diff --git a/.cvsignore b/.cvsignore deleted file mode 100644 index 1e493134b1d0e347e56f614031bec75ab95bf63d..0000000000000000000000000000000000000000 --- a/.cvsignore +++ /dev/null @@ -1,8 +0,0 @@ -configure -missing -install-sh -mkinstalldirs -aclocal.m4 -.deps -generated_lists -buildmk.stamp diff --git a/.gdbinit b/.gdbinit deleted file mode 100644 index 564d9c3a2556a116fc13759df953f589240cad43..0000000000000000000000000000000000000000 --- a/.gdbinit +++ /dev/null @@ -1,28 +0,0 @@ -# gdb macros which may be useful for folks using gdb to debug -# apache. Delete it if it bothers you. - -define dump_table - set $t = (table_entry *)((array_header *)$arg0)->elts - set $n = ((array_header *)$arg0)->nelts - set $i = 0 - while $i < $n - printf "[%u] '%s'='%s'\n", $i, $t[$i].key, $t[$i].val - set $i = $i + 1 - end -end -document dump_table - Print the key/value pairs in a table. -end - -define dump_string_array - set $a = (char **)((array_header *)$arg0)->elts - set $n = (int)((array_header *)$arg0)->nelts - set $i = 0 - while $i < $n - printf "[%u] '%s'\n", $i, $a[$i] - set $i = $i + 1 - end -end -document dump_string_array - Print all of the elements in an array of strings. -end diff --git a/ABOUT_APACHE b/ABOUT_APACHE deleted file mode 100644 index 696a87bd54621b84c13195ca410fe9923f5abced..0000000000000000000000000000000000000000 --- a/ABOUT_APACHE +++ /dev/null @@ -1,266 +0,0 @@ - - The Apache HTTP Server Project - - http://www.apache.org/httpd - - July 2000 - -The Apache Project is a collaborative software development effort aimed -at creating a robust, commercial-grade, featureful, and freely-available -source code implementation of an HTTP (Web) server. The project is -jointly managed by a group of volunteers located around the world, using -the Internet and the Web to communicate, plan, and develop the server and -its related documentation. These volunteers are known as the Apache Group. -In addition, hundreds of users have contributed ideas, code, and -documentation to the project. This file is intended to briefly describe -the history of the Apache Group, recognize the many contributors, and -explain how you can join the fun too. - -In February of 1995, the most popular server software on the Web was the -public domain HTTP daemon developed by Rob McCool at the National Center -for Supercomputing Applications, University of Illinois, Urbana-Champaign. -However, development of that httpd had stalled after Rob left NCSA in -mid-1994, and many webmasters had developed their own extensions and bug -fixes that were in need of a common distribution. A small group of these -webmasters, contacted via private e-mail, gathered together for the purpose -of coordinating their changes (in the form of "patches"). Brian Behlendorf -and Cliff Skolnick put together a mailing list, shared information space, -and logins for the core developers on a machine in the California Bay Area, -with bandwidth and diskspace donated by HotWired and Organic Online. -By the end of February, eight core contributors formed the foundation -of the original Apache Group: - - Brian Behlendorf Roy T. Fielding Rob Hartill - David Robinson Cliff Skolnick Randy Terbush - Robert S. Thau Andrew Wilson - -with additional contributions from - - Eric Hagberg Frank Peters Nicolas Pioch - -Using NCSA httpd 1.3 as a base, we added all of the published bug fixes -and worthwhile enhancements we could find, tested the result on our own -servers, and made the first official public release (0.6.2) of the Apache -server in April 1995. By coincidence, NCSA restarted their own development -during the same period, and Brandon Long and Beth Frank of the NCSA Server -Development Team joined the list in March as honorary members so that the -two projects could share ideas and fixes. - -The early Apache server was a big hit, but we all knew that the codebase -needed a general overhaul and redesign. During May-June 1995, while -Rob Hartill and the rest of the group focused on implementing new features -for 0.7.x (like pre-forked child processes) and supporting the rapidly growing -Apache user community, Robert Thau designed a new server architecture -(code-named Shambhala) which included a modular structure and API for better -extensibility, pool-based memory allocation, and an adaptive pre-forking -process model. The group switched to this new server base in July and added -the features from 0.7.x, resulting in Apache 0.8.8 (and its brethren) -in August. - -After extensive beta testing, many ports to obscure platforms, a new set -of documentation (by David Robinson), and the addition of many features -in the form of our standard modules, Apache 1.0 was released on -December 1, 1995. - -Less than a year after the group was formed, the Apache server passed -NCSA's httpd as the #1 server on the Internet. - -The survey by Netcraft (http://www.netcraft.com/survey/) shows that Apache -is today more widely used than all other web servers combined. - - ============================================================================ - -Current Apache Group in alphabetical order as of 27 July 2000: - - Brian Behlendorf Collab.Net, California - Ryan Bloom Covalent Technologies, California - Ken Coar IBM Corporation, Research Triangle Park, NC, USA - Mark J. Cox Red Hat, England - Lars Eilebrecht CyberSolutions, Munich, Germany - Ralf S. Engelschall Munich, Germany. - Roy T. Fielding eBuilt, California - Tony Finch Covalent Technologies, California - Dean Gaudet Transmeta Corporation, California - Dirk-Willem van Gulik Covalent Technologies, California - Brian Havard Australia - Ben Hyde Gensym, Massachusetts - Jim Jagielski jaguNET Access Services, Maryland - Manoj Kasichainula Collab.Net, California - Alexei Kosut Stanford University, California - Martin Kraemer Munich, Germany - Ben Laurie Freelance Consultant, UK - Rasmus Lerdorf Linuxcare, California - Daniel Lopez Ridruejo Covalent Technologies, California - Doug MacEachern Covalent Technologies, California - Aram W. Mirzadeh CableVision, New York - Chuck Murcko The Topsail Group, Pennsylvania - Sameer Parekh California - David Reid UK - William A. Rowe, Jr. Freelance Consultant, Chicago area - Wilfredo Sanchez Apple Computer, California - Cliff Skolnick California - Marc Slemko Canada - Greg Stein California - Bill Stoddard IBM Corporation, Research Triangle Park, NC - Paul Sutton Seattle - Randy Terbush Covalent Technologies, California - -Apache Emeritus (old group members now off doing other things) - - Rob Hartill Internet Movie DB, UK - David Robinson Cambridge University, UK - Robert S. Thau MIT, Massachusetts - Andrew Wilson Freelance Consultant, UK - -Other major contributors - - Howard Fear (mod_include), Florent Guillaume (language negotiation), - Koen Holtman (rewrite of mod_negotiation), - Kevin Hughes (creator of all those nifty icons), - Brandon Long and Beth Frank (NCSA Server Development Team, post-1.3), - Ambarish Malpani (Beginning of the NT port), - Rob McCool (original author of the NCSA httpd 1.3), - Paul Richards (convinced the group to use remote CVS after 1.0), - Garey Smiley (OS/2 port), Henry Spencer (author of the regex library). - -Many 3rd-party modules, frequently used and recommended, are also -freely-available and linked from the related projects page: -, and their authors frequently -contribute ideas, patches, and testing. - -Hundreds of people have made individual contributions to the Apache -project. Patch contributors are listed in the src/CHANGES file. -Frequent contributors have included Petr Lampa, Tom Tromey, James H. -Cloos Jr., Ed Korthof, Nathan Neulinger, Jason S. Clary, Jason A. Dour, -Michael Douglass, Tony Sanders, Brian Tao, Michael Smith, Adam Sussman, -Nathan Schrenk, Matthew Gray, and John Heidemann. - - ============================================================================ - -How to become involved in the Apache project - -There are several levels of contributing. If you just want to send -in an occasional suggestion/fix, then you can just use the bug reporting -form at . You can also subscribe -to the announcements mailing list (apache-announce@apache.org) which we -use to broadcast information about new releases, bugfixes, and upcoming -events. There's a lot of information about the development process (much -of it in serious need of updating) to be found at . - -If you'd like to become an active contributor to the Apache project (the -group of volunteers who vote on changes to the distributed server), then -you need to start by subscribing to the new-httpd@apache.org mailing list. -One warning though: traffic is high, 1000 to 1500 messages/month. -To subscribe to the list, send "subscribe new-httpd" in the body of -a message to . We recommend reading the list for -a while before trying to jump in to development. - - NOTE: The developer mailing list (new-httpd@apache.org) is not - a user support forum; it is for people actively working on development - of the server code and documentation, and for planning future - directions. If you have user/configuration questions, send them - to the USENET newsgroup "comp.infosystems.www.servers.unix". - -There is a core group of contributors (informally called the "core") -which was formed from the project founders and is augmented from time -to time when core members nominate outstanding contributors and the -rest of the core members agree. The core group focus is more on -"business" issues and limited-circulation things like security problems -than on mainstream code development. The term "The Apache Group" -technically refers to this core of project contributors. - -The Apache project is a meritocracy -- the more work you have done, the more -you are allowed to do. The group founders set the original rules, but -they can be changed by vote of the active members. There is a group -of people who have logins on our server (apache.org) and access to the -CVS repository. Everyone has access to the CVS snapshots. Changes to -the code are proposed on the mailing list and usually voted on by active -members -- three +1 (yes votes) and no -1 (no votes, or vetoes) are needed -to commit a code change during a release cycle; docs are usually committed -first and then changed as needed, with conflicts resolved by majority vote. - -Our primary method of communication is our mailing list. Approximately 40 -messages a day flow over the list, and are typically very conversational in -tone. We discuss new features to add, bug fixes, user problems, developments -in the web server community, release dates, etc. The actual code development -takes place on the developers' local machines, with proposed changes -communicated using a patch (output of a unified "diff -u oldfile newfile" -command), and committed to the source repository by one of the core -developers using remote CVS. Anyone on the mailing list can vote on a -particular issue, but we only count those made by active members or people -who are known to be experts on that part of the server. Vetoes must be -accompanied by a convincing explanation. - -New members of the Apache Group are added when a frequent contributor is -nominated by one member and unanimously approved by the voting members. -In most cases, this "new" member has been actively contributing to the -group's work for over six months, so it's usually an easy decision. - -The above describes our past and current (as of July 2000) guidelines, -which will probably change over time as the membership of the group -changes and our development/coordination tools improve. - - ============================================================================ - -The Apache Software Foundation (www.apache.org) - -The Apache Software Foundation exists to provide organizational, legal, -and financial support for the Apache open-source software projects. -Founded in June 1999 by the Apache Group, the Foundation has been -incorporated as a membership-based, not-for-profit corporation in order -to ensure that the Apache projects continue to exist beyond the participation -of individual volunteers, to enable contributions of intellectual property -and funds on a sound basis, and to provide a vehicle for limiting legal -exposure while participating in open-source software projects. - -You are invited to participate in The Apache Software Foundation. We welcome -contributions in many forms. Our membership consists of those individuals -who have demonstrated a commitment to collaborative open-source software -development through sustained participation and contributions within the -Foundation's projects. Many people and companies have contributed towards -the success of the Apache projects. - - ============================================================================ - -Why Apache Is Free - -Apache exists to provide a robust and commercial-grade reference -implementation of the HTTP protocol. It must remain a platform upon which -individuals and institutions can build reliable systems, both for -experimental purposes and for mission-critical purposes. We believe the -tools of online publishing should be in the hands of everyone, and -software companies should make their money providing value-added services -such as specialized modules and support, amongst other things. We realize -that it is often seen as an economic advantage for one company to "own" a -market - in the software industry that means to control tightly a -particular conduit such that all others must pay. This is typically done -by "owning" the protocols through which companies conduct business, at the -expense of all those other companies. To the extent that the protocols of -the World Wide Web remain "unowned" by a single company, the Web will -remain a level playing field for companies large and small. Thus, -"ownership" of the protocol must be prevented, and the existence of a -robust reference implementation of the protocol, available absolutely for -free to all companies, is a tremendously good thing. - -Furthermore, Apache is an organic entity; those who benefit from it -by using it often contribute back to it by providing feature enhancements, -bug fixes, and support for others in public newsgroups. The amount of -effort expended by any particular individual is usually fairly light, but -the resulting product is made very strong. This kind of community can -only happen with freeware -- when someone pays for software, they usually -aren't willing to fix its bugs. One can argue, then, that Apache's -strength comes from the fact that it's free, and if it were made "not -free" it would suffer tremendously, even if that money were spent on a -real development team. - -We want to see Apache used very widely -- by large companies, small -companies, research institutions, schools, individuals, in the intranet -environment, everywhere -- even though this may mean that companies who -could afford commercial software, and would pay for it without blinking, -might get a "free ride" by using Apache. We would even be happy if some -commercial software companies completely dropped their own HTTP server -development plans and used Apache as a base, with the proper attributions -as described in the LICENSE file. - -Thanks for using Apache! - diff --git a/Apache.dsp b/Apache.dsp deleted file mode 100644 index bbb644ded95ea029c354f2ed2a33cee1c3bebfe5..0000000000000000000000000000000000000000 --- a/Apache.dsp +++ /dev/null @@ -1,109 +0,0 @@ -# Microsoft Developer Studio Project File - Name="Apache" - Package Owner=<4> -# Microsoft Developer Studio Generated Build File, Format Version 5.00 -# ** DO NOT EDIT ** - -# TARGTYPE "Win32 (x86) Console Application" 0x0103 - -CFG=Apache - Win32 Release -!MESSAGE This is not a valid makefile. To build this project using NMAKE, -!MESSAGE use the Export Makefile command and run -!MESSAGE -!MESSAGE NMAKE /f "Apache.mak". -!MESSAGE -!MESSAGE You can specify a configuration when running NMAKE -!MESSAGE by defining the macro CFG on the command line. For example: -!MESSAGE -!MESSAGE NMAKE /f "Apache.mak" CFG="Apache - Win32 Release" -!MESSAGE -!MESSAGE Possible choices for configuration are: -!MESSAGE -!MESSAGE "Apache - Win32 Release" (based on "Win32 (x86) Console Application") -!MESSAGE "Apache - Win32 Debug" (based on "Win32 (x86) Console Application") -!MESSAGE - -# Begin Project -# PROP Scc_ProjName "" -# PROP Scc_LocalPath "" -CPP=cl.exe -RSC=rc.exe - -!IF "$(CFG)" == "Apache - Win32 Release" - -# PROP BASE Use_MFC 0 -# PROP BASE Use_Debug_Libraries 0 -# PROP BASE Output_Dir ".\ApacheLa" -# PROP BASE Intermediate_Dir ".\ApacheLa" -# PROP BASE Target_Dir "" -# PROP Use_MFC 0 -# PROP Use_Debug_Libraries 0 -# PROP Output_Dir ".\ApacheR" -# PROP Intermediate_Dir ".\ApacheR" -# PROP Ignore_Export_Lib 0 -# PROP Target_Dir "" -# ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /YX /c -# ADD CPP /nologo /MD /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /YX /FD /c -# ADD BASE RSC /l 0x809 /d "NDEBUG" -# ADD RSC /l 0x809 /d "NDEBUG" -BSC32=bscmake.exe -# ADD BASE BSC32 /nologo -# ADD BSC32 /nologo -LINK32=link.exe -# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /machine:I386 -# ADD LINK32 CoreR\ApacheCore.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib /nologo /subsystem:console /machine:I386 - -!ELSEIF "$(CFG)" == "Apache - Win32 Debug" - -# PROP BASE Use_MFC 0 -# PROP BASE Use_Debug_Libraries 1 -# PROP BASE Output_Dir ".\ApacheL0" -# PROP BASE Intermediate_Dir ".\ApacheL0" -# PROP BASE Target_Dir "" -# PROP Use_MFC 0 -# PROP Use_Debug_Libraries 1 -# PROP Output_Dir ".\ApacheD" -# PROP Intermediate_Dir ".\ApacheD" -# PROP Ignore_Export_Lib 0 -# PROP Target_Dir "" -# ADD BASE CPP /nologo /W3 /Gm /GX /Zi /Od /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /YX /c -# ADD CPP /nologo /MDd /W3 /Gm /GX /Zi /Od /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /YX /FD /c -# ADD BASE RSC /l 0x809 /d "_DEBUG" -# ADD RSC /l 0x809 /d "_DEBUG" -BSC32=bscmake.exe -# ADD BASE BSC32 /nologo -# ADD BSC32 /nologo -LINK32=link.exe -# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /debug /machine:I386 -# ADD LINK32 CoreD\ApacheCore.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib /nologo /subsystem:console /debug /machine:I386 - -!ENDIF - -# Begin Target - -# Name "Apache - Win32 Release" -# Name "Apache - Win32 Debug" -# Begin Group "Source Files" - -# PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;hpj;bat;for;f90" -# Begin Source File - -SOURCE=.\os\win32\main_win32.c -# End Source File -# End Group -# Begin Group "Header Files" - -# PROP Default_Filter "h;hpp;hxx;hm;inl;fi;fd" -# End Group -# Begin Group "Resource Files" - -# PROP Default_Filter "ico;cur;bmp;dlg;rc2;rct;bin;cnt;rtf;gif;jpg;jpeg;jpe" -# Begin Source File - -SOURCE=.\os\win32\apache.ico -# End Source File -# Begin Source File - -SOURCE=.\os\win32\apache.rc -# End Source File -# End Group -# End Target -# End Project diff --git a/Apache.dsw b/Apache.dsw deleted file mode 100644 index 7f33c59a9e9ebdb9815a544ae6f5fc3728a8545a..0000000000000000000000000000000000000000 --- a/Apache.dsw +++ /dev/null @@ -1,460 +0,0 @@ -Microsoft Developer Studio Workspace File, Format Version 5.00 -# WARNING: DO NOT EDIT OR DELETE THIS WORKSPACE FILE! - -############################################################################### - -Project: "Apache"=".\Apache.dsp" - Package Owner=<4> - -Package=<5> -{{{ -}}} - -Package=<4> -{{{ - Begin Project Dependency - Project_Dep_Name ApacheCore - End Project Dependency - Begin Project Dependency - Project_Dep_Name aprlibdll - End Project Dependency -}}} - -############################################################################### - -Project: "ApacheCore"=".\ApacheCore.dsp" - Package Owner=<4> - -Package=<5> -{{{ -}}} - -Package=<4> -{{{ - Begin Project Dependency - Project_Dep_Name ap - End Project Dependency - Begin Project Dependency - Project_Dep_Name aprlibdll - End Project Dependency - Begin Project Dependency - Project_Dep_Name regex - End Project Dependency - Begin Project Dependency - Project_Dep_Name gen_test_char - End Project Dependency - Begin Project Dependency - Project_Dep_Name gen_uri_delims - End Project Dependency -}}} - -############################################################################### - -Project: "ApacheModuleAuthAnon"=".\os\win32\ApacheModuleAuthAnon.dsp" - Package Owner=<4> - -Package=<5> -{{{ -}}} - -Package=<4> -{{{ - Begin Project Dependency - Project_Dep_Name ApacheCore - End Project Dependency - Begin Project Dependency - Project_Dep_Name aprlibdll - End Project Dependency -}}} - -############################################################################### - -Project: "ApacheModuleCERNMeta"=".\os\win32\ApacheModuleCERNMeta.dsp" - Package Owner=<4> - -Package=<5> -{{{ -}}} - -Package=<4> -{{{ - Begin Project Dependency - Project_Dep_Name ApacheCore - End Project Dependency - Begin Project Dependency - Project_Dep_Name aprlibdll - End Project Dependency -}}} - -############################################################################### - -Project: "ApacheModuleDigest"=".\os\win32\ApacheModuleDigest.dsp" - Package Owner=<4> - -Package=<5> -{{{ -}}} - -Package=<4> -{{{ - Begin Project Dependency - Project_Dep_Name ApacheCore - End Project Dependency - Begin Project Dependency - Project_Dep_Name aprlibdll - End Project Dependency -}}} - -############################################################################### - -Project: "ApacheModuleExpires"=".\os\win32\ApacheModuleExpires.dsp" - Package Owner=<4> - -Package=<5> -{{{ -}}} - -Package=<4> -{{{ - Begin Project Dependency - Project_Dep_Name ApacheCore - End Project Dependency - Begin Project Dependency - Project_Dep_Name aprlibdll - End Project Dependency -}}} - -############################################################################### - -Project: "ApacheModuleHeaders"=".\os\win32\ApacheModuleHeaders.dsp" - Package Owner=<4> - -Package=<5> -{{{ -}}} - -Package=<4> -{{{ - Begin Project Dependency - Project_Dep_Name ApacheCore - End Project Dependency - Begin Project Dependency - Project_Dep_Name aprlibdll - End Project Dependency -}}} - -############################################################################### - -Project: "ApacheModuleInfo"=".\os\win32\ApacheModuleInfo.dsp" - Package Owner=<4> - -Package=<5> -{{{ -}}} - -Package=<4> -{{{ - Begin Project Dependency - Project_Dep_Name ApacheCore - End Project Dependency - Begin Project Dependency - Project_Dep_Name aprlibdll - End Project Dependency -}}} - -############################################################################### - -Project: "ApacheModuleProxy"=".\modules\proxy\ApacheModuleProxy.dsp" - Package Owner=<4> - -Package=<5> -{{{ -}}} - -Package=<4> -{{{ - Begin Project Dependency - Project_Dep_Name ApacheCore - End Project Dependency - Begin Project Dependency - Project_Dep_Name aprlibdll - End Project Dependency -}}} - -############################################################################### - -Project: "ApacheModuleRewrite"=".\os\win32\ApacheModuleRewrite.dsp" - Package Owner=<4> - -Package=<5> -{{{ -}}} - -Package=<4> -{{{ - Begin Project Dependency - Project_Dep_Name ApacheCore - End Project Dependency - Begin Project Dependency - Project_Dep_Name aprlibdll - End Project Dependency -}}} - -############################################################################### - -Project: "ApacheModuleSpeling"=".\os\win32\ApacheModuleSpeling.dsp" - Package Owner=<4> - -Package=<5> -{{{ -}}} - -Package=<4> -{{{ - Begin Project Dependency - Project_Dep_Name ApacheCore - End Project Dependency - Begin Project Dependency - Project_Dep_Name aprlibdll - End Project Dependency -}}} - -############################################################################### - -Project: "ApacheModuleStatus"=".\os\win32\ApacheModuleStatus.dsp" - Package Owner=<4> - -Package=<5> -{{{ -}}} - -Package=<4> -{{{ - Begin Project Dependency - Project_Dep_Name ApacheCore - End Project Dependency - Begin Project Dependency - Project_Dep_Name aprlibdll - End Project Dependency -}}} - -############################################################################### - -Project: "ApacheModuleUserTrack"=".\os\win32\ApacheModuleUserTrack.dsp" - Package Owner=<4> - -Package=<5> -{{{ -}}} - -Package=<4> -{{{ - Begin Project Dependency - Project_Dep_Name ApacheCore - End Project Dependency - Begin Project Dependency - Project_Dep_Name aprlibdll - End Project Dependency -}}} - -############################################################################### - -Project: "InstallBin"=".\InstallBin.dsp" - Package Owner=<4> - -Package=<5> -{{{ -}}} - -Package=<4> -{{{ - Begin Project Dependency - Project_Dep_Name Apache - End Project Dependency - Begin Project Dependency - Project_Dep_Name ApacheCore - End Project Dependency - Begin Project Dependency - Project_Dep_Name ApacheModuleAuthAnon - End Project Dependency - Begin Project Dependency - Project_Dep_Name ApacheModuleCERNMeta - End Project Dependency - Begin Project Dependency - Project_Dep_Name ApacheModuleDigest - End Project Dependency - Begin Project Dependency - Project_Dep_Name ApacheModuleExpires - End Project Dependency - Begin Project Dependency - Project_Dep_Name ApacheModuleHeaders - End Project Dependency - Begin Project Dependency - Project_Dep_Name ApacheModuleRewrite - End Project Dependency - Begin Project Dependency - Project_Dep_Name ApacheModuleSpeling - End Project Dependency - Begin Project Dependency - Project_Dep_Name ApacheModuleStatus - End Project Dependency - Begin Project Dependency - Project_Dep_Name ApacheModuleUserTrack - End Project Dependency - Begin Project Dependency - Project_Dep_Name aprlibdll - End Project Dependency - Begin Project Dependency - Project_Dep_Name htpasswd - End Project Dependency - Begin Project Dependency - Project_Dep_Name rotatelogs - End Project Dependency -}}} - -############################################################################### - -Project: "ap"=".\ap\ap.dsp" - Package Owner=<4> - -Package=<5> -{{{ -}}} - -Package=<4> -{{{ -}}} - -############################################################################### - -Project: "aprlib"=".\lib\apr\aprlib.dsp" - Package Owner=<4> - -Package=<5> -{{{ -}}} - -Package=<4> -{{{ -}}} - -############################################################################### - -Project: "aprlibdll"=".\lib\apr\aprlibdll.dsp" - Package Owner=<4> - -Package=<5> -{{{ -}}} - -Package=<4> -{{{ - Begin Project Dependency - Project_Dep_Name aprlib - End Project Dependency -}}} - -############################################################################### - -Project: "gen_test_char"=".\main\gen_test_char.dsp" - Package Owner=<4> - -Package=<5> -{{{ -}}} - -Package=<4> -{{{ -}}} - -############################################################################### - -Project: "gen_uri_delims"=".\main\gen_uri_delims.dsp" - Package Owner=<4> - -Package=<5> -{{{ -}}} - -Package=<4> -{{{ -}}} - -############################################################################### - -Project: "htdigest"=".\support\htdigest.dsp" - Package Owner=<4> - -Package=<5> -{{{ -}}} - -Package=<4> -{{{ - Begin Project Dependency - Project_Dep_Name aprlib - End Project Dependency -}}} - -############################################################################### - -Project: "htpasswd"=".\support\htpasswd.dsp" - Package Owner=<4> - -Package=<5> -{{{ -}}} - -Package=<4> -{{{ - Begin Project Dependency - Project_Dep_Name ap - End Project Dependency - Begin Project Dependency - Project_Dep_Name aprlib - End Project Dependency -}}} - -############################################################################### - -Project: "install"=".\os\win32\installer\installdll\install.dsp" - Package Owner=<4> - -Package=<5> -{{{ -}}} - -Package=<4> -{{{ - Begin Project Dependency - Project_Dep_Name aprlib - End Project Dependency -}}} - -############################################################################### - -Project: "logresolve"=".\support\logresolve.dsp" - Package Owner=<4> - -Package=<5> -{{{ -}}} - -Package=<4> -{{{ -}}} - -############################################################################### - -Project: "regex"=".\regex\regex.dsp" - Package Owner=<4> - -Package=<5> -{{{ -}}} - -Package=<4> -{{{ -}}} - -############################################################################### - -Project: "rotatelogs"=".\support\rotatelogs.dsp" - Package Owner=<4> - -Package=<5> -{{{ -}}} - -Package=<4> -{{{ -}}} - -############################################################################### - -Global: - -Package=<5> -{{{ -}}} - -Package=<3> -{{{ -}}} - -############################################################################### diff --git a/BuildBin.dsp b/BuildBin.dsp deleted file mode 100644 index 628c7b6d679bc707a49cced305aa38c2febc8715..0000000000000000000000000000000000000000 --- a/BuildBin.dsp +++ /dev/null @@ -1,97 +0,0 @@ -# Microsoft Developer Studio Project File - Name="BuildBin" - Package Owner=<4> -# Microsoft Developer Studio Generated Build File, Format Version 6.00 -# ** DO NOT EDIT ** - -# TARGTYPE "Win32 (x86) External Target" 0x0106 - -CFG=BuildBin - Win32 Debug -!MESSAGE This is not a valid makefile. To build this project using NMAKE, -!MESSAGE use the Export Makefile command and run -!MESSAGE -!MESSAGE NMAKE /f "BuildBin.mak". -!MESSAGE -!MESSAGE You can specify a configuration when running NMAKE -!MESSAGE by defining the macro CFG on the command line. For example: -!MESSAGE -!MESSAGE NMAKE /f "BuildBin.mak" CFG="BuildBin - Win32 Debug" -!MESSAGE -!MESSAGE Possible choices for configuration are: -!MESSAGE -!MESSAGE "BuildBin - Win32 Release" (based on "Win32 (x86) External Target") -!MESSAGE "BuildBin - Win32 Debug" (based on "Win32 (x86) External Target") -!MESSAGE - -# Begin Project -# PROP AllowPerConfigDependencies 0 -# PROP Scc_ProjName "" -# PROP Scc_LocalPath "" - -!IF "$(CFG)" == "BuildBin - Win32 Release" - -# PROP BASE Use_Debug_Libraries 0 -# PROP BASE Output_Dir "" -# PROP BASE Intermediate_Dir "" -# PROP BASE Cmd_Line "NMAKE /f makefile.win" -# PROP BASE Rebuild_Opt "/a" -# PROP BASE Target_File "\Apache2.0\bin\Apache.exe" -# PROP BASE Bsc_Name ".\Browse\BuildBin.bsc" -# PROP BASE Target_Dir "" -# PROP Use_Debug_Libraries 0 -# PROP Output_Dir "" -# PROP Intermediate_Dir "" -# PROP Cmd_Line "NMAKE /f makefile.win INSTDIR="\Apache2" _dummy" -# PROP Rebuild_Opt "" -# PROP Target_File "\Apache2\bin\Apache.exe" -# PROP Bsc_Name ".\Browse\Apache.bsc" -# PROP Target_Dir "" - -!ELSEIF "$(CFG)" == "BuildBin - Win32 Debug" - -# PROP BASE Use_Debug_Libraries 1 -# PROP BASE Output_Dir "" -# PROP BASE Intermediate_Dir "" -# PROP BASE Cmd_Line "NMAKE /f makefile.win" -# PROP BASE Rebuild_Opt "/a" -# PROP BASE Target_File "\Apache2.0\bin\Apache.exe" -# PROP BASE Bsc_Name ".\Browse\BuildBin.bsc" -# PROP BASE Target_Dir "" -# PROP Use_Debug_Libraries 1 -# PROP Output_Dir "" -# PROP Intermediate_Dir "" -# PROP Cmd_Line "NMAKE /f makefile.win INSTDIR="\Apache2" _dummy" -# PROP Rebuild_Opt "" -# PROP Target_File "\Apache2\bin\Apache.exe" -# PROP Bsc_Name ".\Browse\Apache.bsc" -# PROP Target_Dir "" - -!ENDIF - -# Begin Target - -# Name "BuildBin - Win32 Release" -# Name "BuildBin - Win32 Debug" - -!IF "$(CFG)" == "BuildBin - Win32 Release" - -!ELSEIF "$(CFG)" == "BuildBin - Win32 Debug" - -!ENDIF - -# Begin Source File - -SOURCE=.\os\win32\BaseAddr.ref -# End Source File -# Begin Source File - -SOURCE=.\CHANGES -# End Source File -# Begin Source File - -SOURCE=.\Makefile.win -# End Source File -# Begin Source File - -SOURCE=.\STATUS -# End Source File -# End Target -# End Project diff --git a/CHANGES b/CHANGES deleted file mode 100644 index e27eab039b5c75baf0fc7d44e650b925613dfe04..0000000000000000000000000000000000000000 --- a/CHANGES +++ /dev/null @@ -1,8722 +0,0 @@ -Changes with Apache 2.0a9 - - *) Distribution directory structure reorganized to reflect a - normal source distribution with external install targets. - [Roy Fielding] - - *) The MPMs that need multiple segments of shared memory now create - two apr_shmem_t variables, one for each shared memory allocation. - the problem is that we can't determine how much memory will be required - for shared memory allocations once we try to allocate more than one - variable. The MM code automatically aligns the shared memory allocations, - so we end up needing to pad the amount of shared memory we want based - on how many variables will be allocated out of the shared memory segment. - It is just easier to create a second apr_shmem_t variable, and two - shmem memory blocks. - [Ryan Bloom] - - *) Cleanup the export list a bit. This creates a single unified list of - functions exported by APR. The export list is generated at configure - time, and that list is then used to generate the exports.c file. - Because of the way the export list is generated, we only export those - functions that are valid on the platform we are building on. - [Ryan Bloom] - - *) Enable logging the cookie with mod_log_config - [Sander van Zoest ] - - *) Fix a segfault in mod_info when it reaches the end of the configuration. - [Jeff Trawick] - - *) Added lib/aputil/ as a placeholder for utility functions which are not - specific to the Apache HTTP Server (but do not make sense with APR). - The first utility is "apu_dbm": a set of functions to work with DBM - files. This first version can be compiled for SDBM or GDBM databases. - [Greg Stein] - - *) Complete re-write of mod_include. This makes mod_include a filter that - uses buckets directly. This has now served the FAQ correctly. - [Paul Reder ] - - *) Allow modules to specify the first filter in a sub_request when - making the sub_request. This keeps modules from having to change the - output_filter immediately after creating the sub-request, and therefore - skip the sub_req_output_filter. [Ryan Bloom] - - *) Update ab to accept URLs with IPv6 literal address strings (in the - format described in RFC 2732), and to build Host header fields in - the same format. This allows IPv6 literal address strings to be - used with ab. This support has been tested against Apache 1.3 with - the KAME patch, but Apache 2.0 does not yet work with this format - of the Host header field. [Jeff Trawick] - - *) Accomodate an out-of-space condition in the piped logs and the - rotatelogs.c code, and no longer churn log processes for this - condition. [Victor J. Orlikowski] - - *) Add support for partial writes with apr_sendfile() to core_output_filter. - [Greg Ames] - -Changes with Apache 2.0a8 - - *) Add a directive to mod_mime so that filters can be associated with - a given mime-type. - [Ryan Bloom] - - *) Get multi-views working again. We were setting the path_info - field incorrectly if we couldn't find the specified file. - [Ryan Bloom] - - *) Fix 304 processing. The core should never try to send the headers - down the filter stack. Always, just setup the table in the request - record, and let the header filter convert it to data that is ready - for the network. - [Ryan Bloom] - - *) More fixes for the proxy. There are still bugs in the proxy code, - but this has now proxied www.yahoo.com and www.ntrnet.net (my ISP) - successfully. - [Ryan Bloom] - - *) Fix params for apr_getaddrinfo() call in connect proxy handler. - [Chuck Murcko] - - *) APR: Add new apr_getopt_long function to handle long options. - [B. W. Fitzpatrick ] - - *) APR: Change apr_connect() to take apr_sockaddr_t instead of hostname. - Add generic apr_create_socket(). Add apr_getaddrinfo() for doing - hostname resolution/address string parsing and building - apr_sockaddr_t. Add apr_get_sockaddr() for getting the address - of one of the apr_sockaddr_t structures for a socket. Change - apr_bind() to take apr_sockaddr_t. [David Reid and Jeff Trawick] - - *) Remove the BUFF from the HTTP proxy. This is still a bit ugly, but - I have proxied pages with it, cleanup will commence soon. - [Ryan Bloom] - - *) Make the proxy work with filters. This isn't perfect, because we - aren't dealing with the headers properly. [Ryan Bloom] - - *) Do not send a content-length iff the C-L is 0 and this is a head - request. [Ryan Bloom] - - *) Make cgi-bin work as a regular directory when using mod_vhost_alias - with no VirtualScriptAlias directives. PR#6829 [Tony Finch] - - *) Remove BUFF from the PROXY connect handling. [Ryan Bloom] - - *) Get the default_handler to stop trying to deal with HEAD requests. - The idea is to let the content-length filter compute the C-L before - we try to send the data. If we can get the C-L correctly, then we - should send it in the HEAD response. - [Ryan Bloom] - - *) The Header filter can now determine if a body should be sent based - on r->header_only. The general idea of this is that if we delay - deciding to send the body, then we might be able to compute the - content-length correctly, which will help caching proxies to cache - our data better. Any handler that doesn't want to try to compute - the content-length can just send an EOS bucket without data and - everything will just work. - [Ryan Bloom] - - *) Add the referer to the error log if one is available. - [Markus Gyger ] - - *) Mod_info.c has now been ported to Apache 2.0. As a part of this - change, the root of the configuration tree has been exposed to modules - as ap_conftree. - [Ryan Morgan ] - - *) Get the core_output_filter to use the bucket interface directly. - This keeps us from calling the content-length filter multiple times - for a simple static request. - [Ryan Bloom] - - *) We are sending the content-type correctly now. - [Ryan Bloom and Will Rowe] - - *) APR on FreeBSD: Fix a bug in apr_sendfile() which caused us to report - a bogus bytes-sent value when the only thing being sent was trailers - and writev() returned an error (or EAGAIN). [Jeff Trawick] - - *) Get SINGLE_LISTEN_UNSERIALIZED_ACCEPT working again. This uses the - hints file to determine which platforms define - SINGLE_LISTEN_UNSERIALIZED_ACCEPT. - [Ryan Bloom] - - *) APR: add apr_get_home_directory() [Jeff Trawick] - - *) Initial import of 1.3-current mod_proxy. [Chuck Murcko] - - *) Not all platforms have INADDR_NONE defined by default. Apache - used to make this check and define INADDR_NONE if appropriate, - but APR needs the check too, and I suspect other applications will - as well. APR now defines APR_INADDR_NONE, which is always a valid - value on all platforms. - [Branko Èibej ] - - *) Destroy the pthread mutex in lock_intra_cleanup() for PR#6824. - [Shuichi Kitaguchi ] - - *) Relax the syntax checking of Host: headers in order to support - iDNS. PR#6635 [Tony Finch] - - *) When reading from file buckets we convert to an MMAP if it makes - sense. This also simplifies the default handler because the - default handler no longer needs to try to create MMAPs. - [Ryan Bloom] - - *) BUFF has been removed from the main server. The BUFF code will remain - in the code until it has been purged from the proxy module as well. - [Ryan Bloom] - - *) Byteranges have been completely re-written to be a filter. This - has been tested, and I believe it is working correctly, but it could - doesn't work for the Adobe Acrobat plug-in. The output almost matches - the output from 1.3, the only difference being that 1.3 includes - a content-length in the response, and this does not. - [Ryan Bloom] - - *) APR read/write functions and bucket read functions now operate - on unsigned integers, instead of signed ones. It doesn't make - any sense to use signed ints, because we return the error codes, - so if we have an error we should report 0 bytes read or written. - [Ryan Bloom] - - *) Always compute the content length, whether it is sent or not. - The reason for this, is that it allows us to correctly report - the bytes_sent when logging the request. This also simplifies - content-length filter a bit, and fixes the actual byte-reporing - code in mod_log_config.c - [Ryan Bloom] - - *) Remove AP_END_OF_BRIGADE definition. This does not signify what - it says, because it was only used by EOS and FLUSH buckets. Since - neither of those are required at the end of a brigade, this was - really signifying FLUSH_THE_DATA, but that can be determined better - by checking AP_BUCKET_IS_EOS() or AP_BUCKET_IS_FLUSH. EOS and FLUSH - buckets now return a length of 0, which is actually the amount of data - read, so they make more sense. - [Ryan Bloom] - - *) Allow the core_output_filter to save some data past the end of a - request. If we get an EOS bucket, we only send the data if it - makes sense to send it. This allows us to pipeline request - responses. As a part of this, we also need to allocate mmap - buckets out of the connection pool, not the request pool. This - allows the mmap to outlive the request. - [Ryan Bloom] - - *) Make blocking and non-blocking bucket reads work correctly for - sockets and pipes. These are the only bucket types that should - have non-blocking reads, because the other bucket types should - ALWAYS be able to return something immediately. - [Ryan Bloom] - - *) In the Apache/Win32 console window, accept Ctrl+C to stop the - server, but use Ctrl+Break to initiate a graceful restart - instead of duplicating behavior. [John Sterling] - - *) Patch mod_autoindex to set the Last-Modified header based on - the directory's mtime, and add the ETag header. [William Rowe] - - *) Merge the 1.3 patch to add support for logging query string in - such a way that "%m %U%q %H" is the same as "%r". - [Bill Stoddard] - - *) Port three log methods from mod_log_config 1.3 to 2.0: - CLF compliant '-' byte count, method and protocol. - [Bill Stoddard] - - *) Add a new LogFormat directive, %c, that will log connection - status at the end of the response as follows: - 'X' - connection aborted before the response completed. - '+' - connection may be kept-alive by the server. - '-' - connection will be closed by the server. - [Bill Stoddard] - - *) Expand APR for WinNT to fully accept and return utf-8 encoded - Unicode file names and paths for Win32, and tag the Content-Type - from mod_autoindex to reflect that charset if the the feature - macro APR_HAS_UNICODE_FS is true. [William Rowe] - - *) Compute the content length (and add appropriate header field) for - the response when no content length is available and we can't use - chunked encoding. [Jeff Trawick] - - *) Changed ap_discard_request_body() to use REQUEST_CHUNKED_DECHUNK, - so that content input filters get dechunked data when using - the default handler. Also removed REQUEST_CHUNKED_PASS. - [Sascha Schumann] - - *) Add mod_ext_filter as an experimental module. This module allows - the administrator to use external programs as filters. Currently, - only filtering of output is supported. [Jeff Trawick] - - *) Most Apache functions work on EBCDIC machines again, as protocol - data is now translated (again). [Jeff Trawick] - - *) Introduce ap_xlate_proto_{to|from}_ascii() to clean up some of - the EBCDIC support. They are noops on ASCII machines, so this - type of translation doesn't have to be surrounded by #ifdef - CHARSET_EBCDIC. [Jeff Trawick] - - *) Fix mod_include. tag commands work again, and the server will - send the FAQ again. This also allows mod_include to set aside - buckets that include partial buckets. - [Ryan Bloom and David Reid] - - *) Add suexec support back. [Manoj Kasichainula] - - *) Lingering close now uses the socket directly instead of using - BUFF. This has been tested, but since all we can tell is that it - doesn't fail, this needs to be really hacked on. - [Ryan Bloom] - - *) Allow filters to modify headers and have those headers be sent to - the client. The idea is that we have an http_header filter that - actually sends the headers to the network. This removes the need - for the BUFF to send headers. - [Ryan Bloom] - - *) Charset translation: mod_charset_lite handles translation of - request bodies. Get rid of the xlate version of ap_md5_digest() - since we don't compute digests of filtered (e.g., translated) - response bodies this way anymore. (Note that we don't do it at - all at the present; somebody needs to write a filter to do so.) - [Jeff Trawick] - - *) Input filters and ap_get_brigade() now have a input mode parameter - (blocking, non-blocking, peek) instead of a length parameter. - [hackathon] - - *) Update the mime.types file to the registered media types as - of 2000-10-19. PR#6613 [Carsten Klapp , - Tony Finch] - - *) Namespace protect some macros declared in ap_config.h - [Ryan Bloom] - - *) Support HTTP header line folding with input filtering. - [Greg Ames] - - *) Mod_include works again. This should still be re-written, but at - least now we can serve an SHTML page again. - [Ryan Bloom] - - *) Begin to remove BUFF from the core. Currently, we keep a pointer - to both the BUFF and the socket in the conn_rec. Functions that - want to use the BUFF can, functions that want to use the socket, - can. They point to the same place. - [Ryan Bloom] - - *) apr_psprintf doesn't understand %lld as a format. Make it %ld. - [Tomas "Ögren" ] - - *) APR pipes on Unix and Win32 are now cleaned up automatically when the - associated pool goes away. (APR pipes on OS/2 were already had this - logic.) This resolvs a fatal file descriptor leak with CGIs. - [Jeff Trawick] - - *) The final line of the config file was not being read if there was - no \n at the end of it. This was caused by apr_fgets returning - APR_EOF even though we had read valid data. This is solved by - making cfg_getline check the buff that was returned from apr_fgets. - If apr_fgets return APR_EOF, but there was data in the buf, then we - return the buf, otherwise we return NULL. - [Ryan Bloom] - - *) Piped logs work again in the 2.0 series. - [Ryan Bloom] - - *) Restore functionality broken by the mod_rewrite security fix: - rewrite map lookup keys and default values are now expanded - so that the lookup can depend on the requested URI etc. - PR #6671 [Tony Finch] - - *) Tighten up the syntax checking of Host: headers to fix a - security bug in some mass virtual hosting configurations - that can allow a remote attacker to retrieve some files - on the system that should be inaccessible. [Tony Finch] - - *) Add a pool bucket type. This bucket is used for data allocated out - of a pool. If the pool is cleaned before the bucket is destroyed, then - the data is converted to a heap bucket, allowing it to survive the - death of the pool. - [Ryan Bloom] - - *) Add a flush bucket. This allows modules to signal that the filters - should all flush whatever data they currently have. There is no way - to actually force them to do this, so if a filter ignores this bucket, - that's life, but at least we can try with this. - [Ryan Bloom] - - *) Add an output filter for sub-requests. This filter just strips the - EOS bucket so that we don't confuse the main request's core output - filter by sending multiple EOS buckets. This change also makes sub - requests start to send EOS buckets when they are finished. - [Ryan Bloom] - - *) Make ap_bucket_(read|destroy|split|setaside) into macros. Also - makes ap_bucket_destroy a return void, which is okay because it - used to always return APR_SUCCESS, and nobody ever checked its - return value anyway. - [Cliff Woolley ] - - *) Remove the index into the bucket-type table from the buckets - structure. This has now been replaced with a pointer to the - bucket_type. Also add some macros to test the bucket-type. - [Ryan Bloom] - - *) Renamed all MODULE_EXPORT symbols to AP_MODULE_DECLARE and all symbols - for CORE_EXPORT to AP_CORE_DECLARE (namespace protecting the wrapper) - and retitled API_EXPORT as AP_DECLARE and APR_EXPORT as APR_DECLARE. - All _VAR_ flavors changes to _DATA to be absolutely clear. - [William Rowe] - - *) Add support for /, //, //servername and //server/sharename - parsing of blocks under Win32 and OS2. - [Tim Costello, William Rowe, Brian Harvard] - - *) Remove the function pointers from the ap_bucket type. They have been - replaced with a global table. Modules are allowed to register bucket - types and use then use those buckets. - [Ryan Bloom] - - *) mod_cgid: In the handler, shut down the Unix socket (only for write) - once we finish writing the request body to the cgi child process; - otherwise, the client doesn't hit EOF on stdin. Small request bodies - worked without this change (for reasons I don't understand), but large - ones didn't. [Jeff Trawick] - - *) Remove file bucket specific information from the ap_bucket type. - This has been moved to a file_bucket specific type that hangs off - the data pointer in the ap_bucket type. - [Ryan Bloom] - - *) Input filtering now has a third argument. This is the amount of data - to read from lower filters. This argument can be -1, 0, or a positive - number. -1 means give me all the data you have, I'll deal with it and - let you know if I need more. 0 means give me one line and one line - only. A positive number means I want no more than this much data. - - Currently, only 0 and a positive number are implemented. This allows - us to remove the remaining field from the conn_rec structure, which - has also been done. - [Ryan Bloom] - - *) Big cleanup of the input filtering. The goal is that http_filter - understands two conditions, headers and body. It knows where it is - based on c->remaining. If c->remaining is 0, then we are in headers, - and http_filter returns a line at a time. If it is not 0, then we are - in body, and http_filter returns raw data, but only up to c->remaining - bytes. It can return less, but never more. - [Greg Ames, Ryan Bloom, Jeff Trawick] - - *) mod_cgi: Write all of the request body to the child, not just what - the kernel would accept on the first write. [Jeff Trawick] - - *) Back out the change that moved the brigade from the core_output_filters - ctx to the conn_rec. Since all requests over a given connection - go through the same core_output_filter, the ctx pointer has the - correct lifetime. - [Ryan Bloom] - - *) Fix another bug in the send_the_file() read/write loop. A partial - send by apr_send would cause unsent data in the read buffer to - get clobbered. Complete making send_the_file handle partial - writes to the network. - [Bill Stoddard] - - *) Fix a couple of type fixes to allow compilation on AIX again - [Victor J. Orlikowski ] - - *) Fix bug in send_the_file() which causes offset to be ignored - if there are no headers to send. - [Bill Stoddard] - - *) Handle APR_ENOTIMPL returned from apr_sendfile in the core - filter. Useful for supporting Windows 9* with a binary - compiled on Windows NT. - [Bill Stoddard] - -Changes with Apache 2.0a7 - - *) Reimplement core_output_filter to buffer/save bucket brigades - across multiple calls to the core_filter. The brigade will be - sent when either MIN_BYTES_TO_SEND or MAX_IOVEC_TO_WRITE - thresholds are hit or the EOS bucket is received. - [Bill Stoddard] - - *) Create experimental filter (buffer_filter) that coalesces bytes - into one large buffer before invoking the next filter in the - chain. This filter is particularly useful with the current - implementation of mod_autoindex when it inserted above the - chunk_filter. mod_autoindex generates a lot of brigades that - containing buckets holding just a few bytes each. The - buffer_filter coalesces these buckets into a single large bucket. - [Bill Stoddard] - - *) Add apr_sendfile() support into the core_output_filter. - [Bill Stoddard] - - *) Add apr_sendv() support into the core_output_filter. - [Bill Stoddard] - - *) Fix mod_log_config so that it compiles cleanly with BUFFERED_LOGS - [Mike Abbott ] - - *) Remove ap_send_fb. This is no longer used in Apache, and it doesn't - make much sense, because Apache uses buckets instead of BUFFs now. - [Ryan Bloom] - - *) send_the_file now falls back to a read/write loop on platforms that - do not have sendfile. - [Ryan Bloom and Brian Havard] - - *) Install apachectl correctly, and substitute the proper values so - that it works again. [Ryan Bloom] - - *) Better(??) handle platforms that lack sendfile(). - [Jim Jagielski] - - *) APR now has UUID generation/formatting/parsing support. - [Greg Stein] - - *) Begin the http_filter. This is an input filter that understands - the absolute basic amount required to parse an HTTP Request. The - goal is to be able to split headers from request body before passing - the data back to the other filters. - [Ryan Bloom] - - *) Bring forward from 1.3.13 the config directory implementation - [Jim Jagielski] - - *) install apxs if it is created - [Ryan Bloom] - - *) Added APR_IS_STATUS_condition test macros to eliminate canonical error - conversions. [William Rowe] - - *) Now that we have ap_add_input_filter(), rename ap_add_filter() to - ap_add_output_filter(). [Jeff Trawick] - - *) Multiple build and configuration fixes - Build process: - - -add datadir and localstatedir substitutions - -fix layout name - -fix logfilename misspelling - -fix evaluation of installation dir variables and - -replace $foobar by $(foobar) to be usefull in the makefile - - Cross compile: - - -add rules for cross-compiling in rules.mk. Okay, rule to check for - $CC_FOR_BUILD is still missing - -use CHECK_TOOL instead of CHECK_PROG for ranlib - -add missing "AR=@AR@" to severaly Makefile.in's - -cache result for "struct rlimit" - -compile all helper programs with native and cross compiler - and use the native version to generate header file - ["Rüdiger" Kuhlmann ] - - *) Prepare our autoconf setup for autoconf 2.14a and for cross- - compiling. - ["Rüdiger" Kuhlmann ] - - *) Fix a bug where a client which only sends \n to delimit header - lines (netcat) gets a strange looking HTTP_NOT_IMPLEMENTED - message. Start working on ebcdic co-existance with input - filtering. - [William Rowe, Greg Ames] - - *) If mod_so is enabled in the server always create libexec, even - if there are no modules installed in this directory. This is a - requirement for APXS to work correctly. - [Ryan Bloom] - - *) Connection oriented output filters are now stored in the - conn_rec instead of the request_rec. This allows us to add the - output filter in the pre-connection phase instead of the - post_read_request phase, which keeps us from trying to write an - error page before we have a filter to write to the network. - [Ryan Bloom, Jeff Trawick, and Greg Ames] - - *) Cleaning up an mmap bucket no longer deletes the mmap. An - mmap can be used across multiple buckets (default_handler with - byte ranges, mod_file_cache, mod_mmap_static), so cleanup of - the mmap itself can't be associated with the bucket. - [Jeff Trawick] - - *) Add .dll caching directive ISAPICacheFile to mod_isapi. - [William Rowe] - - *) Radical surgery to improve mod_isapi support under Win32. - Includes a number of newer ServerSupportFunction calls, support - for ReadClient (in order to retrieve POSTs greater than 48KB), - and general bug fixes to more reliably load ISAPI .dll's and - prevent leaking handle resources. Note: There are still - discrepancies between IIS's and Apache's ServerVariables, and - async calls are still not supported. Additional warnings are - logged to facilitate debugging of unsupported ISAPI calls. - [William Rowe] - - *) Add input filtering to Apache. The basic idea for the input - filters is the same as the ideas for output filters. The biggest - difference is that instead of calling ap_pass_brigade, ap_get_brigade - should be called, and the order of execution for the filter itself is - different. When writing an output filter, a brigade is passed in, - and filters operate directly on that brigade, when done, they call - ap_pass_brigade. Input filters are the exact opposite. Because input - is not a push operation, filters first call ap_get_brigade. When this - function returns, the input filter will be left with a valid brigade. - The input filter should then operate on the brigade, and return. - [Ryan Bloom] - - *) Fix building on BSD/OS using its native make. The build system - falls back to the BSD .include directive on that host platform. - [Sascha Schumann] - - *) Expand dbmmanage to allow -d -m -s -p options for Crypt, MD5, - SHA1 and plaintext password encodings. Make feature tests a - bit more flexible. [William Rowe] - - *) Charset translation: mod_charset_lite handles output content - translation in a filter. mod_charset_lite no longer ignores - subrequests. A bunch of cruft related to BUFF's support for - translating request and response bodies was removed. - [Jeff Trawick] - - *) Move the addition of the CORE filter to the post_read_request - hook in http_core.c. This removes the need to add the filter in - multiple places and allows for an SSL module to be added much - simpler. [Ryan Bloom] - - *) Fix a security problem that affects certain configurations of - mod_rewrite. If the result of a RewriteRule is a filename that - contains expansion specifiers, especially regexp backreferences - $0..$9 and %0..%9, then it may be possible for an attacker to - access any file on the web server. [Tony Finch] - - *) Fix a bug where errors that are detected during early request parsing - don't produce visible HTTP error messages at the browser, because - the core_filter wasn't present. [Greg Ames] - - *) Provide apr_socklen_t as a portability aid. - [Victor J. Orlikowski] - - *) Overhaul of dbmmanage to allow a groups arg (as in Apache 1.2) - as well as a comment arg to the add, adduser and update cmds. - update allows the user to clear or preserve pw/groups/comment. - Fixed a bug in dbmmanage that prevented the check option from - parsing a password followed by :group... text. Corrected the - seed calcualation for Win32 systems, and added -lsdbm support. - [William Rowe] - - *) Configured mod_auth_dbm to compile with sdbmlib under Win32. - [William Rowe] - - *) Avoid a segfault when parsing .htaccess files. An - uninitialized tree pointer was passed to ap_build_config(). - [Jeff Trawick] - - *) Change the way that inet_addr & inet_network are checked for - in APR's configure process to allow BeOS BONE to correctly - find them. With this change BeOS BONE now builds from source - with no problems. [David Reid] - - *) Fix a bug in apr_create_process() for Unix. The NULL signifying - the end of the parameters to execve() was stored in the wrong - location, overlaying the storage beyond the newargs[] array and - also passing uninitialized storage to execve(), which would - sometimes fail with EFAULT. [Jeff Trawick] - - *) Fix a bug parsing configuration file containers. With a sequence - like this in the config file - - - any stuff - - - (blank line) - any stuff - - - the second container would be terminated at the blank line due to - sediment in the buffer from reading the prior and an - error message would be generated for the real for the - second container. Also due to this problem, any two characters - could be used for "] - - *) Fix chunking problem with CGI scripts. The general problem was that - the CGI modules were adding an EOS bucket and then the core added an - EOS bucket. The chunking filter finalizes the chunked response when it - encounters an EOS bucket. Because two EOS buckets were sent, we - finalized the response twice. The fix is to make sure we only send one - EOS, by utilizing a flag in the request_rec. - [Ryan Bloom] - - *) apr_put_os_file() now sets up the unget byte appropriately on Unix - and Win32. Previously, the first read from an apr_file_t set up via - apr_put_os_file() would return a '\0'. [Jeff Trawick] - - *) Mod_cgid now creates a single element bucket brigade, with a pipe - bucket, instead of using BUFF's and ap_r*. - [Ryan Bloom] - - *) APRVARS.in no longer overwrites the EXTRA_LIBS variable. - [Mike Abbott ] - - *) Remove ap_bopenf from buff code. This required modifying the file_cache - code to use APR file's directly instead of going through BUFFs. - [Ryan Bloom] - - *) Fix compile break on some platforms for mod_mime_magic.c - [John K. Sterling ] - - *) Fix merging of AddDefaultCharset directive. - PR #5872 (1.3) [Jun Kuriyama ] - - *) Minor revamp of the rlimit sections of code. We now test - explicitly for setrlimit and getrlimit. Also, unixd_set_rlimit() - is now "available" even if the platform doesn't support - the rlimit family (it's just a noop though). [Jim Jagielski] - - *) Migrate the pre-selection of which MPM to use for specific - platforms to hints.m4, which contains (or should contain) - all platform specific "hints". [Jim Jagielski] - - *) Remove IOLs from Apache. With filtering, IOLs are no longer necessary - [Ryan Bloom] - - *) Add tables with non-string/binary values to APR. - [Ken Coar] - - *) Fix some bad calls to ap_log_rerror() in mod_rewrite. - [Jeff Trawick] - - *) Update PCRE to version 3.2. [Ryan Bloom] - - *) Change the way buckets' destroy functions are called so that - they can be more directly used when changing the type of a - bucket in place. [Tony Finch] - - *) Add generic support for reference-counting the resources used by - buckets, and alter the HEAP and MMAP buckets to use it. Change - the way buckets are initialised to support changing the type of - buckets in place, and use it when setting aside TRANSIENT buckets. - Change the implementation of TRANSIENT buckets so that it can be - mostly shared with IMMORTAL buckets, which are now implemented. - [Tony Finch] - -Changes with Apache 2.0a6 - - *) Add support to Apache and APR for dsos on OS/390. [Greg Ames] - - *) Add a chunking filter to Apache. This brings us one step closer - to removing BUFF. [Ryan Bloom] - - *) ap_add_filter now adds filters in a LIFO fashion. The first filter - added to the stack is the last filter to be called. [Ryan Bloom] - - *) Apache 2.0 has been completely documented using Scandoc. The - docs can be generated by running 'make docs'. [Ryan Bloom] - - *) Add filtered I/O to Apache. This is based on bucket brigades, - Currently the buckets still use BUFF under the covers, but that - should change quickly. The only currently written filter is the - core filter which just calls ap_bwrite. [The Apache Group] - - *) APR locks on Unix: Let APR_LOCKALL locks work when APR isn't - built with thread support. [Jeff Trawick] - - *) Abort configuration if --with-layout was specified and there's - no layout definition file. [Ken Coar] - - *) Add support for '--with-port=n' option to configure. [Ken Coar] - - *) Add support for extension methods for the Allow response header - field, and an API routine for accessing r->allowed and the - list of extension methods in a unified manner. [Ken Coar] - - *) mod_cern_meta: fix broken file reading loop in scan_meta_file(). - [Rob Simonson ] - - *) Get xlate builds working again. The apr renaming in 2.0a5 broke - APACHE_XLATE builds. [Jeff Trawick] - - *) A configuration file parsing problem was fixed. When the - configuration file started with an IfModule/IfDefine container, - only the last statement in the container would be retained. - [Jeff Trawick] - -Changes with Apache 2.0a5 - - *) Perchild is serving pages after passing them to different child - processes. There are still a lot of bugs, but this does work. I - have made requests against the same installation of Apache, and had - different servers use different user IDs to serve the responses. - This change moves to using socketpair instead of an AF_UNIX socket. - [Ryan Bloom] - - *) Perchild MPM still doesn't work perfectly, but it is serving pages. - It can't seem to pass between child processes yet, but I think we - are closer now than before. This moves us back to using Unix - Domain Sockets. [Ryan Bloom] - - *) libapr functions and types renamed with apr_ prefix. - #include "apr_compat.h" for 1.3.x backwards compat - [Perl] - - *) Fix problems with APR sockaddr handling on Win32. It didn't always - return the right information on the local socket address. - [Gregory Nicholls ] - - *) ap_recv() on Win32: Set bytes-read to 0 on error. - [Gregory Nicholls ] - - *) Add an option to not detach from the controlling terminal without - going into single process mode. This allows for much easier - debugging of the process startup code. [Ryan Bloom] - - *) ab: don't use perror() to report the failure of an APR function. - [Jeff Trawick] - - *) Make dexter, mpmt_pthread, and perchild MPMs not destroy the - scoreboard on graceful restarts. - [Ryan Bloom] - - *) Fix segfault/SIGSEGV when running gzip from mod_mime_magic.c. - An invalid ap_proc_t was passed to ap_create_process(). - [Jeff Trawick] - - *) Allow modules to register filters. Those filters are still - never called, but this is a step in the right direction. - [Ryan Bloom and Greg Stein] - - *) Register the mod_cgid daemon process for cleanup so that it is - killed at termination if it does not die when the parent gets - SIGTERM. This change is to fix occasional problems where the - process stays around. Bugs in similar logic in mod_rewrite and - mod_include were also fixed. [Jeff Trawick] - - *) Fix a bug in the time handling. Basically, we were imploding a time - in ap_parseHTTPdate, but it had bogus data in the exploded time format. - Namely, tm_usec and tm_gmtoff were not filled out. ap_implode_time - uses those two fields to adjust the time value. Because of the HTTP - spec, both of those values can be zero'ed out safely. This fixes - the bug correctly. [Ryan Bloom] - - *) Fix a couple of place in the Windows code where the wrong error - code was being returned. [Gregory Nicholls ] - - *) Fix POOL_DEBUG (at least for prefork mpm). [Dean Gaudet] - - *) Added the APR_EOL_STR macro for platform dependent differences in - logfiles and other raw text (such as all APR files). Fixes logfiles - not terminated with cr/lf sequences in Win32. [William Rowe] - - *) Move all strings functions in APR to src/lib/apr/strings and create - apr_strings.h for the prototypes. [Ryan Bloom] - - *) APR lock fixes: when using SysV sems, flock(), or fcntl(), be sure - to repeat the syscall until we stop getting EINTR. I noticed a - related problem at termination (SIGTERM) on FreeBSD when using - fcntl(). Apache 1.3 had these new loops too. Also, make the flock() - implementation work properly with child init. Previously, ap_lock() - was essentially a no-op because all children were using different - locks and thus nobody ever blocked. [Jeff Trawick] - - *) The htdocs/ tree has been moved out of the CVS source tree into - a separate area for easier development. This has NO EFFECT on - end-users or Apache installations. [Ken Coar] - - *) Integrate the mod_dav module for WebDAV protocol handling. This - adds the dav and dav_fs modules, the SDBM library, and additional - XML handling utilities. [Greg Stein] - - *) Clean out obsolete names (from httpd.h) for the HTTP Status Codes - [Greg Stein] - - *) Update the lib/expat-lite/ library (bring forward changes from - the Apache 1.3 repository). [Greg Stein] - - *) If sizeof(long long) == sizeof(long), then prefer long in APR - configure.in. [Dave Hill ] - - *) Add ap_sendfile for Tru64 Unix. Also, add an error message for - machines where sendfile is detected, but nobody has written ap_sendfile. - [Dave Hill ] - - *) Compile fixes in mod_mmap_static. [Victor J. Orlikowski] - - *) ab would start up more connections than needed, then quit when the - desired number were finished. Also fixed a logic error involving - ab keepalives. [Victor J. Orlikowski] - - *) WinNT: Implement non-blocking pipes with timeouts to communicate - with CGIs. Apache 2.0a4 had non-blocking pipes but without - timeouts (i.e, if a timeout was specified, the pipe reverted to - a full blocking pipe). Now the behaviour is more in line with - Unix non-blocking pipes. - [Bill Stoddard] - - *) WinNT: Implement accept socket reuse. Using mod_file_cache to - cache open file handles along with accept socket reuse enables - Apache 2.0 to serve non-keepalive requests for static files at - 3x the rate of Apache 1.3.(e.g, Apache 1.3 will serve 400 rps - and Apache 2.0 will serve almost 1200 rps on my system). - [Bill Stoddard] - - *) Merge mod_mmap_static function into mod_file_cache. mod_file_cache - supports two config directives, mmapfile (same behavious as - mod_mmap_static) and cachefile. Use the cachefile directive - to cache open file handles. This directive only works on systems - that have implemented the ap_sendfile API. cachefile works today - on Windows NT, but has not been tested on any flavors of Unix. - [Bill Stoddard] - - *) Cleanup the configuration. With the last few changes the - configuration process automatically: - inherits information about how to build from APR. Allowing - APR to inform Apache that it should or should not use -ldl - - Detects which mod_cgi should be used mod_cgi or mod_cgid, - based on the threading model - - Apache calls APR's configure process before finishing it's - configuration processing, allowing for more information flow - between the two. - [Ryan Bloom] - - - *) Change Unix and Win32 ap_setsockopt() so that APR_SO_NONBLOCK - with non-zero argument makes the socket non-blocking. BeOS and - OS/2 already worked this way. [Jeff Trawick] - - *) ap_close() now calls ap_flush() for buffered files, so write - operations work a whole lot better on buffered files. - [Jeff Trawick] - - *) Fix error messages issued from MPMs which explain where to change - compiled-in limits (e.g., ThreadsPerChild, MaxClients, StartTreads). - [Greg Ames] - - *) ap_create_pipe() now leaves pipes in blocking state. (This helps - reduce the number of syscalls on Unix.) ap_set_pipe_timeout() is - now the way that the blocking state of a pipe is manipulated. - ap_block_pipe() is gone. [Jeff Trawick] - - *) Correct the problem where the only local host name that the IP stack - can discover are 'undotted' private names. If no fully qualified - domain name can be identified, the default ServerName will be set to - the machine's IP address string. A warning is always provided if the - ServerName not specified, but assumed. Solves PR6215 [William Rowe] - - *) Repair problems with config file processing which caused segfault - at init when virtual hosts were defined and which caused ServerName to - be ignored when there was no valid DNS setup. [Jeff Trawick] - - *) Removed pointless ap_is_aborted macro function. [Roy Fielding] - - *) Add ap_sendfile implementation for AIX - [Victor J. Orlikowski] - - *) Repair C++ compatibility in ap_config.h, apr_file_io.h, - apr_network_io.h, and apr_thread_proc.h. - [Tyler J. Brooks , Jeff Trawick] - - *) Bring the allocation and pool debugging code back into a working - state. This will need to be tested as so far it's only been used on - BeOS. [David Reid] - - *) Change configuration command setup to be properly typesafe when in - maintainer mode. Note that this requires a compiler that can initialise - unions. [Ben Laurie] - - *) Turn on buffering for config file reads. Part of this was to - repair buffered I/O support in Unix and implement buffered - ap_fgets() for all platforms. [Brian Havard, Jeff Trawick] - - *) Win32: Fix problem where UTC offset was not being set correctly - in the access log. Problem reported on news group by Jerry Baker. - [Bill Stoddard] - - *) Fix segfault when reporting this type of syntax error: - " without matching section", where - container is VirtualHost or Directory or whatever. - [Jeff Trawick] - - *) Prevent the source code for CGIs from being revealed when using - mod_vhost_alias and the CGI directory is under the document root - and a user makes a request like http://www.example.com//cgi-bin/cgi - as reported in - [Tony Finch] - - *) Add support for the new Beos NetwOrking Environment (BONE) - [David Reid] - - *) xlate: ap_xlate_conv_buffer() now tells the caller when the - final input char is incomplete; ap_bwrite_xlate() now handles - incomplete final input chars. [Jeff Trawick] - - *) Yet another update to saferead/halfduplex stuff -- need to ensure - that a bhalfduplex call occurs before logging or else DNS and - such can delay the last packet of the response. [Dean Gaudet] - - *) Some syscall reduction in APR on unix -- don't seek when setting - up an mmap; and don't fcntl() more than once per socket. - [Dean Gaudet] - - *) When mod_cgid is started as root, the cgi daemon now switches - to the configured User/Group (like other httpd processes) - instead of continuing as root. [Jeff Trawick] - - *) The prefork MPM now uses an APR lock for the accept() mutex. - It has not been getting a lock at all recently. httpd -V now - displays APR's selection of the lock mechanism instead of the - symbols previously respected by prefork. [Jeff Trawick] - - *) Change the mmap() feature test to check only for existence. - The previous check required features not used by Apache. - [Greg Ames] - - *) Fix a couple of bugs in mod_cgid: The cgi arguments were - sometimes mangled. The len parm to accept() was not - initialized, leading sometimes to an endless loop of failed - accept() calls on OS/390 and anywhere else that failed the call - if the len was negative. Use for struct sockaddr_un - instead of declaring it ourselves to fix a compilation problem - on Solaris. [Jeff Trawick] - - *) Add Resource limiting code back into Apache 2.0. [Ryan Bloom] - - *) Fix zombie process problem with mod_cgi. [Jeff Trawick] - - *) Port mod_mmap_static to 2.0. Make it go faster. [Greg Ames] - - *) Fix storage overlay when loading dsos. Symptom: Apache dies at - initialization if ALLOC_DEBUG is defined; no known symptom - otherwise. [Jeff Trawick] - - *) Fix typo in configure script when checking for mod_so. bash - doesn't seem to have a problem but /bin/sh on Solaris does. - Symptom: "./configure: test: unknown operator ==" - [Jeff Trawick] - - *) Rebind the Win32 NT and 9x services control into the MPM. - All console, WinNT SCM and Win9x pseudo-service control code is - now wrapped within the WinNT MPM. - [William Rowe] - - *) Make a copy of getenv("PATH") before storing for later use. Some - getenv() implementations use the same storage for successive calls. - CGIs on OS/390 had a bad PATH due to this. [Jeff Trawick] - - *) Server Tokens work in 2.0 again. This also propogates the change - to allow just the product name in the server string using - PRODUCT_ONLY. - [Ryan Bloom] - -Changes with Apache 2.0a4 - - *) EBCDIC: Rearrange calls to ap_checkconv() so that most handlers - won't need to call it. [Greg Ames, Jeff Trawick] - - *) Move pre_config hook call to between configuration read and config - tree walk. This allows all modules to implement pre_config hooks - and know that they will be called at an appropriate time. - [Ryan Bloom] - - *) mod_cgi, mod_cgid: Make ScriptLog directive work again. - [Jeff Trawick] - - *) Add pre-config hooks back to all modules. - [Ryan Bloom] - - *) Fix a SIGSEGV in ap_md5digest(), which is used when you have - ContentDigest enabled and we can't/don't mmap the file. - [Jeff Trawick] - - *) We now report the correct line number for syntax errors in config - files. [Ryan Bloom, Greg Stein, Jeff Trawick] - - *) Brought mod_auth_digest up to synch with 1.3, fixed ap_time_t- - related bugs, and changed shmem/locking to use apr API. Shared-mem - is currently disabled, however, because of problems with graceful - restarts. [Ronald Tschalär] - - *) Fix corruption of IFS variable in --with-module= handling. - Depending on the user's shell or customization thereof, there - would be errors generating ap_config_auto.h later in the configure - procedure. [Jeff Trawick] - - *) mod_cgi: Restore logging of stderr from child process when ScriptLog - isn't used (as in 1.3), except that on Unix it is now logged via - ap_log_rerror() instead of by the child having STDERR_FILENO refer - to the error log. [Greg Ames, Jeff Trawick] - - *) Add '-D' argument processing for run time configuration defines. - [William Rowe] - - *) Organize http_main.c as independent code, such that no code or - global data is exported from it. WIN32 will dynamically link it - to the server core, so this will prevent mutual dependency. - [William Rowe] - - *) Add separate dynamic linkage tags APR_EXPORT(), APR_EXPORT_NONSTD() - and APR_VAR_EXPORT to correctly resolve apr functions and globals. - [William Rowe] - - *) Add Win9x service execution and Ctrl+C/Ctrl+Break/Shutdown handlers. - [William Rowe, Jan Just Keijser ] - - *) Add mod_charset_lite for configuring character set translation. - [Jeff Trawick] - - *) Add '-n' option to htpasswd to make it print its user:pw record - on stdout rather than having to frob a text file. [Ken Coar] - - *) Fix saferead. Basically, we flush the output buffer if a read on the - input will block. - [Ryan Bloom] - - *) APR: Add ap_xlate_get_sb() so that an app can find out whether or not - a conversion is single-byte only. [Jeff Trawick] - - *) BEOS: ap_shutdown should return APR_SUCCESS or errno. Note that - the BeOS 5.0 documentation says that shutdown doesn't work yet. - [Roy Fielding] - - *) Fix some minor errors where pid was being manipulated as an int - instead of the portable pid_t. [Roy Fielding] - - *) Fix some error log prints that were printing the pointer to a - structure rather than the pid within the structure. - [Jeff Trawick, Roy Fielding] - - *) ab: Fix a command-line processing bug; track bad headers in - err_response; support reading headers up to 2K. - [Ask Bjoern Hansen ] - - *) Fix ap_resolve_env() so that it handles new function added in a prior - alpha (see "Added the capability to do ${ENVVAR} constructs in the - config file.") as well as the constructs used by mod_rewrite. - [Paul Reder ] - - *) Apache 2.0 builds and runs on OS/390. [Jeff Trawick, Greg Ames] - - *) Change the EBCDIC support in functions for MD5, SHA1, and base 64 to use - APR to perform translation, instead of accessing the hard-coded tables - in 1.3's ebcdic.c. [Jeff Trawick] - - *) Fix some bugs (mostly lost 1.3 code) in ab's command-line processing. - [Jeff Trawick] - - *) Add the ability to hook into the config file reading phase. Basically - if a directive is specified EXEC_ON_READ, then when that directive is - read from the config file, the assocaited function is executed. This - should only be used for those directives that must muck with HOW the - server INTERPRETS the config. This should not be used for directives - that re-order or replace items in the config tree. Those changes should - be made in the pre-config step. - [Ryan Bloom] - - *) Add mod_example to the build system. - [Tony Finch] - - *) APR: Add ap_xlate_conv_byte() to convert one char between single- - byte character sets. [Jeff Trawick] - - *) Pick up various EBCDIC fixes from 1.3 (from Martin - Kraemer and Oliver Reh originally according to the change log). - [Jeff Trawick] - - *) Fix a couple of problems in RFC1413 support (controlled by the - IdentityCheck directive). Apache did not build the request string - properly and more importantly Apache would loop forever if the - would-be ident server dropped the connection before sending a - properly terminated response. [Jeff Trawick] - - *) apxs works in 2.0. - [Ryan Bloom] - - *) Reliable piped logs work in 2.0. - [Ryan Bloom] - - *) Introduce a hash table implementation into APR to be used for - replacing tables and other random data structures in Apache. - [Tony Finch] - - *) Add some more error reporting to htpasswd in the case of problems - generating or accessing the temporary file. Also, pass in a - buffer if the implementation knows how to use it (i.e., if L_tmpnam - is defined). [Ken Coar] - - *) Configure creates config.nice now containing your configure - options. Syntax: ./config.nice [--more-options] - [Sascha Schumann] - - *) Fix various return code problems in APR on Win32. For most of - these, APR was returning APR_EEXIST instead of GetLastError()/ - WSAGetLastError(). [Jeff Trawick] - - *) Make piped logs work again in version 2.0 - [Ryan Bloom] - - *) Add VPATH support to UNIX build system of Apache and APR. - [Sascha Schumann] - - *) Fix ap_tokenize_to_argv to respect the const arguments that are - passed to it. - [Ryan Bloom] - - *) Fix mm's memcpy/memset macros, pointer arithmetic was broken. - Patch submitted to author. - [Sascha Schumann] - - *) Fix mm configuration on Solaris 8 x86 and OS/390. Don't require - /sbin in PATH on FreeBSD (all submitted to rse previously) - [Jeff Trawick] - - *) Fix building Pthread-based MPMs on OpenBSD - [Sascha Schumann] PR#26 - - *) Fix ap_readdir() problem on systems where d_name[] field in - struct dirent is declared with only one byte. (This problem only - affected multithreaded builds.) This caused a segfault during - pool cleanup with mod_autoindex on Solaris (Solaris 8 x86, at - least). [Jeff Trawick] - - *) Fix some make-portability problems on at least Tru64, Irix - and UnixWare. - [Sascha Schumann] PR#18, PR#39 - - *) Add ap_sigwait() to support old-style sigwait() on systems - like OS/390 and UnixWare. - [Sascha Schumann] - - *) Add POSIX-thread flags for more platforms. - [Sascha Schumann] - - *) Fix some minor bugs in ap_strerror(). Teach ap_strerror() - (on Unix, at least) to handle resolver errors. Fix a bug in - the definition of APR_ENOMEM so that ap_strerror() can spit - out the correct error message for it. - [Jeff Trawick] - -Changes with Apache 2.0a3 - - *) mod_so reports ap_os_dso_error() if ap_dso_load() fails - [Doug MacEachern] - - *) API: *HOOK* macros now have an AP_ prefix - [Doug MacEachern] - - *) Win32: Eliminate redundant calls to initialize winsock. - [Tim Costello ] - - *) Fix bugs initializing ungetchar for pipes. - [Chia-liang Kao ] - - *) The ab program in the src/support directory is now portable using - APR. - [Ryan Bloom] - - *) Support directory is being compiled when the server is built - [Ryan Bloom] - - *) The configure option --with-program-name has been added to allow - developers to rename the executable at configure time. This also - changes the name of the config files to match the executable's name. - [Ryan Bloom] - - *) mod_autoindex: Add `IndexOptions +VersionSort', to nicely sort filenames - containing version numbers. [Martin Pool] - - *) ap_open(..,APR_OS_DEFAULT,..) uses perms 0666 instead of 0777 on - Unix; access_log and error_log now created with these perms; non- - Unix is unaffected [Jeff Trawick] - - *) Finished move of ap_md5 routines to apr_md5. Removed ap_md5.h. - Replaced more magic numbers with MD5_DIGESTSIZE. - [William Rowe, Roy Fielding] - - *) Win32: Get mod_auth_digest compiling and added to the Windows - build environment. Not tested and I'd be suprised if it - actually works. [Bill Stoddard] - - *) Revamp the Win32 make environment. Makefiles have been removed and - Apache.dsw created to bring together all the pieces. Create new file - os/win32/BaseAddr.ref to define module base addresses (to prevent - dll relocation at start-up). - [William Rowe, Greg Marr, Tim Costello, Bill Stoddard] - - *) [EBCDIC] Port Paul Gilmartin's CRLF patch from 1.3. This replaces most - of the \015, \012, and \015\012 constants with macros. - [Greg Ames ] - - *) Add ap_xlate_open() et al for translation of text between different - character sets. The initial implementation requires iconv(). - [Jeff Trawick] - - *) More FAQs and answers from comp.infosystems.www.servers.unix. - [Joshua Slive ] - - *) CGI output is being timed out now. - [Ryan Bloom] - - *) Fix the problem with dieing quietly. dupfile now takes a pool which - is used by the new apr file. There is no reason to create a new file - with the same lifetime as the original file. - [Ryan Bloom] - - *) Win32: Attempt to eliminate dll relocation at start-up by specifying - module base addresses. This will help shooting seg faults - in the field. [William Rowe ] - - *) Update Apache on Windows documentation. Add new document - describing how to compile Apache on Windows. - [William Rowe ] - - *) ap_set_pipe_timeout(), ap_poll(), and APR_SO_TIMEOUT now take - microseconds instead of seconds. Some storage leaks and other - minor bugs in related code were fixed. [Jeff Trawick] - - *) Win32: First cut at getting mod_isapi working under 2.0 - [William Rowe ] - - *) First stab at getting mod_auth_digest working under 2.0 - quick change summary: - - moved the random byte generation (ap_generate_random_bytes) into APR - - now uses ap_time_t - - compiles and runs on linux - - tested with amaya - [Brian Martin ] - - *) Win32: Move the space stripping of physical service names - fix up from Apache 1.3. #include'ing "ap_mpm.h" fixes up an - unresolved symbol. Add dependency checking to the - CreateService call to ensure TCPIP and AFP (winsock) is started - before Apache. - [William Rowe ] - - *) Win32: Add code to perform latebinding on functions that may - not exist on all levels of Windows where Apache runs. This - is needed to allow Apache to start-up on Win95/98. All calls - to non portable functions should be protected with - ap_oslevel checks to prevent runtime segfaults. - [William Rowe ] - - *) Fix fallback default values for SHM_R and SHM_W [Martin Kraemer] - - *) Get lingering_close() working again. [Dean Gaudet, Jeff Trawick] - - *) Win32: Get non-blocking CGI pipe reads working under Windows NT. - This addresses PR 1623. Still need to address timing out runaway - CGI scripts. [Bill Stoddard] - - *) Win32: Make ap_stat Windows 95/98 friendly - [William Rowe ] - - *) Win32: Fix a bug in ap_get_oslevel which causes GetVersionEx() to - always fail. Need to initialise the dwOSVersionInfoSize member of the - OSVERSIONINFO struct before calling GetVersionEx, so GetVersionEx - always fails. - - The patch also enhances ap_get_oslevel (and the associated enum) to - handle selected service packs for NT4, and adds recognition for - Windows 2000. This is useful, eg. if we can recognise NT4 SP2 then - we can use ReadFileScatter and WriteFileGather in readwrite.c. - [Tim Costello ] - - *) Get mod_rewrite building and running, and mod_status building for Win NT - [Allan Edwards ] - - *) Patch to port mod_auth_db to the 2.0 api and also to support - Berlekey DB 3.0. It works for me with both Berkeley DB 3.0.55 and - 2.7.7. It should work with version 1 as well but I haven't tested it. - [Brian Martin ] - - *) Get APR DSO code working under Windows. Includes cross platform - fixes to mod_so.c. - [Tim.Costello@BTFinancialgroup.com] - - *) Fix some of the Windows APR time functions. - [William Rowe] - - *) FAQ changes related to tidying up historical documents on the web site. - [Joshua Slive ] - - *) Move Windows DSO code into APR. - [Bill Stoddard] - - *) Eliminate apr_win.h and apr_winconfig.h (and the ugly #ifdefs they cause). - Now, apr.h and apr_config.h are generated from apr.hw and apr_config.hw - at build time. At this point, the server will not compile on Windows because - of the recent DSO commits. Fixing those next. - [Bill Rowe & Bill Stoddard] - - *) Added error checking for file I/O APR routines. - [Jon Travis ] - - *) APR: Don't use the values of resolver error codes for the - corresponding APR error codes. On Unix and Win32, return the - proper APR error code after a resolver error. [Jeff Trawick] - -Changes with Apache 2.0a2 - - *) Renamed the executable back to httpd on all platforms other - than Win32 - [Ryan Bloom] - - *) Allow BeOS to survive restarts, log properly and a few - small things it had problems with due to the way it setup - users and groups. [David Reid] - - *) Get mod_rewrite working with APR locks - [Paul Reder ] - - *) Actually remove the sempahore when the lock cleanup routine - is called on BeOS. [David Reid] - - *) Clear hook registrations between reads of the config file. - When DSOs are unloaded and re-loaded the old hook pointers may - no longer be valid. This fix eliminates potential segfaults. - [Allan Edwards ] - - *) Fix a problem with Sigfunc not being defined or bypassed - if sigaction() wasn't found. [Jim Jagielski] - - *) Fix the locking mechanism on BSD variants. They now use fcntl - locks. This allows the server to start and serve pages. - [Ryan Bloom] - - *) First cut at getting the Win32 installer to work - [William Rowe ] - - *) Get htpasswd compiling under Windows - [William Rowe ] - - *) Change the log message for a bind() failure to show the - interface and port number. [Jeff Trawick] - - *) Import the documentation from 1.3.12 and bring parts of it - up-to-date with respect to the changes that have occurred - in 2.0. - [Tony Finch] - - *) BeOS MPM updated. CGI bug on BeOS fixed. IP addresses - now logged correctly on BeOS. - [David Reid] - - *) Create one makefile for all Win32 distributions (NT/2000/95/98). - Makefile.win includes the same user interface as the old - Makefile.nt - [William Rowe , Jeff Trawick ] - - *) Win32 exec now uses COMSPEC environment string for command - shell path resolution. - [William Rowe ] PR#3715 - - *) Win32: ap_connect() was not returning correct error condition - PR5866 - [Allen Prescott ] - - *) Win32: ap_open() was broken on Win9x because an NT-specific - flag was passed to CreateFile. ap_puts() added an unnecessary - '\n'. - [Jeff Trawick ] - - *) Put in Korean and Norwegian index.html pages (2.0 and 1.3) - which where donated by Lee Kuk Hyun and Lorant Czaran. 'Fixed' - confusing ee/et name and made all extensions language/dialect - rather than country reflecting. Changed example files to - explicit reflect the ISO charset and added a few common - ones to the example config [dirkx] - - *) Extend external module capability. To use this, you call - configure with --with-module=path/to/mod1,path/to/mod2,etc. - [Ryan Bloom] - - *) Backported the various "default charset" fixes from 1.3.12, - including the AddDefaultCharset directive. [Jim Jagielski] - - *) Added the capability to do ${ENVVAR} constructs in the - config file. E.g. 'ServerAdmin ${POSTMASTER}'. As commited - it does this on a line by line basis; i.e. if the envvar - expands to something with spaces you have to protect it - by adding quotes around it (Unless of course you expect it - to contains more than one argument. Alternatively you - can compile it on a per token basis; which is what people - usually expect by setting RESOLVE_ENV_PER_TOKEN. But this - hampers fancier hacks. - [Dirk-Willem van Gulik] - - *) Changed the 'ErrorDocument' syntax in that it NO longer - supports the asymetric - - ErrorDocument 301 "Some message - - Note the opening " quote, without a closing quote. It now - has either the following syntaxes - - ErrorDocument XXX /local/uri - ErrorDocument XXX http://valid/url - ErrorDocument XXX "Some Message" - - The recognition heuristic is: if it has a space it - is a message. If it has no spaces and starts with a / - or is a valid URL then treat it that way. Otherwise it - is assumed to be a message. - - This breaks backward compatibility but makes live a hell - of a lot easier for GUI's and config file parsers. - [Dirk-Willem van Gulik] - - *) Changed 'CacheNegotiatedDocs' from its present/not-present - syntax into a 'on' or 'off' syntax. As it currently is the - only non nesting token which uses NO_ARGS and thus is an - absolute pain for any config interface automation. This - breaks backward compatibility. [Dirk-Willem van Gulik] - - *) Add ability to add external modules to the build process. This is - done with --with-module=/path/to/module. Modules can only be added - as static modules at this point. - [Ryan Bloom] - -Changes with Apache 2.0a1 - - *) Fix FreeBSD 3.3 core dump. - Basically, ap_initialize() needs to get called before - create_process(), since create_process() passes op_on structure - to semop() to get a lock, but op_on isn't initialized until - ap_initialize() calls setup_lock(). Here is a slight - rearrangement to main() which calls ap_initialize() earlier... - [Jeff Trawick ] - - *) Enable Apache to use sendfile/TransmitFile API - [Bill Stoddard, David Reid, Paul Reder] - - *) Re-Implement Win32 APR network I/O APIs and most of the file I/O - APIs. - [Bill Stoddard] - - *) Make file I/O and network I/O writev/sendv APIs consistent. - Eliminate use of ap_iovec_t and use Posix struct iovec. - Use seperate variable on ap_writev to set the number of iovecs - passed in and number of bytes written. - [Bill Stoddard] - - *) Adapt file iol to use APR functions. Replaced ap_open_file() - with ap_create_file_iol(). ap_create_file_iol() requires that - the file be opened prior to the call using ap_open(). - [Bill Stoddard] - - *) Port mod_include and mod_cgi to 2.0 - [Paul Reder, Bill Stoddard] - - *) ap_send{,v}, ap_recv, ap_sendfile API clarification -- - bytes_read/bytes_written is always valid (never -1). Plus - some fixes to buff.c to correct problems introduced by the - errno => ap_status_t changes a while back. Plus a fix to - chunked encoding introduced right at the beginning of 2.0. - [Dean Gaudet] - - *) Revamped UNIX build system to use autoconf and libtool. - [Manoj Kasichainula, Sascha Schumann] - - *) port mod_rewrite to 2.0. [Paul J. Reder ] - - *) More rigorous checking of Host: headers to fix security problems - with mass name-based virtual hosting (whether using mod_rewrite - or mod_vhost_alias). - [Ben Hyde, Tony Finch] - - *) Add back support for UseCanonicalName in containers. - [Manoj Kasichainula] - - *) Added APLOG_STARTUP log type. This allows us to write an error - message without any of the date and time information. As a part - of this change, I also removed all of the calls to fprintf(stderr - and replaced them with calls to ap_log_error using APLOG_STARTUP - writing to stderr is no longer portable, because we don't direct - stderr to the error log on all platforms. - [Ryan Bloom] - - *) Convert error logging functions to take errno as an argument. - This makes our error logs more portable, because some Windows API's - don't set errno. This change allows us to still output a valid - message on all of our platforms. - [Ryan Bloom] - - *) mod_mime_magic runs in 2.0-dev now. - [Paul Reder ] - - *) sendfile has been added to APR. - [John Zedlewski ] - - *) buff.c has been converted to no longer use errno. - [Manoj Kasichainula] - - *) mod_speling runs in 2.0-dev now: a bug in readdir_r handling and - interface adaption to APR functions did it. [Martin Kraemer] - - *) Support DSOs properly on 32-bit HP-UX 11.0 - [Dilip Khandekar ] - - *) Updated MM in APR source tree from version 1.0.8 to 1.0.11 - [Ralf S. Engelschall] - - *) Cleaned APR build environment integration and bootstrap APR - automatically for developers from src/Configure. - [Ralf S. Engelschall] - - *) Fixed building of src/support/htpasswd.c - [Ralf S. Engelschall] - - *) When generating the Location: header, mod_speling forgot - to escape the spelling-fixed uri. (Forw-Port from 1.3) - [Martin Kraemer] - - *) Moved mod_auth_digest.c from experimental to standard. [Roy Fielding] - - *) Change all pools to APR contexts. This is the first step to - incorporating APR into Apache. [Ryan Bloom] - - *) Move "handler not found" warning message to below the check - for a wildcard handler. [Dirk , Roy Fielding] - PR#2584, PR#2751, PR#3349, PR#3436, PR#3548, PR#4384, PR#4795, PR#4807 - - *) Support line-continuation feature in config.option file and - allow the loading of multiple option sections at once via - ``--with-option=,,...'' - [Ralf S. Engelschall] - - *) Rebuilt CVS repository with Apache 1.3.9 as basis. [Roy Fielding] - -Changes with Apache MPM - - *) Use asynchronous AcceptEx() and a completion port to accept and - dispatch connections to threads in Windows NT/2000. - [Bill Stoddard] - - *) Implement WINNT Win32 MPM from original Win32 code in http_main.c - [Bill Stoddard] - - *) Implement the APACI --with-option facility - (per default used the config.option file). - [Ralf S. Engelschall] - - *) MPM BEOS port. [David Reid ] - - *) Start to implement module-defined hooks that are a) fast and b) typesafe. - Replace pre_connection module call with a register_hook call and - implement pre_connection as a hook. The intent is that these hooks will - be extended to allow Apache to be multi-protocol, and also to allow the - calling order to be specified on a per-hook/per-module basis. - [Ben Laurie] - - *) Implement mpm_* methods as "modules". Each method gets its own - subdir in src/modules (eg: src/modules/prefork). Selection - of method uses Rule MPM_METHOD. [Jim Jagielski] - - *) Port the hybrid server from the apache-apr repository as - mpm_mpmt_pthread. [Manoj Kasichainula] - - *) os/unix/unixd.[ch]: detach, setuid, setgid, stuff which will be common - amongst the unix MPMs. - - *) mpm_prefork: throw away all the alarm/timeout crud; and clean up the - signal handling for the new world order. [Dean Gaudet] - - *) Crude ap_thread_mutex abstraction so that we get the pthread stuff out - of alloc.c for now. [Dean Gaudet] - - *) Handle partial large writes correctly. [Ben Laurie] - - *) Eliminate conn_rec's pointer to server. All it knows is the base server - based on IP/port. [Ben Laurie] - - *) Port a bunch of modules to the new module structure. - ["Michael H. Voase" ] - - *) I/O layering and BUFF revamp. See docs/buff.txt. [Dean Gaudet] - - *) Basic restructuring to introduce the MPM concept; includes various - changes to the module API... better described by - docs/initial_blurb.txt. [Dean Gaudet] - -Changes with Apache pthreads - - *) New buff option added: BO_TIMEOUT. It describes the timeout for - buff operations (generally over a network). - [Dean Gaudet, Ryan Bloom, Manoj Kasichainula] - - *) Created http_accept abstraction. Added 4 new functions (not exported): - init_accept(), begin_accepting_requests(), get_request(), - stop_accepting_requests() [Bill Stoddard] - - *) Fix to ap_rprintf call that allows mod_info to work properly. - [James Morris ] - - *) user and ap_auth_type fields were moved from connection_rec to - request_rec. [Ryan Bloom] - - *) Removed the ap_block_alarms and ap_unblock_alarm calls. These aren't - needed in a threaded server. - - *) Initial pthread implementation from from Dean's apache-nspr code. - [Bill Stoddard, Ryan Bloom] - - -Changes with Apache 1.3.9 - - *) Remove bogus error message when a redirect doesn't set Location. - Instead, use an empty string to avoid coredump if the error message - was supposed to include a location. [Roy Fielding] - - *) Don't allow configure to include mod_auth_digest unless it is - explicitly requested, even if the user asked for all modules. - [Roy Fielding] - - *) Translate module names to dll names for OS/2 so that they are no more - than 8 characters long and have an extension of "dll" instead of "so". - [Brian Havard] - - *) Print out pointer to Rule DEV_RANDOM when truerand lib not found. - Fix test-compile check to check for randbyte instead of trand32. - Use ap_base64encode_binary/decode instead of copy in mod_auth_digest.c - and tweak to make Amaya happier. [Ronald Tschalär] - - *) Ensure that the installed expat include files are world readable, - just like the other header files. [Martin Kraemer] - - *) Fixed generated AddModule adjustments in APACI's `configure' script - in order to allow (new) modules like mod_vhost_alias to be handled - correctly (which was touched by the adjustments for mod_alias). - [Ralf S. Engelschall] - - *) For binary builds, add -R flag to apachectl to work around the lack of - an absolute path to the ./libexec directory where the libhttp.ep file - is needed for SHARED_CORE architectures. [Randy Terbush] - - *) WIN32: Create the CGI script process as DETACHED. This may solve the - problem observed by some Win95/98 users where they get CGI script - output sent to the console. [Bill Stoddard] - - *) Fix (re)naming in the uuencode/decode section. The ap/ap_ - routines are now called ap_base64* and are 'plain' (i.e., no - pool access or anything clever). Inside util.c the routines acting - like pstrdup are called ap_pbase64encode() and ap_pbase64decode(). - The oddly named ap_uuencode(), ap_uudecode() are kept around for - now but deprecated. [dirkx] - - *) Clean up the base64 and SHA1 additions and make sure they are - represented in the ApacheCore.def, ApacheCoreOS2.def, and httpd.exp - files. [Roy Fielding] - - *) WIN32: Migrate to InstallShield 5.5 and provide a bit more error - checking. Allow compiling on VS 6.0. [Randy Terbush] - - *) Fixed assumption of absolute paths in binbuild.sh. [Tony Finch] - - *) Use TestCompile to search for the truerand library (rather than blindly - assuming its existence). If it is not found, complain (but do not - exit - yet). [Martin Kraemer] - - *) We forgot to add the new exported function names to - src/support/httpd.exp. [Bill Stoddard, Randy Terbush] - - *) Add description of -T command-line option to usage(). - [Ralf S. Engelschall] - - *) For "some" platforms (notably, EBCDIC based ones), libos needs to be - searched only AFTER libap has been searched, because libap needs - some symbols from libos. [Martin Kraemer] - - *) Fix conflict with original mod_digest related to the symbol of the - module dispatch list (which has to be unique for DSO and follow the - usual conventions for the installation procedure). - [Ralf S. Engelschall] - - *) Add a dbm-library check for the "usual places" (-ldbm, -lndbm, -ldb) - for other platforms as well. [Martin Kraemer] - - *) Make ap_sha1.c compile for EBCDIC platforms: replace remaining LONG - types by AP_LONG and replace reference to renamed variable 'ubuf' - by 'buffer'. [Martin Kraemer] - -Changes with Apache 1.3.8 [not released] - - *) Flush the output buffer immediately after sending an error or redirect - response, since the result may be needed by the client to abort a - long data transfer or restart a series of pipelined requests. - [Tom Vaughan , Roy Fielding] - - *) PORT: Improved compilation and DSO support on Sequent DYNIX/ptx. - [Ian Turner ] PR#4735 - - *) Local struct mmap in http_core.c conflicted with system structure - name on DYNIX -- changed to mmap_rec. [Roy Fielding] PR#4735 - - *) Added updated mod_digest as modules/experimental/mod_auth_digest. - [Ronald Tschalär ] - - *) Fix a memory leak where the module counts were getting messed - up across restarts. [David Harris ] - - *) CIDR addresses such as a.b.c.d/24 where d != 0 weren't handled - properly in mod_access. - ["Paul J. Reder" ] PR#4770 - - *) RewriteLock/RewriteMap didn't work properly with virtual hosts. - [Dmitry Khrustalev ] PR#3874 - - *) PORT: Support for compaq/tandem/com. - [Michael Ottati , dirkx] - - *) Added SHA1 password encryption support to easy migration from - Netscape servers. See support/SHA1 for more information. - Caused the separation of ap_md5.c into md5, sha1 and a general - ap_checkpass.c with just a validate_passwd routine. Added a - couple of flags to support/htpasswd. Some reuse of the to64() - function; hence renamed to ap_to64(). - [Dirk-Willem van Gulik, Clinton Wong ] - - *) Change for EBCDIC platforms (TPF and BS2000) to correctly deal - with ASCII/EBCDIC conversions in "ident" query. - [David McCreedy ] - - *) Get rid of redefinition warning on MAC_OS_X_SERVER platform. - Change "Power Macintosh" to Power* so if uname prints "Power Book" - we're still happy on Rhapsody platforms. [Wilfredo Sanchez] - - *) Fix SIGSEGV on some systems because the Vary fix below included - a call to table_do with a variable argument list that was not - NULL terminated. Replaced with better implementation. [Roy Fielding] - -Changes with Apache 1.3.7 [not released] - - *) The "Vary" response header field is now sanitised right before - the header is sent back to the client. Multiple "Vary" fields - are combined, and duplicate tokens (e.g., "Vary: host, host" or - "Vary: host, negotiate, host, accept-language") are reduced to - single instances. This is a better solution than the force-no-vary - one (which is still valid for clients that can't cope with Vary - at all). PR#3118 [Dean Gaudet, Roy Fielding, Ken Coar] - - *) Portability changes for BeOS. [David Reid abb37@dial.pipex.com] - - *) Link DSO's with "gcc -shared" instead of "ld -Bshareable" at - least on Linux and FreeBSD for now. - [Rasmus Lerdorf] - - *) Win32: More apache -k restart work. Restarts are now honored - immediately and connections in the listen queue are -not- lost. - This is made possible by the use of the WSADuplicateSocket() - call. The listeners are opened in the parent, duplicated, then - the duplicates are passed to the child. The original listen sockets - are not closed by the parent across a restart, thus the listen queue - is preserved. - [Bill Stoddard ] - - *) Fix handling of case when a client has sent "Expect: 100-continue" - and we are going to respond with an error, but get stuck waiting to - discard the body in the pointless hope of preserving the connection. - [Roy Fielding, Joe Orton ] PR#4499, PR#3806 - - *) Fix 'configure' to work correctly with SysV-based versions of - 'tr' (consistent with Configure's use as well). [Jim Jagielski] - - *) apxs: Add "-S var=val" option which allows for override of CFG_* - built-in values. Add "-e" option which works like -i but doesn't - install the DSO; useful for editing httpd.conf with apxs. Fix - editing code so that multiple invocations of apxs -a will not - create duplicate LoadModule/AddModule entries; apxs can now be - used to re- enable/disable a module. [Wilfredo Sanchez] - - *) Win32: Update the server to use Winsock 2. Specifically, link with - ws2_32.lib rather than wsock32.lib. This gives us access to - WSADuplcateSocket() in addition to some other enhanced comm APIs. - Win 95 users may need to update their TCP/IP stack to pick up - Winsock 2. (See http://www.microsoft.com/windows95/downloads/) - [Bill Stoddard stoddard@raleigh.ibm.com] - - *) Win32: Redirect CGI script stderr (script debug info) into the - error.log when CGI scripts fail. This makes Apache on Win32 - behave more like Unix. - [Bill Stoddard stoddard@raleigh.ibm.com] - - *) Fixed `httpd' usage display: -D was missing. - [Ralf S. Engelschall] PR#4614 - - *) Fix `make r' test procedure in src/regex/: ap_isprint was not found. - [Ralf S. Engelschall] PR#4561, PR#4562 - - *) OS/2: Fix problem with accept lock semaphores where server would die with - "OS2SEM: Error 105 getting accept lock. Exiting!" - [Brian Havard] PR#4505 - - *) Add DSO support for DGUX 4.x using gcc. Tested on x86 platforms. - [Randy Terbush ] - - *) Add the new mass-vhost module (mod_vhost_alias.c) developed and - used by Demon Internet, Ltd. [Tony Finch ] - - *) Better GCC detection for DSO flags under Solaris 2 where the `cc' - command potentially _is_ GCC. [Ralf S. Engelschall] - - *) Fix apxs build issues on AIX - [Rasmus Lerdorf ] - - *) DocumentRoot Checking: Under previous versions, when Apache - first started up, it used to do a stat of each DocumentRoot to - see if it existed and was a directory. If not, then an error - message was printed. THIS HAS BEEN DISABLED. If DocumentRoot - does not exist, you will get error messages in error_log. If - the '-t' command line option is used (to check the configuration) - the check of DocumentRoot IS performed. An additional command - line option, '-T', has been added if you want to avoid the - DocumentRoot check even when checking the configuration. - [Jim Jagielski] - - *) Win32: The query switch "apache -S" didn't exit after showing the - vhost settings. That was inconsistent with the other query functions. - [Bill Stoddard - Fixed by Martin on Unix in 1.3.4] - - *) Win32: Changed behaviour of apache -k restart. - Previously, the server would drain all connections in the stack's - listen queue before honoring the restart. On a busy server, this - could take hours. Now, a restart is honored almost immediately. - All connections in Apache's queues are handled but connections in - the stack's listen queue are discarded. Restart triggered by - MaxRequestPerChild is unchanged. - [Bill Stoddard ] - - *) Win32: Eliminated unnecessary call to wait_for_multiple_objects in - the accept loop. Good for a 5% performance boost. Cleaned up - parent/child process management code. - [Bill Stoddard ] - - *) Added ceiling on file size for memory mapped files. - [John Giannandrea ] PR#4122 - - *) Fix ndbm.h include problems with brain-dead glibc >= 2.1 which - has ndbm.h in a non-standard db1/ subdir. PR#4431, PR#4528 - [Henri Gomez , Ralf S. Engelschall] - - *) Determine AP_BYTE_ORDER for ap_config_auto.h and already - use this at least for Expat. [Ralf S. Engelschall] - - *) Allow .module files to specify libraries with Lib:. - [Ben Laurie] - - *) Allow SetEnvIf[NoCase] to test environment variables as well - as header fields and request attributes. [Ken Coar] - - *) Fix mod_autoindex's handling of ScanHTMLTitles when file - content-types are "text/html;parameters". PR#4524 [Ken Coar] - - *) Remove "mxb" support from mod_negotiation -- it was a draft feature - never accepted into any standard, and it opens up certain DoS - attacks. [Koen Holtman ] - - *) TestCompile updated. We can now run programs and output the - results during the Configure process. [ Jim Jagielski] - - *) The source is now quad (long long) aware as needed. Specifically, - the Configure process determines the correct size of off_t and - *void. When the OS/platform/compiler supports quads, ap_snprintf() - provides for the 'q' format qualifier (if quads are not available, - 'q' is silently "demoted" to long). [Jim Jagielski] - - *) When the username or password fed to htpasswd is too long, include the - size limit in the error message. Also report illegal characters - (currently only ':') in the username. Add the size restrictions - to the man page. [Ken Coar] - - *) Fixed the configure --without-support option so it doesn't result in - an infinite loop. [Marc Slemko] - - *) Piped error logs could cause a segfault if an error occured - during configuration after a restart. - [Aidan Cully ] PR#4456 - - *) If a "Location" field was stored in r->err_headers_out rather - than r->headers_out, redirect processing wouldn't find it and - the server would core dump on ap_escape_html(NULL). Check both - tables and raise HTTP_INTERNAL_SERVER_ERROR with a log message - if Location isn't set. [Doug MacEachern, Ken Coar] - - *) Add RULE_EXPAT, the src/lib/ directory structure, and a modified copy - of the Expat 1.0.2 distribution. [Greg Stein] - - *) Replace regexec() calls with calls to a new API stub function - ap_regexec(). This solves problems with DSO modules which use the regex - library. [Jens-Uwe Mager , Ralf S. Engelschall] - - *) Add 'Request_Protocol' special keyword to mod_setenvif so that - environment variables can be set according to the protocol version - (e.g., HTTP/0.9 or HTTP/1.1) of the request. [Ken Coar] - - *) Add DSO support for OpenStep (Mach 4.2) platform. - [Ralf S. Engelschall, Rex Dieter ] PR#3997 - - *) Fix sed regex for generating ap_config_auto.h in src/Configure. - [Jan Gallo ] PR#3690, PR#4373 - - *) Switch to /bin/sh5 in APACI on Ultrix and friends to avoid problems with - their brain-dead /bin/sh. [Ralf S. Engelschall] PR#4372 - - *) Better DSO flags recognition on NetBSD platforms using ELF. - [Todd Vierling ] PR#4310 - - *) Always log months in english format for %t in mod_log_config. - [Petr Lampa ] PR#4366, 679 - - *) Support for server-parsed and multiview-determined ReadmeName and - HeaderName files in mod_autoindex. Removed the restriction on - "/"s in ReadmeName and HeaderName directives since the *sub_req* - routines will deal with the access issues. (It's now possible to - have {site|group|project|customer|...} wide readmes and headers.) - [Raymond S Brand , Ken Coar] PR#1574, 3026, 3529, - 3569, 4256 - - *) When stat() fails, don't assume anything about the contents of - the struct stat. [Ed Korthof ] - - *) It's OK for a semop to return EINTR, just loop around and try - again. [Dean Gaudet] - - *) Fix configuration engine re-entrant hangups, which solve a - handful of problems seen with mod_perl configuration sections - [Salvador Ortiz Garcia ] - - *) Mac OS and Mac OS X Server now use the appropriate custom layout - by default when building with APACI; allow for platform-specific - variable defaults in configure. [Wilfredo Sanchez] - - *) Do setgid() before initgroups() in http_main; some platforms - zap the grouplist when setgid() is called. This was fixed in - suexec earlier, but the main httpd code missed the change. - [Rob Saccoccio ] PR#2579 - - *) Add recognition of .tgz as a gzipped tarchive. - [Bertrand de Singly ] PR#2364 - - *) mod_include's fsize/flastmod should allow only relative paths, just - like "include file". [Jaroslav Benkovsky ] - - *) OS/2: Add support for building loadable modules using DLLs. - [Brian Havard] - - *) Add iconsdir, htdocsdir, and cgidir to config.layout. - [Wilfredo Sanchez] - - *) Fix minor but annoying bug with the test for Configuration.tmpl - being newer than Configuration so that it is less likely to fail - when using APACI and shadow sources. [Wilfredo Sanchez] - - *) PORT: Add initial support for Mac OS (versions 10.0 and - greater). Use Mac OS X Server layout for now. Clean up dyld code - in unix/os.c, and don't install the dyld error handlers, which - are no longer needed in Mac OS. [Wilfredo Sanchez] - - *) Rename Rhapsody layout to "Mac OS X Server". Change install - locations to appropriate ones for user-built (as opposed to - system) installs. [Wilfredo Sanchez] - - *) Modify mod_autoindex's handling of AddDescription so that the - behaviour matches the documentation. [Ken Coar] PR#1898, 3072. - - *) Add functionality to the install-bindist.sh script created by - binbuild.sh to use tar when copying distribution files to the - serverroot. This allows upgrading an existing installation - without nesting the new distribution in the old. - - install-bindist.sh now detects the local perl5 path to install - apxs and dbmmanage with proper path to perl interpreter. - - Add an install-binsupport target which copies the source files - for apxs and dbmmanage to bindist to allow these scripts to - be properly installed relative to the destination serverroot. - [Randy Terbush, Covalent Technologies, randy@covalent.net] - - *) Fix intermittent SEGV in ap_proxy_cache_error() in - src/modules/proxy_util.c where a NULL filepointer and - temporary filename were closed and unlinked. - [Graham Leggett , - Tim Costello ] PR#3178 - - *) Fix inconsistent error messages reported by mod_proxy. - [Graham Leggett ] - - *) OS/2: Fix terminating CGIs that aren't compiled by EMX GCC when a - connection is aborted. [Brian Havard] - - *) Force the LANG envariable to the known state of "C" so that we - have assurance about how string manipulators (e.g., tr) will - function. [Ken Coar] PR#1630 - - *) Add a directive to allow customising of the tracking cookie name. - [Ken Coar] PR#2921, 4303 - - *) Add "force-no-vary" envariable to allow servers to work around - clients that choke on "Vary" fields in the response header. - [Ken Coar, Dmitry Khrustalev ] PR#4118 - - *) Fixed a bug in mod_dir that causes a child process will infinitely - recurse when it attemps to handle a request for a directory wnd the - value of the DirectoryIndex directive is a single dot. Also likely - to happen for anyother values of DirectoryIndex that will map back - to the same directory. The handler now only considers regular files - as being index candidates. No PR#s found. - [Raymond S Brand ] - - *) Ease configuration debugging by making TestCompile fall back to - using "make" if the $MAKE variable is unset [Martin Kraemer] - - *) Fixed the ServerSignature directive to work as documented. - [Raymond S Brand ] PR#4248 - - *) Add "opt" (SysV-style) layout to config.layout. [Raymond S Brand - ] - - *) Add APACI --without-execstrip option which can be used to disable the - stripping of executables on installation. This is very important for DSO - and debugging situations. [Ralf S. Engelschall] - - *) Add support for OS/2 (case insenstive filesystem, .exe suffix, etc) - to APACI files and related scripts. - [Yitzchak Scott-Thoennes , Ralf S. Engelschall] PR#4269 - - *) Add support for standalone mode in TPF - [Joe Moenich ] - - *) Fix number of bytes copied by read_connection() in src/support/ab.c - [Jim Cox ] PR#4271 - - *) Fix special RewriteCond "-s" pattern matching. - [Bob Finch ] - - *) Fix value quoting in src/Configure script for ap_config_auto.h - [Paul Sutton ] - - *) Make sure RewriteLock can be used only in the global context, (i.e. - outside of any sections) because it's a global facility of - the rewrite engine. [Ralf S. Engelschall] - - *) Fix the ownership delegation for proxy directory under `make install'. - [Ralf S. Engelschall] - - *) APACI would not correctly build suexec. [Maria Verina - ] PR#4260 - - *) mod_mime_magic passed only the first 4k of a file to - uncompress/gzip, but those tools sometimes do not produce - any output unless a sufficient portion of the compressed - file is input. Change to pass the entire file -- but - only read 4k of output. - [Marcin Cieslak ] PR#4097 - - *) "IndexOptions None" generated extra spaces at the end of each - line. [inkling@firstnethou.com] PR#3770 - - *) The "100 Continue" response wasn't being sent after internal - redirects. [Jose KAHAN ] PR#3910, 3806, 3575 - - *) When padding the name with spaces for display, mod_autoindex would - count &, <, and > in their escaped width, messing up the display. - [Dean Gaudet] PR#4075, 3758 - - *) PORT: fixed a compilation problem on NEXT. - [Jacques Distler ] PR#4130 - - *) r->request_time wasn't being set properly in certain error conditions. - [Dean Gaudet] PR#4156 - - *) PORT: deal with UTS compiler error in http_protocol.c - [Dave Dykstra ] PR#4189 - - *) Add ap_vrprintf() function. [John Tobey ] PR#4246 - - *) Fix the mod_mime hash table to work properly with locales other - than C. [Dean Gaudet] PR#3427 - - *) Fix a memory leak which is exacerbated by certain configurations. - [Dean Gaudet] PR#4225 - - *) Prevent clobbering saved IFS values in APACI. [Jim Jagielski] - - *) Fix buffer overflows in ap_uuencode and ap_uudecode pointed out - by "Peter 'Luna' Altberg " and PR#3422 - [Peter 'Luna' Altberg , Ronald Tschalär] - - *) Make {Set,Unset,Pass}Env per-directory instead of per-server. - [Ben Laurie] - - *) Correct an apparent typo: on the Windows and MPE platforms, the - htpasswd utility was limiting passwords to only 8 characters. - [Ken Coar] - - *) EBCDIC platforms: David submitted patches for two bugs in the - MD5 digest port for EBCDIC machines: - a) the htdigest utility overwrote the old contents of the digest file - b) the Content-MD5 header value (ContentDigest directive) was wrong - when the returned file was not converted from EBCDIC, but was a - binary (e.g., image file) in the first place. - [David McCreedy ] - - *) support/htpasswd now permits the password to be specified on the - command line with the '-b' switch. This is useful when passwords - need to be maintained by scripts -- particularly in the Win32 - environment. [Ken Coar] - - *) Win32: Win32 multiple services patch. Added capability to install and - run multiple copies of apache as individual services. - - Example 1: - apache -n apache1 -i -f c:/httpd.conf - Installs apache as service 'apache1' and associates c:/httpd.conf - with that service. - net start apache1 - Starts apache1 service. - net stop apache1 - Stops apache1 service - - Example 2: - apache -n apache2 -i - Installs apache as service 'apache2'. httpd.conf is located under - the default server root (/apache/conf/httpd.conf). - net start apache2 - Starts apache2 service. - - Example 3: - apache -n apache3 -i -d c:/program files/apache - Install apache as service 'apache3' and sets server root to - c:/program files/apache. - - Example 4: - apache -n apache2 -k restart - Restart apache2 service - - [Keith Wannamaker, Ken Parzygnat, Bill Stoddard] - - *) Correct the signed/unsigned character handling for the MD5 routines; - mismatches were causing compilation problems with gcc -pedantic and - in the TPF cross-compilation. [Ken Coar] - - *) OS/2: Rework CGI handling to use spawn*() instead of fork/exec, achieving - a roughly 5 fold speed up. [Brian Havard] - - *) proxy ftp: instead of using the hardwired string "text/plain" as - a fallback type for files served by the ftp proxy, use the - ap_default_type() function to determine the configured type. - This allows for special configurations like - - DefaultType gargle/blurb - - Additionally, add the Content-Encoding: header to FTP proxy replies - when the encoding is defined (by the AddEncoding directive). - Because it was missing, it was almost impossible to browse compressed - files using the FTP proxy (works now perfectly in Communicator). - The ftp proxy now also returns the Date: and Server: header lines (if not - much else... This code is "somewhat" broken) like normal requests do. - [Martin Kraemer] - - *) Be more smart in APACI's configure script when determining the UID/GID - for User/Group directives and use the determined UID/GID to initialize - the permissions on the proxycachedir. - [Dirk-Willem van Gulik, Ralf S. Engelschall] - - *) Changed the forking-prior-to-cleanup in the proxy module to first - check wether it actually needs to collect garbage. This reduces - the number of fork()s from one/request to just the odd one an hour. - [Dirk-Willem van Gulik] - - *) Added proxy, auth and header support to src/support/ab.c. Added a - README file to src/support/ - [Dirk-Willem van Gulik] - - *) Don't hard-code the path to AWK in --shadow bootstrapping Makefile. - [Ralf S. Engelschall] PR#4050 - - *) Add support for DSO module compilation on BSD/OS 3.x. - [Randy Terbush, Covalent Technologies] - - *) Fix sed-substitutions in `make install': path elements like `httpd/conf' - (for instance from an APACI configure --sysconfdir=/etc/httpd/conf - option) were substituted with $(TARGET).conf, etc. Same for other strings - with dots where the dot wasn't matched as plain text. - [Ralf S. Engelschall] - - *) PORT: Add support for FreeBSD 4.x [Ralf S. Engelschall] - - *) Fix verbose output of APACI configure (option -v) - [Martin Kraemer, Ralf S. Engelschall] - -Changes with Apache 1.3.6 - - *) Removed new PassAllEnv code due to DSO problems. [Lars Eilebrecht] - -Changes with Apache 1.3.5 [not released] - - *) M_INVALID needed a value within the scope of METHODS so that unknown - methods can be access controlled. [Roy Fielding] PR#3821 - - *) Added PassAllEnv; makes server's entire environment available - to CGIs and SSIs executed within directive's scope. [Ken Coar] - - *) ap_uuencode() always added two trailing '='s and encoding of - 8 bit characters on a machine with signed char may produced - incorrect results. Additionally ap_uuencode() should now - work correctly on EBCDIC platforms. - [Ronald Tschalär ] PR#3411 - - *) WIN32: Binary installer now runs the configuration DLL before - the reboot prompt (which is only given if MSVCRT.DLL system - DLL is new or updated). This should avoid the configuration - directory being empty after installation. [Paul Sutton] - PR#3767, 3800, 3827, 3850, 3900, 3953, 3988 - - *) WIN32: Binary installer now creates Start menu options to start - and stop Apache as a console application and to uninstall - the Apache service on NT. [Paul Sutton] PR#3741 - - *) WIN32: Apache.exe now contains an icon. [Paul Sutton] - - *) PORT: Switch back to using fcntl() locking on Linux -- instabilities - have been reported with flock() locking (probably related to kernel - version). [Dean Gaudet] PR#2723, 3531 - - *) Using APACI, the main config file (usually httpd.conf) was - not being adjusted as $(TARGET).conf. [Wilfredo Sanchez - ] - - *) PORT: AIX does not require the SHARED_CODE "hack" - [Ryan Bloom ] - - *) Set-Cookie headers were being doubled up for some CGIs by the O(n^2) - avoidance code added in 1.3.3. - [Dean Gaudet, Jeff Lewis ] PR#3872 - - *) ap_isxdigit was somehow neglected when adding the ap_isfoo() macros - for 8-bit safeness. [Dean Gaudet] - - *) PORT: Use -fPIC instead of -fpic on Solaris and SunOS for compiling DSOs - because SPARCs have a small machine-specific maximum size for the Global - Offset Table which is often exceeded when compiling one of the larger - third-party modules with Apache. [Peter Urban ] PR#3977 - - *) Move the directive `ExtendedStatus' in httpd.conf-dist-win _after_ the - DSO/DLL section because it's a directive from mod_status and isn't - available before the DLL of mod_status is loaded. - [Martin POESCHL ] PR#3936 - - *) SECURITY: Fix a bug in the calculation of the buffer size for the line - continuation facility in Apache's configuration files which could - lead to a buffer overflow situation. - [Thomas Devanneaux ] PR#3617 - - *) Make documentation and error messages of APACI's --activate-module=FILE - option more clear. [Jan Wolter ] PR#3995 - - *) Fix the gcc version check (for enabling the `inline' facility) to - really support all future gcc versions >= 2.7 until we know more. - [John Tobey ] PR#3983 - - *) Let APACI's configure script correctly complain for unknown --enable-XXX - and --disable-XXX options. [Ralf S. Engelschall] PR#3958 - - *) Link the shared core bootstrap program (``Rule SHARED_CORE=yes'') also - against libap.a and use its ap_snprintf() instead of sprintf() to avoid - possible buffer overflows. [Ralf S. Engelschall] - - *) Remove no longer used non-API function ap_single_module_init(). - [Ralf S. Engelschall] - - *) Add Apple's Mac OS X Server Layout "Rhapsody" to config.layout. - [Wilfredo Sanchez] - - *) Add cgidir, htdocsdir, iconsdir variables to Makefile.tmpl in order - to make platform installations easier. [Wilfredo Sanchez] - - *) In configure, do not append the target name to the directory path if - the path already contains "apache". [Ralf S. Engelschall] - - *) SIGPIPE is now ignored by the server core. The request write routines - (ap_rputc, ap_rputs, ap_rvputs, ap_rwrite, ap_rprintf, ap_rflush) now - correctly check for output errors and mark the connection as aborted. - Replaced many direct (unchecked) calls to ap_b* routines with the - analogous ap_r* calls. [Roy Fielding] - - *) Enhanced mod_rewrite's mapfile handling: The in-core cache for text and - DBM format mapfiles now uses a 4-way hash table with LRU functionality. - Furthermore map lookups for non-existent keys are now cached as well. - Additionally "txt" maps are now parsed with simple string functions - instead of using ap_pregcomp(). As a side effect a bug that prevented - the usage of keys containing the "," character was fixed. - The changes drastically improve the performance when large rewrite maps - are in use. - [Michael van Elst , Lars Eilebrecht] PR#3160 - - *) Added ap_sub_req_method_uri() for doing a subrequest with a method - other than GET, and const'd the definition of method in request_rec. - [Greg Stein] - - *) Use proper pid_t type for saving PIDs in alloc.c. [John Bley] - - *) Replaced use of WIN32 define with HAVE_DRIVE_LETTERS to indicate - when the OS allows a DOS drive letter within pathnames. [Brian Havard] - - *) Add %V to mod_log_config, this logs the hostname according to the - UseCanonicalName setting (this is the pre-1.3.4 behaviour of - %v). Useful for mass vhosting. [Tony Finch ] - - *) Add support for \n and \t to mod_log_config, can be used to produce - more reliable logs with multiline entries. [Tony Finch ] - - *) Fixed a few compiler nits. [John Bley ] - - *) Added informative error messages for failed munmap() and fseek() calls - in http_core.c. [John Bley, Roy Fielding] - - *) Added some informative error messages for some failed malloc() - calls. [John Bley , Jim Jagielski] - - *) OS/2 ap_os_canonical_filename()'s behaviour is improved: ap_assert() - is removed. This allows directives to work and - prevents invalid requests from killing the process. - [Brian Havard ] - - *) Reorganised FAQ document. - [Joshua Slive ] PR#2497 - - *) src/support/: The ApacheBench benchmark program was overhauled by - David N. Welton: you can now have it generate an HTML TABLE, presumably - for integration into other HTML sources. David updated the ab man page - as well and added some missing descriptions. Thanks! - [David N. Welton ] - - *) Win32: The filename validity checker now allows filenames containing - characters in the range 0x80 to 0xff (for example accented characters). - [Paul Sutton] PR#3890 - - *) Added conditional logging based upon environment variables to - mod_log_config. mod_log_referer and mod_log_agent - are now deprecated. [Ken Coar] - - *) Allow apache acting as a proxy server to relay the real - reason of a failure to a client rather than the "internal - server error" it does currently. The general exposure mechanism - can be triggered by any module by setting the "verbose-error-to" - note to "*"; this allows more than just proxy errors to be exposed. - [Cliff Skolnick, Roy Fielding, Martin Kraemer] Related to PR#3455, 4086 - - *) Moved man pages for ab and apachectrl to section 8. - [Wilfredo Sanchez, Roy Fielding] - - *) Added -S option to install.sh so that options can be passed to - strip on some platforms. [Ralf S. Engelschall, Wilfredo Sanchez] - - *) Tweak modules Makefile generated by Configure so that it handles - the test case of no modules being selected. [chaz@reliant.com] - - *) Added a sectioning directive that allows - the user to assign authentication control to any HTTP method that - is *not* given in the argument list; i.e., the logical negation - of the directive. This is particularly useful for controlling - access on methods unknown to the Apache core, but perhaps known by - some module or CGI script. [Roy Fielding, Tony Finch] - - *) Prevent apachectl from complaining if the PIDFILE exists but - does not contain a process id, as might occur if the server is - being rapidly restarted. [Wilfredo Sanchez] - - *) Win32: Add global symbols missing from ApacheCore.def. [Carl Olsen] - - *) Entity tag comparisons for If-Match and If-None-Match were not being - performed correctly -- weak tags might cause false positives. Also, - strong comparison wasn't properly enforced in all cases. - [Roy Fielding, Ken Coar, Dean Gaudet] PR#2065, 3657 - - *) OS/2: Supply OS/2 error code instead of errno on semaphore errors. - [Brian Havard] - - *) Work around a bug in Lynx regarding its sending "Negotiate: trans" - even though it doesn't understand TCN. [Koen Holtman, Roy Fielding] - - *) Added ap_size_list_item(), ap_get_list_item(), and ap_find_list_item() - to util.c for parsing an HTTP header field value to extract the next - list item, taking into account the possible presence of nested comments, - quoted-pairs, and quoted-strings. ap_get_list_item() also removes - insignificant whitespace and lowercases non-quoted tokens. - [Roy Fielding] PR#2065 - - *) proxy: The various calls to ap_proxyerror() can return HTTP/1.1 status - code different from 500. This allows the proxy to, e.g., return - "403 Forbidden" for ProxyBlock'ed URL's. [Martin Kraemer] Related to PR#3455 - - *) Fix ordering of language variants for the case where the traditional - negotiation algorithm is being used with multiple language variants - and no Accept-Language. [James Treacy ] PR#3299, 3688 - - *) Do not round the TCN quality calculation to 5 decimal places, - unlike RFC 2296, because the calculation might need 12 decimal places - to get the right result. [Roy Fielding] - - *) Remove unused code to disable transparent negotiation when - negotiating on encoding only, as we now handle encoding too - (though this is nonstandard for TCN), remove charset=ISO-8859-1 - fiddle from the fiddle-averse RVSA comparison, and fix bugs in - some debugging statements within mod_negotiation. [Koen Holtman] - - *) Fixed a rare memory corruption possibility in mod_dir if the index - file is negotiable and no acceptable variant can be found. - [Dean Gaudet, Roy Fielding, Martin Kraemer] - - *) Win32: Add new config directive, ScriptInterpreterSource, to enable - searching the Win32 registry for script interpreters. - [Bill Stoddard] - - *) Win32: The compiled-in default filename for the error log is now - error.log, which matches the default in the distributed httpd.conf. - [Paul Sutton] - - *) Win32: Any error messages from -i or -u command line options are now - displayed on the console output rather than sent to the error log. - Also the "Running Apache..." message is not output unless Apache is - going to serve requests. [Paul Sutton] - - *) Rework the MD5 authentication scheme to use FreeBSD's algorithm, - and use a private significator ('$apr1$') to mark passwords as - being smashed with our own algorithm. Also abstract the password - checking into a new ap_validate_password() routine. [Ken Coar] - - *) Win32: The filename validity checker now allows "COM" but refuses - access to "COM1" through "COM4". This allows filenames such - as "com.name" to be served. [Paul Sutton] PR#3769. - - *) BS2000: Adapt to the new ufork() system call interface which will - make subtasking easier on the OSD/POSIX mainframe environment. - [Martin Kraemer] - - *) Add a compatibility define for escape_uri() -> ap_escape_uri() to - ap_compat.h. [David White ] PR#3725 - - *) Make NDBM file suffix determination for mod_rewrite more accurate, i.e. - use `.db' instead of `.pag' not only for FreeBSD, but also when - the NDBM library looks like Berkeley-DB based. - [Ralf S. Engelschall] PR#3773 - - *) Add ability to handle DES or MD5 authentication passwords. - [Ryan Bloom ] - - *) Fix O(n^2) memory consumption in mod_speling. [Dean Gaudet] - - *) SECURITY: Avoid some buffer overflow problems when escaping - quoted strings. (This overflow was on the heap and we believe - impossible to exploit.) [Rick Perry ] - - *) Let src/Configure be aware of CFLAGS options starting with plus - signs as it's the case for the HP/UX compiler. - [Doug Yatcilla ] PR#3681 - - *) Remove the hard-wire of TAR=tar (we now check for gtar and gnutar first) - and check to see if the tar we wind up with supports '-h'. - [Jim Jagielski] PR#3671 - - *) A consistent and conservative style for all shell scripts has been - implemented. Basically, all shell string tests use the traditional - hack of 'if [ "x$var" != "x" ]' or 'if [ "x$var" = "xstring" ]' - to protect against bare null variable strings (ie: wrapping both - sides with double quotes and prepending 'x'). 'x' was chosen - because it's more universal and hopefully easier for old shell - prgrammers, as well as being easier to search for in 'vi' (/x\$) :) - [Jim Jagielski] - - *) The status module now prints out both the main server generation as - well as the generation of each process. Also, the vhost info is - printed with '?notable'. [Jim Jagielski] - - *) Move src/main/md5c.c to src/ap/ap_md5c.c; it's httpd-neutral - and this makes its functions available to things in src/support. - [Ken Coar] - -Changes with Apache 1.3.4 - - *) Renamed macros status_drops_connection to ap_status_drops_connection - and vestigial scan_script_header to ap_scan_script_header_err, - mostly for aesthetic reasons. [Roy Fielding] - - *) The query switch "httpd -S" didn't exit after showing the - vhost settings. That was inconsistent with the other query functions. - [Martin Kraemer] - - *) Moved the MODULE_MAGIC_COOKIE from before the versions and - filename to the end of the STANDARD_MODULE_STUFF. Its - presence at the beginning prevented reporting of the filename - for modules compiled before 1 January 1999. [Ken Coar] - - *) SECURITY: ap_os_is_filename_valid() has been added to Win32 - to detect and prevent access to special DOS device file names. - [Paul Sutton, Ken Parzygnat] - - *) WIN32: Created new makefiles Makefile_win32.txt (normal build) - and Makefile_win32_debug.txt (debug build) that work on Win95. - Run each of the following from the src directory: - nmake /f Makefile_win32.txt # compiles normal build - nmake /f Makefile_win32.txt install # compiles and installs - nmake /f Makefile_win32.txt clean # removes compiled junk - nmake /f Makefile_win32_debug.txt # compiles debug build - nmake /f Makefile_win32_debug.txt install - nmake /f Makefile_win32_debug.txt clean - [Roy Fielding] - - *) Added binbuild.sh and findprg.sh helpers to make it easier for us - to build binary distributions. [Lars Eilebrecht] - - *) IndexOptions SuppressColumnSorting only turned off making - the column headers anchors; you could still change the display - order by manually adding a '?N=A' or similar query string to the - URL. Now SuppressColumnSorting locks in the sort order so - it can't be overridden this way. [Ken Coar] - - *) Added IndexOrderDefault directive to supply a default sort order - for FancyIndexed directory listings. [Ken Coar] PR#1699 - - *) Change the ap_assert macro to a variant that works on all platforms. - [Richard Prinz ] PR#2575 - - *) Make sure under ELF-based NetBSD (now) and OpenBSD (future) we don't - search for an underscore on dlsym() (as it's already the case - for FreeBSD 3.0). [Todd Vierling ] PR#2462 - - *) Small fix for mod_env.html: The module was documented as to be _not_ - compiled into Apache per default, although it _IS_ compiled into - Apache per default. [Sim Harbert ] PR#3572 - - *) Instead of fixing a bug in the generation procedure for config.status (a - backslash was missing) we remove the bug together with it's complete - context because the special cases of the past can now no longer occur - because of the recent magic for the --with-layout default. - [Ralf S. Engelschall] PR#3590 - - *) Make top-level Makefile aware of a parallel build procedures (make -j) by - making sure the src/support/ tools are _forced_ to be build last (they - depend on other libraries). - [Markus Theissinger ] - - *) Fix installation procedure: Now that os-inline.c is actually used (a - recently fixed bug prevented this) we need to also install os-include.c - in addition to os.h into the PREFIX/include/ location or building of - module DSOs with APXS fails. [Ralf S. Engelschall] PR#3527 - - *) Added MODULE_MAGIC_COOKIE as the first field in a module structure to - allow us to distinguish between a garbled DSO (or even a file which isn't - an Apache module DSO at all) and a DSO which doesn't match the current - Apache API. [Ralf S. Engelschall] PR#3152 - - *) Two minor enhancements to mod_rewrite: First RewriteRule now also - supports the ``nocase|NC'' flag (as RewriteCond already does for ages) to - match case insensitive (this especially avoids nasty patterns like - `[tT][eE][sS][tT]'). Second two additional internal map functions - `escape' and `unescape' were added which can be used to escape/unescape - to/from hex-encodings in URLs parts (this is especially useful in - combination with map lookups). - [Magnus Bodin, Ian Kallen, Ralf S. Engelschall] - - *) Renamed the macro escape_uri() to ap_escape_uri() which was - forgotten (because it was a macro) in the symbol renaming process. - [Ralf S. Engelschall] - - *) Fix some inconsistencies related to the scopes of directives. The only - user visible change is that the directives `UseCanonicalName' and - `ContentDigest' now use the (more correct) `Options' scope instead of - (less correct) `AuthConfig' scope. [Ralf S. Engelschall] - - *) Using DSO, the Server token was being mangled. Specifically, the - module's token was being added first before the Apache token. This - has been fixed. [Jim Jagielski] - - *) Major overhaul of mod_negotiation.c, part 2. - - properly handle "identity" within Accept-Encoding. - - allow encoded variants in RVSA negotiation and let them appear in - the Alternates field using the non-standard "encoding" tag-list. - - fixed both negotiation algorithms so that an explicitly accepted - encoding is preferred over no encoding if "identity" is not - included within Accept-Encoding. - - added ap_array_pstrcat() to alloc.c for efficient concatenation - of large substring sequences. - - replaced O(n^2) memory hogs in mod_negotiation with ap_array_pstrcat. - [Roy Fielding] - - *) Major overhaul of mod_negotiation.c, part 1. - - cleanups to mod_negotiation comments and code structure - - made compliant with HTTP/1.1 proposed standard (rfc2068) and added - support for everything in the upcoming HTTP/1.1 - revision (draft-ietf-http-v11-spec-rev-06.txt). - - language tag matching also handles tags with more than 2 - levels like x-y-z - - empty Accept, Accept-Language, Accept-Charset headers are - processed correctly; previously an empty header would make all - values acceptable instead of unacceptable. - - allowed for q values in Accept-Encoding - - added support for transparent content negotiation (rfc2295 and - rfc2296) (though we do not implement all features in these drafts, - e.g. no feature negotiation). Removed old experimental version. - - implemented 'structured entity tags' for better cache correctness - (structured entity tags ensure that caches which can deal with Vary - will (eventually) be updated if the set of variants on the server - is changed) - - this involved adding a vlist_validator element to request_rec - - this involved adding the ap_make_etag() function to the global API - - modified guessing of charsets used by Apache negotiation algorithm - to guess 'no charset' if the variant is not a text/* type - - added code to sort multiviews variants into a canonical order so that - negotiation results are consistent across backup/restores and mirrors - - removed possibility of a type map file resolving to another type map - file as its best variant - [Koen Holtman, Roy Fielding, Lars Eilebrecht] PR#3451, 3299, 1987 - - *) RFC2396 allows the syntax http://host:/path (with no port number) - but the proxy disallowed it (ap_proxy_canon_netloc()). - [David Kristol ] PR#3530 - - *) When modules update/modify the file name in the configfile_t structure, - syntax errors will report the updated name, not the original one. - [Fabien Coelho ] PR#3573 - - *) Correct some filename case assumptions from WIN32 to - CASE_BLIND_FILESYSTEM. [Brian Havard ] - - *) For %v log ServerName regardless of the UseCanonicalName - setting (similarly for %p). [Dean Gaudet] - - *) Configure was initializing the variables $OSDIR, $INCDIR and $SHELL - rather late (too late for some invocations of TestCompile). - This improves the make environment available to TestCompile and - the *.module scripts. [Martin Kraemer] - - *) The hashbang emulation code in ap_execve.c would interpret - #!/hashbang/scripts correctly, but failed to fall back to a - standard shell for scripts which did NOT start with #! - Now SHELL_PATH is started in these cases. [Martin Kraemer] - - *) PORT: Added the Cyberguard V2 port [Richard Stagg ] - PR#3336 - - *) Update APXS manual page: some -q option arguments were missing - and another was incorrect. [Mark Anderson ] PR#3553 - - *) Cleanup the command line options: `-?' was documented to show - the usage list but does it with an error because `?' is not a valid - command. OTOH a lot of users expect `-h' to print such a usage list and - instead are annoyed for ages by our huge unreadable list of directives. - So we now changed the command line options this way: - 1. `-L' => `-R' - Intent: we need `-L' to be free, and `-R' for the DSO run-time path is - very similar to the popular linker option. - 2. `-h' => `-L' - Intent: while -l gives the small list of modules, -L now gives the - large list of directives implemented by these modules. This is also - consistent with -v (short version info) and -V (large version info). - 3. `-?' => `-h' - Intent: it's now the expected option ;-) - The manual page was adjusted accordingly. - [Ralf S. Engelschall] PR#2714 - - *) Fixed problem of fclose() on an unopened file in suexec if LOG_EXEC - wasn't defined. [Rick Franchuk ] - - *) Removed recently introduced bugs and disfigurements in APACI: - o fixed argument line processing: using $args was broken: It was not - initialized and using args="$args $apc_option" and even args="$args - \"$apc_option\"" fails in the second processing round for any arguments - containing whitespaces. The only correct way is to use the construct - "$@" (but not possible here) or iterate _both_ times over the implicit - argument line (no argument to for-loop) which is what we now use. - o make --with-layout=Apache the default without creating - redundancy (copying the --with-layout block in the argument parsing - loop). We achieve this by using the "$@" construct together with the - `set' command to prepend --with-layout=Apache to the command line in - case --with-layout is not used. - o fixed auto-suffix handling now that config.layout exists. - Paths which are auto-suffixed are marked with a trailing plus sign in - config.layout and every path now can be marked this way (not only the - four paths for which we do it currently). Additionally the suffix is - no longer a static one. Instead it's now `/' where is - the argument of the --target option or per default `httpd'. - o allow also tabs (and only spaces) where we match whitespaces - o various fixes and cleanups related to used shell coding style - o made Jim happy by replacing `Written by' with `Initially written by' ;-) - o trimmed output of --help to fit into 80 columns - [Ralf S. Engelschall] - - *) Added two new core API functions, ap_single_module_configure() and - ap_single_module_init(), which are now used by mod_so to configure a module - after loading. [Ralf S. Engelschall] - - *) PORT: Add defines for USE_FLOCK_SERIALIZED_ACCEPT and - SINGLE_LISTEN_UNSERIALIZED_ACCEPT to NetBSD/OpenBSD section - of ap_config.h to allow serialized accept for multiport listens. - [Roy Fielding, Curt Sampson] PR#3120 - - *) PORT: Fixed a misplaced #endif for NetBSD/OpenBSD section - of ap_config.h that would skip several defines if DEFAULT_GROUP - was overridden. [Roy Fielding] - - *) PORT: The I86 version of DGUX has support for strncasecmp and - strcasecmp, so allow it in ap_config.h. [Amiel Lee Yee] PR#3247 - - *) Fix ordering of definitions in ap_config.h so that ap_inline is - defined before it might be used. [Victor Khimenko] - - *) PORT: Add Dynamic Shared Object (DSO) support for BSDI (v4.0). - [Tom Serkowski ] PR#3453 - - *) Make generation of src/Configuration.apaci more robust: It failed to - differenciate between modules when one module name was a postfix of - another (e.g. cgi vs. fastcgi). We now check for mod_XXX, libXXX and even - just XXX (think about totally non-standard names like "apache_ssl", too). - [Ralf S. Engelschall] PR#3380 - - *) In src/Configure remove the SERVER_SUBVERSION support (already deprecated - since 1.3b7) and make whitespace handling more robust (it failed horrible - when whitespaces were present in the arguments of -D options). - [Ralf S. Engelschall] PR#3240 - - *) Add APACI --shadow=DIR variant (in addition to --shadow). This now first - creates an external package shadow tree in DIR before the local build - shadow tree is generated under DIR. This way one can have the extracted - Apache distribution tree read-only on NFS or CDROM and still build Apache - from these sources. An automatically triggered VPATH-like mechanism is - provided through the TOP variable, too. - [Ralf S. Engelschall, Wilfredo Sanchez ] - - *) Fix negotiation so that a Vary response header is correctly - generated when, for a particular dimension, variants only vary - in having or not having a value for that dimension. [Paul Sutton] - - *) Fix negotiation so that we prefer an encoded variant over an - unencoded variant if the user-agent explicitly says it can - accept that encoding. Previously we always preferred the unencoded - variant. - [Paul Ausbeck , Paul Sutton] PR#3447 - - *) Fix APXS tool: query variables LIBS_SHLIB and TARGET were not recognized - and the usage page was inconsistent with the functionality and manpage. - [Ralf S. Engelschall] - - *) Allow special options -Wc,xxx and -Wl,xxx on APXS compile/link command. - They can occur multiple times and their arguments (`xxx') are passed AS - IS to the compiler/linker command. [Ralf S. Engelschall] - - *) Fixed possible (but harmless in practice) bug in the DBM lookup - procedure of mod_rewrite: very long keys were truncated. - [Ralf S. Engelschall] - - *) Added a generic --with-layout=[FILE:]ID option. ID here is a layout - identifier, currently "Apache" and "GNU" are pre-defined in the file - config.layout. Custom layouts are possible by using FILE:ID as the - argument where the layout ID is taken from FILE. - - The config.layout file consists of .. sections - where inside those sections "path_variable: path_value" pairs can be - specified. These lines are converted to path_variable='path_value'. - - *) Add a DefaultLanguage directive so that files missing a language - extension (e.g., .fr, .de) can be labelled as being some other - default language. DefaultLanguage can appear in and - containers as well as .htaccess files. [Paul Sutton] - PR#1180 - - *) Fix TARGET configuration when configuring and installing using - APACI configure. TARGET now defines the basename of the configuration - file, startup script, manual page, etc. log_error_core() now reports - the server binary name given by argv[0]. TARGET can now also be defined - with --target=TARGET parameter passed to APACI configure. - [Ralf Engelschall, Randy Terbush] - - *) mod_include.c:handle_perl() now properly tests for OPT_INCNOEXEC - rather than OPT_INCLUDES [Rainer Schoepf ] - - *) ap_md5_binary() was using sprintf() rather than a table lookup - to convert binary bytes to hex digits. - [Ronald Tschalär ] PR#3409 - - *) Fix SEGV in TCN negotiation if no variants are acceptable. - [Martin Plechsmid ] PR#1987 - - *) API: ap_exists_config_define() function is now "public" [Doug MacEachern] - - *) Fix documentation of `Action' directive: It can activate a CGI script - when either a handler or a MIME content type is triggered by the request. - [Andrew Pimlott ] PR#3340 - - *) Document the `add' command of `dbmmanage' in `dbmmanage.1' manpage. - [David MacKenzie ] PR#3394 - - *) Ignore a "ErrorDocument 401" directive with a full URL and write a - notice to the error log. It is not possible to send a 401 response - and a redirect at the same time. [Lars Eilebrecht] - - *) Fallback to native compilers for IRIX-32 platform. It seems that - a gcc 2.8.1 compiled apache is logging client addresses with all - bits set (255.255.255.255). This is the second such problem caused - by gcc 2.8.1 compiler. The first being broken semaphore locking. - [Randy Terbush] - - *) Updated mime.types to reflect current Internet media types - and include a URL to the registry. - [Manoj Kasichainula, Roy Fielding] PR#2380, 2286, 2246 - - *) SECURITY: Do a more complete check in mod_include to avoid - an infinite loop of recursive SSI includes. [Marc Slemko] PR#3323 - - *) Add APACI --suexec-docroot and --suexec-logfile options which can be - used to set the document root directory (DOC_ROOT) and the suexec - logfile (LOG_EXEC), respectively. Additionally the --layout option - was changed to show more information about the suEXEC setup. - [Lars Eilebrecht] PR#3316, 3357, 3361 - - *) Added the last two WebDAV status codes of 424 (Failed Dependency) - and 507 (Insufficient Storage) for use by third-party modules. - [Roy Fielding] - - *) Enabled all of the WebDAV method names for use by third-party - modules, Limit, and Script directives. That includes PATCH, - PROPFIND, PROPPATCH, MKCOL, COPY, MOVE, LOCK, and UNLOCK. - Improved mod_actions.c so that it can use any of the methods - defined in httpd.h. Added ap_method_number_of(method) for - getting the internal method number. [Roy Fielding] - - *) PORT: Add a port to the TPF OS. [Joe Moenich and - others at IBM] - - *) Fix problems with handling of UNC names (e.g., \\host\path) - on Win32. [Ken Parzygnat ] - - *) Rework os_canonical_*() on Win32 so it's simpler, more - robust, and works. [Ken Parzygnat ] - PR#2555, 2915, 3064, 3232 - - *) Work around incomplete implementation of strftime on Win32. - [Manoj Kasichainula, Ken Parzygnat ] - - *) Move a typedef to fix compile problems on Linux with 1.x kernels. - [Manoj Kasichainula] PR#3177 - - *) PORT: Add a port to the Concurrent PowerMAX OS. [Tom Horsley - ] - - *) WIN32: Log more explicit error messages if spawning an interpreted - script failed, including the command line used to attempt to execute - the interpreter and the Win32 error code returned. [Marc Slemko] - - *) Disable sending of error-notes on a 500 (Internal Server Error) response - since it often includes file path info. Enable sending of error-notes - on a 501 (Method Not Implemented). [Roy Fielding] PR#3173 - - *) http_config.c would respond with 501 (Method Not Implemented) if a - content type handler was specified but could not be found, which - should have been a 500 response. Likewise, mod_proxy.c would responsd - with a 501 if the URI scheme is unrecognized instead of the correct - response of 403 (Forbidden). [Roy Fielding] - - *) SECURITY: Eliminate DoS attack when a bad URI path contains what - looks like a printf format escape. [Marc Slemko, Studenten Net Twente] - - *) Fix in mod_autoindex: for files where the last modified time stamp was - unavailable, an empty string was printed which was 2 bytes short. - The size and description columns were therefore not aligned correctly. - [Martin Kraemer] (no PR#) - - *) Update BS2000 OS code to work with recent versions. Starting with - release A17, the child fork() must be replaced by a _rfork(). - (BS2000 only) [Martin Kraemer] - - *) Add the actual server_rec structure of the specific Vhost to the - scoreboard file and avoid a string copy (as well as allow some - further future enhancements). [Harrie Hazewinkel - ] - - *) Add APACI --permute-module=foo:bar option which can be used to - on-the-fly/batch permute the order of two modules (mod_foo and mod_bar) - in the Configuration[.apaci] file. Two special and important variants are - supported for the option argument: first BEGIN:foo which permutes module - mod_foo with the begin of the module list, i.e. it `moves' the module to - the begin of the list (gives it lowest priority). And second foo:END - which permutes mod_foo with the end of the module list, i.e. it `moves' - the module to the end of the list (gives it highest priority). - [Ralf S. Engelschall] - - *) Fix problem with 'apache -k shutdown' and startup event - synchronisation (Win32). [Ken Parzygnat ] - PR#3255 - - *) The config parser wasn't correctly noticing a missing '>' - on container start lines (e.g., it wouldn't spot - "] - PR#3279 - - *) Add a 'RemoveHandler' directive which will selectively remove - all handler associations for the specified file extensions. - [Ryan Bloom ] PR#1799. - - *) Properly handle & allow "nul" and ".*/null" in AccessConfig and - ResourceConfig directives on Win32. Also add a note to the effect - of 'useless User directive ignored on Win32' to the errorlog if - a User directive is encountered on Win32. - [Ken Parzygnat ] PR#2078, 2303. - - *) Fix multiple whitespace handling in imagemaps for mod_imap which was - broken since Apache 1.3.1 where we took out compressing of multiple - spaces in ap_cfg_getline(). - [Ivan Richwalski ] PR#3249 - - *) Fix Berkeley-DB/2.x support in mod_auth_db: The data structures were not - initialized correctly and the db_open() call used an invalid mode - parameter. [Ron Klatchko ] PR#3171 - - *) PORT: DSO support for UnixWare 7 - [Ralf S. Engelschall, Ron Record ] - - *) Merge the contents of the {srm,access}.conf-dist* files into the - httpd.conf-dist* files. The srm and access files now contain - only comments, and httpd.conf has all the combined contents in - a rational order. [Ken Coar] - - *) PORT: DSO/ELF support for FreeBSD 3.0. - [Ralf S. Engelschall, Dirk Froemberg ] - - *) Add a "default-handler" handler that calls the default_hander() - function which is normally called for static content. This allows - you to override a specific handler. [Marc Slemko] - - *) Further simplify checking for absolute paths by replacing an - hard-coded syntax check with a call to a routine we already created to - do this. [Ken Parzygnat ] PR#2976, 3074 - - *) Log an error if we encounter a malformed "require" directive - in mod_auth if we know that we know that no other module can - deal with it. [Marc Slemko] - - *) Remove ap_private_extern method of hiding conflicting symbols - on the NEXT platform because it is not correct for all versions, - and the versions for which it is correct are unknown. - [Wilfredo Sanchez ] - - *) Fix inheritance of IndexOptions NameWidth and remove unintended - restriction on +NameWidth, +IconHeight, and +IconWidth. [Ken Coar] - - *) Fix per-directory config merging for cases in which a 500 error - is encountered in an .htaccess file somewhere down the tree. - [Ken Coar] PR#2409 - - *) Minor performance improvement to ap_escape_html(). [Roy Fielding] - - *) Fixed a segmentation violation in mod_proxy when a response is - non-cachable. [Roy Fielding, traced by Doug Bloebaum]. PR#2950, 3056 - -Changes with Apache 1.3.3 - - *) Added a complete implementation of the Expect header field as - specified in rev-05 of HTTP/1.1. Disabled the 100 Continue - response when we already know the final status, which is mighty - useful for PUT responses that result in 302 or 401. [Roy Fielding] - - *) Remove extra trailing whitespace from the getline results as part - of the protocol processing, which is extra nice because it works - between continuation lines, is almost no cost in the normal case - of no extra whitespace, and saves memory. [Roy Fielding] - - *) Added new HTTP status codes and default response bodies from the - revised HTTP/1.1 (307, 416, 417), WebDAV (102, 207, 422, 423), and - HTTP Extension Framework (510) specifications. Did not add the - WebDAV 424 and 425 codes because they are bogus. We don't use any - of these codes yet, but they are now available to 3rd-party modules. - [Roy Fielding] - - *) Fix a possible race condition between timed-out requests and the - ap_bhalfduplex select that might result in an infinite loop on - platforms that do not validate the descriptor. [Roy Fielding] - - *) WIN32: Add "-k shutdown" and "-k restart" options to signal a - running Apache server [Paul Sutton] - - *) Fix mod_autoindex bug where directories got a size of "0k" instead - of "-". [Martin Plechsmid , Marc Slemko] - PR#3130 - - *) PORT: DRS 6000 machine. [Paul Debleecker ] - - *) Add the server signature text (from the core ServerSignature directive) - to the list of envariables available to scripts, SSI, and the like. - [Ken Coar] - - *) PORT: Fix sys/resource.h handling for SCO 3.x platform. - [M. Laak ] PR#3108 - - *) Fallback from sysconf-based to plain HZ-based `ticks per second' - calculation in mod_status for all systems which don't have POSIX - sysconf() (like UTS 2.1) and not only for the NEXT platform. - [Dave Dykstra ] PR#3055 - - *) Fix `require ...' directive parsing in mod_auth, mod_auth_dbm and - mod_auth_db by using ap_getword_white() (which uses ap_isspace()) - instead of ap_getword(..., ' ') (which parses only according to spaces - but not tabs). [James Morris , - Ralf S. Engelschall] PR#3105 - - *) Fix the SERVER_NAME variable under sub-request situations (where - `UseCanonicalName off' is used) like CGI's called from SSI pages or - RewriteCond variables by adopting r->hostname to sub-requests. - [James Grinter ] PR#3111 - - *) Fix stderr redirection under syslog-based error logging situation. - [Youichirou Koga ] PR#3095 - - *) Document `ErrorLog syslog:facility' variant of error logging. - [Youichirou Koga ] PR#3096 - - *) Fix http://localhost/ hints in top-level INSTALL document. - [Rob Jenson , Ralf S. Engelschall] PR#3088 - - *) Quote paths in default configuration files. [Wilfredo Sanchez] - - *) PORT: Remove extra HAVE_SYS_RESOURCE_H define for RHAPSODY since - it is now taken care of properly by the header file tests. - [Wilfredo Sanchez ] - - *) Fix problem with scripts and filehandle inheritance on Win32. - [Ken Parzygnat ] PR#2884, 2910 - - *) Win32 name canonicalisation could end up using the server's - working directory to fill in some blanks. [Ken Parzygnat - ] PR#3001 - - *) Correct invalid assumption by ap_sub_req_lookup_file() that all - absolute paths begin with "/" -- because they don't on Win32. - [Ken Parzygnat ] PR#2976, 3074 - - *) Add [REDIRECT_]VARIANTS environment variable to mod_speling - so that ErrorDocument 300 processors can reformat the list - if desired. [Ken Coar] PR#2859 - - *) Add +/- incremental prefixes to IndexOptions keywords, and - enable merging of multiple IndexOptions directives. [Ken Coar] - - *) PORT: Allow GuessOS to recognize Unixware 7.0.1 [Steve Cameron - ] - - *) Reconstructed the loop through multiple htaccess file names so - that missing files are not confused with unreadable files. - [Roy Fielding] - - *) The ap_pfopen and ap_pfdopen routines were failing to protect the - errno on an error, which leads to one error being mistaken for - another when reading non-existent .htaccess files. - [Jim Jagielski] - - *) OS/2: The new header tests get things right, need to update - ap_config.h. [Brian Havard] - - *) The Perl %ENV hash will now be setup by default when using the - mod_include `perl' command [Doug MacEachern] - - *) PORT: Add Pyramid DC/OSx support to configuration mechanism. - [Earle Ake ] - - *) PORT: Fix sys/resource.h handling for Amdahl's UTS 2.1 - [Dave Dykstra ] PR#3054 - - *) Correct comment in mod_log_config.c about its internals. - [Elf Sternberg ] - - *) Avoid possible line overflow in Configure: Use an awkfile to - handle the creation of modules.c [Jim Jagielski] - -Changes with Apache 1.3.2 - - *) Fix bug in ap_remove_module(), which caused problems for dso's - who were the top_module. [Doug MacEachern] - - *) Add support for Berkeley-DB/2.x (in addition to Berkeley-DB/1.x) to - mod_auth_db to both be friendly to users who wants to use this version - and to avoid problems under platforms where only version 2.x is present. - [Dan Jacobowitz , Ralf S. Engelschall] - - *) When using ap_log_rerror(), make the error message available to the - *ERROR_NOTES envariables by default. [Ken Coar] - - *) BS2000 platform only: get rid of the nasty BS2000AuthFile. - You now must define a BS2000Account name for the server User. - This has fewer security implications than the old approach. - [Martin Kraemer] - - *) Fix SHARED_CORE feature for HPUX platform: We now use extension `.sl' - instead of `.so' and `SHLIB_PATH' instead of `LD_LIBRARY_PATH' on this - platform to make the braindead HPUX linker happy. Notice, for the module - DSOs we don't have to use this, because these are loaded manually (and - not via HPUX' dld). [Ralf S. Engelschall] PR#2905, PR#2968 - - *) Remove 64 thread limit on Win32. - [Bill Stoddard ] - - *) Remove redundant substitutions in top-level Makefile.tmpl. - [Ralf S. Engelschall] - - *) Fix APACI's `Group' configuration adjustment - especially for Linux - platforms where `nogroup' exists in /etc/group. [Ralf S. Engelschall] - - *) Make PrintPath work generically instead of having one version - strictly for OS/2. [Jim Jagielski, Brian Havard] - - *) Fix the recently introduced C header file checking: We now use the C - pre-processor pass only (and no longer the complete compiler pass) to - determine whether a C header file exists or not. Because only this way - we're safe against inter-header dependencies (which caused horrible - portability problems). The only drawback is that we now have a CPP - configuration variable which has to be determined first (we do a similar - approach as GNU Autoconf does here). When all fails the user still has - the possibility to override it manually via APACI or src/Configuration. - As a fallback for the header check itself we can directly check the - existance of the file under /usr/include, too. - [Ralf S. Engelschall] PR#2777 - - *) PORT: Added RHAPSODY (Mac OS X Server) support. MAP_TMPFILE defined - as an alternate mechanism for mmap'd shared memory for RHAPSODY. - ap_private_extern defined to hide symbols that conflict with loaded - dynamic libraries on the NEXT and RHAPSODY platforms. - [Wilfredo Sanchez ] - - *) Delete PID file on clean shutdowns. - [Charles Randall ] PR#2947 - - *) Fix mod_auth_*.html documents: NSCA -> NCSA - [Youichirou Koga ] PR#2991 - - *) Fix INSTALL document: www.gnu.ai.mit.edu -> www.gnu.org - [Karl Berry ] PR#2994 - - *) Fix dbmmanage.1 manual page. - [Youichirou Koga ] PR#2992 - - *) Fix possible buffer overflow situation in suexec.c. - [Jeff Stewart ] PR#2790 - - *) Add some more LIBS for the SCO5 platform which are needed for the already - used -lprot. It's actually a bug in SCO5, of course. - [Ronald Record ] PR#2533 - - *) Fix documentation of ProxyPass/ProxyPassReverse according to the - trailing slash problem. [Jon Drukman ] PR#2933 - - *) Remove `-msym' option from LDFLAGS_SHLIB for the Digital UNIX (OSF/1) - platform, because it's only supported under version 4.0 and higher. But - because our GuessOS is still unaware of Digital UNIX versions and the - -msym is just to optimize the DSO statup time a little bit it's safe and - best when we leave it out now. [Ralf S. Engelschall] PR#2969 - - *) Fix the ap_log_error_old(), ap_log_unixerr() and ap_log_printf() - functions: First all three functions no longer fail on strings containing - "%" chars and second ap_log_printf() no longer does a double-formatting - (instead it directly passes through the message to be formatted to the - real internal formatting function). [Ralf S. Engelschall] PR#2941 - - *) Allow "Include" directives anywhere in the server config - files (but not .htaccess files). [Ken Coar] PR#2727 - - *) The proxy was refusing to serve CONNECT requests except to - port 443 (https://) and 563 (snews://). The new AllowCONNECT - directive allows the configuration of the ports to which a - CONNECT is allowed. [Sameer Parekh, Martin Kraemer] - - *) mod_expires will now act on content that is not sent from a file - on disk. Previously it would never add an Expires: header to - any response that did not come from a file on disk; the only - case where it still doesn't (and can't) add one for that type of - content is if you are using a modification date based setting. - [Marc Slemko, Paul Phillips ] - - *) Problems encountered during .htaccess parsing or CGI execution - that lead to a "500 Server Error" condition now provide explanatory - text (in the *ERROR_NOTES envariable) to ErrorDocument 500 scripts. - [Ken Coar] PR#1291 - - *) Add NameWidth keyword to IndexOptions directive so that the - width of the filename column is customisable. [Ken Coar, Dean Gaudet] - PR#1949, 2324. - - *) Recognize lowercase _and_ uppercase `uname' results under - SCO OpenServer. [David Coelho ] - - *) As duplicate "HTTP/1.0 200 OK" lines within the header seem to be - a common problem of (mis-administrated?) IIS servers, make the apache - proxy immune to these errors (and ignore the duplicates, but log - the fact to error_log). [Martin Kraemer], after the proposal in PR#2914 - - *) The ] PR#2866 - - *) Replace the inlined information grabbing stuff for the configuration - adjustment feature (no --without-confadjust) with calls to a new helper - script `buildinfo.sh' which is both more flexible and already proofed to - be more robust against platform differences. This mainly fixes the - recently occured ``sed: command garbled: ...'' problems. - [Ralf S. Engelschall] PR#2776, PR#2848 - - *) Make ab.c again pass ``gcc -Wall -Wshadow -Wpointer-arith -Wcast-align - -Wmissing-prototypes -Wmissing-declarations -Wnested-externs -Winline'' - without complains after we recently added the POST feature. - [Ralf S. Engelschall] - - *) Renamed is_HTTP_xxx() macros to ap_is_HTTP_xxx() name. They are used inside - modules as API functions and we forgot them at the big symbol renaming. - [Ralf S. Engelschall] - - *) Remove bad reference to non-existing SERVER_VERSION in mod_rewrite.html - [Youichirou Koga ] PR#2895 - - *) Dynamically size the filename column of mod_autoindex output. - [Dean Gaudet] - - *) Add the ability to do POST requests to the ab benchmarking tool. - [Kurt Sussman ] PR#2871 - - *) Bump up MAX_ENV_FLAGS in mod_rewrite.h from the too conservatice limit of - 5 to 10 because there are some users out there who always have 5 to 8 - variables in one RewriteRule and had to patch mod_rewrite.h for every - release. So 15 should be now more than enough, even for them. (I never - needed more than 4 in my RewriteRules ;-) - [Ralf S. Engelschall] - - *) Make the proxy generate and understand Via: headers - [Martin Kraemer] - - *) Change the proxy to use tables instead of array_headers for - the header lines. [Martin Kraemer] - - *) Make sure the config.status file is not overridden when just - ``configure --help'' is used. [Ralf S. Engelschall] PR#2844 - - *) Split MODULE_MAGIC_NUMBER into _MAJOR/_MINOR numbers. This should - provide a way to trace API changes that add functionality but do - not create a compatibility issue for precompiled modules, etc. - See include/ap_mmn.h for more details. [Randy Terbush] - - *) Fix suexec installation under `make install root=xxx' situation. - [Ralf S. Engelschall] - - *) Extend the output of the -V switch to include the paths of all - compiled-in configuration files, if they were overridden at - compile time, for least astonishment of the user. - [Martin Kraemer] - - *) When READing a request in ExtendedStatus mode, the "old" - vhost, request and client information is not displayed. - [Jim Jagielski] - - *) STATUS is no longer available. Full status information now - run-time configurable using the ExtendedStatus directive. - [Jim Jagielski] - - *) SECURITY: Eliminate O(n^2) space DoS attacks (and other O(n^2) - cpu time attacks) in header parsing. Add ap_overlap_tables(), - a function which can be used to perform bulk update operations - on tables in a more efficient manner. [Dean Gaudet] - - *) SECURITY: Added compile-time and configurable limits for - various aspects of reading a client request to avoid some simple - denial of service attacks, including limits on maximum request-line - size (LimitRequestLine), number of header fields (LimitRequestFields), - and size of any one header field (LimitRequestFieldsize). Also added - a configurable directive LimitRequestBody for limiting the size of the - request message body. [Roy Fielding] - - *) Make status module aware of DNS and logging states, even if - STATUS not defined. [Jim Jagielski] - - *) Fix a problem with the new OS/2 mutexes. [Brian Havard] - - *) Enhance mod_speling so that CheckSpelling can be used in - containers and .htaccess files. [Ken Coar] - - *) API: new ap_custom_response() function for hooking into the - ErrorDocument mechanism at runtime [Doug MacEachern] - - *) API: new ap_uuencode() function [Doug MacEachern] - - *) API: scan_script_header_err_core() now "public" and renamed - ap_scan_script_header_err_core() [Doug MacEachern] - - *) The 'status' module will now show the process pid's and their - state even without full STATUS accounting. [Jim Jagielski] - - *) Restore the client IP address to the error log messages, this - was lost during the transition from 1.2 to 1.3. Add a new - function ap_log_rerror() which takes a request_rec * and - formats it appropriately. [Dean Gaudet] PR#2661 - - *) Cure ap_cfg_getline() of its nasty habit of compressing internal - whitespace in input lines -- including within quoted strings. - [Ken Coar] - but leading and trailing whitespace should continue to be - stripped [Martin Kraemer] - - *) Cleanup of the PrintPath/PrintPathOS2 helper functions. Avoid - the ugly use of an env. variable and use command-line args for - alternate $PATH. Make more like advanced 'type's as well. - [Jim Jagielski] - - *) The IRIXN32 Rule was being ignored. Configure now correctly adds - -n32 only if IRIXN32 says to. [Jim Jagielski, Alain St-Denis - ] PR#2736 - - *) Clean up a warning in mod_proxy. [Ralf S. Engelschall] - - *) Renamed __EMX__ (internal define of the gcc port under OS/2) to OS2 - following the same idea as "MSVC vs WIN32". Additionally the src/os/emx/ - directory was renamed to src/os/os2/ for consistency. - [Brian Havard, Ralf S. Engelschall] - - *) Add new Rule SHARED_CHAIN which can be used to enable linking of DSO - files (here modules) against other DSO files (here shared libraries). - This is done by determining a subset of LIBS which can be safely used for - linking the DSOs, i.e. PIC libs and shared libs. Currently the rule is - disabled for all platforms to avoid problems with this (experimental) - rule. But we provide it now for those people how ran into problems and - want to came out by forcing linking against DSOs. - [Ralf S. Engelschall] PR#2587 - - *) Fix suEXEC start message: Has to be of `notice' level to really get - printed together with the standard startup message because the `notice' - level is handled special inside ap_log_error() for startup messages. - [Ralf S. Engelschall] PR#2761 PR#2761 PR#2765 - - *) Add correct `model' MIME types from RFC2077 to mime.types file. - [Ralf S. Engelschall] PR#2732 - - *) Fixed examples in mod_rewrite.html document. - [Youichirou Koga , Ralf S. Engelschall] PR#2756 - - *) Allow ap_read_request errors to propagate through the normal request - handling loop so that the connection can be properly closed with - lingering_close, thus avoiding a potential TCP reset that would - cause the client to miss the HTTP error response. [Roy Fielding] - - *) One more portability fix for APACI shadow tree support: Swap order of awk - and sed in top-level configure script to avoid sed fails on some - platforms (for instance SunOS 4.1.3 and NCR SysV) because of the - non-newline-termined output of Awk. [Ralf S. Engelschall] PR#2729 - - *) PORT: NEC EWS4800 support. - [MATSUURA Takanori ] - - *) Fix a segfault in the proxy on OS/2. [Brian Havard] - - *) Fix Win32 part of ap_spawn_child() by providing a reasonable child_info - structure instead of just NULL. This fixes at least the RewriteMap - programs under Win32. [Marco De Michele ] PR#2483 - - *) Add workaround to top-level `configure' script for brain dead - `echo' commands which interpet escape sequences per default. - [Ralf S. Engelschall] PR#2654 - - *) Make sure that the path to the Perl interpreter is correctly - adjusted under `make install' also for the printenv CGI script. - [Ralf S. Engelschall] PR#2595 - - *) Update the mod_rewrite.html document to correctly reflect the situation - of the `proxy' (`[P]') feature. [Ralf S. Engelschall] PR#2679 - - *) Fix `install-includes' sub-target of `install' target in top-level - Makefile.tmpl: The umask+cp approach didn't work as expected (especially - for users which extracted the distribution under 'umask 077'), so replace - it by an explicit cp+chmod approach. - [Richard Lloyd, Curt Sampson, Ralf S. Engelschall] PR#2656 PR#2626 - - *) Fix `distclean' and `clean' targets in src/Makefile.tmpl to have same - behavior and to cleanup correctly even under enabled SHARED_CORE rule. - [Ralf S. Engelschall] - - *) Use a more straight forward and thus less problematic Sed command in - src/helper/mkdir.sh script. [Ralf S. Engelschall] - - *) Make sure the `configure' scripts doesn't fail when trying to guess the - domainname of the machine and there are multiple `domainname' and - `search' entries in /etc/resolv.conf. - [Ralf S. Engelschall] PR#2710 - - *) Add note about the SHARED_CORE requirement on some platforms also to the - INSTALL file because a lot of users don't read htdocs/manual/dso.html - first. [Ralf S. Engelschall] PR#2701 - - *) Fix document "hyperlink" for dso.html in src/Configuration.tmpl - [Knut A.Syed ] PR#2674 - - *) Modify mod_rewrite to update the Vary response field if the URL rewriting - engine does any manipulations or decisions based upon request fields. - [Ken Coar] PR#1644 - - *) Document the special APACI behavior for installation paths where - ``/apache'' is appended to paths under some (well defined, of course) - situations to prevent pollution of system locations with Apache files. - [Ralf S. Engelschall] PR#2660 - - *) Fixed problem with buffered response message not being sent for - the read_request error conditions of URI-too-long (414) and - malformed header fields (400). [Roy Fielding] PR#2646 - - *) Add support for the Max-Forwards: header line required by RFC2068 for - the TRACE method. This allows apache to TRACE along a chain of proxies - up to a predetermined depth. [Martin Kraemer] - - *) Fix SHARED_CORE rule: The CFLAGS_SHLIB variable is no longer doubled - (compilers complained) and the .so.V.R.P filename extension was adjusted - to correctly reflect the 1.3.2 version. - [Ralf S. Engelschall] PR#2644 - - *) SECURITY: Plug "..." and other canonicalization holes under OS/2. - [Brian Havard] - - *) PORT: implement serialized accepts for OS/2. [Brian Havard] - - *) mod_include had problems with the fsize and flastmod directives - under WIN32. Fix also avoids the minor security hole of using - ".." paths for fsize and flastmod. - [Manoj Kasichainula ] PR#2355 - - *) Fixed some Makefile dependency problems. [Dean Gaudet] - -Changes with Apache 1.3.1 - - *) Disable the incorrect entry for application/msword in the - mod_mime_magic "magic" file because it also matches other Office - documents. [Ralf S. Engelschall] PR#2608 - - *) Fix broken RANLIB handling in src/Configure (the entry from - src/Configuration.tmpl was ignored) and additionally force RANLIB to - /bin/true under HP/UX where ranlib exists but is deprecated. - [Ralf S. Engelschall] PR#2627 - - *) 'apachectl status' failed on some systems. - [Steve VanDevender , Lars Eilebrecht] PR#2613 - - *) Add new flags for ap_unparse_uri_components() to make it generate - the scheme://sitepart string only, or to omit the query string. - [Martin Kraemer] - - *) WIN32: Canonicalize ServerRoot before checking to see if it - is a valid directory. The failure to do this caused certain - ServerRoot settings (eg. "ServerRoot /apache") to be improperly - rejected. [Marc Slemko] - - *) Global renaming of C header files to both get rid of conflicts with third - party packages and to again reach consistency: - 1. conf.h -> ap_config.h - 2. conf_auto.h -> ap_config_auto.h \ these are now merged - 3. ap_config.h -> ap_config_auto.h / in the config process - 4. compat.h -> ap_compat.h - 5. apctype.h -> ap_ctype.h - Backward compatibility files for conf.h and compat.h were created. - - *) mod_mmap_static will no longer take action on requests unless at - least one "mmapfile" directive is present in the configuration. - This experimental module has to do some black magic to operate - inside the current API and thus creates side-effects for other - modules under some circumstances. - [Ralf S. Engelschall] - - *) Add conservative ticks around more egrep arguments in top-level configure - to avoid problems under brain-dead platforms like Digital UNIX (OSF1). - [Ralf S. Engelschall] PR#2596 - - *) mod_rewrite created RewriteLock files under the UID of the parent - process, thus the child processes had no write access to the files. - Now a chown() is done on the file to the uid of the children, - if applicable. [Lars Eilebrecht, Ralf S. Engelschall] PR#2341 - - *) Autogenerate some HAVE_XXXXX_H defines in conf_auto.h (determined via - TestCompile) instead of defining them manually in conf.h based on less - accurate platform definitions. This way we no longer have to fiddle with - OS-type and/or OS-version identifiers to discover whether a system header - file exists or not. Instead we now directly check for the existence of - those esoteric ones. - [Ralf S. Engelschall] PR#2093, PR#2361, PR#2377, PR#2434, - PR#2524, PR#2525, PR#2533, PR#2569 - - *) mod_setenvif (BrowserMatch* and friends) will now match a missing - field with "^$". [Ken Coar] - - *) Set the RTLD_GLOBAL dlopen mode parameter to allow dynamically loaded - modules to load their own modules dynamically. This improves mod_perl - and mod_php3 when these modules are loaded dynamically into Apache. - [Rasmus Lerdorf] - - *) Cache a proxied request in the event that the client cancels the - transfer, provided that the configured percentage of the file has - already been transfered. It works for HTTP transfers only. The - new configuration directive is called CacheForceCompletion. - [Glen Parker ] PR#2277 - - *) Add the "] - - *) Fix yet another signal-based race condition involving nested timers. - Signals suck. [Dean Gaudet] - - *) suexec's error messages have been clarified a little bit. [Ken Coar] - - *) Clean up some, but perhaps not all, 8-bit character set problems - with config file parsing, and URL parsing. We now define - ap_isdigit(), ap_isupper(), ... which cast to an (unsigned char). - This should work on most modern unixes. - [Dean Gaudet] PR#800, 2282, 2553 (and others) - - *) The "handler not found" error was issued in cases where the handler - really did exist, but was just declining to serve the request. - [John Van Essen ] PR#2529 - - *) Add Dynamic Shared Object (DSO) support for SCO5 (OpenServer 5.0.x). - [Ronald Record ] PR#2533 - - *) The APACI libexecdir was not extended with an "apache/" subdir - if the installation prefix didn't already contain "apache", but - it should be because the DSO files are Apache-specific. Now - libexecdir is treated the same way sysconfdir, datadir, localstatedir - and includedir are already treated. - [Charles Levert ] PR#2551 - - *) The parsing routine was incorrectly treating methods as - case-insensitive. [Ken Coar] - - *) The ap_bprintf() code neglected to test if there was an error on - the connection. ap_bflush() misdiagnosed a failure as a success. - [Dean Gaudet] - - *) add support for #perl arg interpolation in mod_include - [Doug MacEachern] - - *) API: Name changes of table_elts to ap_table_elts, is_table_empty - to ap_is_table_empty and bgetflag to ap_bgetflag. [Ben Laurie] - - *) PORT: Add UnixWare 7 support - [Vadim Kostoglodoff ] PR#2463 - - *) Fix the Guess-DSO-flags-from-Perl stuff in src/Configure: "perl" was - used instead of "$PERL" which contains the correctly determined Perl - interpreter (important for instance on systems where "perl" and "perl5" - exists, like BSDI or FreeBSD, etc). - [Ralf S. Engelschall] PR#2505 - - *) Move the initial suEXEC-related startup message from plain - fprintf()/stderr to a delayed ap_log_error()-based one to avoid problems - when Apache is started from inetd (instead of standalone). Under this - situation startup messages on stderr lead to problems (the line is sent - to the client in front of the requested document). - [Ralf S. Engelschall] PR#871, PR#1318 - - *) Add a flag so ap_fnmatch() can be used for case-blind pattern matching. - [Ken Coar, Dean Gaudet] - - *) WIN32: Don't collapse multiple slashes in PATH_INFO. - [Ben Laurie, Bill Stoddard ] PR#2274 - - *) WIN32 SECURITY: Eliminate trailing "."s in path components. These are - ignored by the Windows filesystem, and so can be used to bypass security. - [Ben Laurie, Alexei Kosut]. - - *) We now attempt to dump core when we get SIGILL. [Jim Jagielski] - - *) PORT: remove broken test for MAP_FILE in http_main.c. - [Wilfredo Sanchez ] - - *) PORT: Change support/apachectl to use "kill -0 $pid" to test if the - httpd is running. This should be more portable than figuring out - which of three dozen different versions of "ps" are installed. - [a cast of dozens] - - *) WIN32: If we can't figure out how to execute a file in a script - directory, bail out of the request with an error message. [W G Stoddard] - - *) WIN32 SECURITY: Eliminate directories consisting of three or more dots; - these are treated by Win32 as if they are ".." but are not detected by - other machinery within Apache. This is something of a kludge but - eliminates a security hole. [Manoj Kasichainula, Ben Laurie] - - *) Move ap_escape_quotes() from src/ap to src/main/util.c; it uses - pools and thus pollutes libap (until the pool stuff is moved there). - [Ken Coar] - - *) IndexIgnore should be case-blind on Win32 (and any other case-aware - but case-insensitive platforms). New #define for this added to conf.h - (CASE_BLIND_FILESYSTEM). [Ken Coar] PR#2455 - - *) Enable DSO support for OpenBSD in general, not only for 2.x, because it - also works for OpenBSD 1.x. [Ralf S. Engelschall] - - *) PORT: Fix compilation problem on ARM Linux. - [Sam Kington ] PR#2443 - - *) Let APACI's configure script determine some configuration parameters - (Group, Port, ServerAdmin, ServerName) via some intelligent tests to - remove some of the classical hurdles for new users when setting up - Apache. This is done per default because it is useful for the average - user. Package authors can use the --without-confadjust option to disable - these configuration adjustments. - [Ralf S. Engelschall] - - *) Added an EXTRA_DEPS configuration parameter which can be used - to add an extra Makefile dependency for the httpd target, for instance - to external third-party libraries, etc. - [Ralf S. Engelschall] - - *) Add .. sections to the core module (with same spirit - as .. sections) which can be used to skip or process - contained commands dependend of ``-D PARAMETER'' options on the command - line. This can be used to achieve logical conditions like instead of physically ones (e.g. ) - and thus especially can be used for conditionally loading DSO-based - modules via LoadModule, etc. [Ralf S. Engelschall] - - *) PORT: clean up a warning in mod_status for OS/2. [Brian Havard] - - *) Make table elements const. This may prevent obscure errors. [Ben Laurie] - - *) Fix parsing of FTP `SIZE' responses in proxy module: The newline was not - truncated which forced following HTTP headers to be data in the HTTP - reponse. [Ralf S. Engelschall, Charles Fu ] - PR#2412, 2367 - - *) Portability fix for APACI shadow tree support: Swap order of awk and sed - in top-level configure script to avoid sed fails on some platforms (for - instance SunOS 4.1.3 and NCR SysV) because of the non-newline-termined - output of Awk. [Bill Houle ] PR#2435 - - *) Improve performance of directory listings (mod_autoindex) by comparing - integer keys (last-modified and size) as integers rather than converting - them to strings first. Also use a set of explicit byte tests rather - than strcmp() to check for parent directory-ness of an entry. Oh, and - make sure the parent directory (if displayed) is *always* listed first - regardless of the sort key. Overall performance winnage should be good - in CPU time, instruction cache, and memory usage, particularly for large - directories. [Ken Coar] - - *) Add a tiny but useful goody to APACI's configure script: The generation - of a config.status script (as GNU Autoconf does) which remembers the used - configure command and hence can be used to restore the configuration by - just re-running this script or for remembering the configuration between - releases. - [Ralf S. Engelschall] - - *) Add httpd -t (test) option for running configuration syntax tests only. - If something is broken it complains and exits with a return code - non-equal to 0. This can be used manually by the user to check the Apache - configuration after editing and is also automatically used by apachectl - on (graceful) restart command to make sure Apache doesn't die on restarts - because of a configuration which is now broken since the last (re)start. - This way `apachectl restart' can be used inside cronjobs without having - to expect Apache to be falling down. Additionally the httpd -t can be run - via `apachectl configtest'. - [Ralf S. Engelschall] PR#2393 - - *) Minor display fix for "install" target of top-level Makefile: - the displayed installation command was incorrect although the - executed command was correct. Now they are in sync. - [Ralf S. Engelschall] PR#2402 - - *) Correct initialization of variable `allowed_globals' in http_main.c - [Justin Bradford ] PR#2400 - - *) Apache would incorrectly downcase the entire Content-Type passed from - CGIs. This affected server-push scripts and such which use - multipart/x-mixed-replace;boundary=ThisRandomString. - [Dean Gaudet] PR#2394 - - *) PORT: QNX update to properly guess 32-bit systems. - [Sean Boudreau ] PR#2390 - - *) Make sure the DSO emulation code for HPUX finds the proprietary shl_xxx() - functions which are in libdld under HPUX 9/10. - [Ralf S. Engelschall] PR#2378 - - *) Make sure the "install" target of the top-level Makefile doesn't break - because of a return code of 1 from an "if" (for instance under braindead - Ultrix the result code of an "if" construct is 1 if the "then" clause - didn't match). [Ralf S. Engelschall] - - *) Add an additional "dummy" target to the "$(LIB)" target in generated - modules/xxx/Makefile's to avoid problems with SVR4 Make under "full-DSO" - situation (no libxxx.a built, only mod_xxx.so's) where LIB and OBJS are - empty. [Ralf S. Engelschall, Dean Gaudet, Martin Kraemer] - - *) Replace two bad sprintf() calls with ap_snprintf() variants in - mod_rewrite. [Ralf S. Engelschall] - - *) Fix missing usage description for MetaFiles directive. - [David MacKenzie ] PR#2384 - - *) mod_log_config wouldn't let vhosts use log formats defined in the - main server. [Christof Damian ] PR#2090 - - *) mod_usertrack was corrupting the client hostname. As part of the - fix, the cookie values were slightly extended to include the - fully qualified hostname of the client. - [Dean Gaudet] PR#2190, 2229, 2366 - - *) Fix a typo in pool debugging code. [Alvaro Martinez Echevarria] - - *) mod_unique_id did not work on alpha linux (in general on any - architecture that has 64-bit time_t). - [Alvaro Martinez Echevarria] - - *) PORT: Make SCO 5 (and probably 3) compile again. [Ben Laurie] - - *) PORT: NCR MPRAS systems have the same bug with SIGHUP restart that - Solaris systems experience. So define WORKAROUND_SOLARIS_BUG. - [Klaus Weber ] PR#1973 - - *) Change "Options None" to "Options FollowSymLinks" in the - section of the default access.conf-dist - (and -win even though it doesn't matter there). This has better - performance, and more intuitive semantics. [Dean Gaudet] - - *) PORT: Updated support for UTS 2.1.2. - [Dave Dykstra ] PR#2320 - - *) Fix symbol export list (src/support/httpd.exp) after recent - API changes in the child spawning area. - [Jens-Uwe Mager ] - - *) Workaround for configure script and old `test' commands which do not - support the -x flag (for instance under platforms like Ultrix). This is - solved by another helper script findprg.sh which searches for Perl and - Awk like PrintPath but _via different names_. - [Ralf S. Engelschall] - - *) Remove the system() call from htpasswd.c, which eliminates a system - dependancy. ["M.D.Parker" ] PR#2332 - - *) PORT: Fix compilation failures on NEXTSTEP. - [Rex Dieter ] PR#2293, 2316 - - *) PORT: F_NDELAY is a typo, should have been FNDELAY. There's also - O_NDELAY on various systems. [Dave Dykstra ] PR#2313 - - *) PORT: helpers/GuessOS updates for various versions for NCR SVR4. - [juerg schreiner , - Bill Houle ] PR#2310 - - *) Fix recently introduced Win32 child spawning code in mod_rewrite.c which - was broken because of invalid ap_pstrcat() -> strcat() transformation. - [Ralf S. Engelschall] - - *) Proxy Cache Fixes: account for directory sizes, fork off garbage collection - to continue in background, use predefined types (off_t, size_t, time_t), - log the current cache usage percentage at LogLevel debug - [Martin Kraemer, based on discussion between Dean Gaudet & Dirk vanGulik] - -Changes with Apache 1.3.0 - - *) Using a type map file as a custom error document was not possible. - [Lars Eilebrecht] PR#1031 - - *) Avoid problems with braindead Awks by additionally searching for gawk - and nawk in APACI's configure script. - [Dave Dykstra , Ralf S. Engelschall] PR#2319 - - *) Rename md5.h to ap_md5.h to avoid conflicts with native MD5 on - some systems. [Randy Terbush] - - *) Change usage of perror()+fprintf(stderr,...) in mod_rewrite to - more proper ap_log_error() variants. - [Ralf S. Engelschall] - - *) Make sure the argument for the --add-module option to APACI's configure - script is of type [path/to/]mod_xxx.c because all calculations inside - configure and src/Configure depend on this. - [Ralf S. Engelschall] PR#2307 - - *) Changes usage of perror/fprintf to stderr to more proper ap_log_error - in mod_mime, mod_log_referer, mod_log_agent, and mod_log_config. - [Brian Behlendorf] - - *) Various OS/2 cleanups ["Brian Havard" ] - - *) PORT: QNX needed a #include ; and now it uses flock - serialized accept to handle multiple sockets. - [Rob Saccoccio ] PR#2295, 2296 - - *) Have NT properly set the directory for CGI scripts - (& other spawned children) - [W G Stoddard ] - - *) Propagate environment to CGI scripts correctly in Win32. - [W G Stoddard ] PR#2294 - - *) Some symbol renaming: - ap_spawn_child_err became ap_spawn_child - ap_spawn_child_err_buff became ap_bspawn_child - spawn_child was obsoleted and moved to compat.h - [Brian Behlendorf] - - *) Upgrade the child spawning code in mod_rewrite for the RewriteMap - programs: ap_spawn_child_err() is used and the Win32 case now uses - CreateProcess() instead of a low-level execl() (which caused problems in - the past under Win32). - [Ralf S. Engelschall] - - *) A few cosmetics and trivial enhancements to APXS to make the - generated Makefile more user friendly. [Ralf S. Engelschall] - - *) Proxy Fix: The proxy special failure routine ap_proxyerror() - was updated to use the normal apache error processing, thereby allowing - proxy errors to be treated by ErrorDocument's as well. For this - purpose, a new module-to-core communication variable "error-notes" - was introduced; the proxy (and possibly other modules) communicates - its error text using this variable. Its content is copied to a new - cgi-env-var REDIRECT_ERROR_NOTES for use by ErrorDocuments. - The old proxy special error routine ap_proxy_log_uerror() - was replaced by regular ap_log_error() calls, many messages were made - more informative. - [Martin Kraemer] PR#494, 1259 - - *) SECURITY: A possible buffer overflow in the ftp proxy was fixed. - [Martin Kraemer] - - *) Transform the configure message "You need root privileges for suEXEC" - from a fatal error into a (more friendly) warning because the building - ("make") of Apache we can allow, of course. Root privileges are needed - only for the installation step ("make install"). So make sure the - user is aware of this fact but let him proceed as long as he can. - [Ralf S. Engelschall] PR#2288 - - *) Renamed three more functions to common ap_ prefix which we missed at the - Big Symbol Renaming because they're #defines and not real C functions: - is_default_port(), default_port(), http_method(). - [Ralf S. Engelschall] - - *) A zero-length name after a $ in an SSI document should cause - just the $ to be in the expansion. This was broken during the - security fixes in 1.2.5. [Dean Gaudet] PR#1921, 2249 - - *) Call ap_destroy_sub_req() in ap_add_cgi_vars() to reclaim some - memory. [Rob Saccoccio ] PR#2252 - - *) Fix src/support/httpd.exp (DSO export file which is currently only - used under AIX) because of recent changes to function names. - [Ralf S. Engelschall] - -Changes with Apache 1.3b7 - - *) Make sure a MIME-type can be forced via a RewriteRule even when no - substitution takes place, for instance via the following rule: - ``RewriteRule ^myscript$ - [T=application/x-httpd-cgi]'' This was often - requested by users in the past to force a single script without a .cgi - extension and outside any cgi-bin dirs to be executed as a CGI program. - [Ralf S. Engelschall] PR#2254 - - *) A fix for protocol issues surrounding 400, 408, and - 414 responses. [Ed Korthof] - - *) Ignore MaxRequestsPerChild on WIN32. [Brian Behlendorf] - - *) Fix discrepancy in proxy_ftp.c which was causing failures when - trying to connect to certain ftpd's, such as anonftpd. - [Rick Ohnemus ] - - *) Make mod_rewrite use ap_open_piped_log() for RewriteLog directive's - logfile instead of fiddling around itself with child spawning stuff. - [Ralf S. Engelschall] - - *) Made RefererIgnore case-insensitive. - - *) Mod_log_agent, mod_log_referer now use ap_open_piped_log for piped logs. - [Brian Behlendorf] - - *) Replace use of spawn_child with ap_spawn_child_err_buff, to make everything - "safe" under Win32. In: mod_include.c, mod_mime_magic.c - [Brian Behlendorf] - - *) Improve RFC1413 support. [Bob Beck ] - - *) Fix support script `dbmmanage': It was unable to handle some sort - of passwords, especially passwords with "0" chars. - [Ralf S. Engelschall] PR#2242 - - *) WIN32: Clicking on "Last Modified" in a fancy index caused a crash. Fixed. - [Ben Laurie] PR#2238 - - *) WIN32: CGIs could cause a hang (because of a deadlock in the standard C - library), so CGI handling has been changed to use Win32 native handles - instead of C file descriptors. - [Ben Laurie and Bill Stoddard ] PR#1129, 1607 - - *) The proxy cache would store an incorrect content-length in the cached - file copy after a cache update. That resulted in repeated fetching - of the original copy instead of using the cached copy. - [Ernst Kloppenburg ] PR#2094 - - *) The Makefiles assumed that DSO files are build via $(LD). This - is broken for two reasons: First we never defined at least LD=ld - somewhere to make sure this works (it was silently assumed that most Make - provide a built-in LD definition - ARGL!) and second using the generic LD - variable is not the truth. Instead a special variable named LD_SHLIB is - reasonable because although "ld" is usually the default, the command for - building DSO files can be "libtool" or even "cc" on some systems. - [Ralf S. Engelschall] - - *) Replace the AddVersionPlatform directive with ServerTokens which - provides for more control over the format of the Server: - header line. SERVER_SUBVERSION is no longer supported; - all module should use the ap_add_version_component() - API function instead. [Jim Jagielski] - - *) Support for the NCR MP/RAS 3.0 - [John Withers ] - - *) The LDFLAGS_SHLIB_EXPORT variable of src/Configuration[.tmpl] was - not retrieved in src/Configure and thus was not useable. - [Ralf S. Engelschall] - - *) Various Makefile consistency cleanups: - - make OSDIR also automatically be relative to src/ like INCDIR - - SUBDIRS is now generated in src/Makefile only and not in - Makefile.config because it is a local define for this location. - - remove BROKEN_BPRINTF_FLAGS because is it no longer used inside - any Makefile but make sure that at least the "-K inline" is kept in - CFLAGS for SCO 5. - - update the "depend" targets in Makefile.tmpl files to use $(OSDIR), too. - - updated the dependencies theirself - - removed not existing SHLIB variable from "clean" targets - - replaced SHLIB_OBJS/SHLIBS_OBJ consistently with OBJS_PIC because OBJS - already exists and OBJS_PIC are also just plain objects and have not - directly to do with "shared" things. The only difference is that they - contain PIC. So OBJS_PIC is the more canonical name. - - Updated the Makefile-dependency lines for OBJS_PIC - - Removed the Makefile-dependency line in Configure to avoid double - definitions - - replaced ugly xx-so.o/xx.so-o hack with a clean and consistent usage - of xxx.lo as GNU libtool does with its PIC objects - - reduce local complexity in modules Makefile.tmpl by moving the last - existing target "depend" to the generation section in Configure, too. - - removed the historical $(SPACER) which was used in the past together - with BROKEN_BPRINTF_FLAGS to avoid zig-zags in the build process. This - is no longer needed. - - force the build and run of the gen_xxx programs under main/ as the - first step before building the objects because it looks cleaner - [Ralf S. Engelschall] - - *) WIN32: Make Win32 work again after the /dev/null DoS fix. - [Ben Laurie] - - *) WIN32: Check for buffer overflows in ap_os_canonical_filename. - [Ben Laurie] - - *) WIN32: Don't force ISAPI headers to finish with \n. - [Jim Patterson , Ben Laurie] PR#2060 - - *) When opening "configuration" files (like httpd.conf, htaccess - and htpasswd), Apache will not allow them to be non-/dev/null - device files. This closes a DoS hole. At the same time, - we use ap_pfopen to open these files to handle timeouts. - [Jim Jagielski, Martin Kraemer] - - *) Apache will now log the reason its httpd children exit if they exit - due to an unexpected signal. (It requires a new porting define, - SYS_SIGLIST, which if defined should point to a list of text - descriptions of the signals available. See PORTING.) [Dean Gaudet] - - *) WIN32: chdir() doesn't make sense in a multithreaded environment - like WIN32. Before, Win32 CGI's could have had sporadic failures - if a chdir call from one thread was made between another chdir call - and a spawn in another thread. So, for now don't chdir for CGI scripts - in WIN32. The current CGI "spec" is unclear as to whether it's - necessary. Long-term fix is to either serialize the chdir/spawn combo - or use WIN32 native calls to spawn a process. This temp fix was - necessary to remove this as a showstopper for 1.3's release. - [Brian Behlendorf] - - *) Cleanup the suEXEC support in APACI and make it more safe: - 1. Add big fat hint in INSTALL about risks and to read the - htdocs/manual/suexec.html document before using the suexec-related - configure options. - 2. Make sure the user has at least provided one --suexec-xxxx option - (specifies suEXEC parameters) in addition to --enable-suexec option. - If only --enable-suexec is given APACI stops with a hint to INSTALL - and htdocs/manual/suexec.html documents. - 3. Provide two additional --suexec-xxxx options to make the suEXEC - configuration complete (especially for package maintainers who else - had to patch the source tree) by providing ways to configure minimal - UID/GID and safe PATH, too. - [Ralf S. Engelschall] - - *) Cleanup of the `configure --shadow' process: - - make sure the configure script creates its temporary files in the - shadow tree to avoid conflicts with parallel configure runs - - removed unnecessary option "-r" from "rm" call for Makefiles - - make sure the configure scripts creates the shadow-wrapper Makefile - only when no shadow trees already exists - - make sure "make distclean" removes the shadow-wrapper Makefile but only - when no more shadow trees exists - - overhauled mkshadow.sh script: now its more IFS-safe and approx. twice - as fast (in the past it needed 70sec, now it runs just 38sec) - - make sure CVS does not complain about the created files - Makefille. and directories src. - [Ralf S. Engelschall] - - *) Added the ap_add_version_component() API routine and the - AddVersionPlatform core directive. The first allows modules to - declare themselves in the Server response header field value, - augmenting the SERVER_SUBVERSION define in the Configuration file - with run-time settings (more useful in a loadable-module environment). - AddVersionPlatform inserts a comment such as "(UNIX)" or "(Win32)" - into the server version string. [Ken Coar] PR#2056 - - *) Minor stability tweaks to avoid core dumps in ap_snprintf. - [Martin Kraemer] - - *) Emit the "Accept-Range" header for the default handler. - [Brian Behlendorf] PR#1464 - - *) Add a note to httpd.conf-dist that apache will on some systems fail - to start when the Group # is set to a negative or large positive value. - [Martin Kraemer] - - *) Make sure the module execution order is correct even when some modules - are loaded under runtime (`LoadModule') via the DSO mechanism: - 1. The list of loaded modules is now a dynamically allocated one - and not the original statically list from modules.c - 2. The loaded modules are now correctly setup by LoadModule for - later use by the AddModule command. - 3. When the DSO mechanism for modules is used APACI's `install' - target now enables all created `LoadModule' lines per default because - this is both already expected by the user _and_ needed to avoid - confusion with the next point and reduces the Makefile.tmpl complexity - 4. When the DSO mechanism for modules is used, APACI's `install' - target now additionally makes sure the module list is reconstructed - via a complete `ClearModuleList+AddModule...' entry. - 5. The support tool `apxs' now also makes sure an AddModule command - is added in addition to the LoadModule command. - 6. The modules.c generation was extended to now contain two - comments to make sure no one is confused by the confusing terminology - of loading/linking (we use load=link+load & link=activate instead of - the obvious load=activate & link=link :-( ) - This way now there is no longer a difference under execution time between - statically and dynamically linked modules. - [Ralf S. Engelschall] - - *) Fix the generated mod_xxx.c from "apxs -g -f xxx" after the - Big Symbol Renaming. [Ralf S. Engelschall] - - *) Add a comment to mod_example.c showing the format of a FLAG command - handler. [Ken Coar] - - *) Standardized the time format in mod_status to match that of other - places in the code (e.g. DATE_GMT). PR#1551 - - *) Fix handling of %Z in timefmt strings for those platforms with no time - zone information in their tm struct. [Paul Eggert ] - PR#754 - - *) Makes mod_rewrite, mod_log_config, mod_status and the ServerSignature - feature compatible with 'UseCanonicalName off' by changing - r->server->server_hostname to ap_get_server_name(). And I changed some - functions which use r->server->port to use ap_get_server_port() instead, - because if there's no Port directive in the config r->server->port is 0. - [Lars Eilebrecht] - - *) get/set_module_config are trivial enough to be better off inline. Worth - 1.5% performance boost. [Dean Gaudet] - - *) Fix off-by-one error in ap_proxy_date_canon() in proxy_util.c - when ensuring 'x' is at least 30-chars big. [Jim Jagielski, - Brian Behlendorf] - - *) [BS2000 security] BS2000 needs an extra authentication to initialize - the task environment to the unprivileged User id. Otherwise CGI scripts - would have a way to gain super user access. [Martin Kraemer] - - *) Fix debug log messages for BS2000/OSD: instead of logging the whole - absolute path, only log base name of logging source as is done - in unix. [Martin Kraemer] - - *) Ronald Tschalaer's Accept-Encoding patch - preserve the "x-" in - the encoding type from the Accept-Encoding header (if it's there) - and use it in the response, as that's probably what it'll be expecting. - [Ronald.Tschalaer@psi.ch] - - *) Fix to mod_alias: translate_alias_redir is dealing with - a URI, not a filename, so the check for drive letters for win32 - and emx is not necessary. [Dean Gaudet] - - *) WIN32: Allow .cmd as an executable extension. - [Kari Likovuori ] PR#2146 - - *) Make Apache header files, and some variables, C++ friendly. - [Michael Anderson's ] - - *) Child processes can now "signal" (by exiting with a status - of APEXIT_CHILDFATAL) the parent process to abort and - shutdown the server if the error in the child process was - fatal enough. [Jim Jagielski] - - *) mod_autoindex's find_itme() was sensitive to MIME type case. - [Jim Jagielski] PR#2112 - - *) Make sure the referer_log and agent_log entries in the default httpd.conf - file are also adjusted for the actual relative installation paths. - [Ralf S. Engelschall] PR#2175 - - *) WIN32: Extensive overhaul of the way UNCs are handled. [Ben Laurie] - - *) WIN32: Make roots of filesystems (e.g. c:/) work. [Ben Laurie] - PR#1558 - - *) PORT: Various porting changes to support AIX 3.2, 4.1.5, 4.2 and 4.3. - Additionally the checks for finding the vendor DSO library were moved - from mod_so.c to Configure because first it needs $PLAT etc. and second - mod_so already uses an abstraction layer and does not fiddle with the - vendor functions itself. - [Jens-Uwe Mager, Ralf S. Engelschall] - - *) PORT: Some optimization defines for NetBSD - [Jaromir Dolecek ] PR#2165 - - *) PORT: Dynamic Shared Object (DSO) support for NetBSD. - [Jaromir Dolecek , Ralf S. Engelschall] PR#2158 - - *) Add Dynamic Shared Object (DSO) support for AIX (at least 4.2 but older - AIX variants should work fine, too. Even AIX 3.x should work). This is - accomplished by using the free DSO emulation code from Jens-Uwe Mager - which we put into a os/unix/os-dso-aix.c file. - [Ralf S. Engelschall] - - *) PORT: Fix compiler warnings under AIX >= 4.2 where the manual pages imply - that we should use NET_SIZE_T == int but the include files force size_t. - [Ralf S. Engelschall] - - *) Fix two bugs in select() handling in http_main.c. - [Roy Fielding] - - *) Suppress "error(0)" messages for ap_log_error() when the APLOG_NOERRNO - is unset (as it is in situations like timeouts) where it is unclear - whether errno is set or not. [Martin Kraemer] - - *) Just having APACI's localstatedir is too general and not enough for most - of the systems. 1.3b6 again required manual APACI patches by package - maintainers from RedHat and FreeBSD because for their filesystem layout a - little bit more flexibility in configuring the paths is needed. Hence we - provide three additional configure options (--runtimedir, --logfiledir, - --proxycachedir) which now can be used for more granular adjustments if - --localstatedir is not enough to fit the particular needs. As a nice - side-effect this reduces some subdir fiddling in configure+Makefile.tmpl. - [Ralf S. Engelschall] - - *) Make the install root for "make install" in APACI's Makefile overrideable - by package authors. This way we are even more friendly to package - maintainers (especially Debian and RedHat) who build for the real prefix - via "configure --prefix=/" but use a different local prefix via - "make root=/tmp/apache install" for rolling the package without bristling - the target location on their system. - [Ralf S. Engelschall] - - *) Workaround sed limitations in APACI's configure script by now - substituting in chunks of 50 commands (because for instance HPUX's vendor - sed has a limit of max. 98 commands) - [Ralf S. Engelschall] PR#2136 - - *) Adding SOCKS5 support and fixing existing SOCKS4 support. - [Ralf S. Engelschall] PR#2140 - - *) Manually fix some symbols which were not renamed to prefix ap_ in the BIG - RENAMING process because they are defined as pre-processor macros instead - of real functions: bputc, bgetc, piped_log_write_fd, piped_log_read_fd - [Ralf S. Engelschall] - - *) Workaround braindead AWK's when generating ap_config.h: The split() and - substr() functions cannot be nested under vendor AWK from Solaris 2.6. - [Ralf S. Engelschall] PR#2139 - - *) Various bugfixes and cleanups for the APACI configure script: - o fix IFS handling for _nested_ situation - o fix Perl interpreter search: take first one found instead of last one - o fix DSO consistency check - o print error messages to stderr instead of stdout - o add install-quiet for --shadow situation to Makefile stub - o reduce complexity by avoiding sed-hacks for rule and module list loops - [Ralf S. Engelschall] - - *) Fix DEBUG_CGI situation in mod_cgi.c [David MacKenzie] PR#2114 - - *) Make sure the input field separator (IFS) shell variable is explicitly - initialized correctly before _every_ `for' loop and also restored after - the loops. [Ralf S. Engelschall] - - *) Make sure that "make install" doesn't overwrite the `mime.types' and - `magic' files from an existing Apache installation. Because people often - customize these for own MIME and content types. - [Ralf S. Engelschall] - - *) PORT: Dynamic Shared Object (DSO) support for OpenBSD 2.x - [Peter Galbavy, Ralf S. Engelschall] PR#2109 - - *) Fix the path to the ScoreBoardFile in the install-config target, too. - [Ralf S. Engelschall] PR#2105 - - *) Let "configure" clear out the users parameters (provided as shell - variables) to avoid side-effects in "src/Configure" when the user - exported them (which is not needed, but some users do it). - [Ralf S. Engelschall] PR#2101 - - *) Provide backward compatibility from some old src/Configuration.tmpl - parameter names to the canonical Autoconf-style shell variable names. For - instance CFLAGS vs. EXTRA_CFLAGS. The EXTRA_xxx variants are accepted now - but a hint message is displayed. [Ralf S. Engelschall] - - *) Make sure that "make install" doesn't overwrite the DocumentRoot and - CGI scripts from an existing Apache installation. - [Ralf S. Engelschall, Jim Jagielski] PR#2084 - - *) Make `configure --compat' more "compatible" by first - let the libexecdir default to EPREFIX/libexec instead of EPREFIX/bin and - second by making sure the "avoid-bristling-suffix" /apache is not - appended to sysconfdir, datadir, localstatedir and includedir when - --compat is used. [Ralf S. Engelschall, Lars Eilebrecht] - - *) NeXT required strdup() in support/logresolve.c - [Francisco Tomei ] PR#2082 - - *) AIX required sys/select.h in support/ab.c - [Jens Schleusener ] PR#2081 - - *) Fix the path to the MimeMagicFile in the install-config target, too. - [Ralf S. Engelschall] PR#2089 - - *) PORT: Added HP-UX 11 patches [Jeff Earickson ] - - *) If you start apache with the -S command line option it will dump - out the parsed vhost settings. This is useful for folks trying - to figure out what is wrong with their vhost configuration. - (Other dumps may be added in the future.) [Dean Gaudet] - - *) Add %pA, %pI, and %pp codes to ap_vformatter (and hence ap_bprintf, - ap_snprintf, and ap_psprintf). See include/ap.h for docs. - [Dean Gaudet] - - *) Because /usr/local/apache is the default prefix the ``configure - --compat'' option no longer has to set prefix, again. This way the - --compat option honors a leading --prefix option. [Lars Eilebrecht] - - *) PORT: Cast the first argument of dlopen() in ap_os_dso_load() - to `char *' under OSF1 and FreeBSD 2.x where it is defined this way - to avoid "discard const" warnings. [Ralf S. Engelschall] - - *) If a specific handler is set for a file yet the request still - ends up being handled by the default handler, log an error - message before handling it. This catches things such as trying - to use SSIs without mod_include enabled. [Marc Slemko] - - *) Fix error logging for the startup case where ap_log_error() still uses - stderr as the target. Now the default log level is honored here, too. - [Ralf S. Engelschall] - - *) PORT: Make sure some AWK's don't fail in src/Configure with "string too - long" errors when generating the MODULES entry for src/Makefile - [Ben Hyde, Ralf S. Engelschall] - - *) Make sure src/Configure doesn't complain about the old directory - /usr/local/etc/httpd/ when APACI is used. [Lars Eilebrecht] - -Changes with Apache 1.3b6 - - *) PORT: Clean up warnings on Ultrix and HPUX. [Ben Hyde] - - *) Adding DSO support for the HP/UX platform by emulating the dlopen-style - interface via the similar but proprietary HP/UX shl_xxx-style system - calls. [Ralf S. Engelschall] - - *) PORT: Updated UnixWare 2.0.x and 2.1.x entries for DSO support and made - APACI Makefile.tmpl "install" target more robust for sensible UnixWare - Make. [Ralf S. Engelschall] - - *) ++++ THE BIG SYMBOL RENAMING ++++ - To avoid symbol clashes with third-party code compiled into the server, - we globally applied the prefix "ap_" to the following classes of - functions: - - Apache provided general functions (e.g., ap_cpystrn) - - Public API functions (e.g., palloc, bgets) - - Private functions which we can't make static (because of - cross-object usage) but should be (e.g., new_connection) - For backward source compatibility a new header file named compat.h was - created which provides defines for the old symbol names and can be used - by third-party module authors. - [The Apache Group] - - *) Added dynamic shared object (DSO) support for SVR4-derivates: The - problem under SVR4 is that there is no command flag to force the linker - to export the global symbols of the httpd executable therewith they are - available to the DSO's. Instead of problematic hacks like creating a - dummy.so file (containing dummy references to all global symbols) the - httpd binary is linked against, we use a clean trick stolen from Perl 5: - Placing the Apache core code itself into a DSO library named libhttpd.so. - This way the global symbols _HAVE_ to be exported and thus are available - to any manually loaded DSO's under runtime. To reduce the impact to the - user to null we go even further and create a stub httpd executable which - automatically keeps track of the DSO library loading itself and thus - hides the complete mechanism from the user. Although the generation of - this DSO library is automatically triggered for platforms which - essentially need it (mostly all SVR4-derivates) it can be also enabled - manually via the Rule SHARED_CORE. This can be interesting in the future - where we perhaps exploit this libhttpd.so mechanism for providing nifty - features like graceful upgrades, or whatever. - [Ralf S. Engelschall, Martin Kraemer] - - *) Build the libraries before building the rest of the tools. [Ben Hyde] - - *) Add "distclean" target to src/-Makefiles to provide "make distclean" also - inside the src subtree (i.e. for non-APACI users). Following GNU Makefile - conventions while "clean" removes only stuff created by "all" targets, - "distclean" additionally removes the stuff from the configuration - process. This way "make distclean" (hence the name) provides a fresh - source tree as it was for distribution. - [Ralf S. Engelschall] - - *) Allow top-level (APACI) Makefile to break on build errors - the same way the src/ subtree Makefiles breaks on them by replacing the - initial APACI sed-subdir-display-kludge with a more clean - variable-passing-solution: variable SDP can optionally hold the subdir - prefix which is consistently used for displaying the subdir movement. - This way even the top-level Makefile can stop correctly on errors as the - user expects. [Ralf S. Engelschall] - - *) Fixed ordering of argument checks for RewriteBase directive. - [Todd Eigenschink ] PR#2045 - - *) Change Win32 IS_MODULE to SHARED_MODULE to match Unix' method of - indicating that a module is being compiled for dynamic loading. Also - remove #define IS_MODULE from modules and add SHARED_MODULE define - to the mak/dsp files. [Alexei Kosut] - - *) Reduce logging level of "normal" warning messages to APLOG_INFO, - since we are now logging APLOG_WARNING by default. [Roy Fielding] - - *) PORT: OS/2 tweak to deal with multiple .exe targets. [Brian Havard] - - *) Add documentation file and src/Configuration.tmpl entry for the - experimental mod_mmap_static module. Because although it is and marked as - an experimental one it is distributed and thus should be documented and - prepared for configuration the same way as all others modules. - [Ralf S. Engelschall] - - *) Add query (-q) option to apxs support tool to be able to manually query - specific settings from apxs. This is needed for instance when you - manually want to access Apache's header files and you need to assemble - the -I option. Now you can do -I`apxs -q INCLUDEDIR`. - [Ralf S. Engelschall] - - *) Now src/Configure uses a fallback strategy for the shared object support - on platforms where no explicit information is available: If a Perl - installation exists we ask it about its shared object support and if it's - the dlopen-style one we shamelessly guess the compiler and linker flags - for creating shared objects from Perls knowledge. Of course, the user is - warning about what we are doing and informed that he should send us - the guessed flags when they work. [Ralf S. Engelschall] - - *) Provide APACI --without-support option to be able to disable the build - and installation of the support tools from the src/support/ area. - Although its useful to have these installed per default we should provide - a way to compile and install without them for backward-compatibility. - [Ralf S. Engelschall] - - *) Add of the new APache eXtenSion (apxs) support tool for building and - installing modules into an _already installed_ Apache package through the - dynamic shared object (DSO) mechanism [mod_so.c]. The trick here is that - this approach actually doesn't need the Apache source tree. The - (APACI-installed) server package is enough, because this now includes the - Apache C header files (PREFIX/include) and the new APXS tool - (SBINDIR/apxs). The intend is to provide a handy tool for third-party - module authors to build their Apache modules _OUTSIDE_ the Apache source - tree while avoiding them to fiddle around with the totally platform - dependend way of compiling DSO files. The tool supports all ranges of - modules, from trivial ones (single mod_foo.c) to complex ones (like PHP3 - which has a mod_php3.c plus a pre-built libmodphp3-so.a) and even can - on-the-fly generate a minimalistic Makefile and sample module for the - first step to provide both a quick success event and to demonstrate the - APXS mechanism to module authors. [Ralf S. Engelschall] - - *) Fix core dumps in use of CONNECT in proxy. - [Rainer.Scherg@rexroth.de] PR#1326, #1573, #1942 - - *) Modify the log directives in httpd.conf-dist files to use CustomLog - so that users have examples of how CustomLog can be used. - [Lars Eilebrecht] - - *) Add the new Apache Autoconf-style Interface (APACI) for the top-level of - the Apache distribution tree. Until Apache 1.3 there was no real - out-of-the-box batch-capable build and installation procedure for the - complete Apache package. This is now provided by a top-level "configure" - script and a corresponding top-level "Makefile.tmpl" file. The goal is - to provide a GNU Autoconf-style frontend which is capable to both drive - the old src/Configure stuff in batch and additionally installs the - package with a GNU-conforming directory layout. Any options from the old - configuration scheme are available plus a lot of new options for flexibly - customizing Apache. [Ralf S. Engelschall] - - *) The floating point ap_snprintf code wasn't threadsafe. - Had to remove the HAVE_CVT macro in order to do threadsafe - calling of the ?cvt() floating point routines. [Dean Gaudet] - - *) PORT: Add the SCO_SV port. [Jim Jagielski] PR#1962 - - *) PORT: IRIX needs the -n32 flag iff using the 'cc' compiler - [Jim Jagielski] PR#1901 - - *) BUG: Configure was using TCC and CC inconsistently. Make sure - Configure knows which CC we are using. [Jim Jagielski] - - *) "Options +Includes" wasn't correctly merged if "+IncludesNoExec" - was defined in a parent directory. [Lars Eilebrecht] - - *) API: ap_snprintf() code mutated into ap_vformatter(), which is - a generic printf-style routine that can call arbitrary output - routines. Use this to replace http_bprintf.c. Add new routines - psprintf(), pvsprintf() which allocate the exact amount of memory - required for a string from a pool. Use psprintf() to clean up - various bits of code which used ap_snprintf()/pstrdup(). - [Dean Gaudet] - - *) PORT: HAVE_SNPRINTF doesn't do anything any longer. This is because - ap_snprintf() has different semantics and formatting codes than - snprintf(). [Dean Gaudet] - - *) SIGXCPU and SIGXFSZ are now reset to SIG_DFL at boot-time. This - is necessary on at least Solaris where the /etc/rc?.d scripts - are run with these signals ignored, and "SIG_IGN" settings are - maintained across exec(). - [Rein Tollevik ] PR#2009 - - *) Fix the check for symbolic links in ``RewriteCond ... -l'': stat() was - used instead of lstat() and thus this flag didn't work as expected. - [Rein Tollevik ] PR#2010 - - *) Fix the proxy pass-through feature of mod_rewrite for the case of - existing QUERY_STRING now that mod_proxy was recently changed because of - the new URL parsing stuff. [Ralf S. Engelschall] - - *) A few changes to scoreboard definitions which helps gcc generate - better code. [Dean Gaudet] - - *) ANSI C doesn't guarantee that "int foo : 2" in a structure will - be a signed bitfield. So mark a few bitfields as signed to - ensure correct code. [Dean Gaudet] - - *) The default for HostnameLookups was changed to Off, but there - was a problem and it wasn't taking effect. [Dean Gaudet] - - *) PORT: Clean up undefined signals on some platforms (SCO, BeOS). - [Dean Gaudet] - - *) After a SIGHUP the listening sockets in the parent weren't - properly marked for closure on fork(). - [Jürgen Keil ] PR#2000 - - *) Allow %2F in two situations: 1) it is in the query part of the URI, - therefore not exposed to %2F -> '/' translations and 2) the request - is a proxy request, so we're not dealing with a local resource anyway. - Without this, the proxy would fail to work for any URL's with - %2f in them (occurs quite often in - http://.../cgi-bin/...?http%3A%2F%2F... references) [Martin Kraemer] - - *) Protect against FD_SETSIZE mismatches. [Dean Gaudet] - - *) Make the shared object compilation command more portable by avoiding - the direct combination of `-c' & `-o' which is not honored by some - compilers like UnixWare's cc. [Ralf S. Engelschall] - - *) WIN32: the proxy was creating filenames missing the last four - characters. While this normally doesn't stop anything from - working, it can result in extra collisions. - [Tim Costello ] PR#1890 - - *) Now mod_proxy uses the response string (in addition to the response status - code) from the already used FTP SIZE command to setup the Content-Length - header if available. [Ralf S. Engelschall] PR#1183 - - *) Reanimated the (still undocumented) proxy receive buffer size directive: - Renamed from ReceiveBufferSize to ProxyReceiveBufferSize because the old - name was really too generic, added documentation for this directive to - the mod_proxy.html and corrected the hyperlink to it in the - new_features_1.3.html document. [Ralf S. Engelschall] PR#1348 - - *) Fix a bug in the src/helpers/fp2rp script and make it a little bit - faster [Martin Kraemer] - - *) Make Configure die when you give it an unknown command switch. - [Ben Hyde] - - *) Add five new and fresh manpages for the support programs: dbmmanage.1, - suexec.8, htdigest.1, rotatelogs.8 and logresolve.8. Now all up-to-date - and per default compiled support programs have manual pages - just to - document our stuff a little bit more and to be able to do really - Unix-like installations ;-) [Ralf S. Engelschall] - - *) Major cleanups to the Configure script to make it and its generated - Makefiles again readable and maintainable: add SRCDIR option, removed - INCLUDES_DEPTH[0-2] kludge, cleanup of TARGET option, cleanup of - generated sections, consequently added Makefile headers with inheritance - information, added subdir movement messages for easier following where - the build process currently stays (more verbose then standard Make, less - verbose than GNU make), same style to comments in the Configure script, - added Apache license header, fixed a few bugs, etc. [Ralf S. Engelschall] - - *) Add the new ApacheBench program "ab" to src/support/: This is derived - from the ZeusBench benchmarking program and can be used to determine the - response performance of an Apache installation. This version is - officially licensed with Zeus Technology, Ltd. See the license agreement - statements in <199803171224.NAA24547@en1.engelschall.com> in apache-core. - [Ralf S. Engelschall] - - *) API: Various core functions that are definately not part of the API - have been made static, and a few have been marked API_EXPORT. Still - more have been marked CORE_EXPORT and are not intended for general - use by modules. [Doug MacEachern, Dean Gaudet] - - *) mod_proxy was not clearing the Proxy-Connection header from - requests; now it does. This did not violate any spec, however - causes poor interactions when you are talking to remote proxies. - [Marc Slemko] PR#1741 - - *) Various cleanups to the command line interface and manual pages. - [Ralf S. Engelschall] - - *) cfg_getline() was not properly handling lines that did not end - with a line termination character. [Marc Slemko] PR#1869, 1909 - - *) Performance tweak to mod_log_config. [Dmitry Khrustalev] - - *) Clean up some undocumented behavior of mod_setenvif related to - "merging" two SetEnvIf directives when they match the same header - and regex. Document that mod_setenvif will perform comparisons in - the order they appear in the config file. Optimize mod_setenvif by - doing more work at config time rather than at runtime. - [Dean Gaudet] - - *) src/include/ap_config.h now wraps it's #define's with #ifndef/#endif's - to allow for modules to overrule them and to reduce redefinition - warnings [Jim Jagielski] - - *) [PORT] For A/UX change the OS-#define for -DAUX to -DAUX3. - [Jim Jagielski] - - *) Making the hard-coded cross-module function call mime_find_ct() (from - mod_proxy to mod_mime) obsolete by making sure the API hook for MIME type - checking is really called even for proxy requests except for URLs with - HTTP schemes (because there we can optimize by not running the type - checking hooks due to the fact that the proxy gets the MIME Content-type - from the remote host later). This change cleans up mod_mime by removing - the ugly export kludge, makes the one-liner file mod_mime.h obsolete, and - especially unbundles mod_proxy and mod_mime. This way they both now can - be compiled as shared objects and are no longer tied together. - [Ralf S. Engelschall] - - *) util.c cleanup and speedup. [Dean Gaudet] - - *) API: Clarification, pstrndup() will always copy n bytes of the source - and NUL terminate at the (n+1)st byte. [Dean Gaudet] - - *) Mark module command_rec and handler_rec structures const so that they - end up in the read-only data section (and are friendlier to systems - that don't do optimistic memory allocation on fork()). [Dean Gaudet] - - *) Add check to the "Port" directive to make sure the specified - port is in the appropriate range. [Ben Hyde] - - *) Performance improvements to invoke_handler(). - [Dmitry Khrustalev ] - - *) Added support for building shared objects even for library-style modules - (which are built from more than one object file). This now provides the - ability to build mod_proxy as a shared object module. Additionally - modules like mod_example are now also supported for shared object - building because the generated Makefiles now no longer assume there is at - least one statically linked module. [Ralf S. Engelschall] - - *) API: Clarify usage of content_type, handler, content_encoding, - content_language and content_languages fields in request_rec. They - must always be lowercased; and the strings pointed to shouldn't - be modified (you must copy them to modify them). Fix a few bugs - related to this. [Dean Gaudet] - - *) API: Clarification: except for RAW_ARGS, all command handlers can - treat the char * parameters as permanent, and modifiable. There - is no need to pstrdup() them. Clean up some needless pstrdup(). - [Dean Gaudet] - - *) Now mod_so keeps track of which module shared objects with which names - are loaded and thus avoids multiple loading and unloading and irritating - error_log messages. [Ralf S. Engelschall] - - *) Prior to the existence of mod_setenv it was necessary to tweak the TZ - environment variable in the apache core. But that tweaking interferes - with mod_setenv. So don't tweak if the user has specified an explicit - TZ variable. [Jay Soffian ] PR#1888 - - *) rputs() did not calculate r->sent_bodyct properly. - [Siegmund Stirnweiss ] PR#1900 - - *) The CGI spec says that REMOTE_HOST should be set to the remote hosts's - name, or left unset if this value is unavailable. Apache was setting - it to the IP address when unavailable. - [Tony Finch ] PR#1925 - - *) Various improvements to the configuration and build support for compiling - modules as shared objects. Especially Solaris 2.x, SunOS 4.1, IRIX and - OSF1 support with GCC and vendor compilers was added. This way shared - object support is now provided out-of-the-box for FreeBSD, Linux, - Solaris, SunOS, IRIX and OSF1. In short: On all major platforms! - [Ralf S. Engelschall] - - *) Minor cleanup in http_main -- split QNX and OS2 specific "mmap" - scoreboard code into separate #defines -- USE_POSIX_SCOREBOARD - and USE_OS2_SCOREBOARD. [Dean Gaudet] - - *) Fix one more special locking problem for RewriteMap programs in - mod_rewrite: According to the documentation of flock(), "Locks are on - files, not file descriptors. That is, file descriptors duplicated - through dup(2) or fork(2) do not result in multiple instances of a lock, - but rather multiple references to a single lock. If a process holding a - lock on a file forks and the child explicitly unlocks the file, the - parent will lose its lock.". To overcome this we have to make sure the - RewriteLock file is opened _AFTER_ the childs were spawned which is now - the case by opening it in the child_init instead of the module_init API - hook. [Ralf S. Engelschall] PR#1029 - - *) Change to Location and LocationMatch semantics. LocationMatch no - longer lets a single slash match multiple adjacent slashes in the - URL. This change is for consistency with RewriteRule and - AliasMatch. Multiple slashes have meaning in URLs that they do - not have in (some) filesystems. Location on the other hand can - be considered a shorthand for a more complicated regex, and it - does match multiple slashes with a single slash -- which is - also consistent with the Alias directive. - [Dean Gaudet] related PR#1440 - - *) Fix bug with mod_mime_magic causing certain files, including files - of length 0, to result in no response from the server. - [Dean Gaudet] - - *) The Configure script now generates src/include/ap_config.h which - contains the set of defines used when Apache is compiled on a platform. - This file can then be included by external modules before including - any Apache header files in case they are being built separately from - Apache. Along with this change, a couple of minor changes were - made to make Apache's #defines coexist peacefully with any autoconf - defines an external module might have. [Rasmus Lerdorf] - - *) Fix mod_rewrite for the ugly API case where sections exist - but without any RewriteXXXXX directives. Here mod_rewrite is given no - chance by the API to initialize its per-server configuration and thus - receives the wrong one from the main server. This is now avoided by - remembering the server together with the config structure while - configuring and later assuming there is no config when we see a - difference between the remembered server and the one calling us. - [Ralf S. Engelschall] PR#1790 - - *) Fixed the DBM RewriteMap support for mod_rewrite: First the support now - is automatically disabled under configure time when the dbm_xxx functions - are not available. Second, two heavy source code errors in the DBM - support code were fixed. This makes DBM RewriteMap's usable again after - a long time of brokenness. [Ralf S. Engelschall] PR#1696 - - *) Now all configuration files support Unix-style line-continuation via - the trailing backslash ("\") character. This enables us to write down - complex or just very long directives in a more readable way. The - backslash character has to be really the last character before the - newline and it has not been prefixed by another (escaping) backslash. - [Ralf S. Engelschall] - - *) When using ProxyPass the ?querystring was not passed correctly. - [Joel Truher ] - - *) To deal with modules being compiled and [dynamically] linked - at a different time from the core, the SERVER_VERSION and - SERVER_BUILT symbols have been abstracted through the new - API routines apapi_get_server_version() and apapi_get_server_built(). - [Ken Coar] PR#1448 - - *) WIN32: Preserve trailing slash in canonical path (and hence - in PATH_INFO). [Paul Sutton, Ben Laurie] - - *) PORT: USE_PTHREAD_SERIALIZED_ACCEPT has proven unreliable - depending on the rev of Solaris and what mixture of modules - are in use. So it has been disabled, and Solaris is back to - using USE_FCNTL_SERIALIZED_ACCEPT. Users may experiment with - USE_PTHREAD_SERIALIZED_ACCEPT at their own risk, it may speed - up static content only servers. Or it may fail unpredictably. - [Dean Gaudet] PR#1779, 1854, 1904 - - *) mod_test_util_uri.c created which tests the logic in util_uri.c. - [Dean Gaudet] - - *) API: Rewrite of absoluteURI handling, and in particular how - absoluteURIs match vhosts. Unless a request is a proxy request, a - "http://host" url is treated as if a similar "Host:" header had been - supplied. This change was made to support future HTTP/1.x protocols - which may require clients to send absoluteURIs for all requests. - - In order to achieve this change subtle changes were made to the API. In a - request_rec, r->hostlen has been removed. r->unparsed_uri now exists so - that the unmodified uri can be retrieved easily. r->proxyreq is not set - by the core, modules must set it during the post_read_request or - translate_names phase. - - Plus changes to the virtualhost test suite for absoluteURI testing. - - This fixes several bugs with the proxy proxying requests to vhosts - managed by the same httpd. - [Dean Gaudet] - - *) API: Cleanup of code in http_vhost.c, and remove vhost matching - code from mod_rewrite. The vhost matching is now performed by a - globally available function matches_request_vhost(). [Dean Gaudet] - - *) Reduce memory usage, and speed up ServerAlias support. As a - side-effect users can list multiple ServerAlias directives - and they're all considered. - [Chia-liang Kao ] PR#1531 - - *) The "poly" directive in image maps did not include the borders of the - polygon, whereas the "rect" directive does. Fix this inconsistency. - [Konstantin Morshnev ] PR#1771 - - *) Make \\ behave as expected. [Ronald.Tschalaer@psi.ch] - - *) Add the `%a' construct to LogFormat and CustomLog to log the client IP - address. [Todd Eigenschink ] PR#1885 - - *) API: A new source module main/util_uri.c; It contains a routine - parse_uri_components() and friends which breaks a URI into its component - parts. These parts are stored in a uri_components structure called - parsed_uri within each request_rec, and are available to all modules. - Additionally, an unparse routine is supplied which re-assembles the URI - components back to an URI, optionally hiding the username:password@ part - from ftp proxy requests, and other useful routines. Within the structure, - you find on a ready-for-use basis: - scheme; /* scheme ("http"/"ftp"/...) */ - hostinfo; /* combined [user[:password]@]host[:port] */ - user; /* user name, as in http://user:passwd@host:port/ */ - password; /* password, as in http://user:passwd@host:port/ */ - hostname; /* hostname from URI (or from Host: header) */ - port_str; /* port string (integer representation is in "port") */ - path; /* the request path (or "/" if only scheme://host was given) */ - query; /* Everything after a '?' in the path, if present */ - fragment; /* Trailing "#fragment" string, if present */ - This is meant to serve as the platform for *BIG* savings in - code complexity for the proxy module (and maybe the vhost logic). - [Martin Kraemer] - - *) Make all possible meta-construct expansions ($N, %N, %{NAME} and - ${map:key}) available for all location where a string is created in - mod_rewrite rewriting rulesets: 1st arg of RewriteCond, 2nd arg of - RewriteRule and for the [E=NAME:STRING] flag of RewriteRule. This way the - possible expansions are consequently usable at all string creation - locations. [Ralf S. Engelschall] - - *) Fix initialization of RewriteLogLevel (default now is 0 as documented - and not 1) and the per-virtual-server merging of directives. Now all - directives except `RewriteEngine' and `RewriteOption' are either - completely overridden (default) or completely inherited (when - `RewriteOptions inherit') is used. [Ralf S. Engelschall] PR#1325 - - *) Fix `RewriteMap' program lookup in situations where such maps are - defined but disabled (`RewriteEngine off') in per-server context. - [Ralf S. Engelschall] PR#1431 - - *) Fix bug introduced in 1.3b4-dev, config with no Port setting would cause - server to bind to port 0 rather than 80. [Dean Gaudet] - - *) Fix long-standing problem with RewriteMap _programs_ under Unix derivates - (like SunOS and FreeBSD) which don't accept the locking of pipes - directly. A new directive RewriteLock is introduced which can be used to - setup a separate locking file which then is used for synchronization. - [Ralf S. Engelschall] PR#1029 - - *) WIN32: The server root is obtained from the registry key - HKLM\SOFTWARE\Apache Group\Apache\ (version is currently - "1.3 beta"), unless overridden by the -d command line flag. The - value is stored by running "apache -i -d serverroot". [Paul Sutton] - - *) Merged os/win32/mod_dll.c into modules/standard/mod_so.c to support - dynamic loading on Win32 and Unix via the same module. [Paul Sutton] - - *) Now mod_rewrite no longer makes problematic assumptions on the characters - a username can contain when trying to expand it via /etc/passwd. - [Ralf S. Engelschall] - - *) The mod_setenvif BrowserMatch backwards compatibility command did not - work properly with spaces in the regex. [Ronald Tschalaer] PR#1825 - - *) Add new RewriteMap types: First, `rnd' which is equivalent to the `txt' - type but with a special post-processing for the looked-up value: It - parses it into alternatives according to `|' chars and then only one - particular alternative is chosen randomly (this is an essential - functionality needed for balancing between backend-servers when using - Apache as a Reverse Proxy. The looked up value here is a list of - servers). Second, `int' with the built-in maps named `tolower' and - `toupper' which can be used to map URL parts to a fixed case (this is an - essential feature to fix the case of server names when doing mass - virtual-hosting with the help of mod_rewrite instead of using - sections). [Ralf S. Engelschall, parts based on code from - Jay Soffian ] PR#1631 - - *) Add a new directive to mod_proxy similar to ProxyPass: `ProxyPassReverse'. - This directive lets Apache adjust the URL in Location-headers on HTTP - redirect responses sent by the remote server. This way the virtually - mapped area is no longer left on redirects and thus by-passed which is - especially essential when running Apache as a reverse proxy. - [Ralf S. Engelschall] - - *) Hide Proxy-Authorization from CGI/SSI/etc just like Authorization is - hidden. [Alvaro Martinez Echevarria] - - *) Apache will, when started with the -X (single process) debugging flag, - honor the SIGINT or SIGQUIT signals again now. This capability got lost - a while ago during OS/2 signal handling changes. - - *) [PORT] Work around the fact that NeXT runs on more than the - m68k chips in mod_status [Scott Anguish and Timothy Luoma - ] - - *) [PORT] Recognize FreeBSD versions so we can use the OS regex as well - as handling unsigned-chars for FreeBSD v3 and v2 [Andrey Chernov - and Jim] PR#1450 - - *) Use SA_RESETHAND or SA_ONESHOT when installing the coredump handlers. - In particular the handlers could trigger themselves into an infinite - loop if RLimitMem was used with a small amount of memory -- too small - for the signal stack frame to be set up. [Dean Gaudet] - - *) Fix problems with absoluteURIs introduced during 1.3b4. [Dean Gaudet, - Alvaro Martinez Echevarria ] - - *) Fix multiple UserDir problem introduced during 1.3b4-dev. - [Dean Gaudet] PR#1850 - - *) ap_cpystrn() had an off-by-1 error. - [Charles Fu ] PR#1847 - - *) API: As Ken suggested the check_cmd_context() function and related - defines are non-static now so modules can use 'em. [Martin Kraemer] - - *) mod_info would occasionally produce an unpaired in its - output. Fixed. [Martin Kraemer] - - *) By default AIX binds a process (and it's children) to a single - processor. httpd children now unbind themselves from that cpu - and re-bind to one selected at random via bindprocessor() - [Doug MacEachern] - - *) Linux 2.0 and above implement RLIMIT_AS, RLIMIT_DATA has almost no - effect. Work around it by using RLIMIT_AS for the RLimitMEM - directive. [Enrik Berkhan ] PR#1816 - - *) mod_mime_magic error message should indicate the filename when - reads fail. ["M.D.Parker" ] PR#1827 - - *) Previously Apache would permit to end (and - similary for Location and Directory), now this is diagnosed as an - error. Improve error messages for mismatched sections (, - , , , ...). - [Dean Gaudet, Martin Kraemer] - - *) is not permitted within (because of the - semantic ordering). [Dean Gaudet] PR#379 - - *) with wildcards was broken by the change in wildcard - semantics (* does not match /). To fix this, now - apply only to the basename of the request filename. This - fixes some other inconsistencies in semantics - (such as not working). [Dean Gaudet] PR#1817 - - *) Removed bogus "dist.tar" target from Makefile.tmpl and make sure - backup files are removed on "clean" target [Ralf S. Engelschall] - - *) PORT: Add -lm to LIBS for HPUX. [Dean Gaudet] PR#1639 - - *) Various errors from select() and accept() in child_main() would - result in an infinite loop. It seems these two tickle kernel - or library bugs occasionally, and result in log spammage and - a generally bad scene. Now the child exits immediately, - which seems to be a good workaround. - [Dean Gaudet] PR#1747, 1107, 588, 1787, 987, 588 - - *) Cleaned up some race conditions in unix child_main during - initialization. [Dean Gaudet] - - *) SECURITY: "UserDir /abspath" without a * in the path would allow - remote users to access "/~.." and bypass access restrictions - (but note /~../.. was handled properly). - [Lauri Jesmin ] PR#1701 - - *) API: os_is_path_absolute() now takes a const char * instead of a char *. - [Dean Gaudet] - -Changes with Apache 1.3b5 - - *) Source file dependencies in Makefile.tmpl files throughout the - source tree were updated to accurately reflect reality. - [Dean Gaudet] - - *) Preserve the content encoding given by the AddEncoding directive - when the client doesn't otherwise specify an encoding. - [Ronald Tschalaer ] - - *) Sort out problems with canonical filename handling happening too late. - [Dean Gaudet, Ben Laurie] - -Changes with Apache 1.3b4 - - *) The module structure was modified to include a *dynamic_load_handle - in the STANDARD_MODULE_STUFF portion, and the MODULE_MAGIC_NUMBER - has been bumped accordingly. [Paul Sutton] - - *) All BrowserMatch directives mentioned in - htdocs/manual/known_client_problems.html are in the default - configuration files. [Lars Eilebrecht] - - *) MiNT port update. [Jan Paul Schmidt] - - *) HTTP/1.1 requires x-gzip and gzip encodings be treated - equivalent, similarly for x-compress and compress. Apache - now ignores a leading x- when comparing encodings. It also - preserves the encoding the client requests (for example if - it requests x-gzip, then Apache will respond with x-gzip - in the Content-Encoding header). - [Ronald Tschalaer ] PR#1772 - - *) Fix a memory leak on keep-alive connections. [Igor Tatarinov] - - *) Added mod_so module to support dynamic loading of modules on Unix - (like mod_dld for Win32). This replaces mod_dld.c. Use SharedModule - instead of AddModule in Configuration to build shared modules - [Sameer Parekh, Paul Sutton] - - *) Minor cleanups to r->finfo handling in some modules. - [Dean Gaudet] - - *) Abstract read()/write() to ap_read()/ap_write(). - Makes it easier to add other types of IO code such as SFIO. - [Randy Terbush] - - *) API: Generalize default_port manipulations to make support of - different protocols easier. [Ben Laurie, Randy Terbush] - - *) There are many cases where users do not want Apache to form - self-referential urls using the "canonical" ServerName and Port. - The new UseCanonicalName directive (default on), if set to off - will cause Apache to use the client-supplied hostname and port. - API: Part of this change required a change to the construct_url() - prototype; and the addition of get_server_name() and - get_server_port(). - [Michael Douglass , Dean Gaudet] - PR#315, 459, 485, 1433 - - *) Yet another rearrangement of the source tree.. now all the common - header files are in the src/include directory. The -Imain -Iap - references in Makefiles have been changed to the simpler -Iinclude - instead. In addition to simplifying the build a little bit, this - also makes it clear when a module is referencing something in a - other than kosher manner (e.g., the proxy including mod_mime.h). - Module-private header files (the proxy, mod_mime, the regex library, - and mod_rewrite) have not been moved to src/include; nor have - the OS-abstraction files. [Ken Coar] - - *) Fix a bug where r->hostname didn't have the :port stripped - from it. [Dean Gaudet] - - *) Tweaked the headers_out table size, and the subprocess_env - table size guess in rename_original_environment(). Added - MAKE_TABLE_PROFILE which can help discover make_table() - calls that use too small an initial guess, see alloc.c. - [Dean Gaudet] - - *) Options and AllowOverride weren't properly merging in the main - server setting inside vhosts (only an issue when you have no - or other section containing an Options that affects - a request). Options +foo or -foo in the main_server wouldn't - affect the main_server's lookup defaults. [Dean Gaudet] - - *) Variable 'cwd' was being used pointlessly before being set. - [Ken Coar] PR#1738 - - *) r->allowed handling cleaned up in the standard modules. - [Dean Gaudet] - - *) Some case-sensitivity issues cleaned up to be consistent with - RFC2068. [Dean Gaudet] - - *) SIGURG doesn't exist everywhere. - [Mark Andrew Heinrich ] - - *) mod_unique_id was erroneously generating a second unique id when - an internal redirect occured. Such redirects occur, for example, - when processing a DirectoryIndex match. [Dean Gaudet] - - *) API: table_add, table_merge, and table_set include implicit pstrdup() - of the key and value. But in many cases this is not required - because the key/value is a constant, or the value has been built - by pstrcat() or other similar means. New routines table_addn, - table_mergen, and table_setn have been added to the API, these - routines do not pstrdup() their arguments. The core code and - standard modules were changed to take advantage of these routines. - The resulting server is up to 20% faster in some situations. - - Note that it is easy to get code subtly wrong if you pass a key/value - which is in a pool other than the pool of the table. The only - safe thing to do is to pass key/values which are in the pool of - the table, or in one of the ancestors of the pool of the table. - i.e. if the table is part of a subrequest, a value from the main - request's pool is OK since the subrequest pool is a sub_pool of the - main request's pool (and therefore has a lifespan at most as long as - the main pool). There is debugging code which can detect improper - usage, enabled by defining POOL_DEBUG. See alloc.c for more details. - [Dmitry Khrustalev , Dean Gaudet] - - *) More mod_mime_magic cleanup: fewer syscalls; should handle "files" - which don't exist on disk more gracefully; handles vhosts properly. - Update documentation to reflect the code -- if there's no - MimeMagicFile directive then the module is not enabled. - [Dean Gaudet] - - *) PORT: Some older *nix dialects cannot automatically start scripts - which begin with a #! interpreter line (the shell starts the scripts - appropriately on these platforms). Apache now supports starting of - "hashbang-scripts" when the NEED_HASHBANG_EMUL define is set. - [Martin Kraemer, with code from peter@zeus.dialix.oz.au (Peter Wemm) - taken from tcsh] - - *) API: "typedef array_header table" removed from alloc.h, folks should - have been writing to use table as if it were an opaque type, but even - some standard modules got this wrong. By changing the definition - to "typedef struct table table" module authors will receive compile - time warnings that they're doing the wrong thing. This change - facilitates future changes with more sophisticated table - structures. Specifically, module authors should be using table_elts() - to get access to an array_header * for the table. [Dean Gaudet] - - *) API: Renamed new_connection() to avoid namespace collision with LDAP - library routines. [Ken Coar, Rasmus Lerdorf] - - *) WIN32: mod_speling is now available on the Win32 platform. - [Marc Slemko] - - *) For clarity the following compile time definition was changed: - - SAFE_UNSERIALIZED_ACCEPT -> SINGLE_LISTEN_UNSERIALIZED_ACCEPT - - Also, for example, HAVE_MMAP would mean to use mmap() scoreboards - and not be a general notice that the OS has mmap(). Now the - HAVE_MMAP/SHMGET #defines strictly are informational that the - OS has that method of shared memory; the type to use for - the scoreboard is a seperate #define (USE_MMAP_SCOREBOARD - and USE_SHMGET_SCOREBOARD). This allows outside modules to - determine if shared memory is available and allows Apache - to determine the best method to use for the scoreboard. - [Jim Jagielski] - - *) PORT: UnixWare 2.1.2 SMP appears to require USE_FCNTL_SERIALIZED_ACCEPT, - as do various earlier versions. It should be safe on all versions. - Unixware 1.x appears to have the same SIGHUP bug as solaris does with - the slack code. A few other cleanups for Unixware. - [Tom Hughes ] PR#1082, PR#1282, PR#1499, PR#1553 - - *) PORT: A/UX can handle single-listen accepts without mutex - locking, so we add SINGLE_LISTEN_UNSERIALIZED_ACCEPT. [Jim Jagielski] - - *) When die() happens we need to eat any request body if one exists. - Otherwise we can't continue with a keepalive session. This shows up - as a POST problem with MSIE 4.0, typically against pages which are - authenticated. [Roy Fielding] PR#1399 - - *) If you define SECURITY_HOLE_PASS_AUTHORIZATION then the Authorization - header will be passed to CGIs. This is generally a security hole, so - it's not a default. [Marc Slemko] PR#549 - - *) Fix Y2K problem with date printing in suexec log. - [Paul Eggert ] PR#1343 - - *) WIN32 deserves a pid file. [Ben Hyde] - - *) suexec errors now include the errno/description. [Marc Slemko] PR#1543 - - *) PORT: OSF/1 now uses USE_FLOCK_SERIALIZED_ACCEPT to solve PR#467. - The choice of flock vs. fcntl was made based on timings which showed that - even on non-NFS, non-exported filesystems fcntl() was an order of - magnitude slower. It also uses SINGLE_LISTEN_UNSERIALIZED_ACCEPT so - that single socket users will see no difference. [Dean Gaudet] PR#467 - - *) "File does not exist" error message was erroneously including the - errno. [Marc Slemko] - - *) Improve the warning message generated when a client drops the - connection (hits stop button, etc.) during a send. [Roy Fielding] - - *) Defining GPROF will disable profiling in the parent and enable it - in the children. If you're profiling under Linux this is pretty much - necessary because SIGPROF is lost across a fork(). [Dean Gaudet] - - *) htdigest and htpasswd needed slight tweaks to work on OS/2 and WIN32. - [Brian Havard] - - *) The NeXT cc (which is gcc hacked up) doesn't appear to support some - gcc functionality. Work around it. - [Keith Severson ] PR#1613 - - *) Some linkers complain when .o files contain no functions. - [Keith Severson ] PR#1614 - - *) Some const declarations in mod_imap.c that were added for debugging - purposes caused some compilers heartburn without adding any - significant value, so they've been removed. [Ken Coar] - - *) The src/main/*.h header files have had #ifndef wrappers added to - insulate them against duplicate calls if they get included through - multiple paths (e.g., in .c files as well as other .h files). - [Ken Coar] - - *) The libap routines now have a header file for their prototypes, - src/ap/ap.h, to ease their use in non-httpd applications. [Ken Coar] - - *) mod_autoindex with a plaintext header file would emit the
-     start-tag before the HTML preamble, rather than after the preamble
-     but before the header file contents.  [John Van Essen ]
-     PR#1667
-
-  *) SECURITY: Fix a possible buffer overflow in logresolve.  This is
-     only an issue on systems without a MAXDNAME define or where
-     the resolver returns domain names longer than MAXDNAME.  [Marc Slemko]
-
-  *) SECURITY: Eliminate possible buffer overflow in cfg_getline, which
-     is used to read various types of files such as htaccess and
-     htpasswd files.  [Marc Slemko]
-
-  *) SECURITY: Ensure that the buffer returned by ht_time is always
-     properly null terminated.  [Marc Slemko]
-
-  *) The "Connection" header could be sent back with multiple "close"
-     tokens.  Not an error, but a waste.
-     [Ronald.Tschalaer@psi.ch] PR#1683
-
-  *) mod_rewrite's RewriteLog should behave like mod_log_config, it
-     shouldn't force hostname lookups.  [Dean Gaudet] PR#1684
-
-  *) "basic" auth needs a case-insensitive comparison.
-     [Ronald.Tschalaer@psi.ch] PR#1666
-
-  *) For maximum portability, the environment passed to CGIs should
-     only contain variables whose names match the regex
-     /[a-zA-Z][a-zA-Z0-9_]*/.  This is now enforced by stamping
-     underscores over any character outside the regex.  This
-     affects HTTP_* variables, in a way that should be backward
-     compatible for all the standard headers; and affects variables
-     set with SetEnv/BrowserMatch and similar directives.
-     [Dean Gaudet]
-
-  *) mod_speling returned incorrect HREF's when an ambigous match
-     was found. Noticed by  (Soeren Ziehe)
-     [robinton@amtrash.comlink.de (Soeren Ziehe), Martin Kraemer]
-
-  *) PORT: Apache now compiles & runs on an EBCDIC mainframe
-     (the Siemens BS2000/OSD family) in the POSIX subsystem
-     [Martin Kraemer]
-
-  *) PORT: Fix problem killing children when terminating.  Allow ^C
-     to shut down the server.  [Brian Havard]
-
-  *) pstrdup() is implicit in calls to table_* functions, so there's
-     no need to do it before calling.  Clean up a few cases.
-     [Marc Slemko, Dean Gaudet]
-
-  *) new -C and -c command line arguments
-     usage:
-     -C "directive" : process directive before reading config files
-     -c "directive" : process directive after reading config files
-     example:
-     httpd -C "PerlModule Apache::httpd_conf"
-     [Doug MacEachern, Martin Kraemer]
-
-  *) WIN32: Fix the execution of CGIs that are scripts and called 
-     with path info that does not have an '=' in.
-     (eg. http://server/cgi-bin/printenv?foobar)  
-     [Marc Slemko] PR#1591
-
-  *) WIN32: Fix a call to os_canonical_filename so it doesn't try to 
-     mess with fake filenames.  This fixes proxy caching on 
-     win32. PR#1265
-
-  *) SECURITY: General mod_include cleanup, including fixing several
-     possible buffer overflows and a possible infinite loop.
-     [Dean Gaudet, Marc Slemko]
-
-  *) SECURITY: Numerous changes to mod_imap in a general cleanup
-     including fixing a possible buffer overflow.  [Dean Gaudet]
-
-  *) WIN32: overhaul of multithreading code. Shutdowns are now graceful
-     (connections are not dropped). Code can handle graceful restarts
-     (but there is as yet no way to signal this to Apache). Various
-     other cleanups. [Paul Sutton]
-
-  *) The aplog_error changes specific to 1.3 introduced a buffer
-     overrun in the (now legacy) log_printf function.  Fixed.
-     [Dean Gaudet]
-
-  *) mod_digest didn't properly deal with proxy authentication.  It
-     also lacked a case-insensitive comparision of the "Digest"
-     token.  [Ronald Tschalaer ] PR#1599
-
-  *) A few cleanups in mod_status for efficiency.  [Dean Gaudet]
-
-  *) A few cleanups in mod_info to make it thread-safe, and remove an
-     off-by-5 bug that could hammer \0 on the stack. [Dean Gaudet]
-
-  *) no2slash() was O(n^2) in the length of the input.  Make it O(n).
-     [Dean Gaudet]
-
-  *) API: migration from strncpy() to our "enhanced" version called
-     ap_cpystrn() for performance and functionality reasons.
-     Located in libap.a.  [Jim Jagielski]
-
-  *) table_set() and table_unset() did not deal correctly with
-     multiple occurrences of the same key.
-     [Stephen Scheck , Ben Laurie] PR#1604
-
-  *) The AuthName must now be enclosed in quotes if it is to contain
-     spaces.  [Ken Coar] PR#1195
-
-  *) API: new function: ap_escape_quotes(). [Ken Coar] PR#1195
-
-  *) WIN32: Work around optimiser bug that killed ISAPI in release
-     versions. [Ben Laurie] PR#1533
-
-  *) PORT: Update the MPE port [Mark Bixby, Jim Jagielski]
-
-  *) Interim (slow) fix for p->sub_pool critical sections in
-     alloc.c (affects win32 only).  [Ben Hyde]
-
-  *) non-WIN32 was missing destroy_mutex definition.  [Ben Hyde]
-
-  *) send_fd_length() did not calculate total_bytes_sent properly.
-     [Ben Reser ] PR#1366
-
-  *) The bputc() macro was not properly integrated with the chunking
-     code; in many cases modules using bputc() could cause completely
-     bogus chunked output.  (Typically this will show up as problems
-     with Internet Explorer 4.0 reading a page, but other browsers
-     having no problem.) [Dean Gaudet]
-
-  *) Create LARGE_WRITE_THRESHOLD define which determines how many
-     bytes have to be supplied to bwrite() before it will consider
-     doing a writev() to assemble multiple buffers in one system
-     call.  This is critical for modules such as mod_include,
-     mod_autoindex, mod_php3 which all use bputc()/bputs() of smaller
-     strings in some cases.  The result would be extra effort
-     setting up writev(), and in many cases extra effort building
-     chunks.  The default is 31, it can be overriden at compile
-     time. [Dean Gaudet]
-
-  *) Move the gid switching code into the child so that log files
-     and pid files are opened with the root gid.
-     [Gregory A Lundberg ]
-
-  *) WIN32: Check for binaries by looking for the executable header
-     instead of counting control characters.
-     [Jim Patterson ] PR#1340
-
-  *) ap_snprintf() moved from main/util_snprintf.c to ap/ap_snprintf.c
-     so the functionality is available to applications other than the
-     server itself (like the src/support tools).  [Ken Coar]
-
-  *) ap_slack() moved out of main/util.c into ap/ap_slack.c as part of
-     the libap consolidation work.  [Ken Coar]
-
-  *) ap_snprintf() with a len of 0 behaved like sprintf().  This is not
-     useful, and isn't what the standards require.  Now it returns 0
-     and writes nothing.  [Dean Gaudet]
-
-  *) When an error occurs in fcntl() locking suggest the user look up
-     the docs for LockFile.  [Dean Gaudet]
-
-  *) Eliminate some dead code from writev_it_all().
-     [Igor Tatarinov ]
-
-  *) mod_autoindex had an fread() without checking the result code.
-     It also wouldn't handle "AddIconByType (TXT,/icons/text.gif text/*"
-     (note the missing closing paren) properly.  [Dean Gaudet]
-
-  *) It appears the "257th byte" bug (see
-     htdocs/manual/misc/known_client_problems.html#257th-byte) can happen
-     at the 256th byte as well.  Fixed.  [Dean Gaudet]
-
-  *) PORT: Fix mod_mime_magic under OS/2, no support for block devices.
-     [Brian Havard]
-
-  *) Fix memory corruption caused by allocating auth usernames in the
-     wrong pool.  [Dean Gaudet] PR#1500
-
-  *) Fix an off-by-1, and an unterminated string error in
-     mod_mime_magic.  [Dean Gaudet]
-
-  *) Fix a potential SEGV problem in mod_negotiation when dealing
-     with type-maps.  [Dean Gaudet]
-
-  *) Better glibc support under Linux.  [Dean Gaudet] PR#1542
-
-  *) "RedirectMatch gone /" would cause a SIGSEGV. [Dean Gaudet] PR#1319
-
-  *) WIN32: avoid overflows during file canonicalisations.
-     [malcolm@mgdev.demon.co.uk] PR#1378
-
-  *) WIN32: set_file_slot() didn't detect absolute paths. [Ben Laurie]
-     PR#1511, 1508
-
-  *) WIN32: mod_status display header didn't match fields. [Ben Laurie]
-
-  *) The pthread_mutex_* functions return an error code, and don't
-     set errno.  [Igor Tatarinov ]
-
-  *) WIN32: Allow spaces to prefix the interpreter in #! lines.
-     [Ben Laurie] PR#1101
-
-  *) WIN32: Cure file leak in CGIs. [Peter Tillemans ] PR#1523
-
-  *) proxy_ftp: the directory listings generated by the proxy ftp module
-     now have a title in which the path components are clickable and allow
-     quick navigation to the clicked-on directory on the currently listed
-     ftp server. This also fixes a bug where the ".." directory links would
-     sometimes refer to the wrong directory.  [Martin Kraemer]
-
-  *) WIN32: Allocate the correct amount of memory for the scoreboard.
-     [Ben Hyde] PR#1387
-
-  *) WIN32: Only lowercase the part of the path that is real. [Ben Laurie]
-     PR#1505
-
-  *) Fix problems with timeouts in inetd mode and -X mode.  [Dean Gaudet]
-
-  *) Fix the spurious "(0)unknown error: mmap_handler: mmap failed"
-     error messages. [Ben Hyde]
-
-Changes with Apache 1.3b3
-
-  *) WIN32: Work around brain-damaged spawn calls that can't deal
-     with spaces and slashes.  [Ben Laurie]
-
-  *) WIN32: Fix the code so CGIs can use socket calls on Windows.  
-     The problem was that certain undocumented environment variables
-     needed for sockets to work under Win32 were not being passed.
-     [Frank Faubert ]
-
-  *) Add a "-V" command line flag to the httpd binary.  This 
-     flag shows some of the defines that Apache was compiled with.
-     It is useful for debugging purposes.  [Martin Kraemer]
-
-  *) Start separating the ap_*() routines into their own library, so they
-     can be used by items in src/support among other things.  
-     [Ken Coar] PR#512, 905, 1252, 1308 
-
-  *) Give a more informative error when no AuthType is set.
-     [Lars Eilebrecht]
-
-  *) Remove strtoul() use from mod_proxy because it isn't available
-     on all platforms.   [Marc Slemko] PR#1214
-
-  *) WIN32: Some Win32 systems terminated all responses after 16 kB. 
-     This turns out to be a bug in Winsock - select() doesn't always 
-     return the correct status.  [Ben Laurie]
-
-  *) Directives owned by http_core can now use the new check_cmd_context()
-     routine to ensure that they're not being used within a container
-     (e.g., ) where they're invalid.  [Martin Kraemer]
-
-  *) PORT: Recent changes made it necessary to add explicit prototype
-     for fgetc() and fgets() on SunOS 4.x.  [Martin Kraemer, Ben Hyde]
-
-  *) It was necessary to distinguish between resources which are
-     allocated in the parent, for cleanup in the parent, and resources
-     which are allocated in each child, for cleanup in each child.
-     A new pool was created which is passed to the module child_init
-     and child_exit functions; modules are free to register per-child
-     cleanups there.  This fixes a bug with reliable piped logs.
-     [Dean Gaudet]
-
-  *) mod_autoindex wasn't displaying the ReadmeName file at the bottom
-     unless it was also doing FancyIndexes, but it displayed the
-     HeaderName file at the top under all circumstances.  It now shows
-     the ReadmeName file for simple indices, too, as it should.  
-     [Ken Coar] PR#1373
-
-  *) http_core was mmap()ing even in cases where it wasn't going to
-     read the file.  [Ben Hyde ]
-
-  *) Complete rewrite ;-) of mod_rewrite's URL rewriting engine:
-     Now the rewriting engine (the heart of mod_rewrite) is organized more
-     straight-forward, first time well documented and reduced to the really
-     essential parts. All redundant cases were stripped off and processing now
-     is the same for both per-server and per-directory context with only a
-     minimum difference (the prefix stripping in per-dir context). As a
-     side-effect some subtle restrictions and two recently discovered problems
-     are gone: Wrong escaping of QUERY_STRING on redirects in per-directory
-     context and restrictions on the substitution URL on redirects.
-     Additionally some minor source cleanups were done. 
-     [Ralf S. Engelschall] 
-
-  *) Lars Eilebrecht wrote a whole new set of Apache Vhost Internals
-     documentation, examples, explanations and caveats. They live in a new
-     subdirectory htdocs/manual/vhost/. [Lars Eilebrecht ]
-
-  *) If ap_slack fails to allocate above the low slack line it's a good
-     indication that further problems will occur; it's a better indication
-     than many external libraries give us when we actually run out of
-     descriptors.  So report it to the user once per restart.
-     [Dean Gaudet] PR#1181
-
-  *) Change mod_include and mod_autoindex to use Y2K-safe date formats
-     by default.  [Ken Coar]
-
-  *) Add a "SuppressColumnSorting" option to the IndexOptions list,
-     which will keep the column heading from being links for sorting
-     the display.  [Ken Coar, suggested by Brian Tiemann ]
-     PR #1261
-
-  *) PORT: Update the LynxOS port.  [Marius Groeger ]
-
-  *) Fix logic error when issuing a mmap() failed message
-     with a non-zero MMAP_THRESHOLD.
-     [David Chambers ] PR#1294
-
-  *) Preserve handler value on ProxyPass'ed requests by not
-     calling find_types on a proxy'd request; fixes problems
-     where some ProxyPass'ed URLs weren't actually passed
-     to the proxy.
-     [Lars Eilebrecht] PR#870
-
-  *) Fix a byte ordering problem in mod_access which prevented
-     the old-style syntax (i.e. "a.b.c." to match a class C)
-     from working properly. [Dean Gaudet] PR#1248, 1328, 1384
-
-  *) Fix problem with USE_FLOCK_SERIALIZED_ACCEPT not working
-     properly. Each child needs to open the lockfile instead
-     of using the passed file-descriptor from the parent. 
-     [Jim Jagielski] PR#1056
-
-  *) Fix the error logging in mod_cgi; the recent error log changes
-     introduced a bug that prevented it from working correctly.
-     [M.D.Parker] PR#1352
-
-  *) Default to USE_FCNTL_SERIALIZED_ACCEPT on HPUX to properly 
-     handle multiple Listen directives.  [Marc Slemko] PR#872
-
-  *) Inherit a bugfix to fnmatch.c from FreeBSD sources.
-     ["[KOI8-R] áÎÄÒÅÊ þÅÒÎÏ×" ] PR#1311
-
-  *) When a configuration parse complained about a bad directive,
-     the logger would use whatever (unrelated) value was in errno.
-     errno is now forced to EINVAL first in this case.  [Ken Coar]
-
-  *) A sed command in the Configure script pushed the edge of POSIXness,
-     breaking on some systems.  [Bhaba R.Misra ] PR#1368
-
-  *) Solaris >= 2.5 was totally broken due to a mess up using pthread
-     mutexes.  [Roy Fielding, Dean Gaudet]
-
-  *) OS/2 Port updated; it should be possible to build OS/2 from the same
-     sources as Unix now.  [Brian Havard ]
-
-  *) Fix a year formatting bug in mod_usertrack.
-     [Paul Eggert ] PR#1342
-
-  *) A mild SIGTERM/SIGALRM race condition was eliminated.
-     [Dean Gaudet] PR#1211
-
-  *) Warn user that default path has changed if /usr/local/etc/httpd
-     is found on the system.  [Lars Eilebrecht]
-
-  *) Various mod_mime_magic bug fixes and cleanups: Uncompression
-     should work, it should work on WIN32, and a few resource
-     leaks and abort conditions are fixed.
-     [Dean Gaudet] PR#1205
-
-  *) PORT: On AIX 1.x files can't be named '@', fix the proxy cache
-     to use '%' instead of '@' in its encodings.
-     [David Schuler ] PR#1317
-
-  *) Improve the warning message generated when the "server is busy".
-     [Dean Gaudet] PR#1293
-
-  *) PORT: All ports which don't otherwise define DEF_WANTHSREGEX will
-     get Spencer regex by default.  This is to avoid having to
-     discover bugs in operating system libraries.  [Dean Gaudet]
-
-  *) PORT: "Fix" PR#467 by generating warnings on systems which we have
-     not been able to get working USE_*_SERIALIZED_ACCEPT settings for.
-     Document this a bit more in src/PORTING.  [Dean Gaudet] PR#467
-
-  *) Ensure that one copy of config warnings makes it to the
-     error_log.  [Dean Gaudet]
-
-  *) Invent new structure and associated methods to handle config file
-     reading. Add "custom" hook to use config file cfg_getline() on
-     something which is not a FILE*  [Martin Kraemer]
-
-  *) Make single-exe Windows install. [Ben Laurie and Eric Esselink]
-
-  *) WIN32: Make CGI work under Win95. [Ben Laurie and Paul Sutton]
-
-  *) WIN32: Make index.html and friends work under Win95. [Ben Laurie]
-
-  *) PORT: Solaris 2.4 needs Spencer regex, the system regex is broken.
-     [John Line ] PR#1321
-
-  *) Default pathname has been changed everywhere to /usr/local/apache
-     [Sameer ]
-
-  *) PORT: AIX now uses USE_FCNTL_SERIALIZED_ACCEPT.
-     [David Bronder ] PR#849
-
-  *) PORT: i386 AIX does not have memmove.
-     [David Schuler ] PR#1267
-
-  *) PORT: HPUX now defaults to using Spencer regex.
-     [Philippe Vanhaesendonck ,
-     Omar Del Rio ] PR#482, 1246
-
-  *) PORT: Some versions of NetBSD don't automatically define
-     __NetBSD__.  Workaround by defining NETBSD.
-     [Chris Craft ] PR#977
-
-  *) PORT: UnixWare 2.x requires -lgen for syslog.
-     [Hans Snijder ] PR#1249
-
-  *) PORT: ULTRIX appears to not have syslog.
-     [Lars Eilebrecht ]
-
-  *) PORT: Basic Gemini port (treat it like unixware212).
-     ["Pavel Yakovlev (Paul McHacker)" ]
-
-  *) PORT: All SVR4 systems now use NET_SIZE_T = size_t, and
-     use USE_SHMGET_SCOREBOARD.
-     [Martin Kraemer]
-
-  *) Various improvements in detecting config file errors (missing closing
-     directives for ,  etc. blocks, prohibiting global
-     server settings in  blocks, flagging unhandled multiple
-     arguments to ,  etc.)
-     [Martin Kraemer]
-
-  *) Add support to suexec wrapper program for mod_unique_id's UNIQUE_ID
-     variable to provide this one to suexec'd CGIs, too.
-     [M.D.Parker ] PR#1284
-
-  *) New support tool: src/support/split-logfile, a sample Perl script which
-     splits up a combined access log into separate files based on the
-     name of the virtual host (listed first in the log records by "%v").
-     [Ken Coar]
-
-Changes with Apache 1.3b2 (there is no 1.3b1)
-
-  *) TestCompile was not passing $LIBS [Dean Gaudet]
-
-  *) Makefile.tmpl was not using $CFLAGS in the link phase. 
-     [Martin Kraemer]
-
-  *) Add debugging code to alloc.c.  Defining ALLOC_DEBUG provides a
-     rudimentary memory debugger which can be used on live servers with
-     low impact -- it sets all allocated and freed memory bytes to 0xa5.
-     Defining ALLOC_USE_MALLOC will cause the alloc code to use malloc()
-     and free() for each object.  This is far more expensive and should
-     only be used for testing with tools such as Electric Fence and
-     Purify.  See main/alloc.c for more details.  [Dean Gaudet]
-
-  *) Configure uses a sh trap and didn't set its exitcode properly.
-     [Dean Gaudet] PR#1159
-
-  *) Yet another vhost revamp.  Add the NameVirtualHost directive which
-     explicitly lists the ip:port pairs that are to be used for name-vhosts.
-     From a given ip:port, regardless what the Host: header is, you can
-     only reach the vhosts defined on that ip:port.  The precedence of
-     vhosts was reversed to match other precedences in the config --
-     the earlier vhosts override the later vhosts.  All vhost matching was
-     moved into http_vhost.[ch].  [Dean Gaudet]
-
-  *) ap_inline can be used to force inlining.  GNUC __attribute__() can
-     be used for whatever reason is appropriate (i.e. format() warnings
-     for printf style functions).  Both are enabled only with
-     gcc >= 2.7.x (so that we have fewer support issues with older
-     versions).  [Dean Gaudet]
-
-  *) Fix support for Proxy Authentication (we were testing the response
-     status too early). [Marc Slemko]
-
-  *) CoreDumpDirectory directive directs where the core file is
-     written when a SIGSEGV, SIGBUS, SIGABORT or SIGABRT are
-     received.  [Marc Slemko, Dean Gaudet]
-
-  *) PORT: Support for Atari MINT.
-     [Jan Paul Schmidt ]
-
-  *) When booting, apache will now detach itself from stdin, stdout,
-     and stderr.  stderr will not be detached until after the config
-     files have been read so you will be able to see initial error
-     messages.  After that all errors are logged in the error_log.
-     This makes it more convenient to start apache via rsh, ssh,
-     or crontabs.  [Dean Gaudet] PR#523
-
-  *) mod_proxy was sending HTTP/1.1 responses to ftp requests by mistake.
-     Also removed the auto-generated link to www.apache.org that was the
-     source of so many misdirected bug reports.  [Roy Fielding, Marc Slemko]
-
-  *) send_fb would not detect aborted connections in some situations.
-     [Dean Gaudet]
-
-  *) mod_include would use uninitialized data when parsing certain
-     expressions involving && and ||. [Brian Slesinsky] PR#1139
-
-  *) mod_imap should only handle GET methods.  [Jay Bloodworth]
-
-  *) suexec.c wouldn't build without -DLOG_EXEC. [Jason A. Dour]
-
-  *) mod_autoindex improperly counted &escapes; as more than one
-     character in the description.  It also improperly truncated
-     descriptions that were exactly the maximum length.
-     [Martin Kraemer]
-
-  *) RedirectMatch was not properly escaping the result (PR#1155).  Also
-     "RedirectMatch /advertiser/(.*) $1" is now permitted.
-     [Dean Gaudet]
-
-  *) mod_include now uses symbolic names to check for request success
-     and return HTTP errors, and correctly handles all types of
-     redirections (previously it only did temporary redirect correctly).
-     [Ken Coar, Roy Fielding]
-
-  *) mod_userdir was modifying r->finfo in cases where it wasn't setting
-     r->filename.  Since those two are meant to be in sync with each other
-     this is a bug.  ["Paul B. Henson" ]
-
-  *) PORT: Support Unisys SVR4, whose uname returns mostly useless data.
-     ["Kaufman, Steven E" ]
-
-  *) Inetd mode (which is buggy) uses timeouts without having setup the
-     jmpbuffer. [Dean Gaudet] PR#1064
-
-  *) Work around problem under Linux where a child will start looping
-     reporting a select error over and over.
-     [Rick Franchuk ] PR#1107, 987, 588
-
-  *) Fixed error in proxy_util.c when looping through multiple host IP
-     addresses. [Lars Eilebrecht] PR#974
-
-  *) If BUFFERED_LOGS is defined then mod_log_config will do atomic
-     buffered writes -- that is, it will buffer up to PIPE_BUF (i.e. 4k)
-     bytes before writing, but it will never split a log entry across a
-     buffer boundary.  [Dean Gaudet]
-
-  *) API: the short_score record has been split into two pieces, one which
-     the parent writes on, and one which the child writes on.  As part of
-     this change the get_scoreboard_info() function was removed, and
-     scoreboard_image was exported.  This change fixes a race condition
-     in file based scoreboard systems, and speeds up changes involving the
-     scoreboard in earlier 1.3 development.  [Dean Gaudet]
-
-  *) API: New register_other_child() API (see http_main.h) which allows
-     modules to register children with the parent for maintenance.  It
-     is disabled by defining NO_OTHER_CHILD.  [Dean Gaudet]
-
-  *) API: New piped_log API (see http_log.h) which implements piped logs,
-     and will use register_other_child to implement reliable piped logs
-     when it is available.  The reliable piped logs part can be disabled
-     by defining NO_RELIABLE_PIPED_LOGS.  At the moment reliable piped
-     logs is only available on Unix. [Dean Gaudet]
-
-  *) API: set_last_modified() broken into set_last_modified(), set_etag(), and
-     meets_conditions().  This allows conditional HTTP selection to be
-     handled separately from the storing of the header fields, and provides
-     the ability for CGIs to set their own ETags for conditional checking.
-     [Ken Coar, Roy Fielding]  PR#895
-
-  *) Changes to mod_log_config to allow naming of format strings.
-     Format nicknames are defined with "LogFormat fmt nickname", and can
-     be used with "LogFormat nickname" and "CustomLog logtarget nickname".
-     [Ken Coar]
-
-  *) New module, "mod_speling", which can help find files even when 
-     the URL is slightly misspelled. [Martin Kraemer, Alexei Kosut]
-
-  *) API: New function child_terminate() triggers the child process to
-     exit, while allowing the child finish what it needs to for the
-     current request first.  
-     [Doug MacEachern, Alexei Kosut]
-
-  *) Windows now defaults to using full status reports with mod_status.
-     [Alexei Kosut] PR #1094
-
-  *) *Really* disable all mod_rewrite operations if the engine is off.
-     Some things (like RewriteMaps) were checked/performed even if they
-     weren't supposed to be.  [Ken Coar] PR #991
-
-  *) Implement a new timer scheme which eliminates the need to call alarm() all
-     the time.  Instead a counter in the scoreboard for each child is used to
-     show when the child has made forward progress.  The parent samples this
-     counter every scoreboard maintenance cycle, and issues SIGALRM if no
-     progress has been made in the timeout period.  This reduces the static
-     request best-case syscall count to 22 from 29.  This scheme is only
-     used by systems with memory-based scoreboards.  [Dean Gaudet]
-
-  *) The proxy now properly handles CONNECT requests which are sent
-     to proxy servers when using ProxyRemote.  [Marc Slemko] PR#1024
-
-  *) A script called apachectl has been added to the support 
-     directory.  This script allows you to do things such as 
-     "apachectl start" and "apachectl restart" from the command
-     line.  [Marc Slemko]
-
-  *) Modules and core routines are now put into libraries, which
-     simplifies the link line tremendously (among other advantages).
-     [Paul Sutton]
-
-  *) Some of the MD5 names defined in Apache have been renamed to have
-     an `ap_' prefix to avoid conflicts with routines supplied by
-     external libraries.  [Ken Coar]
-
-  *) Removal of mod_auth_msql.c from the distribution. There are many
-     other options for databases today. Rather than offer one option,
-     offer none at this time. mod_auth_msql and other SQL database
-     authentication modules can be found at the Apache Module Registry.
-     http://modules.apache.org/ It would be nice to offer a generic
-     mod_auth_sql option in the near future.
-
-  *) PORT: BeOS support added [Alexei Kosut]
-
-  *) Configure no longer accepts the -make option, since it creates
-     Makefile on the fly based on Makefile.tmpl and Configuration.
-
-  *) Apache now gracefully shuts down when it receives a SIGTERM, instead
-     of forcibly killing off all its processes and exiting without
-     cleaning up. [Alexei Kosut]
-
-  *) API: A new field in the request_rec, r->mtime, has been added to
-     avoid gratuitous parsing of date strings.  It is intended to hold
-     the last-modified date of the resource (if applicable).  An
-     update_mtime() routine has also been added to advance it if
-     appropriate.  [Roy Fielding, Ken Coar]
-
-  *) SECURITY: If a htaccess file can not be read due to bad permissions,
-     deny access to the directory with a HTTP_FORBIDDEN.  The previous
-     behavior was to ignore the htaccess file if it could not be read.
-     This change may make some setups with unreadable htaccess files
-     stop working.  [Marc Slemko] PR#817
-
-  *) Add aplog_error() providing a mechanism to define levels of
-     verbosity to the server error logging. This addition also provides
-     the ability to log errors using syslogd. Error logging is configurable
-     on a per-server basis using the LogLevel directive. Conversion
-     of log_*() in progress. [Randy Terbush]
-
-  *) Further enhance aplog_error() to not log filename, line number, and
-     errno information when it isn't applicable. [Ken Coar, Dean Gaudet]
-
-  *) WIN32: Canonicalise filenames under Win32. Short filenames are
-     converted to long ones. Backslashes are converted to forward
-     slashes. Case is converted to lower. Parts of URLs that do not
-     correspond to files are left completely alone. [Ben Laurie]
-
-  *) PORT: 2 new OSs added to the list of ports:
-      Encore's UMAX V: Arieh Markel 
-      Acorn RISCiX: Stephen Borrill 
-
-  *) Add the server version (SERVER_VERSION macro) to the "server
-     configured and running" entry in the error_log.  Also build an
-     object file at link-time that contains the current time
-     (SERVER_BUILT global const char[]), and include that in the
-     message.  [Ken Coar]
-
-  *) Set r->headers_out when sending responses from the proxy.
-     This fixes things such as the logging of headers sent from
-     the proxy.  [Marc Slemko] PR#659
-
-  *) support/httpd_monitor is no longer distributed because the 
-     scoreboard should not be file based if at all possible. Use
-     mod_status to see current server snapshot.
-
-  *) (set_file_slot): New function, allowing auth directives to be
-     independent of the server root, so the server documents can be
-     moved to a different directory or machine more easily.
-     [David J. MacKenzie]
-
-  *) If no TransferLog is given explicitly, decline
-     to log.  This supports coexistence with other logging modules,
-     such as the custom one that UUNET uses. [David J. MacKenzie]
-
-  *) Check for titles in server-parsed HTML files.
-     Ignore leading newlines and returns in titles.  The old behavior
-     of replacing a newline after  with a space causes the
-     title to be misaligned in the listing. [David J. MacKenzie]
-
-  *) Change mod_cern_meta to be configurable on a per-directory basis.
-     [David J. MacKenzie]
-
-  *) Add 'Include' directive to allow inclusion of configuration
-     files within configuration files. [Randy Terbush]
-
-  *) Proxy errors on connect() are logged to the error_log (nothing
-     new); now they include the IP address and port that failed
-     (*that's* new).   [Ken Coar, Marc Slemko] PR#352
-
-  *) Various architectures now define USE_MMAP_FILES which causes
-     the server to use mmap() for static files.  There are two
-     compile-time tunables MMAP_THRESHOLD (minimum number of bytes
-     required to use mmap(), default is 0), and MMAP_SEGMENT_SIZE (maximum
-     number of bytes written in one cycle from a single mmap()d object,
-     default 32768).  [Dean Gaudet]
-
-  *) API: Added post_read_request API phase which is run right after reading
-     the request from a client, or right after an internal redirect.  It is
-     useful for modules setting environment variables that depend only on
-     the headers/contents of the request.  It does not run during subrequests
-     because subrequests inherit pretty much everything from the main
-     request. [Dean Gaudet]
-
-  *) Added mod_unique_id which is used to generate a unique identifier for
-     each hit, available in the environment variable UNIQUE_ID.
-     [Dean Gaudet]
-
-  *) init_modules is now called after the error logs have been opened.  This
-     allows modules to emit information messages into the error logs.
-     [Dean Gaudet]
-
-  *) Fixed proxy-pass-through feature of mod_rewrite; Added error logging
-     information for case where proxy module is not available. [Marc Slemko]
-
-  *) PORT: Apache has need for mutexes to serialize its children around
-     accept.  In prior versions either fcntl file locking or flock file
-     locking were used.  The method is chosen by the definition of
-     USE_xxx_SERIALIZED_ACCEPT in conf.h.  xxx is FCNTL for fcntl(),
-     and FLOCK for flock().  New options have been added:
-        - SYSVSEM to use System V style semaphores
-        - PTHREAD to use POSIX threads (appears to work on Solaris only)
-        - USLOCK to use IRIX uslock
-     Based on timing various techniques, the following changes were made
-     to the defaults:
-        - Linux 2.x uses flock instead of fcntl
-        - Solaris 2.x uses pthreads
-        - IRIX uses SysV semaphores -- however multiprocessor IRIX boxes
-          work far faster if you -DUSE_USLOCK_SERIALIZED_ACCEPT
-     [Dean Gaudet, Pierre-Yves Kerembellec <Pierre-Yves.Kerembellec@vtcom.fr>,
-     Martijn Koster <m.koster@pobox.com>]
-
-  *) PORT: The semantics of accept/select make it very desirable to use
-     mutexes to serialize accept when multiple Listens are in use.  But
-     in the case where only a single socket is open it is sometimes
-     redundant to serialize accept().  Not all unixes do a good job with
-     potentially dozens of children blocked on accept() on the same
-     socket.  It's now possible to define SINGLE_LISTEN_UNSERIALIZED_ACCEPT and
-     the server will avoid serialization when listening on only one socket,
-     and use serialization when listening on multiple sockets.
-     [Dean Gaudet] PR#467
-
-  *) Configure changes: TestLib replaced by TestCompile, which has
-     some additional capability (such as doing a sanity check of
-     the compiler and flags selected); the version of Solaris is now
-     available via the #define value of SOLARIS2; IRIX n32bit libs
-     now supported and selectable by new Configuration Rule: IRIXN32;
-     We no longer default to -O2 optimization.  [Jim Jagielski]
-
-  *) Updated Configure: Configuration now uses AddModule to specify
-     module source or binary file location, relative to src directory.
-     Modules can be dropped into modules/extra, or in their own 
-     directory, and modules can come with a Makefile or Configure can 
-     create one.  Modules can add compiler or library information to 
-     generated Makefiles. [Paul Sutton]
-
-  *) Source core re-organisation: distributed modules are now in 
-     modules/standard. All other source code is in main. OS-specific
-     code is in os/{unix,emx,win32} directories. [Paul Sutton]
-
-  *) mod_browser has been removed, since it's replaced by mod_setenvif.
-     [Ken Coar]
-
-  *) Fix another long-standing bug in sub_req_lookup_file where it would
-     happily skip past access checks on subdirectories looked up with
-     relative paths.  (It's used by mod_dir, mod_negotiation,
-     and mod_include.) [Dean Gaudet]
-
-  *) directory_walk optimization to reduce an O(N*M) loop to O(N+M) where
-     N is the number of <Directory> sections, and M is the number of
-     components in the filename of an object.
-
-     To achieve this optimization the following config changes were made:
-        - Wildcards (* and ?, not the regex forms) in <Directory>s,
-          <Files>s, and <Location>s now treat a slash as a special
-          character.  For example "/home/*/public_html" previously would
-          match "/home/a/andrew/public_html", now it only matches things
-          like "/home/bob/public_html".  This mimics /bin/sh behaviour.
-        - It's possible now to use [] wildcarding in <Directory>, <Files>
-          or <Location>.
-        - Regex <Directory>s are applied after all non-regex <Directory>s.
-
-    [Dean Gaudet]
-
-  *) Fix a bug introduced in 1.3a1 directory_walk regarding .htaccess files
-     and corrupted paths.  [Dean Gaudet]
-
-  *) Enhanced and cleaned up the URL rewriting engine of mod_rewrite:
-     First the grouped parts of RewriteRule pattern matches (parenthesis!) can
-     be accessed now via backreferences $1..$9 in RewriteConds test-against
-     strings in addition to RewriteRules subst string. Second the grouped
-     parts of RewriteCond pattern matches (parenthesis!) can be accessed now
-     via backreferences %1..%9 both in following RewriteCond test-against
-     strings and RewriteRules subst string. This provides maximum flexibility
-     through the use of backreferences.
-     Additionally the rewriting engine was cleaned up by putting common
-     code to the new expand_backrefs_inbuffer() function. 
-     [Ralf S. Engelschall]
-
-  *) When merging the main server's <Directory> and <Location> sections into
-     a vhost, put the main server's first and the vhost's second.  Otherwise
-     the vhost can't override the main server.  [Dean Gaudet] PR#717
-
-  *) The <Directory> code would merge and re-merge the same section after
-     a match was found, possibly causing problems with some modules.
-     [Dean Gaudet]
-
-  *) ip-based vhosts are stored and queried using a hashing function, which
-     has been shown to improve performance on servers with many ip-vhosts.
-     Some other changes had to be made to accommodate this:
-        - the * address for vhosts now behaves like _default_
-        - the matching process now is:
-            - match an ip-vhost directly via hash (possibly matches main
-              server)
-            - if that fails, just pretend it matched the main server
-            - if so far only the main server has been matched, perform
-              name-based lookups (ServerName, ServerAlias, ServerPath)
-              *only on name-based vhosts*
-            - if they fail, look for _default_ vhosts
-     [Dean Gaudet, Dave Hankins <dhankins@sugarat.net>]
-
-  *) dbmmanage overhaul:
-     - merge dbmmanage and dbmmanage.new functionality, remove dbmmanage.new 
-     - tie() to AnyDBM_File which will use one of DB_File, NDBM_File or
-       GDBM_File (-ldb, -lndbm, -lgdbm) (trying each in that order)
-     - provide better seed for rand
-     - prompt for password as per getpass(3) (turn off echo, read from
-       /dev/tty, etc.)
-     - use "newstyle" crypt based on $Config{osname} ($^O)
-     - will not add a user if already in database, use new `update' command
-       instead
-     - added `check' command to check a users' password
-     - added `import' command to convert existing password text-files or 
-       dbm files exported with `view'
-     - more descriptive usage, general cleanup, 'use strict' clean, etc.
-     [Doug MacEachern]
-
-  *) Added psocket() which is a pool form of socket(), various places within
-     the proxy weren't properly blocking alarms while registering the cleanup
-     for its sockets.  bclose() now uses pclose() and pclosesocket().  There
-     was a bug where the client socket was being close()d twice due a still
-     registered cleanup.  [Dean Gaudet]
-
-  *) A few cleanups were made to reduce time(), getpid(), and signal() calls.
-     [Dean Gaudet]
-
-  *) PORT: AIX >= 4.2 requires -lm due to libc changes.
-     [Jason Venner <jason@idiom.com>] PR#667
-
-  *) Enable ``=""'' for RewriteCond directives to match against
-     the empty string. This is the preferred way instead of ``^$''.
-     [Ralf S. Engelschall]
-
-  *) Fixed an infinite loop in mod_imap for references above the server root
-     [Dean Gaudet] PR#748
-
-  *) mod_proxy now has a ReceiveBufferSize directive, similar to
-     SendBufferSize, so that the TCP window can be set appropriately
-     for LFNs. [Phillip A. Prindeville]
-
-  *) mod_browser has been replaced by the more general mod_setenvif
-     (courtesy of Paul Sutton).  BrowserMatch* directives are still
-     available, but are now joined by SetEnvIf*, UnSetEnvIf*, and
-     UnSetEnvIfZero directives.  [Ken Coar]
-
-  *) "HostnameLookups double" forces double-reverse DNS to succeed in
-     order for remote_host to be set (for logging, or for the env var
-     REMOTE_HOST).  The old define MAXIMUM_DNS has been deprecated.
-     [Dean Gaudet]
-
-  *) mod_access overhaul:
-     - Now understands network/netmask syntax (i.e.  10.1.0.0/255.255.0.0)
-       and cidr syntax (i.e. 10.1.0.0/16).  PR#762
-     - Critical path was sped up by pre-computing a few things at config time.
-     - The undocumented syntax "allow user-agents" was removed,
-       the replacement is "allow from env=foobar" combined with mod_browser.
-     - When used with hostnames it now forces a double-reverse lookup
-       no matter what the directory settings are.  This double-reverse
-       doesn't affect any of the other routines that use the remote
-       hostname.  In particular it's still passed to CGIs and the log
-       without the double-reverse check.  Related PR#860.
-     [Dean Gaudet]
-
-  *) When a large bwrite() occurs (larger than the internal buffer size),
-     while there is already something in the buffer, apache will combine
-     the large write and the buffer into a single writev().  (This is
-     in anticipation of using mmap() for reading files.)
-     [Dean Gaudet]
-
-  *) In obscure cases where a partial socket write occurred while chunking,
-     Apache would omit the chunk header/footer on the next block.  Cleaned
-     up other bugs/inconsistencies in error conditions in buff.c.  Fixed
-     a bug where a long pause in DNS lookups could cause the last packet
-     of a response to be unduly delayed.  [Roy Fielding, Dean Gaudet]
-
-  *) API: Added child_exit function to module structure.  This is called
-     once per "heavy-weight process" just before a server child exit()'s 
-     e.g. when max_requests_per_child is reached, etc.
-     [Doug MacEachern, Dean Gaudet]
-
-  *) mod_include cleanup showed that handle_else was being used to handle
-     endif.  It didn't cause problems, but it was cleaned up too.
-     [Howard Fear]
-
-  *) mod_cern_meta would attempt to find meta files for the directory itself
-     in some cases, but not in others.  It now avoids it in all cases.
-     [Dean Gaudet]
-
-  *) mod_mime_magic would core dump if there was a decompression error.
-     [Martin Kraemer <Martin.Kraemer@mch.sni.de>] PR#904
-
-  *) PORT: some variants of DGUX require -lsocket -lnsl
-     [Alexander L Jones <alex@systems-options.co.uk>] PR#732
-
-  *) mod_autoindex now allows sorting of FancyIndexed directory listings
-     by the various fields (name, size, et cetera), either in ascending
-     or descending order.  Just click on the column header.  [Ken Coar]
-
-  *) PORT: Various tweaks to eliminate pointer-int casting warnings on 64-bit
-     CPUs like the Alpha.  Apache still stores ints in pointers, but that's
-     the relatively safe direction.  [Dean Gaudet] PR#344
-
-  *) PORT: QNX mmap() support for faster/more reliable scoreboard handling.
-     [Igor N Kovalenko <infoh@mail.wplus.net>] PR#683
-
-  *) child_main avoids an unneeded call to select() when there is only one
-     listening socket.  [Dean Gaudet]
-
-  *) In the event that the server is starved for idle servers it will
-     spawn 1, then 2, then 4, ..., then 32 servers each second,
-     doubling each second.  It'll also give a warning in the errorlog
-     since the most common reason for this is a poor StartServers
-     setting.  The define MAX_SPAWN_RATE can be used to raise/lower
-     the maximum.  [Dean Gaudet]
-
-  *) Apache now provides an effectively unbuffered connection for
-     CGI scripts.  This means that data will be sent to the client
-     as soon as the CGI pauses or stops output; previously, Apache would
-     buffer the output up to a fixed buffer size before sending, which
-     could result in the user viewing an empty page until the CGI finished
-     or output a complete buffer.  It is no longer necessary to use an
-     "nph-" CGI to get unbuffered output.  Given that most CGIs are written
-     in a language that by default does buffering (e.g. perl) this
-     shouldn't have a detrimental effect on performance.
-
-     "nph-" CGIs, which formerly provided a direct socket to the client
-     without any server post-processing, were not fully compatible with
-     HTTP/1.1 or SSL support.  As such they would have had to implement
-     the transport details, such as encryption or chunking, in order
-     to work properly in certain situations.  Now, the only difference
-     between nph and non-nph scripts is "non-parsed headers".
-     [Dean Gaudet, Sameer Parekh, Roy Fielding]
-
-  *) If a BUFF is switched from buffered to unbuffered reading the first
-     bread() will return whatever remained in the buffer prior to the
-     switch. [Dean Gaudet]
-
-Changes with Apache 1.3a1
-
-  *) Added another Configure helper script: TestLib. It determines
-     if a specified library exists.  [Jim Jagielski]
-
-  *) PORT: Allow for use of n32bit libraries under IRIX 6.x
-     [derived from patch from Jeff Hayes <jhayes@aw.sgi.com>]
-     PR#721
-
-  *) PORT: Some architectures use size_t for various lengths in network
-     functions such as accept(), and getsockname().  The definition
-     NET_SIZE_T is used to control this. [Dean Gaudet]
-
-  *) PORT: Linux: Attempt to detect glibc based systems and include crypt.h
-     and -lcrypt.  Test for various db libraries (dbm, ndbm, db) when
-     mod_auth_dbm or mod_auth_db are included.  [Dean Gaudet]
-
-  *) PORT: QNX doesn't have initgroups() which support/suexec.c uses.
-     [Igor N Kovalenko <infoh@mail.wplus.net>]
-
-  *) "force-response-1.0" now only applies to requests which are HTTP/1.0 to
-     begin with.  "nokeepalive" now works for HTTP/1.1 clients.  Added
-     "downgrade-1.0" which causes Apache to pretend it received a 1.0.
-     [Dean Gaudet] related PR#875
-
-  *) API: Correct child_init() slot declaration from int to void, to
-     match the init() declaration.  Update mod_example to use the new
-     hook.  [Ken Coar]
-
-  *) added transport handle slot (t_handle) to the BUFF structure
-     [Doug MacEachern]
-
-  *) get_client_block() returns wrong length if policy is
-     REQUEST_CHUNKED_DECHUNK.
-     [Kenichi Hori <ken@d2.bs1.fc.nec.co.jp>] PR#815
-
-  *) Support the image map format of FrontPage.  For example:
-        rect /url.hrm 10 20 30 40
-     ["Chris O'Byrne" <obyrne@iol.ie>] PR#807
-
-  *) PORT: -lresolv and -lsocks were in the wrong order for Solaris.
-     ["Darren O'Shaughnessy" <darren@aaii.oz.au>] PR#846
-
-  *) AddModuleInfo directive for mod_info which allows you to annotate
-     the output of mod_info.  ["Lou D. Langholtz" <ldl@usi.utah.edu>]
-
-  *) Added NoProxy directive to avoid using ProxyRemote for selected
-     addresses.  Added ProxyDomain directive to cause unqualified
-     names to be qualified by redirection.
-     [Martin Kraemer <Martin.Kraemer@mch.sni.de>]
-
-  *) Support Proxy Authentication, and don't pass the Proxy-Authorize
-     header to the remote host in the proxy. [Sameer Parekh and
-     Wallace]
-
-  *) Upgraded mod_rewrite from 3.0.6+ to latest officially available version
-     3.0.9. This upgrade includes: fixed deadlooping on rewriting to same
-     URLs, fixed rewritelog(), fixed forced response code handling on
-     redirects from within .htaccess files, disabled pipe locking under
-     braindead SunOS 4.1.x, allow env variables to be set even on rules with
-     no substitution, bugfixed situations where HostnameLookups is off, made
-     mod_rewrite more thread-safe for NT port and fixed problem when creating
-     an empty query string via "xxx?".
-         This update also removes the copyright of Ralf S. Engelschall,
-     i.e. now mod_rewrite no longer has a shared copyright. Instead is is
-     exclusively copyrighted by the Apache Group now. This happened because
-     the author now has gifted mod_rewrite exclusively to the Apache Group and 
-     no longer maintains an external version.
-     [Ralf S. Engelschall]
-
-  *) API: Added child_init function to module structure.  This is called
-     once per "heavy-weight process" before any requests are handled.
-     See http_config.h for more details.  [Dean Gaudet]
-
-  *) Anonymous_LogEmail was logging on each subrequest.
-     [Dean Gaudet] PR#421, 868
-
-  *) API: Added is_initial_req() which tests if the request being
-     processed is the initial request, or a subrequest.
-     [Doug MacEachern]
-
-  *) Extended SSI (mod_include) now handles additional relops for
-     string comparisons (<, >, <=, and >=).  [Bruno Wolff III] PR#41
-
-  *) Configure fixed to correctly propagate user-selected options and
-     settings (such as CC and OPTIM) to Makefiles other than
-     src/Makefile (notably support/Makefile).  [Ken Coar] PR#666, #834
-
-  *) IndexOptions SuppressHTMLPreamble now causes the actual HTML of
-     directory indices to start with the contents of the HeaderName file
-     if there is one.  If there isn't one, the behaviour is unchanged.
-     [Ken Coar, Roy Fielding, Andrey A. Chernov]
-
-  *) WIN32: Modules can now be dynamically loaded DLLs using the
-     LoadModule/LoadFile directives. Note that module DLLs must be
-     compiled with the multithreaded DLL version of the runtime library.
-     [Alexei Kosut and Ben Laurie]
-
-  *) Automatic indexing removed from mod_dir and placed into mod_autoindex.
-     This allows the admin to completely remove automatic indexing
-     from the server, while still supporting the basic functions of
-     trailing-slash redirects and DirectoryIndex files.  Note that if
-     you're carrying over an old Configuration file and you use directory
-     indexing then you'll want to add:
-
-     Module autoindex_module    mod_autoindex.o
-
-     before mod_dir in your Configuration.  [Dean Gaudet]
-
-  *) popendir/pclosedir created to properly protect directory scanning.
-     [Dean Gaudet] PR#525
-
-  *) AliasMatch, ScriptAliasMatch and RedirectMatch directives added,
-     giving regex support to mod_alias. <DirectoryMatch>, <LocationMatch>
-     and <FilesMatch> sections added to succeed <DirectoryMatch ~>, etc...
-     [Alexei Kosut]
-
-  *) The AccessFileName directive can now take more than one filename.
-     ["Lou D. Langholtz" <ldl@usi.utah.edu>]
-
-  *) The new mod_mime_magic can be used to "magically" determine the type
-     of a file if the extension is unknown.  Based on the unix file(1)
-     command.  [Ian Kluft <ikluft@cisco.com>]
-
-  *) We now determine and display the time spent processing a
-     request if desired.  [Jim Jagielski]
-
-  *) mod_status: PID field of "dead" child slots no longer displays
-     main httpd process's PID.  [Jim Jagielski]
-
-  *) Makefile.nt added - to build all the bits from the command line:
-        nmake -f Makefile.nt
-         Doesn't yet work properly. [Ben Laurie]
-
-  *) Default text of 404 error is now "Not Found" rather than the
-     potentially misleading "File Not Found".  [Ken Coar]
-
-  *) CONFIG: "HostnameLookups" now defaults to off because it is far better
-     for the net if we require people that actually need this data to
-     enable it.  [Linus Torvalds]
-
-  *) directory_walk() is an expensive function, keep a little more state to
-     avoid needless string counting.  Add two new functions make_dirstr_parent
-     and make_dirstr_prefix which replace all existing uses of make_dirstr.
-     The new functions are a little less general than make_dirstr, but
-     work more efficiently (less memory, less string counting).
-     [Dean Gaudet]
-
-  *) EXTRA_LFLAGS was changed to EXTRA_LDFLAGS (and LFLAGS was changed
-     to LDFLAGS) to avoid complications with lex rules in make files.
-     [Dean Gaudet] PR#372
-
-  *) run_method optimized to avoid needless scanning over NULLs in the
-     module list.  [Dean Gaudet]
-
-  *) Revamp of (unix) scoreboard management code such that it avoids
-     unnecessary traversals of the scoreboard on each hit.  This is
-     particularly important for high volume sites with a large
-     HARD_SERVER_LIMIT.  Some of the previous operations were O(n^2),
-     and are now O(n).  See also SCOREBOARD_MAINTENANCE_INTERVAL in
-     httpd.h. [Dean Gaudet]
-
-  *) In configurations using multiple Listen statements it was possible for
-     busy sockets to starve other sockets of service.  [Dean Gaudet]
-
-  *) Added hook so standalone_main can be replaced at compile time
-     (define STANDALONE_MAIN)
-     [Doug MacEachern]
-
-  *) Lowest-level read/write functions in buff.c will be replaced with
-     the SFIO library calls sfread/sfwrite if B_SFIO is defined at
-     compile time.  The default sfio discipline will behave as apache
-     would without sfio compiled in.
-     [Doug MacEachern]
-
-  *) Enhance UserDir directive (mod_userdir) to accept a list of
-     usernames for the 'disable' keyword, and add 'enable user...' to
-     selectively *en*able userdirs if they're globally disabled.
-     [Ken Coar]
-
-  *) If NETSCAPE_DBM_COMPAT is defined in EXTRA_CFLAGS then Apache
-     will work with Netscape dbm files.  (dbmmanage will probably not
-     work however.) [Alexander Spohr <aspohr@netmatic.com>] PR#444
-
-  *) Add a ListenBacklog directive to control the backlog parameter
-     passed to listen().  Also change the default to 511 from 512.
-     [Marc Slemko]
-
-  *) API: A new handler response DONE which informs apache that the
-     request has been handled and it can finish off quickly, similar to
-     how it handles errors. [Rob Hartill]
-
-  *) Turn off chunked encoding after sending terminating chunk/footer
-     so that we can't do it twice by accident. [Roy Fielding]
-
-  *) mod_expire also issues Cache-Control: max-age headers.
-     [Rob Hartill]
-
-  *) API: Added kill_only_once option for free_proc_chain so that it won't
-     aggressively try to kill off specific children.  For fastcgi.
-     [Stanley Gambarin <gambarin@OpenMarket.com>]
-
-  *) mod_auth deals with extra ':' delimited fields.  [Marc Slemko]
-
-  *) Added IconHeight and IconWidth to mod_dir's IndexOptions directive.
-     When used together, these cause mod_dir to emit HEIGHT and WIDTH
-     attributes in the FancyIndexing IMG tags.  [Ken Coar]
-
-  *) PORT: Sequent and SONY NEWS-OS support added.  [Jim Jagielski]
-
-  *) PORT: Added Windows NT support
-     [Ben Laurie and Ambarish Malpani <ambarish@valicert.com>]
-
-Changes with Apache 1.2.6
-
-  *) mod_include when using XBitHack Full would send ETags in addition to
-     sending Last-Modifieds.  This is incorrect HTTP/1.1 behaviour.
-     [Dean Gaudet] PR#1133
-
-  *) SECURITY: When a client connects to a particular port/addr, and
-     gives a Host: header ensure that the virtual host requested can
-     actually be reached via that port/addr.  [Ed Korthof <ed@organic.com>]
-
-  *) Support virtual hosts with wildcard port and/or multiple ports
-     properly.  [Ed Korthof <ed@organic.com>]
-
-  *) Fixed some case-sensitivity issues according to RFC2068.
-     [Dean Gaudet]
-
-  *) Set r->allowed properly in mod_asis.c, mod_dir.c, mod_info.c,
-     and mod_include.c.  [Dean Gaudet]
-
-  *) Variable 'cwd' was being used pointlessly before being set.
-     [Ken Coar] PR#1738
-
-  *) SIGURG doesn't exist on all platforms.
-     [Mark Andrew Heinrich <heinrich@tinderbox.Stanford.EDU>]
-
-  *) When an error occurs during a POST, or other operation with a
-     request body, the body has to be read from the net before allowing
-     a keepalive session to continue.  [Roy Fielding] PR#1399
-
-  *) When an error occurs in fcntl() locking suggest the user look up
-     the docs for LockFile.  [Dean Gaudet]
-
-  *) table_set() and table_unset() did not deal correctly with
-     multiple occurrences of the same key. [Stephen Scheck
-     <sscheck@infonex.net>, Ben Laurie] PR#1604
-
-  *) send_fd_length() did not calculate total_bytes_sent properly in error
-     cases.  [Ben Reser <breser@regnow.com>] PR#1366
-
-  *) r->connection->user was allocated in the wrong pool causing corruption
-     in some cases when used with mod_cern_meta.  [Dean Gaudet] PR#1500
-
-  *) mod_proxy was sending HTTP/1.1 responses to ftp requests by mistake.
-     Also removed the auto-generated link to www.apache.org that was the
-     source of so many misdirected bug reports.  [Roy Fielding, Marc Slemko]
-
-  *) Multiple "close" tokens may have been set in the "Connection"
-     header, not an error, but a waste.
-     [Ronald.Tschalaer@psi.ch] PR#1683
-
-  *) "basic" and "digest" auth tokens should be tested case-insensitive.
-     [Ronald.Tschalaer@psi.ch] PR#1599, PR#1666
-
-  *) It appears the "257th byte" bug (see
-     htdocs/manual/misc/known_client_problems.html#257th-byte) can happen
-     at the 256th byte as well.  Fixed.  [Dean Gaudet]
-
-  *) mod_rewrite would not handle %3f properly in some situations.
-     [Ralf Engelschall]
-
-  *) Apache could generate improperly chunked HTTP/1.1 responses when
-     the bputc() or rputc() functions were used by modules (such as
-     mod_include).  [Dean Gaudet]
-
-  *) #ifdef wrap a few #defines in httpd.h to make life easier on
-     some ports.  [Ralf Engelschall]
-
-  *) Fix MPE compilation error in mod_usertrack.c.  [Mark Bixby]
-
-  *) Quote CC='$(CC)' to improve recurse make calls.  [Martin Kraemer]
-
-  *) Avoid B_ERROR redeclaration on sysvr4 systems.  [Martin Kraemer]
-
-Changes with Apache 1.2.5
-
-  *) SECURITY: Fix a possible buffer overflow in logresolve.  This is
-     only an issue on systems without a MAXDNAME define or where 
-     the resolver returns domain names longer than MAXDNAME.  [Marc Slemko]
-
-  *) Fix an improper length in an ap_snprintf call in proxy_date_canon().
-     [Marc Slemko]
-
-  *) Fix core dump in the ftp proxy when reading incorrectly formatted
-     directory listings.  [Marc Slemko]
-
-  *) SECURITY: Fix possible minor buffer overflow in the proxy cache.
-     [Marc Slemko]
-
-  *) SECURITY: Eliminate possible buffer overflow in cfg_getline, which
-     is used to read various types of files such as htaccess and 
-     htpasswd files.  [Marc Slemko]
-
-  *) SECURITY: Ensure that the buffer returned by ht_time is always
-     properly null terminated.  [Marc Slemko]
-
-  *) SECURITY: General mod_include cleanup, including fixing several
-     possible buffer overflows and a possible infinite loop.  This cleanup
-     was done against 1.3 code and then backported to 1.2, the result
-     is a large difference (due to indentation cleanup in 1.3 code).
-     Users interested in seeing a smaller set of relevant differences
-     should consider comparing against src/modules/standard/mod_include.c
-     from the 1.3b3 release.  Non-indentation changes to mod_include
-     between 1.2 and 1.3 were minimal.  [Dean Gaudet, Marc Slemko]
-
-  *) SECURITY: Numerous changes to mod_imap in a general cleanup
-     including fixing a possible buffer overflow.  This cleanup also
-     was done with 1.3 code as a basis, see the the previous note
-     about mod_include.  [Dean Gaudet]
-
-  *) SECURITY: If a htaccess file can not be read due to bad 
-     permissions, deny access to the directory with a HTTP_FORBIDDEN.  
-     The previous behavior was to ignore the htaccess file if it could not
-     be read.  This change may make some setups with unreadable
-     htaccess files stop working.  PR#817  [Marc Slemko]
-
-  *) SECURITY: no2slash() was O(n^2) in the length of the input.  
-     Make it O(n).  This inefficiency could be used to mount a denial 
-     of service attack against the Apache server.  Thanks to 
-     Michal Zalewski <lcamtuf@boss.staszic.waw.pl> for reporting
-     this.  [Dean Gaudet]
-
-  *) mod_include used uninitialized data for some uses of && and ||.
-     [Brian Slesinsky <bslesins@wired.com>] PR#1139
-
-  *) mod_imap should decline all non-GET methods.
-     [Jay Bloodworth <jay@pathways.sde.state.sc.us>]
-
-  *) suexec.c wouldn't build without -DLOG_EXEC. [Jason A. Dour]
-
-  *) mod_userdir was modifying r->finfo in cases where it wasn't setting
-     r->filename.  Since those two are meant to be in sync with each other
-     this is a bug.  ["Paul B. Henson" <henson@intranet.csupomona.edu>]
-
-  *) mod_include did not properly handle all possible redirects from sub-
-     requests.  [Ken Coar]
-
-  *) Inetd mode (which is buggy) uses timeouts without having setup the
-     jmpbuffer. [Dean Gaudet] PR#1064
-
-  *) Work around problem under Linux where a child will start looping
-     reporting a select error over and over.
-     [Rick Franchuk <rickf@transpect.net>] PR#1107
-
-Changes with Apache 1.2.4
-
-  *) The ProxyRemote change in 1.2.3 introduced a bug resulting in the proxy
-     always making requests with the full-URI instead of just the URI path.
-     [Marc Slemko, Roy Fielding]
-
-  *) Add -lm for AIX versions >= 4.2 to allow Apache to link properly
-     on this platform.  [Marc Slemko]
-
-Changes with Apache 1.2.3
-
-  *) The request to a remote proxy was mangled if it was generated as the
-     result of a ProxyPass directive. URL schemes other than http:// were not
-     supported when ProxyRemote was used. PR#260, PR#656, PR#699, PR#713,
-     PR#812 [Lars Eilebrecht]
-
-  *) Fixed proxy-pass-through feature of mod_rewrite; Added error logging
-     information for case where proxy module is not available. [Marc Slemko]
-
-  *) Force proxy to always respond as HTTP/1.0, which it was failing to
-     do for errors and cached responses.  [Roy Fielding]
-
-  *) PORT: Improved support for ConvexOS 11.  [Jeff Venters]
-
-Changes with Apache 1.2.2 [not released]
-
-  *) Fixed another long-standing bug in sub_req_lookup_file where it would
-     happily skip past access checks on subdirectories looked up with relative
-     paths.  (It's used by mod_dir, mod_negotiation, and mod_include.)
-     [Dean Gaudet]
-
-  *) Add lockfile name to error message printed out when
-     USE_FLOCK_SERIALIZED_ACCEPT is defined.
-     [Marc Slemko]
-
-  *) Enhanced the chunking and error handling inside the buffer functions.
-     [Dean Gaudet, Roy Fielding]
-
-  *) When merging the main server's <Directory> and <Location> sections into
-     a vhost, put the main server's first and the vhost's second.  Otherwise
-     the vhost can't override the main server.  [Dean Gaudet] PR#717
-
-  *) The <Directory> code would merge and re-merge the same section after
-     a match was found, possibly causing problems with some modules.
-     [Dean Gaudet]
-
-  *) Fixed an infinite loop in mod_imap for references above the server root.
-     [Dean Gaudet] PR#748
-
-  *) mod_include cleanup showed that handle_else was being used to handle
-     endif.  It didn't cause problems, but it was cleaned up too.
-     [Howard Fear]
-
-  *) Last official synchronization of mod_rewrite with author version (because
-     mod_rewrite is now directly developed by the author at the Apache Group):
-     o added diff between mod_rewrite 3.0.6+ and 3.0.9
-       minus WIN32/NT stuff, but plus copyright removement.
-       In detail:
-       - workaround for detecting infinite rewriting loops
-       - fixed setting of env vars when "-" is used as subst string
-       - fixed forced response code on redirects (PR#777)
-       - fixed cases where r->args is ""
-       - kludge to disable locking on pipes under braindead SunOS
-       - fix for rewritelog in cases where remote hostname is unknown
-       - fixed totally damaged request_rec walk-back loop
-     o remove static from local data and add static to global ones.
-     o replaced ugly proxy finding stuff by simple
-       find_linked_module("mod_proxy") call.
-     o added missing negation char on rewritelog()
-     o fixed a few comment typos
-     [Ralf S. Engelschall]
-
-  *) Anonymous_LogEmail was logging on each subrequest.
-     [Dean Gaudet] PR#421, PR#868
-
-  *) "force-response-1.0" now only applies to requests which are HTTP/1.0 to
-     begin with.  "nokeepalive" now works for HTTP/1.1 clients.  Added
-     "downgrade-1.0" which causes Apache to pretend it received a 1.0.
-     Additionally mod_browser now triggers during translate_name to workaround
-     a deficiency in the header_parse phase.
-     [Dean Gaudet] PR#875
-
-  *) get_client_block() returns wrong length if policy is 
-     REQUEST_CHUNKED_DECHUNK.
-     [Kenichi Hori <ken@d2.bs1.fc.nec.co.jp>] PR#815
-
-  *) Properly treat <files> container like other containers in mod_info.
-     [Marc Slemko] PR#848
-
-  *) The proxy didn't treat the "Host:" keyword of the host header as case-
-     insensitive.  The proxy would corrupt the first line of a response from
-     an HTTP/0.9 server.  [Kenichi Hori <ken@d2.bs1.fc.nec.co.jp>] PR#813,814
-
-  *) mod_include would log some bogus values occasionally.
-     [Skip Montanaro <skip@calendar.com>, Marc Slemko] PR#797
-
-  *) PORT: The slack fd changes in 1.2.1 introduced a problem with SIGHUP
-     under Solaris 2.x (up through 2.5.1).  It has been fixed.
-     [Dean Gaudet] PR#832
-
-  *) API: In HTTP/1.1, whether or not a request message contains a body
-     is independent of the request method and based solely on the presence
-     of a Content-Length or Transfer-Encoding.  Therefore, our default
-     handlers need to be prepared to read a body even if they don't know
-     what to do with it; otherwise, the body would be mistaken for the
-     next request on a persistent connection.  discard_request_body()
-     has been added to take care of that.  [Roy Fielding] PR#378
-
-  *) API: Symbol APACHE_RELEASE provides a numeric form of the Apache
-     release version number, such that it always increases along the
-     same lines as our source code branching.  [Roy Fielding]
-
-  *) Minor oversight on multiple variants fixed.  [Paul Sutton] PR#94
-
-Changes with Apache 1.2.1
-
-  *) SECURITY: Don't serve file system objects unless they are plain files,
-     symlinks, or directories.  This prevents local users from using pipes
-     or named sockets to invoke programs for an extremely crude form of
-     CGI.  [Dean Gaudet]
-
-  *) SECURITY: HeaderName and ReadmeName were settable in .htaccess and
-     could contain "../" allowing a local user to "publish" any file on
-     the system.  No slashes are allowed now.  [Dean Gaudet]
-
-  *) SECURITY: It was possible to violate the symlink Options using mod_dir
-     (headers, readmes, titles), mod_negotiation (type maps), or
-     mod_cern_meta (meta files).  [Dean Gaudet]
-
-  *) SECURITY: Apache will refuse to run as "User root" unless
-     BIG_SECURITY_HOLE is defined at compile time.  [Dean Gaudet]
-
-  *) CONFIG: If a symlink pointed to a directory then it would be disallowed
-     if it contained a .htaccess disallowing symlinks.  This is contrary
-     to the rule that symlink permissions are tested with the symlink
-     options of the parent directory.  [Dean Gaudet] PR#353
-
-  *) CONFIG: The LockFile directive can be used to place the serializing
-     lockfile in any location.  It previously defaulted to /usr/tmp/htlock.
-     [Somehow it took four of us: Randy Terbush, Jim Jagielski, Dean Gaudet,
-     Marc Slemko]
-
-  *) Request processing now retains state of whether or not the request
-     body has been read, so that internal redirects and subrequests will
-     not try to read it twice (and block). [Roy Fielding]
-
-  *) Add a placeholder in modules/Makefile to avoid errors with certain
-     makes. [Marc Slemko]
-
-  *) QUERY_STRING was unescaped in mod_include, it shouldn't be.
-     [Dean Gaudet] PR#644
-
-  *) mod_include was not properly changing the current directory.
-     [Marc Slemko] PR#742
-
-  *) Attempt to work around problems with third party libraries that do not
-     handle high numbered descriptors (examples include bind, and
-     solaris libc).  On all systems apache attempts to keep all permanent
-     descriptors above 15 (called the low slack line).  Solaris users
-     can also benefit from adding -DHIGH_SLACK_LINE=256 to EXTRA_CFLAGS
-     which keeps all non-FILE * descriptors above 255.  On all systems
-     this should make supporting large numbers of vhosts with many open
-     log files more feasible.  If this causes trouble please report it,
-     you can disable this workaround by adding -DNO_SLACK to EXTRA_CFLAGS.
-     [Dean Gaudet] various PRs
-
-  *) Related to the last entry, network sockets are now opened before
-     log files are opened.  The only known case where this can cause
-     problems is under Solaris with many virtualhosts and many Listen
-     directives.  But using -DHIGH_SLACK_LINE=256 described above will
-     work around this problem.  [Dean Gaudet]
-
-  *) USE_FLOCK_SERIALIZED_ACCEPT is now default for FreeBSD, A/UX, and
-     SunOS 4.
-
-  *) Improved unix error response logging.  [Marc Slemko]
-
-  *) Update mod_rewrite from 3.0.5 to 3.0.6.  New ruleflag
-     QSA=query_string_append.  Also fixed a nasty bug in per-dir context:
-     when a URL http://... was used in conjunction with a special
-     redirect flag, e.g. R=permanent, the permanent status was lost.
-     [Ronald Tschalaer <Ronald.Tschalaer@psi.ch>, Ralf S. Engelschall]
-
-  *) If an object has multiple variants that are otherwise equal Apache
-     would prefer the last listed variant rather than the first.
-     [Paul Sutton] PR#94
-
-  *) "make clean" at the top level now removes *.o.  [Dean Gaudet] PR#752
-
-  *) mod_status dumps core in inetd mode.  [Marc Slemko and Roy Fielding]
-     PR#566
-
-  *) pregsub had an off-by-1 in its error checking code. [Alexei Kosut]
-
-  *) PORT: fix rlim_t problems with AIX 4.2. [Marc Slemko] PR#333
-
-  *) PORT: Update UnixWare support for 2.1.2.
-     [Lawrence Rosenman <ler@lerctr.org>] PR#511
-
-  *) PORT: NonStop-UX [Joachim Schmitz <schmitz_joachim@tandem.com>] PR#327
-
-  *) PORT: Update ConvexOS support for 11.5.
-     [David DeSimone <fox@convex.com>] PR#399
-
-  *) PORT: Support for DEC cc compiler under ULTRIX.
-     ["P. Alejandro Lopez-Valencia" <alejolo@ideam.gov.co>] PR#388
-
-  *) PORT: Support for Maxion/OS SVR4.2 Real Time Unix. [no name given] PR#383
-
-  *) PORT: Workaround for AIX 3.x compiler bug in http_bprintf.c.  
-     [Marc Slemko] PR#725
-
-  *) PORT: fix problem compiling http_bprintf.c with gcc under SCO
-     [Marc Slemko] PR#695
-
-Changes with Apache 1.2
-
-Changes with Apache 1.2b11
-
-  *) Fixed open timestamp fd in proxy_cache.c [Chuck Murcko]
-
-  *) Added undocumented perl SSI mechanism for -DUSE_PERL_SSI and mod_perl.
-     [Doug MacEachern, Rob Hartill]
-
-  *) Proxy needs to use hard_timeout instead of soft_timeout when it is
-     reading from one buffer and writing to another, at least until it has
-     a custom timeout handler.  [Roy Fielding and Petr Lampa]
-
-  *) Fixed problem on IRIX with servers hanging in IdentityCheck,
-     apparently due to a mismatch between sigaction and setjmp.
-     [Roy Fielding] PR#502
-
-  *) Log correct status code if we timeout before receiving a request (408)
-     or if we received a request-line that was too long to process (414).
-     [Ed Korthof and Roy Fielding] PR#601
-
-  *) Virtual hosts with the same ServerName, but on different ports, were
-     not being selected properly.  [Ed Korthof]
-
-  *) Added code to return the requested IP address from proxy_host2addr()
-     if gethostbyaddr() fails due to reverse DNS lookup problems. Original
-     change submitted by Jozsef Hollosi <hollosi@sbcm.com>.
-     [Chuck Murcko] PR#614
-
-  *) If multiple requests on a single connection are used to retrieve
-     data from different virtual hosts, the virtual host list would be
-     scanned starting with the most recently used VH instead of the first,
-     causing most virtual hosts to be ignored.
-     [Paul Sutton and Martin Mares] PR#610
-
-  *) The OS/2 handling of process group was broken by a porting patch for
-     MPE, so restored prior code for OS/2.  [Roy Fielding and Garey Smiley]
-
-  *) Inherit virtual server port from main server if none (or "*") is
-     given for VirtualHost.  [Dean Gaudet] PR#576
-
-  *) If the lookup for a DirectoryIndex name with content negotiation
-     has found matching variants, but none are acceptable, return the
-     negotiation result if there are no more DirectoryIndex names to lookup.
-     [Petr Lampa and Roy Fielding]
-
-  *) If a soft_timeout occurs after keepalive is set, then the main child
-     loop would try to read another request even though the connection
-     has been aborted.  [Roy Fielding]
-
-  *) Configure changes: Allow for whitespace at the start of a
-     Module declaration. Also, be more understanding about the
-     CC=/OPTIM= format in Configuration. Finally, fix compiler
-     flags if using HP-UX's cc compiler. [Jim Jagielski]
-
-  *) Subrequests and internal redirects now inherit the_request from the
-     original request-line. [Roy Fielding]
-
-  *) Test for error conditions before creating output header fields, since
-     we don't want the error message to include those fields.  Likewise,
-     reset the content_language(s) and content_encoding of the response
-     before generating or redirecting to an error message, since the new
-     message will have its own Content-* definitions. [Dean Gaudet]
-
-  *) Restored the semantics of headers_out (headers sent only with 200..299
-     and 304 responses) and err_headers_out (headers sent with all responses).
-     Avoid the overhead of copying tables if err_headers_out is empty
-     (the usual case).  [Roy Fielding]
-
-  *) Fixed a couple places where a check for the default Content-Type was
-     not properly checking both the value configured by the DefaultType
-     directive and the DEFAULT_TYPE symbol in httpd.h.  Changed the value
-     of DEFAULT_TYPE to match the documented default (text/plain).
-     [Dean Gaudet] PR#506
-
-  *) Escape the HTML-sensitive characters in the Request-URI that is
-     output for each child by mod_status. [Dean Gaudet and Ken Coar] PR#501
-
-  *) Properly initialize the flock structures used by the mutex locking
-     around accept() when USE_FCNTL_SERIALIZED_ACCEPT is defined.
-     [Marc Slemko]
-
-  *) The method for determining PATH_INFO has been restored to the pre-1.2b
-     (and NCSA httpd) definition wherein it was the extra path info beyond
-     the CGI script filename.  The environment variable FILEPATH_INFO has
-     been removed, and instead we supply the original REQUEST_URI to any
-     script that wants to be Apache-specific and needs the real URI path.
-     This solves a problem with existing scripts that use extra path info
-     in the ScriptAlias directive to pass options to the CGI script.
-     [Roy Fielding]
-
-  *) The _default_ change in 1.2b10 will change the behaviour on configs
-     that use multiple Listen statements for listening on multiple ports.
-     But that change is necessary to make _default_ consistent with other
-     forms of <VirtualHost>.  It requires such configs to be modified
-     to use <VirtualHost _default_:*>.  The documentation has been
-     updated.  [Dean Gaudet] PR#530
-
-  *) If an ErrorDocument CGI script is used to respond to an error
-     generated by another CGI script which has already read the message
-     body of the request, the server would block trying to read the
-     message body again.  [Rob Hartill]
-
-  *) signal() replacement conflicted with a define on QNX (and potentially
-     other platforms). Fixed. [Ben Laurie] PR#512
-
-Changes with Apache 1.2b10
-
-  *) Allow HTTPD_ROOT, SERVER_CONFIG_FILE, DEFAULT_PATH, and SHELL_PATH
-     to be configured via -D in Configuration.  [Dean Gaudet] PR#449
-
-  *) <VirtualHost _default_:portnum> didn't work properly.  [Dean Gaudet]
-
-  *) Added prototype for mktemp() for SUNOS4 [Marc Slemko]
-
-  *) In mod_proxy.c, check return values for proxy_host2addr() when reading
-     config, in case the hostent struct returned is trash.
-     [Chuck Murcko] PR #491
-
-  *) Fixed the fix in 1.2b9 for parsing URL query info into args for CGI
-     scripts.  [Dean Gaudet, Roy Fielding, Marc Slemko]
-
-Changes with Apache 1.2b9  [never announced]
-
-  *) Reset the MODULE_MAGIC_NUMBER to account for the unsigned port
-     changes and in anticipation of 1.2 final release.  [Roy Fielding]
-
-  *) Fix problem with scripts not receiving a SIGPIPE when client drops
-     the connection (e.g., when user presses Stop).  Apache will now stop
-     trying to send a message body immediately after an error from write.
-     [Roy Fielding and Nathan Kurz] PR#335
-
-  *) Rearrange Configuration.tmpl so that mod_rewrite has higher priority
-     than mod_alias, and mod_alias has higher priority than mod_proxy;
-     rearranged other modules to enhance understanding of their purpose
-     and relative order (and maybe even reduce some overhead).
-     [Roy Fielding and Sameer Parekh]
-
-  *) Fix graceful restart.  Eliminate many signal-related race
-     conditions in both forms of restart, and in SIGTERM.  See
-     htdocs/manual/stopping.html for details on stopping and
-     restarting the parent.  [Dean Gaudet]
-
-  *) Fix memory leaks in mod_rewrite, mod_browser, mod_include.  Tune
-     memory allocator to avoid a behaviour that required extra blocks to
-     be allocated.  [Dean Gaudet]
-
-  *) Allow suexec to access files relative to current directory but not
-     above.  (Excluding leading / or any .. directory.)  [Ken Coar]
-     PR#269, 319, 395
-
-  *) Fix suexec segfault when group doesn't exist. [Gregory Neil Shapiro]
-     PR#367, 368, 354, 453
-
-  *) Fix the above fix: if suexec is enabled, avoid destroying r->url
-     while obtaining the /~user and save the username in a separate data
-     area so that it won't be overwritten by the call to getgrgid(), and
-     fix some misuse of the pool string allocation functions.  Also fixes
-     a general problem with parsing URL query info into args for CGI scripts.
-     [Roy Fielding] PR#339, 367, 354, 453
-
-  *) Fix IRIX warning about bzero undefined. [Marc Slemko]
-
-  *) Fix problem with <Directory proxy:...>. [Martin Kraemer] PR#271
-
-  *) Corrected spelling of "authoritative".  AuthDBAuthoratative became
-     AuthDBAuthoritative. [Marc Slemko] PR#420
-
-  *) MaxClients should be at least 1. [Lars Eilebrecht] PR#375
-
-  *) The default handler now logs invalid methods or URIs (i.e. PUT on an
-     object that can't be PUT, or FOOBAR for some method FOOBAR that
-     apache doesn't know about at all).  Log 404s that occur in mod_include.
-     [Paul Sutton, John Van Essen]
-
-  *) If a soft timeout (or lingerout) occurs while trying to flush a
-     buffer or write inside buff.c or fread'ing from a CGI's output,
-     then the timeout would be ignored. [Roy Fielding] PR#373
-
-  *) Work around a bug in Netscape Navigator versions 2.x, 3.x and 4.0b2's
-     parsing of headers.  If the terminating empty-line CRLF occurs starting
-     at the 256th or 257th byte of output, then Navigator will think a normal
-     image is invalid.  We are guessing that this is because their initial
-     read of a new request uses a 256 byte buffer. We check the bytes written
-     so far and, if we are about to tickle the bug, we instead insert a
-     padding header of eminent bogosity. [Roy Fielding and Dean Gaudet] PR#232
-
-  *) Fixed SIGSEGV problem when a DirectoryIndex file is also the source
-     of an external redirection.  [Roy Fielding and Paul Sutton]
-
-  *) Configure would create a broken Makefile if the configuration file
-     contained a commented-out Rule.  [Roy Fielding]
-
-  *) Promote per_dir_config and subprocess_env from the subrequest to the
-     main request in mod_negotiation.  In particular this fixes a bug
-     where <Files> sections wouldn't properly apply to negotiated content.
-     [Dean Gaudet]
-
-  *) Fix a potential deadlock in mod_cgi script_err handling.
-     [Ralf S. Engelschall]
-
-  *) rotatelogs zero-pads the logfile names to improve alphabetic sorting.
-     [Mitchell Blank Jr]
-
-  *) Updated mod_rewrite to 3.0.4: Fixes HTTP redirects from within
-     .htaccess files because the RewriteBase was not replaced correctly.
-     Updated mod_rewrite to 3.0.5: Fixes problem with rewriting inside
-     <Directory> sections missing a trailing /.  [Ralf S. Engelschall]
-
-  *) Clean up Linux settings in conf.h by detecting 2.x versus 1.x.  For
-     1.x the settings are those of pre-1.2b8.  For 2.x we include
-     USE_SHMGET_SCOREBOARD (scoreboard in shared memory rather than file) and
-     HAVE_SYS_RESOURCE_H (enable the RLimit commands).
-     [Dean Gaudet] PR#336, PR#340
-
-  *) Redirect did not preserve ?query_strings when present in the client's
-     request.  [Dean Gaudet]
-
-  *) Configure was finding non-modules on EXTRA_LIBS. [Frank Cringle] PR#380
-
-  *) Use /bin/sh5 on ULTRIX.  [P. Alejandro Lopez-Valencia] PR#369
-
-  *) Add UnixWare compile/install instructions.  [Chuck Murcko]
-
-  *) Add mod_example (illustration of API techniques).  [Ken Coar]
-
-  *) Add macro for memmove to conf.h for SUNOS4. [Marc Slemko]
-
-  *) Improve handling of directories when filenames have spaces in them.
-     [Chuck Murcko]
-
-  *) For hosts with multiple IP addresses, try all additional addresses if
-     necessary to get a connect. Fail only if hostent address list is
-     exhausted. [Chuck Murcko]
-
-  *) More signed/unsigned port fixes.  [Dean Gaudet]
-
-  *) HARD_SERVER_LIMIT can be defined in the Configuration file now.
-     [Dean Gaudet]
-
-Changes with Apache 1.2b8
-
-  *) suexec.c doesn't close the log file, allowing CGIs to continue writing
-     to it.  [Marc Slemko]
-
-  *) The addition of <Location> and <File> directives made the
-     sub_req_lookup_simple() function bogus, so we now handle
-     the special cases directly.  [Dean Gaudet]
-
-  *) We now try to log where the server is dumping core when a fatal
-     signal is received.  [Ken Coar]
-
-  *) Improved lingering_close by adding a special timeout, removing the
-     spurious log messages, removing the nonblocking settings (they
-     are not needed with the better timeout), and adding commentary
-     about the NO_LINGCLOSE and USE_SO_LINGER issues.  NO_LINGCLOSE is
-     now the default for SunOS4, UnixWare, NeXT, and IRIX.  [Roy Fielding]
-
-  *) Send error messages about setsockopt failures to the server error
-     log instead of stderr.  [Roy Fielding]
-
-  *) Fix loopholes in proxy cache expiry vis a vis alarms. [Brian Moore]
-
-  *) Stopgap solution for CGI 3-second delay with server-side includes: if
-     processing a subrequest, allocate memory from r->main->pool instead
-     of r->pool so that we can avoid waiting for free_proc_chain to cleanup
-     in the middle of an SSI request.  [Dean Gaudet] PR #122
-
-  *) Fixed status of response when POST is received for a nonexistent URL
-     (was sending 405, now 404) and when any method is sent with a
-     full-URI that doesn't match the server and the server is not acting
-     as a proxy (was sending 501, now 403).  [Roy Fielding]
-
-  *) Host port changed to unsigned short. [Ken Coar] PR #276
-
-  *) Fix typo in command definition of AuthAuthoritative. [Ken Coar] PR #246
-
-  *) Defined USE_SHMGET_SCOREBOARD for shared memory on Linux.  [Dean Gaudet]
-
-  *) Report extra info from errno with many errors that cause httpd to exit.
-     spawn_child, popenf, and pclosef now have valid errno returns in the
-     event of an error.  Correct problems where errno was stomped on
-     before being reported.  [Dean Gaudet]
-
-  *) In the proxy, if the cache filesystem was full, garbage_coll() was
-     never called, and thus the filesystem would remain full indefinitely.
-     We now also remove incomplete cache files left if the origin server
-     didn't send a Content-Length header and either the client has aborted
-     transfer or bwrite() to client has failed. [Petr Lampa]
-
-  *) Fixed the handling of module and script-added header fields.
-     Improved the interface for sending header fields and reduced
-     the duplication of code between sending okay responses and errors.
-     We now always send both headers_out and err_headers_out, and
-     ensure that the server-reserved fields are not being overridden,
-     while not overriding those that are not reserved.  [Roy Fielding]
-
-  *) Moved transparent content negotiation fields to err_headers_out
-     to reflect above changes.  [Petr Lampa]
-
-  *) Fixed the determination of whether or not we should make the
-     connection persistent for all of the cases where some other part
-     of the server has already indicated that we should not.  Also
-     improved the ordering of the test so that chunked encoding will
-     be set whenever it is desired instead of only when KeepAlive
-     is enabled. Added persistent connection capability for most error
-     responses (those that do not indicate a bad input stream) when
-     accessed by an HTTP/1.1 client. [Roy Fielding]
-
-  *) Added missing timeouts for sending header fields, error responses,
-     and the last chunk of chunked encoding, each of which could have
-     resulted in a process being stuck in write forever.  Using soft_timeout
-     requires that the sender check for an aborted connection rather than
-     continuing after an EINTR.  Timeouts that used to be initiated before
-     send_http_header (and never killed) are now initiated only within or
-     around the routines that actually do the sending, and not allowed to
-     propagate above the caller.  [Roy Fielding]
-
-  *) mod_auth_anon required an @ or a . in the email address, not both.
-     [Dirk vanGulik]
-
-  *) per_dir_defaults weren't set correctly until directory_walk for
-     name-based vhosts.  This fixes an obscure bug with the wrong config
-     info being used for vhosts that share the same ip as the server.
-     [Dean Gaudet]
-
-  *) Improved generation of modules/Makefile to be more generic for
-     new module directories. [Ken Coar, Chuck Murcko, Roy Fielding]
-
-  *) Generate makefile dependency for Configuration based on the actual
-     name given when running the Configure process.  [Dean Gaudet]
-
-  *) Fixed problem with vhost error log not being set prior to
-     initializing virtual hosts. [Dean Gaudet]
-
-  *) Fixed infinite loop when a trailing slash is included after a type map
-     file URL (extra path info). [Petr Lampa]
-
-  *) Fixed server status updating of per-connection counters. [Roy Fielding]
-
-  *) Add documentation for DNS issues (reliability and security), and try
-     to explain the virtual host matching process.  [Dean Gaudet]
-
-  *) Try to continue gracefully by disabling the vhost if a DNS lookup
-     fails while parsing the configuration file.  [Dean Gaudet]
-
-  *) Improved calls to setsockopt.  [Roy Fielding]
-
-  *) Negotiation changes: Don't output empty content-type in variant list;
-     Output charset in variant list; Return sooner from handle_multi() if
-     no variants found; Add handling of '*' wildcard in Accept-Charset.
-     [Petr Lampa and Paul Sutton]
-
-  *) Fixed overlaying of request/sub-request notes and headers in
-     mod_negotiation.  [Dean Gaudet]
-
-  *) If two variants' charset quality are equal and one is the default
-     charset (iso-8859-1), then prefer the variant that was specifically
-     listed in Accept-Charset instead of the default.  [Petr Lampa]
-
-  *) Memory allocation problem in push_array() -- it would corrupt memory
-     when nalloc==0.  [Kai Risku <krisku@tf.hut.fi> and Roy Fielding]
-
-  *) invoke_handler() doesn't handle mime arguments in content-type
-     [Petr Lampa] PR#160
-
-  *) Reduced IdentityCheck timeout to 30 seconds, as per RFC 1413 minimum.
-     [Ken Coar]
-
-  *) Fixed problem with ErrorDocument not working for virtual hosts
-     due to one of the performance changes in 1.2b7. [Dean Gaudet]
-
-  *) Log an error message if we get a request header that is too long,
-     since it may indicate a buffer overflow attack. [Marc Slemko]
-
-  *) Made is_url() allow "[-.+a-zA-Z0-9]+:" as a valid scheme and
-     not reject URLs without a double-slash, as per RFC2068 section 3.2.
-     [Ken Coar] PR #146, #187
-
-  *) Added table entry placeholder for new header_parser callback
-     in all of the distributed modules. [Ken Coar] PR #191
-
-  *) Allow for cgi files without the .EXE extension on them under OS/2.
-     [Garey Smiley] PR #59
-
-  *) Fixed error message when resource is not found and URL contains
-     path info. [Petr Lampa and Dean Gaudet] PR #40
-
-  *) Fixed user and server confusion over what should be a virtual host
-     and what is the main server, resulting in access to something
-     other than the name defined in the virtualhost directive (but
-     with the same IP address) failing. [Dean Gaudet]
-
-  *) Updated mod_rewrite to version 3.0.2, which: fixes compile error on
-     AIX; improves the redirection stuff to enable the users to generally
-     redirect to http, https, gopher and ftp; added TIME variable for
-     RewriteCond which expands to YYYYMMDDHHMMSS strings and added the
-     special patterns >STRING, <STRING and =STRING to RewriteCond, which
-     can be used in conjunction with %{TIME} or other variables to create
-     time-dependent rewriting rules. [Ralf S. Engelschall]
-
-  *) bpushfd() no longer notes cleanups for the file descriptors it is handed.
-     Module authors may need to adjust their code for proper cleanup to take
-     place (that is, call note_cleanups_for_fd()). This change fixes problems
-     with file descriptors being erroneously closed when the proxy module was
-     in use. [Ben Laurie]
-
-  *) Fix bug in suexec reintroduced by changes in 1.2b7 which allows
-     initgroups() to hose the group information needed for later
-     comparisons. [Randy Terbush]
-
-  *) Remove unnecessary call to va_end() in create_argv() which
-     caused a SEGV on some systems.
-
-  *) Use proper MAXHOSTNAMELEN symbol for limiting length of server name.
-     [Dean Gaudet]
-
-  *) Clear memory allocated for listeners. [Randy Terbush]
-
-  *) Improved handling of IP address as a virtualhost address and
-     introduced "_default_" as a synonym for the default vhost config.
-     [Dean Gaudet] PR #212
-
-Changes with Apache 1.2b7
-
-  *) Port to  UXP/DS(V20) [Toshiaki Nomura <nom@yk.fujitsu.co.jp>]
-
-  *) unset Content-Length if chunked (RFC-2068) [Petr Lampa]
-
-  *) mod_negotiation fixes [Petr Lampa] PR#157, PR#158, PR#159
-     - replace protocol response numbers with symbols
-     - save variant-list into main request notes
-     - free allocated memory from subrequests
-     - merge notes, headers_out and err_headers_out
-
-  *) changed status check mask in proxy_http.c from "HTTP/#.# ### *" to
-     "HTTP/#.# ###*" to be more lenient about what we accept.
-     [Chuck Murcko]
-
-  *) more proxy FTP bug fixes:
-     - Changed send_dir() to remove user/passwd from displayed URL.
-     - Changed login error messages to be more descriptive.
-     - remove setting of SO_DEBUG socket option
-     - Make ftp_getrc() more lenient about multiline responses,
-       specifically, 230 responses which don't have continuation 230-
-       on each line). These seem to be all NT FTP servers, and while
-       perhaps questionable, they appear to be legal by RFC 959.
-     - Add missing kill_timeout() after transfer to user completes.
-     [Chuck Murcko]
-
-  *) Fixed problem where a busy server could hang when restarting
-     after being sent a SIGHUP due to child processes not exiting.
-     [Marc Slemko]
-
-  *) Modify mod_include escaping so a '\' only signifies an escaped
-     character if the next character is one that needs
-     escaping.  [Ben Laurie]
-
-  *) Eliminated possible infinite loop in mod_imap when relative URLs are
-     used with a 'base' directive that does not have a '/' in it.
-     [Marc Slemko, reported by Onno Witvliet <onno@tc.hsa.nl>]
-
-  *) Reduced the default timeout from 1200 seconds to 300, and the
-     one in the sample configfile from 400 to 300.  [Marc Slemko]
-
-  *) Stop vbprintf from crashing if given a NULL string pointer;
-     print (null) instead.  [Ken Coar]
-
-  *) Don't disable Nagle algorithm if system doesn't have TCP_NODELAY.
-     [Marc Slemko and Roy Fielding]
-
-  *) Fixed problem with mod_cgi-generated internal redirects trying to
-     read the request message-body twice. [Archie Cobbs and Roy Fielding]
-
-  *) Reduced timeout on lingering close, removed possibility of a blocked
-     read causing the child to hang, and stopped logging of errors if
-     the socket is not connected (reset by client).  [Roy Fielding]
-
-  *) Rearranged main child loop to remove duplication of code in
-     select/accept and keep-alive requests, fixed several bugs regarding
-     checking scoreboard_image for exit indication and failure to
-     account for all success conditions and trap all error conditions,
-     prevented multiple flushes before closing the socket; close the entire
-     socket buffer instead of just one descriptor, prevent logging of
-     EPROTO and ECONNABORTED on platforms where supported, and generally
-     improved readability.  [Roy Fielding]
-
-  *) Extensive performance improvements. Cleaned up inefficient use of
-     auto initializers, multiple is_matchexp calls on a static string,
-     and excessive merging of response_code_strings. [Dean Gaudet]
-
-  *) Added double-buffering to mod_include to improve performance on
-     server-side includes. [Marc Slemko]
-
-  *) Several fixes for suexec wrapper. [Randy Terbush]
-     - Make wrapper work for files on NFS filesystem.
-     - Fix portability problem of MAXPATHLEN.
-     - Fix array overrun problem in clean_env().
-     - Fix allocation of PATH environment variable
-
-  *) Removed extraneous blank line is description of mod_status chars.
-     [Kurt Kohler]
-
-  *) Logging of errors from the call_exec routine simply went nowhere,
-     since the logfile fd has been closed, so now we send them to stderr.
-     [Harald T. Alvestrand]
-
-  *) Fixed core dump when DocumentRoot is a CGI.
-     [Ben Laurie, reported by geddis@tesserae.com]
-
-  *) Fixed potential file descriptor leak in mod_asis; updated it and
-     http_core to use pfopen/pfclose instead of fopen/fclose.
-     [Randy Terbush and Roy Fielding]
-
-  *) Fixed handling of unsigned ints in ap_snprintf() on some chips such
-     as the DEC Alpha which is 64-bit but uses 32-bit ints.
-     [Dean Gaudet and Ken Coar]
-
-  *) Return a 302 response code to the client when sending a redirect
-     due to a missing trailing '/' on a directory instead of a 301; now
-     it is cacheable. [Markus Gyger]
-
-  *) Fix condition where, if a bad directive occurs in .htaccess, and
-     sub_request() goes first to this directory, then log_reason() will
-     SIGSEGV because it doesn't have initialized r->per_dir_config.
-     [PR#162 from Petr Lampa, fix by Marc Slemko and Dean Gaudet]
-
-  *) Fix handling of lang_index in is_variant_better().  This was
-     causing problems which resulted in the server sending the
-     wrong language document in some cases. [Petr Lampa]
-
-  *) Remove free() from clean_env() in suexec wrapper. This was nuking
-     the clean environment on some systems.
-
-  *) Tweak byteserving code (e.g. serving PDF files) to work around
-     bugs in Netscape Navigator and Microsoft Internet Explorer.
-     Emit Content-Length header when sending multipart/byteranges.
-     [Alexei Kosut]
-
-  *) Port to HI-UX/WE2. [Nick Maclaren]
-
-  *) Port to HP MPE operating system for HP 3000 machines
-     [Mark Bixby <markb@cccd.edu>]
-
-  *) Fixed bug which caused a segmentation fault if only one argument
-     given to RLimit* directives. [Ed Korthof]
-
-  *) Continue persistent connection after 204 or 304 response. [Dean Gaudet]
-
-  *) Improved buffered output to the client by delaying the flush decision
-     until the BUFF code is actually about to read the next request.
-     This fixes a problem introduced in 1.2b5 with clients that send
-     an extra CRLF after a POST request. Also improved chunked output
-     performance by combining writes using writev() and removing as
-     many bflush() calls as possible.  NOTE: Platforms without writev()
-     must add -DNO_WRITEV to the compiler CFLAGS, either in Configuration
-     or Configure, unless we have already done so.  [Dean Gaudet]
-
-  *) Fixed mod_rewrite bug which truncated the rewritten URL [Marc Slemko]
-
-  *) Fixed mod_info output corruption bug introduced by buffer overflow
-     fixes. [Dean Gaudet]
-
-  *) Fixed http_protocol to correctly output all HTTP/1.1 headers, including
-     for the special case of a 304 response.  [Paul Sutton]
-
-  *) Improved handling of TRACE method by bypassing normal method handling
-     and header parsing routines; fixed Allow response to always allow TRACE.
-     [Dean Gaudet]
-
-  *) Fixed compiler warnings in the regex library. [Dean Gaudet]
-
-  *) Cleaned-up some of the generated HTML. [Ken Coar]
-
-Changes with Apache 1.2b6
-
-  *) Allow whitespace in imagemap mapfile coordinates. [Marc Slemko]
-
-  *) Fix typo introduced in fix for potential infinite loop around
-     accept() in child_main(). This change caused the rev to 1.2b6.
-     1.2b5 was never a public beta.
-
-Changes with Apache 1.2b5
-
-  *) Change KeepAlive semantics (On|Off instead of a number), add
-     MaxKeepAliveRequests directive. [Alexei Kosut]
-
-  *) Various NeXT compilation patches, as well as a change in
-     regex/regcomp.c since that file also used a NEXT define.
-     [Andreas Koenig]
-
-  *) Allow * to terminate the end of a directory match in mod_dir.
-     Allows /~* to match for both /~joe and /~joe/. [David Bronder]
-
-  *) Don't call can_exec() if suexec_enabled. Calling this requires
-     scripts executed by the suexec wrapper to be world executable, which
-     defeats one of the advantages of running the wrapper. [Randy Terbush]
-
-  *) Portability Fix: IRIX complained with 'make clean' about *pure* (removed)
-     [Jim Jagielski]
-
-  *) Migration from sprintf() to snprintf() to avoid buffer
-     overflows. [Marc Slemko]
-
-  *) Provide portable snprintf() implementation (ap_snprintf)
-     as well as *cvt family. [Jim Jagielski]
-
-  *) Portability Fix: NeXT lacks unistd.h so we wrap it's inclusion
-     [Jim Jagielski]
-
-  *) Remove mod_fastcgi.c from the distribution. This module appears
-     to be maintained more through the Open Market channels and should
-     continue to be easily available at http://www.fastcgi.com/
-
-  *) Fixed bug in modules/Makefile that wouldn't allow building in more
-     than one subdirectory (or cleaning, either). [Jeremy Laidman]
-
-  *) mod_info assumed that the config files were relative to ServerRoot.
-     [Ken the Rodent]
-
-  *) CGI scripts called as an error document resulting from failed
-     CGI execution would hang waiting for POST'ed data. [Rob Hartill]
-
-  *) Log reason when mod_dir returns access HTTP_FORBIDDEN
-     [Ken the Rodent]
-
-  *) Properly check errno to prevent display of a directory index
-     when server receives a long enough URL to confuse stat().
-     [Marc Slemko]
-
-  *) Several security enhancements to suexec wrapper. It is _highly_
-     recommended that previously installed versions of the wrapper
-     be replaced with this version.  [Randy Terbush, Jason Dour]
-
-        - ~user execution now properly restricted to ~user's home
-          directory and below.
-        - execution restricted to UID/GID > 100
-        - restrict passed environment to known variables
-        - call setgid() before initgroups() (portability fix)
-        - remove use of setenv() (portability fix)
-
-  *) Add HTTP/1.0 response forcing. [Ben Laurie]
-
-  *) Add access control via environment variables. [Ben Laurie]
-
-  *) Add rflush() function. [Alexei Kosut]
-
-  *) remove duplicate pcalloc() call in new_connection().
-
-  *) Fix incorrect comparison which could allow number of children =
-     MaxClients + 1 if less than HARD_SERVER_LIMIT. Also fix potential
-     problem if StartServers > HARD_SERVER_LIMIT. [Ed Korthof]
-
-  *) Updated support for OSes (MachTen, ULTRIX, Paragon, ISC, OpenBSD
-     AIX PS/2, CONVEXOS. [Jim Jagielski]
-
-  *) Replace instances of inet_ntoa() with inet_addr() for ProxyBlock.
-     It's more portable. [Martin Kraemer]
-
-  *) Replace references to make in Makefile.tmpl with $(MAKE).
-     [Chuck Murcko]
-
-  *) Add ProxyBlock directive w/IP address caching. Add IP address
-     caching to NoCache directive as well. ProxyBlock works with all
-     handlers; NoCache now also works with FTP for anonymous logins.
-     Still more code cleanup. [Chuck Murcko]
-
-  *) Add "header parse" API hook [Ben Laurie]
-
-  *) Fix byte ordering problems for REMOTE_PORT [Chuck Murcko]
-
-  *) suEXEC wrapper was freeing memory that had not been malloc'ed.
-
-  *) Correctly allow access and auth directives in <Files> sections in
-     server config files. [Alexei Kosut]
-
-  *) Fix bug with ServerPath that could cause certain files to be not
-     found by the server. [Alexei Kosut]
-
-  *) Fix handling of ErrorDocument so that it doesn't remove a trailing
-     double-quote from text and so that it properly checks for unsupported
-     status codes using the new index_of_response interface. [Roy Fielding]
-
-  *) Multiple fixes to the lingering_close code in order to avoid being
-     interrupted by a stray timeout, to avoid lingering on a connection
-     that has already been aborted or never really existed, to ensure that
-     we stop lingering as soon as any error condition is received, and to
-     prevent being stuck indefinitely if the read blocks.  Also improves
-     reporting of error conditions.  [Marc Slemko and Roy Fielding]
-
-  *) Fixed initialization of parameter structure for sigaction.
-     [mgyger@itr.ch, Adrian Filipi-Martin]
-
-  *) Fixed reinitializing the parameters before each call to accept and
-     select, and removed potential for infinite loop in accept.
-     [Roy Fielding, after useful PR from adrian@virginia.edu]
-
-  *) Fixed condition where, if a child fails to fork, the scoreboard would
-     continue to say SERVER_STARTING forever. Eventually, the main process
-     would refuse to start new children because count_idle_servers() will
-     count those SERVER_STARTING entries and will always report that there
-     are enough idle servers. [Phillip Vandry]
-
-  *) Fixed bug in bcwrite regarding failure to account for partial writes.
-     Avoided calling bflush() when the client is pipelining requests.
-     Removed unnecessary flushes from http_protocol. [Dean Gaudet]
-
-  *) Added description of "." mode in server-status [Jim Jagielski]
-
-Changes with Apache 1.2b4
-
-  *) Fix possible race condition in accept_mutex_init() that
-     could leave a small security hole open allowing files to be
-     overwritten in cases where the server UID has write permissions.
-     [Marc Slemko]
-
-  *) Fix awk compatibilty problem in Configure. [Jim Jagielski]
-
-  *) Fix portablity problem in util_script where ARG_MAX may not be
-     defined for some systems.
-
-  *) Add changes to allow compilation on Machten 4.0.3 for PowerPC.
-     [Randal Schwartz]
-
-  *) OS/2 changes to support an MMAP style scoreboard file and UNIX
-     style magic #! token for better script portability. [Garey Smiley]
-
-  *) Fix bug in suexec wrapper introduced in b3 that would cause failed
-     execution for ~userdir CGI. [Jason Dour]
-
-  *) Fix initgroups() business in suexec wrapper. [Jason Dour]
-
-  *) Fix month off by one in suexec wrapper logging.
-
-Changes with Apache 1.2b3:
-
-  *) Fix error in mod_cgi which could cause resources not to be properly
-     freed, or worse. [Dean Gaudet]
-
-  *) Fix find_string() NULL pointer dereference. [Howard Fear]
-
-  *) Add set_flag_slot() at the request of Dirk and others.
-     [Dirk vanGulik]
-
-  *) Sync mod_rewrite with patch level 10. [Ralf Engelschall]
-
-  *) Add changes to improve the error message given for invalid
-     ServerName parameters. [Dirk vanGulik]
-
-  *) Add "Authoritative" directive for Auth modules that don't
-     currently have it. This gives admin control to assign authoritative
-     control to an authentication scheme and allow "fall through" for
-     those authentication modules that aren't "Authoritative" thereby
-     allowing multiple authentication mechanisms to be chained.
-     [Dirk vanGulik]
-
-  *) Remove requirement for ResourceConfig/AccessConfig if not using
-     the three config file layout. [Randy Terbush]
-
-  *) Add PASV mode to mod_proxy FTP handler. [Chuck Murcko]
-
-  *) Changes to suexec wrapper to fix the following problems:
-     1.  symlinked homedirs will kill ~userdirs.
-     2.  initgroups() on Linux 2.0.x clobbers gr->grid.
-     3.  CGI command lines paramters problems
-     4.  pw-pwdir for "docroot check" still the httpd user's pw record.
-    [Randy Terbush, Jason Dour]
-
-  *) Change create_argv() to accept variable arguments. This fixes
-     a problem where arguments were not getting passed to the CGI via
-     argv[] when the suexec wrapper was active. [Randy Terbush, Jake Buchholz]
-
-  *) Collapse multiple slashes in path URLs to properly apply
-     handlers defined by <Location>. [Alexei Kosut]
-
-  *) Define a sane set of DEFAULT_USER and DEFAULT_GROUP values for AIX.
-
-  *) Improve the accuracy of request duration timings by setting
-     r->request_time in read_request_line() instead of read_request().
-     [Dean Gaudet]
-
-  *) Reset timeout while reading via get_client_block() in mod_cgi.c
-     Fixes problem with timed out transfers of large files. [Rasmus Lerdorf]
-
-  *) Add the ability to pass different Makefile.tmpl files to Configure
-     using the -make flag. [Rob Hartill]
-
-  *) Fix coredump triggered when sending a SIGHUP to the server caused
-     by an assertion failure, in turn caused by an uninitialised field in a
-     listen_rec.
-     [Ben Laurie]
-
-  *) Add FILEPATH_INFO variable to CGI environment, which is equal to
-     PATH_INFO from previous versions of Apache (in certain situations,
-     Apache 1.2's PATH_INFO will be different than 1.1's). [Alexei Kosut]
-     [later removed in 1.2b11]
-
-  *) Add rwrite() function to API to allow for sending strings of
-     arbitrary length. [Doug MacEachern]
-
-  *) Remove rlim_t typedef for NetBSD. Do older versions need this?
-
-  *) Defined rlim_t and WANTHSREGEX=yes and fixed waitpid() substitute for
-     NeXT. [Jim Jagielski]
-
-  *) Removed recent modification to promote the status code on internal
-     redirects, since the correct fix was to change the default log format
-     in mod_log_config so that it outputs the original status. [Rob Hartill]
-
-Changes with Apache 1.2b2:
-
-  *) Update set_signals() to use sigaction() for setting handlers.
-     This appears to fix a re-entrant problem in the seg_fault()
-     bus_error() handlers. [Randy Terbush]
-
-  *) Changes to allow mod_status compile for OS/2 [Garey Smiley]
-
-  *) changes for DEC AXP running OSF/1 v3.0. [Marc Evans]
-
-  *) proxy_http.c bugfixes:  [Chuck Murcko]
-        1) fixes possible NULL pointer reference w/NoCache
-        2) fixes NoCache behavior when using ProxyRemote (ProxyRemote
-           host would cache nothing if it was in the local domain,
-           and the local domain was in the NoCache list)
-        3) Adds Host: header when not available
-        4) Some code cleanup and clarification
-
-  *) mod_include.c bugfixes:
-        1) Fixed an ommission that caused include variables to not
-           be parsed in config errmsg directives [Howard Fear]
-        2) Remove HAVE_POSIX_REGEX cruft [Alexei Kosut]
-        3) Patch to fix compiler warnings [perrot@lal.in2p3.fr]
-        4) Allow backslash-escaping to all quoted text
-           [Ben Yoshino <ben@wiliki.eng.hawaii.edu>]
-        5) Pass variable to command line if not set in XSSI's env
-           [Howard Fear]
-
-  *) Fix infinite loop when processing Content-language lines in
-     type-map files. [Alexei Kosut]
-
-  *) Closed file-globbing hole in test-cgi script. [Brian Behlendorf]
-
-  *) Fixed problem in set_[user|group] that prevented CGI execution
-     for non-virtualhosts when suEXEC was enabled. [Randy Terbush]
-
-  *) Added PORTING information file.  [Jim Jagielski]
-
-  *) Added definitions for S_IWGRP and S_IWOTH to conf.h [Ben Laurie]
-
-  *) Changed default group to "nogroup" instead of "nobody" [Randy Terbush]
-
-  *) Fixed define typo of FCNTL_SERIALIZED_ACCEPT where
-     USE_FCNTL_SERIALIZED_ACCEPT was intended.
-
-  *) Fixed additional uses of 0xffffffff where INADDR_NONE was intended,
-     which caused problems of systems where socket s_addr is >32bits.
-
-  *) Added comment to explain (r->chunked = 1) side-effect in
-     http_protocol.c [Roy Fielding]
-
-  *) Replaced use of index() in mod_expires.c with more appropriate
-     and portable isdigit() test.  [Ben Laurie]
-
-  *) Updated Configure for ...
-        OS/2          (DEF_WANTHSREGEX=yes, other code changes)
-        *-dg-dgux*    (bad pattern match)
-        QNX           (DEF_WANTHSREGEX=yes)
-        *-sunos4*     (DEF_WANTHSREGEX=yes, -DUSEBCOPY)
-        *-ultrix      (new)
-        *-unixware211 (new)
-     and added some user diagnostic info.  [Ben Laurie]
-
-  *) In helpers/CutRule, replaced "cut" invocation with "awk" invocation
-     for better portability. [Jim Jagielski]
-
-  *) Updated helpers/GuessOS for ...
-        SCO 5            (recognize minor releases)
-        SCO UnixWare     (braindamaged uname, whatever-whatever-unixware2)
-        SCO UnixWare 2.1.1      (requires a separate set of #defines in conf.h)
-        IRIX64           (-sgi-irix64)
-        ULTRIX           (-unknown-ultrix)
-        SINIX            (-whatever-sysv4)
-        NCR Unix         (-ncr-sysv4)
-     and fixed something in helpers/PrintPath  [Ben Laurie]
-
-Changes with Apache 1.2b1
-
-  *) Not listed. See <http://www.apache.org/docs/new_features_1_2.html>
-
-Changes with Apache 1.1.1
-
-  *) Fixed bug where Cookie module would make two entries in the
-     logfile for each access [Mark Cox]
-
-  *) Fixed bug where Redirect in .htaccess files would cause memory
-     leak. [Nathan Neulinger]
-
-  *) MultiViews now works correctly with AddHandler [Alexei Kosut]
-
-  *) Problems with mod_auth_msql fixed [Dirk vanGulik]
-
-  *) Fix misspelling of "Anonymous_Authorative" directive in mod_auth_anon.
-
-Changes with Apache 1.1.0
-
-  *) Bring NeXT support up to date. [Takaaki Matsumoto]
-
-  *) Bring QNX support up to date. [Ben Laurie]
-
-  *) Make virtual hosts default to main server keepalive parameters.
-     [Alexei Kosut, Ben Laurie]
-
-  *) Allow ScanHTMLTitles to work with lowercase <title> tags. [Alexei Kosut]
-
-  *) Fix missing address family for connect, also remove unreachable statement
-     in mod_proxy. [Ben Laurie]
-
-  *) mod_env now turned on by default in Configuration.tmpl.
-
-  *) Bugs which were fixed:
-        a) yet more mod_proxy bugs [Ben Laurie]
-        b) CGI works again with inetd [Alexei Kosut]
-        c) Leading colons were stripped from passwords [osm@interguide.com]
-        d) Another fix to multi-method Limit problem [jk@tools.de]
-
-Changes with Apache 1.1b4
-
-  *) r->bytes_sent variable restored. [Robert Thau]
-
-  *) Previously broken multi-method <Limit> parsing fixed. [Robert Thau]
-
-  *) More possibly unsecure programs removed from the support directory.
-
-  *) More mod_auth_msql authentication improvements.
-
-  *) VirtualHosts based on Host: headers no longer conflict with the
-     Listen directive.
-
-  *) OS/2 compatibility enhancements. [Gary Smiley]
-
-  *) POST now allowed to directory index CGI scripts.
-
-  *) Actions now work with files of the default type.
-
-  *) Bugs which were fixed:
-        a) more mod_proxy bugs
-        b) early termination of inetd requests
-        c) compile warnings on several systems
-        d) problems when scripts stop reading output early
-
-Changes with Apache 1.1b3
-
-  *) Much of cgi-bin and all of cgi-src has been removed, due to
-     various security holes found and that we could no longer support
-     them.
-
-  *) The "Set-Cookie" header is now special-cased to not merge multiple
-     instances, since certain popular browsers can not handle multiple
-     Set-Cookie instructions in a single header. [Paul Sutton]
-
-  *) rprintf() added to buffer code, occurrences of sprintf removed.
-     [Ben Laurie]
-
-  *) CONNECT method for proxy module, which means tunneling SSL should work.
-     (No crypto needed)  Also a NoCache config directive.
-
-  *) Several API additions: pstrndup(), table_unset() and get_token()
-     functions now available to modules.
-
-  *) mod_imap fixups, in particular Location: headers are now complete
-     URL's.
-
-  *) New "info" module which reports on installed module set through a
-     special URL, a la mod_status.
-
-  *) "ServerPath" directive added - allows for graceful transition
-     for Host:-header-based virtual hosts.
-
-  *) Anonymous authentication module improvements.
-
-  *) MSQL authentication module improvements.
-
-  *) Status module design improved - output now table-based. [Ben Laurie]
-
-  *) htdigest utility included for use with digest authentication
-     module.
-
-  *) mod_negotiation: Accept values with wildcards to be treated with
-     less priority than those without wildcards at the same quality
-     value. [Alexei Kosut]
-
-  *) Bugs which were fixed:
-        a) numerous mod_proxy bugs
-        b) CGI early-termination bug [Ben Laurie]
-        c) Keepalives not working with virtual hosts
-        d) RefererIgnore problems
-        e) closing fd's twice in mod_include (causing core dumps on
-           Linux and elsewhere).
-
-Changes with Apache 1.1b2
-
-  *) Bugfixes:
-        a) core dumps in mod_digest
-        b) truncated hostnames/ip address in the logs
-        c) relative URL's in mod_imap map files
-
-Changes with Apache 1.1b1
-
-  *) Not listed. See <http://www.apache.org/docs/new_features_1_1.html>
-
-Changes with Apache 1.0.3
-
-  *) Internal redirects which occur in mod_dir.c now preserve the
-     query portion of a request (the bit after the question mark).
-     [Adam Sussman]
-
-  *) Escape active characters '<', '>' and '&' in html output in
-     directory listings, error messages and redirection links.
-     [David Robinson]
-
-  *) Apache will now work with LynxOS 2.3 and later [Steven Watt]
-
-  *) Fix for POSIX compliance in waiting for processes in alloc.c.
-     [Nick Williams]
-
-  *) setsockopt no longer takes a const declared argument [Martijn Koster]
-
-  *) Reset timeout timer after each successful fwrite() to the network.
-     This patch adds a reset_timeout() procedure that is called by
-     send_fd() to reset the timeout ever time data is written to the net.
-     [Nathan Schrenk]
-
-  *) timeout() signal handler now checks for SIGPIPE and reports
-     lost connections in a more user friendly way. [Rob Hartill]
-
-  *) Location of the "scoreboard" file which used to live in /tmp is
-     now configurable (for OSes that can't use mmap) via ScoreBoardFile
-     which works similar to PidFile (in httpd.conf) [Rob Hartill]
-
-  *) Include sys/resource.h in the correct place for SunOS4 [Sameer Parekh]
-
-  *) the pstrcat call in mod_cookies.c didn't have an ending NULL,
-     which caused a SEGV with cookies enabled
-
-  *) Output warning when MinSpareServers is set to <= 0 and change it to 1
-     [Rob Hartill]
-
-  *) Log the UNIX textual error returned by some system calls, in
-     particular errors from accept() [David Robinson]
-
-  *) Add strerror function to util.c for SunOS4 [Randy Terbush]
-
-Changes with Apache 1.0.2
-
-  *) patch to get Apache compiled on UnixWare 2.x, recommended as
-     a temporary measure, pending rewrite of rfc931.c. [Chuck Murcko]
-
-  *) Fix get_basic_auth_pw() to set the auth_type of the request.
-     [David Robinson]
-
-  *) past changes to http_config.c to only use the
-     setrlimit function on systems defining RLIMIT_NOFILE
-     broke the feature on SUNOS4. Now defines HAVE_RESOURCE
-     for SUNOS and prototypes the needed functions.
-
-  *) Remove uses of MAX_STRING_LEN/HUGE_STRING_LEN from several routines.
-     [David Robinson]
-
-  *) Fix use of pointer to scratch memory. [Cliff Skolnick]
-
-  *) Merge multiple headers from CGI scripts instead of taking last
-     one. [David Robinson]
-
-  *) Add support for SCO 5. [Ben Laurie]
-
-Changes with Apache 1.0.1
-
-  *) Silence mod_log_referer and mod_log_agent if not configured
-     [Randy Terbush]
-
-  *) Recursive includes can occur if the client supplies PATH_INFO data
-     and the server provider uses relative links; as file.html
-     relative to /doc.shtml/pathinfo is /doc.shtml/file.html. [David Robinson]
-
-  *) The replacement for initgroups() did not call {set,end}grent(). This
-     had two implications: if anything else used getgrent(), then
-     initgroups() would fail, and it was consuming a file descriptor.
-     [Ben Laurie]
-
-  *) On heavily loaded servers it was possible for the scoreboard to get
-     out of sync with reality, as a result of a race condition.
-     The observed symptoms are far more Apaches running than should
-     be, and heavy system loads, generally followed by catastrophic
-     system failure. [Ben Laurie]
-
-  *) Fix typo in license. [David Robinson]
-
-Changes with Apache 1.0.0                                        23 Nov 1995
-
-  *) Not listed. See <http://www.apache.org/docs/new_features_1_0.html>
-
-Changes with Apache 0.8.16                                       05 Nov 1995
-
-  *) New man page for 'httpd' added to support directory [David Robinson]
-
-  *) .htgroup files can have more than one line giving members for a
-     given group (each must have the group name in front), for NCSA
-     back-compatibility [Robert Thau]
-
-  *) Mutual exclusion around accept() is on by default for SVR4 systems
-     generally, since they generally can't handle multiple processes in
-     accept() on the same socket.  This should cure flaky behavior on
-     a lot of those systems.  [David Robinson]
-
-  *) AddType, AddEncoding, and AddLanguage directives take multiple
-     extensions on a single command line [David Robinson]
-
-  *) UserDir can be disabled for a given virtual host by saying
-     "UserDir disabled" in the <VirtualHost> section --- it was a bug
-     that this didn't work.  [David Robinson]
-
-  *) Compiles on QNX [Ben Laurie]
-
-  *) Corrected parsing of ctime time format [David Robinson]
-
-  *) httpd does a perror() before exiting if it can't log its pid
-     to the PidFile, to make diagnosing the error a bit easier.
-     [David Robinson]
-
-  *) <!--#include file="..."--> can no longer include files in the
-     parent directory, for NCSA back-compatibility.  [David Robinson]
-
-  *) '~' is *not* escaped in URIs generated for directory listings
-     [Roy Fielding]
-
-  *) Eliminated compiler warning in the imagemap module [Randy Terbush]
-
-  *) Fixed bug involving handling URIs with escaped %-characters
-     in redirects [David Robinson]
-
-Changes with Apache 0.8.15                                       14 Oct 1995
-
-  *) Switched to new, simpler license
-
-  *) Eliminated core dumps with improperly formatted DBM group files [Mark Cox]
-
-  *) Don't allow requests for ordinary files to have PATH_INFO [Ben Laurie]
-
-  *) Reject paths containing %-escaped '%' or null characters [David Robinson]
-
-  *) Correctly handles internal redirects to files with names containing '%'
-     [David Robinson]
-
-  *) Repunctuated some error messages [Aram Mirzadeh, Andrew Wilson]
-
-  *) Use geteuid() rather than getuid() to see if we have root privilege,
-     so that server correctly resets privilege if run setuid root.  [Andrew
-     Wilson]
-
-  *) Handle ftp: and telnet: URLs correctly in imagemaps (built-in module)
-     [Randy Terbush]
-
-  *) Fix relative URLs in imagemap files [Randy Terbush]
-
-  *) Somewhat better fix for the old "Alias /foo/ /bar/" business
-     [David Robinson]
-
-  *) Don't repeatedly open the ErrorLog if a bunch of <VirtualHost>
-     entries all name the same one. [David Robinson]
-
-  *) Fix directory listings with filenames containing unusual characters
-     [David Robinson]
-
-  *) Better URI-escaping for generated URIs in directories with filenames
-     containing unusual characters [Ben Laurie]
-
-  *) Fixed potential FILE* leak in http_main.c [Ben Laurie]
-
-  *) Unblock alarms on error return from spawn_child() [David Robinson]
-
-  *) Sample Config files have extra note for SCO users [Ben Laurie]
-
-  *) Configuration has note for HP-UX users [Rob Hartill]
-
-  *) Eliminated some bogus Linux-only #defines in conf.h [Aram Mirzadeh]
-
-  *) Nuked bogus #define in httpd.h [David Robinson]
-
-  *) Better test for whether a system has setrlimit() [David Robinson]
-
-  *) Calls update_child_status() after reopen_scoreboard() [David Robinson]
-
-  *) Doesn't send itself SIGHUP on startup when run in the -X debug-only mode
-     [Ben Laurie]
-
-Changes with Apache 0.8.14                                       19 Sep 1995
-
-  *) Compiles on SCO ODT 3.0 [Ben Laurie]
-
-  *) AddDescription works (better) [Ben Laurie]
-
-  *) Leaves an intelligible error diagnostic when it can't set group
-     privileges on standalone startup [Andrew Wilson]
-
-  *) Compiles on NeXT again --- the 0.8.13 RLIMIT patch was failing on
-     that machine, which claims to be BSD but does not support RLIMIT.
-     [Randy Terbush]
-
-  *) gcc -Wall no longer complains about an unused variable when util.c
-     is compiled with -DMINIMAL_DNS [Andrew Wilson]
-
-  *) Nuked another compiler warning for -Wall on Linux [Aram Mirzadeh]
-
-Changes with Apache 0.8.13                                       07 Sep 1995
-
-  *) Make IndexIgnore *work* (ooops) [Jarkko Torppa]
-
-  *) Have built-in imagemap code recognize & honor Point directive [James
-     Cloos]
-
-  *) Generate cleaner directory listings in directories with a mix of
-     long and short filenames [Rob Hartill]
-
-  *) Properly initialize dynamically loaded modules [Royston Shufflebotham]
-
-  *) Properly default ServerName for virtual servers [Robert Thau]
-
-  *) Rationalize handling of BSD in conf.h and elsewhere [Randy Terbush,
-     Paul Richards and a cast of thousands...]
-
-  *) On self-identified BSD systems (we don't try to guess any more),
-     allocate a few extra file descriptors per virtual host with setrlimit,
-     if we can, to avoid running out. [Randy Terbush]
-
-  *) Write 22-character lock file name into buffer with enough space
-     on startup [Konstantin Olchanski]
-
-  *) Use archaic setpgrp() interface on NeXT, which requires it [Brian
-     Pinkerton]
-
-  *) Suppress -Wall warning by casting const away in util.c [Aram Mirzadeh]
-
-  *) Suppress -Wall warning by initializing variable in negotiation code
-     [Tobias Weingartner]
-
-Changes with Apache 0.8.12                                       31 Aug 1995
-
-  *) Doesn't pause three seconds after including a CGI script which is
-     too slow to die off (this is done by not even trying to kill off
-     subprocesses, including the SIGTERM/pause/SIGKILL routine, until
-     after the entire document has been processed).  [Robert Thau]
-
-  *) Doesn't do SSI if Options Includes is off.  (Ooops).  [David Robinson]
-
-  *) Options IncludesNoExec allows inclusion of at least text/* [Roy Fielding]
-
-  *) Allows .htaccess files to override <Directory> sections naming the
-     same directory [David Robinson]
-
-  *) Removed an efficiency hack in sub_req_lookup_uri which was
-     causing certain extremely marginal cases (e.g., ScriptAlias of a
-     *particular* index.html file) to fail.  [David Robinson]
-
-  *) Doesn't log an error when the requested URI requires
-     authentication, but no auth header line was supplied by the
-     client; this is a normal condition (the client doesn't no auth is
-     needed here yet).  [Robert Thau]
-
-  *) Behaves more sanely when the name server loses its mind [Sean Welch]
-
-  *) RFC931 code compiles cleanly on old BSDI releases [Randy Terbush]
-
-  *) RFC931 code no longer passes out name of prior clients on current
-     requests if the current request came from a server that doesn't
-     do RFC931.  [David Robinson]
-
-  *) Configuration script accepts "Module" lines with trailing whitespace.
-     [Robert Thau]
-
-  *) Cleaned up compiler warning from mod_access.c [Robert Thau]
-
-  *) Cleaned up comments in mod_cgi.c [Robert Thau]
-
-Changes with Apache 0.8.11                                       24 Aug 1995
-
-  *) Wildcard <Directory> specifications work.  [Robert Thau]
-
-  *) Doesn't loop for buggy CGI on Solaris [Cliff Skolnick]
-
-  *) Symlink checks (FollowSymLinks off, or SymLinkIfOwnerMatch) always check
-     the file being requested itself, in addition to the directories leading
-     up to it. [Robert Thau]
-
-  *) Logs access failures due to symlink checks or invalid client address
-     in the error log [Roy Fielding, Robert Thau]
-
-  *) Symlink checks deal correctly with systems where lstat of
-     "/path/to/some/link/" follows the link.  [Thau, Fielding]
-
-  *) Doesn't reset DirectoryIndex to 'index.html' when
-     other directory options are set in a .htaccess file.  [Robert Thau]
-
-  *) Clarified init code and nuked bogus warning in mod_access.c
-     [Florent Guillaume]
-
-  *) Corrected several directives in sample srm.conf
-     --- includes corrections to directory indexing icon-related directives
-     (using unknown.gif rather than unknown.xbm as the DefaultIcon, doing
-     icons for encodings right, and turning on AddEncoding by default).
-     [Roy Fielding]
-
-  *) Corrected descriptions of args to AddIcon and AddAlt in command table
-     [James Cloos]
-
-  *) INSTALL & README mention "contributed modules" directory [Brian
-     Behlendorf]
-
-  *) Fixed English in the license language...  "for for" --> "for".
-     [Roy Fielding]
-
-  *) Fixed ScriptAlias/Alias interaction by moving ScriptAlias handling to
-     mod_alias.c, merging it almost completely with handling of Alias, and
-     adding a 'notes' field to the request_rec which allows the CGI module
-     to discover whether the Alias module has put this request through
-     ScriptAlias (which it needs to know for back-compatibility, as the old
-     NCSA code did not check Options ExecCGI in ScriptAlias directories).
-     [Robert Thau]
-
-Changes with Apache 0.8.10                                       18 Aug 1995
-
-  *) AllowOverride applies to the named directory, and not just
-     subdirectories.  [David Robinson]
-
-  *) Do locking for accept() exclusion (on systems that need it)
-     using a special file created for the purpose in /usr/tmp, and
-     not the error log; using the error log causes real problems
-     if it's NFS-mounted; this is known to be the cause of a whole
-     lot of "server hang" problems with Solaris.  [David Robinson;
-     thanks to Merten Schumann for help diagnosing the problem].
-
-Changes with Apache 0.8.9                                        12 Aug 1995
-
-  *) Compiles with -DMAXIMUM_DNS ---- ooops! [Henrik Mortensen]
-
-  *) Nested includes see environment variables of the including document,
-     for NCSA bug-compatibility (some sites have standard footer includes
-     which try to print out the last-modified date).  [Eric Hagberg/Robert
-     Thau]
-
-  *) <!--exec cgi="/some/uri/here"--> always treats the item named by the
-     URI as a CGI script, even if it would have been treated as something
-     else if requested directly, for NCSA back-compatibility.  (Note that
-     this means that people who know the name of the script can see the
-     code just by asking for it).  [Robert Thau]
-
-  *) New version of dbmmanage script included in support directory as
-     dbmmanage.new.
-
-  *) Check if scoreboard file couldn't be opened, and say so, rather
-     then going insane [David Robinson]
-
-  *) POST to CGI works on A/UX [Jim Jagielski]
-
-  *) AddIcon and AddAlt commands work properly [Rob Hartill]
-
-  *) NCSA server push works properly --- the Arena bug compatibility
-     workaround, which broke it, is gone (use -DARENA_BUG_WORKAROUND
-     if you still want the workaround).  [Rob Hartill]
-
-  *) If client didn't submit any Accept-encodings, ignore encodings in
-     content negotiation.  (NB this will all have to be reworked anyway
-     for the new HTTP draft).  [Florent Guillaume]
-
-  *) Don't dump core when trying to log timed-out requests [Jim Jagielski]
-
-  *) Really honor CacheNegotiatedDocs [Florent Guillaume]
-
-  *) Give Redirect priority over Alias, for NCSA bug compatibility
-     [David Robinson]
-
-  *) Correctly set PATH_TRANSLATED in all cases from <!--#exec cmd=""-->,
-     paralleling earlier bug fix for CGI [David Robinson]
-
-  *) If DBM auth is improperly configured, report a server error and don't
-     dump core.
-
-  *) Deleted FCNTL_SERIALIZED_ACCEPTS from conf.h entry for A/UX;
-     it seems to work well enough without it (even in a 10 hits/sec
-     workout), and the overhead for the locking under A/UX is
-     alarmingly high (though it is very low on other systems).
-     [Eric Hagberg, Jim Jagielski]
-
-  *) Fixed portability problems with mod_cookies.c [Cliff Skolnick]
-
-  *) Further de-Berklize mod_cookies.c; change the bogus #include.  [Brian
-     Behlendorf/Eric Hagberg]
-
-  *) More improvements to default Configuration for A/UX [Jim Jagielski]
-
-  *) Compiles clean on NEXT [Rob Hartill]
-
-  *) Compiles clean on SGI [Robert Thau]
-
-Changes with Apache 0.8.8                                        08 Aug 1995
-
-  *) SunOS library prototypes now never included unless explicitly
-     requested in the configuration (via -DSUNOS_LIB_PROTOTYPES);
-     people using GNU libc on SunOS are screwed by prototypes for the
-     standard library.
-
-     (Those who wish to compile clean with gcc -Wall on a standard
-     SunOS setup need the prototypes, and may obtain them using
-     -DSUNOS_LIB_PROTOTYPES.  Those wishing to use -Wall on a system
-     with nonstandard libraries are presumably competent to make their
-     own arrangements).
-
-  *) Strips trailing '/' characters off both args to the Alias command,
-     to make 'Alias /foo/ /bar/' work.
-
-Changes with Apache 0.8.7                                        03 Aug 1995
-
-  *) Don't hang when restarting with a child from 'TransferLog "|..."' running
-     [reported by David Robinson]
-
-  *) Compiles clean on OSF/1 [David Robinson]
-
-  *) Added some of the more recent significant changes (AddLanguage stuff,
-     experimental LogFormat support) to CHANGES file in distribution root
-     directory
-
-Changes with Apache 0.8.6                                        02 Aug 1995
-
-  *) Deleted Netscape reload workaround --- it's in violation of HTTP specs.
-     (If you actually wanted a conditional GET which bypassed the cache, you
-     couldn't get it). [Reported by Roy Fielding]
-
-  *) Properly terminate headers on '304 Not Modified' replies to conditional
-     GETs --- no browser we can find cares much, but the CERN proxy chokes.
-     [Reported by Cliff Skolnick; fix discovered independently by Rob Hartill]
-
-  *) httpd -v doesn't call itself "Shambhala".  [Reported by Chuck Murcko]
-
-  *) SunOS lib-function prototypes in conf.h conditionalized on __GNUC__,
-     not __SUNPRO_C (they're needed to quiet gcc -Wall, but acc chokes on 'em,
-     and older versions don't set the __SUNPRO_C preprocessor variable).  On
-     all other systems, these are never used anyway.  [Reported by Mark Cox].
-
-  *) Scoreboard file (/tmp/htstatus.*) no longer publically writable.
-
-Changes with Apache 0.8.5                                        01 Aug 1995
-
-  *) Added last-minute configurable log experiment, as optional module
-
-  *) Correctly set r->bytes_sent for HTTP/0.9 requests, so they get logged
-     properly.  (One-line fix to http_protocol.c).
-
-  *) Work around bogus behavior when reloading from Netscape.
-     It's Netscape's bug --- for some reason they expect a request with
-     If-modified-since: to not function as a conditional GET if it also
-     comes with Pragma: no-cache, which is way out of line with the HTTP
-     spec (according to Roy Fielding, the redactor).
-
-  *) Added parameter to set maximum number of server processes.
-
-  *) Added patches to make it work on A/UX.  A/UX is *weird*.  [Eric Hagberg,
-     Jim Jagielski]
-
-  *) IdentityCheck bugfix [Chuck Murcko].
-
-  *) Corrected cgi-src/Makefile entry for new imagemap script.  [Alexei Kosut]
-
-  *) More sample config file corrections; add extension to AddType for
-     *.asis, move AddType generic description to its proper place, and
-     fix miscellaneous typos. [ Alexei Kosut ]
-
-  *) Deleted the *other* reference to the regents from the Berkeley
-     legal disclaimer (everyplace).
-
-  *) Nuked Shambhala name from src/README; had already cleaned it out
-     of everywhere else.
-
-Changes with Apache 0.8.4
-
-  *) Changes to server-pool management parms --- renamed current
-     StartServers to MinSpareServers, created separate StartServers
-     parameter which means what it says, and renamed MaxServers to
-     MaxSpareServers (though the old name still works, for NCSA 1.4
-     back-compatibility).  The old names were generally regarded as
-     too confusing.  Also altered "docs" in sample config files.
-
-  *) More improvements to default config files ---
-     sample directives (commented out) for XBitHack, BindAddress,
-     CacheNegotiatedDocs, VirtualHost; decent set of AddLanguage
-     defaults, AddTypes for send-as-is and imagemap magic types, and
-     improvements to samples for DirectoryIndex [Alexei Kosut]
-
-  *) Yet more improvements to default config files --- changes to
-     Alexei's sample AddLanguage directives, and sample LanguagePriority
-     [ Florent Guillaume ]
-
-  *) Set config file locations properly if not set in httpd.conf
-     [ David Robinson ]
-
-  *) Don't escape URIs in internal redirects multiple times; don't
-     do that when translating PATH_INFO to PATH_TRANSLATED either.
-     [ David Robinson ]
-
-  *) Corrected spelling of "Required" in 401 error reports [Andrew Wilson]
-
-Changes with Apache 0.8.3
-
-  *) Edited distribution README to *briefly* summarize installation
-     procedures, and give a pointer to the INSTALL file in the src/
-     directory.
-
-  *) Upgraded imagemap script in cgi-bin to 1.8 version from more
-     recent NCSA distributions.
-
-  *) Bug fix to previous bug fix --- if .htaccess file and <Directory>
-     exist for the same directory, use both and don't segfault.  [Reported
-     by David Robinson]
-
-  *) Proper makefile dependencies [David Robinson]
-
-  *) Note (re)starts in error log --- reported by Rob Hartill.
-
-  *) Only call no2slash() after get_path_info() has been done, to
-     preserve multiple slashes in the PATH_INFO [NCSA compatibility,
-     reported by Andrew Wilson, though this one is probably a real bug]
-
-  *) Fixed mod_imap.c --- relative paths with base_uri referer don't
-     dump core when Referer is not supplied. [Randy Terbush]
-
-  *) Lightly edited sample config files to refer people to our documentation
-     instead of NCSA's, and to list Rob McCool as *original* author (also
-     deleted his old, and no doubt non-functional email address).  Would be
-     nice to have examples of new features...
-
-Changes with Apache 0.8.2                                        19 Jul 1995
-
-  *) Added AddLanuage code [Florent Guillaume]
-
-  *) Don't say "access forbidden" when a CGI script is not found.  [Mark Cox]
-
-  *) All sorts of problems when MultiViews finds a directory.  It would
-     be nice if mod_dir.c was robust enough to handle that, but for now,
-     just punt.  [reported by Brian Behlendorf]
-
-  *) Wait for all children on restart, to make sure that the old socket
-     is gone and we can reopen it.  [reported by Randy Terbush]
-
-  *) Imagemap module is enabled in default Configuration
-
-  *) RefererLog and UserAgentLog modules properly default the logfile
-     [Randy Terbush]
-
-  *) Mark Cox's mod_cookies added to the distribution as an optional
-     module (commented out in the default Configuration, and noted as
-     an experiment, along with mod_dld). [Mark Cox]
-
-  *) Compiles on ULTRIX (a continuing battle...). [Robert Thau]
-
-  *) Fixed nasty bug in SIGTERM handling [reported by Randy Terbush]
-
-  *) Changed "Shambhala" to "Apache" in API docs. [Robert Thau]
-
-  *) Added new, toothier legal disclaimer. [Robert Thau; copied from BSD
-     license]
-
-Changes with Apache 0.8.1
-
-  *) New imagemap module [Randy Terbush]
-
-  *) Replacement referer log module with NCSA-compatible RefererIgnore
-     [Matthew Gray again]
-
-  *) Don't mung directory listings with very long filenames.
-     [Florent Guillaume]
-
-Changes with Apache 0.8.0 (nee Shambhala 0.6.2)                  16 Jul 1995
-
-  *) New config script.  See INSTALL for info.  [Robert Thau]
-
-  *) Scoreboard mechanism for regulating the number of extant server
-     processes.  MaxServers and StartServers defaults are the same as
-     for NCSA, but the meanings are slightly different.  (Actually,
-     I should probably lower the MaxServers default to 10).
-
-     Before asking for a new connection, each server process checks
-     the number of other servers which are also waiting for a
-     connection.  If there are more than MaxServers, it quietly dies
-     off.  Conversely, every second, the root, or caretaker, process
-     looks to see how many servers are waiting for a new connection;
-     if there are fewer than StartServers, it starts a new one.  This
-     does not depend on the number of server processes already extant.
-     The accounting is arranged through a "scoreboard" file, named
-     /tmp/htstatus.*, on which each process has an independent file
-     descriptor (they need to seek without interference).
-
-     The end effect is that MaxServers is the maximum number of
-     servers on an *inactive* server machine, but more will be forked
-     off to handle unusually heavy loads (or unusually slow clients);
-     these will die off when they are no longer needed --- without
-     reverting to the overhead of full forking operation.  There is a
-     hard maximum of 150 server processes compiled in, largely to
-     avoid forking out of control and dragging the machine down.
-     (This is arguably too high).
-
-     In my server endurance tests, this mechanism did not appear to
-     impose any significant overhead, even after I forced it to put the
-     scoreboard file on a normal filesystem (which might have more
-     overhead than tmpfs).  [Robert Thau]
-
-  *) Set HTTP_FOO variables for SSI <!--#exec cmd-->s, not just CGI scripts.
-     [Cliff Skolnick]
-
-  *) Read .htaccess files even in directory with <Directory> section.
-     (Former incompatibility noted on mailing list, now fixed). [Robert
-     Thau]
-
-  *) "HEAD /" gives the client a "Bad Request" error message, rather
-     than trying to send no body *and* no headers.  [Cliff Skolnick].
-
-  *) Don't produce double error reports for some very obscure cases
-     mainly involving auth configuration (the "all modules decline to
-     handle" case which is a sure sign of a server bug in most cases,
-     but also happens when authentication is badly misconfigured).
-     [Robert Thau]
-
-  *) Moved FCNTL_SERIALIZED_ACCEPT defines into conf.h (that's what
-     it's *for*, and this sort of thing really shouldn't be cluttering
-     up the Makefile). [Robert Thau]
-
-  *) Incidental code cleanups in http_main.c --- stop dragging
-     sa_client around; just declare it where used.  [Robert Thau]
-
-  *) Another acc-related fix.  (It doesn't like const char
-     in some places...). [Mark Cox]
-
-Changes with Shambhala 0.6.1                                     13 Jul 1995
-
-  *) Fixed auth_name-related typos in http_core.c [Brian Behlendorf]
-     Also, fixed auth typo in http_protocol.c unmasked by this fix.
-
-  *) Compiles clean with acc on SunOS [Paul Sutton]
-
-  *) Reordered modules in modules.c so that Redirect takes priority
-     over ScriptAlias, for NCSA bug-compatibility [Rob Hartill] ---
-     believe it or not, he has an actual site with a ScriptAlias and
-     a Redirect declared for the *exact same directory*.  Even *my*
-     compatibility fetish wouldn't motivate me to fix this if the fix
-     required any effort, but it doesn't, so what the hey.
-
-  *) Fixed to properly default several server_rec fields for virtual
-     servers from the corresponding fields in the main server_rec.
-     [Cliff Skolnick --- 'port' was a particular irritant].
-
-  *) No longer kills off nph- child processes before they are
-     finished sending output. [Matthew Gray]
-
-Changes with Shambhala 0.6.0                                     10 Jul 1995
-
-  *) Two styles of timeout --- hard and soft.  soft_timeout()s just put
-     the connection to the client in an "aborted" state, but otherwise
-     allow whatever handlers are running to clean up.  hard_timeout()s
-     abort the request in progress completely; anything not tied to some
-     resource pool cleanup will leak.  They're still around because I
-     haven't yet come up with a more elegant way of handling
-     timeouts when talking to something that isn't the client.  The
-     default_handler and the dir_handler now use soft timeouts, largely
-     so I can test the feature.  [Robert Thau]
-
-  *) TransferLog "| my_postprocessor ..." seems to be there.  Note that
-     the case of log handlers dying prematurely is probably handled VERY
-     gracelessly at this point, and if the logger stops reading input,
-     the server will hang.  (It is known to correctly restart the
-     logging process on server restart; this is (should be!) going through
-     the same SIGTERM/pause/SIGKILL routine used to ding an errant CGI
-     script).  [Robert Thau]
-
-  *) asis files supported (new module).  [Robert Thau]
-
-  *) IdentityCheck code is compiled in, but has not been tested.  (I
-     don't know anyone who runs identd). [Robert Thau]
-
-  *) PATH_INFO and PATH_TRANSLATED are not set unless some real PATH_INFO
-     came in with the request, for NCSA bug-compatibility. [Robert Thau]
-
-  *) Don't leak the DIR * on HEAD request for a directory. [Robert Thau]
-
-  *) Deleted the block_alarms() stuff from dbm_auth; no longer necessary,
-     as timeouts are not in scope. [Robert Thau]
-
-  *) quoted-string args in config files now handled correctly (doesn't drop
-     the last character). [Robert Thau; reported by Randy Terbush]
-
-  *) Fixed silly typo in http_main.c which was suddenly fatal in HP-UX.
-     How the hell did it ever work? [Robert Thau; reported by Rob Hartill]
-
-  *) mod_core.c --- default_type returns DEFAULT_TYPE (the compile-time
-     default default type); the former default default behavior when all
-     type-checkers defaulted had been a core dump.  [Paul Sutton]
-
-  *) Copy filenames out of the struct dirent when indexing
-     directories.  (On Linux, readdir() returns a pointer to the same
-     memory area every time).  Fix is in mod_dir.c.  [Paul Sutton]
-
-Changes with Shambhala 0.5.3 [not released]
-
-  *) Default response handler notes "file not found" in the error log,
-     if the file was not found.  [Cliff Skolnick].
-
-  *) Another Cliff bug --- "GET /~user" now properly redirects (the userdir
-     code no longer sets up bogus PATH_INFO which fakes out the directory
-     handler). [Cliff Skolnick]
-
-Changes with Shambhala 0.5.2                                     06 Jul 1995
-
-  *) Changes to http_main.c --- root server no longer plays silly
-     games with SIGCHLD, and so now detects and replaces dying
-     children.  Child processes just die on SIGTERM, without taking
-     the whole process group with them.  Potential problem --- if any
-     child process refuses to die, we hang in restart.
-     MaxRequestsPerChild may still not work, but it certainly works
-     better than it did before this!  [Robert Thau]
-
-  *) mod_dir.c bug fixes: ReadmeName and HeaderName
-     work (or work better, at least); over-long description lines
-     properly terminated. [Mark Cox]
-
-  *) http_request.c now calls unescape_url() more places where it
-     should [Paul Sutton].
-
-  *) More directory handling bugs (reported by Cox)
-     Parent Directory link is now set correctly. [Robert Thau]
-
-Changes with Shambhala 0.5.1                                     04 Jul 1995
-
-  *) Generalized cleanup interface in alloc.c --- any function can be
-     registered with alloc.c as a cleanup for a resource pool;
-     tracking of files and file descriptors has been reimplemented in
-     terms of this interface, so I can give it some sort of a test.
-     [Robert Thau]
-
-  *) More changes in alloc.c --- new cleanup_for_exec() function,
-     which tracks down and closes all file descriptors which have been
-     registered with the alloc.c machinery before the server exec()s a
-     child process for CGI or <!--#exec-->.  CGI children now get
-     started with exactly three file descriptors open.  Hopefully,
-     this cures the problem Rob H. was having with overly persistent
-     CGI connections. [Robert Thau]
-
-  *) Mutual exclusion around the accept() in child_main() --- this is
-     required on at least SGI, Solaris and Linux, and is #ifdef'ed in
-     by default on those systems only (-DFCNTL_SERIALIZED_ACCEPT).
-     This uses fcntl(F_SETLK,...) on the error log descriptor because
-     flock() on that descriptor won't work on systems which have BSD
-     flock() semantics, including (I think) Linux 1.3 and Solaris.
-
-     This does work on SunOS (when the server is idle, only one
-     process in the pool is waiting on accept()); it *ought* to work
-     on the other systems. [Robert Thau]
-
-  *) FreeBSD and BSDI portability tweaks [Chuck Murcko]
-
-  *) sizeof(*sa_client) bugfix from [Rob Hartill]
-
-  *) pstrdup(..., NULL) returns NULL, [Randy Terbush]
-
-  *) block_alarms() to avoid leaking the DBM* in dbm auth (this should
-     be unnecessary if I go to the revised timeout-handling scheme).
-     [Robert Thau]
-
-  *) For NCSA bug-compatibility, set QUERY_STRING env var (to a null
-     string) even if none came in with the request.  [Robert Thau]
-
-  *) CHANGES file added to distribution ;-).
-
-Changes with Shambhala 0.4.5
-
-  *) mod_dld --- early dynamic loading support [rst]
-  *) Add wildcard content handlers for XBITHACK; default_hander now
-     invoked with that mechanism (as a handler hanging off mod_core) [rst]
-  *) XBITHACK supported as a wildcard content-handler, and 
-     configurable at run-time (not just at compile time, as in the
-     "patchy server" releases) [rst]
-
-Changes with Shambhala 0.4.4                                     30 Jun 1995
-
-  *) Fixed basic thinkos in mod_dbm_auth.c [rst, reported by Mark Cox]
-  *) Handle Addtype x/y .z [rst, reported by Cox]
-
-Changes with Shambhala 0.4.3
-
-  *) Fixed very dumb bug in mod_alias; "Alias" and "Redirect" are not
-     synonymous [rst, terbush]
-
-Changes with Shambhala 0.4.1                                     28 Jun 1995
-
-  *) First-cut virtual host implementation; some refit in the config
-     reading code, and log management, was necessary to support this [rst]
-  *) Sub-pool machinery, originally added to avoid excessive storage
-     allocation on listings of large directories (which turned out to
-     be the problem that the 0.3 storage accounting was added to
-     find).  Subrequests and mod_dir changed to use subpools.  [rst]
-  *) More memory debugging --- free list consistency checks. [rst]
-  *) Added err_headers to request_rec, with support elsewhere [rst]
-  *) Other fixes to minor bugs in mod_dir and mod_includes [rst, terbush]
-
-Changes with Shambhala 0.3                                       19 Jun 1995
-
-  *) Switch ONE_PROCESS to a runtime command-line option (-X)
-  *) Don't compile in mod_ai_backcompat by default
-  *) Switch name of server from Apache to Shambhala in Makefile
-  *) Add some accounting routines to track memory usage in the pools,
-     for debugging
-
-Changes with Shambhala 0.2
-
-  *) Set DOCUMENT_ROOT CGI variable
-  *) Add single-process debugging, as a compile-time option (ONE_PROCESS)
-  *) Add critical section protection to handling of cleanup structures 
-     in alloc.c [rst]
-  *) Significant code reorg within the server core to group related
-     functions together [rst]
-  *) Correctly handle clients that hang up before sending any request
-     [rst]
-  *) Replace dying child processes. [rst]
-
-Changes with Shambhala 0.1                                       12 Jun 1995
-
-   Major rewrite of the pre-existing "patchy server" codebase, by
-   Robert Thau (rst).  Significant portions of the server code, such
-   as configuration-file handling and HTTP authentication support,
-   were ripped out and rewritten from scratch.  Code that was not
-   completely rewritten was significantly altered.
-
-   Major changes with this release include:
-
-   *) Introduction of the module API; in request handling, the central 
-      machinery just dispatches to various modules, which actually do
-      most of the work.  Configuration handling is similar --- modules
-      declare their own commands, and the central machinery just
-      dispatches to them.  
-
-      API features from shambhala/0.1 were substantially unchanged in
-      Apache 1.0 and 1.1.  (1.0 API features not yet present in this
-      release, such as wildcard handlers and subpools, were added in
-      subsequent Shambhala releases, and were also generally rst's
-      work). 
-
-   *) This release included the following modules:
-
-      mod_access      (access control --- allow and deny directives),
-      mod_alias       (Alias and Redirect commands),
-      mod_auth        (straight HTTP authentication, based on flat-files)
-      mod_auth_dbm    (same, with dbm files)
-      mod_cgi         (CGI scripts and, in this release, ScriptAlias)
-      mod_common_log  (CLF access logs; later renamed mod_log_common)
-      mod_dir         (directory indexing)
-      mod_include     (server-side includes)
-      mod_mime        (AddType directives)
-      mod_negotiation (content negotiation)
-      mod_userdir     (support for users' public_html directories)
-
-      It also included a mod_ai_backcompat, which was a private hack
-      for back-compatibility with rst's own AI-lab servers.
-
-      All of these modules were substantially complete, and functional 
-      or nearly so (a few, which implemented features not in use at
-      Thau's site, required patches of a few lines).
-
-   *) sub-request machinery, to allow modules to determine how other
-      modules would assign MIME types to a given file, or optionally
-      serve its content (this is heavily used by mod_dir, mod_include
-      and mod_negotiation).
-
-   *) Resource pool system for keeping track of memory allocated and
-      files opened in service of a particular request.  Much of the
-      code in the modules (when they weren't rewrites) was adjusted to 
-      replace a pervasive convention of using fixed-size buffers on
-      the stack with an equally pervasive convention of using memory
-      allocated with palloc().
-
-   *) Reorganization of data structures associated with a given
-      request to eliminate use of global variables and the troublesome 
-      unmunge_name function (used in NCSA and early Apache releases to 
-      attempt to determine the URI which mapped to a given filename
-      --- a difficult proposition, given that it is easy to produce
-      setups in which multiple URIs map to the same file).
-
-   *) Source files renamed and rearranged
-
-   *) Very simple pre-forking behavior --- parent process forked off a 
-      fixed number of children, and then just waited for SIGHUP.
-
-   *) Other more minor changes too numerous to list.
-
-   This release included modified versions of a lot of code from the
-   Apache 0.6.4 public release, plus an early pre-forking patch
-   codeveloped by Robert Thau and Rob Hartill.
-
-Changes with Apache 0.7.3                                        20 Jun 1995
-
-   *) There were a bunch of changes between Apache 0.6.4 and 0.7.3 that
-      were incorporated by Rob Hartill on the main branch while Robert Thau
-      worked on the Shambhala rewrite above.  Most were merged into the
-      Shambala architecture after Apache 0.8.0.
-
-Changes with Apache 0.6.4                                        13 May 1995
-
-   *) Patches by Rob Hartill, Cliff Skolnick, Randy Terbush, Robert Thau,
-      and others.
-
-Changes with Apache 0.5.1                                        10 Apr 1995
-
-Changes with Apache 0.4                                          02 Apr 1995
-
-  *) Patches by Brian Behlendorf, Andrew Wilson, Robert Thau,
-     and Rob Hartill.
-
-Changes with Apache 0.3                                          24 Mar 1995
-
-  *) Patches by Robert Thau, David Robinson, Rob Hartill, and
-     Carlos Varela.
-
-Changes with Apache 0.2                                          18 Mar 1995
-
-  *) Based on NCSA httpd 1.3 by Rob McCool and patches by CERT,
-     Roy Fielding, Robert Thau, Nicolas Pioch, David Robinson,
-     Brian Behlendorf, Rob Hartill, and Cliff Skolnick.
diff --git a/INSTALL b/INSTALL
deleted file mode 100644
index ba598eb21252bc248d34c5361cc4c58e28a71628..0000000000000000000000000000000000000000
--- a/INSTALL
+++ /dev/null
@@ -1,449 +0,0 @@
-
-  APACHE INSTALLATION
-
-  Introduction
-  ============
-
-  Apache 2.0's configuration and installation environment has changed
-  completely from Apache 1.3.  Apache 1.3 used a custom set of scripts
-  to achieve easy installation.  Apache 2.0 now uses libtool and autoconf
-  to create an environment that looks like many other Open Source projects.
-
-
-  Installing the Apache 1.3 HTTP server with APACI
-  ================================================
-
-  1. Overview for the impatient
-     --------------------------
-
-     $ ./buildconf
-     $ ./configure --prefix=PREFIX
-     $ make
-     $ make install
-     $ PREFIX/bin/apachectl start
-
-     NOTE: PREFIX is not the string "PREFIX". Instead use the Unix
-           filesystem path under which Apache should be installed. For
-           instance use "/usr/local/apache" for PREFIX above.
-
-  2. Requirements
-     ------------
-
-     The following requirements exist for building Apache:
-
-     o  Disk Space: 
-
-        Make sure you have approximately 12 MB of temporary free disk space
-        available.  After installation Apache occupies approximately 5 MB of
-        disk space (the actual required disk space depends on the amount of
-        compiled in third party modules, etc).
-
-     o  ANSI-C Compiler: 
-
-        Make sure you have an ANSI-C compiler installed. The GNU C compiler
-        (GCC) from the Free Software Foundation (FSF) is recommended (version
-        2.7.2 is fine). If you don't have GCC then at least make sure your
-        vendors compiler is ANSI compliant. You can find the homepage of GNU
-        at http://www.gnu.org/ and the GCC distribution under
-        http://www.gnu.org/order/ftp.html .
-
-     o  Libtool 1.3.3:
-
-        Make sure that you have libtool 1.3.3 or later installed before
-        trying to configure and build Apache 2.0.  Libtool can be downloaded
-        from the Free Software Foundation (FSF), at 
-        http://www.gnu.org/order/ftp.html.
-
-     o  Autoconf 2.13:
-
-        Make sure that you have autoconf 2.13 or later installed before
-        trying to configure and build Apache 2.0.  Autoconf can be
-        downloaded from the Free Software Foundation (FSF), at
-        http://www.gnu.org/order/ftp.html.
-
-     o  Perl 5 Interpreter [OPTIONAL]:
-
-        For some of the support scripts like `apxs' or `dbmmanage' (which are
-        written in Perl) the Perl 5 interpreter is required (versions 5.003
-        and 5.004 are fine). If no such interpreter is found by APACI's
-        `configure' script this is no harm.  Of course, you still can build
-        and install Apache 1.3. Only those support scripts cannot be used. If
-        you have multiple Perl interpreters installed (perhaps a Perl 4 from
-        the vendor and a Perl 5 from your own), then it is recommended to use
-        the --with-perl option (see below) to make sure the correct one is
-        selected by APACI.
-
-     o  Dynamic Shared Object (DSO) support [OPTIONAL]:
-
-        To provide maximum flexibility Apache now is able to load modules
-        under runtime via the DSO mechanism by using the pragmatic
-        dlopen()/dlsym() system calls. These system calls are not available
-        under all operating systems therefore you cannot use the DSO mechanism
-        on all platforms. And Apache currently has only limited built-in
-        knowledge on how to compile shared objects because this is heavily
-        platform-dependent. The current state is this:
-
-        o Out-of-the-box supported platforms are (Not all of these will
-          work currently.  DSO support is currently available on most
-          of these platforms however):
-           - Linux     - SunOS         - UnixWare     - Darwin/Mac OS
-           - FreeBSD   - Solaris       - AIX          - OpenStep/Mach
-           - OpenBSD   - IRIX          - SCO          - DYNIX/ptx
-           - NetBSD    - HPUX          - ReliantUNIX
-           - BSDI      - Digital Unix  - DGUX
-
-        o Entirely unsupported platforms are:
-           - Ultrix
-
-        If your system is not on these lists but has the dlopen-style
-        interface, you either have to provide the appropriate compiler and
-        linker flags (see CFLAGS_SHLIB, LDFLAGS_SHLIB and LDFLAGS_SHLIB_EXPORT
-        below) manually or at least make sure a Perl 5 interpreter is
-        installed from which Apache can guess the options.
-
-  3. Configuring the source tree
-     ---------------------------
-
-     Setup:
- 
-     The first step in compiling Apache 2.0 is to setup the source tree so
-     that it can be built.  This is done by running:
- 
-     ./buildconf
-
-     This script ensures that all required programs are installed on the
-     currently machine, and creates the ./configure script.  If you are
-     using a package downloaded from apache.org then this step is not 
-     necessary.
-
-     Introduction:
-
-     The next step is to configure the Apache source tree for your particular
-     platform and personal requirements. The most important setup here is the
-     location prefix where Apache is to be installed later, because Apache has
-     to be configured for this location to work correctly. But there are a lot
-     of other options available for your pleasure.
-
-     For a short impression of what possibilities you have, here is a typical
-     example which compiles Apache for the installation tree /sw/pkg/apache
-     with a particular compiler and flags plus the two additional modules
-     mod_rewrite and mod_speling for later loading through the DSO mechanism: 
-
-     $ CC="pgcc" OPTIM="-O2" \
-       ./configure --prefix=/sw/pkg/apache \
-                   --enable-rewrite=shared \
-                   --enable-speling=shared
-
-     The easiest way to find all of the configuration flags for Apache 2.0
-     is to run ./configure --help.  What follows is a brief description of
-     most of the arguments.
-
-     Reference:
-
-     $ [CC=...]        [CFLAGS_SHLIB=...]           [TARGET=...]
-       [OPTIM=...]     [LD_SHLIB=...]
-       [CFLAGS=...]    [LDFLAGS_SHLIB=...]        
-       [INCLUDES=...]  [LDFLAGS_SHLIB_EXPORT=...] 
-       [LDFLAGS=...]   [RANLIB=...]  
-       [LIBS=...]      [DEPS=...]
-       ./configure
-           [--quiet]         [--prefix=DIR]            [--enable-NAME=(shared)]
-           [--verbose]       [--exec-prefix=PREFIX]    [--disable-NAME]
-           [--shadow[=DIR]]  [--bindir=EPREFIX]        [--with-mpm=NAME]
-           [--show-layout]   [--sbindir=DIR]           
-           [--help]          [--libexecdir=DIR]        
-                             [--mandir=DIR]            
-                             [--sysconfdir=DIR]        
-                             [--datadir=DIR]           
-                             [--includedir=DIR]        
-                             [--localstatedir=DIR]
-                             [--runtimedir=DIR]        [--enable-suexec]
-                             [--logfiledir=DIR]        [--suexec-caller=UID]
-                             [--proxycachedir=DIR]     [--suexec-docroot=DIR]
-                             [--with-layout=[FILE:]ID] [--suexec-logfile=FILE]
-                                                       [--suexec-userdir=DIR]
-                             [--with-perl=FILE]        [--suexec-uidmin=UID]
-                             [--without-support]       [--suexec-gidmin=GID]
-                             [--without-confadjust]    [--suexec-safepath=PATH]
-                             [--without-execstrip]
-			     [--server-uid=UID]        [--with-maintainter-mode]
-			     [--server-gid=GID]
-
-     Use the CC, OPTIM, CFLAGS, INCLUDES, LDFLAGS, LIBS, CFLAGS_SHLIB,
-     LD_SHLIB, LDFLAGS_SHLIB, LDFLAGS_SHLIB_EXPORT, RANLIB, DEPS and TARGET
-     environment variables to override the corresponding default entries in
-     the src/Configuration.tmpl file (see there for more information about
-     their usage).
-
-     Use the --prefix=PREFIX and --exec-prefix=EPREFIX options to configure
-     Apache to use a particular installation prefix. The default is
-     PREFIX=/usr/local/apache and EPREFIX=PREFIX.
-
-     Use the --bindir=DIR, --sbindir=DIR, --libexecdir=DIR, --mandir=DIR,
-     --sysconfdir=DIR, --datadir=DIR, --includedir=DIR, --localstatedir=DIR,
-     --runtimedir=DIR, --logfiledir=DIR and proxycachedir=DIR option to change
-     the paths for particular subdirectories of the installation tree.
-     Defaults are bindir=EPREFIX/bin, sbindir=EPREFIX/sbin,
-     libexecdir=EPREFIX/libexec, mandir=PREFIX/man, sysconfdir=PREFIX/etc,
-     datadir=PREFIX/share, includedir=PREFIX/include,
-     localstatedir=PREFIX/var, runtimedir=PREFIX/var/run,
-     logfiledir=PREFIX/var/log and proxycachedir=PREFIX/var/proxy.
-
-         Note: To reduce the pollution of shared installation locations
-               (like /usr/local/ or /etc) with Apache files to a minimum the
-               string ``/apache'' is automatically appended to 'libexecdir',
-               'sysconfdir', 'datadir', 'localstatedir' and 'includedir' if
-               (and only if) the following points apply for each path
-               individually:
-
-                   1. the path doesn't already contain the word ``apache''
-                   2. the path was not directly customized by the user
-
-               Keep in mind that per default these paths are derived from
-               'prefix' and 'exec-prefix', so usually its only a matter
-               whether these paths contain ``apache'' or not. Although the
-               defaults were defined with experience in mind you always should
-               make sure the paths fit your situation by checking the finally
-               chosen paths via the --layout option.
-
-     Use the --with-layout=[F:]ID option to select a particular installation
-     path base-layout. You always _HAVE_ to select a base-layout. There are
-     currently two layouts pre-defined in the file config.layout: `Apache' for
-     the classical Apache path layout and `GNU' for a path layout conforming
-     to the GNU `standards' document. When you want to use your own custom
-     layout FOO, either add a corresponding "<Layout FOO>...</Layout>" section
-     to config.layout and use --with-layout=FOO or place it into your own
-     file, say config.mypaths, and use --with-layout=config.mypaths:FOO.
- 
-     Use the --show-layout option to check the final installation path layout
-     while fiddling with the options above.
- 
-     Use the --enable-rule=NAME and --disable-rule=NAME options to enable or
-     disable a particular Rule from the Apache src/Configuration.tmpl file. The
-     defaults (yes=enabled, no=disabled) can either be seen when running
-     `./configure --help' or manually looked up in the src/Configuration.tmpl
-     file.
- 
-     Use the --enable-NAME=(shared) and --disable-NAME options to enable
-     or disable a particular already distributed module from the Apache
-     package.
-
-     Use the --with-mpm=NAME option to determine which MPM should be built
-     for your server.
-     _________________________________________________________________________
-     LIST OF AVAILABLE MODULES
-
-     Environment creation
-      (+) mod_env .......... Set environment variables for CGI/SSI scripts
-      (+) mod_setenvif ..... Set environment variables based on HTTP headers
-      (-) mod_unique_id .... Generate unique identifiers for request
-     Content type decisions
-      (+) mod_mime ......... Content type/encoding determination (configured)
-      (-) mod_mime_magic ... Content type/encoding determination (automatic)
-      (+) mod_negotiation .. Content selection based on the HTTP Accept* headers
-     URL mapping
-      (+) mod_alias ........ Simple   URL translation and redirection
-      (-) mod_rewrite ...... Advanced URL translation and redirection
-      (+) mod_userdir ...... Selection of resource directories by username
-      (-) mod_speling ...... Correction of misspelled URLs
-     Directory Handling
-      (+) mod_dir .......... Directory and directory default file handling
-      (+) mod_autoindex .... Automated directory index file generation
-     Access Control
-      (+) mod_access ....... Access Control (user, host, network)
-      (+) mod_auth ......... HTTP Basic Authentication (user, passwd)
-      (-) mod_auth_dbm ..... HTTP Basic Authentication via Unix NDBM files
-      (-) mod_auth_db ...... HTTP Basic Authentication via Berkeley-DB files
-      (-) mod_auth_anon .... HTTP Basic Authentication for Anonymous-style users
-      (-) mod_digest ....... HTTP Digest Authentication
-     HTTP response
-      (-) mod_headers ...... Arbitrary HTTP response headers (configured)
-      (-) mod_cern_meta .... Arbitrary HTTP response headers (CERN-style files)
-      (-) mod_expires ...... Expires HTTP responses 
-      (+) mod_asis ......... Raw HTTP responses 
-     Scripting
-      (+) mod_include ...... Server Side Includes (SSI) support
-      (+) mod_cgi .......... Common Gateway Interface (CGI) support
-      (+) mod_cgid ......... Common Gateway Interface (CGI) support for 
-                             multi-threaded MPMs
-      (+) mod_actions ...... Map CGI scripts to act as internal `handlers'
-     Internal Content Handlers
-      (+) mod_status ....... Content handler for server run-time status
-      (-) mod_info ......... Content handler for server configuration summary
-     Request Logging
-      (+) mod_log_config ... Customizable logging of requests
-      (-) mod_log_agent .... Specialized HTTP User-Agent logging (deprecated)
-      (-) mod_log_referer .. Specialized HTTP Referrer logging   (deprecated)
-      (-) mod_usertrack .... Logging of user click-trails via HTTP Cookies
-     Miscellaneous
-      (+) mod_imap ......... Server-side Image Map support
-      (-) mod_proxy ........ Caching Proxy Module (HTTP, HTTPS, FTP)
-      (-) mod_so ........... Dynamic Shared Object (DSO) bootstrapping
-     Experimental
-      (-) mod_mmap_static .. Caching of frequently served pages via mmap()
-     Development
-      (-) mod_example ...... Apache API demonstration (developers only)
-
-     MPMs
-          mpmt_pthread ..... Mutli-process(dynamic) Multi-threaded(static) 
-                             Unix MPM
-          prefork .......... Preforking Unix MPM
-          dexter ........... Multi-process(static) Multi-threaded(dynamic)
-                             Unix MPM
-          perchild ......... Multi-process(static) Multi-threaded(dynamic)
-                             Unix MPM, that allows a User per child process
-
-          winnt ............ Multi-process(1) Multi-threaded Windows MPM
-
-          mpmt_beos ........ Multi-process Multi-threaded Beos MPM
-          beos ............. Multi-process Multi-threaded Beos MPM
-
-          spmt_os2 ......... Single-process Multi-threaded OS/2 MPM
-     _________________________________________________________________________
-                    (+) = enabled  per default [disable with --disable-module]
-                    (-) = disabled per default [enable  with --enable-module ]
-
-     Use the --enable-suexec option to enable the suEXEC feature by building
-     and installing the "suexec" support program. Use --suexec-caller=UID to
-     set the allowed caller user id, --suexec-userdir=DIR to set the user
-     subdirectory, --suexec-docroot=DIR to set the suexec root directory,
-     --suexec-uidmin=UID/--suexec-gidmin=GID to set the minimal allowed
-     UID/GID, --suexec-logfile=FILE to set the logfile and
-     --suexec-safepath=PATH to set the safe shell PATH for the suEXEC
-     feature. At least one --suexec-xxxxx option has to be provided together
-     with the --enable-suexec option to let APACI accept your request for
-     using the suEXEC feature.
-
-     CAUTION: FOR DETAILS ABOUT THE SUEXEC FEATURE WE HIGHLY RECOMMEND YOU TO
-              FIRST READ THE DOCUMENT htdocs/manual/suexec.html BEFORE USING
-              THE ABOVE OPTIONS.
-     
-              USING THE SUEXEC FEATURE PROPERLY CAN REDUCE CONSIDERABLY THE
-              SECURITY RISKS INVOLVED WITH ALLOWING USERS TO DEVELOP AND RUN
-              PRIVATE CGI OR SSI PROGRAMS. HOWEVER, IF SUEXEC IS IMPROPERLY
-              CONFIGURED, IT CAN CAUSE ANY NUMBER OF PROBLEMS AND POSSIBLY
-              CREATE NEW HOLES IN YOUR COMPUTER'S SECURITY.  IF YOU AREN'T
-              FAMILIAR WITH MANAGING SETUID ROOT PROGRAMS AND THE SECURITY
-              ISSUES THEY PRESENT, WE HIGHLY RECOMMEND THAT YOU NOT CONSIDER
-              USING SUEXEC AND KEEP AWAY FROM THESE OPTIONS!
-
-     Use the --shadow option to let APACI create a shadow source tree of the
-     sources for building. This is useful when you want to build for different
-     platforms in parallel (usually through a NFS, AFS or DFS mounted
-     filesystem).  You may specify a directory to the --shadow option into
-     which the shadow tree will be created.
- 
-     Use the --quiet option to disable all configuration verbose messages.
- 
-     Use the --verbose option to enable additional verbose messages.
-     
-     Use the --server-uid option to specify the user ID you want the server to run
-     as. If not specified the server will run as user nobody.  If the user ID
-     specified is different than the ID of the user starting the server, you need to
-     start the server as root.
-
-     Use the --server-gid option to specify the group ID you want the server user ID to
-     be a member of.  If not specified, the group ID will be #-1.
-
-  4. Building the package
-     --------------------
-     
-     Now you can build the various parts which form the Apache package by
-     simply running the command
- 
-        $ make 
- 
-     Please be patient here, this takes approximately 2 minutes to complete
-     under a Pentium-166/FreeBSD-2.2 system, dependend on the amount of
-     modules you have enabled. 
- 
-  5. Installing the package
-     ----------------------
-     
-     Now its time to install the package under the configured installation
-     PREFIX (see --prefix option above) by running:
- 
-        $ make install
- 
-     For the paranoid hackers under us: The above command really installs under
-     prefix _only_, i.e. no other stuff from your system is touched. Even if
-     you upgrade an existing installation your configuration files in
-     PREFIX/etc/ are preserved.
-
-  6. Testing the package
-     -------------------
- 
-     Now you can fire up your Apache HTTP server by immediately running
- 
-        $ PREFIX/bin/apachectl start
- 
-     and then you should be able to request your first document via URL
-     http://localhost/ (when you built and installed Apache as root or at
-     least used the --without-confadjust option) or http://localhost:8080/
-     (when you built and installed Apache as a regular user). Then stop the
-     server again by running: 
-
-        $ PREFIX/bin/apachectl stop
- 
-  7. Customizing the package
-     -----------------------
- 
-     Finally you can customize your Apache HTTP server by editing the
-     configuration files under PREFIX/etc/.
- 
-        $ vi PREFIX/etc/httpd.conf
-        $ vi PREFIX/etc/access.conf
-        $ vi PREFIX/etc/srm.conf
- 
-     Have a look at the Apache manual under htdocs/manual/ or
-     http://www.apache.org/docs/ for a complete reference of available
-     configuration directives.
-
-  8. Preparing the system
-     --------------------
-
-     Proper operation of a public HTTP server requires at least the following:
-
-     1. A correctly working TCP/IP layer, since HTTP is implemented on top of
-        TCP/IP. Although modern Unix platforms have good networking layers,
-        always make sure you have all official vendor patches referring to the
-        network layer applied.
-
-     2. Accurate time keeping, since elements of the HTTP protocol are
-        expressed as the time of day.  So, it's time to investigate setting
-        some time synchronization facility on your system. Usually the ntpdate
-        or xntpd programs are used for this purpose which are based on the
-        Network Time Protocol (NTP). See the Usenet newsgroup
-        comp.protocols.time.ntp and the NTP homepage at
-        http://www.eecis.udel.edu/~ntp/ for more details about NTP software
-        and public time servers.
-
-  9. Contacts
-     --------
-
-     o If you want to be informed about new code releases, bug fixes, 
-       security fixes, general news and information about the Apache server
-       subscribe to the apache-announce mailing list as described under
-       http://www.apache.org/announcelist.html
-
-     o If you want freely available support for running Apache please join the
-       Apache user community by subscribing at least to the following USENET
-       newsgroup:
-       comp.infosystems.www.servers.unix
-
-     o If you want commercial support for running Apache please contact
-       one of the companies and contractors which are listed at
-       http://www.apache.org/info/support.cgi
-
-     o If you have a concrete bug report for Apache please go to the
-       Apache Group Bug Database and submit your report:
-       http://www.apache.org/bug_report.html
-
-     o If you want to participate in actively developing Apache please
-       subscribe to the `new-httpd' mailing list as described at
-       http://dev.apache.org/mailing-lists
-
-     Thanks for running Apache.
-                                          The Apache Group
-                                          http://www.apache.org/
-
diff --git a/InstallBin.dsp b/InstallBin.dsp
deleted file mode 100644
index cb5b7c67b9fbf9b4fb6ebad526b2316507808c10..0000000000000000000000000000000000000000
--- a/InstallBin.dsp
+++ /dev/null
@@ -1,96 +0,0 @@
-# Microsoft Developer Studio Project File - Name="InstallBin" - Package Owner=<4>
-# Microsoft Developer Studio Generated Build File, Format Version 5.00
-# ** DO NOT EDIT **
-
-# TARGTYPE "Win32 (x86) External Target" 0x0106
-
-CFG=InstallBin - Win32 Debug
-!MESSAGE This is not a valid makefile. To build this project using NMAKE,
-!MESSAGE use the Export Makefile command and run
-!MESSAGE 
-!MESSAGE NMAKE /f "InstallBin.mak".
-!MESSAGE 
-!MESSAGE You can specify a configuration when running NMAKE
-!MESSAGE by defining the macro CFG on the command line. For example:
-!MESSAGE 
-!MESSAGE NMAKE /f "InstallBin.mak" CFG="InstallBin - Win32 Debug"
-!MESSAGE 
-!MESSAGE Possible choices for configuration are:
-!MESSAGE 
-!MESSAGE "InstallBin - Win32 Release" (based on "Win32 (x86) External Target")
-!MESSAGE "InstallBin - Win32 Debug" (based on "Win32 (x86) External Target")
-!MESSAGE 
-
-# Begin Project
-# PROP Scc_ProjName ""
-# PROP Scc_LocalPath ""
-
-!IF  "$(CFG)" == "InstallBin - Win32 Release"
-
-# PROP BASE Use_Debug_Libraries 0
-# PROP BASE Output_Dir "Release"
-# PROP BASE Intermediate_Dir "Release"
-# PROP BASE Cmd_Line "NMAKE /f InstallBin.mak"
-# PROP BASE Rebuild_Opt "/a"
-# PROP BASE Target_File "InstallBin.exe"
-# PROP BASE Bsc_Name "InstallBin.bsc"
-# PROP BASE Target_Dir ""
-# PROP Use_Debug_Libraries 0
-# PROP Output_Dir "Release"
-# PROP Intermediate_Dir "Release"
-# PROP Cmd_Line "NMAKE /f makefile.win INSTDIR=.. SHORT=D LONG=Debug _install"
-# PROP Rebuild_Opt ""
-# PROP Target_File "..\Apache.exe"
-# PROP Bsc_Name ""
-# PROP Target_Dir ""
-
-!ELSEIF  "$(CFG)" == "InstallBin - Win32 Debug"
-
-# PROP BASE Use_Debug_Libraries 1
-# PROP BASE Output_Dir "Debug"
-# PROP BASE Intermediate_Dir "Debug"
-# PROP BASE Cmd_Line "NMAKE /f InstallBin.mak"
-# PROP BASE Rebuild_Opt "/a"
-# PROP BASE Target_File "InstallBin.exe"
-# PROP BASE Bsc_Name "InstallBin.bsc"
-# PROP BASE Target_Dir ""
-# PROP Use_Debug_Libraries 1
-# PROP Output_Dir "Debug"
-# PROP Intermediate_Dir "Debug"
-# PROP Cmd_Line "NMAKE /f makefile.win INSTDIR=.. SHORT=D LONG=Debug _install"
-# PROP Rebuild_Opt ""
-# PROP Target_File "..\Apache.exe"
-# PROP Bsc_Name ".\apache.bsc"
-# PROP Target_Dir ""
-
-!ENDIF 
-
-# Begin Target
-
-# Name "InstallBin - Win32 Release"
-# Name "InstallBin - Win32 Debug"
-
-!IF  "$(CFG)" == "InstallBin - Win32 Release"
-
-!ELSEIF  "$(CFG)" == "InstallBin - Win32 Debug"
-
-!ENDIF 
-
-# Begin Source File
-
-SOURCE=..\logs\access.log
-# End Source File
-# Begin Source File
-
-SOURCE=..\logs\error.log
-# End Source File
-# Begin Source File
-
-SOURCE=..\conf\httpd.conf
-# End Source File
-# Begin Source File
-
-SOURCE=.\Makefile.win
-# End Source File
-# End Target
-# End Project
diff --git a/LICENSE b/LICENSE
deleted file mode 100644
index 6ac6538b3ca330b9d558e42b73cf1af61070f310..0000000000000000000000000000000000000000
--- a/LICENSE
+++ /dev/null
@@ -1,59 +0,0 @@
-/* ====================================================================
- * Copyright (c) 1995-1999 The Apache Group.  All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * 1. Redistributions of source code must retain the above copyright
- *    notice, this list of conditions and the following disclaimer. 
- *
- * 2. Redistributions in binary form must reproduce the above copyright
- *    notice, this list of conditions and the following disclaimer in
- *    the documentation and/or other materials provided with the
- *    distribution.
- *
- * 3. All advertising materials mentioning features or use of this
- *    software must display the following acknowledgment:
- *    "This product includes software developed by the Apache Group
- *    for use in the Apache HTTP server project (http://www.apache.org/)."
- *
- * 4. The names "Apache Server" and "Apache Group" must not be used to
- *    endorse or promote products derived from this software without
- *    prior written permission. For written permission, please contact
- *    apache@apache.org.
- *
- * 5. Products derived from this software may not be called "Apache"
- *    nor may "Apache" appear in their names without prior written
- *    permission of the Apache Group.
- *
- * 6. Redistributions of any form whatsoever must retain the following
- *    acknowledgment:
- *    "This product includes software developed by the Apache Group
- *    for use in the Apache HTTP server project (http://www.apache.org/)."
- *
- * THIS SOFTWARE IS PROVIDED BY THE APACHE GROUP ``AS IS'' AND ANY
- * EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
- * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE APACHE GROUP OR
- * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
- * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
- * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
- * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
- * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
- * OF THE POSSIBILITY OF SUCH DAMAGE.
- * ====================================================================
- *
- * This software consists of voluntary contributions made by many
- * individuals on behalf of the Apache Group and was originally based
- * on public domain software written at the National Center for
- * Supercomputing Applications, University of Illinois, Urbana-Champaign.
- * For more information on the Apache Group and the Apache HTTP server
- * project, please see <http://www.apache.org/>.
- *
- */
-
-
-
diff --git a/Makefile.in b/Makefile.in
deleted file mode 100644
index 7892c08c008c8def7521f4622349fc123f30a36a..0000000000000000000000000000000000000000
--- a/Makefile.in
+++ /dev/null
@@ -1,73 +0,0 @@
-
-DEPTH     = .
-topsrcdir = @topsrcdir@
-srcdir    = @srcdir@
-VPATH     = @srcdir@
-
-SUBDIRS = ap lib main modules os $(REGEX_DIR)
-
-PROGRAM_NAME         = apache
-PROGRAM_SOURCES      = modules.c buildmark.c
-PROGRAM_LDADD        = $(EXTRA_LDFLAGS) $(PROGRAM_DEPENDENCIES) $(EXTRA_LIBS)
-PROGRAM_DEPENDENCIES = \
-  $(BUILTIN_LIBS) \
-  $(MPM_LIB) \
-  main/libmain.la \
-  $(OS_DIR)/libos.la \
-  ap/libap.la \
-  lib/apr/libapr.a \
-  $(REGEX_LIB)
-
-PROGRAMS        = $(PROGRAM_NAME)
-targets         = $(PROGRAMS)
-phony_targets   = buildmark.c
-install_targets = install-conf install-htdocs install-icons install-other \
-	install-cgi install-include
-
-include $(topsrcdir)/build/rules.mk
-include $(topsrcdir)/build/program.mk
-
-install-conf:
-	@echo Installing configuration files
-	@test -d $(sysconfdir) || $(mkinstalldirs) $(sysconfdir)
-	@cd $(srcdir)/../conf; \
-	for i in mime.types magic; do \
-		$(INSTALL_DATA) $$i $(sysconfdir); \
-	done; \
-	for i in *-dist; do \
-		sed -e 's#@@ServerRoot@@#$(prefix)#g' \
-			< $$i > $(sysconfdir)/$$i; \
-		chmod 0644 $(sysconfdir)/$$i; \
-		file=`echo $$i|sed s/-dist//`; \
-		if test "$$file" != "$$i" && test ! -f $(sysconfdir)/$$file; then \
-			$(INSTALL_DATA) $(sysconfdir)/$$i $(sysconfdir)/$$file; \
-		fi; \
-	done
-
-install-htdocs:
-	@echo Installing HTML documents
-	@test -d $(htdocsdir) || $(mkinstalldirs) $(htdocsdir)
-	@cp -rp $(srcdir)/../htdocs/* $(htdocsdir)
-
-install-icons:
-	@echo Installing icons
-	@test -d $(iconsdir) || $(mkinstalldirs) $(iconsdir)
-	@cp -rp $(srcdir)/../icons/* $(iconsdir)
-
-install-cgi:
-	@echo Installing CGIs
-	@test -d $(cgidir) || $(mkinstalldirs) $(cgidir)
-	@cp -rp $(srcdir)/../cgi-bin/* $(cgidir)
-	
-install-other:
-	@test -d $(logdir) || $(mkinstalldirs) $(logdir)
-
-install-include:
-	@echo Installing header files
-	@test -d $(includedir)     || $(mkinstalldirs) $(includedir)
-	@test -d $(includedir)/xml || $(mkinstalldirs) $(includedir)/xml
-	@test -d $(includedir)/apr || $(mkinstalldirs) $(includedir)/apr
-	@cp include/*.h $(srcdir)/include/*.h $(includedir)
-	@cp $(srcdir)/lib/expat-lite/*.h $(includedir)/xml
-	@cp lib/apr/include/*.h $(srcdir)/lib/apr/include/*.h $(includedir)/apr
-	@chmod 644 $(includedir)/*.h $(includedir)/xml/*.h $(includedir)/apr/*.h
diff --git a/Makefile.win b/Makefile.win
deleted file mode 100644
index 6e7bf6c5a393fbca976dd5ca394f746302515aab..0000000000000000000000000000000000000000
--- a/Makefile.win
+++ /dev/null
@@ -1,166 +0,0 @@
-# Makefile for Windows NT and Windows 95/98
-
-# Targets are:
-#   _apacher   - build Apache in Release mode
-#   _apached   - build Apache in Debug mode
-#   installr   - build and install a Release build
-#   installd   - build and install a Debug build
-#   clean      - remove (most) generated files
-#   _cleanr    - remove (most) files generated by a Release build
-#   _cleand    - remove (most) files generated by a Debug build
-#
-# The default installation directory is \Apache. This can be changed
-# with the INSTDIR macro, for example:
-#
-#   nmake /f Makefile.win INSTDIR="d:\Program Files\Apache" installr
-#
-# Note: this does *NOT* change the compiled in default "server root"
-
-!IF "$(INSTDIR)" == ""
-INSTDIR=\Apache
-!MESSAGE Using default install directory \Apache
-!ENDIF 
-
-default:        _apacher
-
-_apacher: 
-	$(MAKE) /f Makefile.win SHORT=R LONG=Release _build
-
-_apached: 
-	$(MAKE) /f Makefile.win SHORT=D LONG=Debug   _build
-
-installr: 
-	$(MAKE) /f Makefile.win SHORT=R LONG=Release _build _install
-
-installd: 
-	$(MAKE) /f Makefile.win SHORT=D LONG=Debug   _build _install
-
-_cleanr:  
-	$(MAKE) /f Makefile.win SHORT=R LONG=Release _clean
-
-_cleand:  
-	$(MAKE) /f Makefile.win SHORT=D LONG=Debug   _clean
-
-clean:
-	$(MAKE) /f Makefile.win _cleanr
-	$(MAKE) /f Makefile.win _cleand
-
-installdll:
-	$(MAKE) /f Makefile.win SHORT=R LONG=Release _installdll
-
-_build:
-	echo Building Win32 $(LONG) targets ($(SHORT) suffixes)
-	cd lib\apr
-	 nmake /nologo CFG="aprlib - Win32 $(LONG)" -f aprlib.mak
-	cd ..\..
-	cd os\win32
-	 nmake /nologo CFG="ApacheOS - Win32 $(LONG)" -f ApacheOS.mak
-	cd ..\..
-	cd regex
-	 nmake /nologo CFG="regex - Win32 $(LONG)" -f regex.mak
-	cd ..
-	cd ap
-	 nmake /nologo CFG="ap - Win32 $(LONG)" -f ap.mak
-	cd ..
-	cd support
-#        nmake /nologo CFG="htpasswd - Win32 $(LONG)" -f htpasswd.mak
-#        nmake /nologo CFG="htdigest - Win32 $(LONG)" -f htdigest.mak
-	 nmake /nologo CFG="rotatelogs - Win32 $(LONG)" -f rotatelogs.mak
-	cd ..
-	cd main
-	 nmake /nologo CFG="gen_uri_delims - Win32 $(LONG)" -f gen_uri_delims.mak
-	 nmake /nologo CFG="gen_test_char - Win32 $(LONG)" -f gen_test_char.mak
-	cd ..
-	 -del Core$(SHORT)\buildmark.obj
-	 nmake /nologo CFG="ApacheCore - Win32 $(LONG)" -f ApacheCore.mak
-	 nmake /nologo CFG="Apache - Win32 $(LONG)" -f Apache.mak
-	cd os\win32
-#        set CFG=ApacheModuleStatus - Win32 $(LONG)
-#        nmake /nologo CFG="ApacheModuleStatus - Win32 $(LONG)" -f ApacheModuleStatus.mak
-#        nmake /nologo CFG"=ApacheModuleInfo - Win32 $(LONG)" -f ApacheModuleInfo.mak
-	 nmake /nologo CFG="ApacheModuleAuthAnon - Win32 $(LONG)" -f ApacheModuleAuthAnon.mak
-	 nmake /nologo CFG="ApacheModuleDigest - Win32 $(LONG)" -f ApacheModuleDigest.mak
-	 nmake /nologo CFG="ApacheModuleCERNMeta - Win32 $(LONG)" -f ApacheModuleCERNMeta.mak
-	 nmake /nologo CFG="ApacheModuleExpires - Win32 $(LONG)" -f ApacheModuleExpires.mak
-	 nmake /nologo CFG="ApacheModuleHeaders - Win32 $(LONG)" -f ApacheModuleHeaders.mak
-	 nmake /nologo CFG="ApacheModuleSpeling - Win32 $(LONG)" -f ApacheModuleSpeling.mak
-	 nmake /nologo CFG="ApacheModuleUserTrack - Win32 $(LONG)" -f ApacheModuleUserTrack.mak
-#        nmake /nologo CFG="ApacheModuleRewrite - Win32 $(LONG)" -f ApacheModuleRewrite.mak
-	cd ..\..
-#       cd modules\proxy
-#        nmake /nologo CFG="ApacheModuleProxy - Win32 $(LONG)" -f ApacheModuleProxy.mak
-#       cd ..\..
-
-_install:
-	-mkdir $(INSTDIR)
-	-mkdir $(INSTDIR)\modules
-	-mkdir $(INSTDIR)\logs
-	-mkdir $(INSTDIR)\conf
-	-mkdir $(INSTDIR)\bin
-	copy Apache$(SHORT)\Apache.exe $(INSTDIR)
-	copy Core$(SHORT)\ApacheCore.dll $(INSTDIR)
-	copy lib\apr\$(LONG)\aprlib.dll $(INSTDIR)
-#       copy os\win32\ApacheModuleStatus$(SHORT)\ApacheModuleStatus.dll $(INSTDIR)\modules
-#       copy os\win32\ApacheModuleInfo$(SHORT)\ApacheModuleInfo.dll $(INSTDIR)\modules
-	copy os\win32\ApacheModuleAuthAnon$(SHORT)\ApacheModuleAuthAnon.dll $(INSTDIR)\modules
-	copy os\win32\ApacheModuleDigest$(SHORT)\ApacheModuleDigest.dll $(INSTDIR)\modules
-	copy os\win32\ApacheModuleCERNMeta$(SHORT)\ApacheModuleCERNMeta.dll $(INSTDIR)\modules
-	copy os\win32\ApacheModuleExpires$(SHORT)\ApacheModuleExpires.dll $(INSTDIR)\modules
-	copy os\win32\ApacheModuleHeaders$(SHORT)\ApacheModuleHeaders.dll $(INSTDIR)\modules
-#       copy os\win32\ApacheModuleRewrite$(SHORT)\ApacheModuleRewrite.dll $(INSTDIR)\modules
-	copy os\win32\ApacheModuleSpeling$(SHORT)\ApacheModuleSpeling.dll $(INSTDIR)\modules
-	copy os\win32\ApacheModuleUserTrack$(SHORT)\ApacheModuleUserTrack.dll $(INSTDIR)\modules
-#       copy modules\proxy\$(LONG)\ApacheModuleProxy.dll $(INSTDIR)\modules
-#       copy support\$(LONG)\htpasswd.exe $(INSTDIR)\bin
-#       copy support\$(LONG)\htdigest.exe $(INSTDIR)\bin
-	copy support\$(LONG)\rotatelogs.exe $(INSTDIR)\bin
-
-_clean:
-	cd lib\apr
-	 nmake /nologo CFG="aprlib - Win32 $(LONG)" -f aprlib.mak clean
-	cd ..\..
-	cd os\win32
-	 nmake /nologo CFG="ApacheOS - Win32 $(LONG)" -f ApacheOS.mak clean
-	cd ..\..
-	cd regex
-	 nmake /nologo CFG="regex - Win32 $(LONG)" -f regex.mak clean
-	cd ..
-        cd ap
-         nmake /nologo CFG="ap - Win32 $(LONG)" -f ap.mak clean
-        cd ..
-	cd support
-	 nmake /nologo CFG="htpasswd - Win32 $(LONG)" -f htpasswd.mak clean
-	 nmake /nologo CFG="htdigest - Win32 $(LONG)" -f htdigest.mak clean
-	 nmake /nologo CFG="rotatelogs - Win32 $(LONG)" -f rotatelogs.mak clean
-	cd ..
-	cd main
-	 nmake /nologo CFG="gen_uri_delims - Win32 $(LONG)" -f gen_uri_delims.mak clean
-	 del uri_delims.h
-	 nmake /nologo CFG="gen_test_char - Win32 $(LONG)" -f gen_test_char.mak clean
-	 del test_char.h
-	cd ..
-	 nmake /nologo CFG="ApacheCore - Win32 $(LONG)" -f ApacheCore.mak clean
-	 nmake /nologo CFG="Apache - Win32 $(LONG)" -f Apache.mak clean
-	cd os\win32
-#        nmake /nologo CFG="ApacheModuleStatus - Win32 $(LONG)" -f ApacheModuleStatus.mak clean
-#        nmake /nologo CFG="ApacheModuleInfo - Win32 $(LONG)" -f ApacheModuleInfo.mak clean
-	 nmake /nologo CFG="ApacheModuleAuthAnon - Win32 $(LONG)" -f ApacheModuleAuthAnon.mak clean
-	 nmake /nologo CFG="ApacheModuleDigest - Win32 $(LONG)" -f ApacheModuleDigest.mak clean
-	 nmake /nologo CFG="ApacheModuleCERNMeta - Win32 $(LONG)" -f ApacheModuleCERNMeta.mak clean
-	 nmake /nologo CFG="ApacheModuleExpires - Win32 $(LONG)" -f ApacheModuleExpires.mak clean
-	 nmake /nologo CFG="ApacheModuleHeaders - Win32 $(LONG)" -f ApacheModuleHeaders.mak clean
-	 nmake /nologo CFG="ApacheModuleSpeling - Win32 $(LONG)" -f ApacheModuleSpeling.mak clean
-	 nmake /nologo CFG="ApacheModuleUserTrack - Win32 $(LONG)" -f ApacheModuleUserTrack.mak clean
-#        nmake /nologo CFG="ApacheModuleRewrite - Win32 $(LONG)" -f ApacheModuleRewrite.mak clean
-	cd ..\..
-#       cd modules\proxy
-#        nmake /nologo CFG="ApacheModuleProxy - Win32 $(LONG)" -f ApacheModuleProxy.mak clean
-#       cd ..\..
-	cd os\win32\installer\installdll
-	 nmake /nologo CFG="install - Win32 $(LONG)" -f install.mak clean
-	cd ..\..\..
-
-_installdll:
-	cd os\win32\installer\installdll
-	 nmake /nologo CFG="install - Win32 $(LONG)" -f install.mak
-	cd ..\..\..
diff --git a/NWGNUmakefile b/NWGNUmakefile
deleted file mode 100644
index 39af31185e1d5919da9abd323364c25364e874e3..0000000000000000000000000000000000000000
--- a/NWGNUmakefile
+++ /dev/null
@@ -1,400 +0,0 @@
-#
-# Declare the sub-directories to be built here
-#
-
-SUBDIRS = \
-	srclib\apr \
-	build \
-	support \
-	modules \
-	$(EOLIST) 
-
-#
-# Get the 'head' of the build environment.  This includes default targets and
-# paths to tools
-#
-
-include $(AP_WORK)\build\NWGNUhead.inc
-
-#
-# build this level's files
-
-#
-# Make sure all needed macro's are defined
-#
-
-#
-# These directories will be at the beginning of the include list, followed by
-# INCDIRS
-#
-XINCDIRS	+= \
-			$(AP_WORK)/srclib/apr/include \
-			$(AP_WORK)/srclib/include/arch/NetWare \
-			$(AP_WORK)/srclib/apr-util/include \
-			$(AP_WORK)/include \
-			$(AP_WORK)/modules/filters/ \
-			$(AP_WORK)/modules/generators/ \
-			$(AP_WORK)/modules/http/ \
-			$(AP_WORK)/modules/loggers/ \
-			$(AP_WORK)/modules/mappers/ \
-			$(AP_WORK)/modules/proxy/ \
-			$(AP_WORK)/os/NetWare \
-			$(AP_WORK)/server/mpm/NetWare \
-			$(AP_WORK)/srclib/pcre \
-			$(NWOS) \
-			$(EOLIST)
-
-#
-# These flags will come after CFLAGS
-#
-XCFLAGS		+= \
-			$(EOLIST)
-
-#
-# These defines will come after DEFINES
-#
-XDEFINES	+= \
-			$(EOLIST)
-
-#
-# These flags will be added to the link.opt file
-#
-XLFLAGS		+= \
-			$(EOLIST)
-
-#
-# These values will be appended to the correct variables based on the value of
-# RELEASE
-#
-ifeq "$(RELEASE)" "debug"
-XINCDIRS	+= \
-			$(EOLIST)
-
-XCFLAGS		+= \
-			$(EOLIST)
-
-XDEFINES	+= \
-			$(EOLIST)
-
-XLFLAGS		+= \
-		   	$(EOLIST)
-endif
-
-ifeq "$(RELEASE)" "noopt"
-XINCDIRS	+= \
-			$(EOLIST)
-
-XCFLAGS		+= \
-			$(EOLIST)
-
-XDEFINES	+= \
-			$(EOLIST)
-
-XLFLAGS		+= \
-		   	$(EOLIST)
-endif
-
-ifeq "$(RELEASE)" "release"
-XINCDIRS	+= \
-			$(EOLIST)
-
-XCFLAGS		+= \
-			$(EOLIST)
-
-XDEFINES	+= \
-			$(EOLIST)
-
-XLFLAGS		+= \
-			$(EOLIST)
-endif
-
-#
-# These are used by the link target if an NLM is being generated
-# This is used by the link 'name' directive to name the nlm.  If left blank
-# TARGET_nlm (see below) will be used.
-#
-NLM_NAME		= Apache2
-
-#
-# This is used by the link '-desc ' directive. 
-# If left blank, NLM_NAME will be used.
-#
-NLM_DESCRIPTION	= Apache Web Server 
-
-#
-# This is used by the '-threadname' directive.  If left blank,
-# NLM_NAME Thread will be used.
-#
-NLM_THREAD_NAME	= Apache
-#
-# If this is specified, it will override VERSION value in 
-# $(AP_WORK)\build\NWGNUenvironment.inc
-#
-NLM_VERSION		=
-
-#
-# If this is specified, it will override the default of 64K
-#
-NLM_STACK_SIZE	= 65536
- 
-
-#
-# If this is specified it will be used by the link '-entry' directive
-#
-NLM_ENTRY_SYM	= _LibCPrelude
-
-#
-# If this is specified it will be used by the link '-exit' directive
-#
-NLM_EXIT_SYM	= _LibCPostlude
-
-#
-# If this is specified it will be used by the link '-check' directive
-#
-NLM_CHECK_SYM	= _LibCCheckUnload
-
-#
-# If these are specified it will be used by the link '-flags' directive
-#
-NLM_FLAGS		=  PSEUDOPREEMPTION
-
-#
-# If this is specified it will be linked in with the XDCData option in the def 
-# file instead of the default of $(NWOS)/apache.xdc.  XDCData can be disabled
-# by setting APACHE_UNIPROC in the environment
-#
-XDCDATA         = 
-
-#
-# If there is an NLM target, put it here
-#
-TARGET_nlm = \
-	$(OBJDIR)/Apache2.nlm \
-	$(EOLIST)
-
-#
-# If there is an LIB target, put it here
-#
-TARGET_lib = \
-	$(EOLIST)
-
-#
-# These are the OBJ files needed to create the NLM target above.
-# Paths must all use the '/' character
-#
-FILES_nlm_objs = \
-	$(OBJDIR)/buildmark.o \
-	$(OBJDIR)/config.o \
-	$(OBJDIR)/connection.o \
-	$(OBJDIR)/core.o \
-	$(OBJDIR)/error_bucket.o \
-	$(OBJDIR)/http_core.o \
-	$(OBJDIR)/http_protocol.o \
-	$(OBJDIR)/http_request.o \
-	$(OBJDIR)/listen.o \
-	$(OBJDIR)/log.o \
-	$(OBJDIR)/main.o \
-	$(OBJDIR)/mod_access.o \
-	$(OBJDIR)/mod_actions.o \
-	$(OBJDIR)/mod_alias.o \
-	$(OBJDIR)/mod_asis.o \
-	$(OBJDIR)/mod_auth.o \
-	$(OBJDIR)/mod_autoindex.o \
-	$(OBJDIR)/mod_dir.o \
-	$(OBJDIR)/mod_env.o \
-	$(OBJDIR)/mod_imap.o \
-	$(OBJDIR)/mod_include.o \
-	$(OBJDIR)/mod_log_config.o \
-	$(OBJDIR)/mod_mime.o \
-	$(OBJDIR)/mod_negotiation.o \
-	$(OBJDIR)/mod_nw_ssl.o \
-	$(OBJDIR)/mod_setenvif.o \
-	$(OBJDIR)/mod_so.o \
-	$(OBJDIR)/mod_userdir.o \
-	$(OBJDIR)/modules.o \
-	$(OBJDIR)/mpm_common.o \
-	$(OBJDIR)/mpm_netware.o \
-	$(OBJDIR)/pcre.o \
-	$(OBJDIR)/pcreposix.o \
-	$(OBJDIR)/protocol.o \
-	$(OBJDIR)/request.o \
-	$(OBJDIR)/rfc1413.o \
-	$(OBJDIR)/scoreboard.o \
-	$(OBJDIR)/util.o \
-	$(OBJDIR)/util_cfgtree.o \
-	$(OBJDIR)/util_charset.o \
-	$(OBJDIR)/util_filter.o \
-	$(OBJDIR)/util_md5.o \
-	$(OBJDIR)/util_nw.o \
-	$(OBJDIR)/util_script.o \
-	$(OBJDIR)/util_time.o \
-	$(OBJDIR)/util_xml.o \
-	$(OBJDIR)/vhost.o \
-	$(EOLIST)
-
-#
-# These are the LIB files needed to create the NLM target above.
-# These will be added as a library command in the link.opt file.
-#
-FILES_nlm_libs = \
-   	libcpre.o \
-	$(EOLIST)
-
-#
-# These are the modules that the above NLM target depends on to load.
-# These will be added as a module command in the link.opt file.
-#
-FILES_nlm_modules = \
-	aprlib \
-	Libc \
-	$(EOLIST)
-
-#
-# If the nlm has a msg file, put it's path here
-#
-FILE_nlm_msg =
- 
-#
-# If the nlm has a hlp file put it's path here
-#
-FILE_nlm_hlp =
-
-#
-# If this is specified, it will override $(NWOS)\copyright.txt.
-#
-FILE_nlm_copyright =
-
-#
-# Any additional imports go here
-#
-FILES_nlm_Ximports = \
-	@netware.imp \
-	@$(APR)/aprlib.imp \
-	@libc.imp \
-	@ws2nlm.imp \
-	GetCurrentAddressSpace \
-	$(EOLIST)
- 
-#   
-# Any symbols exported to here
-#
-FILES_nlm_exports = \
-	@$(NWOS)/httpd.imp \
-	$(EOLIST)
-	
-#   
-# These are the OBJ files needed to create the LIB target above.
-# Paths must all use the '/' character
-#
-FILES_lib_objs = \
-		$(EOLIST)
-
-#
-# implement targets and dependancies (leave this section alone)
-#
-
-libs :: $(OBJDIR) $(TARGET_lib)
-
-nlms :: libs $(TARGET_nlm)
-
-#
-# Updated this target to create necessary directories and copy files to the 
-# correct place.  (See $(AP_WORK)\build\NWGNUhead.inc for examples)
-#
-install :: nlms FORCE
-	copy $(OBJDIR)\Apache2.nlm $(INSTALL)\Apache2\*.*
-	-copy ABOUT_APACHE              $(INSTALL)\Apache2\*.*
-	-copy README                    $(INSTALL)\Apache2\*.*
-	-copy STATUS                    $(INSTALL)\Apache2\*.*
-	-copy LICENSE                   $(INSTALL)\Apache2\*.*
-	-copy docs\cgi-examples\*.      $(INSTALL)\Apache2\cgi-examples\*.*
-	-copy docs\conf\httpd-std.conf  $(INSTALL)\Apache2\conf\httpd.conf
-	-copy docs\conf\magic           $(INSTALL)\Apache2\conf\magic
-	-copy docs\conf\mime.types      $(INSTALL)\Apache2\conf\mime.types
-	-copy docs\error\*.*            $(INSTALL)\Apache2\error\*.*
-	-copy docs\error\include\*.*    $(INSTALL)\Apache2\error\include\*.*
-	-copy docs\docroot\*.*          $(INSTALL)\Apache2\htdocs\*.*
-	-copy docs\icons\*.*            $(INSTALL)\Apache2\icons\*.*
-	-copy docs\icons\small\*.*      $(INSTALL)\Apache2\icons\small\*.*
-	-copy docs\man\*.*              $(INSTALL)\Apache2\man\*.*
-	-copy docs\manual\*.*           $(INSTALL)\Apache2\manual\*.*
-	-copy docs\manual\developer\*.* $(INSTALL)\Apache2\manual\developer
-	-copy docs\manual\faq\*.*       $(INSTALL)\Apache2\manual\faq
-	-copy docs\manual\howto\*.*     $(INSTALL)\Apache2\manual\howto
-	-copy docs\manual\images\*.*    $(INSTALL)\Apache2\manual\images
-	-copy docs\manual\misc\*.*      $(INSTALL)\Apache2\manual\misc
-	-copy docs\manual\mod\*.*       $(INSTALL)\Apache2\manual\mod
-	-copy docs\manual\platform\*.*  $(INSTALL)\Apache2\manual\platform
-	-copy docs\manual\programs\*.*  $(INSTALL)\Apache2\manual\programs
-	-copy docs\manual\search\*.*    $(INSTALL)\Apache2\manual\search
-	-copy docs\manual\vhosts\*.*    $(INSTALL)\Apache2\manual\vhosts
-    
-installdev :: FORCE
-	-copy $(subst /,\,$(AP_WORK))\include\*.h           $(INSTALL)\Apache2\include\*.*
-	-copy $(subst /,\,$(AP_WORK))\os\netware\*.h        $(INSTALL)\Apache2\include\*.*
-	-copy $(subst /,\,$(NWOS))\include\*.h              $(INSTALL)\Apache2\include\*.*
-	-copy $(subst /,\,$(NWOS))\*.imp                    $(INSTALL)\Apache2\lib\*.*
-	-copy $(subst /,\,$(APR))\include\*.h               $(INSTALL)\Apache2\include\*.*
-	-copy $(subst /,\,$(APR))\arch\netware\include\*.h  $(INSTALL)\Apache2\include\*.*
-	-copy $(subst /,\,$(APRUTIL))\include\*.h           $(INSTALL)\Apache2\include\*.*
-	-copy $(subst /,\,$(APR))\*.imp                     $(INSTALL)\Apache2\lib\*.*
-    
-#
-# Any specialized rules here
-#
-
-$(OBJDIR)/%.o: server/%.c $(OBJDIR)\cc.opt
-	@echo compiling $<
-	$(CC) $< -o=$(OBJDIR)\$(@F) @$(OBJDIR)\cc.opt
-
-$(OBJDIR)/%.o: modules/arch/netware/%.c $(OBJDIR)\cc.opt
-	@echo compiling $<
-	$(CC) $< -o=$(OBJDIR)\$(@F) @$(OBJDIR)\cc.opt
-
-$(OBJDIR)/%.o: modules/http/%.c $(OBJDIR)\cc.opt
-	@echo compiling $<
-	$(CC) $< -o=$(OBJDIR)\$(@F) @$(OBJDIR)\cc.opt
-
-$(OBJDIR)/%.o: modules/aaa/%.c $(OBJDIR)\cc.opt
-	@echo compiling $<
-	$(CC) $< -o=$(OBJDIR)\$(@F) @$(OBJDIR)\cc.opt
-
-$(OBJDIR)/%.o: modules/mappers/%.c $(OBJDIR)\cc.opt
-	@echo compiling $<
-	$(CC) $< -o=$(OBJDIR)\$(@F) @$(OBJDIR)\cc.opt
-
-$(OBJDIR)/%.o: modules/generators/%.c $(OBJDIR)\cc.opt
-	@echo compiling $<
-	$(CC) $< -o=$(OBJDIR)\$(@F) @$(OBJDIR)\cc.opt
-
-$(OBJDIR)/%.o: modules/metadata/%.c $(OBJDIR)\cc.opt
-	@echo compiling $<
-	$(CC) $< -o=$(OBJDIR)\$(@F) @$(OBJDIR)\cc.opt
-
-$(OBJDIR)/%.o: modules/filters/%.c $(OBJDIR)\cc.opt
-	@echo compiling $<
-	$(CC) $< -o=$(OBJDIR)\$(@F) @$(OBJDIR)\cc.opt
-
-$(OBJDIR)/%.o: modules/loggers/%.c $(OBJDIR)\cc.opt
-	@echo compiling $<
-	$(CC) $< -o=$(OBJDIR)\$(@F) @$(OBJDIR)\cc.opt
-
-$(OBJDIR)/%.o: os/netware/%.c $(OBJDIR)\cc.opt
-	@echo compiling $<
-	$(CC) $< -o=$(OBJDIR)\$(@F) @$(OBJDIR)\cc.opt
-
-$(OBJDIR)/%.o: server/mpm/netware/%.c $(OBJDIR)\cc.opt
-	@echo compiling $<
-	$(CC) $< -o=$(OBJDIR)\$(@F) @$(OBJDIR)\cc.opt
-
-$(OBJDIR)/%.o: srclib/pcre/%.c $(OBJDIR)\cc.opt
-	@echo compiling $<
-	$(CC) $< -o=$(OBJDIR)\$(@F) @$(OBJDIR)\cc.opt
-
-#
-# Include the 'tail' makefile that has targets that depend on variables defined
-# in this makefile
-#
-
-include $(AP_WORK)\build\NWGNUtail.inc
-
diff --git a/README b/README
deleted file mode 100644
index 679b207b3534714c745598dd0b506bf61099090c..0000000000000000000000000000000000000000
--- a/README
+++ /dev/null
@@ -1,72 +0,0 @@
-
-                                 Apache
-                             Version 1.3 (and up)
-
-  What is it?
-  -----------
-
-  Apache is an HTTP server designed as a plug-in replacement for
-  the NCSA server version 1.3 (or 1.4). It fixes numerous bugs in
-  the NCSA server and includes many frequently requested new
-  features, and has an API which allows it to be extended to meet
-  users' needs more easily.
-
-  The Latest Version
-  ------------------
-
-  Details of the latest version can be found on the Apache HTTP
-  server project page under http://httpd.apache.org/.
-
-  Documentation
-  -------------
-
-  The documentation available as of the date of this release is
-  also included, in HTML format, in the htdocs/manual/ directory.
-  For the most up-to-date documentation can be found on
-  http://httpd.apache.org/docs/.
-
-  Installation
-  ------------
-
-  Apache 2.0 uses autoconf for configuration and installation.  To use
-  Apache's autoconf script, you will need libtool 1.3.3 or higher, and
-  autoconf 2.13 or newer.
-
-  To configure Apache 2.0 run the following commands.
-
-  ./buildconf
-  ./configure [autoconf arguments] [apache arguments]
-  make
-  make install
-  
-  The buildconf script is very important.  Just running autoconf will not
-  leave the directory tree in a usable state.
-
-  Licensing
-  ---------
-
-  Please see the file called LICENSE.
-
-  Acknowledgments
-  ----------------
-
-  We wish to acknowledge the following copyrighted works that
-  make up portions of the Apache software:
-
-  Portions of this software were developed at the National Center
-  for Supercomputing Applications (NCSA) at the University of
-  Illinois at Urbana-Champaign.
-
-  This software contains code derived from the RSA Data Security
-  Inc. MD5 Message-Digest Algorithm, including various
-  modifications by Spyglass Inc., Carnegie Mellon University, and
-  Bell Communications Research, Inc (Bellcore).
-
-  This package contains software written and copyrighted by Henry
-  Spencer.  Please see the file called src/regex/COPYRIGHT. 
-
-  The NT port was started with code provided to the Apache Group
-  by Ambarish Malpani of ValiCert, Inc. (http://www.valicert.com/).
-
-  Apache 2.0 relies heavily on the use of autoconf and libtool to provide
-  a build environment.
diff --git a/ROADMAP b/ROADMAP
deleted file mode 100644
index cd45d6d5b587f965658d7b67dd1ff46da1648175..0000000000000000000000000000000000000000
--- a/ROADMAP
+++ /dev/null
@@ -1,39 +0,0 @@
-APACHE 2.1+ ROADMAP:
-
-Last modified at [$Date: 2001/11/27 05:19:39 $]
-
-DEFERRRED FOR APACHE 2.1
-
-    * Source code should follow style guidelines.
-      OK, we all agree pretty code is good.  Probably best to clean this
-      up by hand immediately upon branching a 2.1 tree.
-      Justin's voulenteered to hand-edit the entire source tree ;)
-
-    * revamp the input filter syntax to provide for ordering of
-      filters created with the Set{Input|Output}Filter and the
-      Add{Input|Output}Filter directives.  A 'relative to filterx' 
-      syntax is definately preferable, but not realistic for 2.0.
-
-    * Platforms that do not support fork (primarily Win32 and AS/400)
-      Architect start-up code that avoids initializing all the modules 
-      in the parent process on platforms that do not support fork.
-      Better yet - not only inform the startup of which phase it's in,
-      but allow the parent 'process' to initialize shared memory, etc,
-      and create a module-by-module stream to pass to the child, so the
-      parent can actually arbitrate the important stuff.
-
-    * Replace stat [deferred open] with open/fstat in directory_walk.
-      Justin, Ian, OtherBill all interested in this.  Implies setting up
-      the apr_file_t member in request_rec, and having all modules use
-      that file, and allow the cleanup to close it [if it isn't a shared,
-      cached file handle.]
-
-    * Refactor auth into auth protocols and auth database stores.
-      Many interested hackers, too destabilizing for 2.0 inclusion.
-
-DEFERRRED FOR APACHE 3.0
-
-    * The Async Apache Server implemented in terms of APR.
-      [Bill Stoddard's pet project.]
-
-    
diff --git a/STATUS b/STATUS
deleted file mode 100644
index 114c3cad34a2818b1ca2e2d893bea30660a3ea91..0000000000000000000000000000000000000000
--- a/STATUS
+++ /dev/null
@@ -1,96 +0,0 @@
-Apache 2.0 STATUS:
-Last modified at [$Date: 1999/08/27 18:57:17 $]
-
-Release:
-
-    2.0: In pre-alpha development
-
-Plan:
-
-    * Vague goal of an alpha or beta release in 1999. Commit-then-review
-      is active.
-
-RELEASE SHOWSTOPPERS:
-
-    * CGI doesn't work
-        Status: Ben Laurie is working on this.
-
-    * mod_status doesn't work
-        Status: Manoj Kasichainula <manojk@io.com> is working on this. A
-        patch has been posted that starts to fix this:
-        (<19990825025653.A19065@samosa.mindspring.com> and
-        <19990825022146.A10096@io.com>)
-
-    * suEXEC doesn't work
-        Ben Laurie's work to fix CGIs will also fix this.
-
-    * Windows NT port isn't done
-        Status: Bill is working on this through his MPM work, and Ryan
-        is with APR.
-
-    * Current 2.0 code is not tested on many Unix platforms. Make 2.0
-      work on most, if not all the systems 1.3 did
-
-        Status: Autoconf and APR will get us most of the way there.
-
-    * The module API is a weird combination of the old table and the new
-      hook system. Switch completely to the new hook system
-        Status: Ben Laurie is working on this.
-
-RELEASE NON-SHOWSTOPPERS BUT WOULD BE REAL NICE TO WRAP THESE UP:
-
-    (none listed)
-
-Other bugs that need fixing:
-
-    * MaxRequestsPerChild measures connections, not requests.
-    
-    * Regex containers don't work in an intutive way
-        Status: No one has come up with an efficient way to fix this
-        behavior. Dean has suggested getting rid of regex containers
-        completely.
-
-Other features that need writing:
-
-    * Switch to autoconf, et al. for configuration.
-
-    * Use APR to get rid of more platform dependancies.
-        Status: Ryan Bloom <rbb@raleigh.ibm.com> is working on this.
-
-    * Finish infrastructure in core for async MPMs
-        Status: ?
-
-    * Work on other MPMs. Possible MPMs discussed or in progress include:
-
-      - David Reid's <abb37@dial.pipex.com> Beos MPM
-          Status: in progress
-
-      - Dean Gaudet's async MPM
-          Status: ?
-
-      - Zach Brown's <zab@zabbo.net> Linux siginfo MPM
-          Status: ?
-
-Documentation that needs writing:
-
-    * The concept of MPMs, especially if we ship more than one MPM for a
-      given platform
-
-    * New directives in the various MPMs
-
-    * API documentation
-        Status: Ben Laurie has written some hooks documentation
-        (apache-2.0/htdocs/hooks.html)
-
-Available Patches:
-
-   * Mike Abbott's <mja@trudge.engr.sgi.com> patches to improve
-     performance
-       Status: These were written for 1.3, and are awaiting a port to
-       2.0
-
-Open issues:
-
-   * What do we do about mod_proxy?
-
-   * Which MPMs will be included with Apache 2.0?
diff --git a/acinclude.m4 b/acinclude.m4
deleted file mode 100644
index aa97f724ae445a87e9dda545f295a305a3eee660..0000000000000000000000000000000000000000
--- a/acinclude.m4
+++ /dev/null
@@ -1,59 +0,0 @@
-dnl
-dnl APACHE_MODULE(modname [, shared])
-dnl
-dnl Includes an extension in the build.
-dnl
-dnl "modname" is the name of the modules/ subdir where the extension resides
-dnl "shared" can be set to "shared" or "yes" to build the extension as
-dnl a dynamically loadable library.
-dnl
-AC_DEFUN(APACHE_MODULE,[
-  if test -d "$cwd/$srcdir/modules/$1" ; then
-    MOD_SUBDIRS="$MOD_SUBDIRS $1"
-    if test "$2" != "shared" -a "$2" != "yes"; then
-      libname=$(basename $1)
-      _extlib="lib${libname}.a"
-      MOD_LTLIBS="$MOD_LTLIBS modules/$1/lib${libname}.la"
-      MOD_LIBS="$MOD_LIBS $1/$_extlib"
-      MOD_STATIC="$MOD_STATIC $1"
-    else
-      MOD_SHARED="$MOD_SHARED $1"
-    fi
-    APACHE_OUTPUT(modules/$1/Makefile)
-  fi
-])
-
-AC_SUBST(MOD_LTLIBS)
-
-dnl ## APACHE_OUTPUT(file)
-dnl ## adds "file" to the list of files generated by AC_OUTPUT
-dnl ## This macro can be used several times.
-AC_DEFUN(APACHE_OUTPUT, [
-  APACHE_OUTPUT_FILES="$APACHE_OUTPUT_FILES $1"
-])
-
-dnl
-dnl AC_ADD_LIBRARY(library)
-dnl
-dnl add a library to the link line
-dnl
-AC_DEFUN(AC_ADD_LIBRARY,[
-  APACHE_ONCE(LIBRARY, $1, [
-    EXTRA_LIBS="$EXTRA_LIBS -l$1"
-  ])
-])
-
-dnl
-dnl APACHE_ONCE(namespace, variable, code)
-dnl
-dnl execute code, if variable is not set in namespace
-dnl
-AC_DEFUN(APACHE_ONCE,[
-  unique=`echo $ac_n "$2$ac_c" | tr -c -d a-zA-Z0-9`
-  cmd="echo $ac_n \"\$$1$unique$ac_c\""
-  if test -n "$unique" && test "`eval $cmd`" = "" ; then
-    eval "$1$unique=set"
-    $3
-  fi
-])
-
diff --git a/apachenw.mcp.zip b/apachenw.mcp.zip
deleted file mode 100644
index 645099f073725cadd3c1af3ba5ed92fb793caef9..0000000000000000000000000000000000000000
Binary files a/apachenw.mcp.zip and /dev/null differ
diff --git a/build/.cvsignore b/build/.cvsignore
deleted file mode 100644
index 29d51bb51c690314a78587cbac0529063795cfec..0000000000000000000000000000000000000000
--- a/build/.cvsignore
+++ /dev/null
@@ -1 +0,0 @@
-rules.mk
diff --git a/build/NWGNUenvironment.inc b/build/NWGNUenvironment.inc
deleted file mode 100644
index 76149ad0c8d3ce3384cb093198375361a7a608ee..0000000000000000000000000000000000000000
--- a/build/NWGNUenvironment.inc
+++ /dev/null
@@ -1,286 +0,0 @@
-#
-# Setup needed Tools and Libraries
-#
-
-ifeq "$(wildcard $(AP_WORK)\NWGNUcustom.ini)" "$(AP_WORK)\NWGNUcustom.ini"
-include $(AP_WORK)\NWGNUcustom.ini
-CUSTOM_INI = $(AP_WORK)\NWGNUcustom.ini
-endif
-
-ifndef VERBOSE
-.SILENT:
-endif
-
-#
-# Treat like an include
-#
-ifndef EnvironmentDefined
-
-#
-# simple macros for parsing makefiles
-#
-EOLIST:=
-EMPTY :=
-COMMA := ,
-SPACE := $(EMPTY) $(EMPTY)
-
-#
-# Base environment
-#
-
-# Try and handle case issues
-ifndef NOVELLLIBC
-ifdef NovellLibC
-NOVELLLIBC = $(NovellLibC)
-endif
-endif
-
-ifndef NOVELLLIBC
-NOVELLLIBC = C:/novell/ndk/libc
-endif
-
-# This is a placeholder
-# ifndef LDAPSDK
-# LDAPSDK = C:/novell/ndk/cldapsdk
-# endif
-
-ifndef METROWERKS
-METROWERKS = C:\Program Files\Metrowerks\CodeWarrior
-endif
-
-# If LM_LICENSE_FILE isn't defined, define a variable that can be used to
-# restart make with it defined
-ifndef LM_LICENSE_FILE
-NO_LICENSE_FILE = NO_LICENSE_FILE
-endif
-
-#
-# Set the Release type that you want to build, possible values are:
-#
-#  debug		- full debug switches are set
-#  noopt		- normal switches are set (default)
-#  optimized	- optimization switches are set
-
-ifdef reltype
-RELEASE=$(reltype)
-endif
-
-ifdef RELTYPE
-RELEASE=$(RELTYPE)
-endif
-
-ifdef debug
-RELEASE=debug
-endif
-
-ifdef DEBUG
-RELEASE=debug
-endif
-
-ifdef optimized
-RELEASE=optimized
-endif
-
-ifdef OPTIMIZED
-RELEASE=optimized
-endif
-
-ifndef RELEASE
-RELEASE = optimized
-endif
-
-ifeq "$(RELEASE)" "debug"
-OBJDIR = Debug
-endif
-
-ifeq "$(RELEASE)" "noopt"
-OBJDIR = Noopt
-endif
-
-ifeq "$(RELEASE)" "optimized"
-OBJDIR = Release
-endif
-
-#
-# Setup compiler information
-#
-
-# MetroWerks NLM tools
-CC		= mwccnlm
-CPP		= mwccnlm
-LINK	= mwldnlm
-LIB		= mwldnlm -type library -w nocmdline
-
-NOVI	= $(NOVELLLIBC)\imports
-
-INCDIRS 	= $(NOVELLLIBC)\include;$(NOVELLLIBC)\include\nks;$(NOVELLLIBC)\include\winsock;
-
-DEFINES		= -DNETWARE
-
-#
-# MetroWerks static Libraries
-
-CLIB3S	= $(METROWERKS)\Novell Support\Metrowerks Support\Libraries\Runtime\mwcrtl.lib
-MATH3S	=
-PLIB3S	= $(METROWERKS)\Novell Support\Metrowerks Support\Libraries\MSL C++\MWCPP.lib
-
-# Base compile flags
-# and prefix or precompiled header added here.
-
-# The default flags are as follows:
-#
-# -c                    compile only, no link
-# -nosyspath            treat #include <...> like #include "..."
-# -Cpp_exceptions off   disable C++ exceptions
-# -RTTI off             disable C++ run-time typing information
-# -align 4              align on 4 byte bounderies
-# -w nocmdline          disable command-line driver/parser warnings
-# -proc PII             generate code base on Pentium II instruction set
-# -inst mmx             use MMX extensions
-
-CFLAGS = -c -nosyspath -Cpp_exceptions off -RTTI off -align 4 -w nocmdline -proc PII -inst mmx
-
-# -g                    generate debugging information
-# -O1                   level 1 optimizations
-
-ifeq "$(RELEASE)" "debug"
-CFLAGS += -g -O1
-endif
-
-# -O4,p                 level 4 optimizations, optimize for speed
-ifeq "$(RELEASE)" "optimized"
-CFLAGS += -O4,p
-endif
-
-# -prefix pre_nw.h      #include pre_nw.h for all files
-
-CFLAGS += -prefix pre_nw.h
-
-
-PATH:=$(PATH);$(METROWERKS)\bin;$(METROWERKS)\Other Metrowerks Tools\Command Line Tools
-
-#
-# Declare major project deliverables output directories here
-#
-
-ifdef DEST
-INSTALL = $(DEST)
-ifeq (\, $(findstring \,$(INSTALL)))
-INSTDIRS = $(DEST)
-endif
-endif
-
-ifdef dest
-INSTALL = $(dest)
-ifeq (\, $(findstring \,$(INSTALL)))
-INSTDIRS = $(dest)
-endif
-endif
-
-ifndef INSTALL
-INSTALL = $(AP_WORK)\..\Dist
-INSTDIRS = $(AP_WORK)\..\Dist
-endif
-
-INSTDEVDIRS := \
-    $(INSTDIRS) \
-	$(INSTALL)\Apache2\include \
-	$(INSTALL)\Apache2\lib \
-
-INSTDIRS += \
-	$(INSTALL)\Apache2 \
-	$(INSTALL)\Apache2\cgi-examples \
-	$(INSTALL)\Apache2\conf \
-	$(INSTALL)\Apache2\error \
-	$(INSTALL)\Apache2\error\include \
-	$(INSTALL)\Apache2\htdocs \
-	$(INSTALL)\Apache2\icons \
-	$(INSTALL)\Apache2\icons\small \
-	$(INSTALL)\Apache2\logs \
-	$(INSTALL)\Apache2\man \
-	$(INSTALL)\Apache2\manual \
-	$(INSTALL)\Apache2\manual\developer \
-	$(INSTALL)\Apache2\manual\faq \
-	$(INSTALL)\Apache2\manual\howto \
-	$(INSTALL)\Apache2\manual\images \
-	$(INSTALL)\Apache2\manual\misc \
-	$(INSTALL)\Apache2\manual\mod \
-	$(INSTALL)\Apache2\manual\platform \
-	$(INSTALL)\Apache2\manual\programs \
-	$(INSTALL)\Apache2\manual\search \
-	$(INSTALL)\Apache2\manual\ssl \
-	$(INSTALL)\Apache2\manual\vhosts \
-	$(INSTALL)\Apache2\modules \
-
-#
-# Declare Command and tool macros here
-#
-
-# Os2LibPath is an extra check to see if we are on NT
-ifdef Os2LibPath
-OS = Windows_NT
-endif
-
-ifeq "$(OS)" "Windows_NT"
-CMD=cmd /C
-CHK=cmd /C if exist
-CHKNOT=cmd /C if not exist
-DEL = del /F
-DELTREE = cmd /C rd /s/q
-WINNT=1
-else
-CMD=command /C
-CHK=command /C if exist
-CHKNOT=command /C if not exist
-DEL = del
-DELTREE = deltree /y
-endif
-
-
-#
-# Setup base C compiler flags
-#
-
-#
-# Common directories
-#
-
-STDMOD		= $(AP_WORK)/modules
-NWOS		= $(AP_WORK)/os/netware
-SERVER		= $(AP_WORK)/server
-SRC			= $(AP_WORK)
-APR			= $(AP_WORK)/srclib/apr
-APRUTIL		= $(AP_WORK)/srclib/apr-util
-SUPMOD		= $(AP_WORK)/support
-PCRE		= $(AP_WORK)/srclib/pcre
-APRTEST		= $(AP_WORK)/srclib/apr/test
-HTTPD		= $(AP_WORK)/modules/http
-XML			= $(AP_WORK)/srclib/apr-util/xml
-
-#
-# Internal Libraries
-#
-
-APRLIB		= $(APR)/$(OBJDIR)/aprlib.lib
-APRUTLIB	= $(APRUTIL)/$(OBJDIR)/aprutil.lib
-STMODLIB	= $(STDMOD)/$(OBJDIR)/stdmod.lib
-PCRELIB		= $(PCRE/$(OBJDIR)/pcre.lib
-NWOSLIB		= $(NWOS)/$(OBJDIR)/netware.lib
-SERVLIB		= $(SERVER)/$(OBJDIR)/server.lib
-HTTPDLIB	= $(HTTPD)/$(OBJDIR)/httpd.lib
-XMLLIB		= $(XML)/$(OBJDIR)/xmllib.lib
-
-#
-# Additional general defines
-#
-VERSION		= 2,0,0
-			
-EnvironmentDefined = 1
-endif # ifndef EnvironmentDefined
-
-# This is always set so that it will show up in lower directories
-
-ifdef Path
-Path = $(PATH)
-endif
-
diff --git a/build/NWGNUhead.inc b/build/NWGNUhead.inc
deleted file mode 100644
index 71855ab3cd36bf84f73927d58df43bd5961c2e0f..0000000000000000000000000000000000000000
--- a/build/NWGNUhead.inc
+++ /dev/null
@@ -1,103 +0,0 @@
-#
-# Obtain the global build environment
-#
-
-include $(AP_WORK)\build\NWGNUenvironment.inc
-
-#
-# Define base targets and rules
-# 
-
-TARGETS = libs nlms install clobber_libs clobber_nlms clean installdev
-
-.PHONY : $(TARGETS) default all help $(NO_LICENSE_FILE)
-
-# Here is where we will use the NO_LICENSE_FILE variable to see if we need to
-# restart the make with it defined
-
-ifdef NO_LICENSE_FILE
-
-default: NO_LICENSE_FILE
-
-all: NO_LICENSE_FILE
-
-install :: NO_LICENSE_FILE
-
-installdev :: NO_LICENSE_FILE
-
-NO_LICENSE_FILE :
-	$(MAKE) $(MAKECMDGOALS) -f NWGNUmakefile RELEASE=$(RELEASE) DEST="$(INSTALL)" LM_LICENSE_FILE="$(METROWERKS)\license.dat"
-
-else # LM_LICENSE_FILE must be defined so use the real targets
-
-default: $(SUBDIRS) libs nlms
-
-all: $(SUBDIRS) libs nlms install
-
-$(TARGETS) :: $(SUBDIRS)
-
-install :: nlms $(INSTDIRS)
-
-installdev :: $(INSTDEVDIRS)
-
-$(INSTDIRS) ::
-	$(CHKNOT) $@\NUL mkdir $@
-
-$(INSTDEVDIRS) ::
-	$(CHKNOT) $@\NUL mkdir $@
-
-endif #NO_LICENSE_FILE check
-
-help :
-	@echo targets for RELEASE=$(RELEASE):
-	@echo (default) . . . . libs nlms
-	@echo all . . . . . . . does everything (libs nlms install)
-	@echo libs. . . . . . . builds all libs
-	@echo nlms. . . . . . . builds all nlms
-	@echo install . . . . . builds libs and nlms and copies install files to
-	@echo                   "$(INSTALL)"
-	@echo clean . . . . . . deletes $(OBJDIR) dirs, *.err, and *.map
-	@echo clobber_all . . . deletes all possible output from the make
-	@echo clobber_install . deletes all files in $(INSTALL)
-	@$(CMD) echo.
-	@echo Multiple targets can be used on a single nmake command line -
-	@echo (i.e. $(MAKE) clean all)
-	@$(CMD) echo.
-	@echo You can also specify RELEASE=debug, RELEASE=noopt, or RELEASE=optimized
-	@echo The default is RELEASE=optimized
-
-clobber_all :: clean clobber_install
-
-clobber_install ::
-	-$(DELTREE) $(INSTALL) 2>NUL
-
-#
-# build recursive targets
-#
-
-$(SUBDIRS) : FORCE
-ifneq "$(MAKECMDGOALS)" "clean"
-	$(CMD) echo.
-	@echo Building $(CURDIR)/$@
-endif
-	$(MAKE) -C $@ $(MAKECMDGOALS) -f NWGNUmakefile RELEASE=$(RELEASE) DEST="$(INSTALL)" LM_LICENSE_FILE="$(LM_LICENSE_FILE)"
-	$(CMD) echo.
-
-FORCE:
-
-#
-# Standard targets
-#
-
-clean :: $(SUBDIRS)
-	@echo Cleaning up $(CURDIR)
-	-$(DELTREE) $(OBJDIR) 2> NUL
-	$(CHK) *.err $(DEL) *.err
-	$(CHK) *.map $(DEL) *.map
-	$(CHK) *.d $(DEL) *.d
-	$(CHK) *.tmp $(DEL) *.tmp
-	-$(DELTREE) $(OBJDIR) 2> NUL
-
-$(OBJDIR) ::
-	$(CHKNOT) $(OBJDIR)\nul mkdir $(OBJDIR)
-
diff --git a/build/NWGNUmakefile b/build/NWGNUmakefile
deleted file mode 100644
index deeef84fa274fa71cfa235abbf7e5f59df708825..0000000000000000000000000000000000000000
--- a/build/NWGNUmakefile
+++ /dev/null
@@ -1,80 +0,0 @@
-#
-# Declare the sub-directories to be built here
-#
-
-SUBDIRS = \
-	$(EOLIST) 
-
-#
-# Get the 'head' of the build environment.  This includes default targets and
-# paths to tools
-#
-
-include $(AP_WORK)\build\NWGNUhead.inc
-
-#
-# build this level's files
-
-FILES_prebuild_headers = \
-	$(APR)/include/apr.h \
-	$(APRUTIL)/include/apu.h \
-	$(APRUTIL)/include/apr_ldap.h \
-	$(PCRE)/config.h \
-	$(PCRE)/pcre.h \
-	$(EOLIST) 
-    
-nlms :: $(NWOS)/httpd.imp
-
-$(NWOS)/httpd.imp : make_nw_export.awk nw_export.i
-	@echo Generating $(subst /,\,$@)
-	awk -f make_nw_export.awk nw_export.i | sort >$(NWOS)/httpd.imp
-    
-nw_export.i : nw_export.inc $(FILES_prebuild_headers) cc.opt
-	@echo Generating $(subst /,\,$@)
-	$(CC) $< @cc.opt
-
-cc.opt : NWGNUmakefile $(AP_WORK)\build\NWGNUenvironment.inc $(AP_WORK)\build\NWGNUtail.inc $(AP_WORK)\build\NWGNUhead.inc
-	$(CHK) $@ $(DEL) $@
-	@echo -P >> $@
-	@echo -EP >> $@
-	@echo -nosyspath >> $@
-	@echo -w nocmdline >> $@
-	@echo -DNETWARE >> $@
-	@echo -DCORE_PRIVATE >> $@
-	@echo -I..\include >> $@
-	@echo -I..\modules\http >> $@
-	@echo -I..\os\netware >> $@
-	@echo -I..\server\mpm\netware >> $@
-	@echo -I..\srclib\apr\include >> $@
-	@echo -I..\srclib\apr-util\include >> $@
-	@echo -ir $(NOVELLLIBC) >> $@
-
-$(APR)/include/%.h: $(subst /,\,$(APR))\include\%.hnw
-	@echo Creating $(subst /,\,$@)
-	copy $< $(subst /,\,$(APR))\include\$(@F)
-
-$(APRUTIL)/include/%.h: $(subst /,\,$(APRUTIL))\include\%.hnw
-	@echo Creating $(subst /,\,$@)
-	copy $< $(subst /,\,$(APRUTIL))\include\$(@F)
-
-$(PCRE)/%.h: $(subst /,\,$(PCRE))\%.hw
-	@echo Creating $(subst /,\,$@)
-	copy $< $(subst /,\,$(PCRE))\$(@F)
-
-#
-# You can use this target if all that is needed is to copy files to the
-# installation area
-#
-install :: nlms FORCE
-	
-
-clean ::
-	$(CHK) nw_export.i                                  $(DEL) nw_export.i
-	$(CHK) cc.opt                                       $(DEL) cc.opt
-	$(CHK) $(subst /,\,$(APR))\include\apr.h            $(DEL) $(subst /,\,$(APR))\include\apr.h
-	$(CHK) $(subst /,\,$(APRUTIL))\include\apu.h        $(DEL) $(subst /,\,$(APRUTIL))\include\apu.h
-	$(CHK) $(subst /,\,$(APRUTIL))\include\apr_ldap.h   $(DEL) $(subst /,\,$(APRUTIL))\include\apr_ldap.h
-	$(CHK) $(subst /,\,$(PCRE))\config.h                $(DEL) $(subst /,\,$(PCRE))\config.h
-	$(CHK) $(subst /,\,$(PCRE))\pcre.h                  $(DEL) $(subst /,\,$(PCRE))\pcre.h
-	$(CHK) $(subst /,\,$(NWOS))\httpd.imp               $(DEL) $(subst /,\,$(NWOS))\httpd.imp
-    
diff --git a/build/NWGNUtail.inc b/build/NWGNUtail.inc
deleted file mode 100644
index 015f197cbc4806a026dd0e27209fb721a2cd0f19..0000000000000000000000000000000000000000
--- a/build/NWGNUtail.inc
+++ /dev/null
@@ -1,287 +0,0 @@
-#
-# This contains final targets and should be included at the end of any
-# NWGNUmakefile file
-#
-
-#
-# If we are going to create an nlm, make sure we have assigned variables to 
-# use during the link.
-#
-echo NLM_NAME=$(NLM_NAME)
-ifndef NLM_NAME
-NLM_NAME = $(TARGET_nlm)
-endif
-
-ifndef NLM_DESCRIPTION
-NLM_DESCRIPTION = $(NLM_NAME)
-endif
-
-ifndef NLM_THREAD_NAME
-NLM_THREAD_NAME = $(NLM_NAME) Thread
-endif
-
-#
-# Create dependency lists based on the files available
-#
-
-CCOPT_DEPENDS 	= \
-				$(AP_WORK)\build\NWGNUhead.inc \
-				$(AP_WORK)\build\NWGNUenvironment.inc \
-				$(AP_WORK)\build\NWGNUtail.inc \
-				NWGNUmakefile \
-				$(CUSTOM_INI) \
-				$(EOLIST)
-                
-CPPOPT_DEPENDS	= \
-				$(AP_WORK)\build\NWGNUhead.inc \
-				$(AP_WORK)\build\NWGNUenvironment.inc \
-				$(AP_WORK)\build\NWGNUtail.inc \
-				NWGNUmakefile \
-				$(CUSTOM_INI) \
-				$(EOLIST)
-
-$(NLM_NAME)_LINKOPT_DEPENDS	= \
-				$(TARGET_lib) \
-				$(AP_WORK)\build\NWGNUenvironment.inc \
-				NWGNUmakefile \
-				$(AP_WORK)\build\NWGNUtail.inc \
-				$(CUSTOM_INI) \
-				$(EOLIST)
-
-ifeq "$(words $(strip $(TARGET_lib)))" "1"
-LIB_NAME					= $(basename $(notdir $(TARGET_lib)))
-$(LIB_NAME)_LIBLST_DEPENDS	= \
-				$(FILES_lib_objs) \
-				$(AP_WORK)\build\NWGNUenvironment.inc \
-				NWGNUmakefile \
-				$(AP_WORK)\build\NWGNUtail.inc \
-				$(CUSTOM_INI) \
-				$(EOLIST)
-endif
-
-ifeq "$(wildcard NWGNU$(LIB_NAME))" "NWGNU$(LIB_NAME)"
-$(LIB_NAME)_LIBLST_DEPENDS	+= NWGNU$(LIB_NAME)
-endif
-
-ifeq "$(wildcard NWGNU$(NLM_NAME))" "NWGNU$(NLM_NAME)"
-$(NLM_NAME)_LINKOPT_DEPENDS	+= NWGNU$(NLM_NAME)
-CCOPT_DEPENDS 	+= NWGNU$(NLM_NAME)
-CPPOPT_DEPENDS 	+= NWGNU$(NLM_NAME)
-endif
-
-#
-# Generic compiler rules
-#
-
-$(OBJDIR)/%.o: %.c $(OBJDIR)\cc.opt
-	@echo Compiling $<
-	$(CC) $< -o=$(OBJDIR)\$(@F) @$(OBJDIR)\cc.opt 
-
-$(OBJDIR)\cc.opt: $(CCOPT_DEPENDS)
-	$(CHK) $@ $(DEL) $@
-	@echo Generating $@
-ifneq "$(strip $(CFLAGS))" ""
-	@echo $(CFLAGS) >> $@
-endif	
-ifneq "$(strip $(XCFLAGS))" ""
-	@echo $(XCFLAGS) >> $@
-endif
-ifneq "$(strip $(XINCDIRS))" ""
-	@echo $(foreach xincdir,$(strip $(subst ;,$(SPACE),$(XINCDIRS))),-I$(xincdir)) >> $@
-endif	
-ifneq "$(strip $(INCDIRS))" ""
-	@echo $(foreach incdir,$(strip $(subst ;,$(SPACE),$(INCDIRS))),-I$(incdir)) >> $@
-endif
-ifneq "$(strip $(DEFINES))" "" 
-	@echo $(DEFINES) >> $@
-endif
-ifneq "$(strip $(XDEFINES))" "" 
-	@echo $(XDEFINES) >> $@
-endif
-
-$(OBJDIR)/%.o: %.cpp $(OBJDIR)\cpp.opt
-	@echo Compiling $<
-	$(CPP) $< -o=$(OBJDIR)\$(@F) @$(OBJDIR)\cpp.opt 
-
-$(OBJDIR)\cpp.opt: $(CPPOPT_DEPENDS)
-	$(CHK) $@ $(DEL) $@
-	@echo Generating $@
-ifneq "$(strip $(CFLAGS))" ""
-	@echo $(CFLAGS) >> $@
-endif	
-ifneq "$(strip $(XCFLAGS))" ""
-	@echo $(XCFLAGS) >> $@
-endif
-ifneq "$(strip $(XINCDIRS))" ""
-	@echo $(foreach xincdir,$(strip $(subst ;,$(SPACE),$(XINCDIRS))),-I$(xincdir)) >> $@
-endif	
-ifneq "$(strip $(INCDIRS))" ""
-	@echo $(foreach incdir,$(strip $(subst ;,$(SPACE),$(INCDIRS))),-I$(incdir)) >> $@
-endif
-ifneq "$(strip $(DEFINES))" "" 
-	@echo $(DEFINES) >> $@
-endif
-ifneq "$(strip $(XDEFINES))" "" 
-	@echo $(XDEFINES) >> $@
-endif
-
-#
-# Rules to build libraries
-#
-
-# If we only have one target library then build it
-
-ifeq "$(words $(strip $(TARGET_lib)))" "1"
-
-$(TARGET_lib) : $(OBJDIR)\$(LIB_NAME)_lib.lst
-	@echo Generating $@
-	$(CHK) $(OBJDIR)\$(@F) $(DEL) $(OBJDIR)\$(@F)
-	$(LIB) -o $(OBJDIR)\$(@F) @$?
-   
-$(OBJDIR)\$(LIB_NAME)_lib.lst: $($(LIB_NAME)_LIBLST_DEPENDS)
-	$(CHK) $@ $(DEL) $@
-	@echo Generating $@
-ifneq "$(strip $(FILES_lib_objs))" ""
-	@echo $(foreach objfile,$(FILES_lib_objs),$(subst /,\,$(objfile)) ) >> $@
-endif
-
-else # We must have more than one target library so load the individual makefiles
-
-$(OBJDIR)/%.lib: NWGNU% $(AP_WORK)\build\NWGNUhead.inc $(AP_WORK)\build\NWGNUtail.inc $(AP_WORK)\build\NWGNUenvironment.inc FORCE
-	@echo Calling $<
-	$(MAKE) -f $< $(MAKECMDGOALS) RELEASE=$(RELEASE)
-
-endif
-
-#
-# Rules to build nlms. 
-#
-
-vpath libcpre.o $(NOVELLLIBC)\imports
-
-# If we only have one target NLM then build it
-ifeq "$(words $(strip $(TARGET_nlm)))" "1"
-
-$(TARGET_nlm) : $(FILES_nlm_objs) $(FILES_nlm_libs) $(OBJDIR)\$(NLM_NAME)_link.opt
-	@echo Linking $@
-	$(LINK) @$(OBJDIR)\$(NLM_NAME)_link.opt
-
-# This will force the link option file to be rebuilt if we change the 
-# corresponding makefile
-
-$(OBJDIR)\$(NLM_NAME)_link.opt : $($(NLM_NAME)_LINKOPT_DEPENDS)
-	$(CHK) $(OBJDIR)\$(@F) $(DEL) $(OBJDIR)\$(@F)
-	$(CHK) $(OBJDIR)\$(NLM_NAME)_link.def $(DEL) $(OBJDIR)\$(NLM_NAME)_link.def
-	@echo Generating $@
-	@echo -warnings off >> $@
-	@echo -zerobss >> $@
-	@echo -desc "$(NLM_DESCRIPTION)" >> $@
-	@echo -o $(TARGET_nlm) >> $@
-ifneq "$(FILE_nlm_copyright)" ""
-	@-type $(FILE_nlm_copyright) >> $@
-endif
-ifeq "$(RELEASE)" "debug"
-	@echo -g >> $@
-	@echo -sym internal >> $@
-	@echo -sym codeview4 >> $@
-	@echo -osym $(OBJDIR)\$(NLM_NAME).sym >> $@
-else	
-	@echo -sym internal >> $@
-endif	
-	@echo -screenname "Apache for NetWare" >> $@ 
-ifneq "$(NLM_VERSION)" ""
-	@echo -nlmversion=$(NLM_VERSION) >> $@ 
-else
-	@echo -nlmversion=$(VERSION) >> $@
-endif
-	@echo -l $(NWOS) >> $@
-	@echo -l $(AP)/$(OBJDIR) >> $@
-	@echo -l $(APR)/$(OBJDIR) >> $@
-	@echo -l $(APRUTIL)/$(OBJDIR) >> $@
-	@echo -l $(PCRE)/$(OBJDIR) >> $@
-	@echo -l $(HTTPD)/$(OBJDIR) >> $@
-	@echo -l $(SERVER)/$(OBJDIR) >> $@
-	@echo -l $(STDMOD)/$(OBJDIR) >> $@
-	@echo -l $(NWOS)/$(OBJDIR) >> $@
-	@echo -l "$(METROWERKS)/Novell Support/Metrowerks Support/Libraries/Runtime" >> $@
-	@echo -l "$(METROWERKS)/Novell Support/Metrowerks Support/Libraries/MSL C++" >> $@
-	@echo -l $(NOVELLLIBC)/imports >> $@
-ifneq "$(LDAPSDK)" ""    
-	@echo -l $(LDAPSDK)/lib/nlm >> $@
-endif    
-	@echo -l $(XML)/$(OBJDIR) >> $@
-	@echo -nodefaults >> $@
-	@echo -map $(OBJDIR)\$(NLM_NAME).map>> $@
-	@echo -threadname "$(NLM_THREAD_NAME)" >> $@
-ifneq "$(NLM_STACK_SIZE)" ""
-	@echo -stacksize $(subst K,000,$(subst k,K,$(strip $(NLM_STACK_SIZE)))) >> $@
-else	
-	@echo -stacksize 64000 >> $@
-endif
-ifneq "$(NLM_ENTRY_SYM)" ""
-	@echo -entry $(NLM_ENTRY_SYM) >> $@
-endif
-ifneq "$(NLM_EXIT_SYM)" ""
-	@echo -exit $(NLM_EXIT_SYM) >> $@
-endif
-ifneq "$(NLM_CHECK_SYM)" ""
-	@echo -check $(NLM_CHECK_SYM) >> $@
-endif
-ifneq "$(NLM_FLAGS)" ""
-	@echo -flags $(NLM_FLAGS) >> $@
-endif
-ifneq "$(strip $(FILES_nlm_objs))" ""
-	@echo $(foreach objfile,$(strip $(FILES_nlm_objs)),$(subst /,\,$(objfile))) >> $@
-endif
-ifneq "$(FILES_nlm_libs)" ""
-	@echo $(foreach libfile, $(notdir $(strip $(FILES_nlm_libs))),-l$(subst /,\,$(libfile))) >> $@
-endif
-	@echo -commandfile $(OBJDIR)\$(NLM_NAME)_link.def >> $@
-ifneq "$(FILE_nlm_msg)" ""
-	@echo Messages $(FILE_nlm_msg) >> $(OBJDIR)\$(NLM_NAME)_link.def
-endif
-ifneq "$(FILE_nlm_hlp)" ""
-	@echo Help $(FILE_nlm_hlp) >> $(OBJDIR)\$(NLM_NAME)_link.def
-endif
-ifneq "$(FILES_nlm_modules)" ""
-	@echo module $(foreach module,$(subst $(SPACE),$(COMMA),$(strip $(FILES_nlm_modules))),$(subst /,\,$(module))) >> $(OBJDIR)\$(NLM_NAME)_link.def
-endif
-ifneq "$(FILES_nlm_Ximports)" ""
-	@echo Import $(foreach import,$(subst $(SPACE),$(COMMA),$(strip $(FILES_nlm_Ximports))),$(subst /,\,$(import))) >> $(OBJDIR)\$(NLM_NAME)_link.def
-endif	
-ifneq "$(FILES_nlm_exports)" ""
-	@echo Export $(foreach export,$(subst $(SPACE),$(COMMA),$(strip $(FILES_nlm_exports))),$(subst /,\,$(export))) >> $(OBJDIR)\$(NLM_NAME)_link.def
-endif	
-ifneq "$(strip $(XLFLAGS))" ""
-	@echo $(XLFLAGS) >> $(OBJDIR)\$(NLM_NAME)_link.def
-endif
-
-# if APACHE_UNIPROC is defined, don't include XDCData
-ifndef APACHE_UNIPROC
-ifneq "$(string $(XDCDATA))" ""
-	@echo XDCData $(XDCDATA) >> $(OBJDIR)\$(NLM_NAME)_link.def
-else
-	@echo XDCData $(NWOS)\apache.xdc >> $(OBJDIR)\$(NLM_NAME)_link.def
-endif
-endif
-
-else # more than one target so look for individual makefiles.
-
-# Only include these if NO_LICENSE_FILE isn't set to prevent excessive 
-# recursion
-
-ifndef NO_LICENSE_FILE
-
-$(OBJDIR)/%.nlm: NWGNU% $(AP_WORK)\build\NWGNUhead.inc $(AP_WORK)\build\NWGNUtail.inc $(AP_WORK)\build\NWGNUenvironment.inc $(CUSTOM_INI) FORCE
-	@echo Calling $<
-	$(MAKE) -f $< $(MAKECMDGOALS) RELEASE=$(RELEASE)
-	$(CMD) echo.
-
-else
-
-$(TARGET_nlm):
-
-endif # NO_LICENSE_FILE
-
-endif
-
diff --git a/build/PrintPath b/build/PrintPath
deleted file mode 100755
index 908d274008313895aedb42b232bc1a09fd0364c6..0000000000000000000000000000000000000000
--- a/build/PrintPath
+++ /dev/null
@@ -1,105 +0,0 @@
-#!/bin/sh
-# Look for program[s] somewhere in $PATH.
-#
-# Options:
-#  -s
-#    Do not print out full pathname. (silent)
-#  -pPATHNAME
-#    Look in PATHNAME instead of $PATH
-#
-# Usage:
-#  PrintPath [-s] [-pPATHNAME] program [program ...]
-#
-# Initially written by Jim Jagielski for the Apache configuration mechanism
-#  (with kudos to Kernighan/Pike)
-#
-# This script falls under the Apache License.
-# See http://www.apache.org/docs/LICENSE
-
-##
-# Some "constants"
-##
-pathname=$PATH
-echo="yes"
-
-##
-# Find out what OS we are running for later on
-##
-os=`(uname) 2>/dev/null`
-
-##
-# Parse command line
-##
-for args in $*
-do
-    case $args in
-	-s  ) echo="no" ;;
-	-p* ) pathname="`echo $args | sed 's/^..//'`" ;;
-	*   ) programs="$programs $args" ;;
-    esac
-done
-
-##
-# Now we make the adjustments required for OS/2 and everyone
-# else :)
-#
-# First of all, all OS/2 programs have the '.exe' extension.
-# Next, we adjust PATH (or what was given to us as PATH) to
-# be whitespace seperated directories.
-# Finally, we try to determine the best flag to use for
-# test/[] to look for an executable file. OS/2 just has '-r'
-# but with other OSs, we do some funny stuff to check to see
-# if test/[] knows about -x, which is the prefered flag.
-##
-
-if [ "x$os" = "xOS/2" ]
-then
-    ext=".exe"
-    pathname=`echo -E $pathname |
-     sed 's/^;/.;/
-	  s/;;/;.;/g
-	  s/;$/;./
-	  s/;/ /g
-	  s/\\\\/\\//g' `
-    test_exec_flag="-r"
-else
-    ext=""	# No default extensions
-    pathname=`echo $pathname |
-     sed 's/^:/.:/
-	  s/::/:.:/g
-	  s/:$/:./
-	  s/:/ /g' `
-    # Here is how we test to see if test/[] can handle -x
-    testfile="pp.t.$$"
-
-    cat > $testfile <<ENDTEST
-#!/bin/sh
-if [ -x / ] || [ -x /bin ] || [ -x /bin/ls ]; then
-    exit 0
-fi
-exit 1
-ENDTEST
-
-    if `/bin/sh $testfile 2>/dev/null`; then
-	test_exec_flag="-x"
-    else
-	test_exec_flag="-r"
-    fi
-    rm -f $testfile
-fi
-
-for program in $programs
-do
-    for path in $pathname
-    do
-	if [ $test_exec_flag $path/${program}${ext} ] && \
-	   [ ! -d $path/${program}${ext} ]; then
-	    if [ "x$echo" = "xyes" ]; then
-		echo $path/${program}${ext}
-	    fi
-	    exit 0
-	fi
-    done
-done
-exit 1
-
diff --git a/build/binbuild.sh b/build/binbuild.sh
deleted file mode 100755
index 3279148fcbcbfa90e2a2bf649192bb65ca5065d6..0000000000000000000000000000000000000000
--- a/build/binbuild.sh
+++ /dev/null
@@ -1,221 +0,0 @@
-#!/bin/sh
-#
-# binbuild.sh - Builds an Apache binary distribution.
-# Initially written by Lars Eilebrecht <lars@apache.org>.
-#
-# This script falls under the Apache License.
-# See http://www.apache.org/docs/LICENSE
-
-
-APDIR=$(basename $(pwd))
-VER=$(echo $APDIR |sed s/apache-//)
-OS=$(src/helpers/GuessOS)
-USER="$(src/helpers/buildinfo.sh -n %u@%h%d)"
-TAR="$(src/helpers/findprg.sh tar)"
-GTAR="$(src/helpers/findprg.sh gtar)"
-GZIP="$(src/helpers/findprg.sh gzip)"
-CONFIGPARAM="--with-layout=BinaryDistribution --enable-module=most --enable-shared=max"
-
-if [ ! -f ./ABOUT_APACHE ]
-then
-  echo "ERROR: The current directory contains no valid Apache distribution."
-  echo "Please change the directory to the top level directory of a freshly"
-  echo "unpacked Apache 1.3 source distribution and re-execute the script"
-  echo "'./src/helpers/bindbuild.sh'." 
-  exit 1;
-fi
-
-if [ -d ./CVS ]
-then
-  echo "ERROR: The current directory is a CVS checkout of Apache."
-  echo "Only a standard Apache 1.3 source distribution should be used to"
-  echo "create a binary distribution."
-  exit 1;
-fi
-
-echo "Building Apache $VER binary distribution..."
-echo "Platform is \"$OS\"..."
-
-( echo "Build log for Apache binary distribution" && \
-  echo "----------------------------------------------------------------------" && \
-  ./configure $CONFIGPARAM && \
-  echo "----------------------------------------------------------------------" && \
-  make clean && \
-  rm -rf bindist install-bindist.sh *.bindist
-  echo "----------------------------------------------------------------------" && \
-  make && \
-  echo "----------------------------------------------------------------------" && \
-  make install-quiet root="bindist/" && \
-  echo "----------------------------------------------------------------------" && \
-  make clean && \
-  echo "----------------------------------------------------------------------" && \
-  echo "[EOF]" \
-) > build.log 2>&1
-
-if [ ! -f ./bindist/bin/httpd ]
-then
-  echo "ERROR: Failed to build Apache. See \"build.log\" for details."
-  exit 1;
-fi
-
-echo "Binary images successfully created..."
-echo "Creating supplementary files..."
-
-( echo " " && \
-  echo "Apache $VER binary distribution" && \
-  echo "================================" && \
-  echo " " && \
-  echo "This binary distribution is usable on a \"$OS\"" && \
-  echo "system and was built by \"$USER\"." && \
-  echo "" && \
-  echo "The distribution contains all standard Apache modules as shared" && \
-  echo "objects. This allows you to enable or disable particular modules" && \
-  echo "with the LoadModule/AddModule directives in the configuration file" && \
-  echo "without the need to re-compile Apache." && \
-  echo "" && \
-  echo "See \"INSTALL.bindist\" on how to install the distribution." && \
-  echo " " && \
-  echo "NOTE: Please do not send support-related mails to the address mentioned" && \
-  echo "      above or to any member of the Apache Group! Support questions" && \
-  echo "      should be directed to the \"comp.infosystems.www.servers.unix\"" && \
-  echo "      or \"comp.infosystems.www.servers.ms-windows\" newsgroup" && \
-  echo "      (as appropriate for the platform you use), where some of the" && \
-  echo "      Apache team lurk, in the company of many other Apache gurus" && \
-  echo "      who should be able to help." && \
-  echo "      If you think you found a bug in Apache or have a suggestion please" && \
-  echo "      visit the bug report page at http://www.apache.org/bug_report.html" && \
-  echo " " && \
-  echo "----------------------------------------------------------------------" && \
-  ./bindist/bin/httpd -V && \
-  echo "----------------------------------------------------------------------" \
-) > README.bindist
-cp README.bindist ../apache-$VER-$OS.README
-
-( echo " " && \
-  echo "Apache $VER binary installation" && \
-  echo "================================" && \
-  echo " " && \
-  echo "To install this binary distribution you have to execute the installation" && \
-  echo "script \"install-bindist.sh\" in the top-level directory of the distribution." && \
-  echo " " && \
-  echo "The script takes the ServerRoot directory into which you want to install" && \
-  echo "Apache as an option. If you ommit the option the default path" && \
-  echo "\"/usr/local/apache\" is used." && \
-  echo "Make sure you have write permissions in the target directory, e.g. switch" && \
-  echo "to user \"root\" before you execute the script." && \
-  echo " " && \
-  echo "See \"README.bindist\" for further details about this distribution." && \
-  echo " " && \
-  echo "Please note that this distribution includes the complete Apache source code." && \
-  echo "Therefore you may compile Apache yourself at any time if you have a compiler" && \
-  echo "installation on your system." && \
-  echo "See \"INSTALL\" for details on how to accomplish this." && \
-  echo " " \
-) > INSTALL.bindist
-
-( echo "#!/bin/sh" && \
-  echo "#" && \
-  echo "# Usage: install-bindist.sh [ServerRoot]" && \
-  echo "# This script installs the Apache binary distribution and" && \
-  echo "# was automatically created by binbuild.sh." && \
-  echo " " && \
-  echo "if [ .\$1 = . ]" && \
-  echo "then" && \
-  echo "  SR=/usr/local/apache" && \
-  echo "else" && \
-  echo "  SR=\$1" && \
-  echo "fi" && \
-  echo "echo \"Installing binary distribution for platform $OS\"" && \
-  echo "echo \"into directory \$SR ...\"" && \
-  echo "./src/helpers/mkdir.sh \$SR" && \
-  echo "cp -r bindist/proxy \$SR/proxy" && \
-  echo "cp -r bindist/man \$SR/man" && \
-  echo "cp -r bindist/logs \$SR/logs" && \
-  echo "cp -r bindist/libexec \$SR/libexec" && \
-  echo "cp -r bindist/include \$SR/include" && \
-  echo "cp -r bindist/icons \$SR/icons" && \
-  echo "cp -r bindist/cgi-bin \$SR/cgi-bin" && \
-  echo "cp -r bindist/bin \$SR/bin" && \
-  echo "if [ -d \$SR/conf ]" && \
-  echo "then" && \
-  echo "  echo \"[Preserving existing configuration files.]\"" && \
-  echo "  cp -r bindist/conf/*.default \$SR/conf/" && \
-  echo "else" && \
-  echo "  cp -r bindist/conf \$SR/conf" && \
-  echo "fi" && \
-  echo "if [ -d \$SR/htdocs ]" && \
-  echo "then" && \
-  echo "  echo \"[Preserving existing htdocs directory.]\"" && \
-  echo "else" && \
-  echo "  cp -r bindist/htdocs \$SR/htdocs" && \
-  echo "fi" && \
-  echo "sed -e s%/usr/local/apache%\$SR/% \$SR/conf/httpd.conf.default > \$SR/conf/httpd.conf" && \
-  echo "sed -e s%PIDFILE=%PIDFILE=\$SR/% -e s%HTTPD=%HTTPD=\\\"\$SR/% -e \"s%/httpd$%/httpd -d \$SR\\\"%\" bindist/bin/apachectl > \$SR/bin/apachectl" && \
-  echo " " && \
-  echo "echo \"Ready.\"" && \
-  echo "echo \" +--------------------------------------------------------+\"" && \
-  echo "echo \" | You now have successfully installed the Apache $VER   |\"" && \
-  echo "echo \" | HTTP server. To verify that Apache actually works      |\"" && \
-  echo "echo \" | correctly you now should first check the (initially    |\"" && \
-  echo "echo \" | created or preserved) configuration files              |\"" && \
-  echo "echo \" |                                                        |\"" && \
-  echo "echo \" |   \$SR/conf/httpd.conf\"" && \
-  echo "echo \" |                                                        |\"" && \
-  echo "echo \" | and then you should be able to immediately fire up     |\"" && \
-  echo "echo \" | Apache the first time by running:                      |\"" && \
-  echo "echo \" |                                                        |\"" && \
-  echo "echo \" |   \$SR/bin/apachectl start \"" &&\
-  echo "echo \" |                                                        |\"" && \
-  echo "echo \" | Thanks for using Apache.       The Apache Group        |\"" && \
-  echo "echo \" |                                http://www.apache.org/  |\"" && \
-  echo "echo \" +--------------------------------------------------------+\"" && \
-  echo "echo \" \"" \
-) > install-bindist.sh
-chmod 755 install-bindist.sh
-
-sed -e "s%\"/htdocs%\"/usr/local/apache/htdocs%" \
-    -e "s%\"/icons%\"/usr/local/apache/icons%" \
-    -e "s%\"/cgi-bin%\"/usr/local/apache/cgi-bin%" \
-    -e "s%^ServerAdmin.*%ServerAdmin you@your.address%" \
-    -e "s%#ServerName.*%#ServerName localhost%" \
-    -e "s%Port 8080%Port 80%" \
-    bindist/conf/httpd.conf.default > bindist/conf/httpd.conf
-cp bindist/conf/httpd.conf bindist/conf/httpd.conf.default
-
-echo "Creating distribution archive and readme file..."
- 
-if [ ".`grep -i error build.log > /dev/null`" != . ]
-then
-  echo "ERROR: Failed to build Apache. See \"build.log\" for details."
-  exit 1;
-else
-  if [ ".$GTAR" != . ]
-  then
-    $GTAR -zcf ../apache-$VER-$OS.tar.gz -C .. --owner=root --group=root apache-$VER
-  else
-    if [ ".$TAR" != . ]
-    then
-      $TAR -cf ../apache-$VER-$OS.tar -C .. apache-$VER
-      if [ ".$GZIP" != . ]
-      then
-        $GZIP ../apache-$VER-$OS.tar
-      fi
-    else
-      echo "ERROR: Could not find a 'tar' program!"
-      echo "       Please execute the following commands manually:"
-      echo "         tar -cf ../apache-$VER-$OS.tar ."
-      echo "         gzip ../apache-$VER-$OS.tar"
-    fi
-  fi
-
-  if [ -f ../apache-$VER-$OS.tar.gz ] && [ -f ../apache-$VER-$OS.README ]
-  then
-    echo "Ready."
-    echo "You can find the binary archive (apache-$VER-$OS.tar.gz)"
-    echo "and the readme file (apache-$VER-$OS.README) in the"
-    echo "parent directory."
-    exit 0;
-  else
-    exit 1;
-  fi
-fi
diff --git a/build/bsd_makefile b/build/bsd_makefile
deleted file mode 100755
index 90ce5fee3d997986eee146d7123d5ca88c251512..0000000000000000000000000000000000000000
--- a/build/bsd_makefile
+++ /dev/null
@@ -1,71 +0,0 @@
-#! /bin/sh
-# ====================================================================
-# The Apache Software License, Version 1.1
-#
-# Copyright (c) 2000 The Apache Software Foundation.  All rights
-# reserved.
-#
-# Redistribution and use in source and binary forms, with or without
-# modification, are permitted provided that the following conditions
-# are met:
-#
-# 1. Redistributions of source code must retain the above copyright
-#    notice, this list of conditions and the following disclaimer.
-#
-# 2. Redistributions in binary form must reproduce the above copyright
-#    notice, this list of conditions and the following disclaimer in
-#    the documentation and/or other materials provided with the
-#    distribution.
-#
-# 3. The end-user documentation included with the redistribution,
-#    if any, must include the following acknowledgment:
-#       "This product includes software developed by the
-#        Apache Software Foundation (http://www.apache.org/)."
-#    Alternately, this acknowledgment may appear in the software itself,
-#    if and wherever such third-party acknowledgments normally appear.
-#
-# 4. The names "Apache" and "Apache Software Foundation" must
-#    not be used to endorse or promote products derived from this
-#    software without prior written permission. For written
-#    permission, please contact apache@apache.org.
-#
-# 5. Products derived from this software may not be called "Apache",
-#    nor may "Apache" appear in their name, without prior written
-#    permission of the Apache Software Foundation.
-#
-# THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
-# WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
-# OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
-# DISCLAIMED.  IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
-# ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
-# USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
-# ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
-# OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
-# OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
-# SUCH DAMAGE.
-# ====================================================================
-#
-# This software consists of voluntary contributions made by many
-# individuals on behalf of the Apache Software Foundation.  For more
-# information on the Apache Software Foundation, please see
-# <http://www.apache.org/>.
-#
-# The build environment was provided by Sascha Schumann.
-#
-
-# cwd must be top_srcdir
-test -f build/bsd_makefile || exit 2
-
-test -f bsd_converted && exit 0
-
-tmpfile=`mktemp /tmp/$0.XXXXXX` || exit 1
-for i in build/*.mk; do
-    sed 's/^include \(.*\)/.include "\1"/' $i >$tmpfile \
-        && cp $tmpfile $i
-done
-rm -f $tmpfile
-
-touch bsd_converted
-exit 0
diff --git a/build/build-modules-c.awk b/build/build-modules-c.awk
deleted file mode 100644
index 0da842152e1fedbe20eda08c6058256fab248409..0000000000000000000000000000000000000000
--- a/build/build-modules-c.awk
+++ /dev/null
@@ -1,48 +0,0 @@
-BEGIN {
-    RS = " "
-    modules[n++] = "core"
-    pmodules[pn++] = "core"
-} 
-{ modules[n++] = $1 ; pmodules[pn++] = $1 } 
-END {
-    print "/*"
-    print " * modules.c --- automatically generated by Apache"
-    print " * configuration script.  DO NOT HAND EDIT!!!!!"
-    print " */"
-    print ""
-    print "#include \"httpd.h\""
-    print "#include \"http_config.h\""
-    print ""
-    for (i = 0; i < pn; ++i) {
-        printf ("extern module %s_module;\n", pmodules[i])
-    }
-    print ""
-    print "/*"
-    print " *  Modules which implicitly form the"
-    print " *  list of activated modules on startup,"
-    print " *  i.e. these are the modules which are"
-    print " *  initially linked into the Apache processing"
-    print " *  [extendable under run-time via AddModule]"
-    print " */"
-    print "module *ap_prelinked_modules[] = {"
-    for (i = 0; i < n; ++i) {
-        printf "  &%s_module,\n", modules[i]
-    }
-    print "  NULL"
-    print "};"
-    print ""
-    print "/*"
-    print " *  Modules which initially form the"
-    print " *  list of available modules on startup,"
-    print " *  i.e. these are the modules which are"
-    print " *  initially loaded into the Apache process"
-    print " *  [extendable under run-time via LoadModule]"
-    print " */"
-    print "module *ap_preloaded_modules[] = {"
-    for (i = 0; i < pn; ++i) {
-        printf "  &%s_module,\n", pmodules[i]
-    }
-    print "  NULL"
-    print "};"
-    print ""
-}
diff --git a/build/buildinfo.sh b/build/buildinfo.sh
deleted file mode 100755
index 5c2a72d6b3538cb98e0a0033a5b282e13e616be7..0000000000000000000000000000000000000000
--- a/build/buildinfo.sh
+++ /dev/null
@@ -1,160 +0,0 @@
-#!/bin/sh
-##
-##  buildinfo.sh -- Determine Build Information
-##  Initially written by Ralf S. Engelschall <rse@apache.org>
-##  for the Apache's Autoconf-style Interface (APACI) 
-##
-#
-# This script falls under the Apache License.
-# See http://www.apache.org/docs/LICENSE
-
-
-#
-#   argument line handling
-#
-error=no
-if [ $# -ne 1 -a $# -ne 2 ]; then
-    error=yes
-fi
-if [ $# -eq 2 -a "x$1" != "x-n" ]; then
-    error=yes
-fi
-if [ "x$error" = "xyes" ]; then
-    echo "$0:Error: invalid argument line"
-    echo "$0:Usage: $0 [-n] <format-string>"
-    echo "Where <format-string> can contain:"
-    echo "   %u ...... substituted by determined username    (foo)"
-    echo "   %h ...... substituted by determined hostname    (bar)"
-    echo "   %d ...... substituted by determined domainname  (.com)"
-    echo "   %D ...... substituted by determined day         (DD)"
-    echo "   %M ...... substituted by determined month       (MM)"
-    echo "   %Y ...... substituted by determined year        (YYYYY)"
-    echo "   %m ...... substituted by determined monthname   (Jan)"
-    exit 1
-fi
-if [ $# -eq 2 ]; then
-    newline=no
-    format_string="$2"
-else
-    newline=yes
-    format_string="$1"
-fi
-
-#
-#   initialization
-#
-username=''
-hostname=''
-domainname=''
-time_day=''
-time_month=''
-time_year=''
-time_monthname=''
-
-#
-#   determine username
-#
-username="$LOGNAME"
-if [ "x$username" = "x" ]; then
-    username="$USER"
-    if [ "x$username" = "x" ]; then
-        username="`(whoami) 2>/dev/null |\
-                   awk '{ printf("%s", $1); }'`"
-        if [ "x$username" = "x" ]; then
-            username="`(who am i) 2>/dev/null |\
-                       awk '{ printf("%s", $1); }'`"
-            if [ "x$username" = "x" ]; then
-                username='unknown'
-            fi
-        fi
-    fi
-fi
-
-#
-#   determine hostname and domainname
-#
-hostname="`(uname -n) 2>/dev/null |\
-           awk '{ printf("%s", $1); }'`"
-if [ "x$hostname" = "x" ]; then
-    hostname="`(hostname) 2>/dev/null |\
-               awk '{ printf("%s", $1); }'`"
-    if [ "x$hostname" = "x" ]; then
-        hostname='unknown'
-    fi
-fi
-case $hostname in
-    *.* )
-        domainname=".`echo $hostname | cut -d. -f2-`"
-        hostname="`echo $hostname | cut -d. -f1`"
-        ;;
-esac
-if [ "x$domainname" = "x" ]; then
-    if [ -f /etc/resolv.conf ]; then
-        domainname="`egrep '^[ 	]*domain' /etc/resolv.conf | head -1 |\
-                     sed -e 's/.*domain//' \
-                         -e 's/^[ 	]*//' -e 's/^ *//' -e 's/^	*//' \
-                         -e 's/^\.//' -e 's/^/./' |\
-                     awk '{ printf("%s", $1); }'`"
-        if [ "x$domainname" = "x" ]; then
-            domainname="`egrep '^[ 	]*search' /etc/resolv.conf | head -1 |\
-                         sed -e 's/.*search//' \
-                             -e 's/^[ 	]*//' -e 's/^ *//' -e 's/^	*//' \
-                             -e 's/ .*//' -e 's/	.*//' \
-                             -e 's/^\.//' -e 's/^/./' |\
-                         awk '{ printf("%s", $1); }'`"
-        fi
-    fi
-fi
-
-#
-#   determine current time
-#
-time_day="`date '+%d' | awk '{ printf("%s", $1); }'`"
-time_month="`date '+%m' | awk '{ printf("%s", $1); }'`"
-time_year="`date '+%Y' 2>/dev/null | awk '{ printf("%s", $1); }'`"
-if [ "x$time_year" = "x" ]; then
-    time_year="`date '+%y' | awk '{ printf("%s", $1); }'`"
-    case $time_year in
-        [5-9][0-9]) time_year="19$time_year" ;;
-        [0-4][0-9]) time_year="20$time_year" ;;
-    esac
-fi
-case $time_month in
-    1|01) time_monthname='Jan' ;;
-    2|02) time_monthname='Feb' ;;
-    3|03) time_monthname='Mar' ;;
-    4|04) time_monthname='Apr' ;;
-    5|05) time_monthname='May' ;;
-    6|06) time_monthname='Jun' ;;
-    7|07) time_monthname='Jul' ;;
-    8|08) time_monthname='Aug' ;;
-    9|09) time_monthname='Sep' ;;
-      10) time_monthname='Oct' ;;
-      11) time_monthname='Nov' ;;
-      12) time_monthname='Dec' ;;
-esac
-
-#
-#   create result string
-#
-if [ "x$newline" = "xyes" ]; then
-    echo $format_string |\
-    sed -e "s;%u;$username;g" \
-        -e "s;%h;$hostname;g" \
-        -e "s;%d;$domainname;g" \
-        -e "s;%D;$time_day;g" \
-        -e "s;%M;$time_month;g" \
-        -e "s;%Y;$time_year;g" \
-        -e "s;%m;$time_monthname;g"
-else
-    echo "${format_string}&" |\
-    sed -e "s;%u;$username;g" \
-        -e "s;%h;$hostname;g" \
-        -e "s;%d;$domainname;g" \
-        -e "s;%D;$time_day;g" \
-        -e "s;%M;$time_month;g" \
-        -e "s;%Y;$time_year;g" \
-        -e "s;%m;$time_monthname;g" |\
-    awk '-F&' '{ printf("%s", $1); }'
-fi
-
diff --git a/build/config-stubs b/build/config-stubs
deleted file mode 100755
index aff00a57d48c27562c2f2c1a75f0125aa72ab740..0000000000000000000000000000000000000000
--- a/build/config-stubs
+++ /dev/null
@@ -1,8 +0,0 @@
-#!/bin/sh
-
-dir=$1
-for stubdir in `find $dir -type d`; do
-    if [ -r $stubdir/config.m4 ]; then
-        echo "sinclude($stubdir/config.m4)"
-    fi
-done
diff --git a/build/default.pl b/build/default.pl
deleted file mode 100644
index 42c0b0ca0042c1c1255d8eb3eef7bdae3da1ae6f..0000000000000000000000000000000000000000
--- a/build/default.pl
+++ /dev/null
@@ -1,496 +0,0 @@
-<<
-# Scandoc template file.
-#
-# This is an example set of templates that is designed to create several 
-# different kinds of index files. It generates a "master index" which intended 
-# for use with a frames browser; A "package index" which is the root page of 
-# the index, and then "package files" containing documentation for all of the 
-# classes within a single package.
-
-######################################################################
-
-## For quick and superficial customization, 
-## simply change these variables
-
-$project_name     = '[Apache]';
-$company_logo     = '<img src="../images/ScanDocBig.jpg">'; # change this to an image tag.
-$copyright        = '© 2000 [Apache Software Foundation]';
-$image_directory  = "../images/";
-$bullet1_image    = $image_directory . "ball1.gif";
-$bullet2_image    = $image_directory . "ball2.gif";
-$bgcolor1         = "#FFFFFF";
-$bgcolor2         = "#FFFFFF";
-
-######################################################################
-
-## Begin generating frame index file.
-
-file "index.html";
->><html>
-  <head>
-    <meta http-equiv="Content-Type" content="text/html; iso-8859-1">
-    <title>$project_name
-  
-  
-    
-    
-    
-      <body bgcolor="$bgcolor2" stylesrc="index.html">
-        <p>Some Documentation</p>
-      </body>
-    
-  
-
-<<
-
-######################################################################
-
-## Begin generating master index file (left-hand frame).
-
-file "master.html";
->>
-  
-    Master Index
-  
-  
-    
-

- Master Index -

-

- - -<< - -## For each package, generate an index entry. - -foreach $p (packages()) { - $_ = $p->url; - s/\s/%20/g; - >>$(p.name)
-

- << - foreach $e ($p->classes()) { - $_ = $e->url; - s/\s/%20/g; - >>
  • $(e.fullname) - << - } - foreach $e ($p->globals()) { - $_ = $e->url; - s/\s/%20/g; - >>
  • $(e.fullname) - << - } - >>
  • << -} - ->> - To-Do List
    -
    -
    -

    - - -<< - -###################################################################### - -## Begin generating package index file - -file "packages.html"; ->> - - $project_name -- Packages - - - -
    $company_logo -

    Documentation for $project_name

    -
    -

    Package List

    -<< - -## For each package, generate an index entry. - -foreach $p (packages()) { - $_ = $p->url; - s/\s/%20/g; - >>$(p.name)
    - << -} - ->> -

    -


    - $copyright
    - Generated by ScanDoc $majorVersion.$minorVersion
    - Last Updated: $date
    - - - -<< - -###################################################################### - -## Generate "To-do list" - -file "to-do.html"; ->> - - $project_name -- To-Do list - - - - $company_logo - -

    To-do list for $project_name

    -<< - -if (&todolistFiles()) { - >>

    - << - foreach $f (&todolistFiles()) { - my @m = &todolistEntries( $f ); - if ($f =~ /([^\/]+)$/) { $f = $1; } - >>$f:

      - << - foreach $text (@m) { - if ($text) { - print "
    • ", &processDescription( $text ), "\n"; - } - } - >>
    - << - } -} - ->> -
    - $copyright
    - Generated by ScanDoc $majorVersion.$minorVersion
    - Last Updated: $date
    - - -<< - -###################################################################### - -## Generate individual files for each package. - -my $p; -foreach $p (packages()) { - file $p->name() . ".html"; - >> - - $project_name -- $(p.name) - - -
    - $project_name -

    -

    - -

    Package Name: $(p.name)

    - -<< - -## Generate class and member index at the top of the file. - -foreach $c ($p->classes()) { - >>

    - $(c.fullname)

    -
      - << - foreach $m ($c->members()) { - >>
    • $(m.longname) - << - } - >>
    - << -} - ->> -
    -<< - -## Generate detailed class documentation -foreach $c ($p->classes()) { - ## Output searchable keyword list - if ($c->keywords()) { - print "\n"; - } - - >>
    - -

    $(c.fullname)

    - - - - - << - - # Output author tag - if ($c->author()) { - >><< - >><< - } - - # Output package version - if ($c->version()) { - >><< - >><< - } - - # Output Source file - if ($c->sourcefile()) { - >><< - >><< - } - - # Output base class list - if ($c->baseclasses()) { - >> - - << - } - - # Output subclasses list - if ($c->subclasses()) { - >> - << - } - - # Output main class description - >> -
    -
    Author:$(c.author)
    Version:$(c.version)
    Source:$(c.sourcefile)
    Base classes:<< - my @t = (); - foreach $b ($c->baseclasses()) { - my $name = $b->name(); - if ($url = $b->url()) { - push @t, "$name"; - } - else { push @t, $name; } - } - print join( ', ', @t ); - >>
    Subclasses:<< - my @t = (); - foreach $s ($c->subclasses()) { - my $name = $s->name(); - if ($url = $s->url()) { - push @t, "$name"; - } - else { push @t, $name; } - } - print join( ', ', @t ); - >>
    -

    - << - print &processDescription( $c->description() ); - - # Output "see also" information - if ($c->seealso()) { - >>

    See Also
    - << - my @r = (); - foreach $a ($c->seealso()) { - my $name = $a->name(); - if ($url = $a->url()) { - push @r, "$name"; - } - else { push @r, $name; } - } - print join( ',', @r ); - >>

    - << - } - - # Output class member index - if ($c->members()) { - print "

    Member Index

    \n"; - print "
      "; - foreach $m ($c->members()) { - >>
    • $(m.fullname) - << - } - >>
    << - } - - # Output class member variable documentation - if ($c->membervars()) { - print "

    Class Variables

    \n"; - print "
    \n"; - foreach $m ($c->membervars()) { &variable( $m ); } - print "
    \n"; - } - - # Output class member function documentation - if ($c->memberfuncs()) { - print "

    Class Methods

    \n"; - print "
    \n"; - foreach $m ($c->memberfuncs()) { &function( $m ); } - print "
    \n"; - } -} - -# Output global variables -if ($p->globalvars()) { - >>

    Global Variables

    -
    - << - foreach $m ($p->globalvars()) { &variable( $m ); } - print "
    \n"; -} - -# Output global functions -if ($p->globalfuncs()) { - >>

    Global Functions

    -
    - << - foreach $m ($p->globalfuncs()) { &function( $m ); } - print "
    \n"; -} - ->> -
    - $copyright
    - Generated by ScanDoc $majorVersion.$minorVersion
    - Last Updated: $date
    - - -<< -} # end of foreach (packages) loop - -###################################################################### - -## Subroutine to generate documentation for a member function or global function - -sub function { - local ($f) = @_; - - if ($f->keywords()) { - >> - << - } - >> - -
    -
    - $(f.fullname); -
    - << - print &processDescription( $f->description() ); - >> -

    - << - if ($f->params()) { - >> -
    Parameters
    - - << - foreach $a ($f->params()) { - >> - << - } - >>
    - $(a.name)<< - print &processDescription( $a->description() ); - >>
    - << - } - - if ($f->returnValue()) { - >>
    Return Value -
    << - print &processDescription( $f->returnValue() ); - >>

    << - } - - if ($f->exceptions()) { - >>

    Exceptions
    - - << - foreach $a ($f->exceptions()) { - >> - << - } - >>

    - $(a.name)<< - print &processDescription( $a->description() ); - >>

    - << - } - - if ($f->seealso()) { - >>
    See Also
    - << - my @r = (); - foreach $a ($f->seealso()) { - my $name = $a->name(); - if ($url = $a->url()) { - push @r, "$name"; - } - else { push @r, $name; } - } - print join( ',', @r ); - >>

    << - } - >>

    - << -} - -###################################################################### - -## Subroutine to generate documentation for a member variable or global variable. - -sub variable { - local ($v) = @_; - - if ($v->keywords()) { - print ""; - } - - >> - -
    - $(v.fullname); -
    - <description() );>> -

    - << - if ($v->seealso()) { - >>
    See Also
    - << - $comma = 0; - foreach $a ($v->seealso()) { - if ($comma) { print ","; } - $comma = 1; - >>$(a.name) - << - } - >>

    - << - } - >>

    - << -} - -###################################################################### - -sub processDescription { - local ($_) = @_; - - s/^\s+//; # Remove whitespace from beginning - s/\s+$/\n/; # Remove whitespace from end - s/\n\n/

    \n/g; # Replace multiple CR's with paragraph markers - s:\@heading(.*)\n:

    $1

    :; # Handle heading text - - # Handle embedded image tags - s:\@caution:

    :; - s:\@warning:

    :; - s:\@bug:

    :; - s:\@tip:

    :; - - return $_; -} diff --git a/build/fastgen.sh b/build/fastgen.sh deleted file mode 100755 index 9a59ab7949def7af3ccacf9d00a51c0018636de8..0000000000000000000000000000000000000000 --- a/build/fastgen.sh +++ /dev/null @@ -1,53 +0,0 @@ -#! /bin/sh -# -# Copyright (c) 1999, 2000 Sascha Schumann. All rights reserved. -# -# Redistribution and use in source and binary forms, with or without -# modification, are permitted provided that the following conditions -# are met: -# 1. Redistributions of source code must retain the above copyright -# notice, this list of conditions and the following disclaimer. -# 2. Redistributions in binary form must reproduce the above copyright -# notice, this list of conditions and the following disclaimer in the -# documentation and/or other materials provided with the distribution. -# -# THIS SOFTWARE IS PROVIDED BY SASCHA SCHUMANN ``AS IS'' AND ANY EXPRESS OR -# IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF -# MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO -# EVENT SHALL SASCHA SCHUMANN BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, -# PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; -# OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, -# WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR -# OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF -# ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -# -############################################################################## -# $Id: fastgen.sh,v 1.1 2000/01/11 13:10:58 sascha Exp $ -# - -srcdir=$1 -shift - -topsrcdir=`(cd $srcdir; pwd)` - -mkdir_p=$1 -shift - -if test "$mkdir_p" = "yes"; then - mkdir_p="mkdir -p" -else - mkdir_p="$topsrcdir/helpers/mkdir.sh" -fi - -base="\$(DEPTH)/$srcdir" - -for i in $@ ; do - echo "creating $i" - dir=`dirname $i` - $mkdir_p $dir - sed \ - -e s#@topsrcdir@#$base# \ - -e s#@srcdir@#$base/$dir# \ - < $topsrcdir/$i.in > $i -done diff --git a/build/httpd_roll_release b/build/httpd_roll_release deleted file mode 100755 index 9930ec0a6d6ba900fd08496ef7d1d8320ac7acf7..0000000000000000000000000000000000000000 --- a/build/httpd_roll_release +++ /dev/null @@ -1,115 +0,0 @@ -#!/bin/sh - -if [ "x$1" = "xhelp" ]; then - echo "Usage: ./httpd_roll_release tag log_name [user]" - echo "tag the tag to use when checking out the repository" - echo "log_name the name of a file to log the results to." - echo "user An optional user name to use when siging the release" - exit -else - TAG=$1 -fi - -LOG_NAME=`pwd`/$2 - -USER=$3 - -REPO="httpd-2.0" -WORKING_DIR=`echo "$REPO" | sed -e 's/[\-\.]/_/g'` -WORKING_TAG=`echo "$TAG" | sed -e 's/APACHE_2_0_/_/'` -WORKING_DIR="$WORKING_DIR$WORKING_TAG" - -START_DIR=`echo "$PWD"` - -# Check out the correct repositories. -echo "Checking out repository $REPO into $WORKING_DIR using tag $TAG" - -umask 022 -echo Checking out httpd-2.0 > $LOG_NAME -cvs checkout -r $TAG -d $WORKING_DIR $REPO >> $LOG_NAME -cd $WORKING_DIR/srclib -echo "Checking out apr and apr-util" >> $LOG_NAME -cvs checkout -r $TAG apr apr-util >> $LOG_NAME -cd $START_DIR/$WORKING_DIR - -# Make sure the master site's FAQ is up-to-date. It doesn't hurt to do this -# all the time. :-) -echo "Updating the site's FAQ" -(cd /www/www.apache.org/docs-2.0/misc ; cvs update) - -# Now update the FAQ in the tarball -rm -f docs/manual/misc/FAQ*.html -links -source http://www.apache.org/docs-2.0/misc/FAQ.html > docs/manual/misc/FAQ.html - -# Create the configure scripts -echo "Creating the configure script" -cd $START_DIR/$WORKING_DIR - -echo >> $LOG_NAME -echo "Running ./buildconf" >> $LOG_NAME -./buildconf >> $LOG_NAME -rm -f ltconfig ltmain.sh config.sub config.guess -cp /usr/local/share/libtool/ltconfig . -cp /usr/local/share/libtool/ltmain.sh . -cp /usr/local/share/libtool/config.sub . -cp /usr/local/share/libtool/config.guess . - -# Remove any files we don't distribute with our code -rm -f STATUS - -echo >> $LOG_NAME -echo "Removing files that we don't distribute" >> $LOG_NAME -find . -name ".cvsignore" -exec rm {} \; >> $LOG_NAME -find . -type d -name "test" | xargs rm -rf >> $LOG_NAME -find . -type d -name "CVS" | xargs rm -rf >> $LOG_NAME - -# expand SSI directives in the manual -echo "Making sure people can read the manual (expanding SSI's)" - -echo >> $LOG_NAME -echo "Making sure people can read the manual (expanding SSI's)" >> $LOG_NAME -( cd docs/manual ; chmod +x expand.pl ; ./expand.pl ; rm ./expand.pl ) >> $LOG_NAME - -# Time to roll the tarball -echo "Rolling the tarballs" - -cd $START_DIR -echo >> $LOG_NAME -echo "Rolling the tarball" >> $LOG_NAME -tar cvf $WORKING_DIR-alpha.tar $WORKING_DIR >> $LOG_NAME -cp -p $WORKING_DIR-alpha.tar x$WORKING_DIR-alpha.tar -gzip -9 $WORKING_DIR-alpha.tar -mv x$WORKING_DIR-alpha.tar $WORKING_DIR-alpha.tar -compress $WORKING_DIR-alpha.tar - -# Test the tarballs -echo "Testing the tarball" - -echo >> $LOG_NAME -echo "Testing the tarball $WORKING_DIR-alpha.tar.gz" >> $LOG_NAME -gunzip -c $WORKING_DIR-alpha.tar.gz | tar tvf - >> $LOG_NAME -zcat $WORKING_DIR-alpha.tar.Z | tar tvf - >> $LOG_NAME - -# remember the CHANGES file -echo "Copying the CHANGES file to this directory" -cp $WORKING_DIR/CHANGES . - -# cleanup -echo "Cleaning up my workspace" -rm -fr $WORKING_DIR - -if [ "x$USER" != "x" ]; then - USER="-u $USER" -fi - -echo Tagging the tarballs - -echo "Taggig the tarballs" >> $LOG_NAME -pgp -sba $WORKING_DIR-alpha.tar.gz $USER -pgp -sba $WORKING_DIR-alpha.tar.Z $USER - -pgp $WORKING_DIR-alpha.tar.gz.asc $WORKING_DIR-alpha.tar.gz >> $LOG_NAME -pgp $WORKING_DIR-alpha.tar.Z.asc $WORKING_DIR-alpha.tar.Z >> $LOG_NAME - -echo "Don't forget to make the tarballs available by copying them to the" -echo "/www/dev.apache.org/dist directory." diff --git a/build/install-bindist.sh.in b/build/install-bindist.sh.in deleted file mode 100755 index 0c8a23ed71adb4c82d7009fa52d1b3a404a8e327..0000000000000000000000000000000000000000 --- a/build/install-bindist.sh.in +++ /dev/null @@ -1,130 +0,0 @@ -#!/bin/sh -# -# Usage: install-bindist.sh [ServerRoot] -# This script installs the Apache binary distribution and -# was automatically created by binbuild.sh. - -lmkdir() -{ - path="" - dirs=`echo $1 | sed -e 's%/% %g'` - mode=$2 - - set -- ${dirs} - - for d in ${dirs} - do - path="${path}/$d" - if test ! -d "${path}" ; then - mkdir ${path} - if test $? -ne 0 ; then - echo "Failed to create directory: ${path}" - exit 1 - fi - chmod ${mode} ${path} - fi - done -} - -lcopy() -{ - from=$1 - to=$2 - dmode=$3 - fmode=$4 - - test -d ${to} || lmkdir ${to} ${dmode} - (cd ${from} && tar -cf - *) | (cd ${to} && tar -xf -) - - if test "X${fmode}" != X ; then - find ${to} -type f -print | xargs chmod ${fmode} - fi - if test "X${dmode}" != X ; then - find ${to} -type d -print | xargs chmod ${dmode} - fi -} - -## -## determine path to (optional) Perl interpreter -## -PERL=no-perl5-on-this-system -perls='perl5 perl' -path=`echo $PATH | sed -e 's/:/ /g'` - -for dir in ${path} ; do - for pperl in ${perls} ; do - if test -f "${dir}/${pperl}" ; then - if `${dir}/${pperl} -v | grep 'version 5\.' >/dev/null 2>&1` ; then - PERL="${dir}/${pperl}" - break - fi - fi - done -done - -if [ .$1 = . ] -then - SR=@default_dir@ -else - SR=$1 -fi -echo "Installing binary distribution for platform i686-pc-linux" -echo "into directory $SR ..." -lmkdir $SR 755 -lmkdir $SR/proxy 750 -lmkdir $SR/logs 750 -lcopy bindist/man $SR/man 755 644 -if [ -d bindist/modules ] -then - lcopy bindist/modules $SR/modules 750 750 -fi -lcopy bindist/include $SR/include 755 644 -lcopy bindist/icons $SR/icons 755 644 -lcopy bindist/cgi-bin $SR/cgi-bin 750 750 -lcopy bindist/bin $SR/bin 750 750 -if [ -d $SR/conf ] -then - echo "[Preserving existing configuration files.]" - cp bindist/conf/*-std.conf $SR/conf/ -else - lcopy bindist/conf $SR/conf 750 640 - sed -e "s%@default_dir@%$SR%" $SR/conf/httpd-std.conf > $SR/conf/httpd.conf -fi -if [ -d $SR/htdocs ] -then - echo "[Preserving existing htdocs directory.]" -else - lcopy bindist/htdocs $SR/htdocs 755 644 -fi -if [ -d $SR/error ] -then - echo "[Preserving existing error documents directory.]" -else - lcopy bindist/error $SR/error 755 644 -fi - -sed -e "s;^#!/.*;#!$PERL;" -e "s;\@prefix\@;$SR;" -e "s;\@sbindir\@;$SR/bin;" \ - -e "s;\@libexecdir\@;$SR/libexec;" -e "s;\@includedir\@;$SR/include;" \ - -e "s;\@sysconfdir\@;$SR/conf;" bindist/bin/apxs > $SR/bin/apxs -sed -e "s;^#!/.*;#!$PERL;" bindist/bin/dbmmanage > $SR/bin/dbmmanage -sed -e "s%@default_dir@%$SR%" \ - -e "s%^HTTPD=.*$%HTTPD=\"$SR/bin/httpd -d $SR\"%" bindist/bin/apachectl > $SR/bin/apachectl - -echo "Ready." -echo " +--------------------------------------------------------+" -echo " | You now have successfully installed the Apache @ver@ |" -echo " | HTTP server. To verify that Apache actually works |" -echo " | correctly you should first check the (initially |" -echo " | created or preserved) configuration files: |" -echo " | |" -echo " | $SR/conf/httpd.conf" -echo " | |" -echo " | You should then be able to immediately fire up |" -echo " | Apache the first time by running: |" -echo " | |" -echo " | $SR/bin/apachectl start " -echo " | |" -echo " | Thanks for using Apache. The Apache Group |" -echo " | http://www.apache.org/ |" -echo " +--------------------------------------------------------+" -echo " " diff --git a/build/install.sh b/build/install.sh deleted file mode 100755 index 9a8821fa2905d3e2adcc93deb84cc48fdcfa1c83..0000000000000000000000000000000000000000 --- a/build/install.sh +++ /dev/null @@ -1,112 +0,0 @@ -#!/bin/sh -## -## install.sh -- install a program, script or datafile -## -## Based on `install-sh' from the X Consortium's X11R5 distribution -## as of 89/12/18 which is freely available. -## Cleaned up for Apache's Autoconf-style Interface (APACI) -## by Ralf S. Engelschall -## -# -# This script falls under the Apache License. -# See http://www.apache.org/docs/LICENSE - - -# -# put in absolute paths if you don't have them in your path; -# or use env. vars. -# -mvprog="${MVPROG-mv}" -cpprog="${CPPROG-cp}" -chmodprog="${CHMODPROG-chmod}" -chownprog="${CHOWNPROG-chown}" -chgrpprog="${CHGRPPROG-chgrp}" -stripprog="${STRIPPROG-strip}" -rmprog="${RMPROG-rm}" - -# -# parse argument line -# -instcmd="$mvprog" -chmodcmd="" -chowncmd="" -chgrpcmd="" -stripcmd="" -rmcmd="$rmprog -f" -mvcmd="$mvprog" -ext="" -src="" -dst="" -while [ "x$1" != "x" ]; do - case $1 in - -c) instcmd="$cpprog" - shift; continue - ;; - -m) chmodcmd="$chmodprog $2" - shift; shift; continue - ;; - -o) chowncmd="$chownprog $2" - shift; shift; continue - ;; - -g) chgrpcmd="$chgrpprog $2" - shift; shift; continue - ;; - -s) stripcmd="$stripprog" - shift; continue - ;; - -S) stripcmd="$stripprog $2" - shift; shift; continue - ;; - -e) ext="$2" - shift; shift; continue - ;; - *) if [ "x$src" = "x" ]; then - src=$1 - else - dst=$1 - fi - shift; continue - ;; - esac -done -if [ "x$src" = "x" ]; then - echo "install.sh: no input file specified" - exit 1 -fi -if [ "x$dst" = "x" ]; then - echo "install.sh: no destination specified" - exit 1 -fi - -# -# If destination is a directory, append the input filename; if -# your system does not like double slashes in filenames, you may -# need to add some logic -# -if [ -d $dst ]; then - dst="$dst/`basename $src`" -fi - -# Add a possible extension (such as ".exe") to src and dst -src="$src$ext" -dst="$dst$ext" - -# Make a temp file name in the proper directory. -dstdir=`dirname $dst` -dsttmp=$dstdir/#inst.$$# - -# Move or copy the file name to the temp name -$instcmd $src $dsttmp - -# And set any options; do chmod last to preserve setuid bits -if [ "x$chowncmd" != "x" ]; then $chowncmd $dsttmp; fi -if [ "x$chgrpcmd" != "x" ]; then $chgrpcmd $dsttmp; fi -if [ "x$stripcmd" != "x" ]; then $stripcmd $dsttmp; fi -if [ "x$chmodcmd" != "x" ]; then $chmodcmd $dsttmp; fi - -# Now rename the file to the real destination. -$rmcmd $dst -$mvcmd $dsttmp $dst - -exit 0 - diff --git a/build/instdso.sh b/build/instdso.sh deleted file mode 100755 index c7b5d61564876dd8ea65daf188493116bffe3651..0000000000000000000000000000000000000000 --- a/build/instdso.sh +++ /dev/null @@ -1,54 +0,0 @@ -#!/bin/sh -# -# instdso.sh - install Apache DSO modules -# -# usually this just passes through to libtool but on a few -# platforms libtool doesn't install DSOs exactly like we'd -# want so more effort is required - -if test "$#" != "3"; then - echo "wrong number of arguments to instdso.sh" - echo "Usage: instdso.sh SH_LIBTOOL-value dso-name path-to-modules" - exit 1 -fi - -SH_LIBTOOL=`echo $1 | sed -e 's/^SH_LIBTOOL=//'` -DSOARCHIVE=$2 -TARGETDIR=$3 -DSOBASE=`echo $DSOARCHIVE | sed -e 's/\.la$//'` -TARGET_NAME="$DSOBASE.so" - -# special logic for systems where libtool doesn't install -# the DSO exactly like we'd want - -SYS=`uname -s` -case $SYS in - AIX) - # on AIX, shared libraries remain in storage even when - # all processes using them have exited; standard practice - # prior to installing a shared library is to rm -f first - CMD="rm -f $TARGETDIR/$TARGET_NAME" - echo $CMD - $CMD || exit $? - CMD="cp .libs/lib$DSOBASE.so.0 $TARGETDIR/$TARGET_NAME" - echo $CMD - $CMD || exit $? - ;; - HP-UX) - CMD="cp .libs/$DSOBASE.sl $TARGETDIR/$TARGET_NAME" - echo $CMD - $CMD || exit $? - ;; - OSF1) - CMD="cp .libs/lib$DSOBASE.so $TARGETDIR/$TARGET_NAME" - echo $CMD - $CMD || exit $? - ;; - *) - CMD="$SH_LIBTOOL --mode=install cp $DSOARCHIVE $TARGETDIR" - echo $CMD - $CMD || exit $? - ;; -esac - -exit 0 diff --git a/build/library.mk b/build/library.mk deleted file mode 100644 index abadb6340c517abd015d0db8967cb28736571daa..0000000000000000000000000000000000000000 --- a/build/library.mk +++ /dev/null @@ -1,42 +0,0 @@ -# Copyright (c) 1999, 2000 Sascha Schumann. All rights reserved. -# -# Redistribution and use in source and binary forms, with or without -# modification, are permitted provided that the following conditions -# are met: -# 1. Redistributions of source code must retain the above copyright -# notice, this list of conditions and the following disclaimer. -# 2. Redistributions in binary form must reproduce the above copyright -# notice, this list of conditions and the following disclaimer in the -# documentation and/or other materials provided with the distribution. -# -# THIS SOFTWARE IS PROVIDED BY SASCHA SCHUMANN ``AS IS'' AND ANY EXPRESS OR -# IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF -# MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO -# EVENT SHALL SASCHA SCHUMANN BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, -# PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; -# OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, -# WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR -# OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF -# ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -# -############################################################################## -# $Id: library.mk,v 1.1 2000/01/11 13:10:58 sascha Exp $ -# - -LTLIBRARY_OBJECTS = $(LTLIBRARY_SOURCES:.c=.lo) - -$(LTLIBRARY_NAME): $(LTLIBRARY_OBJECTS) $(LTLIBRARY_DEPENDENCIES) - $(LINK) $(LTLIBRARY_LDFLAGS) $(LTLIBRARY_OBJECTS) $(LTLIBRARY_LIBADD) - -$(LTLIBRARY_SHARED_NAME): $(LTLIBRARY_OBJECTS) $(LTLIBRARY_DEPENDENCIES) - @test -d $(phplibdir) || $(mkinstalldirs) $(phplibdir) - $(LINK) -avoid-version -module -rpath $(phplibdir) $(LTLIBRARY_LDFLAGS) $(LTLIBRARY_OBJECTS) $(LTLIBRARY_SHARED_LIBADD) - $(SHLIBTOOL) --mode=install install $@ $(phplibdir) - -shared: - @if test '$(SHLIBTOOL)' != '$(LIBTOOL)'; then \ - $(MAKE) 'LIBTOOL=$(SHLIBTOOL)' $(LTLIBRARY_SHARED_NAME); \ - else \ - $(MAKE) $(LTLIBRARY_SHARED_NAME); \ - fi; \ diff --git a/build/ltlib.mk b/build/ltlib.mk deleted file mode 100644 index 42bbb7cb1b7409acc9e685233f4758b64223ace2..0000000000000000000000000000000000000000 --- a/build/ltlib.mk +++ /dev/null @@ -1,31 +0,0 @@ -# Copyright (c) 1999, 2000 Sascha Schumann. All rights reserved. -# -# Redistribution and use in source and binary forms, with or without -# modification, are permitted provided that the following conditions -# are met: -# 1. Redistributions of source code must retain the above copyright -# notice, this list of conditions and the following disclaimer. -# 2. Redistributions in binary form must reproduce the above copyright -# notice, this list of conditions and the following disclaimer in the -# documentation and/or other materials provided with the distribution. -# -# THIS SOFTWARE IS PROVIDED BY SASCHA SCHUMANN ``AS IS'' AND ANY EXPRESS OR -# IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF -# MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO -# EVENT SHALL SASCHA SCHUMANN BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, -# PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; -# OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, -# WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR -# OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF -# ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -# -############################################################################## -# $Id: ltlib.mk,v 1.1 2000/01/11 13:10:58 sascha Exp $ -# - -targets = $(LTLIBRARY_NAME) - -include $(topsrcdir)/build/rules.mk -include $(topsrcdir)/build/library.mk - diff --git a/build/make_exports.awk b/build/make_exports.awk deleted file mode 100644 index 27fd631eb9eb2b6d20ca2d442209c1983450f8cf..0000000000000000000000000000000000000000 --- a/build/make_exports.awk +++ /dev/null @@ -1,120 +0,0 @@ - -BEGIN { - printf("/*\n") - printf(" * THIS FILE WAS AUTOGENERATED BY make_exports.awk\n") - printf(" *\n") - printf(" * This is an ugly hack that needs to be here, so\n") - printf(" * that libtool will link all of the APR functions\n") - printf(" * into server regardless of whether the base server\n") - printf(" * uses them.\n") - printf(" */\n") - printf("\n") - printf("#define CORE_PRIVATE\n") - printf("\n") - - for (i = 1; i < ARGC; i++) { - file = ARGV[i] - sub("([^/]*[/])*", "", file) - printf("#include \"%s\"\n", file) - } - - printf("\n") - printf("const void *ap_ugly_hack = NULL;\n") - printf("\n") - - TYPE_NORMAL = 0 - TYPE_HEADER = 1 - - stackptr = 0 -} - -function push(line) { - stack[stackptr] = line - stackptr++ -} - -function do_output() { - printf("/*\n") - printf(" * %s\n", FILENAME) - printf(" */\n") - - for (i = 0; i < stackptr; i++) { - printf("%s\n", stack[i]) - } - - stackptr = 0 - - printf("\n"); -} - -function enter_scope(type) { - scope++ - scope_type[scope] = type - scope_stack[scope] = stackptr - delete scope_used[scope] -} - -function leave_scope() { - used = scope_used[scope] - - if (!used) - stackptr = scope_stack[scope] - - scope-- - if (used) { - scope_used[scope] = 1 - - if (!scope) - do_output() - } -} - -function add_symbol(symbol) { - idx = index(symbol, "#") - - if (!idx) { - push("const void *ap_hack_" symbol " = (const void *)" symbol ";") - scope_used[scope] = 1 - } -} - -/^[ \t]*AP[RU]?_DECLARE[^(]*[(][^)]*[)]([^ ]* )*[^(]+[(]/ { - sub("[ \t]*AP[RU]?_DECLARE[^(]*[(][^)]*[)]", ""); - sub("[(].*", ""); - sub("^[ \t]+", ""); - sub("([^ ]* ^([ \t]*[(]))*", ""); - - add_symbol($0) - next -} - -/^#[ \t]*if(ndef| !defined[(])([^_]*_)*H/ { - enter_scope(TYPE_HEADER) - next -} - -/^#[ \t]*if([n]?def)? / { - enter_scope(TYPE_NORMAL) - push($0) - next -} - -/^#[ \t]*endif/ { - if (scope_type[scope] == TYPE_NORMAL) - push($0) - - leave_scope() - next -} - -/^#[ \t]*else/ { - push($0) - next -} - -/^#[ \t]*elif/ { - push($0) - next -} - - diff --git a/build/make_nw_export.awk b/build/make_nw_export.awk deleted file mode 100644 index 317e4bc7c364bbce02580fc23e75de441415d4a9..0000000000000000000000000000000000000000 --- a/build/make_nw_export.awk +++ /dev/null @@ -1,113 +0,0 @@ -# Based on apr's make_export.awk, which is -# based on Ryan Bloom's make_export.pl - -# List of functions that we don't support, yet?? -/apr_##name##_set_inherit/{next} -/apr_##name##_unset_inherit/{next} -/apr_compare_groups/{next} -/apr_compare_users/{next} -/apr_find_pool/{next} -/apr_generate_random_bytes/{next} -/apr_lock_create_np/{next} -/apr_md5_set_xlate/{next} -/apr_mmap_create/{next} -/apr_mmap_delete/{next} -/apr_mmap_offset/{next} -/apr_os_thread_get/{next} -/apr_os_thread_put/{next} -/apr_pool_free_blocks_num_bytes/{next} -/apr_pool_join/{next} -/apr_pool_num_bytes/{next} -/apr_proc_mutex_child_init/{next} -/apr_proc_mutex_create/{next} -/apr_proc_mutex_create_np/{next} -/apr_proc_mutex_destroy/{next} -/apr_proc_mutex_lock/{next} -/apr_proc_mutex_trylock/{next} -/apr_proc_mutex_unlock/{next} -/apr_proc_other_child_check/{next} -/apr_proc_other_child_read/{next} -/apr_proc_other_child_register/{next} -/apr_proc_other_child_unregister/{next} -/apr_sendfile/{next} -/apr_shm_avail/{next} -/apr_shm_calloc/{next} -/apr_shm_destroy/{next} -/apr_shm_free/{next} -/apr_shm_init/{next} -/apr_shm_malloc/{next} -/apr_shm_name_get/{next} -/apr_shm_name_set/{next} -/apr_shm_open/{next} -/apr_signal/{next} -/apr_signal_thread/{next} -/apr_socket_from_file/{next} -/apr_thread_once/{next} -/apr_thread_once_init/{next} -/apr_xlate_close/{next} -/apr_xlate_conv_buffer/{next} -/apr_xlate_conv_byte/{next} -/apr_xlate_conv_char/{next} -/apr_xlate_get_sb/{next} -/apr_xlate_open/{next} -/apr_brigade_consume/{next} -/apr_bucket_mmap_create/{next} -/apr_bucket_mmap_make/{next} -/apr_bucket_type_mmap/{next} -/apr_md4_set_xlate/{next} -#/XML_ParserFree/{next} -#/XML_ParserCreate/{next} -#/XML_SetUserData/{next} -#/XML_SetElementHandler/{next} -#/XML_SetCharacterDataHandler/{next} -#/XML_Parse/{next} -#/XML_GetErrorCode/{next} -#/XML_ErrorString/{next} - - -function add_symbol (sym_name) { - if (count) { - found++ - } -# for (i = 0; i < count; i++) { -# line = line "\t" -# } - line = line sym_name ",\n" - - if (count == 0) { - printf(" %s", line) - line = "" - } -} - -/^[ \t]*AP[RU]?_DECLARE[^(]*[(][^)]*[)]([^ ]* )*[^(]+[(]/ { - sub("[ \t]*AP[RU]?_DECLARE[^(]*[(][^)]*[)][ \t]*", "") - sub("[(].*", "") - sub("([^ ]* (^([ \t]*[(])))+", "") - - add_symbol($0) - next -} - -/^[ \t]*AP_DECLARE_HOOK[^(]*[(][^)]*[)]/ { - split($0, args, ",") - symbol = args[2] - sub("^[ \t]+", "", symbol) - sub("[ \t]+$", "", symbol) - - add_symbol("ap_hook_" symbol) - add_symbol("ap_hook_get_" symbol) - add_symbol("ap_run_" symbol) - next -} - -/^[ \t]*AP[RU]?_DECLARE_DATA .*;$/ { - varname = $NF; - gsub( /[*;]/, "", varname); - gsub( /\[.*\]/, "", varname); - add_symbol(varname); -} - -#END { -# printf(" %s", line) -#} diff --git a/build/make_var_export.awk b/build/make_var_export.awk deleted file mode 100644 index 62263f10e68b9cb76d038296cfcb9ce269298428..0000000000000000000000000000000000000000 --- a/build/make_var_export.awk +++ /dev/null @@ -1,59 +0,0 @@ -# Based on apr's make_export.awk, which is -# based on Ryan Bloom's make_export.pl - -/^#[ \t]*if(def)? (AP[RU]?_|!?defined).*/ { - if (old_filename != FILENAME) { - if (old_filename != "") printf("%s", line) - macro_no = 0 - found = 0 - count = 0 - old_filename = FILENAME - line = "" - } - macro_stack[macro_no++] = macro - macro = substr($0, length($1)+2) - count++ - line = line "#ifdef " macro "\n" - next -} - -/^#[ \t]*endif/ { - if (count > 0) { - count-- - line = line "#endif " macro "\n" - macro = macro_stack[--macro_no] - } - if (count == 0) { - if (found != 0) { - printf("%s", line) - } - line = "" - } - next -} - -function add_symbol (sym_name) { - if (count) { - found++ - } - for (i = 0; i < count; i++) { - line = line "\t" - } - line = line sym_name "\n" - - if (count == 0) { - printf("%s", line) - line = "" - } -} - -/^[ \t]*AP[RU]?_DECLARE_DATA .*;$/ { - varname = $NF; - gsub( /[*;]/, "", varname); - gsub( /\[.*\]/, "", varname); - add_symbol(varname); -} - -END { - printf("%s", line) -} diff --git a/build/mkconfNW.awk b/build/mkconfNW.awk deleted file mode 100644 index 3ec7a51bb1944f67744a40bb10ebba4bfe6309f9..0000000000000000000000000000000000000000 --- a/build/mkconfNW.awk +++ /dev/null @@ -1,59 +0,0 @@ - - -BEGIN { - - A["ServerRoot"] = "SYS:\APACHE2" - A["Port"] = "80" - -} - -/@@LoadModule@@/ { - print "#LoadModule auth_anon_module modules/authanon.nlm" - print "#LoadModule auth_dbm_module modules/authdbm.nlm" - print "#LoadModule auth_digest_module modules/digest.nlm" - print "#LoadModule cern_meta_module modules/cernmeta.nlm" - print "#LoadModule dav_module modules/mod_dav.nlm" - print "#LoadModule dav_fs_module modules/moddavfs.nlm" - print "#LoadModule expires_module modules/expires.nlm" - print "#LoadModule file_cache_module modules/filecach.nlm" - print "#LoadModule headers_module modules/headers.nlm" - print "#LoadModule info_module modules/info.nlm" - print "#LoadModule mime_magic_module modules/mimemagi.nlm" - print "#LoadModule proxy_module modules/proxy.nlm" - print "#LoadModule proxy_connect_module modules/proxy_connect.nlm" - print "#LoadModule proxy_http_module modules/proxy_http.nlm" - print "#LoadModule proxy_ftp_module modules/proxy_ftp.nlm" - print "#LoadModule rewrite_module modules/rewrite.nlm" - print "#LoadModule speling_module modules/speling.nlm" - print "#LoadModule status_module modules/status.nlm" - print "#LoadModule unique_id_module modules/uniqueid.nlm" - print "#LoadModule usertrack_module modules/usertrk.nlm" - print "#LoadModule vhost_alias_module modules/vhost.nlm" - print "" - next -} - -match ($0,/@@.*@@/) { - s=substr($0,RSTART+2,RLENGTH-4) -# substr($0,RSTART,RLENGTH) = A[s] - sub(/@@.*@@/,A[s],$0) -# print -} - - -{ - print -} - - -END { - print - print "#" - print "# SecureListen: Allows you to securely bind Apache to specific IP addresses " - print "# and/or ports." - print "#" - print "# Change this to SecureListen on specific IP addresses as shown below to " - print "# prevent Apache from glomming onto all bound IP addresses (0.0.0.0)" - print "#" - print "#SecureListen 443 \"SSL CertificateIP\"" -} diff --git a/build/mkdep.perl b/build/mkdep.perl deleted file mode 100644 index f9e06ea041ee8bd442b4e8305051f1c35556182b..0000000000000000000000000000000000000000 --- a/build/mkdep.perl +++ /dev/null @@ -1,91 +0,0 @@ -#!/usr/bin/perl -# -# $Id: mkdep.perl,v 1.1 2000/01/11 13:10:59 sascha Exp $ -# -# Created: Thu Aug 15 11:57:33 1996 too -# Last modified: Mon Dec 27 09:23:56 1999 too -# -# Copyright (c) 1996-1999 Tomi Ollila. All rights reserved. -# -# Redistribution and use in source and binary forms, with or without -# modification, are permitted provided that the following conditions -# are met: -# 1. Redistributions of source code must retain the above copyright -# notice, this list of conditions and the following disclaimer. -# 2. Redistributions in binary form must reproduce the above copyright -# notice, this list of conditions and the following disclaimer in the -# documentation and/or other materials provided with the distribution. -# -# THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR -# IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF -# MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO -# EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, -# PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; -# OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, -# WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR -# OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF -# ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - -die "Usage: mkdep CPP-command [CPP options] file1 [file2...]\n" - if ($#ARGV < 1); - -$cmdl = shift(@ARGV); - -$cmdl = "$cmdl " . shift (@ARGV) while ($ARGV[0] =~ /^-[A-Z]/); - -while ($file = shift(@ARGV)) -{ - $file =~ s/\.o$/.c/; - - open(F, "$cmdl $file|"); - - &parseout; - - close(F); -} - - -sub initinit -{ - %used = (); - $of = $file; - $of =~ s/\.c$/.lo/; - $str = "$of:\t$file"; - $len = length $str; -} - -sub initstr -{ - $str = "\t"; - $len = length $str; -} - -sub parseout -{ - &initinit; - while () - { - next unless (/^# [0-9]* "(.*\.h)"/); - - next if ($1 =~ /^\//); - - next if $used{$1}; - - $used{$1} = 1; - - $nlen = length($1) + 1; - - if ($len + $nlen > 72) - { - print $str, "\\\n"; - &initstr; - $str = $str . $1; - } - else { $str = $str . " " . $1; } - - $len += $nlen; - - } - print $str, "\n"; -} diff --git a/build/mkdir.sh b/build/mkdir.sh deleted file mode 100755 index 4cd33c5671cc98fd27e30f2570bf6a0d55600fd2..0000000000000000000000000000000000000000 --- a/build/mkdir.sh +++ /dev/null @@ -1,35 +0,0 @@ -#!/bin/sh -## -## mkdir.sh -- make directory hierarchy -## -## Based on `mkinstalldirs' from Noah Friedman -## as of 1994-03-25, which was placed in the Public Domain. -## Cleaned up for Apache's Autoconf-style Interface (APACI) -## by Ralf S. Engelschall -## -# -# This script falls under the Apache License. -# See http://www.apache.org/docs/LICENSE - - -umask 022 -errstatus=0 -for file in ${1+"$@"} ; do - set fnord `echo ":$file" |\ - sed -e 's/^:\//%/' -e 's/^://' -e 's/\// /g' -e 's/^%/\//'` - shift - pathcomp= - for d in ${1+"$@"}; do - pathcomp="$pathcomp$d" - case "$pathcomp" in - -* ) pathcomp=./$pathcomp ;; - esac - if test ! -d "$pathcomp"; then - echo "mkdir $pathcomp" 1>&2 - mkdir "$pathcomp" || errstatus=$? - fi - pathcomp="$pathcomp/" - done -done -exit $errstatus - diff --git a/build/nw_export.inc b/build/nw_export.inc deleted file mode 100644 index 27185ead30027d0d689f92eb15957343b60d59be..0000000000000000000000000000000000000000 --- a/build/nw_export.inc +++ /dev/null @@ -1,47 +0,0 @@ -/* Must include ap_config.h first so that we can redefine - the standard prototypes macros after it messes with - them. */ -#include "ap_config.h" - -/* Define all of the standard prototype macros as themselves - so that httpd.h will not mess with them. This allows - them to pass untouched so that the AWK script can pick - them out of the preprocessed result file. */ -#define AP_DECLARE AP_DECLARE -#define AP_CORE_DECLARE AP_CORE_DECLARE -#define AP_DECLARE_NONSTD AP_DECLARE_NONSTD -#define AP_CORE_DECLARE_NONSTD AP_CORE_DECLARE_NONSTD -#define AP_DECLARE_HOOK AP_DECLARE_HOOK -#define AP_DECLARE_DATA AP_DECLARE_DATA - -#include "httpd.h" - -/* Preprocess all of the standard HTTPD headers. */ -#include "ap_compat.h" -#include "ap_listen.h" -#include "ap_mmn.h" -#include "ap_mpm.h" -#include "ap_release.h" -#include "http_config.h" -#include "http_connection.h" -#include "http_core.h" -#include "http_log.h" -#include "http_main.h" -#include "http_protocol.h" -#include "http_request.h" -#include "http_vhost.h" -#include "mpm_common.h" -#include "pcreposix.h" -#include "rfc1413.h" -#include "scoreboard.h" -#include "util_cfgtree.h" -#include "util_charset.h" -#include "util_ebcdic.h" -#include "util_filter.h" -/*#include "util_ldap.h"*/ -#include "util_md5.h" -#include "util_script.h" -#include "util_time.h" -#include "util_xml.h" - -#include "mod_core.h" diff --git a/build/prebuildNW.bat b/build/prebuildNW.bat deleted file mode 100755 index d82be4e6d16b5ed3efa820238fa95150a5d58939..0000000000000000000000000000000000000000 --- a/build/prebuildNW.bat +++ /dev/null @@ -1,24 +0,0 @@ -@echo off -rem # As part of the pre-build process, the utilities GenChars.NLM -rem # (Gen Test Chars) and DFTables.NLM (dftables) must be built, -rem # copied to a NetWare server and run using the following commands: -rem # -rem # genchars >test_char.h -rem # dftables >chartables.c -rem # -rem # The files "sys:\test_chars.h" and "sys:\chartables.c" must be -rem # copied to "httpd\os\netware" on the build machine. - -@echo Fixing up the APR headers -copy ..\srclib\apr\include\apr.hnw ..\srclib\apr\include\apr.h - -@echo Fixing up the APR-Util headers -copy ..\srclib\apr-util\include\apu.h.in ..\srclib\apr-util\include\apu.h - -@echo Fixing up the pcre headers -copy ..\srclib\pcre\config.hw ..\srclib\pcre\config.h -copy ..\srclib\pcre\pcre.hw ..\srclib\pcre\pcre.h - -@echo Generating the import lists... -awk95 -f make_nw_export.awk ..\srclib\apr\include\*.h |sort > ..\os\netware\aprlib.imp -awk95 -f make_nw_export.awk ..\srclib\apr-util\include\*.h |sort > ..\os\netware\aprutil.imp \ No newline at end of file diff --git a/build/program.mk b/build/program.mk deleted file mode 100644 index bb52d8832c00fbffe08860bcf955d4b0240f24cf..0000000000000000000000000000000000000000 --- a/build/program.mk +++ /dev/null @@ -1,30 +0,0 @@ -# Copyright (c) 1999, 2000 Sascha Schumann. All rights reserved. -# -# Redistribution and use in source and binary forms, with or without -# modification, are permitted provided that the following conditions -# are met: -# 1. Redistributions of source code must retain the above copyright -# notice, this list of conditions and the following disclaimer. -# 2. Redistributions in binary form must reproduce the above copyright -# notice, this list of conditions and the following disclaimer in the -# documentation and/or other materials provided with the distribution. -# -# THIS SOFTWARE IS PROVIDED BY SASCHA SCHUMANN ``AS IS'' AND ANY EXPRESS OR -# IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF -# MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO -# EVENT SHALL SASCHA SCHUMANN BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, -# PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; -# OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, -# WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR -# OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF -# ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -# -############################################################################## -# $Id: program.mk,v 1.1 2000/01/11 13:10:59 sascha Exp $ -# - -PROGRAM_OBJECTS = $(PROGRAM_SOURCES:.c=.lo) - -$(PROGRAM_NAME): $(PROGRAM_DEPENDENCIES) $(PROGRAM_OBJECTS) - $(LINK) $(PROGRAM_LDFLAGS) $(PROGRAM_OBJECTS) $(PROGRAM_LDADD) diff --git a/build/rules.mk.in b/build/rules.mk.in deleted file mode 100644 index 659cbcf877f32ced4818674659874aa876f122ec..0000000000000000000000000000000000000000 --- a/build/rules.mk.in +++ /dev/null @@ -1,264 +0,0 @@ -# ==================================================================== -# The Apache Software License, Version 1.1 -# -# Copyright (c) 2000-2001 The Apache Software Foundation. All rights -# reserved. -# -# Redistribution and use in source and binary forms, with or without -# modification, are permitted provided that the following conditions -# are met: -# -# 1. Redistributions of source code must retain the above copyright -# notice, this list of conditions and the following disclaimer. -# -# 2. Redistributions in binary form must reproduce the above copyright -# notice, this list of conditions and the following disclaimer in -# the documentation and/or other materials provided with the -# distribution. -# -# 3. The end-user documentation included with the redistribution, -# if any, must include the following acknowledgment: -# "This product includes software developed by the -# Apache Software Foundation (http://www.apache.org/)." -# Alternately, this acknowledgment may appear in the software itself, -# if and wherever such third-party acknowledgments normally appear. -# -# 4. The names "Apache" and "Apache Software Foundation" must -# not be used to endorse or promote products derived from this -# software without prior written permission. For written -# permission, please contact apache@apache.org. -# -# 5. Products derived from this software may not be called "Apache", -# nor may "Apache" appear in their name, without prior written -# permission of the Apache Software Foundation. -# -# THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED -# WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES -# OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE -# DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR -# ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF -# USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND -# ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, -# OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT -# OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF -# SUCH DAMAGE. -# ==================================================================== -# -# This software consists of voluntary contributions made by many -# individuals on behalf of the Apache Software Foundation. For more -# information on the Apache Software Foundation, please see -# . -# -# The build environment was originally provided by Sascha Schumann. -# - -include $(top_builddir)/config_vars.mk - -# Combine all of the flags together in the proper order so that -# the user-defined flags can always override the configure ones, if needed. -# Note that includes are listed after the flags because -I options have -# left-to-right precedence and CPPFLAGS may include user-defined overrides. -# -ALL_CFLAGS = $(EXTRA_CFLAGS) $(NOTEST_CFLAGS) $(CFLAGS) -ALL_CPPFLAGS = $(DEFS) $(EXTRA_CPPFLAGS) $(NOTEST_CPPFLAGS) $(CPPFLAGS) -ALL_CXXFLAGS = $(EXTRA_CXXFLAGS) $(NOTEST_CXXFLAGS) $(CXXFLAGS) -ALL_LDFLAGS = $(EXTRA_LDFLAGS) $(NOTEST_LDFLAGS) $(LDFLAGS) -ALL_LIBS = $(EXTRA_LIBS) $(NOTEST_LIBS) $(LIBS) -ALL_INCLUDES = $(INCLUDES) $(EXTRA_INCLUDES) - -# Compile commands - -COMPILE = $(CC) $(ALL_CFLAGS) $(ALL_CPPFLAGS) $(ALL_INCLUDES) -CXX_COMPILE = $(CXX) $(ALL_CXXFLAGS) $(ALL_CPPFLAGS) $(ALL_INCLUDES) - -SH_COMPILE = $(LIBTOOL) --mode=compile $(COMPILE) @SHLTCFLAGS@ -c $< && touch $@ -SH_CXX_COMPILE = $(LIBTOOL) --mode=compile $(CXX_COMPILE) @SHLTCFLAGS@ -c $< && touch $@ - -LT_COMPILE = $(LIBTOOL) --mode=compile $(COMPILE) @LTCFLAGS@ -c $< && touch $@ -LT_CXX_COMPILE = $(LIBTOOL) --mode=compile $(CXX_COMPILE) @LTCFLAGS@ -c $< && touch $@ - -# Link-related commands - -LINK = $(LIBTOOL) --mode=link $(COMPILE) $(LT_LDFLAGS) $(ALL_LDFLAGS) -o $@ -SH_LINK = $(SH_LIBTOOL) --mode=link $(COMPILE) $(LT_LDFLAGS) $(ALL_LDFLAGS) $(SH_LDFLAGS) $(CORE_IMPLIB) -o $@ -MOD_LINK = $(LIBTOOL) --mode=link $(COMPILE) -module $(LT_LDFLAGS) $(ALL_LDFLAGS) -o $@ - -# Cross compile commands - -# Helper programs - -MKINSTALLDIRS = $(abs_srcdir)/build/mkdir.sh -INSTALL = $(abs_srcdir)/build/install.sh -c -INSTALL_DATA = $(INSTALL) -m 644 -INSTALL_PROGRAM = $(INSTALL) -m 755 $(INSTALL_PROG_FLAGS) - -# -# Standard build rules -# -all: all-recursive -depend: depend-recursive -clean: clean-recursive -distclean: distclean-recursive -extraclean: extraclean-recursive -install: install-recursive -shared-build: shared-build-recursive - -all-recursive install-recursive depend-recursive: - @otarget=`echo $@|sed s/-recursive//`; \ - list='$(SUBDIRS)'; \ - for i in $$list; do \ - if test -d "$$i"; then \ - target="$$otarget"; \ - echo "Making $$target in $$i"; \ - if test "$$i" = "."; then \ - made_local=yes; \ - target="local-$$target"; \ - fi; \ - (cd $$i && $(MAKE) $$target) || exit 1; \ - fi; \ - done; \ - if test "$$otarget" = "all" && test -z '$(TARGETS)'; then \ - made_local=yes; \ - fi; \ - if test "$$made_local" != "yes"; then \ - $(MAKE) "local-$$otarget" || exit 1; \ - fi - -clean-recursive distclean-recursive extraclean-recursive: - @otarget=`echo $@|sed s/-recursive//`; \ - list='$(SUBDIRS) $(CLEAN_SUBDIRS)'; \ - for i in $$list; do \ - if test -d "$$i"; then \ - target="$$otarget"; \ - echo "Making $$target in $$i"; \ - if test "$$i" = "."; then \ - made_local=yes; \ - target="local-$$target"; \ - fi; \ - (cd $$i && $(MAKE) $$target); \ - fi; \ - done; \ - if test "$$otarget" = "all" && test -z '$(TARGETS)'; then \ - made_local=yes; \ - fi; \ - if test "$$made_local" != "yes"; then \ - $(MAKE) "local-$$otarget"; \ - fi - -shared-build-recursive: - @if test `pwd` = "$(top_builddir)"; then \ - $(PRE_SHARED_CMDS) ; \ - fi; \ - list='$(SUBDIRS)'; for i in $$list; do \ - target="shared-build"; \ - if test "$$i" = "."; then \ - made_local=yes; \ - target="local-shared-build"; \ - fi; \ - if test "$$i" != "srclib"; then \ - (cd $$i && $(MAKE) $$target) || exit 1; \ - fi; \ - done; \ - if test -f 'modules.mk'; then \ - if test -n '$(SHARED_TARGETS)'; then \ - echo "Building shared: $(SHARED_TARGETS)"; \ - if test "$$made_local" != "yes"; then \ - $(MAKE) "local-shared-build" || exit 1; \ - fi; \ - fi; \ - fi; \ - if test `pwd` = "$(top_builddir)"; then \ - $(POST_SHARED_CMDS) ; \ - fi - -local-all: $(TARGETS) - -local-shared-build: $(SHARED_TARGETS) - -local-depend: x-local-depend - if test "`echo $(srcdir)/*.c`" != "$(srcdir)'/*.c'"; then \ - $(CC) -MM $(ALL_CPPFLAGS) $(ALL_INCLUDES) $(srcdir)/*.c | sed 's/\.o:/.lo:/' > $(builddir)/.deps || true; \ - fi - -local-clean: x-local-clean - rm -f *.o *.lo *.slo *.obj *.a *.la $(CLEAN_TARGETS) $(TARGETS) - rm -rf .libs - -local-distclean: local-clean x-local-distclean - rm -f .deps Makefile $(DISTCLEAN_TARGETS) - -local-extraclean: local-distclean x-local-extraclean - @if test -n "$(EXTRACLEAN_TARGETS)"; then \ - echo "rm -f $(EXTRACLEAN_TARGETS)"; \ - rm -f $(EXTRACLEAN_TARGETS) ; \ - fi - -local-install: $(TARGETS) $(SHARED_TARGETS) $(INSTALL_TARGETS) - @if test -n '$(PROGRAMS)'; then \ - test -d $(bindir) || $(MKINSTALLDIRS) $(bindir); \ - list='$(PROGRAMS)'; for i in $$list; do \ - $(INSTALL_PROGRAM) $$i $(bindir); \ - done; \ - fi - -# to be filled in by the actual Makefile if extra commands are needed -x-local-depend x-local-clean x-local-distclean x-local-extraclean: - -# -# Implicit rules for creating outputs from input files -# -CXX_SUFFIX = cpp -SHLIB_SUFFIX = so - -.SUFFIXES: -.SUFFIXES: .S .c .$(CXX_SUFFIX) .lo .o .s .y .l .slo .def .la - -.c.o: - $(COMPILE) -c $< - -.s.o: - $(COMPILE) -c $< - -.c.lo: - $(LT_COMPILE) - -.s.lo: - $(LT_COMPILE) - -.c.slo: - $(SH_COMPILE) - -.$(CXX_SUFFIX).lo: - $(LT_CXX_COMPILE) - -.$(CXX_SUFFIX).slo: - $(SH_CXX_COMPILE) - -.y.c: - $(YACC) $(YFLAGS) $< && mv y.tab.c $*.c - if test -f y.tab.h; then \ - if cmp -s y.tab.h $*.h; then rm -f y.tab.h; else mv y.tab.h $*.h; fi; \ - else :; fi - -.l.c: - $(LEX) $(LFLAGS) $< && mv $(LEX_OUTPUT_ROOT).c $@ - -# Makes an import library from a def file -.def.la: - $(LIBTOOL) --mode=compile $(MK_IMPLIB) -o $@ $< - -# -# Dependencies -# -include $(builddir)/.deps - -.PHONY: all all-recursive install-recursive local-all $(PHONY_TARGETS) \ - shared-build shared-build-recursive local-shared-build \ - depend depend-recursive local-depend x-local-depend \ - clean clean-recursive local-clean x-local-clean \ - distclean distclean-recursive local-distclean x-local-distclean \ - extraclean extraclean-recursive local-extraclean x-local-extraclean \ - install local-install $(INSTALL_TARGETS) - diff --git a/build/special.mk b/build/special.mk deleted file mode 100644 index 0068836ff3baede029ec6063e6637d8c26f74454..0000000000000000000000000000000000000000 --- a/build/special.mk +++ /dev/null @@ -1,45 +0,0 @@ -# Copyright (c) 1999, 2000 Sascha Schumann. All rights reserved. -# -# Redistribution and use in source and binary forms, with or without -# modification, are permitted provided that the following conditions -# are met: -# 1. Redistributions of source code must retain the above copyright -# notice, this list of conditions and the following disclaimer. -# 2. Redistributions in binary form must reproduce the above copyright -# notice, this list of conditions and the following disclaimer in the -# documentation and/or other materials provided with the distribution. -# -# THIS SOFTWARE IS PROVIDED BY SASCHA SCHUMANN ``AS IS'' AND ANY EXPRESS OR -# IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF -# MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO -# EVENT SHALL SASCHA SCHUMANN BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, -# PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; -# OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, -# WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR -# OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF -# ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -# -############################################################################## -# $Id: special.mk,v 1.1 2000/01/11 13:10:59 sascha Exp $ -# - - - -all: all-recursive - -include modules.mk -targets = $(static) $(shared) -install_targets = install-modules - -install-modules: - @shared='$(shared)'; \ - if test -n "$$shared"; then \ - $(mkinstalldirs) $(libexecdir); \ - for i in $$shared; do \ - $(SHLIBTOOL) --mode=install cp $$i $(libexecdir); \ - done; \ - fi - -include $(topsrcdir)/build/rules.mk - diff --git a/build/sysv_makefile b/build/sysv_makefile deleted file mode 100755 index ef37030dde7112ee1496430713d5f1cbe7d2a6d7..0000000000000000000000000000000000000000 --- a/build/sysv_makefile +++ /dev/null @@ -1,71 +0,0 @@ -#! /bin/sh -# ==================================================================== -# The Apache Software License, Version 1.1 -# -# Copyright (c) 2000 The Apache Software Foundation. All rights -# reserved. -# -# Redistribution and use in source and binary forms, with or without -# modification, are permitted provided that the following conditions -# are met: -# -# 1. Redistributions of source code must retain the above copyright -# notice, this list of conditions and the following disclaimer. -# -# 2. Redistributions in binary form must reproduce the above copyright -# notice, this list of conditions and the following disclaimer in -# the documentation and/or other materials provided with the -# distribution. -# -# 3. The end-user documentation included with the redistribution, -# if any, must include the following acknowledgment: -# "This product includes software developed by the -# Apache Software Foundation (http://www.apache.org/)." -# Alternately, this acknowledgment may appear in the software itself, -# if and wherever such third-party acknowledgments normally appear. -# -# 4. The names "Apache" and "Apache Software Foundation" must -# not be used to endorse or promote products derived from this -# software without prior written permission. For written -# permission, please contact apache@apache.org. -# -# 5. Products derived from this software may not be called "Apache", -# nor may "Apache" appear in their name, without prior written -# permission of the Apache Software Foundation. -# -# THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED -# WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES -# OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE -# DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR -# ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF -# USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND -# ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, -# OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT -# OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF -# SUCH DAMAGE. -# ==================================================================== -# -# This software consists of voluntary contributions made by many -# individuals on behalf of the Apache Software Foundation. For more -# information on the Apache Software Foundation, please see -# . -# -# The build environment was provided by Sascha Schumann. -# - -# cwd must be top_srcdir -test -f build/sysv_makefile || exit 2 - -test -f bsd_converted || exit 1 - -tmpfile=`mktemp /tmp/sysv_makefile.XXXXXX` || exit 1 -for i in build/*.mk; do - sed 's/^\.include "\(.*\)"/include \1/' $i >$tmpfile \ - && cp $tmpfile $i -done -rm -f $tmpfile - -rm bsd_converted -exit 0 diff --git a/build/win32/.cvsignore b/build/win32/.cvsignore deleted file mode 100644 index 3a755604911c741e2384e2f15db1667b6287d535..0000000000000000000000000000000000000000 --- a/build/win32/.cvsignore +++ /dev/null @@ -1,2 +0,0 @@ -Apache.aps -Apache.rc diff --git a/build/win32/apache.ico b/build/win32/apache.ico deleted file mode 100644 index 5e8adcbfc5d201d6e667decdb04c71ea26f9ee89..0000000000000000000000000000000000000000 Binary files a/build/win32/apache.ico and /dev/null differ diff --git a/build/win32/win32ver.awk b/build/win32/win32ver.awk deleted file mode 100644 index 8862aa87f341ba2bf36cd390a57a3909bf7307db..0000000000000000000000000000000000000000 --- a/build/win32/win32ver.awk +++ /dev/null @@ -1,108 +0,0 @@ -BEGIN { - - # ff bits: 1(debug), 2(prerelease), 4(patched), 8(vendor) and 32(special) - # debug is summed based on the /Define _DEBUG - # prerelease is based on the -dev extension, - # patched is based on a non-standard "-ver" extension, - # special and vendor are toggled by their args. - # - ff = 0; - - file=ARGV[1]; - desc=ARGV[2]; - rel_h=ARGV[3]; - - i = 4; - while (length(ARGV[i])) { - if (match(ARGV[i], /icon=/)) { - icon = substr(ARGV[i], 6); - } - if (match(ARGV[i], /vendor=/)) { - vendor = substr(ARGV[i], 8); - ff = ff + 8; - } - if (match(ARGV[i], /special=/)) { - special = substr(ARGV[i], 9); - ff = ff + 32; - } - i = i + 1 - } - - i = i - 1; - while (i) { - delete ARGV[i]; - i = i - 1; - } - - while ((getline < rel_h) > 0) { - if (match ($0, /^#define AP_SERVER_BASEREVISION "[^"]+"/)) { - ver = substr($0, RSTART + 32, RLENGTH - 33); - } - } - - verc = ver; - gsub(/\./, ",", verc); - if (build) { - sub(/-.*/, "", verc) - verc = verc "," build; - } else if (sub(/-dev/, ",0", verc)) { - ff = ff + 2; - } else if (!sub(/-alpha/, ",10", verc) \ - && !sub(/-beta/, ",100", verc) \ - && !sub(/-gold/, ",200", verc)) { - sub(/-.*/, "", verc); - verc = verc "," 0; - } - - if (length(vendor)) { - ff = ff + 8; - } - - if (length(icon)) { - print "1 ICON DISCARDABLE \"" icon "\""; - } - print "1 VERSIONINFO"; - print " FILEVERSION " verc ""; - print " PRODUCTVERSION " verc ""; - print " FILEFLAGSMASK 0x3fL"; - print "#if defined(_DEBUG)" - print " FILEFLAGS 0x" sprintf("%02x", ff + 1) "L"; - print "#else" - print " FILEFLAGS 0x" sprintf("%02x", ff) "L"; - print "#endif" - print " FILEOS 0x40004L"; - print " FILETYPE 0x1L"; - print " FILESUBTYPE 0x0L"; - print "BEGIN"; - print " BLOCK \"StringFileInfo\""; - print " BEGIN"; - print " BLOCK \"00000000\""; - print " BEGIN"; - print " VALUE \"Comments\", \"This software consists of " \ - "voluntary contributions made by many individuals on behalf of " \ - "the Apache Software Foundation. For more information on the " \ - "Apache Software Foundation, please see \\0\""; - print " VALUE \"CompanyName\", \"Apache Software Foundation.\\0\""; - print " VALUE \"FileDescription\", \"" desc "\\0\""; - print " VALUE \"FileVersion\", \"" ver "\\0\""; - print " VALUE \"InternalName\", \"" file "\\0\""; - print " VALUE \"LegalCopyright\", \"Copyright (c) 2001, " \ - "The Apache Software Foundation. Current License is available from " \ - "\\0\""; - print " VALUE \"OriginalFilename\", \"" file ".exe\\0\""; - if (vendor) { - print " VALUE \"PrivateBuild\", \"" vendor "\\0\""; - } - if (special) { - print " VALUE \"SpecialBuild\", \"" vendor "\\0\""; - } - print " VALUE \"ProductName\", \"Apache httpd Server\\0\""; - print " VALUE \"ProductVersion\", \"" ver "\\0\""; - print " END"; - print " END"; - print " BLOCK \"VarFileInfo\""; - print " BEGIN"; - print " VALUE \"Translation\", 0, 1200"; - print " END"; - print "END"; -} \ No newline at end of file diff --git a/buildconf b/buildconf deleted file mode 100755 index 123c717a22b4df1af6da50e4c81664f905fe35c5..0000000000000000000000000000000000000000 --- a/buildconf +++ /dev/null @@ -1,107 +0,0 @@ -#!/bin/sh - -# TODO - Steal the new PHP buildconf and build.mk. -# This will do for now, though - -supplied_flag=$1 - -# do some version checking for the tools we use -if test "$1" = "--force"; then - shift -# this is a posix correct "test -nt" -elif test "`ls -t buildconf buildconf.stamp 2>/dev/null |head -1`" != "buildconf"; then - : -else - echo "buildconf: checking installation..." - - # autoconf will check for the version itself - # automake 1.4 or newer - am_version=`automake --version 2>/dev/null|head -1|sed -e 's/^[^0-9]*//' -e 's/[a-z]* *$//'` - if test "$am_version" = ""; then - echo "buildconf: automake not found." - echo " You need automake version 1.4 or newer installed" - echo " to build APACHE from CVS." - exit 1 - fi - IFS=.; set $am_version; IFS=' ' - if test "$1" = "1" -a "$2" -lt "4" || test "$1" -lt "1"; then - echo "buildconf: automake version $am_version found." - echo " You need automake version 1.4 or newer installed" - echo " to build APACHE from CVS." - exit 1 - else - echo "buildconf: automake version $am_version (ok)" - fi - - # libtool 1.3.3 or newer - lt_pversion=`libtool --version 2>/dev/null|sed -e 's/^[^0-9]*//' -e 's/[- ].*//'` - if test "$lt_pversion" = ""; then - echo "buildconf: libtool not found." - echo " You need libtool version 1.3 or newer installed" - echo " to build APACHE from CVS." - exit 1 - fi - lt_version=`echo $lt_pversion|sed -e 's/\([a-z]*\)$/.\1/'` - IFS=.; set $lt_version; IFS=' ' - if test "$1" -gt "1" || test "$2" -gt "3" || test "$2" = "3" -a "$3" -ge "3" - then - echo "buildconf: libtool version $lt_pversion (ok)" - else - echo "buildconf: libtool version $lt_pversion found." - echo " You need libtool version 1.3.3 or newer installed" - echo " to build APACHE from CVS." - exit 1 - fi - touch buildconf.stamp -fi - -am_prefix=`which automake | sed -e 's#/[^/]*/[^/]*$##'` -lt_prefix=`which libtool | sed -e 's#/[^/]*/[^/]*$##'` -if test "$am_prefix" != "$lt_prefix"; then - echo "buildconf: WARNING: automake and libtool are installed in different" - echo " directories. This may cause aclocal to fail." - echo "buildconf: continuing anyway" -fi - -if test "$supplied_flag" = "--copy"; then - automake_flags=--copy -fi - -./helpers/build-acconfig-header - -mv aclocal.m4 aclocal.m4.old 2>/dev/null -aclocal -if test "$?" != "0" -a "$am_prefix" != "$lt_prefix"; then - echo "buildconf: ERROR: aclocal failed, probably because automake and" - echo " libtool are installed with different prefixes;" - echo " automake is installed in $am_prefix, but libtool in $lt_prefix." - echo " Please re-install automake and/or libtool with a common prefix" - echo " and try again." - exit 1 -fi - -if cmp aclocal.m4.old aclocal.m4 > /dev/null 2>&1; then - echo "buildconf: keeping aclocal.m4" - mv aclocal.m4.old aclocal.m4 -else - echo "buildconf: created or modified aclocal.m4" -fi - -autoheader - -# find all Makefile.ams -files="Makefile `find ap lib main modules regex os -name Makefile.am | sed 's#\.am##' | tr '\n' ' '`" - -# suppress stupid automake warning -automake --add-missing --include-deps $automake_flags $files 2>&1 | grep -v \$APACHE_OUTPUT_FILES >&2 - - -mv configure configure.old 2>/dev/null -autoconf -if cmp configure.old configure > /dev/null 2>&1; then - echo "buildconf: keeping configure" - mv configure.old configure -else - echo "buildconf: created or modified configure" -fi - diff --git a/config.layout b/config.layout deleted file mode 100644 index d79741e234694962d73724ec72d9ac18575fa428..0000000000000000000000000000000000000000 --- a/config.layout +++ /dev/null @@ -1,251 +0,0 @@ -## -## config.layout -- APACI Pre-defined Installation Path Layouts -## -## Hints: -## - layouts can be loaded with APACI's --with-layout=ID option -## - when no --with-layout option is given, the default layout is `Apache' -## - a trailing plus character (`+') on paths is replaced with a -## `/' suffix where is the the argument from -## option --target (defaults to `httpd'). -## - -# Classical Apache path layout. - - prefix: /usr/local/apache - exec_prefix: $prefix - bindir: $exec_prefix/bin - sbindir: $exec_prefix/bin - libexecdir: $exec_prefix/libexec - mandir: $prefix/man - sysconfdir: $prefix/conf - datadir: $prefix - iconsdir: $datadir/icons - htdocsdir: $datadir/htdocs - cgidir: $datadir/cgi-bin - includedir: $prefix/include - localstatedir: $prefix - runtimedir: $localstatedir/logs - logfiledir: $localstatedir/logs - proxycachedir: $localstatedir/proxy - - -# GNU standards conforming path layout. -# See FSF's GNU project `make-stds' document for details. - - prefix: /usr/local - exec_prefix: $prefix - bindir: $exec_prefix/bin - sbindir: $exec_prefix/sbin - libexecdir: $exec_prefix/libexec - mandir: $prefix/man - sysconfdir: $prefix/etc+ - datadir: $prefix/share+ - iconsdir: $datadir/icons - htdocsdir: $datadir/htdocs - cgidir: $datadir/cgi-bin - includedir: $prefix/include+ - localstatedir: $prefix/var+ - runtimedir: $localstatedir/run - logfiledir: $localstatedir/log - proxycachedir: $localstatedir/proxy - - -# Apache binary distribution path layout - - prefix: /usr/local/apache - exec_prefix: - bindir: bin - sbindir: bin - libexecdir: libexec - mandir: man - sysconfdir: conf - datadir: - iconsdir: icons - htdocsdir: htdocs - cgidir: cgi-bin - includedir: include - localstatedir: - runtimedir: logs - logfiledir: logs - proxycachedir: proxy - - -# Mac OS X Server (Rhapsody) - - prefix: /Local/Library/WebServer - exec_prefix: /usr - bindir: $exec_prefix/bin - sbindir: $exec_prefix/sbin - libexecdir: /System/Library/Apache/Modules - mandir: $exec_prefix/share/man - sysconfdir: $prefix/Configuration - datadir: $prefix - iconsdir: /System/Library/Apache/Icons - htdocsdir: $datadir/Documents - cgidir: $datadir/CGI-Executables - includedir: /System/Library/Frameworks/Apache.framework/Versions/1.3/Headers - localstatedir: /var - runtimedir: $prefix/Logs - logfiledir: $prefix/Logs - proxycachedir: $prefix/ProxyCache - - -# Darwin/Mac OS Layout - - prefix: /usr - exec_prefix: $prefix - bindir: $exec_prefix/bin - sbindir: $exec_prefix/sbin - libexecdir: $exec_prefix/libexec+ - mandir: $prefix/share/man - datadir: /Library/WebServer - sysconfdir: /etc+ - iconsdir: $prefix/share/httpd/icons - htdocsdir: $datadir/Documents - cgidir: $datadir/CGI-Executables - includedir: $prefix/include+ - localstatedir: /var - runtimedir: $localstatedir/run - logfiledir: $localstatedir/log+ - proxycachedir: $runtimedir/proxy - - -# RedHat 5.x layout - - prefix: /usr - exec_prefix: $prefix - bindir: $prefix/bin - sbindir: $prefix/sbin - libexecdir: $prefix/lib/apache - mandir: $prefix/man - sysconfdir: /etc/httpd/conf - datadir: /home/httpd - iconsdir: $datadir/icons - htdocsdir: $datadir/html - cgidir: $datadir/cgi-bin - includedir: $prefix/include/apache - localstatedir: /var - runtimedir: $localstatedir/run - logfiledir: $localstatedir/log/httpd - proxycachedir: $localstatedir/cache/httpd - - -# According to the /opt filesystem conventions - - prefix: /opt/apache - exec_prefix: $prefix - bindir: $exec_prefix/bin - sbindir: $exec_prefix/sbin - libexecdir: $exec_prefix/libexec - mandir: $prefix/man - sysconfdir: /etc$prefix - datadir: $prefix/share - iconsdir: $datadir/icons - htdocsdir: $datadir/htdocs - cgidir: $datadir/cgi-bin - includedir: $prefix/include - localstatedir: /var$prefix - runtimedir: $localstatedir/run - logfiledir: $localstatedir/logs - proxycachedir: $localstatedir/proxy - - -# BeOS layout... - - prefix: /boot/home/apache - exec_prefix: $prefix - bindir: $exec_prefix/bin - sbindir: $exec_prefix/bin - libexecdir: $exec_prefix/libexec - mandir: $prefix/man - sysconfdir: $prefix/conf - datadir: $prefix - iconsdir: $datadir/icons - htdocsdir: $datadir/htdocs - cgidir: $datadir/cgi-bin - includedir: $prefix/include - localstatedir: $prefix - runtimedir: $localstatedir/logs - logfiledir: $localstatedir/logs - proxycachedir: $localstatedir/proxy - - -# SuSE 6.x layout - - prefix: /usr - exec_prefix: $prefix - bindir: $prefix/bin - sbindir: $prefix/sbin - libexecdir: $prefix/lib/apache - mandir: $prefix/man - sysconfdir: /etc/httpd - datadir: /usr/local/httpd - iconsdir: $datadir/icons - htdocsdir: $datadir/htdocs - cgidir: $datadir/cgi-bin - includedir: $prefix/include/apache - localstatedir: /var - runtimedir: $localstatedir/run - logfiledir: $localstatedir/log/httpd - proxycachedir: $localstatedir/cache/httpd - - -# BSD/OS layout - - prefix: /var/www - exec_prefix: /usr/contrib - bindir: $exec_prefix/bin - sbindir: $exec_prefix/bin - libexecdir: $exec_prefix/libexec/apache - mandir: $exec_prefix/man - sysconfdir: $prefix/conf - datadir: $prefix - iconsdir: $datadir/icons - htdocsdir: $datadir/htdocs - cgidir: $datadir/cgi-bin - includedir: $exec_prefix/include/apache - localstatedir: /var - runtimedir: $localstatedir/run - logfiledir: $localstatedir/log/httpd - proxycachedir: $localstatedir/proxy - - -# Solaris 8 Layout - - prefix: /usr/apache - exec_prefix: $prefix - bindir: $exec_prefix/bin - sbindir: $exec_prefix/bin - libexecdir: $exec_prefix/libexec - mandir: $exec_prefix/man - sysconfdir: /etc/apache - datadir: /var/apache - iconsdir: $datadir/icons - htdocsdir: $datadir/htdocs - cgidir: $datadir/cgi-bin - includedir: $exec_prefix/include - localstatedir: $prefix - runtimedir: /var/run - logfiledir: $datadir/logs - proxycachedir: $datadir/proxy - - -# OpenBSD Layout - - prefix: /var/www - exec_prefix: /usr - bindir: $exec_prefix/bin - sbindir: $exec_prefix/sbin - libexecdir: $exec_prefix/lib/apache/modules - mandir: $exec_prefix/share/man - sysconfdir: $prefix/conf - datadir: $prefix - iconsdir: $prefix/icons - htdocsdir: $prefix/htdocs - cgidir: $prefix/cgi-bin - includedir: $exec_prefix/lib/apache/include - localstatedir: $prefix - runtimedir: $prefix/logs - logfiledir: $prefix/logs - proxycachedir: $prefix/proxy - diff --git a/configure.in b/configure.in deleted file mode 100644 index 952328afe767d97dbc8cabe327cf46c076de874f..0000000000000000000000000000000000000000 --- a/configure.in +++ /dev/null @@ -1,92 +0,0 @@ -dnl ## Process this file with autoconf to produce a configure script - -AC_PREREQ(2.13) -AC_INIT(main/http_main.c) -AM_INIT_AUTOMAKE(apache, 2.0-dev) - -dnl This would be in src/include, but I think I've found an autoheader bug -AM_CONFIG_HEADER(ap_config_auto.h) - -dnl ## This is the central place where Apache's version should be kept. - -APACHE_VERSION=$VERSION -AC_SUBST(APACHE_VERSION) - -dnl XXX - doesn't actually work, because of the APACHE_OUTPUT_FILES error -AM_MAINTAINER_MODE - -dnl We want this one before the checks, so the checks can modify CFLAGS -test -z "$CFLAGS" && auto_cflags=1 - -dnl Needed for APACHE_MODULE() to work -cwd=`pwd` - -dnl ## Check for programs - -dnl AC_PROG_AWK -AC_PROG_CC -AC_PROG_CPP -AC_PROG_INSTALL -dnl AC_PROG_RANLIB -dnl AC_PATH_PROG(PERL_PATH, perl) - -dnl info autoconf says AIX needs this. Okay. -AC_AIX - -dnl ## Check for libraries - -dnl ## Check for header files - -dnl I think these are just used all over the place, so just check for -dnl them at the base of the tree. If some are specific to a single -dnl directory, they should be moved (Comment #Spoon) - -AC_CHECK_HEADERS( \ -unistd.h \ -sys/times.h \ -sys/time.h \ -) - -dnl ## Check for typedefs, structures, and compiler characteristics. - -AC_C_INLINE - -dnl ## Check for library functions - -dnl See Comment #Spoon - -AC_CHECK_FUNCS( \ -strdup \ -strcasecmp \ -strncasecmp \ -strstr \ -strerror \ -initgroups \ -waitpid \ -difftime \ -gettimeofday \ -memmove \ -) - -AM_PROG_LIBTOOL - -dnl ## Checking command-line options -test -n "$GCC" && test "$USE_MAINTAINER_MODE" = "yes" && \ - CFLAGS="$CFLAGS -g -Wall -Wmissing-prototypes -Wstrict-prototypes -Wmissing-declarations" - -INCLUDES="-I\$(top_srcdir)/include -I\$(top_srcdir)/lib/apr/include" -AC_SUBST(INCLUDES) - -dnl reading config stubs -esyscmd(./helpers/config-stubs .) - -INCLUDES="$INCLUDES -I\$(top_srcdir)/\$(OS_DIR)" -AC_SUBST(EXTRA_LIBS) -AC_SUBST(REGEX_DIR) -AC_SUBST(REGEX_LIB) -AC_SUBST(MPM_LIB) -AC_SUBST(OS) -AC_SUBST(OS_DIR) - -AC_OUTPUT([Makefile ap/Makefile main/Makefile lib/apr/Makefile os/Makefile - $APACHE_OUTPUT_FILES]) diff --git a/docs/STATUS b/docs/STATUS deleted file mode 100644 index d9b26c2f9a127f1757a606e25401fb6dabe3bdcd..0000000000000000000000000000000000000000 --- a/docs/STATUS +++ /dev/null @@ -1,76 +0,0 @@ -Apache HTTP Server 2.0 Documentation Status File. - -If you are interested in helping accomplish some of the tasks on this -list or otherwise improving the documentation, please join the -apache-docs mailing list by mailing to -apache-docs-subscribe@apache.org - -- man pages - - Some of the man pages need to be updated for 2.0. At least - the httpd man page appears to be outdated, and perhaps other. - After this is done, the manual/programs/ versions can be - regenerated. - -- XHTML conversion - Status: James A Sutherland was going - to spearhead this, but we haven't heard anything - lately. Some work is still needed - to determine what the SSIs should look like. - -- MPM documentation - - Each MPM needs to have a documentation file in manual/mod/ - which lists the directives it provides, and some details - about its operation. - Status: Initial outlines done. Much more details need to be - filled in. - - Non unix/windows MPMs still need to be completed. - - perchild MPM needs some docs. - -- Merging of changes in 1.3. - - There have been many changes in the 1.3 docs which haven't - been propagated into 2.0. - Things which need to be merged: ??? - -- Cleaning. - - We could use a list of all the docs that can be axed out of 2.0 - because they are redundant or irrelevant. - Status: - Some suggestions on files to axe. Feel free to comment. - manual/cgi-path.html (should be documented in mod_cgi.html instead) - manual/process-model.html (documented in MPMs, eventually) - platform/perf-* (are these relevant anymore?) - - - - Individual docs will need some cleanup. - Status: What docs still need to be touched here? - - invoking.html has had a first-pass cleaning done. - - misc/perf-tuning.html - needs major rewrite for 2.0 - - misc/FAQ.html - some old questions could be remove - - is a new format in order? - - misc/tutorials.html - mostly not relevant to 2.0 - - misc/stopping.html - - dso.html - - misc/rewriteguide.html - needs cleaning in 1.3 and 2.0 - - misc/known_client_problems.html - mostly ancient - - howto/* - some syntax has changed in 2.0 due to - filtering and mod_cgid - -- New build process. - - The new build process is autoconf based, so manual/install.html - will need to be completely rewritten. Someone with enough - patience could probably figure out most of the important stuff - by trial and error. - Status: Ryan's "Building and Installing Apache 2.0" might be - a starting place. - -- Documentation of new features. - - This will probably require more input from new-httpd, since - not many people here follow the development process close - enough to know what is going on. - Status: Ryan has two ApacheToday articles which may be useful - for this. - New features which need documentation: - - filters !!! - -- Translations - Status: ??? diff --git a/docs/cgi-examples/printenv b/docs/cgi-examples/printenv deleted file mode 100644 index 7d389e0ac562197c18a4712e887b7c0e580a69b9..0000000000000000000000000000000000000000 --- a/docs/cgi-examples/printenv +++ /dev/null @@ -1,7 +0,0 @@ -#!/usr/local/bin/perl - -print "Content-type: text/html\n\n"; -while (($key, $val) = each %ENV) { - print "$key = $val
    \n"; -} - diff --git a/docs/cgi-examples/test-cgi b/docs/cgi-examples/test-cgi deleted file mode 100644 index a85631e3aa2b6c0cef0afb6362a5b9fd5b28dceb..0000000000000000000000000000000000000000 --- a/docs/cgi-examples/test-cgi +++ /dev/null @@ -1,31 +0,0 @@ -#!/bin/sh - -# disable filename globbing -set -f - -echo Content-type: text/plain -echo - -echo CGI/1.0 test script report: -echo - -echo argc is $#. argv is "$*". -echo - -echo SERVER_SOFTWARE = $SERVER_SOFTWARE -echo SERVER_NAME = $SERVER_NAME -echo GATEWAY_INTERFACE = $GATEWAY_INTERFACE -echo SERVER_PROTOCOL = $SERVER_PROTOCOL -echo SERVER_PORT = $SERVER_PORT -echo REQUEST_METHOD = $REQUEST_METHOD -echo HTTP_ACCEPT = "$HTTP_ACCEPT" -echo PATH_INFO = "$PATH_INFO" -echo PATH_TRANSLATED = "$PATH_TRANSLATED" -echo SCRIPT_NAME = "$SCRIPT_NAME" -echo QUERY_STRING = "$QUERY_STRING" -echo REMOTE_HOST = $REMOTE_HOST -echo REMOTE_ADDR = $REMOTE_ADDR -echo REMOTE_USER = $REMOTE_USER -echo AUTH_TYPE = $AUTH_TYPE -echo CONTENT_TYPE = $CONTENT_TYPE -echo CONTENT_LENGTH = $CONTENT_LENGTH diff --git a/docs/conf/highperformance-std.conf b/docs/conf/highperformance-std.conf deleted file mode 100755 index d3a5540435da813fc20b1943c27defeb27ca6079..0000000000000000000000000000000000000000 --- a/docs/conf/highperformance-std.conf +++ /dev/null @@ -1,63 +0,0 @@ -# Ha, you're reading this config file looking for the easy way out! -# "how do I make my apache server go really really fast??" -# Well you could start by reading the htdocs/manual/misc/perf-tuning.html -# page. But, we'll give you a head start. -# -# This config file is small, it is probably not what you'd expect on a -# full featured internet webserver with multiple users. But it's -# probably a good starting point for any folks interested in testing -# performance. -# -# To run this config you'll need to use something like: -# httpd -f @@ServerRoot@@/conf/highperformance.conf - -Port 80 -ServerRoot @@ServerRoot@@ -DocumentRoot @@ServerRoot@@/htdocs - -User nobody -# If you're not on Linux, you'll probably need to change Group -Group nobody - - -MaxClients 8 -StartServers 5 -MinSpareServers 5 -MaxSpareServers 10 - - - -MaxClients 8 -StartServers 1 -MinSpareThreads 5 -MaxSpareThreads 10 -ThreadsPerChild 20 - - -# Assume no memory leaks at all -MaxRequestsPerChild 0 - -# it's always nice to know the server has started -ErrorLog logs/error_log - -# Some benchmarks require logging, which is a good requirement. Uncomment -# this if you need logging. -#TransferLog logs/access_log - -# Disable symlink protection and htaccess files, they chew far too much. - - AllowOverride none - Options FollowSymLinks - # If this was a real internet server you'd probably want to - # uncomment these: - #order deny,allow - #deny from all - - -# If this was a real internet server you'd probably want to uncomment this: -# -# order allow,deny -# allow from all -# - -# OK that's enough hints. Read the documentation if you want more. diff --git a/docs/conf/httpd-win.conf b/docs/conf/httpd-win.conf deleted file mode 100644 index 3eca7ef3dea5d39eda47e82b17634d45ba33434e..0000000000000000000000000000000000000000 --- a/docs/conf/httpd-win.conf +++ /dev/null @@ -1,781 +0,0 @@ -# -# Based upon the NCSA server configuration files originally by Rob McCool. -# -# This is the main Apache server configuration file. It contains the -# configuration directives that give the server its instructions. -# See for detailed information about -# the directives. -# -# Do NOT simply read the instructions in here without understanding -# what they do. They're here only as hints or reminders. If you are unsure -# consult the online docs. You have been warned. -# -# After this file is processed, the server will look for and process -# @@ServerRoot@@/conf/srm.conf and then @@ServerRoot@@/conf/access.conf -# unless you have overridden these with ResourceConfig and/or -# AccessConfig directives here. -# -# The configuration directives are grouped into three basic sections: -# 1. Directives that control the operation of the Apache server process as a -# whole (the 'global environment'). -# 2. Directives that define the parameters of the 'main' or 'default' server, -# which responds to requests that aren't handled by a virtual host. -# These directives also provide default values for the settings -# of all virtual hosts. -# 3. Settings for virtual hosts, which allow Web requests to be sent to -# different IP addresses or hostnames and have them handled by the -# same Apache server process. -# -# Configuration and logfile names: If the filenames you specify for many -# of the server's control files begin with "/" (or "drive:/" for Win32), the -# server will use that explicit path. If the filenames do *not* begin -# with "/", the value of ServerRoot is prepended -- so "logs/foo.log" -# with ServerRoot set to "/usr/local/apache" will be interpreted by the -# server as "/usr/local/apache/logs/foo.log". -# -# NOTE: Where filenames are specified, you must use forward slashes -# instead of backslashes (e.g., "c:/apache" instead of "c:\apache"). -# If a drive letter is omitted, the drive on which Apache.exe is located -# will be used by default. It is recommended that you always supply -# an explicit drive letter in absolute paths, however, to avoid -# confusion. -# - -### Section 1: Global Environment -# -# The directives in this section affect the overall operation of Apache, -# such as the number of concurrent requests it can handle or where it -# can find its configuration files. -# - -# -# ServerType is either inetd, or standalone. Inetd mode is only supported on -# Unix platforms. -# -ServerType standalone - -# -# ServerRoot: The top of the directory tree under which the server's -# configuration, error, and log files are kept. -# -# Do NOT add a slash at the end of the directory path. -# -ServerRoot "@@ServerRoot@@" - -# -# PidFile: The file in which the server should record its process -# identification number when it starts. -# -PidFile logs/httpd.pid - -# -# ScoreBoardFile: File used to store internal server process information. -# Not all architectures require this. But if yours does (you'll know because -# this file will be created when you run Apache) then you *must* ensure that -# no two invocations of Apache share the same scoreboard file. -# -ScoreBoardFile logs/apache_status - -# -# In the standard configuration, the server will process httpd.conf, -# srm.conf, and access.conf in that order. The latter two files are -# now distributed empty, as it is recommended that all directives -# be kept in a single file for simplicity. The commented-out values -# below are the built-in defaults. You can have the server ignore -# these files altogether by using "/dev/null" (for Unix) or -# "nul" (for Win32) for the arguments to the directives. -# -#ResourceConfig conf/srm.conf -#AccessConfig conf/access.conf - -# -# Timeout: The number of seconds before receives and sends time out. -# -Timeout 300 - -# -# KeepAlive: Whether or not to allow persistent connections (more than -# one request per connection). Set to "Off" to deactivate. -# -KeepAlive On - -# -# MaxKeepAliveRequests: The maximum number of requests to allow -# during a persistent connection. Set to 0 to allow an unlimited amount. -# We reccomend you leave this number high, for maximum performance. -# -MaxKeepAliveRequests 100 - -# -# KeepAliveTimeout: Number of seconds to wait for the next request from the -# same client on the same connection. -# -KeepAliveTimeout 15 - -# -# Apache on Win32 always creates one child process to handle requests. If it -# dies, another child process is created automatically. Within the child -# process multiple threads handle incoming requests. The next two -# directives control the behaviour of the threads and processes. -# - -# -# MaxRequestsPerChild: the number of requests each child process is -# allowed to process before the child dies. The child will exit so -# as to avoid problems after prolonged use when Apache (and maybe the -# libraries it uses) leak memory or other resources. On most systems, this -# isn't really needed, but a few (such as Solaris) do have notable leaks -# in the libraries. For Win32, set this value to zero (unlimited) -# unless advised otherwise. -# -MaxRequestsPerChild 0 - -# -# Number of concurrent threads (i.e., requests) the server will allow. -# Set this value according to the responsiveness of the server (more -# requests active at once means they're all handled more slowly) and -# the amount of system resources you'll allow the server to consume. -# -ThreadsPerChild 50 - -# -# Listen: Allows you to bind Apache to specific IP addresses and/or -# ports, in addition to the default. See also the -# directive. -# -#Listen 3000 -#Listen 12.34.56.78:80 - -# -# BindAddress: You can support virtual hosts with this option. This directive -# is used to tell the server which IP address to listen to. It can either -# contain "*", an IP address, or a fully qualified Internet domain name. -# See also the and Listen directives. -# -#BindAddress * - -# -# Dynamic Shared Object (DSO) Support -# -# To be able to use the functionality of a module which was built as a DSO you -# have to place corresponding `LoadModule' lines at this location so the -# directives contained in it are actually available _before_ they are used. -# Please read the file README.DSO in the Apache 1.3 distribution for more -# details about the DSO mechanism and run `apache -l' for the list of already -# built-in (statically linked and thus always available) modules in your Apache -# binary. -# -# Note: The order in which modules are loaded is important. Don't change -# the order below without expert advice. -# -#LoadModule anon_auth_module modules/ApacheModuleAuthAnon.dll -#LoadModule cern_meta_module modules/ApacheModuleCERNMeta.dll -#LoadModule digest_module modules/ApacheModuleDigest.dll -#LoadModule expires_module modules/ApacheModuleExpires.dll -#LoadModule headers_module modules/ApacheModuleHeaders.dll -#LoadModule proxy_module modules/ApacheModuleProxy.dll -#LoadModule rewrite_module modules/ApacheModuleRewrite.dll -#LoadModule speling_module modules/ApacheModuleSpeling.dll -#LoadModule status_module modules/ApacheModuleStatus.dll -#LoadModule usertrack_module modules/ApacheModuleUserTrack.dll - -# -# ExtendedStatus controls whether Apache will generate "full" status -# information (ExtendedStatus On) or just basic information (ExtendedStatus -# Off) when the "server-status" handler is called. The default is Off. -# -#ExtendedStatus On - -### Section 2: 'Main' server configuration -# -# The directives in this section set up the values used by the 'main' -# server, which responds to any requests that aren't handled by a -# definition. These values also provide defaults for -# any containers you may define later in the file. -# -# All of these directives may appear inside containers, -# in which case these default settings will be overridden for the -# virtual host being defined. -# - -# -# If your ServerType directive (set earlier in the 'Global Environment' -# section) is set to "inetd", the next few directives don't have any -# effect since their settings are defined by the inetd configuration. -# Skip ahead to the ServerAdmin directive. -# - -# -# Port: The port to which the standalone server listens. -# -Port 80 - -# -# ServerAdmin: Your address, where problems with the server should be -# e-mailed. This address appears on some server-generated pages, such -# as error documents. -# -ServerAdmin you@your.address - -# -# ServerName allows you to set a host name which is sent back to clients for -# your server if it's different than the one the program would get (i.e., use -# "www" instead of the host's real name). -# -# Note: You cannot just invent host names and hope they work. The name you -# define here must be a valid DNS name for your host. If you don't understand -# this, ask your network administrator. -# If your host doesn't have a registered DNS name, enter its IP address here. -# You will have to access it by its address (e.g., http://123.45.67.89/) -# anyway, and this will make redirections work in a sensible way. -# -#ServerName new.host.name - -# -# DocumentRoot: The directory out of which you will serve your -# documents. By default, all requests are taken from this directory, but -# symbolic links and aliases may be used to point to other locations. -# -DocumentRoot "@@ServerRoot@@/htdocs" - -# -# Each directory to which Apache has access, can be configured with respect -# to which services and features are allowed and/or disabled in that -# directory (and its subdirectories). -# -# First, we configure the "default" to be a very restrictive set of -# permissions. -# - - Options FollowSymLinks - AllowOverride None - - -# -# Note that from this point forward you must specifically allow -# particular features to be enabled - so if something's not working as -# you might expect, make sure that you have specifically enabled it -# below. -# - -# -# This should be changed to whatever you set DocumentRoot to. -# - - -# -# This may also be "None", "All", or any combination of "Indexes", -# "Includes", "FollowSymLinks", "ExecCGI", or "MultiViews". -# -# Note that "MultiViews" must be named *explicitly* --- "Options All" -# doesn't give it to you. -# - Options Indexes FollowSymLinks - -# -# This controls which options the .htaccess files in directories can -# override. Can also be "All", or any combination of "Options", "FileInfo", -# "AuthConfig", and "Limit" -# - AllowOverride None - -# -# Controls who can get stuff from this server. -# - Order allow,deny - Allow from all - - -# -# UserDir: The name of the directory which is appended onto a user's home -# directory if a ~user request is received. -# -# Under Win32, we do not currently try to determine the home directory of -# a Windows login, so a format such as that below needs to be used. See -# the UserDir documentation for details. -# -UserDir "@@ServerRoot@@/users/" - -# -# DirectoryIndex: Name of the file or files to use as a pre-written HTML -# directory index. Separate multiple entries with spaces. -# -DirectoryIndex index.html - -# -# AccessFileName: The name of the file to look for in each directory -# for access control information. -# -AccessFileName .htaccess - -# -# The following lines prevent .htaccess files from being viewed by -# Web clients. Since .htaccess files often contain authorization -# information, access is disallowed for security reasons. Comment -# these lines out if you want Web visitors to see the contents of -# .htaccess files. If you change the AccessFileName directive above, -# be sure to make the corresponding changes here. -# - - Order allow,deny - Deny from all - - -# -# CacheNegotiatedDocs: By default, Apache sends "Pragma: no-cache" with each -# document that was negotiated on the basis of content. This asks proxy -# servers not to cache the document. Uncommenting the following line disables -# this behavior, and proxies will be allowed to cache the documents. -# -#CacheNegotiatedDocs - -# -# UseCanonicalName: (new for 1.3) With this setting turned on, whenever -# Apache needs to construct a self-referencing URL (a URL that refers back -# to the server the response is coming from) it will use ServerName and -# Port to form a "canonical" name. With this setting off, Apache will -# use the hostname:port that the client supplied, when possible. This -# also affects SERVER_NAME and SERVER_PORT in CGI scripts. -# -UseCanonicalName On - -# -# TypesConfig describes where the mime.types file (or equivalent) is -# to be found. -# -TypesConfig conf/mime.types - -# -# DefaultType is the default MIME type the server will use for a document -# if it cannot otherwise determine one, such as from filename extensions. -# If your server contains mostly text or HTML documents, "text/plain" is -# a good value. If most of your content is binary, such as applications -# or images, you may want to use "application/octet-stream" instead to -# keep browsers from trying to display binary files as though they are -# text. -# -DefaultType text/plain - -# -# The mod_mime_magic module allows the server to use various hints from the -# contents of the file itself to determine its type. The MIMEMagicFile -# directive tells the module where the hint definitions are located. -# mod_mime_magic is not part of the default server (you have to add -# it yourself with a LoadModule [see the DSO paragraph in the 'Global -# Environment' section], or recompile the server and include mod_mime_magic -# as part of the configuration), so it's enclosed in an container. -# This means that the MIMEMagicFile directive will only be processed if the -# module is part of the server. -# - - MIMEMagicFile conf/magic - - -# -# HostnameLookups: Log the names of clients or just their IP addresses -# e.g., www.apache.org (on) or 204.62.129.132 (off). -# The default is off because it'd be overall better for the net if people -# had to knowingly turn this feature on, since enabling it means that -# each client request will result in AT LEAST one lookup request to the -# nameserver. -# -HostnameLookups Off - -# -# ErrorLog: The location of the error log file. -# If you do not specify an ErrorLog directive within a -# container, error messages relating to that virtual host will be -# logged here. If you *do* define an error logfile for a -# container, that host's errors will be logged there and not here. -# -ErrorLog logs/error.log - -# -# LogLevel: Control the number of messages logged to the error.log. -# Possible values include: debug, info, notice, warn, error, crit, -# alert, emerg. -# -LogLevel warn - -# -# The following directives define some format nicknames for use with -# a CustomLog directive (see below). -# -LogFormat "%h %l %u %t \"%r\" %>s %b \"%{Referer}i\" \"%{User-Agent}i\"" combined -LogFormat "%h %l %u %t \"%r\" %>s %b" common -LogFormat "%{Referer}i -> %U" referer -LogFormat "%{User-agent}i" agent - -# -# The location and format of the access logfile (Common Logfile Format). -# If you do not define any access logfiles within a -# container, they will be logged here. Contrariwise, if you *do* -# define per- access logfiles, transactions will be -# logged therein and *not* in this file. -# -CustomLog logs/access.log common - -# -# If you would like to have agent and referer logfiles, uncomment the -# following directives. -# -#CustomLog logs/referer.log referer -#CustomLog logs/agent.log agent - -# -# If you prefer a single logfile with access, agent, and referer information -# (Combined Logfile Format) you can use the following directive. -# -#CustomLog logs/access.log combined - -# -# Optionally add a line containing the server version and virtual host -# name to server-generated pages (error documents, FTP directory listings, -# mod_status and mod_info output etc., but not CGI generated documents). -# Set to "EMail" to also include a mailto: link to the ServerAdmin. -# Set to one of: On | Off | EMail -# -ServerSignature On - -# -# Aliases: Add here as many aliases as you need (with no limit). The format is -# Alias fakename realname -# -# Note that if you include a trailing / on fakename then the server will -# require it to be present in the URL. So "/icons" isn't aliased in this -# example, only "/icons/".. -# -Alias /icons/ "@@ServerRoot@@/icons/" - -# -# ScriptAlias: This controls which directories contain server scripts. -# ScriptAliases are essentially the same as Aliases, except that -# documents in the realname directory are treated as applications and -# run by the server when requested rather than as documents sent to the client. -# The same rules about trailing "/" apply to ScriptAlias directives as to -# Alias. -# -ScriptAlias /cgi-bin/ "@@ServerRoot@@/cgi-bin/" - -# -# "@@ServerRoot@@/cgi-bin" should be changed to whatever your ScriptAliased -# CGI directory exists, if you have that configured. -# - - AllowOverride None - Options None - - -# -# Redirect allows you to tell clients about documents which used to exist in -# your server's namespace, but do not anymore. This allows you to tell the -# clients where to look for the relocated document. -# Format: Redirect old-URI new-URL -# - -# -# Directives controlling the display of server-generated directory listings. -# - -# -# FancyIndexing is whether you want fancy directory indexing or standard -# -IndexOptions FancyIndexing - -# -# AddIcon* directives tell the server which icon to show for different -# files or filename extensions. These are only displayed for -# FancyIndexed directories. -# -AddIconByEncoding (CMP,/icons/compressed.gif) x-compress x-gzip - -AddIconByType (TXT,/icons/text.gif) text/* -AddIconByType (IMG,/icons/image2.gif) image/* -AddIconByType (SND,/icons/sound2.gif) audio/* -AddIconByType (VID,/icons/movie.gif) video/* - -AddIcon /icons/binary.gif .bin .exe -AddIcon /icons/binhex.gif .hqx -AddIcon /icons/tar.gif .tar -AddIcon /icons/world2.gif .wrl .wrl.gz .vrml .vrm .iv -AddIcon /icons/compressed.gif .Z .z .tgz .gz .zip -AddIcon /icons/a.gif .ps .ai .eps -AddIcon /icons/layout.gif .html .shtml .htm .pdf -AddIcon /icons/text.gif .txt -AddIcon /icons/c.gif .c -AddIcon /icons/p.gif .pl .py -AddIcon /icons/f.gif .for -AddIcon /icons/dvi.gif .dvi -AddIcon /icons/uuencoded.gif .uu -AddIcon /icons/script.gif .conf .sh .shar .csh .ksh .tcl -AddIcon /icons/tex.gif .tex -AddIcon /icons/bomb.gif core - -AddIcon /icons/back.gif .. -AddIcon /icons/hand.right.gif README -AddIcon /icons/folder.gif ^^DIRECTORY^^ -AddIcon /icons/blank.gif ^^BLANKICON^^ - -# -# DefaultIcon is which icon to show for files which do not have an icon -# explicitly set. -# -DefaultIcon /icons/unknown.gif - -# -# AddDescription allows you to place a short description after a file in -# server-generated indexes. These are only displayed for FancyIndexed -# directories. -# Format: AddDescription "description" filename -# -#AddDescription "GZIP compressed document" .gz -#AddDescription "tar archive" .tar -#AddDescription "GZIP compressed tar archive" .tgz - -# -# ReadmeName is the name of the README file the server will look for by -# default, and append to directory listings. -# -# HeaderName is the name of a file which should be prepended to -# directory indexes. -# -# The server will first look for name.html and include it if found. -# If name.html doesn't exist, the server will then look for name.txt -# and include it as plaintext if found. -# -ReadmeName README -HeaderName HEADER - -# -# IndexIgnore is a set of filenames which directory indexing should ignore -# and not include in the listing. Shell-style wildcarding is permitted. -# -IndexIgnore .??* *~ *# HEADER* README* RCS CVS *,v *,t - -# -# AddEncoding allows you to have certain browsers (Mosaic/X 2.1+) uncompress -# information on the fly. Note: Not all browsers support this. -# Despite the name similarity, the following Add* directives have nothing -# to do with the FancyIndexing customisation directives above. -# -AddEncoding x-compress Z -AddEncoding x-gzip gz tgz - -# -# AddLanguage allows you to specify the language of a document. You can -# then use content negotiation to give a browser a file in a language -# it can understand. Note that the suffix does not have to be the same -# as the language keyword --- those with documents in Polish (whose -# net-standard language code is pl) may wish to use "AddLanguage pl .po" -# to avoid the ambiguity with the common suffix for perl scripts. -# -AddLanguage en .en -AddLanguage fr .fr -AddLanguage de .de -AddLanguage da .da -AddLanguage el .el -AddLanguage it .it - -# -# LanguagePriority allows you to give precedence to some languages -# in case of a tie during content negotiation. -# Just list the languages in decreasing order of preference. -# -LanguagePriority en fr de - -# -# AddType allows you to tweak mime.types without actually editing it, or to -# make certain files to be certain types. -# -# For example, the PHP3 module (not part of the Apache distribution) -# will typically use: -# -#AddType application/x-httpd-php3 .phtml -#AddType application/x-httpd-php3-source .phps - -AddType application/x-tar .tgz - -# -# AddHandler allows you to map certain file extensions to "handlers", -# actions unrelated to filetype. These can be either built into the server -# or added with the Action command (see below) -# -# If you want to use server side includes, or CGI outside -# ScriptAliased directories, uncomment the following lines. -# -# To use CGI scripts: -# -#AddHandler cgi-script .cgi - -# -# To use server-parsed HTML files -# -#AddType text/html .shtml -#AddHandler server-parsed .shtml - -# -# Uncomment the following line to enable Apache's send-asis HTTP file -# feature -# -#AddHandler send-as-is asis - -# -# If you wish to use server-parsed imagemap files, use -# -#AddHandler imap-file map - -# -# To enable type maps, you might want to use -# -#AddHandler type-map var - -# -# Action lets you define media types that will execute a script whenever -# a matching file is called. This eliminates the need for repeated URL -# pathnames for oft-used CGI file processors. -# Format: Action media/type /cgi-script/location -# Format: Action handler-name /cgi-script/location -# - -# -# MetaDir: specifies the name of the directory in which Apache can find -# meta information files. These files contain additional HTTP headers -# to include when sending the document -# -#MetaDir .web - -# -# MetaSuffix: specifies the file name suffix for the file containing the -# meta information. -# -#MetaSuffix .meta - -# -# Customizable error response (Apache style) -# these come in three flavors -# -# 1) plain text -#ErrorDocument 500 "The server made a boo boo. -# n.b. the (") marks it as text, it does not get output -# -# 2) local redirects -#ErrorDocument 404 /missing.html -# to redirect to local URL /missing.html -#ErrorDocument 404 /cgi-bin/missing_handler.pl -# N.B.: You can redirect to a script or a document using server-side-includes. -# -# 3) external redirects -#ErrorDocument 402 http://some.other_server.com/subscription_info.html -# N.B.: Many of the environment variables associated with the original -# request will *not* be available to such a script. - -# -# The following directives disable keepalives and HTTP header flushes. -# The first directive disables it for Netscape 2.x and browsers which -# spoof it. There are known problems with these. -# The second directive is for Microsoft Internet Explorer 4.0b2 -# which has a broken HTTP/1.1 implementation and does not properly -# support keepalive when it is used on 301 or 302 (redirect) responses. -# -BrowserMatch "Mozilla/2" nokeepalive -BrowserMatch "MSIE 4\.0b2;" nokeepalive downgrade-1.0 force-response-1.0 - -# -# The following directive disables HTTP/1.1 responses to browsers which -# are in violation of the HTTP/1.0 spec by not being able to grok a -# basic 1.1 response. -# -BrowserMatch "RealPlayer 4\.0" force-response-1.0 -BrowserMatch "Java/1\.0" force-response-1.0 -BrowserMatch "JDK/1\.0" force-response-1.0 - -# -# Allow server status reports, with the URL of http://servername/server-status -# Change the ".your_domain.com" to match your domain to enable. -# -# -# SetHandler server-status -# Order deny,allow -# Deny from all -# Allow from .your_domain.com -# - -# -# Allow remote server configuration reports, with the URL of -# http://servername/server-info (requires that mod_info.c be loaded). -# Change the ".your_domain.com" to match your domain to enable. -# -# -# SetHandler server-info -# Order deny,allow -# Deny from all -# Allow from .your_domain.com -# - -# -# There have been reports of people trying to abuse an old bug from pre-1.1 -# days. This bug involved a CGI script distributed as a part of Apache. -# By uncommenting these lines you can redirect these attacks to a logging -# script on phf.apache.org. Or, you can record them yourself, using the script -# support/phf_abuse_log.cgi. -# -# -# Deny from all -# ErrorDocument 403 http://phf.apache.org/phf_abuse_log.cgi -# - -# -# Proxy Server directives. Uncomment the following line to -# enable the proxy server: -# -#ProxyRequests On - -# -# Enable/disable the handling of HTTP/1.1 "Via:" headers. -# ("Full" adds the server version; "Block" removes all outgoing Via: headers) -# Set to one of: Off | On | Full | Block -# -#ProxyVia On - -# -# To enable the cache as well, edit and uncomment the following lines: -# (no cacheing without CacheRoot) -# -#CacheRoot "@@ServerRoot@@/proxy" -#CacheSize 5 -#CacheGcInterval 4 -#CacheMaxExpire 24 -#CacheLastModifiedFactor 0.1 -#CacheDefaultExpire 1 -#NoCache a_domain.com another_domain.edu joes.garage_sale.com - -### Section 3: Virtual Hosts -# -# VirtualHost: If you want to maintain multiple domains/hostnames on your -# machine you can setup VirtualHost containers for them. -# Please see the documentation at -# for further details before you try to setup virtual hosts. -# You may use the command line option '-S' to verify your virtual host -# configuration. - -# -# If you want to use name-based virtual hosts you need to define at -# least one IP address (and port number) for them. -# -#NameVirtualHost 12.34.56.78:80 -#NameVirtualHost 12.34.56.78 - -# -# VirtualHost example: -# Almost any Apache directive may go into a VirtualHost container. -# -# -# ServerAdmin webmaster@host.some_domain.com -# DocumentRoot /www/docs/host.some_domain.com -# ServerName host.some_domain.com -# ErrorLog logs/host.some_domain.com-error_log -# CustomLog logs/host.some_domain.com-access_log common -# - -# -# diff --git a/docs/conf/magic b/docs/conf/magic deleted file mode 100644 index 885b793aecb26a09bf2328a715b44b2c338b1d40..0000000000000000000000000000000000000000 --- a/docs/conf/magic +++ /dev/null @@ -1,371 +0,0 @@ -# Magic data for mod_mime_magic Apache module (originally for file(1) command) -# The module is described in htdocs/manual/mod/mod_mime_magic.html -# -# The format is 4-5 columns: -# Column #1: byte number to begin checking from, ">" indicates continuation -# Column #2: type of data to match -# Column #3: contents of data to match -# Column #4: MIME type of result -# Column #5: MIME encoding of result (optional) - -#------------------------------------------------------------------------------ -# Localstuff: file(1) magic for locally observed files -# Add any locally observed files here. - -#------------------------------------------------------------------------------ -# end local stuff -#------------------------------------------------------------------------------ - -#------------------------------------------------------------------------------ -# Java - -0 short 0xcafe ->2 short 0xbabe application/java - -#------------------------------------------------------------------------------ -# audio: file(1) magic for sound formats -# -# from Jan Nicolai Langfeldt , -# - -# Sun/NeXT audio data -0 string .snd ->12 belong 1 audio/basic ->12 belong 2 audio/basic ->12 belong 3 audio/basic ->12 belong 4 audio/basic ->12 belong 5 audio/basic ->12 belong 6 audio/basic ->12 belong 7 audio/basic - ->12 belong 23 audio/x-adpcm - -# DEC systems (e.g. DECstation 5000) use a variant of the Sun/NeXT format -# that uses little-endian encoding and has a different magic number -# (0x0064732E in little-endian encoding). -0 lelong 0x0064732E ->12 lelong 1 audio/x-dec-basic ->12 lelong 2 audio/x-dec-basic ->12 lelong 3 audio/x-dec-basic ->12 lelong 4 audio/x-dec-basic ->12 lelong 5 audio/x-dec-basic ->12 lelong 6 audio/x-dec-basic ->12 lelong 7 audio/x-dec-basic -# compressed (G.721 ADPCM) ->12 lelong 23 audio/x-dec-adpcm - -# Bytes 0-3 of AIFF, AIFF-C, & 8SVX audio files are "FORM" -# AIFF audio data -8 string AIFF audio/x-aiff -# AIFF-C audio data -8 string AIFC audio/x-aiff -# IFF/8SVX audio data -8 string 8SVX audio/x-aiff - -# Creative Labs AUDIO stuff -# Standard MIDI data -0 string MThd audio/unknown -#>9 byte >0 (format %d) -#>11 byte >1 using %d channels -# Creative Music (CMF) data -0 string CTMF audio/unknown -# SoundBlaster instrument data -0 string SBI audio/unknown -# Creative Labs voice data -0 string Creative\ Voice\ File audio/unknown -## is this next line right? it came this way... -#>19 byte 0x1A -#>23 byte >0 - version %d -#>22 byte >0 \b.%d - -# [GRR 950115: is this also Creative Labs? Guessing that first line -# should be string instead of unknown-endian long...] -#0 long 0x4e54524b MultiTrack sound data -#0 string NTRK MultiTrack sound data -#>4 long x - version %ld - -# Microsoft WAVE format (*.wav) -# [GRR 950115: probably all of the shorts and longs should be leshort/lelong] -# Microsoft RIFF -0 string RIFF audio/unknown -# - WAVE format ->8 string WAVE audio/x-wav - -#------------------------------------------------------------------------------ -# c-lang: file(1) magic for C programs or various scripts -# - -# XPM icons (Greg Roelofs, newt@uchicago.edu) -# ideally should go into "images", but entries below would tag XPM as C source -0 string /*\ XPM image/x-xbm 7bit - -# this first will upset you if you're a PL/1 shop... (are there any left?) -# in which case rm it; ascmagic will catch real C programs -# C or REXX program text -0 string /* text/plain -# C++ program text -0 string // text/plain - -#------------------------------------------------------------------------------ -# compress: file(1) magic for pure-compression formats (no archives) -# -# compress, gzip, pack, compact, huf, squeeze, crunch, freeze, yabba, whap, etc. -# -# Formats for various forms of compressed data -# Formats for "compress" proper have been moved into "compress.c", -# because it tries to uncompress it to figure out what's inside. - -# standard unix compress -0 string \037\235 application/octet-stream x-compress - -# gzip (GNU zip, not to be confused with [Info-ZIP/PKWARE] zip archiver) -0 string \037\213 application/octet-stream x-gzip - -# According to gzip.h, this is the correct byte order for packed data. -0 string \037\036 application/octet-stream -# -# This magic number is byte-order-independent. -# -0 short 017437 application/octet-stream - -# XXX - why *two* entries for "compacted data", one of which is -# byte-order independent, and one of which is byte-order dependent? -# -# compacted data -0 short 0x1fff application/octet-stream -0 string \377\037 application/octet-stream -# huf output -0 short 0145405 application/octet-stream - -# Squeeze and Crunch... -# These numbers were gleaned from the Unix versions of the programs to -# handle these formats. Note that I can only uncrunch, not crunch, and -# I didn't have a crunched file handy, so the crunch number is untested. -# Keith Waclena -#0 leshort 0x76FF squeezed data (CP/M, DOS) -#0 leshort 0x76FE crunched data (CP/M, DOS) - -# Freeze -#0 string \037\237 Frozen file 2.1 -#0 string \037\236 Frozen file 1.0 (or gzip 0.5) - -# lzh? -#0 string \037\240 LZH compressed data - -#------------------------------------------------------------------------------ -# frame: file(1) magic for FrameMaker files -# -# This stuff came on a FrameMaker demo tape, most of which is -# copyright, but this file is "published" as witness the following: -# -0 string \ -# and Anna Shergold -# -0 string \14 byte 12 (OS/2 1.x format) -#>14 byte 64 (OS/2 2.x format) -#>14 byte 40 (Windows 3.x format) -#0 string IC icon -#0 string PI pointer -#0 string CI color icon -#0 string CP color pointer -#0 string BA bitmap array - - -#------------------------------------------------------------------------------ -# lisp: file(1) magic for lisp programs -# -# various lisp types, from Daniel Quinlan (quinlan@yggdrasil.com) -0 string ;; text/plain 8bit -# Emacs 18 - this is always correct, but not very magical. -0 string \012( application/x-elc -# Emacs 19 -0 string ;ELC\023\000\000\000 application/x-elc - -#------------------------------------------------------------------------------ -# mail.news: file(1) magic for mail and news -# -# There are tests to ascmagic.c to cope with mail and news. -0 string Relay-Version: message/rfc822 7bit -0 string #!\ rnews message/rfc822 7bit -0 string N#!\ rnews message/rfc822 7bit -0 string Forward\ to message/rfc822 7bit -0 string Pipe\ to message/rfc822 7bit -0 string Return-Path: message/rfc822 7bit -0 string Path: message/news 8bit -0 string Xref: message/news 8bit -0 string From: message/rfc822 7bit -0 string Article message/news 8bit -#------------------------------------------------------------------------------ -# msword: file(1) magic for MS Word files -# -# Contributor claims: -# Reversed-engineered MS Word magic numbers -# - -0 string \376\067\0\043 application/msword -0 string \333\245-\0\0\0 application/msword - -# disable this one because it applies also to other -# Office/OLE documents for which msword is not correct. See PR#2608. -#0 string \320\317\021\340\241\261 application/msword - - - -#------------------------------------------------------------------------------ -# printer: file(1) magic for printer-formatted files -# - -# PostScript -0 string %! application/postscript -0 string \004%! application/postscript - -# Acrobat -# (due to clamen@cs.cmu.edu) -0 string %PDF- application/pdf - -#------------------------------------------------------------------------------ -# sc: file(1) magic for "sc" spreadsheet -# -38 string Spreadsheet application/x-sc - -#------------------------------------------------------------------------------ -# tex: file(1) magic for TeX files -# -# XXX - needs byte-endian stuff (big-endian and little-endian DVI?) -# -# From - -# Although we may know the offset of certain text fields in TeX DVI -# and font files, we can't use them reliably because they are not -# zero terminated. [but we do anyway, christos] -0 string \367\002 application/x-dvi -#0 string \367\203 TeX generic font data -#0 string \367\131 TeX packed font data -#0 string \367\312 TeX virtual font data -#0 string This\ is\ TeX, TeX transcript text -#0 string This\ is\ METAFONT, METAFONT transcript text - -# There is no way to detect TeX Font Metric (*.tfm) files without -# breaking them apart and reading the data. The following patterns -# match most *.tfm files generated by METAFONT or afm2tfm. -#2 string \000\021 TeX font metric data -#2 string \000\022 TeX font metric data -#>34 string >\0 (%s) - -# Texinfo and GNU Info, from Daniel Quinlan (quinlan@yggdrasil.com) -#0 string \\input\ texinfo Texinfo source text -#0 string This\ is\ Info\ file GNU Info text - -# correct TeX magic for Linux (and maybe more) -# from Peter Tobias (tobias@server.et-inf.fho-emden.de) -# -0 leshort 0x02f7 application/x-dvi - -# RTF - Rich Text Format -0 string {\\rtf application/rtf - -#------------------------------------------------------------------------------ -# animation: file(1) magic for animation/movie formats -# -# animation formats, originally from vax@ccwf.cc.utexas.edu (VaX#n8) -# MPEG file -0 string \000\000\001\263 video/mpeg -# -# The contributor claims: -# I couldn't find a real magic number for these, however, this -# -appears- to work. Note that it might catch other files, too, -# so BE CAREFUL! -# -# Note that title and author appear in the two 20-byte chunks -# at decimal offsets 2 and 22, respectively, but they are XOR'ed with -# 255 (hex FF)! DL format SUCKS BIG ROCKS. -# -# DL file version 1 , medium format (160x100, 4 images/screen) -0 byte 1 video/unknown -0 byte 2 video/unknown - diff --git a/docs/conf/mime.types b/docs/conf/mime.types deleted file mode 100644 index d53db0f4e880de35af5fd707c924a39fa321fe68..0000000000000000000000000000000000000000 --- a/docs/conf/mime.types +++ /dev/null @@ -1,276 +0,0 @@ -# This is a comment. I love comments. - -# This file controls what Internet media types are sent to the client for -# given file extension(s). Sending the correct media type to the client -# is important so they know how to handle the content of the file. -# Extra types can either be added here or by using an AddType directive -# in your config files. For more information about Internet media types, -# please read RFC 2045, 2046, 2047, 2048, and 2077. The Internet media type -# registry is at . - -# MIME type Extension -application/EDI-Consent -application/EDI-X12 -application/EDIFACT -application/activemessage -application/andrew-inset ez -application/applefile -application/atomicmail -application/cals-1840 -application/commonground -application/cybercash -application/dca-rft -application/dec-dx -application/eshop -application/hyperstudio -application/iges -application/mac-binhex40 hqx -application/mac-compactpro cpt -application/macwriteii -application/marc -application/mathematica -application/msword doc -application/news-message-id -application/news-transmission -application/octet-stream bin dms lha lzh exe class -application/oda oda -application/pdf pdf -application/pgp-encrypted -application/pgp-keys -application/pgp-signature -application/pkcs10 -application/pkcs7-mime -application/pkcs7-signature -application/postscript ai eps ps -application/prs.alvestrand.titrax-sheet -application/prs.cww -application/prs.nprend -application/remote-printing -application/riscos -application/rtf rtf -application/set-payment -application/set-payment-initiation -application/set-registration -application/set-registration-initiation -application/sgml -application/sgml-open-catalog -application/slate -application/smil smi smil -application/vemmi -application/vnd.3M.Post-it-Notes -application/vnd.FloGraphIt -application/vnd.acucobol -application/vnd.anser-web-certificate-issue-initiation -application/vnd.anser-web-funds-transfer-initiation -application/vnd.audiograph -application/vnd.businessobjects -application/vnd.claymore -application/vnd.comsocaller -application/vnd.dna -application/vnd.dxr -application/vnd.ecdis-update -application/vnd.ecowin.chart -application/vnd.ecowin.filerequest -application/vnd.ecowin.fileupdate -application/vnd.ecowin.series -application/vnd.ecowin.seriesrequest -application/vnd.ecowin.seriesupdate -application/vnd.enliven -application/vnd.epson.salt -application/vnd.fdf -application/vnd.ffsns -application/vnd.framemaker -application/vnd.fujitsu.oasys -application/vnd.fujitsu.oasys2 -application/vnd.fujitsu.oasys3 -application/vnd.fujitsu.oasysgp -application/vnd.fujitsu.oasysprs -application/vnd.fujixerox.docuworks -application/vnd.hp-HPGL -application/vnd.hp-PCL -application/vnd.hp-PCLXL -application/vnd.hp-hps -application/vnd.ibm.MiniPay -application/vnd.ibm.modcap -application/vnd.intercon.formnet -application/vnd.intertrust.digibox -application/vnd.intertrust.nncp -application/vnd.is-xpr -application/vnd.japannet-directory-service -application/vnd.japannet-jpnstore-wakeup -application/vnd.japannet-payment-wakeup -application/vnd.japannet-registration -application/vnd.japannet-registration-wakeup -application/vnd.japannet-setstore-wakeup -application/vnd.japannet-verification -application/vnd.japannet-verification-wakeup -application/vnd.koan -application/vnd.lotus-1-2-3 -application/vnd.lotus-approach -application/vnd.lotus-freelance -application/vnd.lotus-organizer -application/vnd.lotus-screencam -application/vnd.lotus-wordpro -application/vnd.meridian-slingshot -application/vnd.mif mif -application/vnd.minisoft-hp3000-save -application/vnd.mitsubishi.misty-guard.trustweb -application/vnd.ms-artgalry -application/vnd.ms-asf -application/vnd.ms-excel xls -application/vnd.ms-powerpoint ppt -application/vnd.ms-project -application/vnd.ms-tnef -application/vnd.ms-works -application/vnd.music-niff -application/vnd.musician -application/vnd.netfpx -application/vnd.noblenet-directory -application/vnd.noblenet-sealer -application/vnd.noblenet-web -application/vnd.novadigm.EDM -application/vnd.novadigm.EDX -application/vnd.novadigm.EXT -application/vnd.osa.netdeploy -application/vnd.powerbuilder6 -application/vnd.powerbuilder6-s -application/vnd.rapid -application/vnd.seemail -application/vnd.shana.informed.formtemplate -application/vnd.shana.informed.interchange -application/vnd.shana.informed.package -application/vnd.street-stream -application/vnd.svd -application/vnd.swiftview-ics -application/vnd.truedoc -application/vnd.visio -application/vnd.webturbo -application/vnd.wrq-hp3000-labelled -application/vnd.wt.stf -application/vnd.xara -application/vnd.yellowriver-custom-menu -application/wita -application/wordperfect5.1 -application/x-bcpio bcpio -application/x-cdlink vcd -application/x-chess-pgn pgn -application/x-compress -application/x-cpio cpio -application/x-csh csh -application/x-director dcr dir dxr -application/x-dvi dvi -application/x-futuresplash spl -application/x-gtar gtar -application/x-gzip -application/x-hdf hdf -application/x-javascript js -application/x-koan skp skd skt skm -application/x-latex latex -application/x-netcdf nc cdf -application/x-sh sh -application/x-shar shar -application/x-shockwave-flash swf -application/x-stuffit sit -application/x-sv4cpio sv4cpio -application/x-sv4crc sv4crc -application/x-tar tar -application/x-tcl tcl -application/x-tex tex -application/x-texinfo texinfo texi -application/x-troff t tr roff -application/x-troff-man man -application/x-troff-me me -application/x-troff-ms ms -application/x-ustar ustar -application/x-wais-source src -application/x400-bp -application/xml -application/zip zip -audio/32kadpcm -audio/basic au snd -audio/midi mid midi kar -audio/mpeg mpga mp2 mp3 -audio/vnd.qcelp -audio/x-aiff aif aiff aifc -audio/x-pn-realaudio ram rm -audio/x-pn-realaudio-plugin rpm -audio/x-realaudio ra -audio/x-wav wav -chemical/x-pdb pdb xyz -image/bmp bmp -image/cgm -image/g3fax -image/gif gif -image/ief ief -image/jpeg jpeg jpg jpe -image/naplps -image/png png -image/prs.btif -image/tiff tiff tif -image/vnd.dwg -image/vnd.dxf -image/vnd.fpx -image/vnd.net-fpx -image/vnd.svf -image/vnd.xiff -image/x-cmu-raster ras -image/x-portable-anymap pnm -image/x-portable-bitmap pbm -image/x-portable-graymap pgm -image/x-portable-pixmap ppm -image/x-rgb rgb -image/x-xbitmap xbm -image/x-xpixmap xpm -image/x-xwindowdump xwd -message/delivery-status -message/disposition-notification -message/external-body -message/http -message/news -message/partial -message/rfc822 -model/iges igs iges -model/mesh msh mesh silo -model/vnd.dwf -model/vrml wrl vrml -multipart/alternative -multipart/appledouble -multipart/byteranges -multipart/digest -multipart/encrypted -multipart/form-data -multipart/header-set -multipart/mixed -multipart/parallel -multipart/related -multipart/report -multipart/signed -multipart/voice-message -text/css css -text/directory -text/enriched -text/html html htm -text/plain asc txt -text/prs.lines.tag -text/rfc822-headers -text/richtext rtx -text/rtf rtf -text/sgml sgml sgm -text/tab-separated-values tsv -text/uri-list -text/vnd.abc -text/vnd.flatland.3dml -text/vnd.fmi.flexstor -text/vnd.in3d.3dml -text/vnd.in3d.spot -text/vnd.latex-z -text/x-setext etx -text/xml xml -video/mpeg mpeg mpg mpe -video/quicktime qt mov -video/vnd.motorola.video -video/vnd.motorola.videop -video/vnd.vivo -video/x-msvideo avi -video/x-sgi-movie movie -x-conference/x-cooltalk ice diff --git a/docs/docroot/apache_pb.gif b/docs/docroot/apache_pb.gif deleted file mode 100644 index 3a1c139fc4247ec7e770fdaab961fb3692c953fb..0000000000000000000000000000000000000000 Binary files a/docs/docroot/apache_pb.gif and /dev/null differ diff --git a/docs/docroot/apache_pb.png b/docs/docroot/apache_pb.png deleted file mode 100644 index eb99a8cd39346fe848d1bbbaccd90afae2183450..0000000000000000000000000000000000000000 Binary files a/docs/docroot/apache_pb.png and /dev/null differ diff --git a/docs/docroot/apache_pb2.gif b/docs/docroot/apache_pb2.gif deleted file mode 100644 index 4e67c7113c54d6569e4e69339df851b9da1796ce..0000000000000000000000000000000000000000 Binary files a/docs/docroot/apache_pb2.gif and /dev/null differ diff --git a/docs/docroot/apache_pb2.png b/docs/docroot/apache_pb2.png deleted file mode 100644 index 28baa70fb8ce678b9e4a5eecb6697d43315f413a..0000000000000000000000000000000000000000 Binary files a/docs/docroot/apache_pb2.png and /dev/null differ diff --git a/docs/docroot/apache_pb2_ani.gif b/docs/docroot/apache_pb2_ani.gif deleted file mode 100644 index fc41c03610c1f56d4e2ce3c9750cbe27e5d96886..0000000000000000000000000000000000000000 Binary files a/docs/docroot/apache_pb2_ani.gif and /dev/null differ diff --git a/docs/docroot/index.html.ca b/docs/docroot/index.html.ca deleted file mode 100644 index a71a6853569da235c6b6d427a2e5a73f08dccca1..0000000000000000000000000000000000000000 --- a/docs/docroot/index.html.ca +++ /dev/null @@ -1,51 +0,0 @@ - - - - Pàgina de prova de l'instal·lació d'Apache - - - -

    - Funciona ! El servidor web Apache està instal·lat - en aquest lloc  ! -

    -

    - Si veu aquesta pàgina, es que els propietaris d'aquest domini - acaben d'instal·lar satisfactòriament el - servidor web Apache. - Ara han d'afegir contingut en aquest directori i substituir aquesta pàgina, - o bè dirigir aquest servidor cap al contingut real. -

    -
    -
    - Si està veien aquesta pàgina i no es la que esperava, posis en - contacte amb - l'administrador web d'aquest lloc. - (Provi d'enviar un correu electrònic a <Webmaster@domain>.) - Encara que aquest lloc està utilitzant el programari Apache, es gairebé segur - que no tè res a veure amb el Grup Apache, per tant - no enviï cap correu electrònic als autors d'Apache referent a aquest lloc o al seu contingut. - Si es que ho fa, el seu missatge serà ignorat. -
    -
    -

    - La - documentació - d'Apache ha estat inclosa en aquesta distribució. -

    -

    - L'administrador de web pot utilitzar lliurement la imatge d'aquí sota - en el servidor web equipat amb el programari Apache. - Gràcies per utilitzar Apache ! -

    -
    - -
    - - diff --git a/docs/docroot/index.html.cz.iso8859-2 b/docs/docroot/index.html.cz.iso8859-2 deleted file mode 100644 index e0cd2ba61092cca1463f0cd497c1a229c18f5257..0000000000000000000000000000000000000000 --- a/docs/docroot/index.html.cz.iso8859-2 +++ /dev/null @@ -1,51 +0,0 @@ - - - - - Testovací stránka instalace web serveru Apache - - - -

    - Funguje to! Na tomto serveru bì¾í Apache! -

    -

    - Pokud vidíte tuto zprávu, správce tohoto poèítaèe právì úspì¹nì - nainstaloval Apache web server. - Teï je¹tì musí doplnit obsah a nahradit tuto standardní uvítací - stránku, nebo pøesmìrovat server na skuteènou domovskou stránku. -

    -
    -
    - Pokud vidíte tuto zprávu místo oèekávané domovské stránky, - kontaktujte, prosím, správce pøíslu¹ného web - serveru. (Zkuste poslat e-mail na adresu - <Webmaster@domain>.) - Pøesto¾e tento server pou¾ívá program Apache, témìø jistì nemá nic - spoleèného s Apache Group, proto prosím neposílejte e-maily o tomto - serveru nebo jeho obsahu autorùm Apache. Pokud to udìláte, budeme - va¹e zprávy ignorovat. -
    -
    -

    - Zde najdete - dokumentaci - Apache (anglicky) obsa¾enou v této distribuci. -

    -

    - Následující logo mù¾e být pou¾ito bez omezení na web serveru s - programem Apache. Dìkujeme za pou¾ití Apache! -

    -
    - -
    - - diff --git a/docs/docroot/index.html.de b/docs/docroot/index.html.de deleted file mode 100644 index a5420e933a0c4231c638f6dec51f648017666d1e..0000000000000000000000000000000000000000 --- a/docs/docroot/index.html.de +++ /dev/null @@ -1,61 +0,0 @@ - - - - Testseite fuer die Apache-Installation auf dieser Web Site - - - - -

    - Es klappt! Der Apache Web-Server ist auf dieser Web-Site installiert! -

    -

    - Wenn Sie diese Seite sehen, dann bedeutet das, dass die - Eigentümer dieser Domäne soeben einen neuen - Apache Web-Server - erfolgreich installiert haben. Jetzt muss noch der - richtige Web-Inhalt zugefügt und diese Platzhalter-Seite - ersetzt werden (oder der Web-Server für den Zugriff auf den - richtigen Inhalt umkonfiguriert werden). -

    -
    -
    - Wenn Sie diese Seite an Stelle einer anderen erwarteten Web-Site - sehen sollten, dann nehmen Sie bitte Kontakt mit dem - Eigentümer dieser Site auf (Versuchen Sie, eine EMail - an <Webmaster@domänenname> - zu senden)!
    -

    - Obwohl der Eigentümer dieser Domäne die Apache - Web-Server Software verwendet, hat diese Web-Site ziemlich sicher - keinerlei Verbindung mit der Apache Software Foundation - (die diese Software kostenlos vertreibt). Es besteht also - keinerlei Veranlassung, eine EMail an - die Entwickler der Software zu senden. Sollten Sie das dennoch - tun, wird Ihre Mail stillschweigend - ignoriert. -

    -
    -

    - Die englische Online-Dokumentation für die - Apache Web-Server Software ist Bestandteil dieser - Software-Distribution. -

    -

    - Dem WebMaster dieser Web-Site steht es frei, das - untenstehende "Powered by Apache"-Logo auf einem Apache-basierten - Web-Server zu verwenden.
    - Vielen Dank, dass Sie Apache gewählt haben! -

    -
    - Powered by Apache! -
    - - diff --git a/docs/docroot/index.html.dk b/docs/docroot/index.html.dk deleted file mode 100644 index 22b3931aac5c321253a3fa09809c7b32353346cc..0000000000000000000000000000000000000000 --- a/docs/docroot/index.html.dk +++ /dev/null @@ -1,47 +0,0 @@ - - - - Prøveside for Apache installationen - - - -

    - Det virkede! Apache Webserveren er installeret på denne maskine! -

    -

    - Hvis du kan se denne side, så har dem som ejer dette domæne lige - installeret Apache Webserveren. - Du må nu placere web sider i dette directory og fjerne denne side, eller - konfigurere serveren til at anvende et andet directory. -

    -
    -
    - Hvis du ser denne side istedet for en anden forventet side, kontakt - venligst administratoren for den server du prøver at kontakte. - (Prøv at sende mail til <Webmaster@domain>.) - Apachegruppen har ikke noget at gøre med denne site, så det vil ikke - hjælpe at sende mail to Apache udviklerne angående denne site. -
    -
    -

    - Apache- - documentationen - er inkluderet med denne distribution. -

    -

    - Webmasteren af denne site må gerne bruge den følgende grafik - på en Apache-drevet webserver. Mange tak for at bruge Apache! -

    -
    - -
    - - diff --git a/docs/docroot/index.html.ee b/docs/docroot/index.html.ee deleted file mode 100644 index 879c30e3815ae380744bd322029d8c13f3118bf6..0000000000000000000000000000000000000000 --- a/docs/docroot/index.html.ee +++ /dev/null @@ -1,53 +0,0 @@ - - - - Apache veebiserveri installatsiooni testlehekülg - - - - -

    - Kujuta pilti, käima läks! Apache veebiserver on installeeritud! -

    -

    - Kui Sa näed seda lehekülge, siis selle domeeni omanikud on - edukalt hakkama saanud Apache veebiserveri - installeerimisega. Järgmiseks peaks nad selle lehekülje asendama - misiganes materjaliga, mida nad oma veebisaidis näidata tahavad, - või siis juhatama veebiserverile kätte tegeliku materjali - asukoha. -

    -
    -
    - Kui Sa ootasid siin leheküljel näha hoopis midagi muud, - siis palun võta ühendust selle veebisaidi - administraatoriga. (Võid näiteks kirjutada aadressil - <Webmaster@domain>.) Kuigi see veebisait - kasutab Apache tarkvara, pole ta peaaegu kindlasti mitte Apache Group'iga - mingil muul moel seotud. Seega, palun ära kirjuta selle saidi - asjus Apache autoritele. Kui sa seda teed, siis sinu kirja - ignoreeritakse. -
    -
    -

    - Ka Apache - dokumentatsioon - on selles distributsioonis olemas. -

    -

    - Kohalik veebmeister võib vabalt kasutada allpool olevat - pilti oma Apache veebiserveril. Aitäh Apachet kasutamast! -

    -
    - -
    - - diff --git a/docs/docroot/index.html.el b/docs/docroot/index.html.el deleted file mode 100644 index 371354f9c6d2e189002893794753e9705ddd0151..0000000000000000000000000000000000000000 --- a/docs/docroot/index.html.el +++ /dev/null @@ -1,37 +0,0 @@ - - - - ÄïêéìáóôéêÞ Óåëßäá ãéá ôçí ÅãêáôÜóôáóç ôïõ Apache - - - - - -

    -ÅÜí ìðïñåßôå íá äåßôå áõôÞ ôç óåëßäá, ôüôå ç åãêáôÜóôáóç ôïõ ëïãéóìéêïý ôïõ ÅîõðçñåôçôÞ WWW Apache óå áõôü ôï óýóôçìá Þôáí åðéôõ÷Þò. Ìðïñåßôå ôþñá íá ðñïóèÝóåôå ðåñéå÷üìåíï óå áõôü ôïí êáôÜëïãï êáé íá áíôéêáôáóôÞóåôå áõôÞ ôç óåëßäá. - -


    - -

    ÂëÝðåôå áõôÞ ôç óåëßäá áíôß ãéá ôï äéêôõáêü ôüðï ðïõ ðåñéìÝíáôå;

    - -

    -ÁõôÞ ç óåëßäá âñßóêåôáé åäþ ãéáôß ï äéá÷åéñéóôÞò áõôïý ôïõ äéêôõáêïý ôüðïõ ôñïðïðïßçóå ôéò ñõèìßóåéò óôïí åîõðçñåôçôÞ Apache. Ðáñáêáëþ åðéêïéíùíÞóôå ìå ôïí õðåýèõíï ãéá ôç äéá÷åßñéóç ôïõ ðáñüíôïò åîõðçñåôçôÞ. Ôï ºäñõìá Ëïãéóìéêïý Apache (The Apache Software Foundation) Ýãñáøå ôï ëïãéóìéêü ôïõ åîõðçñåôçôÞ WWW ôï ïðïßï ÷ñçóéìïðïéåß ï äéá÷åéñéóôÞò áõôïý ôïõ äéêôõáêïý ôüðïõ. Ôï ºäñõìá üìùò äåí Ý÷åé êáìéÜ áñìïäéüôçôá ó÷åôéêÞ ìå ôç äéá÷åßñéóç áõôïý ôïõ äéêôõáêïý ôüðïõ êáé äåí ìðïñåß íá âïçèÞóåé óôçí åðßëõóç èåìÜôùí ðïõ Ý÷ïõí ó÷Ýóç ìå ôéò ñõèìßóåéò ôïõ. - -


    - - -

    ôåêìçñßùóç ôïõ Apache Ý÷åé óõìðåñéëçöèåß óå áõôÞ ôç äéáíïìÞ. - -

    -Åßóôå åëåýèåñïò/ç íá ÷ñçóéìïðïéÞóåôå ôçí ðáñáêÜôù åéêüíá óå Ýíáí åîõðçñåôçôÞ ôïõ WWW ðïõ âáóßæåôáé óå Apache. Åõ÷áñéóôïýìå ðïõ ÷ñçóéìïðïéåßôå ôïí Apache! - -

    - - diff --git a/docs/docroot/index.html.en b/docs/docroot/index.html.en deleted file mode 100644 index 73f5eca36c7cb04afdca63947b7367085d8307fc..0000000000000000000000000000000000000000 --- a/docs/docroot/index.html.en +++ /dev/null @@ -1,38 +0,0 @@ - - - - Test Page for Apache Installation - - - - - -

    -If you can see this, it means that the installation of the Apache web server software on this system was successful. You may now add content to this directory and replace this page. - -


    - -

    Seeing this instead of the website you expected?

    - -

    -This page is here because the site administrator has changed the configuration of this web server. -Please contact the person responsible for maintaining this server with questions. The Apache Software Foundation, which wrote the web server software this site administrator is using, has nothing to do with maintaining this site and cannot help resolve configuration issues. - -


    - - -

    -The Apache documentation has been included with this distribution. - -

    -You are free to use the image below on an Apache-powered web server. Thanks for using Apache! - -

    - - diff --git a/docs/docroot/index.html.es b/docs/docroot/index.html.es deleted file mode 100644 index b5f81070b74b4a12f9dbc3d39c71638ab1863750..0000000000000000000000000000000000000000 --- a/docs/docroot/index.html.es +++ /dev/null @@ -1,51 +0,0 @@ - - - - Pagína para probar la instalación de Apache - - - -

    - ¡Funcionó! ¡El Servidor de Red Apache ha sido instalado en ese sitio! -

    -

    - Si usted puede ver esta pagína, entonces los dueños de esta - maquína han instalado el Servidor de - Red Apache con exíto. Ahora deben añadir contenido a este directorio - y reemplazar esta pagína, ó apuntar este servidor al contenido real. -

    -
    -
    - Si usted esta leyendo esta pagína y no es lo que esperaba, por favor - contacte el administrador de este sitio. - (Trate de enviar correo electrónico a <Webmaster@domain>.) - Aunque este sitio esta utilizando el programa Apache es casi seguro - que no tiene ninguna conexión con el Apache Group, por eso favor de - no enviar correo sobre este sitio o su contenido a los autores de - Apache. Si lo hace, su mensaje sera - ignorado. -
    -
    -

    - La - documentación - de Apache ha sido incluida en esta distribución. -

    -

    - El administrador del sitio esta invitado a usar la siguiente - imagen para indicar que su sitio es servido por Apache. - ¡Gracias por usar Apache! -

    -
    - -
    - - diff --git a/docs/docroot/index.html.et b/docs/docroot/index.html.et deleted file mode 100644 index 879c30e3815ae380744bd322029d8c13f3118bf6..0000000000000000000000000000000000000000 --- a/docs/docroot/index.html.et +++ /dev/null @@ -1,53 +0,0 @@ - - - - Apache veebiserveri installatsiooni testlehekülg - - - - -

    - Kujuta pilti, käima läks! Apache veebiserver on installeeritud! -

    -

    - Kui Sa näed seda lehekülge, siis selle domeeni omanikud on - edukalt hakkama saanud Apache veebiserveri - installeerimisega. Järgmiseks peaks nad selle lehekülje asendama - misiganes materjaliga, mida nad oma veebisaidis näidata tahavad, - või siis juhatama veebiserverile kätte tegeliku materjali - asukoha. -

    -
    -
    - Kui Sa ootasid siin leheküljel näha hoopis midagi muud, - siis palun võta ühendust selle veebisaidi - administraatoriga. (Võid näiteks kirjutada aadressil - <Webmaster@domain>.) Kuigi see veebisait - kasutab Apache tarkvara, pole ta peaaegu kindlasti mitte Apache Group'iga - mingil muul moel seotud. Seega, palun ära kirjuta selle saidi - asjus Apache autoritele. Kui sa seda teed, siis sinu kirja - ignoreeritakse. -
    -
    -

    - Ka Apache - dokumentatsioon - on selles distributsioonis olemas. -

    -

    - Kohalik veebmeister võib vabalt kasutada allpool olevat - pilti oma Apache veebiserveril. Aitäh Apachet kasutamast! -

    -
    - -
    - - diff --git a/docs/docroot/index.html.fr b/docs/docroot/index.html.fr deleted file mode 100644 index 7ffa0979d6179a26399bddfbff49bb06921c3000..0000000000000000000000000000000000000000 --- a/docs/docroot/index.html.fr +++ /dev/null @@ -1,53 +0,0 @@ - - - - Page de test de l'installation d'Apache - - - -

    - Ça fonctionne ! Le serveur web Apache est installé sur - ce site ! -

    -

    - Si vous lisez cette page, c'est que les propriétaires de ce domaine - viennent d'installer le - serveur web Apache - avec succès. Ils doivent maintenant ajouter du contenu à ce - répertoire et remplacer cette page, ou bien faire pointer le serveur - vers l'endroit où se trouve le contenu réel du site. -

    -
    -
    - Si vous voyez cette page au lieu du site attendu, veuillez contacter - l'administrateur du site concerné. - (Essayez d'envoyer un email à - <Webmaster@domaine>.) - Bien que ce site utilise le logiciel Apache, il n'a certainement - rien à voir avec le Groupe Apache, par conséquent - veuillez ne pas envoyer d'email aux - auteurs d'Apache concernant ce site ou son contenu. Si vous le faites, - votre message sera ignoré. -
    -
    -

    - La - documentation - Apache est incluse dans cette distribution. -

    -

    - Le webmaster de ce site peut librement utiliser l'image ci-dessous - sur un site web utilisant le logiciel Apache. Merci d'avoir choisi - Apache ! -

    -
    - -
    - - diff --git a/docs/docroot/index.html.he.iso8859-8 b/docs/docroot/index.html.he.iso8859-8 deleted file mode 100644 index 84254886bc7ceec1fc6e4a5906603dd99c55210a..0000000000000000000000000000000000000000 --- a/docs/docroot/index.html.he.iso8859-8 +++ /dev/null @@ -1,62 +0,0 @@ - - - - - Apache-ä úøù úð÷úäì ïåéñð óã - - - - -
    - -

    - -
    äæä ãåîòä úà äàåø äúà íà -
    Apache èðøèðéàä úøù ìù äð÷úääù øîà äæ -
    !!!äçìöäá äøáò -
    êìù íéöá÷ä úà óéñåäì ìåëé äúà åéùëò -
    .äæä óãä úà óéìçäìå úàæä äöéçîì - -

    - -


    - -

    ?úéôéöù øúàä íå÷îá úàæ àåø

    -
    -

    -
    äæä øúàä ìò éàøçà éë ,ïàë äöîð äæä ãåîòä -
    .äæ èðøèðéàä úøùä ìù äéöøåâéôðå÷ä úà äðéù -
    .úåìàù íà úøùä éàøçà íà øù÷ øåöéì àð -
    úà äøöé øùà Apache Software Foundation -
    úøùä ú÷åæçú ìò úéàøçà äðéà ,äæ úøùä úðëåú -
    äéöøåâéôðå÷ úåéòá ïåøúôá äééòñì äìåëé äðéàå - .íäùìë -

    - -


    - -
    - - -

    -
    êåúá íéòöîð äéöèðîå÷åãä éëîñî - .úøùä úðëåú úìéáç - - -

    -
    ãåîòä úéúçúá äöîðä ìîñá ùîúùäì éàùø äúà -
    .Apache é''ò ìòôåîù úøùä ìò ÷ø - - !!!Apache-á ùåîéùä ìò äãåú - -

    - -
    - - diff --git a/docs/docroot/index.html.hr.iso8859-2 b/docs/docroot/index.html.hr.iso8859-2 deleted file mode 100644 index 7af963d66f632848f9ed5814cb23d938bf7bfff1..0000000000000000000000000000000000000000 --- a/docs/docroot/index.html.hr.iso8859-2 +++ /dev/null @@ -1,35 +0,0 @@ - - - - -Testna Stranica Apache Instalacije - - - -

    Èestitamo! Apache web poslu¾itelj funkcionira!

    -

    Ukoliko vidite ovu stranicu, to znaèi da je instalacija Apache web poslu¾itelja uspje¹no izvr¹ena na ovom raèunalu. -Sada mo¾ete dodati sadr¾aj u ovaj direktorij te promijeniti ovu stranicu.

    - -
    -

    Oèekivali ste neku drugu stranicu?

    - -

    Ovu stranica vidite stoga ¹to je administrator ovog poslu¾itelja promijenio -konfiguraciju. Apache Softver Fondacija napisala je softver koji koristi -administrator ovog web poslu¾itelja i nije odgovorna za odr¾avanje ovog poslu¾itelja. Molimo vas da za sva pitanja kontaktirate odgovornu -osobu za odr¾avanje ovog poslu¾itelja.

    - -
    -

    Ovdje se nalazi Dokumentacija o Apache web poslu¾itelju -(engleski).

    - -

    Donju slièicu mo¾ete slobodno koristiti na stranicama ovog veb poslu¾itelja. -Hvala vam ¹to koristite Apache!

    - -
    Apache Web Poslu¾itelj
    - - - diff --git a/docs/docroot/index.html.it b/docs/docroot/index.html.it deleted file mode 100644 index ab32d04a5096f7c58f41a07045684747e6b3e00e..0000000000000000000000000000000000000000 --- a/docs/docroot/index.html.it +++ /dev/null @@ -1,38 +0,0 @@ - - - - - Pagina di prova dell'installazione di un sito Web con Apache - - - - -
    -

    -Funziona! Il Server Web Apache e' stato installato su questo sito Web!

    -Se riuscite a vedere questa pagina, allora vuol dire che coloro che gestiscono -questo dominio hanno appena installato il software Web Server -Apache correttamente. Ora e' necessario aggiungere il vostro materiale -in questo direttorio e sostituire questa pagina di prova, oppure configurare -il server per far riferimento al vostro materiale se collocato altrove. -

    -


    -
    Se state vedendo questa pagina invece del sito che pensavate, -vi preghiamo di contattare l'amministratore del sito in questione. -(Provate ad inviare un email a <Webmaster@domain>.)  -Nonostante questo sito stia utilizzando il software Apache, questo non -vi garantisce nessun tipo di contatto diretto al Gruppo Apache, quindi -vi preghiamo di non inviare email riguardanti questo sito o al materiale -in esso contenuto agli autori di Apache. Ogni messaggio del genere verra' -ignorato.
    - -
    -
    La documentazione relativa di Apache -e' inclusa nella distribuzione. -

    Il Webmaster di questo sito e' libero di utilizzare l'immagine qui sotto -su qualsiasi Web server potenziato con Apache. Grazie per aver scelto Apache! -

    -

    - - - diff --git a/docs/docroot/index.html.ja.iso2022-jp b/docs/docroot/index.html.ja.iso2022-jp deleted file mode 100644 index 0a4e5452613ad6bd4be820bbcd562f8755f7b5f9..0000000000000000000000000000000000000000 --- a/docs/docroot/index.html.ja.iso2022-jp +++ /dev/null @@ -1,42 +0,0 @@ - - - - - Apache $B%$%s%9%H!<%k;~$N%F%9%H%Z!<%8(B - - - - - -

    -$B$b$7$3$N%Z!<%8$,FI$a$?$N$G$"$l$P!"(BApache $B%&%'%V%5!<%P(B$B$N%$%s%9%H!<%k$,$3$N7W;;5!$GL5;v$K=*N;$7$?$3$H$r0UL#$7$^$9!#$"$J$?$O!"$3$N%G%#%l%/%H%j$KJ8=q$r2C$($?$j!"$3$N%Z!<%8$rCV$-$+$($k$3$H$,$G$-$^$9!#(B -

    -
    - -

    $B$"$J$?$NM=A[$KH?$7$F!"$3$N%Z!<%8$,8+$($F$$$k$G$7$g$&$+(B?

    - -

    -$B$3$N%Z!<%8$O!"%5%$%H4IM}$B$3$N%5!<%P$r4IM}$9$k@UG$$r;}$C$F$$$kJ}$KO"Mm$r$H$C$F(B$B$/$@$5$$!#$3$N%5%$%H4IM} -


    - - -

    -Apache $B$K4X$9$k(B$BJ8=q(B $B$O!"$3$N(B web $B%5!<%PG[I[J*$NCf$K4^$^$l$F$$$^$9!#(B -

    -

    -$B0J2<$N2hA|$O!"(BApache $B$rMxMQ$7$F$$$k(B web $B%5!<%P$G<+M3$K;H$&$3$H$,$G$-$^$9!#(BApache $B$r$4MxMQ$$$?$@$-!"$"$j$,$H$&$4$6$$$^$9(B! -

    -
    - -
    - - diff --git a/docs/docroot/index.html.nl b/docs/docroot/index.html.nl deleted file mode 100644 index b00747cd2a992a391f0b788f8c939481d455d734..0000000000000000000000000000000000000000 --- a/docs/docroot/index.html.nl +++ /dev/null @@ -1,54 +0,0 @@ - - - - Test Pagina voor de Apache Installatie op deze Web Site - - - - -

    - Alles Werkt! De Apache Web Server is geinstalleerd op deze Web Site -

    -

    - Mocht u deze pagina zien, dan betekent dat, dat de eigenaren van dit - domein zojuist een nieuwe Apache Web - Server hebben geinstalleerd. Nu moet men nog de echte inhoud gaan - toevoegen, en moet men deze pagina gaan vervangen door de echte web - site. -

    -
    -
    - Mocht u deze pagina zien, in plaats van de pagina of web site die u - verwachtte, neem dan contact op met de beheerder van - deze site. Bijvoorbeeld door een berichtje te sturen naar - <Webmaster@dit-domain>. -

    - Alhoewel deze web site gebruik maakt van de Apache Software is er - verder geen enkele relatie tussen de beheerders van deze web site en - de Apache Groep (die de web software geschreven heeft). Het heeft dus - absoluut - geen zin de web software auteurs een emailtje te sturen. Mocht u dat - toch doen, dan wordt uw bericht gewoon genegeerd. -

    -
    -

    - De - handleiding voor de apache web - server software maakt deel uit van deze distributie. -

    -

    - Als beheerder of webmaster is het u toegestaan het onderstaande - plaatje vrijelijk te gebruiken op uw 'Apache Powered' web site. Bedankt - voor het kiezen voor, en gebruiken van, Apache! -

    -
    - Klein 'Powered by Apache' Logotje -
    - - diff --git a/docs/docroot/index.html.nn b/docs/docroot/index.html.nn deleted file mode 100644 index 67db9570b0441ca5bb32bcd6f08552bd899d8b3a..0000000000000000000000000000000000000000 --- a/docs/docroot/index.html.nn +++ /dev/null @@ -1,48 +0,0 @@ - - - - Testside Apache-installasjon - - - -

    - Det gjekk bra! Apache er no installert på denne maskina! -

    -

    - Dersom du kan sjå denne sida, har den eller dei som driv denne nettstaden - installert Apache vevtenar. - No må denne testsida erstattast med verkeleg innhald. -

    -
    -
    - Dersom du hadde venta å sjå ei anna side enn denne, bør du - ta kontakt med den som er ansvarleg for denne nettstaden - (Prøv å sende e-post til <webmaster@domene>.) - Sjølv om denne nettstaden vert kjørt på Apache, har den ingen annan - tilknytning til Apache-gruppa, som har utvikla programvaren. - Ver snill og ikkje send e-post om denne nettstaden eller - innhaldet du finn her til utviklarane i Apache-gruppa. - I så tilfelle vil førespurnaden ignorerast. -
    -
    -

    - Dokumentasjon - for Apache er inkludert i denne pakka. -

    -

    - Logoen under kan brukast på kva som helst av maskiner som køyrer Apache. - Takk for at du nyttar Apache! -

    -
    - -
    - - diff --git a/docs/docroot/index.html.no b/docs/docroot/index.html.no deleted file mode 100644 index b69c4ce163cb888f72dda34c7b2ddc51e2c97e54..0000000000000000000000000000000000000000 --- a/docs/docroot/index.html.no +++ /dev/null @@ -1,49 +0,0 @@ - - - - Testside for Apache Installasjon på Webside - - - -

    - Det gikk bra! Det Apache Web Server Er Nå Installert her! -

    -

    - Hvis du kan se denne siden, det betyr at de som eier denne domene (domain) - har nettopp greid å installere Apache Web server - software. De må tilføye innhold til denne katalog og erstatte denne - plassholder siden, ellers peke serveren til de virkelige innhold. -

    -
    -
    - Hvis du ser denne siden istedenfor den du ventet for, vennligst - ta kontakt med websever administratøren. - (Prøv å sende e-post til <Webmaster@domene>.) - Selv om denne hjemmesiden driver med Apache software, har den ingen annen - tilknytting til Apache Gruppen. Vennligst ikke send post angående denne hjemmesiden eller - dets innhold til Apache programmerere. Hvis du gjør det, din beskjed blir - oversett. -
    -
    -

    - Den Apache - dokumentasjon - er inkludert i denne distribusjonen. -

    -

    - Denne sidens Webmaster kan bruke det grafikk nedenfør på en Apache-drevet Webserver. - Takk for at du bruker Apache! -

    -
    - -
    - - diff --git a/docs/docroot/index.html.po.iso8859-2 b/docs/docroot/index.html.po.iso8859-2 deleted file mode 100644 index 8b030bd651637d38329d1ee2dd9868e82f120714..0000000000000000000000000000000000000000 --- a/docs/docroot/index.html.po.iso8859-2 +++ /dev/null @@ -1,40 +0,0 @@ - - - - Strona testowa instalacji serwera Apache - - - - - - - -

    -Je¿eli strona ta jest widoczna, oznacza to poprawn± instalacjê serwera Apache. Mo¿na ju¿ zamieniæ zawarto¶æ tej witryny. - -


    - -

    Czy zamiast spodziewanej witryny WWW widoczna jest ta?

    - -

    -Strona ta jest widoczna, poniewa¿ administrator serwera WWW zmieni³ jego konfiguracjê. -Proszê skontaktowaæ siê z osob± odpowiedzialn± za zarz±dzanie tym serwerem. Apache Software Foundation, producent oprogramowania serwerowego Apache, nie administruje t± witryn± i nie jest w stanie pomóc w sprawach zwi±zanych z jej konfiguracj±. - -


    - - -

    -Do niniejszej dystrybucji serwera Apache do³±czono anglojêzyczn± dokumentacjê. - -

    -Poni¿sze logo, "Powered by Apache", mo¿na stosowaæ bez ograniczeñ. Dziêkujemy za wybranie Apache'a! - -

    - - diff --git a/docs/docroot/index.html.pt b/docs/docroot/index.html.pt deleted file mode 100644 index 4e2645f5d8ab91706792a7849ea19d76637ce5fa..0000000000000000000000000000000000000000 --- a/docs/docroot/index.html.pt +++ /dev/null @@ -1,42 +0,0 @@ - - - - Página de teste da instalação do Apache Web Server - - - - - - -

    Se está a ver esta página significa que a instalação - do Apache Web Server foi efectuada - com sucesso. Pode agora adicionar conteúdo a esta directoria e substituir - esta página. -


    - -

    Está a ver esta página em vez do website que - esperava?

    - -

    Esta página está neste momento activa porque o administrador - deste site alterou a configuração do web server. Por favor contacte - a pessoa responsável pela manutenção deste servidor. - A Fundação Apache Software (Apache Software Foundation), apesar - de ter produzido o web server que o administrador deste site está a usar, - não tem qualquer tipo de responsabilidade pela manutenção - deste nem pode ajudar a resolver problemas de configuração. -


    - - -

    A documentação foi incluída - juntamente com esta distribuição. -

    A imagem abaixo pode ser usada livremente em qualquer site presente num servidor - com o Apache Web Server instalado. Obrigado por usar o Apache Web Server! -

    - - diff --git a/docs/docroot/index.html.pt-br b/docs/docroot/index.html.pt-br deleted file mode 100644 index 72428d5a2a96642b2bd1a046fd6b54099b254f35..0000000000000000000000000000000000000000 --- a/docs/docroot/index.html.pt-br +++ /dev/null @@ -1,55 +0,0 @@ - - - - Pagina teste para a instalacao do Apache no Web Site - - - - -

    - Funcionou! O Apache Web Server esta instalado neste Web Site! -

    -

    - Se conseguir ver esta pagina, entao as pessoas que possuem este - dominio acabaram - de instalar o software Apache Web - server - com sucesso. Agora tem de adicionar o conteudo a esta directoria - e substituir esta pagina "placeholder", ou apontar o servidor para o - seu conteudo real. -

    -
    -
    - Se esta a ver esta pagina em vez do site que esperava, por favor - contacte o administrador do site envolvido. - (Tente enviar um e-mail para - <Webmaster@domain>.) - Apesar de neste site estar a - correr o software Apache e quase certo que nao tem - outra ligacao com o Grupo Apache, por isso por favor nao envie - e-mails acerca deste - site ou do seu conteudo para os autores do Apache. Se o fizer, a - sua mensagem vai ser - ignorada. -
    -
    -

    - O Apache documentation - foi incluido com esta distribuicao. -

    -

    - O Webmaster deste site e livre para utilizar a imagem abaixo num - Web server instalado com o Apache. Obrigado por utilizar o Apache! -

    -
    - -
    - - diff --git a/docs/docroot/index.html.ru.cp-1251 b/docs/docroot/index.html.ru.cp-1251 deleted file mode 100644 index bfb8a16635118e7ca9108e649166a0cc78632e5c..0000000000000000000000000000000000000000 --- a/docs/docroot/index.html.ru.cp-1251 +++ /dev/null @@ -1,34 +0,0 @@ - - - - - - Òåñòîâàÿ ñòðàíèöà óñòàíîâêè Apache - - - -Åñëè Âû ýòî âèäèòå, ýòî çíà÷èò, ÷òî óñòàíîâêà -ÏÎ âåá-ñåðâåðà Apache íà ýòîé -ñèñòåìå çàâåðøèëàñü óñïåøíî. Âû ìîæåòå òåïåðü äîáàâëÿòü ñîäåðæèìîå â ýòó -äèðåêòîðèþ è çàìåíèòü ýòó ñòðàíèöó. -

    -


    -
    -

    -Âû âèäèòå ýòî âìåñòî îæèäàåìîé ñòðàíèöû?

    -Ýòà ñòðàíèöà íàõîäèòñÿ çäåñü ïîòîìó, ÷òî àäìèíèñòðàòîð ñèñòåìû èçìåíèë -êîíôèãóðàöèþ ýòîãî âåá-ñåðâåðà. Ïîæàëóéñòà, ñâÿæèòåñü ñ ëèöîì, îòâåòñâåííûì -çà ïîääåðæêó ýòîãî ñåðâåðà äëÿ âûÿñíåíèÿ âàøèõ âîïðîñîâ. Apache Software -Foundation, àâòîð ÏÎ âåá-ñåðâåðà, êîòîðûì ïîëüçóåòñÿ àäìèíèñòðàòîð ýòîé -ñèñòåìû, íå ñâÿçàí ñ ïîääåðæêîé ýòîé ñèñòåìû è íå ìîæåò ïîìî÷ü Âàì -ðàçðåøèòü ïðîáëåìû êîíôèãóðàöèè. -

    -


    -

    Äîêóìåíòàöèÿ ïî âåá-ñåðâåðó Apache ïðèëàãàåòñÿ -ê êîìïëåêòó ÏÎ. -

    Âû ìîæåòå ñâîáîäíî èñïîëüçîâàòü ïèêòîãðàììó, íàõîäÿùóþñÿ íèæå, íà âåá-ñåðâåðå, -èñïîëüçóþùèì ÏÎ Apache. Ñïàñèáî çà èñïîëüçîâàíèå Apache! -

    - - - diff --git a/docs/docroot/index.html.ru.cp866 b/docs/docroot/index.html.ru.cp866 deleted file mode 100644 index b9f2615f379fe804db874101935925e9e7cf0629..0000000000000000000000000000000000000000 --- a/docs/docroot/index.html.ru.cp866 +++ /dev/null @@ -1,34 +0,0 @@ - - - - - - ’¥á⮢ ï áâà ­¨æ  ãáâ ­®¢ª¨ Apache - - - -…᫨ ‚ë íâ® ¢¨¤¨â¥, íâ® §­ ç¨â, çâ® ãáâ ­®¢ª  -Ž ¢¥¡-á¥à¢¥à  Apache ­  í⮩ -á¨á⥬¥ § ¢¥à訫 áì ãᯥ譮. ‚ë ¬®¦¥â¥ ⥯¥àì ¤®¡ ¢«ïâì ᮤ¥à¦¨¬®¥ ¢ íâã -¤¨à¥ªâ®à¨î ¨ § ¬¥­¨âì íâã áâà ­¨æã. -

    -


    -
    -

    -‚ë ¢¨¤¨â¥ íâ® ¢¬¥áâ® ®¦¨¤ ¥¬®© áâà ­¨æë?

    -â  áâà ­¨æ  ­ å®¤¨âáï §¤¥áì ¯®â®¬ã, çâ®  ¤¬¨­¨áâà â®à á¨áâ¥¬ë ¨§¬¥­¨« -ª®­ä¨£ãà æ¨î í⮣® ¢¥¡-á¥à¢¥à . ®¦ «ã©áâ , á¢ï¦¨â¥áì á «¨æ®¬, ®â¢¥âᢥ­­ë¬ -§  ¯®¤¤¥à¦ªã í⮣® á¥à¢¥à  ¤«ï ¢ëïá­¥­¨ï ¢ è¨å ¢®¯à®á®¢. Apache Software -Foundation,  ¢â®à Ž ¢¥¡-á¥à¢¥à , ª®â®àë¬ ¯®«ì§ã¥âáï  ¤¬¨­¨áâà â®à í⮩ -á¨á⥬ë, ­¥ á¢ï§ ­ á ¯®¤¤¥à¦ª®© í⮩ á¨áâ¥¬ë ¨ ­¥ ¬®¦¥â ¯®¬®çì ‚ ¬ -à §à¥è¨âì ¯à®¡«¥¬ë ª®­ä¨£ãà æ¨¨. -

    -


    -

    „®ªã¬¥­â æ¨ï ¯® ¢¥¡-á¥à¢¥àã Apache ¯à¨« £ ¥âáï -ª ª®¬¯«¥ªâã Ž. -

    ‚ë ¬®¦¥â¥ ᢮¡®¤­® ¨á¯®«ì§®¢ âì ¯¨ªâ®£à ¬¬ã, ­ å®¤ïéãîáï ­¨¦¥, ­  ¢¥¡-á¥à¢¥à¥, -¨á¯®«ì§ãî騬 Ž Apache. ‘¯ á¨¡® §  ¨á¯®«ì§®¢ ­¨¥ Apache! -

    - - - diff --git a/docs/docroot/index.html.ru.iso-ru b/docs/docroot/index.html.ru.iso-ru deleted file mode 100644 index 114d9f75054327e8d5b9eab4545eae43c91dfba2..0000000000000000000000000000000000000000 --- a/docs/docroot/index.html.ru.iso-ru +++ /dev/null @@ -1,34 +0,0 @@ - - - - - - ÂÕáâÞÒÐï áâàÐÝØæÐ ãáâÐÝÞÒÚØ Apache - - - -µáÛØ ²ë íâÞ ÒØÔØâÕ, íâÞ ×ÝÐçØâ, çâÞ ãáâÐÝÞÒÚÐ -¿¾ ÒÕÑ-áÕàÒÕàÐ Apache ÝÐ íâÞÙ -áØáâÕÜÕ ×ÐÒÕàèØÛÐáì ãáßÕèÝÞ. ²ë ÜÞÖÕâÕ âÕßÕàì ÔÞÑÐÒÛïâì áÞÔÕàÖØÜÞÕ Ò íâã -ÔØàÕÚâÞàØî Ø ×ÐÜÕÝØâì íâã áâàÐÝØæã. -

    -


    -
    -

    -²ë ÒØÔØâÕ íâÞ ÒÜÕáâÞ ÞÖØÔÐÕÜÞÙ áâàÐÝØæë?

    -ÍâÐ áâàÐÝØæÐ ÝÐåÞÔØâáï ×ÔÕáì ßÞâÞÜã, çâÞ ÐÔÜØÝØáâàÐâÞà áØáâÕÜë Ø×ÜÕÝØÛ -ÚÞÝäØÓãàÐæØî íâÞÓÞ ÒÕÑ-áÕàÒÕàÐ. ¿ÞÖÐÛãÙáâÐ, áÒïÖØâÕáì á ÛØæÞÜ, ÞâÒÕâáÒÕÝÝëÜ -×Ð ßÞÔÔÕàÖÚã íâÞÓÞ áÕàÒÕàÐ ÔÛï ÒëïáÝÕÝØï ÒÐèØå ÒÞßàÞáÞÒ. Apache Software -Foundation, ÐÒâÞà ¿¾ ÒÕÑ-áÕàÒÕàÐ, ÚÞâÞàëÜ ßÞÛì×ãÕâáï ÐÔÜØÝØáâàÐâÞà íâÞÙ -áØáâÕÜë, ÝÕ áÒï×ÐÝ á ßÞÔÔÕàÖÚÞÙ íâÞÙ áØáâÕÜë Ø ÝÕ ÜÞÖÕâ ßÞÜÞçì ²ÐÜ -àÐ×àÕèØâì ßàÞÑÛÕÜë ÚÞÝäØÓãàÐæØØ. -

    -


    -

    ´ÞÚãÜÕÝâÐæØï ßÞ ÒÕÑ-áÕàÒÕàã Apache ßàØÛÐÓÐÕâáï -Ú ÚÞÜßÛÕÚâã ¿¾. -

    ²ë ÜÞÖÕâÕ áÒÞÑÞÔÝÞ ØáßÞÛì×ÞÒÐâì ßØÚâÞÓàÐÜÜã, ÝÐåÞÔïéãîáï ÝØÖÕ, ÝÐ ÒÕÑ-áÕàÒÕàÕ, -ØáßÞÛì×ãîéØÜ ¿¾ Apache. ÁßÐáØÑÞ ×Ð ØáßÞÛì×ÞÒÐÝØÕ Apache! -

    - - - diff --git a/docs/docroot/index.html.ru.koi8-r b/docs/docroot/index.html.ru.koi8-r deleted file mode 100644 index 685b56207d088373953aaaf238448e613d34405c..0000000000000000000000000000000000000000 --- a/docs/docroot/index.html.ru.koi8-r +++ /dev/null @@ -1,34 +0,0 @@ - - - - - - ôÅÓÔÏ×ÁÑ ÓÔÒÁÎÉÃÁ ÕÓÔÁÎÏ×ËÉ Apache - - - -åÓÌÉ ÷Ù ÜÔÏ ×ÉÄÉÔÅ, ÜÔÏ ÚÎÁÞÉÔ, ÞÔÏ ÕÓÔÁÎÏ×ËÁ -ðï ×ÅÂ-ÓÅÒ×ÅÒÁ Apache ÎÁ ÜÔÏÊ -ÓÉÓÔÅÍÅ ÚÁ×ÅÒÛÉÌÁÓØ ÕÓÐÅÛÎÏ. ÷Ù ÍÏÖÅÔÅ ÔÅÐÅÒØ ÄÏÂÁ×ÌÑÔØ ÓÏÄÅÒÖÉÍÏÅ × ÜÔÕ -ÄÉÒÅËÔÏÒÉÀ É ÚÁÍÅÎÉÔØ ÜÔÕ ÓÔÒÁÎÉÃÕ. -

    -


    -
    -

    -÷Ù ×ÉÄÉÔÅ ÜÔÏ ×ÍÅÓÔÏ ÏÖÉÄÁÅÍÏÊ ÓÔÒÁÎÉÃÙ?

    -üÔÁ ÓÔÒÁÎÉÃÁ ÎÁÈÏÄÉÔÓÑ ÚÄÅÓØ ÐÏÔÏÍÕ, ÞÔÏ ÁÄÍÉÎÉÓÔÒÁÔÏÒ ÓÉÓÔÅÍÙ ÉÚÍÅÎÉÌ -ËÏÎÆÉÇÕÒÁÃÉÀ ÜÔÏÇÏ ×ÅÂ-ÓÅÒ×ÅÒÁ. ðÏÖÁÌÕÊÓÔÁ, Ó×ÑÖÉÔÅÓØ Ó ÌÉÃÏÍ, ÏÔ×ÅÔÓ×ÅÎÎÙÍ -ÚÁ ÐÏÄÄÅÒÖËÕ ÜÔÏÇÏ ÓÅÒ×ÅÒÁ ÄÌÑ ×ÙÑÓÎÅÎÉÑ ×ÁÛÉÈ ×ÏÐÒÏÓÏ×. Apache Software -Foundation, Á×ÔÏÒ ðï ×ÅÂ-ÓÅÒ×ÅÒÁ, ËÏÔÏÒÙÍ ÐÏÌØÚÕÅÔÓÑ ÁÄÍÉÎÉÓÔÒÁÔÏÒ ÜÔÏÊ -ÓÉÓÔÅÍÙ, ÎÅ Ó×ÑÚÁÎ Ó ÐÏÄÄÅÒÖËÏÊ ÜÔÏÊ ÓÉÓÔÅÍÙ É ÎÅ ÍÏÖÅÔ ÐÏÍÏÞØ ÷ÁÍ -ÒÁÚÒÅÛÉÔØ ÐÒÏÂÌÅÍÙ ËÏÎÆÉÇÕÒÁÃÉÉ. -

    -


    -

    äÏËÕÍÅÎÔÁÃÉÑ ÐÏ ×ÅÂ-ÓÅÒ×ÅÒÕ Apache ÐÒÉÌÁÇÁÅÔÓÑ -Ë ËÏÍÐÌÅËÔÕ ðï. -

    ÷Ù ÍÏÖÅÔÅ Ó×ÏÂÏÄÎÏ ÉÓÐÏÌØÚÏ×ÁÔØ ÐÉËÔÏÇÒÁÍÍÕ, ÎÁÈÏÄÑÝÕÀÓÑ ÎÉÖÅ, ÎÁ ×ÅÂ-ÓÅÒ×ÅÒÅ, -ÉÓÐÏÌØÚÕÀÝÉÍ ðï Apache. óÐÁÓÉÂÏ ÚÁ ÉÓÐÏÌØÚÏ×ÁÎÉÅ Apache! -

    - - - diff --git a/docs/docroot/index.html.ru.utf8 b/docs/docroot/index.html.ru.utf8 deleted file mode 100644 index f8a93c302061e5cd9a1d62eadb45a742c7630c9d..0000000000000000000000000000000000000000 --- a/docs/docroot/index.html.ru.utf8 +++ /dev/null @@ -1,34 +0,0 @@ - - - - - - ТеÑÑ‚Ð¾Ð²Ð°Ñ Ñтраница уÑтановки Apache - - - -ЕÑли Ð’Ñ‹ Ñто видите, Ñто значит, что уÑтановка -ПО веб-Ñервера Apache на Ñтой -ÑиÑтеме завершилаÑÑŒ уÑпешно. Ð’Ñ‹ можете теперь добавлÑÑ‚ÑŒ Ñодержимое в Ñту -директорию и заменить Ñту Ñтраницу. -

    -


    -
    -

    -Ð’Ñ‹ видите Ñто вмеÑто ожидаемой Ñтраницы?

    -Эта Ñтраница находитÑÑ Ð·Ð´ÐµÑÑŒ потому, что админиÑтратор ÑиÑтемы изменил -конфигурацию Ñтого веб-Ñервера. ПожалуйÑта, ÑвÑжитеÑÑŒ Ñ Ð»Ð¸Ñ†Ð¾Ð¼, ответÑвенным -за поддержку Ñтого Ñервера Ð´Ð»Ñ Ð²Ñ‹ÑÑÐ½ÐµÐ½Ð¸Ñ Ð²Ð°ÑˆÐ¸Ñ… вопроÑов. Apache Software -Foundation, автор ПО веб-Ñервера, которым пользуетÑÑ Ð°Ð´Ð¼Ð¸Ð½Ð¸Ñтратор Ñтой -ÑиÑтемы, не ÑвÑзан Ñ Ð¿Ð¾Ð´Ð´ÐµÑ€Ð¶ÐºÐ¾Ð¹ Ñтой ÑиÑтемы и не может помочь Ð’ам -разрешить проблемы конфигурации. -

    -


    -

    Ð”Ð¾ÐºÑƒÐ¼ÐµÐ½Ñ‚Ð°Ñ†Ð¸Ñ Ð¿Ð¾ веб-Ñерверу Apache прилагаетÑÑ -к комплекту ПО. -

    Ð’Ñ‹ можете Ñвободно иÑпользовать пиктограмму, находÑщуюÑÑ Ð½Ð¸Ð¶Ðµ, на веб-Ñервере, -иÑпользующим ПО Apache. СпаÑибо за иÑпользование Apache! -

    - - - diff --git a/docs/docroot/index.html.var b/docs/docroot/index.html.var deleted file mode 100644 index 12693fff15d6cd83eccdd36164dd24f858fdd8d2..0000000000000000000000000000000000000000 --- a/docs/docroot/index.html.var +++ /dev/null @@ -1,34 +0,0 @@ -index.html.ca -index.html.cz -index.html.de -index.html.dk -index.html.ee -index.html.el -index.html.en -index.html.es -index.html.et -index.html.fr -index.html.he.iso8859-8 -index.html.it -index.html.ja.iso2022-jp -index.html.ja.jis -index.html.kr.iso-kr -index.html.kr.iso2022-kr -index.html.ltz -index.html.lu -index.html.nl -index.html.no -index.html.po.iso-pl -index.html.pt -index.html.pt-br -index.html.ru.cp-1251 -index.html.ru.cp866 -index.html.ru.iso-ru -index.html.ru.koi8-r -index.html.ru.ucs2 -index.html.ru.ucs4 -index.html.ru.utf8 -index.html.se -index.html.tw -index.html.tw.Big5 -index.html.var diff --git a/docs/doxygen.conf b/docs/doxygen.conf deleted file mode 100644 index 41a6e9c4eec020a401c55c066c90851e2e57cabf..0000000000000000000000000000000000000000 --- a/docs/doxygen.conf +++ /dev/null @@ -1,13 +0,0 @@ -PROJECT_NAME=Apache - -INPUT=. -RECURSIVE=YES -FILE_PATTERNS=*.h - -OUTPUT_DIRECTORY=docs/dox - -MACRO_EXPANSION=YES -EXPAND_ONLY_PREDEF=YES -EXPAND_AS_DEFINED=AP_DECLARE - -OPTIMIZE_OUTPUT_FOR_C=YES diff --git a/docs/error/HTTP_BAD_GATEWAY.html.var b/docs/error/HTTP_BAD_GATEWAY.html.var deleted file mode 100644 index c6f81de0a1cd0b1d43f3445ec5692237c0187aee..0000000000000000000000000000000000000000 --- a/docs/error/HTTP_BAD_GATEWAY.html.var +++ /dev/null @@ -1,66 +0,0 @@ -Content-language: de -Content-type: text/html -Body:----------de-- - - - - Der Proxy-Server erhielt eine fehlerhafte Antwort - eines übergeordneten Servers oder Proxies. - - - - - - - -----------de-- - -Content-language: en -Content-type: text/html -Body:----------en-- - - - - The proxy server received an invalid - response from an upstream server. - - - - - - - -----------en-- - -Content-language: es -Content-type: text/html -Body:----------es-- - - - - El servidor fuente recibio información - inválida por parte del servidor destino. - - - - - - - -----------es-- - -Content-language: fr -Content-type: text/html -Body:----------fr-- - - - - Le serveur proxy a reçu une réponse incorrecte de la part d'un serveur supérieur. - - - - - - - -----------fr-- diff --git a/docs/error/HTTP_BAD_REQUEST.html.var b/docs/error/HTTP_BAD_REQUEST.html.var deleted file mode 100644 index 938db8174d20b6adad3c71e99ea34ce32b8bb669..0000000000000000000000000000000000000000 --- a/docs/error/HTTP_BAD_REQUEST.html.var +++ /dev/null @@ -1,46 +0,0 @@ -Content-language: de -Content-type: text/html -Body:----------de-- - - - - Ihr Browser (oder Proxy) hat eine ungültige Anfrage gesendet, - die vom Server nicht beantwortet werden kann. - - -----------de-- - -Content-language: en -Content-type: text/html -Body:----------en-- - - - - Your browser (or proxy) sent a request that - this server could not understand. - - -----------en-- - -Content-language: es -Content-type: text/html -Body:----------es-- - - - - El buscador ha solicitado una operación - que no puede ser procesada por el servidor. - - -----------es-- - -Content-language: fr -Content-type: text/html -Body:----------fr-- - - - - Votre navigateur (ou votre proxy) a envoyé une demande que ce serveur n'a pas comprise. - - -----------fr-- diff --git a/docs/error/HTTP_FORBIDDEN.html.var b/docs/error/HTTP_FORBIDDEN.html.var deleted file mode 100644 index 9a30ceb9f19c41205ad9e3317714d1935a1e4607..0000000000000000000000000000000000000000 --- a/docs/error/HTTP_FORBIDDEN.html.var +++ /dev/null @@ -1,84 +0,0 @@ -Content-language: de -Content-type: text/html -Body:----------de-- - - - - - - Der Zugriff auf das angeforderte Verzeichnis ist nicht möglich. - Entweder ist kein Index-Dokument vorhanden oder das Verzeichnis - ist zugriffsgeschützt. - - - - Der Zugriff auf das angeforderte Objekt ist nicht möglich. - Entweder kann es vom Server nicht gelesen werden oder es - ist zugriffsgeschützt. - - - - -----------de-- - -Content-language: en -Content-type: text/html -Body:----------en-- - - - - - You don't have permission to access the requested directory. - There is either no index document or the directory is read-protected. - - - - You don't have permission to access the requested object. - It is either read-protected or not readable by the server. - - - - -----------en-- - -Content-language: es -Content-type: text/html -Body:----------es-- - - - - - - Usted no tiene permiso para accesar a la dirección - solicitada. Existe la posibilidad de que el directorio - este protegido contra lectura o que no exista la - documentación requerida. - - - - Usted no tiene permiso de accesar al objeto solicitado. - Existe la posibilidad de que este protegido contra - lectura o que no haya podido ser leido por el servidor. - - - - -----------es-- - -Content-language: fr -Content-type: text/html -Body:----------fr-- - - - -Vous n'avez pas le droit d'accéder au répertoire -demandé. Soit il n'y a pas de document index soit le répertoire -est protégé. - -Vous n'avez pas le droit d'accéder à l'objet -demandé. Soit celui-ci est protégé, soit il ne peut -être lu par le serveur. - - - -----------fr-- diff --git a/docs/error/HTTP_GONE.html.var b/docs/error/HTTP_GONE.html.var deleted file mode 100644 index 22aef7c674e2647b623fbc46794ba8263e432a98..0000000000000000000000000000000000000000 --- a/docs/error/HTTP_GONE.html.var +++ /dev/null @@ -1,100 +0,0 @@ -Content-language: de -Content-type: text/html -Body:----------de-- - - - - Der angeforderte URL existiert auf dem Server nicht mehr - und wurde dauerhaft entfernt. - Eine Weiterleitungsadresse ist nicht verfügbar. - - - - Bitte informieren Sie den Autor der - ">verweisenden Seite - das der Link nicht mehr aktuell ist. - - - - Falls Sie einem Link von einer anderen Seite gefolgt sind, - informieren Sie bitte den Autor der Seite hierüber. - - - - -----------de-- - -Content-language: en -Content-type: text/html -Body:----------en-- - - - - The requested URL is no longer available on this server and there is no - forwarding address. - - - - Please inform the author of the - ">referring - page that the link is outdated. - - - - If you followed a link from a foreign page, please contact the - author of this page. - - - - -----------en-- - -Content-language: es -Content-type: text/html -Body:----------es-- - - - - Los recursos solicitados ya no estan disponibles en - este servidor y no existe una dirección alterna. - - - - Le solicitamos que comunique al autor de la - ">página - referida que el URL esta fuera de tiempo. - - - - Si usted siguio el URL desde una página externa, - porfavor contacte al autor de esa página. - - - - - -----------es-- - -Content-language: fr -Content-type: text/html -Body:----------fr-- - - - - L'URL demandée n'est plus accessible sur ce serveur et il - n'y a pas d'adresse de suite. - - - - Nous vous prions d'informer l'auteur de - ">la - page en question que la référence n'est plus actuelle. - - - - Si vous avez suivi une référence issue d'une page autre, - veuillez contacter l'auteur de cette page. - - - -----------fr-- diff --git a/docs/error/HTTP_INTERNAL_SERVER_ERROR.html.var b/docs/error/HTTP_INTERNAL_SERVER_ERROR.html.var deleted file mode 100644 index 742e235eb7313811511f6c6c69157b14109db7f8..0000000000000000000000000000000000000000 --- a/docs/error/HTTP_INTERNAL_SERVER_ERROR.html.var +++ /dev/null @@ -1,86 +0,0 @@ -Content-language: de -Content-type: text/html -Body:----------de-- - - - - - - Dir Proxy-Anfrage konnte nicht ausgeführt werden. - - - - Fehlermeldung: -
    - - - - - Die Anfrage kann nicht beantwortet werden, da im Server - ein interner Fehler aufgetreten ist. - Der Server ist entweder überlastet oder ein Fehler in - einem CGI-Script ist aufgetreten. - - - - -----------de-- - -Content-language: en -Content-type: text/html -Body:----------en-- - - - - - - - - The server encountered an internal error and was - unable to complete your request. The server is either - overloaded or there was an error in a CGI script. - - - - -----------en-- - -Content-language: es -Content-type: text/html -Body:----------es-- - - - - - - - - El servidor encontro un error interno y fue - imposible completar su solicitud. - Existe tambien la posibilidad de que el servidor - este sobrecargado o de algún error en un - programa de CGI. - - - - -----------es-- - -Content-language: fr -Content-type: text/html -Body:----------fr-- - - - - - - - - Le serveur a èté victime d'une erreur interne et n'a pas été - capable de faire aboutir votre requête. Soit le server est surchargé - soit il s'agit d'une erreur dans le script CGI. - - - - -----------fr-- diff --git a/docs/error/HTTP_LENGTH_REQUIRED.html.var b/docs/error/HTTP_LENGTH_REQUIRED.html.var deleted file mode 100644 index 24d6909c3c4e9877552b6045ef59cf4f02d64aef..0000000000000000000000000000000000000000 --- a/docs/error/HTTP_LENGTH_REQUIRED.html.var +++ /dev/null @@ -1,37 +0,0 @@ -Content-language: de -Content-type: text/html -Body:----------de-- - - - - Die Anfrage kann nicht beantwortet werden. - Bei Verwendung der -Methode - muß ein korrekter Content-Length-Header - angegeben werden. - - -----------de-- - -Content-language: en -Content-type: text/html -Body:----------en-- - - - - A request with the - method requires a valid Content-Length header. - - -----------en-- - -Content-language: fr -Content-type: text/html -Body:----------fr-- - - - - Une requête utilisant la méthode - nécessite un header valable Content-Length (indiquant la longueur). - - -----------fr-- diff --git a/docs/error/HTTP_METHOD_NOT_ALLOWED.html.var b/docs/error/HTTP_METHOD_NOT_ALLOWED.html.var deleted file mode 100644 index 38d2bd8a05cc72c045ba0f5106b2cf049bc60196..0000000000000000000000000000000000000000 --- a/docs/error/HTTP_METHOD_NOT_ALLOWED.html.var +++ /dev/null @@ -1,48 +0,0 @@ -Content-language: de -Content-type: text/html -Body:----------de-- - - - - Die -Methode - ist für den angeforderten URL nicht erlaubt. - - -----------de-- - -Content-language: en -Content-type: text/html -Body:----------en-- - - - - The - method is not allowed for the requested URL. - - -----------en-- - -Content-language: es -Content-type: text/html -Body:----------es-- - - - - El - método utilizado por su solicitud no esta - permitido por el URL. - - -----------es-- - -Content-language: fr -Content-type: text/html -Body:----------fr-- - - - - La méthode - n'est pas utilisable pour l'URL requise. - - -----------fr-- diff --git a/docs/error/HTTP_NOT_ACCEPTABLE.html.var b/docs/error/HTTP_NOT_ACCEPTABLE.html.var deleted file mode 100644 index fe4236fac7fed46eaf9b15c8fc73d73792870e06..0000000000000000000000000000000000000000 --- a/docs/error/HTTP_NOT_ACCEPTABLE.html.var +++ /dev/null @@ -1,49 +0,0 @@ -Content-language: de -Content-type: text/html -Body:----------de-- - - - - Unter dem angeforderten URL konnte kein geeignetes Objekt - auf dem Server gefunden werden, das dem vom Browser - geforderten Format entsprechen würde. - - -----------de-- - -Content-language: en -Content-type: text/html -Body:----------en-- - - - - An appropriate representation of the requested resource - could not be found on this server. - - -----------en-- - -Content-language: es -Content-type: text/html -Body:----------es-- - - - - Una representación apropiada de los recursos - solicitados no ha podido ser localizada en - este servidor. - - -----------es-- - -Content-language: fr -Content-type: text/html -Body:----------fr-- - - - - Une représentation appropriée de la ressource requise - n'a pu être trouvée sur ce serveur. - - -----------fr-- diff --git a/docs/error/HTTP_NOT_FOUND.html.var b/docs/error/HTTP_NOT_FOUND.html.var deleted file mode 100644 index 8a7e8ee5fb836973454cd32f12a33e75078d562b..0000000000000000000000000000000000000000 --- a/docs/error/HTTP_NOT_FOUND.html.var +++ /dev/null @@ -1,113 +0,0 @@ -Content-language: de -Content-type: text/html -Body:----------de-- - - - - Der angeforderte URL konnte auf dem Server nicht gefunden werden. - - - - Der Link auf der - ">verweisenden -Seite< -/a> - scheint falsch oder nicht mehr aktuell zu sein. - Bitte informieren Sie den Autor - ">dieser Seite - über den Fehler. - - - - Sofern Sie den URL manuell eingegeben haben, - überprüfen Sie bitte die Schreibweise und versuchen es erneut. - - - - -----------de-- - -Content-language: en -Content-type: text/html -Body:----------en-- - - - - The requested URL was not found on this server. - - - - The link on the - ">referring -page - seems to be wrong or outdated. Please inform the author of - ">that page - about the error. - - - - If you entered the URL manually please check your - spelling and try again. - - - - -----------en-- - -Content-language: es -Content-type: text/html -Body:----------es-- - - - - El URL requerido no ha sido localizado en - este servidor. - - - - El URL en la - ">página -referida - parece tener algun error o estar fuera de tiempo. Porfavor - comunique al autor de - ">la -página - acerca del error. - - - - Si usted provisiono el URL de manera manual le solicitamos - que porfavor revise los datos e intente de nuevo. - - - - -----------es-- - -Content-language: fr -Content-type: text/html -Body:----------fr-- - - - - L'URL requise n'a pu etre trouvée sur ce serveur. - - - - La référence sur - ">la page -citée - semble être erronée ou perimée. Nous vous prions -d'informer l'auteur de - ">cette page - de cette erreur. - - - - Si vous avez tapé l'URL à la main, veuillez vérifier - l'orthographe et réessayer. - - - - -----------fr-- diff --git a/docs/error/HTTP_NOT_IMPLEMENTED.html.var b/docs/error/HTTP_NOT_IMPLEMENTED.html.var deleted file mode 100644 index ed3468eaf3b99e13ea0a580f626053601c25f01d..0000000000000000000000000000000000000000 --- a/docs/error/HTTP_NOT_IMPLEMENTED.html.var +++ /dev/null @@ -1,45 +0,0 @@ -Content-language: de -Content-type: text/html -Body:----------de-- - - - - Die vom Browser angeforderte Aktion wird vom Server - nicht unterstützt. - - -----------de-- - -Content-language: en -Content-type: text/html -Body:----------en-- - - - - The server does not support the action requested by the browser. - - -----------en-- - -Content-language: es -Content-type: text/html -Body:----------es-- - - - - El buscador esta solicitando una acción - que no puede ser procesada. - - -----------es-- - -Content-language: fr -Content-type: text/html -Body:----------fr-- - - - -Le serveur n'est pas en mesure d'effectuer l'action requise par le navigateur. - - -----------fr-- diff --git a/docs/error/HTTP_PRECONDITION_FAILED.html.var b/docs/error/HTTP_PRECONDITION_FAILED.html.var deleted file mode 100644 index 164bfcef6d82ea4c9c876df3e42114acbb60db29..0000000000000000000000000000000000000000 --- a/docs/error/HTTP_PRECONDITION_FAILED.html.var +++ /dev/null @@ -1,44 +0,0 @@ -Content-language: de -Content-type: text/html -Body:----------de-- - - - - Die Vorbedingung unter dem angeforderten URL wurde - negativ ausgewertet. - - -----------de-- - -Content-language: en -Content-type: text/html -Body:----------en-- - - - - The precondition on the request for the URL failed positive evaluation. - - -----------en-- - -Content-language: es -Content-type: text/html -Body:----------es-- - - - - La precondicion para que exista una - conección al URL solicitado es falsa. - - -----------es-- - -Content-language: fr -Content-type: text/html -Body:----------fr-- - - - -La précondition pour l'URL requise a été évaluée négativement. - -----------fr-- diff --git a/docs/error/HTTP_REQUEST_ENTITY_TOO_LARGE.html.var b/docs/error/HTTP_REQUEST_ENTITY_TOO_LARGE.html.var deleted file mode 100644 index af7ef260e02d5ce19ccbb653ae80ee9e0b85b1ff..0000000000000000000000000000000000000000 --- a/docs/error/HTTP_REQUEST_ENTITY_TOO_LARGE.html.var +++ /dev/null @@ -1,51 +0,0 @@ -Content-language: de -Content-type: text/html -Body:----------de-- - - - - Die bei der Anfrage übermittelnden Daten sind für - die -Methode nicht erlaubt - oder die Datenmenge hat das Maximum überschritten. - - -----------de-- - -Content-language: en -Content-type: text/html -Body:----------en-- - - - - The method does not allow the data - transmitted, or the data volume exceeds the capacity limit. - - -----------en-- - -Content-language: es -Content-type: text/html -Body:----------es-- - - - - Los recursos establecidos no permiten peticiones con - el método - suministrado por su solicitud, o, la cantidad de datos - provistos exceden los límites de capacidad. - - -----------es-- - -Content-language: fr -Content-type: text/html -Body:----------fr-- - - - -La méthode -n'autorise pas le transfert de ces données ou bien le volume -des données excède la limite de capacité. - - -----------fr-- diff --git a/docs/error/HTTP_REQUEST_TIME_OUT.html.var b/docs/error/HTTP_REQUEST_TIME_OUT.html.var deleted file mode 100644 index 6295279a037f45ba7ecbcf873ef31ca192da0657..0000000000000000000000000000000000000000 --- a/docs/error/HTTP_REQUEST_TIME_OUT.html.var +++ /dev/null @@ -1,48 +0,0 @@ -Content-language: de -Content-type: text/html -Body:----------de-- - - - - Der Server konnte nicht mehr länger auf die Beendigung - der Browseranfrage warten, die Netzwerkverbindung wurde - vom Server geschlossen. - - -----------de-- - -Content-language: en -Content-type: text/html -Body:----------en-- - - - - The server closed the network connection because the browser - didn't finish the request within the specified time. - - -----------en-- - -Content-language: es -Content-type: text/html -Body:----------es-- - - - - El servidor ha cerrado la conección de red - debido a que el buscador no termino la solicitud - dentro del tiempo especificado. - - -----------es-- - -Content-language: fr -Content-type: text/html -Body:----------fr-- - - - -La précondition pour l'URL requise a été évaluée négativement. - - -----------fr-- diff --git a/docs/error/HTTP_REQUEST_URI_TOO_LARGE.html.var b/docs/error/HTTP_REQUEST_URI_TOO_LARGE.html.var deleted file mode 100644 index f34de5558c97aae99f17f05b15159759750b8c3c..0000000000000000000000000000000000000000 --- a/docs/error/HTTP_REQUEST_URI_TOO_LARGE.html.var +++ /dev/null @@ -1,48 +0,0 @@ -Content-language: de -Content-type: text/html -Body:----------de-- - - - - Der bei der Anfrage übermittelnde URI überschreitet - die maximale Länge. - Die Anfrage kann nicht ausgeführt werden. - - -----------de-- - -Content-language: en -Content-type: text/html -Body:----------en-- - - - - The length of the requested URL exceeds the capacity limit for this server. - The request cannot be processed. - - -----------en-- - -Content-language: es -Content-type: text/html -Body:----------es-- - - - - Su solicitud no puede procesarse debido a que la - longitud del URL excede la capacidad limite del - servidor. - - -----------es-- - -Content-language: fr -Content-type: text/html -Body:----------fr-- - - - -La longueur de l'URL demandée excède la limite de capacitè pour ce serveur. Nous ne pouvons donner suite à votre requête. - - -----------fr-- diff --git a/docs/error/HTTP_SERVICE_UNAVAILABLE.html.var b/docs/error/HTTP_SERVICE_UNAVAILABLE.html.var deleted file mode 100644 index d29f16fac8f5a858cdc5ac898fce525838788c1d..0000000000000000000000000000000000000000 --- a/docs/error/HTTP_SERVICE_UNAVAILABLE.html.var +++ /dev/null @@ -1,56 +0,0 @@ -Content-language: de -Content-type: text/html -Body:----------de-- - - - - Der Server ist derzeit nicht in der Lage die Anfrage - zu bearbeiten. Entweder ist der Server derzeit überlastet - oder wegen Wartungsarbeiten nicht verfügbar. - Bitte versuchen Sie es später wieder. - - -----------de-- - -Content-language: en -Content-type: text/html -Body:----------en-- - - - - The server is temporarily unable to service your - request due to maintenance downtime or capacity - problems. Please try again later. - - -----------en-- - -Content-language: es -Content-type: text/html -Body:----------es-- - - - - El servidor no puede atender su solicitud por - el momento debido a problemas de mantenimiento - o de capacidad. - - Le solicitamos que porfavor repita la operación - mas tarde. - - - -----------es-- - -Content-language: fr -Content-type: text/html -Body:----------fr-- - - - - En raison de travaux de maintenance ou de problèmes de capacité - le serveur n'est pas en mesure de répondre à votre requête pour l'instant. - Veuillez réessayer plus tard. - - -----------fr-- diff --git a/docs/error/HTTP_UNAUTHORIZED.html.var b/docs/error/HTTP_UNAUTHORIZED.html.var deleted file mode 100644 index 4152b66146bac10b8ca7f92b486284e9a85c2b95..0000000000000000000000000000000000000000 --- a/docs/error/HTTP_UNAUTHORIZED.html.var +++ /dev/null @@ -1,84 +0,0 @@ -Content-language: de -Content-type: text/html -Body:----------de-- - - - - Der Server konnte nicht verifizieren, ob Sie authorisiert sind, - auf den URL "" zuzugreifen. - Entweder wurden falsche Referenzen (z.B. ein falsches Passwort) - angeben oder ihr Browser versteht nicht, wie die geforderten - Referenzen zu übermitteln sind. - - - - Sofern Sie für den Zugriff berechtigt sind, überprüfen Sie bitte - die eingegebene User-ID und das Passwort und versuchen es erneut. - - -----------de-- - -Content-language: en -Content-type: text/html -Body:----------en-- - - - - This server could not verify that you are authorized to access - the URL "". - You either supplied the wrong credentials (e.g., bad password), or your - browser doesn't understand how to supply the credentials required. - - - - In case you are allowed to request the document, please - check your user-id and password and try again. - - -----------en-- - -Content-language: es -Content-type: text/html -Body:----------es-- - - - - El servidor no puede certificar que usted este autorizado - para accesar el URL "". - Usted pudo suministrar información incorrecta accidentalmente - (ejem. una contraseña inválida) o, el buscador no sabe - como suministrar la información requerida. - - - - En caso de que a usted le este permitido el uso del - documento requerido, le solicitamos de la manera mas atenta - que porfavor vuelva a intentar la operación suministrando - nuevamente su numero de identificación y su contraseña. - - Muchas Gracias. - -----------es-- - -Content-language: fr -Content-type: text/html -Body:----------fr-- - - - - Ce server n'a pas été en mesure de vérifier que - vous êtes autorisé à accéder à cette - URL "". - - Vous avez ou bien fourni des coordonnées erronées - (p.ex. mot de passe inexact) ou bien votre navigateur ne parvient - pas à fournir les données exactes. - - - - Si vous êtez autorisé à requérir le document, - veuillez vérifier votre nom d'utilisateur et votre mot de passe - et réessayer. - - -----------fr-- diff --git a/docs/error/HTTP_UNSUPPORTED_MEDIA_TYPE.html.var b/docs/error/HTTP_UNSUPPORTED_MEDIA_TYPE.html.var deleted file mode 100644 index 78c48bd2c420a927b80f365f0b481acecdc3d493..0000000000000000000000000000000000000000 --- a/docs/error/HTTP_UNSUPPORTED_MEDIA_TYPE.html.var +++ /dev/null @@ -1,45 +0,0 @@ -Content-language: de -Content-type: text/html -Body:----------de-- - - - - Das bei der Anfrage übermittelte Format (media type) - wird vom Server nicht unterstützt. - - -----------de-- - -Content-language: en -Content-type: text/html -Body:----------en-- - - - - The server does not support the media type transmitted in the request. - - -----------en-- - -Content-language: es -Content-type: text/html -Body:----------es-- - - - - Los datos de su solicitud no se encuentran en - un formato aceptado por este recurso. - - -----------es-- - -Content-language: fr -Content-type: text/html -Body:----------fr-- - - - -Le serveur ne supporte pas le type de média utilisé dans votre requête. - - -----------fr-- diff --git a/docs/error/HTTP_VARIANT_ALSO_VARIES.html.var b/docs/error/HTTP_VARIANT_ALSO_VARIES.html.var deleted file mode 100644 index b558284f4775759f5d2ccf3c17654b306b8ddd94..0000000000000000000000000000000000000000 --- a/docs/error/HTTP_VARIANT_ALSO_VARIES.html.var +++ /dev/null @@ -1,51 +0,0 @@ -Content-language: de -Content-type: text/html -Body:----------de-- - - - - Ein Zugriff auf das angeforderte Objekt bzw. einer - Variante dieses Objektes ist nicht möglich, da es ebenfalls - ein variables Objekt darstellt. - - -----------de-- - -Content-language: en -Content-type: text/html -Body:----------en-- - - - - A variant for the requested entity - is itself a negotiable resource. - Access not possible. - - -----------en-- - -Content-language: es -Content-type: text/html -Body:----------es-- - - - - No es posible tener acceso debido a que - una variante de la solicitud es por si - misma un recurso negociable. - - -----------es-- - -Content-language: fr -Content-type: text/html -Body:----------fr-- - - - - Une variante pour l'entité requise - est elle-même une ressource négociable. - L'accès est impossible. - - -----------fr-- diff --git a/docs/error/README b/docs/error/README deleted file mode 100644 index 6856b7c7eec9d348d206df04e4bb78a90839f0a9..0000000000000000000000000000000000000000 --- a/docs/error/README +++ /dev/null @@ -1,27 +0,0 @@ - - Multi Language Custom Error Documents - ------------------------------------- - - The 'error' directory in the document root directory contains HTTP error - messages in multiple languages. If the preferred language of client is - available it is selected automatically via the MultiViews feature. - You may configure the design and markup of the documents by modifying - the HTML files in the directory '/error/includes', especially the - file 'config.html'. - - - Supported Languages: - - +------------------+------------------------------------------+ - | Language | Contributed by | - +------------------+------------------------------------------+ - | English (en) | Lars Eilebrecht | - | German (de) | Lars Eilebrecht | - | Spanish (es) | Karla Quintero | - | French (fr) | Cecile de Crecy | - +------------------+------------------------------------------+ - (Please see http://httpd.apache.org/docs-project/ if you would - like to contribute the pages in an additional language.) - - - Copyright (c) 2001 The Apache Software Foundation. All rights reserved. diff --git a/docs/error/contact.html.var b/docs/error/contact.html.var deleted file mode 100644 index f39136b637395abf1b7a7c747e5d854c416935f1..0000000000000000000000000000000000000000 --- a/docs/error/contact.html.var +++ /dev/null @@ -1,30 +0,0 @@ -Content-language: de -Content-type: text/html -Body:----------de-- - Sofern Sie dies für eine Fehlfunktion des Servers halten, - informieren Sie bitte den - ">Webmaster - hierüber. -----------de-- - -Content-language: en -Content-type: text/html -Body:----------en-- - In case you think this is a server error, please contact - the ">Webmaster -----------en-- - -Content-language: es -Content-type: text/html -Body:----------es-- -Favor de contactar al -">Webmaster -en caso de que usted crea que existe un error en el servidor. -----------es-- - -Content-language: fr -Content-type: text/html -Body:----------fr-- -Si vous pensez qu'il s'agit d'une erreur du serveur, veuillez contacter -le ">gestionnaire du site -----------fr-- diff --git a/docs/error/include/bottom.html b/docs/error/include/bottom.html deleted file mode 100644 index a3b23698d37d4736685c31d803cf1229a4d5a2b8..0000000000000000000000000000000000000000 --- a/docs/error/include/bottom.html +++ /dev/null @@ -1,12 +0,0 @@ - - - - -
    rightleft> - - - -
    -Error -
    - diff --git a/docs/error/include/spacer.html b/docs/error/include/spacer.html deleted file mode 100644 index 70c5b25f4a84bfd15867787e07ff2ca323baf551..0000000000000000000000000000000000000000 --- a/docs/error/include/spacer.html +++ /dev/null @@ -1 +0,0 @@ -
    diff --git a/docs/error/include/top.html b/docs/error/include/top.html deleted file mode 100644 index 3e24e486155bbd13ffd576afc85a0e320c8e4962..0000000000000000000000000000000000000000 --- a/docs/error/include/top.html +++ /dev/null @@ -1,12 +0,0 @@ - - -
    - -
    - -
    - - SRC="/error/images/logo.gif" ALT=""> - -
    -
    diff --git a/docs/icons/README b/docs/icons/README deleted file mode 100644 index 74b2970b9e810609bc35bcec0bbecf1fb5ba9e81..0000000000000000000000000000000000000000 --- a/docs/icons/README +++ /dev/null @@ -1,158 +0,0 @@ -Public Domain Icons - - These icons were originally made for Mosaic for X and have been - included in the NCSA httpd and Apache server distributions in the - past. They are in the public domain and may be freely included in any - application. The originals were done by Kevin Hughes - (kevinh@kevcom.com). - - Many thanks to Andy Polyakov for tuning the icon colors and adding a - few new images. If you'd like to contribute additions or ideas to - this set, please let me know. - - Almost all of these icons are 20x22 pixels in size. There are - alternative icons in the "small" directory that are 16x16 in size, - provided by Mike Brown (mike@hyperreal.org). - -Suggested Uses - -The following are a few suggestions, to serve as a starting point for ideas. -Please feel free to tweak and rename the icons as you like. - - a.gif - This might be used to represent PostScript or text layout - languages. - - alert.black.gif, alert.red.gif - These can be used to highlight any important items, such as a - README file in a directory. - - back.gif, forward.gif - These can be used as links to go to previous and next areas. - - ball.gray.gif, ball.red.gif - These might be used as bullets. - - binary.gif - This can be used to represent binary files. - - binhex.gif - This can represent BinHex-encoded data. - - blank.gif - This can be used as a placeholder or a spacing element. - - bomb.gif - This can be used to repreesnt core files. - - box1.gif, box2.gif - These icons can be used to represent generic 3D applications and - related files. - - broken.gif - This can represent corrupted data. - - burst.gif - This can call attention to new and important items. - - c.gif - This might represent C source code. - - comp.blue.gif, comp.red.gif - These little computer icons can stand for telnet or FTP - sessions. - - compressed.gif - This may represent compressed data. - - continued.gif - This can be a link to a continued listing of a directory. - - down.gif, up.gif, left.gif, right.gif - These can be used to scroll up, down, left and right in a - listing or may be used to denote items in an outline. - - dvi.gif - This can represent DVI files. - - f.gif - This might represent FORTRAN or Forth source code. - - folder.gif, folder.open.gif, folder.sec.gif - The folder can represent directories. There is also a version - that can represent secure directories or directories that cannot - be viewed. - - generic.gif, generic.sec.gif, generic.red.gif - These can represent generic files, secure files, and important - files, respectively. - - hand.right.gif, hand.up.gif - These can point out important items (pun intended). - - image1.gif, image2.gif, image3.gif - These can represent image formats of various types. - - index.gif - This might represent a WAIS index or search facility. - - layout.gif - This might represent files and formats that contain graphics as - well as text layout, such as HTML and PDF files. - - link.gif - This might represent files that are symbolic links. - - movie.gif - This can represent various movie formats. - - p.gif - This may stand for Perl or Python source code. - - pie0.gif ... pie8.gif - These icons can be used in applications where a list of - documents is returned from a search. The little pie chart images - can denote how relevant the documents may be to your search - query. - - patch.gif - This may stand for patches and diff files. - - portal.gif - This might be a link to an online service or a 3D world. - - ps.gif, quill.gif - These may represent PostScript files. - - screw1.gif, screw2.gif - These may represent CAD or engineering data and formats. - - script.gif - This can represent any of various interpreted languages, such as - Perl, python, TCL, and shell scripts, as well as server - configuration files. - - sound1.gif, sound2.gif - These can represent sound files. - - sphere1.gif, sphere2.gif - These can represent 3D worlds or rendering applications and - formats. - - tex.gif - This can represent TeX files. - - text.gif - This can represent generic (plain) text files. - - transfer.gif - This can represent FTP transfers or uploads/downloads. - - unknown.gif - This may represent a file of an unknown type. - - uuencoded.gif - This can stand for uuencoded data. - - world1.gif, world2.gif - These can represent 3D worlds or other 3D formats. diff --git a/docs/icons/a.gif b/docs/icons/a.gif deleted file mode 100644 index bb23d971f4ce99b43dcadc7179deab4e3f55d2fd..0000000000000000000000000000000000000000 Binary files a/docs/icons/a.gif and /dev/null differ diff --git a/docs/icons/a.png b/docs/icons/a.png deleted file mode 100644 index c1840256dcf85ae97807b18bb7d6cc05eb0f95ed..0000000000000000000000000000000000000000 Binary files a/docs/icons/a.png and /dev/null differ diff --git a/docs/icons/alert.black.gif b/docs/icons/alert.black.gif deleted file mode 100644 index eaecd2172a091ee2994c73f33e784e336b23b58b..0000000000000000000000000000000000000000 Binary files a/docs/icons/alert.black.gif and /dev/null differ diff --git a/docs/icons/alert.black.png b/docs/icons/alert.black.png deleted file mode 100644 index af6b1246ad7d62287a5fab89f964a26af30f7177..0000000000000000000000000000000000000000 Binary files a/docs/icons/alert.black.png and /dev/null differ diff --git a/docs/icons/alert.red.gif b/docs/icons/alert.red.gif deleted file mode 100644 index a4238940433deedd024eb0cada54be82e8f47db0..0000000000000000000000000000000000000000 Binary files a/docs/icons/alert.red.gif and /dev/null differ diff --git a/docs/icons/alert.red.png b/docs/icons/alert.red.png deleted file mode 100644 index b9222fd52468a84ee30e82c7f45ee5d11c1b5c74..0000000000000000000000000000000000000000 Binary files a/docs/icons/alert.red.png and /dev/null differ diff --git a/docs/icons/apache_pb.gif b/docs/icons/apache_pb.gif deleted file mode 100644 index 3a1c139fc4247ec7e770fdaab961fb3692c953fb..0000000000000000000000000000000000000000 Binary files a/docs/icons/apache_pb.gif and /dev/null differ diff --git a/docs/icons/apache_pb.png b/docs/icons/apache_pb.png deleted file mode 100644 index eb99a8cd39346fe848d1bbbaccd90afae2183450..0000000000000000000000000000000000000000 Binary files a/docs/icons/apache_pb.png and /dev/null differ diff --git a/docs/icons/apache_pb2.gif b/docs/icons/apache_pb2.gif deleted file mode 100644 index 4e67c7113c54d6569e4e69339df851b9da1796ce..0000000000000000000000000000000000000000 Binary files a/docs/icons/apache_pb2.gif and /dev/null differ diff --git a/docs/icons/apache_pb2.png b/docs/icons/apache_pb2.png deleted file mode 100644 index 28baa70fb8ce678b9e4a5eecb6697d43315f413a..0000000000000000000000000000000000000000 Binary files a/docs/icons/apache_pb2.png and /dev/null differ diff --git a/docs/icons/apache_pb2_ani.gif b/docs/icons/apache_pb2_ani.gif deleted file mode 100644 index fc41c03610c1f56d4e2ce3c9750cbe27e5d96886..0000000000000000000000000000000000000000 Binary files a/docs/icons/apache_pb2_ani.gif and /dev/null differ diff --git a/docs/icons/back.gif b/docs/icons/back.gif deleted file mode 100644 index a694ae1ec3f0636cddbf195dd151abff150af69f..0000000000000000000000000000000000000000 Binary files a/docs/icons/back.gif and /dev/null differ diff --git a/docs/icons/back.png b/docs/icons/back.png deleted file mode 100644 index 2d8d353bbc7d6adb82b273b25d3dae725c7112a9..0000000000000000000000000000000000000000 Binary files a/docs/icons/back.png and /dev/null differ diff --git a/docs/icons/ball.gray.gif b/docs/icons/ball.gray.gif deleted file mode 100644 index eb84268c4ccf0146e661f51e63fc7d958d39111f..0000000000000000000000000000000000000000 Binary files a/docs/icons/ball.gray.gif and /dev/null differ diff --git a/docs/icons/ball.gray.png b/docs/icons/ball.gray.png deleted file mode 100644 index 7b756f2d82dee472e1faafe53abc04ca1cccb9ca..0000000000000000000000000000000000000000 Binary files a/docs/icons/ball.gray.png and /dev/null differ diff --git a/docs/icons/ball.red.gif b/docs/icons/ball.red.gif deleted file mode 100644 index a8425cb574b1e4250b8cd35656432245cf4b51c8..0000000000000000000000000000000000000000 Binary files a/docs/icons/ball.red.gif and /dev/null differ diff --git a/docs/icons/ball.red.png b/docs/icons/ball.red.png deleted file mode 100644 index 05f3e50629c6d930c77e762fce2fe2c6e0ba0e25..0000000000000000000000000000000000000000 Binary files a/docs/icons/ball.red.png and /dev/null differ diff --git a/docs/icons/binary.gif b/docs/icons/binary.gif deleted file mode 100644 index 9a15cbae04ccda7ee515f0e56360afc5a0dba7a5..0000000000000000000000000000000000000000 Binary files a/docs/icons/binary.gif and /dev/null differ diff --git a/docs/icons/binary.png b/docs/icons/binary.png deleted file mode 100644 index c5119d1e1ea26c01d09aa3cf2fa936989a543056..0000000000000000000000000000000000000000 Binary files a/docs/icons/binary.png and /dev/null differ diff --git a/docs/icons/binhex.gif b/docs/icons/binhex.gif deleted file mode 100644 index 62d0363108d2585b7574f1eafa0749ae48e15f5b..0000000000000000000000000000000000000000 Binary files a/docs/icons/binhex.gif and /dev/null differ diff --git a/docs/icons/binhex.png b/docs/icons/binhex.png deleted file mode 100644 index eff532202d39384c325bb87f35478a993322ca7b..0000000000000000000000000000000000000000 Binary files a/docs/icons/binhex.png and /dev/null differ diff --git a/docs/icons/blank.gif b/docs/icons/blank.gif deleted file mode 100644 index 0ccf01e1983e40365a9ab9f373b6fc497c8603cd..0000000000000000000000000000000000000000 Binary files a/docs/icons/blank.gif and /dev/null differ diff --git a/docs/icons/blank.png b/docs/icons/blank.png deleted file mode 100644 index 3802c03c9c8351d0983ca8750eba2cb1c17a4420..0000000000000000000000000000000000000000 Binary files a/docs/icons/blank.png and /dev/null differ diff --git a/docs/icons/bomb.gif b/docs/icons/bomb.gif deleted file mode 100644 index 270fdb1c064a678acb8764f49dfab1e4930a437c..0000000000000000000000000000000000000000 Binary files a/docs/icons/bomb.gif and /dev/null differ diff --git a/docs/icons/bomb.png b/docs/icons/bomb.png deleted file mode 100644 index 5261a0575e3c37acffd2a3c5ae038c1215373b1c..0000000000000000000000000000000000000000 Binary files a/docs/icons/bomb.png and /dev/null differ diff --git a/docs/icons/box1.gif b/docs/icons/box1.gif deleted file mode 100644 index 65dcd002eafc0513dd4e7f6d54ca1d82345aa4be..0000000000000000000000000000000000000000 Binary files a/docs/icons/box1.gif and /dev/null differ diff --git a/docs/icons/box1.png b/docs/icons/box1.png deleted file mode 100644 index c55fccf8dc8d7c367f7d3622960ee74361306650..0000000000000000000000000000000000000000 Binary files a/docs/icons/box1.png and /dev/null differ diff --git a/docs/icons/box2.gif b/docs/icons/box2.gif deleted file mode 100644 index c43bc4faecfbfc27d83c6ba936a39ae65c42a251..0000000000000000000000000000000000000000 Binary files a/docs/icons/box2.gif and /dev/null differ diff --git a/docs/icons/box2.png b/docs/icons/box2.png deleted file mode 100644 index 26d14325d970a9e93f5e08cdf7e7422dc3cf1055..0000000000000000000000000000000000000000 Binary files a/docs/icons/box2.png and /dev/null differ diff --git a/docs/icons/broken.gif b/docs/icons/broken.gif deleted file mode 100644 index 9f8cbe9f7604077bbd3a2bc8bc3a5bb5f569b838..0000000000000000000000000000000000000000 Binary files a/docs/icons/broken.gif and /dev/null differ diff --git a/docs/icons/broken.png b/docs/icons/broken.png deleted file mode 100644 index e8fd150a339f8928e416ae7f2f631440060cd7fe..0000000000000000000000000000000000000000 Binary files a/docs/icons/broken.png and /dev/null differ diff --git a/docs/icons/burst.gif b/docs/icons/burst.gif deleted file mode 100644 index fbdcf575f78a5ebbd3eeac5bbd9f963962ab664f..0000000000000000000000000000000000000000 Binary files a/docs/icons/burst.gif and /dev/null differ diff --git a/docs/icons/burst.png b/docs/icons/burst.png deleted file mode 100644 index 2329898f2a4b89a0297f36374a18f81e2232d0b7..0000000000000000000000000000000000000000 Binary files a/docs/icons/burst.png and /dev/null differ diff --git a/docs/icons/c.gif b/docs/icons/c.gif deleted file mode 100644 index 7555b6c164fc1b4fd61b082d8077fa9d91df56f2..0000000000000000000000000000000000000000 Binary files a/docs/icons/c.gif and /dev/null differ diff --git a/docs/icons/c.png b/docs/icons/c.png deleted file mode 100644 index 41593b36b36dd8f23c15b81779af794ce72e0e2c..0000000000000000000000000000000000000000 Binary files a/docs/icons/c.png and /dev/null differ diff --git a/docs/icons/comp.blue.gif b/docs/icons/comp.blue.gif deleted file mode 100644 index f8d76a8c23f018497587e3f99b1ca6de51b3f31c..0000000000000000000000000000000000000000 Binary files a/docs/icons/comp.blue.gif and /dev/null differ diff --git a/docs/icons/comp.blue.png b/docs/icons/comp.blue.png deleted file mode 100644 index 60ff156deb9e9379f5dd717fa5cb41a3136e096b..0000000000000000000000000000000000000000 Binary files a/docs/icons/comp.blue.png and /dev/null differ diff --git a/docs/icons/comp.gray.gif b/docs/icons/comp.gray.gif deleted file mode 100644 index 7664cd03649021707e088ea934495978fb0d2656..0000000000000000000000000000000000000000 Binary files a/docs/icons/comp.gray.gif and /dev/null differ diff --git a/docs/icons/comp.gray.png b/docs/icons/comp.gray.png deleted file mode 100644 index 01538f8f3162eee18d9a4d5487b22b3395daccfe..0000000000000000000000000000000000000000 Binary files a/docs/icons/comp.gray.png and /dev/null differ diff --git a/docs/icons/compressed.gif b/docs/icons/compressed.gif deleted file mode 100644 index 39e732739f562920d69e21b9d5f766103225471e..0000000000000000000000000000000000000000 Binary files a/docs/icons/compressed.gif and /dev/null differ diff --git a/docs/icons/compressed.png b/docs/icons/compressed.png deleted file mode 100644 index de7276dbc08d599e67cbac9e87ac4c6c3b3e0c8a..0000000000000000000000000000000000000000 Binary files a/docs/icons/compressed.png and /dev/null differ diff --git a/docs/icons/continued.gif b/docs/icons/continued.gif deleted file mode 100644 index b0ffb7e0cc026c1e0c383a17044f5aabcf4b5d91..0000000000000000000000000000000000000000 Binary files a/docs/icons/continued.gif and /dev/null differ diff --git a/docs/icons/continued.png b/docs/icons/continued.png deleted file mode 100644 index 8f656e27f244a2a0ce8a34bf4244ae481a4e7232..0000000000000000000000000000000000000000 Binary files a/docs/icons/continued.png and /dev/null differ diff --git a/docs/icons/dir.gif b/docs/icons/dir.gif deleted file mode 100644 index 48264601ae0655bbb5b5539e54ab9c4c52c0ca96..0000000000000000000000000000000000000000 Binary files a/docs/icons/dir.gif and /dev/null differ diff --git a/docs/icons/dir.png b/docs/icons/dir.png deleted file mode 100644 index 6b97905067e6b9b10af40be23f8e9aca47cbd456..0000000000000000000000000000000000000000 Binary files a/docs/icons/dir.png and /dev/null differ diff --git a/docs/icons/down.gif b/docs/icons/down.gif deleted file mode 100644 index a354c871cd0b1871aea54b437a9fcd88608b6945..0000000000000000000000000000000000000000 Binary files a/docs/icons/down.gif and /dev/null differ diff --git a/docs/icons/down.png b/docs/icons/down.png deleted file mode 100644 index be3904b0451ef63dc020239da150d32199ae1f54..0000000000000000000000000000000000000000 Binary files a/docs/icons/down.png and /dev/null differ diff --git a/docs/icons/dvi.gif b/docs/icons/dvi.gif deleted file mode 100644 index 791be33105d03f674f9b9949c25ddd54591fa08d..0000000000000000000000000000000000000000 Binary files a/docs/icons/dvi.gif and /dev/null differ diff --git a/docs/icons/dvi.png b/docs/icons/dvi.png deleted file mode 100644 index 19c417f227b9e86f0a483ac268a148ed3cd59c3c..0000000000000000000000000000000000000000 Binary files a/docs/icons/dvi.png and /dev/null differ diff --git a/docs/icons/f.gif b/docs/icons/f.gif deleted file mode 100644 index fbe353c28223f727deb5144a964b67aa52081e42..0000000000000000000000000000000000000000 Binary files a/docs/icons/f.gif and /dev/null differ diff --git a/docs/icons/f.png b/docs/icons/f.png deleted file mode 100644 index c946f5b3165874522c62a888a08e931a2ccfc198..0000000000000000000000000000000000000000 Binary files a/docs/icons/f.png and /dev/null differ diff --git a/docs/icons/folder.gif b/docs/icons/folder.gif deleted file mode 100644 index 48264601ae0655bbb5b5539e54ab9c4c52c0ca96..0000000000000000000000000000000000000000 Binary files a/docs/icons/folder.gif and /dev/null differ diff --git a/docs/icons/folder.open.gif b/docs/icons/folder.open.gif deleted file mode 100644 index 30979cb52855157110d56344ce09ff29ad726585..0000000000000000000000000000000000000000 Binary files a/docs/icons/folder.open.gif and /dev/null differ diff --git a/docs/icons/folder.open.png b/docs/icons/folder.open.png deleted file mode 100644 index dd2d7e0cc2d0a2965652a2caa3be74d71e4a6d64..0000000000000000000000000000000000000000 Binary files a/docs/icons/folder.open.png and /dev/null differ diff --git a/docs/icons/folder.png b/docs/icons/folder.png deleted file mode 100644 index 6b97905067e6b9b10af40be23f8e9aca47cbd456..0000000000000000000000000000000000000000 Binary files a/docs/icons/folder.png and /dev/null differ diff --git a/docs/icons/folder.sec.gif b/docs/icons/folder.sec.gif deleted file mode 100644 index 75332d9e59bf1b7d40d5a82279bfeea18611db90..0000000000000000000000000000000000000000 Binary files a/docs/icons/folder.sec.gif and /dev/null differ diff --git a/docs/icons/folder.sec.png b/docs/icons/folder.sec.png deleted file mode 100644 index 833f59ac51787c972c5cffe1a5297cd5165849ff..0000000000000000000000000000000000000000 Binary files a/docs/icons/folder.sec.png and /dev/null differ diff --git a/docs/icons/forward.gif b/docs/icons/forward.gif deleted file mode 100644 index b2959b4c85c612f74f3ed207b3c8e09ce906fd70..0000000000000000000000000000000000000000 Binary files a/docs/icons/forward.gif and /dev/null differ diff --git a/docs/icons/forward.png b/docs/icons/forward.png deleted file mode 100644 index c5584a4c306f209d7af960872bb9e5c11d6b7523..0000000000000000000000000000000000000000 Binary files a/docs/icons/forward.png and /dev/null differ diff --git a/docs/icons/generic.gif b/docs/icons/generic.gif deleted file mode 100644 index de60b2940f90cc3bef3e16e2d20b39aa00807327..0000000000000000000000000000000000000000 Binary files a/docs/icons/generic.gif and /dev/null differ diff --git a/docs/icons/generic.png b/docs/icons/generic.png deleted file mode 100644 index 0227cabb5ce99df7839ccd94bea389260541bee4..0000000000000000000000000000000000000000 Binary files a/docs/icons/generic.png and /dev/null differ diff --git a/docs/icons/generic.red.gif b/docs/icons/generic.red.gif deleted file mode 100644 index 94743981d931466fd6403a80dc4d1425b744822e..0000000000000000000000000000000000000000 Binary files a/docs/icons/generic.red.gif and /dev/null differ diff --git a/docs/icons/generic.red.png b/docs/icons/generic.red.png deleted file mode 100644 index be63249beb5be105a84eb123ff3e15b6f46bbe61..0000000000000000000000000000000000000000 Binary files a/docs/icons/generic.red.png and /dev/null differ diff --git a/docs/icons/generic.sec.gif b/docs/icons/generic.sec.gif deleted file mode 100644 index 88d5240c3c3ee7aba7e51be6e49516277cd2c024..0000000000000000000000000000000000000000 Binary files a/docs/icons/generic.sec.gif and /dev/null differ diff --git a/docs/icons/generic.sec.png b/docs/icons/generic.sec.png deleted file mode 100644 index 0bd3d96bdcd6c1f71503491294c48905ba27f41f..0000000000000000000000000000000000000000 Binary files a/docs/icons/generic.sec.png and /dev/null differ diff --git a/docs/icons/hand.right.gif b/docs/icons/hand.right.gif deleted file mode 100644 index 5cdbc7206da8856227e36b9d8f1fe5668e162607..0000000000000000000000000000000000000000 Binary files a/docs/icons/hand.right.gif and /dev/null differ diff --git a/docs/icons/hand.right.png b/docs/icons/hand.right.png deleted file mode 100644 index 93035c658ab61cbfc29e9afbd281a0266436f916..0000000000000000000000000000000000000000 Binary files a/docs/icons/hand.right.png and /dev/null differ diff --git a/docs/icons/hand.up.gif b/docs/icons/hand.up.gif deleted file mode 100644 index 85a5d683177b439d3bd52a5fbe4f4b88e6b36a51..0000000000000000000000000000000000000000 Binary files a/docs/icons/hand.up.gif and /dev/null differ diff --git a/docs/icons/hand.up.png b/docs/icons/hand.up.png deleted file mode 100644 index 1405a6f156249d7dfe8298e9cf83c209c9e302d5..0000000000000000000000000000000000000000 Binary files a/docs/icons/hand.up.png and /dev/null differ diff --git a/docs/icons/icon.sheet.gif b/docs/icons/icon.sheet.gif deleted file mode 100644 index ad1686e44808e4eea393f203c7d91538612eefe1..0000000000000000000000000000000000000000 Binary files a/docs/icons/icon.sheet.gif and /dev/null differ diff --git a/docs/icons/icon.sheet.png b/docs/icons/icon.sheet.png deleted file mode 100644 index b875cb6b1c15e5a9cce993b50a1f47ce08852f45..0000000000000000000000000000000000000000 Binary files a/docs/icons/icon.sheet.png and /dev/null differ diff --git a/docs/icons/image1.gif b/docs/icons/image1.gif deleted file mode 100644 index 01e442bfa92332ec1c6f6a3a1310a41da8be5cb4..0000000000000000000000000000000000000000 Binary files a/docs/icons/image1.gif and /dev/null differ diff --git a/docs/icons/image1.png b/docs/icons/image1.png deleted file mode 100644 index c1374fde333a1ea462d2edb9fac7c8eecaf9711a..0000000000000000000000000000000000000000 Binary files a/docs/icons/image1.png and /dev/null differ diff --git a/docs/icons/image2.gif b/docs/icons/image2.gif deleted file mode 100644 index 751faeea3644ec77fc2758b18522443c86e11e88..0000000000000000000000000000000000000000 Binary files a/docs/icons/image2.gif and /dev/null differ diff --git a/docs/icons/image2.png b/docs/icons/image2.png deleted file mode 100644 index 606d4fb87e58bdb5db8af12d5cafa4827c431540..0000000000000000000000000000000000000000 Binary files a/docs/icons/image2.png and /dev/null differ diff --git a/docs/icons/image3.gif b/docs/icons/image3.gif deleted file mode 100644 index 4f30484ff64db93ee44ed0a9ad7ee2ddee74b3ff..0000000000000000000000000000000000000000 Binary files a/docs/icons/image3.gif and /dev/null differ diff --git a/docs/icons/image3.png b/docs/icons/image3.png deleted file mode 100644 index 701fb1e1359e4fbd3f0d4c1428c1e9f809a5447d..0000000000000000000000000000000000000000 Binary files a/docs/icons/image3.png and /dev/null differ diff --git a/docs/icons/index.gif b/docs/icons/index.gif deleted file mode 100644 index 162478fb3a7f690884b1527488a27a9d34ab497b..0000000000000000000000000000000000000000 Binary files a/docs/icons/index.gif and /dev/null differ diff --git a/docs/icons/index.png b/docs/icons/index.png deleted file mode 100644 index 9a0de3505826f3588d694fb0481b222812df4edb..0000000000000000000000000000000000000000 Binary files a/docs/icons/index.png and /dev/null differ diff --git a/docs/icons/layout.gif b/docs/icons/layout.gif deleted file mode 100644 index c96338a15228f70b4fa5753ff93db7d70f1123cc..0000000000000000000000000000000000000000 Binary files a/docs/icons/layout.gif and /dev/null differ diff --git a/docs/icons/layout.png b/docs/icons/layout.png deleted file mode 100644 index 0a97c1c475f364f66ad30ec78a081a22e60f5109..0000000000000000000000000000000000000000 Binary files a/docs/icons/layout.png and /dev/null differ diff --git a/docs/icons/left.gif b/docs/icons/left.gif deleted file mode 100644 index 279e6710d4961d7644ea2e3e39e6afd300147aa8..0000000000000000000000000000000000000000 Binary files a/docs/icons/left.gif and /dev/null differ diff --git a/docs/icons/left.png b/docs/icons/left.png deleted file mode 100644 index d6e2404a811ad62eb3c5f705ba265e273661d7d5..0000000000000000000000000000000000000000 Binary files a/docs/icons/left.png and /dev/null differ diff --git a/docs/icons/link.gif b/docs/icons/link.gif deleted file mode 100644 index c5b6889a76d72a1f052d2885a725e7065344ee9b..0000000000000000000000000000000000000000 Binary files a/docs/icons/link.gif and /dev/null differ diff --git a/docs/icons/link.png b/docs/icons/link.png deleted file mode 100644 index 4714d0ef40ac22fba325fffc67ef42a807791dc3..0000000000000000000000000000000000000000 Binary files a/docs/icons/link.png and /dev/null differ diff --git a/docs/icons/movie.gif b/docs/icons/movie.gif deleted file mode 100644 index 003518377414735b97dd78c435daa795c9136526..0000000000000000000000000000000000000000 Binary files a/docs/icons/movie.gif and /dev/null differ diff --git a/docs/icons/movie.png b/docs/icons/movie.png deleted file mode 100644 index 5615180de885fdad381d4dc6702eaec6ef4a378c..0000000000000000000000000000000000000000 Binary files a/docs/icons/movie.png and /dev/null differ diff --git a/docs/icons/p.gif b/docs/icons/p.gif deleted file mode 100644 index 7b917b4e91e8004d40241f2c031016f3cb414caa..0000000000000000000000000000000000000000 Binary files a/docs/icons/p.gif and /dev/null differ diff --git a/docs/icons/p.png b/docs/icons/p.png deleted file mode 100644 index 3fbe0e8801e4eeb7179e4d8845690c7d86cfb010..0000000000000000000000000000000000000000 Binary files a/docs/icons/p.png and /dev/null differ diff --git a/docs/icons/patch.gif b/docs/icons/patch.gif deleted file mode 100644 index 39bc90e7953103a7fb4d6dbbd3efcfc1cc8de759..0000000000000000000000000000000000000000 Binary files a/docs/icons/patch.gif and /dev/null differ diff --git a/docs/icons/patch.png b/docs/icons/patch.png deleted file mode 100644 index 808ed7865fe85986e4a15b5038aba0397f6e041d..0000000000000000000000000000000000000000 Binary files a/docs/icons/patch.png and /dev/null differ diff --git a/docs/icons/pdf.gif b/docs/icons/pdf.gif deleted file mode 100644 index c88fd777c4b2a85b930eb4a6b68440c88536289a..0000000000000000000000000000000000000000 Binary files a/docs/icons/pdf.gif and /dev/null differ diff --git a/docs/icons/pdf.png b/docs/icons/pdf.png deleted file mode 100644 index 516142bb47bca0ec5906b6cc7547e68812835107..0000000000000000000000000000000000000000 Binary files a/docs/icons/pdf.png and /dev/null differ diff --git a/docs/icons/pie0.gif b/docs/icons/pie0.gif deleted file mode 100644 index 6f7a0ae7a703000c365896477c32f9f1434d14ca..0000000000000000000000000000000000000000 Binary files a/docs/icons/pie0.gif and /dev/null differ diff --git a/docs/icons/pie0.png b/docs/icons/pie0.png deleted file mode 100644 index 12e0200c97f4174cb32e46b48c7446947628e11c..0000000000000000000000000000000000000000 Binary files a/docs/icons/pie0.png and /dev/null differ diff --git a/docs/icons/pie1.gif b/docs/icons/pie1.gif deleted file mode 100644 index 03aa6be71eb2efded05e937f1ad79549ca2d56bd..0000000000000000000000000000000000000000 Binary files a/docs/icons/pie1.gif and /dev/null differ diff --git a/docs/icons/pie1.png b/docs/icons/pie1.png deleted file mode 100644 index c44c793ed8b2aab446b8fcb47039c33209cd52c9..0000000000000000000000000000000000000000 Binary files a/docs/icons/pie1.png and /dev/null differ diff --git a/docs/icons/pie2.gif b/docs/icons/pie2.gif deleted file mode 100644 index b04c5e090868dbcea50043700d52179ba99e89a4..0000000000000000000000000000000000000000 Binary files a/docs/icons/pie2.gif and /dev/null differ diff --git a/docs/icons/pie2.png b/docs/icons/pie2.png deleted file mode 100644 index e0b7167d913cc7c6e6bc35d3dac8496bcf15b1bd..0000000000000000000000000000000000000000 Binary files a/docs/icons/pie2.png and /dev/null differ diff --git a/docs/icons/pie3.gif b/docs/icons/pie3.gif deleted file mode 100644 index 4db9d023eda78f499c5e5efb7d6739d0d450652d..0000000000000000000000000000000000000000 Binary files a/docs/icons/pie3.gif and /dev/null differ diff --git a/docs/icons/pie3.png b/docs/icons/pie3.png deleted file mode 100644 index 820a3c35fa9f6652703d8e9e9e45378cf9090af3..0000000000000000000000000000000000000000 Binary files a/docs/icons/pie3.png and /dev/null differ diff --git a/docs/icons/pie4.gif b/docs/icons/pie4.gif deleted file mode 100644 index 93471fdd885b4e54a6ebcfb68fa98626f3d43d75..0000000000000000000000000000000000000000 Binary files a/docs/icons/pie4.gif and /dev/null differ diff --git a/docs/icons/pie4.png b/docs/icons/pie4.png deleted file mode 100644 index 35490d857c7f2fa89b7924a3ad65e40085b7e27a..0000000000000000000000000000000000000000 Binary files a/docs/icons/pie4.png and /dev/null differ diff --git a/docs/icons/pie5.gif b/docs/icons/pie5.gif deleted file mode 100644 index 57aee93f0707a6fea58637c351c4ac1dae6459cf..0000000000000000000000000000000000000000 Binary files a/docs/icons/pie5.gif and /dev/null differ diff --git a/docs/icons/pie5.png b/docs/icons/pie5.png deleted file mode 100644 index 359b7d377f437a75fc4598b5349d7c48266f69bc..0000000000000000000000000000000000000000 Binary files a/docs/icons/pie5.png and /dev/null differ diff --git a/docs/icons/pie6.gif b/docs/icons/pie6.gif deleted file mode 100644 index 0dc327b569730e90421c3fae883b17691b8b9219..0000000000000000000000000000000000000000 Binary files a/docs/icons/pie6.gif and /dev/null differ diff --git a/docs/icons/pie6.png b/docs/icons/pie6.png deleted file mode 100644 index 4b293eae18c19bcd47cc526bf23db1dc5188425c..0000000000000000000000000000000000000000 Binary files a/docs/icons/pie6.png and /dev/null differ diff --git a/docs/icons/pie7.gif b/docs/icons/pie7.gif deleted file mode 100644 index 8661337f067f9933eb0ef9bb4ccd77dd8bdb0b10..0000000000000000000000000000000000000000 Binary files a/docs/icons/pie7.gif and /dev/null differ diff --git a/docs/icons/pie7.png b/docs/icons/pie7.png deleted file mode 100644 index 6bfa2d06ae2be70d6e378b84f66a88bc1ef6d5ec..0000000000000000000000000000000000000000 Binary files a/docs/icons/pie7.png and /dev/null differ diff --git a/docs/icons/pie8.gif b/docs/icons/pie8.gif deleted file mode 100644 index 59ddb34ce0f42f40fc010aa2bcf059d891fccadf..0000000000000000000000000000000000000000 Binary files a/docs/icons/pie8.gif and /dev/null differ diff --git a/docs/icons/pie8.png b/docs/icons/pie8.png deleted file mode 100644 index 716cf2822bf1cbb2f46fff422d0a7388f99e2806..0000000000000000000000000000000000000000 Binary files a/docs/icons/pie8.png and /dev/null differ diff --git a/docs/icons/portal.gif b/docs/icons/portal.gif deleted file mode 100644 index 0e6e506e004caddde40da13470f5b566c4ebd3e4..0000000000000000000000000000000000000000 Binary files a/docs/icons/portal.gif and /dev/null differ diff --git a/docs/icons/portal.png b/docs/icons/portal.png deleted file mode 100644 index 937c0f87cd627a30af5d7782fa371220f933a991..0000000000000000000000000000000000000000 Binary files a/docs/icons/portal.png and /dev/null differ diff --git a/docs/icons/ps.gif b/docs/icons/ps.gif deleted file mode 100644 index 0f565bc1db7ebc72bc372381239f378780df5487..0000000000000000000000000000000000000000 Binary files a/docs/icons/ps.gif and /dev/null differ diff --git a/docs/icons/ps.png b/docs/icons/ps.png deleted file mode 100644 index ccccf730b6c9a54915d892d6b4194ddcea4616f2..0000000000000000000000000000000000000000 Binary files a/docs/icons/ps.png and /dev/null differ diff --git a/docs/icons/quill.gif b/docs/icons/quill.gif deleted file mode 100644 index 818a5cdc7e0f1d073cea1f9771b6d94737d34183..0000000000000000000000000000000000000000 Binary files a/docs/icons/quill.gif and /dev/null differ diff --git a/docs/icons/quill.png b/docs/icons/quill.png deleted file mode 100644 index b697770a8823da0cff6de7d1ecc6c06d985dd034..0000000000000000000000000000000000000000 Binary files a/docs/icons/quill.png and /dev/null differ diff --git a/docs/icons/right.gif b/docs/icons/right.gif deleted file mode 100644 index b256e5f75fb1f5467251abbf9442f338892e6ab5..0000000000000000000000000000000000000000 Binary files a/docs/icons/right.gif and /dev/null differ diff --git a/docs/icons/right.png b/docs/icons/right.png deleted file mode 100644 index 41f8529a84e4b17e9c27cc21d2d56c1a2511596b..0000000000000000000000000000000000000000 Binary files a/docs/icons/right.png and /dev/null differ diff --git a/docs/icons/screw1.gif b/docs/icons/screw1.gif deleted file mode 100644 index af6ba2b097bda90209dd1d3d392fccdb7bcfa629..0000000000000000000000000000000000000000 Binary files a/docs/icons/screw1.gif and /dev/null differ diff --git a/docs/icons/screw1.png b/docs/icons/screw1.png deleted file mode 100644 index 11673ab97dc664c3d2c86d8e0ac6329f430f5844..0000000000000000000000000000000000000000 Binary files a/docs/icons/screw1.png and /dev/null differ diff --git a/docs/icons/screw2.gif b/docs/icons/screw2.gif deleted file mode 100644 index 06dccb3e44c66d18be8e7c0a3da2413d3644b3c8..0000000000000000000000000000000000000000 Binary files a/docs/icons/screw2.gif and /dev/null differ diff --git a/docs/icons/screw2.png b/docs/icons/screw2.png deleted file mode 100644 index 5d7d2cf65e999a28311dc28eec53eac318d20eeb..0000000000000000000000000000000000000000 Binary files a/docs/icons/screw2.png and /dev/null differ diff --git a/docs/icons/script.gif b/docs/icons/script.gif deleted file mode 100644 index d8a853bc5828cf534c4c46a0efbf4b1d7d3c52fc..0000000000000000000000000000000000000000 Binary files a/docs/icons/script.gif and /dev/null differ diff --git a/docs/icons/script.png b/docs/icons/script.png deleted file mode 100644 index 2520570a775d4ed6898317d00aefbaf63f8b379e..0000000000000000000000000000000000000000 Binary files a/docs/icons/script.png and /dev/null differ diff --git a/docs/icons/small/README.txt b/docs/icons/small/README.txt deleted file mode 100644 index deb96702b767e9f5a4c2fc8350f9e32825558c86..0000000000000000000000000000000000000000 --- a/docs/icons/small/README.txt +++ /dev/null @@ -1,6 +0,0 @@ - -These icons are provided as an alternative to the standard Apache -icon graphics. All graphics in this directory, with the exception -of rainbow.gif, are 16x16 pixels in size, rather than the 20x22 -dimension icons which are the normal defaults for Apache and are -in the parent directory of this one. diff --git a/docs/icons/small/back.gif b/docs/icons/small/back.gif deleted file mode 100644 index e331454726bbc19cdcdd3867ffcae217a0fde8f6..0000000000000000000000000000000000000000 Binary files a/docs/icons/small/back.gif and /dev/null differ diff --git a/docs/icons/small/back.png b/docs/icons/small/back.png deleted file mode 100644 index 2257df2140d3bd07fb6173d33167b365714c4906..0000000000000000000000000000000000000000 Binary files a/docs/icons/small/back.png and /dev/null differ diff --git a/docs/icons/small/binary.gif b/docs/icons/small/binary.gif deleted file mode 100644 index 995f79b9b10d5a49fd6e6d9f641d3bb65cfffa02..0000000000000000000000000000000000000000 Binary files a/docs/icons/small/binary.gif and /dev/null differ diff --git a/docs/icons/small/binary.png b/docs/icons/small/binary.png deleted file mode 100644 index 2e2e1b073d62786ba186eb440908f86852839429..0000000000000000000000000000000000000000 Binary files a/docs/icons/small/binary.png and /dev/null differ diff --git a/docs/icons/small/binhex.gif b/docs/icons/small/binhex.gif deleted file mode 100644 index 3d54a5458e6edfde1f60b8a35d549e3af1552ffd..0000000000000000000000000000000000000000 Binary files a/docs/icons/small/binhex.gif and /dev/null differ diff --git a/docs/icons/small/binhex.png b/docs/icons/small/binhex.png deleted file mode 100644 index 9deab419b618c87c27fbce4b1aed5b97de07b8bc..0000000000000000000000000000000000000000 Binary files a/docs/icons/small/binhex.png and /dev/null differ diff --git a/docs/icons/small/blank.gif b/docs/icons/small/blank.gif deleted file mode 100644 index 606787a8399e939a2691a76e3edb3897037b2daa..0000000000000000000000000000000000000000 Binary files a/docs/icons/small/blank.gif and /dev/null differ diff --git a/docs/icons/small/blank.png b/docs/icons/small/blank.png deleted file mode 100644 index 86f57a504f732b516a88b5b5b49a2a241203dc5e..0000000000000000000000000000000000000000 Binary files a/docs/icons/small/blank.png and /dev/null differ diff --git a/docs/icons/small/broken.gif b/docs/icons/small/broken.gif deleted file mode 100644 index 1bcc57f25c59044e6af6f09d0fc46dbd0bdafd66..0000000000000000000000000000000000000000 Binary files a/docs/icons/small/broken.gif and /dev/null differ diff --git a/docs/icons/small/broken.png b/docs/icons/small/broken.png deleted file mode 100644 index 79c998c8c3111f187ac1d586b4c5101534ca0d0e..0000000000000000000000000000000000000000 Binary files a/docs/icons/small/broken.png and /dev/null differ diff --git a/docs/icons/small/burst.gif b/docs/icons/small/burst.gif deleted file mode 100644 index d882ceba9cbf05051d5081f2e102ebff5f24edac..0000000000000000000000000000000000000000 Binary files a/docs/icons/small/burst.gif and /dev/null differ diff --git a/docs/icons/small/burst.png b/docs/icons/small/burst.png deleted file mode 100644 index 2b21436c78eb254526ce54349170863cb136d5a8..0000000000000000000000000000000000000000 Binary files a/docs/icons/small/burst.png and /dev/null differ diff --git a/docs/icons/small/comp1.gif b/docs/icons/small/comp1.gif deleted file mode 100644 index 712f36afdb27370918ce1eb008be6073aba769e6..0000000000000000000000000000000000000000 Binary files a/docs/icons/small/comp1.gif and /dev/null differ diff --git a/docs/icons/small/comp1.png b/docs/icons/small/comp1.png deleted file mode 100644 index 6d8c3459ed08a21c1d7cc50afbad7a1abd5471b4..0000000000000000000000000000000000000000 Binary files a/docs/icons/small/comp1.png and /dev/null differ diff --git a/docs/icons/small/comp2.gif b/docs/icons/small/comp2.gif deleted file mode 100644 index 7759eb11f95a4bb3803ca55eae6c3ff8fd100b96..0000000000000000000000000000000000000000 Binary files a/docs/icons/small/comp2.gif and /dev/null differ diff --git a/docs/icons/small/comp2.png b/docs/icons/small/comp2.png deleted file mode 100644 index 57f7ad197b8e18ceb981ecdb30a05611720acfbe..0000000000000000000000000000000000000000 Binary files a/docs/icons/small/comp2.png and /dev/null differ diff --git a/docs/icons/small/compressed.gif b/docs/icons/small/compressed.gif deleted file mode 100644 index d3b156072ac0b62c0248694d2d05791379e34927..0000000000000000000000000000000000000000 Binary files a/docs/icons/small/compressed.gif and /dev/null differ diff --git a/docs/icons/small/compressed.png b/docs/icons/small/compressed.png deleted file mode 100644 index 43acd8b943dadffd426aabaa42e86df0891b0274..0000000000000000000000000000000000000000 Binary files a/docs/icons/small/compressed.png and /dev/null differ diff --git a/docs/icons/small/continued.gif b/docs/icons/small/continued.gif deleted file mode 100644 index e1c9f2cfa68034f0439e336d3b3903deb44a0883..0000000000000000000000000000000000000000 Binary files a/docs/icons/small/continued.gif and /dev/null differ diff --git a/docs/icons/small/continued.png b/docs/icons/small/continued.png deleted file mode 100644 index db17c424650859f7b8f2117ce08ce4e78888e1b9..0000000000000000000000000000000000000000 Binary files a/docs/icons/small/continued.png and /dev/null differ diff --git a/docs/icons/small/dir.gif b/docs/icons/small/dir.gif deleted file mode 100644 index 7b37b099177d12b3f6ee7056c03d992b09e7fee1..0000000000000000000000000000000000000000 Binary files a/docs/icons/small/dir.gif and /dev/null differ diff --git a/docs/icons/small/dir.png b/docs/icons/small/dir.png deleted file mode 100644 index 9bd6256bdbb781ad96d26b02870c8dabb1622f5f..0000000000000000000000000000000000000000 Binary files a/docs/icons/small/dir.png and /dev/null differ diff --git a/docs/icons/small/dir2.gif b/docs/icons/small/dir2.gif deleted file mode 100644 index 425d6e4b77ceb7ba16ded08c4915c809acf69c12..0000000000000000000000000000000000000000 Binary files a/docs/icons/small/dir2.gif and /dev/null differ diff --git a/docs/icons/small/dir2.png b/docs/icons/small/dir2.png deleted file mode 100644 index 836daf49ef273cd3310889196a325983db1f76f2..0000000000000000000000000000000000000000 Binary files a/docs/icons/small/dir2.png and /dev/null differ diff --git a/docs/icons/small/doc.gif b/docs/icons/small/doc.gif deleted file mode 100644 index 0fcf18db2a89a540716c06e734cc564cdf08375a..0000000000000000000000000000000000000000 Binary files a/docs/icons/small/doc.gif and /dev/null differ diff --git a/docs/icons/small/doc.png b/docs/icons/small/doc.png deleted file mode 100644 index c560df21d3c48dffb288d24f7f7a4212bc15b531..0000000000000000000000000000000000000000 Binary files a/docs/icons/small/doc.png and /dev/null differ diff --git a/docs/icons/small/forward.gif b/docs/icons/small/forward.gif deleted file mode 100644 index 2997466eb4de77500cbe27060b1a590f251102ab..0000000000000000000000000000000000000000 Binary files a/docs/icons/small/forward.gif and /dev/null differ diff --git a/docs/icons/small/forward.png b/docs/icons/small/forward.png deleted file mode 100644 index 4ddbc61e1429e0a9c0812e8a2f72936cc1b2a2f0..0000000000000000000000000000000000000000 Binary files a/docs/icons/small/forward.png and /dev/null differ diff --git a/docs/icons/small/generic.gif b/docs/icons/small/generic.gif deleted file mode 100644 index f8da6ff92c3103d440aa34c842efce51ddd2d55c..0000000000000000000000000000000000000000 Binary files a/docs/icons/small/generic.gif and /dev/null differ diff --git a/docs/icons/small/generic.png b/docs/icons/small/generic.png deleted file mode 100644 index 16374a12bbb34254380c4fd6343424ffc0b164c0..0000000000000000000000000000000000000000 Binary files a/docs/icons/small/generic.png and /dev/null differ diff --git a/docs/icons/small/generic2.gif b/docs/icons/small/generic2.gif deleted file mode 100644 index 992f13331bba69df688a1c52eee270449974f51d..0000000000000000000000000000000000000000 Binary files a/docs/icons/small/generic2.gif and /dev/null differ diff --git a/docs/icons/small/generic2.png b/docs/icons/small/generic2.png deleted file mode 100644 index 40d60c1df235b0326c27e6f1ff591e949aba6a03..0000000000000000000000000000000000000000 Binary files a/docs/icons/small/generic2.png and /dev/null differ diff --git a/docs/icons/small/generic3.gif b/docs/icons/small/generic3.gif deleted file mode 100644 index 85aa275e25a86a88d23dcc61e5229626d06e421d..0000000000000000000000000000000000000000 Binary files a/docs/icons/small/generic3.gif and /dev/null differ diff --git a/docs/icons/small/generic3.png b/docs/icons/small/generic3.png deleted file mode 100644 index aa38963afa2abcadb18fceb583aa705aae9b9acd..0000000000000000000000000000000000000000 Binary files a/docs/icons/small/generic3.png and /dev/null differ diff --git a/docs/icons/small/image.gif b/docs/icons/small/image.gif deleted file mode 100644 index dc3d95ced763c4a905d8ceee4b2550e2131fd42f..0000000000000000000000000000000000000000 Binary files a/docs/icons/small/image.gif and /dev/null differ diff --git a/docs/icons/small/image.png b/docs/icons/small/image.png deleted file mode 100644 index d92f0a5fcc45d6a98f9a3c92864e9b1cb4d68c46..0000000000000000000000000000000000000000 Binary files a/docs/icons/small/image.png and /dev/null differ diff --git a/docs/icons/small/image2.gif b/docs/icons/small/image2.gif deleted file mode 100644 index a5c40f15508516b54f02ecb77b9995116dc11308..0000000000000000000000000000000000000000 Binary files a/docs/icons/small/image2.gif and /dev/null differ diff --git a/docs/icons/small/image2.png b/docs/icons/small/image2.png deleted file mode 100644 index 4049bda56198a26bc5199f9e79bd58d5214af139..0000000000000000000000000000000000000000 Binary files a/docs/icons/small/image2.png and /dev/null differ diff --git a/docs/icons/small/index.gif b/docs/icons/small/index.gif deleted file mode 100644 index 526df6b064537f21f92ef3cbdd61ee741a2e8dda..0000000000000000000000000000000000000000 Binary files a/docs/icons/small/index.gif and /dev/null differ diff --git a/docs/icons/small/index.png b/docs/icons/small/index.png deleted file mode 100644 index 080453e21514f61b83b4e2b8d86a0a9ecfd033e2..0000000000000000000000000000000000000000 Binary files a/docs/icons/small/index.png and /dev/null differ diff --git a/docs/icons/small/key.gif b/docs/icons/small/key.gif deleted file mode 100644 index 8dfd6c09de379a7fb7e78f3d06b5e2dbc959b109..0000000000000000000000000000000000000000 Binary files a/docs/icons/small/key.gif and /dev/null differ diff --git a/docs/icons/small/key.png b/docs/icons/small/key.png deleted file mode 100644 index 1a45f67df3115e1caa9ed558cabe24553cd87e44..0000000000000000000000000000000000000000 Binary files a/docs/icons/small/key.png and /dev/null differ diff --git a/docs/icons/small/movie.gif b/docs/icons/small/movie.gif deleted file mode 100644 index 7b4a42e7a0eec8e4508903e9bd49cd966e966e21..0000000000000000000000000000000000000000 Binary files a/docs/icons/small/movie.gif and /dev/null differ diff --git a/docs/icons/small/movie.png b/docs/icons/small/movie.png deleted file mode 100644 index 7c126042c9aa4e013f543244b0c281e540b06d53..0000000000000000000000000000000000000000 Binary files a/docs/icons/small/movie.png and /dev/null differ diff --git a/docs/icons/small/patch.gif b/docs/icons/small/patch.gif deleted file mode 100644 index 100484e59822e79e22ab469fecd4a39052a66875..0000000000000000000000000000000000000000 Binary files a/docs/icons/small/patch.gif and /dev/null differ diff --git a/docs/icons/small/patch.png b/docs/icons/small/patch.png deleted file mode 100644 index c39f14435a0b18a81092762ad5476a59822c88be..0000000000000000000000000000000000000000 Binary files a/docs/icons/small/patch.png and /dev/null differ diff --git a/docs/icons/small/ps.gif b/docs/icons/small/ps.gif deleted file mode 100644 index fa4bcfce30f5fb3f62e65f0c989ac15be60a49b9..0000000000000000000000000000000000000000 Binary files a/docs/icons/small/ps.gif and /dev/null differ diff --git a/docs/icons/small/ps.png b/docs/icons/small/ps.png deleted file mode 100644 index 5c604230d07d4611118d95d9c0d916c99e095104..0000000000000000000000000000000000000000 Binary files a/docs/icons/small/ps.png and /dev/null differ diff --git a/docs/icons/small/rainbow.gif b/docs/icons/small/rainbow.gif deleted file mode 100644 index 8216b89bade87b795a7345329da487735f3e07eb..0000000000000000000000000000000000000000 Binary files a/docs/icons/small/rainbow.gif and /dev/null differ diff --git a/docs/icons/small/rainbow.png b/docs/icons/small/rainbow.png deleted file mode 100644 index 175053cb4335738d0e0a4f7f93e745acbef90443..0000000000000000000000000000000000000000 Binary files a/docs/icons/small/rainbow.png and /dev/null differ diff --git a/docs/icons/small/sound.gif b/docs/icons/small/sound.gif deleted file mode 100644 index a7a89ffd9ed29c24e1759e48291cadb875f6562a..0000000000000000000000000000000000000000 Binary files a/docs/icons/small/sound.gif and /dev/null differ diff --git a/docs/icons/small/sound.png b/docs/icons/small/sound.png deleted file mode 100644 index 6e3e95d3d01a390c8ae57bd8ac4631f69b36d526..0000000000000000000000000000000000000000 Binary files a/docs/icons/small/sound.png and /dev/null differ diff --git a/docs/icons/small/sound2.gif b/docs/icons/small/sound2.gif deleted file mode 100644 index 07706e07b86d25525e8e7fcb8cd2d8b10c235d49..0000000000000000000000000000000000000000 Binary files a/docs/icons/small/sound2.gif and /dev/null differ diff --git a/docs/icons/small/sound2.png b/docs/icons/small/sound2.png deleted file mode 100644 index bc46eb48fe59bce696319655f7377566780f44fc..0000000000000000000000000000000000000000 Binary files a/docs/icons/small/sound2.png and /dev/null differ diff --git a/docs/icons/small/tar.gif b/docs/icons/small/tar.gif deleted file mode 100644 index 59c3ffb9a5f0dcbcc0052a6dc8b428f4b033d316..0000000000000000000000000000000000000000 Binary files a/docs/icons/small/tar.gif and /dev/null differ diff --git a/docs/icons/small/tar.png b/docs/icons/small/tar.png deleted file mode 100644 index 12f0347bf9cd2d5131184de55dae0238ece29e4b..0000000000000000000000000000000000000000 Binary files a/docs/icons/small/tar.png and /dev/null differ diff --git a/docs/icons/small/text.gif b/docs/icons/small/text.gif deleted file mode 100644 index 66ceefbc8c46837738701f2ab48d202b4df62686..0000000000000000000000000000000000000000 Binary files a/docs/icons/small/text.gif and /dev/null differ diff --git a/docs/icons/small/text.png b/docs/icons/small/text.png deleted file mode 100644 index b4e30f466d364c3967471f6bda9c12cc4ce645fd..0000000000000000000000000000000000000000 Binary files a/docs/icons/small/text.png and /dev/null differ diff --git a/docs/icons/small/transfer.gif b/docs/icons/small/transfer.gif deleted file mode 100644 index d460d3fffe6c7cf99f9928a6304bd6067fa6f03d..0000000000000000000000000000000000000000 Binary files a/docs/icons/small/transfer.gif and /dev/null differ diff --git a/docs/icons/small/transfer.png b/docs/icons/small/transfer.png deleted file mode 100644 index 324048170a885e74c514be41d78cd701f54c5e6f..0000000000000000000000000000000000000000 Binary files a/docs/icons/small/transfer.png and /dev/null differ diff --git a/docs/icons/small/unknown.gif b/docs/icons/small/unknown.gif deleted file mode 100644 index 7bf0bbc10a654c44b34856884713f88e202b3d5d..0000000000000000000000000000000000000000 Binary files a/docs/icons/small/unknown.gif and /dev/null differ diff --git a/docs/icons/small/unknown.png b/docs/icons/small/unknown.png deleted file mode 100644 index cad7e7a7aa004850885b00f47ea548d0b01ecac7..0000000000000000000000000000000000000000 Binary files a/docs/icons/small/unknown.png and /dev/null differ diff --git a/docs/icons/small/uu.gif b/docs/icons/small/uu.gif deleted file mode 100644 index 8c793f8a7f98188fd983b21a7c89ecd79f0ef0fa..0000000000000000000000000000000000000000 Binary files a/docs/icons/small/uu.gif and /dev/null differ diff --git a/docs/icons/small/uu.png b/docs/icons/small/uu.png deleted file mode 100644 index ef87c82ee6c6d0091b457aea3de8d2b17bf7523c..0000000000000000000000000000000000000000 Binary files a/docs/icons/small/uu.png and /dev/null differ diff --git a/docs/icons/sound1.gif b/docs/icons/sound1.gif deleted file mode 100644 index 8efb49f55d6a370df44ad6e3269f6f966ffe25f6..0000000000000000000000000000000000000000 Binary files a/docs/icons/sound1.gif and /dev/null differ diff --git a/docs/icons/sound1.png b/docs/icons/sound1.png deleted file mode 100644 index 7a766be6cc8038c54605beca648425afa090b17a..0000000000000000000000000000000000000000 Binary files a/docs/icons/sound1.png and /dev/null differ diff --git a/docs/icons/sound2.gif b/docs/icons/sound2.gif deleted file mode 100644 index 48e6a7fb2faeb6ba254a87945246f5ca5980583b..0000000000000000000000000000000000000000 Binary files a/docs/icons/sound2.gif and /dev/null differ diff --git a/docs/icons/sound2.png b/docs/icons/sound2.png deleted file mode 100644 index 45112909398771bab1ed7004379521ae610cf191..0000000000000000000000000000000000000000 Binary files a/docs/icons/sound2.png and /dev/null differ diff --git a/docs/icons/sphere1.gif b/docs/icons/sphere1.gif deleted file mode 100644 index 7067070da2786b9842212ff1ce2307fb404407ce..0000000000000000000000000000000000000000 Binary files a/docs/icons/sphere1.gif and /dev/null differ diff --git a/docs/icons/sphere1.png b/docs/icons/sphere1.png deleted file mode 100644 index 2198ae89ec4cd38ae9dedec1849543cd304e3451..0000000000000000000000000000000000000000 Binary files a/docs/icons/sphere1.png and /dev/null differ diff --git a/docs/icons/sphere2.gif b/docs/icons/sphere2.gif deleted file mode 100644 index a9e462a377c8d451bd0c0d07a47035bd44caf57e..0000000000000000000000000000000000000000 Binary files a/docs/icons/sphere2.gif and /dev/null differ diff --git a/docs/icons/sphere2.png b/docs/icons/sphere2.png deleted file mode 100644 index 257632ba46db43a6f3fdee93a6dc61dd26d8efe5..0000000000000000000000000000000000000000 Binary files a/docs/icons/sphere2.png and /dev/null differ diff --git a/docs/icons/tar.gif b/docs/icons/tar.gif deleted file mode 100644 index 4032c1bd3d407abddd0f0e8801e3091726574171..0000000000000000000000000000000000000000 Binary files a/docs/icons/tar.gif and /dev/null differ diff --git a/docs/icons/tar.png b/docs/icons/tar.png deleted file mode 100644 index 6c40521ff80f9282f16938e6fbfd5c7ab43bd008..0000000000000000000000000000000000000000 Binary files a/docs/icons/tar.png and /dev/null differ diff --git a/docs/icons/tex.gif b/docs/icons/tex.gif deleted file mode 100644 index 45e43233b845960c59aa8933251d6d745b324031..0000000000000000000000000000000000000000 Binary files a/docs/icons/tex.gif and /dev/null differ diff --git a/docs/icons/tex.png b/docs/icons/tex.png deleted file mode 100644 index 906622d3844661a0928730801e5dbe6c06b26da2..0000000000000000000000000000000000000000 Binary files a/docs/icons/tex.png and /dev/null differ diff --git a/docs/icons/text.gif b/docs/icons/text.gif deleted file mode 100644 index 4c623909fbfb54658f19186beec8d362f87e233b..0000000000000000000000000000000000000000 Binary files a/docs/icons/text.gif and /dev/null differ diff --git a/docs/icons/text.png b/docs/icons/text.png deleted file mode 100644 index 34d0edf86e4702601cababe0759021b1c0dc6337..0000000000000000000000000000000000000000 Binary files a/docs/icons/text.png and /dev/null differ diff --git a/docs/icons/transfer.gif b/docs/icons/transfer.gif deleted file mode 100644 index 33697dbb667a8c898bc501cedd8039a3e9e04272..0000000000000000000000000000000000000000 Binary files a/docs/icons/transfer.gif and /dev/null differ diff --git a/docs/icons/transfer.png b/docs/icons/transfer.png deleted file mode 100644 index efaf17b682fc991783918932e9ea9edc715e7ddd..0000000000000000000000000000000000000000 Binary files a/docs/icons/transfer.png and /dev/null differ diff --git a/docs/icons/unknown.gif b/docs/icons/unknown.gif deleted file mode 100644 index 32b1ea23fb6f6195f1bb17adf9c3cb2cc29dfefa..0000000000000000000000000000000000000000 Binary files a/docs/icons/unknown.gif and /dev/null differ diff --git a/docs/icons/unknown.png b/docs/icons/unknown.png deleted file mode 100644 index 7c241c383c0ae302ec5e4b1b9d8aa0e57eefd103..0000000000000000000000000000000000000000 Binary files a/docs/icons/unknown.png and /dev/null differ diff --git a/docs/icons/up.gif b/docs/icons/up.gif deleted file mode 100644 index 6d6d6d1ebf89aef21c40a88f5a181b8155e4d79f..0000000000000000000000000000000000000000 Binary files a/docs/icons/up.gif and /dev/null differ diff --git a/docs/icons/up.png b/docs/icons/up.png deleted file mode 100644 index a69ea00c5b70706a98fda039b8e92afa35829e1f..0000000000000000000000000000000000000000 Binary files a/docs/icons/up.png and /dev/null differ diff --git a/docs/icons/uu.gif b/docs/icons/uu.gif deleted file mode 100644 index 4387d529f69f77810347be63429d13ff38bcb2c1..0000000000000000000000000000000000000000 Binary files a/docs/icons/uu.gif and /dev/null differ diff --git a/docs/icons/uu.png b/docs/icons/uu.png deleted file mode 100644 index b1d1a8579d543c97b53f6694575f508e69be10ee..0000000000000000000000000000000000000000 Binary files a/docs/icons/uu.png and /dev/null differ diff --git a/docs/icons/uuencoded.gif b/docs/icons/uuencoded.gif deleted file mode 100644 index 4387d529f69f77810347be63429d13ff38bcb2c1..0000000000000000000000000000000000000000 Binary files a/docs/icons/uuencoded.gif and /dev/null differ diff --git a/docs/icons/uuencoded.png b/docs/icons/uuencoded.png deleted file mode 100644 index b1d1a8579d543c97b53f6694575f508e69be10ee..0000000000000000000000000000000000000000 Binary files a/docs/icons/uuencoded.png and /dev/null differ diff --git a/docs/icons/world1.gif b/docs/icons/world1.gif deleted file mode 100644 index 05b4ec205884f16202e290b83db7c36ec660a73e..0000000000000000000000000000000000000000 Binary files a/docs/icons/world1.gif and /dev/null differ diff --git a/docs/icons/world1.png b/docs/icons/world1.png deleted file mode 100644 index 3a65c00d8468f2455e5edd5b494fd4b5f39b7172..0000000000000000000000000000000000000000 Binary files a/docs/icons/world1.png and /dev/null differ diff --git a/docs/icons/world2.gif b/docs/icons/world2.gif deleted file mode 100644 index e3203f7a881283a15f895af86b7727878592257a..0000000000000000000000000000000000000000 Binary files a/docs/icons/world2.gif and /dev/null differ diff --git a/docs/icons/world2.png b/docs/icons/world2.png deleted file mode 100644 index 9f8a3ea4b353922676ccce124fb7c975c20a1cc6..0000000000000000000000000000000000000000 Binary files a/docs/icons/world2.png and /dev/null differ diff --git a/docs/man/ab.8 b/docs/man/ab.8 deleted file mode 100644 index 5a06f36055732e68f0453cb9ef4cd7644d319e79..0000000000000000000000000000000000000000 --- a/docs/man/ab.8 +++ /dev/null @@ -1,210 +0,0 @@ -.TH ab 1 "March 1998" -.\" $Id: ab.8,v 1.1 1999/08/24 06:45:53 fielding Exp $ -.\" Copyright (c) 1998-1999 The Apache Group. All rights reserved. -.\" -.\" Redistribution and use in source and binary forms, with or without -.\" modification, are permitted provided that the following conditions -.\" are met: -.\" -.\" 1. Redistributions of source code must retain the above copyright -.\" notice, this list of conditions and the following disclaimer. -.\" -.\" 2. Redistributions in binary form must reproduce the above copyright -.\" notice, this list of conditions and the following disclaimer in -.\" the documentation and/or other materials provided with the -.\" distribution. -.\" -.\" 3. All advertising materials mentioning features or use of this -.\" software must display the following acknowledgment: -.\" "This product includes software developed by the Apache Group -.\" for use in the Apache HTTP server project (http://www.apache.org/)." -.\" -.\" 4. The names "Apache Server" and "Apache Group" must not be used to -.\" endorse or promote products derived from this software without -.\" prior written permission. -.\" -.\" 5. Products derived from this software may not be called "Apache" -.\" nor may "Apache" appear in their names without prior written -.\" permission of the Apache Group. -.\" -.\" 6. Redistributions of any form whatsoever must retain the following -.\" acknowledgment: -.\" "This product includes software developed by the Apache Group -.\" for use in the Apache HTTP server project (http://www.apache.org/)." -.\" -.\" THIS SOFTWARE IS PROVIDED BY THE APACHE GROUP ``AS IS'' AND ANY -.\" EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR -.\" PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE APACHE GROUP OR -.\" ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -.\" SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT -.\" NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; -.\" LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) -.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, -.\" STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) -.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED -.\" OF THE POSSIBILITY OF SUCH DAMAGE. -.\" ==================================================================== -.\" -.\" This software consists of voluntary contributions made by many -.\" individuals on behalf of the Apache Group and was originally based -.\" on public domain software written at the National Center for -.\" Supercomputing Applications, University of Illinois, Urbana-Champaign. -.\" For more information on the Apache Group and the Apache HTTP server -.\" project, please see . -.SH NAME -ab \- Apache HTTP server benchmarking tool -.SH SYNOPSIS -.B ab -[ -.B \-k -] [ -.BI \-n " requests" -] [ -.BI \-t " timelimit" -] [ -.BI \-c " concurrency" -] [ -.BI \-p " POST file" -] [ -.BI \-A " Authenticate username:password" -] [ -.BI \-P " Proxy Authenticate username:password" -] [ -.BI \-H " Custom header" -] [ -.BI \-C " Cookie name=value" -] [ -.BI \-T " content-type" -] [ -.BI \-v " verbosity" -] -] [ -.BI \-w " output HTML" -] -] [ -.BI \-x " attributes" -] -] [ -.BI \-y " attributes" -] -] [ -.BI \-z " " - "" - "" - "" - "" - "" - "", - name, - cache->numentries, - (double)cache->numentries / (double)cache->maxentries * 100.0, - chainlen, - cache->hits, - cache->fetches, - (cache->fetches > 0 ? (double)(cache->hits) / (double)(cache->fetches) * 100.0 : 100.0), - cache->inserts, - cache->removes); - - if (cache->numpurges) { - char str_ctime[APR_CTIME_LEN]; - - apr_ctime(str_ctime, cache->last_purge); - buf = apr_psprintf(p, - "%s" - "\n" - "\n", - buf, - cache->numpurges, - str_ctime); - } - else { - buf = apr_psprintf(p, - "%s\n", - buf); - } - - buf = apr_psprintf(p, "%s\n", buf, cache->avg_purgetime); - - return buf; -} - -char *util_ald_cache_display(apr_pool_t *pool) -{ - int i; - char *buf, *t1, *t2, *t3; - - if (!util_ldap_cache) { - return ""; - } - - buf = util_ald_cache_display_stats(pool, util_ldap_cache, "LDAP URL Cache"); - - for (i=0; i < util_ldap_cache->size; ++i) { - util_cache_node_t *p; - for (p = util_ldap_cache->nodes[i]; p != NULL; p = p->next) { - util_url_node_t *n; - - n = (util_url_node_t *)p->payload; - - t1 = apr_psprintf(pool, "%s (Searches)", n->url); - t2 = apr_psprintf(pool, "%s (Compares)", n->url); - t3 = apr_psprintf(pool, "%s (DNCompares)", n->url); - - buf = apr_psprintf(pool, "%s\n\n" - "%s\n\n" - "%s\n\n" - "%s\n\n", - buf, - util_ald_cache_display_stats(pool, n->search_cache, t1), - util_ald_cache_display_stats(pool, n->compare_cache, t2), - util_ald_cache_display_stats(pool, n->dn_compare_cache, t3) - ); - } - } - return buf; -} - -#endif /* APU_HAS_LDAP */ diff --git a/modules/filters/.cvsignore b/modules/filters/.cvsignore deleted file mode 100644 index f2f7a70d2c9528e7ef84cf1b3bf9ff721fa08b08..0000000000000000000000000000000000000000 --- a/modules/filters/.cvsignore +++ /dev/null @@ -1,10 +0,0 @@ -.deps -.libs -*.la -modules.mk -Makefile -*.lo -*.slo -*.so -*.dll -*.def diff --git a/modules/filters/.indent.pro b/modules/filters/.indent.pro deleted file mode 100644 index a9fbe9f9a1f2e6e7bcc54171c215bdacd44171ba..0000000000000000000000000000000000000000 --- a/modules/filters/.indent.pro +++ /dev/null @@ -1,54 +0,0 @@ --i4 -npsl -di0 -br -nce -d0 -cli0 -npcs -nfc1 --TBUFF --TFILE --TTRANS --TUINT4 --T_trans --Tallow_options_t --Tapache_sfio --Tarray_header --Tbool_int --Tbuf_area --Tbuff_struct --Tbuffy --Tcmd_how --Tcmd_parms --Tcommand_rec --Tcommand_struct --Tconn_rec --Tcore_dir_config --Tcore_server_config --Tdir_maker_func --Tevent --Tglobals_s --Thandler_func --Thandler_rec --Tjoblist_s --Tlisten_rec --Tmerger_func --Tmode_t --Tmodule --Tmodule_struct --Tmutex --Tn_long --Tother_child_rec --Toverrides_t --Tparent_score --Tpid_t --Tpiped_log --Tpool --Trequest_rec --Trequire_line --Trlim_t --Tscoreboard --Tsemaphore --Tserver_addr_rec --Tserver_rec --Tserver_rec_chain --Tshort_score --Ttable --Ttable_entry --Tthread --Tu_wide_int --Tvtime_t --Twide_int diff --git a/modules/filters/Makefile.in b/modules/filters/Makefile.in deleted file mode 100644 index 167b343d0db75f7876a55cef1681570eba813202..0000000000000000000000000000000000000000 --- a/modules/filters/Makefile.in +++ /dev/null @@ -1,3 +0,0 @@ - -include $(top_srcdir)/build/special.mk - diff --git a/modules/filters/config.m4 b/modules/filters/config.m4 deleted file mode 100644 index 2b8589e3e5e1b4a017c8a82bd8653c4e71d09474..0000000000000000000000000000000000000000 --- a/modules/filters/config.m4 +++ /dev/null @@ -1,18 +0,0 @@ -dnl modules enabled in this directory by default - -dnl AC_DEFUN(modulename, modulestructname, defaultonoroff, configmacros) -dnl XXX - Need to allow --enable-module to fail if optional config fails - -AC_DEFUN(APACHE_CHECK_STANDARD_MODULE, [ - APACHE_MODULE([$1],[$2],,[$3],[$4],[$5]) -]) - -APACHE_MODPATH_INIT(filters) - -APACHE_CHECK_STANDARD_MODULE(include, Server Side Includes, includes, yes) - -LTFLAGS="$LTFLAGS -export-dynamic" - -APACHE_MODPATH_FINISH - -APACHE_SUBST(STANDARD_LIBS) diff --git a/modules/filters/mod_include.c b/modules/filters/mod_include.c deleted file mode 100644 index 3ee96db83b5033da911f7cf112776578b5edc963..0000000000000000000000000000000000000000 --- a/modules/filters/mod_include.c +++ /dev/null @@ -1,2486 +0,0 @@ -/* ==================================================================== - * Copyright (c) 1995-1999 The Apache Group. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in - * the documentation and/or other materials provided with the - * distribution. - * - * 3. All advertising materials mentioning features or use of this - * software must display the following acknowledgment: - * "This product includes software developed by the Apache Group - * for use in the Apache HTTP server project (http://www.apache.org/)." - * - * 4. The names "Apache Server" and "Apache Group" must not be used to - * endorse or promote products derived from this software without - * prior written permission. For written permission, please contact - * apache@apache.org. - * - * 5. Products derived from this software may not be called "Apache" - * nor may "Apache" appear in their names without prior written - * permission of the Apache Group. - * - * 6. Redistributions of any form whatsoever must retain the following - * acknowledgment: - * "This product includes software developed by the Apache Group - * for use in the Apache HTTP server project (http://www.apache.org/)." - * - * THIS SOFTWARE IS PROVIDED BY THE APACHE GROUP ``AS IS'' AND ANY - * EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR - * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE APACHE GROUP OR - * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT - * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, - * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED - * OF THE POSSIBILITY OF SUCH DAMAGE. - * ==================================================================== - * - * This software consists of voluntary contributions made by many - * individuals on behalf of the Apache Group and was originally based - * on public domain software written at the National Center for - * Supercomputing Applications, University of Illinois, Urbana-Champaign. - * For more information on the Apache Group and the Apache HTTP server - * project, please see . - * - */ - -/* - * http_include.c: Handles the server-parsed HTML documents - * - * Original by Rob McCool; substantial fixups by David Robinson; - * incorporated into the Apache module framework by rst. - * - */ -/* - * sub key may be anything a Perl*Handler can be: - * subroutine name, package name (defaults to package::handler), - * Class->method call or anoymous sub {} - * - * Child accessed - * times.
    - * - * - * - * -Doug MacEachern - */ - -#ifdef USE_PERL_SSI -#include "config.h" -#undef VOIDUSED -#ifdef USE_SFIO -#undef USE_SFIO -#define USE_STDIO -#endif -#include "modules/perl/mod_perl.h" -#else -#include "httpd.h" -#include "http_config.h" -#include "http_request.h" -#include "http_core.h" -#include "http_protocol.h" -#include "http_log.h" -#include "http_main.h" -#include "util_script.h" -#endif - -#define STARTING_SEQUENCE "" -#define DEFAULT_ERROR_MSG "[an error occurred while processing this directive]" -#define DEFAULT_TIME_FORMAT "%A, %d-%b-%Y %H:%M:%S %Z" -#define SIZEFMT_BYTES 0 -#define SIZEFMT_KMG 1 -#ifdef CHARSET_EBCDIC -#define RAW_ASCII_CHAR(ch) os_toebcdic[(unsigned char)ch] -#else /*CHARSET_EBCDIC*/ -#define RAW_ASCII_CHAR(ch) (ch) -#endif /*CHARSET_EBCDIC*/ - -module MODULE_VAR_EXPORT includes_module; - -/* just need some arbitrary non-NULL pointer which can't also be a request_rec */ -#define NESTED_INCLUDE_MAGIC (&includes_module) - -/* ------------------------ Environment function -------------------------- */ - -/* XXX: could use ap_table_overlap here */ -static void add_include_vars(request_rec *r, char *timefmt) -{ -#ifndef WIN32 - struct passwd *pw; -#endif /* ndef WIN32 */ - table *e = r->subprocess_env; - char *t; - time_t date = r->request_time; - - ap_table_setn(e, "DATE_LOCAL", ap_ht_time(r->pool, date, timefmt, 0)); - ap_table_setn(e, "DATE_GMT", ap_ht_time(r->pool, date, timefmt, 1)); - ap_table_setn(e, "LAST_MODIFIED", - ap_ht_time(r->pool, r->finfo.st_mtime, timefmt, 0)); - ap_table_setn(e, "DOCUMENT_URI", r->uri); - ap_table_setn(e, "DOCUMENT_PATH_INFO", r->path_info); -#ifndef WIN32 - pw = getpwuid(r->finfo.st_uid); - if (pw) { - ap_table_setn(e, "USER_NAME", ap_pstrdup(r->pool, pw->pw_name)); - } - else { - ap_table_setn(e, "USER_NAME", ap_psprintf(r->pool, "user#%lu", - (unsigned long) r->finfo.st_uid)); - } -#endif /* ndef WIN32 */ - - if ((t = strrchr(r->filename, '/'))) { - ap_table_setn(e, "DOCUMENT_NAME", ++t); - } - else { - ap_table_setn(e, "DOCUMENT_NAME", r->uri); - } - if (r->args) { - char *arg_copy = ap_pstrdup(r->pool, r->args); - - ap_unescape_url(arg_copy); - ap_table_setn(e, "QUERY_STRING_UNESCAPED", - ap_escape_shell_cmd(r->pool, arg_copy)); - } -} - - - -/* --------------------------- Parser functions --------------------------- */ - -#define OUTBUFSIZE 4096 -/* PUT_CHAR and FLUSH_BUF currently only work within the scope of - * find_string(); they are hacks to avoid calling rputc for each and - * every character output. A common set of buffering calls for this - * type of output SHOULD be implemented. - */ -#define PUT_CHAR(c,r) \ - { \ - outbuf[outind++] = c; \ - if (outind == OUTBUFSIZE) { \ - FLUSH_BUF(r) \ - }; \ - } - -/* there SHOULD be some error checking on the return value of - * rwrite, however it is unclear what the API for rwrite returning - * errors is and little can really be done to help the error in - * any case. - */ -#define FLUSH_BUF(r) \ - { \ - ap_rwrite(outbuf, outind, r); \ - outind = 0; \ - } - -/* - * f: file handle being read from - * c: character to read into - * ret: return value to use if input fails - * r: current request_rec - * - * This macro is redefined after find_string() for historical reasons - * to avoid too many code changes. This is one of the many things - * that should be fixed. - */ -#define GET_CHAR(f,c,ret,r) \ - { \ - int i = getc(f); \ - if (i == EOF) { /* either EOF or error -- needs error handling if latter */ \ - if (ferror(f)) { \ - fprintf(stderr, "encountered error in GET_CHAR macro, " \ - "mod_include.\n"); \ - } \ - FLUSH_BUF(r); \ - ap_pfclose(r->pool, f); \ - return ret; \ - } \ - c = (char)i; \ - } - -static int find_string(FILE *in, const char *str, request_rec *r, int printing) -{ - int x, l = strlen(str), p; - char outbuf[OUTBUFSIZE]; - int outind = 0; - char c; - - p = 0; - while (1) { - GET_CHAR(in, c, 1, r); - if (c == str[p]) { - if ((++p) == l) { - FLUSH_BUF(r); - return 0; - } - } - else { - if (printing) { - for (x = 0; x < p; x++) { - PUT_CHAR(str[x], r); - } - PUT_CHAR(c, r); - } - p = 0; - } - } -} - -#undef FLUSH_BUF -#undef PUT_CHAR -#undef GET_CHAR -#define GET_CHAR(f,c,r,p) \ - { \ - int i = getc(f); \ - if (i == EOF) { /* either EOF or error -- needs error handling if latter */ \ - if (ferror(f)) { \ - fprintf(stderr, "encountered error in GET_CHAR macro, " \ - "mod_include.\n"); \ - } \ - ap_pfclose(p, f); \ - return r; \ - } \ - c = (char)i; \ - } - -/* - * decodes a string containing html entities or numeric character references. - * 's' is overwritten with the decoded string. - * If 's' is syntatically incorrect, then the followed fixups will be made: - * unknown entities will be left undecoded; - * references to unused numeric characters will be deleted. - * In particular, � will not be decoded, but will be deleted. - * - * drtr - */ - -/* maximum length of any ISO-LATIN-1 HTML entity name. */ -#define MAXENTLEN (6) - -/* The following is a shrinking transformation, therefore safe. */ - -static void decodehtml(char *s) -{ - int val, i, j; - char *p = s; - const char *ents; - static const char * const entlist[MAXENTLEN + 1] = - { - NULL, /* 0 */ - NULL, /* 1 */ - "lt\074gt\076", /* 2 */ - "amp\046ETH\320eth\360", /* 3 */ - "quot\042Auml\304Euml\313Iuml\317Ouml\326Uuml\334auml\344euml\353\ -iuml\357ouml\366uuml\374yuml\377", /* 4 */ - "Acirc\302Aring\305AElig\306Ecirc\312Icirc\316Ocirc\324Ucirc\333\ -THORN\336szlig\337acirc\342aring\345aelig\346ecirc\352icirc\356ocirc\364\ -ucirc\373thorn\376", /* 5 */ - "Agrave\300Aacute\301Atilde\303Ccedil\307Egrave\310Eacute\311\ -Igrave\314Iacute\315Ntilde\321Ograve\322Oacute\323Otilde\325Oslash\330\ -Ugrave\331Uacute\332Yacute\335agrave\340aacute\341atilde\343ccedil\347\ -egrave\350eacute\351igrave\354iacute\355ntilde\361ograve\362oacute\363\ -otilde\365oslash\370ugrave\371uacute\372yacute\375" /* 6 */ - }; - - for (; *s != '\0'; s++, p++) { - if (*s != '&') { - *p = *s; - continue; - } - /* find end of entity */ - for (i = 1; s[i] != ';' && s[i] != '\0'; i++) { - continue; - } - - if (s[i] == '\0') { /* treat as normal data */ - *p = *s; - continue; - } - - /* is it numeric ? */ - if (s[1] == '#') { - for (j = 2, val = 0; j < i && ap_isdigit(s[j]); j++) { - val = val * 10 + s[j] - '0'; - } - s += i; - if (j < i || val <= 8 || (val >= 11 && val <= 31) || - (val >= 127 && val <= 160) || val >= 256) { - p--; /* no data to output */ - } - else { - *p = RAW_ASCII_CHAR(val); - } - } - else { - j = i - 1; - if (j > MAXENTLEN || entlist[j] == NULL) { - /* wrong length */ - *p = '&'; - continue; /* skip it */ - } - for (ents = entlist[j]; *ents != '\0'; ents += i) { - if (strncmp(s + 1, ents, j) == 0) { - break; - } - } - - if (*ents == '\0') { - *p = '&'; /* unknown */ - } - else { - *p = RAW_ASCII_CHAR(((const unsigned char *) ents)[j]); - s += i; - } - } - } - - *p = '\0'; -} - -/* - * extract the next tag name and value. - * if there are no more tags, set the tag name to 'done' - * the tag value is html decoded if dodecode is non-zero - */ - -static char *get_tag(pool *p, FILE *in, char *tag, int tagbuf_len, int dodecode) -{ - char *t = tag, *tag_val, c, term; - - /* makes code below a little less cluttered */ - --tagbuf_len; - - do { /* skip whitespace */ - GET_CHAR(in, c, NULL, p); - } while (ap_isspace(c)); - - /* tags can't start with - */ - if (c == '-') { - GET_CHAR(in, c, NULL, p); - if (c == '-') { - do { - GET_CHAR(in, c, NULL, p); - } while (ap_isspace(c)); - if (c == '>') { - ap_cpystrn(tag, "done", tagbuf_len); - return tag; - } - } - return NULL; /* failed */ - } - - /* find end of tag name */ - while (1) { - if (t - tag == tagbuf_len) { - *t = '\0'; - return NULL; - } - if (c == '=' || ap_isspace(c)) { - break; - } - *(t++) = ap_tolower(c); - GET_CHAR(in, c, NULL, p); - } - - *t++ = '\0'; - tag_val = t; - - while (ap_isspace(c)) { - GET_CHAR(in, c, NULL, p); /* space before = */ - } - if (c != '=') { - ungetc(c, in); - return NULL; - } - - do { - GET_CHAR(in, c, NULL, p); /* space after = */ - } while (ap_isspace(c)); - - /* we should allow a 'name' as a value */ - - if (c != '"' && c != '\'') { - return NULL; - } - term = c; - while (1) { - GET_CHAR(in, c, NULL, p); - if (t - tag == tagbuf_len) { - *t = '\0'; - return NULL; - } -/* Want to accept \" as a valid character within a string. */ - if (c == '\\') { - *(t++) = c; /* Add backslash */ - GET_CHAR(in, c, NULL, p); - if (c == term) { /* Only if */ - *(--t) = c; /* Replace backslash ONLY for terminator */ - } - } - else if (c == term) { - break; - } - *(t++) = c; - } - *t = '\0'; - if (dodecode) { - decodehtml(tag_val); - } - return ap_pstrdup(p, tag_val); -} - -static int get_directive(FILE *in, char *dest, size_t len, pool *p) -{ - char *d = dest; - char c; - - /* make room for nul terminator */ - --len; - - /* skip initial whitespace */ - while (1) { - GET_CHAR(in, c, 1, p); - if (!ap_isspace(c)) { - break; - } - } - /* now get directive */ - while (1) { - if (d - dest == len) { - return 1; - } - *d++ = ap_tolower(c); - GET_CHAR(in, c, 1, p); - if (ap_isspace(c)) { - break; - } - } - *d = '\0'; - return 0; -} - -/* - * Do variable substitution on strings - */ -static void parse_string(request_rec *r, const char *in, char *out, - size_t length, int leave_name) -{ - char ch; - char *next = out; - char *end_out; - - /* leave room for nul terminator */ - end_out = out + length - 1; - - while ((ch = *in++) != '\0') { - switch (ch) { - case '\\': - if (next == end_out) { - /* truncated */ - *next = '\0'; - return; - } - if (*in == '$') { - *next++ = *in++; - } - else { - *next++ = ch; - } - break; - case '$': - { - char var[MAX_STRING_LEN]; - const char *start_of_var_name; - const char *end_of_var_name; /* end of var name + 1 */ - const char *expansion; - const char *val; - size_t l; - - /* guess that the expansion won't happen */ - expansion = in - 1; - if (*in == '{') { - ++in; - start_of_var_name = in; - in = strchr(in, '}'); - if (in == NULL) { - ap_log_rerror(APLOG_MARK, APLOG_NOERRNO|APLOG_ERR, - r, "Missing '}' on variable \"%s\"", - expansion); - *next = '\0'; - return; - } - end_of_var_name = in; - ++in; - } - else { - start_of_var_name = in; - while (ap_isalnum(*in) || *in == '_') { - ++in; - } - end_of_var_name = in; - } - /* what a pain, too bad there's no table_getn where you can - * pass a non-nul terminated string */ - l = end_of_var_name - start_of_var_name; - if (l != 0) { - l = (l > sizeof(var) - 1) ? (sizeof(var) - 1) : l; - memcpy(var, start_of_var_name, l); - var[l] = '\0'; - - val = ap_table_get(r->subprocess_env, var); - if (val) { - expansion = val; - l = strlen(expansion); - } - else if (leave_name) { - l = in - expansion; - } - else { - break; /* no expansion to be done */ - } - } - else { - /* zero-length variable name causes just the $ to be copied */ - l = 1; - } - l = (l > end_out - next) ? (end_out - next) : l; - memcpy(next, expansion, l); - next += l; - break; - } - default: - if (next == end_out) { - /* truncated */ - *next = '\0'; - return; - } - *next++ = ch; - break; - } - } - *next = '\0'; - return; -} - -/* --------------------------- Action handlers ---------------------------- */ - -static int include_cgi(char *s, request_rec *r) -{ - request_rec *rr = ap_sub_req_lookup_uri(s, r); - int rr_status; - - if (rr->status != HTTP_OK) { - return -1; - } - - /* No hardwired path info or query allowed */ - - if ((rr->path_info && rr->path_info[0]) || rr->args) { - return -1; - } - if (rr->finfo.st_mode == 0) { - return -1; - } - - /* Script gets parameters of the *document*, for back compatibility */ - - rr->path_info = r->path_info; /* hard to get right; see mod_cgi.c */ - rr->args = r->args; - - /* Force sub_req to be treated as a CGI request, even if ordinary - * typing rules would have called it something else. - */ - - rr->content_type = CGI_MAGIC_TYPE; - - /* Run it. */ - - rr_status = ap_run_sub_req(rr); - if (ap_is_HTTP_REDIRECT(rr_status)) { - const char *location = ap_table_get(rr->headers_out, "Location"); - location = ap_escape_html(rr->pool, location); - ap_rvputs(r, "", location, "", NULL); - } - - ap_destroy_sub_req(rr); -#ifndef WIN32 - ap_chdir_file(r->filename); -#endif - - return 0; -} - -/* ensure that path is relative, and does not contain ".." elements - * ensentially ensure that it does not match the regex: - * (^/|(^|/)\.\.(/|$)) - * XXX: this needs os abstraction... consider c:..\foo in win32 - */ -static int is_only_below(const char *path) -{ -#ifdef HAVE_DRIVE_LETTERS - if (path[1] == ':') - return 0; -#endif - if (path[0] == '/') { - return 0; - } - if (path[0] == '.' && path[1] == '.' - && (path[2] == '\0' || path[2] == '/')) { - return 0; - } - while (*path) { - if (*path == '/' && path[1] == '.' && path[2] == '.' - && (path[3] == '\0' || path[3] == '/')) { - return 0; - } - ++path; - } - return 1; -} - -static int handle_include(FILE *in, request_rec *r, const char *error, int noexec) -{ - char tag[MAX_STRING_LEN]; - char parsed_string[MAX_STRING_LEN]; - char *tag_val; - - while (1) { - if (!(tag_val = get_tag(r->pool, in, tag, sizeof(tag), 1))) { - return 1; - } - if (!strcmp(tag, "file") || !strcmp(tag, "virtual")) { - request_rec *rr = NULL; - char *error_fmt = NULL; - - parse_string(r, tag_val, parsed_string, sizeof(parsed_string), 0); - if (tag[0] == 'f') { - /* be safe; only files in this directory or below allowed */ - if (!is_only_below(parsed_string)) { - error_fmt = "unable to include file \"%s\" " - "in parsed file %s"; - } - else { - rr = ap_sub_req_lookup_file(parsed_string, r); - } - } - else { - rr = ap_sub_req_lookup_uri(parsed_string, r); - } - - if (!error_fmt && rr->status != HTTP_OK) { - error_fmt = "unable to include \"%s\" in parsed file %s"; - } - - if (!error_fmt && noexec && rr->content_type - && (strncmp(rr->content_type, "text/", 5))) { - error_fmt = "unable to include potential exec \"%s\" " - "in parsed file %s"; - } - if (error_fmt == NULL) { - /* try to avoid recursive includes. We do this by walking - * up the r->main list of subrequests, and at each level - * walking back through any internal redirects. At each - * step, we compare the filenames and the URIs. - * - * The filename comparison catches a recursive include - * with an ever-changing URL, eg. - * - * which, although they would eventually be caught because - * we have a limit on the length of files, etc., can - * recurse for a while. - * - * The URI comparison catches the case where the filename - * is changed while processing the request, so the - * current name is never the same as any previous one. - * This can happen with "DocumentRoot /foo" when you - * request "/" on the server and it includes "/". - * This only applies to modules such as mod_dir that - * (somewhat improperly) mess with r->filename outside - * of a filename translation phase. - */ - int founddupe = 0; - request_rec *p; - for (p = r; p != NULL && !founddupe; p = p->main) { - request_rec *q; - for (q = p; q != NULL; q = q->prev) { - if ( (strcmp(q->filename, rr->filename) == 0) || - (strcmp(q->uri, rr->uri) == 0) ){ - founddupe = 1; - break; - } - } - } - - if (p != NULL) { - error_fmt = "Recursive include of \"%s\" " - "in parsed file %s"; - } - } - - /* see the Kludge in send_parsed_file for why */ - if (rr) - ap_set_module_config(rr->request_config, &includes_module, r); - - if (!error_fmt && ap_run_sub_req(rr)) { - error_fmt = "unable to include \"%s\" in parsed file %s"; - } -#ifndef WIN32 - ap_chdir_file(r->filename); -#endif - if (error_fmt) { - ap_log_rerror(APLOG_MARK, APLOG_NOERRNO|APLOG_ERR, - r, error_fmt, tag_val, r->filename); - ap_rputs(error, r); - } - - /* destroy the sub request if it's not a nested include */ - if (rr != NULL - && ap_get_module_config(rr->request_config, &includes_module) - != NESTED_INCLUDE_MAGIC) { - ap_destroy_sub_req(rr); - } - } - else if (!strcmp(tag, "done")) { - return 0; - } - else { - ap_log_rerror(APLOG_MARK, APLOG_NOERRNO|APLOG_ERR, r, - "unknown parameter \"%s\" to tag include in %s", - tag, r->filename); - ap_rputs(error, r); - } - } -} - -typedef struct { -#ifdef TPF - TPF_FORK_CHILD t; -#endif - request_rec *r; - char *s; -} include_cmd_arg; - -static int include_cmd_child(void *arg, child_info *pinfo) -{ - request_rec *r = ((include_cmd_arg *) arg)->r; - char *s = ((include_cmd_arg *) arg)->s; - table *env = r->subprocess_env; - int child_pid = 0; -#ifdef DEBUG_INCLUDE_CMD -#ifdef OS2 - /* under OS/2 /dev/tty is referenced as con */ - FILE *dbg = fopen("con", "w"); -#else - FILE *dbg = fopen("/dev/tty", "w"); -#endif -#endif -#ifndef WIN32 - char err_string[MAX_STRING_LEN]; -#endif - -#ifdef DEBUG_INCLUDE_CMD - fprintf(dbg, "Attempting to include command '%s'\n", s); -#endif - - if (r->path_info && r->path_info[0] != '\0') { - request_rec *pa_req; - - ap_table_setn(env, "PATH_INFO", ap_escape_shell_cmd(r->pool, r->path_info)); - - pa_req = ap_sub_req_lookup_uri(ap_escape_uri(r->pool, r->path_info), r); - if (pa_req->filename) { - ap_table_setn(env, "PATH_TRANSLATED", - ap_pstrcat(r->pool, pa_req->filename, pa_req->path_info, - NULL)); - } - } - - if (r->args) { - char *arg_copy = ap_pstrdup(r->pool, r->args); - - ap_table_setn(env, "QUERY_STRING", r->args); - ap_unescape_url(arg_copy); - ap_table_setn(env, "QUERY_STRING_UNESCAPED", - ap_escape_shell_cmd(r->pool, arg_copy)); - } - - ap_error_log2stderr(r->server); - -#ifdef DEBUG_INCLUDE_CMD - fprintf(dbg, "Attempting to exec '%s'\n", s); -#endif -#ifdef TPF - return (0); -#else - ap_cleanup_for_exec(); - /* set shellcmd flag to pass arg to SHELL_PATH */ - child_pid = ap_call_exec(r, pinfo, s, ap_create_environment(r->pool, env), - 1); -#if defined(WIN32) || defined(OS2) - return (child_pid); -#else - /* Oh, drat. We're still here. The log file descriptors are closed, - * so we have to whimper a complaint onto stderr... - */ - -#ifdef DEBUG_INCLUDE_CMD - fprintf(dbg, "Exec failed\n"); -#endif - ap_snprintf(err_string, sizeof(err_string), - "exec of %s failed, reason: %s (errno = %d)\n", - SHELL_PATH, strerror(errno), errno); - write(STDERR_FILENO, err_string, strlen(err_string)); - exit(0); - /* NOT REACHED */ - return (child_pid); -#endif /* WIN32 */ -#endif /* TPF */ -} - -static int include_cmd(char *s, request_rec *r) -{ - include_cmd_arg arg; - BUFF *script_in; - - arg.r = r; - arg.s = s; -#ifdef TPF - arg.t.filename = r->filename; - arg.t.subprocess_env = r->subprocess_env; - arg.t.prog_type = FORK_FILE; -#endif - - if (!ap_bspawn_child(r->pool, include_cmd_child, &arg, - kill_after_timeout, NULL, &script_in, NULL)) { - ap_log_rerror(APLOG_MARK, APLOG_ERR, r, - "couldn't spawn include command"); - return -1; - } - - ap_send_fb(script_in, r); - ap_bclose(script_in); - return 0; -} - -static int handle_exec(FILE *in, request_rec *r, const char *error) -{ - char tag[MAX_STRING_LEN]; - char *tag_val; - char *file = r->filename; - char parsed_string[MAX_STRING_LEN]; - - while (1) { - if (!(tag_val = get_tag(r->pool, in, tag, sizeof(tag), 1))) { - return 1; - } - if (!strcmp(tag, "cmd")) { - parse_string(r, tag_val, parsed_string, sizeof(parsed_string), 1); - if (include_cmd(parsed_string, r) == -1) { - ap_log_rerror(APLOG_MARK, APLOG_NOERRNO|APLOG_ERR, r, - "execution failure for parameter \"%s\" " - "to tag exec in file %s", - tag, r->filename); - ap_rputs(error, r); - } - /* just in case some stooge changed directories */ -#ifndef WIN32 - ap_chdir_file(r->filename); -#endif - } - else if (!strcmp(tag, "cgi")) { - parse_string(r, tag_val, parsed_string, sizeof(parsed_string), 0); - if (include_cgi(parsed_string, r) == -1) { - ap_log_rerror(APLOG_MARK, APLOG_NOERRNO|APLOG_ERR, r, - "invalid CGI ref \"%s\" in %s", tag_val, file); - ap_rputs(error, r); - } - /* grumble groan */ -#ifndef WIN32 - ap_chdir_file(r->filename); -#endif - } - else if (!strcmp(tag, "done")) { - return 0; - } - else { - ap_log_rerror(APLOG_MARK, APLOG_NOERRNO|APLOG_ERR, r, - "unknown parameter \"%s\" to tag exec in %s", - tag, file); - ap_rputs(error, r); - } - } - -} - -static int handle_echo(FILE *in, request_rec *r, const char *error) -{ - char tag[MAX_STRING_LEN]; - char *tag_val; - - while (1) { - if (!(tag_val = get_tag(r->pool, in, tag, sizeof(tag), 1))) { - return 1; - } - if (!strcmp(tag, "var")) { - const char *val = ap_table_get(r->subprocess_env, tag_val); - - if (val) { - ap_rputs(val, r); - } - else { - ap_rputs("(none)", r); - } - } - else if (!strcmp(tag, "done")) { - return 0; - } - else { - ap_log_rerror(APLOG_MARK, APLOG_NOERRNO|APLOG_ERR, r, - "unknown parameter \"%s\" to tag echo in %s", - tag, r->filename); - ap_rputs(error, r); - } - } -} - -#ifdef USE_PERL_SSI -static int handle_perl(FILE *in, request_rec *r, const char *error) -{ - char tag[MAX_STRING_LEN]; - char parsed_string[MAX_STRING_LEN]; - char *tag_val; - SV *sub = Nullsv; - AV *av = newAV(); - - if (ap_allow_options(r) & OPT_INCNOEXEC) { - ap_log_rerror(APLOG_MARK, APLOG_NOERRNO|APLOG_ERR, r, - "#perl SSI disallowed by IncludesNoExec in %s", - r->filename); - return DECLINED; - } - while (1) { - if (!(tag_val = get_tag(r->pool, in, tag, sizeof(tag), 1))) { - break; - } - if (strnEQ(tag, "sub", 3)) { - sub = newSVpv(tag_val, 0); - } - else if (strnEQ(tag, "arg", 3)) { - parse_string(r, tag_val, parsed_string, sizeof(parsed_string), 0); - av_push(av, newSVpv(parsed_string, 0)); - } - else if (strnEQ(tag, "done", 4)) { - break; - } - } - perl_stdout2client(r); - perl_setup_env(r); - perl_call_handler(sub, r, av); - return OK; -} -#endif - -/* error and tf must point to a string with room for at - * least MAX_STRING_LEN characters - */ -static int handle_config(FILE *in, request_rec *r, char *error, char *tf, - int *sizefmt) -{ - char tag[MAX_STRING_LEN]; - char *tag_val; - char parsed_string[MAX_STRING_LEN]; - table *env = r->subprocess_env; - - while (1) { - if (!(tag_val = get_tag(r->pool, in, tag, sizeof(tag), 0))) { - return 1; - } - if (!strcmp(tag, "errmsg")) { - parse_string(r, tag_val, error, MAX_STRING_LEN, 0); - } - else if (!strcmp(tag, "timefmt")) { - time_t date = r->request_time; - - parse_string(r, tag_val, tf, MAX_STRING_LEN, 0); - ap_table_setn(env, "DATE_LOCAL", ap_ht_time(r->pool, date, tf, 0)); - ap_table_setn(env, "DATE_GMT", ap_ht_time(r->pool, date, tf, 1)); - ap_table_setn(env, "LAST_MODIFIED", - ap_ht_time(r->pool, r->finfo.st_mtime, tf, 0)); - } - else if (!strcmp(tag, "sizefmt")) { - parse_string(r, tag_val, parsed_string, sizeof(parsed_string), 0); - decodehtml(parsed_string); - if (!strcmp(parsed_string, "bytes")) { - *sizefmt = SIZEFMT_BYTES; - } - else if (!strcmp(parsed_string, "abbrev")) { - *sizefmt = SIZEFMT_KMG; - } - } - else if (!strcmp(tag, "done")) { - return 0; - } - else { - ap_log_rerror(APLOG_MARK, APLOG_NOERRNO|APLOG_ERR, r, - "unknown parameter \"%s\" to tag config in %s", - tag, r->filename); - ap_rputs(error, r); - } - } -} - - -static int find_file(request_rec *r, const char *directive, const char *tag, - char *tag_val, struct stat *finfo, const char *error) -{ - char *to_send = tag_val; - request_rec *rr = NULL; - int ret=0; - char *error_fmt = NULL; - - if (!strcmp(tag, "file")) { - /* be safe; only files in this directory or below allowed */ - if (!is_only_below(tag_val)) { - error_fmt = "unable to access file \"%s\" " - "in parsed file %s"; - } - else { - ap_getparents(tag_val); /* get rid of any nasties */ - rr = ap_sub_req_lookup_file(tag_val, r); - - if (rr->status == HTTP_OK && rr->finfo.st_mode != 0) { - to_send = rr->filename; - if (stat(to_send, finfo)) { - error_fmt = "unable to get information about \"%s\" " - "in parsed file %s"; - } - } - else { - error_fmt = "unable to lookup information about \"%s\" " - "in parsed file %s"; - } - } - - if (error_fmt) { - ret = -1; - ap_log_rerror(APLOG_MARK, APLOG_ERR, r, error_fmt, to_send, r->filename); - ap_rputs(error, r); - } - - if (rr) ap_destroy_sub_req(rr); - - return ret; - } - else if (!strcmp(tag, "virtual")) { - rr = ap_sub_req_lookup_uri(tag_val, r); - - if (rr->status == HTTP_OK && rr->finfo.st_mode != 0) { - memcpy((char *) finfo, (const char *) &rr->finfo, - sizeof(struct stat)); - ap_destroy_sub_req(rr); - return 0; - } - else { - ap_log_rerror(APLOG_MARK, APLOG_NOERRNO|APLOG_ERR, r, - "unable to get information about \"%s\" " - "in parsed file %s", - tag_val, r->filename); - ap_rputs(error, r); - ap_destroy_sub_req(rr); - return -1; - } - } - else { - ap_log_rerror(APLOG_MARK, APLOG_NOERRNO|APLOG_ERR, r, - "unknown parameter \"%s\" to tag %s in %s", - tag, directive, r->filename); - ap_rputs(error, r); - return -1; - } -} - - -static int handle_fsize(FILE *in, request_rec *r, const char *error, int sizefmt) -{ - char tag[MAX_STRING_LEN]; - char *tag_val; - struct stat finfo; - char parsed_string[MAX_STRING_LEN]; - - while (1) { - if (!(tag_val = get_tag(r->pool, in, tag, sizeof(tag), 1))) { - return 1; - } - else if (!strcmp(tag, "done")) { - return 0; - } - else { - parse_string(r, tag_val, parsed_string, sizeof(parsed_string), 0); - if (!find_file(r, "fsize", tag, parsed_string, &finfo, error)) { - if (sizefmt == SIZEFMT_KMG) { - ap_send_size(finfo.st_size, r); - } - else { - int l, x; -#if defined(AP_OFF_T_IS_QUAD) - ap_snprintf(tag, sizeof(tag), "%qd", finfo.st_size); -#else - ap_snprintf(tag, sizeof(tag), "%ld", finfo.st_size); -#endif - l = strlen(tag); /* grrr */ - for (x = 0; x < l; x++) { - if (x && (!((l - x) % 3))) { - ap_rputc(',', r); - } - ap_rputc(tag[x], r); - } - } - } - } - } -} - -static int handle_flastmod(FILE *in, request_rec *r, const char *error, const char *tf) -{ - char tag[MAX_STRING_LEN]; - char *tag_val; - struct stat finfo; - char parsed_string[MAX_STRING_LEN]; - - while (1) { - if (!(tag_val = get_tag(r->pool, in, tag, sizeof(tag), 1))) { - return 1; - } - else if (!strcmp(tag, "done")) { - return 0; - } - else { - parse_string(r, tag_val, parsed_string, sizeof(parsed_string), 0); - if (!find_file(r, "flastmod", tag, parsed_string, &finfo, error)) { - ap_rputs(ap_ht_time(r->pool, finfo.st_mtime, tf, 0), r); - } - } - } -} - -static int re_check(request_rec *r, char *string, char *rexp) -{ - regex_t *compiled; - int regex_error; - - compiled = ap_pregcomp(r->pool, rexp, REG_EXTENDED | REG_NOSUB); - if (compiled == NULL) { - ap_log_rerror(APLOG_MARK, APLOG_NOERRNO|APLOG_ERR, r, - "unable to compile pattern \"%s\"", rexp); - return -1; - } - regex_error = ap_regexec(compiled, string, 0, (regmatch_t *) NULL, 0); - ap_pregfree(r->pool, compiled); - return (!regex_error); -} - -enum token_type { - token_string, - token_and, token_or, token_not, token_eq, token_ne, - token_rbrace, token_lbrace, token_group, - token_ge, token_le, token_gt, token_lt -}; -struct token { - enum token_type type; - char value[MAX_STRING_LEN]; -}; - -/* there is an implicit assumption here that string is at most MAX_STRING_LEN-1 - * characters long... - */ -static const char *get_ptoken(request_rec *r, const char *string, struct token *token) -{ - char ch; - int next = 0; - int qs = 0; - - /* Skip leading white space */ - if (string == (char *) NULL) { - return (char *) NULL; - } - while ((ch = *string++)) { - if (!ap_isspace(ch)) { - break; - } - } - if (ch == '\0') { - return (char *) NULL; - } - - token->type = token_string; /* the default type */ - switch (ch) { - case '(': - token->type = token_lbrace; - return (string); - case ')': - token->type = token_rbrace; - return (string); - case '=': - token->type = token_eq; - return (string); - case '!': - if (*string == '=') { - token->type = token_ne; - return (string + 1); - } - else { - token->type = token_not; - return (string); - } - case '\'': - token->type = token_string; - qs = 1; - break; - case '|': - if (*string == '|') { - token->type = token_or; - return (string + 1); - } - break; - case '&': - if (*string == '&') { - token->type = token_and; - return (string + 1); - } - break; - case '>': - if (*string == '=') { - token->type = token_ge; - return (string + 1); - } - else { - token->type = token_gt; - return (string); - } - case '<': - if (*string == '=') { - token->type = token_le; - return (string + 1); - } - else { - token->type = token_lt; - return (string); - } - default: - token->type = token_string; - break; - } - /* We should only be here if we are in a string */ - if (!qs) { - token->value[next++] = ch; - } - - /* - * Yes I know that goto's are BAD. But, c doesn't allow me to - * exit a loop from a switch statement. Yes, I could use a flag, - * but that is (IMHO) even less readable/maintainable than the goto. - */ - /* - * I used the ++string throughout this section so that string - * ends up pointing to the next token and I can just return it - */ - for (ch = *string; ch != '\0'; ch = *++string) { - if (ch == '\\') { - if ((ch = *++string) == '\0') { - goto TOKEN_DONE; - } - token->value[next++] = ch; - continue; - } - if (!qs) { - if (ap_isspace(ch)) { - goto TOKEN_DONE; - } - switch (ch) { - case '(': - goto TOKEN_DONE; - case ')': - goto TOKEN_DONE; - case '=': - goto TOKEN_DONE; - case '!': - goto TOKEN_DONE; - case '|': - if (*(string + 1) == '|') { - goto TOKEN_DONE; - } - break; - case '&': - if (*(string + 1) == '&') { - goto TOKEN_DONE; - } - break; - case '<': - goto TOKEN_DONE; - case '>': - goto TOKEN_DONE; - } - token->value[next++] = ch; - } - else { - if (ch == '\'') { - qs = 0; - ++string; - goto TOKEN_DONE; - } - token->value[next++] = ch; - } - } - TOKEN_DONE: - /* If qs is still set, I have an unmatched ' */ - if (qs) { - ap_rputs("\nUnmatched '\n", r); - next = 0; - } - token->value[next] = '\0'; - return (string); -} - - -/* - * Hey I still know that goto's are BAD. I don't think that I've ever - * used two in the same project, let alone the same file before. But, - * I absolutely want to make sure that I clean up the memory in all - * cases. And, without rewriting this completely, the easiest way - * is to just branch to the return code which cleans it up. - */ -/* there is an implicit assumption here that expr is at most MAX_STRING_LEN-1 - * characters long... - */ -static int parse_expr(request_rec *r, const char *expr, const char *error) -{ - struct parse_node { - struct parse_node *left, *right, *parent; - struct token token; - int value, done; - } *root, *current, *new; - const char *parse; - char buffer[MAX_STRING_LEN]; - pool *expr_pool; - int retval = 0; - - if ((parse = expr) == (char *) NULL) { - return (0); - } - root = current = (struct parse_node *) NULL; - expr_pool = ap_make_sub_pool(r->pool); - - /* Create Parse Tree */ - while (1) { - new = (struct parse_node *) ap_palloc(expr_pool, - sizeof(struct parse_node)); - new->parent = new->left = new->right = (struct parse_node *) NULL; - new->done = 0; - if ((parse = get_ptoken(r, parse, &new->token)) == (char *) NULL) { - break; - } - switch (new->token.type) { - - case token_string: -#ifdef DEBUG_INCLUDE - ap_rvputs(r, " Token: string (", new->token.value, ")\n", NULL); -#endif - if (current == (struct parse_node *) NULL) { - root = current = new; - break; - } - switch (current->token.type) { - case token_string: - if (current->token.value[0] != '\0') { - strncat(current->token.value, " ", - sizeof(current->token.value) - - strlen(current->token.value) - 1); - } - strncat(current->token.value, new->token.value, - sizeof(current->token.value) - - strlen(current->token.value) - 1); - current->token.value[sizeof(current->token.value) - 1] = '\0'; - break; - case token_eq: - case token_ne: - case token_and: - case token_or: - case token_lbrace: - case token_not: - case token_ge: - case token_gt: - case token_le: - case token_lt: - new->parent = current; - current = current->right = new; - break; - default: - ap_log_rerror(APLOG_MARK, APLOG_NOERRNO|APLOG_ERR, r, - "Invalid expression \"%s\" in file %s", - expr, r->filename); - ap_rputs(error, r); - goto RETURN; - } - break; - - case token_and: - case token_or: -#ifdef DEBUG_INCLUDE - ap_rputs(" Token: and/or\n", r); -#endif - if (current == (struct parse_node *) NULL) { - ap_log_rerror(APLOG_MARK, APLOG_NOERRNO|APLOG_ERR, r, - "Invalid expression \"%s\" in file %s", - expr, r->filename); - ap_rputs(error, r); - goto RETURN; - } - /* Percolate upwards */ - while (current != (struct parse_node *) NULL) { - switch (current->token.type) { - case token_string: - case token_group: - case token_not: - case token_eq: - case token_ne: - case token_and: - case token_or: - case token_ge: - case token_gt: - case token_le: - case token_lt: - current = current->parent; - continue; - case token_lbrace: - break; - default: - ap_log_rerror(APLOG_MARK, APLOG_NOERRNO|APLOG_ERR, r, - "Invalid expression \"%s\" in file %s", - expr, r->filename); - ap_rputs(error, r); - goto RETURN; - } - break; - } - if (current == (struct parse_node *) NULL) { - new->left = root; - new->left->parent = new; - new->parent = (struct parse_node *) NULL; - root = new; - } - else { - new->left = current->right; - current->right = new; - new->parent = current; - } - current = new; - break; - - case token_not: -#ifdef DEBUG_INCLUDE - ap_rputs(" Token: not\n", r); -#endif - if (current == (struct parse_node *) NULL) { - root = current = new; - break; - } - /* Percolate upwards */ - while (current != (struct parse_node *) NULL) { - switch (current->token.type) { - case token_not: - case token_eq: - case token_ne: - case token_and: - case token_or: - case token_lbrace: - case token_ge: - case token_gt: - case token_le: - case token_lt: - break; - default: - ap_log_rerror(APLOG_MARK, APLOG_NOERRNO|APLOG_ERR, r, - "Invalid expression \"%s\" in file %s", - expr, r->filename); - ap_rputs(error, r); - goto RETURN; - } - break; - } - if (current == (struct parse_node *) NULL) { - new->left = root; - new->left->parent = new; - new->parent = (struct parse_node *) NULL; - root = new; - } - else { - new->left = current->right; - current->right = new; - new->parent = current; - } - current = new; - break; - - case token_eq: - case token_ne: - case token_ge: - case token_gt: - case token_le: - case token_lt: -#ifdef DEBUG_INCLUDE - ap_rputs(" Token: eq/ne/ge/gt/le/lt\n", r); -#endif - if (current == (struct parse_node *) NULL) { - ap_log_rerror(APLOG_MARK, APLOG_NOERRNO|APLOG_ERR, r, - "Invalid expression \"%s\" in file %s", - expr, r->filename); - ap_rputs(error, r); - goto RETURN; - } - /* Percolate upwards */ - while (current != (struct parse_node *) NULL) { - switch (current->token.type) { - case token_string: - case token_group: - current = current->parent; - continue; - case token_lbrace: - case token_and: - case token_or: - break; - case token_not: - case token_eq: - case token_ne: - case token_ge: - case token_gt: - case token_le: - case token_lt: - default: - ap_log_rerror(APLOG_MARK, APLOG_NOERRNO|APLOG_ERR, r, - "Invalid expression \"%s\" in file %s", - expr, r->filename); - ap_rputs(error, r); - goto RETURN; - } - break; - } - if (current == (struct parse_node *) NULL) { - new->left = root; - new->left->parent = new; - new->parent = (struct parse_node *) NULL; - root = new; - } - else { - new->left = current->right; - current->right = new; - new->parent = current; - } - current = new; - break; - - case token_rbrace: -#ifdef DEBUG_INCLUDE - ap_rputs(" Token: rbrace\n", r); -#endif - while (current != (struct parse_node *) NULL) { - if (current->token.type == token_lbrace) { - current->token.type = token_group; - break; - } - current = current->parent; - } - if (current == (struct parse_node *) NULL) { - ap_log_rerror(APLOG_MARK, APLOG_NOERRNO|APLOG_ERR, r, - "Unmatched ')' in \"%s\" in file %s", - expr, r->filename); - ap_rputs(error, r); - goto RETURN; - } - break; - - case token_lbrace: -#ifdef DEBUG_INCLUDE - ap_rputs(" Token: lbrace\n", r); -#endif - if (current == (struct parse_node *) NULL) { - root = current = new; - break; - } - /* Percolate upwards */ - while (current != (struct parse_node *) NULL) { - switch (current->token.type) { - case token_not: - case token_eq: - case token_ne: - case token_and: - case token_or: - case token_lbrace: - case token_ge: - case token_gt: - case token_le: - case token_lt: - break; - case token_string: - case token_group: - default: - ap_log_rerror(APLOG_MARK, APLOG_NOERRNO|APLOG_ERR, r, - "Invalid expression \"%s\" in file %s", - expr, r->filename); - ap_rputs(error, r); - goto RETURN; - } - break; - } - if (current == (struct parse_node *) NULL) { - new->left = root; - new->left->parent = new; - new->parent = (struct parse_node *) NULL; - root = new; - } - else { - new->left = current->right; - current->right = new; - new->parent = current; - } - current = new; - break; - default: - break; - } - } - - /* Evaluate Parse Tree */ - current = root; - while (current != (struct parse_node *) NULL) { - switch (current->token.type) { - case token_string: -#ifdef DEBUG_INCLUDE - ap_rputs(" Evaluate string\n", r); -#endif - parse_string(r, current->token.value, buffer, sizeof(buffer), 0); - ap_cpystrn(current->token.value, buffer, sizeof(current->token.value)); - current->value = (current->token.value[0] != '\0'); - current->done = 1; - current = current->parent; - break; - - case token_and: - case token_or: -#ifdef DEBUG_INCLUDE - ap_rputs(" Evaluate and/or\n", r); -#endif - if (current->left == (struct parse_node *) NULL || - current->right == (struct parse_node *) NULL) { - ap_log_rerror(APLOG_MARK, APLOG_NOERRNO|APLOG_ERR, r, - "Invalid expression \"%s\" in file %s", - expr, r->filename); - ap_rputs(error, r); - goto RETURN; - } - if (!current->left->done) { - switch (current->left->token.type) { - case token_string: - parse_string(r, current->left->token.value, - buffer, sizeof(buffer), 0); - ap_cpystrn(current->left->token.value, buffer, - sizeof(current->left->token.value)); - current->left->value = (current->left->token.value[0] != '\0'); - current->left->done = 1; - break; - default: - current = current->left; - continue; - } - } - if (!current->right->done) { - switch (current->right->token.type) { - case token_string: - parse_string(r, current->right->token.value, - buffer, sizeof(buffer), 0); - ap_cpystrn(current->right->token.value, buffer, - sizeof(current->right->token.value)); - current->right->value = (current->right->token.value[0] != '\0'); - current->right->done = 1; - break; - default: - current = current->right; - continue; - } - } -#ifdef DEBUG_INCLUDE - ap_rvputs(r, " Left: ", current->left->value ? "1" : "0", - "\n", NULL); - ap_rvputs(r, " Right: ", current->right->value ? "1" : "0", - "\n", NULL); -#endif - if (current->token.type == token_and) { - current->value = current->left->value && current->right->value; - } - else { - current->value = current->left->value || current->right->value; - } -#ifdef DEBUG_INCLUDE - ap_rvputs(r, " Returning ", current->value ? "1" : "0", - "\n", NULL); -#endif - current->done = 1; - current = current->parent; - break; - - case token_eq: - case token_ne: -#ifdef DEBUG_INCLUDE - ap_rputs(" Evaluate eq/ne\n", r); -#endif - if ((current->left == (struct parse_node *) NULL) || - (current->right == (struct parse_node *) NULL) || - (current->left->token.type != token_string) || - (current->right->token.type != token_string)) { - ap_log_rerror(APLOG_MARK, APLOG_NOERRNO|APLOG_ERR, r, - "Invalid expression \"%s\" in file %s", - expr, r->filename); - ap_rputs(error, r); - goto RETURN; - } - parse_string(r, current->left->token.value, - buffer, sizeof(buffer), 0); - ap_cpystrn(current->left->token.value, buffer, - sizeof(current->left->token.value)); - parse_string(r, current->right->token.value, - buffer, sizeof(buffer), 0); - ap_cpystrn(current->right->token.value, buffer, - sizeof(current->right->token.value)); - if (current->right->token.value[0] == '/') { - int len; - len = strlen(current->right->token.value); - if (current->right->token.value[len - 1] == '/') { - current->right->token.value[len - 1] = '\0'; - } - else { - ap_log_rerror(APLOG_MARK, APLOG_NOERRNO|APLOG_ERR, r, - "Invalid rexp \"%s\" in file %s", - current->right->token.value, r->filename); - ap_rputs(error, r); - goto RETURN; - } -#ifdef DEBUG_INCLUDE - ap_rvputs(r, " Re Compare (", current->left->token.value, - ") with /", ¤t->right->token.value[1], "/\n", NULL); -#endif - current->value = - re_check(r, current->left->token.value, - ¤t->right->token.value[1]); - } - else { -#ifdef DEBUG_INCLUDE - ap_rvputs(r, " Compare (", current->left->token.value, - ") with (", current->right->token.value, ")\n", NULL); -#endif - current->value = - (strcmp(current->left->token.value, - current->right->token.value) == 0); - } - if (current->token.type == token_ne) { - current->value = !current->value; - } -#ifdef DEBUG_INCLUDE - ap_rvputs(r, " Returning ", current->value ? "1" : "0", - "\n", NULL); -#endif - current->done = 1; - current = current->parent; - break; - case token_ge: - case token_gt: - case token_le: - case token_lt: -#ifdef DEBUG_INCLUDE - ap_rputs(" Evaluate ge/gt/le/lt\n", r); -#endif - if ((current->left == (struct parse_node *) NULL) || - (current->right == (struct parse_node *) NULL) || - (current->left->token.type != token_string) || - (current->right->token.type != token_string)) { - ap_log_rerror(APLOG_MARK, APLOG_NOERRNO|APLOG_ERR, r, - "Invalid expression \"%s\" in file %s", - expr, r->filename); - ap_rputs(error, r); - goto RETURN; - } - parse_string(r, current->left->token.value, - buffer, sizeof(buffer), 0); - ap_cpystrn(current->left->token.value, buffer, - sizeof(current->left->token.value)); - parse_string(r, current->right->token.value, - buffer, sizeof(buffer), 0); - ap_cpystrn(current->right->token.value, buffer, - sizeof(current->right->token.value)); -#ifdef DEBUG_INCLUDE - ap_rvputs(r, " Compare (", current->left->token.value, - ") with (", current->right->token.value, ")\n", NULL); -#endif - current->value = - strcmp(current->left->token.value, - current->right->token.value); - if (current->token.type == token_ge) { - current->value = current->value >= 0; - } - else if (current->token.type == token_gt) { - current->value = current->value > 0; - } - else if (current->token.type == token_le) { - current->value = current->value <= 0; - } - else if (current->token.type == token_lt) { - current->value = current->value < 0; - } - else { - current->value = 0; /* Don't return -1 if unknown token */ - } -#ifdef DEBUG_INCLUDE - ap_rvputs(r, " Returning ", current->value ? "1" : "0", - "\n", NULL); -#endif - current->done = 1; - current = current->parent; - break; - - case token_not: - if (current->right != (struct parse_node *) NULL) { - if (!current->right->done) { - current = current->right; - continue; - } - current->value = !current->right->value; - } - else { - current->value = 0; - } -#ifdef DEBUG_INCLUDE - ap_rvputs(r, " Evaluate !: ", current->value ? "1" : "0", - "\n", NULL); -#endif - current->done = 1; - current = current->parent; - break; - - case token_group: - if (current->right != (struct parse_node *) NULL) { - if (!current->right->done) { - current = current->right; - continue; - } - current->value = current->right->value; - } - else { - current->value = 1; - } -#ifdef DEBUG_INCLUDE - ap_rvputs(r, " Evaluate (): ", current->value ? "1" : "0", - "\n", NULL); -#endif - current->done = 1; - current = current->parent; - break; - - case token_lbrace: - ap_log_rerror(APLOG_MARK, APLOG_NOERRNO|APLOG_ERR, r, - "Unmatched '(' in \"%s\" in file %s", - expr, r->filename); - ap_rputs(error, r); - goto RETURN; - - case token_rbrace: - ap_log_rerror(APLOG_MARK, APLOG_NOERRNO|APLOG_ERR, r, - "Unmatched ')' in \"%s\" in file %s", - expr, r->filename); - ap_rputs(error, r); - goto RETURN; - - default: - ap_log_rerror(APLOG_MARK, APLOG_NOERRNO|APLOG_ERR, r, - "bad token type"); - ap_rputs(error, r); - goto RETURN; - } - } - - retval = (root == (struct parse_node *) NULL) ? 0 : root->value; - RETURN: - ap_destroy_pool(expr_pool); - return (retval); -} - -static int handle_if(FILE *in, request_rec *r, const char *error, - int *conditional_status, int *printing) -{ - char tag[MAX_STRING_LEN]; - char *tag_val; - char *expr; - - expr = NULL; - while (1) { - tag_val = get_tag(r->pool, in, tag, sizeof(tag), 0); - if (*tag == '\0') { - return 1; - } - else if (!strcmp(tag, "done")) { - if (expr == NULL) { - ap_log_rerror(APLOG_MARK, APLOG_NOERRNO|APLOG_ERR, r, - "missing expr in if statement: %s", - r->filename); - ap_rputs(error, r); - return 1; - } - *printing = *conditional_status = parse_expr(r, expr, error); -#ifdef DEBUG_INCLUDE - ap_rvputs(r, "**** if conditional_status=\"", - *conditional_status ? "1" : "0", "\"\n", NULL); -#endif - return 0; - } - else if (!strcmp(tag, "expr")) { - expr = tag_val; -#ifdef DEBUG_INCLUDE - ap_rvputs(r, "**** if expr=\"", expr, "\"\n", NULL); -#endif - } - else { - ap_log_rerror(APLOG_MARK, APLOG_NOERRNO|APLOG_ERR, r, - "unknown parameter \"%s\" to tag if in %s", - tag, r->filename); - ap_rputs(error, r); - } - } -} - -static int handle_elif(FILE *in, request_rec *r, const char *error, - int *conditional_status, int *printing) -{ - char tag[MAX_STRING_LEN]; - char *tag_val; - char *expr; - - expr = NULL; - while (1) { - tag_val = get_tag(r->pool, in, tag, sizeof(tag), 0); - if (*tag == '\0') { - return 1; - } - else if (!strcmp(tag, "done")) { -#ifdef DEBUG_INCLUDE - ap_rvputs(r, "**** elif conditional_status=\"", - *conditional_status ? "1" : "0", "\"\n", NULL); -#endif - if (*conditional_status) { - *printing = 0; - return (0); - } - if (expr == NULL) { - ap_log_rerror(APLOG_MARK, APLOG_NOERRNO|APLOG_ERR, r, - "missing expr in elif statement: %s", - r->filename); - ap_rputs(error, r); - return 1; - } - *printing = *conditional_status = parse_expr(r, expr, error); -#ifdef DEBUG_INCLUDE - ap_rvputs(r, "**** elif conditional_status=\"", - *conditional_status ? "1" : "0", "\"\n", NULL); -#endif - return 0; - } - else if (!strcmp(tag, "expr")) { - expr = tag_val; -#ifdef DEBUG_INCLUDE - ap_rvputs(r, "**** if expr=\"", expr, "\"\n", NULL); -#endif - } - else { - ap_log_rerror(APLOG_MARK, APLOG_NOERRNO|APLOG_ERR, r, - "unknown parameter \"%s\" to tag if in %s", - tag, r->filename); - ap_rputs(error, r); - } - } -} - -static int handle_else(FILE *in, request_rec *r, const char *error, - int *conditional_status, int *printing) -{ - char tag[MAX_STRING_LEN]; - - if (!get_tag(r->pool, in, tag, sizeof(tag), 1)) { - return 1; - } - else if (!strcmp(tag, "done")) { -#ifdef DEBUG_INCLUDE - ap_rvputs(r, "**** else conditional_status=\"", - *conditional_status ? "1" : "0", "\"\n", NULL); -#endif - *printing = !(*conditional_status); - *conditional_status = 1; - return 0; - } - else { - ap_log_rerror(APLOG_MARK, APLOG_NOERRNO|APLOG_ERR, r, - "else directive does not take tags in %s", - r->filename); - if (*printing) { - ap_rputs(error, r); - } - return -1; - } -} - -static int handle_endif(FILE *in, request_rec *r, const char *error, - int *conditional_status, int *printing) -{ - char tag[MAX_STRING_LEN]; - - if (!get_tag(r->pool, in, tag, sizeof(tag), 1)) { - return 1; - } - else if (!strcmp(tag, "done")) { -#ifdef DEBUG_INCLUDE - ap_rvputs(r, "**** endif conditional_status=\"", - *conditional_status ? "1" : "0", "\"\n", NULL); -#endif - *printing = 1; - *conditional_status = 1; - return 0; - } - else { - ap_log_rerror(APLOG_MARK, APLOG_NOERRNO|APLOG_ERR, r, - "endif directive does not take tags in %s", - r->filename); - ap_rputs(error, r); - return -1; - } -} - -static int handle_set(FILE *in, request_rec *r, const char *error) -{ - char tag[MAX_STRING_LEN]; - char parsed_string[MAX_STRING_LEN]; - char *tag_val; - char *var; - - var = (char *) NULL; - while (1) { - if (!(tag_val = get_tag(r->pool, in, tag, sizeof(tag), 1))) { - return 1; - } - else if (!strcmp(tag, "done")) { - return 0; - } - else if (!strcmp(tag, "var")) { - var = tag_val; - } - else if (!strcmp(tag, "value")) { - if (var == (char *) NULL) { - ap_log_rerror(APLOG_MARK, APLOG_NOERRNO|APLOG_ERR, r, - "variable must precede value in set directive in %s", - r->filename); - ap_rputs(error, r); - return -1; - } - parse_string(r, tag_val, parsed_string, sizeof(parsed_string), 0); - ap_table_setn(r->subprocess_env, var, ap_pstrdup(r->pool, parsed_string)); - } - else { - ap_log_rerror(APLOG_MARK, APLOG_NOERRNO|APLOG_ERR, r, - "Invalid tag for set directive in %s", r->filename); - ap_rputs(error, r); - return -1; - } - } -} - -static int handle_printenv(FILE *in, request_rec *r, const char *error) -{ - char tag[MAX_STRING_LEN]; - char *tag_val; - array_header *arr = ap_table_elts(r->subprocess_env); - table_entry *elts = (table_entry *) arr->elts; - int i; - - if (!(tag_val = get_tag(r->pool, in, tag, sizeof(tag), 1))) { - return 1; - } - else if (!strcmp(tag, "done")) { - for (i = 0; i < arr->nelts; ++i) { - ap_rvputs(r, elts[i].key, "=", elts[i].val, "\n", NULL); - } - return 0; - } - else { - ap_log_rerror(APLOG_MARK, APLOG_NOERRNO|APLOG_ERR, r, - "printenv directive does not take tags in %s", - r->filename); - ap_rputs(error, r); - return -1; - } -} - - - -/* -------------------------- The main function --------------------------- */ - -/* This is a stub which parses a file descriptor. */ - -static void send_parsed_content(FILE *f, request_rec *r) -{ - char directive[MAX_STRING_LEN], error[MAX_STRING_LEN]; - char timefmt[MAX_STRING_LEN]; - int noexec = ap_allow_options(r) & OPT_INCNOEXEC; - int ret, sizefmt; - int if_nesting; - int printing; - int conditional_status; - - ap_cpystrn(error, DEFAULT_ERROR_MSG, sizeof(error)); - ap_cpystrn(timefmt, DEFAULT_TIME_FORMAT, sizeof(timefmt)); - sizefmt = SIZEFMT_KMG; - -/* Turn printing on */ - printing = conditional_status = 1; - if_nesting = 0; - -#ifndef WIN32 - ap_chdir_file(r->filename); -#endif - if (r->args) { /* add QUERY stuff to env cause it ain't yet */ - char *arg_copy = ap_pstrdup(r->pool, r->args); - - ap_table_setn(r->subprocess_env, "QUERY_STRING", r->args); - ap_unescape_url(arg_copy); - ap_table_setn(r->subprocess_env, "QUERY_STRING_UNESCAPED", - ap_escape_shell_cmd(r->pool, arg_copy)); - } - - while (1) { - if (!find_string(f, STARTING_SEQUENCE, r, printing)) { - if (get_directive(f, directive, sizeof(directive), r->pool)) { - ap_log_rerror(APLOG_MARK, APLOG_NOERRNO|APLOG_ERR, r, - "mod_include: error reading directive in %s", - r->filename); - ap_rputs(error, r); - return; - } - if (!strcmp(directive, "if")) { - if (!printing) { - if_nesting++; - } - else { - ret = handle_if(f, r, error, &conditional_status, - &printing); - if_nesting = 0; - } - continue; - } - else if (!strcmp(directive, "else")) { - if (!if_nesting) { - ret = handle_else(f, r, error, &conditional_status, - &printing); - } - continue; - } - else if (!strcmp(directive, "elif")) { - if (!if_nesting) { - ret = handle_elif(f, r, error, &conditional_status, - &printing); - } - continue; - } - else if (!strcmp(directive, "endif")) { - if (!if_nesting) { - ret = handle_endif(f, r, error, &conditional_status, - &printing); - } - else { - if_nesting--; - } - continue; - } - if (!printing) { - continue; - } - if (!strcmp(directive, "exec")) { - if (noexec) { - ap_log_rerror(APLOG_MARK, APLOG_NOERRNO|APLOG_ERR, r, - "exec used but not allowed in %s", - r->filename); - if (printing) { - ap_rputs(error, r); - } - ret = find_string(f, ENDING_SEQUENCE, r, 0); - } - else { - ret = handle_exec(f, r, error); - } - } - else if (!strcmp(directive, "config")) { - ret = handle_config(f, r, error, timefmt, &sizefmt); - } - else if (!strcmp(directive, "set")) { - ret = handle_set(f, r, error); - } - else if (!strcmp(directive, "include")) { - ret = handle_include(f, r, error, noexec); - } - else if (!strcmp(directive, "echo")) { - ret = handle_echo(f, r, error); - } - else if (!strcmp(directive, "fsize")) { - ret = handle_fsize(f, r, error, sizefmt); - } - else if (!strcmp(directive, "flastmod")) { - ret = handle_flastmod(f, r, error, timefmt); - } - else if (!strcmp(directive, "printenv")) { - ret = handle_printenv(f, r, error); - } -#ifdef USE_PERL_SSI - else if (!strcmp(directive, "perl")) { - ret = handle_perl(f, r, error); - } -#endif - else { - ap_log_rerror(APLOG_MARK, APLOG_NOERRNO|APLOG_ERR, r, - "unknown directive \"%s\" " - "in parsed doc %s", - directive, r->filename); - if (printing) { - ap_rputs(error, r); - } - ret = find_string(f, ENDING_SEQUENCE, r, 0); - } - if (ret) { - ap_log_rerror(APLOG_MARK, APLOG_NOERRNO|APLOG_ERR, r, - "premature EOF in parsed file %s", - r->filename); - return; - } - } - else { - return; - } - } -} - -/***************************************************************** - * - * XBITHACK. Sigh... NB it's configurable per-directory; the compile-time - * option only changes the default. - */ - -module includes_module; -enum xbithack { - xbithack_off, xbithack_on, xbithack_full -}; - -#ifdef XBITHACK -#define DEFAULT_XBITHACK xbithack_full -#else -#define DEFAULT_XBITHACK xbithack_off -#endif - -static void *create_includes_dir_config(pool *p, char *dummy) -{ - enum xbithack *result = (enum xbithack *) ap_palloc(p, sizeof(enum xbithack)); - *result = DEFAULT_XBITHACK; - return result; -} - -static const char *set_xbithack(cmd_parms *cmd, void *xbp, char *arg) -{ - enum xbithack *state = (enum xbithack *) xbp; - - if (!strcasecmp(arg, "off")) { - *state = xbithack_off; - } - else if (!strcasecmp(arg, "on")) { - *state = xbithack_on; - } - else if (!strcasecmp(arg, "full")) { - *state = xbithack_full; - } - else { - return "XBitHack must be set to Off, On, or Full"; - } - - return NULL; -} - -static int send_parsed_file(request_rec *r) -{ - FILE *f; - enum xbithack *state = - (enum xbithack *) ap_get_module_config(r->per_dir_config, &includes_module); - int errstatus; - request_rec *parent; - - if (!(ap_allow_options(r) & OPT_INCLUDES)) { - return DECLINED; - } - r->allowed |= (1 << M_GET); - if (r->method_number != M_GET) { - return DECLINED; - } - if (r->finfo.st_mode == 0) { - ap_log_rerror(APLOG_MARK, APLOG_NOERRNO|APLOG_ERR, r, - "File does not exist: %s", - (r->path_info - ? ap_pstrcat(r->pool, r->filename, r->path_info, NULL) - : r->filename)); - return HTTP_NOT_FOUND; - } - - if (!(f = ap_pfopen(r->pool, r->filename, "r"))) { - ap_log_rerror(APLOG_MARK, APLOG_ERR, r, - "file permissions deny server access: %s", r->filename); - return HTTP_FORBIDDEN; - } - - if ((*state == xbithack_full) -#if !defined(OS2) && !defined(WIN32) - /* OS/2 dosen't support Groups. */ - && (r->finfo.st_mode & S_IXGRP) -#endif - ) { - ap_update_mtime(r, r->finfo.st_mtime); - ap_set_last_modified(r); - } - if ((errstatus = ap_meets_conditions(r)) != OK) { - return errstatus; - } - - ap_send_http_header(r); - - if (r->header_only) { - ap_pfclose(r->pool, f); - return OK; - } - - if ((parent = ap_get_module_config(r->request_config, &includes_module))) { - /* Kludge --- for nested includes, we want to keep the subprocess - * environment of the base document (for compatibility); that means - * torquing our own last_modified date as well so that the - * LAST_MODIFIED variable gets reset to the proper value if the - * nested document resets . - * We also insist that the memory for this subrequest not be - * destroyed, that's dealt with in handle_include(). - */ - r->subprocess_env = parent->subprocess_env; - ap_pool_join(parent->pool, r->pool); - r->finfo.st_mtime = parent->finfo.st_mtime; - } - else { - /* we're not a nested include, so we create an initial - * environment */ - ap_add_common_vars(r); - ap_add_cgi_vars(r); - add_include_vars(r, DEFAULT_TIME_FORMAT); - } - /* XXX: this is bogus, at some point we're going to do a subrequest, - * and when we do it we're going to be subjecting code that doesn't - * expect to be signal-ready to SIGALRM. There is no clean way to - * fix this, except to put alarm support into BUFF. -djg - */ - ap_hard_timeout("send SSI", r); - -#ifdef CHARSET_EBCDIC - /* XXX:@@@ Is the generated/included output ALWAYS in text/ebcdic format? */ - ap_bsetflag(r->connection->client, B_EBCDIC2ASCII, 1); -#endif - - send_parsed_content(f, r); - - if (parent) { - /* signify that the sub request should not be killed */ - ap_set_module_config(r->request_config, &includes_module, - NESTED_INCLUDE_MAGIC); - } - - ap_kill_timeout(r); - return OK; -} - -static int send_shtml_file(request_rec *r) -{ - r->content_type = "text/html"; - return send_parsed_file(r); -} - -static int xbithack_handler(request_rec *r) -{ -#if defined(OS2) || defined(WIN32) - /* OS/2 dosen't currently support the xbithack. This is being worked on. */ - return DECLINED; -#else - enum xbithack *state; - - if (!(r->finfo.st_mode & S_IXUSR)) { - return DECLINED; - } - - state = (enum xbithack *) ap_get_module_config(r->per_dir_config, - &includes_module); - - if (*state == xbithack_off) { - return DECLINED; - } - return send_parsed_file(r); -#endif -} - -static const command_rec includes_cmds[] = -{ - {"XBitHack", set_xbithack, NULL, OR_OPTIONS, TAKE1, "Off, On, or Full"}, - {NULL} -}; - -static const handler_rec includes_handlers[] = -{ - {INCLUDES_MAGIC_TYPE, send_shtml_file}, - {INCLUDES_MAGIC_TYPE3, send_shtml_file}, - {"server-parsed", send_parsed_file}, - {"text/html", xbithack_handler}, - {NULL} -}; - -module MODULE_VAR_EXPORT includes_module = -{ - STANDARD_MODULE_STUFF, - NULL, /* initializer */ - create_includes_dir_config, /* dir config creater */ - NULL, /* dir merger --- default is to override */ - NULL, /* server config */ - NULL, /* merge server config */ - includes_cmds, /* command table */ - includes_handlers, /* handlers */ - NULL, /* filename translation */ - NULL, /* check_user_id */ - NULL, /* check auth */ - NULL, /* check access */ - NULL, /* type_checker */ - NULL, /* fixups */ - NULL, /* logger */ - NULL, /* header parser */ - NULL, /* child_init */ - NULL, /* child_exit */ - NULL /* post read-request */ -}; diff --git a/modules/filters/mod_include.dsp b/modules/filters/mod_include.dsp deleted file mode 100644 index 94b6dfb9b8901199b7d5e840b535398625f32bac..0000000000000000000000000000000000000000 --- a/modules/filters/mod_include.dsp +++ /dev/null @@ -1,132 +0,0 @@ -# Microsoft Developer Studio Project File - Name="mod_include" - Package Owner=<4> -# Microsoft Developer Studio Generated Build File, Format Version 6.00 -# ** DO NOT EDIT ** - -# TARGTYPE "Win32 (x86) Dynamic-Link Library" 0x0102 - -CFG=mod_include - Win32 Release -!MESSAGE This is not a valid makefile. To build this project using NMAKE, -!MESSAGE use the Export Makefile command and run -!MESSAGE -!MESSAGE NMAKE /f "mod_include.mak". -!MESSAGE -!MESSAGE You can specify a configuration when running NMAKE -!MESSAGE by defining the macro CFG on the command line. For example: -!MESSAGE -!MESSAGE NMAKE /f "mod_include.mak" CFG="mod_include - Win32 Release" -!MESSAGE -!MESSAGE Possible choices for configuration are: -!MESSAGE -!MESSAGE "mod_include - Win32 Release" (based on "Win32 (x86) Dynamic-Link Library") -!MESSAGE "mod_include - Win32 Debug" (based on "Win32 (x86) Dynamic-Link Library") -!MESSAGE - -# Begin Project -# PROP AllowPerConfigDependencies 0 -# PROP Scc_ProjName "" -# PROP Scc_LocalPath "" -CPP=cl.exe -MTL=midl.exe -RSC=rc.exe - -!IF "$(CFG)" == "mod_include - Win32 Release" - -# PROP BASE Use_MFC 0 -# PROP BASE Use_Debug_Libraries 0 -# PROP BASE Output_Dir "Release" -# PROP BASE Intermediate_Dir "Release" -# PROP BASE Target_Dir "" -# PROP Use_MFC 0 -# PROP Use_Debug_Libraries 0 -# PROP Output_Dir "Release" -# PROP Intermediate_Dir "Release" -# PROP Ignore_Export_Lib 0 -# PROP Target_Dir "" -# ADD BASE CPP /nologo /MD /W3 /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /FD /c -# ADD CPP /nologo /MD /W3 /O2 /I "../../include" /I "../../srclib/apr/include" /I "../../srclib/apr-util/include" /D "NDEBUG" /D "WIN32" /D "_WINDOWS" /Fd"Release\mod_include" /FD /c -# ADD BASE MTL /nologo /D "NDEBUG" /win32 -# ADD MTL /nologo /D "NDEBUG" /mktyplib203 /win32 -# ADD BASE RSC /l 0x409 /d "NDEBUG" -# ADD RSC /l 0x409 /d "NDEBUG" -BSC32=bscmake.exe -# ADD BASE BSC32 /nologo -# ADD BSC32 /nologo -LINK32=link.exe -# ADD BASE LINK32 kernel32.lib /nologo /subsystem:windows /dll /map /machine:I386 /out:"Release/mod_include.so" /base:@..\..\os\win32\BaseAddr.ref,mod_include -# ADD LINK32 kernel32.lib /nologo /subsystem:windows /dll /map /machine:I386 /out:"Release/mod_include.so" /base:@..\..\os\win32\BaseAddr.ref,mod_include - -!ELSEIF "$(CFG)" == "mod_include - Win32 Debug" - -# PROP BASE Use_MFC 0 -# PROP BASE Use_Debug_Libraries 1 -# PROP BASE Output_Dir "Debug" -# PROP BASE Intermediate_Dir "Debug" -# PROP BASE Target_Dir "" -# PROP Use_MFC 0 -# PROP Use_Debug_Libraries 1 -# PROP Output_Dir "Debug" -# PROP Intermediate_Dir "Debug" -# PROP Ignore_Export_Lib 0 -# PROP Target_Dir "" -# ADD BASE CPP /nologo /MDd /W3 /GX /Zi /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /FD /c -# ADD CPP /nologo /MDd /W3 /GX /Zi /Od /I "../../include" /I "../../srclib/apr/include" /I "../../srclib/apr-util/include" /D "_DEBUG" /D "WIN32" /D "_WINDOWS" /Fd"Debug\mod_include" /FD /c -# ADD BASE MTL /nologo /D "_DEBUG" /win32 -# ADD MTL /nologo /D "_DEBUG" /mktyplib203 /win32 -# ADD BASE RSC /l 0x409 /d "_DEBUG" -# ADD RSC /l 0x409 /d "_DEBUG" -BSC32=bscmake.exe -# ADD BASE BSC32 /nologo -# ADD BSC32 /nologo -LINK32=link.exe -# ADD BASE LINK32 kernel32.lib /nologo /subsystem:windows /dll /incremental:no /map /debug /machine:I386 /out:"Debug/mod_include.so" /base:@..\..\os\win32\BaseAddr.ref,mod_include -# ADD LINK32 kernel32.lib /nologo /subsystem:windows /dll /incremental:no /map /debug /machine:I386 /out:"Debug/mod_include.so" /base:@..\..\os\win32\BaseAddr.ref,mod_include - -!ENDIF - -# Begin Target - -# Name "mod_include - Win32 Release" -# Name "mod_include - Win32 Debug" -# Begin Source File - -SOURCE=.\mod_include.c -# End Source File -# Begin Source File - -SOURCE=.\mod_include.h -# End Source File -# Begin Source File - -SOURCE=.\mod_include.rc -# End Source File -# Begin Source File - -SOURCE=..\..\build\win32\win32ver.awk - -!IF "$(CFG)" == "mod_include - Win32 Release" - -# PROP Ignore_Default_Tool 1 -# Begin Custom Build - Creating Version Resource -InputPath=..\..\build\win32\win32ver.awk - -".\mod_include.rc" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)" - awk -f ../../build/win32/win32ver.awk mod_include "include_module for Apache" ../../include/ap_release.h > .\mod_include.rc - -# End Custom Build - -!ELSEIF "$(CFG)" == "mod_include - Win32 Debug" - -# PROP Ignore_Default_Tool 1 -# Begin Custom Build - Creating Version Resource -InputPath=..\..\build\win32\win32ver.awk - -".\mod_include.rc" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)" - awk -f ../../build/win32/win32ver.awk mod_include "include_module for Apache" ../../include/ap_release.h > .\mod_include.rc - -# End Custom Build - -!ENDIF - -# End Source File -# End Target -# End Project diff --git a/modules/filters/mod_include.exp b/modules/filters/mod_include.exp deleted file mode 100644 index 335da742da4014822b07681bc21c6abde6cf5250..0000000000000000000000000000000000000000 --- a/modules/filters/mod_include.exp +++ /dev/null @@ -1 +0,0 @@ -includes_module diff --git a/modules/filters/mod_include.h b/modules/filters/mod_include.h deleted file mode 100644 index 554d9998bbe12f143f5359bd3fa6246b2695192e..0000000000000000000000000000000000000000 --- a/modules/filters/mod_include.h +++ /dev/null @@ -1,206 +0,0 @@ -/* ==================================================================== - * The Apache Software License, Version 1.1 - * - * Copyright (c) 2000 The Apache Software Foundation. All rights - * reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in - * the documentation and/or other materials provided with the - * distribution. - * - * 3. The end-user documentation included with the redistribution, - * if any, must include the following acknowledgment: - * "This product includes software developed by the - * Apache Software Foundation (http://www.apache.org/)." - * Alternately, this acknowledgment may appear in the software itself, - * if and wherever such third-party acknowledgments normally appear. - * - * 4. The names "Apache" and "Apache Software Foundation" must - * not be used to endorse or promote products derived from this - * software without prior written permission. For written - * permission, please contact apache@apache.org. - * - * 5. Products derived from this software may not be called "Apache", - * nor may "Apache" appear in their name, without prior written - * permission of the Apache Software Foundation. - * - * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED - * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES - * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR - * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF - * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND - * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, - * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT - * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * ==================================================================== - * - * This software consists of voluntary contributions made by many - * individuals on behalf of the Apache Software Foundation. For more - * information on the Apache Software Foundation, please see - * . - * - * Portions of this software are based upon public domain software - * originally written at the National Center for Supercomputing Applications, - * University of Illinois, Urbana-Champaign. - */ - -#ifndef _MOD_INCLUDE_H -#define _MOD_INCLUDE_H 1 - - - -#define STARTING_SEQUENCE "" - -#define DEFAULT_ERROR_MSG "[an error occurred while processing this directive]" -#define DEFAULT_TIME_FORMAT "%A, %d-%b-%Y %H:%M:%S %Z" -#define SIZEFMT_BYTES 0 -#define SIZEFMT_KMG 1 -#define TMP_BUF_SIZE 1024 -#ifdef CHARSET_EBCDIC -#define RAW_ASCII_CHAR(ch) apr_xlate_conv_byte(ap_hdrs_from_ascii, (unsigned char)ch) -#else /*CHARSET_EBCDIC*/ -#define RAW_ASCII_CHAR(ch) (ch) -#endif /*CHARSET_EBCDIC*/ - -module AP_MODULE_DECLARE_DATA includes_module; - -/* just need some arbitrary non-NULL pointer which can't also be a request_rec */ -#define NESTED_INCLUDE_MAGIC (&includes_module) - -/* TODO: changing directory should be handled by CreateProcess */ -#define ap_chdir_file(x) do {} while(0) - - -/**************************************************************************** - * Used to keep context information during parsing of a request for SSI tags. - * This is especially useful if the tag stretches across multiple buckets or - * brigades. This keeps track of which buckets need to be replaced with the - * content generated by the SSI tag. - * - * state: PRE_HEAD - State prior to finding the first character of the - * STARTING_SEQUENCE. Next state is PARSE_HEAD. - * PARSE_HEAD - State entered once the first character of the - * STARTING_SEQUENCE is found and exited when the - * the full STARTING_SEQUENCE has been matched or - * a match failure occurs. Next state is PRE_HEAD - * or PARSE_TAG. - * PARSE_TAG - State entered once the STARTING sequence has been - * matched. It is exited when the first character in - * ENDING_SEQUENCE is found. Next state is PARSE_TAIL. - * PARSE_TAIL - State entered from PARSE_TAG state when the first - * character in ENDING_SEQUENCE is encountered. This - * state is exited when the ENDING_SEQUENCE has been - * completely matched, or when a match failure occurs. - * Next state is PARSE_TAG or PARSED. - * PARSED - State entered from PARSE_TAIL once the complete - * ENDING_SEQUENCE has been matched. The SSI tag is - * processed and the SSI buckets are replaced with the - * SSI content during this state. - * parse_pos: Current matched position within the STARTING_SEQUENCE or - * ENDING_SEQUENCE during the PARSE_HEAD and PARSE_TAIL states. - * This is especially useful when the sequence spans brigades. - * X_start_bucket: These point to the buckets containing the first character - * of the STARTING_SEQUENCE, the first non-whitespace - * character of the tag, and the first character in the - * ENDING_SEQUENCE (head_, tag_, and tail_ respectively). - * The buckets are kept intact until the PARSED state is - * reached, at which time the tag is consolidated and the - * buckets are released. The buckets that these point to - * have all been set aside in the ssi_tag_brigade (along - * with all of the intervening buckets). - * X_start_index: The index points within the specified bucket contents - * where the first character of the STARTING_SEQUENCE, - * the first non-whitespace character of the tag, and the - * first character in the ENDING_SEQUENCE can be found - * (head_, tag_, and tail_ respectively). - * combined_tag: Once the PARSED state is reached the tag is collected from - * the bucket(s) in the ssi_tag_brigade into this contiguous - * buffer. The buckets in the ssi_tag_brigade are released - * and the tag is processed. - * curr_tag_pos: Ptr to the combined_tag buffer indicating the current - * parse position. - * tag_length: The number of bytes in the actual tag (excluding the - * STARTING_SEQUENCE, leading and trailing whitespace, - * and ENDING_SEQUENCE). This length is computed as the - * buckets are parsed and set aside during the PARSE_TAG state. - * ssi_tag_brigade: The temporary brigade used by this filter to set aside - * the buckets containing parts of the ssi tag and headers. - */ -typedef enum {PRE_HEAD, PARSE_HEAD, PARSE_TAG, PARSE_TAIL, PARSED} states; -typedef struct include_filter_ctx { - states state; - long flags; /* See the FLAG_XXXXX definitions. */ - int if_nesting_level; - apr_ssize_t parse_pos; - - ap_bucket *head_start_bucket; - apr_ssize_t head_start_index; - - ap_bucket *tag_start_bucket; - apr_ssize_t tag_start_index; - - ap_bucket *tail_start_bucket; - apr_ssize_t tail_start_index; - - char *combined_tag; - char *curr_tag_pos; - apr_ssize_t tag_length; - - apr_ssize_t error_length; - char error_str[MAX_STRING_LEN]; - char time_str[MAX_STRING_LEN]; - - ap_bucket_brigade *ssi_tag_brigade; -} include_ctx_t; - -/* These flags are used to set flag bits. */ -#define FLAG_PRINTING 0x00000001 /* Printing conditional lines. */ -#define FLAG_COND_TRUE 0x00000002 /* Conditional eval'd to true. */ -#define FLAG_SIZE_IN_BYTES 0x00000004 /* Sizes displayed in bytes. */ -#define FLAG_NO_EXEC 0x00000008 /* No Exec in current context. */ - -/* These flags are used to clear flag bits. */ -#define FLAG_SIZE_ABBREV 0xFFFFFFFB /* Reset SIZE_IN_BYTES bit. */ -#define FLAG_CLEAR_PRINT_COND 0xFFFFFFFC /* Reset PRINTING and COND_TRUE*/ -#define FLAG_CLEAR_PRINTING 0xFFFFFFFE /* Reset just PRINTING bit. */ - -typedef enum {TOK_UNKNOWN, TOK_IF, TOK_SET, TOK_ECHO, TOK_ELIF, TOK_ELSE, - TOK_EXEC, TOK_PERL, TOK_ENDIF, TOK_FSIZE, TOK_CONFIG, - TOK_INCLUDE, TOK_FLASTMOD, TOK_PRINTENV} dir_token_id; - -#define CREATE_ERROR_BUCKET(cntx, t_buck, h_ptr, ins_head) \ -{ \ - apr_ssize_t e_wrt; \ - t_buck = ap_bucket_create_heap(cntx->error_str, \ - ctx->error_length, 1, &e_wrt); \ - AP_BUCKET_INSERT_BEFORE(h_ptr, t_buck); \ - \ - if (ins_head == NULL) { \ - ins_head = t_buck; \ - } \ -} - -#define SPLIT_AND_PASS_PRETAG_BUCKETS(brgd, cntxt) \ -if ((AP_BRIGADE_EMPTY(cntxt->ssi_tag_brigade)) && \ - (cntxt->head_start_bucket != NULL)) { \ - ap_bucket_brigade *tag_plus; \ - \ - tag_plus = ap_brigade_split(brgd, cntxt->head_start_bucket); \ - ap_pass_brigade(f->next, brgd); \ - brgd = tag_plus; \ -} - -#endif /* MOD_INCLUDE */ diff --git a/modules/generators/.cvsignore b/modules/generators/.cvsignore deleted file mode 100644 index f2f7a70d2c9528e7ef84cf1b3bf9ff721fa08b08..0000000000000000000000000000000000000000 --- a/modules/generators/.cvsignore +++ /dev/null @@ -1,10 +0,0 @@ -.deps -.libs -*.la -modules.mk -Makefile -*.lo -*.slo -*.so -*.dll -*.def diff --git a/modules/generators/.indent.pro b/modules/generators/.indent.pro deleted file mode 100644 index a9fbe9f9a1f2e6e7bcc54171c215bdacd44171ba..0000000000000000000000000000000000000000 --- a/modules/generators/.indent.pro +++ /dev/null @@ -1,54 +0,0 @@ --i4 -npsl -di0 -br -nce -d0 -cli0 -npcs -nfc1 --TBUFF --TFILE --TTRANS --TUINT4 --T_trans --Tallow_options_t --Tapache_sfio --Tarray_header --Tbool_int --Tbuf_area --Tbuff_struct --Tbuffy --Tcmd_how --Tcmd_parms --Tcommand_rec --Tcommand_struct --Tconn_rec --Tcore_dir_config --Tcore_server_config --Tdir_maker_func --Tevent --Tglobals_s --Thandler_func --Thandler_rec --Tjoblist_s --Tlisten_rec --Tmerger_func --Tmode_t --Tmodule --Tmodule_struct --Tmutex --Tn_long --Tother_child_rec --Toverrides_t --Tparent_score --Tpid_t --Tpiped_log --Tpool --Trequest_rec --Trequire_line --Trlim_t --Tscoreboard --Tsemaphore --Tserver_addr_rec --Tserver_rec --Tserver_rec_chain --Tshort_score --Ttable --Ttable_entry --Tthread --Tu_wide_int --Tvtime_t --Twide_int diff --git a/modules/generators/Makefile.in b/modules/generators/Makefile.in deleted file mode 100644 index 167b343d0db75f7876a55cef1681570eba813202..0000000000000000000000000000000000000000 --- a/modules/generators/Makefile.in +++ /dev/null @@ -1,3 +0,0 @@ - -include $(top_srcdir)/build/special.mk - diff --git a/modules/generators/NWGNUinfo b/modules/generators/NWGNUinfo deleted file mode 100644 index 4cad0688b2df06cb26c2df5cd0e14ea9dc65c2ab..0000000000000000000000000000000000000000 --- a/modules/generators/NWGNUinfo +++ /dev/null @@ -1,250 +0,0 @@ -# -# Make sure all needed macro's are defined -# - -# -# Get the 'head' of the build environment if necessary. This includes default -# targets and paths to tools -# - -ifndef EnvironmentDefined -include $(AP_WORK)\build\NWGNUhead.inc -endif - -# -# These directories will be at the beginning of the include list, followed by -# INCDIRS -# -XINCDIRS += \ - $(AP_WORK)/include \ - $(NWOS) \ - $(AP_WORK)/modules/arch/netware \ - $(AP_WORK)/srclib/apr/include \ - $(AP_WORK)/srclib/apr-util/include \ - $(AP_WORK)/srclib/apr \ - $(EOLIST) - -# -# These flags will come after CFLAGS -# -XCFLAGS += \ - -prefix pre_nw.h \ - $(EOLIST) - -# -# These defines will come after DEFINES -# -XDEFINES += \ - $(EOLIST) - -# -# These flags will be added to the link.opt file -# -XLFLAGS += \ - $(EOLIST) - -# -# These values will be appended to the correct variables based on the value of -# RELEASE -# -ifeq "$(RELEASE)" "debug" -XINCDIRS += \ - $(EOLIST) - -XCFLAGS += \ - $(EOLIST) - -XDEFINES += \ - $(EOLIST) - -XLFLAGS += \ - $(EOLIST) -endif - -ifeq "$(RELEASE)" "noopt" -XINCDIRS += \ - $(EOLIST) - -XCFLAGS += \ - $(EOLIST) - -XDEFINES += \ - $(EOLIST) - -XLFLAGS += \ - $(EOLIST) -endif - -ifeq "$(RELEASE)" "release" -XINCDIRS += \ - $(EOLIST) - -XCFLAGS += \ - $(EOLIST) - -XDEFINES += \ - $(EOLIST) - -XLFLAGS += \ - $(EOLIST) -endif - -# -# These are used by the link target if an NLM is being generated -# This is used by the link 'name' directive to name the nlm. If left blank -# TARGET_nlm (see below) will be used. -# -NLM_NAME = info - -# -# This is used by the link '-desc ' directive. -# If left blank, NLM_NAME will be used. -# -NLM_DESCRIPTION = Info Module - -# -# This is used by the '-threadname' directive. If left blank, -# NLM_NAME Thread will be used. -# -NLM_THREAD_NAME = Info Module - -# -# If this is specified, it will override VERSION value in -# $(AP_WORK)\build\NWGNUenvironment.inc -# -NLM_VERSION = - -# -# If this is specified, it will override the default of 64K -# -NLM_STACK_SIZE = 8192 - - -# -# If this is specified it will be used by the link '-entry' directive -# -NLM_ENTRY_SYM = _LibCPrelude - -# -# If this is specified it will be used by the link '-exit' directive -# -NLM_EXIT_SYM = _LibCPostlude - -# -# If this is specified it will be used by the link '-check' directive -# -NLM_CHECK_SYM = - -# -# If these are specified it will be used by the link '-flags' directive -# -NLM_FLAGS = AUTOUNLOAD, PSEUDOPREEMPTION - -# -# If this is specified it will be linked in with the XDCData option in the def -# file instead of the default of $(NWOS)/apache.xdc. XDCData can be disabled -# by setting APACHE_UNIPROC in the environment -# -XDCDATA = - -# -# If there is an NLM target, put it here -# -TARGET_nlm = \ - $(OBJDIR)/info.nlm \ - $(EOLIST) - -# -# If there is an LIB target, put it here -# -TARGET_lib = \ - $(EOLIST) - -# -# These are the OBJ files needed to create the NLM target above. -# Paths must all use the '/' character -# -FILES_nlm_objs = \ - $(OBJDIR)/mod_info.o \ - $(EOLIST) - -# -# These are the LIB files needed to create the NLM target above. -# These will be added as a library command in the link.opt file. -# -FILES_nlm_libs = \ - libcpre.o \ - $(EOLIST) - -# -# These are the modules that the above NLM target depends on to load. -# These will be added as a module command in the link.opt file. -# -FILES_nlm_modules = \ - aprlib \ - libc \ - $(EOLIST) - -# -# If the nlm has a msg file, put it's path here -# -FILE_nlm_msg = - -# -# If the nlm has a hlp file put it's path here -# -FILE_nlm_hlp = - -# -# If this is specified, it will override $(NWOS)\copyright.txt. -# -FILE_nlm_copyright = - -# -# Any additional imports go here -# -FILES_nlm_Ximports = \ - @$(APR)/aprlib.imp \ - @$(NWOS)/httpd.imp \ - @libc.imp \ - $(EOLIST) - -# -# Any symbols exported to here -# -FILES_nlm_exports = \ - info_module \ - $(EOLIST) - -# -# These are the OBJ files needed to create the LIB target above. -# Paths must all use the '/' character -# -FILES_lib_objs = \ - $(EOLIST) - -# -# implement targets and dependancies (leave this section alone) -# - -libs :: $(OBJDIR) $(TARGET_lib) - -nlms :: libs $(TARGET_nlm) - -# -# Updated this target to create necessary directories and copy files to the -# correct place. (See $(AP_WORK)\build\NWGNUhead.inc for examples) -# -install :: nlms FORCE - -# -# Any specialized rules here -# - -# -# Include the 'tail' makefile that has targets that depend on variables defined -# in this makefile -# - -include $(AP_WORK)\build\NWGNUtail.inc - diff --git a/modules/generators/NWGNUmakefile b/modules/generators/NWGNUmakefile deleted file mode 100644 index 7f7d343bdee6092abdd609666ade9448a91cf7ff..0000000000000000000000000000000000000000 --- a/modules/generators/NWGNUmakefile +++ /dev/null @@ -1,247 +0,0 @@ -# -# Declare the sub-directories to be built here -# - -SUBDIRS = \ - $(EOLIST) - -# -# Get the 'head' of the build environment. This includes default targets and -# paths to tools -# - -include $(AP_WORK)\build\NWGNUhead.inc - -# -# build this level's files - -# -# Make sure all needed macro's are defined -# - -# -# These directories will be at the beginning of the include list, followed by -# INCDIRS -# -XINCDIRS += \ - $(EOLIST) - -# -# These flags will come after CFLAGS -# -XCFLAGS += \ - $(EOLIST) - -# -# These defines will come after DEFINES -# -XDEFINES += \ - $(EOLIST) - -# -# These flags will be added to the link.opt file -# -XLFLAGS += \ - $(EOLIST) - -# -# These values will be appended to the correct variables based on the value of -# RELEASE -# -ifeq "$(RELEASE)" "debug" -XINCDIRS += \ - $(EOLIST) - -XCFLAGS += \ - $(EOLIST) - -XDEFINES += \ - $(EOLIST) - -XLFLAGS += \ - $(EOLIST) -endif - -ifeq "$(RELEASE)" "noopt" -XINCDIRS += \ - $(EOLIST) - -XCFLAGS += \ - $(EOLIST) - -XDEFINES += \ - $(EOLIST) - -XLFLAGS += \ - $(EOLIST) -endif - -ifeq "$(RELEASE)" "release" -XINCDIRS += \ - $(EOLIST) - -XCFLAGS += \ - $(EOLIST) - -XDEFINES += \ - $(EOLIST) - -XLFLAGS += \ - $(EOLIST) -endif - -# -# These are used by the link target if an NLM is being generated -# This is used by the link 'name' directive to name the nlm. If left blank -# TARGET_nlm (see below) will be used. -# -NLM_NAME = - -# -# This is used by the link '-desc ' directive. -# If left blank, NLM_NAME will be used. -# -NLM_DESCRIPTION = - -# -# This is used by the '-threadname' directive. If left blank, -# NLM_NAME Thread will be used. -# -NLM_THREAD_NAME = - -# -# If this is specified, it will override VERSION value in -# $(AP_WORK)\build\NWGNUenvironment.inc -# -NLM_VERSION = - -# -# If this is specified, it will override the default of 64K -# -NLM_STACK_SIZE = - - -# -# If this is specified it will be used by the link '-entry' directive -# -NLM_ENTRY_SYM = - -# -# If this is specified it will be used by the link '-exit' directive -# -NLM_EXIT_SYM = - -# -# If this is specified it will be used by the link '-check' directive -# -NLM_CHECK_SYM = - -# -# If these are specified it will be used by the link '-flags' directive -# -NLM_FLAGS = - -# -# If this is specified it will be linked in with the XDCData option in the def -# file instead of the default of $(NWOS)/apache.xdc. XDCData can be disabled -# by setting APACHE_UNIPROC in the environment -# -XDCDATA = - -# -# If there is an NLM target, put it here -# -TARGET_nlm = \ - $(OBJDIR)/info.nlm \ - $(OBJDIR)/status.nlm \ - $(EOLIST) - -# -# If there is an LIB target, put it here -# -TARGET_lib = \ - $(EOLIST) - -# -# These are the OBJ files needed to create the NLM target above. -# Paths must all use the '/' character -# -FILES_nlm_objs = \ - $(EOLIST) - -# -# These are the LIB files needed to create the NLM target above. -# These will be added as a library command in the link.opt file. -# -FILES_nlm_libs = \ - $(EOLIST) - -# -# These are the modules that the above NLM target depends on to load. -# These will be added as a module command in the link.opt file. -# -FILES_nlm_modules = \ - $(EOLIST) - -# -# If the nlm has a msg file, put it's path here -# -FILE_nlm_msg = - -# -# If the nlm has a hlp file put it's path here -# -FILE_nlm_hlp = - -# -# If this is specified, it will override $(NWOS)\copyright.txt. -# -FILE_nlm_copyright = - -# -# Any additional imports go here -# -FILES_nlm_Ximports = \ - $(EOLIST) - -# -# Any symbols exported to here -# -FILES_nlm_exports = \ - $(EOLIST) - -# -# These are the OBJ files needed to create the LIB target above. -# Paths must all use the '/' character -# -FILES_lib_objs = \ - $(EOLIST) - -# -# implement targets and dependancies (leave this section alone) -# - -libs :: $(OBJDIR) $(TARGET_lib) - -nlms :: libs $(TARGET_nlm) - -# -# Updated this target to create necessary directories and copy files to the -# correct place. (See $(AP_WORK)\build\NWGNUhead.inc for examples) -# -install :: nlms FORCE - copy $(OBJDIR)\*.nlm $(INSTALL)\Apache2\modules\*.* - -# -# Any specialized rules here -# - -# -# Include the 'tail' makefile that has targets that depend on variables defined -# in this makefile -# - -include $(AP_WORK)\build\NWGNUtail.inc - - - diff --git a/modules/generators/NWGNUstatus b/modules/generators/NWGNUstatus deleted file mode 100644 index 9a91236852c0267096b525a6efd56a94ae9399fe..0000000000000000000000000000000000000000 --- a/modules/generators/NWGNUstatus +++ /dev/null @@ -1,250 +0,0 @@ -# -# Make sure all needed macro's are defined -# - -# -# Get the 'head' of the build environment if necessary. This includes default -# targets and paths to tools -# - -ifndef EnvironmentDefined -include $(AP_WORK)\build\NWGNUhead.inc -endif - -# -# These directories will be at the beginning of the include list, followed by -# INCDIRS -# -XINCDIRS += \ - $(AP_WORK)/include \ - $(NWOS) \ - $(AP_WORK)/modules/arch/netware \ - $(AP_WORK)/srclib/apr/include \ - $(AP_WORK)/srclib/apr-util/include \ - $(AP_WORK)/srclib/apr \ - $(EOLIST) - -# -# These flags will come after CFLAGS -# -XCFLAGS += \ - -prefix pre_nw.h \ - $(EOLIST) - -# -# These defines will come after DEFINES -# -XDEFINES += \ - $(EOLIST) - -# -# These flags will be added to the link.opt file -# -XLFLAGS += \ - $(EOLIST) - -# -# These values will be appended to the correct variables based on the value of -# RELEASE -# -ifeq "$(RELEASE)" "debug" -XINCDIRS += \ - $(EOLIST) - -XCFLAGS += \ - $(EOLIST) - -XDEFINES += \ - $(EOLIST) - -XLFLAGS += \ - $(EOLIST) -endif - -ifeq "$(RELEASE)" "noopt" -XINCDIRS += \ - $(EOLIST) - -XCFLAGS += \ - $(EOLIST) - -XDEFINES += \ - $(EOLIST) - -XLFLAGS += \ - $(EOLIST) -endif - -ifeq "$(RELEASE)" "release" -XINCDIRS += \ - $(EOLIST) - -XCFLAGS += \ - $(EOLIST) - -XDEFINES += \ - $(EOLIST) - -XLFLAGS += \ - $(EOLIST) -endif - -# -# These are used by the link target if an NLM is being generated -# This is used by the link 'name' directive to name the nlm. If left blank -# TARGET_nlm (see below) will be used. -# -NLM_NAME = status - -# -# This is used by the link '-desc ' directive. -# If left blank, NLM_NAME will be used. -# -NLM_DESCRIPTION = Status Module - -# -# This is used by the '-threadname' directive. If left blank, -# NLM_NAME Thread will be used. -# -NLM_THREAD_NAME = Status Module - -# -# If this is specified, it will override VERSION value in -# $(AP_WORK)\build\NWGNUenvironment.inc -# -NLM_VERSION = - -# -# If this is specified, it will override the default of 64K -# -NLM_STACK_SIZE = 8192 - - -# -# If this is specified it will be used by the link '-entry' directive -# -NLM_ENTRY_SYM = _LibCPrelude - -# -# If this is specified it will be used by the link '-exit' directive -# -NLM_EXIT_SYM = _LibCPostlude - -# -# If this is specified it will be used by the link '-check' directive -# -NLM_CHECK_SYM = - -# -# If these are specified it will be used by the link '-flags' directive -# -NLM_FLAGS = AUTOUNLOAD, PSEUDOPREEMPTION - -# -# If this is specified it will be linked in with the XDCData option in the def -# file instead of the default of $(NWOS)/apache.xdc. XDCData can be disabled -# by setting APACHE_UNIPROC in the environment -# -XDCDATA = - -# -# If there is an NLM target, put it here -# -TARGET_nlm = \ - $(OBJDIR)/status.nlm \ - $(EOLIST) - -# -# If there is an LIB target, put it here -# -TARGET_lib = \ - $(EOLIST) - -# -# These are the OBJ files needed to create the NLM target above. -# Paths must all use the '/' character -# -FILES_nlm_objs = \ - $(OBJDIR)/mod_status.o \ - $(EOLIST) - -# -# These are the LIB files needed to create the NLM target above. -# These will be added as a library command in the link.opt file. -# -FILES_nlm_libs = \ - libcpre.o \ - $(EOLIST) - -# -# These are the modules that the above NLM target depends on to load. -# These will be added as a module command in the link.opt file. -# -FILES_nlm_modules = \ - aprlib \ - libc \ - $(EOLIST) - -# -# If the nlm has a msg file, put it's path here -# -FILE_nlm_msg = - -# -# If the nlm has a hlp file put it's path here -# -FILE_nlm_hlp = - -# -# If this is specified, it will override $(NWOS)\copyright.txt. -# -FILE_nlm_copyright = - -# -# Any additional imports go here -# -FILES_nlm_Ximports = \ - @$(APR)/aprlib.imp \ - @$(NWOS)/httpd.imp \ - @libc.imp \ - $(EOLIST) - -# -# Any symbols exported to here -# -FILES_nlm_exports = \ - status_module \ - $(EOLIST) - -# -# These are the OBJ files needed to create the LIB target above. -# Paths must all use the '/' character -# -FILES_lib_objs = \ - $(EOLIST) - -# -# implement targets and dependancies (leave this section alone) -# - -libs :: $(OBJDIR) $(TARGET_lib) - -nlms :: libs $(TARGET_nlm) - -# -# Updated this target to create necessary directories and copy files to the -# correct place. (See $(AP_WORK)\build\NWGNUhead.inc for examples) -# -install :: nlms FORCE - -# -# Any specialized rules here -# - -# -# Include the 'tail' makefile that has targets that depend on variables defined -# in this makefile -# - -include $(AP_WORK)\build\NWGNUtail.inc - diff --git a/modules/generators/config5.m4 b/modules/generators/config5.m4 deleted file mode 100644 index 2a1ed8ff27879f29f50cdefe18dbc769cc4c9d04..0000000000000000000000000000000000000000 --- a/modules/generators/config5.m4 +++ /dev/null @@ -1,28 +0,0 @@ -dnl modules enabled in this directory by default - -dnl APACHE_MODULE(name, helptext[, objects[, structname[, default[, config]]]]) - -APACHE_MODPATH_INIT(generators) - -APACHE_MODULE(status, process/thread monitoring, , , no) -APACHE_MODULE(autoindex, directory listing, , , yes) -APACHE_MODULE(asis, as-is filetypes, , , yes) -APACHE_MODULE(info, server information, , , no) -APACHE_MODULE(suexec, set uid and gid for spawned processes, , , no) - -LTFLAGS="$LTFLAGS -export-dynamic" - -if test "$apache_cv_mpm" = "mpmt_pthread" -o "$apache_cv_mpm" = "dexter"; then -# if we are using a threaded MPM, we will get better performance with -# mod_cgid, so make it the default. - APACHE_MODULE(cgid, CGI scripts, , , yes) - APACHE_MODULE(cgi, CGI scripts, , , no) -else -# if we are using a non-threaded MPM, it makes little sense to use -# mod_cgid, and it just opens up holes we don't need. Make mod_cgi the -# default - APACHE_MODULE(cgi, CGI scripts, , , yes) - APACHE_MODULE(cgid, CGI scripts, , , no) -fi - -APACHE_MODPATH_FINISH diff --git a/modules/generators/mod_asis.c b/modules/generators/mod_asis.c deleted file mode 100644 index 5e299df92684d0ac37984a81f80538414f8b0cdf..0000000000000000000000000000000000000000 --- a/modules/generators/mod_asis.c +++ /dev/null @@ -1,145 +0,0 @@ -/* ==================================================================== - * Copyright (c) 1995-1999 The Apache Group. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in - * the documentation and/or other materials provided with the - * distribution. - * - * 3. All advertising materials mentioning features or use of this - * software must display the following acknowledgment: - * "This product includes software developed by the Apache Group - * for use in the Apache HTTP server project (http://www.apache.org/)." - * - * 4. The names "Apache Server" and "Apache Group" must not be used to - * endorse or promote products derived from this software without - * prior written permission. For written permission, please contact - * apache@apache.org. - * - * 5. Products derived from this software may not be called "Apache" - * nor may "Apache" appear in their names without prior written - * permission of the Apache Group. - * - * 6. Redistributions of any form whatsoever must retain the following - * acknowledgment: - * "This product includes software developed by the Apache Group - * for use in the Apache HTTP server project (http://www.apache.org/)." - * - * THIS SOFTWARE IS PROVIDED BY THE APACHE GROUP ``AS IS'' AND ANY - * EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR - * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE APACHE GROUP OR - * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT - * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, - * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED - * OF THE POSSIBILITY OF SUCH DAMAGE. - * ==================================================================== - * - * This software consists of voluntary contributions made by many - * individuals on behalf of the Apache Group and was originally based - * on public domain software written at the National Center for - * Supercomputing Applications, University of Illinois, Urbana-Champaign. - * For more information on the Apache Group and the Apache HTTP server - * project, please see . - * - */ - -#include "httpd.h" -#include "http_config.h" -#include "http_protocol.h" -#include "http_log.h" -#include "util_script.h" -#include "http_main.h" -#include "http_request.h" - -static int asis_handler(request_rec *r) -{ - FILE *f; - const char *location; - - r->allowed |= (1 << M_GET); - if (r->method_number != M_GET) - return DECLINED; - if (r->finfo.st_mode == 0) { - ap_log_rerror(APLOG_MARK, APLOG_NOERRNO|APLOG_ERR, r, - "File does not exist: %s", r->filename); - return NOT_FOUND; - } - - f = ap_pfopen(r->pool, r->filename, "r"); - - if (f == NULL) { - ap_log_rerror(APLOG_MARK, APLOG_ERR, r, - "file permissions deny server access: %s", r->filename); - return FORBIDDEN; - } - - ap_scan_script_header_err(r, f, NULL); - location = ap_table_get(r->headers_out, "Location"); - - if (location && location[0] == '/' && - ((r->status == HTTP_OK) || ap_is_HTTP_REDIRECT(r->status))) { - - ap_pfclose(r->pool, f); - - /* Internal redirect -- fake-up a pseudo-request */ - r->status = HTTP_OK; - - /* This redirect needs to be a GET no matter what the original - * method was. - */ - r->method = ap_pstrdup(r->pool, "GET"); - r->method_number = M_GET; - - ap_internal_redirect_handler(location, r); - return OK; - } - - ap_send_http_header(r); - if (!r->header_only) - ap_send_fd(f, r); - - ap_pfclose(r->pool, f); - return OK; -} - -static const handler_rec asis_handlers[] = -{ - {ASIS_MAGIC_TYPE, asis_handler}, - {"send-as-is", asis_handler}, - {NULL} -}; - -module MODULE_VAR_EXPORT asis_module = -{ - STANDARD_MODULE_STUFF, - NULL, /* initializer */ - NULL, /* create per-directory config structure */ - NULL, /* merge per-directory config structures */ - NULL, /* create per-server config structure */ - NULL, /* merge per-server config structures */ - NULL, /* command table */ - asis_handlers, /* handlers */ - NULL, /* translate_handler */ - NULL, /* check_user_id */ - NULL, /* check auth */ - NULL, /* check access */ - NULL, /* type_checker */ - NULL, /* pre-run fixups */ - NULL, /* logger */ - NULL, /* header parser */ - NULL, /* child_init */ - NULL, /* child_exit */ - NULL /* post read-request */ -}; diff --git a/modules/generators/mod_asis.dsp b/modules/generators/mod_asis.dsp deleted file mode 100644 index b4d2a47de35d0aef57c8b3e0784b339f09b63f64..0000000000000000000000000000000000000000 --- a/modules/generators/mod_asis.dsp +++ /dev/null @@ -1,128 +0,0 @@ -# Microsoft Developer Studio Project File - Name="mod_asis" - Package Owner=<4> -# Microsoft Developer Studio Generated Build File, Format Version 6.00 -# ** DO NOT EDIT ** - -# TARGTYPE "Win32 (x86) Dynamic-Link Library" 0x0102 - -CFG=mod_asis - Win32 Release -!MESSAGE This is not a valid makefile. To build this project using NMAKE, -!MESSAGE use the Export Makefile command and run -!MESSAGE -!MESSAGE NMAKE /f "mod_asis.mak". -!MESSAGE -!MESSAGE You can specify a configuration when running NMAKE -!MESSAGE by defining the macro CFG on the command line. For example: -!MESSAGE -!MESSAGE NMAKE /f "mod_asis.mak" CFG="mod_asis - Win32 Release" -!MESSAGE -!MESSAGE Possible choices for configuration are: -!MESSAGE -!MESSAGE "mod_asis - Win32 Release" (based on "Win32 (x86) Dynamic-Link Library") -!MESSAGE "mod_asis - Win32 Debug" (based on "Win32 (x86) Dynamic-Link Library") -!MESSAGE - -# Begin Project -# PROP AllowPerConfigDependencies 0 -# PROP Scc_ProjName "" -# PROP Scc_LocalPath "" -CPP=cl.exe -MTL=midl.exe -RSC=rc.exe - -!IF "$(CFG)" == "mod_asis - Win32 Release" - -# PROP BASE Use_MFC 0 -# PROP BASE Use_Debug_Libraries 0 -# PROP BASE Output_Dir "Release" -# PROP BASE Intermediate_Dir "Release" -# PROP BASE Target_Dir "" -# PROP Use_MFC 0 -# PROP Use_Debug_Libraries 0 -# PROP Output_Dir "Release" -# PROP Intermediate_Dir "Release" -# PROP Ignore_Export_Lib 0 -# PROP Target_Dir "" -# ADD BASE CPP /nologo /MD /W3 /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /FD /c -# ADD CPP /nologo /MD /W3 /O2 /I "../../include" /I "../../srclib/apr/include" /I "../../srclib/apr-util/include" /D "NDEBUG" /D "WIN32" /D "_WINDOWS" /Fd"Release\mod_asis" /FD /c -# ADD BASE MTL /nologo /D "NDEBUG" /win32 -# ADD MTL /nologo /D "NDEBUG" /mktyplib203 /win32 -# ADD BASE RSC /l 0x409 /d "NDEBUG" -# ADD RSC /l 0x409 /d "NDEBUG" -BSC32=bscmake.exe -# ADD BASE BSC32 /nologo -# ADD BSC32 /nologo -LINK32=link.exe -# ADD BASE LINK32 kernel32.lib /nologo /subsystem:windows /dll /map /machine:I386 /out:"Release/mod_asis.so" /base:@..\..\os\win32\BaseAddr.ref,mod_asis -# ADD LINK32 kernel32.lib /nologo /subsystem:windows /dll /map /machine:I386 /out:"Release/mod_asis.so" /base:@..\..\os\win32\BaseAddr.ref,mod_asis - -!ELSEIF "$(CFG)" == "mod_asis - Win32 Debug" - -# PROP BASE Use_MFC 0 -# PROP BASE Use_Debug_Libraries 1 -# PROP BASE Output_Dir "Debug" -# PROP BASE Intermediate_Dir "Debug" -# PROP BASE Target_Dir "" -# PROP Use_MFC 0 -# PROP Use_Debug_Libraries 1 -# PROP Output_Dir "Debug" -# PROP Intermediate_Dir "Debug" -# PROP Ignore_Export_Lib 0 -# PROP Target_Dir "" -# ADD BASE CPP /nologo /MDd /W3 /GX /Zi /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /FD /c -# ADD CPP /nologo /MDd /W3 /GX /Zi /Od /I "../../include" /I "../../srclib/apr/include" /I "../../srclib/apr-util/include" /D "_DEBUG" /D "WIN32" /D "_WINDOWS" /Fd"Debug\mod_asis" /FD /c -# ADD BASE MTL /nologo /D "_DEBUG" /win32 -# ADD MTL /nologo /D "_DEBUG" /mktyplib203 /win32 -# ADD BASE RSC /l 0x409 /d "_DEBUG" -# ADD RSC /l 0x409 /d "_DEBUG" -BSC32=bscmake.exe -# ADD BASE BSC32 /nologo -# ADD BSC32 /nologo -LINK32=link.exe -# ADD BASE LINK32 kernel32.lib /nologo /subsystem:windows /dll /incremental:no /map /debug /machine:I386 /out:"Debug/mod_asis.so" /base:@..\..\os\win32\BaseAddr.ref,mod_asis -# ADD LINK32 kernel32.lib /nologo /subsystem:windows /dll /incremental:no /map /debug /machine:I386 /out:"Debug/mod_asis.so" /base:@..\..\os\win32\BaseAddr.ref,mod_asis - -!ENDIF - -# Begin Target - -# Name "mod_asis - Win32 Release" -# Name "mod_asis - Win32 Debug" -# Begin Source File - -SOURCE=.\mod_asis.c -# End Source File -# Begin Source File - -SOURCE=.\mod_asis.rc -# End Source File -# Begin Source File - -SOURCE=..\..\build\win32\win32ver.awk - -!IF "$(CFG)" == "mod_asis - Win32 Release" - -# PROP Ignore_Default_Tool 1 -# Begin Custom Build - Creating Version Resource -InputPath=..\..\build\win32\win32ver.awk - -".\mod_asis.rc" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)" - awk -f ../../build/win32/win32ver.awk mod_asis "asis_module for Apache" ../../include/ap_release.h > .\mod_asis.rc - -# End Custom Build - -!ELSEIF "$(CFG)" == "mod_asis - Win32 Debug" - -# PROP Ignore_Default_Tool 1 -# Begin Custom Build - Creating Version Resource -InputPath=..\..\build\win32\win32ver.awk - -".\mod_asis.rc" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)" - awk -f ../../build/win32/win32ver.awk mod_asis "asis_module for Apache" ../../include/ap_release.h > .\mod_asis.rc - -# End Custom Build - -!ENDIF - -# End Source File -# End Target -# End Project diff --git a/modules/generators/mod_asis.exp b/modules/generators/mod_asis.exp deleted file mode 100644 index 4f347d921e0358347fd7f2cdb1a6b1bf77e9857d..0000000000000000000000000000000000000000 --- a/modules/generators/mod_asis.exp +++ /dev/null @@ -1 +0,0 @@ -asis_module diff --git a/modules/generators/mod_autoindex.c b/modules/generators/mod_autoindex.c deleted file mode 100644 index 9c28dc4086438daea0d5f98a62255929a6c9e04a..0000000000000000000000000000000000000000 --- a/modules/generators/mod_autoindex.c +++ /dev/null @@ -1,1673 +0,0 @@ -/* ==================================================================== - * Copyright (c) 1995-1999 The Apache Group. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in - * the documentation and/or other materials provided with the - * distribution. - * - * 3. All advertising materials mentioning features or use of this - * software must display the following acknowledgment: - * "This product includes software developed by the Apache Group - * for use in the Apache HTTP server project (http://www.apache.org/)." - * - * 4. The names "Apache Server" and "Apache Group" must not be used to - * endorse or promote products derived from this software without - * prior written permission. For written permission, please contact - * apache@apache.org. - * - * 5. Products derived from this software may not be called "Apache" - * nor may "Apache" appear in their names without prior written - * permission of the Apache Group. - * - * 6. Redistributions of any form whatsoever must retain the following - * acknowledgment: - * "This product includes software developed by the Apache Group - * for use in the Apache HTTP server project (http://www.apache.org/)." - * - * THIS SOFTWARE IS PROVIDED BY THE APACHE GROUP ``AS IS'' AND ANY - * EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR - * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE APACHE GROUP OR - * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT - * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, - * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED - * OF THE POSSIBILITY OF SUCH DAMAGE. - * ==================================================================== - * - * This software consists of voluntary contributions made by many - * individuals on behalf of the Apache Group and was originally based - * on public domain software written at the National Center for - * Supercomputing Applications, University of Illinois, Urbana-Champaign. - * For more information on the Apache Group and the Apache HTTP server - * project, please see . - * - */ - -/* - * mod_autoindex.c: Handles the on-the-fly html index generation - * - * Rob McCool - * 3/23/93 - * - * Adapted to Apache by rst. - */ - -#include "httpd.h" -#include "http_config.h" -#include "http_core.h" -#include "http_request.h" -#include "http_protocol.h" -#include "http_log.h" -#include "http_main.h" -#include "util_script.h" -#include "fnmatch.h" - -module MODULE_VAR_EXPORT autoindex_module; - -/**************************************************************** - * - * Handling configuration directives... - */ - -#define HRULE 1 -#define NO_HRULE 0 -#define FRONT_MATTER 1 -#define END_MATTER 0 - -#define FANCY_INDEXING 1 /* Indexing options */ -#define ICONS_ARE_LINKS 2 -#define SCAN_HTML_TITLES 4 -#define SUPPRESS_LAST_MOD 8 -#define SUPPRESS_SIZE 16 -#define SUPPRESS_DESC 32 -#define SUPPRESS_PREAMBLE 64 -#define SUPPRESS_COLSORT 128 -#define NO_OPTIONS 256 - -#define K_PAD 1 -#define K_NOPAD 0 - -#define K_NOADJUST 0 -#define K_ADJUST 1 -#define K_UNSET 2 - -/* - * Define keys for sorting. - */ -#define K_NAME 'N' /* Sort by file name (default) */ -#define K_LAST_MOD 'M' /* Last modification date */ -#define K_SIZE 'S' /* Size (absolute, not as displayed) */ -#define K_DESC 'D' /* Description */ - -#define D_ASCENDING 'A' -#define D_DESCENDING 'D' - -/* - * These are the dimensions of the default icons supplied with Apache. - */ -#define DEFAULT_ICON_WIDTH 20 -#define DEFAULT_ICON_HEIGHT 22 - -/* - * Other default dimensions. - */ -#define DEFAULT_NAME_WIDTH 23 - -struct item { - char *type; - char *apply_to; - char *apply_path; - char *data; -}; - -typedef struct ai_desc_t { - char *pattern; - char *description; - int full_path; - int wildcards; -} ai_desc_t; - -typedef struct autoindex_config_struct { - - char *default_icon; - int opts; - int incremented_opts; - int decremented_opts; - int name_width; - int name_adjust; - int icon_width; - int icon_height; - char *default_order; - - array_header *icon_list; - array_header *alt_list; - array_header *desc_list; - array_header *ign_list; - array_header *hdr_list; - array_header *rdme_list; - -} autoindex_config_rec; - -static char c_by_encoding, c_by_type, c_by_path; - -#define BY_ENCODING &c_by_encoding -#define BY_TYPE &c_by_type -#define BY_PATH &c_by_path - -/* - * Return true if the specified string refers to the parent directory (i.e., - * matches ".." or "../"). Hopefully this one call is significantly less - * expensive than multiple strcmp() calls. - */ -static ap_inline int is_parent(const char *name) -{ - /* - * Now, IFF the first two bytes are dots, and the third byte is either - * EOS (\0) or a slash followed by EOS, we have a match. - */ - if (((name[0] == '.') && (name[1] == '.')) - && ((name[2] == '\0') - || ((name[2] == '/') && (name[3] == '\0')))) { - return 1; - } - return 0; -} - -/* - * This routine puts the standard HTML header at the top of the index page. - * We include the DOCTYPE because we may be using features therefrom (i.e., - * HEIGHT and WIDTH attributes on the icons if we're FancyIndexing). - */ -static void emit_preamble(request_rec *r, char *title) -{ - ap_rvputs(r, DOCTYPE_HTML_3_2, - "\n \n Index of ", title, - "\n \n \n", NULL); -} - -static void push_item(array_header *arr, char *type, char *to, char *path, - char *data) -{ - struct item *p = (struct item *) ap_push_array(arr); - - if (!to) { - to = ""; - } - if (!path) { - path = ""; - } - - p->type = type; - p->data = data ? ap_pstrdup(arr->pool, data) : NULL; - p->apply_path = ap_pstrcat(arr->pool, path, "*", NULL); - - if ((type == BY_PATH) && (!ap_is_matchexp(to))) { - p->apply_to = ap_pstrcat(arr->pool, "*", to, NULL); - } - else if (to) { - p->apply_to = ap_pstrdup(arr->pool, to); - } - else { - p->apply_to = NULL; - } -} - -static const char *add_alt(cmd_parms *cmd, void *d, char *alt, char *to) -{ - if (cmd->info == BY_PATH) { - if (!strcmp(to, "**DIRECTORY**")) { - to = "^^DIRECTORY^^"; - } - } - if (cmd->info == BY_ENCODING) { - ap_str_tolower(to); - } - - push_item(((autoindex_config_rec *) d)->alt_list, cmd->info, to, - cmd->path, alt); - return NULL; -} - -static const char *add_icon(cmd_parms *cmd, void *d, char *icon, char *to) -{ - char *iconbak = ap_pstrdup(cmd->pool, icon); - - if (icon[0] == '(') { - char *alt; - char *cl = strchr(iconbak, ')'); - - if (cl == NULL) { - return "missing closing paren"; - } - alt = ap_getword_nc(cmd->pool, &iconbak, ','); - *cl = '\0'; /* Lose closing paren */ - add_alt(cmd, d, &alt[1], to); - } - if (cmd->info == BY_PATH) { - if (!strcmp(to, "**DIRECTORY**")) { - to = "^^DIRECTORY^^"; - } - } - if (cmd->info == BY_ENCODING) { - ap_str_tolower(to); - } - - push_item(((autoindex_config_rec *) d)->icon_list, cmd->info, to, - cmd->path, iconbak); - return NULL; -} - -/* - * Add description text for a filename pattern. If the pattern has - * wildcards already (or we need to add them), add leading and - * trailing wildcards to it to ensure substring processing. If the - * pattern contains a '/' anywhere, force wildcard matching mode, - * add a slash to the prefix so that "bar/bletch" won't be matched - * by "foobar/bletch", and make a note that there's a delimiter; - * the matching routine simplifies to just the actual filename - * whenever it can. This allows definitions in parent directories - * to be made for files in subordinate ones using relative paths. - */ - -/* - * Absent a strcasestr() function, we have to force wildcards on - * systems for which "AAA" and "aaa" mean the same file. - */ -#ifdef CASE_BLIND_FILESYSTEM -#define WILDCARDS_REQUIRED 1 -#else -#define WILDCARDS_REQUIRED 0 -#endif - -static const char *add_desc(cmd_parms *cmd, void *d, char *desc, char *to) -{ - autoindex_config_rec *dcfg = (autoindex_config_rec *) d; - ai_desc_t *desc_entry; - char *prefix = ""; - - desc_entry = (ai_desc_t *) ap_push_array(dcfg->desc_list); - desc_entry->full_path = (strchr(to, '/') == NULL) ? 0 : 1; - desc_entry->wildcards = (WILDCARDS_REQUIRED - || desc_entry->full_path - || ap_is_fnmatch(to)); - if (desc_entry->wildcards) { - prefix = desc_entry->full_path ? "*/" : "*"; - desc_entry->pattern = ap_pstrcat(dcfg->desc_list->pool, - prefix, to, "*", NULL); - } - else { - desc_entry->pattern = ap_pstrdup(dcfg->desc_list->pool, to); - } - desc_entry->description = ap_pstrdup(dcfg->desc_list->pool, desc); - return NULL; -} - -static const char *add_ignore(cmd_parms *cmd, void *d, char *ext) -{ - push_item(((autoindex_config_rec *) d)->ign_list, 0, ext, cmd->path, NULL); - return NULL; -} - -static const char *add_header(cmd_parms *cmd, void *d, char *name) -{ - push_item(((autoindex_config_rec *) d)->hdr_list, 0, NULL, cmd->path, - name); - return NULL; -} - -static const char *add_readme(cmd_parms *cmd, void *d, char *name) -{ - push_item(((autoindex_config_rec *) d)->rdme_list, 0, NULL, cmd->path, - name); - return NULL; -} - -/* A legacy directive, FancyIndexing is superseded by the IndexOptions - * keyword. But for compatibility.. - */ -static const char *fancy_indexing(cmd_parms *cmd, void *d, int arg) -{ - int curopts; - int newopts; - autoindex_config_rec *cfg; - - cfg = (autoindex_config_rec *) d; - curopts = cfg->opts; - if (curopts & NO_OPTIONS) { - return "FancyIndexing directive conflicts with existing " - "IndexOptions None"; - } - newopts = (arg ? (curopts | FANCY_INDEXING) : (curopts & ~FANCY_INDEXING)); - cfg->opts = newopts; - return NULL; -} - -static const char *add_opts(cmd_parms *cmd, void *d, const char *optstr) -{ - char *w; - int opts; - int opts_add; - int opts_remove; - char action; - autoindex_config_rec *d_cfg = (autoindex_config_rec *) d; - - opts = d_cfg->opts; - opts_add = d_cfg->incremented_opts; - opts_remove = d_cfg->decremented_opts; - while (optstr[0]) { - int option = 0; - - w = ap_getword_conf(cmd->pool, &optstr); - if ((*w == '+') || (*w == '-')) { - action = *(w++); - } - else { - action = '\0'; - } - if (!strcasecmp(w, "FancyIndexing")) { - option = FANCY_INDEXING; - } - else if (!strcasecmp(w, "IconsAreLinks")) { - option = ICONS_ARE_LINKS; - } - else if (!strcasecmp(w, "ScanHTMLTitles")) { - option = SCAN_HTML_TITLES; - } - else if (!strcasecmp(w, "SuppressLastModified")) { - option = SUPPRESS_LAST_MOD; - } - else if (!strcasecmp(w, "SuppressSize")) { - option = SUPPRESS_SIZE; - } - else if (!strcasecmp(w, "SuppressDescription")) { - option = SUPPRESS_DESC; - } - else if (!strcasecmp(w, "SuppressHTMLPreamble")) { - option = SUPPRESS_PREAMBLE; - } - else if (!strcasecmp(w, "SuppressColumnSorting")) { - option = SUPPRESS_COLSORT; - } - else if (!strcasecmp(w, "None")) { - if (action != '\0') { - return "Cannot combine '+' or '-' with 'None' keyword"; - } - opts = NO_OPTIONS; - opts_add = 0; - opts_remove = 0; - } - else if (!strcasecmp(w, "IconWidth")) { - if (action != '-') { - d_cfg->icon_width = DEFAULT_ICON_WIDTH; - } - else { - d_cfg->icon_width = 0; - } - } - else if (!strncasecmp(w, "IconWidth=", 10)) { - if (action == '-') { - return "Cannot combine '-' with IconWidth=n"; - } - d_cfg->icon_width = atoi(&w[10]); - } - else if (!strcasecmp(w, "IconHeight")) { - if (action != '-') { - d_cfg->icon_height = DEFAULT_ICON_HEIGHT; - } - else { - d_cfg->icon_height = 0; - } - } - else if (!strncasecmp(w, "IconHeight=", 11)) { - if (action == '-') { - return "Cannot combine '-' with IconHeight=n"; - } - d_cfg->icon_height = atoi(&w[11]); - } - else if (!strcasecmp(w, "NameWidth")) { - if (action != '-') { - return "NameWidth with no value may only appear as " - "'-NameWidth'"; - } - d_cfg->name_width = DEFAULT_NAME_WIDTH; - d_cfg->name_adjust = K_NOADJUST; - } - else if (!strncasecmp(w, "NameWidth=", 10)) { - if (action == '-') { - return "Cannot combine '-' with NameWidth=n"; - } - if (w[10] == '*') { - d_cfg->name_adjust = K_ADJUST; - } - else { - int width = atoi(&w[10]); - - if (width < 5) { - return "NameWidth value must be greater than 5"; - } - d_cfg->name_width = width; - d_cfg->name_adjust = K_NOADJUST; - } - } - else { - return "Invalid directory indexing option"; - } - if (action == '\0') { - opts |= option; - opts_add = 0; - opts_remove = 0; - } - else if (action == '+') { - opts_add |= option; - opts_remove &= ~option; - } - else { - opts_remove |= option; - opts_add &= ~option; - } - } - if ((opts & NO_OPTIONS) && (opts & ~NO_OPTIONS)) { - return "Cannot combine other IndexOptions keywords with 'None'"; - } - d_cfg->incremented_opts = opts_add; - d_cfg->decremented_opts = opts_remove; - d_cfg->opts = opts; - return NULL; -} - -static const char *set_default_order(cmd_parms *cmd, void *m, char *direction, - char *key) -{ - char temp[4]; - autoindex_config_rec *d_cfg = (autoindex_config_rec *) m; - - ap_cpystrn(temp, "k=d", sizeof(temp)); - if (!strcasecmp(direction, "Ascending")) { - temp[2] = D_ASCENDING; - } - else if (!strcasecmp(direction, "Descending")) { - temp[2] = D_DESCENDING; - } - else { - return "First keyword must be 'Ascending' or 'Descending'"; - } - - if (!strcasecmp(key, "Name")) { - temp[0] = K_NAME; - } - else if (!strcasecmp(key, "Date")) { - temp[0] = K_LAST_MOD; - } - else if (!strcasecmp(key, "Size")) { - temp[0] = K_SIZE; - } - else if (!strcasecmp(key, "Description")) { - temp[0] = K_DESC; - } - else { - return "Second keyword must be 'Name', 'Date', 'Size', or " - "'Description'"; - } - - if (d_cfg->default_order == NULL) { - d_cfg->default_order = ap_palloc(cmd->pool, 4); - d_cfg->default_order[3] = '\0'; - } - ap_cpystrn(d_cfg->default_order, temp, sizeof(temp)); - return NULL; -} - -#define DIR_CMD_PERMS OR_INDEXES - -static const command_rec autoindex_cmds[] = -{ - {"AddIcon", add_icon, BY_PATH, DIR_CMD_PERMS, ITERATE2, - "an icon URL followed by one or more filenames"}, - {"AddIconByType", add_icon, BY_TYPE, DIR_CMD_PERMS, ITERATE2, - "an icon URL followed by one or more MIME types"}, - {"AddIconByEncoding", add_icon, BY_ENCODING, DIR_CMD_PERMS, ITERATE2, - "an icon URL followed by one or more content encodings"}, - {"AddAlt", add_alt, BY_PATH, DIR_CMD_PERMS, ITERATE2, - "alternate descriptive text followed by one or more filenames"}, - {"AddAltByType", add_alt, BY_TYPE, DIR_CMD_PERMS, ITERATE2, - "alternate descriptive text followed by one or more MIME types"}, - {"AddAltByEncoding", add_alt, BY_ENCODING, DIR_CMD_PERMS, ITERATE2, - "alternate descriptive text followed by one or more content encodings"}, - {"IndexOptions", add_opts, NULL, DIR_CMD_PERMS, RAW_ARGS, - "one or more index options"}, - {"IndexOrderDefault", set_default_order, NULL, DIR_CMD_PERMS, TAKE2, - "{Ascending,Descending} {Name,Size,Description,Date}"}, - {"IndexIgnore", add_ignore, NULL, DIR_CMD_PERMS, ITERATE, - "one or more file extensions"}, - {"AddDescription", add_desc, BY_PATH, DIR_CMD_PERMS, ITERATE2, - "Descriptive text followed by one or more filenames"}, - {"HeaderName", add_header, NULL, DIR_CMD_PERMS, TAKE1, "a filename"}, - {"ReadmeName", add_readme, NULL, DIR_CMD_PERMS, TAKE1, "a filename"}, - {"FancyIndexing", fancy_indexing, NULL, DIR_CMD_PERMS, FLAG, - "Limited to 'on' or 'off' (superseded by IndexOptions FancyIndexing)"}, - {"DefaultIcon", ap_set_string_slot, - (void *) XtOffsetOf(autoindex_config_rec, default_icon), - DIR_CMD_PERMS, TAKE1, "an icon URL"}, - {NULL} -}; - -static void *create_autoindex_config(pool *p, char *dummy) -{ - autoindex_config_rec *new = - (autoindex_config_rec *) ap_pcalloc(p, sizeof(autoindex_config_rec)); - - new->icon_width = 0; - new->icon_height = 0; - new->name_width = DEFAULT_NAME_WIDTH; - new->name_adjust = K_UNSET; - new->icon_list = ap_make_array(p, 4, sizeof(struct item)); - new->alt_list = ap_make_array(p, 4, sizeof(struct item)); - new->desc_list = ap_make_array(p, 4, sizeof(ai_desc_t)); - new->ign_list = ap_make_array(p, 4, sizeof(struct item)); - new->hdr_list = ap_make_array(p, 4, sizeof(struct item)); - new->rdme_list = ap_make_array(p, 4, sizeof(struct item)); - new->opts = 0; - new->incremented_opts = 0; - new->decremented_opts = 0; - new->default_order = NULL; - - return (void *) new; -} - -static void *merge_autoindex_configs(pool *p, void *basev, void *addv) -{ - autoindex_config_rec *new; - autoindex_config_rec *base = (autoindex_config_rec *) basev; - autoindex_config_rec *add = (autoindex_config_rec *) addv; - - new = (autoindex_config_rec *) ap_pcalloc(p, sizeof(autoindex_config_rec)); - new->default_icon = add->default_icon ? add->default_icon - : base->default_icon; - new->icon_height = add->icon_height ? add->icon_height : base->icon_height; - new->icon_width = add->icon_width ? add->icon_width : base->icon_width; - - new->alt_list = ap_append_arrays(p, add->alt_list, base->alt_list); - new->ign_list = ap_append_arrays(p, add->ign_list, base->ign_list); - new->hdr_list = ap_append_arrays(p, add->hdr_list, base->hdr_list); - new->desc_list = ap_append_arrays(p, add->desc_list, base->desc_list); - new->icon_list = ap_append_arrays(p, add->icon_list, base->icon_list); - new->rdme_list = ap_append_arrays(p, add->rdme_list, base->rdme_list); - if (add->opts & NO_OPTIONS) { - /* - * If the current directory says 'no options' then we also - * clear any incremental mods from being inheritable further down. - */ - new->opts = NO_OPTIONS; - new->incremented_opts = 0; - new->decremented_opts = 0; - } - else { - /* - * If there were any non-incremental options selected for - * this directory, they dominate and we don't inherit *anything.* - * Contrariwise, we *do* inherit if the only settings here are - * incremental ones. - */ - if (add->opts == 0) { - new->incremented_opts = (base->incremented_opts - | add->incremented_opts) - & ~add->decremented_opts; - new->decremented_opts = (base->decremented_opts - | add->decremented_opts); - /* - * We may have incremental settings, so make sure we don't - * inadvertently inherit an IndexOptions None from above. - */ - new->opts = (base->opts & ~NO_OPTIONS); - } - else { - /* - * There are local non-incremental settings, which clear - * all inheritance from above. They *are* the new base settings. - */ - new->opts = add->opts;; - } - /* - * We're guaranteed that there'll be no overlap between - * the add-options and the remove-options. - */ - new->opts |= new->incremented_opts; - new->opts &= ~new->decremented_opts; - } - /* - * Inherit the NameWidth settings if there aren't any specific to - * the new location; otherwise we'll end up using the defaults set in the - * config-rec creation routine. - */ - if (add->name_adjust == K_UNSET) { - new->name_width = base->name_width; - new->name_adjust = base->name_adjust; - } - else { - new->name_width = add->name_width; - new->name_adjust = add->name_adjust; - } - - new->default_order = (add->default_order != NULL) - ? add->default_order : base->default_order; - return new; -} - -/**************************************************************** - * - * Looking things up in config entries... - */ - -/* Structure used to hold entries when we're actually building an index */ - -struct ent { - char *name; - char *icon; - char *alt; - char *desc; - off_t size; - time_t lm; - struct ent *next; - int ascending; - char key; -}; - -static char *find_item(request_rec *r, array_header *list, int path_only) -{ - const char *content_type = r->content_type; - const char *content_encoding = r->content_encoding; - char *path = r->filename; - - struct item *items = (struct item *) list->elts; - int i; - - for (i = 0; i < list->nelts; ++i) { - struct item *p = &items[i]; - - /* Special cased for ^^DIRECTORY^^ and ^^BLANKICON^^ */ - if ((path[0] == '^') || (!ap_strcmp_match(path, p->apply_path))) { - if (!*(p->apply_to)) { - return p->data; - } - else if (p->type == BY_PATH || path[0] == '^') { - if (!ap_strcmp_match(path, p->apply_to)) { - return p->data; - } - } - else if (!path_only) { - if (!content_encoding) { - if (p->type == BY_TYPE) { - if (content_type - && !ap_strcasecmp_match(content_type, - p->apply_to)) { - return p->data; - } - } - } - else { - if (p->type == BY_ENCODING) { - if (!ap_strcasecmp_match(content_encoding, - p->apply_to)) { - return p->data; - } - } - } - } - } - } - return NULL; -} - -#define find_icon(d,p,t) find_item(p,d->icon_list,t) -#define find_alt(d,p,t) find_item(p,d->alt_list,t) -#define find_header(d,p) find_item(p,d->hdr_list,0) -#define find_readme(d,p) find_item(p,d->rdme_list,0) - -static char *find_default_icon(autoindex_config_rec *d, char *bogus_name) -{ - request_rec r; - - /* Bleah. I tried to clean up find_item, and it lead to this bit - * of ugliness. Note that the fields initialized are precisely - * those that find_item looks at... - */ - - r.filename = bogus_name; - r.content_type = r.content_encoding = NULL; - - return find_item(&r, d->icon_list, 1); -} - -/* - * Look through the list of pattern/description pairs and return the first one - * if any) that matches the filename in the request. If multiple patterns - * match, only the first one is used; since the order in the array is the - * same as the order in which directives were processed, earlier matching - * directives will dominate. - */ - -#ifdef CASE_BLIND_FILESYSTEM -#define MATCH_FLAGS FNM_CASE_BLIND -#else -#define MATCH_FLAGS 0 -#endif - -static char *find_desc(autoindex_config_rec *dcfg, request_rec *r) -{ - int i; - ai_desc_t *list = (ai_desc_t *) dcfg->desc_list->elts; - const char *filename_full = r->filename; - const char *filename_only; - const char *filename; - - /* - * If the filename includes a path, extract just the name itself - * for the simple matches. - */ - if ((filename_only = strrchr(filename_full, '/')) == NULL) { - filename_only = filename_full; - } - else { - filename_only++; - } - for (i = 0; i < dcfg->desc_list->nelts; ++i) { - ai_desc_t *tuple = &list[i]; - int found; - - /* - * Only use the full-path filename if the pattern contains '/'s. - */ - filename = (tuple->full_path) ? filename_full : filename_only; - /* - * Make the comparison using the cheapest method; only do - * wildcard checking if we must. - */ - if (tuple->wildcards) { - found = (ap_fnmatch(tuple->pattern, filename, MATCH_FLAGS) == 0); - } - else { - found = (strstr(filename, tuple->pattern) != NULL); - } - if (found) { - return tuple->description; - } - } - return NULL; -} - -static int ignore_entry(autoindex_config_rec *d, char *path) -{ - array_header *list = d->ign_list; - struct item *items = (struct item *) list->elts; - char *tt; - int i; - - if ((tt = strrchr(path, '/')) == NULL) { - tt = path; - } - else { - tt++; - } - - for (i = 0; i < list->nelts; ++i) { - struct item *p = &items[i]; - char *ap; - - if ((ap = strrchr(p->apply_to, '/')) == NULL) { - ap = p->apply_to; - } - else { - ap++; - } - -#ifndef CASE_BLIND_FILESYSTEM - if (!ap_strcmp_match(path, p->apply_path) - && !ap_strcmp_match(tt, ap)) { - return 1; - } -#else /* !CASE_BLIND_FILESYSTEM */ - /* - * On some platforms, the match must be case-blind. This is really - * a factor of the filesystem involved, but we can't detect that - * reliably - so we have to granularise at the OS level. - */ - if (!ap_strcasecmp_match(path, p->apply_path) - && !ap_strcasecmp_match(tt, ap)) { - return 1; - } -#endif /* !CASE_BLIND_FILESYSTEM */ - } - return 0; -} - -/***************************************************************** - * - * Actually generating output - */ - -/* - * Elements of the emitted document: - * Preamble - * Emitted unless SUPPRESS_PREAMBLE is set AND ap_run_sub_req - * succeeds for the (content_type == text/html) header file. - * Header file - * Emitted if found (and able). - * H1 tag line - * Emitted if a header file is NOT emitted. - * Directory stuff - * Always emitted. - * HR - * Emitted if FANCY_INDEXING is set. - * Readme file - * Emitted if found (and able). - * ServerSig - * Emitted if ServerSignature is not Off AND a readme file - * is NOT emitted. - * Postamble - * Emitted unless SUPPRESS_PREAMBLE is set AND ap_run_sub_req - * succeeds for the (content_type == text/html) readme file. - */ - - -/* - * emit a plain text file - */ -static void do_emit_plain(request_rec *r, FILE *f) -{ - char buf[IOBUFSIZE + 1]; - int i, n, c, ch; - - ap_rputs("
    \n", r);
    -    while (!feof(f)) {
    -	do {
    -	    n = fread(buf, sizeof(char), IOBUFSIZE, f);
    -	}
    -	while (n == -1 && ferror(f) && errno == EINTR);
    -	if (n == -1 || n == 0) {
    -	    break;
    -	}
    -	buf[n] = '\0';
    -	c = 0;
    -	while (c < n) {
    -	    for (i = c; i < n; i++) {
    -		if (buf[i] == '<' || buf[i] == '>' || buf[i] == '&') {
    -		    break;
    -		}
    -	    }
    -	    ch = buf[i];
    -	    buf[i] = '\0';
    -	    ap_rputs(&buf[c], r);
    -	    if (ch == '<') {
    -		ap_rputs("<", r);
    -	    }
    -	    else if (ch == '>') {
    -		ap_rputs(">", r);
    -	    }
    -	    else if (ch == '&') {
    -		ap_rputs("&", r);
    -	    }
    -	    c = i + 1;
    -	}
    -    }
    -    ap_rputs("
    \n", r); -} - -/* - * Handle the preamble through the H1 tag line, inclusive. Locate - * the file with a subrequests. Process text/html documents by actually - * running the subrequest; text/xxx documents get copied verbatim, - * and any other content type is ignored. This means that a non-text - * document (such as HEADER.gif) might get multiviewed as the result - * instead of a text document, meaning nothing will be displayed, but - * oh well. - */ -static void emit_head(request_rec *r, char *header_fname, int suppress_amble, - char *title) -{ - FILE *f; - request_rec *rr = NULL; - int emit_amble = 1; - int emit_H1 = 1; - - /* - * If there's a header file, send a subrequest to look for it. If it's - * found and a text file, handle it -- otherwise fall through and - * pretend there's nothing there. - */ - if ((header_fname != NULL) - && (rr = ap_sub_req_lookup_uri(header_fname, r)) - && (rr->status == HTTP_OK) - && (rr->filename != NULL) - && S_ISREG(rr->finfo.st_mode)) { - /* - * Check for the two specific cases we allow: text/html and - * text/anything-else. The former is allowed to be processed for - * SSIs. - */ - if (rr->content_type != NULL) { - if (!strcasecmp(ap_field_noparam(r->pool, rr->content_type), - "text/html")) { - /* Hope everything will work... */ - emit_amble = 0; - emit_H1 = 0; - - if (! suppress_amble) { - emit_preamble(r, title); - } - /* - * If there's a problem running the subrequest, display the - * preamble if we didn't do it before -- the header file - * didn't get displayed. - */ - if (ap_run_sub_req(rr) != OK) { - /* It didn't work */ - emit_amble = suppress_amble; - emit_H1 = 1; - } - } - else if (!strncasecmp("text/", rr->content_type, 5)) { - /* - * If we can open the file, prefix it with the preamble - * regardless; since we'll be sending a
     block around
    -		 * the file's contents, any HTML header it had won't end up
    -		 * where it belongs.
    -		 */
    -		if ((f = ap_pfopen(r->pool, rr->filename, "r")) != 0) {
    -		    emit_preamble(r, title);
    -		    emit_amble = 0;
    -		    do_emit_plain(r, f);
    -		    ap_pfclose(r->pool, f);
    -		    emit_H1 = 0;
    -		}
    -	    }
    -	}
    -    }
    -
    -    if (emit_amble) {
    -	emit_preamble(r, title);
    -    }
    -    if (emit_H1) {
    -	ap_rvputs(r, "

    Index of ", title, "

    \n", NULL); - } - if (rr != NULL) { - ap_destroy_sub_req(rr); - } -} - - -/* - * Handle the Readme file through the postamble, inclusive. Locate - * the file with a subrequests. Process text/html documents by actually - * running the subrequest; text/xxx documents get copied verbatim, - * and any other content type is ignored. This means that a non-text - * document (such as FOOTER.gif) might get multiviewed as the result - * instead of a text document, meaning nothing will be displayed, but - * oh well. - */ -static void emit_tail(request_rec *r, char *readme_fname, int suppress_amble) -{ - FILE *f; - request_rec *rr = NULL; - int suppress_post = 0; - int suppress_sig = 0; - - /* - * If there's a readme file, send a subrequest to look for it. If it's - * found and a text file, handle it -- otherwise fall through and - * pretend there's nothing there. - */ - if ((readme_fname != NULL) - && (rr = ap_sub_req_lookup_uri(readme_fname, r)) - && (rr->status == HTTP_OK) - && (rr->filename != NULL) - && S_ISREG(rr->finfo.st_mode)) { - /* - * Check for the two specific cases we allow: text/html and - * text/anything-else. The former is allowed to be processed for - * SSIs. - */ - if (rr->content_type != NULL) { - if (!strcasecmp(ap_field_noparam(r->pool, rr->content_type), - "text/html")) { - if (ap_run_sub_req(rr) == OK) { - /* worked... */ - suppress_sig = 1; - suppress_post = suppress_amble; - } - } - else if (!strncasecmp("text/", rr->content_type, 5)) { - /* - * If we can open the file, suppress the signature. - */ - if ((f = ap_pfopen(r->pool, rr->filename, "r")) != 0) { - do_emit_plain(r, f); - ap_pfclose(r->pool, f); - suppress_sig = 1; - } - } - } - } - - if (!suppress_sig) { - ap_rputs(ap_psignature("", r), r); - } - if (!suppress_post) { - ap_rputs("\n", r); - } - if (rr != NULL) { - ap_destroy_sub_req(rr); - } -} - - -static char *find_title(request_rec *r) -{ - char titlebuf[MAX_STRING_LEN], *find = ""; - FILE *thefile = NULL; - int x, y, n, p; - - if (r->status != HTTP_OK) { - return NULL; - } - if ((r->content_type != NULL) - && (!strcasecmp(ap_field_noparam(r->pool, r->content_type), - "text/html") - || !strcmp(r->content_type, INCLUDES_MAGIC_TYPE)) - && !r->content_encoding) { - if (!(thefile = ap_pfopen(r->pool, r->filename, "r"))) { - return NULL; - } - n = fread(titlebuf, sizeof(char), MAX_STRING_LEN - 1, thefile); - if (n <= 0) { - ap_pfclose(r->pool, thefile); - return NULL; - } - titlebuf[n] = '\0'; - for (x = 0, p = 0; titlebuf[x]; x++) { - if (ap_toupper(titlebuf[x]) == find[p]) { - if (!find[++p]) { - if ((p = ap_ind(&titlebuf[++x], '<')) != -1) { - titlebuf[x + p] = '\0'; - } - /* Scan for line breaks for Tanmoy's secretary */ - for (y = x; titlebuf[y]; y++) { - if ((titlebuf[y] == CR) || (titlebuf[y] == LF)) { - if (y == x) { - x++; - } - else { - titlebuf[y] = ' '; - } - } - } - ap_pfclose(r->pool, thefile); - return ap_pstrdup(r->pool, &titlebuf[x]); - } - } - else { - p = 0; - } - } - ap_pfclose(r->pool, thefile); - } - return NULL; -} - -static struct ent *make_autoindex_entry(char *name, int autoindex_opts, - autoindex_config_rec *d, - request_rec *r, char keyid, - char direction) -{ - struct ent *p; - - if ((name[0] == '.') && (!name[1])) { - return (NULL); - } - - if (ignore_entry(d, ap_make_full_path(r->pool, r->filename, name))) { - return (NULL); - } - - p = (struct ent *) ap_pcalloc(r->pool, sizeof(struct ent)); - p->name = ap_pstrdup(r->pool, name); - p->size = -1; - p->icon = NULL; - p->alt = NULL; - p->desc = NULL; - p->lm = -1; - p->key = ap_toupper(keyid); - p->ascending = (ap_toupper(direction) == D_ASCENDING); - - if (autoindex_opts & FANCY_INDEXING) { - request_rec *rr = ap_sub_req_lookup_file(name, r); - - if (rr->finfo.st_mode != 0) { - p->lm = rr->finfo.st_mtime; - if (S_ISDIR(rr->finfo.st_mode)) { - if (!(p->icon = find_icon(d, rr, 1))) { - p->icon = find_default_icon(d, "^^DIRECTORY^^"); - } - if (!(p->alt = find_alt(d, rr, 1))) { - p->alt = "DIR"; - } - p->size = -1; - p->name = ap_pstrcat(r->pool, name, "/", NULL); - } - else { - p->icon = find_icon(d, rr, 0); - p->alt = find_alt(d, rr, 0); - p->size = rr->finfo.st_size; - } - } - - p->desc = find_desc(d, rr); - - if ((!p->desc) && (autoindex_opts & SCAN_HTML_TITLES)) { - p->desc = ap_pstrdup(r->pool, find_title(rr)); - } - - ap_destroy_sub_req(rr); - } - /* - * We don't need to take any special action for the file size key. If - * we did, it would go here. - */ - if (keyid == K_LAST_MOD) { - if (p->lm < 0) { - p->lm = 0; - } - } - return (p); -} - -static char *terminate_description(autoindex_config_rec *d, char *desc, - int autoindex_opts) -{ - int maxsize = 23; - register int x; - - if (autoindex_opts & SUPPRESS_LAST_MOD) { - maxsize += 19; - } - if (autoindex_opts & SUPPRESS_SIZE) { - maxsize += 7; - } - - for (x = 0; desc[x] && (maxsize > 0 || desc[x]=='<'); x++) { - if (desc[x] == '<') { - while (desc[x] != '>') { - if (!desc[x]) { - maxsize = 0; - break; - } - ++x; - } - } - else if (desc[x] == '&') { - /* entities like ä count as one character */ - --maxsize; - for ( ; desc[x] != ';'; ++x) { - if (desc[x] == '\0') { - maxsize = 0; - break; - } - } - } - else { - --maxsize; - } - } - if (!maxsize && desc[x] != '\0') { - desc[x - 1] = '>'; /* Grump. */ - desc[x] = '\0'; /* Double Grump! */ - } - return desc; -} - -/* - * Emit the anchor for the specified field. If a field is the key for the - * current request, the link changes its meaning to reverse the order when - * selected again. Non-active fields always start in ascending order. - */ -static void emit_link(request_rec *r, char *anchor, char fname, char curkey, - char curdirection, int nosort) -{ - char qvalue[5]; - int reverse; - - if (!nosort) { - qvalue[0] = '?'; - qvalue[1] = fname; - qvalue[2] = '='; - qvalue[4] = '\0'; - reverse = ((curkey == fname) && (curdirection == D_ASCENDING)); - qvalue[3] = reverse ? D_DESCENDING : D_ASCENDING; - ap_rvputs(r, "<A HREF=\"", qvalue, "\">", anchor, "</A>", NULL); - } - else { - ap_rputs(anchor, r); - } -} - -static void output_directories(struct ent **ar, int n, - autoindex_config_rec *d, request_rec *r, - int autoindex_opts, char keyid, char direction) -{ - int x; - char *name = r->uri; - char *tp; - int static_columns = (autoindex_opts & SUPPRESS_COLSORT); - pool *scratch = ap_make_sub_pool(r->pool); - int name_width; - char *name_scratch; - char *pad_scratch; - - if (name[0] == '\0') { - name = "/"; - } - - name_width = d->name_width; - if (d->name_adjust == K_ADJUST) { - for (x = 0; x < n; x++) { - int t = strlen(ar[x]->name); - if (t > name_width) { - name_width = t; - } - } - } - name_scratch = ap_palloc(r->pool, name_width + 1); - pad_scratch = ap_palloc(r->pool, name_width + 1); - memset(pad_scratch, ' ', name_width); - pad_scratch[name_width] = '\0'; - - if (autoindex_opts & FANCY_INDEXING) { - ap_rputs("<PRE>", r); - if ((tp = find_default_icon(d, "^^BLANKICON^^"))) { - ap_rvputs(r, "<IMG SRC=\"", ap_escape_html(scratch, tp), - "\" ALT=\" \"", NULL); - if (d->icon_width && d->icon_height) { - ap_rprintf - ( - r, - " HEIGHT=\"%d\" WIDTH=\"%d\"", - d->icon_height, - d->icon_width - ); - } - ap_rputs("> ", r); - } - emit_link(r, "Name", K_NAME, keyid, direction, static_columns); - ap_rputs(pad_scratch + 4, r); - /* - * Emit the guaranteed-at-least-one-space-between-columns byte. - */ - ap_rputs(" ", r); - if (!(autoindex_opts & SUPPRESS_LAST_MOD)) { - emit_link(r, "Last modified", K_LAST_MOD, keyid, direction, - static_columns); - ap_rputs(" ", r); - } - if (!(autoindex_opts & SUPPRESS_SIZE)) { - emit_link(r, "Size", K_SIZE, keyid, direction, static_columns); - ap_rputs(" ", r); - } - if (!(autoindex_opts & SUPPRESS_DESC)) { - emit_link(r, "Description", K_DESC, keyid, direction, - static_columns); - } - ap_rputs("\n<HR>\n", r); - } - else { - ap_rputs("<UL>", r); - } - - for (x = 0; x < n; x++) { - char *anchor, *t, *t2; - int nwidth; - - ap_clear_pool(scratch); - - if (is_parent(ar[x]->name)) { - t = ap_make_full_path(scratch, name, "../"); - ap_getparents(t); - if (t[0] == '\0') { - t = "/"; - } - t2 = "Parent Directory"; - anchor = ap_escape_html(scratch, ap_os_escape_path(scratch, t, 0)); - } - else { - t = ar[x]->name; - t2 = t; - anchor = ap_escape_html(scratch, ap_os_escape_path(scratch, t, 0)); - } - - if (autoindex_opts & FANCY_INDEXING) { - if (autoindex_opts & ICONS_ARE_LINKS) { - ap_rvputs(r, "<A HREF=\"", anchor, "\">", NULL); - } - if ((ar[x]->icon) || d->default_icon) { - ap_rvputs(r, "<IMG SRC=\"", - ap_escape_html(scratch, - ar[x]->icon ? ar[x]->icon - : d->default_icon), - "\" ALT=\"[", (ar[x]->alt ? ar[x]->alt : " "), - "]\"", NULL); - if (d->icon_width && d->icon_height) { - ap_rprintf(r, " HEIGHT=\"%d\" WIDTH=\"%d\"", - d->icon_height, d->icon_width); - } - ap_rputs(">", r); - } - if (autoindex_opts & ICONS_ARE_LINKS) { - ap_rputs("</A>", r); - } - - nwidth = strlen(t2); - if (nwidth > name_width) { - memcpy(name_scratch, t2, name_width - 3); - name_scratch[name_width - 3] = '.'; - name_scratch[name_width - 2] = '.'; - name_scratch[name_width - 1] = '>'; - name_scratch[name_width] = 0; - t2 = name_scratch; - nwidth = name_width; - } - ap_rvputs(r, " <A HREF=\"", anchor, "\">", - ap_escape_html(scratch, t2), "</A>", pad_scratch + nwidth, - NULL); - /* - * The blank before the storm.. er, before the next field. - */ - ap_rputs(" ", r); - if (!(autoindex_opts & SUPPRESS_LAST_MOD)) { - if (ar[x]->lm != -1) { - char time_str[MAX_STRING_LEN]; - struct tm *ts = localtime(&ar[x]->lm); - strftime(time_str, MAX_STRING_LEN, "%d-%b-%Y %H:%M ", ts); - ap_rputs(time_str, r); - } - else { - /*Length="22-Feb-1998 23:42 " (see 4 lines above) */ - ap_rputs(" ", r); - } - } - if (!(autoindex_opts & SUPPRESS_SIZE)) { - ap_send_size(ar[x]->size, r); - ap_rputs(" ", r); - } - if (!(autoindex_opts & SUPPRESS_DESC)) { - if (ar[x]->desc) { - ap_rputs(terminate_description(d, ar[x]->desc, - autoindex_opts), r); - } - } - } - else { - ap_rvputs(r, "<LI><A HREF=\"", anchor, "\"> ", t2, - "</A>", NULL); - } - ap_rputc('\n', r); - } - if (autoindex_opts & FANCY_INDEXING) { - ap_rputs("</PRE>", r); - } - else { - ap_rputs("</UL>", r); - } -} - -/* - * Compare two file entries according to the sort criteria. The return - * is essentially a signum function value. - */ - -static int dsortf(struct ent **e1, struct ent **e2) -{ - struct ent *c1; - struct ent *c2; - int result = 0; - - /* - * First, see if either of the entries is for the parent directory. - * If so, that *always* sorts lower than anything else. - */ - if (is_parent((*e1)->name)) { - return -1; - } - if (is_parent((*e2)->name)) { - return 1; - } - /* - * All of our comparisons will be of the c1 entry against the c2 one, - * so assign them appropriately to take care of the ordering. - */ - if ((*e1)->ascending) { - c1 = *e1; - c2 = *e2; - } - else { - c1 = *e2; - c2 = *e1; - } - switch (c1->key) { - case K_LAST_MOD: - if (c1->lm > c2->lm) { - return 1; - } - else if (c1->lm < c2->lm) { - return -1; - } - break; - case K_SIZE: - if (c1->size > c2->size) { - return 1; - } - else if (c1->size < c2->size) { - return -1; - } - break; - case K_DESC: - result = strcmp(c1->desc ? c1->desc : "", c2->desc ? c2->desc : ""); - if (result) { - return result; - } - break; - } - return strcmp(c1->name, c2->name); -} - - -static int index_directory(request_rec *r, - autoindex_config_rec *autoindex_conf) -{ - char *title_name = ap_escape_html(r->pool, r->uri); - char *title_endp; - char *name = r->filename; - - DIR *d; - struct DIR_TYPE *dstruct; - int num_ent = 0, x; - struct ent *head, *p; - struct ent **ar = NULL; - const char *qstring; - int autoindex_opts = autoindex_conf->opts; - char keyid; - char direction; - - if (!(d = ap_popendir(r->pool, name))) { - ap_log_rerror(APLOG_MARK, APLOG_ERR, r, - "Can't open directory for index: %s", r->filename); - return HTTP_FORBIDDEN; - } - - r->content_type = "text/html"; - - ap_send_http_header(r); - - if (r->header_only) { - ap_pclosedir(r->pool, d); - return 0; - } - ap_hard_timeout("send directory", r); - - /* Spew HTML preamble */ - - title_endp = title_name + strlen(title_name) - 1; - - while (title_endp > title_name && *title_endp == '/') { - *title_endp-- = '\0'; - } - - emit_head(r, find_header(autoindex_conf, r), - autoindex_opts & SUPPRESS_PREAMBLE, title_name); - - /* - * Figure out what sort of indexing (if any) we're supposed to use. - * - * If no QUERY_STRING was specified or column sorting has been - * explicitly disabled, we use the default specified by the - * IndexOrderDefault directive (if there is one); otherwise, - * we fall back to ascending by name. - */ - qstring = r->args; - if ((autoindex_opts & SUPPRESS_COLSORT) - || ((qstring == NULL) || (*qstring == '\0'))) { - qstring = autoindex_conf->default_order; - } - /* - * If there is no specific ordering defined for this directory, - * default to ascending by filename. - */ - if ((qstring == NULL) || (*qstring == '\0')) { - keyid = K_NAME; - direction = D_ASCENDING; - } - else { - keyid = *qstring; - ap_getword(r->pool, &qstring, '='); - if (qstring != '\0') { - direction = *qstring; - } - else { - direction = D_ASCENDING; - } - } - - /* - * Since we don't know how many dir. entries there are, put them into a - * linked list and then arrayificate them so qsort can use them. - */ - head = NULL; - while ((dstruct = readdir(d))) { - p = make_autoindex_entry(dstruct->d_name, autoindex_opts, - autoindex_conf, r, keyid, direction); - if (p != NULL) { - p->next = head; - head = p; - num_ent++; - } - } - if (num_ent > 0) { - ar = (struct ent **) ap_palloc(r->pool, - num_ent * sizeof(struct ent *)); - p = head; - x = 0; - while (p) { - ar[x++] = p; - p = p->next; - } - - qsort((void *) ar, num_ent, sizeof(struct ent *), - (int (*)(const void *, const void *)) dsortf); - } - output_directories(ar, num_ent, autoindex_conf, r, autoindex_opts, keyid, - direction); - ap_pclosedir(r->pool, d); - - if (autoindex_opts & FANCY_INDEXING) { - ap_rputs("<HR>\n", r); - } - emit_tail(r, find_readme(autoindex_conf, r), - autoindex_opts & SUPPRESS_PREAMBLE); - - ap_kill_timeout(r); - return 0; -} - -/* The formal handler... */ - -static int handle_autoindex(request_rec *r) -{ - autoindex_config_rec *d; - int allow_opts = ap_allow_options(r); - - d = (autoindex_config_rec *) ap_get_module_config(r->per_dir_config, - &autoindex_module); - - r->allowed |= (1 << M_GET); - if (r->method_number != M_GET) { - return DECLINED; - } - - /* OK, nothing easy. Trot out the heavy artillery... */ - - if (allow_opts & OPT_INDEXES) { - /* KLUDGE --- make the sub_req lookups happen in the right directory. - * Fixing this in the sub_req_lookup functions themselves is difficult, - * and would probably break virtual includes... - */ - - if (r->filename[strlen(r->filename) - 1] != '/') { - r->filename = ap_pstrcat(r->pool, r->filename, "/", NULL); - } - return index_directory(r, d); - } - else { - ap_log_rerror(APLOG_MARK, APLOG_NOERRNO|APLOG_ERR, r, - "Directory index forbidden by rule: %s", r->filename); - return HTTP_FORBIDDEN; - } -} - - -static const handler_rec autoindex_handlers[] = -{ - {DIR_MAGIC_TYPE, handle_autoindex}, - {NULL} -}; - -module MODULE_VAR_EXPORT autoindex_module = -{ - STANDARD_MODULE_STUFF, - NULL, /* initializer */ - create_autoindex_config, /* dir config creater */ - merge_autoindex_configs, /* dir merger --- default is to override */ - NULL, /* server config */ - NULL, /* merge server config */ - autoindex_cmds, /* command table */ - autoindex_handlers, /* handlers */ - NULL, /* filename translation */ - NULL, /* check_user_id */ - NULL, /* check auth */ - NULL, /* check access */ - NULL, /* type_checker */ - NULL, /* fixups */ - NULL, /* logger */ - NULL, /* header parser */ - NULL, /* child_init */ - NULL, /* child_exit */ - NULL /* post read-request */ -}; diff --git a/modules/generators/mod_autoindex.dsp b/modules/generators/mod_autoindex.dsp deleted file mode 100644 index 40303919059e0be13f83820a9805c7b382afa8d7..0000000000000000000000000000000000000000 --- a/modules/generators/mod_autoindex.dsp +++ /dev/null @@ -1,128 +0,0 @@ -# Microsoft Developer Studio Project File - Name="mod_autoindex" - Package Owner=<4> -# Microsoft Developer Studio Generated Build File, Format Version 6.00 -# ** DO NOT EDIT ** - -# TARGTYPE "Win32 (x86) Dynamic-Link Library" 0x0102 - -CFG=mod_autoindex - Win32 Release -!MESSAGE This is not a valid makefile. To build this project using NMAKE, -!MESSAGE use the Export Makefile command and run -!MESSAGE -!MESSAGE NMAKE /f "mod_autoindex.mak". -!MESSAGE -!MESSAGE You can specify a configuration when running NMAKE -!MESSAGE by defining the macro CFG on the command line. For example: -!MESSAGE -!MESSAGE NMAKE /f "mod_autoindex.mak" CFG="mod_autoindex - Win32 Release" -!MESSAGE -!MESSAGE Possible choices for configuration are: -!MESSAGE -!MESSAGE "mod_autoindex - Win32 Release" (based on "Win32 (x86) Dynamic-Link Library") -!MESSAGE "mod_autoindex - Win32 Debug" (based on "Win32 (x86) Dynamic-Link Library") -!MESSAGE - -# Begin Project -# PROP AllowPerConfigDependencies 0 -# PROP Scc_ProjName "" -# PROP Scc_LocalPath "" -CPP=cl.exe -MTL=midl.exe -RSC=rc.exe - -!IF "$(CFG)" == "mod_autoindex - Win32 Release" - -# PROP BASE Use_MFC 0 -# PROP BASE Use_Debug_Libraries 0 -# PROP BASE Output_Dir "Release" -# PROP BASE Intermediate_Dir "Release" -# PROP BASE Target_Dir "" -# PROP Use_MFC 0 -# PROP Use_Debug_Libraries 0 -# PROP Output_Dir "Release" -# PROP Intermediate_Dir "Release" -# PROP Ignore_Export_Lib 0 -# PROP Target_Dir "" -# ADD BASE CPP /nologo /MD /W3 /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /FD /c -# ADD CPP /nologo /MD /W3 /O2 /I "../../include" /I "../../srclib/apr/include" /I "../../srclib/apr-util/include" /D "NDEBUG" /D "WIN32" /D "_WINDOWS" /Fd"Release\mod_autoindex" /FD /c -# ADD BASE MTL /nologo /D "NDEBUG" /win32 -# ADD MTL /nologo /D "NDEBUG" /mktyplib203 /win32 -# ADD BASE RSC /l 0x409 /d "NDEBUG" -# ADD RSC /l 0x409 /d "NDEBUG" -BSC32=bscmake.exe -# ADD BASE BSC32 /nologo -# ADD BSC32 /nologo -LINK32=link.exe -# ADD BASE LINK32 kernel32.lib /nologo /subsystem:windows /dll /map /machine:I386 /out:"Release/mod_autoindex.so" /base:@..\..\os\win32\BaseAddr.ref,mod_autoindex -# ADD LINK32 kernel32.lib /nologo /subsystem:windows /dll /map /machine:I386 /out:"Release/mod_autoindex.so" /base:@..\..\os\win32\BaseAddr.ref,mod_autoindex - -!ELSEIF "$(CFG)" == "mod_autoindex - Win32 Debug" - -# PROP BASE Use_MFC 0 -# PROP BASE Use_Debug_Libraries 1 -# PROP BASE Output_Dir "Debug" -# PROP BASE Intermediate_Dir "Debug" -# PROP BASE Target_Dir "" -# PROP Use_MFC 0 -# PROP Use_Debug_Libraries 1 -# PROP Output_Dir "Debug" -# PROP Intermediate_Dir "Debug" -# PROP Ignore_Export_Lib 0 -# PROP Target_Dir "" -# ADD BASE CPP /nologo /MDd /W3 /GX /Zi /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /FD /c -# ADD CPP /nologo /MDd /W3 /GX /Zi /Od /I "../../include" /I "../../srclib/apr/include" /I "../../srclib/apr-util/include" /D "_DEBUG" /D "WIN32" /D "_WINDOWS" /Fd"Debug\mod_autoindex" /FD /c -# ADD BASE MTL /nologo /D "_DEBUG" /win32 -# ADD MTL /nologo /D "_DEBUG" /mktyplib203 /win32 -# ADD BASE RSC /l 0x409 /d "_DEBUG" -# ADD RSC /l 0x409 /d "_DEBUG" -BSC32=bscmake.exe -# ADD BASE BSC32 /nologo -# ADD BSC32 /nologo -LINK32=link.exe -# ADD BASE LINK32 kernel32.lib /nologo /subsystem:windows /dll /incremental:no /map /debug /machine:I386 /out:"Debug/mod_autoindex.so" /base:@..\..\os\win32\BaseAddr.ref,mod_autoindex -# ADD LINK32 kernel32.lib /nologo /subsystem:windows /dll /incremental:no /map /debug /machine:I386 /out:"Debug/mod_autoindex.so" /base:@..\..\os\win32\BaseAddr.ref,mod_autoindex - -!ENDIF - -# Begin Target - -# Name "mod_autoindex - Win32 Release" -# Name "mod_autoindex - Win32 Debug" -# Begin Source File - -SOURCE=.\mod_autoindex.c -# End Source File -# Begin Source File - -SOURCE=.\mod_autoindex.rc -# End Source File -# Begin Source File - -SOURCE=..\..\build\win32\win32ver.awk - -!IF "$(CFG)" == "mod_autoindex - Win32 Release" - -# PROP Ignore_Default_Tool 1 -# Begin Custom Build - Creating Version Resource -InputPath=..\..\build\win32\win32ver.awk - -".\mod_autoindex.rc" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)" - awk -f ../../build/win32/win32ver.awk mod_autoindex "autoindex_module for Apache" ../../include/ap_release.h > .\mod_autoindex.rc - -# End Custom Build - -!ELSEIF "$(CFG)" == "mod_autoindex - Win32 Debug" - -# PROP Ignore_Default_Tool 1 -# Begin Custom Build - Creating Version Resource -InputPath=..\..\build\win32\win32ver.awk - -".\mod_autoindex.rc" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)" - awk -f ../../build/win32/win32ver.awk mod_autoindex "autoindex_module for Apache" ../../include/ap_release.h > .\mod_autoindex.rc - -# End Custom Build - -!ENDIF - -# End Source File -# End Target -# End Project diff --git a/modules/generators/mod_autoindex.exp b/modules/generators/mod_autoindex.exp deleted file mode 100644 index 90f4057e9c2c7e4d2c762fad7bb1a70c04febbf3..0000000000000000000000000000000000000000 --- a/modules/generators/mod_autoindex.exp +++ /dev/null @@ -1 +0,0 @@ -autoindex_module diff --git a/modules/generators/mod_cgi.c b/modules/generators/mod_cgi.c deleted file mode 100644 index 392fb5a1f13c78f58948da1fb7094e785ad00b4c..0000000000000000000000000000000000000000 --- a/modules/generators/mod_cgi.c +++ /dev/null @@ -1,609 +0,0 @@ -/* ==================================================================== - * Copyright (c) 1995-1999 The Apache Group. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in - * the documentation and/or other materials provided with the - * distribution. - * - * 3. All advertising materials mentioning features or use of this - * software must display the following acknowledgment: - * "This product includes software developed by the Apache Group - * for use in the Apache HTTP server project (http://www.apache.org/)." - * - * 4. The names "Apache Server" and "Apache Group" must not be used to - * endorse or promote products derived from this software without - * prior written permission. For written permission, please contact - * apache@apache.org. - * - * 5. Products derived from this software may not be called "Apache" - * nor may "Apache" appear in their names without prior written - * permission of the Apache Group. - * - * 6. Redistributions of any form whatsoever must retain the following - * acknowledgment: - * "This product includes software developed by the Apache Group - * for use in the Apache HTTP server project (http://www.apache.org/)." - * - * THIS SOFTWARE IS PROVIDED BY THE APACHE GROUP ``AS IS'' AND ANY - * EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR - * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE APACHE GROUP OR - * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT - * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, - * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED - * OF THE POSSIBILITY OF SUCH DAMAGE. - * ==================================================================== - * - * This software consists of voluntary contributions made by many - * individuals on behalf of the Apache Group and was originally based - * on public domain software written at the National Center for - * Supercomputing Applications, University of Illinois, Urbana-Champaign. - * For more information on the Apache Group and the Apache HTTP server - * project, please see <http://www.apache.org/>. - * - */ - -/* - * http_script: keeps all script-related ramblings together. - * - * Compliant to CGI/1.1 spec - * - * Adapted by rst from original NCSA code by Rob McCool - * - * Apache adds some new env vars; REDIRECT_URL and REDIRECT_QUERY_STRING for - * custom error responses, and DOCUMENT_ROOT because we found it useful. - * It also adds SERVER_ADMIN - useful for scripts to know who to mail when - * they fail. - */ - -#include "httpd.h" -#include "http_config.h" -#include "http_request.h" -#include "http_core.h" -#include "http_protocol.h" -#include "http_main.h" -#include "http_log.h" -#include "util_script.h" -#include "http_conf_globals.h" - -module MODULE_VAR_EXPORT cgi_module; - -/* KLUDGE --- for back-combatibility, we don't have to check ExecCGI - * in ScriptAliased directories, which means we need to know if this - * request came through ScriptAlias or not... so the Alias module - * leaves a note for us. - */ - -static int is_scriptaliased(request_rec *r) -{ - const char *t = ap_table_get(r->notes, "alias-forced-type"); - return t && (!strcasecmp(t, "cgi-script")); -} - -/* Configuration stuff */ - -#define DEFAULT_LOGBYTES 10385760 -#define DEFAULT_BUFBYTES 1024 - -typedef struct { - char *logname; - long logbytes; - int bufbytes; -} cgi_server_conf; - -static void *create_cgi_config(pool *p, server_rec *s) -{ - cgi_server_conf *c = - (cgi_server_conf *) ap_pcalloc(p, sizeof(cgi_server_conf)); - - c->logname = NULL; - c->logbytes = DEFAULT_LOGBYTES; - c->bufbytes = DEFAULT_BUFBYTES; - - return c; -} - -static void *merge_cgi_config(pool *p, void *basev, void *overridesv) -{ - cgi_server_conf *base = (cgi_server_conf *) basev, *overrides = (cgi_server_conf *) overridesv; - - return overrides->logname ? overrides : base; -} - -static const char *set_scriptlog(cmd_parms *cmd, void *dummy, char *arg) -{ - server_rec *s = cmd->server; - cgi_server_conf *conf = - (cgi_server_conf *) ap_get_module_config(s->module_config, &cgi_module); - - conf->logname = arg; - return NULL; -} - -static const char *set_scriptlog_length(cmd_parms *cmd, void *dummy, char *arg) -{ - server_rec *s = cmd->server; - cgi_server_conf *conf = - (cgi_server_conf *) ap_get_module_config(s->module_config, &cgi_module); - - conf->logbytes = atol(arg); - return NULL; -} - -static const char *set_scriptlog_buffer(cmd_parms *cmd, void *dummy, char *arg) -{ - server_rec *s = cmd->server; - cgi_server_conf *conf = - (cgi_server_conf *) ap_get_module_config(s->module_config, &cgi_module); - - conf->bufbytes = atoi(arg); - return NULL; -} - -static const command_rec cgi_cmds[] = -{ - {"ScriptLog", set_scriptlog, NULL, RSRC_CONF, TAKE1, - "the name of a log for script debugging info"}, - {"ScriptLogLength", set_scriptlog_length, NULL, RSRC_CONF, TAKE1, - "the maximum length (in bytes) of the script debug log"}, - {"ScriptLogBuffer", set_scriptlog_buffer, NULL, RSRC_CONF, TAKE1, - "the maximum size (in bytes) to record of a POST request"}, - {NULL} -}; - -static int log_scripterror(request_rec *r, cgi_server_conf * conf, int ret, - int show_errno, char *error) -{ - FILE *f; - struct stat finfo; - - ap_log_rerror(APLOG_MARK, show_errno|APLOG_ERR, r, - "%s: %s", error, r->filename); - - if (!conf->logname || - ((stat(ap_server_root_relative(r->pool, conf->logname), &finfo) == 0) - && (finfo.st_size > conf->logbytes)) || - ((f = ap_pfopen(r->pool, ap_server_root_relative(r->pool, conf->logname), - "a")) == NULL)) { - return ret; - } - - /* "%% [Wed Jun 19 10:53:21 1996] GET /cgi-bin/printenv HTTP/1.0" */ - fprintf(f, "%%%% [%s] %s %s%s%s %s\n", ap_get_time(), r->method, r->uri, - r->args ? "?" : "", r->args ? r->args : "", r->protocol); - /* "%% 500 /usr/local/apache/cgi-bin */ - fprintf(f, "%%%% %d %s\n", ret, r->filename); - - fprintf(f, "%%error\n%s\n", error); - - ap_pfclose(r->pool, f); - return ret; -} - -static int log_script(request_rec *r, cgi_server_conf * conf, int ret, - char *dbuf, const char *sbuf, BUFF *script_in, BUFF *script_err) -{ - array_header *hdrs_arr = ap_table_elts(r->headers_in); - table_entry *hdrs = (table_entry *) hdrs_arr->elts; - char argsbuffer[HUGE_STRING_LEN]; - FILE *f; - int i; - struct stat finfo; - - if (!conf->logname || - ((stat(ap_server_root_relative(r->pool, conf->logname), &finfo) == 0) - && (finfo.st_size > conf->logbytes)) || - ((f = ap_pfopen(r->pool, ap_server_root_relative(r->pool, conf->logname), - "a")) == NULL)) { - /* Soak up script output */ - while (ap_bgets(argsbuffer, HUGE_STRING_LEN, script_in) > 0) - continue; -#ifdef WIN32 - /* Soak up stderr and redirect it to the error log. - * Script output to stderr is already directed to the error log - * on Unix, thanks to the magic of fork(). - */ - while (ap_bgets(argsbuffer, HUGE_STRING_LEN, script_err) > 0) { - ap_log_rerror(APLOG_MARK, APLOG_ERR | APLOG_NOERRNO, r, - "%s", argsbuffer); - } -#else - while (ap_bgets(argsbuffer, HUGE_STRING_LEN, script_err) > 0) - continue; -#endif - return ret; - } - - /* "%% [Wed Jun 19 10:53:21 1996] GET /cgi-bin/printenv HTTP/1.0" */ - fprintf(f, "%%%% [%s] %s %s%s%s %s\n", ap_get_time(), r->method, r->uri, - r->args ? "?" : "", r->args ? r->args : "", r->protocol); - /* "%% 500 /usr/local/apache/cgi-bin" */ - fprintf(f, "%%%% %d %s\n", ret, r->filename); - - fputs("%request\n", f); - for (i = 0; i < hdrs_arr->nelts; ++i) { - if (!hdrs[i].key) - continue; - fprintf(f, "%s: %s\n", hdrs[i].key, hdrs[i].val); - } - if ((r->method_number == M_POST || r->method_number == M_PUT) - && *dbuf) { - fprintf(f, "\n%s\n", dbuf); - } - - fputs("%response\n", f); - hdrs_arr = ap_table_elts(r->err_headers_out); - hdrs = (table_entry *) hdrs_arr->elts; - - for (i = 0; i < hdrs_arr->nelts; ++i) { - if (!hdrs[i].key) - continue; - fprintf(f, "%s: %s\n", hdrs[i].key, hdrs[i].val); - } - - if (sbuf && *sbuf) - fprintf(f, "%s\n", sbuf); - - if (ap_bgets(argsbuffer, HUGE_STRING_LEN, script_in) > 0) { - fputs("%stdout\n", f); - fputs(argsbuffer, f); - while (ap_bgets(argsbuffer, HUGE_STRING_LEN, script_in) > 0) - fputs(argsbuffer, f); - fputs("\n", f); - } - - if (ap_bgets(argsbuffer, HUGE_STRING_LEN, script_err) > 0) { - fputs("%stderr\n", f); - fputs(argsbuffer, f); - while (ap_bgets(argsbuffer, HUGE_STRING_LEN, script_err) > 0) - fputs(argsbuffer, f); - fputs("\n", f); - } - - ap_bclose(script_in); - ap_bclose(script_err); - - ap_pfclose(r->pool, f); - return ret; -} - -/**************************************************************** - * - * Actual CGI handling... - */ - - -struct cgi_child_stuff { -#ifdef TPF - TPF_FORK_CHILD t; -#endif - request_rec *r; - int nph; - int debug; - char *argv0; -}; - -static int cgi_child(void *child_stuff, child_info *pinfo) -{ - struct cgi_child_stuff *cld = (struct cgi_child_stuff *) child_stuff; - request_rec *r = cld->r; - char *argv0 = cld->argv0; - int child_pid; - -#ifdef DEBUG_CGI -#ifdef OS2 - /* Under OS/2 need to use device con. */ - FILE *dbg = fopen("con", "w"); -#else - FILE *dbg = fopen("/dev/tty", "w"); -#endif - int i; -#endif - - char **env; - - RAISE_SIGSTOP(CGI_CHILD); -#ifdef DEBUG_CGI - fprintf(dbg, "Attempting to exec %s as %sCGI child (argv0 = %s)\n", - r->filename, cld->nph ? "NPH " : "", argv0); -#endif - - ap_add_cgi_vars(r); - env = ap_create_environment(r->pool, r->subprocess_env); - -#ifdef DEBUG_CGI - fprintf(dbg, "Environment: \n"); - for (i = 0; env[i]; ++i) - fprintf(dbg, "'%s'\n", env[i]); -#endif - -#ifndef WIN32 - ap_chdir_file(r->filename); -#endif - if (!cld->debug) - ap_error_log2stderr(r->server); - - /* Transumute outselves into the script. - * NB only ISINDEX scripts get decoded arguments. - */ - -#ifdef TPF - return (0); -#else - ap_cleanup_for_exec(); - - child_pid = ap_call_exec(r, pinfo, argv0, env, 0); -#if defined(WIN32) || defined(OS2) - return (child_pid); -#else - - /* Uh oh. Still here. Where's the kaboom? There was supposed to be an - * EARTH-shattering kaboom! - * - * Oh, well. Muddle through as best we can... - * - * Note that only stderr is available at this point, so don't pass in - * a server to aplog_error. - */ - - ap_log_error(APLOG_MARK, APLOG_ERR, NULL, "exec of %s failed", r->filename); - exit(0); - /* NOT REACHED */ - return (0); -#endif -#endif /* TPF */ -} - -static int cgi_handler(request_rec *r) -{ - int retval, nph, dbpos = 0; - char *argv0, *dbuf = NULL; - BUFF *script_out, *script_in, *script_err; - char argsbuffer[HUGE_STRING_LEN]; - int is_included = !strcmp(r->protocol, "INCLUDED"); - void *sconf = r->server->module_config; - cgi_server_conf *conf = - (cgi_server_conf *) ap_get_module_config(sconf, &cgi_module); - - struct cgi_child_stuff cld; - - if (r->method_number == M_OPTIONS) { - /* 99 out of 100 CGI scripts, this is all they support */ - r->allowed |= (1 << M_GET); - r->allowed |= (1 << M_POST); - return DECLINED; - } - - if ((argv0 = strrchr(r->filename, '/')) != NULL) - argv0++; - else - argv0 = r->filename; - - nph = !(strncmp(argv0, "nph-", 4)); - - if (!(ap_allow_options(r) & OPT_EXECCGI) && !is_scriptaliased(r)) - return log_scripterror(r, conf, FORBIDDEN, APLOG_NOERRNO, - "Options ExecCGI is off in this directory"); - if (nph && is_included) - return log_scripterror(r, conf, FORBIDDEN, APLOG_NOERRNO, - "attempt to include NPH CGI script"); - -#if defined(OS2) || defined(WIN32) - /* Allow for cgi files without the .EXE extension on them under OS/2 */ - if (r->finfo.st_mode == 0) { - struct stat statbuf; - char *newfile; - - newfile = ap_pstrcat(r->pool, r->filename, ".EXE", NULL); - - if ((stat(newfile, &statbuf) != 0) || (!S_ISREG(statbuf.st_mode))) { - return log_scripterror(r, conf, NOT_FOUND, 0, - "script not found or unable to stat"); - } else { - r->filename = newfile; - } - } -#else - if (r->finfo.st_mode == 0) - return log_scripterror(r, conf, NOT_FOUND, APLOG_NOERRNO, - "script not found or unable to stat"); -#endif - if (S_ISDIR(r->finfo.st_mode)) - return log_scripterror(r, conf, FORBIDDEN, APLOG_NOERRNO, - "attempt to invoke directory as script"); - if (!ap_suexec_enabled) { - if (!ap_can_exec(&r->finfo)) - return log_scripterror(r, conf, FORBIDDEN, APLOG_NOERRNO, - "file permissions deny server execution"); - } - - if ((retval = ap_setup_client_block(r, REQUEST_CHUNKED_ERROR))) - return retval; - - ap_add_common_vars(r); - cld.argv0 = argv0; - cld.r = r; - cld.nph = nph; - cld.debug = conf->logname ? 1 : 0; -#ifdef TPF - cld.t.filename = r->filename; - cld.t.subprocess_env = r->subprocess_env; - cld.t.prog_type = FORK_FILE; -#endif /* TPF */ - -#ifdef CHARSET_EBCDIC - /* XXX:@@@ Is the generated/included output ALWAYS in text/ebcdic format? */ - /* Or must we check the Content-Type first? */ - ap_bsetflag(r->connection->client, B_EBCDIC2ASCII, 1); -#endif /*CHARSET_EBCDIC*/ - - /* - * we spawn out of r->main if it's there so that we can avoid - * waiting for free_proc_chain to cleanup in the middle of an - * SSI request -djg - */ - if (!ap_bspawn_child(r->main ? r->main->pool : r->pool, cgi_child, - (void *) &cld, kill_after_timeout, - &script_out, &script_in, &script_err)) { - ap_log_rerror(APLOG_MARK, APLOG_ERR, r, - "couldn't spawn child process: %s", r->filename); - return HTTP_INTERNAL_SERVER_ERROR; - } - - /* Transfer any put/post args, CERN style... - * Note that we already ignore SIGPIPE in the core server. - */ - - if (ap_should_client_block(r)) { - int dbsize, len_read; - - if (conf->logname) { - dbuf = ap_pcalloc(r->pool, conf->bufbytes + 1); - dbpos = 0; - } - - ap_hard_timeout("copy script args", r); - - while ((len_read = - ap_get_client_block(r, argsbuffer, HUGE_STRING_LEN)) > 0) { - if (conf->logname) { - if ((dbpos + len_read) > conf->bufbytes) { - dbsize = conf->bufbytes - dbpos; - } - else { - dbsize = len_read; - } - memcpy(dbuf + dbpos, argsbuffer, dbsize); - dbpos += dbsize; - } - ap_reset_timeout(r); - if (ap_bwrite(script_out, argsbuffer, len_read) < len_read) { - /* silly script stopped reading, soak up remaining message */ - while (ap_get_client_block(r, argsbuffer, HUGE_STRING_LEN) > 0) { - /* dump it */ - } - break; - } - } - - ap_bflush(script_out); - - ap_kill_timeout(r); - } - - ap_bclose(script_out); - - /* Handle script return... */ - if (script_in && !nph) { - const char *location; - char sbuf[MAX_STRING_LEN]; - int ret; - - if ((ret = ap_scan_script_header_err_buff(r, script_in, sbuf))) { - return log_script(r, conf, ret, dbuf, sbuf, script_in, script_err); - } - -#ifdef CHARSET_EBCDIC - /* Now check the Content-Type to decide if conversion is needed */ - ap_checkconv(r); -#endif /*CHARSET_EBCDIC*/ - - location = ap_table_get(r->headers_out, "Location"); - - if (location && location[0] == '/' && r->status == 200) { - - /* Soak up all the script output */ - ap_hard_timeout("read from script", r); - while (ap_bgets(argsbuffer, HUGE_STRING_LEN, script_in) > 0) { - continue; - } - while (ap_bgets(argsbuffer, HUGE_STRING_LEN, script_err) > 0) { - continue; - } - ap_kill_timeout(r); - - - /* This redirect needs to be a GET no matter what the original - * method was. - */ - r->method = ap_pstrdup(r->pool, "GET"); - r->method_number = M_GET; - - /* We already read the message body (if any), so don't allow - * the redirected request to think it has one. We can ignore - * Transfer-Encoding, since we used REQUEST_CHUNKED_ERROR. - */ - ap_table_unset(r->headers_in, "Content-Length"); - - ap_internal_redirect_handler(location, r); - return OK; - } - else if (location && r->status == 200) { - /* XX Note that if a script wants to produce its own Redirect - * body, it now has to explicitly *say* "Status: 302" - */ - return REDIRECT; - } - - ap_send_http_header(r); - if (!r->header_only) { - ap_send_fb(script_in, r); - } - ap_bclose(script_in); - - ap_soft_timeout("soaking script stderr", r); - while (ap_bgets(argsbuffer, HUGE_STRING_LEN, script_err) > 0) { - continue; - } - ap_kill_timeout(r); - ap_bclose(script_err); - } - - if (script_in && nph) { - ap_send_fb(script_in, r); - } - - return OK; /* NOT r->status, even if it has changed. */ -} - -static const handler_rec cgi_handlers[] = -{ - {CGI_MAGIC_TYPE, cgi_handler}, - {"cgi-script", cgi_handler}, - {NULL} -}; - -module MODULE_VAR_EXPORT cgi_module = -{ - STANDARD_MODULE_STUFF, - NULL, /* initializer */ - NULL, /* dir config creater */ - NULL, /* dir merger --- default is to override */ - create_cgi_config, /* server config */ - merge_cgi_config, /* merge server config */ - cgi_cmds, /* command table */ - cgi_handlers, /* handlers */ - NULL, /* filename translation */ - NULL, /* check_user_id */ - NULL, /* check auth */ - NULL, /* check access */ - NULL, /* type_checker */ - NULL, /* fixups */ - NULL, /* logger */ - NULL, /* header parser */ - NULL, /* child_init */ - NULL, /* child_exit */ - NULL /* post read-request */ -}; diff --git a/modules/generators/mod_cgi.dsp b/modules/generators/mod_cgi.dsp deleted file mode 100644 index be4d4a964716011b5f8eba4e6ec4daea477c7b7c..0000000000000000000000000000000000000000 --- a/modules/generators/mod_cgi.dsp +++ /dev/null @@ -1,132 +0,0 @@ -# Microsoft Developer Studio Project File - Name="mod_cgi" - Package Owner=<4> -# Microsoft Developer Studio Generated Build File, Format Version 6.00 -# ** DO NOT EDIT ** - -# TARGTYPE "Win32 (x86) Dynamic-Link Library" 0x0102 - -CFG=mod_cgi - Win32 Release -!MESSAGE This is not a valid makefile. To build this project using NMAKE, -!MESSAGE use the Export Makefile command and run -!MESSAGE -!MESSAGE NMAKE /f "mod_cgi.mak". -!MESSAGE -!MESSAGE You can specify a configuration when running NMAKE -!MESSAGE by defining the macro CFG on the command line. For example: -!MESSAGE -!MESSAGE NMAKE /f "mod_cgi.mak" CFG="mod_cgi - Win32 Release" -!MESSAGE -!MESSAGE Possible choices for configuration are: -!MESSAGE -!MESSAGE "mod_cgi - Win32 Release" (based on "Win32 (x86) Dynamic-Link Library") -!MESSAGE "mod_cgi - Win32 Debug" (based on "Win32 (x86) Dynamic-Link Library") -!MESSAGE - -# Begin Project -# PROP AllowPerConfigDependencies 0 -# PROP Scc_ProjName "" -# PROP Scc_LocalPath "" -CPP=cl.exe -MTL=midl.exe -RSC=rc.exe - -!IF "$(CFG)" == "mod_cgi - Win32 Release" - -# PROP BASE Use_MFC 0 -# PROP BASE Use_Debug_Libraries 0 -# PROP BASE Output_Dir "Release" -# PROP BASE Intermediate_Dir "Release" -# PROP BASE Target_Dir "" -# PROP Use_MFC 0 -# PROP Use_Debug_Libraries 0 -# PROP Output_Dir "Release" -# PROP Intermediate_Dir "Release" -# PROP Ignore_Export_Lib 0 -# PROP Target_Dir "" -# ADD BASE CPP /nologo /MD /W3 /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /FD /c -# ADD CPP /nologo /MD /W3 /O2 /I "../../include" /I "../../srclib/apr/include" /I "../../srclib/apr-util/include" /D "NDEBUG" /D "WIN32" /D "_WINDOWS" /Fd"Release\mod_cgi" /FD /c -# ADD BASE MTL /nologo /D "NDEBUG" /win32 -# ADD MTL /nologo /D "NDEBUG" /mktyplib203 /win32 -# ADD BASE RSC /l 0x409 /d "NDEBUG" -# ADD RSC /l 0x409 /d "NDEBUG" -BSC32=bscmake.exe -# ADD BASE BSC32 /nologo -# ADD BSC32 /nologo -LINK32=link.exe -# ADD BASE LINK32 kernel32.lib /nologo /subsystem:windows /dll /map /machine:I386 /out:"Release/mod_cgi.so" /base:@..\..\os\win32\BaseAddr.ref,mod_cgi -# ADD LINK32 kernel32.lib /nologo /subsystem:windows /dll /map /machine:I386 /out:"Release/mod_cgi.so" /base:@..\..\os\win32\BaseAddr.ref,mod_cgi - -!ELSEIF "$(CFG)" == "mod_cgi - Win32 Debug" - -# PROP BASE Use_MFC 0 -# PROP BASE Use_Debug_Libraries 1 -# PROP BASE Output_Dir "Debug" -# PROP BASE Intermediate_Dir "Debug" -# PROP BASE Target_Dir "" -# PROP Use_MFC 0 -# PROP Use_Debug_Libraries 1 -# PROP Output_Dir "Debug" -# PROP Intermediate_Dir "Debug" -# PROP Ignore_Export_Lib 0 -# PROP Target_Dir "" -# ADD BASE CPP /nologo /MDd /W3 /GX /Zi /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /FD /c -# ADD CPP /nologo /MDd /W3 /GX /Zi /Od /I "../../include" /I "../../srclib/apr/include" /I "../../srclib/apr-util/include" /D "_DEBUG" /D "WIN32" /D "_WINDOWS" /Fd"Debug\mod_cgi" /FD /c -# ADD BASE MTL /nologo /D "_DEBUG" /win32 -# ADD MTL /nologo /D "_DEBUG" /mktyplib203 /win32 -# ADD BASE RSC /l 0x409 /d "_DEBUG" -# ADD RSC /l 0x409 /d "_DEBUG" -BSC32=bscmake.exe -# ADD BASE BSC32 /nologo -# ADD BSC32 /nologo -LINK32=link.exe -# ADD BASE LINK32 kernel32.lib /nologo /subsystem:windows /dll /incremental:no /map /debug /machine:I386 /out:"Debug/mod_cgi.so" /base:@..\..\os\win32\BaseAddr.ref,mod_cgi -# ADD LINK32 kernel32.lib /nologo /subsystem:windows /dll /incremental:no /map /debug /machine:I386 /out:"Debug/mod_cgi.so" /base:@..\..\os\win32\BaseAddr.ref,mod_cgi - -!ENDIF - -# Begin Target - -# Name "mod_cgi - Win32 Release" -# Name "mod_cgi - Win32 Debug" -# Begin Source File - -SOURCE=.\mod_cgi.c -# End Source File -# Begin Source File - -SOURCE=.\mod_cgi.h -# End Source File -# Begin Source File - -SOURCE=.\mod_cgi.rc -# End Source File -# Begin Source File - -SOURCE=..\..\build\win32\win32ver.awk - -!IF "$(CFG)" == "mod_cgi - Win32 Release" - -# PROP Ignore_Default_Tool 1 -# Begin Custom Build - Creating Version Resource -InputPath=..\..\build\win32\win32ver.awk - -".\mod_cgi.rc" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)" - awk -f ../../build/win32/win32ver.awk mod_cgi "cgi_module for Apache" ../../include/ap_release.h > .\mod_cgi.rc - -# End Custom Build - -!ELSEIF "$(CFG)" == "mod_cgi - Win32 Debug" - -# PROP Ignore_Default_Tool 1 -# Begin Custom Build - Creating Version Resource -InputPath=..\..\build\win32\win32ver.awk - -".\mod_cgi.rc" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)" - awk -f ../../build/win32/win32ver.awk mod_cgi "cgi_module for Apache" ../../include/ap_release.h > .\mod_cgi.rc - -# End Custom Build - -!ENDIF - -# End Source File -# End Target -# End Project diff --git a/modules/generators/mod_cgi.exp b/modules/generators/mod_cgi.exp deleted file mode 100644 index 96ea0c2348044fc2437b753c98d9e37014552560..0000000000000000000000000000000000000000 --- a/modules/generators/mod_cgi.exp +++ /dev/null @@ -1 +0,0 @@ -cgi_module diff --git a/modules/generators/mod_cgi.h b/modules/generators/mod_cgi.h deleted file mode 100644 index 4eadfaa58adbfea876894698ef1d0144e96aa32a..0000000000000000000000000000000000000000 --- a/modules/generators/mod_cgi.h +++ /dev/null @@ -1,79 +0,0 @@ -/* ==================================================================== - * The Apache Software License, Version 1.1 - * - * Copyright (c) 2000-2001 The Apache Software Foundation. All rights - * reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in - * the documentation and/or other materials provided with the - * distribution. - * - * 3. The end-user documentation included with the redistribution, - * if any, must include the following acknowledgment: - * "This product includes software developed by the - * Apache Software Foundation (http://www.apache.org/)." - * Alternately, this acknowledgment may appear in the software itself, - * if and wherever such third-party acknowledgments normally appear. - * - * 4. The names "Apache" and "Apache Software Foundation" must - * not be used to endorse or promote products derived from this - * software without prior written permission. For written - * permission, please contact apache@apache.org. - * - * 5. Products derived from this software may not be called "Apache", - * nor may "Apache" appear in their name, without prior written - * permission of the Apache Software Foundation. - * - * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED - * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES - * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR - * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF - * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND - * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, - * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT - * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * ==================================================================== - * - * This software consists of voluntary contributions made by many - * individuals on behalf of the Apache Software Foundation. For more - * information on the Apache Software Foundation, please see - * <http://www.apache.org/>. - * - * Portions of this software are based upon public domain software - * originally written at the National Center for Supercomputing Applications, - * University of Illinois, Urbana-Champaign. - */ - -#ifndef _MOD_CGI_H -#define _MOD_CGI_H 1 - - -/** - * Registerable optional function to override CGI behavior; - * Reprocess the command and arguments to execute the given CGI script. - * @param cmd Pointer to the command to execute (may be overridden) - * @param argv Pointer to the arguments to pass (may be overridden) - * @param r The current request - * @param p The pool to allocate correct cmd/argv elements within. - * @deffunc apr_status_t ap_cgi_build_command(const char **cmd, const char ***argv, request_rec *r, apr_pool_t *p) - * @tip This callback may be registered by the os-specific module - * to correct the command and arguments for apr_proc_create invocation - * on a given os. mod_cgi will call the function if registered. - */ -APR_DECLARE_OPTIONAL_FN(apr_status_t, ap_cgi_build_command, - (const char **cmd, const char ***argv, - request_rec *r, apr_pool_t *p)); - -#endif /* _MOD_CGI_H */ diff --git a/modules/generators/mod_cgid.c b/modules/generators/mod_cgid.c deleted file mode 100644 index ae90d763d4740cb5489741dd0d65e438f8fbecaf..0000000000000000000000000000000000000000 --- a/modules/generators/mod_cgid.c +++ /dev/null @@ -1,1006 +0,0 @@ -/* ==================================================================== - * Copyright (c) 1995-1999 The Apache Group. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in - * the documentation and/or other materials provided with the - * distribution. - * - * 3. All advertising materials mentioning features or use of this - * software must display the following acknowledgment: - * "This product includes software developed by the Apache Group - * for use in the Apache HTTP server project (http://www.apache.org/)." - * - * 4. The names "Apache Server" and "Apache Group" must not be used to - * endorse or promote products derived from this software without - * prior written permission. For written permission, please contact - * * apache@apache.org. - * - * 5. Products derived from this software may not be called "Apache" - * nor may "Apache" appear in their names without prior written - * permission of the Apache Group. - * - * 6. Redistributions of any form whatsoever must retain the following - * acknowledgment: - * "This product includes software developed by the Apache Group - * for use in the Apache HTTP server project (http://www.apache.org/)." - * - * THIS SOFTWARE IS PROVIDED BY THE APACHE GROUP ``AS IS'' AND ANY - * EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR - * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE APACHE GROUP OR - * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT - * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, - * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED - * OF THE POSSIBILITY OF SUCH DAMAGE. - * ==================================================================== - * - * This software consists of voluntary contributions made by many - * individuals on behalf of the Apache Group and was originally based - * on public domain software written at the National Center for - * Supercomputing Applications, University of Illinois, Urbana-Champaign. - * For more information on the Apache Group and the Apache HTTP server - * project, please see <http://www.apache.org/>. - * - */ - -/* - * http_script: keeps all script-related ramblings together. - * - * Compliant to cgi/1.1 spec - * - * Adapted by rst from original NCSA code by Rob McCool - * - * Apache adds some new env vars; REDIRECT_URL and REDIRECT_QUERY_STRING for - * custom error responses, and DOCUMENT_ROOT because we found it useful. - * It also adds SERVER_ADMIN - useful for scripts to know who to mail when - * they fail. - */ - - - -#define CORE_PRIVATE - -#include "apr_lib.h" -#include "apr_general.h" -#include "apr_file_io.h" -#include "apr_portable.h" -#include "httpd.h" -#include "http_config.h" -#include "http_request.h" -#include "http_core.h" -#include "http_protocol.h" -#include "http_main.h" -#include "http_log.h" -#include "util_script.h" -#include "http_conf_globals.h" -#include "buff.h" -#include "ap_mpm.h" -#include "iol_socket.h" - -#ifndef UNIX_PATH_MAX -#define UNIX_PATH_MAX 108 -#endif - -#ifndef sockaddr_un -struct sockaddr_un { - unsigned short sun_family; - char sun_path[UNIX_PATH_MAX]; -}; -#endif - - -module MODULE_VAR_EXPORT cgid_module; - -static void cgid_init(ap_context_t *p, ap_context_t *plog, ap_context_t *ptemp, server_rec *main_server); -static int once_through = 0; - -static ap_context_t *pcgi; - -/* KLUDGE --- for back-combatibility, we don't have to check Execcgid - * in ScriptAliased directories, which means we need to know if this - * request came through ScriptAlias or not... so the Alias module - * leaves a note for us. - */ - -static int is_scriptaliased(request_rec *r) -{ - const char *t = ap_table_get(r->notes, "alias-forced-type"); - return t && (!strcasecmp(t, "cgi-script")); -} - -/* Configuration stuff */ - -#define DEFAULT_LOGBYTES 10385760 -#define DEFAULT_BUFBYTES 1024 -#define DEFAULT_SOCKET "logs/cgisock" - -typedef struct { - const char *sockname; - char *logname; - long logbytes; - int bufbytes; - BUFF *bin; - BUFF *bout; - BUFF *berror; -} cgid_server_conf; - -/* If a request includes query info in the URL (stuff after "?"), and - * the query info does not contain "=" (indicative of a FORM submission), - * then this routine is called to create the argument list to be passed - * to the CGI script. When suexec is enabled, the suexec path, user, and - * group are the first three arguments to be passed; if not, all three - * must be NULL. The query info is split into separate arguments, where - * "+" is the separator between keyword arguments. - * - * XXXX: note that the WIN32 code uses one of the suexec strings - * to pass an interpreter name. Remember this if changing the way they - * are handled in create_argv. - * - */ -static char **create_argv(ap_context_t *p, char *path, char *user, char *group, - char *av0, const char *args) -{ - int x, numwords; - char **av; - char *w; - int idx = 0; - - /* count the number of keywords */ - - for (x = 0, numwords = 1; args[x]; x++) { - if (args[x] == '+') { - ++numwords; - } - } - - if (numwords > APACHE_ARG_MAX - 5) { - numwords = APACHE_ARG_MAX - 5; /* Truncate args to prevent overrun */ - } - av = (char **) ap_palloc(p, (numwords + 5) * sizeof(char *)); - - if (path) { - av[idx++] = path; - } - if (user) { - av[idx++] = user; - } - if (group) { - av[idx++] = group; - } - - av[idx++] = av0; - - for (x = 1; x <= numwords; x++) { - w = ap_getword_nulls(p, &args, '+'); - ap_unescape_url(w); - av[idx++] = ap_escape_shell_cmd(p, w); - } - av[idx] = NULL; - return av; -} - -static int call_exec(request_rec *r, char *argv0, char **env, int shellcmd) -{ - int pid = 0; - int errfileno = STDERR_FILENO; - - /* the fd on r->server->error_log is closed, but we need somewhere to * put the error messages from the log_* functions. So, we use stderr, - * since that is better than allowing errors to go unnoticed. - */ - ap_put_os_file(&r->server->error_log, &errfileno, r->pool); - /* TODO: reimplement suexec */ -#if 0 - if (ap_suexec_enabled - && ((r->server->server_uid != ap_user_id) - || (r->server->server_gid != ap_group_id) - || (!strncmp("/~", r->uri, 2)))) { - - char *execuser, *grpname; - struct passwd *pw; - struct group *gr; - - if (!strncmp("/~", r->uri, 2)) { - gid_t user_gid; - char *username = ap_pstrdup(r->pool, r->uri + 2); - char *pos = strchr(username, '/'); - - if (pos) { - *pos = '\0'; - } - - if ((pw = getpwnam(username)) == NULL) { - ap_log_rerror(APLOG_MARK, APLOG_ERR, r, - "getpwnam: invalid username %s", username); - return (pid); - } - execuser = ap_pstrcat(r->pool, "~", pw->pw_name, NULL); - user_gid = pw->pw_gid; - - if ((gr = getgrgid(user_gid)) == NULL) { - if ((grpname = ap_palloc(r->pool, 16)) == NULL) { - return (pid); - } - else { - ap_snprintf(grpname, 16, "%ld", (long) user_gid); - } - } - else { - grpname = gr->gr_name; - } - } - else { - if ((pw = getpwuid(r->server->server_uid)) == NULL) { - ap_log_rerror(APLOG_MARK, APLOG_ERR, r, - "getpwuid: invalid userid %ld", - (long) r->server->server_uid); - return (pid); - } - execuser = ap_pstrdup(r->pool, pw->pw_name); - - if ((gr = getgrgid(r->server->server_gid)) == NULL) { - ap_log_rerror(APLOG_MARK, APLOG_ERR, r, - "getgrgid: invalid groupid %ld", - (long) r->server->server_gid); - return (pid); - } - grpname = gr->gr_name; - } - - if (shellcmd) { - execle(SUEXEC_BIN, SUEXEC_BIN, execuser, grpname, argv0, - NULL, env); - } - - else if ((!r->args) || (!r->args[0]) || strchr(r->args, '=')) { - execle(SUEXEC_BIN, SUEXEC_BIN, execuser, grpname, argv0, - NULL, env); - } - - else { - execve(SUEXEC_BIN, - create_argv(r->pool, SUEXEC_BIN, execuser, grpname, - argv0, r->args), - env); - } - } - else { -#endif - if (shellcmd) { - execle(SHELL_PATH, SHELL_PATH, "-c", argv0, NULL, env); - } - - else if ((!r->args) || (!r->args[0]) || strchr(r->args, '=')) { - execle(r->filename, argv0, NULL, env); - } - - else { - execve(r->filename, - create_argv(r->pool, NULL, NULL, NULL, argv0, r->args), - env); - } -#if 0 - } -#endif - return (pid); -} - -static void cgid_maint(int reason, void *data, ap_wait_t status) -{ -#ifdef HAS_OTHER_CHILD - int *sd = data; - switch (reason) { - case OC_REASON_DEATH: - case OC_REASON_LOST: - /* stop gap to make sure everything else works. In the end, - * we'll just restart the cgid server. */ - kill(getppid(), SIGWINCH); - break; - case OC_REASON_RESTART: - case OC_REASON_UNREGISTER: - kill(*sd, SIGHUP); - break; - } -#endif -} - -static void get_req(int fd, request_rec *r, char **filename, char **argv0, char ***env) -{ - int i, len, j; - unsigned char *data; - char **environ; - char temp[MAX_STRING_LEN]; - core_dir_config *temp_core; - void **dconf; - - r->server = ap_pcalloc(r->pool, sizeof(server_rec)); - - read(fd, &j, sizeof(int)); - read(fd, &len, sizeof(int)); - data = ap_pcalloc(r->pool, len); - i = read(fd, data, len); - - r->filename = ap_getword(r->pool, (const char **)&data, '\n'); - *argv0 = ap_getword(r->pool, (const char **)&data, '\n'); - - r->uri = ap_getword(r->pool, (const char **)&data, '\n'); - - environ = ap_pcalloc(r->pool, (j + 2) *sizeof(char *)); - i = 0; - for (i = 0; i < j; i++) { - environ[i] = ap_getword(r->pool, (const char **)&data, '\n'); - } - *env = environ; - r->args = ap_getword(r->pool, (const char **)&data, '\n'); - - read(fd, &r->server->server_uid, sizeof(uid_t)); - read(fd, &r->server->server_gid, sizeof(gid_t)); - - read(fd, &i, sizeof(int)); - - /* add 1, so that if i == 0, we still malloc something. */ - dconf = (void **)malloc(sizeof(void *) * i + 1); - - temp_core = (core_dir_config *)malloc(sizeof(core_module)); -#if 0 -#ifdef RLIMIT_CPU - read(fd, &j, sizeof(int)); - if (j) { - temp_core->limit_cpu = (struct rlimit *)malloc (sizeof(struct rlimit)); - read(fd, temp_core->limit_cpu, sizeof(struct rlimit)); - } - else { - temp_core->limit_cpu = NULL; - } -#endif - -#if defined (RLIMIT_DATA) || defined(RLIMIT_VMEM) || defined(RLIMIT_AS) - read(fd, &j, sizeof(int)); - if (j) { - temp_core->limit_mem = (struct rlimit *)malloc (sizeof(struct rlimit)); - read(fd, temp_core->limit_mem, sizeof(struct rlimit)); - } - else { - temp_core->limit_mem = NULL; - } -#endif - -#ifdef RLIMIT_NPROC - read(fd, &j, sizeof(int)); - if (j) { - temp_core->limit_nproc = (struct rlimit *)malloc (sizeof(struct rlimit)); - read(fd, temp_core->limit_nproc, sizeof(struct rlimit)); - } - else { - temp_core->limit_nproc = NULL; - } -#endif -#endif - dconf[i] = (void *)temp_core; - r->per_dir_config = dconf; -} - - - -static void send_req(int fd, request_rec *r, char *argv0, char **env) -{ - int len; - int rv; - int i = 0; - char *data; - core_dir_config *conf = ap_get_module_config(r->per_dir_config, - &core_module); - - data = ap_pstrcat(r->pool, r->filename, "\n", argv0, "\n", r->uri, "\n", - NULL); - - for (i =0; env[i]; i++) { - continue; - } - - if (write(fd, &i, sizeof(int)) < 0) { - ap_log_rerror(APLOG_MARK, APLOG_ERR, errno, r, - "write to cgi daemon process"); - } - - for (i = 0; env[i]; i++) { - data = ap_pstrcat(r->pool, data, env[i], "\n", NULL); - } - data = ap_pstrcat(r->pool, data, r->args, NULL); - len = strlen(data); - if (write(fd, &len, sizeof(int)) < 0) { - ap_log_rerror(APLOG_MARK, APLOG_ERR, errno, r, - "write to cgi daemon process"); - } - if (write(fd, data, len) < 0) { - ap_log_rerror(APLOG_MARK, APLOG_ERR, errno, r, - "write to cgi daemon process"); - } - if (write(fd, &r->server->server_uid, sizeof(uid_t)) < 0) { - ap_log_rerror(APLOG_MARK, APLOG_ERR, errno, r, - "write to cgi daemon process"); - } - if (write(fd, &r->server->server_gid, sizeof(gid_t)) < 0) { - ap_log_rerror(APLOG_MARK, APLOG_ERR, errno, r, - "write to cgi daemon process"); - } - if (write(fd, &core_module.module_index, sizeof(int)) < 0) { - ap_log_rerror(APLOG_MARK, APLOG_ERR, errno, r, - "write to cgi daemon process"); - } -#if 0 -#ifdef RLIMIT_CPU - if (conf->limit_cpu) { - len = 1; - write(fd, &len, sizeof(int)); - write(fd, conf->limit_cpu, sizeof(struct rlimit)); - } - else { - len = 0; - write(fd, &len, sizeof(int)); - } -#endif - -#if defined(RLIMIT_DATA) || defined(RLIMIT_VMEM) || defined(RLIMIT_AS) - if (conf->limit_mem) { - len = 1; - write(fd, &len, sizeof(int)); - write(fd, conf->limit_mem, sizeof(struct rlimit)); - } - else { - len = 0; - write(fd, &len, sizeof(int)); - } -#endif - -#ifdef RLIMIT_NPROC - if (conf->limit_nproc) { - len = 1; - write(fd, &len, sizeof(int)); - write(fd, conf->limit_nproc, sizeof(struct rlimit)); - } - else { - len = 0; - write(fd, &len, sizeof(int)); - } -#endif -#endif -} - -static int cgid_server_child(int sd) -{ - char *argv0; - char *filename; - char **env; - ap_context_t *p; - request_rec *r; - - ap_create_context(&p, pcgi); - r = ap_pcalloc(p, sizeof(request_rec)); - r->pool = p; - dup2(sd, STDIN_FILENO); - dup2(sd, STDOUT_FILENO); - get_req(sd, r, &filename, &argv0, &env); - call_exec(r, argv0, env, 0); - exit(-1); /* We should NEVER get here */ -} - -static int cgid_server(void *data) -{ - struct sockaddr_un unix_addr; - int pid; - int sd, sd2, len; - int errfile; - server_rec *main_server = data; - cgid_server_conf *sconf = (cgid_server_conf *)ap_get_module_config( - main_server->module_config, &cgid_module); - - signal(SIGCHLD, SIG_IGN); - unlink(sconf->sockname); - - if ((sd = socket(AF_UNIX, SOCK_STREAM, 0)) < 0) { - ap_log_error(APLOG_MARK, APLOG_ERR, errno, main_server, - "Couldn't create unix domain socket"); - } - - memset(&unix_addr, 0, sizeof(unix_addr)); - unix_addr.sun_family = AF_UNIX; - strcpy(unix_addr.sun_path, sconf->sockname); - - if (bind(sd, (struct sockaddr *)&unix_addr, sizeof(unix_addr)) < 0) { - ap_log_error(APLOG_MARK, APLOG_ERR, errno, main_server, - "Couldn't bind unix domain socket"); - } - /* Most implementations silently enforce a value of 5 anyway. - * This way, it'll work the same everywhere. */ - if (listen(sd, 5) < 0) { - ap_log_error(APLOG_MARK, APLOG_ERR, errno, main_server, - "Couldn't listen on unix domain socket"); - } - - while (1) { - sd2 = accept(sd, (struct sockaddr *)&unix_addr, &len); - if (sd2 < 0) { - ap_log_error(APLOG_MARK, APLOG_ERR, errno, (server_rec *)data, - "Error accepting on cgid socket."); - continue; - } - - if ((pid = fork()) > 0) { - close(sd2); - } - else if (pid == 0) { - /* setup the STDERR here, because I have all the info - * for it. I'll do the STDIN and STDOUT later, but I can't - * do STDERR as easily. - */ - if (sconf->logname) { - dup2(open(sconf->logname, O_WRONLY), STDERR_FILENO); - } - else { - ap_get_os_file(&errfile, main_server->error_log); - dup2(errfile, STDERR_FILENO); - } - cgid_server_child(sd2); - } - else { - ap_log_error(APLOG_MARK, APLOG_ERR, errno, (server_rec *)data, - "Couldn't fork cgi script"); - } - } - return -1; -} - -static void cgid_init(ap_context_t *p, ap_context_t *plog, ap_context_t *ptemp, server_rec *main_server) -{ - int pid; - int tempfd; - - cgid_server_conf *sconf = (cgid_server_conf *)ap_get_module_config( - main_server->module_config, &cgid_module); - - if (once_through > 0) { - ap_create_context(&pcgi, p); - tempfd = creat(sconf->sockname, S_IRUSR | S_IWUSR | S_IRGRP | S_IWGRP | S_IROTH | S_IWOTH); - close(tempfd); - - if ((pid = fork()) < 0) { - ap_log_error(APLOG_MARK, APLOG_ERR, errno, main_server, - "Couldn't spawn cgid daemon process"); - } - else if (pid == 0) { - cgid_server(main_server); - exit(-1); - } -#ifdef HAS_OTHER_CHILD - ap_register_other_child(pid, cgid_maint, &pid, -1); -#endif - } - else once_through++; -} - -static void *create_cgid_config(ap_context_t *p, server_rec *s) -{ - cgid_server_conf *c = - (cgid_server_conf *) ap_pcalloc(p, sizeof(cgid_server_conf)); - - c->logname = NULL; - c->logbytes = DEFAULT_LOGBYTES; - c->bufbytes = DEFAULT_BUFBYTES; - c->sockname = ap_server_root_relative(p, DEFAULT_SOCKET); - c->bin = c->bout = c->berror = NULL; - return c; -} - -static void *merge_cgid_config(ap_context_t *p, void *basev, void *overridesv) -{ - cgid_server_conf *base = (cgid_server_conf *) basev, *overrides = (cgid_server_conf *) overridesv; - - return overrides->logname ? overrides : base; -} - -static const char *set_scriptlog(cmd_parms *cmd, void *dummy, char *arg) -{ - server_rec *s = cmd->server; - cgid_server_conf *conf = - (cgid_server_conf *) ap_get_module_config(s->module_config, &cgid_module); - - conf->logname = arg; - return NULL; -} - -static const char *set_scriptlog_length(cmd_parms *cmd, void *dummy, char *arg) -{ - server_rec *s = cmd->server; - cgid_server_conf *conf = - (cgid_server_conf *) ap_get_module_config(s->module_config, &cgid_module); - - conf->logbytes = atol(arg); - return NULL; -} - -static const char *set_scriptlog_buffer(cmd_parms *cmd, void *dummy, char *arg) -{ - server_rec *s = cmd->server; - cgid_server_conf *conf = - (cgid_server_conf *) ap_get_module_config(s->module_config, &cgid_module); - - conf->bufbytes = atoi(arg); - return NULL; -} - -static const char *set_script_socket(cmd_parms *cmd, void *dummy, char *arg) -{ - server_rec *s = cmd->server; - cgid_server_conf *conf = - (cgid_server_conf *) ap_get_module_config(s->module_config, &cgid_module); - - conf->sockname = ap_server_root_relative(cmd->pool, arg); - return NULL; -} - -static const command_rec cgid_cmds[] = -{ - {"ScriptLog", set_scriptlog, NULL, RSRC_CONF, TAKE1, - "the name of a log for script debugging info"}, - {"ScriptLogLength", set_scriptlog_length, NULL, RSRC_CONF, TAKE1, - "the maximum length (in bytes) of the script debug log"}, - {"ScriptLogBuffer", set_scriptlog_buffer, NULL, RSRC_CONF, TAKE1, - "the maximum size (in bytes) to record of a POST request"}, - {"Scriptsock", set_script_socket, NULL, RSRC_CONF, TAKE1, - "the name of the socket to use for communication with the cgi daemon."}, - {NULL} -}; - -static int log_scripterror(request_rec *r, cgid_server_conf * conf, int ret, - int show_errno, char *error) -{ - ap_file_t *f; - struct stat finfo; - - ap_log_rerror(APLOG_MARK, show_errno|APLOG_ERR, errno, r, - "%s: %s", error, r->filename); - - if (!conf->logname || - ((stat(ap_server_root_relative(r->pool, conf->logname), &finfo) == 0) - && (finfo.st_size > conf->logbytes)) || - (ap_open(&f, ap_server_root_relative(r->pool, conf->logname), - APR_APPEND, APR_OS_DEFAULT, r->pool) != APR_SUCCESS)) { - return ret; - } - - /* "%% [Wed Jun 19 10:53:21 1996] GET /cgid-bin/printenv HTTP/1.0" */ - ap_fprintf(f, "%%%% [%s] %s %s%s%s %s\n", ap_get_time(), r->method, r->uri, - r->args ? "?" : "", r->args ? r->args : "", r->protocol); - /* "%% 500 /usr/local/apache/cgid-bin */ - ap_fprintf(f, "%%%% %d %s\n", ret, r->filename); - - ap_fprintf(f, "%%error\n%s\n", error); - - ap_close(f); - return ret; -} - -static int log_script(request_rec *r, cgid_server_conf * conf, int ret, - char *dbuf, const char *sbuf, BUFF *script_in, BUFF *script_err) -{ - ap_array_header_t *hdrs_arr = ap_table_elts(r->headers_in); - ap_table_entry_t *hdrs = (ap_table_entry_t *) hdrs_arr->elts; - char argsbuffer[HUGE_STRING_LEN]; - ap_file_t *f; - int i; - struct stat finfo; - - if (!conf->logname || - ((stat(ap_server_root_relative(r->pool, conf->logname), &finfo) == 0) - && (finfo.st_size > conf->logbytes)) || - (ap_open(&f, ap_server_root_relative(r->pool, conf->logname), - APR_APPEND, APR_OS_DEFAULT, r->pool) != APR_SUCCESS)) { - /* Soak up script output */ - while (ap_bgets(argsbuffer, HUGE_STRING_LEN, script_in) > 0) - continue; - while (ap_bgets(argsbuffer, HUGE_STRING_LEN, script_err) > 0) - continue; - return ret; - } - - /* "%% [Wed Jun 19 10:53:21 1996] GET /cgid-bin/printenv HTTP/1.0" */ - ap_fprintf(f, "%%%% [%s] %s %s%s%s %s\n", ap_get_time(), r->method, r->uri, - r->args ? "?" : "", r->args ? r->args : "", r->protocol); - /* "%% 500 /usr/local/apache/cgid-bin" */ - ap_fprintf(f, "%%%% %d %s\n", ret, r->filename); - - ap_puts("%request\n", f); - for (i = 0; i < hdrs_arr->nelts; ++i) { - if (!hdrs[i].key) - continue; - ap_fprintf(f, "%s: %s\n", hdrs[i].key, hdrs[i].val); - } - if ((r->method_number == M_POST || r->method_number == M_PUT) - && *dbuf) { - ap_fprintf(f, "\n%s\n", dbuf); - } - - ap_puts("%response\n", f); - hdrs_arr = ap_table_elts(r->err_headers_out); - hdrs = (ap_table_entry_t *) hdrs_arr->elts; - - for (i = 0; i < hdrs_arr->nelts; ++i) { - if (!hdrs[i].key) - continue; - ap_fprintf(f, "%s: %s\n", hdrs[i].key, hdrs[i].val); - } - - if (sbuf && *sbuf) - ap_fprintf(f, "%s\n", sbuf); - - if (ap_bgets(argsbuffer, HUGE_STRING_LEN, script_in) > 0) { - ap_puts("%stdout\n", f); - ap_puts(argsbuffer, f); - while (ap_bgets(argsbuffer, HUGE_STRING_LEN, script_in) > 0) - ap_puts(argsbuffer, f); - ap_puts("\n", f); - } - - if (ap_bgets(argsbuffer, HUGE_STRING_LEN, script_err) > 0) { - ap_puts("%stderr\n", f); - ap_puts(argsbuffer, f); - while (ap_bgets(argsbuffer, HUGE_STRING_LEN, script_err) > 0) - ap_puts(argsbuffer, f); - ap_puts("\n", f); - } - - ap_bclose(script_in); - ap_bclose(script_err); - - ap_close(f); - return ret; -} - - - -/**************************************************************** - * - * Actual cgid handling... - */ -static int cgid_handler(request_rec *r) -{ - int retval, nph, dbpos = 0; - char *argv0, *dbuf = NULL; - BUFF *script = NULL; - char argsbuffer[HUGE_STRING_LEN]; - void *sconf = r->server->module_config; - cgid_server_conf *conf = (cgid_server_conf *) ap_get_module_config(sconf, &cgid_module); - int is_included = !strcmp(r->protocol, "INCLUDED"); - int sd; - char **env; - struct sockaddr_un unix_addr; - ap_socket_t *tempsock = NULL; - int nbytes; - ap_iol *iol; - script = ap_bcreate(r->pool, B_RDWR); - - if (r->method_number == M_OPTIONS) { - /* 99 out of 100 cgid scripts, this is all they support */ - r->allowed |= (1 << M_GET); - r->allowed |= (1 << M_POST); - return DECLINED; - } - - if ((argv0 = strrchr(r->filename, '/')) != NULL) - argv0++; - else - argv0 = r->filename; - - nph = !(strncmp(argv0, "nph-", 4)); - - if ((argv0 = strrchr(r->filename, '/')) != NULL) - argv0++; - else - argv0 = r->filename; - - if (!(ap_allow_options(r) & OPT_EXECCGI) && !is_scriptaliased(r)) - return log_scripterror(r, conf, FORBIDDEN, APLOG_NOERRNO, - "Options ExecCGI is off in this directory"); - if (nph && is_included) - return log_scripterror(r, conf, FORBIDDEN, APLOG_NOERRNO, - "attempt to include NPH CGI script"); - -#if defined(OS2) || defined(WIN32) - /* Allow for cgid files without the .EXE extension on them under OS/2 */ - if (r->finfo.st_mode == 0) { - struct stat statbuf; - char *newfile; - - newfile = ap_pstrcat(r->pool, r->filename, ".EXE", NULL); - - if ((stat(newfile, &statbuf) != 0) || (!S_ISREG(statbuf.st_mode))) { - return log_scripterror(r, conf, NOT_FOUND, 0, - "script not found or unable to stat"); - } else { - r->filename = newfile; - } - } -#else - if (r->finfo.st_mode == 0) - return log_scripterror(r, conf, NOT_FOUND, APLOG_NOERRNO, - "script not found or unable to stat"); -#endif - if (S_ISDIR(r->finfo.st_mode)) - return log_scripterror(r, conf, FORBIDDEN, APLOG_NOERRNO, - "attempt to invoke directory as script"); -/* - if (!ap_suexec_enabled) { - if (!ap_can_exec(&r->finfo)) - return log_scripterror(r, conf, FORBIDDEN, APLOG_NOERRNO, - "file permissions deny server execution"); - } -*/ - ap_add_common_vars(r); - ap_add_cgi_vars(r); - env = ap_create_environment(r->pool, r->subprocess_env); - - if ((sd = socket(AF_UNIX, SOCK_STREAM, 0)) < 0) { - return log_scripterror(r, conf, NOT_FOUND, 0, - "unable to create socket to cgi daemon"); - } - memset(&unix_addr, 0, sizeof(unix_addr)); - unix_addr.sun_family = AF_UNIX; - strcpy(unix_addr.sun_path, conf->sockname); - - if (connect(sd, (struct sockaddr *)&unix_addr, sizeof(unix_addr)) < 0) { - return log_scripterror(r, conf, NOT_FOUND, 0, - "unable to connect to cgi daemon"); - } - - send_req(sd, r, argv0, env); - - ap_put_os_sock(&tempsock, &sd, pcgi); - - iol = unix_attach_socket(tempsock); - - ap_bpush_iol(script, iol); - - if ((retval = ap_setup_client_block(r, REQUEST_CHUNKED_ERROR))) - return retval; - - if ((argv0 = strrchr(r->filename, '/')) != NULL) - argv0++; - else - argv0 = r->filename; - - /* Transfer any put/post args, CERN style... - * Note that we already ignore SIGPIPE in the core server. - */ - - if (ap_should_client_block(r)) { - int dbsize, len_read; - - if (conf->logname) { - dbuf = ap_pcalloc(r->pool, conf->bufbytes + 1); - dbpos = 0; - } - - - - while ((len_read = - ap_get_client_block(r, argsbuffer, HUGE_STRING_LEN)) > 0) { - if (conf->logname) { - if ((dbpos + len_read) > conf->bufbytes) { - dbsize = conf->bufbytes - dbpos; - } - else { - dbsize = len_read; - } - memcpy(dbuf + dbpos, argsbuffer, dbsize); - dbpos += dbsize; - } - ap_bwrite(script, argsbuffer, len_read, &nbytes); - if (nbytes < len_read) { - /* silly script stopped reading, soak up remaining message */ - while (ap_get_client_block(r, argsbuffer, HUGE_STRING_LEN) > 0) { - /* dump it */ - } - break; - } - } - - ap_bflush(script); - - } - - /* Handle script return... */ - if (script && !nph) { - const char *location; - char sbuf[MAX_STRING_LEN]; - int ret; - - if ((ret = ap_scan_script_header_err_buff(r, script, sbuf))) { - return log_script(r, conf, ret, dbuf, sbuf, script, NULL); - } - -#ifdef CHARSET_EBCDIC - /* Now check the Content-Type to decide if conversion is needed */ - ap_checkconv(r); -#endif /*CHARSET_EBCDIC*/ - - location = ap_table_get(r->headers_out, "Location"); - - if (location && location[0] == '/' && r->status == 200) { - - /* Soak up all the script output */ - while (ap_bgets(argsbuffer, HUGE_STRING_LEN, script) > 0) { - continue; - } - /* This redirect needs to be a GET no matter what the original - * method was. - */ - r->method = ap_pstrdup(r->pool, "GET"); - r->method_number = M_GET; - - /* We already read the message body (if any), so don't allow - * the redirected request to think it has one. We can ignore - * Transfer-Encoding, since we used REQUEST_CHUNKED_ERROR. - */ - ap_table_unset(r->headers_in, "Content-Length"); - - ap_internal_redirect_handler(location, r); - return OK; - } - else if (location && r->status == 200) { - /* XX Note that if a script wants to produce its own Redirect - * body, it now has to explicitly *say* "Status: 302" - */ - return REDIRECT; - } - - ap_send_http_header(r); - if (!r->header_only) { - ap_send_fb(script, r); - } - ap_bclose(script); - } - - if (script && nph) { - ap_send_fb(script, r); - } - -ap_destroy_pool(pcgi); - - return OK; /* NOT r->status, even if it has changed. */ -} - -static const handler_rec cgid_handlers[] = -{ - {CGI_MAGIC_TYPE, cgid_handler}, - {"cgi-script", cgid_handler}, - {NULL} -}; - -static void register_hook(void) -{ - ap_hook_post_config(cgid_init, NULL, NULL, HOOK_MIDDLE); -} - -module MODULE_VAR_EXPORT cgid_module = { - STANDARD20_MODULE_STUFF, - NULL, /* dir config creater */ - NULL, /* dir merger --- default is to override */ - create_cgid_config, /* server config */ - merge_cgid_config, /* merge server config */ - cgid_cmds, /* command table */ - cgid_handlers, /* handlers */ - register_hook /* register_handlers */ -}; - diff --git a/modules/generators/mod_cgid.exp b/modules/generators/mod_cgid.exp deleted file mode 100644 index 5f10d486daabf94443d63e96d0991156ebd71c7c..0000000000000000000000000000000000000000 --- a/modules/generators/mod_cgid.exp +++ /dev/null @@ -1 +0,0 @@ -cgid_module diff --git a/modules/generators/mod_info.c b/modules/generators/mod_info.c deleted file mode 100644 index 279958557805a045d26745ab540eef33b6894912..0000000000000000000000000000000000000000 --- a/modules/generators/mod_info.c +++ /dev/null @@ -1,695 +0,0 @@ -/* ==================================================================== - * Copyright (c) 1995-1999 The Apache Group. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in - * the documentation and/or other materials provided with the - * distribution. - * - * 3. All advertising materials mentioning features or use of this - * software must display the following acknowledgment: - * "This product includes software developed by the Apache Group - * for use in the Apache HTTP server project (http://www.apache.org/)." - * - * 4. The names "Apache Server" and "Apache Group" must not be used to - * endorse or promote products derived from this software without - * prior written permission. For written permission, please contact - * apache@apache.org. - * - * 5. Products derived from this software may not be called "Apache" - * nor may "Apache" appear in their names without prior written - * permission of the Apache Group. - * - * 6. Redistributions of any form whatsoever must retain the following - * acknowledgment: - * "This product includes software developed by the Apache Group - * for use in the Apache HTTP server project (http://www.apache.org/)." - * - * THIS SOFTWARE IS PROVIDED BY THE APACHE GROUP ``AS IS'' AND ANY - * EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR - * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE APACHE GROUP OR - * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT - * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, - * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED - * OF THE POSSIBILITY OF SUCH DAMAGE. - * ==================================================================== - * - * This software consists of voluntary contributions made by many - * individuals on behalf of the Apache Group and was originally based - * on public domain software written at the National Center for - * Supercomputing Applications, University of Illinois, Urbana-Champaign. - * For more information on the Apache Group and the Apache HTTP server - * project, please see <http://www.apache.org/>. - * - */ - -/* - * Info Module. Display configuration information for the server and - * all included modules. - * - * <Location /server-info> - * SetHandler server-info - * </Location> - * - * GET /server-info - Returns full configuration page for server and all modules - * GET /server-info?server - Returns server configuration only - * GET /server-info?module_name - Returns configuration for a single module - * GET /server-info?list - Returns quick list of included modules - * - * Rasmus Lerdorf <rasmus@vex.net>, May 1996 - * - * 05.01.96 Initial Version - * - * Lou Langholtz <ldl@usi.utah.edu>, July 1997 - * - * 07.11.97 Addition of the AddModuleInfo directive - * - */ - -#include "httpd.h" -#include "http_config.h" -#include "http_core.h" -#include "http_log.h" -#include "http_main.h" -#include "http_protocol.h" -#include "util_script.h" -#include "http_conf_globals.h" - -typedef struct { - char *name; /* matching module name */ - char *info; /* additional info */ -} info_entry; - -typedef struct { - array_header *more_info; -} info_svr_conf; - -typedef struct info_cfg_lines { - char *cmd; - char *line; - struct info_cfg_lines *next; -} info_cfg_lines; - -module MODULE_VAR_EXPORT info_module; -extern module *top_module; - -static void *create_info_config(pool *p, server_rec *s) -{ - info_svr_conf *conf = (info_svr_conf *) ap_pcalloc(p, sizeof(info_svr_conf)); - - conf->more_info = ap_make_array(p, 20, sizeof(info_entry)); - return conf; -} - -static void *merge_info_config(pool *p, void *basev, void *overridesv) -{ - info_svr_conf *new = (info_svr_conf *) ap_pcalloc(p, sizeof(info_svr_conf)); - info_svr_conf *base = (info_svr_conf *) basev; - info_svr_conf *overrides = (info_svr_conf *) overridesv; - - new->more_info = ap_append_arrays(p, overrides->more_info, base->more_info); - return new; -} - -static char *mod_info_html_cmd_string(const char *string, char *buf, size_t buf_len) -{ - const char *s; - char *t; - char *end_buf; - - s = string; - t = buf; - /* keep space for \0 byte */ - end_buf = buf + buf_len - 1; - while ((*s) && (t < end_buf)) { - if (*s == '<') { - strncpy(t, "<", end_buf - t); - t += 4; - } - else if (*s == '>') { - strncpy(t, ">", end_buf - t); - t += 4; - } - else if (*s == '&') { - strncpy(t, "&", end_buf - t); - t += 5; - } - else { - *t++ = *s; - } - s++; - } - /* oops, overflowed... don't overwrite */ - if (t > end_buf) { - *end_buf = '\0'; - } - else { - *t = '\0'; - } - return (buf); -} - -static info_cfg_lines *mod_info_load_config(pool *p, const char *filename, - request_rec *r) -{ - char s[MAX_STRING_LEN]; - configfile_t *fp; - info_cfg_lines *new, *ret, *prev; - const char *t; - - fp = ap_pcfg_openfile(p, filename); - if (!fp) { - ap_log_rerror(APLOG_MARK, APLOG_WARNING, r, - "mod_info: couldn't open config file %s", - filename); - return NULL; - } - ret = NULL; - prev = NULL; - while (!ap_cfg_getline(s, MAX_STRING_LEN, fp)) { - if (*s == '#') { - continue; /* skip comments */ - } - new = ap_palloc(p, sizeof(struct info_cfg_lines)); - new->next = NULL; - if (!ret) { - ret = new; - } - if (prev) { - prev->next = new; - } - t = s; - new->cmd = ap_getword_conf(p, &t); - if (*t) { - new->line = ap_pstrdup(p, t); - } - else { - new->line = NULL; - } - prev = new; - } - ap_cfg_closefile(fp); - return (ret); -} - -static void mod_info_module_cmds(request_rec *r, info_cfg_lines *cfg, - const command_rec *cmds, char *label) -{ - const command_rec *cmd = cmds; - info_cfg_lines *li = cfg, *li_st = NULL, *li_se = NULL; - info_cfg_lines *block_start = NULL; - int lab = 0, nest = 0; - char buf[MAX_STRING_LEN]; - - while (li) { - if (!strncasecmp(li->cmd, "<directory", 10) || - !strncasecmp(li->cmd, "<location", 9) || - !strncasecmp(li->cmd, "<limit", 6) || - !strncasecmp(li->cmd, "<files", 6)) { - if (nest) { - li_se = li; - } - else { - li_st = li; - } - li = li->next; - nest++; - continue; - } - else if (nest && (!strncasecmp(li->cmd, "</limit", 7) || - !strncasecmp(li->cmd, "</location", 10) || - !strncasecmp(li->cmd, "</directory", 11) || - !strncasecmp(li->cmd, "</files", 7))) { - if (block_start) { - if ((nest == 1 && block_start == li_st) || - (nest == 2 && block_start == li_se)) { - ap_rputs("<dd><tt>", r); - if (nest == 2) { - ap_rputs("  ", r); - } - ap_rputs(mod_info_html_cmd_string(li->cmd, buf, sizeof(buf)), r); - ap_rputs(" ", r); - if (li->line) { - ap_rputs(mod_info_html_cmd_string(li->line, buf, sizeof(buf)), r); - } - ap_rputs("</tt>\n", r); - nest--; - if (!nest) { - block_start = NULL; - li_st = NULL; - } - else { - block_start = li_st; - } - li_se = NULL; - } - else { - nest--; - if (!nest) { - li_st = NULL; - } - li_se = NULL; - } - } - else { - nest--; - if (!nest) { - li_st = NULL; - } - li_se = NULL; - } - li = li->next; - continue; - } - cmd = cmds; - while (cmd) { - if (cmd->name) { - if (!strcasecmp(cmd->name, li->cmd)) { - if (!lab) { - ap_rputs("<dt><strong>", r); - ap_rputs(label, r); - ap_rputs("</strong>\n", r); - lab = 1; - } - if (((nest && block_start == NULL) || - (nest == 2 && block_start == li_st)) && - (strncasecmp(li->cmd, "<directory", 10) && - strncasecmp(li->cmd, "<location", 9) && - strncasecmp(li->cmd, "<limit", 6) && - strncasecmp(li->cmd, "</limit", 7) && - strncasecmp(li->cmd, "</location", 10) && - strncasecmp(li->cmd, "</directory", 11) && - strncasecmp(li->cmd, "</files", 7))) { - ap_rputs("<dd><tt>", r); - ap_rputs(mod_info_html_cmd_string(li_st->cmd, buf, sizeof(buf)), r); - ap_rputs(" ", r); - if (li_st->line) { - ap_rputs(mod_info_html_cmd_string(li_st->line, buf, sizeof(buf)), r); - } - ap_rputs("</tt>\n", r); - block_start = li_st; - if (li_se) { - ap_rputs("<dd><tt>  ", r); - ap_rputs(mod_info_html_cmd_string(li_se->cmd, buf, sizeof(buf)), r); - ap_rputs(" ", r); - if (li_se->line) { - ap_rputs(mod_info_html_cmd_string(li_se->line, buf, sizeof(buf)), r); - } - ap_rputs("</tt>\n", r); - block_start = li_se; - } - } - ap_rputs("<dd><tt>", r); - if (nest) { - ap_rputs("  ", r); - } - if (nest == 2) { - ap_rputs("  ", r); - } - ap_rputs(mod_info_html_cmd_string(li->cmd, buf, sizeof(buf)), r); - if (li->line) { - ap_rputs(" <i>", r); - ap_rputs(mod_info_html_cmd_string(li->line, buf, sizeof(buf)), r); - ap_rputs("</i>", r); - } - ap_rputs("</tt>", r); - } - } - else - break; - cmd++; - } - li = li->next; - } -} - -static char *find_more_info(server_rec *s, const char *module_name) -{ - int i; - info_svr_conf *conf = (info_svr_conf *) ap_get_module_config(s->module_config, - &info_module); - info_entry *entry = (info_entry *) conf->more_info->elts; - - if (!module_name) { - return 0; - } - for (i = 0; i < conf->more_info->nelts; i++) { - if (!strcmp(module_name, entry->name)) { - return entry->info; - } - entry++; - } - return 0; -} - -static int display_info(request_rec *r) -{ - module *modp = NULL; - char buf[MAX_STRING_LEN], *cfname; - char *more_info; - const command_rec *cmd = NULL; - const handler_rec *hand = NULL; - server_rec *serv = r->server; - int comma = 0; - info_cfg_lines *mod_info_cfg_httpd = NULL; - info_cfg_lines *mod_info_cfg_srm = NULL; - info_cfg_lines *mod_info_cfg_access = NULL; - - r->allowed |= (1 << M_GET); - if (r->method_number != M_GET) - return DECLINED; - - r->content_type = "text/html"; - ap_send_http_header(r); - if (r->header_only) { - return 0; - } - ap_hard_timeout("send server info", r); - - ap_rputs(DOCTYPE_HTML_3_2 - "<html><head><title>Server Information\n", r); - ap_rputs("

    Apache Server Information

    \n", r); - if (!r->args || strcasecmp(r->args, "list")) { - cfname = ap_server_root_relative(r->pool, ap_server_confname); - mod_info_cfg_httpd = mod_info_load_config(r->pool, cfname, r); - cfname = ap_server_root_relative(r->pool, serv->srm_confname); - mod_info_cfg_srm = mod_info_load_config(r->pool, cfname, r); - cfname = ap_server_root_relative(r->pool, serv->access_confname); - mod_info_cfg_access = mod_info_load_config(r->pool, cfname, r); - if (!r->args) { - ap_rputs("Server Settings, ", r); - for (modp = top_module; modp; modp = modp->next) { - ap_rprintf(r, "%s", modp->name, modp->name); - if (modp->next) { - ap_rputs(", ", r); - } - } - ap_rputs("
    ", r); - - } - if (!r->args || !strcasecmp(r->args, "server")) { - ap_rprintf(r, "Server Version: " - "%s
    \n", - ap_get_server_version()); - ap_rprintf(r, "Server Built: " - "%s
    \n", - ap_get_server_built()); - ap_rprintf(r, "API Version: " - "%d:%d
    \n", - MODULE_MAGIC_NUMBER_MAJOR, MODULE_MAGIC_NUMBER_MINOR); - ap_rprintf(r, "Run Mode: %s
    \n", - (ap_standalone ? "standalone" : "inetd")); - ap_rprintf(r, "User/Group: " - "%s(%d)/%d
    \n", - ap_user_name, (int) ap_user_id, (int) ap_group_id); - ap_rprintf(r, "Hostname/port: " - "%s:%u
    \n", - serv->server_hostname, serv->port); - ap_rprintf(r, "Daemons: " - "start: %d    " - "min idle: %d    " - "max idle: %d    " - "max: %d
    \n", - ap_daemons_to_start, ap_daemons_min_free, - ap_daemons_max_free, ap_daemons_limit); - ap_rprintf(r, "Max Requests: " - "per child: %d    " - "keep alive: %s    " - "max per connection: %d
    \n", - ap_max_requests_per_child, - (serv->keep_alive ? "on" : "off"), - serv->keep_alive_max); - ap_rprintf(r, "Threads: " - "per child: %d   
    \n", - ap_threads_per_child); - ap_rprintf(r, "Excess requests: " - "per child: %d   
    \n", - ap_excess_requests_per_child); - ap_rprintf(r, "Timeouts: " - "connection: %d    " - "keep-alive: %d
    ", - serv->timeout, serv->keep_alive_timeout); - ap_rprintf(r, "Server Root: " - "%s
    \n", ap_server_root); - ap_rprintf(r, "Config File: " - "%s
    \n", ap_server_confname); - ap_rprintf(r, "PID File: " - "%s
    \n", ap_pid_fname); - ap_rprintf(r, "Scoreboard File: " - "%s
    \n", ap_scoreboard_fname); - } - ap_rputs("
    ", r); - for (modp = top_module; modp; modp = modp->next) { - if (!r->args || !strcasecmp(modp->name, r->args)) { - ap_rprintf(r, "
    Module Name: " - "%s\n", - modp->name, modp->name); - ap_rputs("
    Content handlers:", r); - hand = modp->handlers; - if (hand) { - while (hand) { - if (hand->content_type) { - ap_rprintf(r, " %s\n", hand->content_type); - } - else { - break; - } - hand++; - if (hand && hand->content_type) { - ap_rputs(",", r); - } - } - } - else { - ap_rputs(" none", r); - } - ap_rputs("
    Configuration Phase Participation: \n", - r); - if (modp->child_init) { - ap_rputs("Child Init", r); - comma = 1; - } - if (modp->create_dir_config) { - if (comma) { - ap_rputs(", ", r); - } - ap_rputs("Create Directory Config", r); - comma = 1; - } - if (modp->merge_dir_config) { - if (comma) { - ap_rputs(", ", r); - } - ap_rputs("Merge Directory Configs", r); - comma = 1; - } - if (modp->create_server_config) { - if (comma) { - ap_rputs(", ", r); - } - ap_rputs("Create Server Config", r); - comma = 1; - } - if (modp->merge_server_config) { - if (comma) { - ap_rputs(", ", r); - } - ap_rputs("Merge Server Configs", r); - comma = 1; - } - if (modp->child_exit) { - if (comma) { - ap_rputs(", ", r); - } - ap_rputs("Child Exit", r); - comma = 1; - } - if (!comma) - ap_rputs(" none", r); - comma = 0; - ap_rputs("
    Request Phase Participation: \n", - r); - if (modp->post_read_request) { - ap_rputs("Post-Read Request", r); - comma = 1; - } - if (modp->header_parser) { - if (comma) { - ap_rputs(", ", r); - } - ap_rputs("Header Parse", r); - comma = 1; - } - if (modp->translate_handler) { - if (comma) { - ap_rputs(", ", r); - } - ap_rputs("Translate Path", r); - comma = 1; - } - if (modp->access_checker) { - if (comma) { - ap_rputs(", ", r); - } - ap_rputs("Check Access", r); - comma = 1; - } - if (modp->ap_check_user_id) { - if (comma) { - ap_rputs(", ", r); - } - ap_rputs("Verify User ID", r); - comma = 1; - } - if (modp->auth_checker) { - if (comma) { - ap_rputs(", ", r); - } - ap_rputs("Verify User Access", r); - comma = 1; - } - if (modp->type_checker) { - if (comma) { - ap_rputs(", ", r); - } - ap_rputs("Check Type", r); - comma = 1; - } - if (modp->fixer_upper) { - if (comma) { - ap_rputs(", ", r); - } - ap_rputs("Fixups", r); - comma = 1; - } - if (modp->logger) { - if (comma) { - ap_rputs(", ", r); - } - ap_rputs("Logging", r); - comma = 1; - } - if (!comma) - ap_rputs(" none", r); - comma = 0; - ap_rputs("
    Module Directives: ", r); - cmd = modp->cmds; - if (cmd) { - while (cmd) { - if (cmd->name) { - ap_rprintf(r, "
    %s - ", - mod_info_html_cmd_string(cmd->name, - buf, sizeof(buf))); - if (cmd->errmsg) { - ap_rputs(cmd->errmsg, r); - } - ap_rputs("\n", r); - } - else { - break; - } - cmd++; - } - ap_rputs("
    Current Configuration:\n", r); - mod_info_module_cmds(r, mod_info_cfg_httpd, modp->cmds, - "httpd.conf"); - mod_info_module_cmds(r, mod_info_cfg_srm, modp->cmds, - "srm.conf"); - mod_info_module_cmds(r, mod_info_cfg_access, modp->cmds, - "access.conf"); - } - else { - ap_rputs(" none\n", r); - } - more_info = find_more_info(serv, modp->name); - if (more_info) { - ap_rputs("
    Additional Information:\n
    ", - r); - ap_rputs(more_info, r); - } - ap_rputs("

    \n", r); - if (r->args) { - break; - } - } - } - if (!modp && r->args && strcasecmp(r->args, "server")) { - ap_rputs("No such module\n", r); - } - } - else { - for (modp = top_module; modp; modp = modp->next) { - ap_rputs(modp->name, r); - if (modp->next) { - ap_rputs("
    ", r); - } - } - } - ap_rputs("
    \n", r); - ap_rputs(ap_psignature("",r), r); - ap_rputs("\n", r); - /* Done, turn off timeout, close file and return */ - ap_kill_timeout(r); - return 0; -} - -static const char *add_module_info(cmd_parms *cmd, void *dummy, char *name, - char *info) -{ - server_rec *s = cmd->server; - info_svr_conf *conf = (info_svr_conf *) ap_get_module_config(s->module_config, - &info_module); - info_entry *new = ap_push_array(conf->more_info); - - new->name = name; - new->info = info; - return NULL; -} - -static const command_rec info_cmds[] = -{ - {"AddModuleInfo", add_module_info, NULL, RSRC_CONF, TAKE2, - "a module name and additional information on that module"}, - {NULL} -}; - -static const handler_rec info_handlers[] = -{ - {"server-info", display_info}, - {NULL} -}; - -module MODULE_VAR_EXPORT info_module = -{ - STANDARD_MODULE_STUFF, - NULL, /* initializer */ - NULL, /* dir config creater */ - NULL, /* dir merger --- default is to override */ - create_info_config, /* server config */ - merge_info_config, /* merge server config */ - info_cmds, /* command table */ - info_handlers, /* handlers */ - NULL, /* filename translation */ - NULL, /* check_user_id */ - NULL, /* check auth */ - NULL, /* check access */ - NULL, /* type_checker */ - NULL, /* fixups */ - NULL, /* logger */ - NULL, /* header parser */ - NULL, /* child_init */ - NULL, /* child_exit */ - NULL /* post read-request */ -}; diff --git a/modules/generators/mod_info.dsp b/modules/generators/mod_info.dsp deleted file mode 100644 index cf856463352694a935947ae1562146179588acd4..0000000000000000000000000000000000000000 --- a/modules/generators/mod_info.dsp +++ /dev/null @@ -1,112 +0,0 @@ -# Microsoft Developer Studio Project File - Name="ApacheModuleInfo" - Package Owner=<4> -# Microsoft Developer Studio Generated Build File, Format Version 5.00 -# ** DO NOT EDIT ** - -# TARGTYPE "Win32 (x86) Dynamic-Link Library" 0x0102 - -CFG=ApacheModuleInfo - Win32 Release -!MESSAGE This is not a valid makefile. To build this project using NMAKE, -!MESSAGE use the Export Makefile command and run -!MESSAGE -!MESSAGE NMAKE /f "ApacheModuleInfo.mak". -!MESSAGE -!MESSAGE You can specify a configuration when running NMAKE -!MESSAGE by defining the macro CFG on the command line. For example: -!MESSAGE -!MESSAGE NMAKE /f "ApacheModuleInfo.mak" CFG="ApacheModuleInfo - Win32 Release" -!MESSAGE -!MESSAGE Possible choices for configuration are: -!MESSAGE -!MESSAGE "ApacheModuleInfo - Win32 Release" (based on\ - "Win32 (x86) Dynamic-Link Library") -!MESSAGE "ApacheModuleInfo - Win32 Debug" (based on\ - "Win32 (x86) Dynamic-Link Library") -!MESSAGE - -# Begin Project -# PROP Scc_ProjName "" -# PROP Scc_LocalPath "" -CPP=cl.exe -MTL=midl.exe -RSC=rc.exe - -!IF "$(CFG)" == "ApacheModuleInfo - Win32 Release" - -# PROP BASE Use_MFC 0 -# PROP BASE Use_Debug_Libraries 0 -# PROP BASE Output_Dir ".\Release" -# PROP BASE Intermediate_Dir ".\Release" -# PROP BASE Target_Dir "" -# PROP Use_MFC 0 -# PROP Use_Debug_Libraries 0 -# PROP Output_Dir ".\ApacheModuleInfoR" -# PROP Intermediate_Dir ".\ApacheModuleInfoR" -# PROP Ignore_Export_Lib 0 -# PROP Target_Dir "" -# ADD BASE CPP /nologo /MT /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /YX /c -# ADD CPP /nologo /MD /W3 /GX /O2 /I "..\..\include" /D "NDEBUG" /D "WIN32" /D "_WINDOWS" /D "SHARED_MODULE" /YX /FD /c -# ADD BASE MTL /nologo /D "NDEBUG" /win32 -# ADD MTL /nologo /D "NDEBUG" /mktyplib203 /win32 -# ADD BASE RSC /l 0x809 /d "NDEBUG" -# ADD RSC /l 0x809 /d "NDEBUG" -BSC32=bscmake.exe -# ADD BASE BSC32 /nologo -# ADD BSC32 /nologo -LINK32=link.exe -# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:windows /dll /machine:I386 -# ADD LINK32 ..\..\CoreR\ApacheCore.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib /nologo /subsystem:windows /dll /machine:I386 - -!ELSEIF "$(CFG)" == "ApacheModuleInfo - Win32 Debug" - -# PROP BASE Use_MFC 0 -# PROP BASE Use_Debug_Libraries 1 -# PROP BASE Output_Dir ".\Debug" -# PROP BASE Intermediate_Dir ".\Debug" -# PROP BASE Target_Dir "" -# PROP Use_MFC 0 -# PROP Use_Debug_Libraries 1 -# PROP Output_Dir ".\ApacheModuleInfoD" -# PROP Intermediate_Dir ".\ApacheModuleInfoD" -# PROP Ignore_Export_Lib 0 -# PROP Target_Dir "" -# ADD BASE CPP /nologo /MTd /W3 /Gm /GX /Zi /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /YX /c -# ADD CPP /nologo /MDd /W3 /Gm /GX /Zi /Od /I "..\..\include" /D "_DEBUG" /D "WIN32" /D "_WINDOWS" /D "SHARED_MODULE" /YX /FD /c -# ADD BASE MTL /nologo /D "_DEBUG" /win32 -# ADD MTL /nologo /D "_DEBUG" /mktyplib203 /win32 -# ADD BASE RSC /l 0x809 /d "_DEBUG" -# ADD RSC /l 0x809 /d "_DEBUG" -BSC32=bscmake.exe -# ADD BASE BSC32 /nologo -# ADD BSC32 /nologo -LINK32=link.exe -# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:windows /dll /debug /machine:I386 -# ADD LINK32 ..\..\CoreD\ApacheCore.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib /nologo /subsystem:windows /dll /debug /machine:I386 - -!ENDIF - -# Begin Target - -# Name "ApacheModuleInfo - Win32 Release" -# Name "ApacheModuleInfo - Win32 Debug" -# Begin Group "Source Files" - -# PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;hpj;bat;for;f90" -# Begin Source File - -SOURCE=..\..\modules\standard\mod_info.c -# End Source File -# End Group -# Begin Group "Header Files" - -# PROP Default_Filter "h;hpp;hxx;hm;inl;fi;fd" -# Begin Source File - -SOURCE=.\readdir.h -# End Source File -# End Group -# Begin Group "Resource Files" - -# PROP Default_Filter "ico;cur;bmp;dlg;rc2;rct;bin;cnt;rtf;gif;jpg;jpeg;jpe" -# End Group -# End Target -# End Project diff --git a/modules/generators/mod_info.exp b/modules/generators/mod_info.exp deleted file mode 100644 index c304fa776dbeb98450eb2c45b8bc3b541f33b207..0000000000000000000000000000000000000000 --- a/modules/generators/mod_info.exp +++ /dev/null @@ -1 +0,0 @@ -info_module diff --git a/modules/generators/mod_status.c b/modules/generators/mod_status.c deleted file mode 100644 index 88fc0870908658407aa9745afc6d12f81623a3f2..0000000000000000000000000000000000000000 --- a/modules/generators/mod_status.c +++ /dev/null @@ -1,773 +0,0 @@ -/* ==================================================================== - * Copyright (c) 1995-1999 The Apache Group. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in - * the documentation and/or other materials provided with the - * distribution. - * - * 3. All advertising materials mentioning features or use of this - * software must display the following acknowledgment: - * "This product includes software developed by the Apache Group - * for use in the Apache HTTP server project (http://www.apache.org/)." - * - * 4. The names "Apache Server" and "Apache Group" must not be used to - * endorse or promote products derived from this software without - * prior written permission. For written permission, please contact - * apache@apache.org. - * - * 5. Products derived from this software may not be called "Apache" - * nor may "Apache" appear in their names without prior written - * permission of the Apache Group. - * - * 6. Redistributions of any form whatsoever must retain the following - * acknowledgment: - * "This product includes software developed by the Apache Group - * for use in the Apache HTTP server project (http://www.apache.org/)." - * - * THIS SOFTWARE IS PROVIDED BY THE APACHE GROUP ``AS IS'' AND ANY - * EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR - * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE APACHE GROUP OR - * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT - * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, - * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED - * OF THE POSSIBILITY OF SUCH DAMAGE. - * ==================================================================== - * - * This software consists of voluntary contributions made by many - * individuals on behalf of the Apache Group and was originally based - * on public domain software written at the National Center for - * Supercomputing Applications, University of Illinois, Urbana-Champaign. - * For more information on the Apache Group and the Apache HTTP server - * project, please see . - * - */ - -/* Status Module. Display lots of internal data about how Apache is - * performing and the state of all children processes. - * - * To enable this, add the following lines into any config file: - * - * - * SetHandler server-status - * - * - * You may want to protect this location by password or domain so no one - * else can look at it. Then you can access the statistics with a URL like: - * - * http://your_server_name/server-status - * - * /server-status - Returns page using tables - * /server-status?notable - Returns page for browsers without table support - * /server-status?refresh - Returns page with 1 second refresh - * /server-status?refresh=6 - Returns page with refresh every 6 seconds - * /server-status?auto - Returns page with data for automatic parsing - * - * Mark Cox, mark@ukweb.com, November 1995 - * - * 12.11.95 Initial version for www.telescope.org - * 13.3.96 Updated to remove rprintf's [Mark] - * 18.3.96 Added CPU usage, process information, and tidied [Ben Laurie] - * 18.3.96 Make extra Scoreboard variables #definable - * 25.3.96 Make short report have full precision [Ben Laurie suggested] - * 25.3.96 Show uptime better [Mark/Ben Laurie] - * 29.3.96 Better HTML and explanation [Mark/Rob Hartill suggested] - * 09.4.96 Added message for non-STATUS compiled version - * 18.4.96 Added per child and per slot counters [Jim Jagielski] - * 01.5.96 Table format, cleanup, even more spiffy data [Chuck Murcko/Jim J.] - * 18.5.96 Adapted to use new rprintf() routine, incidentally fixing a missing - * piece in short reports [Ben Laurie] - * 21.5.96 Additional Status codes (DNS and LOGGING only enabled if - * extended STATUS is enabled) [George Burgyan/Jim J.] - * 10.8.98 Allow for extended status info at runtime (no more STATUS) - * [Jim J.] - */ - -#define CORE_PRIVATE -#include "httpd.h" -#include "http_config.h" -#include "http_core.h" -#include "http_protocol.h" -#include "http_conf_globals.h" /* for ap_extended_status */ -#include "http_main.h" -#include "util_script.h" -#include -#include "scoreboard.h" -#include "http_log.h" - -#ifdef NEXT -#if (NX_CURRENT_COMPILER_RELEASE == 410) -#ifdef m68k -#define HZ 64 -#else -#define HZ 100 -#endif -#else -#include -#endif -#endif /* NEXT */ - -#define STATUS_MAXLINE 64 - -#define KBYTE 1024 -#define MBYTE 1048576L -#define GBYTE 1073741824L - -#ifndef DEFAULT_TIME_FORMAT -#define DEFAULT_TIME_FORMAT "%A, %d-%b-%Y %H:%M:%S %Z" -#endif - -module MODULE_VAR_EXPORT status_module; - -/* - *command-related code. This is here to prevent use of ExtendedStatus - * without status_module included. - */ -static const char *set_extended_status(cmd_parms *cmd, void *dummy, char *arg) -{ - const char *err = ap_check_cmd_context(cmd, GLOBAL_ONLY); - if (err != NULL) { - return err; - } - if (!strcasecmp(arg, "off") || !strcmp(arg, "0")) { - ap_extended_status = 0; - } - else { - ap_extended_status = 1; - } - return NULL; -} - -static const command_rec status_module_cmds[] = -{ - { "ExtendedStatus", set_extended_status, NULL, RSRC_CONF, TAKE1, - "\"On\" to enable extended status information, \"Off\" to disable" }, - {NULL} -}; - -/* Format the number of bytes nicely */ -static void format_byte_out(request_rec *r, unsigned long bytes) -{ - if (bytes < (5 * KBYTE)) - ap_rprintf(r, "%d B", (int) bytes); - else if (bytes < (MBYTE / 2)) - ap_rprintf(r, "%.1f kB", (float) bytes / KBYTE); - else if (bytes < (GBYTE / 2)) - ap_rprintf(r, "%.1f MB", (float) bytes / MBYTE); - else - ap_rprintf(r, "%.1f GB", (float) bytes / GBYTE); -} - -static void format_kbyte_out(request_rec *r, unsigned long kbytes) -{ - if (kbytes < KBYTE) - ap_rprintf(r, "%d kB", (int) kbytes); - else if (kbytes < MBYTE) - ap_rprintf(r, "%.1f MB", (float) kbytes / KBYTE); - else - ap_rprintf(r, "%.1f GB", (float) kbytes / MBYTE); -} - -static void show_time(request_rec *r, time_t tsecs) -{ - long days, hrs, mins, secs; - - secs = tsecs % 60; - tsecs /= 60; - mins = tsecs % 60; - tsecs /= 60; - hrs = tsecs % 24; - days = tsecs / 24; - if (days) - ap_rprintf(r, " %ld day%s", days, days == 1 ? "" : "s"); - if (hrs) - ap_rprintf(r, " %ld hour%s", hrs, hrs == 1 ? "" : "s"); - if (mins) - ap_rprintf(r, " %ld minute%s", mins, mins == 1 ? "" : "s"); - if (secs) - ap_rprintf(r, " %ld second%s", secs, secs == 1 ? "" : "s"); -} - -/* Main handler for x-httpd-status requests */ - -/* ID values for command table */ - -#define STAT_OPT_END -1 -#define STAT_OPT_REFRESH 0 -#define STAT_OPT_NOTABLE 1 -#define STAT_OPT_AUTO 2 - -struct stat_opt { - int id; - const char *form_data_str; - const char *hdr_out_str; -}; - -static const struct stat_opt status_options[] = /* see #defines above */ -{ - {STAT_OPT_REFRESH, "refresh", "Refresh"}, - {STAT_OPT_NOTABLE, "notable", NULL}, - {STAT_OPT_AUTO, "auto", NULL}, - {STAT_OPT_END, NULL, NULL} -}; - -static char status_flags[SERVER_NUM_STATUS]; - -static int status_handler(request_rec *r) -{ - char *loc; - time_t nowtime = time(NULL); - time_t up_time; - int i, res; - int ready = 0; - int busy = 0; - unsigned long count = 0; - unsigned long lres, bytes; - unsigned long my_lres, my_bytes, conn_bytes; - unsigned short conn_lres; - unsigned long bcount = 0; - unsigned long kbcount = 0; - long req_time; -#ifndef NO_TIMES -#ifdef _SC_CLK_TCK - float tick = sysconf(_SC_CLK_TCK); -#else - float tick = HZ; -#endif -#endif - int short_report = 0; - int no_table_report = 0; - short_score score_record; - parent_score ps_record; - char stat_buffer[HARD_SERVER_LIMIT]; - int pid_buffer[HARD_SERVER_LIMIT]; - clock_t tu, ts, tcu, tcs; - server_rec *vhost; - - tu = ts = tcu = tcs = 0; - - if (!ap_exists_scoreboard_image()) { - ap_log_rerror(APLOG_MARK, APLOG_NOERRNO|APLOG_ERR, r, - "Server status unavailable in inetd mode"); - return HTTP_INTERNAL_SERVER_ERROR; - } - r->allowed = (1 << M_GET); - if (r->method_number != M_GET) - return DECLINED; - - r->content_type = "text/html"; - - /* - * Simple table-driven form data set parser that lets you alter the header - */ - - if (r->args) { - i = 0; - while (status_options[i].id != STAT_OPT_END) { - if ((loc = strstr(r->args, status_options[i].form_data_str)) != NULL) { - switch (status_options[i].id) { - case STAT_OPT_REFRESH: - if (*(loc + strlen(status_options[i].form_data_str)) == '=') - ap_table_set(r->headers_out, - status_options[i].hdr_out_str, - loc + strlen(status_options[i].hdr_out_str) + 1); - else - ap_table_set(r->headers_out, - status_options[i].hdr_out_str, "1"); - break; - case STAT_OPT_NOTABLE: - no_table_report = 1; - break; - case STAT_OPT_AUTO: - r->content_type = "text/plain"; - short_report = 1; - break; - } - } - i++; - } - } - - ap_send_http_header(r); - - if (r->header_only) - return 0; - - ap_sync_scoreboard_image(); - for (i = 0; i < HARD_SERVER_LIMIT; ++i) { - score_record = ap_scoreboard_image->servers[i]; - ps_record = ap_scoreboard_image->parent[i]; - res = score_record.status; - stat_buffer[i] = status_flags[res]; - pid_buffer[i] = (int) ps_record.pid; - if (res == SERVER_READY) - ready++; - else if (res != SERVER_DEAD) - busy++; - if (ap_extended_status) { - lres = score_record.access_count; - bytes = score_record.bytes_served; - if (lres != 0 || (res != SERVER_READY && res != SERVER_DEAD)) { -#ifndef NO_TIMES - tu += score_record.times.tms_utime; - ts += score_record.times.tms_stime; - tcu += score_record.times.tms_cutime; - tcs += score_record.times.tms_cstime; -#endif /* NO_TIMES */ - count += lres; - bcount += bytes; - if (bcount >= KBYTE) { - kbcount += (bcount >> 10); - bcount = bcount & 0x3ff; - } - } - } - } - - up_time = nowtime - ap_restart_time; - - ap_hard_timeout("send status info", r); - - if (!short_report) { - ap_rputs(DOCTYPE_HTML_3_2 - "\nApache Status\n\n", - r); - ap_rputs("

    Apache Server Status for ", r); - ap_rvputs(r, ap_get_server_name(r), "

    \n\n", NULL); - ap_rvputs(r, "Server Version: ", - ap_get_server_version(), "
    \n", NULL); - ap_rvputs(r, "Server Built: ", - ap_get_server_built(), "
    \n
    \n", NULL); - ap_rvputs(r, "Current Time: ", - ap_ht_time(r->pool, nowtime, DEFAULT_TIME_FORMAT, 0), "
    \n", NULL); - ap_rvputs(r, "Restart Time: ", - ap_ht_time(r->pool, ap_restart_time, DEFAULT_TIME_FORMAT, 0), - "
    \n", NULL); - ap_rprintf(r, "Parent Server Generation: %d
    \n", (int) ap_my_generation); - ap_rputs("Server uptime: ", r); - show_time(r, up_time); - ap_rputs("
    \n", r); - } - - if (ap_extended_status) { - if (short_report) { - ap_rprintf(r, "Total Accesses: %lu\nTotal kBytes: %lu\n", - count, kbcount); - -#ifndef NO_TIMES - /* Allow for OS/2 not having CPU stats */ - if (ts || tu || tcu || tcs) - ap_rprintf(r, "CPULoad: %g\n", - (tu + ts + tcu + tcs) / tick / up_time * 100.); -#endif - - ap_rprintf(r, "Uptime: %ld\n", (long) (up_time)); - if (up_time > 0) - ap_rprintf(r, "ReqPerSec: %g\n", - (float) count / (float) up_time); - - if (up_time > 0) - ap_rprintf(r, "BytesPerSec: %g\n", - KBYTE * (float) kbcount / (float) up_time); - - if (count > 0) - ap_rprintf(r, "BytesPerReq: %g\n", - KBYTE * (float) kbcount / (float) count); - } - else { /* !short_report */ - ap_rprintf(r, "Total accesses: %lu - Total Traffic: ", count); - format_kbyte_out(r, kbcount); - -#ifndef NO_TIMES - /* Allow for OS/2 not having CPU stats */ - ap_rputs("
    \n", r); - ap_rprintf(r, "CPU Usage: u%g s%g cu%g cs%g", - tu / tick, ts / tick, tcu / tick, tcs / tick); - - if (ts || tu || tcu || tcs) - ap_rprintf(r, " - %.3g%% CPU load", - (tu + ts + tcu + tcs) / tick / up_time * 100.); -#endif - - ap_rputs("
    \n", r); - - if (up_time > 0) - ap_rprintf(r, "%.3g requests/sec - ", - (float) count / (float) up_time); - - if (up_time > 0) { - format_byte_out(r, KBYTE * (float) kbcount / (float) up_time); - ap_rputs("/second - ", r); - } - - if (count > 0) { - format_byte_out(r, KBYTE * (float) kbcount / (float) count); - ap_rputs("/request", r); - } - - ap_rputs("
    \n", r); - } /* short_report */ - } /* ap_extended_status */ - - if (!short_report) - ap_rprintf(r, "\n%d requests currently being processed, %d idle servers\n" - ,busy, ready); - else - ap_rprintf(r, "BusyServers: %d\nIdleServers: %d\n", busy, ready); - - /* send the scoreboard 'table' out */ - - if (!short_report) - ap_rputs("
    ", r);
    -    else
    -	ap_rputs("Scoreboard: ", r);
    -
    -    for (i = 0; i < HARD_SERVER_LIMIT; ++i) {
    -	ap_rputc(stat_buffer[i], r);
    -	if ((i % STATUS_MAXLINE == (STATUS_MAXLINE - 1)) && !short_report)
    -	    ap_rputs("\n", r);
    -    }
    -
    -    if (short_report)
    -	ap_rputs("\n", r);
    -    else {
    -	ap_rputs("
    \n", r); - ap_rputs("Scoreboard Key:
    \n", r); - ap_rputs("\"_\" Waiting for Connection, \n", r); - ap_rputs("\"S\" Starting up, \n", r); - ap_rputs("\"R\" Reading Request,
    \n", r); - ap_rputs("\"W\" Sending Reply, \n", r); - ap_rputs("\"K\" Keepalive (read), \n", r); - ap_rputs("\"D\" DNS Lookup,
    \n", r); - ap_rputs("\"L\" Logging, \n", r); - ap_rputs("\"G\" Gracefully finishing, \n", r); - ap_rputs("\".\" Open slot with no current process

    \n", r); - ap_rputs("

    \n", r); - if (!ap_extended_status) { - int j = 0; - ap_rputs("PID Key:
    \n", r); - ap_rputs("

    \n", r);
    -	    for (i = 0; i < HARD_SERVER_LIMIT; ++i) {
    -		if (stat_buffer[i] != '.') {
    -		    ap_rprintf(r, "   %d in state: %c ", pid_buffer[i],
    -		     stat_buffer[i]);
    -		    if (++j >= 3) {
    -		    	ap_rputs("\n", r);
    -			j = 0;
    -		    } else
    -		    	ap_rputs(",", r);
    -		}
    -	    }
    -	    ap_rputs("\n", r);
    -	    ap_rputs("
    \n", r); - } - } - - if (ap_extended_status) { - if (!short_report) { - if (no_table_report) - ap_rputs("


    Server Details

    \n\n", r); - else -#ifdef NO_TIMES - /* Allow for OS/2 not having CPU stats */ - ap_rputs("

    \n\n

    attributes" -] -.I [http://]hostname[:port]/path - -.B ab -[ -.B \-V -] [ -.B \-h -] -.PP -.SH DESCRIPTION -.B ab -is a tool for benchmarking your Apache HyperText Transfer Protocol (HTTP) -server. It is designed to give you an impression on how performant is your -current Apache installation. This especially shows you how much requests per -time your Apache installation is capable to serve. -.PP -.SH OPTIONS -.TP 12 -.B \-k -Enable the HTTP KeepAlive feature, i.e. perform multiple requests within one -HTTP session instead. Default is no KeepAlive. -.TP 12 -.BI \-n " requests" -Number of requests to perform for the benchmarking session. The default is to -just perform one single request which usually leads to not very representative -benchmarking results. -.TP 12 -.BI \-t " timelimit" -Seconds to max. spend for benchmarking. This implies -a -.B \-n -.B 50000 -internally. Use this to benchmark the server within a fixed total amount of -time. Per default there is no timelimit. -.TP 12 -.BI \-c " concurrency" -Number of multiple requests per time to perform. -Default is one request per time. - -.TP 12 -.BI \-p " POST file" -File containing data to POST. - -.TP 12 -.BI \-A " Authorization username:password" -Supply BASIC Authentification credentials to the server. The username -and password are separated by a single ':' and send on the wire uuencoded. -The string is send regardless of wether the server needs it; (i.e. has -send an 401. Authentifcation needed). - -.TP 12 -.BI \-p " Proxy-Authorization username:password" -Supply BASIC Authentification credentials to a proxy en-route. The username -and password are separated by a single ':' and send on the wire uuencoded. -The string is send regardless of wether the proxy needs it; (i.e. has -send an 407 Proxy authentifcation needed). - -.TP 12 -.BI \-C " Cookie name=value" -Add a 'Cookie:' line to the request. The argument is typically in the form -of a 'name=value' pair. This field is repeatable. - -.TP 12 -.BI \-p " Header string" -Postfix extra headers to the request. The argument is typically in the form -of a valid header line; containing a colon separated field value pair. (i.e. -'Accept-Encoding: zip/zop;8bit'). - -.TP 12 -.BI \-T " content-type" -Content-type header to use for POST data. - -.TP 12 -.B \-v -Set verbosity level - 4 and above prints information on headers, 3 and -above prints response codes (404, 200, etc.), 2 and above prints -warnings and info. - -.TP 12 -.BI \-w -Print out results in HTML tables. Default table is two columns wide, -with a white background. -.TP 12 -.BI \-x " attributes" -String to use as attributes for . Attributes are inserted -
    -.TP 12 -.BI \-y " attributes" -String to use as attributes for . -.TP 12 -.BI \-z " attributes" -String to use as attributes for - -
    . -.TP 12 -.B \-V -Display version number and exit. -.TP 12 -.B \-h -Display usage information. -.PD -.SH BUGS -There are various statically declared buffers of fixed length. Combined -with the lazy parsing of the command line arguments, the response headers -from the server and other external inputs this might bite you. -.P -It does not implement HTTP/1.x fully; only accepts some 'expected' forms -of responses. The rather heavy use of -.BR strstr(3) -shows up top in profile, -which might indicate a performance problem; i.e. you would measure the -.BR ab -performance rather than the server's. - -.SH SEE ALSO -.BR httpd(8) -. diff --git a/docs/man/apachectl.8 b/docs/man/apachectl.8 deleted file mode 100644 index 72300eb98b2e32b5fac8ee12193f115e09f51758..0000000000000000000000000000000000000000 --- a/docs/man/apachectl.8 +++ /dev/null @@ -1,133 +0,0 @@ -.TH apachectl 1 "September 1997" -.\" Copyright (c) 1997-1999 The Apache Group. All rights reserved. -.\" -.\" Redistribution and use in source and binary forms, with or without -.\" modification, are permitted provided that the following conditions -.\" are met: -.\" -.\" 1. Redistributions of source code must retain the above copyright -.\" notice, this list of conditions and the following disclaimer. -.\" -.\" 2. Redistributions in binary form must reproduce the above copyright -.\" notice, this list of conditions and the following disclaimer in -.\" the documentation and/or other materials provided with the -.\" distribution. -.\" -.\" 3. All advertising materials mentioning features or use of this -.\" software must display the following acknowledgment: -.\" "This product includes software developed by the Apache Group -.\" for use in the Apache HTTP server project (http://www.apache.org/)." -.\" -.\" 4. The names "Apache Server" and "Apache Group" must not be used to -.\" endorse or promote products derived from this software without -.\" prior written permission. -.\" -.\" 5. Products derived from this software may not be called "Apache" -.\" nor may "Apache" appear in their names without prior written -.\" permission of the Apache Group. -.\" -.\" 6. Redistributions of any form whatsoever must retain the following -.\" acknowledgment: -.\" "This product includes software developed by the Apache Group -.\" for use in the Apache HTTP server project (http://www.apache.org/)." -.\" -.\" THIS SOFTWARE IS PROVIDED BY THE APACHE GROUP ``AS IS'' AND ANY -.\" EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR -.\" PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE APACHE GROUP OR -.\" ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -.\" SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT -.\" NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; -.\" LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) -.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, -.\" STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) -.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED -.\" OF THE POSSIBILITY OF SUCH DAMAGE. -.\" ==================================================================== -.\" -.\" This software consists of voluntary contributions made by many -.\" individuals on behalf of the Apache Group and was originally based -.\" on public domain software written at the National Center for -.\" Supercomputing Applications, University of Illinois, Urbana-Champaign. -.\" For more information on the Apache Group and the Apache HTTP server -.\" project, please see . -.SH NAME -apachectl \- Apache HTTP server control interface -.SH SYNOPSIS -.B apachectl -\fIcommand\fP [...] -.SH DESCRIPTION -.B apachectl -is a front end to the Apache HyperText Transfer Protocol (HTTP) -server. It is designed to help the administrator control the -functioning of the Apache -.B httpd -daemon. -.PP -.B NOTE: -If your Apache installation uses non-standard paths, you will need to -edit the -.B apachectl -script to set the appropriate paths to your PID file and your -.B httpd -binary. See the comments in the script for details. -.PP -The -.B apachectl -script returns a 0 exit value on success, and >0 if an error -occurs. For more details, view the comments in the script. -.PP -Full documentation for Apache is available at -.B http://www.apache.org/ -. -.SH OPTIONS -The \fIcommand\fP can be any one or more of the following options: -.TP 12 -.BI start -Start the Apache daemon. Gives an error if it is already running. -.TP -.BI stop -Stops the Apache daemon. -.TP -.BI restart -Restarts the Apache daemon by sending it a SIGHUP. If the daemon -is not running, it is started. -This command automatically checks the configuration files via -.BI configtest -before initiating the restart to make sure Apache doesn't die. -.TP -.BI fullstatus -Displays a full status report from -.B mod_status. -For this to work, you need to have mod_status enabled on your server -and a text-based browser such as \fIlynx\fP available on your system. The -URL used to access the status report can be set by editing the -.B STATUSURL -variable in the script. -.TP -.BI status -Displays a brief status report. Similar to the fullstatus option, -except that the list of requests currently being served is omitted. -.TP -.BI graceful -Gracefully restarts the Apache daemon by sending it a SIGUSR1. If -the daemon is not running, it is started. This differs from a -normal restart in that currently open connections are not aborted. -A side effect is that old log files will not be closed immediately. -This means that if used in a log rotation script, a substantial delay may be -necessary to ensure that the old log files are closed before processing them. -This command automatically checks the configuration files via -.BI configtest -before initiating the restart to make sure Apache doesn't die. -.TP -.BI configtest -Run a configuration file syntax test. It parses the configuration -files and either reports -.B "Syntax Ok" -or detailed information about the particular syntax error. -.TP -.BI help -Displays a short help message. -.SH SEE ALSO -.BR httpd(8) -. diff --git a/docs/man/apxs.8 b/docs/man/apxs.8 deleted file mode 100644 index 464766c75fee15ebfda557bf80adf6cb63b048e9..0000000000000000000000000000000000000000 --- a/docs/man/apxs.8 +++ /dev/null @@ -1,459 +0,0 @@ -.TH apxs 8 "April 1998" -.\" Copyright (c) 1998-1999 The Apache Group. All rights reserved. -.\" -.\" Redistribution and use in source and binary forms, with or without -.\" modification, are permitted provided that the following conditions -.\" are met: -.\" -.\" 1. Redistributions of source code must retain the above copyright -.\" notice, this list of conditions and the following disclaimer. -.\" -.\" 2. Redistributions in binary form must reproduce the above copyright -.\" notice, this list of conditions and the following disclaimer in -.\" the documentation and/or other materials provided with the -.\" distribution. -.\" -.\" 3. All advertising materials mentioning features or use of this -.\" software must display the following acknowledgment: -.\" "This product includes software developed by the Apache Group -.\" for use in the Apache HTTP server project (http://www.apache.org/)." -.\" -.\" 4. The names "Apache Server" and "Apache Group" must not be used to -.\" endorse or promote products derived from this software without -.\" prior written permission. -.\" -.\" 5. Products derived from this software may not be called "Apache" -.\" nor may "Apache" appear in their names without prior written -.\" permission of the Apache Group. -.\" -.\" 6. Redistributions of any form whatsoever must retain the following -.\" acknowledgment: -.\" "This product includes software developed by the Apache Group -.\" for use in the Apache HTTP server project (http://www.apache.org/)." -.\" -.\" THIS SOFTWARE IS PROVIDED BY THE APACHE GROUP ``AS IS'' AND ANY -.\" EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR -.\" PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE APACHE GROUP OR -.\" ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -.\" SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT -.\" NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; -.\" LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) -.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, -.\" STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) -.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED -.\" OF THE POSSIBILITY OF SUCH DAMAGE. -.\" ==================================================================== -.\" -.\" This software consists of voluntary contributions made by many -.\" individuals on behalf of the Apache Group and was originally based -.\" on public domain software written at the National Center for -.\" Supercomputing Applications, University of Illinois, Urbana-Champaign. -.\" For more information on the Apache Group and the Apache HTTP server -.\" project, please see . -.SH NAME -apxs \- APache eXtenSion tool -.SH SYNOPSIS -.B apxs -.B \-g -[ -.BI \-S " name=value -] -.BI \-n " modname" - -.B apxs -.B \-q -[ -.BI \-S " name=value -] -.IR query " ..." - -.B apxs -.B \-c -[ -.BI \-S " name=value -] -[ -.BI \-o " dsofile" -] -[ -.BI \-I " incdir" -] -[ -.BI \-D " name=value" -] -[ -.BI \-L " libdir" -] -[ -.BI \-l " libname" -] -[ -.BI \-Wc, "compiler-flags" -] -[ -.BI \-Wl, "linker-flags" -] -.IR files " ..." - -.B apxs -.B \-i -[ -.BI \-S " name=value -] -[ -.BI \-n " modname" -] -[ -.B \-a -] -[ -.B \-A -] -.IR dsofile " ..." - -.B apxs -.B \-e -[ -.BI \-S " name=value -] -[ -.BI \-n " modname" -] -[ -.B \-a -] -[ -.B \-A -] -.IR dsofile " ..." -.PP -.SH DESCRIPTION -.B apxs -is a tool for building and installing extension modules for the Apache -HyperText Transfer Protocol (HTTP) server. This is achieved by building a -dynamic shared object (DSO) from one or more source or object -.I files -which then can be loaded into -the Apache server under runtime via the -.B LoadModule -directive from -.BR mod_so. - -So to use this extension mechanism your platform has -to support the DSO feature and your -Apache -.B httpd -binary has to be built with the -.B mod_so -module. -The -.B apxs -tool automatically complains if this is not the case. -You can check this yourself by manually running the command - -.nf - $ httpd -l -.fi - -The module -.B mod_so -should be part of the displayed list. -If these requirements are fulfilled you can easily extend -your Apache server's functionality by installing your own -modules with the DSO mechanism by the help of this -.B apxs -tool: - -.nf - $ apxs -i -a -c mod_foo.c - gcc -fpic -DSHARED_MODULE -I/path/to/apache/include -c mod_foo.c - ld -Bshareable -o mod_foo.so mod_foo.o - cp mod_foo.so /path/to/apache/libexec/mod_foo.so - chmod 755 /path/to/apache/libexec/mod_foo.so - [activating module `foo' in /path/to/apache/etc/httpd.conf] - $ apachectl restart - /path/to/apache/sbin/apachectl restart: httpd not running, trying to start - [Tue Mar 31 11:27:55 1998] [debug] mod_so.c(303): loaded module foo_module - /path/to/apache/sbin/apachectl restart: httpd started - $ _ -.fi - -The arguments -.I files -can be any C source file (.c), a object file (.o) or -even a library archive (.a). The -.B apxs -tool automatically recognizes these extensions and automtaically used the C -source files for compilation while just using the object and archive files for -the linking phase. But when using such pre-compiled objects make sure they are -compiled for position independend code (PIC) to be able to use them for a -dynamically loaded shared object. -For instance with GCC you always just have to use -.BR -fpic . -For other -C compilers consult its manual -page or at watch for the flags -.B apxs -uses to compile the object files. - -For more details about DSO support in Apache read the documentation -of -.B mod_so -or perhaps even read the -.B src/modules/standard/mod_so.c -source file. - -.PP -.SH OPTIONS -Common options: -.TP 12 -.BI \-n " modname" -This explicitly sets the module name for the -.B \-i -(install) -and -.B \-g -(template generation) option. Use this to explicitly specify the module name. -For option -.B \-g -this is required, for option -.B \-i -the -.B apxs -tool tries to determine the name from the source or (as a fallback) at least -by guessing it from the filename. -.PP -Query options: -.TP 12 -.B \-q -Performs a query for -.BR apxs 's -knowledge about certain settings. The -.I query -parameters can be one or more of the following strings: -.nf - CC TARGET - CFLAGS SBINDIR - CFLAGS_SHLIB INCLUDEDIR - LD_SHLIB LIBEXECDIR - LDFLAGS_SHLIB SYSCONFDIR - LIBS_SHLIB -.fi -Use this for manually determining settings. For instance use -.nf - INC=-I`apxs -q INCLUDEDIR` -.fi -inside your own Makefiles if you need manual access -to Apache's C header files. -.PP -Configuration options: -.TP 12 -.BI \-S " name=value" -This option changes the apxs settings described above. -.PP -Template Generation options: -.TP 12 -.B \-g -This generates a subdirectory -.I name -(see option -.BR \-n ")" -and there two files: A sample module source file named -.BI mod_ name.c -which can be used as a template for creating your own modules or -as a quick start for playing with the APXS mechanism. -And a corresponding -.B Makefile -for even easier build and installing of this module. -.PP -DSO compilation options: -.TP 12 -.B \-c -This indicates the compilation operation. It first compiles the C source -files (.c) of -.I files -into corresponding object files (.o) and then builds a dynamically shared object in -.I dsofile -by linking these object files plus the remaining -object files (.o and .a) of -.I files -If no -.B \-o -option is specified -the output file is guessed from the first filename in -.I files -and thus usually defaults to -.BI mod_ name.so -.TP 12 -.BI \-o " dsofile" -Explicitly specifies the filename of the created dynamically shared object. If -not specified and the name cannot be guessed from the -.I files -list, the fallback name -.B mod_unknown.so -is used. -.TP 12 -.BI \-D " name=value" -This option is directly passed through to the compilation command(s). -Use this to add your own defines to the build process. -.TP 12 -.BI \-I " incdir" -This option is directly passed through to the compilation command(s). -Use this to add your own include directories to search to the build process. -.TP 12 -.BI \-L " libdir" -This option is directly passed through to the linker command. -Use this to add your own library directories to search to the build process. -.TP 12 -.BI \-l " libname" -This option is directly passed through to the linker command. -Use this to add your own libraries to search to the build process. -.TP 12 -.BI \-Wc, "compiler-flags" -This option passes -.I compiler-flags -as additional flags to the compiler command. -Use this to add local compiler-specific options. -.TP 12 -.BI \-Wl, "linker-flags" -This option passes -.I linker-flags -as additional flags to the linker command. -Use this to add local linker-specific options. -.PP -DSO installation and configuration options: -.TP 12 -.B \-i -This indicates the installation operation and installs one or more -dynamically shared objects into the -server's -.I libexec -directory. -.TP 12 -.B \-a -This activates the module by automatically adding a corresponding -.B LoadModule -line to Apache's -.B httpd.conf -configuration file, or by enabling it if it already exists. -.TP 12 -.B \-A -Same as option -.B \-a -but the created -.B LoadModule -directive is prefixed with a hash sign (#), i.e. the module is -just prepared for later activation but initially disabled. -.TP 12 -.B \-e -This indicates the editing operation, which can be used with the -.B \-a -and -.B \-A -options similarly to the -.B \-i -operation to edit Apache's -.B httpd.conf -configuration file without attempting to install the module. -.PD -.SH EXAMPLES -Assume you have an Apache module named mod_foo.c available which should extend -Apache's server functionality. To accomplish this you first have to compile -the C source into a shared object suitable for loading into the Apache server -under runtime via the following command: - -.nf - $ apxs -c mod_foo.c - gcc -fpic -DSHARED_MODULE -I/path/to/apache/include -c mod_foo.c - ld -Bshareable -o mod_foo.so mod_foo.o - $ _ -.fi - -Then you have to update the Apache configuration by making sure a -.B LoadModule -directive is present to load this shared object. To simplify this -step -.B apxs -provides an automatic way to install the shared object in its -"libexec" directory and updating the -.B httpd.conf -file accordingly. This can be achieved by running: - -.nf - $ apxs -i -a mod_foo.c - cp mod_foo.so /path/to/apache/libexec/mod_foo.so - chmod 755 /path/to/apache/libexec/mod_foo.so - [activating module `foo' in /path/to/apache/etc/httpd.conf] - $ _ -.fi - -This way a line named - -.nf - LoadModule foo_module libexec/mod_foo.so -.fi - -is added to the configuration file if still not present. -If you want to have this this disabled per default use the -.B \-A -option, i.e. - -.nf - $ apxs -i -A mod_foo.c -.fi - -For a quick test of the APXS mechanism you can create a sample Apache module -template plus a corresponding Makefile via: - -.nf - $ apxs -g -n foo - Creating [DIR] foo - Creating [FILE] foo/Makefile - Creating [FILE] foo/mod_foo.c - $ _ -.fi - -Then you can immediately compile this sample module into a shared object and -load it into the Apache server: - -.nf - $ cd foo - $ make all reload - apxs -c mod_foo.c - gcc -fpic -DSHARED_MODULE -I/path/to/apache/include -c mod_foo.c - ld -Bshareable -o mod_foo.so mod_foo.o - apxs -i -a -n "foo" mod_foo.so - cp mod_foo.so /path/to/apache/libexec/mod_foo.so - chmod 755 /path/to/apache/libexec/mod_foo.so - [activating module `foo' in /path/to/apache/etc/httpd.conf] - apachectl restart - /path/to/apache/sbin/apachectl restart: httpd not running, trying to start - [Tue Mar 31 11:27:55 1998] [debug] mod_so.c(303): loaded module foo_module - /path/to/apache/sbin/apachectl restart: httpd started - $ _ -.fi - -You can even use -.B apxs -to compile complex modules outside the Apache source tree, like PHP3: - -.nf - $ cd php3 - $ ./configure --with-shared-apache=../apache-1.3 - $ apxs -c -o libphp3.so mod_php3.c libmodphp3-so.a - gcc -fpic -DSHARED_MODULE -I/tmp/apache/include -c mod_php3.c - ld -Bshareable -o libphp3.so mod_php3.o libmodphp3-so.a - $ _ -.fi - -because -.B apxs -automatically recognized C source files and object files. Only C source files -are compiled while remaining object files are used for the linking phase. - -.PD -.SH SEE ALSO -.BR apachectl(1), -.BR httpd(8). -. diff --git a/docs/man/dbmmanage.1 b/docs/man/dbmmanage.1 deleted file mode 100644 index 06380ff0f5904bca21be2cdb419a65d1a96948bd..0000000000000000000000000000000000000000 --- a/docs/man/dbmmanage.1 +++ /dev/null @@ -1,171 +0,0 @@ -.TH dbmmanage 1 "March 1998" -.\" Copyright (c) 1998-1999 The Apache Group. All rights reserved. -.\" -.\" Redistribution and use in source and binary forms, with or without -.\" modification, are permitted provided that the following conditions -.\" are met: -.\" -.\" 1. Redistributions of source code must retain the above copyright -.\" notice, this list of conditions and the following disclaimer. -.\" -.\" 2. Redistributions in binary form must reproduce the above copyright -.\" notice, this list of conditions and the following disclaimer in -.\" the documentation and/or other materials provided with the -.\" distribution. -.\" -.\" 3. All advertising materials mentioning features or use of this -.\" software must display the following acknowledgment: -.\" "This product includes software developed by the Apache Group -.\" for use in the Apache HTTP server project (http://www.apache.org/)." -.\" -.\" 4. The names "Apache Server" and "Apache Group" must not be used to -.\" endorse or promote products derived from this software without -.\" prior written permission. -.\" -.\" 5. Products derived from this software may not be called "Apache" -.\" nor may "Apache" appear in their names without prior written -.\" permission of the Apache Group. -.\" -.\" 6. Redistributions of any form whatsoever must retain the following -.\" acknowledgment: -.\" "This product includes software developed by the Apache Group -.\" for use in the Apache HTTP server project (http://www.apache.org/)." -.\" -.\" THIS SOFTWARE IS PROVIDED BY THE APACHE GROUP ``AS IS'' AND ANY -.\" EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR -.\" PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE APACHE GROUP OR -.\" ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -.\" SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT -.\" NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; -.\" LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) -.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, -.\" STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) -.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED -.\" OF THE POSSIBILITY OF SUCH DAMAGE. -.\" ==================================================================== -.\" -.\" This software consists of voluntary contributions made by many -.\" individuals on behalf of the Apache Group and was originally based -.\" on public domain software written at the National Center for -.\" Supercomputing Applications, University of Illinois, Urbana-Champaign. -.\" For more information on the Apache Group and the Apache HTTP server -.\" project, please see . -.SH NAME -dbmmanage \- Create and update user authentication files in DBM format -.SH SYNOPSIS -.B dbmmanage -.I filename -[ -.I command -] [ -.I username -[ -.I encpasswd -] ] -.PP -.SH DESCRIPTION -.B dbmmanage -is used to create and update the DBM format files used to store -usernames and password for basic authentication of HTTP users. -Resources available from the -.B httpd -Apache web server can be restricted to just the users listed -in the files created by -.B dbmmanage. -This program can only be used -when the usernames are stored in a DBM file. To use a -flat-file database see -\fBhtpasswd\fP. -.PP -This manual page only lists the command line arguments. For details of -the directives necessary to configure user authentication in -.B httpd -see -the Apache manual, which is part of the Apache distribution or can be -found at http://www.apache.org/. -.SH OPTIONS -.IP \fB\fIfilename\fP -The filename of the DBM format file. Usually without the -extension .db, .pag, or .dir. -.IP \fB\fIcommand\fP -This selects the operation to perform: -.TP 12 -.B add -Adds an entry for \fIusername\fP to \fIfilename\fP using the encrypted -password \fIencpassword\fP. -.TP 12 -.B adduser -Asks for a password and then adds an entry for \fIusername\fP to -\fIfilename\fP . -.TP 12 -.B check -Asks for a password and then checks if -\fIusername\fP is in \fIfilename\fP and if it's password matches -the specified one. -.TP 12 -.B delete -Deletes the \fIusername\fP entry from \fIfilename\fP. -.TP 12 -.B import -Reads username:password entries (one per line) from STDIN and adds them to -\fIfilename\fP. The passwords already has to be crypted. -.TP 12 -.B update -Same as the "adduser" command, except that it makes sure \fIusername\fP -already exists in \fIfilename\fP. -.TP 12 -.B view -Just displays the complete contents of the DBM file. -.IP \fB\fIusername\fP -The user for which the update operation is performed. -.PD -.SH BUGS -.PP -One should be aware that there are a number of different DBM file -formats in existance, and with all likelihood, libraries for more than -one format may exist on your system. The three primary examples are -NDBM, the GNU project's GDBM, and Berkeley DB 2. Unfortunately, all -these libraries use different file formats, and you must make sure -that the file format used by -.I filename -is the same format that -.B dbmmanage -expects to see. -.B dbmmanage -currently has no way of determining what type of DBM file it is -looking at. If used against the wrong format, -.dbmmanage -will simply return nothing, or may create a different DBM file with a -different name, or at worst, it may corrupt the DBM file if you were -attempting to write to it. -.PP -.B dbmmanage -has a list of DBM format preferences, defined by the -.B @AnyDBM::ISA -array near the beginning of the program. Since we prefer the Berkeley -DB 2 file format, the order in which -.B dbmmanage -will look for system libraries is Berkeley DB 2, then NDBM, and then -GDBM. The first library found will be the library -.B dbmmanage -will attempt to use for all DBM file transactions. This ordering is -slightly different than the standard -.B @AnyDBM::ISA -ordering in perl, as well as the ordering used by the simple dbmopen() -call in Perl, so if you use any other utilities to manage your DBM -files, they must also follow this preference ordering. Similar care -must be taken if using programs in other languages, like C, to -access these files. -.PP -Apache's -.B mod_auth_db.c -module corresponds to Berkeley DB 2 library, while -.B mod_auth_dbm.c -corresponds to the NDBM library. Also, one can usually use the -.B file -program supplied with most Unix systems to see what format a DBM file is in. -.PD -.SH SEE ALSO -.BR httpd(8) -. diff --git a/docs/man/htdigest.1 b/docs/man/htdigest.1 deleted file mode 100644 index c719e456ce92685105f857453edb9757b49b5c15..0000000000000000000000000000000000000000 --- a/docs/man/htdigest.1 +++ /dev/null @@ -1,97 +0,0 @@ -.TH htdigest 1 "March 1998" -.\" Copyright (c) 1997-1999 The Apache Group. All rights reserved. -.\" -.\" Redistribution and use in source and binary forms, with or without -.\" modification, are permitted provided that the following conditions -.\" are met: -.\" -.\" 1. Redistributions of source code must retain the above copyright -.\" notice, this list of conditions and the following disclaimer. -.\" -.\" 2. Redistributions in binary form must reproduce the above copyright -.\" notice, this list of conditions and the following disclaimer in -.\" the documentation and/or other materials provided with the -.\" distribution. -.\" -.\" 3. All advertising materials mentioning features or use of this -.\" software must display the following acknowledgment: -.\" "This product includes software developed by the Apache Group -.\" for use in the Apache HTTP server project (http://www.apache.org/)." -.\" -.\" 4. The names "Apache Server" and "Apache Group" must not be used to -.\" endorse or promote products derived from this software without -.\" prior written permission. For written permission, please contact -.\" apache@apache.org. -.\" -.\" 5. Products derived from this software may not be called "Apache" -.\" nor may "Apache" appear in their names without prior written -.\" permission of the Apache Group. -.\" -.\" 6. Redistributions of any form whatsoever must retain the following -.\" acknowledgment: -.\" "This product includes software developed by the Apache Group -.\" for use in the Apache HTTP server project (http://www.apache.org/)." -.\" -.\" THIS SOFTWARE IS PROVIDED BY THE APACHE GROUP ``AS IS'' AND ANY -.\" EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR -.\" PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE APACHE GROUP OR -.\" ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -.\" SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT -.\" NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; -.\" LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) -.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, -.\" STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) -.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED -.\" OF THE POSSIBILITY OF SUCH DAMAGE. -.\" ==================================================================== -.\" -.\" This software consists of voluntary contributions made by many -.\" individuals on behalf of the Apache Group and was originally based -.\" on public domain software written at the National Center for -.\" Supercomputing Applications, University of Illinois, Urbana-Champaign. -.\" For more information on the Apache Group and the Apache HTTP server -.\" project, please see . -.SH NAME -htdigest \- Create and update user authentication files -.SH SYNOPSIS -.B htdigest -[ -.B \-c -] -.I passwdfile -.I realm -.I username -.SH DESCRIPTION -.B htdigest -is used to create and update the flat-files used to store -usernames, realm and password for digest authentication of HTTP users. -Resources available from the -.B httpd -Apache web server can be restricted to just the users listed -in the files created by -.B htdigest. -.PP -This manual page only lists the command line arguments. For details of -the directives necessary to configure digest authentication in -.B httpd -see -the Apache manual, which is part of the Apache distribution or can be -found at http://www.apache.org/. -.SH OPTIONS -.IP \-c -Create the \fIpasswdfile\fP. If \fIpasswdfile\fP already exists, it -is deleted first. -.IP \fB\fIpasswdfile\fP -Name of the file to contain the username, realm and password. If \-c -is given, this file is created if it does not already exist, -or deleted and recreated if it does exist. -.IP \fB\fIrealm\fP -The realm name to which the user name belongs to. -.IP \fB\fIusername\fP -The user name to create or update in \fBpasswdfile\fP. If -\fIusername\fP does not exist is this file, an entry is added. If it -does exist, the password is changed. -.SH SEE ALSO -.BR httpd(8) -. diff --git a/docs/man/htpasswd.1 b/docs/man/htpasswd.1 deleted file mode 100644 index 1687cde41c29be63b72f492086e8ead75b5bc355..0000000000000000000000000000000000000000 --- a/docs/man/htpasswd.1 +++ /dev/null @@ -1,213 +0,0 @@ -.TH htpasswd 1 "February 1997" -.\" Copyright (c) 1997-1999 The Apache Group. All rights reserved. -.\" -.\" Redistribution and use in source and binary forms, with or without -.\" modification, are permitted provided that the following conditions -.\" are met: -.\" -.\" 1. Redistributions of source code must retain the above copyright -.\" notice, this list of conditions and the following disclaimer. -.\" -.\" 2. Redistributions in binary form must reproduce the above copyright -.\" notice, this list of conditions and the following disclaimer in -.\" the documentation and/or other materials provided with the -.\" distribution. -.\" -.\" 3. All advertising materials mentioning features or use of this -.\" software must display the following acknowledgment: -.\" "This product includes software developed by the Apache Group -.\" for use in the Apache HTTP server project (http://www.apache.org/)." -.\" -.\" 4. The names "Apache Server" and "Apache Group" must not be used to -.\" endorse or promote products derived from this software without -.\" prior written permission. For written permission, please contact -.\" apache@apache.org. -.\" -.\" 5. Products derived from this software may not be called "Apache" -.\" nor may "Apache" appear in their names without prior written -.\" permission of the Apache Group. -.\" -.\" 6. Redistributions of any form whatsoever must retain the following -.\" acknowledgment: -.\" "This product includes software developed by the Apache Group -.\" for use in the Apache HTTP server project (http://www.apache.org/)." -.\" -.\" THIS SOFTWARE IS PROVIDED BY THE APACHE GROUP ``AS IS'' AND ANY -.\" EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR -.\" PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE APACHE GROUP OR -.\" ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -.\" SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT -.\" NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; -.\" LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) -.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, -.\" STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) -.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED -.\" OF THE POSSIBILITY OF SUCH DAMAGE. -.\" ==================================================================== -.\" -.\" This software consists of voluntary contributions made by many -.\" individuals on behalf of the Apache Group and was originally based -.\" on public domain software written at the National Center for -.\" Supercomputing Applications, University of Illinois, Urbana-Champaign. -.\" For more information on the Apache Group and the Apache HTTP server -.\" project, please see . -.SH NAME -htpasswd \- Create and update user authentication files -.SH SYNOPSIS -.B htpasswd -[ -.B \-c -] -[ -.B \-m -] -.I passwdfile -.I username -.br -.B htpasswd -.B \-b -[ -.B \-c -] -[ -.B \-m -.B \-d -.B \-p -.B \-s -] -.I passwdfile -.I username -.I password -.SH DESCRIPTION -.B htpasswd -is used to create and update the flat-files used to store -usernames and password for basic authentication of HTTP users. -If -.B htpasswd -cannot access a file, such as not being able to write to the output -file or not being able to read the file in order to update it, -it returns an error status and makes no changes. -.PP -Resources available from the -.B httpd -Apache web server can be restricted to just the users listed -in the files created by -.B htpasswd. -This program can only be used -when the usernames are stored in a flat-file. To use a -DBM database see -\fBdbmmanage\fP. -.PP -.B htpasswd -encrypts passwords using either a version of MD5 modified for Apache, -or the system's \fIcrypt()\fP routine. Files managed by -.B htpasswd -may contain both types of passwords; some user records may have -MD5-encrypted passwords while others in the same file may have passwords -encrypted with \fIcrypt()\fP. -.PP -This manual page only lists the command line arguments. For details of -the directives necessary to configure user authentication in -.B httpd -see -the Apache manual, which is part of the Apache distribution or can be -found at . -.SH OPTIONS -.IP \-b -Use batch mode; \fIi.e.\fP, get the password from the command line -rather than prompting for it. \fBThis option should be used with -extreme care, since the password is clearly visible on the command -line.\fP -.IP \-c -Create the \fIpasswdfile\fP. If \fIpasswdfile\fP already exists, it -is rewritten and truncated. -.IP \-m -Use MD5 encryption for passwords. On Windows and TPF, this is the default. -.IP \-d -Use crypt() encryption for passwords. The default on all platforms but -Windows and TPF. Though possibly supported by -.B htpasswd -onm all platforms, it is not supported by the -.B httpd -server on Windows and TPF. -.IP \-s -Use SHA encryption for passwords. Faciliates migration from/to Netscape -servers using the LDAP Directory Interchange Format (ldif). -.IP \-p -Use plaintext passwords. Though -.B htpasswd -will support creation on all platofrms, the -.B httpd -deamon will only accept plain text passwords on Windows and TPF. -.IP \fB\fIpasswdfile\fP -Name of the file to contain the user name and password. If \-c -is given, this file is created if it does not already exist, -or rewritten and truncated if it does exist. -.IP \fB\fIusername\fP -The username to create or update in \fBpasswdfile\fP. If -\fIusername\fP does not exist in this file, an entry is added. If it -does exist, the password is changed. -.IP \fB\fIpassword\fP -The plaintext password to be encrypted and stored in the file. Only used -with the \fI-b\fP flag. -.SH EXIT STATUS -.B htpasswd -returns a zero status ("true") if the username and password have -been successfully added or updated in the \fIpasswdfile\fP. -.B htpasswd -returns 1 if it encounters some problem accessing files, 2 if there -was a syntax problem with the command line, 3 if the password was -entered interactively and the verification entry didn't match, 4 if -its operation was interrupted, 5 if a value is too long (username, -filename, password, or final computed record), and 6 if the username -contains illegal characters (see the \fBRESTRICTIONS\fP section). -.SH EXAMPLES -\fBhtpasswd /usr/local/etc/apache/.htpasswd-users jsmith\fP -.IP -Adds or modifies the password for user \fIjsmith\fP. -The user is prompted for the password. If executed -on a Windows system, the password will be encrypted using the -modified Apache MD5 algorithm; otherwise, the system's -\fIcrypt()\fP routine will be used. If the file does not -exist, -.B htpasswd -will do nothing except return an error. -.LP -\fBhtpasswd -c /home/doe/public_html/.htpasswd jane\fP -.IP -Creates a new file and stores a record in it for user \fIjane\fP. -The user is prompted for the password. -If the file exists and cannot be read, or cannot be written, -it is not altered and -.B htpasswd -will display a message and return an error status. -.LP -\fBhtpasswd -mb /usr/web/.htpasswd-all jones Pwd4Steve\fP -.IP -Encrypts the password from the command line (\fIPwd4Steve\fP) using -the MD5 algorithm, and stores it in the specified file. -.LP -.SH SECURITY CONSIDERATIONS -Web password files such as those managed by -.B htpasswd -should \fBnot\fP be within the Web server's URI space -- that is, -they should not be fetchable with a browser. -.PP -The use of the \fI-b\fP option is discouraged, since when it is -used the unencrypted password appears on the command line. -.SH RESTRICTIONS -On the Windows and MPE platforms, passwords encrypted with -.B htpasswd -are limited to no more than 255 characters in length. Longer -passwords will be truncated to 255 characters. -.PP -The MD5 algorithm used by -.B htpasswd -is specific to the Apache software; passwords encrypted using it will not be -usable with other Web servers. -.PP -Usernames are limited to 255 bytes and may not include the character ':'. -.SH SEE ALSO -.BR httpd(8) -and the scripts in support/SHA1 which come with the distribution. diff --git a/docs/man/httpd.8 b/docs/man/httpd.8 deleted file mode 100644 index ae320bad2adaf982ac5e261dd38aba94ba2c1e3a..0000000000000000000000000000000000000000 --- a/docs/man/httpd.8 +++ /dev/null @@ -1,211 +0,0 @@ -.TH httpd 8 "February 1997" -.\" Copyright (c) 1995-1997 David Robinson. All rights reserved. -.\" Copyright (c) 1997-1999 The Apache Group. All rights reserved. -.\" -.\" Redistribution and use in source and binary forms, with or without -.\" modification, are permitted provided that the following conditions -.\" are met: -.\" -.\" 1. Redistributions of source code must retain the above copyright -.\" notice, this list of conditions and the following disclaimer. -.\" -.\" 2. Redistributions in binary form must reproduce the above copyright -.\" notice, this list of conditions and the following disclaimer in -.\" the documentation and/or other materials provided with the -.\" distribution. -.\" -.\" 3. All advertising materials mentioning features or use of this -.\" software must display the following acknowledgment: -.\" "This product includes software developed by the Apache Group -.\" for use in the Apache HTTP server project (http://www.apache.org/)." -.\" -.\" 4. The names "Apache Server" and "Apache Group" must not be used to -.\" endorse or promote products derived from this software without -.\" prior written permission. For written permission, please contact -.\" apache@apache.org. -.\" -.\" 5. Products derived from this software may not be called "Apache" -.\" nor may "Apache" appear in their names without prior written -.\" permission of the Apache Group. -.\" -.\" 6. Redistributions of any form whatsoever must retain the following -.\" acknowledgment: -.\" "This product includes software developed by the Apache Group -.\" for use in the Apache HTTP server project (http://www.apache.org/)." -.\" -.\" THIS SOFTWARE IS PROVIDED BY THE APACHE GROUP ``AS IS'' AND ANY -.\" EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR -.\" PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE APACHE GROUP OR -.\" ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -.\" SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT -.\" NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; -.\" LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) -.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, -.\" STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) -.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED -.\" OF THE POSSIBILITY OF SUCH DAMAGE. -.\" ==================================================================== -.\" -.\" This software consists of voluntary contributions made by many -.\" individuals on behalf of the Apache Group and was originally based -.\" on public domain software written at the National Center for -.\" Supercomputing Applications, University of Illinois, Urbana-Champaign. -.\" For more information on the Apache Group and the Apache HTTP server -.\" project, please see . -.SH NAME -httpd \- Apache hypertext transfer protocol server -.SH SYNOPSIS -.B httpd -[ -.B \-X -] [ -.BI \-R " libexecdir" -] [ -.BI \-d " serverroot" -] [ -.BI \-f " config" -] [ -.BI \-C " directive" -] [ -.BI \-c " directive" -] [ -.BI \-D " parameter" -] - -.B httpd -[ -.B \-h -] -[ -.B \-l -] -[ -.B \-L -] -[ -.B \-v -] -[ -.B \-V -] -[ -.B \-S -] -[ -.B \-t -] -[ -.B \-T -] - -.SH DESCRIPTION -.B httpd -is the Apache HyperText Transfer Protocol (HTTP) server program. It is -designed to be run as a standalone daemon process. When used like this -it will create a pool of child processes to handle requests. To stop -it, send a TERM signal to the initial (parent) process. The PID of -this process is written to a file as given in the configuration file. -Alternatively -.B httpd -may be invoked by the Internet daemon inetd(8) each -time a connection to the HTTP service is made. -.PP -This manual page only lists the command line arguments. For details -of the directives necessary to configure -.B httpd -see the Apache manual, -which is part of the Apache distribution or can be found at -http://www.apache.org/. Paths in this manual may not reflect those -compiled into -.B httpd. -.SH OPTIONS -.TP 12 -.BI \-R " libexecdir" -This option is only available if Apache was built with -the -.I SHARED_CORE -rule enabled which forces the Apache core code to be -placed into a dynamic shared object (DSO) file. This file -is searched in a hardcoded path under ServerRoot per default. Use this -option if you want to override it. -.TP 12 -.BI \-d " serverroot" -Set the initial value for the ServerRoot directive to \fIserverroot\fP. This -can be overridden by the ServerRoot command in the configuration file. The -default is \fB/usr/local/apache\fP. -.TP -.BI \-f " config" -Execute the commands in the file \fIconfig\fP on startup. If \fIconfig\fP -does not begin with a /, then it is taken to be a path relative to -the ServerRoot. The default is \fBconf/httpd.conf\fP. -.TP -.BI \-C " directive" -Process the configuration \fIdirective\fP before reading config files. -.TP -.BI \-c " directive" -Process the configuration \fIdirective\fP after reading config files. -.TP -.BI \-D " parameter" -Sets a configuration \fIparameter\fP which can be used with -... sections in the configuration files -to conditionally skip or process commands. -.TP -.B \-h -Output a short summary of available command line options. -.TP -.B \-l -Output a list of modules compiled into the server. -.TP -.B \-L -Output a list of directives together with expected arguments and -places where the directive is valid. -.TP -.B \-S -Show the settings as parsed from the config file (currently only shows the -virtualhost settings). -.TP -.B \-t -Run syntax tests for configuration files only. The program immediately exits -after these syntax parsing with either a return code of 0 (Syntax OK) or -return code not equal to 0 (Syntax Error). -.TP -.B \-T -Same as option -.B \-t -but does not check the configured document roots. -.TP -.B \-X -Run in single-process mode, for internal debugging purposes only; the daemon -does not detach from the terminal or fork any children. Do NOT use this mode -to provide ordinary web service. -.TP -.B \-v -Print the version of -.B httpd -, and then exit. -.TP -.B \-V -Print the version and build parameters of -.B httpd -, and then exit. -.SH FILES -.PD 0 -.B /usr/local/apache/conf/httpd.conf -.br -.B /usr/local/apache/conf/srm.conf -.br -.B /usr/local/apache/conf/access.conf -.br -.B /usr/local/apache/conf/mime.types -.br -.B /usr/local/apache/conf/magic -.br -.B /usr/local/apache/logs/error_log -.br -.B /usr/local/apache/logs/access_log -.br -.B /usr/local/apache/logs/httpd.pid -.PD -.SH SEE ALSO -.BR inetd (8). diff --git a/docs/man/logresolve.8 b/docs/man/logresolve.8 deleted file mode 100644 index 4851269ad61711690b0605c764819126b3f09026..0000000000000000000000000000000000000000 --- a/docs/man/logresolve.8 +++ /dev/null @@ -1,87 +0,0 @@ -.TH logresolve 8 "March 1998" -.\" Copyright (c) 1998-1999 The Apache Group. All rights reserved. -.\" -.\" Redistribution and use in source and binary forms, with or without -.\" modification, are permitted provided that the following conditions -.\" are met: -.\" -.\" 1. Redistributions of source code must retain the above copyright -.\" notice, this list of conditions and the following disclaimer. -.\" -.\" 2. Redistributions in binary form must reproduce the above copyright -.\" notice, this list of conditions and the following disclaimer in -.\" the documentation and/or other materials provided with the -.\" distribution. -.\" -.\" 3. All advertising materials mentioning features or use of this -.\" software must display the following acknowledgment: -.\" "This product includes software developed by the Apache Group -.\" for use in the Apache HTTP server project (http://www.apache.org/)." -.\" -.\" 4. The names "Apache Server" and "Apache Group" must not be used to -.\" endorse or promote products derived from this software without -.\" prior written permission. -.\" -.\" 5. Products derived from this software may not be called "Apache" -.\" nor may "Apache" appear in their names without prior written -.\" permission of the Apache Group. -.\" -.\" 6. Redistributions of any form whatsoever must retain the following -.\" acknowledgment: -.\" "This product includes software developed by the Apache Group -.\" for use in the Apache HTTP server project (http://www.apache.org/)." -.\" -.\" THIS SOFTWARE IS PROVIDED BY THE APACHE GROUP ``AS IS'' AND ANY -.\" EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR -.\" PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE APACHE GROUP OR -.\" ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -.\" SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT -.\" NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; -.\" LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) -.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, -.\" STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) -.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED -.\" OF THE POSSIBILITY OF SUCH DAMAGE. -.\" ==================================================================== -.\" -.\" This software consists of voluntary contributions made by many -.\" individuals on behalf of the Apache Group and was originally based -.\" on public domain software written at the National Center for -.\" Supercomputing Applications, University of Illinois, Urbana-Champaign. -.\" For more information on the Apache Group and the Apache HTTP server -.\" project, please see . -.SH NAME -logresolve \- resolve hostnames for IP-adresses in Apache logfiles -.SH SYNOPSIS -.B logresolve -[ -.BI \-s " filename" -] [ -.B \-c -] < -.I access_log -> -.I access_log.new -.PP -.SH DESCRIPTION -.B logresolve -is a post-processing program to resolve IP-adresses in Apache's access -logfiles. To minimize impact on your nameserver, logresolve has its very own -internal hash-table cache. This means that each IP number will only be looked -up the first time it is found in the log file. -.SH OPTIONS -.TP 12 -.BI \-s " filename" -Specifies a filename to record statistics. -.TP 12 -.B \-c -This causes -.B logresolve -to apply some DNS checks: after finding the hostname from the IP address, it -looks up the IP addresses for the hostname and checks that one of these -matches the original address. -.PD -.SH SEE ALSO -.BR httpd(8) -. diff --git a/docs/man/rotatelogs.8 b/docs/man/rotatelogs.8 deleted file mode 100644 index aee02e11ecd0dd3298abd92e4f47923f56fa7b58..0000000000000000000000000000000000000000 --- a/docs/man/rotatelogs.8 +++ /dev/null @@ -1,83 +0,0 @@ -.TH rotatelogs 8 "March 1998" -.\" Copyright (c) 1998-1999 The Apache Group. All rights reserved. -.\" -.\" Redistribution and use in source and binary forms, with or without -.\" modification, are permitted provided that the following conditions -.\" are met: -.\" -.\" 1. Redistributions of source code must retain the above copyright -.\" notice, this list of conditions and the following disclaimer. -.\" -.\" 2. Redistributions in binary form must reproduce the above copyright -.\" notice, this list of conditions and the following disclaimer in -.\" the documentation and/or other materials provided with the -.\" distribution. -.\" -.\" 3. All advertising materials mentioning features or use of this -.\" software must display the following acknowledgment: -.\" "This product includes software developed by the Apache Group -.\" for use in the Apache HTTP server project (http://www.apache.org/)." -.\" -.\" 4. The names "Apache Server" and "Apache Group" must not be used to -.\" endorse or promote products derived from this software without -.\" prior written permission. -.\" -.\" 5. Products derived from this software may not be called "Apache" -.\" nor may "Apache" appear in their names without prior written -.\" permission of the Apache Group. -.\" -.\" 6. Redistributions of any form whatsoever must retain the following -.\" acknowledgment: -.\" "This product includes software developed by the Apache Group -.\" for use in the Apache HTTP server project (http://www.apache.org/)." -.\" -.\" THIS SOFTWARE IS PROVIDED BY THE APACHE GROUP ``AS IS'' AND ANY -.\" EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR -.\" PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE APACHE GROUP OR -.\" ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -.\" SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT -.\" NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; -.\" LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) -.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, -.\" STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) -.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED -.\" OF THE POSSIBILITY OF SUCH DAMAGE. -.\" ==================================================================== -.\" -.\" This software consists of voluntary contributions made by many -.\" individuals on behalf of the Apache Group and was originally based -.\" on public domain software written at the National Center for -.\" Supercomputing Applications, University of Illinois, Urbana-Champaign. -.\" For more information on the Apache Group and the Apache HTTP server -.\" project, please see . -.SH NAME -rotatelogs \- rotate Apache logs without having to kill the server -.SH SYNOPSIS -.B rotatelogs -.I logfile -.I rotationtime -.PP -.SH DESCRIPTION -.B rotatelogs -is a simple program for use in conjunction with Apache's piped logfile -feature which can be used like this: - -.fi - TransferLog "|rotatelogs /path/to/logs/access_log 86400" -.mf - -This creates the files /path/to/logs/access_log.nnnn where nnnn is the system -time at which the log nominally starts (this time will always be a multiple of -the rotation time, so you can synchronize cron scripts with it). At the end -of each rotation time (here after 24 hours) a new log is started. -.SH OPTIONS -.IP \fB\fIlogfile\fP -The path plus basename of the logfile. The suffix .nnnn is automatically -added. -.IP \fB\fIrotationtime\fP -The rotation time in seconds. -.PD -.SH SEE ALSO -.BR httpd(8) -. diff --git a/docs/man/suexec.8 b/docs/man/suexec.8 deleted file mode 100644 index 801d7abce916fce6e4b8abdddfb68717393c6560..0000000000000000000000000000000000000000 --- a/docs/man/suexec.8 +++ /dev/null @@ -1,70 +0,0 @@ -.TH suexec 8 "March 1998" -.\" Copyright (c) 1998-1999 The Apache Group. All rights reserved. -.\" -.\" Redistribution and use in source and binary forms, with or without -.\" modification, are permitted provided that the following conditions -.\" are met: -.\" -.\" 1. Redistributions of source code must retain the above copyright -.\" notice, this list of conditions and the following disclaimer. -.\" -.\" 2. Redistributions in binary form must reproduce the above copyright -.\" notice, this list of conditions and the following disclaimer in -.\" the documentation and/or other materials provided with the -.\" distribution. -.\" -.\" 3. All advertising materials mentioning features or use of this -.\" software must display the following acknowledgment: -.\" "This product includes software developed by the Apache Group -.\" for use in the Apache HTTP server project (http://www.apache.org/)." -.\" -.\" 4. The names "Apache Server" and "Apache Group" must not be used to -.\" endorse or promote products derived from this software without -.\" prior written permission. -.\" -.\" 5. Products derived from this software may not be called "Apache" -.\" nor may "Apache" appear in their names without prior written -.\" permission of the Apache Group. -.\" -.\" 6. Redistributions of any form whatsoever must retain the following -.\" acknowledgment: -.\" "This product includes software developed by the Apache Group -.\" for use in the Apache HTTP server project (http://www.apache.org/)." -.\" -.\" THIS SOFTWARE IS PROVIDED BY THE APACHE GROUP ``AS IS'' AND ANY -.\" EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR -.\" PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE APACHE GROUP OR -.\" ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -.\" SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT -.\" NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; -.\" LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) -.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, -.\" STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) -.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED -.\" OF THE POSSIBILITY OF SUCH DAMAGE. -.\" ==================================================================== -.\" -.\" This software consists of voluntary contributions made by many -.\" individuals on behalf of the Apache Group and was originally based -.\" on public domain software written at the National Center for -.\" Supercomputing Applications, University of Illinois, Urbana-Champaign. -.\" For more information on the Apache Group and the Apache HTTP server -.\" project, please see . -.SH NAME -suexec \- Switch User For Exec -.SH SYNOPSIS -No synopsis for usage, because this program -is used internally by Apache only. -.PP -.SH DESCRIPTION -.B suexec -is the "wrapper" support program for the suEXEC behaviour for Apache. -It is run from within Apache automatically to switch the user when -an external program has to be run under a different user. For more -information about suEXEC see the document `Apache suEXEC Support' -under http://www.apache.org/docs/suexec.html . -.PD -.SH SEE ALSO -.BR httpd(8) -. diff --git a/docs/manual/LICENSE b/docs/manual/LICENSE deleted file mode 100644 index 0d3053a52e15aa74002977d2f9e2f38b639b3aa3..0000000000000000000000000000000000000000 --- a/docs/manual/LICENSE +++ /dev/null @@ -1,51 +0,0 @@ - -Apache httpd license - ==================== - - -This is the license for the Apache Server. It covers all the -files which come in this distribution, and should never be removed. - -The "Apache Group" has based this server, called "Apache", on -public domain code distributed under the name "NCSA httpd 1.3". - -NCSA httpd 1.3 was placed in the public domain by the National Center -for Supercomputing Applications at the University of Illinois -at Urbana-Champaign. - -As requested by NCSA we acknowledge, - - "Portions developed at the National Center for Supercomputing - Applications at the University of Illinois at Urbana-Champaign." - -Copyright on the sections of code added by the "Apache Group" belong -to the "Apache Group" and/or the original authors. The "Apache Group" and -authors hereby grant permission for their code, along with the -public domain NCSA code, to be distributed under the "Apache" name. - -Reuse of "Apache Group" code outside of the Apache distribution should -be acknowledged with the following quoted text, to be included with any new -work; - - "Portions developed by the "Apache Group", taken with permission - from the Apache Server http://www.hyperreal.com/apache/ " - - -Permission is hereby granted to anyone to redistribute Apache under -the "Apache" name. We do not grant permission for the resale of Apache, but -we do grant permission for vendors to bundle Apache free with other software, -or to charge a reasonable price for redistribution, provided it is made -clear that Apache is free. Permission is also granted for vendors to -sell support for for Apache. We explicitly forbid the redistribution of -Apache under any other name. - -The "Apache Group" makes no promises to support "Apache". Users and -sellers of Apache support, and users of "Apache Group" code, should be -aware that they use "Apache" or portions of the "Apache Group" code at -their own risk. While every effort has been made to ensure that "Apache" -is robust and safe to use, we will not accept responsibility for any -damage caused, or loss of data or income which results from its use. - - - -Apache httpd server (c) 1995 The Apache Group. diff --git a/docs/manual/bind.html b/docs/manual/bind.html deleted file mode 100644 index 777f79650fab3063930dd8c0a3b75fcdd6235e7c..0000000000000000000000000000000000000000 --- a/docs/manual/bind.html +++ /dev/null @@ -1,103 +0,0 @@ - -Setting which addresses and ports Apache uses - - - -

    Setting which addresses and ports Apache uses

    - -
    - -When Apache starts, it connects to some port and address on the -local machine and waits for incoming requests. By default, it -listens to all addresses on the machine, and to the port -as specified by the Port directive in the server configuration. -However, it can be told to listen to more the one port, or to listen -to only selected addresses, or a combination. This is often combined -with the Virtual Host feature which determines how Apache -responds to different IP addresses, hostnames and ports.

    - -There are two directives used to restrict or specify which addresses -and ports Apache listens to. - -

      -
    • BindAddress is used to restrict the server to listening to - a single address, and can be used to permit multiple Apache servers - on the same machine listening to different IP addresses. -
    • Listen can be used to make a single Apache server listen - to more than one address and/or port. -
    - -

    BindAddress

    -Syntax: BindAddress [ * | IP-address | hostname ]
    -Default: BindAddress *
    -Context: server config
    -Status: Core

    - -Makes the server listen to just the specified address. If the argument -is *, the server listens to all addresses. The port listened to -is set with the Port directive. Only one BindAddress -should be used. - -

    Listen

    -Syntax: Listen [ port | IP-address:port ]
    -Default: none
    -Context: server config
    -Status: Core

    - -Listen can be used instead of BindAddress and -Port. It tells the server to accept incoming requests on the -specified port or address-and-port combination. If the first format is -used, with a port number only, the server listens to the given port on -all interfaces, instead of the port given by the Port -directive. If an IP address is given as well as a port, the server -will listen on the given port and interface.

    Multiple Listen -directives may be used to specify a number of addresses and ports to -listen to. The server will respond to requests from any of the listed -addresses and ports.

    - -For example, to make the server accept connections on both port -80 and port 8000, use: -

    -   Listen 80
    -   Listen 8000
    -
    - -To make the server accept connections on two specified -interfaces and port numbers, use -
    -   Listen 192.170.2.1:80
    -   Listen 192.170.2.5:8000
    -
    - -

    How this works with Virtual Hosts

    - -BindAddress and Listen do not implement Virtual Hosts. They tell the -main server what addresses and ports to listen to. If no -<VirtualHost> directives are used, the server will behave the -same for all accepted requests. However, <VirtualHost> can be -used to specify a different behavour for one or more of the addresses -and ports. To implement a VirtualHost, the server must first be told -to listen to the address and port to be used. Then a -<VirtualHost> section should be created for a specified address -and port to set the behaviour of this virtual host. Note that if the -<VirtualHost> is set for an address and port that the server is -not listening to, it cannot be accessed. - -

    See also

    - -See also the documentation on -Virtual Hosts, -Non-IP virtual hosts, -BindAddress directive, -Port directive -and -<VirtualHost> section. - - -
    -Home -Index - - - - diff --git a/docs/manual/bind.html.en b/docs/manual/bind.html.en deleted file mode 100644 index 777f79650fab3063930dd8c0a3b75fcdd6235e7c..0000000000000000000000000000000000000000 --- a/docs/manual/bind.html.en +++ /dev/null @@ -1,103 +0,0 @@ - -Setting which addresses and ports Apache uses - - - -

    Setting which addresses and ports Apache uses

    - -
    - -When Apache starts, it connects to some port and address on the -local machine and waits for incoming requests. By default, it -listens to all addresses on the machine, and to the port -as specified by the Port directive in the server configuration. -However, it can be told to listen to more the one port, or to listen -to only selected addresses, or a combination. This is often combined -with the Virtual Host feature which determines how Apache -responds to different IP addresses, hostnames and ports.

    - -There are two directives used to restrict or specify which addresses -and ports Apache listens to. - -

      -
    • BindAddress is used to restrict the server to listening to - a single address, and can be used to permit multiple Apache servers - on the same machine listening to different IP addresses. -
    • Listen can be used to make a single Apache server listen - to more than one address and/or port. -
    - -

    BindAddress

    -Syntax: BindAddress [ * | IP-address | hostname ]
    -Default: BindAddress *
    -Context: server config
    -Status: Core

    - -Makes the server listen to just the specified address. If the argument -is *, the server listens to all addresses. The port listened to -is set with the Port directive. Only one BindAddress -should be used. - -

    Listen

    -Syntax: Listen [ port | IP-address:port ]
    -Default: none
    -Context: server config
    -Status: Core

    - -Listen can be used instead of BindAddress and -Port. It tells the server to accept incoming requests on the -specified port or address-and-port combination. If the first format is -used, with a port number only, the server listens to the given port on -all interfaces, instead of the port given by the Port -directive. If an IP address is given as well as a port, the server -will listen on the given port and interface.

    Multiple Listen -directives may be used to specify a number of addresses and ports to -listen to. The server will respond to requests from any of the listed -addresses and ports.

    - -For example, to make the server accept connections on both port -80 and port 8000, use: -

    -   Listen 80
    -   Listen 8000
    -
    - -To make the server accept connections on two specified -interfaces and port numbers, use -
    -   Listen 192.170.2.1:80
    -   Listen 192.170.2.5:8000
    -
    - -

    How this works with Virtual Hosts

    - -BindAddress and Listen do not implement Virtual Hosts. They tell the -main server what addresses and ports to listen to. If no -<VirtualHost> directives are used, the server will behave the -same for all accepted requests. However, <VirtualHost> can be -used to specify a different behavour for one or more of the addresses -and ports. To implement a VirtualHost, the server must first be told -to listen to the address and port to be used. Then a -<VirtualHost> section should be created for a specified address -and port to set the behaviour of this virtual host. Note that if the -<VirtualHost> is set for an address and port that the server is -not listening to, it cannot be accessed. - -

    See also

    - -See also the documentation on -Virtual Hosts, -Non-IP virtual hosts, -BindAddress directive, -Port directive -and -<VirtualHost> section. - - -
    -Home -Index - - - - diff --git a/docs/manual/cgi_path.html b/docs/manual/cgi_path.html deleted file mode 100644 index 81bb314ead0d57bd4b8f7021cdd6b5bb70373bcd..0000000000000000000000000000000000000000 --- a/docs/manual/cgi_path.html +++ /dev/null @@ -1,84 +0,0 @@ - -PATH_INFO Changes in the CGI Environment - - - -

    PATH_INFO Changes in the CGI Environment

    - -
    - -

    Overview

    - -

    As implemented in Apache 1.1.1 and earlier versions, the method -Apache used to create PATH_INFO in the CGI environment was -counterintiutive, and could result in crashes in certain cases. In -Apache 1.2 and beyond, this behavior has changed. Although this -results in some compatibility problems with certain legacy CGI -applications, the Apache 1.2 behavior is still compatible with the -CGI/1.1 specification, and CGI scripts can be easily modified (see below). - -

    The Problem

    - -

    Apache 1.1.1 and earlier implemented the PATH_INFO and SCRIPT_NAME -environment variables by looking at the filename, not the URL. While -this resulted in the correct values in many cases, when the filesystem -path was overloaded to contain path information, it could result in -errant behavior. For example, if the following appeared in a config -file: -

    -     Alias /cgi-ralph /usr/local/httpd/cgi-bin/user.cgi/ralph
    -
    -

    In this case, user.cgi is the CGI script, the "/ralph" -is information to be passed onto the CGI. If this configuration was in -place, and a request came for "/cgi-ralph/script/", the -code would set PATH_INFO to "/ralph/script", and -SCRIPT_NAME to "/cgi-". Obviously, the latter is -incorrect. In certain cases, this could even cause the server to -crash.

    - -

    The Solution

    - -

    Apache 1.2 and later now determine SCRIPT_NAME and PATH_INFO by -looking directly at the URL, and determining how much of the URL is -client-modifiable, and setting PATH_INFO to it. To use the above -example, PATH_INFO would be set to "/script", and -SCRIPT_NAME to "/cgi-ralph". This makes sense and results -in no server behavior problems. It also permits the script to be -gauranteed that -"http://$SERVER_NAME:$SERVER_PORT$SCRIPT_NAME$PATH_INFO" -will always be an accessable URL that points to the current script, -something which was not neccessarily true with previous versions of -Apache. - -

    However, the "/ralph" -information from the Alias directive is lost. This is -unfortunate, but we feel that using the filesystem to pass along this -sort of information is not a recommended method, and a script making -use of it "deserves" not to work. Apache 1.2b3 and later, however, do -provide a workaround. - -

    Compatibility with Previous Servers

    - -

    It may be neccessary for a script that was designed for earlier -versions of Apache or other servers to need the information that the -old PATH_INFO variable provided. For this purpose, Apache 1.2 (1.2b3 -and later) sets an additional variable, FILEPATH_INFO. This -environment variable contains the value that PATH_INFO would have had -with Apache 1.1.1.

    - -

    A script that wishes to work with both Apache 1.2 and earlier -versions can simply test for the existance of FILEPATH_INFO, and use -it if available. Otherwise, it can use PATH_INFO. For example, in -Perl, one might use: -

    -    $path_info = $ENV{'FILEPATH_INFO'} || $ENV{'PATH_INFO'};
    -
    - -

    By doing this, a script can work with all servers supporting the -CGI/1.1 specification, including all versions of Apache.

    - - - - - diff --git a/docs/manual/cgi_path.html.en b/docs/manual/cgi_path.html.en deleted file mode 100644 index 81bb314ead0d57bd4b8f7021cdd6b5bb70373bcd..0000000000000000000000000000000000000000 --- a/docs/manual/cgi_path.html.en +++ /dev/null @@ -1,84 +0,0 @@ - -PATH_INFO Changes in the CGI Environment - - - -

    PATH_INFO Changes in the CGI Environment

    - -
    - -

    Overview

    - -

    As implemented in Apache 1.1.1 and earlier versions, the method -Apache used to create PATH_INFO in the CGI environment was -counterintiutive, and could result in crashes in certain cases. In -Apache 1.2 and beyond, this behavior has changed. Although this -results in some compatibility problems with certain legacy CGI -applications, the Apache 1.2 behavior is still compatible with the -CGI/1.1 specification, and CGI scripts can be easily modified (see below). - -

    The Problem

    - -

    Apache 1.1.1 and earlier implemented the PATH_INFO and SCRIPT_NAME -environment variables by looking at the filename, not the URL. While -this resulted in the correct values in many cases, when the filesystem -path was overloaded to contain path information, it could result in -errant behavior. For example, if the following appeared in a config -file: -

    -     Alias /cgi-ralph /usr/local/httpd/cgi-bin/user.cgi/ralph
    -
    -

    In this case, user.cgi is the CGI script, the "/ralph" -is information to be passed onto the CGI. If this configuration was in -place, and a request came for "/cgi-ralph/script/", the -code would set PATH_INFO to "/ralph/script", and -SCRIPT_NAME to "/cgi-". Obviously, the latter is -incorrect. In certain cases, this could even cause the server to -crash.

    - -

    The Solution

    - -

    Apache 1.2 and later now determine SCRIPT_NAME and PATH_INFO by -looking directly at the URL, and determining how much of the URL is -client-modifiable, and setting PATH_INFO to it. To use the above -example, PATH_INFO would be set to "/script", and -SCRIPT_NAME to "/cgi-ralph". This makes sense and results -in no server behavior problems. It also permits the script to be -gauranteed that -"http://$SERVER_NAME:$SERVER_PORT$SCRIPT_NAME$PATH_INFO" -will always be an accessable URL that points to the current script, -something which was not neccessarily true with previous versions of -Apache. - -

    However, the "/ralph" -information from the Alias directive is lost. This is -unfortunate, but we feel that using the filesystem to pass along this -sort of information is not a recommended method, and a script making -use of it "deserves" not to work. Apache 1.2b3 and later, however, do -provide a workaround. - -

    Compatibility with Previous Servers

    - -

    It may be neccessary for a script that was designed for earlier -versions of Apache or other servers to need the information that the -old PATH_INFO variable provided. For this purpose, Apache 1.2 (1.2b3 -and later) sets an additional variable, FILEPATH_INFO. This -environment variable contains the value that PATH_INFO would have had -with Apache 1.1.1.

    - -

    A script that wishes to work with both Apache 1.2 and earlier -versions can simply test for the existance of FILEPATH_INFO, and use -it if available. Otherwise, it can use PATH_INFO. For example, in -Perl, one might use: -

    -    $path_info = $ENV{'FILEPATH_INFO'} || $ENV{'PATH_INFO'};
    -
    - -

    By doing this, a script can work with all servers supporting the -CGI/1.1 specification, including all versions of Apache.

    - - - - - diff --git a/docs/manual/configuring.html b/docs/manual/configuring.html deleted file mode 100644 index fbe41c2f1713735120e05e4cbd19216fcae524f3..0000000000000000000000000000000000000000 --- a/docs/manual/configuring.html +++ /dev/null @@ -1,169 +0,0 @@ - - - -Configuring Apache - - - - - -

    Configuring Apache

    - -

    Main Configuration Files

    - -

    Apache is configured by placing directives in plain text configuration files. The main -configuration file is usually called httpd.conf. The -location of this file is set at compile-time, but may be overridden -with the -f command line flag. Some sites also have -srm.conf and access.conf files for historical -reasons. In addition, other configuration files may be added using -the Include -directive. Any directive may be placed in any of these configuration -files. Changes to the main configuration files are only recognized by -Apache when it is started or restarted. - -

    -The server also reads a file containing mime document types; the -filename is set by the TypesConfig directive, and is mime.types by default. - -

    Syntax of the Configuration Files

    - -

    Directives in the configuration files are case-insensitive, but -arguments to directives are often case sensitive. Lines which begin -with the hash character "#" are considered comments, and are ignored. -Comments may not be included on a line after a configuration -directive. White space occurring before a directive -is ignored, so you may indent directives for clarity. - -

    You can check your configuration files for syntax errors without -starting the server by using apachectl configtest -or the -t command line option. - -

    Modules

    - -

    Apache is a modular server. This implies that only the most basic -functionality is included in the core server. Extended features are -available through modules which can -be loaded into Apache. By default, a base set of modules is -included in the server at compile-time. If the server is compiled to -use dynamically loaded modules, then modules -can be compiled separately and added at any time using the LoadModule directive. -Otherwise, apache must be recompiled to add or remove modules. - -

    To see which modules are currently compiled into the server, -you can use the -l command line option. - -

    Scope of Directives

    - -

    Directives placed in the main configuration files apply to the entire -server. If you wish to change the configuration for only a part of -the server, you can scope your directives by placing them in -<Directory>, -<DirectoryMatch>, -<Files>, -<FilesMatch>, -<Location>, - and -<LocationMatch> - -sections. These sections limit the application of the directives -which they enclose to particular filesystem locations or URLs. They -can also be nested, allowing for very fine grained configuration. - -

    Apache has the capability to serve many different websites -simultaneously. This is called Virtual Hosting. -Directives can also be scoped by placing them inside -<VirtualHost> -sections, so that they will only apply to requests for a particular -website. - -

    Although most directives can be placed in any of these sections, -some directives do not make sense in some contexts. For example, -directives controlling process creation can only be placed in the main -server context. To find which directives can be placed in which -sections, check the Context of the directive. -For further information, we provide details on How Directory, Location and Files sections -work. - -

    .htaccess Files

    - -

    Apache allows for decentralized management of configuration via -special files placed inside the web tree. The special files are -usually called .htaccess, but any name can be specified -in the AccessFileName directive. Directives placed in -.htaccess files apply to the directory where you place -the file, and all sub-directories. The .htaccess files -follow the same syntax as the main configuration files. Since -.htaccess files are read on every request, rather than -only at server startup, changes made in these files take immediate -effect. - -

    To find which directives can be placed in .htaccess -files, check the Context -of the directive. The server administrator further controls what -directives may be placed in .htaccess files by -configuring the AllowOverride -directive in the main configuration files. - -

    Log files

    -

    security warning

    -Anyone who can write to the directory where Apache is writing a -log file can almost certainly gain access to the uid that the server is -started as, which is normally root. Do NOT give people write -access to the directory the logs are stored in without being aware of -the consequences; see the security tips -document for details. - -

    pid file

    - -

    On startup, Apache saves the process id of the parent httpd process to -the file logs/httpd.pid. This filename can be changed -with the PidFile directive. The -process-id is for use by the administrator in restarting and -terminating the daemon: on Unix, a HUP or USR1 signal causes the -daemon to re-read its configuration files and a TERM signal causes it -to die gracefully; on Windows, use the -k command line option instead. -For more information see the Stopping and -Restarting page. - -

    -If the process dies (or is killed) abnormally, then it will be necessary to -kill the children httpd processes. - -

    Error log

    - -

    The server will log error messages to a log file, by default -logs/error_log on Unix or logs/error.log on -Windows and OS/2. The filename can be set using the ErrorLog directive; different error -logs can be set for different virtual hosts. - -

    Transfer log

    - -

    The server will typically log each request to a transfer file, by -default logs/access_log on Unix or -logs/access.log on Windows and OS/2. The filename can be -set using a CustomLog -directive; different transfer logs can be set for different virtual hosts. - - - - - diff --git a/docs/manual/configuring.html.en b/docs/manual/configuring.html.en deleted file mode 100644 index fbe41c2f1713735120e05e4cbd19216fcae524f3..0000000000000000000000000000000000000000 --- a/docs/manual/configuring.html.en +++ /dev/null @@ -1,169 +0,0 @@ - - - -Configuring Apache - - - - - -

    Configuring Apache

    - -

    Main Configuration Files

    - -

    Apache is configured by placing directives in plain text configuration files. The main -configuration file is usually called httpd.conf. The -location of this file is set at compile-time, but may be overridden -with the -f command line flag. Some sites also have -srm.conf and access.conf files for historical -reasons. In addition, other configuration files may be added using -the Include -directive. Any directive may be placed in any of these configuration -files. Changes to the main configuration files are only recognized by -Apache when it is started or restarted. - -

    -The server also reads a file containing mime document types; the -filename is set by the TypesConfig directive, and is mime.types by default. - -

    Syntax of the Configuration Files

    - -

    Directives in the configuration files are case-insensitive, but -arguments to directives are often case sensitive. Lines which begin -with the hash character "#" are considered comments, and are ignored. -Comments may not be included on a line after a configuration -directive. White space occurring before a directive -is ignored, so you may indent directives for clarity. - -

    You can check your configuration files for syntax errors without -starting the server by using apachectl configtest -or the -t command line option. - -

    Modules

    - -

    Apache is a modular server. This implies that only the most basic -functionality is included in the core server. Extended features are -available through modules which can -be loaded into Apache. By default, a base set of modules is -included in the server at compile-time. If the server is compiled to -use dynamically loaded modules, then modules -can be compiled separately and added at any time using the LoadModule directive. -Otherwise, apache must be recompiled to add or remove modules. - -

    To see which modules are currently compiled into the server, -you can use the -l command line option. - -

    Scope of Directives

    - -

    Directives placed in the main configuration files apply to the entire -server. If you wish to change the configuration for only a part of -the server, you can scope your directives by placing them in -<Directory>, -<DirectoryMatch>, -<Files>, -<FilesMatch>, -<Location>, - and -<LocationMatch> - -sections. These sections limit the application of the directives -which they enclose to particular filesystem locations or URLs. They -can also be nested, allowing for very fine grained configuration. - -

    Apache has the capability to serve many different websites -simultaneously. This is called Virtual Hosting. -Directives can also be scoped by placing them inside -<VirtualHost> -sections, so that they will only apply to requests for a particular -website. - -

    Although most directives can be placed in any of these sections, -some directives do not make sense in some contexts. For example, -directives controlling process creation can only be placed in the main -server context. To find which directives can be placed in which -sections, check the Context of the directive. -For further information, we provide details on How Directory, Location and Files sections -work. - -

    .htaccess Files

    - -

    Apache allows for decentralized management of configuration via -special files placed inside the web tree. The special files are -usually called .htaccess, but any name can be specified -in the AccessFileName directive. Directives placed in -.htaccess files apply to the directory where you place -the file, and all sub-directories. The .htaccess files -follow the same syntax as the main configuration files. Since -.htaccess files are read on every request, rather than -only at server startup, changes made in these files take immediate -effect. - -

    To find which directives can be placed in .htaccess -files, check the Context -of the directive. The server administrator further controls what -directives may be placed in .htaccess files by -configuring the AllowOverride -directive in the main configuration files. - -

    Log files

    -

    security warning

    -Anyone who can write to the directory where Apache is writing a -log file can almost certainly gain access to the uid that the server is -started as, which is normally root. Do NOT give people write -access to the directory the logs are stored in without being aware of -the consequences; see the security tips -document for details. - -

    pid file

    - -

    On startup, Apache saves the process id of the parent httpd process to -the file logs/httpd.pid. This filename can be changed -with the PidFile directive. The -process-id is for use by the administrator in restarting and -terminating the daemon: on Unix, a HUP or USR1 signal causes the -daemon to re-read its configuration files and a TERM signal causes it -to die gracefully; on Windows, use the -k command line option instead. -For more information see the Stopping and -Restarting page. - -

    -If the process dies (or is killed) abnormally, then it will be necessary to -kill the children httpd processes. - -

    Error log

    - -

    The server will log error messages to a log file, by default -logs/error_log on Unix or logs/error.log on -Windows and OS/2. The filename can be set using the ErrorLog directive; different error -logs can be set for different virtual hosts. - -

    Transfer log

    - -

    The server will typically log each request to a transfer file, by -default logs/access_log on Unix or -logs/access.log on Windows and OS/2. The filename can be -set using a CustomLog -directive; different transfer logs can be set for different virtual hosts. - - - - - diff --git a/docs/manual/configuring.html.ja.jis b/docs/manual/configuring.html.ja.jis deleted file mode 100644 index c1b41e52518108111d77f5f0af6e3ccfa18abb4f..0000000000000000000000000000000000000000 --- a/docs/manual/configuring.html.ja.jis +++ /dev/null @@ -1,247 +0,0 @@ - - - -$B@_Dj%U%!%$%k(B - - - - - - -

    $B%U%!%$%k$N@_Dj(B

    - - - -
    - -

    $B%a%$%s$N@_Dj%U%!%$%k(B

    - - - -
    -$B4XO"%b%8%e!<%k(B

    -mod_mime
    -
    -$B4XO"%G%#%l%/%F%#%V(B

    -<IfDefine>
    -Include
    -TypesConfig
    -
    - -

    Apache $B$O(B $B%G%#%l%/%F%#%V(B $B$r(B -$B@_Dj%U%!%$%k$KJ?J8$G=q$/$3$H$K$h$j@_Dj$7$^$9!#%a%$%s$N(B -$B@_Dj%U%!%$%k$OIaDL$O(B httpd.conf $B$H$$$&L>A0$G$9!#(B -$B$3$N%U%!%$%k$N0LCV$O%3%s%Q%$%k;~$K@_Dj$5$l$^$9$,!"%3%^%s%I%i%$%s$N(B --f $B%U%i%0$K$h$j>e=q$-$G$-$^$9!#$=$N>e!"B>$N@_Dj%U%!%$%k$,(B -Include $B%G%#%l%/%F%#%V(B -$B$K$h$C$FDI2C$5$l$F$$$k$+$b$7$l$^$;$s!#$I$N%G%#%l%/%F%#%V$b(B -$B$3$l$i$N@_Dj%U%!%$%k$N$I$l$K$G$bF~$l$i$l$^$9!#(BApache $B$O5/F0;~$+(B -$B:F5/F0;~$N$_%a%$%s@_Dj%U%!%$%k$NJQ99$rG'<1$7$^$9!#(B

    - -

    Apache 1.3.13 $B$N?7$7$$5!G=$H$7$F!"@_Dj%U%!%$%k$,$l$N%[%9%H$KBP$7$F>.$5$J@_Dj(B -$B%U%!%$%k$r:n$j!"@_Dj%G%#%l%/%H%j$KCV$/$H$$$&$b$N$,5s$2$i$l$^$9!#(B -$B$3$&$9$k$H!"C1$K%U%!%$%k$NDI2C!":o=|$r$9$k$3$H$K$h$jA4$/%U%!%$%k$r(B -$BJT=8$9$k$3$H$J$/%P!<%A%c%k%[%9%H$NDI2C!":o=|$,$G$-$^$9!#$3$l$O<+F02=$r(B -$B$:$C$H4JC1$K$7$^$9!#(B

    - -

    -$B%5!<%P$O(B mime $B%I%-%e%a%s%H%?%$%W$r4^$s$G$$$k%U%!%$%k$bFI$_9~$_$^$9!#(B -$B%U%!%$%kL>$O(B TypesConfig $B$G@_Dj$5$l!"%G%U%)%k%H$G(B mime.types -$B$K$J$C$F$$$^$9!#(B

    -
    - -

    $B@_Dj%U%!%$%k$N9=J8(B

    - -

    Apache $B@_Dj%U%!%$%k$O(B1$B9T$K(B1$B$D$N%G%#%l%/%F%#%V$+$i$J$j$^$9!#(B -$B%P%C%/%9%i%C%7%e(B "\" $B$O%G%#%l%/%F%#%V$,$NJ8;z$d6uGr$,$"$C$F$O$$$1$^$;$s!#(B

    - -

    $B@_Dj%U%!%$%k$N%G%#%l%/%F%#%V$OBgJ8;z>.J8;z$r6hJL$7$^$;$s$,!"(B -$B0z?t$K$O$7$P$7$P6hJL$9$k$b$N$,$"$j$^$9!#%O%C%7%eJ8;z(B "#" $B$G;O$^$k9T$O(B -$B%3%a%s%H$H8+$J$5$l$FL5;k$5$l$^$9!#@_Dj%G%#%l%/%F%#%V$N8e$N9T$G$O(B -$B%3%a%s%H$,4^$^$l$F$$$F$O(B$B$$$1$^$;$s(B$B!#%G%#%l%/%F%#%V$N(B -$BA0$N6u9T$H6uGr$OL5;k$5$l$^$9$N$G!"$o$+$j$d$9$/$9$k$?$a$K%G%#%l%/%F%#%V$r(B -$B%$%s%G%s%H$9$k$3$H$,$G$-$^$9!#(B

    - -

    $B@_Dj%U%!%$%k$N9=J8%(%i!<$O(B -apachectl configtest $B$+%3%^%s%I%i%$%s%*%W%7%g%s(B --t $B$r;H$C$FD4$Y$i$l$^$9!#(B

    - -
    - -

    $B%b%8%e!<%k(B

    - - -
    -$B4XO"%b%8%e!<%k(B

    -mod_so
    -
    -$B4XO"%G%#%l%/%F%#%V(B

    -AddModule
    -ClearModuleList
    -<IfModule>
    -LoadModule
    -
    - -

    Apache $B$O%b%8%e!<%k2=$5$l$?%5!<%P$G$9!#%3%"%5!<%P$K$O(B -$B0lHV4pK\E*$J5!G=$@$1$,4^$^$l$F$$$^$9!#3HD%5!G=$O(B Apache $B$K(B -$B%m!<%I$5$l$k(B$B%b%8%e!<%k(B$B$H$7$F(B -$BMxMQ2DG=$G$9!#%G%U%)%k%H$G$O%3%s%Q%$%k;~$K%b%8%e!<%k$N(B$B4pK\(B$B%;%C%H$,(B -$B%5!<%P$K4^$^$l$^$9!#%5!<%P$,(B$BF0E*%m!<%I(B$B%b%8%e!<%k$r(B -$B;H$&$h$&$K%3%s%Q%$%k$5$l$F$$$k>l9g$O!"%b%8%e!<%k$rJL$K%3%s%Q%$%k$7$F!"(B -$B$$$D$G$b(B LoadModule -$B%G%#%l%/%F%#%V$r;H$C$FDI2C$G$-$^$9!#$=$&$G$J$$>l9g$O!"%b%8%e!<%k$N(B -$BDI2C$d:o=|$r$9$k$?$a$K$O(B Apache $B$r:F%3%s%Q%$%k$9$kI,MW$,$"$j$^$9!#(B -$B@_Dj%G%#%l%/%F%#%V$O(B <IfModule> $B%V%m%C%/$K(B -$BF~$l$k$3$H$GFCDj$N%b%8%e!<%k$,B8:_$9$k$H$-$@$1(B -$B@_Dj%U%!%$%k$K4^$^$l$k$h$&$K$9$k$3$H$,$G$-$^$9!#(B

    - -

    $B%3%^%s%I%i%$%s%*%W%7%g%s(B -l $B$r;H$C$F(B -$B8=;~E@$G$I$N%b%8%e!<%k$,%5!<%P$K%3%s%Q%$%k$5$l$F$$$k$+$r(B -$BCN$k$3$H$,$G$-$^$9!#(B - -


    - -

    $B%G%#%l%/%F%#%V$NE,MQHO0O(B

    - -
    -$B4XO"%G%#%l%/%F%#%V(B

    -<Directory>
    -<DirectoryMatch>
    -<Files>
    -<FilesMatch>
    -<Location>
    -<LocationMatch>
    -<VirtualHost>
    -
    - -

    $B%a%$%s@_Dj%U%!%$%k$K$"$k%G%#%l%/%F%#%V$O%5!<%PA4BN$KE,MQ$5$l$^$9!#(B -$B%5!<%P$N0lItJ,$N@_Dj$@$1$rJQ99$7$?$$>l9g$O(B -<Directory>, -<DirectoryMatch>, -<Files>, -<FilesMatch>, -<Location>, -<LocationMatch> - -$B%;%/%7%g%s$NCf$KCV$/$3$H$GE,MQHO0O$r7h$a$i$l$^$9!#$3$l$i$N%;%/%7%g%s$O(B -$B$=$NCf$K$"$k%G%#%l%/%F%#%V$NE,MQHO0O$rFCDj$N%U%!%$%k%7%9%F%`$N0LCV$d(B -URL $B$K8BDj$7$^$9!#Hs>o$K:YN3EY$N@_Dj$r2DG=$K$9$k$?$a$K!"%;%/%7%g%s$r(B -$BF~$l;R$K$9$k$3$H$b$G$-$^$9!#(B

    - -

    Apache $B$OF1;~$KB?$/$N0c$&%&%'%V%5%$%H$r07$&G=NO$,$"$j$^$9!#(B -$B$3$l$O(B $B%P!<%A%c%k%[%9%H(B $B$H8F$P$l$F$$$^$9!#(B -$BFCDj$N%&%'%V%5%$%H$K$N$_E,MQ$5$l$k$h$&$K$9$k$?$a$K!"%G%#%l%/%F%#%V$O(B -<VirtualHost> -$B%;%/%7%g%s$NCf$KCV$/$3$H$G$bE,MQHO0O$rJQ$($k$3$H$,$G$-$^$9!#(B

    - -

    $B$[$H$s$I$N%G%#%l%/%F%#%V$O$I$N%;%/%7%g%s$K$G$b=q$1$^$9$,!"(B -$BCf$K$O%3%s%F%-%9%H$K$h$C$F$O0UL#$r$J$5$J$$$b$N$b$"$j$^$9!#Nc$($P!"(B -$B%W%m%;%9$N:n@.$r@)8f$7$F$$$k%G%#%l%/%F%#%V$O%a%$%s%5!<%P$N%3%s%F%-%9%H$K(B -$B$N$_=q$/$3$H$,$G$-$^$9!#$I$N%G%#%l%/%F%#%V$r$I$N%;%/%7%g%s$K=q$/$3$H$,(B -$B$G$-$k$+$rCN$k$?$a$K$O%G%#%l%/%F%#%V$N(B -$B%3%s%F%-%9%H(B$B$rD4$Y$F$/$@$5$$!#(B -$B>\$7$$>pJs$O!"(BDirectory, Location, Files $B%;%/%7%g%s$NF0:nK!(B -$B$K$"$j$^$9!#(B

    - -
    - -

    .htaccess $B%U%!%$%k(B

    - -
    -$B4XO"%G%#%l%/%F%#%V(B

    -AccessFileName
    -AllowOverride
    -
    - -

    Apache $B$G$O%&%'%V%D%j!<$NCf$KCV$+$l$?FCJL$J%U%!%$%k$r;H$C$F(B -$BHsCf1{=88"E*$J@_Dj4IM}$r$G$-$^$9!#$=$NFCJL$J%U%!%$%k$OIaDL$O(B -.htaccess $B$H$$$&L>A0$G!"(B -AccessFileName $B%G%#%l%/%F%#%V$G$I$s$JL>A0$G$b;XDj$G$-$^$9!#(B -.htaccess $B%U%!%$%k$K=q$+$l$?%G%#%l%/%F%#%V$O%U%!%$%k$r(B -$BCV$$$?%G%#%l%/%H%j$H$=$NA4$F$N%5%V%G%#%l%/%H%j$KE,MQ$5$l$^$9!#(B -.htaccess $B%U%!%$%k$O$9$Y$F$N%j%/%(%9%H$G(B -$BFI$_9~$^$l$k$?$a!"JQ99$O$9$0$KH?1G$5$l$^$9!#(B - -

    $B$I$N%G%#%l%/%F%#%V$,(B .htaccess $B%U%!%$%k$K=q$1$k$+$r(B -$BD4$Y$k$K$O!"%G%#%l%/%F%#%V$N(B -$B%3%s%F%-%9%H(B $B$rD4$Y$F$/$@$5$$!#(B -$B%5!<%P4IM}AllowOverride -$B$r@_Dj$9$k$3$H$G$I$N%G%#%l%/%F%#%V$r(B .htaccess $B%U%!%$%k$K(B -$B=q$1$k$h$&$K$9$k$+$r@)8f$9$k$3$H$,$G$-$^$9!#(B

    - -
    - -

    $B%m%0%U%!%$%k(B

    - -

    $B%;%-%e%j%F%#$K4X$9$k7Y9p(B

    -

    -Apache $B$,%m%0%U%!%$%k$r=q$$$F$$$k%G%#%l%/%H%j$K=q$-9~$a$k?M$OC/$G$b(B -$B$[$\3N$B$7$J$$(B$B$G$/$@$5$$!#>\:Y$O(B -$B%;%-%e%j%F%#>pJs(B$B$r;2>H$7$F$/$@$5$$!#(B

    - -

    pid $B%U%!%$%k(B

    - -

    $B5/F0;~$K(B Apache $B$O?F(B httpd $B%W%m%;%9$N%W%m%;%9(B ID $B$r(B -logs/httpd.pid $B%U%!%$%k$KJ]B8$7$^$9!#$3$N%U%!%$%kL>$O(B -PidFile -$B%G%#%l%/%F%#%V$GJQ99$9$k$3$H$,$G$-$^$9!#%W%m%;%9(B ID $B$O4IM}\$7$$>pJs$O(B$B5/F0$H=*N;(B$B$r;2>H$7$F$/$@$5$$!#(B

    - -

    -$B%W%m%;%9$,0[>o=*N;$9$k(B ($B$b$7$/$O(B kill $B$5$l$k(B) $B$H!";R(B httpd $B%W%m%;%9$r(B -kill $B$9$kI,MW$,$"$j$^$9!#(B

    - -

    $B%(%i!<%m%0(B

    - -

    $B%5!<%P$O%(%i!<%a%C%;!<%8$r%m%0%U%!%$%k$K5-O?$7$^$9!#%G%U%)%k%H$O!"(BUnix -$B$G$O(B logs/error_log $B$G(B Windows $B$H(B OS/2 $B$G$O(B -logs/error.log $B$G$9!#%U%!%$%kL>$O(B ErrorLog $B%G%#%l%/%F%#%V$G@_Dj$G$-$^$9!#(B -$B0c$&(B$B%P!<%A%c%k%[%9%H(B -$B$K0c$&%(%i!<%m%0$r@_Dj$9$k$3$H$,$G$-$^$9!#(B

    - -

    $BE>Aw%m%0(B

    - -

    $B%5!<%P$OIaDL$=$l$>$l$N%j%/%(%9%H$rE>Aw%U%!%$%k$K%m%0$rlogs/access_log $B$G(B Windows $B$H(B -OS/2 $B$G$O(B logs/access.log $B$G$9!#%U%!%$%kL>$O(B -CustomLog -$B%G%#%l%/%F%#%V$r$G@_Dj$G$-$^$9!#0c$&(B$B%P!<%A%c%k%[%9%H(B$B$K(B -$B0c$&E>Aw%m%0$r@_Dj$9$k$3$H$,$G$-$^$9!#(B

    - - - - - diff --git a/docs/manual/content-negotiation.html b/docs/manual/content-negotiation.html deleted file mode 100644 index 20825f3661a93d38135a53f7da20f06866b67088..0000000000000000000000000000000000000000 --- a/docs/manual/content-negotiation.html +++ /dev/null @@ -1,216 +0,0 @@ - - -Apache server Content arbitration: MultiViews and *.var files - - - - -

    Content Arbitration: MultiViews and *.var files

    - -The HTTP standard allows clients (i.e., browsers like Mosaic or -Netscape) to specify what data formats they are prepared to accept. -The intention is that when information is available in multiple -variants (e.g., in different data formats), servers can use this -information to decide which variant to send. This feature has been -supported in the CERN server for a while, and while it is not yet -supported in the NCSA server, it is likely to assume a new importance -in light of the emergence of HTML3 capable browsers.

    - -The Apache module mod_negotiation handles -content negotiation in two different ways; special treatment for the -pseudo-mime-type application/x-type-map, and the -MultiViews per-directory Option (which can be set in srm.conf, or in -.htaccess files, as usual). These features are alternate user -interfaces to what amounts to the same piece of code (in the new file -http_mime_db.c) which implements the content negotiation -portion of the HTTP protocol.

    - -Each of these features allows one of several files to satisfy a -request, based on what the client says it's willing to accept; the -differences are in the way the files are identified: - -

      -
    • A type map (i.e., a *.var file) names the files - containing the variants explicitly -
    • In a MultiViews search, the server does an implicit filename - pattern match, and chooses from among the results. -
    - -Apache also supports a new pseudo-MIME type, -text/x-server-parsed-html3, which is treated as text/html;level=3 -for purposes of content negotiation, and as server-side-included HTML -elsewhere. - -

    Type maps (*.var files)

    - -A type map is a document which is typed by the server (using its -normal suffix-based mechanisms) as -application/x-type-map. Note that to use this feature, -you've got to have an AddType some place which defines a -file suffix as application/x-type-map; the easiest thing -may be to stick a -
    -
    -  AddType application/x-type-map var
    -
    -
    -in srm.conf. See comments in the sample config files for -details.

    - -Type map files have an entry for each available variant; these entries -consist of contiguous RFC822-format header lines. Entries for -different variants are separated by blank lines. Blank lines are -illegal within an entry. It is conventional to begin a map file with -an entry for the combined entity as a whole, e.g., -

    -
    -  URI: foo; vary="type,language"
    -
    -  URI: foo.en.html
    -  Content-type: text/html; level=2
    -  Content-language: en
    -
    -  URI: foo.fr.html
    -  Content-type: text/html; level=2
    -  Content-language: fr
    -
    -
    -If the variants have different qualities, that may be indicated by the -"qs" parameter, as in this picture (available as jpeg, gif, or ASCII-art): -
    -
    -  URI: foo; vary="type,language"
    -
    -  URI: foo.jpeg
    -  Content-type: image/jpeg; qs=0.8
    -
    -  URI: foo.gif
    -  Content-type: image/gif; qs=0.5
    -
    -  URI: foo.txt
    -  Content-type: text/plain; qs=0.01
    -
    -

    - -The full list of headers recognized is: - -

    -
    URI: -
    uri of the file containing the variant (of the given media - type, encoded with the given content encoding). These are - interpreted as URLs relative to the map file; they must be on - the same server (!), and they must refer to files to which the - client would be granted access if they were to be requested - directly. -
    Content-type: -
    media type --- level may be specified, along with "qs". These - are often referred to as MIME types; typical media types are - image/gif, text/plain, or - text/html; level=3. -
    Content-language: -
    The language of the variant, specified as an internet standard - language code (e.g., en for English, - kr for Korean, etc.). -
    Content-encoding: -
    If the file is compressed, or otherwise encoded, rather than - containing the actual raw data, this says how that was done. - For compressed files (the only case where this generally comes - up), content encoding should be - x-compress, or gzip, as appropriate. -
    Content-length: -
    The size of the file. Clients can ask to receive a given media - type only if the variant isn't too big; specifying a content - length in the map allows the server to compare against these - thresholds without checking the actual file. -
    - -

    Multiviews

    - -This is a per-directory option, meaning it can be set with an -Options directive within a <Directory> -section in access.conf, or (if AllowOverride -is properly set) in .htaccess files. Note that -Options All does not set MultiViews; you -have to ask for it by name. (Fixing this is a one-line change to -httpd.h). - -

    - -The effect of MultiViews is as follows: if the server -receives a request for /some/dir/foo, if -/some/dir has MultiViews enabled, and -/some/dir/foo does *not* exist, then the server reads the -directory looking for files named foo.*, and effectively fakes up a -type map which names all those files, assigning them the same media -types and content-encodings it would have if the client had asked for -one of them by name. It then chooses the best match to the client's -requirements, and forwards them along. - -

    - -This applies to searches for the file named by the -DirectoryIndex directive, if the server is trying to -index a directory; if the configuration files specify -

    -
    -  DirectoryIndex index
    -
    -
    then the server will arbitrate between index.html -and index.html3 if both are present. If neither are -present, and index.cgi is there, the server will run it. - -

    - -If one of the files found by the globbing is a CGI script, it's not -obvious what should happen. My code gives that case gets special -treatment --- if the request was a POST, or a GET with QUERY_ARGS or -PATH_INFO, the script is given an extremely high quality rating, and -generally invoked; otherwise it is given an extremely low quality -rating, which generally causes one of the other views (if any) to be -retrieved. This is the only jiggering of quality ratings done by the -MultiViews code; aside from that, all Qualities in the synthesized -type maps are 1.0. - -

    - -New as of 0.8: Documents in multiple languages can also be resolved through the use -of the AddLanguage and LanguagePriority -directives: - -

    -AddLanguage en .en
    -AddLanguage fr .fr
    -AddLanguage de .de
    -AddLanguage da .da
    -AddLanguage el .el
    -AddLanguage it .it
    -
    -# LanguagePriority allows you to give precedence to some languages
    -# in case of a tie during content negotiation.
    -# Just list the languages in decreasing order of preference.
    -
    -LanguagePriority en fr de
    -
    - -Here, a request for "foo.html" matched against "foo.html.en" and -"foo.html.fr" would return an French document to a browser that -indicated a preference for French, or an English document otherwise. -In fact, a request for "foo" matched against "foo.html.en", -"foo.html.fr", "foo.ps.en", "foo.pdf.de", and "foo.txt.it" would do -just what you expect - treat those suffices as a database and compare -the request to it, returning the best match. The languages and data -types share the same suffix name space. - -

    - -Note that this machinery only comes into play if the file which the -user attempted to retrieve does not exist by that name; if it -does, it is simply retrieved as usual. (So, someone who actually asks -for foo.jpeg, as opposed to foo, never gets -foo.gif). - -


    -Home -Index - - diff --git a/docs/manual/content-negotiation.html.en b/docs/manual/content-negotiation.html.en deleted file mode 100644 index 20825f3661a93d38135a53f7da20f06866b67088..0000000000000000000000000000000000000000 --- a/docs/manual/content-negotiation.html.en +++ /dev/null @@ -1,216 +0,0 @@ - - -Apache server Content arbitration: MultiViews and *.var files - - - - -

    Content Arbitration: MultiViews and *.var files

    - -The HTTP standard allows clients (i.e., browsers like Mosaic or -Netscape) to specify what data formats they are prepared to accept. -The intention is that when information is available in multiple -variants (e.g., in different data formats), servers can use this -information to decide which variant to send. This feature has been -supported in the CERN server for a while, and while it is not yet -supported in the NCSA server, it is likely to assume a new importance -in light of the emergence of HTML3 capable browsers.

    - -The Apache module mod_negotiation handles -content negotiation in two different ways; special treatment for the -pseudo-mime-type application/x-type-map, and the -MultiViews per-directory Option (which can be set in srm.conf, or in -.htaccess files, as usual). These features are alternate user -interfaces to what amounts to the same piece of code (in the new file -http_mime_db.c) which implements the content negotiation -portion of the HTTP protocol.

    - -Each of these features allows one of several files to satisfy a -request, based on what the client says it's willing to accept; the -differences are in the way the files are identified: - -

      -
    • A type map (i.e., a *.var file) names the files - containing the variants explicitly -
    • In a MultiViews search, the server does an implicit filename - pattern match, and chooses from among the results. -
    - -Apache also supports a new pseudo-MIME type, -text/x-server-parsed-html3, which is treated as text/html;level=3 -for purposes of content negotiation, and as server-side-included HTML -elsewhere. - -

    Type maps (*.var files)

    - -A type map is a document which is typed by the server (using its -normal suffix-based mechanisms) as -application/x-type-map. Note that to use this feature, -you've got to have an AddType some place which defines a -file suffix as application/x-type-map; the easiest thing -may be to stick a -
    -
    -  AddType application/x-type-map var
    -
    -
    -in srm.conf. See comments in the sample config files for -details.

    - -Type map files have an entry for each available variant; these entries -consist of contiguous RFC822-format header lines. Entries for -different variants are separated by blank lines. Blank lines are -illegal within an entry. It is conventional to begin a map file with -an entry for the combined entity as a whole, e.g., -

    -
    -  URI: foo; vary="type,language"
    -
    -  URI: foo.en.html
    -  Content-type: text/html; level=2
    -  Content-language: en
    -
    -  URI: foo.fr.html
    -  Content-type: text/html; level=2
    -  Content-language: fr
    -
    -
    -If the variants have different qualities, that may be indicated by the -"qs" parameter, as in this picture (available as jpeg, gif, or ASCII-art): -
    -
    -  URI: foo; vary="type,language"
    -
    -  URI: foo.jpeg
    -  Content-type: image/jpeg; qs=0.8
    -
    -  URI: foo.gif
    -  Content-type: image/gif; qs=0.5
    -
    -  URI: foo.txt
    -  Content-type: text/plain; qs=0.01
    -
    -

    - -The full list of headers recognized is: - -

    -
    URI: -
    uri of the file containing the variant (of the given media - type, encoded with the given content encoding). These are - interpreted as URLs relative to the map file; they must be on - the same server (!), and they must refer to files to which the - client would be granted access if they were to be requested - directly. -
    Content-type: -
    media type --- level may be specified, along with "qs". These - are often referred to as MIME types; typical media types are - image/gif, text/plain, or - text/html; level=3. -
    Content-language: -
    The language of the variant, specified as an internet standard - language code (e.g., en for English, - kr for Korean, etc.). -
    Content-encoding: -
    If the file is compressed, or otherwise encoded, rather than - containing the actual raw data, this says how that was done. - For compressed files (the only case where this generally comes - up), content encoding should be - x-compress, or gzip, as appropriate. -
    Content-length: -
    The size of the file. Clients can ask to receive a given media - type only if the variant isn't too big; specifying a content - length in the map allows the server to compare against these - thresholds without checking the actual file. -
    - -

    Multiviews

    - -This is a per-directory option, meaning it can be set with an -Options directive within a <Directory> -section in access.conf, or (if AllowOverride -is properly set) in .htaccess files. Note that -Options All does not set MultiViews; you -have to ask for it by name. (Fixing this is a one-line change to -httpd.h). - -

    - -The effect of MultiViews is as follows: if the server -receives a request for /some/dir/foo, if -/some/dir has MultiViews enabled, and -/some/dir/foo does *not* exist, then the server reads the -directory looking for files named foo.*, and effectively fakes up a -type map which names all those files, assigning them the same media -types and content-encodings it would have if the client had asked for -one of them by name. It then chooses the best match to the client's -requirements, and forwards them along. - -

    - -This applies to searches for the file named by the -DirectoryIndex directive, if the server is trying to -index a directory; if the configuration files specify -

    -
    -  DirectoryIndex index
    -
    -
    then the server will arbitrate between index.html -and index.html3 if both are present. If neither are -present, and index.cgi is there, the server will run it. - -

    - -If one of the files found by the globbing is a CGI script, it's not -obvious what should happen. My code gives that case gets special -treatment --- if the request was a POST, or a GET with QUERY_ARGS or -PATH_INFO, the script is given an extremely high quality rating, and -generally invoked; otherwise it is given an extremely low quality -rating, which generally causes one of the other views (if any) to be -retrieved. This is the only jiggering of quality ratings done by the -MultiViews code; aside from that, all Qualities in the synthesized -type maps are 1.0. - -

    - -New as of 0.8: Documents in multiple languages can also be resolved through the use -of the AddLanguage and LanguagePriority -directives: - -

    -AddLanguage en .en
    -AddLanguage fr .fr
    -AddLanguage de .de
    -AddLanguage da .da
    -AddLanguage el .el
    -AddLanguage it .it
    -
    -# LanguagePriority allows you to give precedence to some languages
    -# in case of a tie during content negotiation.
    -# Just list the languages in decreasing order of preference.
    -
    -LanguagePriority en fr de
    -
    - -Here, a request for "foo.html" matched against "foo.html.en" and -"foo.html.fr" would return an French document to a browser that -indicated a preference for French, or an English document otherwise. -In fact, a request for "foo" matched against "foo.html.en", -"foo.html.fr", "foo.ps.en", "foo.pdf.de", and "foo.txt.it" would do -just what you expect - treat those suffices as a database and compare -the request to it, returning the best match. The languages and data -types share the same suffix name space. - -

    - -Note that this machinery only comes into play if the file which the -user attempted to retrieve does not exist by that name; if it -does, it is simply retrieved as usual. (So, someone who actually asks -for foo.jpeg, as opposed to foo, never gets -foo.gif). - -


    -Home -Index - - diff --git a/docs/manual/custom-error.html b/docs/manual/custom-error.html deleted file mode 100644 index 31c955a2c4da944ca7f3f94f9ffcac89a0b8424a..0000000000000000000000000000000000000000 --- a/docs/manual/custom-error.html +++ /dev/null @@ -1,109 +0,0 @@ - - -Ccustom error responses - - - - -

    Custom error responses

    -
    -
    Purpose -
    Additional functionality. Allows webmasters to configure the response of -Apache to some error or problem.
    -

    Customizable responses can be defined to be activated in the event of a -server detected error or problem.
    -e.g. if a script crashes and produces a "500 Server Error" response, then -this response can be replaced with either some friendlier text or by a -redirection to another URL (local or external). -

    Old behavior -
    NCSA httpd 1.3 would return some boring old error/problem message which -would often be meaningless to the user, and would provide no means of logging -the symptoms which caused it.

    -
    New behavior -
    The server can be asked to; -
      -
    1. Display some other text, instead of the NCSA hard coded messages, or -
    2. redirect to a local URL, or -
    3. redirect to an external URL. -
    -

    Redirecting to another URL can be useful, but only if some information -can be passed which can then be used to explain and/or log the error/problem -more clearly.
    To achieve this, Apache will define new CGI-like environment -variables, e.g. -

    -REDIRECT_HTTP_ACCEPT=*/*, image/gif, image/x-xbitmap, image/jpeg
    -REDIRECT_HTTP_USER_AGENT=Mozilla/1.1b2 (X11; I; HP-UX A.09.05 9000/712)
    -REDIRECT_PATH=.:/bin:/usr/local/bin:/etc
    -REDIRECT_QUERY_STRING=
    -REDIRECT_REMOTE_ADDR=121.345.78.123
    -REDIRECT_REMOTE_HOST=ooh.ahhh.com
    -REDIRECT_SERVER_NAME=crash.bang.edu
    -REDIRECT_SERVER_PORT=80
    -REDIRECT_SERVER_SOFTWARE=Apache/0.8.15
    -REDIRECT_URL=/cgi-bin/buggy.pl
    -
    - -note the REDIRECT_ prefix.

    - -At least REDIRECT_URL and REDIRECT_QUERY_STRING will -be passed to the new URL (assuming it's a cgi-script or a cgi-include). The -other variables will exist only if they existed prior to the error/problem.

    - -

    Configuration -
    file: server configuration
    -

    Here are some examples... -

    -ErrorDocument 500 /cgi-bin/crash-recover
    -ErrorDocument 500 "Sorry, our script crashed because %s. Oh dear
    -ErrorDocument 500 http://xxx/
    -ErrorDocument 404 /Lame_excuses/not_found.html
    -ErrorDocument 401 /Subscription/how_to_subscribe.html -
    -The syntax is,

    -ErrorDocument -<3-digit-code> action

    - -where the action can be, -

      -
    1. Text to be displayed.
      Prefix the text with a quote ("). Whatever -follows the quote is displayed. If the error/problem produced any additional -information, it can be specified using %s. -Note: the (") prefix isn't displayed. -
    2. An external URL to redirect to. -
    3. A local URL to redirect to. -
    -

    ErrorDocument definitions are sensitive to a -SIGHUP, so you can change any of the definitions or add new ones -prior to sending a SIGHUP (kill -1) signal. -

    -


    - -

    Custom error responses and redirects

    -
    -
    Purpose -
    Apache's behaviour to redirected URLs has been modified so that additional -environment variables are available to a script/server-include.

    - -

    Old behaviour -
    Standard CGI vars were made available to a script which has been -redirected to. No indication of where the redirection came from was provided. -

    -

    New behaviour -
    A new batch of environment variables will be initialized for use by a -script which has been redirected to.
    -Each new variable will have the prefix REDIRECT_.
    -REDIRECT_ environment variables are created from the CGI environment -variables which existed prior to the redirect, they are renamed with a -REDIRECT_ prefix, i.e. HTTP_USER_AGENT -> REDIRECT_HTTP_USER_AGENT.
    -In addition to these new variables, Apache will define -REDIRECT_URL and REDIRECT_STATUS to help the script -trace its origin.
    -Logging: both the original URL and the URL being redirected to, will -now be logged correctly in the access log.

    -

    -


    - -Home -Index - - diff --git a/docs/manual/custom-error.html.en b/docs/manual/custom-error.html.en deleted file mode 100644 index 31c955a2c4da944ca7f3f94f9ffcac89a0b8424a..0000000000000000000000000000000000000000 --- a/docs/manual/custom-error.html.en +++ /dev/null @@ -1,109 +0,0 @@ - - -Ccustom error responses - - - - -

    Custom error responses

    -
    -
    Purpose -
    Additional functionality. Allows webmasters to configure the response of -Apache to some error or problem.
    -

    Customizable responses can be defined to be activated in the event of a -server detected error or problem.
    -e.g. if a script crashes and produces a "500 Server Error" response, then -this response can be replaced with either some friendlier text or by a -redirection to another URL (local or external). -

    Old behavior -
    NCSA httpd 1.3 would return some boring old error/problem message which -would often be meaningless to the user, and would provide no means of logging -the symptoms which caused it.

    -
    New behavior -
    The server can be asked to; -
      -
    1. Display some other text, instead of the NCSA hard coded messages, or -
    2. redirect to a local URL, or -
    3. redirect to an external URL. -
    -

    Redirecting to another URL can be useful, but only if some information -can be passed which can then be used to explain and/or log the error/problem -more clearly.
    To achieve this, Apache will define new CGI-like environment -variables, e.g. -

    -REDIRECT_HTTP_ACCEPT=*/*, image/gif, image/x-xbitmap, image/jpeg
    -REDIRECT_HTTP_USER_AGENT=Mozilla/1.1b2 (X11; I; HP-UX A.09.05 9000/712)
    -REDIRECT_PATH=.:/bin:/usr/local/bin:/etc
    -REDIRECT_QUERY_STRING=
    -REDIRECT_REMOTE_ADDR=121.345.78.123
    -REDIRECT_REMOTE_HOST=ooh.ahhh.com
    -REDIRECT_SERVER_NAME=crash.bang.edu
    -REDIRECT_SERVER_PORT=80
    -REDIRECT_SERVER_SOFTWARE=Apache/0.8.15
    -REDIRECT_URL=/cgi-bin/buggy.pl
    -
    - -note the REDIRECT_ prefix.

    - -At least REDIRECT_URL and REDIRECT_QUERY_STRING will -be passed to the new URL (assuming it's a cgi-script or a cgi-include). The -other variables will exist only if they existed prior to the error/problem.

    - -

    Configuration -
    file: server configuration
    -

    Here are some examples... -

    -ErrorDocument 500 /cgi-bin/crash-recover
    -ErrorDocument 500 "Sorry, our script crashed because %s. Oh dear
    -ErrorDocument 500 http://xxx/
    -ErrorDocument 404 /Lame_excuses/not_found.html
    -ErrorDocument 401 /Subscription/how_to_subscribe.html -
    -The syntax is,

    -ErrorDocument -<3-digit-code> action

    - -where the action can be, -

      -
    1. Text to be displayed.
      Prefix the text with a quote ("). Whatever -follows the quote is displayed. If the error/problem produced any additional -information, it can be specified using %s. -Note: the (") prefix isn't displayed. -
    2. An external URL to redirect to. -
    3. A local URL to redirect to. -
    -

    ErrorDocument definitions are sensitive to a -SIGHUP, so you can change any of the definitions or add new ones -prior to sending a SIGHUP (kill -1) signal. -

    -


    - -

    Custom error responses and redirects

    -
    -
    Purpose -
    Apache's behaviour to redirected URLs has been modified so that additional -environment variables are available to a script/server-include.

    - -

    Old behaviour -
    Standard CGI vars were made available to a script which has been -redirected to. No indication of where the redirection came from was provided. -

    -

    New behaviour -
    A new batch of environment variables will be initialized for use by a -script which has been redirected to.
    -Each new variable will have the prefix REDIRECT_.
    -REDIRECT_ environment variables are created from the CGI environment -variables which existed prior to the redirect, they are renamed with a -REDIRECT_ prefix, i.e. HTTP_USER_AGENT -> REDIRECT_HTTP_USER_AGENT.
    -In addition to these new variables, Apache will define -REDIRECT_URL and REDIRECT_STATUS to help the script -trace its origin.
    -Logging: both the original URL and the URL being redirected to, will -now be logged correctly in the access log.

    -

    -


    - -Home -Index - - diff --git a/docs/manual/developer/API.html b/docs/manual/developer/API.html deleted file mode 100644 index f860996e472445e06006a19d70701666779732e9..0000000000000000000000000000000000000000 --- a/docs/manual/developer/API.html +++ /dev/null @@ -1,988 +0,0 @@ - - -Apache API notes - - - -

    Apache API notes

    - -These are some notes on the Apache API and the data structures you -have to deal with, etc. They are not yet nearly complete, but -hopefully, they will help you get your bearings. Keep in mind that -the API is still subject to change as we gain experience with it. -(See the TODO file for what might be coming). However, -it will be easy to adapt modules to any changes that are made. -(We have more modules to adapt than you do). -

    - -A few notes on general pedagogical style here. In the interest of -conciseness, all structure declarations here are incomplete --- the -real ones have more slots that I'm not telling you about. For the -most part, these are reserved to one component of the server core or -another, and should be altered by modules with caution. However, in -some cases, they really are things I just haven't gotten around to -yet. Welcome to the bleeding edge.

    - -Finally, here's an outline, to give you some bare idea of what's -coming up, and in what order: - -

    - -

    Basic concepts.

    - -We begin with an overview of the basic concepts behind the -API, and how they are manifested in the code. - -

    Handlers, Modules, and Requests

    - -Apache breaks down request handling into a series of steps, more or -less the same way the Netscape server API does (although this API has -a few more stages than NetSite does, as hooks for stuff I thought -might be useful in the future). These are: - -
      -
    • URI -> Filename translation -
    • Auth ID checking [is the user who they say they are?] -
    • Auth access checking [is the user authorized here?] -
    • Access checking other than auth -
    • Determining MIME type of the object requested -
    • `Fixups' --- there aren't any of these yet, but the phase is - intended as a hook for possible extensions like - SetEnv, which don't really fit well elsewhere. -
    • Actually sending a response back to the client. -
    • Logging the request -
    - -These phases are handled by looking at each of a succession of -modules, looking to see if each of them has a handler for the -phase, and attempting invoking it if so. The handler can typically do -one of three things: - -
      -
    • Handle the request, and indicate that it has done so - by returning the magic constant OK. -
    • Decline to handle the request, by returning the magic - integer constant DECLINED. In this case, the - server behaves in all respects as if the handler simply hadn't - been there. -
    • Signal an error, by returning one of the HTTP error codes. - This terminates normal handling of the request, although an - ErrorDocument may be invoked to try to mop up, and it will be - logged in any case. -
    - -Most phases are terminated by the first module that handles them; -however, for logging, `fixups', and non-access authentication -checking, all handlers always run (barring an error). Also, the -response phase is unique in that modules may declare multiple handlers -for it, via a dispatch table keyed on the MIME type of the requested -object. Modules may declare a response-phase handler which can handle -any request, by giving it the key */* (i.e., a -wildcard MIME type specification). However, wildcard handlers are -only invoked if the server has already tried and failed to find a more -specific response handler for the MIME type of the requested object -(either none existed, or they all declined).

    - -The handlers themselves are functions of one argument (a -request_rec structure. vide infra), which returns an -integer, as above.

    - -

    A brief tour of a module

    - -At this point, we need to explain the structure of a module. Our -candidate will be one of the messier ones, the CGI module --- this -handles both CGI scripts and the ScriptAlias config file -command. It's actually a great deal more complicated than most -modules, but if we're going to have only one example, it might as well -be the one with its fingers in every place.

    - -Let's begin with handlers. In order to handle the CGI scripts, the -module declares a response handler for them. Because of -ScriptAlias, it also has handlers for the name -translation phase (to recognise ScriptAliased URIs), the -type-checking phase (any ScriptAliased request is typed -as a CGI script).

    - -The module needs to maintain some per (virtual) -server information, namely, the ScriptAliases in effect; -the module structure therefore contains pointers to a functions which -builds these structures, and to another which combines two of them (in -case the main server and a virtual server both have -ScriptAliases declared).

    - -Finally, this module contains code to handle the -ScriptAlias command itself. This particular module only -declares one command, but there could be more, so modules have -command tables which declare their commands, and describe -where they are permitted, and how they are to be invoked.

    - -A final note on the declared types of the arguments of some of these -commands: a pool is a pointer to a resource pool -structure; these are used by the server to keep track of the memory -which has been allocated, files opened, etc., either to service a -particular request, or to handle the process of configuring itself. -That way, when the request is over (or, for the configuration pool, -when the server is restarting), the memory can be freed, and the files -closed, en masse, without anyone having to write explicit code to -track them all down and dispose of them. Also, a -cmd_parms structure contains various information about -the config file being read, and other status information, which is -sometimes of use to the function which processes a config-file command -(such as ScriptAlias). - -With no further ado, the module itself: - -

    -/* Declarations of handlers. */
    -
    -int translate_scriptalias (request_rec *);
    -int type_scriptalias (request_rec *);
    -int cgi_handler (request_rec *);
    -
    -/* Subsidiary dispatch table for response-phase handlers, by MIME type */
    -
    -handler_rec cgi_handlers[] = {
    -{ "application/x-httpd-cgi", cgi_handler },
    -{ NULL }
    -};
    -
    -/* Declarations of routines to manipulate the module's configuration
    - * info.  Note that these are returned, and passed in, as void *'s;
    - * the server core keeps track of them, but it doesn't, and can't,
    - * know their internal structure.
    - */
    -
    -void *make_cgi_server_config (pool *);
    -void *merge_cgi_server_config (pool *, void *, void *);
    -
    -/* Declarations of routines to handle config-file commands */
    -
    -extern char *script_alias(cmd_parms *, void *per_dir_config, char *fake,
    -                          char *real);
    -
    -command_rec cgi_cmds[] = {
    -{ "ScriptAlias", script_alias, NULL, RSRC_CONF, TAKE2,
    -    "a fakename and a realname"},
    -{ NULL }
    -};
    -
    -module cgi_module = {
    -   STANDARD_MODULE_STUFF,
    -   NULL,                     /* initializer */
    -   NULL,                     /* dir config creator */
    -   NULL,                     /* dir merger --- default is to override */
    -   make_cgi_server_config,   /* server config */
    -   merge_cgi_server_config,  /* merge server config */
    -   cgi_cmds,                 /* command table */
    -   cgi_handlers,             /* handlers */
    -   translate_scriptalias,    /* filename translation */
    -   NULL,                     /* check_user_id */
    -   NULL,                     /* check auth */
    -   NULL,                     /* check access */
    -   type_scriptalias,         /* type_checker */
    -   NULL,                     /* fixups */
    -   NULL                      /* logger */
    -};
    -
    - -

    How handlers work

    - -The sole argument to handlers is a request_rec structure. -This structure describes a particular request which has been made to -the server, on behalf of a client. In most cases, each connection to -the client generates only one request_rec structure.

    - -

    A brief tour of the request_rec

    - -The request_rec contains pointers to a resource pool -which will be cleared when the server is finished handling the -request; to structures containing per-server and per-connection -information, and most importantly, information on the request itself.

    - -The most important such information is a small set of character -strings describing attributes of the object being requested, including -its URI, filename, content-type and content-encoding (these being filled -in by the translation and type-check handlers which handle the -request, respectively).

    - -Other commonly used data items are tables giving the MIME headers on -the client's original request, MIME headers to be sent back with the -response (which modules can add to at will), and environment variables -for any subprocesses which are spawned off in the course of servicing -the request. These tables are manipulated using the -table_get and table_set routines.

    - -Finally, there are pointers to two data structures which, in turn, -point to per-module configuration structures. Specifically, these -hold pointers to the data structures which the module has built to -describe the way it has been configured to operate in a given -directory (via .htaccess files or -<Directory> sections), for private data it has -built in the course of servicing the request (so modules' handlers for -one phase can pass `notes' to their handlers for other phases). There -is another such configuration vector in the server_rec -data structure pointed to by the request_rec, which -contains per (virtual) server configuration data.

    - -Here is an abridged declaration, giving the fields most commonly used:

    - -

    -struct request_rec {
    -
    -  pool *pool;
    -  conn_rec *connection;
    -  server_rec *server;
    -
    -  /* What object is being requested */
    -  
    -  char *uri;
    -  char *filename;
    -  char *path_info;
    -  char *args;           /* QUERY_ARGS, if any */
    -  struct stat finfo;    /* Set by server core;
    -                         * st_mode set to zero if no such file */
    -  
    -  char *content_type;
    -  char *content_encoding;
    -  
    -  /* MIME header environments, in and out.  Also, an array containing
    -   * environment variables to be passed to subprocesses, so people can
    -   * write modules to add to that environment.
    -   *
    -   * The difference between headers_out and err_headers_out is that
    -   * the latter are printed even on error, and persist across internal
    -   * redirects (so the headers printed for ErrorDocument handlers will
    -   * have them).
    -   */
    -  
    -  table *headers_in;
    -  table *headers_out;
    -  table *err_headers_out;
    -  table *subprocess_env;
    -
    -  /* Info about the request itself... */
    -  
    -  int header_only;     /* HEAD request, as opposed to GET */
    -  char *protocol;      /* Protocol, as given to us, or HTTP/0.9 */
    -  char *method;        /* GET, HEAD, POST, etc. */
    -  int method_number;   /* M_GET, M_POST, etc. */
    -
    -  /* Info for logging */
    -
    -  char *the_request;
    -  int bytes_sent;
    -
    -  /* A flag which modules can set, to indicate that the data being
    -   * returned is volatile, and clients should be told not to cache it.
    -   */
    -
    -  int no_cache;
    -
    -  /* Various other config info which may change with .htaccess files
    -   * These are config vectors, with one void* pointer for each module
    -   * (the thing pointed to being the module's business).
    -   */
    -  
    -  void *per_dir_config;   /* Options set in config files, etc. */
    -  void *request_config;   /* Notes on *this* request */
    -  
    -};
    -
    -
    - -

    Where request_rec structures come from

    - -Most request_rec structures are built by reading an HTTP -request from a client, and filling in the fields. However, there are -a few exceptions: - -
      -
    • If the request is to an imagemap, a type map (i.e., a - *.var file), or a CGI script which returned a - local `Location:', then the resource which the user requested - is going to be ultimately located by some URI other than what - the client originally supplied. In this case, the server does - an internal redirect, constructing a new - request_rec for the new URI, and processing it - almost exactly as if the client had requested the new URI - directly.

      - -

    • If some handler signaled an error, and an - ErrorDocument is in scope, the same internal - redirect machinery comes into play.

      - -

    • Finally, a handler occasionally needs to investigate `what - would happen if' some other request were run. For instance, - the directory indexing module needs to know what MIME type - would be assigned to a request for each directory entry, in - order to figure out what icon to use.

      - - Such handlers can construct a sub-request, using the - functions sub_req_lookup_file and - sub_req_lookup_uri; this constructs a new - request_rec structure and processes it as you - would expect, up to but not including the point of actually - sending a response. (These functions skip over the access - checks if the sub-request is for a file in the same directory - as the original request).

      - - (Server-side includes work by building sub-requests and then - actually invoking the response handler for them, via the - function run_sub_request). -

    - -

    Handling requests, declining, and returning error codes

    - -As discussed above, each handler, when invoked to handle a particular -request_rec, has to return an int to -indicate what happened. That can either be - -
      -
    • OK --- the request was handled successfully. This may or may - not terminate the phase. -
    • DECLINED --- no erroneous condition exists, but the module - declines to handle the phase; the server tries to find another. -
    • an HTTP error code, which aborts handling of the request. -
    - -Note that if the error code returned is REDIRECT, then -the module should put a Location in the request's -headers_out, to indicate where the client should be -redirected to.

    - -

    Special considerations for response handlers

    - -Handlers for most phases do their work by simply setting a few fields -in the request_rec structure (or, in the case of access -checkers, simply by returning the correct error code). However, -response handlers have to actually send a request back to the client.

    - -They should begin by sending an HTTP response header, using the -function send_http_header. (You don't have to do -anything special to skip sending the header for HTTP/0.9 requests; the -function figures out on its own that it shouldn't do anything). If -the request is marked header_only, that's all they should -do; they should return after that, without attempting any further -output.

    - -Otherwise, they should produce a request body which responds to the -client as appropriate. The primitives for this are rputc -and rprintf, for internally generated output, and -send_fd, to copy the contents of some FILE * -straight to the client.

    - -At this point, you should more or less understand the following piece -of code, which is the handler which handles GET requests -which have no more specific handler; it also shows how conditional -GETs can be handled, if it's desirable to do so in a -particular response handler --- set_last_modified checks -against the If-modified-since value supplied by the -client, if any, and returns an appropriate code (which will, if -nonzero, be USE_LOCAL_COPY). No similar considerations apply for -set_content_length, but it returns an error code for -symmetry.

    - -

    -int default_handler (request_rec *r)
    -{
    -    int errstatus;
    -    FILE *f;
    -    
    -    if (r->method_number != M_GET) return DECLINED;
    -    if (r->finfo.st_mode == 0) return NOT_FOUND;
    -
    -    if ((errstatus = set_content_length (r, r->finfo.st_size))
    -        || (errstatus = set_last_modified (r, r->finfo.st_mtime)))
    -        return errstatus;
    -    
    -    f = fopen (r->filename, "r");
    -
    -    if (f == NULL) {
    -        log_reason("file permissions deny server access",
    -                   r->filename, r);
    -        return FORBIDDEN;
    -    }
    -      
    -    register_timeout ("send", r);
    -    send_http_header (r);
    -
    -    if (!r->header_only) send_fd (f, r);
    -    pfclose (r->pool, f);
    -    return OK;
    -}
    -
    - -Finally, if all of this is too much of a challenge, there are a few -ways out of it. First off, as shown above, a response handler which -has not yet produced any output can simply return an error code, in -which case the server will automatically produce an error response. -Secondly, it can punt to some other handler by invoking -internal_redirect, which is how the internal redirection -machinery discussed above is invoked. A response handler which has -internally redirected should always return OK.

    - -(Invoking internal_redirect from handlers which are -not response handlers will lead to serious confusion). - -

    Special considerations for authentication handlers

    - -Stuff that should be discussed here in detail: - -
      -
    • Authentication-phase handlers not invoked unless auth is - configured for the directory. -
    • Common auth configuration stored in the core per-dir - configuration; it has accessors auth_type, - auth_name, and requires. -
    • Common routines, to handle the protocol end of things, at least - for HTTP basic authentication (get_basic_auth_pw, - which sets the connection->user structure field - automatically, and note_basic_auth_failure, which - arranges for the proper WWW-Authenticate: header - to be sent back). -
    - -

    Special considerations for logging handlers

    - -When a request has internally redirected, there is the question of -what to log. Apache handles this by bundling the entire chain of -redirects into a list of request_rec structures which are -threaded through the r->prev and r->next -pointers. The request_rec which is passed to the logging -handlers in such cases is the one which was originally built for the -initial request from the client; note that the bytes_sent field will -only be correct in the last request in the chain (the one for which a -response was actually sent). - -

    Resource allocation and resource pools

    - -One of the problems of writing and designing a server-pool server is -that of preventing leakage, that is, allocating resources (memory, -open files, etc.), without subsequently releasing them. The resource -pool machinery is designed to make it easy to prevent this from -happening, by allowing resource to be allocated in such a way that -they are automatically released when the server is done with -them.

    - -The way this works is as follows: the memory which is allocated, file -opened, etc., to deal with a particular request are tied to a -resource pool which is allocated for the request. The pool -is a data structure which itself tracks the resources in question.

    - -When the request has been processed, the pool is cleared. At -that point, all the memory associated with it is released for reuse, -all files associated with it are closed, and any other clean-up -functions which are associated with the pool are run. When this is -over, we can be confident that all the resource tied to the pool have -been released, and that none of them have leaked.

    - -Server restarts, and allocation of memory and resources for per-server -configuration, are handled in a similar way. There is a -configuration pool, which keeps track of resources which were -allocated while reading the server configuration files, and handling -the commands therein (for instance, the memory that was allocated for -per-server module configuration, log files and other files that were -opened, and so forth). When the server restarts, and has to reread -the configuration files, the configuration pool is cleared, and so the -memory and file descriptors which were taken up by reading them the -last time are made available for reuse.

    - -It should be noted that use of the pool machinery isn't generally -obligatory, except for situations like logging handlers, where you -really need to register cleanups to make sure that the log file gets -closed when the server restarts (this is most easily done by using the -function pfopen, which also -arranges for the underlying file descriptor to be closed before any -child processes, such as for CGI scripts, are execed), or -in case you are using the timeout machinery (which isn't yet even -documented here). However, there are two benefits to using it: -resources allocated to a pool never leak (even if you allocate a -scratch string, and just forget about it); also, for memory -allocation, palloc is generally faster than -malloc.

    - -We begin here by describing how memory is allocated to pools, and then -discuss how other resources are tracked by the resource pool -machinery. - -

    Allocation of memory in pools

    - -Memory is allocated to pools by calling the function -palloc, which takes two arguments, one being a pointer to -a resource pool structure, and the other being the amount of memory to -allocate (in chars). Within handlers for handling -requests, the most common way of getting a resource pool structure is -by looking at the pool slot of the relevant -request_rec; hence the repeated appearance of the -following idiom in module code: - -
    -int my_handler(request_rec *r)
    -{
    -    struct my_structure *foo;
    -    ...
    -
    -    foo = (foo *)palloc (r->pool, sizeof(my_structure));
    -}
    -
    - -Note that there is no pfree --- -palloced memory is freed only when the associated -resource pool is cleared. This means that palloc does not -have to do as much accounting as malloc(); all it does in -the typical case is to round up the size, bump a pointer, and do a -range check.

    - -(It also raises the possibility that heavy use of palloc -could cause a server process to grow excessively large. There are -two ways to deal with this, which are dealt with below; briefly, you -can use malloc, and try to be sure that all of the memory -gets explicitly freed, or you can allocate a sub-pool of -the main pool, allocate your memory in the sub-pool, and clear it out -periodically. The latter technique is discussed in the section on -sub-pools below, and is used in the directory-indexing code, in order -to avoid excessive storage allocation when listing directories with -thousands of files). - -

    Allocating initialized memory

    - -There are functions which allocate initialized memory, and are -frequently useful. The function pcalloc has the same -interface as palloc, but clears out the memory it -allocates before it returns it. The function pstrdup -takes a resource pool and a char * as arguments, and -allocates memory for a copy of the string the pointer points to, -returning a pointer to the copy. Finally pstrcat is a -varargs-style function, which takes a pointer to a resource pool, and -at least two char * arguments, the last of which must be -NULL. It allocates enough memory to fit copies of each -of the strings, as a unit; for instance: - -
    -     pstrcat (r->pool, "foo", "/", "bar", NULL);
    -
    - -returns a pointer to 8 bytes worth of memory, initialized to -"foo/bar". - -

    Tracking open files, etc.

    - -As indicated above, resource pools are also used to track other sorts -of resources besides memory. The most common are open files. The -routine which is typically used for this is pfopen, which -takes a resource pool and two strings as arguments; the strings are -the same as the typical arguments to fopen, e.g., - -
    -     ...
    -     FILE *f = pfopen (r->pool, r->filename, "r");
    -
    -     if (f == NULL) { ... } else { ... }
    -
    - -There is also a popenf routine, which parallels the -lower-level open system call. Both of these routines -arrange for the file to be closed when the resource pool in question -is cleared.

    - -Unlike the case for memory, there are functions to close -files allocated with pfopen, and popenf, -namely pfclose and pclosef. (This is -because, on many systems, the number of files which a single process -can have open is quite limited). It is important to use these -functions to close files allocated with pfopen and -popenf, since to do otherwise could cause fatal errors on -systems such as Linux, which react badly if the same -FILE* is closed more than once.

    - -(Using the close functions is not mandatory, since the -file will eventually be closed regardless, but you should consider it -in cases where your module is opening, or could open, a lot of files). - -

    Other sorts of resources --- cleanup functions

    - -More text goes here. Describe the the cleanup primitives in terms of -which the file stuff is implemented; also, spawn_process. - -

    Fine control --- creating and dealing with sub-pools, with a note -on sub-requests

    - -On rare occasions, too-free use of palloc() and the -associated primitives may result in undesirably profligate resource -allocation. You can deal with such a case by creating a -sub-pool, allocating within the sub-pool rather than the main -pool, and clearing or destroying the sub-pool, which releases the -resources which were associated with it. (This really is a -rare situation; the only case in which it comes up in the standard -module set is in case of listing directories, and then only with -very large directories. Unnecessary use of the primitives -discussed here can hair up your code quite a bit, with very little -gain).

    - -The primitive for creating a sub-pool is make_sub_pool, -which takes another pool (the parent pool) as an argument. When the -main pool is cleared, the sub-pool will be destroyed. The sub-pool -may also be cleared or destroyed at any time, by calling the functions -clear_pool and destroy_pool, respectively. -(The difference is that clear_pool frees resources -associated with the pool, while destroy_pool also -deallocates the pool itself. In the former case, you can allocate new -resources within the pool, and clear it again, and so forth; in the -latter case, it is simply gone).

    - -One final note --- sub-requests have their own resource pools, which -are sub-pools of the resource pool for the main request. The polite -way to reclaim the resources associated with a sub request which you -have allocated (using the sub_req_lookup_... functions) -is destroy_sub_request, which frees the resource pool. -Before calling this function, be sure to copy anything that you care -about which might be allocated in the sub-request's resource pool into -someplace a little less volatile (for instance, the filename in its -request_rec structure).

    - -(Again, under most circumstances, you shouldn't feel obliged to call -this function; only 2K of memory or so are allocated for a typical sub -request, and it will be freed anyway when the main request pool is -cleared. It is only when you are allocating many, many sub-requests -for a single main request that you should seriously consider the -destroy... functions). - -

    Configuration, commands and the like

    - -One of the design goals for this server was to maintain external -compatibility with the NCSA 1.3 server --- that is, to read the same -configuration files, to process all the directives therein correctly, -and in general to be a drop-in replacement for NCSA. On the other -hand, another design goal was to move as much of the server's -functionality into modules which have as little as possible to do with -the monolithic server core. The only way to reconcile these goals is -to move the handling of most commands from the central server into the -modules.

    - -However, just giving the modules command tables is not enough to -divorce them completely from the server core. The server has to -remember the commands in order to act on them later. That involves -maintaining data which is private to the modules, and which can be -either per-server, or per-directory. Most things are per-directory, -including in particular access control and authorization information, -but also information on how to determine file types from suffixes, -which can be modified by AddType and -DefaultType directives, and so forth. In general, the -governing philosophy is that anything which can be made -configurable by directory should be; per-server information is -generally used in the standard set of modules for information like -Aliases and Redirects which come into play -before the request is tied to a particular place in the underlying -file system.

    - -Another requirement for emulating the NCSA server is being able to -handle the per-directory configuration files, generally called -.htaccess files, though even in the NCSA server they can -contain directives which have nothing at all to do with access -control. Accordingly, after URI -> filename translation, but before -performing any other phase, the server walks down the directory -hierarchy of the underlying filesystem, following the translated -pathname, to read any .htaccess files which might be -present. The information which is read in then has to be -merged with the applicable information from the server's own -config files (either from the <Directory> sections -in access.conf, or from defaults in -srm.conf, which actually behaves for most purposes almost -exactly like <Directory />).

    - -Finally, after having served a request which involved reading -.htaccess files, we need to discard the storage allocated -for handling them. That is solved the same way it is solved wherever -else similar problems come up, by tying those structures to the -per-transaction resource pool.

    - -

    Per-directory configuration structures

    - -Let's look out how all of this plays out in mod_mime.c, -which defines the file typing handler which emulates the NCSA server's -behavior of determining file types from suffixes. What we'll be -looking at, here, is the code which implements the -AddType and AddEncoding commands. These -commands can appear in .htaccess files, so they must be -handled in the module's private per-directory data, which in fact, -consists of two separate tables for MIME types and -encoding information, and is declared as follows: - -
    -typedef struct {
    -    table *forced_types;      /* Additional AddTyped stuff */
    -    table *encoding_types;    /* Added with AddEncoding... */
    -} mime_dir_config;
    -
    - -When the server is reading a configuration file, or -<Directory> section, which includes one of the MIME -module's commands, it needs to create a mime_dir_config -structure, so those commands have something to act on. It does this -by invoking the function it finds in the module's `create per-dir -config slot', with two arguments: the name of the directory to which -this configuration information applies (or NULL for -srm.conf), and a pointer to a resource pool in which the -allocation should happen.

    - -(If we are reading a .htaccess file, that resource pool -is the per-request resource pool for the request; otherwise it is a -resource pool which is used for configuration data, and cleared on -restarts. Either way, it is important for the structure being created -to vanish when the pool is cleared, by registering a cleanup on the -pool if necessary).

    - -For the MIME module, the per-dir config creation function just -pallocs the structure above, and a creates a couple of -tables to fill it. That looks like this: - -

    -void *create_mime_dir_config (pool *p, char *dummy)
    -{
    -    mime_dir_config *new =
    -      (mime_dir_config *) palloc (p, sizeof(mime_dir_config));
    -
    -    new->forced_types = make_table (p, 4);
    -    new->encoding_types = make_table (p, 4);
    -    
    -    return new;
    -}
    -
    - -Now, suppose we've just read in a .htaccess file. We -already have the per-directory configuration structure for the next -directory up in the hierarchy. If the .htaccess file we -just read in didn't have any AddType or -AddEncoding commands, its per-directory config structure -for the MIME module is still valid, and we can just use it. -Otherwise, we need to merge the two structures somehow.

    - -To do that, the server invokes the module's per-directory config merge -function, if one is present. That function takes three arguments: -the two structures being merged, and a resource pool in which to -allocate the result. For the MIME module, all that needs to be done -is overlay the tables from the new per-directory config structure with -those from the parent: - -

    -void *merge_mime_dir_configs (pool *p, void *parent_dirv, void *subdirv)
    -{
    -    mime_dir_config *parent_dir = (mime_dir_config *)parent_dirv;
    -    mime_dir_config *subdir = (mime_dir_config *)subdirv;
    -    mime_dir_config *new =
    -      (mime_dir_config *)palloc (p, sizeof(mime_dir_config));
    -
    -    new->forced_types = overlay_tables (p, subdir->forced_types,
    -                                        parent_dir->forced_types);
    -    new->encoding_types = overlay_tables (p, subdir->encoding_types,
    -                                          parent_dir->encoding_types);
    -
    -    return new;
    -}
    -
    - -As a note --- if there is no per-directory merge function present, the -server will just use the subdirectory's configuration info, and ignore -the parent's. For some modules, that works just fine (e.g., for the -includes module, whose per-directory configuration information -consists solely of the state of the XBITHACK), and for -those modules, you can just not declare one, and leave the -corresponding structure slot in the module itself NULL.

    - -

    Command handling

    - -Now that we have these structures, we need to be able to figure out -how to fill them. That involves processing the actual -AddType and AddEncoding commands. To find -commands, the server looks in the module's command table. -That table contains information on how many arguments the commands -take, and in what formats, where it is permitted, and so forth. That -information is sufficient to allow the server to invoke most -command-handling functions with pre-parsed arguments. Without further -ado, let's look at the AddType command handler, which -looks like this (the AddEncoding command looks basically -the same, and won't be shown here): - -
    -char *add_type(cmd_parms *cmd, mime_dir_config *m, char *ct, char *ext)
    -{
    -    if (*ext == '.') ++ext;
    -    table_set (m->forced_types, ext, ct);
    -    return NULL;
    -}
    -
    - -This command handler is unusually simple. As you can see, it takes -four arguments, two of which are pre-parsed arguments, the third being -the per-directory configuration structure for the module in question, -and the fourth being a pointer to a cmd_parms structure. -That structure contains a bunch of arguments which are frequently of -use to some, but not all, commands, including a resource pool (from -which memory can be allocated, and to which cleanups should be tied), -and the (virtual) server being configured, from which the module's -per-server configuration data can be obtained if required.

    - -Another way in which this particular command handler is unusually -simple is that there are no error conditions which it can encounter. -If there were, it could return an error message instead of -NULL; this causes an error to be printed out on the -server's stderr, followed by a quick exit, if it is in -the main config files; for a .htaccess file, the syntax -error is logged in the server error log (along with an indication of -where it came from), and the request is bounced with a server error -response (HTTP error status, code 500).

    - -The MIME module's command table has entries for these commands, which -look like this: - -

    -command_rec mime_cmds[] = {
    -{ "AddType", add_type, NULL, OR_FILEINFO, TAKE2, 
    -    "a mime type followed by a file extension" },
    -{ "AddEncoding", add_encoding, NULL, OR_FILEINFO, TAKE2, 
    -    "an encoding (e.g., gzip), followed by a file extension" },
    -{ NULL }
    -};
    -
    - -The entries in these tables are: - -
      -
    • The name of the command -
    • The function which handles it -
    • a (void *) pointer, which is passed in the - cmd_parms structure to the command handler --- - this is useful in case many similar commands are handled by the - same function. -
    • A bit mask indicating where the command may appear. There are - mask bits corresponding to each AllowOverride - option, and an additional mask bit, RSRC_CONF, - indicating that the command may appear in the server's own - config files, but not in any .htaccess - file. -
    • A flag indicating how many arguments the command handler wants - pre-parsed, and how they should be passed in. - TAKE2 indicates two pre-parsed arguments. Other - options are TAKE1, which indicates one pre-parsed - argument, FLAG, which indicates that the argument - should be On or Off, and is passed in - as a boolean flag, RAW_ARGS, which causes the - server to give the command the raw, unparsed arguments - (everything but the command name itself). There is also - ITERATE, which means that the handler looks the - same as TAKE1, but that if multiple arguments are - present, it should be called multiple times, and finally - ITERATE2, which indicates that the command handler - looks like a TAKE2, but if more arguments are - present, then it should be called multiple times, holding the - first argument constant. -
    • Finally, we have a string which describes the arguments that - should be present. If the arguments in the actual config file - are not as required, this string will be used to help give a - more specific error message. (You can safely leave this - NULL). -
    - -Finally, having set this all up, we have to use it. This is -ultimately done in the module's handlers, specifically for its -file-typing handler, which looks more or less like this; note that the -per-directory configuration structure is extracted from the -request_rec's per-directory configuration vector by using -the get_module_config function. - -
    -int find_ct(request_rec *r)
    -{
    -    int i;
    -    char *fn = pstrdup (r->pool, r->filename);
    -    mime_dir_config *conf = (mime_dir_config *)
    -             get_module_config(r->per_dir_config, &mime_module);
    -    char *type;
    -
    -    if (S_ISDIR(r->finfo.st_mode)) {
    -        r->content_type = DIR_MAGIC_TYPE;
    -        return OK;
    -    }
    -    
    -    if((i=rind(fn,'.')) < 0) return DECLINED;
    -    ++i;
    -
    -    if ((type = table_get (conf->encoding_types, &fn[i])))
    -    {
    -        r->content_encoding = type;
    -
    -        /* go back to previous extension to try to use it as a type */
    -
    -        fn[i-1] = '\0';
    -        if((i=rind(fn,'.')) < 0) return OK;
    -        ++i;
    -    }
    -
    -    if ((type = table_get (conf->forced_types, &fn[i])))
    -    {
    -        r->content_type = type;
    -    }
    -    
    -    return OK;
    -}
    -
    -
    - -

    Side notes --- per-server configuration, virtual servers, etc.

    - -The basic ideas behind per-server module configuration are basically -the same as those for per-directory configuration; there is a creation -function and a merge function, the latter being invoked where a -virtual server has partially overridden the base server configuration, -and a combined structure must be computed. (As with per-directory -configuration, the default if no merge function is specified, and a -module is configured in some virtual server, is that the base -configuration is simply ignored).

    - -The only substantial difference is that when a command needs to -configure the per-server private module data, it needs to go to the -cmd_parms data to get at it. Here's an example, from the -alias module, which also indicates how a syntax error can be returned -(note that the per-directory configuration argument to the command -handler is declared as a dummy, since the module doesn't actually have -per-directory config data): - -

    -char *add_redirect(cmd_parms *cmd, void *dummy, char *f, char *url)
    -{
    -    server_rec *s = cmd->server;
    -    alias_server_conf *conf = (alias_server_conf *)
    -            get_module_config(s->module_config,&alias_module);
    -    alias_entry *new = push_array (conf->redirects);
    -
    -    if (!is_url (url)) return "Redirect to non-URL";
    -    
    -    new->fake = f; new->real = url;
    -    return NULL;
    -}
    -
    - - - diff --git a/docs/manual/developer/debugging.html b/docs/manual/developer/debugging.html deleted file mode 100644 index 2cb210f7326739616cc04360342fde2c25393494..0000000000000000000000000000000000000000 --- a/docs/manual/developer/debugging.html +++ /dev/null @@ -1,175 +0,0 @@ - - - -Debugging Memory Allocation in APR - - - - - -

    Debugging Memory Allocation in APR

    - -

    The allocation mechanism's within APR have a number of debugging -modes that can be used to assist in finding memory problems. This document describes -the modes available and gives instructions on activating them.

    - - - -
    - -

    Allocation Debugging

    - -

    ALLOC_DEBUG

    -

    Debugging support: Define this to enable code which helps detect re-use of freed memory and other such nonsense.

    - -

    The theory is simple. The FILL_BYTE (0xa5) is written over all malloc'd memory as we receive it, and is written over everything that we free up during a clear_pool. We check that blocks on the free list always have the FILL_BYTE in them, and we check during palloc() that the bytes still have FILL_BYTE in them. If you ever see garbage URLs or whatnot containing lots of 0xa5s then you know something used data that's been freed or uninitialized.

    - -

    Malloc Support

    -

    ALLOC_USE_MALLOC

    -

    If defined all allocations will be done with malloc and free()d appropriately at the end. -

    - -

    This is intended to be used with something like Electric Fence or Purify to help detect memory problems. Note that if you're using efence then you should also add in ALLOC_DEBUG. But don't add in ALLOC_DEBUG if you're using Purify because ALLOC_DEBUG would hide all the uninitialized read errors that Purify can diagnose.

    - -

    Pool Debugging

    -

    POOL_DEBUG

    -

    This is intended to detect cases where the wrong pool is used when assigning data to an object in another pool.

    - -

    In particular, it causes the table_{set,add,merge}n routines to check that their arguments are safe for the ap_table_t they're being placed in. It currently only works with the unix multiprocess model, but could be extended to others.

    - -

    Table Debugging

    -

    MAKE_TABLE_PROFILE

    -

    Provide diagnostic information about make_table() calls which are possibly too small.

    - -

    This requires a recent gcc which supports __builtin_return_address(). The error_log output will be a message such as:

    -
    table_push: ap_table_t created by 0x804d874 hit limit of 10
    -

    Use "l *0x804d874" to find the source that corresponds to. It - indicates that a ap_table_t allocated by a call at that address has possibly too small an initial ap_table_t size guess.

    - -

    Allocation Statistics

    -

    ALLOC_STATS

    -

    Provide some statistics on the cost of allocations.

    - -

    This requires a bit of an understanding of how alloc.c works.

    - -
    - -
    -

    Allowable Combinations

    - -

    Not all the options outlined above can be activated at the same time. the following table gives more information.

    - -

    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    Option 1ALLOC
    DEBUG
    ALLOC
    USE
    MALLOC
    POOL
    DEBUG
    MAKE
    TABLE
    PROFILE
    ALLOC
    STATS
    ALLOC_DEBUG NoYesYesYes
    ALLOC_USE
    MALLOC
    No NoNoNo
    POOL_DEBUGYesNo YesYes
    MAKE_TABLE
    PROFILE
    YesNoYes Yes
    ALLOC_STATSYesNoYesYes 
    - -

    Additionally the debugging options are not suitable for multi-threaded versions of the server. When trying to debug with these options the server should be started in single process mode.

    - -
    - -
    -

    Activating Debugging Options

    -

    The various options for debugging memory are now enabled in the apr_general.h header file in APR. The various options are enabled by uncommenting the define for the option you wish to use. The section of the code currently looks like this (contained in src/lib/apr/inclide/apr_general.h)

    - -
    -/*
    -#define ALLOC_DEBUG
    -#define POOL_DEBUG
    -#define ALLOC_USE_MALLOC
    -#define MAKE_TABLE_PROFILE
    -#define ALLOC_STATS
    -*/
    -
    -typedef struct ap_pool_t {
    -    union block_hdr *first;
    -    union block_hdr *last;
    -    struct cleanup *cleanups;
    -    struct process_chain *subprocesses;
    -    struct ap_pool_t *sub_pools;
    -    struct ap_pool_t *sub_next;
    -    struct ap_pool_t *sub_prev;
    -    struct ap_pool_t *parent;
    -    char *free_first_avail;
    -#ifdef ALLOC_USE_MALLOC
    -    void *allocation_list;
    -#endif
    -#ifdef POOL_DEBUG
    -    struct ap_pool_t *joined;
    -#endif
    -    int (*apr_abort)(int retcode);
    -    struct datastruct *prog_data;
    -}ap_pool_t;
    -
    - -

    To enable allocation debugging simply move the #define ALLOC_DEBUG above the start of the comments block and rebuild the server.

    - -

    NB. In order to use the various options the server MUST be rebuilt after editing the header file. -

    - - - - - - - - - diff --git a/docs/manual/developer/documenting.html b/docs/manual/developer/documenting.html deleted file mode 100644 index 8f8163f426ef5335d5ff17f6b7e981edc39fa3d9..0000000000000000000000000000000000000000 --- a/docs/manual/developer/documenting.html +++ /dev/null @@ -1,64 +0,0 @@ - - - -Documenting Apache 2.0 - - - - - - -

    Documentating Apache 2.0

    - -

    Apache 2.0 uses DoxyGen to document the API's and global variables in the - the code. This will explain the basics of how to document using DoxyGen. - -

    To start a documentation block, use /**
    - To end a documentation block, use */

    - -

    In the middle of the block, there are multiple tags we can use:

    -
    -    Description of this functions purpose
    -    @param parameter_name description
    -

    - -

    The deffunc is not always necessary. DoxyGen does not have a full parser - in it, so any prototype that use a macro in the return type declaration - is too complex for scandoc. Those functions require a deffunc.

    - -

    An example (using &> rather than >):

    -
    -/**
    - * return the final element of the pathname
    - * @param pathname The path to get the final element of
    - * @return the final element of the path
    - * @tip Examples:
    - * <pre>
    - *                 "/foo/bar/gum"   -&> "gum"
    - *                 "/foo/bar/gum/"  -&> ""
    - *                 "gum"            -&> "gum"
    - *                 "wi\\n32\\stuff" -&> "stuff"
    - * </pre>
    - * @deffunc const char * ap_filename_of_pathname(const char *pathname)
    - */
    -
    - -

    At the top of the header file, always include:

    -
    -/**
    - * @package Name of library header
    - */
    -
    - -

    ScanDoc uses a new html file for each package. The html files are named - {Name_of_library_header}.html, so try to be concise with your names.

    - - - - diff --git a/docs/manual/developer/filters.html b/docs/manual/developer/filters.html deleted file mode 100644 index b8ac610025b52417436dbd4733c88e42ac47c88a..0000000000000000000000000000000000000000 --- a/docs/manual/developer/filters.html +++ /dev/null @@ -1,168 +0,0 @@ - - - - - - - Request Processing in Apache 2.0 - - - - - - -

    How filters work in Apache 2.0

    - -

    Warning - this is a cut 'n paste job from an email: - <022501c1c529$f63a9550$7f00000a@KOJ>

    - -
    -There are three basic filter types (each of these is actually broken
    -down into two categories, but that comes later).
    -
    -CONNECTION:  Filters of this type are valid for the lifetime of this
    -             connection.
    -
    -PROTOCOL:    Filters of this type are valid for the lifetime of this
    -             request from the point of view of the client, this means
    -             that the request is valid from the time that the request
    -             is sent until the time that the response is received.
    -
    -RESOURCE:    Filters of this type are valid for the time that this
    -             content is used to satisfy a request.  For simple
    -             requests, this is identical to PROTOCOL, but internal redirects
    -             and sub-requests can change the content without ending
    -             the request.
    -
    -It is important to make the distinction between a protocol and a
    -resource filter.  A resource filter is tied to a specific resource, it
    -may also be tied to header information, but the main binding is to a
    -resource.  If you are writing a filter and you want to know if it is
    -resource or protocol, the correct question to ask is:  "Can this filter
    -be removed if the request is redirected to a different resource?"  If
    -the answer is yes, then it is a resource filter.  If it is no, then it
    -is most likely a protocol or connection filter.  I won't go into
    -connection filters, because they seem to be well understood.
    -
    -With this definition, a few examples might help:
    -Byterange:  We have coded it to be inserted for all
    -requests, and it is removed if not used.  Because this filter is active
    -at the beginning of all requests, it can not be removed if it is
    -redirected, so this is a protocol filter.
    -
    -http_header:  This filter actually writes the headers to the
    -network.  This is obviously a required filter (except in the asis case
    -which is special and will be dealt with below) and so it is a protocol
    -filter.
    -
    -Deflate:  The administrator configures this filter based on
    -which file has been requested.  If we do an internal redirect from an
    -autoindex page to an index.html page, the deflate filter may be added or
    -removed based on config, so this is a resource filter.
    -
    -The further breakdown of each category into two more filter types is
    -strictly for ordering.  We could remove it, and only allow for one
    -filter type, but the order would tend to be wrong, and we would need to
    -hack things to make it work.  Currently, the RESOURCE filters only have
    -one filter type, but that should change.
    -
    -How are filters inserted?
    -This is actually rather simple in theory, but the code is
    -complex.  First of all, it is important that everybody realize that
    -there are three filter lists for each request, but they are all
    -concatenated together.  So, the first list is r->output_filters, then
    -r->proto_output_filters, and finally r->connection->output_filters.
    -These correspond to the RESOURCE, PROTOCOL, and CONNECTION filters
    -respectively.  The problem previously, was that we used a singly linked
    -list to create the filter stack, and we started from the "correct"
    -location.  This means that if I had a RESOURCE filter on the stack, and
    -I added a CONNECTION filter, the CONNECTION filter would be ignored.
    -This should make sense, because we would insert the connection filter at
    -the top of the c->output_filters list, but the end of r->output_filters
    -pointed to the filter that used to be at the front of c->output_filters.
    -This is obviously wrong.  The new insertion code uses a doubly linked
    -list.  This has the advantage that we never lose a filter that has been
    -inserted.  Unfortunately, it comes with a separate set of headaches.
    -
    -The problem is that we have two different cases were we use subrequests.
    -The first is to insert more data into a response.  The second is to
    -replace the existing response with an internal redirect.  These are two
    -different cases and need to be treated as such.
    -
    -In the first case, we are creating the subrequest from within a handler
    -or filter.  This means that the next filter should be passed to
    -make_sub_request function, and the last resource filter in the
    -sub-request will point to the next filter in the main request.  This
    -makes sense, because the sub-request's data needs to flow through the
    -same set of filters as the main request.  A graphical representation
    -might help:
    -
    -Default_handler --> includes_filter --> byterange --> content_length ->
    -etc
    -
    -If the includes filter creates a sub request, then we don't want the
    -data from that sub-request to go through the includes filter, because it
    -might not be SSI data.  So, the subrequest adds the following:
    -
    -Default_handler --> includes_filter -/-> byterange --> content_length -> etc
    -                                    /
    -Default_handler --> sub_request_core
    -
    -What happens if the subrequest is SSI data?  Well, that's easy, the
    -includes_filter is a resource filter, so it will be added to the sub
    -request in between the Default_handler and the sub_request_core filter.
    -
    -The second case for sub-requests is when one sub-request is going to
    -become the real request.  This happens whenever a sub-request is created
    -outside of a handler or filter, and NULL is passed as the next filter to
    -the make_sub_request function.
    -
    -In this case, the resource filters no longer make sense for the new
    -request, because the resource has changed.  So, instead of starting from
    -scratch, we simply point the front of the resource filters for the
    -sub-request to the front of the protocol filters for the old request.
    -This means that we won't lose any of the protocol filters, neither will
    -we try to send this data through a filter that shouldn't see it.
    -
    -The problem is that we are using a doubly-linked list for our filter
    -stacks now. But, you should notice that it is possible for two lists to
    -intersect in this model.  So, you do you handle the previous pointer?
    -This is a very difficult question to answer, because there is no "right"
    -answer, either method is equally valid.  I looked at why we use the
    -previous pointer.  The only reason for it is to allow for easier
    -addition of new servers.  With that being said, the solution I chose was
    -to make the previous pointer always stay on the original request.
    -
    -This causes some more complex logic, but it works for all cases.  My
    -concern in having it move to the sub-request, is that for the more
    -common case (where a sub-request is used to add data to a response), the
    -main filter chain would be wrong.  That didn't seem like a good idea to
    -me.
    -
    -asis:
    -The final topic.  :-)  Mod_Asis is a bit of a hack, but the
    -handler needs to remove all filters except for connection filters, and
    -send the data.  If you are using mod_asis, all other bets are off.
    -
    -The absolutely last point is that the reason this code was so hard to
    -get right, was because we had hacked so much to force it to work.  I
    -wrote most of the hacks originally, so I am very much to blame.
    -However, now that the code is right, I have started to remove some
    -hacks.  Most people should have seen that the reset_filters and
    -add_required_filters functions are gone.  Those inserted protocol level
    -filters for error conditions, in fact, both functions did the same
    -thing, one after the other, it was really strange.  Because we don't
    -lose protocol filters for error cases any more, those hacks went away.
    -The HTTP_HEADER, Content-length, and Byterange filters are all added in
    -the insert_filters phase, because if they were added earlier, we had
    -some interesting interactions.  Now, those could all be moved to be
    -inserted with the HTTP_IN, CORE, and CORE_IN filters.  That would make
    -the code easier to follow.
    -
    - - - - - diff --git a/docs/manual/developer/hooks.html b/docs/manual/developer/hooks.html deleted file mode 100644 index 39f4e8bad17d817e57c053bf20d1089569ef7cc0..0000000000000000000000000000000000000000 --- a/docs/manual/developer/hooks.html +++ /dev/null @@ -1,202 +0,0 @@ - - - -Apache 2.0 Hook Functions - - - - - -

    Apache Hook Functions

    - -

    In general, a hook function is one that Apache will call at some -point during the processing of a request. Modules can provide -functions that are called, and specify when they get called in -comparison to other modules.

    - -

    Creating a hook function

    - -

    In order to create a new hook, four things need to be done:

    - -

    Declare the hook function

    - -

    Use the DECLARE_HOOK macro, which needs to be given the name of the -hook, the return type of the hook function and the arguments. For -example, if the hook returns an int and takes a -request_rec * and an int and is called -"do_something", then declare it like this:

    - -DECLARE_HOOK(int,do_something,(request_rec *r,int n)) - -

    This should go in a header which modules will include if they want -to use the hook.

    - -

    Create the hook structure

    - -

    Each source file that exports a hook has a private structure which -is used to record the module functions that use the hook. This is -declared as follows:

    - -
    -HOOK_STRUCT(
    -            HOOK_LINK(do_something)
    -            ...
    -           )
    -
    - -

    Implement the hook caller

    - -

    The source file that exports the hook has to implement a function -that will call the hook. There are currently three possible ways to do -this. In all cases, the calling function is called -ap_run_hookname().

    - -

    Void hooks

    - -

    If the return value of a hook is void, then all the hooks are -called, and the caller is implemented like this:

    - -IMPLEMENT_HOOK_VOID(do_something,(request_rec *r,int -n),(r,n)) - -

    The second and third arguments are the dummy argument declaration and -the dummy arguments as they will be used when calling the hook. In -other words, this macro expands to something like this:

    - -
    -void ap_run_do_something(request_rec *r,int n)
    -{
    -    ...
    -    do_something(r,n);
    -}
    -
    - -

    Hooks that return a value

    - -

    If the hook returns a value, then it can either be run until the first -hook that does something interesting, like so:

    - -IMPLEMENT_HOOK_RUN_FIRST(int,do_something,(request_rec *r,int n),(r,n),DECLINED) - -

    The first hook that doesn't return DECLINED stops -the loop and its return value is returned from the hook caller. Note -that DECLINED is the tradition Apache hook return meaning "I -didn't do anything", but it can be whatever suits you.

    - -

    Alternatively, all hooks can be run until an error occurs. This -boils down to permitting two return values, one of which means -"I did something, and it was OK" and the other meaning "I did -nothing". The first function that returns a value other than one of -those two stops the loop, and its return is the return value. Declare -these like so:

    - -IMPLEMENT_HOOK_RUN_ALL(int,do_something,(request_rec *r,int -n),(r,n),OK,DECLINED) - -

    Again, OK and DECLINED are the traditional -values. You can use what you want.

    - -

    Call the hook callers

    - -

    At appropriate moments in the code, call the hook caller, like -so:

    - -
    -    int n,ret;
    -    request_rec *r;
    -
    -    ret=ap_run_do_something(r,n);
    -
    - -

    Hooking the hook

    - -

    A module that wants a hook to be called needs to do two -things.

    - -

    Implement the hook function

    - -

    Include the appropriate header, and define a static function of the -correct type:

    - -
    -static int my_something_doer(request_rec *r,int n)
    -{
    -    ...
    -    return OK;
    -}
    -
    - -

    Add a hook registering function

    - -

    During initialisation, Apache will call each modules hook -registering function, which is included in the module structure:

    - -
    -static void my_register_hooks()
    -{
    -    ap_hook_do_something(my_something_doer,NULL,NULL,HOOK_MIDDLE);
    -}
    -
    -mode MODULE_VAR_EXPORT my_module =
    -{
    -    ...
    -    my_register_hooks       /* register hooks */
    -};
    -
    - -

    Controlling hook calling order

    - -

    In the example above, we didn't use the three arguments in the hook -registration function that control calling order. There are two -mechanisms for doing this. The first, rather crude, method, allows us -to specify roughly where the hook is run relative to other -modules. The final argument control this. There are three possible -values:

    - -
    -HOOK_FIRST
    -HOOK_MIDDLE
    -HOOK_LAST
    -
    - -

    All modules using any particular value may be run in any order -relative to each other, but, of course, all modules using -HOOK_FIRST will be run before HOOK_MIDDLE which are -before HOOK_LAST. Modules that don't care when they are run -should use HOOK_MIDDLE. (I spaced these out so people -could do stuff like HOOK_FIRST-2 to get in slightly earlier, -but is this wise? - Ben)

    - -

    Note that there are two more values, HOOK_REALLY_FIRST and -HOOK_REALLY_LAST. These should only be used by the hook -exporter.

    - -

    The other method allows finer control. When a module knows that it -must be run before (or after) some other modules, it can specify them -by name. The second (third) argument is a NULL-terminated array of -strings consisting of the names of modules that must be run before -(after) the current module. For example, suppose we want "mod_xyz.c" -and "mod_abc.c" to run before we do, then we'd hook as follows:

    - -
    -static void register_hooks()
    -{
    -    static const char * const aszPre[]={ "mod_xyz.c", "mod_abc.c", NULL };
    -
    -    ap_hook_do_something(my_something_doer,aszPre,NULL,HOOK_MIDDLE);
    -}
    -
    - -

    Note that the sort used to achieve this is stable, so ordering set -by HOOK_ORDER is preserved, as far as is -possible.

    - -Ben Laurie, 15th August 1999 - - diff --git a/docs/manual/developer/index.html b/docs/manual/developer/index.html deleted file mode 100644 index a72dd44b2127b34f4685b2287052301e81da2f96..0000000000000000000000000000000000000000 --- a/docs/manual/developer/index.html +++ /dev/null @@ -1,19 +0,0 @@ - - - -Apache-2.0 Developer Documentation - - - -

    Developer Documentation for Apache-2.0

    -

    Apache Hook Functions

    -

    Converting Apache 1.3 Modules to Apache 2.0

    -

    MPM listing

    - - diff --git a/docs/manual/developer/modules.html b/docs/manual/developer/modules.html deleted file mode 100644 index b066223466f59e405fb92ed8510f0c698fd44c83..0000000000000000000000000000000000000000 --- a/docs/manual/developer/modules.html +++ /dev/null @@ -1,200 +0,0 @@ - - - -Converting Modules from Apache 1.3 to Apache 2.0 - - - - - -

    From Apache 1.3 to Apache 2.0
    Modules

    - -

    -This is a first attempt at writing the lessons I learned when trying to convert the mod_mmap_static module to Apache 2.0. It's by no means definitive and probably won't even be correct in some ways, but it's a start. -

    -
    -

    The easier changes... -

    - -

    Cleanup Routines

    -

    -These now need to be of type ap_status_t and return a value of that type. Normally the return value will be APR_SUCCESS unless there is some need to signal an error in the cleanup. Be aware that even though you signal an error not all code yet checks and acts upon the error. -

    - -

    Initialisation Routines

    - -

    -These should now be renamed to better signify where they sit in the overall process. So the name gets a small change from mmap_init to mmap_post_config. The arguments passed have undergone a radical change and now look like -

    -
      -
    • ap_context_t *p,
    • -
    • ap_context_t *plog,
    • -
    • ap_context_t *ptemp,
    • -
    • server_rec *s
    • -
    -

    -Throughout Apache the old pools have been replced by the ap_context_t, though their use remains remarkably similar. -

    - -

    Data Types

    -

    -A lot of the data types have been moved into the APR. This means that some have had a name change, such as the one shown above. The following is a brief list of some of the changes that you are likely to have to make. -

      -
    • pool becomes ap_context_t
    • -
    • table becomes ap_table_t
    • -
    -
    - -

    -The messier changes... -

    -

    Register Hooks

    -

    -The new architecture uses a series of hooks to provide for calling your functions. These you'll need to add to your module by way of a new function, static void register_hooks(void). The function is really reasonably straightforward once you understand what needs to be done. Each function that needs calling at some stage in the processing of a request needs to be registered, handlers do not. There are a number of phases where functions can be added, and for each you can specify with a high degree of control the relative order that the function will be called in. -

    -

    -This is the code that was added to mod_mmap_static -

    -
    -static void register_hooks(void)
    -{
    -    static const char * const aszPre[]={ "http_core.c",NULL };
    -    ap_hook_post_config(mmap_post_config,NULL,NULL,HOOK_MIDDLE);
    -    ap_hook_translate_name(mmap_static_xlat,aszPre,NULL,HOOK_LAST);
    -};
    -
    -

    -This registers 2 functions that need to be called, one in the post_config stage (virtually every module will need this one) and one for the translate_name phase. note that while there are different function names the format of each is identical. So what is the format? -

    -

    -ap_hook_[phase_name](function_name, predecessors, successors, position); -

    -

    -There are 3 hook positions defined... -

    -
      -
    • HOOK_FIRST
    • -
    • HOOK_MIDDLE
    • -
    • HOOK_LAST
    • -
    -

    -To define the position you use the position and then modify it with the predecessors and successors. each of the modifiers can be a list of functions that should be called, either before the function is run (predecessors) or after the function has run (successors). -

    -

    -In the mod_mmap_static case I didn't care about the post_config stage, but the mmap_static_xlat MUST be called after the core module had done it's name translation, hence the use of the aszPre to define a modifier to the position HOOK_LAST. -

    -

    Module Definition

    - -

    -There are now a lot fewer stages to worry about when creating your module definition. The old defintion looked like -

    -
    -module MODULE_VAR_EXPORT [module_name]_module =
    -{
    -    STANDARD_MODULE_STUFF,
    -    /* initializer */
    -    /* dir config creater */
    -    /* dir merger --- default is to override */
    -    /* server config */
    -    /* merge server config */
    -    /* command handlers */
    -    /* handlers */
    -    /* filename translation */
    -    /* check_user_id */
    -    /* check auth */
    -    /* check access */
    -    /* type_checker */
    -    /* fixups */
    -    /* logger */
    -    /* header parser */
    -    /* child_init */
    -    /* child_exit */
    -    /* post read-request */
    -};
    -
    -

    -The new structure is a great deal simpler... -

    -
    -module MODULE_VAR_EXPORT [module_name]_module =
    -{
    -    STANDARD20_MODULE_STUFF,
    -    /* create per-directory config structures */
    -    /* merge per-directory config structures  */
    -    /* create per-server config structures    */
    -    /* merge per-server config structures     */
    -    /* command handlers */
    -    /* handlers */
    -    /* register hooks */
    - };
    -
    -

    -Some of these read directly across, some don't. I'll try to summarise what should be done below. -

    -

    -The stages that read directly across : -

    -
      -
    • -/* dir config creater */ ==> /* create per-directory config structures */ -
    • -
    • -/* server config */ ==> /* create per-server config structures */ -
    • -
    • -/* dir merger */ ==> /* merge per-directory config structures */ -
    • -
    • -/* merge server config */ ==> /* merge per-server config structures */ -
    • -
    • -/* command table */ ==> /* command ap_table_t */ -
    • -
    • -/* handlers */ ==> /* handlers */ -
    • -
    -

    -The remainder of the old functions should be registered as hooks. There are the following hook stages defined so far... -

    - -
      -
    • -ap_hook_post_config (this is where the old _init routines get registered) -
    • -
    • -ap_hook_http_method -
    • -
    • -ap_hook_open_logs -
    • -
    • -ap_hook_auth_checker -
    • -
    • -ap_hook_default_port -
    • -
    • -ap_hook_access_checker -
    • -
    • -ap_hook_process_connection -
    • -
    • -ap_hook_child_init_hook -
    • - - - - - - - - - diff --git a/docs/manual/developer/modules.html.en b/docs/manual/developer/modules.html.en deleted file mode 100644 index b066223466f59e405fb92ed8510f0c698fd44c83..0000000000000000000000000000000000000000 --- a/docs/manual/developer/modules.html.en +++ /dev/null @@ -1,200 +0,0 @@ - - - -Converting Modules from Apache 1.3 to Apache 2.0 - - - - - -

      From Apache 1.3 to Apache 2.0
      Modules

      - -

      -This is a first attempt at writing the lessons I learned when trying to convert the mod_mmap_static module to Apache 2.0. It's by no means definitive and probably won't even be correct in some ways, but it's a start. -

      -
      -

      The easier changes... -

      - -

      Cleanup Routines

      -

      -These now need to be of type ap_status_t and return a value of that type. Normally the return value will be APR_SUCCESS unless there is some need to signal an error in the cleanup. Be aware that even though you signal an error not all code yet checks and acts upon the error. -

      - -

      Initialisation Routines

      - -

      -These should now be renamed to better signify where they sit in the overall process. So the name gets a small change from mmap_init to mmap_post_config. The arguments passed have undergone a radical change and now look like -

      -
        -
      • ap_context_t *p,
      • -
      • ap_context_t *plog,
      • -
      • ap_context_t *ptemp,
      • -
      • server_rec *s
      • -
      -

      -Throughout Apache the old pools have been replced by the ap_context_t, though their use remains remarkably similar. -

      - -

      Data Types

      -

      -A lot of the data types have been moved into the APR. This means that some have had a name change, such as the one shown above. The following is a brief list of some of the changes that you are likely to have to make. -

        -
      • pool becomes ap_context_t
      • -
      • table becomes ap_table_t
      • -
      -
      - -

      -The messier changes... -

      -

      Register Hooks

      -

      -The new architecture uses a series of hooks to provide for calling your functions. These you'll need to add to your module by way of a new function, static void register_hooks(void). The function is really reasonably straightforward once you understand what needs to be done. Each function that needs calling at some stage in the processing of a request needs to be registered, handlers do not. There are a number of phases where functions can be added, and for each you can specify with a high degree of control the relative order that the function will be called in. -

      -

      -This is the code that was added to mod_mmap_static -

      -
      -static void register_hooks(void)
      -{
      -    static const char * const aszPre[]={ "http_core.c",NULL };
      -    ap_hook_post_config(mmap_post_config,NULL,NULL,HOOK_MIDDLE);
      -    ap_hook_translate_name(mmap_static_xlat,aszPre,NULL,HOOK_LAST);
      -};
      -
      -

      -This registers 2 functions that need to be called, one in the post_config stage (virtually every module will need this one) and one for the translate_name phase. note that while there are different function names the format of each is identical. So what is the format? -

      -

      -ap_hook_[phase_name](function_name, predecessors, successors, position); -

      -

      -There are 3 hook positions defined... -

      -
        -
      • HOOK_FIRST
      • -
      • HOOK_MIDDLE
      • -
      • HOOK_LAST
      • -
      -

      -To define the position you use the position and then modify it with the predecessors and successors. each of the modifiers can be a list of functions that should be called, either before the function is run (predecessors) or after the function has run (successors). -

      -

      -In the mod_mmap_static case I didn't care about the post_config stage, but the mmap_static_xlat MUST be called after the core module had done it's name translation, hence the use of the aszPre to define a modifier to the position HOOK_LAST. -

      -

      Module Definition

      - -

      -There are now a lot fewer stages to worry about when creating your module definition. The old defintion looked like -

      -
      -module MODULE_VAR_EXPORT [module_name]_module =
      -{
      -    STANDARD_MODULE_STUFF,
      -    /* initializer */
      -    /* dir config creater */
      -    /* dir merger --- default is to override */
      -    /* server config */
      -    /* merge server config */
      -    /* command handlers */
      -    /* handlers */
      -    /* filename translation */
      -    /* check_user_id */
      -    /* check auth */
      -    /* check access */
      -    /* type_checker */
      -    /* fixups */
      -    /* logger */
      -    /* header parser */
      -    /* child_init */
      -    /* child_exit */
      -    /* post read-request */
      -};
      -
      -

      -The new structure is a great deal simpler... -

      -
      -module MODULE_VAR_EXPORT [module_name]_module =
      -{
      -    STANDARD20_MODULE_STUFF,
      -    /* create per-directory config structures */
      -    /* merge per-directory config structures  */
      -    /* create per-server config structures    */
      -    /* merge per-server config structures     */
      -    /* command handlers */
      -    /* handlers */
      -    /* register hooks */
      - };
      -
      -

      -Some of these read directly across, some don't. I'll try to summarise what should be done below. -

      -

      -The stages that read directly across : -

      -
        -
      • -/* dir config creater */ ==> /* create per-directory config structures */ -
      • -
      • -/* server config */ ==> /* create per-server config structures */ -
      • -
      • -/* dir merger */ ==> /* merge per-directory config structures */ -
      • -
      • -/* merge server config */ ==> /* merge per-server config structures */ -
      • -
      • -/* command table */ ==> /* command ap_table_t */ -
      • -
      • -/* handlers */ ==> /* handlers */ -
      • -
      -

      -The remainder of the old functions should be registered as hooks. There are the following hook stages defined so far... -

      - -
        -
      • -ap_hook_post_config (this is where the old _init routines get registered) -
      • -
      • -ap_hook_http_method -
      • -
      • -ap_hook_open_logs -
      • -
      • -ap_hook_auth_checker -
      • -
      • -ap_hook_default_port -
      • -
      • -ap_hook_access_checker -
      • -
      • -ap_hook_process_connection -
      • -
      • -ap_hook_child_init_hook -
      • - - - - - - - - - diff --git a/docs/manual/developer/request.html b/docs/manual/developer/request.html deleted file mode 100644 index 6becc938a4edfe14307d54bb7c0b8e3fdf226eed..0000000000000000000000000000000000000000 --- a/docs/manual/developer/request.html +++ /dev/null @@ -1,217 +0,0 @@ - - - -Request Processing in Apache 2.0 - - - - - - - -

        Request Processing in Apache 2.0

        - -

        Warning - this is a first (fast) draft that needs further revision!

        - -

        Several changes in Apache 2.0 affect the internal request processing - mechanics. Module authors need to be aware of these changes so they - may take advantage of the optimizations and security enhancements.

        - -

        The first major change is to the subrequest and redirect mechanisms. - There were a number of different code paths in Apache 1.3 to attempt - to optimize subrequest or redirect behavior. As patches were introduced - to 2.0, these optimizations (and the server behavior) were quickly broken - due to this duplication of code. All duplicate code has been folded - back into ap_process_internal_request() to prevent the - code from falling out of sync again.

        - -

        This means that much of the existing code was 'unoptimized'. It is - the Apache HTTP Project's first goal to create a robust and correct - implementation of the HTTP server RFC. Additional goals include - security, scalability and optimization. New methods were sought to - optimize the server (beyond the performance of Apache 1.3) without - introducing fragile or insecure code.

        - -

        The Request Processing Cycle

        - -

        All requests pass through ap_process_request_internal() - in request.c, including subrequests and redirects. If a module doesn't - pass generated requests through this code, the author is cautioned that - the module may be broken by future changes to request processing.

        - -

        To streamline requests, the module author can take advantage of the - hooks offered to drop out of the request cycle early, or to bypass - core Apache hooks which are irrelevant (and costly in terms of CPU.)

        - -

        The Request Parsing Phase

        - -

        Unescapes the URL

        - -

        The request's parsed_uri path is unescaped, once and only once, at the - beginning of internal request processing.

        - -

        This step is bypassed if the proxyreq flag is set, or the parsed_uri.path - element is unset. The module has no further control of this one-time - unescape operation, either failing to unescape or multiply unescaping - the URL leads to security reprecussions.

        - -

        Strips Parent and This Elements from the URI

        - -

        All /../ and /./ elements are removed by - ap_getparents(). This helps to ensure the path is (nearly) - absolute before the request processing continues.

        - -

        This step cannot be bypassed.

        - -

        Initial URI Location Walk

        - -

        Every request is subject to an ap_location_walk() call. - This ensures that <Location > sections are consistently enforced for - all requests. If the request is an internal redirect or a sub-request, - it may borrow some or all of the processing from the previous or parent - request's ap_location_walk, so this step is generally very efficient - after processing the main request.

        - -

        Hook: translate_name

        - -

        Modules can determine the file name, or alter the given URI in this step. - For example, mod_vhost_alias will translate the URI's path into the - configured virtual host, mod_alias will translate the path to an alias - path, and if the request falls back on the core, the DocumentRoot is - prepended to the request resource. - -

        If all modules DECLINE this phase, an error 500 is returned to the browser, - and a "couldn't translate name" error is logged automatically.

        - -

        Hook: map_to_storage

        - -

        After the file or correct URI was determined, the appropriate per-dir - configurations are merged together. For example, mod_proxy compares - and merges the appropriate <Proxy > sections. If the URI is nothing - more than a local (non-proxy) TRACE request, the core handles the - request and returns DONE. If no module answers this hook with OK or - DONE, the core will run the request filename against the <Directory > - and <Files > sections. If the request 'filename' isn't an absolute, - legal filename, a note is set for later termination.

        - -

        Initial URI Location Walk

        - -

        Every request is hardened by a second ap_location_walk() - call. This reassures that a translated request is still subjected to - the configured <Location > sections. The request again borrows - some or all of the processing from it's previous location_walk above, - so this step is almost always very efficient unless the translated URI - mapped to a substantially different path or Virtual Host.

        - -

        Hook: header_parser

        - -

        The main request then parses the client's headers. This prepares -the remaining request processing steps to better serve the client's -request.

        - -

        The Security Phase

        - -

        Needs Documentation. Code is;

        -
        -    switch (ap_satisfies(r)) {
        -    case SATISFY_ALL:
        -    case SATISFY_NOSPEC:
        -        if ((access_status = ap_run_access_checker(r)) != 0) {
        -            return decl_die(access_status, "check access", r);
        -        }
        -        if (ap_some_auth_required(r)) {
        -            if (((access_status = ap_run_check_user_id(r)) != 0) || !ap_auth_type(r)) {
        -                return decl_die(access_status, ap_auth_type(r)
        -		            ? "check user.  No user file?"
        -		            : "perform authentication. AuthType not set!", r);
        -            }
        -            if (((access_status = ap_run_auth_checker(r)) != 0) || !ap_auth_type(r)) {
        -                return decl_die(access_status, ap_auth_type(r)
        -		            ? "check access.  No groups file?"
        -		            : "perform authentication. AuthType not set!", r);
        -            }
        -        }
        -        break;
        -    case SATISFY_ANY:
        -        if (((access_status = ap_run_access_checker(r)) != 0) || !ap_auth_type(r)) {
        -            if (!ap_some_auth_required(r)) {
        -                return decl_die(access_status, ap_auth_type(r)
        -		            ? "check access"
        -		            : "perform authentication. AuthType not set!", r);
        -            }
        -            if (((access_status = ap_run_check_user_id(r)) != 0) || !ap_auth_type(r)) {
        -                return decl_die(access_status, ap_auth_type(r)
        -		            ? "check user.  No user file?"
        -		            : "perform authentication. AuthType not set!", r);
        -            }
        -            if (((access_status = ap_run_auth_checker(r)) != 0) || !ap_auth_type(r)) {
        -                return decl_die(access_status, ap_auth_type(r)
        -		            ? "check access.  No groups file?"
        -		            : "perform authentication. AuthType not set!", r);
        -            }
        -	        }
        -        break;
        -    }
        -
        -

        The Preparation Phase

        - -

        Hook: type_checker

        - -

        The modules have an opportunity to test the URI or filename against - the target resource, and set mime information for the request. Both - mod_mime and mod_mime_magic use this phase to compare the file name - or contents against the administrator's configuration and set the - content type, language, character set and request handler. Some - modules may set up their filters or other request handling parameters - at this time.

        - -

        If all modules DECLINE this phase, an error 500 is returned to the browser, - and a "couldn't find types" error is logged automatically.

        - -

        Hook: fixups

        - -

        Many modules are 'trounced' by some phase above. The fixups phase is - used by modules to 'reassert' their ownership or force the request's - fields to their appropriate values. It isn't always the cleanest - mechanism, but occasionally it's the only option.

        - -

        Hook: insert_filter

        - -

        Modules that transform the content in some way can insert their values - and override existing filters, such that if the user configured a more - advanced filter out-of-order, then the module can move it's order as - need be. - -

        The Handler Phase

        - -

        This phase is not part of the processing in - ap_process_request_internal(). Many modules prepare one - or more subrequests prior to creating any content at all. After the - core, or a module calls ap_process_request_internal() it - then calls ap_invoke_handler() to generate the request.

        - -

        Hook: handler

        - -

        The module finally has a chance to serve the request in it's handler - hook. Note that not every prepared request is sent to the handler - hook. Many modules, such as mod_autoindex, will create subrequests - for a given URI, and then never serve the subrequest, but simply - lists it for the user. Remember not to put required teardown from - the hooks above into this module, but register pool cleanups against - the request pool to free resources as required.

        - - - - - - - - - - diff --git a/docs/manual/dns-caveats.html b/docs/manual/dns-caveats.html deleted file mode 100644 index e535a36187a08d8feb6f2b2baa17279e5a25ba47..0000000000000000000000000000000000000000 --- a/docs/manual/dns-caveats.html +++ /dev/null @@ -1,190 +0,0 @@ - - -Issues Regarding DNS and Apache - - - -

        Issues Regarding DNS and Apache

        - -

        This page could be summarized with the statement: don't require -Apache to use DNS for any parsing of the configuration files. -If Apache has to use DNS to parse the configuration files then your -server may be subject to reliability problems (it might not boot), or -denial and theft of service attacks (including users able to steal hits -from other users). - -

        A Simple Example

        - -Consider this configuration snippet: - -
        -    <VirtualHost www.abc.dom>
        -    ServerAdmin webgirl@abc.dom
        -    DocumentRoot /www/abc
        -    </VirtualHost>
        -
        - -

        In order for Apache to function properly it absolutely needs -to have two pieces of information about each virtual host: the -ServerName -and at least one ip address that the server -responds to. This example does not include the ip address, so Apache -must use DNS to find the address of www.abc.dom. If for -some reason DNS is not available at the time your server is parsing its -config file, then this virtual host will not be configured. It -won't be able to respond to any hits to this virtual host (prior to -Apache version 1.2 the server would not even boot). - -

        Suppose that www.abc.dom has address 10.0.0.1. Then -consider this configuration snippet: - -

        -    <VirtualHost 10.0.0.1>
        -    ServerAdmin webgirl@abc.dom
        -    DocumentRoot /www/abc
        -    </VirtualHost>
        -
        - -

        Now Apache needs to use reverse DNS to find the ServerName -for this virtualhost. If that reverse lookup fails then it will partially -disable the virtualhost (prior to Apache version 1.2 the server would not -even boot). If the virtual host is name-based then it will effectively -be totally disabled, but if it is ip-based then it will mostly work. -However if Apache should ever have to generate a full URL for the server -which includes the server name then it will fail to generate a valid URL. - -

        Here is a snippet that avoids both of these problems. - -

        -    <VirtualHost 10.0.0.1>
        -    ServerName www.abc.dom
        -    ServerAdmin webgirl@abc.dom
        -    DocumentRoot /www/abc
        -    </VirtualHost>
        -
        - -

        Denial of Service

        - -

        There are (at least) two forms that denial of service can come in. -If you are running a version of Apache prior to version 1.2 then your -server will not even boot if one of the two DNS lookups mentioned above -fails for any of your virtual hosts. In some cases this DNS lookup may -not even be under your control. For example, if abc.dom -is one of your customers and they control their own DNS then they -can force your (pre-1.2) server to fail while booting simply by deleting the -www.abc.dom record. - -

        Another form is far more insidious. Consider this configuration -snippet: - -

        -    <VirtualHost www.abc.dom>
        -    ServerAdmin webgirl@abc.dom
        -    DocumentRoot /www/abc
        -    </VirtualHost>
        -
        - -
        -    <VirtualHost www.def.dom>
        -    ServerAdmin webguy@def.dom
        -    DocumentRoot /www/def
        -    </VirtualHost>
        -
        - -

        Suppose that you've assigned 10.0.0.1 to www.abc.dom and -10.0.0.2 to www.def.dom. Furthermore, suppose that -def.com has control of their own DNS. With this config -you have put def.com into a position where they can steal -all traffic destined to abc.com. To do so, all they have to -do is set www.def.dom to 10.0.0.1. -Since they control their own DNS you can't stop them from pointing the -www.def.com record wherever they wish. - -

        Requests coming in to 10.0.0.1 (including all those where users typed -in URLs of the form http://www.abc.dom/whatever) will all be -served by the def.com virtual host. To better understand why -this happens requires a more in-depth discussion of how Apache matches -up incoming requests with the virtual host that will serve it. A rough -document describing this is available. - -

        The "main server" Address

        - -

        The addition of non-IP-based virtual host -support in Apache 1.1 requires Apache to know the IP address(es) of -the host that httpd is running on. To get this address it uses either -the global ServerName (if present) or calls the C function -gethostname (which should return the same as typing -"hostname" at the command prompt). Then it performs a DNS lookup on -this address. At present there is no way to avoid this lookup. - -

        If you fear that this lookup might fail because your DNS server is down -then you can insert the hostname in /etc/hosts (where you -probably already have it so that the machine can boot properly). Then -ensure that your machine is configured to use /etc/hosts -in the event that DNS fails. Depending on what OS you are using this -might be accomplished by editing /etc/resolv.conf, or maybe -/etc/nsswitch.conf. - -

        If your server doesn't have to perform DNS for any other reason -then you might be able to get away with running Apache with the -HOSTRESORDER environment variable set to "local". This all -depends on what OS and resolver libraries you are using. It also affects -CGIs unless you use mod_env -to control the environment. It's best to consult the man pages or FAQs -for your OS. - -

        The _default_ Address

        - -

        Any address that happens to go to your webserver which doesn't match -the ip address of any of the webservers will be served from the "main" or -"default" server configurations. The "main" server configuration consists -of all those definitions appearing outside of any VirtualHost section. -You may want instead to define a <VirtualHost _default> -which returns 403 or 404 for all hits. - -

        Tips to Avoid these problems

        - -
          -
        • use ip addresses in <VirtualHost> -
        • use ip addresses in Listen -
        • use ip addresses in BindAddress -
        • ensure all virtual hosts have an explicit ServerName -
        • create a <VirtualHost _default_> server that - has no pages to serve -
        - -

        Appendix: Future Directions

        - -

        The situation regarding DNS is highly undesirable. For Apache -1.2 we've attempted to make the server at least continue booting -in the event of failed DNS, but it might not be the best we -can do. In any event requiring the use of explicit ip addresses in -configuration files is highly undesirable in today's Internet where renumbering - is a necessity. - -

        A possible work around to the theft of service attack described above -would be to perform a reverse DNS lookup on the ip address returned by -the forward lookup and compare the two names. In the event of a mismatch -the virtualhost would be disabled. This would require reverse DNS to be -configured properly (which is something that most admins are familiar with -because of the common use of "double-reverse" DNS lookups by FTP servers -and TCP wrappers). - -

        In any event it doesn't seem possible to reliably boot a virtual-hosted -web server when DNS has failed unless IP addresses are used. Partial -solutions such as disabling portions of the configuration might be worse -than not booting at all depending on what the webserver is supposed -to accomplish. - -

        As HTTP/1.1 is deployed and browsers and proxies start issuing the -Host header it will become possible to avoid the use of -ip-based virtual hosts entirely. In this event a webserver has no requirement -to do DNS lookups during configuration. But as of March 1997 these -features have not been deployed widely enough to be put into use on -critical webservers. - - - - - diff --git a/docs/manual/dso.html b/docs/manual/dso.html deleted file mode 100644 index ecaf33f90fc1c27bb0690cc88fc43c3a29c8add8..0000000000000000000000000000000000000000 --- a/docs/manual/dso.html +++ /dev/null @@ -1,337 +0,0 @@ - - -Apache 1.3 Dynamic Shared Object (DSO) support - - - - - - -

        Apache 1.3 Dynamic Shared Object (DSO) support

        - -


        - -

        Originally written by Ralf S. Engelschall, April 1998
        - -

        Background

        - -

        On modern Unix derivatives there exists a nifty mechanism usually - called dynamic linking/loading of Dynamic Shared Objects (DSO) which - provides a way to build a piece of program code in a special format - for loading it at run-time into the address space of an executable - program. - -

        This loading can usually be done in two ways: Automatically by a - system program called ld.so when an executable program - is started or manually from within the executing program via a - programmatic system interface to the Unix loader through the system - calls dlopen()/dlsym(). - -

        In the first way the DSO's are usually called "shared libraries" or - "DSO libraries" and named libfoo.so or - libfoo.so.1.2. They reside in a system directory - (usually /usr/lib) and the link to the executable - program is established at link-time by specifying -lfoo - to the linker command. This hardcodes library references into the - executable program file so that at start-time the Unix loader is able - to locate libfoo.so in /usr/lib or in paths - configured via the environment variable - LD_LIBRARY_PATH. It then resolves any (yet unresolved) - symbols in the executable program which are available in the DSO. - -

        Symbols in the executable program are usually not referenced by the - DSO (because it's a reuseable library of general code) and hence no - further resolving has to be done. The executable program has no need - to do anything on its own to use the symbols from the DSO because the - complete resolving is done by the Unix loader. (In fact, the code to - invoke ld.so is part of the run-time startup code which - is linked into every executable program which has been bound - non-static). The advantage of dynamic loading of common library code - is obvious: the library code needs to be stored only once, in a - system library like libc.so, saving disk space for every - program. - -

        In the second way the DSO's are usually called "shared objects" or - "DSO files" and can be named with an arbitrary extension (although - the canonical name is foo.so). These files usually stay - inside a program-specific directory and there is no automatically - established link to the executable program where they are - used. Instead the executable program manually loads the DSO at - run-time into its address space via dlopen(). At this - time no resolving of symbols from the DSO for the executable program - is done. But instead the Unix loader automatically resolves any (yet - unresolved) symbols in the DSO from the set of symbols exported by - the executable program and its already loaded DSO libraries - (especially all symbols from the ubiquitous libc.so). - This way the DSO gets knowledge of the executable program's symbol - set as if it had been statically linked with it in the first place. - -

        Finally, to take advantage of the DSO's API the executable program - has to resolve particular symbols from the DSO via - dlsym() for later use inside dispatch tables etc. In - other words: The executable program has to manually resolve every - symbol it needs to be able to use it. The advantage of such a - mechanism is that optional program parts need not be loaded (and thus - do not spend memory) until they are needed by the program in - question. When required, these program parts can be loaded - dynamically to extend the base program's functionality. - -

        Although this DSO mechanism sounds straightforward there is at least one - difficult step here: The resolving of symbols from the executable program for - the DSO when using a DSO to extend a program (the second way). Why? Because - `reverse resolving' DSO symbols from the executable program's symbol set is - against the library design (where the library has no knowledge about the - programs it is used by) and is neither available under all platforms nor - standardized. In practice the executable program's global symbols are often - not re-exported and thus not available for use in a DSO. Finding a way to - force the linker to export all global symbols is the main problem one has to - solve when using DSO for extending a program at run-time. - -

        Practical Usage

        - -

        The shared library approach is the typical one, because it is what the DSO - mechanism was designed for, hence it is used for nearly all types of - libraries the operating system provides. On the other hand using shared - objects for extending a program is not used by a lot of programs. - -

        As of 1998 there are only a few software packages available which use the DSO - mechanism to actually extend their functionality at run-time: Perl 5 (via its - XS mechanism and the DynaLoader module), GIMP, Netscape Server, etc. - Starting with version 1.3, Apache joined the crew, because Apache already - uses a module concept to extend its functionality and internally uses a - dispatch-list-based approach to link external modules into the Apache core - functionality. So, Apache is really predestined for using DSO to load its - modules at run-time. - -

        As of Apache 1.3, the configuration system supports two optional features for - taking advantage of the modular DSO approach: compilation of the Apache core - program into a DSO library for shared usage and compilation of the Apache - modules into DSO files for explicit loading at run-time. - -

        Implementation

        - -

        The DSO support for loading individual Apache modules is based on a module - named mod_so.c which has to be statically compiled into the Apache core. It - is the only module besides http_core.c which cannot be put into a DSO itself - (bootstrapping!). Practically all other distributed Apache modules then can - then be placed into a DSO by individually enabling the DSO build for them via - configure's --enable-shared option (see ../INSTALL file) or by changing the - `AddModule' command in src/Configuration.tmpl into a `SharedModule' command - (see ./INSTALL file). After a module is compiled into a DSO named mod_foo.so - you can use mod_so's `LoadModule' command in your httpd.conf file to load - this module at server startup or restart. - -

        To simplify this creation of DSO files for Apache modules (especially for - third-party modules) a new support program named `apxs' is available. It can - be used to build DSO based modules _outside of_ the Apache source tree. The - idea is simple: When installing Apache the configure's "make install" - procedure installs the Apache C header files and puts the platform-dependend - compiler and linker flags for building DSO files into the `apxs' program. - This way the user can use `apxs' to compile his Apache module sources without - the Apache distribution source tree and without having to fiddle with the - platform-dependend compiler and linker flags for DSO support. - -

        To place the complete Apache core program into a DSO library (only required - on some of the supported platforms to force the linker to export the apache - core symbols -- a prerequisite for the DSO modularization) the rule - SHARED_CORE has to be enabled via configure's --enable-rule=SHARED_CORE - option (see ../INSTALL file) or by changing the Rule command in - Configuration.tmpl to "Rule SHARED_CORE=yes" (see ./INSTALL file). The Apache - core code is then placed into a DSO library named libhttpd.so. Because one - cannot link a DSO against static libraries, an additional executable program - named libhttpd.ep is created which both binds this static code and provides a - stub for the main() function. Finally the httpd executable program itself is - replaced by a bootstrapping code which automatically makes sure the Unix - loader is able to load and start libhttpd.ep by providing the LD_LIBRARY_PATH - to libhttpd.so. - -

        Supported Platforms

        - -

        Apache's src/Configure script currently has only limited built-in knowledge - on how to compile DSO files because (as already mentioned) this is heavily - platform-dependent. Nevertheless all major Unix platforms are supported. The - definitive current state (May 1998) is this: - -

        - Out-of-the-box supported platforms:
        - (actually tested versions in parenthesis)
        -
        -   o  FreeBSD            (2.1.5, 2.2.5, 2.2.6)
        -   o  OpenBSD            (2.x)
        -   o  NetBSD             (1.3.1)
        -   o  Linux              (Debian/1.3.1, RedHat/4.2)
        -   o  Solaris            (2.4, 2.5.1, 2.6)
        -   o  SunOS              (4.1.3)
        -   o  OSF1               (4.0)
        -   o  IRIX               (6.2)
        -   o  HP/UX              (10.20)
        -   o  UnixWare           (2.01, 2.1.2)
        -   o  AIX                (3.2, 4.1.5, 4.2, 4.3)
        -   o  ReliantUNIX/SINIX  (5.43)
        -   o  SVR4               (-)
        -
        - Explicitly unsupported platforms:
        -
        -   o  Ultrix: There is no dlopen-style interface under this platform.
        -
        - - -

        Usage Summary

        - -

        To give you an overview of the DSO features of Apache 1.3, here is - a short and concise summary: - -

          - -
        1. Placing the Apache core code (all the stuff which usually forms - the httpd binary) into a DSO libhttpd.so, an executable program - libhttpd.ep and a bootstrapping executable program httpd (Notice: - this is only required on some of the supported platforms to force - the linker to export the Apache core symbols, which in turn is a - prerequisite for the DSO modularization): - -
          -   o Build and install via configure (preferred):
          -     $ ./configure --prefix=/path/to/install
          -                   --enable-rule=SHARED_CORE ...
          -     $ make install
          -
          -   o Build and install manually: 
          -     - Edit src/Configuration:
          -       << "Rule SHARED_CORE=default"
          -       >> "Rule SHARED_CORE=yes"
          -       << "EXTRA_CFLAGS= "
          -       >> "EXTRA_CFLAGS= -DSHARED_CORE_DIR=\"/path/to/install/libexec\"
          -     $ make 
          -     $ cp src/libhttpd.so* /path/to/install/libexec/
          -     $ cp src/libhttpd.ep  /path/to/install/libexec/
          -     $ cp src/httpd        /path/to/install/bin/
          -
          - -
        2. Build and install a distributed Apache module, say mod_foo.c, - into its own DSO mod_foo.so: - -
          -   o Build and install via configure (preferred):
          -     $ ./configure --prefix=/path/to/install
          -             --enable-shared=foo
          -     $ make install
          -
          -   o Build and install manually: 
          -     - Edit src/Configuration:
          -       << "AddModule    modules/xxxx/mod_foo.o" 
          -       >> "SharedModule modules/xxxx/mod_foo.so"
          -     $ make
          -     $ cp src/xxxx/mod_foo.so /path/to/install/libexec
          -     - Edit /path/to/install/etc/httpd.conf
          -       >> "LoadModule foo_module /path/to/install/libexec/mod_foo.so"
          -
          - -
        3. Build and install a third-party Apache module, say mod_foo.c, - into its own DSO mod_foo.so - -
          -   o Build and install via configure (preferred):
          -     $ ./configure --add-module=/path/to/3rdparty/mod_foo.c 
          -             --enable-shared=foo
          -     $ make install
          -
          -   o Build and install manually: 
          -     $ cp /path/to/3rdparty/mod_foo.c /path/to/apache-1.3/src/modules/extra/
          -     - Edit src/Configuration:
          -       >> "SharedModule modules/extra/mod_foo.so"
          -     $ make
          -     $ cp src/xxxx/mod_foo.so /path/to/install/libexec
          -     - Edit /path/to/install/etc/httpd.conf
          -       >> "LoadModule foo_module /path/to/install/libexec/mod_foo.so"
          -
          - -
        4. Build and install a third-party Apache module, say mod_foo.c, - into its own DSO mod_foo.so _outside of_ the Apache source tree: - -
          -   o Build and install via APXS: 
          -     $ cd /path/to/3rdparty
          -     $ apxs -c mod_foo.c
          -     $ apxs -i -a -n foo mod_foo.so
          -
          - -
      - -

      Advantages & Disadvantages

      - -

      The above DSO based features of Apache 1.3 have the following advantages: - -

        -
      • The server package is more flexible at run-time because the actual server - process can be assembled at run-time via LoadModule httpd.conf - configuration commands instead of Configuration AddModule commands at - build-time. For instance this way one is able to run different server - instances (standard & SSL version, minimalistic & powered up version - [mod_perl, PHP3], etc.) with only one Apache installation. - -
      • The server package can be easily extended with third-party modules even - after installation. This is at least a great benefit for vendor package - maintainers who can create a Apache core package and additional packages - containing extensions like PHP3, mod_perl, mod_fastcgi, etc. - -
      • Easier Apache module prototyping because with the DSO/APXS pair you can - both work outside the Apache source tree and only need an `apxs -i' - command followed by a `apachectl restart' to bring a new version of your - currently developed module into the running Apache server. -
      - -

      DSO has the following disadvantages: - -

        -
      • The DSO mechanism cannot be used on every platform because not all - operating systems support dynamic loading. - -
      • The server is approximately 20% slower at startup time because of the - symbol resolving overhead the Unix loader now has to do. - -
      • The server is approximately 5% slower at execution time under some - platforms because position independed code (PIC) sometimes needs - complicated assembler tricks for relative addressing which are not - necessarily as fast as absolute addressing. - -
      • Because DSO modules cannot be linked against other DSO-based libraries - (ld -lfoo) on all platforms (for instance a.out-based platforms usually - don't provide this functionality while ELF-based platforms do) you cannot - use the DSO mechanism for all types of modules. Or in other words, - modules compiled as DSO files are restricted to only use symbols from the - Apache core, from the C library (libc) and all other dynamic or static - libraries used by the Apache core, or from static library archives - (libfoo.a) containing position independend code. The only chance to use - other code is to either make sure the Apache core itself already contains - a reference to it or loading the code yourself via dlopen(). - -
      • Under some platforms (many SVR4 systems) there is no way to force the - linker to export all global symbols for use in DSO's when linking the - Apache httpd executable program. But without the visibility of the Apache - core symbols no standard Apache module could be used as a DSO. The only - chance here is to use the SHARED_CORE feature because this way the global - symbols are forced to be exported. As a consequence the Apache - src/Configure script automatically enforces SHARED_CORE on these - platforms when DSO features are used in the Configuration file or on the - configure command line. -
      - -
      -                     Ralf S. Engelschall
      -                     rse@engelschall.com
      -                     www.engelschall.com
      -
      - - - - - - - diff --git a/docs/manual/dso.html.en b/docs/manual/dso.html.en deleted file mode 100644 index ecaf33f90fc1c27bb0690cc88fc43c3a29c8add8..0000000000000000000000000000000000000000 --- a/docs/manual/dso.html.en +++ /dev/null @@ -1,337 +0,0 @@ - - -Apache 1.3 Dynamic Shared Object (DSO) support - - - - - - -

      Apache 1.3 Dynamic Shared Object (DSO) support

      - -


      - -

      Originally written by Ralf S. Engelschall, April 1998
      - -

      Background

      - -

      On modern Unix derivatives there exists a nifty mechanism usually - called dynamic linking/loading of Dynamic Shared Objects (DSO) which - provides a way to build a piece of program code in a special format - for loading it at run-time into the address space of an executable - program. - -

      This loading can usually be done in two ways: Automatically by a - system program called ld.so when an executable program - is started or manually from within the executing program via a - programmatic system interface to the Unix loader through the system - calls dlopen()/dlsym(). - -

      In the first way the DSO's are usually called "shared libraries" or - "DSO libraries" and named libfoo.so or - libfoo.so.1.2. They reside in a system directory - (usually /usr/lib) and the link to the executable - program is established at link-time by specifying -lfoo - to the linker command. This hardcodes library references into the - executable program file so that at start-time the Unix loader is able - to locate libfoo.so in /usr/lib or in paths - configured via the environment variable - LD_LIBRARY_PATH. It then resolves any (yet unresolved) - symbols in the executable program which are available in the DSO. - -

      Symbols in the executable program are usually not referenced by the - DSO (because it's a reuseable library of general code) and hence no - further resolving has to be done. The executable program has no need - to do anything on its own to use the symbols from the DSO because the - complete resolving is done by the Unix loader. (In fact, the code to - invoke ld.so is part of the run-time startup code which - is linked into every executable program which has been bound - non-static). The advantage of dynamic loading of common library code - is obvious: the library code needs to be stored only once, in a - system library like libc.so, saving disk space for every - program. - -

      In the second way the DSO's are usually called "shared objects" or - "DSO files" and can be named with an arbitrary extension (although - the canonical name is foo.so). These files usually stay - inside a program-specific directory and there is no automatically - established link to the executable program where they are - used. Instead the executable program manually loads the DSO at - run-time into its address space via dlopen(). At this - time no resolving of symbols from the DSO for the executable program - is done. But instead the Unix loader automatically resolves any (yet - unresolved) symbols in the DSO from the set of symbols exported by - the executable program and its already loaded DSO libraries - (especially all symbols from the ubiquitous libc.so). - This way the DSO gets knowledge of the executable program's symbol - set as if it had been statically linked with it in the first place. - -

      Finally, to take advantage of the DSO's API the executable program - has to resolve particular symbols from the DSO via - dlsym() for later use inside dispatch tables etc. In - other words: The executable program has to manually resolve every - symbol it needs to be able to use it. The advantage of such a - mechanism is that optional program parts need not be loaded (and thus - do not spend memory) until they are needed by the program in - question. When required, these program parts can be loaded - dynamically to extend the base program's functionality. - -

      Although this DSO mechanism sounds straightforward there is at least one - difficult step here: The resolving of symbols from the executable program for - the DSO when using a DSO to extend a program (the second way). Why? Because - `reverse resolving' DSO symbols from the executable program's symbol set is - against the library design (where the library has no knowledge about the - programs it is used by) and is neither available under all platforms nor - standardized. In practice the executable program's global symbols are often - not re-exported and thus not available for use in a DSO. Finding a way to - force the linker to export all global symbols is the main problem one has to - solve when using DSO for extending a program at run-time. - -

      Practical Usage

      - -

      The shared library approach is the typical one, because it is what the DSO - mechanism was designed for, hence it is used for nearly all types of - libraries the operating system provides. On the other hand using shared - objects for extending a program is not used by a lot of programs. - -

      As of 1998 there are only a few software packages available which use the DSO - mechanism to actually extend their functionality at run-time: Perl 5 (via its - XS mechanism and the DynaLoader module), GIMP, Netscape Server, etc. - Starting with version 1.3, Apache joined the crew, because Apache already - uses a module concept to extend its functionality and internally uses a - dispatch-list-based approach to link external modules into the Apache core - functionality. So, Apache is really predestined for using DSO to load its - modules at run-time. - -

      As of Apache 1.3, the configuration system supports two optional features for - taking advantage of the modular DSO approach: compilation of the Apache core - program into a DSO library for shared usage and compilation of the Apache - modules into DSO files for explicit loading at run-time. - -

      Implementation

      - -

      The DSO support for loading individual Apache modules is based on a module - named mod_so.c which has to be statically compiled into the Apache core. It - is the only module besides http_core.c which cannot be put into a DSO itself - (bootstrapping!). Practically all other distributed Apache modules then can - then be placed into a DSO by individually enabling the DSO build for them via - configure's --enable-shared option (see ../INSTALL file) or by changing the - `AddModule' command in src/Configuration.tmpl into a `SharedModule' command - (see ./INSTALL file). After a module is compiled into a DSO named mod_foo.so - you can use mod_so's `LoadModule' command in your httpd.conf file to load - this module at server startup or restart. - -

      To simplify this creation of DSO files for Apache modules (especially for - third-party modules) a new support program named `apxs' is available. It can - be used to build DSO based modules _outside of_ the Apache source tree. The - idea is simple: When installing Apache the configure's "make install" - procedure installs the Apache C header files and puts the platform-dependend - compiler and linker flags for building DSO files into the `apxs' program. - This way the user can use `apxs' to compile his Apache module sources without - the Apache distribution source tree and without having to fiddle with the - platform-dependend compiler and linker flags for DSO support. - -

      To place the complete Apache core program into a DSO library (only required - on some of the supported platforms to force the linker to export the apache - core symbols -- a prerequisite for the DSO modularization) the rule - SHARED_CORE has to be enabled via configure's --enable-rule=SHARED_CORE - option (see ../INSTALL file) or by changing the Rule command in - Configuration.tmpl to "Rule SHARED_CORE=yes" (see ./INSTALL file). The Apache - core code is then placed into a DSO library named libhttpd.so. Because one - cannot link a DSO against static libraries, an additional executable program - named libhttpd.ep is created which both binds this static code and provides a - stub for the main() function. Finally the httpd executable program itself is - replaced by a bootstrapping code which automatically makes sure the Unix - loader is able to load and start libhttpd.ep by providing the LD_LIBRARY_PATH - to libhttpd.so. - -

      Supported Platforms

      - -

      Apache's src/Configure script currently has only limited built-in knowledge - on how to compile DSO files because (as already mentioned) this is heavily - platform-dependent. Nevertheless all major Unix platforms are supported. The - definitive current state (May 1998) is this: - -

      - Out-of-the-box supported platforms:
      - (actually tested versions in parenthesis)
      -
      -   o  FreeBSD            (2.1.5, 2.2.5, 2.2.6)
      -   o  OpenBSD            (2.x)
      -   o  NetBSD             (1.3.1)
      -   o  Linux              (Debian/1.3.1, RedHat/4.2)
      -   o  Solaris            (2.4, 2.5.1, 2.6)
      -   o  SunOS              (4.1.3)
      -   o  OSF1               (4.0)
      -   o  IRIX               (6.2)
      -   o  HP/UX              (10.20)
      -   o  UnixWare           (2.01, 2.1.2)
      -   o  AIX                (3.2, 4.1.5, 4.2, 4.3)
      -   o  ReliantUNIX/SINIX  (5.43)
      -   o  SVR4               (-)
      -
      - Explicitly unsupported platforms:
      -
      -   o  Ultrix: There is no dlopen-style interface under this platform.
      -
      - - -

      Usage Summary

      - -

      To give you an overview of the DSO features of Apache 1.3, here is - a short and concise summary: - -

        - -
      1. Placing the Apache core code (all the stuff which usually forms - the httpd binary) into a DSO libhttpd.so, an executable program - libhttpd.ep and a bootstrapping executable program httpd (Notice: - this is only required on some of the supported platforms to force - the linker to export the Apache core symbols, which in turn is a - prerequisite for the DSO modularization): - -
        -   o Build and install via configure (preferred):
        -     $ ./configure --prefix=/path/to/install
        -                   --enable-rule=SHARED_CORE ...
        -     $ make install
        -
        -   o Build and install manually: 
        -     - Edit src/Configuration:
        -       << "Rule SHARED_CORE=default"
        -       >> "Rule SHARED_CORE=yes"
        -       << "EXTRA_CFLAGS= "
        -       >> "EXTRA_CFLAGS= -DSHARED_CORE_DIR=\"/path/to/install/libexec\"
        -     $ make 
        -     $ cp src/libhttpd.so* /path/to/install/libexec/
        -     $ cp src/libhttpd.ep  /path/to/install/libexec/
        -     $ cp src/httpd        /path/to/install/bin/
        -
        - -
      2. Build and install a distributed Apache module, say mod_foo.c, - into its own DSO mod_foo.so: - -
        -   o Build and install via configure (preferred):
        -     $ ./configure --prefix=/path/to/install
        -             --enable-shared=foo
        -     $ make install
        -
        -   o Build and install manually: 
        -     - Edit src/Configuration:
        -       << "AddModule    modules/xxxx/mod_foo.o" 
        -       >> "SharedModule modules/xxxx/mod_foo.so"
        -     $ make
        -     $ cp src/xxxx/mod_foo.so /path/to/install/libexec
        -     - Edit /path/to/install/etc/httpd.conf
        -       >> "LoadModule foo_module /path/to/install/libexec/mod_foo.so"
        -
        - -
      3. Build and install a third-party Apache module, say mod_foo.c, - into its own DSO mod_foo.so - -
        -   o Build and install via configure (preferred):
        -     $ ./configure --add-module=/path/to/3rdparty/mod_foo.c 
        -             --enable-shared=foo
        -     $ make install
        -
        -   o Build and install manually: 
        -     $ cp /path/to/3rdparty/mod_foo.c /path/to/apache-1.3/src/modules/extra/
        -     - Edit src/Configuration:
        -       >> "SharedModule modules/extra/mod_foo.so"
        -     $ make
        -     $ cp src/xxxx/mod_foo.so /path/to/install/libexec
        -     - Edit /path/to/install/etc/httpd.conf
        -       >> "LoadModule foo_module /path/to/install/libexec/mod_foo.so"
        -
        - -
      4. Build and install a third-party Apache module, say mod_foo.c, - into its own DSO mod_foo.so _outside of_ the Apache source tree: - -
        -   o Build and install via APXS: 
        -     $ cd /path/to/3rdparty
        -     $ apxs -c mod_foo.c
        -     $ apxs -i -a -n foo mod_foo.so
        -
        - -
    - -

    Advantages & Disadvantages

    - -

    The above DSO based features of Apache 1.3 have the following advantages: - -

      -
    • The server package is more flexible at run-time because the actual server - process can be assembled at run-time via LoadModule httpd.conf - configuration commands instead of Configuration AddModule commands at - build-time. For instance this way one is able to run different server - instances (standard & SSL version, minimalistic & powered up version - [mod_perl, PHP3], etc.) with only one Apache installation. - -
    • The server package can be easily extended with third-party modules even - after installation. This is at least a great benefit for vendor package - maintainers who can create a Apache core package and additional packages - containing extensions like PHP3, mod_perl, mod_fastcgi, etc. - -
    • Easier Apache module prototyping because with the DSO/APXS pair you can - both work outside the Apache source tree and only need an `apxs -i' - command followed by a `apachectl restart' to bring a new version of your - currently developed module into the running Apache server. -
    - -

    DSO has the following disadvantages: - -

      -
    • The DSO mechanism cannot be used on every platform because not all - operating systems support dynamic loading. - -
    • The server is approximately 20% slower at startup time because of the - symbol resolving overhead the Unix loader now has to do. - -
    • The server is approximately 5% slower at execution time under some - platforms because position independed code (PIC) sometimes needs - complicated assembler tricks for relative addressing which are not - necessarily as fast as absolute addressing. - -
    • Because DSO modules cannot be linked against other DSO-based libraries - (ld -lfoo) on all platforms (for instance a.out-based platforms usually - don't provide this functionality while ELF-based platforms do) you cannot - use the DSO mechanism for all types of modules. Or in other words, - modules compiled as DSO files are restricted to only use symbols from the - Apache core, from the C library (libc) and all other dynamic or static - libraries used by the Apache core, or from static library archives - (libfoo.a) containing position independend code. The only chance to use - other code is to either make sure the Apache core itself already contains - a reference to it or loading the code yourself via dlopen(). - -
    • Under some platforms (many SVR4 systems) there is no way to force the - linker to export all global symbols for use in DSO's when linking the - Apache httpd executable program. But without the visibility of the Apache - core symbols no standard Apache module could be used as a DSO. The only - chance here is to use the SHARED_CORE feature because this way the global - symbols are forced to be exported. As a consequence the Apache - src/Configure script automatically enforces SHARED_CORE on these - platforms when DSO features are used in the Configuration file or on the - configure command line. -
    - -
    -                     Ralf S. Engelschall
    -                     rse@engelschall.com
    -                     www.engelschall.com
    -
    - - - - - - - diff --git a/docs/manual/env.html b/docs/manual/env.html deleted file mode 100644 index fbecf41bb7f1097fb4fcca1ddd27171cb9ebaa5a..0000000000000000000000000000000000000000 --- a/docs/manual/env.html +++ /dev/null @@ -1,30 +0,0 @@ - - - -Special Purpose Environment Variables - - - - -

    Special Purpose Environment Variables

    -

    Interoperability problems have led to the introduction of mechanisms to modify -the way Apache behaves when talking to particular clients. To make these -mechanisms as flexible as possible, they are invoked by defining environment -variables, typically with BrowserMatch, though SetEnv and -PassEnv could also be used, for example.

    -

    nokeepalive

    -This disables KeepAlive when set. Because -of problems with Netscape 2.x and KeepAlive, we recommend the following -directive be used: -
    -BrowserMatch Mozilla/2 nokeepalive -
    -

    force-response-1.0

    -This forces an HTTP/1.0 response when set. It was originally implemented as a -result of a problem with AOL's proxies. Some clients may not behave correctly -when given an HTTP/1.1 response, and this can be used to interoperate with -them. - - - - diff --git a/docs/manual/env.html.en b/docs/manual/env.html.en deleted file mode 100644 index fbecf41bb7f1097fb4fcca1ddd27171cb9ebaa5a..0000000000000000000000000000000000000000 --- a/docs/manual/env.html.en +++ /dev/null @@ -1,30 +0,0 @@ - - - -Special Purpose Environment Variables - - - - -

    Special Purpose Environment Variables

    -

    Interoperability problems have led to the introduction of mechanisms to modify -the way Apache behaves when talking to particular clients. To make these -mechanisms as flexible as possible, they are invoked by defining environment -variables, typically with BrowserMatch, though SetEnv and -PassEnv could also be used, for example.

    -

    nokeepalive

    -This disables KeepAlive when set. Because -of problems with Netscape 2.x and KeepAlive, we recommend the following -directive be used: -
    -BrowserMatch Mozilla/2 nokeepalive -
    -

    force-response-1.0

    -This forces an HTTP/1.0 response when set. It was originally implemented as a -result of a problem with AOL's proxies. Some clients may not behave correctly -when given an HTTP/1.1 response, and this can be used to interoperate with -them. - - - - diff --git a/docs/manual/faq/index.html b/docs/manual/faq/index.html deleted file mode 100644 index 90c19b7bb964b4851dffb34a1efa9d6f8a87ca75..0000000000000000000000000000000000000000 --- a/docs/manual/faq/index.html +++ /dev/null @@ -1,67 +0,0 @@ - - - - - - - - - Apache Server Frequently Asked Questions - - - -

    Frequently Asked Questions

    - -

    - The latest version of this FAQ is always available from the main - Apache web site, at <http://httpd.apache.org/docs-2.0/faq/>. - In addition, you can view this FAQ all in one page for easy searching and - printing. -

    - -

    Since Apache 2.0 is very new, we don't yet know what the - Frequently Asked Questions will be. While this section - fills up, you should also consult the Apache 1.3 FAQ - to see if your question is answered there.

    - - - -

    Categories

    - - - -
    - -
    Support
    -
    What do I do when I have problems?
    - -
    - - - -
    - -
    Support
    -
    What do I do when I have problems?
    - -
    - -
    - - - - - - - - diff --git a/docs/manual/faq/support.html b/docs/manual/faq/support.html deleted file mode 100644 index 95aa420132c3cc10f1bc1e0435fed31bb4a0d772..0000000000000000000000000000000000000000 --- a/docs/manual/faq/support.html +++ /dev/null @@ -1,143 +0,0 @@ - - - - - Support - Apache Server Frequently Asked Questions - - - - -

    Apache Server Frequently Asked Questions

    - - -

    Support

    - - - -
    - -

    "Why can't I ...? Why won't ... work?" - What to do in case of problems

    -

    - If you are having trouble with your Apache server software, you should - take the following steps: -

    -
      -
    1. Check the errorlog! -

      - Apache tries to be helpful when it encounters a problem. In many - cases, it will provide some details by writing one or messages to - the server error log. Sometimes this is enough for you to diagnose - & fix the problem yourself (such as file permissions or the like). - The default location of the error log is - /usr/local/apache/logs/error_log, but see the - ErrorLog - directive in your config files for the location on your server. -

      -
    2. -
    3. Check the - FAQ! -

      - The latest version of the Apache Frequently-Asked Questions list can - always be found at the main Apache web site. -

      -
    4. -
    5. Check the Apache bug database -

      - Most problems that get reported to The Apache Group are recorded in - the - bug database. - Please check the existing reports, open - and closed, before adding one. If you find - that your issue has already been reported, please don't add - a "me, too" report. If the original report isn't closed - yet, we suggest that you check it periodically. You might also - consider contacting the original submitter, because there may be an - email exchange going on about the issue that isn't getting recorded - in the database. -

      -
    6. -
    7. Ask in the comp.infosystems.www.servers.unix - or comp.infosystems.www.servers.ms-windows USENET - newsgroup (as appropriate for the platform you use). -

      - A lot of common problems never make it to the bug database because - there's already high Q&A traffic about them in the - comp.infosystems.www.servers.unix - newsgroup. Many Apache users, and some of the developers, can be - found roaming its virtual halls, so it is suggested that you seek - wisdom there. The chances are good that you'll get a faster answer - there than from the bug database, even if you don't see - your question already posted. -

      -
    8. -
    9. If all else fails, report the problem in the bug - database -

      - If you've gone through those steps above that are appropriate and - have obtained no relief, then please do let The Apache - Group know about the problem by - logging a bug report. -

      -

      - If your problem involves the server crashing and generating a core - dump, please include a backtrace (if possible). As an example, -

      -

      -

      -
      # cd ServerRoot
      - # dbx httpd core
      - (dbx) where
      -
      -
      -

      -

      - (Substitute the appropriate locations for your - ServerRoot and your httpd and - core files. You may have to use gdb - instead of dbx.) -

      -
    10. -
    -
    - -

    Whom do I contact for support?

    -

    - There is no official support for Apache. None of the developers want to - be swamped by a flood of trivial questions that can be resolved elsewhere. - Bug reports and suggestions should be sent via - the bug report page. - Other questions should be directed to the - comp.infosystems.www.servers.unix or comp.infosystems.www.servers.ms-windows - newsgroup (as appropriate for the platform you use), where some of the - Apache team lurk, in the company of many other httpd gurus who - should be able to help. -

    -

    - Commercial support for Apache is, however, available from a number - of third parties. -

    - - - - - - - diff --git a/docs/manual/filter.html b/docs/manual/filter.html deleted file mode 100644 index 9cdcb201d9fbd6937a96fc7aea39f56560b381dc..0000000000000000000000000000000000000000 --- a/docs/manual/filter.html +++ /dev/null @@ -1,61 +0,0 @@ - - - -Filters - Apache HTTPD - - - - - -

    Filters

    - - - - -
    -Related Modules

    - -mod_ext_filter
    -mod_include
    -
    -Related Directives

    - -ExtFilterDefine
    -ExtFilterOptions
    -SetInputFilter
    -SetOutputFilter
    -
    - - -

    A filter is a process which is applied to data that is -sent or received by the server. Data sent by clients to the server -is processed by input filters while data sent by the -server to the client is processed by output filters. -Multiple filters can be applied to the data, and the order -of the filters can be explicitly specified. In addition, -since filters apply to all content, they allow for flexible -manipulation of data such as processing the output of -CGI scripts for Server Side Includes.

    - -

    The set of filters which apply to data can be manipulated -with the SetInputFilter and SetOutputFilter -directives.

    - -

    The only filter currently included with the Apache distribution -is the INCLUDE filter which is provided by -mod_include to process output -for Server Side Includes. There is also an experimental module -called mod_ext_filter -which allows for external programs to be defined as filters.

    - - - - - - diff --git a/docs/manual/filter.html.en b/docs/manual/filter.html.en deleted file mode 100644 index 9cdcb201d9fbd6937a96fc7aea39f56560b381dc..0000000000000000000000000000000000000000 --- a/docs/manual/filter.html.en +++ /dev/null @@ -1,61 +0,0 @@ - - - -Filters - Apache HTTPD - - - - - -

    Filters

    - - - - -
    -Related Modules

    - -mod_ext_filter
    -mod_include
    -
    -Related Directives

    - -ExtFilterDefine
    -ExtFilterOptions
    -SetInputFilter
    -SetOutputFilter
    -
    - - -

    A filter is a process which is applied to data that is -sent or received by the server. Data sent by clients to the server -is processed by input filters while data sent by the -server to the client is processed by output filters. -Multiple filters can be applied to the data, and the order -of the filters can be explicitly specified. In addition, -since filters apply to all content, they allow for flexible -manipulation of data such as processing the output of -CGI scripts for Server Side Includes.

    - -

    The set of filters which apply to data can be manipulated -with the SetInputFilter and SetOutputFilter -directives.

    - -

    The only filter currently included with the Apache distribution -is the INCLUDE filter which is provided by -mod_include to process output -for Server Side Includes. There is also an experimental module -called mod_ext_filter -which allows for external programs to be defined as filters.

    - - - - - - diff --git a/docs/manual/handler.html b/docs/manual/handler.html deleted file mode 100644 index 4472b3165d00d2825fe62d006f21a437500f55b3..0000000000000000000000000000000000000000 --- a/docs/manual/handler.html +++ /dev/null @@ -1,138 +0,0 @@ - - - -Apache's Handler Use - - - - -

    Apache's Handler Use

    - -

    What is a Handler

    - -

    A "handler" is an internal Apache representation of the action to be -performed when a file is called. Generally, files have implicit -handlers, based on the file type. Normally, all files are simply -served by the server, but certain file typed are "handled" -seperately. For example, you may use a type of -"application/x-httpd-cgi" to invoke CGI scripts.

    - -

    Apache 1.1 adds the additional ability to use handlers -explicitly. Either based on filename extensions or on location, these -handlers are unrelated to file type. This is advantageous both because -it is a more elegant solution, but it also allows for both a type -and a handler to be associated with a file.

    - -

    Handlers can either be built into the server or to a module, or -they can be added with the Action directive. The built-in -handlers in the standard distribution are as follows:

    - -
      -
    • send-as-is: - Send file with HTTP headers as is. - (mod_asis) -
    • cgi-script: - Treat the file as a CGI script. - (mod_cgi) -
    • imap-file: - Imagemap rule file. - (mod_imap) -
    • server-info: - Get the server's configuration information - (mod_info) -
    • server-parsed: - Parse for server-side includes - (mod_include) -
    • server-status: - Get the server's status report - (mod_status) -
    • type-map: - Parse as a type map file for content negotation - (mod_negotiation) -
    - -

    - -

    Directives

    - - -
    - -

    AddHandler

    - -Syntax: <AddHandler handler-name extention>
    -Context: server config, virtual host, directory, .htaccess
    -Status: Base
    -Module: mod_mime - -

    AddHandler maps the filename extension extension to the -handler handler-name. For example, to activate CGI scripts -with the file extension ".cgi", you might use: -

    -    AddHandler cgi-script cgi
    -
    - -

    Once that has been put into your srm.conf or httpd.conf file, any -file ending with ".cgi" will be treated as a CGI -program.

    - -
    - -

    SetHandler

    - -Syntax: <SetHandler handler-name>
    -Context: directory, .htaccess
    -Status: Base
    -Module: mod_mime - -

    When placed into an .htaccess file or a -<Directory> or <Location section, -this directive forces all matching files to be parsed through the -handler given by handler-name. For example, if you had a -directory you wanted to be parsed entirely as imagemap rule files, -regardless of extension, you might put the following into an -.htaccess file in that directory: -

    -    SetHandler imap-file
    -
    -

    Another example: if you wanted to have the server display a status -report whenever a URL of http://servername/status was -called, you might put the following into access.conf: -

    -    <Location /status>
    -    SetHandler server-status
    -    </Location>
    -
    - -


    - -

    Programmer's Note

    - -

    In order to implement the handler features, an addition has been -made to the Apache API that you may wish to -make use of. Specifically, a new record has been added to the -request_rec structure:

    -
    -    char *handler
    -
    -

    If you wish to have your module engage a handler, you need only to -set r->handler to the name of the handler at any time -prior to the invoke_handler stage of the -request. Handlers are implemented as they were before, albiet using -the handler name instead of a content type. While it is not -neccessary, the naming convention for handlers is to use a -dash-seperated word, with no slashes, so as to not invade the media -type namespace.

    - -
    - -Home -Index - - - - diff --git a/docs/manual/handler.html.en b/docs/manual/handler.html.en deleted file mode 100644 index 4472b3165d00d2825fe62d006f21a437500f55b3..0000000000000000000000000000000000000000 --- a/docs/manual/handler.html.en +++ /dev/null @@ -1,138 +0,0 @@ - - - -Apache's Handler Use - - - - -

    Apache's Handler Use

    - -

    What is a Handler

    - -

    A "handler" is an internal Apache representation of the action to be -performed when a file is called. Generally, files have implicit -handlers, based on the file type. Normally, all files are simply -served by the server, but certain file typed are "handled" -seperately. For example, you may use a type of -"application/x-httpd-cgi" to invoke CGI scripts.

    - -

    Apache 1.1 adds the additional ability to use handlers -explicitly. Either based on filename extensions or on location, these -handlers are unrelated to file type. This is advantageous both because -it is a more elegant solution, but it also allows for both a type -and a handler to be associated with a file.

    - -

    Handlers can either be built into the server or to a module, or -they can be added with the Action directive. The built-in -handlers in the standard distribution are as follows:

    - -
      -
    • send-as-is: - Send file with HTTP headers as is. - (mod_asis) -
    • cgi-script: - Treat the file as a CGI script. - (mod_cgi) -
    • imap-file: - Imagemap rule file. - (mod_imap) -
    • server-info: - Get the server's configuration information - (mod_info) -
    • server-parsed: - Parse for server-side includes - (mod_include) -
    • server-status: - Get the server's status report - (mod_status) -
    • type-map: - Parse as a type map file for content negotation - (mod_negotiation) -
    - -

    - -

    Directives

    - - -
    - -

    AddHandler

    - -Syntax: <AddHandler handler-name extention>
    -Context: server config, virtual host, directory, .htaccess
    -Status: Base
    -Module: mod_mime - -

    AddHandler maps the filename extension extension to the -handler handler-name. For example, to activate CGI scripts -with the file extension ".cgi", you might use: -

    -    AddHandler cgi-script cgi
    -
    - -

    Once that has been put into your srm.conf or httpd.conf file, any -file ending with ".cgi" will be treated as a CGI -program.

    - -
    - -

    SetHandler

    - -Syntax: <SetHandler handler-name>
    -Context: directory, .htaccess
    -Status: Base
    -Module: mod_mime - -

    When placed into an .htaccess file or a -<Directory> or <Location section, -this directive forces all matching files to be parsed through the -handler given by handler-name. For example, if you had a -directory you wanted to be parsed entirely as imagemap rule files, -regardless of extension, you might put the following into an -.htaccess file in that directory: -

    -    SetHandler imap-file
    -
    -

    Another example: if you wanted to have the server display a status -report whenever a URL of http://servername/status was -called, you might put the following into access.conf: -

    -    <Location /status>
    -    SetHandler server-status
    -    </Location>
    -
    - -


    - -

    Programmer's Note

    - -

    In order to implement the handler features, an addition has been -made to the Apache API that you may wish to -make use of. Specifically, a new record has been added to the -request_rec structure:

    -
    -    char *handler
    -
    -

    If you wish to have your module engage a handler, you need only to -set r->handler to the name of the handler at any time -prior to the invoke_handler stage of the -request. Handlers are implemented as they were before, albiet using -the handler name instead of a content type. While it is not -neccessary, the naming convention for handlers is to use a -dash-seperated word, with no slashes, so as to not invade the media -type namespace.

    - -
    - -Home -Index - - - - diff --git a/docs/manual/handler.html.ja.jis b/docs/manual/handler.html.ja.jis deleted file mode 100644 index 917aabdccd1adef17d0da4980be39f1cb34fbc07..0000000000000000000000000000000000000000 --- a/docs/manual/handler.html.ja.jis +++ /dev/null @@ -1,146 +0,0 @@ - - - -Apache $B$N%O%s%I%i$N;HMQ(B - - - - - - -

    Apache $B$N%O%s%I%i$N;HMQ(B

    - - - -
    -

    $B%O%s%I%i$H$O(B

    - - - - -
    -$B4XO"%b%8%e!<%k(B

    - -mod_actions
    -mod_asis
    -mod_cgi
    -mod_imap
    -mod_info
    -mod_mime
    -mod_negotiation
    -mod_status
    -
    -$B4XO"%G%#%l%/%F%#%V(B

    - -Action
    -AddHandler
    -RemoveHandler
    -SetHandler
    -
    - - -

    $B!V%O%s%I%i!W$H$O!"%U%!%$%k$,8F$P$l$?$H$-$Ko!"%U%!%$%k$O%U%!%$%k7?$K4p$E$$$?0EL[$N(B -$B%O%s%I%i$,$"$j$^$9!#IaDL$O$9$Y$F$N%U%!%$%k$OC1$K%5!<%P$K07$o$l$^$9$,!"(B -$B%U%!%$%k%?%$%W$NCf$K$OJL$K!V%O%s%I%k!W(B ($BLuCm(B: $B07$&(B) $B$5$l$k$b$N$b$"$j$^$9!#(B

    - -

    Apache 1.1 $B$G$O!"%O%s%I%i$rL@<(E*$K;HMQ$9$k5!G=$,DI2C$5$l$^$7$?!#(B -$B%U%!%$%k$N3HD%;R$dCV$$$F$$$k>l=j$K4p$E$$$F!"%U%!%$%k7?$H4X78$J$/%O%s%I%i$r(B -$B;XDj$9$k$3$H$,$G$-$^$9!#$3$l$O$h$jM%2m$J2r7hK!$H$$$&E@$H!"%U%!%$%k$K(B -$B%?%$%W(B$B$H(B$B%O%s%I%i$NN>J}$r4XO"IU$1$k$3$H$,$G$-$k$H$$$&(B -$BE@$GM%$l$F$$$^$9!#(B ($BJ#?t$N3HD%;R$N$"$k%U%!%$%k(B -$B$b;2>H$7$F$/$@$5$$(B)$B!#(B

    - -

    $B%O%s%I%i$O%5!<%P$KAH$_9~$s$@$j!"%b%8%e!<%k$H$7$F4^$a$?$j!"(B -Action $B%G%#%l%/%F%#%V$H$7$F(B -$BDI2C$7$?$j$9$k$3$H$,$G$-$^$9!#0J2<$OI8=`G[I[$KAH$_9~$^$l$F$$$k%O%s%I%i$G$9!#(B

    - -
      -
    • default-handler: - default_handelr() $B$r;H$C$F%U%!%$%k$rAw$j$^$9!#(B - $B@EE*$J%3%s%F%s%D$r07$&$H$-$K%G%U%)%k%H$G;HMQ$5$l$k%O%s%I%i$G$9!#(B - (core) -
    • send-as-is: - HTTP $B%X%C%@$N$"$k%U%!%$%k$r$=$N$^$^Aw$j$^$9!#(B - (mod_asis) -
    • cgi-script: - $B%U%!%$%k$r(B CGI $B%9%/%j%W%H$H$7$F07$$$^$9!#(B - (mod_cgi) -
    • imap-file: - $B%$%a!<%8%^%C%W$N%k!<%k%U%!%$%k$H$7$F2r@O$7$^$9!#(B - (mod_imap) -
    • server-info: - $B%5!<%P$N@_Dj>pJs$rmod_info) -
    • server-status: - $B%5!<%P$N>uBVJs9p$rmod_status) -
    • type-map: - $B%3%s%F%s%H%M%4%7%(!<%7%g%s$N$?$a$N%?%$%W%^%C%W$H$7$F2r@O$7$^$9!#(B - (mod_negotiation) -
    - -
    - -

    $BNc(B

    - -

    CGI $B%9%/%j%W%H$rMQ$$$F@EE*$J%3%s%F%s%D$rJQ99$9$k(B

    - -

    $B0J2<$N%G%#%l%/%F%#%V$K$h$C$F!"3HD%;R$,(B html $B$G$"$k%U%!%$%k$O(B -footer.pl CGI $B%9%/%j%W%H$r5/F0$9$k$h$&$K$J$j$^$9!#(B

    - -
    -     Action add-footer /cgi-bin/footer.pl
    -     AddHandler add-footer .html
    -
    - -

    CGI $B%9%/%j%W%H$OK>$^$7$$=$@5$dDI2C$r9T$J$C$F!"85!9MW5a$5$l$?J8=q(B -($B4D6-JQ?t(B PATH_TRANSLATED $B$G;X$5$l$F$$$^$9(B) $B$rAw$k@UG$$,$"$j$^$9!#(B

    - -

    HTTP $B%X%C%@$N$"$k%U%!%$%k(B

    - -

    $B0J2<$N%G%#%l%/%F%#%V$O(B send-as-is $B%O%s%I%i$r;HMQ$9$k(B -$B$h$&$K;X<($7$^$9!#$3$N%O%s%I%i$O<+J,<+?H$N(B HTTP $B%X%C%@$r;}$C$F$$$k%U%!%$%k$K(B -$B;HMQ$5$l$^$9!#$3$3$G$O!"3HD%;R$K4X$o$i$:!"(B/web/htdocs/asis -$B%G%#%l%/%H%j$K$"$kA4$F$N%U%!%$%k$O(B send-as-is $B%O%s%I%i$K$h$C$F(B -$B07$o$l$^$9!#(B

    - -
    -    <Directory /web/htdocs/asis>
    -    SetHandler send-as-is
    -    </Directory>
    -
    - -
    - -

    $B%W%m%0%i%^8~$1$N%a%b(B

    - -

    $B%O%s%I%i$N5!G=$rApache API $B$KDI2C$5$l$^$7$?!#(B -$B>\$7$/8@$&$H!"(Brequest_rec $B9=B$BN$K?7$7$$%l%3!<%I$,(B -$BDI2C$5$l$?$H$$$&$3$H$G$9!#(B

    -
    -    char *handler
    -
    -

    $B$b$7%b%8%e!<%k$,%O%s%I%i$K4X$o$j$?$$>l9g!"$d$i$J$1$l$P$J$i$J$$$3$H$O!"(B -$B%j%/%(%9%H$,(B invoke_handler $B%9%F!<%8$KC#$9$k0JA0$K(B -r->handler $B$r@_Dj$9$k$3$H$@$1$G$9!#(B -$B%O%s%I%i$O%3%s%F%s%H%?%$%W$NBe$o$j$K%O%s%I%iL>$r;H$&$h$&$K$J$C$F$$$k$3$H0J30$O!"(B -$B0JA0$HF1$8$h$&$KA06u4V$r?/$5$J$$$h$&$K!"%O%s%I%i$NL>A0$K$O%9%i%C%7%e(B -$B$r4^$^$J$$!"%@%C%7%e(B ($BLuCm(B: "-") $B$GJ,N%$5$l$?L>A0$rIU$1$k=,47$K$J$C$F$$$^$9!#(B

    - - - - diff --git a/docs/manual/howto/auth.html b/docs/manual/howto/auth.html deleted file mode 100644 index 9311ffcf814e85fa97a89ae2f27ecd3e209f4e20..0000000000000000000000000000000000000000 --- a/docs/manual/howto/auth.html +++ /dev/null @@ -1,318 +0,0 @@ - - - - - - - Authentication - - - - - - - -

    Authentication

    - - - - - -
    - - - - - - -
    Related Modules
    -
    - mod_auth
    -
    Related Directives
    -
    - Allow
    - AuthGroupFile
    - AuthName
    - AuthType
    - AuthUserFile
    - Deny
    - Options
    - Require
    - -
    - - -

    Authentication

    - -

    Authentication is any process by which you verify that - someone is who they claim they are. Authorization is any - process by which someone is allowed to be where they want to - go, or to have information that they want to have.

    - -

    Introduction

    - -

    If you have information on your web site that is sensitive - or intended for only a small group of people, the techniques in - this article will help you make sure that the people that see - those pages are the people that you wanted to see them.

    - -

    This article covers the "standard" way of protecting parts of your - web site that most of you are going to use.

    - -

    The prerequisites

    - -

    The directives discussed in this article will need to go either - in your main server configuration file, or in per-directory - configuration files (.htaccess files).

    - -

    If you plan to use .htaccess files, you will need to - have a server configuration that permits putting authentication - directives in these files. This is done with the - AllowOverride - directive, which specifies which directives, if any, may be put in - per-directory configuration files.

    - -

    Since we're talking here about authentication, you will need an - AllowOverride directive like the following:

    - -
    -    AllowOverride AuthConfig
    -
    - -

    Or, if you are just going to put the directives directly in your - main server configuration file, you will of course need to have - write permission to that file.

    - -

    And you'll need to know a little bit about the directory - structure of your server, in order to know where some files are - kept. This should not be terribly difficult, and I'll try to - make this clear when we come to that point.

    - -

    Getting it working.

    - -

    Here's the basics of password protecting a directory on your - server.

    - -

    You'll need to create a password file. This file should be - placed somewhere outside of your document directory. This is so - that folks cannot download the password file. For example, if - your documents are served out of - /usr/local/apache/htdocs you might want to put the - password file(s) in /usr/local/apache/passwd.

    - -

    To create the file, use the htpasswd utility - that came with Apache. This be located in the bin - directory of wherever you installed Apache. To create the file, - type:

    -
    -        htpasswd -c /usr/local/apache/passwd/password rbowen
    -
    - -

    htpasswd will ask you for the password, and - then ask you to type it again to confirm it:

    -
    -        # htpasswd -c /usr/local/apache/passwd/passwords rbowen
    -        New password: mypassword
    -        Re-type new password: mypassword
    -        Adding password for user rbowen
    -
    - -

    If htpasswd is not in your path, of course - you'll have to type the full path to the file to get it to run. - On my server, it's located at - /usr/local/apache/bin/htpasswd

    - -

    Next, you'll need to create a file in the directory you want - to protect. This file is usually called .htaccess, - although on Windows it's called htaccess (without - the leading period.) .htaccess needs to contain - the following lines:

    -
    -        AuthType Basic
    -        AuthName "By Invitation Only"
    -        AuthUserFile /usr/local/apache/passwd/passwords
    -        AuthGroupFile /dev/null
    -        require user rbowen
    -
    - -

    The next time that you load a file from that directory, you - should see the familiar username/password dialog box pop up. If - you don't chances are pretty good that you are not permitted to - use .htaccess files in the directory in - question.

    - -

    Letting more than - one person in

    - -

    The directives above only let one person (specifically - someone with a username of rbowen) into the - directory. In most cases, you'll want to let more than one - person in. This is where the AuthGroupFile comes - in. In the example above, we've pointed - AuthGroupFile to /dev/null, which is - Unix-speak for "nowhere", or "off into space." (The Windows - NT equivalent of this is nul.)

    - -

    If you want to let more than one person in, you'll need to - create a group file that associates group names with a list of - users in that group. The format of this file is pretty simple, - and you can create it with your favorite editor. The contents - of the file will look like this:

    -
    -        GroupName: rbowen dpitts sungo rshersey
    -
    - -

    That's just a list of the members of the group in a long - line separated by spaces.

    - -

    To add a user to your already existing password file, - type:

    -
    -        htpasswd /usr/local/apache/passwd/password dpitts
    -
    - -

    You'll get the same response as before, but it will be - appended to the existing file, rather than creating a new file. - (It's the -c that makes it create a new password - file.

    - -

    Now, you need to modify your .htaccess file to - look like the following:

    -
    -        AuthType Basic
    -        AuthName "By Invitation Only"
    -        AuthUserFile /usr/local/apache/passwd/passwords
    -        AuthGroupFile /usr/local/apache/passwd/groups
    -        require group GroupName
    -
    - -

    Now, anyone that is listed in the group - GroupName, and has an entry in the - password file, will be let in, if they type the - correct password.

    - -

    There's another way to let multiple users in that is less - specific. Rather than creating a group file, you can just use - the following directive:

    -
    -        require valid-user
    -
    - -

    Using that rather than the require user rbowen - line will allow anyone in that is listed in the password file, - and who correctly enters their password. You can even emulate - the group behavior here, by just keeping a separate password - file for each group. The advantage of this approach is that - Apache only has to check one file, rather than two. The - disadvantage is that you have to maintain a bunch of password - files, and remember to reference th right one in the - AuthUserFile directive.

    - -

    Possible problems

    - -

    Because of the way that Basic authentication is specified, - your username and password must be verified every time you - request a document from the server. This is even if you're - reloading the same page, and for every image on the page (if - they come from a protected directory). As you can imagine, this - slows things down a little. The amount that it slows things - down is proportional to the size of the password file, because - it has to open up that file, and go down the list of users - until it gets to your name. And it has to do this every time a - page is loaded.

    - -

    A consequence of this is that there's a practical limit to how many - users you can put in one password file. This limit will vary - depending on the performance of your particular server machine, but - you can expect to see slowdowns once you get above a few hundred - entries, and may wish to consider a different authentication method - at that time.

    - -

    What other neat - stuff can I do?

    - -

    Authentication by username and password is only part of the - story. Frequently you want to let people in based on something - other than who they are. Something such as where they are - coming from.

    - -

    The allow and deny directives let - you allow and deny access based on the host name, or host - address, of the machine requesting a document. The directive - goes hand-in-hand with these is the order - directive, which tells Apache in which order to apply the - filters.

    - -

    The usage of these directives is:

    -
    -        allow from address
    -
    - -

    where address is an IP address (or a partial IP - address) or a fully qualified domain name (or a partial domain - name).

    - -

    For example, if you have someone spamming your message - board, and you want to keep them out, you could do the - following:

    -
    -        deny from 205.252.46.165
    -
    - -

    Visitors coming from that address will not be able to see - the content behind this directive. If, instead, you have a - machine name, rather than an IP address, you can use that.

    -
    -        deny from host.example.com
    -
    - -

    And, if you'd like to block access from an entire domain, - you can specify just part of an address or domain name:

    -
    -        deny from 192.101.205
    -        deny from cyberthugs.com
    -        deny from ke
    -
    - -

    Using order will let you be sure that you are - actually restricting things to the group that you want to let - in, by combining a deny and an allow - directive:

    -
    -        order deny,allow
    -        deny from all
    -        allow from dev.example.com
    -
    - -

    Listing just the allow directive would not do - what you want, because it will let folks from that host in, in - addition to letting everyone in. What you want is to let - only those folks in.

    - -

    More information

    - -

    You should also read the documentation for - mod_auth - which contains - some more information about how this all works.

    - - - diff --git a/docs/manual/howto/auth.html.en b/docs/manual/howto/auth.html.en deleted file mode 100644 index 9311ffcf814e85fa97a89ae2f27ecd3e209f4e20..0000000000000000000000000000000000000000 --- a/docs/manual/howto/auth.html.en +++ /dev/null @@ -1,318 +0,0 @@ - - - - - - - Authentication - - - - - - - -

    Authentication

    - - - - - -
    - - - - - - -
    Related Modules
    -
    - mod_auth
    -
    Related Directives
    -
    - Allow
    - AuthGroupFile
    - AuthName
    - AuthType
    - AuthUserFile
    - Deny
    - Options
    - Require
    - -
    - - -

    Authentication

    - -

    Authentication is any process by which you verify that - someone is who they claim they are. Authorization is any - process by which someone is allowed to be where they want to - go, or to have information that they want to have.

    - -

    Introduction

    - -

    If you have information on your web site that is sensitive - or intended for only a small group of people, the techniques in - this article will help you make sure that the people that see - those pages are the people that you wanted to see them.

    - -

    This article covers the "standard" way of protecting parts of your - web site that most of you are going to use.

    - -

    The prerequisites

    - -

    The directives discussed in this article will need to go either - in your main server configuration file, or in per-directory - configuration files (.htaccess files).

    - -

    If you plan to use .htaccess files, you will need to - have a server configuration that permits putting authentication - directives in these files. This is done with the - AllowOverride - directive, which specifies which directives, if any, may be put in - per-directory configuration files.

    - -

    Since we're talking here about authentication, you will need an - AllowOverride directive like the following:

    - -
    -    AllowOverride AuthConfig
    -
    - -

    Or, if you are just going to put the directives directly in your - main server configuration file, you will of course need to have - write permission to that file.

    - -

    And you'll need to know a little bit about the directory - structure of your server, in order to know where some files are - kept. This should not be terribly difficult, and I'll try to - make this clear when we come to that point.

    - -

    Getting it working.

    - -

    Here's the basics of password protecting a directory on your - server.

    - -

    You'll need to create a password file. This file should be - placed somewhere outside of your document directory. This is so - that folks cannot download the password file. For example, if - your documents are served out of - /usr/local/apache/htdocs you might want to put the - password file(s) in /usr/local/apache/passwd.

    - -

    To create the file, use the htpasswd utility - that came with Apache. This be located in the bin - directory of wherever you installed Apache. To create the file, - type:

    -
    -        htpasswd -c /usr/local/apache/passwd/password rbowen
    -
    - -

    htpasswd will ask you for the password, and - then ask you to type it again to confirm it:

    -
    -        # htpasswd -c /usr/local/apache/passwd/passwords rbowen
    -        New password: mypassword
    -        Re-type new password: mypassword
    -        Adding password for user rbowen
    -
    - -

    If htpasswd is not in your path, of course - you'll have to type the full path to the file to get it to run. - On my server, it's located at - /usr/local/apache/bin/htpasswd

    - -

    Next, you'll need to create a file in the directory you want - to protect. This file is usually called .htaccess, - although on Windows it's called htaccess (without - the leading period.) .htaccess needs to contain - the following lines:

    -
    -        AuthType Basic
    -        AuthName "By Invitation Only"
    -        AuthUserFile /usr/local/apache/passwd/passwords
    -        AuthGroupFile /dev/null
    -        require user rbowen
    -
    - -

    The next time that you load a file from that directory, you - should see the familiar username/password dialog box pop up. If - you don't chances are pretty good that you are not permitted to - use .htaccess files in the directory in - question.

    - -

    Letting more than - one person in

    - -

    The directives above only let one person (specifically - someone with a username of rbowen) into the - directory. In most cases, you'll want to let more than one - person in. This is where the AuthGroupFile comes - in. In the example above, we've pointed - AuthGroupFile to /dev/null, which is - Unix-speak for "nowhere", or "off into space." (The Windows - NT equivalent of this is nul.)

    - -

    If you want to let more than one person in, you'll need to - create a group file that associates group names with a list of - users in that group. The format of this file is pretty simple, - and you can create it with your favorite editor. The contents - of the file will look like this:

    -
    -        GroupName: rbowen dpitts sungo rshersey
    -
    - -

    That's just a list of the members of the group in a long - line separated by spaces.

    - -

    To add a user to your already existing password file, - type:

    -
    -        htpasswd /usr/local/apache/passwd/password dpitts
    -
    - -

    You'll get the same response as before, but it will be - appended to the existing file, rather than creating a new file. - (It's the -c that makes it create a new password - file.

    - -

    Now, you need to modify your .htaccess file to - look like the following:

    -
    -        AuthType Basic
    -        AuthName "By Invitation Only"
    -        AuthUserFile /usr/local/apache/passwd/passwords
    -        AuthGroupFile /usr/local/apache/passwd/groups
    -        require group GroupName
    -
    - -

    Now, anyone that is listed in the group - GroupName, and has an entry in the - password file, will be let in, if they type the - correct password.

    - -

    There's another way to let multiple users in that is less - specific. Rather than creating a group file, you can just use - the following directive:

    -
    -        require valid-user
    -
    - -

    Using that rather than the require user rbowen - line will allow anyone in that is listed in the password file, - and who correctly enters their password. You can even emulate - the group behavior here, by just keeping a separate password - file for each group. The advantage of this approach is that - Apache only has to check one file, rather than two. The - disadvantage is that you have to maintain a bunch of password - files, and remember to reference th right one in the - AuthUserFile directive.

    - -

    Possible problems

    - -

    Because of the way that Basic authentication is specified, - your username and password must be verified every time you - request a document from the server. This is even if you're - reloading the same page, and for every image on the page (if - they come from a protected directory). As you can imagine, this - slows things down a little. The amount that it slows things - down is proportional to the size of the password file, because - it has to open up that file, and go down the list of users - until it gets to your name. And it has to do this every time a - page is loaded.

    - -

    A consequence of this is that there's a practical limit to how many - users you can put in one password file. This limit will vary - depending on the performance of your particular server machine, but - you can expect to see slowdowns once you get above a few hundred - entries, and may wish to consider a different authentication method - at that time.

    - -

    What other neat - stuff can I do?

    - -

    Authentication by username and password is only part of the - story. Frequently you want to let people in based on something - other than who they are. Something such as where they are - coming from.

    - -

    The allow and deny directives let - you allow and deny access based on the host name, or host - address, of the machine requesting a document. The directive - goes hand-in-hand with these is the order - directive, which tells Apache in which order to apply the - filters.

    - -

    The usage of these directives is:

    -
    -        allow from address
    -
    - -

    where address is an IP address (or a partial IP - address) or a fully qualified domain name (or a partial domain - name).

    - -

    For example, if you have someone spamming your message - board, and you want to keep them out, you could do the - following:

    -
    -        deny from 205.252.46.165
    -
    - -

    Visitors coming from that address will not be able to see - the content behind this directive. If, instead, you have a - machine name, rather than an IP address, you can use that.

    -
    -        deny from host.example.com
    -
    - -

    And, if you'd like to block access from an entire domain, - you can specify just part of an address or domain name:

    -
    -        deny from 192.101.205
    -        deny from cyberthugs.com
    -        deny from ke
    -
    - -

    Using order will let you be sure that you are - actually restricting things to the group that you want to let - in, by combining a deny and an allow - directive:

    -
    -        order deny,allow
    -        deny from all
    -        allow from dev.example.com
    -
    - -

    Listing just the allow directive would not do - what you want, because it will let folks from that host in, in - addition to letting everyone in. What you want is to let - only those folks in.

    - -

    More information

    - -

    You should also read the documentation for - mod_auth - which contains - some more information about how this all works.

    - - - diff --git a/docs/manual/howto/cgi.html b/docs/manual/howto/cgi.html deleted file mode 100644 index fadbceb41cf2b67b2ee2ec838106cf2f65a1a8e3..0000000000000000000000000000000000000000 --- a/docs/manual/howto/cgi.html +++ /dev/null @@ -1,499 +0,0 @@ - - - -Apache Tutorial: Dynamic Content with CGI - - - - - -

    Dynamic Content with CGI

    - - - - - - - -
    -

    Dynamic Content with -CGI

    - - -
    -Related Modules

    - -mod_alias
    -mod_cgi
    - -
    -Related Directives

    - -AddHandler
    -Options
    -ScriptAlias
    - -
    - -

    The CGI (Common Gateway Interface) defines a way for a web server -to interact with external content-generating programs, which are often -referred to as CGI programs or CGI scripts. It is the simplest, and -most common, way to put dynamic content on your web site. This -document will be an introduction to setting up CGI on your Apache web -server, and getting started writing CGI programs.

    - -
    -

    Configuring Apache to -permit CGI

    - -

    In order to get your CGI programs to work properly, you'll need to -have Apache configured to permit CGI execution. There are several ways -to do this.

    - -

    ScriptAlias

    - -

    The ScriptAlias directive tells Apache that a -particular directory is set aside for CGI programs. Apache will assume -that every file in this directory is a CGI program, and will attempt to -execute it, when that particular resource is requested by a client.

    - -

    The ScriptAlias directive looks like:

    - -
    -        ScriptAlias /cgi-bin/ /usr/local/apache/cgi-bin/
    -
    - -

    The example shown is from your default httpd.conf -configuration file, if you installed Apache in the default location. -The ScriptAlias directive is much like the -Alias directive, which defines a URL prefix that is to -mapped to a particular directory. Alias and -ScriptAlias are usually used for directories that are -outside of the DocumentRoot directory. The difference -between Alias and ScriptAlias is that -ScriptAlias has the added meaning that everything under -that URL prefix will be considered a CGI program. So, the example above -tells Apache that any request for a resource beginning with -/cgi-bin/ should be served from the directory -/usr/local/apache/cgi-bin/, and should be treated as a CGI -program.

    - -

    For example, if the URL -http://dev.rcbowen.com/cgi-bin/test.pl is requested, -Apache will attempt to execute the file -/usr/local/apache/cgi-bin/test.pl and return the output. -Of course, the file will have to exist, and be executable, and return -output in a particular way, or Apache will return an error message.

    - -

    CGI outside of -ScriptAlias directories

    - -

    CGI programs are often restricted to ScriptAlias'ed -directories for security reasons. In this way, administrators can -tightly control who is allowed to use CGI programs. However, if the -proper security precautions are taken, there is no reason why -CGI programs cannot be run from arbitrary directories. For example, -you may wish to let users have web content in their home directories -with the UserDir directive. If they want to have their -own CGI programs, but don't have access to the main -cgi-bin directory, they will need to be able to run CGI -programs elsewhere.

    - -

    Explicitly using -Options to permit CGI execution

    - -

    You could explicitly use the Options directive, inside -your main server configuration file, to specify that CGI execution was -permitted in a particular directory:

    - -
    -        <Directory /usr/local/apache/htdocs/somedir>
    -                Options +ExecCGI
    -        </Directory>
    -
    - -

    The above directive tells Apache to permit the execution of CGI -files. You will also need to tell the server what files are CGI files. -The following AddHandler directive tells the server -to treat all files with the cgi or pl -extension as CGI programs:

    - -
    -     AddHandler cgi-script cgi pl
    -
    - -

    .htaccess files

    - -

    A .htaccess file is a way to set configuration -directives on a per-directory basis. When Apache serves a resource, it -looks in the directory from which it is serving a file for a file -called .htaccess, and, if it finds it, it will apply -directives found therein. .htaccess files can be permitted -with the AllowOverride directive, which specifies what -types of directives can appear in these files, or if they are not -allowed at all. To permit the directive we will need for this purpose, -the following configuration will be needed in your main server -configuration:

    - -
    -        AllowOverride Options
    -
    - -

    In the .htaccess file, you'll need the following -directive:

    - -
    -        Options +ExecCGI
    -
    - -

    which tells Apache that execution of CGI programs is permitted in -this directory.

    - -
    -

    Writing a CGI program

    - -

    There are two main differences between ``regular'' programming, and -CGI programming.

    - -

    First, all output from your CGI program must be preceded by a -MIME-type header. This is HTTP header that tells the client what sort -of content it is receiving. Most of the time, this will look like:

    - -
    -        Content-type: text/html
    -
    - -

    Secondly, your output needs to be in HTML, or some other format that -a browser will be able to display. Most of the time, this will be HTML, -but occasionally you might write a CGI program that outputs a gif -image, or other non-HTML content.

    - -

    Apart from those two things, writing a CGI program will look a lot -like any other program that you might write.

    - -

    Your first CGI program

    - -

    The following is an example CGI program that prints one line to your -browser. Type in the following, save it to a file called -first.pl, and put it in your cgi-bin -directory.

    - -
    -        #!/usr/bin/perl
    -        print "Content-type: text/html\r\n\r\n";
    -        print "Hello, World.";
    -
    - -

    Even if you are not familiar with Perl, you should be able to see -what is happening here. The first line tells Apache (or whatever shell -you happen to be running under) that this program can be executed by -feeding the file to the interpreter found at the location -/usr/bin/perl. The second line prints the content-type -declaration we talked about, followed by two carriage-return newline -pairs. This puts a blank line after the header, to indicate the end of -the HTTP headers, and the beginning of the body. The third line prints -the string ``Hello, World.'' And that's the end of it.

    - -

    If you open your favorite browser and tell it to get the address

    - -
    -        http://www.example.com/cgi-bin/first.pl
    -
    - -

    or wherever you put your file, you will see the one line -Hello, World. appear in your browser window. It's not very -exciting, but once you get that working, you'll have a good chance of -getting just about anything working.

    - -
    -

    But it's still not -working!

    - -

    There are four basic things that you may see in your browser when -you try to access your CGI program from the web:

    - -
    -
    The output of your CGI program
    -
    Great! That means everything worked fine.

    - -
    The source code of your CGI program or a "POST Method Not Allowed" -message
    -
    That means that you have not properly configured -Apache to process your CGI program. Reread the section on configuring Apache and try to -find what you missed.

    - -
    A message starting with "Forbidden"
    That means that there -is a permissions problem. Check the Apache -error log and the section below on file permissions.

    - -
    A message saying "Internal Server Error"
    If you check the -Apache error log, you will probably find -that it says "Premature end of script headers", possibly along with an -error message generated by your CGI program. In this case, you will -want to check each of the below sections to see what might be preventing -your CGI program from emitting the proper HTTP headers.
    -
    - - -

    File permissions

    - -

    Remember that the server does not run as you. That is, when the -server starts up, it is running with the permissions of an unprivileged -user - usually ``nobody'', or ``www'' - and so it will need extra -permissions to execute files that are owned by you. Usually, the way to -give a file sufficient permissions to be executed by ``nobody'' is to -give everyone execute permission on the file:

    - -
    -        chmod a+x first.pl
    -
    - -

    Also, if your program reads from, or writes to, any other files, -those files will need to have the correct permissions to permit -this.

    - -

    The exception to this is when the server is configured to use suexec. This program allows CGI programs to -be run under different user permissions, depending on which virtual -host or user home directory they are located in. Suexec has very -strict permission checking, and any failure in that checking will -result in your CGI programs failing with an "Internal Server Error". -In this case, you will need to check the suexec log file to see what -specific security check is failing.

    - -

    Path information

    - -

    When you run a program from your command line, you have certain -information that is passed to the shell without you thinking about it. -For example, you have a path, which tells the shell where it can look -for files that you reference.

    - -

    When a program runs through the web server as a CGI program, it does -not have that path. Any programs that you invoke in your CGI program -(like 'sendmail', for example) will need to be specified by a full -path, so that the shell can find them when it attempts to execute your -CGI program.

    - -

    A common manifestation of this is the path to the script interpreter -(often perl) indicated in the first line of your CGI -program, which will look something like:

    - -
    -     #!/usr/bin/perl
    -
    - -

    Make sure that this is in fact the path to the interpreter.

    - -

    Syntax errors

    - -

    Most of the time when a CGI program fails, it's because of a problem -with the program itself. This is particularly true once you get the -hang of this CGI stuff, and no longer make the above two mistakes. -Always attempt to run your program from the command line before you -test if via a browser. This will eliminate most of your problems.

    - -

    Error logs

    - -

    The error logs are your friend. Anything that goes wrong generates -message in the error log. You should always look there first. If the -place where you are hosting your web site does not permit you access to -the error log, you should probably host your site somewhere else. Learn -to read the error logs, and you'll find that almost all of your -problems are quickly identified, and quickly solved.

    - -
    -

    What's going on behind -the scenes?

    - -

    As you become more advanced in CGI programming, it will become -useful to understand more about what's happening behind the scenes. -Specifically, how the browser and server communicate with one another. -Because although it's all very well to write a program that prints -``Hello, World.'', it's not particularly useful.

    - -

    Environment variables

    - -

    Environment variables are values that float around you as you use -your computer. They are useful things like your path (where the -computer searches for a the actual file implementing a command when you -type it), your username, your terminal type, and so on. For a full list -of your normal, every day environment variables, type env -at a command prompt.

    - -

    During the CGI transaction, the server and the browser also set -environment variables, so that they can communicate with one another. -These are things like the browser type (Netscape, IE, Lynx), the server -type (Apache, IIS, WebSite), the name of the CGI program that is being -run, and so on.

    - -

    These variables are available to the CGI programmer, and are half of -the story of the client-server communication. The complete list of -required variables is at http://hoohoo.ncsa.uiuc.edu/cgi/env.html

    - -

    This simple Perl CGI program will display all of the environment -variables that are being passed around. Two similar programs are -included in the cgi-bin directory of the Apache -distribution. Note that some variables are required, while others are -optional, so you may see some variables listed that were not in the -official list. In addition, Apache provides many different ways for -you to add your own environment variables to -the basic ones provided by default.

    - -
    -     #!/usr/bin/perl
    -     print "Content-type: text/html\n\n";
    -     foreach $key (keys %ENV) {
    -          print "$key --> $ENV{$key}<br>";
    -     }
    -
    - -

    STDIN and STDOUT

    - -

    Other communication between the server and the client happens over -standard input (STDIN) and standard output -(STDOUT). In normal everyday context, STDIN -means the keyboard, or a file that a program is given to act on, and -STDOUT usually means the console or screen.

    - -

    When you POST a web form to a CGI program, the data in -that form is bundled up into a special format and gets delivered to -your CGI program over STDIN. The program then can process -that data as though it was coming in from the keyboard, or from a -file

    - -

    The ``special format'' is very simple. A field name and its value -are joined together with an equals (=) sign, and pairs of values are -joined together with an ampersand (&). Inconvenient characters like -spaces, ampersands, and equals signs, are converted into their hex -equivalent so that they don't gum up the works. The whole data string -might look something like:

    - -
    -     name=Rich%20Bowen&city=Lexington&state=KY&sidekick=Squirrel%20Monkey
    -
    - -

    You'll sometimes also see this type of string appended to the a URL. -When that is done, the server puts that string into the environment -variable called QUERY_STRING. That's called a -GET request. Your HTML form specifies whether a -GET or a POST is used to deliver the data, by -setting the METHOD attribute in the FORM -tag.

    - -

    Your program is then responsible for splitting that string up into -useful information. Fortunately, there are libraries and modules -available to help you process this data, as well as handle other of the -aspects of your CGI program.

    - -
    -

    CGI modules/libraries

    - -

    When you write CGI programs, you should consider using a code -library, or module, to do most of the grunt work for you. This leads to -fewer errors, and faster development.

    - -

    If you're writing CGI programs in Perl, modules are available on CPAN. The most popular module for this -purpose is CGI.pm. You might also consider CGI::Lite, which implements -a minimal set of functionality, which is all you need in most -programs.

    - -

    If you're writing CGI programs in C, there are a variety of options. -One of these is the CGIC library, from http://www.boutell.com/cgic/

    - -
    -

    For more information

    - -

    There are a large number of CGI resources on the web. You can -discuss CGI problems with other users on the Usenet group -comp.infosystems.www.authoring.cgi. And the -servers mailing list from -the HTML Writers Guild is a great source of answers to your questions. -You can find out more at http://www.hwg.org/lists/hwg-servers/

    - -

    And, of course, you should probably read the CGI specification, -which has all the details on the operation of CGI programs. You can -find the original version at the NCSA and there is -an updated draft at the Common Gateway Interface RFC -project.

    - -

    When you post a question about a CGI problem that you're having, -whether to a mailing list, or to a newsgroup, make sure you provide -enough information about what happened, what you expected to happen, -and how what actually happened was different, what server you're -running, what language your CGI program was in, and, if possible, the -offending code. This will make finding your problem much simpler.

    - -

    Note that questions about CGI problems should never -be posted to the Apache bug database unless you are sure you have found -a problem in the Apache source code.

    - - - - - - diff --git a/docs/manual/howto/cgi.html.en b/docs/manual/howto/cgi.html.en deleted file mode 100644 index fadbceb41cf2b67b2ee2ec838106cf2f65a1a8e3..0000000000000000000000000000000000000000 --- a/docs/manual/howto/cgi.html.en +++ /dev/null @@ -1,499 +0,0 @@ - - - -Apache Tutorial: Dynamic Content with CGI - - - - - -

    Dynamic Content with CGI

    - - - - - - - -
    -

    Dynamic Content with -CGI

    - - -
    -Related Modules

    - -mod_alias
    -mod_cgi
    - -
    -Related Directives

    - -AddHandler
    -Options
    -ScriptAlias
    - -
    - -

    The CGI (Common Gateway Interface) defines a way for a web server -to interact with external content-generating programs, which are often -referred to as CGI programs or CGI scripts. It is the simplest, and -most common, way to put dynamic content on your web site. This -document will be an introduction to setting up CGI on your Apache web -server, and getting started writing CGI programs.

    - -
    -

    Configuring Apache to -permit CGI

    - -

    In order to get your CGI programs to work properly, you'll need to -have Apache configured to permit CGI execution. There are several ways -to do this.

    - -

    ScriptAlias

    - -

    The ScriptAlias directive tells Apache that a -particular directory is set aside for CGI programs. Apache will assume -that every file in this directory is a CGI program, and will attempt to -execute it, when that particular resource is requested by a client.

    - -

    The ScriptAlias directive looks like:

    - -
    -        ScriptAlias /cgi-bin/ /usr/local/apache/cgi-bin/
    -
    - -

    The example shown is from your default httpd.conf -configuration file, if you installed Apache in the default location. -The ScriptAlias directive is much like the -Alias directive, which defines a URL prefix that is to -mapped to a particular directory. Alias and -ScriptAlias are usually used for directories that are -outside of the DocumentRoot directory. The difference -between Alias and ScriptAlias is that -ScriptAlias has the added meaning that everything under -that URL prefix will be considered a CGI program. So, the example above -tells Apache that any request for a resource beginning with -/cgi-bin/ should be served from the directory -/usr/local/apache/cgi-bin/, and should be treated as a CGI -program.

    - -

    For example, if the URL -http://dev.rcbowen.com/cgi-bin/test.pl is requested, -Apache will attempt to execute the file -/usr/local/apache/cgi-bin/test.pl and return the output. -Of course, the file will have to exist, and be executable, and return -output in a particular way, or Apache will return an error message.

    - -

    CGI outside of -ScriptAlias directories

    - -

    CGI programs are often restricted to ScriptAlias'ed -directories for security reasons. In this way, administrators can -tightly control who is allowed to use CGI programs. However, if the -proper security precautions are taken, there is no reason why -CGI programs cannot be run from arbitrary directories. For example, -you may wish to let users have web content in their home directories -with the UserDir directive. If they want to have their -own CGI programs, but don't have access to the main -cgi-bin directory, they will need to be able to run CGI -programs elsewhere.

    - -

    Explicitly using -Options to permit CGI execution

    - -

    You could explicitly use the Options directive, inside -your main server configuration file, to specify that CGI execution was -permitted in a particular directory:

    - -
    -        <Directory /usr/local/apache/htdocs/somedir>
    -                Options +ExecCGI
    -        </Directory>
    -
    - -

    The above directive tells Apache to permit the execution of CGI -files. You will also need to tell the server what files are CGI files. -The following AddHandler directive tells the server -to treat all files with the cgi or pl -extension as CGI programs:

    - -
    -     AddHandler cgi-script cgi pl
    -
    - -

    .htaccess files

    - -

    A .htaccess file is a way to set configuration -directives on a per-directory basis. When Apache serves a resource, it -looks in the directory from which it is serving a file for a file -called .htaccess, and, if it finds it, it will apply -directives found therein. .htaccess files can be permitted -with the AllowOverride directive, which specifies what -types of directives can appear in these files, or if they are not -allowed at all. To permit the directive we will need for this purpose, -the following configuration will be needed in your main server -configuration:

    - -
    -        AllowOverride Options
    -
    - -

    In the .htaccess file, you'll need the following -directive:

    - -
    -        Options +ExecCGI
    -
    - -

    which tells Apache that execution of CGI programs is permitted in -this directory.

    - -
    -

    Writing a CGI program

    - -

    There are two main differences between ``regular'' programming, and -CGI programming.

    - -

    First, all output from your CGI program must be preceded by a -MIME-type header. This is HTTP header that tells the client what sort -of content it is receiving. Most of the time, this will look like:

    - -
    -        Content-type: text/html
    -
    - -

    Secondly, your output needs to be in HTML, or some other format that -a browser will be able to display. Most of the time, this will be HTML, -but occasionally you might write a CGI program that outputs a gif -image, or other non-HTML content.

    - -

    Apart from those two things, writing a CGI program will look a lot -like any other program that you might write.

    - -

    Your first CGI program

    - -

    The following is an example CGI program that prints one line to your -browser. Type in the following, save it to a file called -first.pl, and put it in your cgi-bin -directory.

    - -
    -        #!/usr/bin/perl
    -        print "Content-type: text/html\r\n\r\n";
    -        print "Hello, World.";
    -
    - -

    Even if you are not familiar with Perl, you should be able to see -what is happening here. The first line tells Apache (or whatever shell -you happen to be running under) that this program can be executed by -feeding the file to the interpreter found at the location -/usr/bin/perl. The second line prints the content-type -declaration we talked about, followed by two carriage-return newline -pairs. This puts a blank line after the header, to indicate the end of -the HTTP headers, and the beginning of the body. The third line prints -the string ``Hello, World.'' And that's the end of it.

    - -

    If you open your favorite browser and tell it to get the address

    - -
    -        http://www.example.com/cgi-bin/first.pl
    -
    - -

    or wherever you put your file, you will see the one line -Hello, World. appear in your browser window. It's not very -exciting, but once you get that working, you'll have a good chance of -getting just about anything working.

    - -
    -

    But it's still not -working!

    - -

    There are four basic things that you may see in your browser when -you try to access your CGI program from the web:

    - -
    -
    The output of your CGI program
    -
    Great! That means everything worked fine.

    - -
    The source code of your CGI program or a "POST Method Not Allowed" -message
    -
    That means that you have not properly configured -Apache to process your CGI program. Reread the section on configuring Apache and try to -find what you missed.

    - -
    A message starting with "Forbidden"
    That means that there -is a permissions problem. Check the Apache -error log and the section below on file permissions.

    - -
    A message saying "Internal Server Error"
    If you check the -Apache error log, you will probably find -that it says "Premature end of script headers", possibly along with an -error message generated by your CGI program. In this case, you will -want to check each of the below sections to see what might be preventing -your CGI program from emitting the proper HTTP headers.
    -
    - - -

    File permissions

    - -

    Remember that the server does not run as you. That is, when the -server starts up, it is running with the permissions of an unprivileged -user - usually ``nobody'', or ``www'' - and so it will need extra -permissions to execute files that are owned by you. Usually, the way to -give a file sufficient permissions to be executed by ``nobody'' is to -give everyone execute permission on the file:

    - -
    -        chmod a+x first.pl
    -
    - -

    Also, if your program reads from, or writes to, any other files, -those files will need to have the correct permissions to permit -this.

    - -

    The exception to this is when the server is configured to use suexec. This program allows CGI programs to -be run under different user permissions, depending on which virtual -host or user home directory they are located in. Suexec has very -strict permission checking, and any failure in that checking will -result in your CGI programs failing with an "Internal Server Error". -In this case, you will need to check the suexec log file to see what -specific security check is failing.

    - -

    Path information

    - -

    When you run a program from your command line, you have certain -information that is passed to the shell without you thinking about it. -For example, you have a path, which tells the shell where it can look -for files that you reference.

    - -

    When a program runs through the web server as a CGI program, it does -not have that path. Any programs that you invoke in your CGI program -(like 'sendmail', for example) will need to be specified by a full -path, so that the shell can find them when it attempts to execute your -CGI program.

    - -

    A common manifestation of this is the path to the script interpreter -(often perl) indicated in the first line of your CGI -program, which will look something like:

    - -
    -     #!/usr/bin/perl
    -
    - -

    Make sure that this is in fact the path to the interpreter.

    - -

    Syntax errors

    - -

    Most of the time when a CGI program fails, it's because of a problem -with the program itself. This is particularly true once you get the -hang of this CGI stuff, and no longer make the above two mistakes. -Always attempt to run your program from the command line before you -test if via a browser. This will eliminate most of your problems.

    - -

    Error logs

    - -

    The error logs are your friend. Anything that goes wrong generates -message in the error log. You should always look there first. If the -place where you are hosting your web site does not permit you access to -the error log, you should probably host your site somewhere else. Learn -to read the error logs, and you'll find that almost all of your -problems are quickly identified, and quickly solved.

    - -
    -

    What's going on behind -the scenes?

    - -

    As you become more advanced in CGI programming, it will become -useful to understand more about what's happening behind the scenes. -Specifically, how the browser and server communicate with one another. -Because although it's all very well to write a program that prints -``Hello, World.'', it's not particularly useful.

    - -

    Environment variables

    - -

    Environment variables are values that float around you as you use -your computer. They are useful things like your path (where the -computer searches for a the actual file implementing a command when you -type it), your username, your terminal type, and so on. For a full list -of your normal, every day environment variables, type env -at a command prompt.

    - -

    During the CGI transaction, the server and the browser also set -environment variables, so that they can communicate with one another. -These are things like the browser type (Netscape, IE, Lynx), the server -type (Apache, IIS, WebSite), the name of the CGI program that is being -run, and so on.

    - -

    These variables are available to the CGI programmer, and are half of -the story of the client-server communication. The complete list of -required variables is at http://hoohoo.ncsa.uiuc.edu/cgi/env.html

    - -

    This simple Perl CGI program will display all of the environment -variables that are being passed around. Two similar programs are -included in the cgi-bin directory of the Apache -distribution. Note that some variables are required, while others are -optional, so you may see some variables listed that were not in the -official list. In addition, Apache provides many different ways for -you to add your own environment variables to -the basic ones provided by default.

    - -
    -     #!/usr/bin/perl
    -     print "Content-type: text/html\n\n";
    -     foreach $key (keys %ENV) {
    -          print "$key --> $ENV{$key}<br>";
    -     }
    -
    - -

    STDIN and STDOUT

    - -

    Other communication between the server and the client happens over -standard input (STDIN) and standard output -(STDOUT). In normal everyday context, STDIN -means the keyboard, or a file that a program is given to act on, and -STDOUT usually means the console or screen.

    - -

    When you POST a web form to a CGI program, the data in -that form is bundled up into a special format and gets delivered to -your CGI program over STDIN. The program then can process -that data as though it was coming in from the keyboard, or from a -file

    - -

    The ``special format'' is very simple. A field name and its value -are joined together with an equals (=) sign, and pairs of values are -joined together with an ampersand (&). Inconvenient characters like -spaces, ampersands, and equals signs, are converted into their hex -equivalent so that they don't gum up the works. The whole data string -might look something like:

    - -
    -     name=Rich%20Bowen&city=Lexington&state=KY&sidekick=Squirrel%20Monkey
    -
    - -

    You'll sometimes also see this type of string appended to the a URL. -When that is done, the server puts that string into the environment -variable called QUERY_STRING. That's called a -GET request. Your HTML form specifies whether a -GET or a POST is used to deliver the data, by -setting the METHOD attribute in the FORM -tag.

    - -

    Your program is then responsible for splitting that string up into -useful information. Fortunately, there are libraries and modules -available to help you process this data, as well as handle other of the -aspects of your CGI program.

    - -
    -

    CGI modules/libraries

    - -

    When you write CGI programs, you should consider using a code -library, or module, to do most of the grunt work for you. This leads to -fewer errors, and faster development.

    - -

    If you're writing CGI programs in Perl, modules are available on CPAN. The most popular module for this -purpose is CGI.pm. You might also consider CGI::Lite, which implements -a minimal set of functionality, which is all you need in most -programs.

    - -

    If you're writing CGI programs in C, there are a variety of options. -One of these is the CGIC library, from http://www.boutell.com/cgic/

    - -
    -

    For more information

    - -

    There are a large number of CGI resources on the web. You can -discuss CGI problems with other users on the Usenet group -comp.infosystems.www.authoring.cgi. And the -servers mailing list from -the HTML Writers Guild is a great source of answers to your questions. -You can find out more at http://www.hwg.org/lists/hwg-servers/

    - -

    And, of course, you should probably read the CGI specification, -which has all the details on the operation of CGI programs. You can -find the original version at the NCSA and there is -an updated draft at the Common Gateway Interface RFC -project.

    - -

    When you post a question about a CGI problem that you're having, -whether to a mailing list, or to a newsgroup, make sure you provide -enough information about what happened, what you expected to happen, -and how what actually happened was different, what server you're -running, what language your CGI program was in, and, if possible, the -offending code. This will make finding your problem much simpler.

    - -

    Note that questions about CGI problems should never -be posted to the Apache bug database unless you are sure you have found -a problem in the Apache source code.

    - - - - - - diff --git a/docs/manual/howto/cgi.html.ja.jis b/docs/manual/howto/cgi.html.ja.jis deleted file mode 100644 index b6bf58c2194ce19fc8037a58918bd05370158155..0000000000000000000000000000000000000000 --- a/docs/manual/howto/cgi.html.ja.jis +++ /dev/null @@ -1,495 +0,0 @@ - - - -Apache Tutorial: CGI $B$K$h$kF0E*%3%s%F%s%D(B - - - - - -

    CGI $B$K$h$kF0E*%3%s%F%s%D(B

    - - - - - - - -
    -

    CGI $B$K$h$kF0E*%3%s%F%s%D(B

    - - -
    -$B4XO"%b%8%e!<%k(B

    - -mod_alias
    -mod_cgi
    - -
    -$B4XO"%G%#%l%/%F%#%V(B

    - -AddHandler
    -Options
    -ScriptAlias
    - -
    - -

    CGI (Common Gateway Interface) $B$O!"%&%'%V%5!<%P$,%3%s%F%s%D@8@.$r$9$k(B -$B30It%W%m%0%i%`$H6(D4$7$FF0:n$9$k$?$a$NJ}K!$rDj5A$7$F$$$^$9!#$=$N%W%m%0%i%`$O$7$P$7$P(B -CGI $B%W%m%0%i%`$d(B CGI $B%9%/%j%W%H$H8F$P$l$^$9!#(BCGI $B$O!"%&%'%V%5%$%H$K(B -$BF0E*$J%3%s%F%s%D$rCV$/$?$a$N:G$b4JC1$G0lHLE*$JJ}K!$G$9!#$3$N%I%-%e%a%s%H$O!"(B -Apache $B%&%'%V%5!<%P$G(B CGI $B$r@_Dj$7!"(BCGI $B%W%m%0%i%`$r=q$-;O$a$k$?$a$N(B -$BF~Lg=q$H$J$k$G$7$g$&!#(B

    - -
    -

    CGI $B$r5v2D$9$k$h$&$K(B Apache $B$r(B -$B@_Dj$9$k(B

    - -

    CGI $B%W%m%0%i%`$r@5$7$/F0:n$5$;$k$K$O!"(BCGI $B$r5v2D$9$k$h$&$K(B -Apache $B$N@_Dj$r9T$&I,MW$,$"$j$^$9!#$3$l$r9T$J$&$?$a$NJ}K!$,$$$/$D$+(B -$B$"$j$^$9!#(B

    - -

    ScriptAlias

    - -

    ScriptAlias $B%G%#%l%/%F%#%V$r;HMQ$7$F!"(BCGI $B%W%m%0%i%`MQ$N(B -$BFCJL$JJL%G%#%l%/%H%j$r(B Apache $B$K@_Dj$7$^$9!#(B -Apache $B$O!"$3$N%G%#%l%/%H%jCf$NA4$F$N%U%!%$%k$r(B CGI $B%W%m%0%i%`$G$"$k$H(B -$B2>Dj$7$^$9!#$=$7$F!"$3$NFCJL$J%j%=!<%9$,%/%i%$%"%s%H$+$iMW5a$5$l$k$H!"(B -$B$=$N%W%m%0%i%`$N - -

    ScriptAlias $B%G%#%l%/%F%#%V$O0J2<$N$h$&$K;HMQ$7$^$9(B:

    - -
    -        ScriptAlias /cgi-bin/ /usr/local/apache/cgi-bin/
    -
    - -

    $B%G%U%)%k%H0LCV$K(B Apache $B$r%$%s%9%H!<%k$7$?$J$i$P!"(B -$B$3$NNc$O%G%U%)%k%H>uBV$N(B httpd.conf $B@_Dj%U%!%$%k(B -$B$K4^$^$l$F$$$^$9!#(B -ScriptAlias $B%G%#%l%/%F%#%V$O!"(BURL $B$NA0$KIU2C$9$k%G%#%l%/%H%j$rDj5A$9$k(B Alias $B%G%#%l%/%F%#%V$H$+$J$j;w$F$$$^$9!#(B -Alias $B$H(B ScriptAlias $B$ODL>o!"(B -DocumentRoot $B%G%#%l%/%H%j30$N%G%#%l%/%H%j$N$?$a$K;HMQ$5$l$^$9!#(B -Alias $B$H(B ScriptAlias $B$H$N:9$O!"(B -ScriptAlias $B$,@\F,<-$G;O$^$k$9$Y$F$N(B URL $B$O(B CGI $B%W%m%0%i%`$H(B -$B$_$J$5$l$k$H$$$&DI2C$N0UL#$r4^$s$G$$$k$3$H$G$9!#=>$C$F!"(B -$B>e5-$NNc$G$O!"(B/cgi-bin/ -$B$G;O$^$k%j%=!<%9$X$N$"$i$f$k%j%/%(%9%H$KBP$7$F!"%G%#%l%/%H%j(B -/usr/local/apache/cgi-bin/ -$B$+$iDs6!$7!"$=$l$i$r(B CGI $B%W%m%0%i%`$H$7$F07$&$h$&(B Apache $B$K<($7$^$9!#(B

    - -

    $BNc$($P!"(BURL http://dev.rcbowen.com/cgi-bin/test.pl -$B$,MW5a$5$l$?>l9g!"(BApache $B$O(B $B%U%!%$%k(B -/usr/local/apache/cgi-bin/test.pl $B$r -ScriptAlias $B%G%#%l%/%H%j30$N(B CGI - -

    CGI $B%W%m%0%i%`$O!"%;%-%e%j%F%#>e$NM}M3$+$i(B -ScriptAlias $B$5$l$?%G%#%l%/%H%j$K@)8B$5$l$k$3$H$,$7$P$7$P$"$j$^$9!#(B -$B$3$NJ}K!$K$h$j!"(BCGI $B%W%m%0%i%`$r;HMQ$G$-$k%f!<%6$r4IM}UserDir $B%G%#%l%/%F%#%V$G(B -$BH`$i$N%[!<%`%G%#%l%/%H%jG[2<$K%&%'%V%3%s%F%s%D$r;}$?$;$?$$$H$7$^$9!#(B -$B$b$7!"H`$i$,(B CGI $B%W%m%0%i%`$r;}$D$3$H$rK>$s$G$$$F$b!"%a%$%s$N(B -cgi-bin $B%G%#%l%/%H%j$X$N%"%/%;%9$,$G$-$J$$>l9g!"(BCGI $B%W%m%0%i%`$r(B -$B$N>l=j$,I,MW$K$J$j$^$9!#(B

    - -

    -CGI $B$N

    - -

    $B%5!<%P$N%a%$%s$N@_Dj%U%!%$%kCf$G(B Options $B%G%#%l%/%F%#%V$r(B -$BL@<(E*$K;HMQ$9$k$3$H$G!"FCDj$N%G%#%l%/%H%jG[2<$G(B CGI $B$N - -

    -        <Directory /usr/local/apache/htdocs/somedir>
    -                Options +ExecCGI
    -        </Directory>
    -
    - -

    $B>e5-%G%#%l%/%F%#%V$O!"(BCGI $B%U%!%$%k$NAddHandler -$B%G%#%l%/%F%#%V$NNc$G$O!"(Bcgi $B$^$?$O(B pl $B$r3HD%;R$K(B -$B;}$D$9$Y$F$N%U%!%$%k$r(B CGI $B%W%m%0%i%`$H$7$F$_$J$9$3$H$r%5!<%P$KEA$($^$9(B:

    - -

    -     AddHandler cgi-script cgi pl
    -
    - -

    .htaccess $B%U%!%$%k(B

    - -

    .htaccess $B%U%!%$%k$O!"%G%#%l%/%H%jKh$K(B -$B%G%#%l%/%F%#%V$r;XDj$9$kJ}K!$G$9!#(B -Apache $B$O!"%j%=!<%9$rDs6!$9$k$H$-$K!"Ds6!$9$k%U%!%$%k$,CV$+$l$F$$$k(B -$B%G%#%l%/%H%jCf$N(B .htaccess $B$H$$$&%U%!%$%k$r;2>H$7$^$9!#(B -$B$=$N%U%!%$%k$rH/8+$7$?$i!"$=$NCf$GH/8+$5$l$?%G%#%l%/%F%#%V$,E,MQ$5$l$^$9!#(B -.htaccess $B%U%!%$%k$O!"(BAllowOverride -$B%G%#%l%/%F%#%V$N;XDj$K$h$j;H$($k$h$&$K$J$j$^$9!#(B -AllowOverride $B%G%#%l%/%F%#%V$O!"(B.htaccess $B%U%!%$%k$G(B -$B@_Dj$G$-$k%G%#%l%/%F%#%V$N%?%$%W$r;XDj$7$^$9!#(B -AllowOverride $B%G%#%l%/%F%#%V$N;XDj$,$J$$>l9g!"$^$C$?$/;H$($^$;$s!#(B -CGI $B$N - -

    -        AllowOverride Options
    -
    - -

    .htaccess $B%U%!%$%k$G$O!" - -

    -        Options +ExecCGI
    -
    - -

    $B$3$N@_Dj$G$O!"$3$N%G%#%l%/%H%j$K$*$1$k(B CGI $B%W%m%0%i%`$N - -


    -

    CGI $B%W%m%0%i%`$r=q$/(B

    - -

    $BDL>o$N%W%m%0%i%_%s%0$H(B CGI $B%W%m%0%i%_%s%0$N4V$K$O - -

    $B0l$D$O!"(BCGI $B%W%m%0%i%`$N$9$Y$F$N=PNO$K$O(B MIME-type -$B%X%C%@$rIU$1$J$1$l$P$J$j$^$;$s!#$3$l$O$I$N$h$&$Jl9g$G$O!"(B -$B - -

    -        Content-type: text/html
    -
    - -

    $B$b$&0l$D$O!"=PNO$r(B HTML $B$+!"%V%i%&%6$,I=<($9$k$3$H$,(B -$B$G$-$k2?$+B>$N7A<0$K$9$kI,MW$,$"$j$^$9!#(B -$BBgDq$N>l9g$O(B HTML $B$G$7$g$&$,!"(BGIF $B%$%a!<%8$dB>$NHs(B HTML -$B%3%s%F%s%D$r=PNO$9$k(B CGI $B%W%m%0%i%`$r=q$/$3$H$b$"$k$G$7$g$&!#(B

    - -

    $B$3$l$iFsE@0J30$G$O!"(BCGI $B%W%m%0%i%`$r=q$/$3$H$O!"$"$J$?$,=q$$$F$$$k(B -$BB>$N%W%m%0%i%`$HBg$$$K;w$F$$$k$G$7$g$&!#(B

    - -

    $B$"$J$?$N:G=i$N(B CGI $B%W%m%0%i%`(B

    - -

    $Bfirst.pl $B$H$$$&%U%!%$%k$KJ]B8$7!"$=$l$r(B -cgi-bin $B%G%#%l%/%H%j$KCV$$$F$/$@$5$$!#(B

    - -
    -        #!/usr/bin/perl
    -        print "Content-type: text/html\r\n\r\n";
    -        print "Hello, World.";
    -
    - -

    Perl $B$K@:DL$7$F$$$J$/$F$b!"2?$,5/$3$k$+$r(B -$BM}2r$9$k$3$H$O$G$-$k$O$:$G$9!#(B -1 $B9TL\$O!"(B/usr/bin/perl $B$G8+$D$1(B -$B$i$l$k%$%s%?%W%j%?$K$3$N%U%!%$%k$r6!5k$9$k$3$H$G$3$N%W%m%0%i%`$,e$G - -

    $B9%$_$N%V%i%&%6$r3+$-!"%"%I%l%9(B

    - -
    -        http://www.example.com/cgi-bin/first.pl
    -
    - -

    $B$"$k$$$O%U%!%$%k$rCV$$$?%m%1!<%7%g%s$r;XDj$9$k$H!"(B -Hello, World. $B$H$$$&(B 1 $B9T$,%V%i%&%6%&%#%s%I$K8=$l$k$G$7$g$&!#(B -$B$=$l$O$"$^$j%(%-%5%$%F%#%s%0$J$3$H$G$O$"$j$^$;$s!#(B -$B$7$+$7!"$3$l$,$&$^$/F0$1$P!"(B -$BB>$N$I$N$h$&$J$b$N$G$bF0$+$9$3$H$,$G$-$k$h$&$K$J$j$^$9!#(B

    - -
    -

    $B$7$+$7!"$^$@F0$+$J$$(B !

    - -

    $B%&%'%V$+$i(B CGI $B%W%m%0%i%`$X$N%"%/%;%9$r9T$J$C$?$H$-!"(B -$B%V%i%&%6$G8+$k2DG=@-$,$"$k;M$D$N4pK\E*$J$3$H$,$"$j$^$9(B:

    - -
    -
    CGI $B%W%m%0%i%`$N=PNO(B
    -
    $BAG@2$i$7$$(B ! $B$=$l$O$9$Y$F$,$&$^$/F0$$$?$3$H$r0UL#$7$^$9!#(B

    - -
    CGI $B%W%m%0%i%`$N%=!<%9%3!<%I!"$^$?$O(B "POST Method Not Allowed" -$B$H$$$&%a%C%;!<%8(B
    -
    $B$3$l$O!"(BCGI $B%W%m%0%i%`$r=hM}$G$-$k$h$&(B Apache $B$rE,@Z$K@_Dj$7$F(B -$B$$$J$+$C$?$3$H$r0UL#$7$^$9!#(B -$B!V(BCGI $B$r5v2D$9$k$h$&$K(B Apache $B$r@_Dj$9$k!W(B$B$N>O$rFI$_D>$7!"$"$J$?$,2?$r4V0c$($?$+$r(B -$BC5$7$F$_$F$/$@$5$$!#(B

    - -
    $B%a%C%;!<%8$,(B "Forbidden" $B$G;O$^$C$F$$$k(B
    -
    $B$3$l$O%Q!<%_%C%7%g%s$NLdBj$H$$$&$3$H$r0UL#$7$^$9!#(B -Apache $B$N%(%i!<%m%0(B$B$H!"8e=R$N(B -$B!V%U%!%$%k$N%Q!<%_%C%7%g%s!W(B$B$N>O$r(B -$B%A%'%C%/$7$F$/$@$5$$!#(B -

    - -
    "Internal Server Error" $B$H$$$&%a%C%;!<%8(B
    -
    Apache $B$N%(%i!<%m%0(B$B$r%A%'%C%/$9$k$H!"(B -"Premature end of script headers" $B$H$$$&%m%0$,5-O?$5$l$F$$$k$H;W$$$^$9!#(B -$B$=$7$F!"$*$=$i$/(B CGI $B%W%m%0%i%`$K$h$C$F@8@.$5$l$?%(%i!<%a%C%;!<%8$b5-O?$5$l$F$$$k$G$7$g$&!#(B -$B$3$N>l9g!"(BCGI $B%W%m%0%i%`$,E,@Z$J(B HTTP $B%X%C%@$r=PNO$G$-$J$$860x$r(B -$BCN$k$?$a$K!"0J2<$N3F>O$G%A%'%C%/$7$F$_$F$/$@$5$$!#(B
    -
    - -

    $B%U%!%$%k$N%Q!<%_%C%7%g%s(B

    - -

    $B%5!<%P$O$"$J$?$N8"8B$Go(B ``nobody'' $B$d(B ``www'' -$B$N8"8B$Go!"(B``nobody'' $B$, - -

    -        chmod a+x first.pl
    -
    - -

    $B$^$?!"$b$7$"$J$?$N%W%m%0%i%`$,B>$N%U%!%$%k$rFI$_=q$-$9$k$J$i$P!"(B -$B$=$l$i$N%U%!%$%k$O!"$3$l$,2DG=$H$J$k@5$7$$%Q!<%_%C%7%g%s$r;}$C$F$$$kI,MW$,(B -$B$"$j$^$9!#(B

    - -

    $B$3$l$KBP$9$kNc30$O!"%5!<%P$,(B suexec $B$r(B -$B;HMQ$9$k$h$&@_Dj$5$l$F$$$k>l9g$G$9!#(B -suexec $B$O!"(BCGI $B%W%m%0%i%`$,CV$+$l$F$$$k%P!<%A%c%k%[%9%H$^$?$O%f!<%6$N%[!<%`(B -$B%G%#%l%/%H%j$K$h$C$F!"0[$J$k%f!<%68"8B$G(B -$Bl9g!"$I$N%;%-%e%j%F%#%A%'%C%/$,<:GT$7$F$$$k$N$+$rCN$k(B -$B$?$a$K(B suexec $B%m%0%U%!%$%k$r%A%'%C%/$9$kI,MW$,$"$j$^$9!#(B

    - -

    $B%Q%9>pJs(B

    - -

    $B%3%^%s%I%i%$%s$+$i%W%m%0%i%`$rpJs$,$"$j$^$9!#(B -$BNc$($P!";2>H$9$k%U%!%$%k$N$?$a$K$I$3$r8!:w$7$?$i$h$$$+$r%7%'%k$KEA$($k%Q%9$,(B -$B$"$j$^$9!#(B

    - -

    $B%W%m%0%i%`$,(B CGI $B%W%m%0%i%`$H$7$F%&%'%V%5!<%P$K$h$C$F - -

    $BF1MM$J$3$H$O!"%9%/%j%W%H$N%$%s%?%W%j%?(B ($B$7$P$7$P(B perl ) -$B$X$N%Q%9$G!"(BCGI $B%W%m%0%i%`$N(B 1 $B9TL\$K - -

    -     #!/usr/bin/perl
    -
    - -

    $B$3$l$,%$%s%?!<%W%j%?$X$N - -

    $B9=J8%(%i!<(B

    - -

    CGI $B%W%m%0%i%`$,<:GT$9$k$N$OBgDq!"%W%m%0%i%`<+?H$KLdBj$,$"$k>l9g$G$9!#(B -$B0lEY(B CGI $B$N;H$$J}$rM}2r$7!"A0=R$NFs$D$N8m$j$rHH$7$F$$$J$$$J$i$P!"(B -$B$^$:4V0c$$$J$/$=$&$G$7$g$&!#%V%i%&%6$rDL$7$F%F%9%H$r9T$&A0$KI,$:!"%3%^%s%I%i%$%s(B -$B$+$i%W%m%0%i%`$N - -

    $B%(%i!<%m%0(B

    - -

    $B%(%i!<%m%0$OM'C#$G$9!#A4$F$N$&$^$/$$$+$J$$$3$H$O!"%(%i!<%m%0$K(B -$B%a%C%;!<%8$r@8@.$7$^$9!#I,$:$=$l$r:G=i$K8+$k$Y$-$G$9!#(B -$B$b$7!"$"$J$?$,%&%'%V%5%$%H$rl=j$,%(%i!<%m%0$N;2>H$r(B -$B5v$7$F$$$J$$$J$i$P!"$-$C$HB>$N%5%$%H$G - -


    -

    $BN"$G2?$,5/$3$C$F$$$k$N$+(B?

    - -

    CGI $B%W%m%0%i%_%s%0$K=OC#$9$k$H!"N"$G5/$3$C$F$$$k(B -$B$3$H$K$D$$$F99$KM}2r$9$k$3$H$OM-1W$K$J$k$G$7$g$&!#%V%i%&%6$H(B -$B%5!<%P$,$I$N$h$&$KAj8_DL?.$9$k$+$K$D$$$F$OFC$K$=$&$G$9!#$J$<$J$i!"(B -``Hello, World.'' $B$r0u;z$9$k%W%m%0%i%`$r=q$/$3$H$O$^$3$H$K7k9=$G$9$,!"(B -$B$=$l$OFC$KM-1W$G$O$"$j$^$;$s!#(B

    - -

    $B4D6-JQ?t(B

    - -

    $B4D6-JQ?t$O!"$"$J$?$,%3%s%T%e!<%?$r;H$&$H$-$KJU$j$KB8:_$7$F$$$kCM$G$9!#(B -$B$=$l$i$O!"%Q%9(B ($B%3%^%s%I$r%?%$%W$7$?$H$-$K!"Co$N!"KhF|$N4D6-JQ?t$N40A4$J%j%9%H$rD4$Y$k$K$O!"%3%^%s%I%W%m%s%W%H$G(B -env $B$rF~NO$7$^$9!#(B

    - -

    CGI $B$N=hM}Cf!"%5!<%P$H%V%i%&%6$b4D6-JQ?t$r@_Dj$7!"$=$l$K$h$j(B -$BAj8_$KDL?.$9$k$3$H$,$G$-$k$h$&$K$J$j$^$9!#(B -$B$=$N4D6-JQ?t$O!"%V%i%&%6%?%$%W(B (Netscape, IE, Lynx)$B!"(B -$B%5!<%P%?%$%W(B (Apache, IIS, WebSite)$B!"A0(B -$B$J$I$N$h$&$J$b$N$G$9!#(B

    - -

    $B$3$l$i$NJQ?t$O(B CGI $B%W%m%0%i%^$,;HMQ$9$k$3$H$,$G$-$^$9!#$=$7$F!"(B -$B$=$l$O%/%i%$%"%s%H$H%5!<%P$NDL?.$NOC$NH>J,$G$9!#I,MW$JJQ?t$N40A4$J%j%9%H$O(B -http://hoohoo.ncsa.uiuc.edu/cgi/env.html -$B$K$"$j$^$9!#(B

    - -

    $B0J2<$NC1=c$J(B Perl CGI $B%W%m%0%i%`$O!"EO$5$l$kA4$F$N4D6-JQ?t$r(B -$BI=<($7$^$9!#F1MM$N%W%m%0%i%`$O!"(BApache $B%G%#%9%H%j%S%e!<%7%g%s$N(B -cgi-bin $B%G%#%l%/%H%j$KFs$D4^$^$l$F$$$^$9!#(B -$B$$$/$D$+$NJQ?t$,I,?\$G$"$j!"$$$/$D$+$OG$0U$G$"$k$3$H$KCm0U$7$F$/$@$5$$!#(B -$B$=$7$F!"8x<0$N%j%9%H$K$O$J$$$$$/$D$+$NJQ?t$,I=<($5$l$F$$$k$+$b$7$l$^$;$s!#(B -$B$5$i$K!"(BApache $B$O%G%U%)%k%H$GMQ0U$5$l$F$$$k4pK\E*$J$b$N$K(B -$B$"$J$?<+?H$N4D6-JQ?t$r2C$($k(B -$B$?$a$N!"B?$/$N0[$J$kJ}K!$rMQ0U$7$F$7$^$9!#(B

    - -
    -     #!/usr/bin/perl
    -     print "Content-type: text/html\n\n";
    -     foreach $key (keys %ENV) {
    -          print "$key --> $ENV{$key}<br>";
    -     }
    -
    - -

    STDIN $B$H(B STDOUT

    - -

    $B%5!<%P$H%/%i%$%"%s%H4V$N$b$&0l$D$NDL?.$O!"I8=`F~NO(B (STDIN)$B$H(B -$BI8=`=PNO(B (STDOUT) $B$rDL$8$F9T$J$o$l$^$9!#DL>o$NJ8L.$K$*$$$F!"(B -STDIN $B$O%-!<%\!<%I$d%W%m%0%i%`$,F0:n$9$k$?$a$KM?$($i$l$k(B -$B%U%!%$%k$r0UL#$7!"(BSTDOUT $B$ODL>o%3%s%=!<%k$^$?$O%9%/%j!<%s$r(B -$B0UL#$7$^$9!#(B

    - -

    $B%&%'%V%U%)!<%`$+$i(B CGI $B%W%m%0%i%`$X(BPOST $B$7$?$H$-!"(B -$B%U%)!<%`$N%G!<%?$OFCJL$J%U%)!<%^%C%H$GB+$M$i$l!"(BSTDIN $B$r(B -$BDL$7$F!"(BCGI $B%W%m%0%i%`$K0z$-EO$5$l$^$9!#%W%m%0%i%`$O%G!<%?$,%-!<%\!<%I(B -$B$b$7$/$O%U%!%$%k$+$iMh$F$$$?$+$N$h$&$K=hM}$9$k$3$H$,$G$-$^$9!#(B

    - -

    $B!VFCJL$J%U%)!<%^%C%H!W$O$H$F$bC1=c$G$9!#%U%#!<%k%IL>$HCM$O%$%3!<%k(B -(=) $B$G7k$P$l$^$9!#$=$7$FCM$NAH$O%"%s%Q%5%s%I(B (&) $B$G(B -$B7k$P$l$^$9!#%9%Z!<%9!"%"%s%Q%5%s%I!"%$%3!<%k$N$h$&$JLLE]$JJ8;z(B -$B$O!"$=$l$i$,F0:n$rBLL\$K$7$J$$$h$&$K$=$NJ8;z$KAjEv$9$k(B 16 $B?J$KJQ49$5$l$^$9!#(B -$BA4%G!<%?J8;zNs$O!"0J2<$N$h$&$K$J$j$^$9(B:

    - -
    -     name=Rich%20Bowen&city=Lexington&state=KY&sidekick=Squirrel%20Monkey
    -
    - -

    $B;~!9!"$3$N$h$&$JJ8;zNs$,(B URL $B$KIU2C$5$l$k$N$r8+$k$G$7$g$&!#(B -$B$=$N>l9g!"%5!<%P$O(B QUERY_STRING $B$H$$$&4D6-JQ?t$K$=$N(B -$BJ8;zNs$rF~$l$^$9!#$=$l$O(B GET $B%j%/%(%9%H$H8F$P$l$^$9!#(B -HTML $B%U%)!<%`$G$O!"%G!<%?$rEO$9$?$a$K(B GET $B$H(B POST -$B$N$I$A$i$r;HMQ$9$k$+$r!"(B -FORM$B%?%0$N(B METHOD $BB0@-$N@_Dj$G;XDj$7$^$9!#(B

    - -

    CGI $B%W%m%0%i%`$O!"$=$NJ8;zNs$rLr$KN)$D>pJs$KJ,3d$9$k@UG$$,$"$j$^$9!#(B -$B9,$$$K$b!"$=$N%G!<%?=hM}$r=u$1$k%i%$%V%i%j$d%b%8%e!<%k$,B8:_$7$^$9!#$3$l$i$O!"(B -CGI $B%W%m%0%i%`$NB>$NLL$G$bF1MM$KLr$KN)$A$^$9!#(B

    - -
    -

    CGI $B%b%8%e!<%k(B/$B%i%$%V%i%j(B

    - -

    CGI $B%W%m%0%i%`$r=q$/$H$-!"LLE]$J;E;v$NBgItJ,$r$7$F$/$l$k(B -$B%3!<%I%i%$%V%i%j$^$?$O%b%8%e!<%k$r;H$&$3$H$r8!F$$9$Y$-$G$9!#(B -$B$3$l$O%(%i!<$r8:$i$7!"Aa$$3+H/$K$D$J$,$j$^$9!#(B

    - -

    Perl $B$G(B CGI $B%W%m%0%i%`$r=q$$$F$$$k$J$i!"%b%8%e!<%k$O(B -CPAN $B$GDs6!$5$l$F$$$^$9!#$3$NL\E*$N$?$a$N(B -$B:G$bIa5Z$7$F$$$k%b%8%e!<%k$O(B CGI.pm $B$G$9!#(B -CGI::Lite $B$b8!F$$7$^$7$g$&!#$3$l$O!"$[$H$s$I$N%W%m%0%i%`$K$*$$$FI,MW$H$9$k$9$Y$F$N5!G=$N:G>.%;%C%H$N - -

    C $B$G(B CGI $B%W%m%0%i%`$r=q$$$F$$$k$J$i!"$$$m$$$m$J(B -$B%*%W%7%g%s$,$"$j$^$9!#$3$l$i$NFb$N0l$D$O(B -http://www.boutell.com/cgic/ -$B$GDs6!$5$l$F$$$k(B CGIC $B%i%$%V%i%j$G$9!#(B

    - -
    -

    $B99$J$k>pJs(B

    - -

    CGI $B$K4X$9$k>pJs$O%&%'%V$G?tB?$/Ds6!$5$l$F$$$^$9!#(BCGI $B$NLdBj$K$D$$$F$O(B -Usenet $B$N(B comp.infosystems.www.authoring.cgi $B$G!"B>$N%f!<%6$H(B -$BO@5D$9$k$3$H$,$G$-$^$9!#(BHTML Writers Guide $B$N(B -servers$B%a!<%j%s%0%j%9%H(B -$B$O!"$"$J$?$Nhttp://www.hwg.org/lists/hwg-servers/ -$B$G99$KB?$/$rC5$7=P$9$3$H$,(B -$B$G$-$^$9!#(B

    - -

    $B$=$7$F$b$A$m$s!"$*$=$i$/(B CGI $B%W%m%0%i%`$NF0:n$K4X$9$k>\:Y$N(B -$BA4$F$,5-=R$5$l$F$$$k(B CGI $B$N;EMM$rFI$`$Y$-$G$9!#%*%j%8%J%k%P!<%8%g%s$r(B -NCSA $B$G!"(B -$B%"%C%W%G!<%H$5$l$?%I%i%U%H$r(B -Common Gateway Interface RFC -$B%W%m%8%'%/%H(B$B$G;2>H$9$k$3$H$,$G$-$^$9!#(B

    - -

    CGI $B$NLdBj$K$D$$$F!"2C$o$C$F$$$k%a!<%j%s%0%j%9%H$^$?$O%K%e!<%9(B -$B%0%k!<%W$KpJs$H!"(B -$B2DG=$G$"$l$PLdBj$N%3!<%I$rDs6!$9$k$h$&$K$7$F$/$@$5$$!#(B -$B$=$&$9$k$3$H$G!"LdBj$,$h$j4VC1$K8+$D$+$k$h$&$K$J$j$^$9!#(B

    - -

    Apache $B$N%=!<%9%3!<%I$K$*$$$FLdBj$rH/8+$7$?$3$H$r3N?.$7$F$$$J$$(B -$B8B$j!"(BCGI $B$NLdBj$K4X$9$k - - - - - - diff --git a/docs/manual/howto/ssi.html b/docs/manual/howto/ssi.html deleted file mode 100644 index 0bd2a1f8bcd1c8f246a1a4d3f1b8a99f7c06cb5b..0000000000000000000000000000000000000000 --- a/docs/manual/howto/ssi.html +++ /dev/null @@ -1,519 +0,0 @@ - - - -Apache Tutorial: Introduction to Server Side Includes - - - - - -

    Apache Tutorial: Introduction to Server Side -Includes

    - - - - - - - -
    -

    Apache -Tutorial: Introduction to Server Side Includes

    - - - - - - -
    Related Modules
    -
    - mod_include
    -mod_cgi
    -mod_expires
    -
    Related Directives
    -
    - Options
    -XBitHack
    -AddType
    -AddHandler
    -BrowserMatchNoCase
    - -
    - -

    This HOWTO first appeared in Apache Today -(http://www.apachetoday.com/) as a series of three articles. They -appear here by arrangement with ApacheToday and Internet.com.

    - -

    This article deals with Server Side Includes, usually called simply -SSI. In this article, I'll talk about configuring your server to permit -SSI, and introduce some basic SSI techniques for adding dynamic content -to your existing HTML pages.

    - -

    In the latter part of the article, we'll talk about some of the -somewhat more advanced things that can be done with SSI, such as -conditional statements in your SSI directives.

    - -
    -

    What are SSI?

    - -

    SSI (Server Side Includes) are directives that are placed in HTML -pages, and evaluated on the server while the pages are being served. -They let you add dynamically generated content to an existing HTML -page, without having to serve the entire page via a CGI program, or -other dynamic technology.

    - -

    The decision of when to use SSI, and when to have your page entirely -generated by some program, is usually a matter of how much of the page -is static, and how much needs to be recalculated every time the page is -served. SSI is a great way to add small pieces of information, such as -the current time. But if a majority of your page is being generated at -the time that it is served, you need to look for some other -solution.

    - -
    -

    Configuring your -server to permit SSI

    - -

    To permit SSI on your server, you must have the following directive -either in your httpd.conf file, or in a -.htaccess file:

    - -
    -        Options +Includes
    -
    - -

    This tells Apache that you want to permit files to be parsed for SSI -directives.

    - -

    Not just any file is parsed for SSI directives. You have to tell -Apache which files should be parsed. There are two ways to do this. You -can tell Apache to parse any file with a particular file extension, -such as .shtml, with the following directives:

    - -
    -        AddType text/html .shtml
    -        AddHandler server-parsed .shtml
    -
    - -

    One disadvantage to this approach is that if you wanted to add SSI -directives to an existing page, you would have to change the name of -that page, and all links to that page, in order to give it a -.shtml extension, so that those directives would be -executed.

    - -

    The other method is to use the XBitHack directive:

    - -
    -        XBitHack on
    -
    - -

    XBitHack tells Apache to parse files for SSI directives -if they have the execute bit set. So, to add SSI directives to an -existing page, rather than having to change the file name, you would -just need to make the file executable using chmod.

    - -
    -        chmod +x pagename.html
    -
    - -

    A brief comment about what not to do. You'll occasionally see people -recommending that you just tell Apache to parse all .html -files for SSI, so that you don't have to mess with .shtml -file names. These folks have perhaps not heard about -XBitHack. The thing to keep in mind is that, by doing -this, you're requiring that Apache read through every single file that -it sends out to clients, even if they don't contain any SSI directives. -This can slow things down quite a bit, and is not a good idea.

    - -

    Of course, on Windows, there is no such thing as an execute bit to -set, so that limits your options a little.

    - -

    In its default configuration, Apache does not send the last modified -date or content length HTTP headers on SSI pages, because these values are -difficult to calculate for dynamic content. This can prevent your -document from being cached, and result in slower perceived client -performance. There are two ways to solve this:

    - -
      - -
    1. Use the XBitHack Full configuration. This tells -Apache to determine the last modified date by looking only at the date -of the originally requested file, ignoring the modification date of -any included files.
    2. - -
    3. Use the directives provided by mod_expires to set an explicit -expiration time on your files, thereby letting browsers and proxies -know that it is acceptable to cache them.
    4. - -
    - - -
    -

    Basic SSI directives

    - -

    SSI directives have the following syntax:

    - -
    -        <!--#element attribute=value attribute=value ... -->
    -
    - -

    It is formatted like an HTML comment, so if you don't have SSI -correctly enabled, the browser will ignore it, but it will still be -visible in the HTML source. If you have SSI correctly configured, the -directive will be replaced with its results.

    - -

    The element can be one of a number of things, and we'll talk some -more about most of these in the next installment of this series. For -now, here are some examples of what you can do with SSI

    - -

    Today's date

    - -
    -        <!--#echo var=DATE_LOCAL -->
    -
    - -

    The echo element just spits out the value of a -variable. There are a number of standard variables, which include the -whole set of environment variables that are available to CGI programs. -Also, you can define your own variables with the set -element.

    - -

    If you don't like the format in which the date gets printed, you can -use the config element, with a timefmt -attribute, to modify that formatting.

    - -
    -        <!--#config timefmt="%A %B %d, %Y" -->
    -        Today is <!--#echo var=DATE_LOCAL -->
    -
    - -

    Modification date of the -file

    - -
    -        This document last modified <!--#flastmod file="index.html" -->
    -
    - -

    This element is also subject to timefmt format -configurations.

    - -

    Including the -results of a CGI program

    - -

    This is one of the more common uses of SSI - to output the results -of a CGI program, such as everybody's favorite, a ``hit counter.''

    - -
    -        <!--#include virtual="/cgi-bin/counter.pl" -->
    -
    - -
    -

    Additional examples

    - -

    Following are some specific examples of things you can do in your -HTML documents with SSI.

    - -
    -

    When was this document -modified?

    - -

    Earlier, we mentioned that you could use SSI to inform the user when -the document was most recently modified. However, the actual method for -doing that was left somewhat in question. The following code, placed in -your HTML document, will put such a time stamp on your page. Of course, -you will have to have SSI correctly enabled, as discussed above.

    - -
    -        <!--#config timefmt="%A %B %d, %Y" -->
    -        This file last modified <!--#flastmod file="ssi.shtml" -->
    -
    - -

    Of course, you will need to replace the ssi.shtml with -the actual name of the file that you're referring to. This can be -inconvenient if you're just looking for a generic piece of code that -you can paste into any file, so you probably want to use the -LAST_MODIFIED variable instead:

    - -
    -        <!--#config timefmt="%D" -->
    -        This file last modified <!--#echo var="LAST_MODIFIED" -->
    -
    - -

    For more details on the timefmt format, go to your -favorite search site and look for ctime. The syntax is the -same.

    - -
    -

    Including a standard -footer

    - -

    If you are managing any site that is more than a few pages, you may -find that making changes to all those pages can be a real pain, -particularly if you are trying to maintain some kind of standard look -across all those pages.

    - -

    Using an include file for a header and/or a footer can reduce the -burden of these updates. You just have to make one footer file, and -then include it into each page with the include SSI -command. The include element can determine what file to -include with either the file attribute, or the -virtual attribute. The file attribute is a -file path, relative to the current directory. That means that -it cannot be an absolute file path (starting with /), nor can it -contain ../ as part of that path. The virtual attribute is -probably more useful, and should specify a URL relative to the document -being served. It can start with a /, but must be on the same server as -the file being served.

    - -
    -        <!--#include virtual="/footer.html" -->
    -
    - -

    I'll frequently combine the last two things, putting a -LAST_MODIFIED directive inside a footer file to be -included. SSI directives can be contained in the included file, and -includes can be nested - that is, the included file can include another -file, and so on.

    - -
    -

    What else can I config?

    - -

    In addition to being able to config the time format, -you can also config two other things.

    - -

    Usually, when something goes wrong with your SSI directive, you get -the message

    - -
    -        [an error occurred while processing this directive]
    -
    - -

    If you want to change that message to something else, you can do so -with the errmsg attribute to the config -element:

    - -
    -        <!--#config errmsg="[It appears that you don't know how to use SSI]" -->
    -
    - -

    Hopefully, end users will never see this message, because you will -have resolved all the problems with your SSI directives before your -site goes live. (Right?)

    - -

    And you can config the format in which file sizes are -returned with the sizefmt attribute. You can specify -bytes for a full count in bytes, or abbrev -for an abbreviated number in Kb or Mb, as appropriate.

    - -
    -

    Executing commands

    - -

    I expect that I'll have an article some time in the coming months -about using SSI with small CGI programs. For now, here's something else -that you can do with the exec element. You can actually -have SSI execute a command using the shell (/bin/sh, to be -precise - or the DOS shell, if you're on Win32). The following, for -example, will give you a directory listing.

    - -
    -        <pre>
    -        <!--#exec cmd="ls" -->
    -        </pre>
    -
    - -

    or, on Windows

    - -
    -        <pre>
    -        <!--#exec cmd="dir" -->
    -        </pre>
    -
    - -

    You might notice some strange formatting with this directive on -Windows, because the output from dir contains the string -``<dir>'' in it, which confuses browsers.

    - -

    Note that this feature is exceedingly dangerous, as it will execute -whatever code happens to be embedded in the exec tag. If -you have any situation where users can edit content on your web pages, -such as with a ``guestbook'', for example, make sure that you have this -feature disabled. You can allow SSI, but not the exec -feature, with the IncludesNOEXEC argument to the -Options directive.

    - -
    -

    Advanced SSI techniques

    - -

    In addition to spitting out content, Apache SSI gives you the option -of setting variables, and using those variables in comparisons and -conditionals.

    - -

    Caveat

    - -

    Most of the features discussed in this article are only available to -you if you are running Apache 1.2 or later. Of course, if you are not -running Apache 1.2 or later, you need to upgrade immediately, if not -sooner. Go on. Do it now. We'll wait.

    - -
    -

    Setting variables

    - -

    Using the set directive, you can set variables for -later use. We'll need this later in the discussion, so we'll talk about -it here. The syntax of this is as follows:

    - -
    -        <!--#set var="name" value="Rich" -->
    -
    - -

    In addition to merely setting values literally like that, you can -use any other variable, including, for example, environment variables, -or some of the variables we discussed in the last article (like -LAST_MODIFIED, for example) to give values to your -variables. You will specify that something is a variable, rather than a -literal string, by using the dollar sign ($) before the name of the -variable.

    - -
    -        <!--#set var="modified" value="$LAST_MODIFIED" -->
    -
    - -

    To put a literal dollar sign into the value of your variable, you -need to escape the dollar sign with a backslash.

    - -
    -        <!--#set var="cost" value="\$100" -->
    -
    - -

    Finally, if you want to put a variable in the midst of a longer -string, and there's a chance that the name of the variable will run up -against some other characters, and thus be confused with those -characters, you can place the name of the variable in braces, to remove -this confusion. (It's hard to come up with a really good example of -this, but hopefully you'll get the point.)

    - -
    -        <!--#set var="date" value="${DATE_LOCAL}_${DATE_GMT}" -->
    -
    - -
    -

    Conditional expressions

    - -

    Now that we have variables, and are able to set and compare their -values, we can use them to express conditionals. This lets SSI be a -tiny programming language of sorts. mod_include provides -an if, elif, else, -endif structure for building conditional statements. This -allows you to effectively generate multiple logical pages out of one -actual page.

    - -

    The structure of this conditional construct is:

    - -
    -        <!--#if expr="test_condition" -->
    -    <!--#elif expr="test_condition" -->
    -    <!--#else -->
    -    <!--#endif -->
    -
    - -

    A test_condition can be any sort of logical comparison - -either comparing values to one another, or testing the ``truth'' of a -particular value. (A given string is true if it is nonempty.) For a -full list of the comparison operators available to you, see the -mod_include documentation. Here are some examples of how -one might use this construct.

    - -

    In your configuration file, you could put the following line:

    - -
    -        BrowserMatchNoCase macintosh Mac
    -        BrowserMatchNoCase MSIE InternetExplorer
    -
    - -

    This will set environment variables ``Mac'' and ``InternetExplorer'' -to true, if the client is running Internet Explorer on a Macintosh.

    - -

    Then, in your SSI-enabled document, you might do the following:

    - -
    -        <!--#if expr="${Mac} && ${InternetExplorer}" -->
    -        Apologetic text goes here
    -        <!--#else -->
    -        Cool JavaScript code goes here
    -        <!--#endif -->
    -
    - -

    Not that I have anything against IE on Macs - I just struggled for a -few hours last week trying to get some JavaScript working on IE on a -Mac, when it was working everywhere else. The above was the interim -workaround.

    - -

    Any other variable (either ones that you define, or normal -environment variables) can be used in conditional statements. With -Apache's ability to set environment variables with the -SetEnvIf directives, and other related directives, this -functionality can let you do some pretty involved dynamic stuff without -ever resorting to CGI.

    - -
    -

    Conclusion

    - -

    SSI is certainly not a replacement for CGI, or other technologies -used for generating dynamic web pages. But it is a great way to add -small amounts of dynamic content to pages, without doing a lot of extra -work.

    - - - diff --git a/docs/manual/howto/ssi.html.en b/docs/manual/howto/ssi.html.en deleted file mode 100644 index 0bd2a1f8bcd1c8f246a1a4d3f1b8a99f7c06cb5b..0000000000000000000000000000000000000000 --- a/docs/manual/howto/ssi.html.en +++ /dev/null @@ -1,519 +0,0 @@ - - - -Apache Tutorial: Introduction to Server Side Includes - - - - - -

    Apache Tutorial: Introduction to Server Side -Includes

    - - - - - - - -
    -

    Apache -Tutorial: Introduction to Server Side Includes

    - - - - - - -
    Related Modules
    -
    - mod_include
    -mod_cgi
    -mod_expires
    -
    Related Directives
    -
    - Options
    -XBitHack
    -AddType
    -AddHandler
    -BrowserMatchNoCase
    - -
    - -

    This HOWTO first appeared in Apache Today -(http://www.apachetoday.com/) as a series of three articles. They -appear here by arrangement with ApacheToday and Internet.com.

    - -

    This article deals with Server Side Includes, usually called simply -SSI. In this article, I'll talk about configuring your server to permit -SSI, and introduce some basic SSI techniques for adding dynamic content -to your existing HTML pages.

    - -

    In the latter part of the article, we'll talk about some of the -somewhat more advanced things that can be done with SSI, such as -conditional statements in your SSI directives.

    - -
    -

    What are SSI?

    - -

    SSI (Server Side Includes) are directives that are placed in HTML -pages, and evaluated on the server while the pages are being served. -They let you add dynamically generated content to an existing HTML -page, without having to serve the entire page via a CGI program, or -other dynamic technology.

    - -

    The decision of when to use SSI, and when to have your page entirely -generated by some program, is usually a matter of how much of the page -is static, and how much needs to be recalculated every time the page is -served. SSI is a great way to add small pieces of information, such as -the current time. But if a majority of your page is being generated at -the time that it is served, you need to look for some other -solution.

    - -
    -

    Configuring your -server to permit SSI

    - -

    To permit SSI on your server, you must have the following directive -either in your httpd.conf file, or in a -.htaccess file:

    - -
    -        Options +Includes
    -
    - -

    This tells Apache that you want to permit files to be parsed for SSI -directives.

    - -

    Not just any file is parsed for SSI directives. You have to tell -Apache which files should be parsed. There are two ways to do this. You -can tell Apache to parse any file with a particular file extension, -such as .shtml, with the following directives:

    - -
    -        AddType text/html .shtml
    -        AddHandler server-parsed .shtml
    -
    - -

    One disadvantage to this approach is that if you wanted to add SSI -directives to an existing page, you would have to change the name of -that page, and all links to that page, in order to give it a -.shtml extension, so that those directives would be -executed.

    - -

    The other method is to use the XBitHack directive:

    - -
    -        XBitHack on
    -
    - -

    XBitHack tells Apache to parse files for SSI directives -if they have the execute bit set. So, to add SSI directives to an -existing page, rather than having to change the file name, you would -just need to make the file executable using chmod.

    - -
    -        chmod +x pagename.html
    -
    - -

    A brief comment about what not to do. You'll occasionally see people -recommending that you just tell Apache to parse all .html -files for SSI, so that you don't have to mess with .shtml -file names. These folks have perhaps not heard about -XBitHack. The thing to keep in mind is that, by doing -this, you're requiring that Apache read through every single file that -it sends out to clients, even if they don't contain any SSI directives. -This can slow things down quite a bit, and is not a good idea.

    - -

    Of course, on Windows, there is no such thing as an execute bit to -set, so that limits your options a little.

    - -

    In its default configuration, Apache does not send the last modified -date or content length HTTP headers on SSI pages, because these values are -difficult to calculate for dynamic content. This can prevent your -document from being cached, and result in slower perceived client -performance. There are two ways to solve this:

    - -
      - -
    1. Use the XBitHack Full configuration. This tells -Apache to determine the last modified date by looking only at the date -of the originally requested file, ignoring the modification date of -any included files.
    2. - -
    3. Use the directives provided by mod_expires to set an explicit -expiration time on your files, thereby letting browsers and proxies -know that it is acceptable to cache them.
    4. - -
    - - -
    -

    Basic SSI directives

    - -

    SSI directives have the following syntax:

    - -
    -        <!--#element attribute=value attribute=value ... -->
    -
    - -

    It is formatted like an HTML comment, so if you don't have SSI -correctly enabled, the browser will ignore it, but it will still be -visible in the HTML source. If you have SSI correctly configured, the -directive will be replaced with its results.

    - -

    The element can be one of a number of things, and we'll talk some -more about most of these in the next installment of this series. For -now, here are some examples of what you can do with SSI

    - -

    Today's date

    - -
    -        <!--#echo var=DATE_LOCAL -->
    -
    - -

    The echo element just spits out the value of a -variable. There are a number of standard variables, which include the -whole set of environment variables that are available to CGI programs. -Also, you can define your own variables with the set -element.

    - -

    If you don't like the format in which the date gets printed, you can -use the config element, with a timefmt -attribute, to modify that formatting.

    - -
    -        <!--#config timefmt="%A %B %d, %Y" -->
    -        Today is <!--#echo var=DATE_LOCAL -->
    -
    - -

    Modification date of the -file

    - -
    -        This document last modified <!--#flastmod file="index.html" -->
    -
    - -

    This element is also subject to timefmt format -configurations.

    - -

    Including the -results of a CGI program

    - -

    This is one of the more common uses of SSI - to output the results -of a CGI program, such as everybody's favorite, a ``hit counter.''

    - -
    -        <!--#include virtual="/cgi-bin/counter.pl" -->
    -
    - -
    -

    Additional examples

    - -

    Following are some specific examples of things you can do in your -HTML documents with SSI.

    - -
    -

    When was this document -modified?

    - -

    Earlier, we mentioned that you could use SSI to inform the user when -the document was most recently modified. However, the actual method for -doing that was left somewhat in question. The following code, placed in -your HTML document, will put such a time stamp on your page. Of course, -you will have to have SSI correctly enabled, as discussed above.

    - -
    -        <!--#config timefmt="%A %B %d, %Y" -->
    -        This file last modified <!--#flastmod file="ssi.shtml" -->
    -
    - -

    Of course, you will need to replace the ssi.shtml with -the actual name of the file that you're referring to. This can be -inconvenient if you're just looking for a generic piece of code that -you can paste into any file, so you probably want to use the -LAST_MODIFIED variable instead:

    - -
    -        <!--#config timefmt="%D" -->
    -        This file last modified <!--#echo var="LAST_MODIFIED" -->
    -
    - -

    For more details on the timefmt format, go to your -favorite search site and look for ctime. The syntax is the -same.

    - -
    -

    Including a standard -footer

    - -

    If you are managing any site that is more than a few pages, you may -find that making changes to all those pages can be a real pain, -particularly if you are trying to maintain some kind of standard look -across all those pages.

    - -

    Using an include file for a header and/or a footer can reduce the -burden of these updates. You just have to make one footer file, and -then include it into each page with the include SSI -command. The include element can determine what file to -include with either the file attribute, or the -virtual attribute. The file attribute is a -file path, relative to the current directory. That means that -it cannot be an absolute file path (starting with /), nor can it -contain ../ as part of that path. The virtual attribute is -probably more useful, and should specify a URL relative to the document -being served. It can start with a /, but must be on the same server as -the file being served.

    - -
    -        <!--#include virtual="/footer.html" -->
    -
    - -

    I'll frequently combine the last two things, putting a -LAST_MODIFIED directive inside a footer file to be -included. SSI directives can be contained in the included file, and -includes can be nested - that is, the included file can include another -file, and so on.

    - -
    -

    What else can I config?

    - -

    In addition to being able to config the time format, -you can also config two other things.

    - -

    Usually, when something goes wrong with your SSI directive, you get -the message

    - -
    -        [an error occurred while processing this directive]
    -
    - -

    If you want to change that message to something else, you can do so -with the errmsg attribute to the config -element:

    - -
    -        <!--#config errmsg="[It appears that you don't know how to use SSI]" -->
    -
    - -

    Hopefully, end users will never see this message, because you will -have resolved all the problems with your SSI directives before your -site goes live. (Right?)

    - -

    And you can config the format in which file sizes are -returned with the sizefmt attribute. You can specify -bytes for a full count in bytes, or abbrev -for an abbreviated number in Kb or Mb, as appropriate.

    - -
    -

    Executing commands

    - -

    I expect that I'll have an article some time in the coming months -about using SSI with small CGI programs. For now, here's something else -that you can do with the exec element. You can actually -have SSI execute a command using the shell (/bin/sh, to be -precise - or the DOS shell, if you're on Win32). The following, for -example, will give you a directory listing.

    - -
    -        <pre>
    -        <!--#exec cmd="ls" -->
    -        </pre>
    -
    - -

    or, on Windows

    - -
    -        <pre>
    -        <!--#exec cmd="dir" -->
    -        </pre>
    -
    - -

    You might notice some strange formatting with this directive on -Windows, because the output from dir contains the string -``<dir>'' in it, which confuses browsers.

    - -

    Note that this feature is exceedingly dangerous, as it will execute -whatever code happens to be embedded in the exec tag. If -you have any situation where users can edit content on your web pages, -such as with a ``guestbook'', for example, make sure that you have this -feature disabled. You can allow SSI, but not the exec -feature, with the IncludesNOEXEC argument to the -Options directive.

    - -
    -

    Advanced SSI techniques

    - -

    In addition to spitting out content, Apache SSI gives you the option -of setting variables, and using those variables in comparisons and -conditionals.

    - -

    Caveat

    - -

    Most of the features discussed in this article are only available to -you if you are running Apache 1.2 or later. Of course, if you are not -running Apache 1.2 or later, you need to upgrade immediately, if not -sooner. Go on. Do it now. We'll wait.

    - -
    -

    Setting variables

    - -

    Using the set directive, you can set variables for -later use. We'll need this later in the discussion, so we'll talk about -it here. The syntax of this is as follows:

    - -
    -        <!--#set var="name" value="Rich" -->
    -
    - -

    In addition to merely setting values literally like that, you can -use any other variable, including, for example, environment variables, -or some of the variables we discussed in the last article (like -LAST_MODIFIED, for example) to give values to your -variables. You will specify that something is a variable, rather than a -literal string, by using the dollar sign ($) before the name of the -variable.

    - -
    -        <!--#set var="modified" value="$LAST_MODIFIED" -->
    -
    - -

    To put a literal dollar sign into the value of your variable, you -need to escape the dollar sign with a backslash.

    - -
    -        <!--#set var="cost" value="\$100" -->
    -
    - -

    Finally, if you want to put a variable in the midst of a longer -string, and there's a chance that the name of the variable will run up -against some other characters, and thus be confused with those -characters, you can place the name of the variable in braces, to remove -this confusion. (It's hard to come up with a really good example of -this, but hopefully you'll get the point.)

    - -
    -        <!--#set var="date" value="${DATE_LOCAL}_${DATE_GMT}" -->
    -
    - -
    -

    Conditional expressions

    - -

    Now that we have variables, and are able to set and compare their -values, we can use them to express conditionals. This lets SSI be a -tiny programming language of sorts. mod_include provides -an if, elif, else, -endif structure for building conditional statements. This -allows you to effectively generate multiple logical pages out of one -actual page.

    - -

    The structure of this conditional construct is:

    - -
    -        <!--#if expr="test_condition" -->
    -    <!--#elif expr="test_condition" -->
    -    <!--#else -->
    -    <!--#endif -->
    -
    - -

    A test_condition can be any sort of logical comparison - -either comparing values to one another, or testing the ``truth'' of a -particular value. (A given string is true if it is nonempty.) For a -full list of the comparison operators available to you, see the -mod_include documentation. Here are some examples of how -one might use this construct.

    - -

    In your configuration file, you could put the following line:

    - -
    -        BrowserMatchNoCase macintosh Mac
    -        BrowserMatchNoCase MSIE InternetExplorer
    -
    - -

    This will set environment variables ``Mac'' and ``InternetExplorer'' -to true, if the client is running Internet Explorer on a Macintosh.

    - -

    Then, in your SSI-enabled document, you might do the following:

    - -
    -        <!--#if expr="${Mac} && ${InternetExplorer}" -->
    -        Apologetic text goes here
    -        <!--#else -->
    -        Cool JavaScript code goes here
    -        <!--#endif -->
    -
    - -

    Not that I have anything against IE on Macs - I just struggled for a -few hours last week trying to get some JavaScript working on IE on a -Mac, when it was working everywhere else. The above was the interim -workaround.

    - -

    Any other variable (either ones that you define, or normal -environment variables) can be used in conditional statements. With -Apache's ability to set environment variables with the -SetEnvIf directives, and other related directives, this -functionality can let you do some pretty involved dynamic stuff without -ever resorting to CGI.

    - -
    -

    Conclusion

    - -

    SSI is certainly not a replacement for CGI, or other technologies -used for generating dynamic web pages. But it is a great way to add -small amounts of dynamic content to pages, without doing a lot of extra -work.

    - - - diff --git a/docs/manual/howto/ssi.html.ja.jis b/docs/manual/howto/ssi.html.ja.jis deleted file mode 100644 index eafa3150b7b01d50d9cac40dbbdb40f575e972d6..0000000000000000000000000000000000000000 --- a/docs/manual/howto/ssi.html.ja.jis +++ /dev/null @@ -1,501 +0,0 @@ - - - -Apache $B%A%e!<%H%j%"%k(B: Server Side Includes $BF~Lg(B - - - - - - -

    Apache $B%A%e!<%H%j%"%k(B: Server Side Includes $BF~Lg(B

    - - - - - - - -
    -

    Apache -$B%A%e!<%H%j%"%k(B: Server Side Includes $BF~Lg(B

    - - - - - - -
    $B4XO"%b%8%e!<%k(B
    -
    - mod_include
    -mod_cgi
    -mod_expires
    -
    $B4XO"%G%#%l%/%F%#%V(B
    -
    - Options
    -XBitHack
    -AddType
    -AddHandler
    -BrowserMatchNoCase
    - -
    - -

    $B$3$NJ8=q$O:G=i!"(BApache Today (http://www.apachetoday.com/) $B$K;02s$NO":\5-;v$H$7$F7G:\$5$l$^$7$?!#(B -$B$3$3$G$O!"(BApcheToday $B$H(B Internet.com $B$H$N6(Dj$K$h$j:\$;$F$$$^$9!#(B

    - -

    $B$3$N5-;v$O!"DL>o$OC1$K(B SSI $B$H8F$P$l$k(B Server Side Includes $B$r(B -$B07$$$^$9!#$3$N5-;v$K$*$$$F$O!"%5!<%P$G$N(B SSI $B$r5v2D$9$k$?$a$N@_Dj$H!"(B -$B8=:_$N(B HTML $B%Z!<%8$KF0E*$J%3%s%F%s%D$r2C$($k$?$a$N$$$/$D$+$N4pK\E*$J(B -SSI $B5;=Q$r>R2p$7$^$9!#(B

    - -

    $B5-;v$N8eH>$G$O!"(BSSI $B%G%#%l%/%F%#%V$G(B -SSI $B$H6&$Kr7oJ8$N$h$&$J4vJ,9bEY$J;vJA$K(B -$B$D$$$F=R$Y$F$$$^$9!#(B

    - -
    -

    SSI $B$H$O(B?

    - -

    SSI (Server Side Includes) $B$O!"(BHTML $B%Z!<%8Cf$KG[CV$5$l$k%G%#%l%/%F%#%V$G$"$j!"(B -$B%5!<%P$G%Z!<%8$rDs6!$9$k;~$KI>2A$5$l$^$9!#(B -SSI $B$O!"(BCGI $B%W%m%0%i%`$d$=$NB>$NF0E*$J5;=Q$GA4$F$N%Z!<%8$rDs6!(B -$B$;$:$K!"F0E*$K@8@.$5$l$?%3%s%F%s%D$r8=:_$N(B HTML $B%Z!<%8$K(B -$B2C$($^$9!#(B

    - -

    $B$I$&$$$&>l9g$K(B SSI $B$r;H$$!"$I$&$$$&>l9g$K%W%m%0%i%`$G%Z!<%8$r40A4$K@8@.$9$k$+(B -$B$O!"%Z!<%8$N$&$A$I$NDxEY$,@EE*$G$"$j!"%Z!<%8$,Ds6!$5$l$k$?$S$K(B -$B:F7W;;$9$kI,MW$,$I$NDxEY$"$k$+$GDL>o$O7hDj$7$^$9!#(BSSI $B$O8=:_;~9o$N$h$&$J(B -$B>.$5$$>pJs$r2C$($k$K$O$&$C$F$D$1$NJ}K!$G$9!#(B -$B$7$+$7!"$=$N%Z!<%8$N$[$H$s$I$NItJ,$,Ds6!;~$K@8@.$5$l$k>l9g$O!"(B -$BB>$NJ}K!$rC5$9I,MW$,$"$j$^$9!#(B

    - -
    -

    SSI $B$r5v2D$9$k$?$a$N(B -$B%5!<%P$N@_Dj(B

    - -

    $B%5!<%P$G(B SSI $B5v2D$9$k$K$O!"(Bhttpd.conf $B%U%!%$%k(B -$B$^$?$O(B .htaccess $B%U%!%$%k$K - -

    -        Options +Includes
    -
    - -

    $B$3$N;XDj$O!"%U%!%$%k$r(B SSI $B%G%#%l%/%F%#%V$G2r@O$5$;$k$3$H$r5v2D$9$k(B -$B$H$$$&$3$H$r(B Apache $B$KEA$($^$9!#(B

    - -

    $BA4$F$N%U%!%$%k$,(B SSI $B%G%#%l%/%F%#%V$G2r@O$5$l$k$H$$$&$o$1$G$O$"$j$^$;$s!#(B -$B$I$N%U%!%$%k$,2r@O$5$l$k$+$r(B Apache $B$KEA$($kI,MW$,$"$j$^$9!#$3$l$r(B -$B9T$J$&$K$OFs$DJ}K!$,$"$j$^$9!#.shtml $B$N$h$&$JFCJL$J%U%!%$%k3HD%;R$r;}$D%U%!%$%k$r(B -$B2r@O$9$k$h$&(B Apache $B$KEA$($k$3$H$,$G$-$^$9(B:

    - -
    -        AddType text/html .shtml
    -        AddHandler server-parsed .shtml
    -
    - -

    $B$3$NJ}K!$N7gE@$O!"$b$78=:_$N%Z!<%8$K(B SSI -$B%G%#%l%/%F%#%V$r2C$($?$$>l9g!"$=$l$i$N%G%#%l%/%F%#%V$,.shtml $B3HD%;R$K$9$k$?$a!"$=$N%Z!<%8$NL>A0$H!"(B -$B$=$N%Z!<%8$X$NA4$F$N%j%s%/$rJQ99$7$J$1$l$P$J$i$J$$$3$H$G$9!#(B

    - -

    $B$b$&0l$D$NJ}K!$O!"(BXBitHack $B%G%#%l%/%F%#%V$r;HMQ$9$k$3$H$G$9(B:

    - -
    -        XBitHack on
    -
    - -

    XBitHack $B$O!"%U%!%$%k$Nl9g!"(B -SSI $B%G%#%l%/%F%#%V$K$h$j2r@O$9$k$3$H$r(B Apache $B$KEA$($^$9!#=>$C$F!"(B -SSI $B%G%#%l%/%F%#%V$r8=:_$N%Z!<%8$K2C$($k$?$a$K$O!"%U%!%$%kL>$rJQ99$7$J$/$F$b$h$/!"(B -$BC1$K(B chmod $B$r;HMQ$7$F%U%!%$%k$r - -

    -        chmod +x pagename.html
    -
    - -

    $B9T$J$&$Y$-$G$O$J$$$3$H$K4X$9$kC;$$%3%a%s%H!#;~!9C/$+$,!"(B -$BA4$F$N(B .html $B%U%!%$%k$r(B SSI $B$G2r@O$9$k$h$&(B Apache $B$KEA$($l$P!"(B -$B$o$6$o$6(B .shtml $B$H$$$&%U%!%$%kL>$K$9$kI,MW$,$J$$$H$$$C$F(B -$BA&$a$k$N$r8+$k$3$H$G$7$g$&!#$3$&$$$&?M$?$A$O!"$*$=$i$/(B XBitHack -$B$K$D$$$FJ9$$$?$3$H$,$J$$$N$G$7$g$&!#$3$NJ}K!$K$D$$$FCm0U$9$k$3$H$O!"(B -$B$?$H$((B SSI $B%G%#%l%/%F%#%V$rA4$/4^$^$J$$>l9g$G$b!"(BApache $B$,%/%i%$%"%s%H$K(B -$BAw$kA4$F$N%U%!%$%k$r:G8e$^$GFI$_9~$^$;$k$3$H$K$J$j$^$9!#(B -$B$3$NJ}K!$O$+$J$j=hM}$rCY$/$9$k$b$N$G$"$j!"NI$/$J$$%"%$%G%"$G$9!#(B

    - -

    $B$b$A$m$s!"(BWindows $B$G$O$=$N$h$&$J/$7@)8B$5$l$F$$$^$9!#(B

    - -

    $B%G%U%)%k%H$N@_Dj$G$O!"(BApache $B$O(B SSI $B%Z!<%8$K$D$$$F:G=*JQ99;~9o$d(B -$B%3%s%F%s%D$ND9$5$r(B HTTP $B%X%C%@$KAw$j$^$;$s!#(B -$BF0E*$J%3%s%F%s%D$G$"$k$?$a!"$=$l$i$NCM$r7W;;$9$k$N$,Fq$7$$$+$i$G$9!#(B -$B$3$N$?$a%I%-%e%a%s%H$,(B -$B%-%c%C%7%e$5$l$J$/$J$j!"7k2L$H$7$F%/%i%$%"%s%H$N@-G=$,(B -$BCY$/$J$C$?$h$&$K46$8$5$;$k$3$H$K$J$j$^$9!#(B -$B$3$l$r2r7h$9$kJ}K!$,Fs$D$"$j$^$9(B:

    - -
      - -
    1. XBitHack Full $B@_Dj$r;HMQ$9$k!#$3$N@_Dj$K$h$j!"$b$H$b$HMW5a$5$l$?(B -$B%U%!%$%k$N;~9o$r;2>H$7!"FI$_9~$^$l$k%U%!%$%k$NJQ99;~9o$r(B -$BL5;k$7$F:G=*JQ99;~9o$r7hDj$9$k$h$&(B Apache $B$KEA$($^$9!#(B
    2. - -
    3. mod_expires $B$GDs6!$5$l$F$$$k%G%#%l%/%F%#%V$r;HMQ$7$F!"(B -$B%U%!%$%k$,L58z$K$J$k;~9o$rL@<($7$^$9!#(B -$B$3$l$K$h$j!"%V%i%&%6$H%W%m%-%7$K%-%c%C%7%e$,M-8z$G$"$k$3$H$rDLCN$7$^$9!#(B
    4. - -
    - -
    -

    $B4pK\E*$J(B SSI $B%G%#%l%/%F%#%V(B

    - -

    SSI $B%G%#%l%/%F%#%V$O0J2<$NJ8K!$G5-=R$7$^$9(B:

    - -
    -        <!--#element attribute=value attribute=value ... -->
    -
    - -

    HTML $B$N%3%a%s%H$N$h$&$J=q<0$r$7$F$$$k$N$G!"$b$7(B SSI $B$r(B -$B@5$7$/F0:n2DG=$K$7$J$1$l$P!"%V%i%&%6$O$=$l$rL5;k$9$k$G$7$g$&!#$7$+$7!"(B -HTML $B%=!<%9Cf$G$O8+$($^$9!#$b$7(B SSI $B$r@5$7$/@_Dj$7$?$J$i!"(B -$B%G%#%l%/%F%#%V$O$=$N7k2L$HCV$-49$($i$l$^$9!#(B

    - -

    element $B$O$?$/$5$s$"$k$b$N$+$i0l$D;XDj$9$k$3$H$,$G$-$^$9!#(B -$B;XDj$G$-$k$b$N$NBgB??t$K$D$$$F$O!"/$7>\$7$/@bL@$7$^$9!#(B -$B$3$3$G$O!"(BSSI $B$G9T$J$&$3$H$,$G$-$kNc$r$$$/$D$+<($7$^$9!#(B

    - -

    $B:#F|$NF|IU(B

    - -
    -        <!--#echo var="DATE_LOCAL" -->
    -
    - -

    echo $BMWAG$OC1$KJQ?t$NCM$r=PNO$7$^$9!#(BCGI $B%W%m%0%i%`$K(B -$BMxMQ2DG=$J4D6-JQ?t$NA4$F$N%;%C%H$r4^$`B?$/$NI8=`JQ?t$,$"$j$^$9!#(B -$B$^$?!"(Bset $BMWAG$rMQ$$$k$3$H$G!"FH<+$NJQ?t$rDj5A$9$k$3$H$,(B -$B$G$-$^$9!#(B

    - -

    $B=PNO$5$l$kF|IU$N=q<0$,9%$-$G$O$J$$>l9g!"$=$N=q<0$r(B -$B=$@5$9$k$?$a$K!"(Bconfig $BMWAG$K(B timefmt $BB0@-$r(B -$B;HMQ$9$k$3$H$,$G$-$^$9!#(B

    - -
    -        <!--#config timefmt="%A %B %d, %Y" -->
    -        Today is <!--#echo var="DATE_LOCAL" -->
    -
    - -

    $B%U%!%$%k$NJQ99F|(B

    - -
    -        This document last modified <!--#flastmod file="index.html" -->
    -
    - -

    $B$3$NMWAG$b(B timefmt $B%U%)!<%^%C%H$N@_Dj$K=>$$$^$9!#(B

    - -

    CGI $B%W%m%0%i%`$N7k2L$r

    - -

    $B$3$l$O!"A4$F$N?M$N$*5$$KF~$j$G$"$k(B ``$B%R%C%H%+%&%s%?(B'' $B$N$h$&$J(B CGI $B%W%m%0%i%`$N(B -$B7k2L$r=PNO$9$k(B SSI $B$N$h$j0lHLE*$J;HMQ$N$&$A$N0l$D$G$9!#(B

    - -
    -        <!--#include virtual="/cgi-bin/counter.pl" -->
    -
    - -
    -

    $BDI2C$NNc(B

    - -

    $B0J2<$O!"(BSSI $B$r;HMQ$7$F(B HTML $B%I%-%e%a%s%H$K$*$$$F$G$-$k$3$H$N(B -$B$$$/$D$+$NFCJL$JNc$G$9!#(B

    - -
    -

    $B$$$D$3$N%I%-%e%a%s%H$O=$@5$5$l$?$N$+(B? -

    - -

    $B@h$K!"%I%-%e%a%s%H$,:G8e$KJQ99$5$l$?$N$O$$$D$+$r%f!<%6$KDLCN$9$k$?$a$K(B SSI $B$r;HMQ$9$k$3$H$,$G$-$k$3$H$r(B -$B=R$Y$^$7$?!#$7$+$7$J$,$i!"e=R$N(B -$B$h$&$K!"(BSSI $B$r@5$7$/F0:n2DG=$K$7$F$*$/I,MW$,$"$j$^$9!#(B

    - -
    -        <!--#config timefmt="%A %B %d, %Y" -->
    -        This file last modified <!--#flastmod file="ssi.shtml" -->
    -
    - -

    $B$b$A$m$s!"(Bssi.shtml $B$NItJ,$r$H(B -$BCV$-49$($kI,MW$,$"$j$^$9!#$b$7!"$"$i$f$k%U%!%$%k$KD%$k$3$H$,(B -$B$G$-$k0lHLE*$J%3!<%I$rC5$7$F$$$k$J$i!"$3$l$OITJX$G$"$k$+$b$7$l$^$;$s!#(B -$B$*$=$i$/$=$N>l9g$O!"$=$&$9$kBe$o$j$KJQ?t(B LAST_MODIFIED -$B$r;HMQ$7$?$$$H9M$($k$G$7$g$&(B:

    - -
    -        <!--#config timefmt="%D" -->
    -        This file last modified <!--#echo var="LAST_MODIFIED" -->
    -
    - -

    timefmt $B=q<0$K$D$$$F$N$h$j>\:Y$K$D$$$F$O!"(B -$B$*9%$_$N8!:w%5%$%H$K9T$-!"(Bctime $B$G8!:w$7$F$_$F$/$@$5$$!#J8K!$OF1$8$G$9!#(B

    - -
    -

    $BI8=`$N%U%C%?$rA^F~$9$k(B

    - -

    $B$b$7?t%Z!<%8$rD6$($k%Z!<%8$r;}$D%5%$%H$r4IM}$7$F$$$k$J$i$P!"(B -$BA4%Z!<%8$KBP$7$FJQ9`$r9T$J$&$3$H$,K\Ev$K6lDK$H$J$jF@$k$3$H$,J,$+$k$G$7$g$&!#(B -$BA4$F$N%Z!<%8$KEO$C$F$"$k - -

    $B%X%C%@$d%U%C%?MQ$NA^F~MQ%U%!%$%k$r;HMQ$9$k$3$H$G!"$3$N$h$&$J(B -$B99?7$K$+$+$kIiC4$r8:$i$9$3$H$,$G$-$^$9!#0l$D$N%U%C%?%U%!%$%k$r(B -$B:n@.$7!"$=$l$r(B include SSI $B%3%^%s%I$G3F%Z!<%8$K(B -$BF~$l$k$@$1$G:Q$_$^$9!#(Binclude $BMWAG$O!"(Bfile $BB0@-(B -$B$^$?$O(B virtual $BB0@-$N$$$:$l$+$r;HMQ$7$F$I$N%U%!%$%k$rA^F~$9$k$+$r(B -$B7h$a$k$3$H$,$G$-$^$9!#(Bfile $BB0@-$O!"(B$B%+%l%s%H%G%#%l%/%H%j$+$i$N(B -$BAjBP%Q%9$G<($5$l$?(B$B%U%!%$%k%Q%9$G$9!#$=$l$O(B -/ $B$G;O$^$k@dBP%U%!%$%k%Q%9$K$O$G$-$:!"$^$?!"$=$N%Q%9$N0lIt$K(B ../ $B$r(B -$B4^$`$3$H$,$G$-$J$$$3$H$r0UL#$7$^$9!#(Bvirtual $BB0@-$O!"$*$=$i$/(B -$B$h$jJXMx$@$H;W$$$^$9$,!"Ds6!$9$k%I%-%e%a%s%H$+$i$NAjBP(B URL $B$G;XDj$9$Y$-$G$9!#(B -$B$=$l$O(B / $B$G;O$a$k$3$H$,$G$-$^$9$,!"Ds6!$9$k%U%!%$%k$HF1$8%5!<%P>e$K(B -$BB8:_$7$J$/$F$O$J$j$^$;$s!#(B

    - -
    -        <!--#include virtual="/footer.html" -->
    -
    - -

    $B;d$O:G8e$NFs$D$rAH$_9g$o$;$F!"(BLAST_MODIFIED $B%G%#%l%/%F%#%V$r(B -$B%U%C%?%U%!%$%k$NCf$KCV$/$3$H$,$h$/$"$j$^$9!#(B -SSI $B%G%#%l%/%F%#%V$O!"A^F~MQ$N%U%!%$%k$K4^$^$;$?$j!"(B -$BA^F~%U%!%$%k$N%M%9%H$r$7$?$j$9$k$3$H$,$G$-$^$9!#$9$J$o$A!"(B -$BA^F~MQ$N%U%!%$%k$OB>$N%U%!%$%k$r:F5"E*$KA^F~$9$k$3$H$,$G$-$^$9!#(B

    - -
    -

    $BB>$K2?$,@_Dj$G$-$k$N$+(B?

    - -

    $B;~9o=q<0$r(B config $B$G@_Dj$G$-$k$3$H$K2C$($F!"(B -$B99$KFs$D(B config $B$G@_Dj$9$k$3$H$,$G$-$^$9!#(B

    - -

    $BDL>o!"(BSSI $B%G%#%l%/%F%#%V$G2?$+$,$&$^$/$$$+$J$$$H$-$O!" - -

    -        [an error occurred while processing this directive]
    -
    - -

    $B$3$N%a%C%;!<%8$rB>$N$b$N$K$7$?$$>l9g!"(B -config $BMWAG$N(B errmsg $BB0@-$GJQ99$9$k$3$H$,(B -$B$G$-$^$9(B:

    - -

    -        <!--#config errmsg="[It appears that you don't know how to use SSI]" -->
    -
    - -

    $B$*$=$i$/!"%(%s%I%f!<%6$O$3$N%a%C%;!<%8$r7h$7$F8+$k$3$H$O$"$j$^$;$s!#(B -$B$J$<$J$i!"$=$N%5%$%H$,@8$-$?>uBV$K$J$kA0$K(B SSI $B%G%#%l%/%F%#%V$K4X$9$k(B -$BA4$F$NLdBj$r2r7h$7$F$$$k$O$:$@$+$i$G$9!#(B($B$=$&$G$9$h$M(B?)

    - -

    $B$=$7$F!"(Bconfig $B$K$*$$$F(B sizefmt $BB0@-$r;HMQ$9$k$3$H$G!"(B -$BJV$5$l$k%U%!%$%k%5%$%:$N=q<0$r@_Dj$9$k$3$H$,$G$-$^$9!#(B -$B%P%$%H?t$K$O(B bytes $B$r!"E,Ev$K(B Kb $B$d(B Mb $B$K(B -$BC;=L$5$;$k$K$O(B abbrev $B$r;XDj$9$k$3$H$,$G$-$^$9!#(B

    - -
    -

    $B%3%^%s%I$N

    - -

    $B:#8e?t%v7n$NFb$K!">.$5$J(B CGI $B%W%m%0%i%`$H(B SSI $B$r;HMQ$9$k(B -$B5-;v$r=P$7$?$$$H9M$($F$$$^$9!#$3$3$G$O$=$l$H$OJL$K!"(B -exec $BMWAG$K$h$C$F9T$J$&$3$H$,$G$-$k$3$H$r<($7$^$9!#(B -SSI $B$K%7%'%k(B ($B@53N$K$O(B /bin/sh$B!#(BWin32 $B$J$i$P(B DOS $B%7%'%k(B) -$B$r;HMQ$7$F%3%^%s%I$r - -

    -        <pre>
    -        <!--#exec cmd="ls" -->
    -        </pre>
    -
    - -

    Windows $B>e$G$O!"(B

    - -
    -        <pre>
    -        <!--#exec cmd="dir" -->
    -        </pre>
    -
    - -

    Windows $B>e$G$O!"$3$N%G%#%l%/%F%#%V$K$h$C$F$$$/$D$+$N4qL/$J(B -$B=q<0$K5$$E$/$G$7$g$&!#$J$<$J$i(B dir $B$N=PNO$,(B -$BJ8;zNs(B ``<dir>'' $B$r4^$_!"%V%i%&%6$r:.Mp$5$;$k$+$i$G$9!#(B

    - -

    $B$3$N5!G=$OHs>o$K4m81$G$"$j!"$I$s$J%3!<%I$G$b(B exec $B%?%0$K(B -$BKd$a9~$^$l$F$7$^$($Pu67$K$"$k$J$i$P!"$3$N5!G=$r3NOptions $B%G%#%l%/%F%#%V$N(B IncludesNOEXEC $B0z?t$r;XDj$9$k$3$H$G!"(B -SSI $B$O5v2D$9$k$1$l$I(B exec $B5!G=$O5v2D$7$J$$$h$&$K$9$k$3$H$,$G$-$^$9!#(B

    - -
    -

    $B9bEY$J(B SSI $B%F%/%K%C%/(B

    - -

    $B%3%s%F%s%D$r=PNO$9$k$3$H$K2C$(!"(BApache SSI $B$OJQ?t$r@_Dj$7!"$=$7$FHf3S(B -$B$H>r7oJ,4t$K$=$NJQ?t$r;HMQ$G$-$k5!G=$rDs6!$7$F$$$^$9!#(B

    - -

    $B7Y9p(B

    - -

    $B$3$N5-;v$G=R$Y$?BgItJ,$N5!G=$O!"(BApache 1.2 $B0J9_$r(B -$B;HMQ$7$F$$$k>l9g$N$_MxMQ2DG=$G$9!#$b$A$m$s!"$b$7(B Apache 1.2 $B0J9_$r(B -$B;HMQ$7$F$J$$>l9g!"D>$A$K%"%C%W%0%l!<%I$9$kI,MW$,$"$j$^$9!#(B -$B$5$!!":#$=$l$r9T$J$$$J$5$$!#$=$l$^$GBT$C$F$$$^$9!#(B

    - -
    -

    $BJQ?t$r@_Dj$9$k(B

    - -

    set $B%G%#%l%/%F%#%V$r;HMQ$7$F!"8e$G;HMQ$9$k$?$a$KJQ?t$r(B -$B@_Dj$9$k$3$H$,$G$-$^$9!#$3$l$O8e$N@bL@$GI,MW$K$J$k$N$G!"$3$3$G(B -$B$=$l$K$D$$$F=R$Y$F$$$^$9!#J8K!$O0J2<$N$H$*$j$G$9(B:

    - -
    -        <!--#set var="name" value="Rich" -->
    -
    - -

    $B$3$N$h$&$KC1=c$KJ8;z$I$*$j$K@_Dj$9$k$3$H$K2C$(!"(B -$BNc$($P4D6-JQ?t$dA0$N5-;v$G=R$Y$?JQ?t(B ($BNc$($P(B LAST_MODIFIED $B$N$h$&$J(B) $B$r4^$`B>$N$"$i$f$kJQ?t$r(B -$BCM$r@_Dj$9$k$N$K;HMQ$9$k$3$H$,(B -$B$G$-$^$9!#JQ?tL>$NA0$K%I%k5-9f(B ($) $B$r;HMQ$9$k$3$H$G!"(B -$B$=$l$,%j%F%i%kJ8;zNs$G$O$J$/$FJQ?t$G$"$k$3$H$r<($7$^$9!#(B

    - -
    -        <!--#set var="modified" value="$LAST_MODIFIED" -->
    -
    - -

    $B%I%k5-9f(B ($) $B$rJ8;z$H$7$FJQ?t$NCM$KF~$l$k$K$O!"%P%C%/%9%i%C%7%e$K$h$C$F(B -$B%I%k5-9f$r%(%9%1!<%W$9$kI,MW$,$"$j$^$9!#(B

    - -
    -        <!--#set var="cost" value="\$100" -->
    -
    - -

    $B:G8e$K$J$j$^$9$,!"D9$$J8;zNs$NCf$KJQ?t$rCV$-$?$$>l9g$G!"(B -$BJQ?tL>$,B>$NJ8;z$H$V$D$+$k2DG=@-$,$"$j!"$=$l$i$NJ8;z$K$D$$$F(B -$B:.Mp$7$F$7$^$&>l9g!"$3$N:.Mp$r$rCf3g8L$G(B -$B0O$`$3$H$,$G$-$^$9(B ($B$3$l$K$D$$$F$NNI$$Nc$r<($9$N$OFq$7$$$N$G$9$,!"(B -$B$*$=$i$/J,$+$C$F$$$?$@$1$k$G$7$g$&(B)$B!#(B

    - -
    -        <!--#set var="date" value="${DATE_LOCAL}_${DATE_GMT}" -->
    -
    - -
    -

    $B>r7o<0(B

    - -

    $B$5$F!"JQ?t$r;}$C$F$$$F!"$=$l$i$NCM$r@_Dj$7$FHf3S$9$k$3$H$,$G$-$k$N$G$9$+$i!"(B -$B>r7o$rI=$9$?$a$K$=$l$i$r;HMQ$9$k$3$H$,$G$-$^$9!#$3$l$K$h$j(B SSI $B$O(B -$B$"$k.$5$J%W%m%0%i%_%s%08@8l$K$J$C$F$$$^$9!#(Bmod_include $B$O(B -$B>r7o$rI=8=$9$k$?$a$K(B if, elif, else, -endif $B9=B$$rDs6!$7$F$$$^$9!#$3$l$K$h$C$F!"0l$D$N - -

    $B>r7o9=B$$O0J2<$N$H$*$j$G$9(B:

    - -
    -        <!--#if expr="test_condition" -->
    -        <!--#elif expr="test_condition" -->
    -        <!--#else -->
    -        <!--#endif -->
    -
    - -

    test_condition $B$O$"$i$f$k2A$7$^$9(B ($B6u$G$J$$$J$i(B -$BM?$($i$l$?J8;zNs$O??$G$9(B)$B!#MxMQ2DG=$JHf3S1i;;;R$NA4$F$N%j%9%H$K$D$$$F$O!"(B -mod_include $B%I%-%e%a%s%F!<%7%g%s$r;2>H$7$F$/$@$5$$!#(B -$B$3$3$G$O!"$3$N9=B$$r$I$&;HMQ$9$k$+$NNc$r$$$/$D$+<($7$^$9!#(B

    - -

    $B@_Dj%U%!%$%k$G - -

    -        BrowserMatchNoCase macintosh Mac
    -        BrowserMatchNoCase MSIE InternetExplorer
    -
    - -

    $B$3$l$O%/%i%$%"%s%H$,(B Macintosh $B>e$G%$%s%?!<%M%C%H%(%/%9%W%m!<%i$,(B -$BF0$$$F$$$k>l9g!"4D6-JQ?t(B ``Mac'' $B$H(B ``InternetExplorer'' $B$r??$H@_Dj$7$^$9!#(B

    - -

    $B - -

    -        <!--#if expr="${Mac} && ${InternetExplorer}" -->
    -        Apologetic text goes here
    -        <!--#else -->
    -        Cool JavaScript code goes here
    -        <!--#endif -->
    -
    - -

    Mac $B>e$N(B IE $B$KBP$7$F2?$+;W$&$H$3$m$,$"$k$o$1$G$"$j$^$;$s!#(B -$BB>$G$Oe$N(B IE $B$G(B -$Be$NNc$O$=$N;CDjE*$JBP=hJ}K!$G$9!#(B

    - -

    $BB>$N$I$s$JJQ?t(B ($B$"$J$?$,Dj5A$9$k$b$N!"$^$?$OIaDL$N4D6-JQ?t$N$$$:$l$+(B) $B$b!"(B -$B>r7oJ8$K;HMQ$9$k$3$H$,$G$-$^$9!#(BApache $B$O(B SetEnvIf -$B%G%#%l%/%F%#%V$dB>$N4XO"%G%#%l%/%F%#%V;HMQ$7$F4D6-JQ?t$r@_Dj$9$k$3$H$,(B -$B$G$-$^$9!#$3$N5!G=$K$h$j!"(BCGI $B$KMj$k$3$H$J$/$+$J$jJ#;($JF0E*$J$3$H$r$5$;$k(B -$B$3$H$,$G$-$^$9!#(B

    - -
    -

    $B=*$o$j$K(B

    - -

    SSI $B$O3N$+$K(B CGI $B$dF0E*$J%&%'%V%Z!<%8$r@8@.$9$kB>$N5;=Q$KBe$o$k$b$N(B -$B$G$O$"$j$^$;$s!#$7$+$7!"(B -$B$?$/$5$s$NM>J,$J:n6H$r$;$:$K!">/NL$NF0E*$J%3%s%F%s%D$r2C$($k$K$O(B -$B$9$0$l$?J}K!$G$9!#(B

    - - - diff --git a/docs/manual/images/apache_header.gif b/docs/manual/images/apache_header.gif deleted file mode 100644 index 260e421bf4ad3f012db1746809cf4d2fdd5d8cc6..0000000000000000000000000000000000000000 Binary files a/docs/manual/images/apache_header.gif and /dev/null differ diff --git a/docs/manual/images/custom_errordocs.png b/docs/manual/images/custom_errordocs.png deleted file mode 100644 index 11553cbdeec6148bf9a075c2310c06f40b7684f8..0000000000000000000000000000000000000000 Binary files a/docs/manual/images/custom_errordocs.png and /dev/null differ diff --git a/docs/manual/images/home.gif b/docs/manual/images/home.gif deleted file mode 100644 index 11299c1cb7ef6aed8ee4b159d733668de8662f22..0000000000000000000000000000000000000000 Binary files a/docs/manual/images/home.gif and /dev/null differ diff --git a/docs/manual/images/index.gif b/docs/manual/images/index.gif deleted file mode 100644 index 741c8939d77d2423d67beaaef8fe78aed13a94bb..0000000000000000000000000000000000000000 Binary files a/docs/manual/images/index.gif and /dev/null differ diff --git a/docs/manual/images/mod_rewrite_fig1.gif b/docs/manual/images/mod_rewrite_fig1.gif deleted file mode 100644 index 664ac1e7bb7a186d2c6157878cdadd5bfb7d3466..0000000000000000000000000000000000000000 Binary files a/docs/manual/images/mod_rewrite_fig1.gif and /dev/null differ diff --git a/docs/manual/images/mod_rewrite_fig1.png b/docs/manual/images/mod_rewrite_fig1.png deleted file mode 100644 index f3a68d9e4c545f3c6d278d3d0130ff353cf2c252..0000000000000000000000000000000000000000 Binary files a/docs/manual/images/mod_rewrite_fig1.png and /dev/null differ diff --git a/docs/manual/images/mod_rewrite_fig2.gif b/docs/manual/images/mod_rewrite_fig2.gif deleted file mode 100644 index 3ea8cb65a3f9f1682c6b52d3911f52d2434ad38f..0000000000000000000000000000000000000000 Binary files a/docs/manual/images/mod_rewrite_fig2.gif and /dev/null differ diff --git a/docs/manual/images/mod_rewrite_fig2.png b/docs/manual/images/mod_rewrite_fig2.png deleted file mode 100644 index bc141be769468117d7459dd82437ef0165d4fe67..0000000000000000000000000000000000000000 Binary files a/docs/manual/images/mod_rewrite_fig2.png and /dev/null differ diff --git a/docs/manual/images/pixel.gif b/docs/manual/images/pixel.gif deleted file mode 100644 index c0801475d2729dddd97b223bfc8af320516926e2..0000000000000000000000000000000000000000 Binary files a/docs/manual/images/pixel.gif and /dev/null differ diff --git a/docs/manual/images/sub.gif b/docs/manual/images/sub.gif deleted file mode 100644 index 93061c5ad7f011307c4188fbc5d134db19fbc8c0..0000000000000000000000000000000000000000 Binary files a/docs/manual/images/sub.gif and /dev/null differ diff --git a/docs/manual/index.html b/docs/manual/index.html deleted file mode 100644 index 5bfef758c0785f43a1b677e0c296dd51902c3604..0000000000000000000000000000000000000000 --- a/docs/manual/index.html +++ /dev/null @@ -1,31 +0,0 @@ - - - -Apache-2.0 Documentation - - - -

    Manual Index for Apache-2.0

    -

    The documentation has been split into 2 sections. One is for people installing and configuring an Apache server, the other is for those who are developing the server.

    -

    Where do you want to go today?

    - - - - - -
    -I'm configuring/installing a server - -I'm a developer -
    -
    -David Reid, 15th January 2000 - - - diff --git a/docs/manual/index.html.en b/docs/manual/index.html.en deleted file mode 100644 index 5bfef758c0785f43a1b677e0c296dd51902c3604..0000000000000000000000000000000000000000 --- a/docs/manual/index.html.en +++ /dev/null @@ -1,31 +0,0 @@ - - - -Apache-2.0 Documentation - - - -

    Manual Index for Apache-2.0

    -

    The documentation has been split into 2 sections. One is for people installing and configuring an Apache server, the other is for those who are developing the server.

    -

    Where do you want to go today?

    - - - - - -
    -I'm configuring/installing a server - -I'm a developer -
    -
    -David Reid, 15th January 2000 - - - diff --git a/docs/manual/index.html.ja.jis b/docs/manual/index.html.ja.jis deleted file mode 100644 index 1d2ea9f8082e8d95c8b10940e1a002f6a5c1b02b..0000000000000000000000000000000000000000 --- a/docs/manual/index.html.ja.jis +++ /dev/null @@ -1,179 +0,0 @@ - - -Apache HTTP $B%5!<%P(B $B%P!<%8%g%s(B 2.0 $B%I%-%e%a%s%H(B - - -
    - - - - - - - - - - - - -
    - [Apache $B%I%-%e%a%s%H(B]
    - - - - - - -
    - FAQ - - $B%G%#%l%/%F%#%V(B - - $B%b%8%e!<%k(B - - $B8!:w(B -
    -
     
    -

    Apache HTTP Server Version 2.0

    -
    -
    - -
    - - -
    -
    - - - - - -
    -
    - - - - - - - - - -
    - - -
    - $B%j%j!<%9%N!<%H(B -
    -Apache 2.0 $B$N?75!G=(B -
    -Apache 2.0 $B$X$N%"%C%W%0%l!<%I(B -
    -Apache $B$N%i%$%;%s%9(B -
    - -

    - -
    -$B%j%U%!%l%s%9%^%K%e%"%k(B -
    -$B%3%s%Q%$%k$H%$%s%9%H!<%k(B -
    -$B5/F0(B -
    -$B=*N;$^$?$O:F5/F0(B -
    -$B -
    -$B%b%8%e!<%k(B: $B $B$H(B - $B%"%k%U%!%Y%C%H=g(B -
    -Multi-Processing Modules (MPM) -
    -$B%5!<%P$H%5%]!<%H%W%m%0%i%`(B -
    -Dynamic Shared Object (DSO) $B$N%5%]!<%H(B -
    - -

    - -
    -$B%W%i%C%H%U%)!<%`8GM-$N>pJs(B -
    -Microsoft Windows -
    -$BB>$N%W%i%C%H%U%)!<%`FCM-$N>pJs(B -
    - -

    -
    .
    -
    - -
    -Apache HTTP $B%5!<%P$r;H$&(B -
    -$B@_Dj%U%!%$%k(B -
    -$B%5!<%PA4BN$N@_Dj(B -
    -URL $B$r%U%!%$%k%7%9%F%`$K%^%C%W$9$k(B -
    -$B%P!<%A%c%k%[%9%H(B -
    -$B%O%s%I%i(B -
    -$B%U%#%k%?(B -
    -$B%3%s%F%s%H%M%4%7%(!<%7%g%s(B -
    -$B4D6-JQ?t(B -
    -CGI $B$G(B SetUserID $B -
    -$B0lHLE*$J@-G=$K4X$9$k%R%s%H(B -
    -$B%;%-%e%j%F%#>pJs(B -
    -URL Rewriting $B$N%,%$%I(B -
    - -

    - -
    -$B$=$NB>(B -
    -FAQ -
    -$B%A%e!<%H%j%"%k(B -
    -$B3+H/ -
    -$B$=$NB>(B -
    -

    - -
    - -

    Apache HTTP Server -Documentation Project $B$K$h$j%a%s%F%J%s%9$5$l$F$$$^$9!#(B

    - - - - - diff --git a/docs/manual/install.html b/docs/manual/install.html deleted file mode 100644 index dd53b73a2e8d930b14694ea82aca3230ff29c011..0000000000000000000000000000000000000000 --- a/docs/manual/install.html +++ /dev/null @@ -1,109 +0,0 @@ - - - - -Compiling and Installing Apache - - - - - -

    Compiling and Installing Apache

    -

    Downloading Apache

    -Information on the latest version of Apache can be found on the Apache -web server at http://www.apache.org/. This will list the current release, -any more recent beta-test release, together with details of mirror -web and anonymous ftp sites. - -

    Compiling Apache

    -This release of Apache supports the notion of `optional modules'. -However, the server has to know which modules are compiled into it, in -order for those modules to be effective; this requires generation of a -short bit of code (`modules.c') which simply has a list of them. -

    -If you are satisfied with our standard module set, and expect to -continue to be satisfied with it, then you can just edit the stock -Makefile and compile as you have been doing previously. If you -would -like to select optional modules, however, you need to run the -configuration script. -

    -To do this: -

      -
    1. Edit the file `Configuration'. This contains the per-machine -config settings of the Makefile, and also an additional section at -the bottom which lists the modules which have been compiled in, and -also names the files containing them. You will need to: -
        -
      1. Select a compiler and compilation options as appropriate to -your machine. -
      2. Uncomment lines corresponding to those optional modules you wish -to include (among the Module lines at the bottom of the file) -or add new lines corresponding to custom modules you have written. -

        -Note that DBM auth has to be explicitly configured in, if you want -it; just uncomment the corresponding line. -

      -
    2. Run the `Configure' script: -
      -% Configure
      -Using 'Configuration' as config file
      -%
      - -This generates new versions of the Makefile and of modules.c. If -you want to maintain multiple configurations, you can say, e.g., -
      -% Configure -file Configuration.ai
      -Using alternate config file Configuration.ai
      -%
      - -
    3. Type `make'. -

      -The modules we place in the Apache distribution are the ones we have -tested and are used regularly by various members of the Apache -development group. Additional modules contributed by members or third -parties with specific needs or functions are available at -<URL:http://www.apache.org/dist/contrib/modules/>. There are instructions on that page for -linking these modules into the core Apache code. -

    - -

    Installing Apache

    -After compilation, you will have a binary called `httpd' in the -src/ directory. A binary distribution of Apache will supply this -file. -

    -The next step is to edit the configuration files for the server. In -the subdirectory called `conf' you should find distribution versions -of the three configuration files: srm.conf-dist, -access.conf-dist and httpd.conf-dist. Copy them to -srm.conf, access.conf and httpd.conf -respectively. -

    -First edit httpd.conf. This sets up general attributes about the -server; the port number, the user it runs as, etc. Next edit the -srm.conf file; this sets up the root of the document tree, -special functions like server-parsed HTML or internal imagemap parsing, etc. -Finally, edit the access.conf file to at least set the base cases -of access. -

    -Finally, make a call to httpd, with a -f to the full path to the -httpd.conf file. I.e., the common case: -

    - /usr/local/etc/apache/src/httpd -f /usr/local/etc/apache/conf/httpd.conf -
    -The server should be now running. -

    -By default the srm.conf and access.conf files are -located by name; to specifically call them by other names, use the -AccessConfig and -ResourceConfig directives in -httpd.conf. - - -


    -Home -Index - - - - diff --git a/docs/manual/install.html.en b/docs/manual/install.html.en deleted file mode 100644 index dd53b73a2e8d930b14694ea82aca3230ff29c011..0000000000000000000000000000000000000000 --- a/docs/manual/install.html.en +++ /dev/null @@ -1,109 +0,0 @@ - - - - -Compiling and Installing Apache - - - - - -

    Compiling and Installing Apache

    -

    Downloading Apache

    -Information on the latest version of Apache can be found on the Apache -web server at http://www.apache.org/. This will list the current release, -any more recent beta-test release, together with details of mirror -web and anonymous ftp sites. - -

    Compiling Apache

    -This release of Apache supports the notion of `optional modules'. -However, the server has to know which modules are compiled into it, in -order for those modules to be effective; this requires generation of a -short bit of code (`modules.c') which simply has a list of them. -

    -If you are satisfied with our standard module set, and expect to -continue to be satisfied with it, then you can just edit the stock -Makefile and compile as you have been doing previously. If you -would -like to select optional modules, however, you need to run the -configuration script. -

    -To do this: -

      -
    1. Edit the file `Configuration'. This contains the per-machine -config settings of the Makefile, and also an additional section at -the bottom which lists the modules which have been compiled in, and -also names the files containing them. You will need to: -
        -
      1. Select a compiler and compilation options as appropriate to -your machine. -
      2. Uncomment lines corresponding to those optional modules you wish -to include (among the Module lines at the bottom of the file) -or add new lines corresponding to custom modules you have written. -

        -Note that DBM auth has to be explicitly configured in, if you want -it; just uncomment the corresponding line. -

      -
    2. Run the `Configure' script: -
      -% Configure
      -Using 'Configuration' as config file
      -%
      - -This generates new versions of the Makefile and of modules.c. If -you want to maintain multiple configurations, you can say, e.g., -
      -% Configure -file Configuration.ai
      -Using alternate config file Configuration.ai
      -%
      - -
    3. Type `make'. -

      -The modules we place in the Apache distribution are the ones we have -tested and are used regularly by various members of the Apache -development group. Additional modules contributed by members or third -parties with specific needs or functions are available at -<URL:http://www.apache.org/dist/contrib/modules/>. There are instructions on that page for -linking these modules into the core Apache code. -

    - -

    Installing Apache

    -After compilation, you will have a binary called `httpd' in the -src/ directory. A binary distribution of Apache will supply this -file. -

    -The next step is to edit the configuration files for the server. In -the subdirectory called `conf' you should find distribution versions -of the three configuration files: srm.conf-dist, -access.conf-dist and httpd.conf-dist. Copy them to -srm.conf, access.conf and httpd.conf -respectively. -

    -First edit httpd.conf. This sets up general attributes about the -server; the port number, the user it runs as, etc. Next edit the -srm.conf file; this sets up the root of the document tree, -special functions like server-parsed HTML or internal imagemap parsing, etc. -Finally, edit the access.conf file to at least set the base cases -of access. -

    -Finally, make a call to httpd, with a -f to the full path to the -httpd.conf file. I.e., the common case: -

    - /usr/local/etc/apache/src/httpd -f /usr/local/etc/apache/conf/httpd.conf -
    -The server should be now running. -

    -By default the srm.conf and access.conf files are -located by name; to specifically call them by other names, use the -AccessConfig and -ResourceConfig directives in -httpd.conf. - - -


    -Home -Index - - - - diff --git a/docs/manual/invoking.html b/docs/manual/invoking.html deleted file mode 100644 index f00b68e459933ce9a6ffeca80e1d6f78f8689966..0000000000000000000000000000000000000000 --- a/docs/manual/invoking.html +++ /dev/null @@ -1,108 +0,0 @@ - - - - -Starting Apache - - - - - -

    Starting Apache

    -

    Invoking Apache

    -The httpd program is either invoked by the Internet -daemon inetd each time a connection to the HTTP service is made, -or alternatively it may run as a daemon which executes continuously, handling -requests. Whatever method is chosen, the -ServerType directive must be set -to tell the server how it is to run. - -

    Command line options

    -The following options are recognised on the httpd command line: -
    -
    -d serverroot -
    Set the initial value for the -ServerRoot variable to -serverroot. This can be overridden by the ServerRoot command in the -configuration file. The default is /usr/local/etc/httpd. - -
    -f config -
    Execute the commands in the file config on startup. If -config does not begin with a /, then it is taken to be a -path relative to the ServerRoot. The -default is conf/httpd.conf. - -
    -X -
    Run in single-process mode, for internal debugging purposes only; the -daemon does not detach from the terminal or fork any children. Do NOT -use this mode to provide ordinary web service. - -
    -v -
    Print the version of httpd, and then exit. - -
    -? -
    Print a list of the httpd options, and then exit. -
    - -

    Configuration files

    -The server will read three files for configuration directives. Any directive -may appear in any of these files. The the names of these files are taken -to be relative to the server root; this is set by the -ServerRoot directive, or the --d command line flag. - -Conventionally, the files are: -
    -
    conf/httpd.conf -
    Contains directives that control the operation of the server daemon. -The filename may be overridden with the -f command line flag. - -
    conf/srm.conf -
    Contains directives that control the specification of documents that -the server can provide to clients. The filename may be overridden with -the ResourceConfig directive. - -
    conf/acces.conf -
    Contains directives that control access to documents. -The filename may be overridden with the -AccessConfig directive. -
    -However, these conventions need not be adhered to. -

    -The server also reads a file containing mime document types; the filename -is set by the TypesConfig directive, -and is conf/mime.types by default. - -

    Log files

    -

    pid file

    -On daemon startup, it saves the process id of the parent httpd process to -the file logs/httpd.pid. This filename can be changed with the -PidFile directive. The process-id is for -use by the administrator in restarting and terminating the daemon; -A HUP signal causes the daemon to re-read its configuration files and -a TERM signal causes it to die gracefully. -

    -If the process dies (or is killed) abnormally, then it will be necessary to -kill the children httpd processes. - -

    Error log

    -The server will log error messages to a log file, logs/error_log -by default. The filename can be set using the -ErrorLog directive; different error logs can -be set for different virtual hosts. - -

    Transfer log

    -The server will typically log each request to a transfer file, -logs/access_log by default. The filename can be set using a -TransferLog directive; different -transfer logs can be set for different virtual -hosts. - - -
    -Home -Index - - - - diff --git a/docs/manual/invoking.html.en b/docs/manual/invoking.html.en deleted file mode 100644 index f00b68e459933ce9a6ffeca80e1d6f78f8689966..0000000000000000000000000000000000000000 --- a/docs/manual/invoking.html.en +++ /dev/null @@ -1,108 +0,0 @@ - - - - -Starting Apache - - - - - -

    Starting Apache

    -

    Invoking Apache

    -The httpd program is either invoked by the Internet -daemon inetd each time a connection to the HTTP service is made, -or alternatively it may run as a daemon which executes continuously, handling -requests. Whatever method is chosen, the -ServerType directive must be set -to tell the server how it is to run. - -

    Command line options

    -The following options are recognised on the httpd command line: -
    -
    -d serverroot -
    Set the initial value for the -ServerRoot variable to -serverroot. This can be overridden by the ServerRoot command in the -configuration file. The default is /usr/local/etc/httpd. - -
    -f config -
    Execute the commands in the file config on startup. If -config does not begin with a /, then it is taken to be a -path relative to the ServerRoot. The -default is conf/httpd.conf. - -
    -X -
    Run in single-process mode, for internal debugging purposes only; the -daemon does not detach from the terminal or fork any children. Do NOT -use this mode to provide ordinary web service. - -
    -v -
    Print the version of httpd, and then exit. - -
    -? -
    Print a list of the httpd options, and then exit. -
    - -

    Configuration files

    -The server will read three files for configuration directives. Any directive -may appear in any of these files. The the names of these files are taken -to be relative to the server root; this is set by the -ServerRoot directive, or the --d command line flag. - -Conventionally, the files are: -
    -
    conf/httpd.conf -
    Contains directives that control the operation of the server daemon. -The filename may be overridden with the -f command line flag. - -
    conf/srm.conf -
    Contains directives that control the specification of documents that -the server can provide to clients. The filename may be overridden with -the ResourceConfig directive. - -
    conf/acces.conf -
    Contains directives that control access to documents. -The filename may be overridden with the -AccessConfig directive. -
    -However, these conventions need not be adhered to. -

    -The server also reads a file containing mime document types; the filename -is set by the TypesConfig directive, -and is conf/mime.types by default. - -

    Log files

    -

    pid file

    -On daemon startup, it saves the process id of the parent httpd process to -the file logs/httpd.pid. This filename can be changed with the -PidFile directive. The process-id is for -use by the administrator in restarting and terminating the daemon; -A HUP signal causes the daemon to re-read its configuration files and -a TERM signal causes it to die gracefully. -

    -If the process dies (or is killed) abnormally, then it will be necessary to -kill the children httpd processes. - -

    Error log

    -The server will log error messages to a log file, logs/error_log -by default. The filename can be set using the -ErrorLog directive; different error logs can -be set for different virtual hosts. - -

    Transfer log

    -The server will typically log each request to a transfer file, -logs/access_log by default. The filename can be set using a -TransferLog directive; different -transfer logs can be set for different virtual -hosts. - - -
    -Home -Index - - - - diff --git a/docs/manual/logs.html b/docs/manual/logs.html deleted file mode 100644 index d3ebf480c58923088ca92be461a58abde09416bb..0000000000000000000000000000000000000000 --- a/docs/manual/logs.html +++ /dev/null @@ -1,580 +0,0 @@ - - - -Log Files - Apache HTTP Server - - - - - -

    Log Files

    - -

    In order to effectively manage a web server, it is necessary to get -feedback about the activity and performance of the server as well as -any problems that may be occuring. The Apache HTTP Server provides -very comprehensive and flexible logging capabilities. This document -describes how to configure the various log files, and how to -understand what the logs contain.

    - - - -
    - -

    Security Warning

    - -

    Anyone who can write to the directory where Apache is writing a -log file can almost certainly gain access to the uid that the server is -started as, which is normally root. Do NOT give people write -access to the directory the logs are stored in without being aware of -the consequences; see the security tips -document for details.

    - -

    In addition, log files may contain information supplied directly -by the client, without escaping. Therefore, it is possible for -malicious clients to insert control-characters in the log files, so -care must be taken in dealing with raw logs.

    - -
    - -

    Error Log

    - - -
    -Related Directives

    - -ErrorLog
    -LogLevel -
    - -

    The server error log, whose name and location is set by the ErrorLog directive, is the most -important log file. This is the place where Apache HTTPD will send -diagnostic information and record any errors that it encounters in -processing requests. It is the first place to look when a problem -occurs with starting the server or with the operation of the server, -since it will often contain details of what went wrong and how to fix -it.

    - -

    The error log is usually written to a file (typically -error_log on unix systems and error.log on -Windows and OS/2). On unix systems it is also possible to have the -server send errors to the syslog or pipe -them through a program.

    - -

    The format of the error log is relatively free-form and -descriptive. But there is certain information that is contained -in most error log entries. For example, here is a typical message.

    - -
    -[Wed Oct 11 14:32:52 2000] [error] [client 127.0.0.1] client denied by server configuration: /export/home/live/ap/htdocs/test -
    - -

    The first item in the log entry is the date and time of the -message. The second entry lists the severity of the error being -reported. The LogLevel directive -is used to control the types of errors that are sent to the error log -by restricting the severity level. The third entry gives the IP -address of the client that generated the error. Beyond that is the -message itself, which in this case indicates that the server has been -configured to deny the client access. The server reports the -file-system path (as opposed to the web path) of the requested -document.

    - -

    A very wide variety of different messages can appear in the error -log. Most look similar to the example above. The error log will also -contain debugging output from CGI scripts. Any information written to -stderr by a CGI script will be copied directly to the -error log.

    - -

    It is not possible to customize the error log by adding or removing -information. However, error log entries dealing with particular -requests have corresponding entries in the access -log. For example, the above example entry corresponds to an -access log entry with status code 403. Since it is possible to -customize the access log, you can obtain more information about error -conditions using that log file.

    - -

    During testing, it is often useful to continuously monitor the -error log for any problems. On unix systems, you can accomplish this -using:

    -
    -tail -f error_log -
    - -
    - -

    Access Log

    - -
    -Related Modules

    - -mod_log_config
    - -
    -Related Directives

    - -CustomLog
    -LogFormat
    -SetEnvIf - -
    - -

    The server access log records all requests processed by the server. -The location of the access log as well as its contents are controlled -by the CustomLog -directive. The LogFormat directive can -be used to simplify the selection of the contents of the logs. -This section describes how to configure the server to record -information in the access log.

    - -

    Of course, storing the information in the access log is only the -start of log management. The next step is to analyze this information -to produce useful statistics. Log analysis in general is beyond the -scope of this document, and not really part of the job of the -web server itself. For more information about this topic, and for -applications which perform log analysis, check the Open Directory or Yahoo.

    - -

    Various versions of Apache HTTPD have used other modules and -directives to control access logging, including mod_log_referer, -mod_log_agent, and the TransferLog directive. The -CustomLog directive now subsumes the functionality of all -the older directives.

    - -

    The format of the access log is highly configurable. The format is -specified using a format -string that looks much like a C-style printf(1) format string. -Some examples are presented in the next sections. For a complete list -of the possible contents of the format string, see the mod_log_config documentation.

    - -

    Common Log Format

    - -

    A typical configuration for the access log might look -as follows.

    - -
    -LogFormat "%h %l %u %t \"%r\" %>s %b" common
    -CustomLog logs/access_log common -
    - -

    This defines the nickname common and -associates it with a particular log format string. The format string -consists of percent directives, each of which tell the server to log a -particular piece of information. Literal characters may also be -placed in the format string and will be copied directly into the log -output. The quote character (") must be escaped by -placing a back-slash before it to prevent it from being interpreted as -the end of the format string. The format string may also contain the -special control characters "\n" for new-line and -"\t" for tab.

    - -

    The CustomLog directive sets up a new log file using -the defined nickname. The filename for the access log is -relative to the ServerRoot -unless it begins with a slash.

    - -

    The above configuration will write log entries in a format known as -the Common Log Format (CLF). This standard format can be produced by -many different web servers and read by many log analysis programs. -The log file entries produced in CLF will look something like -this:

    - -
    -127.0.0.1 - frank [10/Oct/2000:13:55:36 -0700] "GET /apache_pb.gif HTTP/1.0" 200 2326 -
    - -

    Each part of this log entry is described below.

    - -
    -
    127.0.0.1 (%h)
    This is the IP -address of the client (remote host) which made the request to the -server. If HostNameLookups is set to -On, then the server will try to determine the hostname -and log it in place of the IP address. However, this configuration is -not recommended since it can significantly slow the server. Instead, -it is best to use a log post-processor such as logresolve to determine the -hostnames. The IP address reported here is not necessarily the -address of the machine at which the user is sitting. If a proxy -server exists between the user and the server, this address will be -the address of the proxy, rather than the originating machine.
    - -
    - (%l)
    The "hyphen" in the -output indicates that the requested piece of information is not -available. In this case, the information that is not available is the -RFC 1413 identity of the client determined by identd on -the clients machine. This information is highly unreliable and should -almost never be used except on tightly controlled internal networks. -Apache HTTPD will not even attempt to determine this information -unless IdentityCheck is set -to On.
    - -
    frank (%u)
    This is the userid -of the person requesting the document as determined by HTTP -authentication. The same value is typically provided to CGI scripts -in the REMOTE_USER environment variable. If the status -code for the request (see below) is 401, then this value should not be -trusted because the user is not yet authenticated. If the document is -not password protected, this entry will be "-" just like -the previous one.
    - -
    [10/Oct/2000:13:55:36 -0700] (%t)
    -
    The time that the server finished processing the request. The -format is: -
    [day/month/year:hour:minute:second zone]
    -day = 2*digit
    -month = 3*letter
    -year = 4*digit
    -hour = 2*digit
    -minute = 2*digit
    -second = 2*digit
    -zone = (`+' | `-') 4*digit
    -It is possible to have the time displayed in another format -by specifying %{format}t in the log format string, where -format is as in strftime(3) from the C -standard library. -
    - -
    "GET /apache_pb.gif HTTP/1.0" -(\"%r\")
    The request line from the client is -given in double quotes. The request line contains a great deal of -useful information. First, the method used by the client is -GET. Second, the client requested the resource -/apache_pb.gif, and third, the client used the protocol -HTTP/1.0.
    It is also possible to log one or more -parts of the request line independently. For example, the format -string "%m %U%q %H" will log the method, path, -query-string, and protocol, resulting in exactly the same output as -"%r". - -
    200
    (%>s)
    This is the status -code that the server sends back to the client. This information is -very valuable, because it reveals whether the request resulted in a -successful response (codes beginning in 2), a redirection (codes -beginning in 3), an error caused by the client (codes beginning in 4), -or an error in the server (codes beginning in 5). -The full list of possible status codes can be -found in the HTTP specification (RFC2616 section 10).
    - -
    2326 (%b) -
    The last entry indicates the size of the object returned to -the client, not including the response headers. If no content -was returned to the client, this value will be "-". -To log "0" for no content, use %B -instead.
    - -
    - -

    Combined Log Format

    - -

    Another commonly used format string is called the -Combined Log Format. It can be used as follows.

    - -
    -LogFormat "%h %l %u %t \"%r\" %>s %b \"%{Referer}i\" \"%{User-agent}i\"" combined
    -CustomLog log/acces_log combined -
    - -

    This format is exactly the same as the Common Log Format, -with the addition of two more fields. The access log under this -format will look like:

    - -
    -127.0.0.1 - frank [10/Oct/2000:13:55:36 -0700] "GET /apache_pb.gif HTTP/1.0" 200 2326 "http://www.example.com/start.html" "Mozilla/4.08 [en] (Win98; I ;Nav)" -
    - -

    The additional fields are:

    - -
    - -
    "http://www.example.com/start.html" -(\"%{Referer}i\")
    The "Referer" (sic) HTTP -request header. This gives the site that the client reports having -been referred from. (This should be the page that links to or includes -/apache_pb.gif). - -
    "Mozilla/4.08 [en] (Win98; I ;Nav)" -(\"%{User-agent}i\")
    The User-Agent HTTP request -header. This is the identifying information that the client browser -reports about itself.
    - -
    - -

    Multiple Access Logs

    - -

    Multiple access logs can be created simply by specifying multiple -CustomLog directives in the configuration file. For -example, the following directives will create three access logs. The -first contains the basic CLF information, while the second and third -contain referer and browser information. The last two -CustomLog lines show how to mimic the effects of the -ReferLog and AgentLog directives.

    - -
    -LogFormat "%h %l %u %t \"%r\" %>s %b" common
    -CustomLog logs/access_log common
    -CustomLog logs/referer_log "%{Referer}i -> %U"
    -CustomLog logs/agent_log "%{User-agent}i" -
    - -

    This example also shows that it is not necessary to define a -nickname with the LogFormat directive. Instead, the log -format can be specified directly in the CustomLog -directive.

    - -

    Conditional Logging

    - -

    There are times when it is convenient to exclude certain entries -from the access logs based on characteristics of the client request. -This is easily accomplished with the help of environment variables. First, an environment -variable must be set to indicate that the request meets certain -conditions. This is usually accomplished with SetEnvIf. Then the -env= clause of the CustomLog directive is -used to include or exclude requests where the environment variable is -set. Some examples:

    - -
    -# Mark requests from the loop-back interface
    -SetEnvIf Remote_Addr "127\.0\.0\.1" dontlog
    -# Mark requests for the robots.txt file
    -SetEnvIf Request_URI "^/robots\.txt$" dontlog
    -# Log what remains
    -CustomLog logs/access_log common env=!dontlog -
    - -

    As another example, consider logging requests from english-speakers -to one log file, and non-english speakers to a different log file.

    - -
    -SetEnvIf Accept-Language "en" english
    -CustomLog logs/english_log common env=english
    -CustomLog logs/non_english_log common env=!english -
    - -

    Although we have just shown that conditional logging is very -powerful and flexibly, it is not the only way to control the contents -of the logs. Log files are more useful when they contain a complete -record of server activity. It is often easier to simply post-process -the log files to remove requests that you do not want to consider.

    - -
    - -

    Log Rotation

    - -

    On even a moderately busy server, the quantity of information -stored in the log files is very large. The access log file typically -grows 1 MB or more per 10,000 requests. It will consequently be -necessary to periodically rotate the log files by moving or deleting -the existing logs. This cannot be done while the server is running, -because Apache will continue writing to the old log file as long as it -holds the file open. Instead, the server must be restarted after the log files are moved or -deleted so that it will open new log files.

    - -

    By using a graceful restart, the server can be instructed -to open new log files without losing any existing or pending -connections from clients. However, in order to accomplish this, the -server must continue to write to the old log files while it finishes -serving old requests. It is therefore necessary to wait for some time -after the restart before doing any processing on the log files. A -typical scenario that simply rotates the logs and compresses the old -logs to save space is:

    - -
    -mv access_log access_log.old
    -mv error_log error_log.old
    -apachectl graceful
    -sleep 600
    -gzip access_log.old error_log.old -
    - -

    Another way to perform log rotation is using piped -logs as discussed in the next section.

    - -
    - -

    Piped Logs

    - -

    Apache HTTPD is capable of writing error and access log files -through a pipe to another process, rather than directly to a file. -This capability dramatically increases the flexibility of logging, -without adding code to the main server. In order to write logs to a -pipe, simply replace the filename with the pipe character -"|", followed by the name of the executable which should -accept log entries on its standard input. Apache will start the -piped-log process when the server starts, and will restart it if it -crashes while the server is running. (This last feature is why we can -refer to this technique as "reliable piped logging".)

    - -

    Piped log processes are spawned by the parent Apache HTTPD process, -and inherit the userid of that process. This means that piped log -programs usually run as root. It is therefore very important to keep -the programs simple and secure.

    - -

    Some simple examples using piped logs:

    - -
    -# compressed logs
    -CustomLog "|/usr/bin/gzip -c >> /var/log/access_log.gz" common
    -# almost-real-time name resolution
    -CustomLog "|/usr/local/apache/bin/logresolve >> /var/log/access_log" common -
    - -

    Notice that quotes are used to enclose the entire command -that will be called for the pipe. Although these examples are -for the access log, the same technique can be used for the -error log.

    - -

    One important use of piped logs is to allow log rotation without -having to restart the server. Apache HTTPD includes a simple program -called rotatelogs for this -purpose. For example, to rotate the logs every 24 hours, you can -use:

    - -
    -CustomLog "|/usr/local/apache/bin/rotatelogs /var/log/access_log 86400" common -
    - -

    A similar, but much more flexible log rotation program -called cronolog -is available at an external site.

    - -

    As with conditional logging, piped logs are a very powerful tool, -but they should not be used where a simpler solution like -off-line post-processing is available.

    - -
    - -

    Virtual Hosts

    - -

    When running a server with many virtual -hosts, there are several options for dealing with log files. -First, it is possible to use logs exactly as in a single-host server. -Simply by placing the logging directives outside the -<VirtualHost> sections in the main server context, -it is possible to log all requests in the same access log and error -log. This technique does not allow for easy collection of statistics -on individual virtual hosts.

    - -

    If CustomLog or ErrorLog directives are -placed inside a <VirtualHost> section, all requests -or errors for that virtual host will be logged only to the specified -file. Any virtual host which does not have logging directives will -still have its requests sent to the main server logs. This technique -is very useful for a small number of virtual hosts, but if the number -of hosts is very large, it can be complicated to manage. In addition, -it can often create problems with insufficient file descriptors.

    - -

    For the access log, there is a very good compromise. By adding -information on the virtual host to the log format string, -it is possible to log all hosts to the same log, and later -split the log into individual files. For example, consider the -following directives.

    - -
    -LogFormat "%v %l %u %t \"%r\" %>s %b" comonvhost
    -CustomLog logs/access_log comonvhost -
    - -

    The %v is used to log the name of the virtual host -that is serving the request. Then a program like split-logfile can be used to -post-process the access log in order to split it into one file per -virtual host.

    - -

    Unfortunately, no similar technique is available for the error log, -so you must choose between mixing all virtual hosts in the same error -log and using one error log per virtual host.

    - -
    - -

    Other Log Files

    - -
    -Related Modules

    - -mod_cgi
    -mod_rewrite - -
    -Related Directives

    - -PidFile
    -RewriteLog
    -RewriteLogLevel
    -ScriptLog
    -ScriptLogLength
    -ScriptLogBuffer - -
    - -

    PID File

    - -

    On startup, Apache HTTPD saves the process id of the parent httpd -process to the file logs/httpd.pid. This filename can be -changed with the PidFile -directive. The process-id is for use by the administrator in -restarting and terminating the daemon by sending signals -to the parent process; on Windows, use the -k command line -option instead. For more information see the Stopping and Restarting page. - -

    Script Log

    - -

    In order to aid in debugging, the -ScriptLog -directive allows you to record the input to and output from -CGI scripts. This should only be used in testing - not for -live servers. More information is available in the -mod_cgi documentation. - -

    Rewrite Log

    - -

    When using the powerful and complex features of mod_rewrite, it is almost always -necessary to use the RewriteLog to help in -debugging. This log file produces a detailed analysis of how the -rewriting engine transforms requests. The level of detail is -controlled by the RewriteLogLevel -directive.

    - - - - diff --git a/docs/manual/logs.html.en b/docs/manual/logs.html.en deleted file mode 100644 index d3ebf480c58923088ca92be461a58abde09416bb..0000000000000000000000000000000000000000 --- a/docs/manual/logs.html.en +++ /dev/null @@ -1,580 +0,0 @@ - - - -Log Files - Apache HTTP Server - - - - - -

    Log Files

    - -

    In order to effectively manage a web server, it is necessary to get -feedback about the activity and performance of the server as well as -any problems that may be occuring. The Apache HTTP Server provides -very comprehensive and flexible logging capabilities. This document -describes how to configure the various log files, and how to -understand what the logs contain.

    - - - -
    - -

    Security Warning

    - -

    Anyone who can write to the directory where Apache is writing a -log file can almost certainly gain access to the uid that the server is -started as, which is normally root. Do NOT give people write -access to the directory the logs are stored in without being aware of -the consequences; see the security tips -document for details.

    - -

    In addition, log files may contain information supplied directly -by the client, without escaping. Therefore, it is possible for -malicious clients to insert control-characters in the log files, so -care must be taken in dealing with raw logs.

    - -
    - -

    Error Log

    - - -
    -Related Directives

    - -ErrorLog
    -LogLevel -
    - -

    The server error log, whose name and location is set by the ErrorLog directive, is the most -important log file. This is the place where Apache HTTPD will send -diagnostic information and record any errors that it encounters in -processing requests. It is the first place to look when a problem -occurs with starting the server or with the operation of the server, -since it will often contain details of what went wrong and how to fix -it.

    - -

    The error log is usually written to a file (typically -error_log on unix systems and error.log on -Windows and OS/2). On unix systems it is also possible to have the -server send errors to the syslog or pipe -them through a program.

    - -

    The format of the error log is relatively free-form and -descriptive. But there is certain information that is contained -in most error log entries. For example, here is a typical message.

    - -
    -[Wed Oct 11 14:32:52 2000] [error] [client 127.0.0.1] client denied by server configuration: /export/home/live/ap/htdocs/test -
    - -

    The first item in the log entry is the date and time of the -message. The second entry lists the severity of the error being -reported. The LogLevel directive -is used to control the types of errors that are sent to the error log -by restricting the severity level. The third entry gives the IP -address of the client that generated the error. Beyond that is the -message itself, which in this case indicates that the server has been -configured to deny the client access. The server reports the -file-system path (as opposed to the web path) of the requested -document.

    - -

    A very wide variety of different messages can appear in the error -log. Most look similar to the example above. The error log will also -contain debugging output from CGI scripts. Any information written to -stderr by a CGI script will be copied directly to the -error log.

    - -

    It is not possible to customize the error log by adding or removing -information. However, error log entries dealing with particular -requests have corresponding entries in the access -log. For example, the above example entry corresponds to an -access log entry with status code 403. Since it is possible to -customize the access log, you can obtain more information about error -conditions using that log file.

    - -

    During testing, it is often useful to continuously monitor the -error log for any problems. On unix systems, you can accomplish this -using:

    -
    -tail -f error_log -
    - -
    - -

    Access Log

    - -
    -Related Modules

    - -mod_log_config
    - -
    -Related Directives

    - -CustomLog
    -LogFormat
    -SetEnvIf - -
    - -

    The server access log records all requests processed by the server. -The location of the access log as well as its contents are controlled -by the CustomLog -directive. The LogFormat directive can -be used to simplify the selection of the contents of the logs. -This section describes how to configure the server to record -information in the access log.

    - -

    Of course, storing the information in the access log is only the -start of log management. The next step is to analyze this information -to produce useful statistics. Log analysis in general is beyond the -scope of this document, and not really part of the job of the -web server itself. For more information about this topic, and for -applications which perform log analysis, check the Open Directory or Yahoo.

    - -

    Various versions of Apache HTTPD have used other modules and -directives to control access logging, including mod_log_referer, -mod_log_agent, and the TransferLog directive. The -CustomLog directive now subsumes the functionality of all -the older directives.

    - -

    The format of the access log is highly configurable. The format is -specified using a format -string that looks much like a C-style printf(1) format string. -Some examples are presented in the next sections. For a complete list -of the possible contents of the format string, see the mod_log_config documentation.

    - -

    Common Log Format

    - -

    A typical configuration for the access log might look -as follows.

    - -
    -LogFormat "%h %l %u %t \"%r\" %>s %b" common
    -CustomLog logs/access_log common -
    - -

    This defines the nickname common and -associates it with a particular log format string. The format string -consists of percent directives, each of which tell the server to log a -particular piece of information. Literal characters may also be -placed in the format string and will be copied directly into the log -output. The quote character (") must be escaped by -placing a back-slash before it to prevent it from being interpreted as -the end of the format string. The format string may also contain the -special control characters "\n" for new-line and -"\t" for tab.

    - -

    The CustomLog directive sets up a new log file using -the defined nickname. The filename for the access log is -relative to the ServerRoot -unless it begins with a slash.

    - -

    The above configuration will write log entries in a format known as -the Common Log Format (CLF). This standard format can be produced by -many different web servers and read by many log analysis programs. -The log file entries produced in CLF will look something like -this:

    - -
    -127.0.0.1 - frank [10/Oct/2000:13:55:36 -0700] "GET /apache_pb.gif HTTP/1.0" 200 2326 -
    - -

    Each part of this log entry is described below.

    - -
    -
    127.0.0.1 (%h)
    This is the IP -address of the client (remote host) which made the request to the -server. If HostNameLookups is set to -On, then the server will try to determine the hostname -and log it in place of the IP address. However, this configuration is -not recommended since it can significantly slow the server. Instead, -it is best to use a log post-processor such as logresolve to determine the -hostnames. The IP address reported here is not necessarily the -address of the machine at which the user is sitting. If a proxy -server exists between the user and the server, this address will be -the address of the proxy, rather than the originating machine.
    - -
    - (%l)
    The "hyphen" in the -output indicates that the requested piece of information is not -available. In this case, the information that is not available is the -RFC 1413 identity of the client determined by identd on -the clients machine. This information is highly unreliable and should -almost never be used except on tightly controlled internal networks. -Apache HTTPD will not even attempt to determine this information -unless IdentityCheck is set -to On.
    - -
    frank (%u)
    This is the userid -of the person requesting the document as determined by HTTP -authentication. The same value is typically provided to CGI scripts -in the REMOTE_USER environment variable. If the status -code for the request (see below) is 401, then this value should not be -trusted because the user is not yet authenticated. If the document is -not password protected, this entry will be "-" just like -the previous one.
    - -
    [10/Oct/2000:13:55:36 -0700] (%t)
    -
    The time that the server finished processing the request. The -format is: -
    [day/month/year:hour:minute:second zone]
    -day = 2*digit
    -month = 3*letter
    -year = 4*digit
    -hour = 2*digit
    -minute = 2*digit
    -second = 2*digit
    -zone = (`+' | `-') 4*digit
    -It is possible to have the time displayed in another format -by specifying %{format}t in the log format string, where -format is as in strftime(3) from the C -standard library. -
    - -
    "GET /apache_pb.gif HTTP/1.0" -(\"%r\")
    The request line from the client is -given in double quotes. The request line contains a great deal of -useful information. First, the method used by the client is -GET. Second, the client requested the resource -/apache_pb.gif, and third, the client used the protocol -HTTP/1.0.
    It is also possible to log one or more -parts of the request line independently. For example, the format -string "%m %U%q %H" will log the method, path, -query-string, and protocol, resulting in exactly the same output as -"%r". - -
    200
    (%>s)
    This is the status -code that the server sends back to the client. This information is -very valuable, because it reveals whether the request resulted in a -successful response (codes beginning in 2), a redirection (codes -beginning in 3), an error caused by the client (codes beginning in 4), -or an error in the server (codes beginning in 5). -The full list of possible status codes can be -found in the HTTP specification (RFC2616 section 10).
    - -
    2326 (%b) -
    The last entry indicates the size of the object returned to -the client, not including the response headers. If no content -was returned to the client, this value will be "-". -To log "0" for no content, use %B -instead.
    - -
    - -

    Combined Log Format

    - -

    Another commonly used format string is called the -Combined Log Format. It can be used as follows.

    - -
    -LogFormat "%h %l %u %t \"%r\" %>s %b \"%{Referer}i\" \"%{User-agent}i\"" combined
    -CustomLog log/acces_log combined -
    - -

    This format is exactly the same as the Common Log Format, -with the addition of two more fields. The access log under this -format will look like:

    - -
    -127.0.0.1 - frank [10/Oct/2000:13:55:36 -0700] "GET /apache_pb.gif HTTP/1.0" 200 2326 "http://www.example.com/start.html" "Mozilla/4.08 [en] (Win98; I ;Nav)" -
    - -

    The additional fields are:

    - -
    - -
    "http://www.example.com/start.html" -(\"%{Referer}i\")
    The "Referer" (sic) HTTP -request header. This gives the site that the client reports having -been referred from. (This should be the page that links to or includes -/apache_pb.gif). - -
    "Mozilla/4.08 [en] (Win98; I ;Nav)" -(\"%{User-agent}i\")
    The User-Agent HTTP request -header. This is the identifying information that the client browser -reports about itself.
    - -
    - -

    Multiple Access Logs

    - -

    Multiple access logs can be created simply by specifying multiple -CustomLog directives in the configuration file. For -example, the following directives will create three access logs. The -first contains the basic CLF information, while the second and third -contain referer and browser information. The last two -CustomLog lines show how to mimic the effects of the -ReferLog and AgentLog directives.

    - -
    -LogFormat "%h %l %u %t \"%r\" %>s %b" common
    -CustomLog logs/access_log common
    -CustomLog logs/referer_log "%{Referer}i -> %U"
    -CustomLog logs/agent_log "%{User-agent}i" -
    - -

    This example also shows that it is not necessary to define a -nickname with the LogFormat directive. Instead, the log -format can be specified directly in the CustomLog -directive.

    - -

    Conditional Logging

    - -

    There are times when it is convenient to exclude certain entries -from the access logs based on characteristics of the client request. -This is easily accomplished with the help of environment variables. First, an environment -variable must be set to indicate that the request meets certain -conditions. This is usually accomplished with SetEnvIf. Then the -env= clause of the CustomLog directive is -used to include or exclude requests where the environment variable is -set. Some examples:

    - -
    -# Mark requests from the loop-back interface
    -SetEnvIf Remote_Addr "127\.0\.0\.1" dontlog
    -# Mark requests for the robots.txt file
    -SetEnvIf Request_URI "^/robots\.txt$" dontlog
    -# Log what remains
    -CustomLog logs/access_log common env=!dontlog -
    - -

    As another example, consider logging requests from english-speakers -to one log file, and non-english speakers to a different log file.

    - -
    -SetEnvIf Accept-Language "en" english
    -CustomLog logs/english_log common env=english
    -CustomLog logs/non_english_log common env=!english -
    - -

    Although we have just shown that conditional logging is very -powerful and flexibly, it is not the only way to control the contents -of the logs. Log files are more useful when they contain a complete -record of server activity. It is often easier to simply post-process -the log files to remove requests that you do not want to consider.

    - -
    - -

    Log Rotation

    - -

    On even a moderately busy server, the quantity of information -stored in the log files is very large. The access log file typically -grows 1 MB or more per 10,000 requests. It will consequently be -necessary to periodically rotate the log files by moving or deleting -the existing logs. This cannot be done while the server is running, -because Apache will continue writing to the old log file as long as it -holds the file open. Instead, the server must be restarted after the log files are moved or -deleted so that it will open new log files.

    - -

    By using a graceful restart, the server can be instructed -to open new log files without losing any existing or pending -connections from clients. However, in order to accomplish this, the -server must continue to write to the old log files while it finishes -serving old requests. It is therefore necessary to wait for some time -after the restart before doing any processing on the log files. A -typical scenario that simply rotates the logs and compresses the old -logs to save space is:

    - -
    -mv access_log access_log.old
    -mv error_log error_log.old
    -apachectl graceful
    -sleep 600
    -gzip access_log.old error_log.old -
    - -

    Another way to perform log rotation is using piped -logs as discussed in the next section.

    - -
    - -

    Piped Logs

    - -

    Apache HTTPD is capable of writing error and access log files -through a pipe to another process, rather than directly to a file. -This capability dramatically increases the flexibility of logging, -without adding code to the main server. In order to write logs to a -pipe, simply replace the filename with the pipe character -"|", followed by the name of the executable which should -accept log entries on its standard input. Apache will start the -piped-log process when the server starts, and will restart it if it -crashes while the server is running. (This last feature is why we can -refer to this technique as "reliable piped logging".)

    - -

    Piped log processes are spawned by the parent Apache HTTPD process, -and inherit the userid of that process. This means that piped log -programs usually run as root. It is therefore very important to keep -the programs simple and secure.

    - -

    Some simple examples using piped logs:

    - -
    -# compressed logs
    -CustomLog "|/usr/bin/gzip -c >> /var/log/access_log.gz" common
    -# almost-real-time name resolution
    -CustomLog "|/usr/local/apache/bin/logresolve >> /var/log/access_log" common -
    - -

    Notice that quotes are used to enclose the entire command -that will be called for the pipe. Although these examples are -for the access log, the same technique can be used for the -error log.

    - -

    One important use of piped logs is to allow log rotation without -having to restart the server. Apache HTTPD includes a simple program -called rotatelogs for this -purpose. For example, to rotate the logs every 24 hours, you can -use:

    - -
    -CustomLog "|/usr/local/apache/bin/rotatelogs /var/log/access_log 86400" common -
    - -

    A similar, but much more flexible log rotation program -called cronolog -is available at an external site.

    - -

    As with conditional logging, piped logs are a very powerful tool, -but they should not be used where a simpler solution like -off-line post-processing is available.

    - -
    - -

    Virtual Hosts

    - -

    When running a server with many virtual -hosts, there are several options for dealing with log files. -First, it is possible to use logs exactly as in a single-host server. -Simply by placing the logging directives outside the -<VirtualHost> sections in the main server context, -it is possible to log all requests in the same access log and error -log. This technique does not allow for easy collection of statistics -on individual virtual hosts.

    - -

    If CustomLog or ErrorLog directives are -placed inside a <VirtualHost> section, all requests -or errors for that virtual host will be logged only to the specified -file. Any virtual host which does not have logging directives will -still have its requests sent to the main server logs. This technique -is very useful for a small number of virtual hosts, but if the number -of hosts is very large, it can be complicated to manage. In addition, -it can often create problems with insufficient file descriptors.

    - -

    For the access log, there is a very good compromise. By adding -information on the virtual host to the log format string, -it is possible to log all hosts to the same log, and later -split the log into individual files. For example, consider the -following directives.

    - -
    -LogFormat "%v %l %u %t \"%r\" %>s %b" comonvhost
    -CustomLog logs/access_log comonvhost -
    - -

    The %v is used to log the name of the virtual host -that is serving the request. Then a program like split-logfile can be used to -post-process the access log in order to split it into one file per -virtual host.

    - -

    Unfortunately, no similar technique is available for the error log, -so you must choose between mixing all virtual hosts in the same error -log and using one error log per virtual host.

    - -
    - -

    Other Log Files

    - -
    -Related Modules

    - -mod_cgi
    -mod_rewrite - -
    -Related Directives

    - -PidFile
    -RewriteLog
    -RewriteLogLevel
    -ScriptLog
    -ScriptLogLength
    -ScriptLogBuffer - -
    - -

    PID File

    - -

    On startup, Apache HTTPD saves the process id of the parent httpd -process to the file logs/httpd.pid. This filename can be -changed with the PidFile -directive. The process-id is for use by the administrator in -restarting and terminating the daemon by sending signals -to the parent process; on Windows, use the -k command line -option instead. For more information see the Stopping and Restarting page. - -

    Script Log

    - -

    In order to aid in debugging, the -ScriptLog -directive allows you to record the input to and output from -CGI scripts. This should only be used in testing - not for -live servers. More information is available in the -mod_cgi documentation. - -

    Rewrite Log

    - -

    When using the powerful and complex features of mod_rewrite, it is almost always -necessary to use the RewriteLog to help in -debugging. This log file produces a detailed analysis of how the -rewriting engine transforms requests. The level of detail is -controlled by the RewriteLogLevel -directive.

    - - - - diff --git a/docs/manual/misc/index.html b/docs/manual/misc/index.html deleted file mode 100644 index b8d7fbe27a1fb96627ffa5ebfe60566660f6b9ac..0000000000000000000000000000000000000000 --- a/docs/manual/misc/index.html +++ /dev/null @@ -1,112 +0,0 @@ - - - - Apache Miscellaneous Documentation - - - - -

    Apache Miscellaneous Documentation

    - -

    - Below is a list of additional documentation pages that apply to the - Apache web server development project. -

    -
    -
    API -
    -
    Description of Apache's Application Programming Interface. -
    -
    FAQ -
    -
    Frequently-Asked Questions concerning the Apache project and server -
    -
    Reading Client Input in Apache 1.2 -
    -
    Describes differences between Apache 1.1 and 1.2 in how modules - read information from the client -
    -
    Compatibility with NCSA -
    -
    Notes about Apache's compatibility with the NCSA server -
    -
    FIN_WAIT_2 -
    -
    A description of the causes of Apache processes going into the - FIN_WAIT_2 state, and what you can do about it -
    -
    "How-To" -
    -
    Instructions about how to accomplish some commonly-desired server - functionality changes -
    -
    Known Bugs -
    -
    Just what it says - a list of known bugs in each of the Apache releases -
    -
    No PGP -
    -
    Why we took PEM and PGP support out of the base Apache distribution -
    -
    Performance Notes (BSD 4.4) -
    -
    Some notes about ways to improve/optimise Apache performance on - BSD 4.4 systems -
    -
    Performance Notes (Digital UNIX) -
    -
    Extracts of USENET postings describing how to optimise Apache - performance on Digital UNIX systems -
    -
    Performance Notes (General) -
    -
    Some generic note about how to improve Apache performance -
    -
    Security Tips -
    -
    Some "do"s - and "don't"s - for keeping your - Apache web site secure -
    -
    Virtual Hosts (IP-based) -
    -
    Excerpts and notes about configuring and using Apache IP-based virtual - hosts -
    -
    Windows Bug with Web Keepalive -
    -
    A brief description of a known problem with Microsoft Windows and - web sites accessed using keepalive connections -
    -
    - - - - diff --git a/docs/manual/misc/perf-tuning.html b/docs/manual/misc/perf-tuning.html deleted file mode 100644 index 16f8c835ef274801ff57a058b0a92ecc368375da..0000000000000000000000000000000000000000 --- a/docs/manual/misc/perf-tuning.html +++ /dev/null @@ -1,820 +0,0 @@ - - -Apache Performance Notes - - - -

    Apache Performance Notes

    - -

    Author: Dean Gaudet - -

    Introduction

    -

    Apache is a general webserver, which is designed to be correct first, and -fast second. Even so, it's performance is quite satisfactory. Most -sites have less than 10Mbits of outgoing bandwidth, which Apache can -fill using only a low end Pentium-based webserver. In practice sites -with more bandwidth require more than one machine to fill the bandwidth -due to other constraints (such as CGI or database transaction overhead). -For these reasons the development focus has been mostly on correctness -and configurability. - -

    Unfortunately many folks overlook these facts and cite raw performance -numbers as if they are some indication of the quality of a web server -product. There is a bare minimum performance that is acceptable, beyond -that extra speed only caters to a much smaller segment of the market. -But in order to avoid this hurdle to the acceptance of Apache in some -markets, effort was put into Apache 1.3 to bring performance up to a -point where the difference with other high-end webservers is minimal. - -

    Finally there are the folks who just plain want to see how fast something -can go. The author falls into this category. The rest of this document -is dedicated to these folks who want to squeeze every last bit of -performance out of Apache's current model, and want to understand why -it does some things which slow it down. - -

    Note that this is tailored towards Apache 1.3 on Unix. Some of it applies -to Apache on NT. Apache on NT has not been tuned for performance yet, -in fact it probably performs very poorly because NT performance requires -a different programming model. - -

    Hardware and Operating System Issues

    - -

    The single biggest hardware issue affecting webserver performance -is RAM. A webserver should never ever have to swap, swapping increases -the latency of each request beyond a point that users consider "fast -enough". This causes users to hit stop and reload, further increasing -the load. You can, and should, control the MaxClients -setting so that your server does not spawn so many children it starts -swapping. - -

    Beyond that the rest is mundane: get a fast enough CPU, a fast enough -network card, and fast enough disks, where "fast enough" is something -that needs to be determined by experimentation. - -

    Operating system choice is largely a matter of local concerns. But -a general guideline is to always apply the latest vendor TCP/IP patches. -HTTP serving completely breaks many of the assumptions built into Unix -kernels up through 1994 and even 1995. Good choices include -recent FreeBSD, and Linux. - -

    Run-Time Configuration Issues

    - -

    HostnameLookups

    -

    Prior to Apache 1.3, HostnameLookups defaulted to On. -This adds latency -to every request because it requires a DNS lookup to complete before -the request is finished. In Apache 1.3 this setting defaults to Off. -However (1.3 or later), if you use any allow from domain or -deny from domain directives then you will pay for a -double reverse DNS lookup (a reverse, followed by a forward to make sure -that the reverse is not being spoofed). So for the highest performance -avoid using these directives (it's fine to use IP addresses rather than -domain names). - -

    Note that it's possible to scope the directives, such as within -a <Location /server-status> section. In this -case the DNS lookups are only performed on requests matching the -criteria. Here's an example which disables -lookups except for .html and .cgi files: - -

    -HostnameLookups off
    -<Files ~ "\.(html|cgi)$>
    -    HostnameLookups on
    -</Files>
    -
    - -But even still, if you just need DNS names -in some CGIs you could consider doing the -gethostbyname call in the specific CGIs that need it. - -

    FollowSymLinks and SymLinksIfOwnerMatch

    -

    Wherever in your URL-space you do not have an -Options FollowSymLinks, or you do have an -Options SymLinksIfOwnerMatch Apache will have to -issue extra system calls to check up on symlinks. One extra call per -filename component. For example, if you had: - -

    -DocumentRoot /www/htdocs
    -<Directory />
    -    Options SymLinksIfOwnerMatch
    -</Directory>
    -
    - -and a request is made for the URI /index.html. -Then Apache will perform lstat(2) on /www, -/www/htdocs, and /www/htdocs/index.html. The -results of these lstats are never cached, -so they will occur on every single request. If you really desire the -symlinks security checking you can do something like this: - -
    -DocumentRoot /www/htdocs
    -<Directory />
    -    Options FollowSymLinks
    -</Directory>
    -<Directory /www/htdocs>
    -    Options -FollowSymLinks +SymLinksIfOwnerMatch
    -</Directory>
    -
    - -This at least avoids the extra checks for the DocumentRoot -path. Note that you'll need to add similar sections if you have any -Alias or RewriteRule paths outside of your -document root. For highest performance, and no symlink protection, -set FollowSymLinks everywhere, and never set -SymLinksIfOwnerMatch. - -

    AllowOverride

    - -

    Wherever in your URL-space you allow overrides (typically -.htaccess files) Apache will attempt to open -.htaccess for each filename component. For example, - -

    -DocumentRoot /www/htdocs
    -<Directory />
    -    AllowOverride all
    -</Directory>
    -
    - -and a request is made for the URI /index.html. Then -Apache will attempt to open /.htaccess, -/www/.htaccess, and /www/htdocs/.htaccess. -The solutions are similar to the previous case of Options -FollowSymLinks. For highest performance use -AllowOverride None everywhere in your filesystem. - -

    Negotiation

    - -

    If at all possible, avoid content-negotiation if you're really -interested in every last ounce of performance. In practice the -benefits of negotiation outweigh the performance penalties. There's -one case where you can speed up the server. Instead of using -a wildcard such as: - -

    -DirectoryIndex index
    -
    - -Use a complete list of options: - -
    -DirectoryIndex index.cgi index.pl index.shtml index.html
    -
    - -where you list the most common choice first. - -

    Process Creation

    - -

    Prior to Apache 1.3 the MinSpareServers, -MaxSpareServers, and StartServers settings -all had drastic effects on benchmark results. In particular, Apache -required a "ramp-up" period in order to reach a number of children -sufficient to serve the load being applied. After the initial -spawning of StartServers children, only one child per -second would be created to satisfy the MinSpareServers -setting. So a server being accessed by 100 simultaneous clients, -using the default StartServers of 5 would take on -the order 95 seconds to spawn enough children to handle the load. This -works fine in practice on real-life servers, because they aren't restarted -frequently. But does really poorly on benchmarks which might only run -for ten minutes. - -

    The one-per-second rule was implemented in an effort to avoid -swamping the machine with the startup of new children. If the machine -is busy spawning children it can't service requests. But it has such -a drastic effect on the perceived performance of Apache that it had -to be replaced. As of Apache 1.3, -the code will relax the one-per-second rule. It -will spawn one, wait a second, then spawn two, wait a second, then spawn -four, and it will continue exponentially until it is spawning 32 children -per second. It will stop whenever it satisfies the -MinSpareServers setting. - -

    This appears to be responsive enough that it's -almost unnecessary to twiddle the MinSpareServers, -MaxSpareServers and StartServers knobs. When -more than 4 children are spawned per second, a message will be emitted -to the ErrorLog. If you see a lot of these errors then -consider tuning these settings. Use the mod_status output -as a guide. - -

    Related to process creation is process death induced by the -MaxRequestsPerChild setting. By default this is 30, which -is probably far too low unless your server is using a module such as -mod_perl which causes children to have bloated memory -images. If your server is serving mostly static pages then consider -raising this value to something like 10000. The code is robust enough -that this shouldn't be a problem. - -

    When keep-alives are in use, children will be kept busy -doing nothing waiting for more requests on the already open -connection. The default KeepAliveTimeout of -15 seconds attempts to minimize this effect. The tradeoff -here is between network bandwidth and server resources. -In no event should you raise this above about 60 seconds, as - -most of the benefits are lost. - -

    Compile-Time Configuration Issues

    - -

    mod_status and Rule STATUS=yes

    - -

    If you include mod_status -and you also set Rule STATUS=yes when building -Apache, then on every request Apache will perform two calls to -gettimeofday(2) (or times(2) depending -on your operating system), and (pre-1.3) several extra calls to -time(2). This is all done so that the status report -contains timing indications. For highest performance, set Rule -STATUS=no. - -

    accept Serialization - multiple sockets

    - -

    This discusses a shortcoming in the Unix socket API. -Suppose your -web server uses multiple Listen statements to listen on -either multiple ports or multiple addresses. In order to test each -socket to see if a connection is ready Apache uses select(2). -select(2) indicates that a socket has none or -at least one connection waiting on it. Apache's model includes -multiple children, and all the idle ones test for new connections at the -same time. A naive implementation looks something like this -(these examples do not match the code, they're contrived for -pedagogical purposes): - -

    -    for (;;) {
    -	for (;;) {
    -	    fd_set accept_fds;
    -
    -	    FD_ZERO (&accept_fds);
    -	    for (i = first_socket; i <= last_socket; ++i) {
    -		FD_SET (i, &accept_fds);
    -	    }
    -	    rc = select (last_socket+1, &accept_fds, NULL, NULL, NULL);
    -	    if (rc < 1) continue;
    -	    new_connection = -1;
    -	    for (i = first_socket; i <= last_socket; ++i) {
    -		if (FD_ISSET (i, &accept_fds)) {
    -		    new_connection = accept (i, NULL, NULL);
    -		    if (new_connection != -1) break;
    -		}
    -	    }
    -	    if (new_connection != -1) break;
    -	}
    -	process the new_connection;
    -    }
    -
    - -But this naive implementation has a serious starvation problem. Recall -that multiple children execute this loop at the same time, and so multiple -children will block at select when they are in between -requests. All those blocked children will awaken and return from -select when a single request appears on any socket -(the number of children which awaken varies depending on the operating -system and timing issues). -They will all then fall down into the loop and try to accept -the connection. But only one will succeed (assuming there's still only -one connection ready), the rest will be blocked in accept. -This effectively locks those children into serving requests from that -one socket and no other sockets, and they'll be stuck there until enough -new requests appear on that socket to wake them all up. -This starvation problem was first documented in -PR#467. There -are at least two solutions. - -

    One solution is to make the sockets non-blocking. In this case the -accept won't block the children, and they will be allowed -to continue immediately. But this wastes CPU time. Suppose you have -ten idle children in select, and one connection arrives. -Then nine of those children will wake up, try to accept the -connection, fail, and loop back into select, accomplishing -nothing. Meanwhile none of those children are servicing requests that -occurred on other sockets until they get back up to the select -again. Overall this solution does not seem very fruitful unless you -have as many idle CPUs (in a multiprocessor box) as you have idle children, -not a very likely situation. - -

    Another solution, the one used by Apache, is to serialize entry into -the inner loop. The loop looks like this (differences highlighted): - -

    -    for (;;) {
    -	accept_mutex_on ();
    -	for (;;) {
    -	    fd_set accept_fds;
    -
    -	    FD_ZERO (&accept_fds);
    -	    for (i = first_socket; i <= last_socket; ++i) {
    -		FD_SET (i, &accept_fds);
    -	    }
    -	    rc = select (last_socket+1, &accept_fds, NULL, NULL, NULL);
    -	    if (rc < 1) continue;
    -	    new_connection = -1;
    -	    for (i = first_socket; i <= last_socket; ++i) {
    -		if (FD_ISSET (i, &accept_fds)) {
    -		    new_connection = accept (i, NULL, NULL);
    -		    if (new_connection != -1) break;
    -		}
    -	    }
    -	    if (new_connection != -1) break;
    -	}
    -	accept_mutex_off ();
    -	process the new_connection;
    -    }
    -
    - - -The functions accept_mutex_on and accept_mutex_off -implement a mutual exclusion semaphore. Only one child can have the -mutex at any time. There are several choices for implementing these -mutexes. The choice is defined in src/conf.h (pre-1.3) or -src/main/conf.h (1.3 or later). Some architectures -do not have any locking choice made, on these architectures it is unsafe -to use multiple Listen directives. - -
    -
    USE_FLOCK_SERIALIZED_ACCEPT -
    This method uses the flock(2) system call to lock a -lock file (located by the LockFile directive). - -
    USE_FCNTL_SERIALIZED_ACCEPT -
    This method uses the fcntl(2) system call to lock a -lock file (located by the LockFile directive). - -
    USE_SYSVSEM_SERIALIZED_ACCEPT -
    (1.3 or later) This method uses SysV-style semaphores to implement the -mutex. Unfortunately SysV-style semaphores have some bad side-effects. -One is that it's possible Apache will die without cleaning up the semaphore -(see the ipcs(8) man page). The other is that the semaphore -API allows for a denial of service attack by any CGIs running under the -same uid as the webserver (i.e. all CGIs unless you use something -like suexec or cgiwrapper). For these reasons this method is not used -on any architecture except IRIX (where the previous two are prohibitively -expensive on most IRIX boxes). - -
    USE_USLOCK_SERIALIZED_ACCEPT -
    (1.3 or later) This method is only available on IRIX, and uses -usconfig(2) to create a mutex. While this method avoids -the hassles of SysV-style semaphores, it is not the default for IRIX. -This is because on single processor IRIX boxes (5.3 or 6.2) the -uslock code is two orders of magnitude slower than the SysV-semaphore -code. On multi-processor IRIX boxes the uslock code is an order of magnitude -faster than the SysV-semaphore code. Kind of a messed up situation. -So if you're using a multiprocessor IRIX box then you should rebuild your -webserver with -DUSE_USLOCK_SERIALIZED_ACCEPT on the -EXTRA_CFLAGS. - -
    USE_PTHREADS_SERIALIZED_ACCEPT -
    (1.3 or later) This method uses POSIX mutexes and should work on -any architecture implementing the full POSIX threads specification, -however appears to only work on Solaris (2.5 or later). This is the -default for Solaris 2.5 or later. -
    - -

    If your system has another method of serialization which isn't in the -above list then it may be worthwhile adding code for it (and submitting -a patch back to Apache). - -

    Another solution that has been considered but never implemented is -to partially serialize the loop -- that is, let in a certain number -of processes. This would only be of interest on multiprocessor boxes -where it's possible multiple children could run simultaneously, and the -serialization actually doesn't take advantage of the full bandwidth. -This is a possible area of future investigation, but priority remains -low because highly parallel web servers are not the norm. - -

    Ideally you should run servers without multiple Listen -statements if you want the highest performance. But read on. - -

    accept Serialization - single socket

    - -

    The above is fine and dandy for multiple socket servers, but what -about single socket servers? In theory they shouldn't experience -any of these same problems because all children can just block in -accept(2) until a connection arrives, and no starvation -results. In practice this hides almost the same "spinning" behaviour -discussed above in the non-blocking solution. The way that most TCP -stacks are implemented, the kernel actually wakes up all processes blocked -in accept when a single connection arrives. One of those -processes gets the connection and returns to user-space, the rest spin in -the kernel and go back to sleep when they discover there's no connection -for them. This spinning is hidden from the user-land code, but it's -there nonetheless. This can result in the same load-spiking wasteful -behaviour that a non-blocking solution to the multiple sockets case can. - -

    For this reason we have found that many architectures behave more -"nicely" if we serialize even the single socket case. So this is -actually the default in almost all cases. Crude experiments under -Linux (2.0.30 on a dual Pentium pro 166 w/128Mb RAM) have shown that -the serialization of the single socket case causes less than a 3% -decrease in requests per second over unserialized single-socket. -But unserialized single-socket showed an extra 100ms latency on -each request. This latency is probably a wash on long haul lines, -and only an issue on LANs. If you want to override the single socket -serialization you can define SAFE_UNSERIALIZED_ACCEPT -and then single-socket servers will not serialize at all. - -

    Lingering Close

    - -

    As discussed in -draft-ietf-http-connection-00.txt section 8, -in order for an HTTP server to reliably implement the protocol -it needs to shutdown each direction of the communication independently -(recall that a TCP connection is bi-directional, each half is independent -of the other). This fact is often overlooked by other servers, but -is correctly implemented in Apache as of 1.2. - -

    When this feature was added to Apache it caused a flurry of -problems on various versions of Unix because of a shortsightedness. -The TCP specification does not state that the FIN_WAIT_2 state has a -timeout, but it doesn't prohibit it. On systems without the timeout, -Apache 1.2 induces many sockets stuck forever in the FIN_WAIT_2 state. -In many cases this can be avoided by simply upgrading to the latest -TCP/IP patches supplied by the vendor, in cases where the vendor has -never released patches (i.e. SunOS4 -- although folks with a source -license can patch it themselves) we have decided to disable this feature. - -

    There are two ways of accomplishing this. One is the -socket option SO_LINGER. But as fate would have it, -this has never been implemented properly in most TCP/IP stacks. Even -on those stacks with a proper implementation (i.e. Linux 2.0.31) this -method proves to be more expensive (cputime) than the next solution. - -

    For the most part, Apache implements this in a function called -lingering_close (in http_main.c). The -function looks roughly like this: - -

    -    void lingering_close (int s)
    -    {
    -	char junk_buffer[2048];
    -
    -	/* shutdown the sending side */
    -	shutdown (s, 1);
    -
    -	signal (SIGALRM, lingering_death);
    -	alarm (30);
    -
    -	for (;;) {
    -	    select (s for reading, 2 second timeout);
    -	    if (error) break;
    -	    if (s is ready for reading) {
    -		read (s, junk_buffer, sizeof (junk_buffer));
    -		/* just toss away whatever is here */
    -	    }
    -	}
    -
    -	close (s);
    -    }
    -
    - -This naturally adds some expense at the end of a connection, but it -is required for a reliable implementation. As HTTP/1.1 becomes more -prevalent, and all connections are persistent, this expense will be -amortized over more requests. If you want to play with fire and -disable this feature you can define NO_LINGCLOSE, but -this is not recommended at all. In particular, as HTTP/1.1 pipelined -persistent connections come into use lingering_close -is an absolute necessity (and - -pipelined connections are faster, so you -want to support them). - -

    Scoreboard File

    - -

    Apache's parent and children communicate with each other through -something called the scoreboard. Ideally this should be implemented -in shared memory. For those operating systems that we either have -access to, or have been given detailed ports for, it typically is -implemented using shared memory. The rest default to using an -on-disk file. The on-disk file is not only slow, but it is unreliable -(and less featured). Peruse the src/main/conf.h file -for your architecture and look for either HAVE_MMAP or -HAVE_SHMGET. Defining one of those two enables the -supplied shared memory code. If your system has another type of -shared memory then edit the file src/main/http_main.c and -add the hooks necessary to use it in Apache. (Send us back a patch -too please.) - -

    Historical note: The Linux port of Apache didn't start to use -shared memory until version 1.2 of Apache. This oversight resulted -in really poor and unreliable behaviour of earlier versions of Apache -on Linux. - -

    DYNAMIC_MODULE_LIMIT

    - -

    If you have no intention of using dynamically loaded modules -(you probably don't if you're reading this and tuning your -server for every last ounce of performance) then you should add --DDYNAMIC_MODULE_LIMIT=0 when building your server. -This will save RAM that's allocated only for supporting dynamically -loaded modules. - -

    Appendix: Detailed Analysis of a Trace

    - -Here is a system call trace of Apache 1.3 running on Linux. The run-time -configuration file is essentially the default plus: - -
    -<Directory />
    -    AllowOverride none
    -    Options FollowSymLinks
    -</Directory>
    -
    - -The file being requested is a static 6K file of no particular content. -Traces of non-static requests or requests with content negotiation -look wildly different (and quite ugly in some cases). First the -entire trace, then we'll examine details. (This was generated by -the strace program, other similar programs include -truss, ktrace, and par.) - -
    -accept(15, {sin_family=AF_INET, sin_port=htons(22283), sin_addr=inet_addr("127.0.0.1")}, [16]) = 3
    -flock(18, LOCK_UN)                      = 0
    -sigaction(SIGUSR1, {SIG_IGN}, {0x8059954, [], SA_INTERRUPT}) = 0
    -getsockname(3, {sin_family=AF_INET, sin_port=htons(8080), sin_addr=inet_addr("127.0.0.1")}, [16]) = 0
    -setsockopt(3, IPPROTO_TCP1, [1], 4)     = 0
    -read(3, "GET /6k HTTP/1.0\r\nUser-Agent: "..., 4096) = 60
    -sigaction(SIGUSR1, {SIG_IGN}, {SIG_IGN}) = 0
    -time(NULL)                              = 873959960
    -gettimeofday({873959960, 404935}, NULL) = 0
    -stat("/home/dgaudet/ap/apachen/htdocs/6k", {st_mode=S_IFREG|0644, st_size=6144, ...}) = 0
    -open("/home/dgaudet/ap/apachen/htdocs/6k", O_RDONLY) = 4
    -mmap(0, 6144, PROT_READ, MAP_PRIVATE, 4, 0) = 0x400ee000
    -writev(3, [{"HTTP/1.1 200 OK\r\nDate: Thu, 11"..., 245}, {"\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"..., 6144}], 2) = 6389
    -close(4)                                = 0
    -time(NULL)                              = 873959960
    -write(17, "127.0.0.1 - - [10/Sep/1997:23:39"..., 71) = 71
    -gettimeofday({873959960, 417742}, NULL) = 0
    -times({tms_utime=5, tms_stime=0, tms_cutime=0, tms_cstime=0}) = 446747
    -shutdown(3, 1 /* send */)               = 0
    -oldselect(4, [3], NULL, [3], {2, 0})    = 1 (in [3], left {2, 0})
    -read(3, "", 2048)                       = 0
    -close(3)                                = 0
    -sigaction(SIGUSR1, {0x8059954, [], SA_INTERRUPT}, {SIG_IGN}) = 0
    -munmap(0x400ee000, 6144)                = 0
    -flock(18, LOCK_EX)                      = 0
    -
    - -

    Notice the accept serialization: - -

    -flock(18, LOCK_UN)                      = 0
    -...
    -flock(18, LOCK_EX)                      = 0
    -
    - -These two calls can be removed by defining -SAFE_UNSERIALIZED_ACCEPT as described earlier. - -

    Notice the SIGUSR1 manipulation: - -

    -sigaction(SIGUSR1, {SIG_IGN}, {0x8059954, [], SA_INTERRUPT}) = 0
    -...
    -sigaction(SIGUSR1, {SIG_IGN}, {SIG_IGN}) = 0
    -...
    -sigaction(SIGUSR1, {0x8059954, [], SA_INTERRUPT}, {SIG_IGN}) = 0
    -
    - -This is caused by the implementation of graceful restarts. When the -parent receives a SIGUSR1 it sends a SIGUSR1 -to all of its children (and it also increments a "generation counter" -in shared memory). Any children that are idle (between connections) -will immediately die -off when they receive the signal. Any children that are in keep-alive -connections, but are in between requests will die off immediately. But -any children that have a connection and are still waiting for the first -request will not die off immediately. - -

    To see why this is necessary, consider how a browser reacts to a closed -connection. If the connection was a keep-alive connection and the request -being serviced was not the first request then the browser will quietly -reissue the request on a new connection. It has to do this because the -server is always free to close a keep-alive connection in between requests -(i.e. due to a timeout or because of a maximum number of requests). -But, if the connection is closed before the first response has been -received the typical browser will display a "document contains no data" -dialogue (or a broken image icon). This is done on the assumption that -the server is broken in some way (or maybe too overloaded to respond -at all). So Apache tries to avoid ever deliberately closing the connection -before it has sent a single response. This is the cause of those -SIGUSR1 manipulations. - -

    Note that it is theoretically possible to eliminate all three of -these calls. But in rough tests the gain proved to be almost unnoticeable. - -

    In order to implement virtual hosts, Apache needs to know the -local socket address used to accept the connection: - -

    -getsockname(3, {sin_family=AF_INET, sin_port=htons(8080), sin_addr=inet_addr("127.0.0.1")}, [16]) = 0
    -
    - -It is possible to eliminate this call in many situations (such as when -there are no virtual hosts, or when Listen directives are -used which do not have wildcard addresses). But no effort has yet been -made to do these optimizations. - -

    Apache turns off the Nagle algorithm: - -

    -setsockopt(3, IPPROTO_TCP1, [1], 4)     = 0
    -
    - -because of problems described in -a -paper by John Heidemann. - -

    Notice the two time calls: - -

    -time(NULL)                              = 873959960
    -...
    -time(NULL)                              = 873959960
    -
    - -One of these occurs at the beginning of the request, and the other occurs -as a result of writing the log. At least one of these is required to -properly implement the HTTP protocol. The second occurs because the -Common Log Format dictates that the log record include a timestamp of the -end of the request. A custom logging module could eliminate one of the -calls. - -

    As described earlier, Rule STATUS=yes causes two -gettimeofday calls and a call to times: - -

    -gettimeofday({873959960, 404935}, NULL) = 0
    -...
    -gettimeofday({873959960, 417742}, NULL) = 0
    -times({tms_utime=5, tms_stime=0, tms_cutime=0, tms_cstime=0}) = 446747
    -
    - -These can be removed by either removing mod_status or -setting Rule STATUS=no. - -

    It might seem odd to call stat: - -

    -stat("/home/dgaudet/ap/apachen/htdocs/6k", {st_mode=S_IFREG|0644, st_size=6144, ...}) = 0
    -
    - -This is part of the algorithm which calculates the -PATH_INFO for use by CGIs. In fact if the request had been -for the URI /cgi-bin/printenv/foobar then there would be -two calls to stat. The first for -/home/dgaudet/ap/apachen/cgi-bin/printenv/foobar -which does not exist, and the second for -/home/dgaudet/ap/apachen/cgi-bin/printenv, which does exist. -Regardless, at least one stat call is necessary when -serving static files because the file size and modification times are -used to generate HTTP headers (such as Content-Length, -Last-Modified) and implement protocol features (such -as If-Modified-Since). A somewhat more clever server -could avoid the stat when serving non-static files, -however doing so in Apache is very difficult given the modular structure. - -

    All static files are served using mmap: - -

    -mmap(0, 6144, PROT_READ, MAP_PRIVATE, 4, 0) = 0x400ee000
    -...
    -munmap(0x400ee000, 6144)                = 0
    -
    - -On some architectures it's slower to mmap small -files than it is to simply read them. The define -MMAP_THRESHOLD can be set to the minimum size required before -using mmap. By default it's set to 0 (except on SunOS4 -where experimentation has shown 8192 to be a better value). Using a -tool such as -lmbench -you can determine the optimal setting for your -environment. It may even be the case that mmap isn't used -on your architecture, if so then defining USE_MMAP_FILES -might work (if it works then report back to us). - - -

    Apache does its best to avoid copying bytes around in memory. The -first write of any request typically is turned into a writev -which combines both the headers and the first hunk of data: - -

    -writev(3, [{"HTTP/1.1 200 OK\r\nDate: Thu, 11"..., 245}, {"\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"..., 6144}], 2) = 6389
    -
    - -When doing HTTP/1.1 chunked encoding Apache will generate up to four -element writevs. The goal is to push the byte copying -into the kernel, where it typically has to happen anyhow (to assemble -network packets). On testing, various Unixes (BSDI 2.x, Solaris 2.5, -Linux 2.0.31+) properly combine the elements into network packets. -Pre-2.0.31 Linux will not combine, and will create a packet for -each element, so upgrading is a good idea. Defining NO_WRITEV -will disable this combining, but result in very poor chunked encoding -performance. - -

    The log write: - -

    -write(17, "127.0.0.1 - - [10/Sep/1997:23:39"..., 71) = 71
    -
    - -can be deferred by defining BUFFERED_LOGS. In this case -up to PIPE_BUF bytes (a POSIX defined constant) of log entries -are buffered before writing. At no time does it split a log entry -across a PIPE_BUF boundary because those writes may not -be atomic. (i.e. entries from multiple children could become mixed together). -The code does it best to flush this buffer when a child dies. - -

    The lingering close code causes four system calls: - -

    -shutdown(3, 1 /* send */)               = 0
    -oldselect(4, [3], NULL, [3], {2, 0})    = 1 (in [3], left {2, 0})
    -read(3, "", 2048)                       = 0
    -close(3)                                = 0
    -
    - -which were described earlier. - -

    Let's apply some of these optimizations: --DSAFE_UNSERIALIZED_ACCEPT -DBUFFERED_LOGS and -Rule STATUS=no. Here's the final trace: - -

    -accept(15, {sin_family=AF_INET, sin_port=htons(22286), sin_addr=inet_addr("127.0.0.1")}, [16]) = 3
    -sigaction(SIGUSR1, {SIG_IGN}, {0x8058c98, [], SA_INTERRUPT}) = 0
    -getsockname(3, {sin_family=AF_INET, sin_port=htons(8080), sin_addr=inet_addr("127.0.0.1")}, [16]) = 0
    -setsockopt(3, IPPROTO_TCP1, [1], 4)     = 0
    -read(3, "GET /6k HTTP/1.0\r\nUser-Agent: "..., 4096) = 60
    -sigaction(SIGUSR1, {SIG_IGN}, {SIG_IGN}) = 0
    -time(NULL)                              = 873961916
    -stat("/home/dgaudet/ap/apachen/htdocs/6k", {st_mode=S_IFREG|0644, st_size=6144, ...}) = 0
    -open("/home/dgaudet/ap/apachen/htdocs/6k", O_RDONLY) = 4
    -mmap(0, 6144, PROT_READ, MAP_PRIVATE, 4, 0) = 0x400e3000
    -writev(3, [{"HTTP/1.1 200 OK\r\nDate: Thu, 11"..., 245}, {"\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"..., 6144}], 2) = 6389
    -close(4)                                = 0
    -time(NULL)                              = 873961916
    -shutdown(3, 1 /* send */)               = 0
    -oldselect(4, [3], NULL, [3], {2, 0})    = 1 (in [3], left {2, 0})
    -read(3, "", 2048)                       = 0
    -close(3)                                = 0
    -sigaction(SIGUSR1, {0x8058c98, [], SA_INTERRUPT}, {SIG_IGN}) = 0
    -munmap(0x400e3000, 6144)                = 0
    -
    - -That's 19 system calls, of which 4 remain relatively easy to remove, -but don't seem worth the effort. - -

    Appendix: The Pre-Forking Model

    - -

    Apache (on Unix) is a pre-forking model server. The -parent process is responsible only for forking child -processes, it does not serve any requests or service any network -sockets. The child processes actually process connections, they serve -multiple connections (one at a time) before dying. -The parent spawns new or kills off old -children in response to changes in the load on the server (it does so -by monitoring a scoreboard which the children keep up to date). - -

    This model for servers offers a robustness that other models do -not. In particular, the parent code is very simple, and with a high -degree of confidence the parent will continue to do its job without -error. The children are complex, and when you add in third party -code via modules, you risk segmentation faults and other forms of -corruption. Even should such a thing happen, it only affects one -connection and the server continues serving requests. The parent -quickly replaces the dead child. - -

    Pre-forking is also very portable across dialects of Unix. -Historically this has been an important goal for Apache, and it continues -to remain so. - -

    The pre-forking model comes under criticism for various -performance aspects. Of particular concern are the overhead -of forking a process, the overhead of context switches between -processes, and the memory overhead of having multiple processes. -Furthermore it does not offer as many opportunities for data-caching -between requests (such as a pool of mmapped files). -Various other models exist and extensive analysis can be found in the - papers -of the JAWS project. In practice all of these costs vary drastically -depending on the operating system. - -

    Apache's core code is already multithread aware, and Apache version -1.3 is multithreaded on NT. There have been at least two other experimental -implementations of threaded Apache (one using the 1.3 code base on DCE, -and one using a custom user-level threads package and the 1.0 code base, -neither are available publically). Part of our redesign for version 2.0 -of Apache will include abstractions of the server model so that we -can continue to support the pre-forking model, and also support various -threaded models. - - - diff --git a/docs/manual/misc/rewriteguide.html b/docs/manual/misc/rewriteguide.html deleted file mode 100644 index b9c10e2aaccdab81f553890c68b81fd7a3cc88a9..0000000000000000000000000000000000000000 --- a/docs/manual/misc/rewriteguide.html +++ /dev/null @@ -1,1905 +0,0 @@ - - -Apache 1.3 URL Rewriting Guide - - - - -

    - - -
    - -

    -Apache 1.3
    -URL Rewriting Guide
    -

    - -
    Originally written by
    -Ralf S. Engelschall <rse@apache.org>
    -December 1997
    - -
    - -

    -This document supplements the mod_rewrite reference documentation. It describes -how one can use Apache's mod_rewrite to solve typical URL-based problems -webmasters are usually confronted with in practice. I give detailed -descriptions on how to solve each problem by configuring URL rewriting -rulesets. - -

    Introduction to mod_rewrite

    - -The Apache module mod_rewrite is a killer one, i.e. it is a really -sophisticated module which provides a powerful way to do URL manipulations. -With it you can nearly do all types of URL manipulations you ever dreamed -about. The price you have to pay is to accept complexity, because -mod_rewrite's major drawback is that it is not easy to understand and use for -the beginner. And even Apache experts sometimes discover new aspects where -mod_rewrite can help. -

    -In other words: With mod_rewrite you either shoot yourself in the foot the -first time and never use it again or love it for the rest of your life because -of its power. This paper tries to give you a few initial success events to -avoid the first case by presenting already invented solutions to you. - -

    Practical Solutions

    - -Here come a lot of practical solutions I've either invented myself or -collected from other peoples solutions in the past. Feel free to learn the -black magic of URL rewriting from these examples. - -

    -ATTENTION: Depending on your server-configuration it can be necessary to -slightly change the examples for your situation, e.g. adding the [PT] flag -when additionally using mod_alias and mod_userdir, etc. Or rewriting a ruleset -to fit in .htaccess context instead of per-server context. Always try -to understand what a particular ruleset really does before you use it. It -avoid problems. - -

    URL Layout

    - -

    -

    Canonical URLs

    -

    - -

    -
    Description: -
    -On some webservers there are more than one URL for a resource. Usually there -are canonical URLs (which should be actually used and distributed) and those -which are just shortcuts, internal ones, etc. Independed which URL the user -supplied with the request he should finally see the canonical one only. - -

    -

    Solution: -
    -We do an external HTTP redirect for all non-canonical URLs to fix them in the -location view of the Browser and for all subsequent requests. In the example -ruleset below we replace /~user by the canonical /u/user and -fix a missing trailing slash for /u/user. - -

    -RewriteRule   ^/~([^/]+)/?(.*)    /u/$1/$2  [R]
    -RewriteRule   ^/([uge])/([^/]+)$  /$1/$2/   [R]
    -
    - -

    - -

    -

    Canonical Hostnames

    -

    - -

    -
    Description: -
    -... - -

    -

    Solution: -
    - -

    -RewriteCond %{HTTP_HOST}   !^fully\.qualified\.domain\.name [NC]
    -RewriteCond %{HTTP_HOST}   !^$
    -RewriteCond %{SERVER_PORT} !^80$
    -RewriteRule ^/(.*)         http://fully.qualified.domain.name:%{SERVER_PORT}/$1 [L,R]
    -RewriteCond %{HTTP_HOST}   !^fully\.qualified\.domain\.name [NC]
    -RewriteCond %{HTTP_HOST}   !^$
    -RewriteRule ^/(.*)         http://fully.qualified.domain.name/$1 [L,R]
    -
    - -

    - -

    -

    Moved DocumentRoot

    -

    - -

    -
    Description: -
    -Usually the DocumentRoot of the webserver directly relates to the URL -``/''. But often this data is not really of top-level priority, it is -perhaps just one entity of a lot of data pools. For instance at our Intranet -sites there are /e/www/ (the homepage for WWW), /e/sww/ (the -homepage for the Intranet) etc. Now because the data of the DocumentRoot stays -at /e/www/ we had to make sure that all inlined images and other -stuff inside this data pool work for subsequent requests. - -

    -

    Solution: -
    -We just redirect the URL / to /e/www/. While is seems -trivial it is actually trivial with mod_rewrite, only. Because the typical -old mechanisms of URL Aliases (as provides by mod_alias and friends) -only used prefix matching. With this you cannot do such a redirection -because the DocumentRoot is a prefix of all URLs. With mod_rewrite it is -really trivial: - -

    -RewriteEngine on
    -RewriteRule   ^/$  /e/www/  [R]
    -
    - -

    - -

    -

    Trailing Slash Problem

    -

    - -

    -
    Description: -
    -Every webmaster can sing a song about the problem of the trailing slash on -URLs referencing directories. If they are missing, the server dumps an error, -because if you say /~quux/foo instead of -/~quux/foo/ then the server searches for a file named -foo. And because this file is a directory it complains. Actually -is tries to fix it themself in most of the cases, but sometimes this mechanism -need to be emulated by you. For instance after you have done a lot of -complicated URL rewritings to CGI scripts etc. - -

    -

    Solution: -
    -The solution to this subtle problem is to let the server add the trailing -slash automatically. To do this correctly we have to use an external redirect, -so the browser correctly requests subsequent images etc. If we only did a -internal rewrite, this would only work for the directory page, but would go -wrong when any images are included into this page with relative URLs, because -the browser would request an in-lined object. For instance, a request for -image.gif in /~quux/foo/index.html would become -/~quux/image.gif without the external redirect! -

    -So, to do this trick we write: - -

    -RewriteEngine  on
    -RewriteBase    /~quux/
    -RewriteRule    ^foo$  foo/  [R]
    -
    - -

    -The crazy and lazy can even do the following in the top-level -.htaccess file of their homedir. But notice that this creates some -processing overhead. - -

    -RewriteEngine  on
    -RewriteBase    /~quux/
    -RewriteCond    %{REQUEST_FILENAME}  -d
    -RewriteRule    ^(.+[^/])$           $1/  [R]
    -
    - -

    - -

    -

    Webcluster through Homogeneous URL Layout

    -

    - -

    -
    Description: -
    -We want to create a homogenous and consistent URL layout over all WWW servers -on a Intranet webcluster, i.e. all URLs (per definition server local and thus -server dependent!) become actually server independed! What we want is -to give the WWW namespace a consistent server-independend layout: no URL -should have to include any physically correct target server. The cluster -itself should drive us automatically to the physical target host. - -

    -

    Solution: -
    -First, the knowledge of the target servers come from (distributed) external -maps which contain information where our users, groups and entities stay. -The have the form - -

    -user1  server_of_user1
    -user2  server_of_user2
    -:      :
    -

    - -We put them into files map.xxx-to-host. Second we need to instruct -all servers to redirect URLs of the forms - -

    -/u/user/anypath
    -/g/group/anypath
    -/e/entity/anypath
    -

    - -to - -

    -http://physical-host/u/user/anypath
    -http://physical-host/g/group/anypath
    -http://physical-host/e/entity/anypath
    -

    - -when the URL is not locally valid to a server. The following ruleset does -this for us by the help of the map files (assuming that server0 is a default -server which will be used if a user has no entry in the map): - -

    -RewriteEngine on
    -
    -RewriteMap      user-to-host   txt:/path/to/map.user-to-host
    -RewriteMap     group-to-host   txt:/path/to/map.group-to-host
    -RewriteMap    entity-to-host   txt:/path/to/map.entity-to-host
    -
    -RewriteRule   ^/u/([^/]+)/?(.*)   http://${user-to-host:$1|server0}/u/$1/$2
    -RewriteRule   ^/g/([^/]+)/?(.*)  http://${group-to-host:$1|server0}/g/$1/$2
    -RewriteRule   ^/e/([^/]+)/?(.*) http://${entity-to-host:$1|server0}/e/$1/$2
    -
    -RewriteRule   ^/([uge])/([^/]+)/?$          /$1/$2/.www/
    -RewriteRule   ^/([uge])/([^/]+)/([^.]+.+)   /$1/$2/.www/$3\
    -
    - -

    - -

    -

    Move Homedirs to Different Webserver

    -

    - -

    -
    Description: -
    -A lot of webmaster aksed for a solution to the following situation: They -wanted to redirect just all homedirs on a webserver to another webserver. -They usually need such things when establishing a newer webserver which will -replace the old one over time. - -

    -

    Solution: -
    -The solution is trivial with mod_rewrite. On the old webserver we just -redirect all /~user/anypath URLs to -http://newserver/~user/anypath. - -

    -RewriteEngine on
    -RewriteRule   ^/~(.+)  http://newserver/~$1  [R,L]
    -
    - -

    - -

    -

    Structured Homedirs

    -

    - -

    -
    Description: -
    -Some sites with thousend of users usually use a structured homedir layout, -i.e. each homedir is in a subdirectory which begins for instance with the -first character of the username. So, /~foo/anypath is -/home/f/foo/.www/anypath while /~bar/anypath is -/home/b/bar/.www/anypath. - -

    -

    Solution: -
    -We use the following ruleset to expand the tilde URLs into exactly the above -layout. - -

    -RewriteEngine on
    -RewriteRule   ^/~(([a-z])[a-z0-9]+)(.*)  /home/$2/$1/.www$3
    -
    - -

    - -

    -

    Filesystem Reorganisation

    -

    - -

    -
    Description: -
    -This really is a hardcore example: a killer application which heavily uses -per-directory RewriteRules to get a smooth look and feel on the Web -while its data structure is never touched or adjusted. - -Background: net.sw is my archive of freely available Unix -software packages, which I started to collect in 1992. It is both my hobby and -job to to this, because while I'm studying computer science I have also worked -for many years as a system and network administrator in my spare time. Every -week I need some sort of software so I created a deep hierarchy of -directories where I stored the packages: - -

    -drwxrwxr-x   2 netsw  users    512 Aug  3 18:39 Audio/
    -drwxrwxr-x   2 netsw  users    512 Jul  9 14:37 Benchmark/
    -drwxrwxr-x  12 netsw  users    512 Jul  9 00:34 Crypto/
    -drwxrwxr-x   5 netsw  users    512 Jul  9 00:41 Database/
    -drwxrwxr-x   4 netsw  users    512 Jul 30 19:25 Dicts/
    -drwxrwxr-x  10 netsw  users    512 Jul  9 01:54 Graphic/
    -drwxrwxr-x   5 netsw  users    512 Jul  9 01:58 Hackers/
    -drwxrwxr-x   8 netsw  users    512 Jul  9 03:19 InfoSys/
    -drwxrwxr-x   3 netsw  users    512 Jul  9 03:21 Math/
    -drwxrwxr-x   3 netsw  users    512 Jul  9 03:24 Misc/
    -drwxrwxr-x   9 netsw  users    512 Aug  1 16:33 Network/
    -drwxrwxr-x   2 netsw  users    512 Jul  9 05:53 Office/
    -drwxrwxr-x   7 netsw  users    512 Jul  9 09:24 SoftEng/
    -drwxrwxr-x   7 netsw  users    512 Jul  9 12:17 System/
    -drwxrwxr-x  12 netsw  users    512 Aug  3 20:15 Typesetting/
    -drwxrwxr-x  10 netsw  users    512 Jul  9 14:08 X11/
    -

    - -In July 1996 I decided to make this 350 MB archive public to the world via a -nice Web interface ( -http://net.sw.engelschall.com/net.sw/). "Nice" means that I wanted to -offer a interface where you can browse directly through the archive hierarchy. -And "nice" means that I didn't wanted to change anything inside this hierarchy -- not even by putting some CGI scripts at the top of it. Why? Because the -above structure should be later accessible via FTP as well, and I didn't -want any Web or CGI stuuf to be there. - -

    -

    Solution: -
    -The solution has two parts: The first is a set of CGI scripts which create all -the pages at all directory levels on-the-fly. I put them under -/e/netsw/.www/ as follows: - -

    --rw-r--r--   1 netsw  users    1318 Aug  1 18:10 .wwwacl
    -drwxr-xr-x  18 netsw  users     512 Aug  5 15:51 DATA/
    --rw-rw-rw-   1 netsw  users  372982 Aug  5 16:35 LOGFILE
    --rw-r--r--   1 netsw  users     659 Aug  4 09:27 TODO
    --rw-r--r--   1 netsw  users    5697 Aug  1 18:01 netsw-about.html
    --rwxr-xr-x   1 netsw  users     579 Aug  2 10:33 netsw-access.pl
    --rwxr-xr-x   1 netsw  users    1532 Aug  1 17:35 netsw-changes.cgi
    --rwxr-xr-x   1 netsw  users    2866 Aug  5 14:49 netsw-home.cgi
    -drwxr-xr-x   2 netsw  users     512 Jul  8 23:47 netsw-img/
    --rwxr-xr-x   1 netsw  users   24050 Aug  5 15:49 netsw-lsdir.cgi
    --rwxr-xr-x   1 netsw  users    1589 Aug  3 18:43 netsw-search.cgi
    --rwxr-xr-x   1 netsw  users    1885 Aug  1 17:41 netsw-tree.cgi
    --rw-r--r--   1 netsw  users     234 Jul 30 16:35 netsw-unlimit.lst
    -

    - -The DATA/ subdirectory holds the above directory structure, i.e. the -real net.sw stuff and gets automatically updated via -rdist from time to time. - - The second part of the problem remains: how to link these two structures -together into one smooth-looking URL tree? We want to hide the DATA/ -directory from the user while running the appropriate CGI scripts for the -various URLs. - -Here is the solution: first I put the following into the per-directory -configuration file in the Document Root of the server to rewrite the announced -URL /net.sw/ to the internal path /e/netsw: - -

    -RewriteRule  ^net.sw$       net.sw/        [R]
    -RewriteRule  ^net.sw/(.*)$  e/netsw/$1
    -
    - -

    -The first rule is for requests which miss the trailing slash! The second rule -does the real thing. And then comes the killer configuration which stays in -the per-directory config file /e/netsw/.www/.wwwacl: - -

    -Options       ExecCGI FollowSymLinks Includes MultiViews 
    -
    -RewriteEngine on
    -
    -#  we are reached via /net.sw/ prefix
    -RewriteBase   /net.sw/
    -
    -#  first we rewrite the root dir to 
    -#  the handling cgi script
    -RewriteRule   ^$                       netsw-home.cgi     [L]
    -RewriteRule   ^index\.html$            netsw-home.cgi     [L]
    -
    -#  strip out the subdirs when
    -#  the browser requests us from perdir pages
    -RewriteRule   ^.+/(netsw-[^/]+/.+)$    $1                 [L]
    -
    -#  and now break the rewriting for local files
    -RewriteRule   ^netsw-home\.cgi.*       -                  [L]
    -RewriteRule   ^netsw-changes\.cgi.*    -                  [L]
    -RewriteRule   ^netsw-search\.cgi.*     -                  [L]
    -RewriteRule   ^netsw-tree\.cgi$        -                  [L]
    -RewriteRule   ^netsw-about\.html$      -                  [L]
    -RewriteRule   ^netsw-img/.*$           -                  [L]
    -
    -#  anything else is a subdir which gets handled
    -#  by another cgi script
    -RewriteRule   !^netsw-lsdir\.cgi.*     -                  [C]
    -RewriteRule   (.*)                     netsw-lsdir.cgi/$1
    -
    - -

    -Some hints for interpretation: -

      -
    1. Notice the L (last) flag and no substitution field ('-') in the - forth part -
    2. Notice the ! (not) character and the C (chain) flag - at the first rule in the last part -
    3. Notice the catch-all pattern in the last rule -
    - -
    - -

    -

    NCSA imagemap to Apache mod_imap

    -

    - -

    -
    Description: -
    -When switching from the NCSA webserver to the more modern Apache webserver a -lot of people want a smooth transition. So they want pages which use their old -NCSA imagemap program to work under Apache with the modern -mod_imap. The problem is that there are a lot of -hyperlinks around which reference the imagemap program via -/cgi-bin/imagemap/path/to/page.map. Under Apache this -has to read just /path/to/page.map. - -

    -

    Solution: -
    -We use a global rule to remove the prefix on-the-fly for all requests: - -

    -RewriteEngine  on
    -RewriteRule    ^/cgi-bin/imagemap(.*)  $1  [PT]
    -
    - -

    - -

    -

    Search pages in more than one directory

    -

    - -

    -
    Description: -
    -Sometimes it is neccessary to let the webserver search for pages in more than -one directory. Here MultiViews or other techniques cannot help. - -

    -

    Solution: -
    -We program a explicit ruleset which searches for the files in the directories. - -

    -RewriteEngine on
    -
    -#   first try to find it in custom/...
    -#   ...and if found stop and be happy:
    -RewriteCond         /your/docroot/dir1/%{REQUEST_FILENAME}  -f
    -RewriteRule  ^(.+)  /your/docroot/dir1/$1  [L]
    -
    -#   second try to find it in pub/...
    -#   ...and if found stop and be happy:
    -RewriteCond         /your/docroot/dir2/%{REQUEST_FILENAME}  -f
    -RewriteRule  ^(.+)  /your/docroot/dir2/$1  [L]
    -
    -#   else go on for other Alias or ScriptAlias directives,
    -#   etc.
    -RewriteRule   ^(.+)  -  [PT]
    -
    - -

    - -

    -

    Set Environment Variables According To URL Parts

    -

    - -

    -
    Description: -
    -Perhaps you want to keep status information between requests and use the URL -to encode it. But you don't want to use a CGI wrapper for all pages just to -strip out this information. - -

    -

    Solution: -
    -We use a rewrite rule to strip out the status information and remember it via -an environment variable which can be later dereferenced from within XSSI or -CGI. This way a URL /foo/S=java/bar/ gets translated to -/foo/bar/ and the environment variable named STATUS is set -to the value "java". - -

    -RewriteEngine on
    -RewriteRule   ^(.*)/S=([^/]+)/(.*)    $1/$3 [E=STATUS:$2]
    -
    - -

    - -

    -

    Virtual User Hosts

    -

    - -

    -
    Description: -
    -Assume that you want to provide www.username.host.domain.com -for the homepage of username via just DNS A records to the same machine and -without any virtualhosts on this machine. - -

    -

    Solution: -
    -For HTTP/1.0 requests there is no solution, but for HTTP/1.1 requests which -contain a Host: HTTP header we can use the following ruleset to rewrite -http://www.username.host.com/anypath internally to -/home/username/anypath: - -

    -RewriteEngine on
    -RewriteCond   %{HTTP_HOST}                 ^www\.[^.]+\.host\.com$
    -RewriteRule   ^(.+)                        %{HTTP_HOST}$1          [C]
    -RewriteRule   ^www\.([^.]+)\.host\.com(.*) /home/$1$2
    -
    - -

    - -

    -

    Redirect Homedirs For Foreigners

    -

    - -

    -
    Description: -
    -We want to redirect homedir URLs to another webserver -www.somewhere.com when the requesting user does not stay in the local -domain ourdomain.com. This is sometimes used in virtual host -contexts. - -

    -

    Solution: -
    -Just a rewrite condition: - -

    -RewriteEngine on
    -RewriteCond   %{REMOTE_HOST}  !^.+\.ourdomain\.com$
    -RewriteRule   ^(/~.+)         http://www.somewhere.com/$1 [R,L]
    -
    - -

    - -

    -

    Redirect Failing URLs To Other Webserver

    -

    - -

    -
    Description: -
    -A typical FAQ about URL rewriting is how to redirect failing requests on -webserver A to webserver B. Usually this is done via ErrorDocument -CGI-scripts in Perl, but there is also a mod_rewrite solution. But notice that -this is less performant than using a ErrorDocument CGI-script! - -

    -

    Solution: -
    -The first solution has the best performance but less flexibility and is less -error safe: - -

    -RewriteEngine on
    -RewriteCond   /your/docroot/%{REQUEST_FILENAME} !-f
    -RewriteRule   ^(.+)                             http://webserverB.dom/$1
    -
    - -

    -The problem here is that this will only work for pages inside the -DocumentRoot. While you can add more Conditions (for instance to also handle -homedirs, etc.) there is better variant: - -

    -RewriteEngine on
    -RewriteCond   %{REQUEST_URI} !-U
    -RewriteRule   ^(.+)          http://webserverB.dom/$1
    -
    - -

    -This uses the URL look-ahead feature of mod_rewrite. The result is that this -will work for all types of URLs and is a safe way. But it does a performance -impact on the webserver, because for every request there is one more internal -subrequest. So, if your webserver runs on a powerful CPU, use this one. If it -is a slow machine, use the first approach or better a ErrorDocument -CGI-script. - -

    - -

    -

    Extended Redirection

    -

    - -

    -
    Description: -
    -Sometimes we need more control (concerning the character escaping mechanism) -of URLs on redirects. Usually the Apache kernels URL escape function also -escapes anchors, i.e. URLs like "url#anchor". You cannot use this directly on -redirects with mod_rewrite because the uri_escape() function of Apache would -also escape the hash character. How can we redirect to such a URL? - -

    -

    Solution: -
    -We have to use a kludge by the use of a NPH-CGI script which does the redirect -itself. Because here no escaping is done (NPH=non-parseable headers). First -we introduce a new URL scheme xredirect: by the following per-server -config-line (should be one of the last rewrite rules): - -

    -RewriteRule ^xredirect:(.+) /path/to/nph-xredirect.cgi/$1 \
    -            [T=application/x-httpd-cgi,L]
    -
    - -

    -This forces all URLs prefixed with xredirect: to be piped through the -nph-xredirect.cgi program. And this program just looks like: - -

    -
    -#!/path/to/perl
    -##
    -##  nph-xredirect.cgi -- NPH/CGI script for extended redirects
    -##  Copyright (c) 1997 Ralf S. Engelschall, All Rights Reserved. 
    -##
    -
    -$| = 1;
    -$url = $ENV{'PATH_INFO'};
    -
    -print "HTTP/1.0 302 Moved Temporarily\n";
    -print "Server: $ENV{'SERVER_SOFTWARE'}\n";
    -print "Location: $url\n";
    -print "Content-type: text/html\n";
    -print "\n";
    -print "<html>\n";
    -print "<head>\n";
    -print "<title>302 Moved Temporarily (EXTENDED)</title>\n";
    -print "</head>\n";
    -print "<body>\n";
    -print "<h1>Moved Temporarily (EXTENDED)</h1>\n";
    -print "The document has moved <a href=\"$url\">here</a>.<p>\n";
    -print "</body>\n";
    -print "</html>\n";
    -
    -##EOF##
    -
    -
    - -

    -This provides you with the functionality to do redirects to all URL schemes, -i.e. including the one which are not directly accepted by mod_rewrite. For -instance you can now also redirect to news:newsgroup via - -

    -RewriteRule ^anyurl  xredirect:news:newsgroup
    -
    - -

    -Notice: You have not to put [R] or [R,L] to the above rule because the -xredirect: need to be expanded later by our special "pipe through" -rule above. - -

    - -

    -

    Archive Access Multiplexer

    -

    - -

    -
    Description: -
    -Do you know the great CPAN (Comprehensive Perl Archive Network) under http://www.perl.com/CPAN? This does a -redirect to one of several FTP servers around the world which carry a CPAN -mirror and is approximately near the location of the requesting client. -Actually this can be called an FTP access multiplexing service. While CPAN -runs via CGI scripts, how can a similar approach implemented via mod_rewrite? - -

    -

    Solution: -
    -First we notice that from version 3.0.0 mod_rewrite can also use the "ftp:" -scheme on redirects. And second, the location approximation can be done by a -rewritemap over the top-level domain of the client. With a tricky chained -ruleset we can use this top-level domain as a key to our multiplexing map. - -

    -RewriteEngine on
    -RewriteMap    multiplex                txt:/path/to/map.cxan
    -RewriteRule   ^/CxAN/(.*)              %{REMOTE_HOST}::$1                 [C]
    -RewriteRule   ^.+\.([a-zA-Z]+)::(.*)$  ${multiplex:$1|ftp.default.dom}$2  [R,L]
    -
    - -

    -##
    -##  map.cxan -- Multiplexing Map for CxAN
    -##
    -
    -de        ftp://ftp.cxan.de/CxAN/
    -uk        ftp://ftp.cxan.uk/CxAN/
    -com       ftp://ftp.cxan.com/CxAN/
    - :
    -##EOF##
    -
    - -

    - -

    -

    Time-Dependend Rewriting

    -

    - -

    -
    Description: -
    -When tricks like time-dependend content should happen a lot of webmasters -still use CGI scripts which do for instance redirects to specialized pages. -How can it be done via mod_rewrite? - -

    -

    Solution: -
    -There are a lot of variables named TIME_xxx for rewrite conditions. -In conjunction with the special lexicographic comparison patterns <STRING, ->STRING and =STRING we can do time-dependend redirects: - -

    -RewriteEngine on
    -RewriteCond   %{TIME_HOUR}%{TIME_MIN} >0700
    -RewriteCond   %{TIME_HOUR}%{TIME_MIN} <1900
    -RewriteRule   ^foo\.html$             foo.day.html
    -RewriteRule   ^foo\.html$             foo.night.html
    -
    - -

    -This provides the content of foo.day.html under the URL -foo.html from 07:00-19:00 and at the remaining time the contents of -foo.night.html. Just a nice feature for a homepage... - -

    - -

    -

    Backward Compatibility for YYYY to XXXX migration

    -

    - -

    -
    Description: -
    -How can we make URLs backward compatible (still existing virtually) after -migrating document.YYYY to document.XXXX, e.g. after translating a bunch of -.html files to .phtml? - -

    -

    Solution: -
    -We just rewrite the name to its basename and test for existence of the new -extension. If it exists, we take that name, else we rewrite the URL to its -original state. - -

    -#   backward compatibility ruleset for 
    -#   rewriting document.html to document.phtml
    -#   when and only when document.phtml exists
    -#   but no longer document.html
    -RewriteEngine on
    -RewriteBase   /~quux/
    -#   parse out basename, but remember the fact
    -RewriteRule   ^(.*)\.html$              $1      [C,E=WasHTML:yes]
    -#   rewrite to document.phtml if exists
    -RewriteCond   %{REQUEST_FILENAME}.phtml -f
    -RewriteRule   ^(.*)$ $1.phtml                   [S=1]
    -#   else reverse the previous basename cutout
    -RewriteCond   %{ENV:WasHTML}            ^yes$
    -RewriteRule   ^(.*)$ $1.html
    -
    - -

    - -

    Content Handling

    - -

    -

    From Old to New (intern)

    -

    - -

    -
    Description: -
    -Assume we have recently renamed the page bar.html to -foo.html and now want to provide the old URL for backward -compatibility. Actually we want that users of the old URL even not recognize -that the pages was renamed. - -

    -

    Solution: -
    -We rewrite the old URL to the new one internally via the following rule: - -

    -RewriteEngine  on
    -RewriteBase    /~quux/
    -RewriteRule    ^foo\.html$  bar.html
    -
    - -

    - -

    -

    From Old to New (extern)

    -

    - -

    -
    Description: -
    -Assume again that we have recently renamed the page bar.html to -foo.html and now want to provide the old URL for backward -compatibility. But this time we want that the users of the old URL get hinted -to the new one, i.e. their browsers Location field should change, too. - -

    -

    Solution: -
    -We force a HTTP redirect to the new URL which leads to a change of the -browsers and thus the users view: - -

    -RewriteEngine  on
    -RewriteBase    /~quux/
    -RewriteRule    ^foo\.html$  bar.html  [R]
    -
    - -

    - -

    -

    Browser Dependend Content

    -

    - -

    -
    Description: -
    -At least for important top-level pages it is sometimes necesarry to provide -the optimum of browser dependend content, i.e. one has to provide a maximum -version for the latest Netscape variants, a minimum version for the Lynx -browsers and a average feature version for all others. - -

    -

    Solution: -
    -We cannot use content negotiation because the browsers do not provide their -type in that form. Instead we have to act on the HTTP header "User-Agent". -The following condig does the following: If the HTTP header "User-Agent" -begins with "Mozilla/3", the page foo.html is rewritten to -foo.NS.html and and the rewriting stops. If the browser is "Lynx" or -"Mozilla" of version 1 or 2 the URL becomes foo.20.html. All other -browsers receive page foo.32.html. This is done by the following -ruleset: - -

    -RewriteCond %{HTTP_USER_AGENT}  ^Mozilla/3.*
    -RewriteRule ^foo\.html$         foo.NS.html          [L]
    -
    -RewriteCond %{HTTP_USER_AGENT}  ^Lynx/.*         [OR]
    -RewriteCond %{HTTP_USER_AGENT}  ^Mozilla/[12].*
    -RewriteRule ^foo\.html$         foo.20.html          [L]
    -
    -RewriteRule ^foo\.html$         foo.32.html          [L]
    -
    - -

    - -

    -

    Dynamic Mirror

    -

    - -

    -
    Description: -
    -Assume there are nice webpages on remote hosts we want to bring into our -namespace. For FTP servers we would use the mirror program which -actually maintains an explicit up-to-date copy of the remote data on the local -machine. For a webserver we could use the program webcopy which acts -similar via HTTP. But both techniques have one major drawback: The local copy -is always just as up-to-date as often we run the program. It would be much -better if the mirror is not a static one we have to establish explicitly. -Instead we want a dynamic mirror with data which gets updated automatically -when there is need (updated data on the remote host). - -

    -

    Solution: -
    -To provide this feature we map the remote webpage or even the complete remote -webarea to our namespace by the use of the Proxy Throughput feature -(flag [P]): - -

    -RewriteEngine  on
    -RewriteBase    /~quux/
    -RewriteRule    ^hotsheet/(.*)$  http://www.tstimpreso.com/hotsheet/$1  [P]
    -
    - -

    -RewriteEngine  on
    -RewriteBase    /~quux/
    -RewriteRule    ^usa-news\.html$   http://www.quux-corp.com/news/index.html  [P]
    -
    - -

    - -

    -

    Reverse Dynamic Mirror

    -

    - -

    -
    Description: -
    -... - -

    -

    Solution: -
    - -

    -RewriteEngine on
    -RewriteCond   /mirror/of/remotesite/$1           -U 
    -RewriteRule   ^http://www\.remotesite\.com/(.*)$ /mirror/of/remotesite/$1
    -
    - -

    - -

    -

    Retrieve Missing Data from Intranet

    -

    - -

    -
    Description: -
    -This is a tricky way of virtually running a corporates (external) Internet -webserver (www.quux-corp.dom), while actually keeping and maintaining -its data on a (internal) Intranet webserver -(www2.quux-corp.dom) which is protected by a firewall. The -trick is that on the external webserver we retrieve the requested data -on-the-fly from the internal one. - -

    -

    Solution: -
    -First, we have to make sure that our firewall still protects the internal -webserver and that only the external webserver is allowed to retrieve data -from it. For a packet-filtering firewall we could for instance configure a -firewall ruleset like the following: - -

    -ALLOW Host www.quux-corp.dom Port >1024 --> Host www2.quux-corp.dom Port 80  
    -DENY  Host *                 Port *     --> Host www2.quux-corp.dom Port 80
    -
    - -

    -Just adjust it to your actual configuration syntax. Now we can establish the -mod_rewrite rules which request the missing data in the background through the -proxy throughput feature: - -

    -RewriteRule ^/~([^/]+)/?(.*)          /home/$1/.www/$2
    -RewriteCond %{REQUEST_FILENAME}       !-f
    -RewriteCond %{REQUEST_FILENAME}       !-d
    -RewriteRule ^/home/([^/]+)/.www/?(.*) http://www2.quux-corp.dom/~$1/pub/$2 [P]
    -
    - -

    - -

    -

    Load Balancing

    -

    - -

    -
    Description: -
    -Suppose we want to load balance the traffic to www.foo.com over -www[0-5].foo.com (a total of 6 servers). How can this be done? - -

    -

    Solution: -
    -There are a lot of possible solutions for this problem. We will discuss first -a commonly known DNS-based variant and then the special one with mod_rewrite: - -
      -
    1. DNS Round-Robin - -

      -The simplest method for load-balancing is to use the DNS round-robin feature -of BIND. Here you just configure www[0-9].foo.com as usual in your -DNS with A(address) records, e.g. - -

      -www0   IN  A       1.2.3.1
      -www1   IN  A       1.2.3.2
      -www2   IN  A       1.2.3.3
      -www3   IN  A       1.2.3.4
      -www4   IN  A       1.2.3.5
      -www5   IN  A       1.2.3.6
      -
      - -

      -Then you additionally add the following entry: - -

      -www    IN  CNAME   www0.foo.com.
      -       IN  CNAME   www1.foo.com.
      -       IN  CNAME   www2.foo.com.
      -       IN  CNAME   www3.foo.com.
      -       IN  CNAME   www4.foo.com.
      -       IN  CNAME   www5.foo.com.
      -       IN  CNAME   www6.foo.com.
      -
      - -

      -Notice that this seems wrong, but is actually an intended feature of BIND and -can be used in this way. However, now when www.foo.com gets resolved, -BIND gives out www0-www6 - but in a slightly permutated/rotated order -every time. This way the clients are spread over the various servers. - -But notice that this not a perfect load balancing scheme, because DNS resolve -information gets cached by the other nameservers on the net, so once a client -has resolved www.foo.com to a particular wwwN.foo.com, all -subsequent requests also go to this particular name wwwN.foo.com. But -the final result is ok, because the total sum of the requests are really -spread over the various webservers. - -

      -

    2. DNS Load-Balancing - -

      -A sophisticated DNS-based method for load-balancing is to use the program -lbnamed which can be found at http://www.stanford.edu/~schemers/docs/lbnamed/lbnamed.html. -It is a Perl 5 program in conjunction with auxilliary tools which provides a -real load-balancing for DNS. - -

      -

    3. Proxy Throughput Round-Robin - -

      -In this variant we use mod_rewrite and its proxy throughput feature. First we -dedicate www0.foo.com to be actually www.foo.com by using a -single - -

      -www    IN  CNAME   www0.foo.com.
      -
      - -

      -entry in the DNS. Then we convert www0.foo.com to a proxy-only -server, i.e. we configure this machine so all arriving URLs are just pushed -through the internal proxy to one of the 5 other servers (www1-www5). -To accomplish this we first establish a ruleset which contacts a load -balancing script lb.pl for all URLs. - -

      -RewriteEngine on
      -RewriteMap    lb      prg:/path/to/lb.pl
      -RewriteRule   ^/(.+)$ ${lb:$1}           [P,L]
      -
      - -

      -Then we write lb.pl: - -

      -#!/path/to/perl
      -##
      -##  lb.pl -- load balancing script
      -##
      -
      -$| = 1;
      -
      -$name   = "www";     # the hostname base
      -$first  = 1;         # the first server (not 0 here, because 0 is myself) 
      -$last   = 5;         # the last server in the round-robin
      -$domain = "foo.dom"; # the domainname
      -
      -$cnt = 0;
      -while (<STDIN>) {
      -    $cnt = (($cnt+1) % ($last+1-$first));
      -    $server = sprintf("%s%d.%s", $name, $cnt+$first, $domain);
      -    print "http://$server/$_";
      -}
      -
      -##EOF##
      -
      - -

      -A last notice: Why is this useful? Seems like www0.foo.com still is -overloaded? The answer is yes, it is overloaded, but with plain proxy -throughput requests, only! All SSI, CGI, ePerl, etc. processing is completely -done on the other machines. This is the essential point. - -

      -

    4. Hardware/TCP Round-Robin - -

      -There is a hardware solution available, too. Cisco has a beast called -LocalDirector which does a load balancing at the TCP/IP level. Actually this -is some sort of a circuit level gateway in front of a webcluster. If you have -enough money and really need a solution with high performance, use this one. - -

    - -
    - -

    -

    Reverse Proxy

    -

    - -

    -
    Description: -
    -... - -

    -

    Solution: -
    - -

    -##
    -##  apache-rproxy.conf -- Apache configuration for Reverse Proxy Usage
    -##
    -
    -#   server type
    -ServerType           standalone
    -Port                 8000
    -MinSpareServers      16
    -StartServers         16
    -MaxSpareServers      16
    -MaxClients           16
    -MaxRequestsPerChild  100
    -
    -#   server operation parameters
    -KeepAlive            on
    -MaxKeepAliveRequests 100
    -KeepAliveTimeout     15
    -Timeout              400
    -IdentityCheck        off
    -HostnameLookups      off
    -
    -#   paths to runtime files
    -PidFile              /path/to/apache-rproxy.pid
    -LockFile             /path/to/apache-rproxy.lock
    -ErrorLog             /path/to/apache-rproxy.elog
    -CustomLog            /path/to/apache-rproxy.dlog "%{%v/%T}t %h -> %{SERVER}e URL: %U"
    -
    -#   unused paths
    -ServerRoot           /tmp
    -DocumentRoot         /tmp
    -CacheRoot            /tmp
    -RewriteLog           /dev/null
    -TransferLog          /dev/null
    -TypesConfig          /dev/null
    -AccessConfig         /dev/null
    -ResourceConfig       /dev/null
    -
    -#   speed up and secure processing
    -<Directory />
    -Options -FollowSymLinks -SymLinksIfOwnerMatch
    -AllowOverwrite None
    -</Directory>
    -
    -#   the status page for monitoring the reverse proxy
    -<Location /rproxy-status>
    -SetHandler server-status
    -</Location>
    -
    -#   enable the URL rewriting engine
    -RewriteEngine        on
    -RewriteLogLevel      0
    -
    -#   define a rewriting map with value-lists where
    -#   mod_rewrite randomly chooses a particular value
    -RewriteMap     server  rnd:/path/to/apache-rproxy.conf-servers
    -
    -#   make sure the status page is handled locally
    -#   and make sure no one uses our proxy except ourself
    -RewriteRule    ^/apache-rproxy-status.*  -  [L]
    -RewriteRule    ^(http|ftp)://.*          -  [F]
    -
    -#   now choose the possible servers for particular URL types
    -RewriteRule    ^/(.*\.(cgi|shtml))$  to://${server:dynamic}/$1  [S=1]
    -RewriteRule    ^/(.*)$               to://${server:static}/$1  
    -
    -#   and delegate the generated URL by passing it 
    -#   through the proxy module
    -RewriteRule    ^to://([^/]+)/(.*)    http://$1/$2   [E=SERVER:$1,P,L]
    -
    -#   and make really sure all other stuff is forbidden 
    -#   when it should survive the above rules...
    -RewriteRule    .*                    -              [F]
    -
    -#   enable the Proxy module without caching
    -ProxyRequests        on
    -NoCache              *
    -
    -#   setup URL reverse mapping for redirect reponses
    -ProxyPassReverse  /  http://www1.foo.dom/
    -ProxyPassReverse  /  http://www2.foo.dom/
    -ProxyPassReverse  /  http://www3.foo.dom/
    -ProxyPassReverse  /  http://www4.foo.dom/
    -ProxyPassReverse  /  http://www5.foo.dom/
    -ProxyPassReverse  /  http://www6.foo.dom/
    -
    - -

    -##
    -##  apache-rproxy.conf-servers -- Apache/mod_rewrite selection table
    -##
    -
    -#   list of backend servers which serve static
    -#   pages (HTML files and Images, etc.)
    -static    www1.foo.dom|www2.foo.dom|www3.foo.dom|www4.foo.dom
    -
    -#   list of backend servers which serve dynamically 
    -#   generated page (CGI programs or mod_perl scripts)
    -dynamic   www5.foo.dom|www6.foo.dom
    -
    - -

    - -

    -

    New MIME-type, New Service

    -

    - -

    -
    Description: -
    -On the net there are a lot of nifty CGI programs. But their usage is usually -boring, so a lot of webmaster don't use them. Even Apache's Action handler -feature for MIME-types is only appropriate when the CGI programs don't need -special URLs (actually PATH_INFO and QUERY_STRINGS) as their input. - -First, let us configure a new file type with extension .scgi -(for secure CGI) which will be processed by the popular cgiwrap -program. The problem here is that for instance we use a Homogeneous URL Layout -(see above) a file inside the user homedirs has the URL -/u/user/foo/bar.scgi. But cgiwrap needs the URL in the form -/~user/foo/bar.scgi/. The following rule solves the problem: - -

    -RewriteRule ^/[uge]/([^/]+)/\.www/(.+)\.scgi(.*) ...
    -... /internal/cgi/user/cgiwrap/~$1/$2.scgi$3  [NS,T=application/x-http-cgi]
    -
    - -

    -Or assume we have some more nifty programs: -wwwlog (which displays the access.log for a URL subtree and -wwwidx (which runs Glimpse on a URL subtree). We have to -provide the URL area to these programs so they know on which area -they have to act on. But usually this ugly, because they are all the -times still requested from that areas, i.e. typically we would run -the swwidx program from within /u/user/foo/ via -hyperlink to - -

    -/internal/cgi/user/swwidx?i=/u/user/foo/
    -

    - -which is ugly. Because we have to hard-code both the location of the -area and the location of the CGI inside the hyperlink. When we have to -reorganise or area, we spend a lot of time changing the various hyperlinks. - -

    -

    Solution: -
    -The solution here is to provide a special new URL format which automatically -leads to the proper CGI invocation. We configure the following: - -

    -RewriteRule   ^/([uge])/([^/]+)(/?.*)/\*  /internal/cgi/user/wwwidx?i=/$1/$2$3/
    -RewriteRule   ^/([uge])/([^/]+)(/?.*):log /internal/cgi/user/wwwlog?f=/$1/$2$3
    -
    - -

    -Now the hyperlink to search at /u/user/foo/ reads only - -

    -href="*"
    -

    - -which internally gets automatically transformed to - -

    -/internal/cgi/user/wwwidx?i=/u/user/foo/
    -

    - -The same approach leads to an invocation for the access log CGI -program when the hyperlink :log gets used. - -

    - -

    -

    From Static to Dynamic

    -

    - -

    -
    Description: -
    -How can we transform a static page foo.html into a dynamic variant -foo.cgi in a seemless way, i.e. without notice by the browser/user. - -

    -

    Solution: -
    -We just rewrite the URL to the CGI-script and force the correct MIME-type so -it gets really run as a CGI-script. This way a request to -/~quux/foo.html internally leads to the invokation of -/~quux/foo.cgi. - -

    -RewriteEngine  on
    -RewriteBase    /~quux/
    -RewriteRule    ^foo\.html$  foo.cgi  [T=application/x-httpd-cgi]
    -
    - -

    - -

    -

    On-the-fly Content-Regeneration

    -

    - -

    -
    Description: -
    -Here comes a really esoteric feature: Dynamically generated but statically -served pages, i.e. pages should be delivered as pur static pages (read from -the filesystem and just passed through), but they have to be generated -dynamically by the webserver if missing. This way you can have CGI-generated -pages which are statically unless one (or a cronjob) removes the static -contents. Then the contents gets refreshed. - -

    -

    Solution: -
    -This is done via the following ruleset: - -

    -RewriteCond %{REQUEST_FILENAME}   !-s
    -RewriteCond ^page\.html$          page.cgi   [T=application/x-httpd-cgi,L]
    -
    - -

    -Here a request to page.html leads to a internal run of a -corresponding page.cgi if page.html is still missing or has -filesize null. The trick here is that page.cgi is a usual CGI script -which (additionally to its STDOUT) writes its output to the file -page.html. Once it was run, the server sends out the data of -page.html. When the webmaster wants to force a refresh the contents, -he just removes page.html (usually done by a cronjob). - -

    - -

    -

    Document With Autorefresh

    -

    - -

    -
    Description: -
    -Wouldn't it be nice while creating a complex webpage if the webbrowser would -automatically refresh the page every time we write a new version from within -our editor? Impossible? - -

    -

    Solution: -
    -No! We just combine the MIME multipart feature, the webserver NPH feature and -the URL manipulation power of mod_rewrite. First, we establish a new URL -feature: Adding just :refresh to any URL causes this to be refreshed -every time it gets updated on the filesystem. - -

    -RewriteRule   ^(/[uge]/[^/]+/?.*):refresh  /internal/cgi/apache/nph-refresh?f=$1
    -
    - -

    -Now when we reference the URL - -

    -/u/foo/bar/page.html:refresh
    -

    - -this leads to the internal invocation of the URL - -

    -/internal/cgi/apache/nph-refresh?f=/u/foo/bar/page.html
    -

    - -The only missing part is the NPH-CGI script. Although one would usually say -"left as an exercise to the reader" ;-) I will provide this, too. - -

    -#!/sw/bin/perl
    -##
    -##  nph-refresh -- NPH/CGI script for auto refreshing pages
    -##  Copyright (c) 1997 Ralf S. Engelschall, All Rights Reserved. 
    -##
    -$| = 1;
    -
    -#   split the QUERY_STRING variable
    -@pairs = split(/&/, $ENV{'QUERY_STRING'});
    -foreach $pair (@pairs) {
    -    ($name, $value) = split(/=/, $pair);
    -    $name =~ tr/A-Z/a-z/;
    -    $name = 'QS_' . $name;
    -    $value =~ s/%([a-fA-F0-9][a-fA-F0-9])/pack("C", hex($1))/eg;
    -    eval "\$$name = \"$value\"";
    -}
    -$QS_s = 1 if ($QS_s eq '');
    -$QS_n = 3600 if ($QS_n eq '');
    -if ($QS_f eq '') {
    -    print "HTTP/1.0 200 OK\n";
    -    print "Content-type: text/html\n\n";
    -    print "&lt;b&gt;ERROR&lt;/b&gt;: No file given\n";
    -    exit(0);
    -}
    -if (! -f $QS_f) {
    -    print "HTTP/1.0 200 OK\n";
    -    print "Content-type: text/html\n\n";
    -    print "&lt;b&gt;ERROR&lt;/b&gt;: File $QS_f not found\n";
    -    exit(0);
    -}
    -
    -sub print_http_headers_multipart_begin {
    -    print "HTTP/1.0 200 OK\n";
    -    $bound = "ThisRandomString12345";
    -    print "Content-type: multipart/x-mixed-replace;boundary=$bound\n";
    -    &print_http_headers_multipart_next;
    -}
    -
    -sub print_http_headers_multipart_next {
    -    print "\n--$bound\n";
    -}
    -
    -sub print_http_headers_multipart_end {
    -    print "\n--$bound--\n";
    -}
    -
    -sub displayhtml {
    -    local($buffer) = @_;
    -    $len = length($buffer);
    -    print "Content-type: text/html\n";
    -    print "Content-length: $len\n\n";
    -    print $buffer;
    -}
    -
    -sub readfile {
    -    local($file) = @_;
    -    local(*FP, $size, $buffer, $bytes);
    -    ($x, $x, $x, $x, $x, $x, $x, $size) = stat($file);
    -    $size = sprintf("%d", $size);
    -    open(FP, "&lt;$file");
    -    $bytes = sysread(FP, $buffer, $size);
    -    close(FP);
    -    return $buffer;
    -}
    -
    -$buffer = &readfile($QS_f);
    -&print_http_headers_multipart_begin;
    -&displayhtml($buffer);
    -
    -sub mystat {
    -    local($file) = $_[0];
    -    local($time);
    -
    -    ($x, $x, $x, $x, $x, $x, $x, $x, $x, $mtime) = stat($file);
    -    return $mtime;
    -}
    -
    -$mtimeL = &mystat($QS_f);
    -$mtime = $mtime;
    -for ($n = 0; $n &lt; $QS_n; $n++) {
    -    while (1) {
    -        $mtime = &mystat($QS_f);
    -        if ($mtime ne $mtimeL) {
    -            $mtimeL = $mtime;
    -            sleep(2);
    -            $buffer = &readfile($QS_f);
    -            &print_http_headers_multipart_next;
    -            &displayhtml($buffer);
    -            sleep(5);
    -            $mtimeL = &mystat($QS_f);
    -            last;
    -        }
    -        sleep($QS_s);
    -    }
    -}
    -
    -&print_http_headers_multipart_end;
    -
    -exit(0);
    -
    -##EOF##
    -
    - -
    - -

    -

    Mass Virtual Hosting

    -

    - -

    -
    Description: -
    -The <VirtualHost> feature of Apache is nice and works great -when you just have a few dozens virtual hosts. But when you are an ISP and -have hundreds of virtual hosts to provide this feature is not the best choice. - -

    -

    Solution: -
    -To provide this feature we map the remote webpage or even the complete remote -webarea to our namespace by the use of the Proxy Throughput feature -(flag [P]): - -

    -##
    -##  vhost.map 
    -## 
    -www.vhost1.dom:80  /path/to/docroot/vhost1
    -www.vhost2.dom:80  /path/to/docroot/vhost2
    -     :
    -www.vhostN.dom:80  /path/to/docroot/vhostN
    -
    - -

    -##
    -##  httpd.conf
    -##
    -    :
    -#   use the canonical hostname on redirects, etc.
    -UseCanonicalName on
    -
    -    :
    -#   add the virtual host in front of the CLF-format
    -CustomLog  /path/to/access_log  "%{VHOST}e %h %l %u %t \"%r\" %>s %b"
    -    :
    -
    -#   enable the rewriting engine in the main server
    -RewriteEngine on
    -
    -#   define two maps: one for fixing the URL and one which defines
    -#   the available virtual hosts with their corresponding
    -#   DocumentRoot.
    -RewriteMap    lowercase    int:tolower
    -RewriteMap    vhost        txt:/path/to/vhost.map
    -
    -#   Now do the actual virtual host mapping
    -#   via a huge and complicated single rule:
    -#
    -#   1. make sure we don't map for common locations
    -RewriteCond   %{REQUEST_URL}  !^/commonurl1/.*
    -RewriteCond   %{REQUEST_URL}  !^/commonurl2/.*
    -    :
    -RewriteCond   %{REQUEST_URL}  !^/commonurlN/.*
    -#
    -#   2. make sure we have a Host header, because
    -#      currently our approach only supports 
    -#      virtual hosting through this header
    -RewriteCond   %{HTTP_HOST}  !^$
    -#
    -#   3. lowercase the hostname
    -RewriteCond   ${lowercase:%{HTTP_HOST}|NONE}  ^(.+)$
    -#
    -#   4. lookup this hostname in vhost.map and
    -#      remember it only when it is a path 
    -#      (and not "NONE" from above)
    -RewriteCond   ${vhost:%1}  ^(/.*)$
    -#
    -#   5. finally we can map the URL to its docroot location 
    -#      and remember the virtual host for logging puposes
    -RewriteRule   ^/(.*)$   %1/$1  [E=VHOST:${lowercase:%{HTTP_HOST}}]
    -    : 
    -
    - -

    - -

    Access Restriction

    - -

    -

    Blocking of Robots

    -

    - -

    -
    Description: -
    -How can we block a really annoying robot from retrieving pages of a specific -webarea? A /robots.txt file containing entries of the "Robot -Exclusion Protocol" is typically not enough to get rid of such a robot. - -

    -

    Solution: -
    -We use a ruleset which forbids the URLs of the webarea -/~quux/foo/arc/ (perhaps a very deep directory indexed area where the -robot traversal would create big server load). We have to make sure that we -forbid access only to the particular robot, i.e. just forbidding the host -where the robot runs is not enough. This would block users from this host, -too. We accomplish this by also matching the User-Agent HTTP header -information. - -

    -RewriteCond %{HTTP_USER_AGENT}   ^NameOfBadRobot.*      
    -RewriteCond %{REMOTE_ADDR}       ^123\.45\.67\.[8-9]$
    -RewriteRule ^/~quux/foo/arc/.+   -   [F]
    -
    - -

    - -

    -

    Blocked Inline-Images

    -

    - -

    -
    Description: -
    -Assume we have under http://www.quux-corp.de/~quux/ some pages with inlined -GIF graphics. These graphics are nice, so others directly incorporate them via -hyperlinks to their pages. We don't like this practice because it adds useless -traffic to our server. - -

    -

    Solution: -
    -While we cannot 100% protect the images from inclusion, we -can at least restrict the cases where the browser sends -a HTTP Referer header. - -

    -RewriteCond %{HTTP_REFERER} !^$                                  
    -RewriteCond %{HTTP_REFERER} !^http://www.quux-corp.de/~quux/.*$ [NC]
    -RewriteRule .*\.gif$        -                                    [F]
    -
    - -

    -RewriteCond %{HTTP_REFERER}         !^$                                  
    -RewriteCond %{HTTP_REFERER}         !.*/foo-with-gif\.html$
    -RewriteRule ^inlined-in-foo\.gif$   -                        [F]
    -
    - -

    - -

    -

    Host Deny

    -

    - -

    -
    Description: -
    -How can we forbid a list of externally configured hosts from using our server? - -

    -

    Solution: -
    - -For Apache >= 1.3b6: - -

    -RewriteEngine on
    -RewriteMap    hosts-deny  txt:/path/to/hosts.deny
    -RewriteCond   ${hosts-deny:%{REMOTE_HOST}|NOT-FOUND} !=NOT-FOUND [OR]
    -RewriteCond   ${hosts-deny:%{REMOTE_ADDR}|NOT-FOUND} !=NOT-FOUND
    -RewriteRule   ^/.*  -  [F]
    -

    - -For Apache <= 1.3b6: - -

    -RewriteEngine on
    -RewriteMap    hosts-deny  txt:/path/to/hosts.deny
    -RewriteRule   ^/(.*)$ ${hosts-deny:%{REMOTE_HOST}|NOT-FOUND}/$1
    -RewriteRule   !^NOT-FOUND/.* - [F]
    -RewriteRule   ^NOT-FOUND/(.*)$ ${hosts-deny:%{REMOTE_ADDR}|NOT-FOUND}/$1 
    -RewriteRule   !^NOT-FOUND/.* - [F]
    -RewriteRule   ^NOT-FOUND/(.*)$ /$1
    -
    - -

    -##
    -##  hosts.deny 
    -##
    -##  ATTENTION! This is a map, not a list, even when we treat it as such.
    -##             mod_rewrite parses it for key/value pairs, so at least a
    -##             dummy value "-" must be present for each entry.
    -##
    -
    -193.102.180.41 -
    -bsdti1.sdm.de  -
    -192.76.162.40  -
    -
    - -

    - -

    -

    Proxy Deny

    -

    - -

    -
    Description: -
    -How can we forbid a certain host or even a user of a special host from using -the Apache proxy? - -

    -

    Solution: -
    -We first have to make sure mod_rewrite is below(!) mod_proxy in the -Configuration file when compiling the Apache webserver. This way it -gets called _before_ mod_proxy. Then we configure the following for a -host-dependend deny... - -

    -RewriteCond %{REMOTE_HOST} ^badhost\.mydomain\.com$ 
    -RewriteRule !^http://[^/.]\.mydomain.com.*  - [F]
    -
    - -

    ...and this one for a user@host-dependend deny: - -

    -RewriteCond %{REMOTE_IDENT}@%{REMOTE_HOST}  ^badguy@badhost\.mydomain\.com$
    -RewriteRule !^http://[^/.]\.mydomain.com.*  - [F]
    -
    - -

    - -

    -

    Special Authentication Variant

    -

    - -

    -
    Description: -
    -Sometimes a very special authentication is needed, for instance a -authentication which checks for a set of explicitly configured users. Only -these should receive access and without explicit prompting (which would occur -when using the Basic Auth via mod_access). - -

    -

    Solution: -
    -We use a list of rewrite conditions to exclude all except our friends: - -

    -RewriteCond %{REMOTE_IDENT}@%{REMOTE_HOST} !^friend1@client1.quux-corp\.com$ 
    -RewriteCond %{REMOTE_IDENT}@%{REMOTE_HOST} !^friend2@client2.quux-corp\.com$ 
    -RewriteCond %{REMOTE_IDENT}@%{REMOTE_HOST} !^friend3@client3.quux-corp\.com$ 
    -RewriteRule ^/~quux/only-for-friends/      -                                 [F]
    -
    - -

    - -

    -

    Referer-based Deflector

    -

    - -

    -
    Description: -
    -How can we program a flexible URL Deflector which acts on the "Referer" HTTP -header and can be configured with as many referring pages as we like? - -

    -

    Solution: -
    -Use the following really tricky ruleset... - -

    -RewriteMap  deflector txt:/path/to/deflector.map
    -
    -RewriteCond %{HTTP_REFERER} !=""
    -RewriteCond ${deflector:%{HTTP_REFERER}} ^-$
    -RewriteRule ^.* %{HTTP_REFERER} [R,L]
    -
    -RewriteCond %{HTTP_REFERER} !=""
    -RewriteCond ${deflector:%{HTTP_REFERER}|NOT-FOUND} !=NOT-FOUND
    -RewriteRule ^.* ${deflector:%{HTTP_REFERER}} [R,L]
    -
    - -

    ... -in conjunction with a corresponding rewrite map: - -

    -##
    -##  deflector.map
    -##
    -
    -http://www.badguys.com/bad/index.html    -
    -http://www.badguys.com/bad/index2.html   -
    -http://www.badguys.com/bad/index3.html   http://somewhere.com/
    -
    - -

    -This automatically redirects the request back to the referring page (when "-" -is used as the value in the map) or to a specific URL (when an URL is -specified in the map as the second argument). - -

    - -

    Other

    - -

    -

    External Rewriting Engine

    -

    - -

    -
    Description: -
    -A FAQ: How can we solve the FOO/BAR/QUUX/etc. problem? There seems no solution -by the use of mod_rewrite... - -

    -

    Solution: -
    -Use an external rewrite map, i.e. a program which acts like a rewrite map. It -is run once on startup of Apache receives the requested URLs on STDIN and has -to put the resulting (usually rewritten) URL on STDOUT (same order!). - -

    -RewriteEngine on
    -RewriteMap    quux-map       prg:/path/to/map.quux.pl
    -RewriteRule   ^/~quux/(.*)$  /~quux/${quux-map:$1}
    -
    - -

    -#!/path/to/perl
    -
    -#   disable buffered I/O which would lead 
    -#   to deadloops for the Apache server
    -$| = 1;
    -
    -#   read URLs one per line from stdin and
    -#   generate substitution URL on stdout
    -while (<>) {
    -    s|^foo/|bar/|;
    -    print $_;
    -}
    -
    - -

    -This is a demonstration-only example and just rewrites all URLs -/~quux/foo/... to /~quux/bar/.... Actually you can program -whatever you like. But notice that while such maps can be used also by -an average user, only the system administrator can define it. - -

    - - -
    - - diff --git a/docs/manual/misc/security_tips.html b/docs/manual/misc/security_tips.html deleted file mode 100644 index a805d8cbed0093bb2615a9a31d12da5e5810519a..0000000000000000000000000000000000000000 --- a/docs/manual/misc/security_tips.html +++ /dev/null @@ -1,92 +0,0 @@ - - - -Apache HTTP Server Documentation - - - - -

    Security tips for server configuration

    - -
    - -

    Some hints and tips on security issues in setting up a web server. Some of -the suggestions will be general, other, specific to Apache - -


    - -

    Server Side Includes

    -

    Server side includes (SSI) can be configured so that users can execute -arbitrary programs on the server. That thought alone should send a shiver -down the spine of any sys-admin.

    - -One solution is to disable that part of SSI. To do that you use the -IncludesNOEXEC option to the Options -directive.

    - -


    - -

    Non Script Aliased CGI

    -

    Allowing users to execute CGI scripts in any directory should only -be considered if; -

      -
    1. You trust your users not to write scripts which will deliberately or -accidentally expose your system to an attack. -
    2. You consider security at your site to be so feeble in other areas, as to -make one more potential hole irrelevant. -
    3. You have no users, and nobody ever visits your server. -

    -


    - -

    Script Alias'ed CGI

    -

    Limiting CGI to special directories gives the admin control over -what goes into those directories. This is inevitably more secure than -non script aliased CGI, but only if users with write access to the -directories are trusted or the admin is willing to test each new CGI -script/program for potential security holes.

    - -Most sites choose this option over the non script aliased CGI approach.

    - -


    -

    CGI in general

    -

    Always remember that you must trust the writers of the CGI script/programs -or your ability to spot potential security holes in CGI, whether they were -deliberate or accidental.

    - -All the CGI scripts will run as the same user, so they have potential to -conflict (accidentally or deliberately) with other scripts e.g. User A hates -User B, so he writes a script to trash User B's CGI database.

    - -


    - -Please send any other useful security tips to -apache-bugs@mail.apache.org -

    -


    - -

    Stopping users overriding system wide settings...

    -

    To run a really tight ship, you'll want to stop users from setting -up .htaccess files which can override security features -you've configured. Here's one way to do it...

    - -In the server configuration file, put -

    -<Directory>
    -AllowOverride None
    -Options None
    -<Limit GET PUT POST>
    -allow from all
    -</Limit>
    -</Directory>
    -
    - -Then setup for specific directories

    - -This stops all overrides, Includes and accesses in all directories apart -from those named.


    - -Home -Index - - - diff --git a/docs/manual/mod/allmodules.xml b/docs/manual/mod/allmodules.xml deleted file mode 100644 index ddf557d601a2348cb4a6bfbaf10182cd549ae515..0000000000000000000000000000000000000000 --- a/docs/manual/mod/allmodules.xml +++ /dev/null @@ -1,46 +0,0 @@ - -core.xml -mod_access.xml -mod_actions.xml -mod_alias.xml -mod_asis.xml -mod_auth.xml -mod_auth_anon.xml -mod_auth_dbm.xml -mod_auth_digest.xml -mod_autoindex.xml -mod_cern_meta.xml -mod_cgi.xml -mod_cgid.xml -mod_charset_lite.xml -mod_dav.xml -mod_deflate.xml -mod_dir.xml -mod_env.xml -mod_example.xml -mod_ext_filter.xml -mod_file_cache.xml -mod_headers.xml -mod_imap.xml -mod_include.xml -mod_info.xml -mod_isapi.xml -mod_log_config.xml -mod_mime.xml -mod_mime_magic.xml -mod_negotiation.xml -mod_proxy.xml -mod_rewrite.xml -mod_setenvif.xml -mod_so.xml -mod_speling.xml -mod_status.xml -mod_suexec.xml -mod_unique_id.xml -mod_userdir.xml -mod_usertrack.xml -mod_vhost_alias.xml -mpm_common.xml -mpm_winnt.xml -prefork.xml - \ No newline at end of file diff --git a/docs/manual/mod/core.html b/docs/manual/mod/core.html deleted file mode 100644 index c7225d732b192c83b0cdf94a8d2f37f8086ff432..0000000000000000000000000000000000000000 --- a/docs/manual/mod/core.html +++ /dev/null @@ -1,946 +0,0 @@ - - - - -Apache Core Features - - - - - -

    Apache Core Features

    - -These configuration parameters control the core Apache features, and are -always available. - - - -
    - - -

    AccessConfig directive

    - -Syntax: AccessConfig filename
    -Default: AccessConfig conf/access.conf
    -Context: server config, virtual host
    -Status: core

    - -The server will read this file for more directives after reading the -ResourceConfig file. Filename is -relative to the ServerRoot. -This feature can be disabled using: -

    AccessConfig /dev/null
    -Historically, this file only contained -<Directory> sections; in fact it can now -contain any server directive allowed in the server config context. -


    - -

    AccessFileName directive

    - -Syntax: AccessFileName filename
    -Default: AccessFileName .htaccess
    -Context: server config, virtual host
    -Status: core

    - -When returning a document to the client the server looks for an -access control file with this name in every directory of the path to -the document, if access control files are enabled for that directory. - -For example: -

    AccessFileName .acl
    -before returning the document /usr/local/web/index.html, the -server will read /.acl, /usr/.acl, /usr/local/.acl and /usr/local/web/.acl -for directives, unless they have been disabled with -
    -<Directory />
    -AllowOverride None
    -</Directory>


    - -

    AllowOverride directive

    - -Syntax: AllowOverride override override ...
    -Default: AllowOverride All
    -Context: directory
    -Status: core

    - -When the server finds an .htaccess file (as specified by -AccessFileName) it needs to know which -directives declared in that file can override earlier access information.

    - -Override can be set to None, in which case the server -will not read the file, All in which case the server will -allow all the directives, or one or more of the following: -

    -
    AuthConfig -
    - -Allow use of the authorization directives -(AuthDBMGroupFile, -AuthDBMUserFile, -AuthGroupFile, -AuthName, AuthType, -AuthUserFile and -require). -
    FileInfo -
    - -Allow use of the directives controlling document types -(AddEncoding, -AddLanguage, -AddType, -DefaultType and -LanguagePriority). -
    Indexes -
    - -Allow use of the directives controlling directory indexing -(AddDescription, -AddIcon, -AddIconByEncoding, -AddIconByType, -DefaultIcon, -DirectoryIndex, -FancyIndexing, -HeaderName, -IndexIgnore, -IndexOptions and -ReadmeName). -
    Limit -
    - -Allow use of the directives controlling host access (allow, deny and order). -
    Options -
    - -Allow use of the directives controlling specific directory features -(Options and -XBitHack). -


    - -

    AuthName directive

    - -Syntax: AuthName auth-domain
    -Context: directory, .htaccess
    -Override: AuthConfig
    -Status: core

    - -This directive sets the name of the authorization realm for a directory. -This realm is given to the client so that the user knows which username and -password to send. -It must be accompanied by AuthType and -require directives, and directives such as -AuthUserFile and -AuthGroupFile to work.


    - -

    AuthType directive

    - -Syntax: AuthType type
    -Context: directory, .htaccess
    -Override: AuthConfig
    -Status: core

    - -This directive selects the type of user authentication for a directory. -Only Basic is currently implemented. - -It must be accompanied by AuthName and -require directives, and directives such as -AuthUserFile and -AuthGroupFile to work.


    - - -

    BindAddress directive

    - -Syntax: BindAddress saddr
    -Default: BindAddress *
    -Context: server config
    -Status: core

    - -A Unix® http server can either listen on for connections to every -IP address of the server machine, or just one IP address of the server -machine. Saddr can be - -

    -
  • * -
  • An IP address -
  • A fully-qualified internet domain name -
  • -If the value is *, then the server will listen for connections on -every IP address, otherwise it will only listen on the IP address -specified.

    - -This option can be used as an alternative method for supporting -virtual hosts instead of using -<VirtualHost> sections.


    - -

    See Also: -Setting which addresses and ports Apache uses

    - -

    DefaultType directive

    - -Syntax: DefaultType mime-type
    -Default: DefaultType text/html
    -Context: server config, virtual host, directory, .htaccess
    -Override: FileInfo
    -Status: core

    - -There will be times when the server is asked to provide a document -whose type cannot be determined by its MIME types mappings.

    - -The server must inform the client of the content-type of the document, so in -the event of an unknown type it uses the DefaultType. For -example: -

    DefaultType image/gif
    -would be appropriate for a directory which contained many gif images -with filenames missing the .gif extension.


    - -

    <Directory> directive

    - -Syntax: <Directory directory> ... -</Directory>
    -Context: server config, virtual host
    -Status: Core.

    - -<Directory> and </Directory> are used to enclose a group of -directives which will apply only to the named directory and sub-directories -of that directory. Any directive which is allowed in a directory -context may be used. Directory is either the full path to a directory, -or a wildcard string. In a wildcard string, `?' matches any single character, -and `*' matches any sequences of characters. Example: -

    - -<Directory /usr/local/httpd/htdocs>
    -Options Indexes FollowSymLinks
    -</Directory>
    -If multiple directory sections match the directory (or its parents) containing -a document, then the directives are applied in the order of shortest match -first, interspersed with the directives from the -.htaccess files. For example, with -
    -<Directory />
    -AllowOverride None
    -</Directoy>

    -<Directory /home/*>
    -AllowOverride FileInfo
    -</Directory>
    -The for access to the document /home/web/dir/doc.html the -steps are: - -
  • Apply directive AllowOverride None (disabling -.htaccess files). -
  • Apply directive AllowOverride FileInfo (for directory -/home/web). -
  • Apply any FileInfo directives in /home/web/.htaccess -
  • - -The directory sections typically occur in the access.conf file, but they -may appear in any configuration file. <Directory> directives cannot -nest, and cannot appear in a <Limit> section. -


    - -

    DocumentRoot directive

    - -Syntax: DocumentRoot directory-filename
    -Default: DocumentRoot -/usr/local/etc/httpd/htdocs
    -Context: server config, virtual host
    -Status: core

    - -This directive sets the directory from which httpd will serve files. -Unless matched by a directive like Alias, the server appends the path -from the requested URL to the document root to make the path to the -document. Example: -

    DocumentRoot /usr/web
    -then an access to http://www.my.host.com/index.html refers -to /usr/web/index.html. - -

    There appears to be a bug in mod_dir which causes problems when the -DocumentRoot has a trailing slash (i.e. "DocumentRoot /usr/web/") so -please avoid that. - -


    - -

    ErrorDocument directive

    - -Syntax: ErrorDocument error-code document
    -Context server config, virtual host, directory, .htaccess
    -Status: core
    -Compatibility: The directory and .htaccess contexts -are only available in Apache 1.1 and later.

    - -In the event of a problem or error, Apache can be configured to do -one of four things, - -

      -
    1. behave like NCSA httpd 1.3 -
    2. output a customized message -
    3. redirect to a local URL to handle the problem/error -
    4. redirect to an external URL to handle the problem/error -
    - -

    2-4 are configured using ErrorDocument, which -is followed by the HTTP response code and a message or URL. - -

    Messages in this context, begin with a single quote -("), which does not form part of the message itself. Apache will -sometime offer additional information regarding the problem/error. This can be -embedded into the message using %s - -

    URLs will begin with a slash (/) for local URLs, or will be a full -URL which the client can resolve. Examples: -

    -ErrorDocument 500 /cgi-bin/tester
    -ErrorDocument 404 /cgi-bin/bad_urls.pl
    -ErrorDocument 401 http://www2.foo.bar/subscription_info.html
    -ErrorDocument 403 "Sorry can't allow you access today -
    - -See Also: documentation of customizable -responses.


    - -

    ErrorLog directive

    - -Syntax: ErrorLog filename
    -Default: ErrorLog logs/error_log
    -Context: server config, virtual host
    -Status: core

    - -The error log directive sets the name of the file to which the server will log -any errors it encounters. If the filename does not begin with a slash (/) -then it is assumed to be relative to the ServerRoot. -Example: -

    ErrorLog /dev/null
    -This effectively turns off error logging.


    - -

    Group directive

    - -Syntax: Group unix-group
    -Default: Group #-1
    -Context: server config
    -Status: core

    - -The Group directive sets the group under which the server will answer requests. -In order to use this directive, the standalone server must be run initially -as root. Unix-group is one of: -

    -
    A group name -
    Refers to the given group by name. -
    # followed by a group number. -
    Refers to a group by its number. -
    - -It is recommended that you set up a new group specifically for running the -server. Some admins use user nobody, but this is not always -possible or desirable.

    - -Note: if you start the server as a non-root user, it will fail to change -to the specified, and will instead continue to run as the group of the -original user.

    - -SECURITY: See User for a discussion of the security -considerations.


    - -

    IdentityCheck directive

    - -Syntax: IdentityCheck boolean
    -Default: IdentityCheck off
    -Context: server config, virtual host, directory, .htaccess
    -Status: core

    - -This directive enables RFC931-compliant logging of the remote user name -for each connection, where the client machine runs identd or something similar. -This information is logged in the access log. Boolean is either -on or off.

    - -The information should not trusted in any way except for rudimentary usage -tracking.


    - -

    KeepAlive

    -Syntax: KeepAlive max-requests
    -Default: KeepAlive 5
    -Context: server config
    -Status: Core
    -Compatibility: KeepAlive is only available in Apache -1.1 and later.

    - -This directive enables -Keep-Alive -support. Set max-requests -to the maximum number of requests you want Apache to entertain per -request. A limit is imposed to prevent a client from hogging your -server resources. Set this to 0 to disable support. - -

    KeepAliveTimeout

    -Syntax: KeepAliveTimeout seconds
    -Default: KeepAliveTimeout 15
    -Context: server config
    -Status: Core
    -Compatibility: KeepAliveTimeout is only available in Apache -1.1 and later.

    - -The number of seconds Apache will wait for a subsequent request before -closing the connection. Once a request has been received, the timeout -value specified by the Timeout directive -applies. - - -

    Listen

    -Syntax: -Listen [IP address:]port number
    -Context: server config
    -Status: core
    -Compatibility: Listen is only available in Apache -1.1 and later.

    - -

    The Listen directive instructs Apache to listen to more than one IP -address or port; by default it responds to requests on all IP -interfaces, but only on the port given by the Port -directive.

    - -

    See Also: -Setting which addresses and ports Apache uses

    - -

    <Limit> directive

    - -Syntax: - <Limit method method ... > ... </Limit>
    -Context: any
    -Status: core

    - -<Limit> and </Limit> are used to enclose a group of -access control directives which will then apply only to the specified -access methods, where method is any valid HTTP method. -Any directive except another <Limit> or -<Directory> may be used; the majority will be -unaffected by the <Limit>. Example: -

    -<Limit GET POST>
    -require valid-user
    -</Limit>
    -If an access control directive appears outside a <Limit> directive, -then it applies to all access methods.


    - -

    <Location>

    - -Syntax: <Location URL prefix>
    -Context: server config, virtual host
    -Status: core
    -Compatibility: Location is only available in Apache -1.1 and later.

    - -

    The <Location> directive provides for access control by -URL. It is comprable to the <Directory> directive, and -should be matched with a </Location> directive. Directives that -apply to the URL given should be listen -within. <Location> sections are processed in the -order they appear in the configuration file, after the -<Directory> sections and .htaccess files are -read.

    - -

    Note that, due to the way HTTP functions, URL prefix -should, save for proxy requests, be of the form /path/, -and should not include the http://servername. It doesn't -neccessarily have to protect a directory (it can be an individual -file, or a number of files), and can include wildcards. In a wildcard -string, `?' matches any single character, and `*' matches any -sequences of characters. - -

    This functionality is especially useful when combined with the -SetHandler -directive. For example, to enable status requests, but allow them only -from browsers at foo.com, you might use: - -

    -    <Location /status>
    -    SetHandler server-status
    -    
    -    order deny,allow
    -    deny from all
    -    allow from .foo.com
    -    
    -    </Location>
    -
    - - -

    MaxClients directive

    - -Syntax: MaxClients number
    -Default: MaxClients 150
    -Context: server config
    -Status: core

    - -The MaxClients directive sets the limit on the number of simultaneous -requests that can be supported; not more than this number of child server -processes will be created.


    - -

    MaxRequestsPerChild directive

    - -Syntax: MaxRequestsPerChild number
    -Default: MaxRequestsPerChild 0
    -Context: server config
    -Status: core

    - -The MaxRequestsPerChild directive sets the limit on the number of requests -that an individual child server process will handle. After MaxRequestsPerChild -requests, the child process will die. If MaxRequestsPerChild is 0, then -the process will never expire.

    - -Setting MaxRequestsPerChild to a non-zero limit has two beneficial effects: -

      -
    • it limits the amount of memory that process can consume by (accidental) -memory leakage; -
    • by giving processes a finite lifetime, it helps reduce the -number of processes when the server load reduces. -


    - -

    MaxSpareServers directive

    - -Syntax: MaxSpareServers number
    -Default: MaxSpareServers 10
    -Context: server config
    -Status: core

    - -The MaxSpareServers directive sets the desired maximum number of idle -child server processes. An idle process is one which is not handling -a request. If there are more than MaxSpareServers idle, then the parent -process will kill off the excess processes.

    - -Tuning of this parameter should only be necessary on very busy sites. -Setting this parameter to a large number is almost always a bad idea.

    - -See also MinSpareServers and -StartServers.


    - -

    MinSpareServers directive

    - -Syntax: MinSpareServers number
    -Default: MinSpareServers 5
    -Context: server config
    -Status: core

    - -The MinSpareServers directive sets the desired minimum number of idle -child server processes. An idle process is one which is not handling -a request. If there are fewer than MinSpareServers idle, then the parent -process creates new children at a maximum rate of 1 per second.

    - -Tuning of this parameter should only be necessary on very busy sites. -Setting this parameter to a large number is almost always a bad idea.

    - -See also MaxSpareServers and -StartServers.


    - -

    Options directive

    - -Syntax: Options option option ...
    -Context: server config, virtual host, directory, .htaccess
    -Override: Options
    -Status: core

    - -The Options directive controls which server features are available in -a particular directory.

    -option can be set to None, in which case none of -the extra features are enabled, or one or more of the following: -

    -
    All -
    All options except for MultiViews. -
    ExecCGI -
    - -Execution of CGI scripts is permitted. -
    FollowSymLinks -
    - -The server will follow symbolic links in this directory. -
    Includes -
    - -Server-side includes are permitted. -
    IncludesNOEXEC -
    - -Server-side includes are permitted, but the #exec command and -#include of CGI scripts are disabled. -
    Indexes -
    - -If a URL which maps to a directory is requested, and the there is no -DirectoryIndex (e.g. index.html) in that directory, then the server will -return a formatted listing of the directory. -
    MultiViews -
    - -Ccontent negotiatad MultiViews are -allowed. -
    SymLinksIfOwnerMatch -
    - -The server will only follow symbolic links for which the target -file or directory is owned by the same user id as the link. -
    - -If multiple Options could apply to a directory, then the most specific one is -taken complete; the options are not merged. For example: -
    -<Directory /web/docs>
    -Options Indexes FollowSymLinks
    -</Directory>
    -<Directory /web/docs/spec>
    -Options Includes
    -</Directory> -
    -then only Includes will be set for the /web/docs/spec -directory.


    - -

    PidFile directive

    - -Syntax: PidFile filename
    -Default: PidFile logs/httpd.pid
    -Context: server config
    -Status: core

    - -The PidFile directive sets the file to which the server records the -process id of the daemon. If the filename does not begin with a slash (/) -then it is assumed to be relative to the ServerRoot. -The PidFile is only used in standalone mode.

    - -It is often useful to be able to send the server a signal, so that it closes -and then reopens its ErrorLog and TransferLog, and -re-reads its configuration files. This is done by sending a SIGHUP (kill -1) -signal to the process id listed in the PidFile.


    - -

    Port directive

    - -Syntax: Port number
    -Default: Port 80
    -Context: server config
    -Status: core

    - -The Port directive sets the network port on which the server listens. -Num is a number from 0 to 65535; some port numbers (especially below -1024) are reserved for particular protocols. See /etc/services -for a list of some defined ports; the standard port for the http protocol -is 80.

    - -Port 80 is one of Unix's special ports. All ports numbered -below 1024 are reserved for system use, i.e. regular (non-root) users cannot -make use of them; instead they can only use higher port numbers.

    - -To use port 80, you must start the server from the root account. -After binding to the port and before accepting requests, Apache will change -to a low privileged user as set by the User directive.

    - -If you cannot use port 80, choose any other unused port. Non-root users -will have to choose a port number higher than 1023, such as 8000.

    - -SECURITY: if you do start the server as root, be sure -not to set User to root. If you run the server as -root whilst handling connections, your site may be open to a major security -attack.


    - -

    require directive

    - -Syntax: require entity-name entity entity...
    -Context: directory, .htaccess
    -Override: AuthConfig
    -Status: core

    - -This directive selects which authenticated users can access a directory. -The allowed syntaxes are: -

      -
    • require user userid userid ...

      -Only the named users can access the directory.

      -

    • require group group-name group-name ...

      -Only users in the named groups can access the directory.

      -

    • require valid-user

      -All valid users can access the directory. -

    -

    -If require appears in a <Limit> -section, then it restricts access to the named methods, otherwise -it restricts access for all methods. Example: -

    -AuthType Basic
    -AuthName somedomain
    -AuthUserFile /web/users
    -AuthGroupFile /web/groups
    -Limit <GET POST>
    -require group admin
    -</Limit> -
    - -Require must be accompanied by AuthName and -AuthType directives, and directives such as -AuthUserFile and -AuthGroupFile (to define users and -groups) in order to work correctly.


    - -

    ResourceConfig directive

    - -Syntax: ResourceConfig filename
    -Default: ResourceConfig conf/srm.conf
    -Context: server config, virtual host
    -Status: core

    - -The server will read this file for more directives after reading the -httpd.conf file. Filename is relative to the -ServerRoot. -This feature can be disabled using: -

    ResourceConfig /dev/null
    -Historically, this file contained most directives except for server -configuration directives and <Directory>. -sections; in fact it can now contain any server directive allowed in the -server config context.

    - -See also AccessConfig.


    - -

    ServerAdmin directive

    - -Syntax: ServerAdmin email-address
    -Context: server config, virtual host
    -Status: core

    - -The ServerAdmin sets the e-mail address that the server includes in any -error messages it returns to the client.

    - -It may be worth setting up a dedicated address for this, e.g. -

    ServerAdmin www-admin@foo.bar.com
    -as users do not always mention that they are talking about the server!


    - -

    ServerAlias directive

    - -Syntax: ServerAlias host1 host2 ...
    -Context: virtual host
    -Status: core
    -Compatibility: ServerAlias is only available in Apache -1.1 and later.

    - -The ServerAlias directive sets the alternate names for a host, for use -with -Host-header based virtual hosts. - -


    - -

    ServerName directive

    - -Syntax: ServerName fully-qualified domain name
    -Context: server config, virtual host
    -Status: core

    - -The ServerName directive sets the hostname of the server; this is only -used when creating redirection URLs. If it is not specified, then the -server attempts to deduce it from its own IP address; however this may -not work reliably, or may not return the preferred hostname. For example: -

    ServerName www.wibble.com
    -would be used if the canonical (main) name of the actual machine -were monster.wibble.com.


    - -

    ServerPath directive

    - -Syntax: ServerPath pathname
    -Context: virtual host
    -Status: core
    -Compatibility: ServerPath is only available in Apache -1.1 and later.

    - -The ServerAlias directive sets the legacy URL pathname for a host, for -use with Host-header based virtual hosts. - -

    ServerRoot directive

    - -Syntax: ServerRoot directory-filename
    -Default: ServerRoot /usr/local/etc/httpd
    -Context: server config
    -Status: core

    - -The ServerRoot directive sets the directory in which the server lives. -Typically it will contain the subdirectories conf/ and -logs/. Relative paths for other configuration files are taken -as relative to this directory.


    - -

    ServerType directive

    - -Syntax: ServerType type
    -Default: ServerType standalone
    -Context: server config
    -Status: core

    - -The ServerType directive sets how the server is executed by the system. -Type is one of -

    -
    inetd -
    The server will be run from the system process inetd; the command to start -the server is added to /etc/inetd.conf -
    standalone -
    The server will run as a daemon process; the command to start the server -is added to the system startup scripts. (/etc/rc.local or -/etc/rc3.d/....) -
    - -Inetd is the lesser used of the two options. For each http -connection received, a new copy of the server is started from scratch; -after the connection is complete, this program exits. There is a high price to -pay per connection, but for security reasons, some admins prefer this option. -

    - -Standalone is the most common setting for ServerType since -it is far more efficient. The server is started once, and services all -subsequent connections. If you intend running Apache to serve a busy site, -standalone will probably be your only option.

    - -SECURITY: if you are paranoid about security, run in inetd mode. Security -cannot be guaranteed in either, but whilst most people are happy to use -standalone, inetd is probably least prone to attack.


    - -

    StartServers directive

    - -Syntax: StartServers number
    -Default: StartServers 5
    -Context: server config
    -Status: core

    - -The StartServers directive sets the number of child server processes created -on startup. As the number of processes is dynamically controlled depending -on the load, there is usually little reason to adjust this parameter.

    - -See also MinSpareServers and -MaxSpareServers.


    - -

    TimeOut directive

    - -Syntax: TimeOut number
    -Default: TimeOut 1200
    -Context: server config
    -Status: core

    - -The TimeOut directive sets the maximum time that the server will wait -for the receipt of a request and the completion of a request, in seconds. -So if it takes more than TimeOut seconds for a client to send a request or -receive a response, the server will break off the connection. Thus TimeOut -limits the maximum a transfer can take; for large files, and slow networks -transfer times can be large. -


    - -

    User directive

    - -Syntax: User unix-userid
    -Default: User #-1
    -Context: server config
    -Status: core

    - -The User directive sets the userid as which the server will answer requests. -In order to use this directive, the standalone server must be run initially -as root. Unix-userid is one of: -

    -
    A username -
    Refers to the given user by name. -
    # followed by a user number. -
    Refers to a user by their number. -
    - -The user should have no privileges which result in it being able to access -files which are not intended to be visible to the outside world, and -similarly, the user should not be able to execute code which is not -meant for httpd requests. It is recommended that you set up a new user and -group specifically for running the server. Some admins use user -nobody, but this is not always possible or desirable.

    - -Notes: If you start the server as a non-root user, it will fail to change -to the lesser privileged user, and will instead continue to run as -that original user. If you do start the server as root, then it is normal -for the parent process to remain running as root.

    - -SECURITY: Don't set User (or Group) to -root unless you know exactly what you are doing, and what the -dangers are.


    - -

    <VirtualHost> directive

    - -Syntax: <VirtualHost addr[:port]> ... -</VirtualHost>
    -Context: server config
    -Status: Core.

    - -<VirtualHost> and </VirtualHost> are used to enclose a group of -directives which will apply only to a particular virtual host. -Any directive which is allowed in a virtual host context may be used. -When the server receives a request for a document on a particular virtual -host, it uses the configuration directives enclosed in the <VirtualHost> -section. Addr can be -

    -
  • The IP address of the virtual host -
  • A fully qualified domain name for the IP address of the virtual host. -
  • Example: -
    - -<VirtualHost host.foo.com>
    -ServerAdmin webmaster@host.foo.com
    -DocumentRoot /www/docs/host.foo.com
    -ServerName host.foo.com
    -ErrorLog logs/host.foo.com-error_log
    -TransferLog logs/host.foo.com-access_log
    -</VirtualHost> -
    - -Currently, each VirtualHost must correspond to a different IP address for -the server, so the server machine must be configured to accept IP packets for -multiple addresses. If the machine does not have multiple network interfaces, -then this can be accomplished with the ifconfig alias command -(if your OS supports it), or with kernel patches like -VIF (for SunOS(TM) 4.1.x).

    - - -

    See also: -Information on Virtual Hosts. -(multihome)
    -See also: -Non-IP address-based Virtual Hosts -

    - -
    - - -Home -Index - - - - diff --git a/docs/manual/mod/core.xml b/docs/manual/mod/core.xml deleted file mode 100644 index 2eb6527b2dc0515cb7bce933a3d9a0c549a1fec7..0000000000000000000000000000000000000000 --- a/docs/manual/mod/core.xml +++ /dev/null @@ -1,2480 +0,0 @@ - - ]> - - - -core -Core -Core Apache HTTP Server features that are always -available - - -AcceptPathInfo -Controls whether requests can contain trailing pathname information -AcceptPathInfo On|Off|Default -AcceptPathInfo Default -server config -virtual hostdirectory -.htaccess -Available in Apache 2.0.30 and later - - - -

    This directive controls whether requests that contain trailing - pathname information that follows an actual filename (or - non-existent file in an existing directory) will be accepted or - rejected. The trailing pathname information can be made - available to scripts in the PATH_INFO environment variable.

    - -

    For example, assume the location /test/ points to - a directory that contains only the single file - here.html. Then requests for - /test/here.html/more and - /test/nothere.html/more both collect - /more as PATH_INFO.

    - -

    The three possible arguments for the - AcceptPathInfo directive are:

    -
    -
    off
    A request will only be accepted if it - maps to a literal path that exists. Therefore a request with - trailing pathname information after the true filename such as - /test/here.html/more in the above example will return - a 404 NOT FOUND error.
    - -
    on
    A request will be accepted if a - leading path component maps to a file that exists. The above - example /test/here.html/more will be accepted if - /test/here.html maps to a valid file.
    - -
    default
    The treatment of requests with - trailing pathname information is determined by the handler responsible for the request. - The core handler for normal files defaults to rejecting PATH_INFO. - Handlers that serve scripts, such as cgi-script and isapi-isa, generally accept PATH_INFO by - default.
    -
    - -

    The primary purpose of the AcceptPathInfo - directive is to allow you to override the handler's choice of - accepting or rejecting PATH_INFO. This override is required, for - example, when you use a filter, such - as INCLUDES, to generate content - based on PATH_INFO. The core handler would usually reject the - request, so you can use the following configuration to enable - such a script:

    - -<Files "mypaths.shtml">
    - Options +Includes
    - SetOutputFilter INCLUDES
    - AcceptPathInfo on
    -</Files> -
    -
    -
    - - -AccessFileName -Sets the name of the .htaccess file -AccessFileName filename [filename] ... -AccessFileName .htaccess -server configvirtual host - - - -

    When returning a document to the client the server looks for - the first existing access control file from this list of names - in every directory of the path to the document, if access - control files are enabled for that directory. For example:

    - - -AccessFileName .acl - - -

    before returning the document - /usr/local/web/index.html, the server will read - /.acl, /usr/.acl, - /usr/local/.acl and /usr/local/web/.acl - for directives, unless they have been disabled with

    - - -<Directory />
    -  AllowOverride None
    -</Directory> -
    -
    -AllowOverride -Configuration Files -
    - - -AddDefaultCharset -Specifies the default character set to be added for a -response without an explicit character set -AddDefaultCharset On|Off|charset -server config -virtual hostdirectory -.htaccess -AddDefaultCharset Off - - - -

    This directive specifies the name of the character set that - will be added to any response that does not have any parameter on - the content type in the HTTP headers. This will override any - character set specified in the body of the document via a - META tag. A setting of AddDefaultCharset - Off disables this - functionality. AddDefaultCharset On enables - Apache's internal default charset of iso-8859-1 as - required by the directive. You can also specify an alternate - charset to be used. For example:

    - - - AddDefaultCharset utf-8 - -
    -
    - - -AddModule -AddModule module [module] ... -server config - - -

    The server can have modules compiled in which are not - actively in use. This directive can be used to enable the use - of those modules. The server comes with a pre-loaded list of - active modules; this list can be cleared with the ClearModuleList directive.

    - -

    For example:

    - -AddDefaultCharset utf-8 - -
    -
    - - -AllowOverride -Sets the types of directives that are allowed in -.htaccess files -AllowOverride All|None|directive-type [directive-type] ... -AllowOverride All -directory - - -

    When the server finds an .htaccess file (as specified by AccessFileName) it needs to know - which directives declared in that file can override earlier - access information.

    - -

    When this directive is set to None, then - .htaccess files are completely ignored. In this case, the - server will not even attempt to read .htaccess files in the - filesystem.

    - -

    When this directive is set to All, then any - directive which has the .htaccess Context is allowed in - .htaccess files.

    - -

    The directive-type can be one of the following - groupings of directives.

    - -
    -
    AuthConfig
    - -
    - - Allow use of the authorization directives (AuthDBMGroupFile, - AuthDBMUserFile, - AuthGroupFile, - AuthName, - AuthType, AuthUserFile, Require, etc.).
    - -
    FileInfo
    - -
    - Allow use of the directives controlling document types (DefaultType, ErrorDocument, ForceType, LanguagePriority, - SetHandler, SetInputFilter, SetOutputFilter, and - mod_mime Add* and Remove* - directives, etc.).
    - -
    Indexes
    - -
    - Allow use of the directives controlling directory indexing - (AddDescription, - AddIcon, AddIconByEncoding, - AddIconByType, - DefaultIcon, DirectoryIndex, FancyIndexing, HeaderName, IndexIgnore, IndexOptions, ReadmeName, - etc.).
    - -
    Limit
    - -
    - Allow use of the directives controlling host access (Allow, Deny and Order).
    - -
    Options
    - -
    - Allow use of the directives controlling specific directory - features (Options and - XBitHack).
    -
    - -

    Example:

    - - AllowOverride AuthConfig Indexes -
    - -AccessFileName -Configuration Files -
    - - -AuthName -Sets the authorization realm for use in HTTP -authentication -AuthName auth-domain -directory.htaccess - -AuthConfig - - -

    This directive sets the name of the authorization realm for a - directory. This realm is given to the client so that the user - knows which username and password to send. - AuthName takes a single argument; if the - realm name contains spaces, it must be enclosed in quotation - marks. It must be accompanied by AuthType and Require directives, and directives such - as AuthUserFile and - AuthGroupFile to - work.

    - -

    For example:

    - - AuthName "Top Secret" - -

    The string provided for the AuthRealm is what will - appear in the password dialog provided by most browsers.

    -
    -Authentication, Authorization, and - Access Control -
    - - -AuthType -Selects the type of user authentication -AuthType Basic|Digest -directory.htaccess -AuthConfig - - -

    This directive selects the type of user authentication for a - directory. Only Basic and Digest are - currently implemented. - - It must be accompanied by AuthName and Require directives, and directives such - as AuthUserFile and - AuthGroupFile to - work.

    -
    -Authentication, Authorization, -and Access Control -
    - - -ContentDigest -Enables the generation of Content-MD5 HTTP Response -headers -ContentDigest on|off -ContentDigest off -server configvirtual host -directory.htaccess - -Options -Experimental -Available in Apache 1.1 and later - - -

    This directive enables the generation of - Content-MD5 headers as defined in RFC1864 - respectively RFC2068.

    - -

    MD5 is an algorithm for computing a "message digest" - (sometimes called "fingerprint") of arbitrary-length data, with - a high degree of confidence that any alterations in the data - will be reflected in alterations in the message digest.

    - -

    The Content-MD5 header provides an end-to-end - message integrity check (MIC) of the entity-body. A proxy or - client may check this header for detecting accidental - modification of the entity-body in transit. Example header:

    - - Content-MD5: AuLb7Dp1rqtRtxz2m9kRpA== - - -

    Note that this can cause performance problems on your server - since the message digest is computed on every request (the - values are not cached).

    - -

    Content-MD5 is only sent for documents served - by the core, and not by any module. For example, SSI documents, - output from CGI scripts, and byte range responses do not have - this header.

    -
    -
    - - -DefaultType -Sets the MIME content-type that will be sent if the -server cannot determine a type in any other way -DefaultType MIME-type -DefaultType text/html -server configvirtual host -directory.htaccess - -FileInfo - - -

    There will be times when the server is asked to provide a - document whose type cannot be determined by its MIME types - mappings.

    - -

    The server must inform the client of the content-type of the - document, so in the event of an unknown type it uses the - DefaultType. For example:

    - - - DefaultType image/gif - - would be appropriate for a directory which contained many gif - images with filenames missing the .gif extension. - -

    Note that unlike ForceType, this directive is only - provides the default mime-type. All other mime-type definitions, - including filename extensions, that might identify the media type - will override this default.

    -
    -
    - - -Directory -Enclose a group of directives that apply only to the -named file-system directory and sub-directories -<Directory directory-path> -... </Directory> -server configvirtual host - - - -

    Directory and - </Directory> are used to enclose a group of - directives which will apply only to the named directory and - sub-directories of that directory. Any directive which is allowed - in a directory context may be used. Directory-path is - either the full path to a directory, or a wild-card string. In a - wild-card string, `?' matches any single character, and `*' - matches any sequences of characters. You may - also use `[]' character ranges like in the shell. Also as of - Apache 1.3 none of the wildcards match a `/' character, which more - closely mimics the behavior of Unix shells. Example:

    - - <Directory /usr/local/httpd/htdocs>
    -  Options Indexes FollowSymLinks
    - </Directory>
    -
    - -

    Extended regular - expressions can also be used, with the addition of the - ~ character. For example:

    - - <Directory ~ "^/www/.*/[0-9]{3}"> - - would match directories in /www/ that consisted of three - numbers. - -

    If multiple (non-regular expression) directory sections - match the directory (or its parents) containing a document, - then the directives are applied in the order of shortest match - first, interspersed with the directives from the .htaccess files. For example, - with

    - - - <Directory />
    -   AllowOverride None
    - </Directory>
    -
    - <Directory /home/*>
    -   AllowOverride FileInfo
    - </Directory> -
    -

    for access to the document /home/web/dir/doc.html - the steps are:

    - -
      -
    • Apply directive AllowOverride None - (disabling .htaccess files).
    • - -
    • Apply directive AllowOverride FileInfo (for - directory /home/web).
    • - -
    • Apply any FileInfo directives in - /home/web/.htaccess
    • -
    - -

    Regular expressions are not considered until after all of the - normal sections have been applied. Then all of the regular - expressions are tested in the order they appeared in the - configuration file. For example, with

    - -<Directory ~ abc$>
    - ... directives here ...
    - </Directory>
    -
    - -

    The regular expression section won't be considered until after - all normal <Directory>s and .htaccess files - have been applied. Then the regular expression will match on - /home/abc/public_html/abc and be applied.

    - -

    Note that the default Apache access for - <Directory /> is Allow from All. This means - that Apache will serve any file mapped from an URL. It is - recommended that you change this with a block such - as

    - - - <Directory />
    -   Order Deny,Allow
    -   Deny from All
    - </Directory> -
    - -

    and then override this for directories you - want accessible. See the Security Tips page for more - details.

    - -

    The directory sections typically occur in - the access.conf file, but they may appear in any configuration - file. Directory directives - cannot nest, and cannot appear in a Limit or LimitExcept section.

    -
    -How - Directory, Location and Files sections work for an - explanation of how these different sections are combined when a - request is received -
    - - -DirectoryMatch -Enclose a group of directives that apply only to -file-system directories that match a regular expression and their -subdirectories -<Directory regex> -... </Directory> -server configvirtual host - - - -

    DirectoryMatch and - </DirectoryMatch> are used to enclose a group - of directives which will apply only to the named directory and - sub-directories of that directory, the same as Directory. However, it - takes as an argument a regular expression. For example:

    - - <DirectoryMatch "^/www/.*/[0-9]{3}"> - - -

    would match directories in /www/ that consisted of three - numbers.

    -
    -Directory for -a description of how regular expressions are mixed in with normal -<Directory>s -How Directory, Location and Files sections -work for an explanation of how these different sections are -combined when a request is received -
    - - -DocumentRoot -Sets the directory that forms the main document tree visible -from the web -DocumentRoot directory-path -DocumentRoot /usr/local/apache/htdocs -server configvirtual host - - - -

    This directive sets the directory from which httpd will - serve files. Unless matched by a directive like Alias, the - server appends the path from the requested URL to the document - root to make the path to the document. Example:

    - - DocumentRoot /usr/web - -

    then an access to - http://www.my.host.com/index.html refers to - /usr/web/index.html.

    - -

    The DocumentRoot should be specified without - a trailing slash.

    -
    -Mapping URLs to Filesystem -Location -
    - - -ErrorDocument -Specifies what the server will return to the client -in case of an error -ErrorDocument error-code document -server configvirtual host -directory.htaccess - -FileInfo -Quoting syntax for text messages is different in Apache -2.0 - - -

    In the event of a problem or error, Apache can be configured - to do one of four things,

    - -
      -
    1. output a simple hardcoded error message
    2. - -
    3. output a customized message
    4. - -
    5. redirect to a local URL-path to handle the - problem/error
    6. - -
    7. redirect to an external URL to handle the - problem/error
    8. -
    - -

    The first option is the default, while options 2-4 are - configured using the ErrorDocument - directive, which is followed by the HTTP response code and a URL - or a message. Apache will sometimes offer additional information - regarding the problem/error.

    - -

    URLs can begin with a slash (/) for local URLs, or be a full - URL which the client can resolve. Alternatively, a message can - be provided to be displayed by the browser. Examples:

    - - - ErrorDocument 500 - http://foo.example.com/cgi-bin/tester
    - ErrorDocument 404 /cgi-bin/bad_urls.pl
    - ErrorDocument 401 /subscription_info.html
    - ErrorDocument 403 "Sorry can't allow you access - today" -
    - -

    Note that when you specify an ErrorDocument - that points to a remote URL (ie. anything with a method such as - "http" in front of it), Apache will send a redirect to the - client to tell it where to find the document, even if the - document ends up being on the same server. This has several - implications, the most important being that the client will not - receive the original error status code, but instead will - receive a redirect status code. This in turn can confuse web - robots and other clients which try to determine if a URL is - valid using the status code. In addition, if you use a remote - URL in an ErrorDocument 401, the client will not - know to prompt the user for a password since it will not - receive the 401 status code. Therefore, if you use an - "ErrorDocument 401" directive then it must refer to a local - document.

    - -

    Prior to version 2.0, messages were indicated by prefixing - them with a single unmatched double quote character.

    -
    - -documentation of - customizable responses -
    - - -ErrorLog -Sets the name of the file to which the server -will log errors - ErrorLog file-path|syslog[:facility] -ErrorLog logs/error_log (Unix) -ErrorLog logs/error.log (Windows and OS/2) -server configvirtual host - - - -

    The ErrorLog directive sets the name of - the file to which the server will log any errors it encounters. If - the file-path does not begin with a slash (/) then it is - assumed to be relative to the ServerRoot. If the file-path - begins with a pipe (|) then it is assumed to be a command to spawn - to handle the error log.

    - -

    Using syslog instead of a filename enables logging - via syslogd(8) if the system supports it. The default is to use - syslog facility local7, but you can override this by - using the syslog:facility syntax where - facility can be one of the names usually documented in - syslog(1).

    - -

    SECURITY: See the security tips - document for details on why your security could be compromised - if the directory where logfiles are stored is writable by - anyone other than the user that starts the server.

    -
    -LogLevel -Apache Log Files -
    - - -FileETag -Configures the file attributes used to create the ETag -HTTP response header -FileETag component ... -server configvirtual host -directory.htaccess - -FileInfo - - -

    - The FileETag directive configures the file - attributes that are used to create the ETag (entity tag) response - header field when the document is based on a file. (The ETag - value is used in cache management to save network bandwidth.) In - Apache 1.3.22 and earlier, the ETag value was always formed - from the file's inode, size, and last-modified time (mtime). The - FileETag directive allows you to choose which of these -- if any - -- should be used. The recognized keywords are: -

    -
    -
    INode
    -
    The file's i-node number will be included in the calculation
    -
    MTime
    -
    The date and time the file was last modified will be included
    -
    Size
    -
    The number of bytes in the file will be included
    -
    All
    -
    All available fields will be used (equivalent to - 'FileETag INode MTime Size')
    -
    None
    -
    If a document is file-based, no ETag field will be included in the - response
    -
    -

    - The INode, MTime, and Size keywords may be prefixed with either '+' - or '-', which allow changes to be made to the default setting - inherited from a broader scope. Any keyword appearing without - such a prefix immediately and completely cancels the inherited - setting. -

    -

    - If a directory's configuration includes - 'FileETag INode MTime Size', and a - subdirectory's includes 'FileETag -INode', - the setting for that subdirectory (which will be inherited by - any sub-subdirectories that don't override it) will be equivalent to - 'FileETag MTime Size'. -

    -
    -
    - - -Files -Contains that directives that apply to matched -filenames -<Files filename> ... </Files> -server configvirtual host -directory.htaccess - - - -

    The Files directive - provides for access control by filename. It is comparable to the - Directory - directive and Location directives. It should be - matched with a </Files> directive. The - directives given within this section will be applied to any object - with a basename (last component of filename) matching the - specified filename. Files - sections are processed in the order they appear in the - configuration file, after the Directory sections and - .htaccess files are read, but before Location sections. Note - that Files can be nested - inside Directory sections to restrict the - portion of the filesystem they apply to.

    - -

    The filename argument should include a filename, or - a wild-card string, where `?' matches any single character, and - `*' matches any sequences of characters. Extended regular - expressions can also be used, with the addition of the - ~ character. For example:

    - - <Files ~ "\.(gif|jpe?g|png)$"> - -

    would match most common Internet graphics formats. In Apache 1.3 - and later, FilesMatch is preferred, however.

    - -

    Note that unlike Directory and Location sections, Files sections can be used inside - .htaccess files. This allows users to control access to their own - files, at a file-by-file level.

    - -
    -How - Directory, Location and Files sections work for an - explanation of how these different sections are combined when a - request is received -
    - - -FilesMatch -Contains that directives that apply to regular-expression matched -filenames -<FilesMatch regex> ... </FilesMatch> -server configvirtual host -directory.htaccess - - - -

    The FilesMatch directive - provides for access control by filename, just as the Files directive - does. However, it accepts a regular expression. For example:

    - - <FilesMatch "\.(gif|jpe?g|png)$"> - - -

    would match most common Internet graphics formats.

    -
    - -How - Directory, Location and Files sections work for an - explanation of how these different sections are combined when a - request is received -
    - - -ForceType -Forces all matching files to be served with the specified -MIME content-type -ForceType mime-type -directory.htaccess - -Moved to the core in Apache 2.0 - - -

    When placed into an .htaccess file or a - Directory, or - Location or - Files - section, this directive forces all matching files to be served - with the content type identification given by - mime-type. For example, if you had a directory full of - GIF files, but did not want to label them all with ".gif", you - might want to use:

    - - ForceType image/gif - - -

    Note that unlike DefaultType, - this directive overrides all mime-type associations, including - filename extensions, that might identify the media type.

    -
    -
    - - -HostnameLookups -Enables DNS lookups on client IP addresses -HostnameLookups on|off|double -HostnameLookups off -server configvirtual host -directory - - -

    This directive enables DNS lookups so that host names can be - logged (and passed to CGIs/SSIs in REMOTE_HOST). - The value double refers to doing double-reverse - DNS. That is, after a reverse lookup is performed, a forward - lookup is then performed on that result. At least one of the ip - addresses in the forward lookup must match the original - address. (In "tcpwrappers" terminology this is called - PARANOID.)

    - -

    Regardless of the setting, when mod_access is - used for controlling access by hostname, a double reverse lookup - will be performed. This is necessary for security. Note that the - result of this double-reverse isn't generally available unless you - set HostnameLookups double. For example, if only - HostnameLookups on and a request is made to an object - that is protected by hostname restrictions, regardless of whether - the double-reverse fails or not, CGIs will still be passed the - single-reverse result in REMOTE_HOST.

    - -

    The default is off in order to save the network - traffic for those sites that don't truly need the reverse - lookups done. It is also better for the end users because they - don't have to suffer the extra latency that a lookup entails. - Heavily loaded sites should leave this directive - off, since DNS lookups can take considerable - amounts of time. The utility logresolve, provided in - the /support directory, can be used to look up host - names from logged IP addresses offline.

    -
    -
    - - -IdentityCheck -Enables logging of the RFC1413 identity of the remote -user -IdentityCheck on|off -IdentityCheck off - - -

    This directive enables RFC1413-compliant logging of the - remote user name for each connection, where the client machine - runs identd or something similar. This information is logged in - the access log.

    - -

    The information should not be trusted in any way except for - rudimentary usage tracking.

    - -

    Note that this can cause serious latency problems accessing - your server since every request requires one of these lookups - to be performed. When firewalls are involved each lookup might - possibly fail and add 30 seconds of latency to each hit. So in - general this is not very useful on public servers accessible - from the Internet.

    -
    -
    - - -IfDefine -Encloses directives that will be processed only -if a test is true at startup -<IfDefine [!]parameter-name> ... - </IfDefine> -server configvirtual host -directory.htaccess - - - -

    The <IfDefine - test>...</IfDefine> section is used to - mark directives that are conditional. The directives within an - IfDefine section are only - processed if the test is true. If test is false, - everything between the start and end markers is ignored.

    - -

    The test in the IfDefine section directive can be one - of two forms:

    - -
      -
    • parameter-name
    • - -
    • !parameter-name
    • -
    - -

    In the former case, the directives between the start and end - markers are only processed if the parameter named - parameter-name is defined. The second format reverses - the test, and only processes the directives if - parameter-name is not defined.

    - -

    The parameter-name argument is a define as given on - the httpd command line via - -Dparameter-, at the time the server was - started.

    - -

    IfDefine sections are - nest-able, which can be used to implement simple - multiple-parameter tests. Example:

    -
    -  $ httpd -DReverseProxy ...
    -
    -  # httpd.conf
    -  <IfDefine ReverseProxy>
    -  LoadModule rewrite_module modules/mod_rewrite.so
    -  LoadModule proxy_module   modules/libproxy.so
    -  </IfDefine>
    -
    - -
    -
    - - -IfModule -Encloses directives that are processed conditional on the -presence of absence of a specific module -<IfModule [!]module-name> ... - </IfModule> -server configvirtual host -directory.htaccess - - - -

    The <IfModule - test>...</IfModule> section is used to - mark directives that are conditional. The directives within an - IfModule section are only - processed if the test is true. If test is false, - everything between the start and end markers is ignored.

    - -

    The test in the IfModule section directive can be one - of two forms:

    - -
      -
    • module name
    • - -
    • !module name
    • -
    - -

    In the former case, the directives between the start and end - markers are only processed if the module named module - name is included in Apache -- either compiled in or - dynamically loaded using LoadModule. The second format - reverses the test, and only processes the directives if module - name is not included.

    - -

    The module name argument is the file name of the - module, at the time it was compiled. - For example, mod_rewrite.c.

    - -

    IfModule sections are - nest-able, which can be used to implement simple multiple-module - tests.

    -
    -
    - - -Include -Includes other configuration files from within -the server configuration files -Include file-path|directory-path -server config - - -

    This directive allows inclusion of other configuration files - from within the server configuration files.

    - -

    If Include points to a directory, rather than a - file, Apache will read all files in that directory, and any - subdirectory, and parse those as configuration files.

    - -

    The file path specified may be a fully qualified path (i.e. - starting with a slash), or may be relative to the - ServerRoot directory.

    - -

    Examples:

    - - - Include /usr/local/apache/conf/ssl.conf
    - Include /usr/local/apache/conf/vhosts/ -
    - -

    Or, providing paths relative to your ServerRoot - directory:

    - - - Include conf/ssl.conf
    - Include conf/vhosts/ -
    - -

    Make sure that an included directory does not contain any stray - files, such as editor temporary files, for example, as Apache will - attempt to read them in and use the contents as configuration - directives, which may cause the server to fail on start up. - Running apachectl configtest will give you a list of - the files that are being processed during the configuration - check:

    - -
    - root@host# apachectl configtest
    -  Processing config directory: /usr/local/apache/conf/vhosts
    -  Processing config file: /usr/local/apache/conf/vhosts/vhost1
    -  Processing config file: /usr/local/apache/conf/vhosts/vhost2
    - Syntax OK
    -
    - -

    This will help in verifying that you are getting only the files - that you intended as part of your configuration.

    -
    - -apachectl -
    - - -KeepAlive -Turns on or off HTTP persistent connections. -KeepAlive on|off -KeepAlive On -server config - - -

    The Keep-Alive extension to HTTP/1.0 and the persistent - connection feature of HTTP/1.1 provide long-lived HTTP sessions - which allow multiple requests to be sent over the same TCP - connection. In some cases this has been shown to result in an - almost 50% speedup in latency times for HTML documents with - many images. To enable Keep-Alive connections in Apache 1.2 and - later, set KeepAlive On.

    - -

    For HTTP/1.0 clients, Keep-Alive connections will only be - used if they are specifically requested by a client. In - addition, a Keep-Alive connection with an HTTP/1.0 client can - only be used when the length of the content is known in - advance. This implies that dynamic content such as CGI output, - SSI pages, and server-generated directory listings will - generally not use Keep-Alive connections to HTTP/1.0 clients. - For HTTP/1.1 clients, persistent connections are the default - unless otherwise specified. If the client requests it, chunked - encoding will be used in order to send content of unknown - length over persistent connections.

    -
    - -MaxKeepAliveRequests -
    - - -KeepAliveTimeout -Sets the amount of time the server will wait for subsequent -requests on a persistent connection -KeepAliveTimeout seconds -KeepAliveTimeout 15 -server config - - -

    The number of seconds Apache will wait for a subsequent - request before closing the connection. Once a request has been - received, the timeout value specified by the - Timeout directive applies.

    - -

    Setting KeepAliveTimeout to a high value - may cause performance problems in heavily loaded servers. The - higher the timeout, the more server processes will be kept - occupied waiting on connections with idle clients.

    -
    -
    - - -Limit -Restrict access controls to only certain HTTP -methods -<Limit method [method] ... > ... - </Limit> -server configvirtual host -directory.htaccess - - - -

    Access controls are normally effective for - all access methods, and this is the usual - desired behavior. In the general case, access control - directives should not be placed within a - limit section.

    - -

    The purpose of the Limit - directive is to restrict the effect of the access controls to the - nominated HTTP methods. For all other methods, the access - restrictions that are enclosed in the <Limit> - bracket will have no effect. The following - example applies the access control only to the methods POST, PUT, - and DELETE, leaving all other methods unprotected:

    - - - <Limit POST PUT DELETE>
    -   Require valid-user
    - </Limit>
    -
    -

    The method names listed can be one or more of: GET, POST, PUT, - DELETE, CONNECT, OPTIONS, TRACE, PATCH, PROPFIND, PROPPATCH, - MKCOL, COPY, MOVE, LOCK, and UNLOCK. The method name is - case-sensitive. If GET is used it will also restrict - HEAD requests.

    -
    -
    - - -LimitExcept -Restrict access controls to all HTTP methods -except the named ones -<LimitExcept method [method] ... > ... - </LimitExcept> -server configvirtual host -directory.htaccess - - - -

    LimitExcept and - </LimitExcept> are used to enclose a group of - access control directives which will then apply to any HTTP access - method not listed in the arguments; i.e., it is - the opposite of a Limit section and can be used to control - both standard and nonstandard/unrecognized methods. See the - documentation for Limit for more details.

    -
    -
    - - -LimitRequestBody -Restricts the total size of the HTTP request body sent -from the client -LimitRequestBody bytes -LimitRequestBody 0 -server configvirtual host -directory.htaccess - - - -

    This directive specifies the number of bytes from 0 - (meaning unlimited) to 2147483647 (2GB) that are allowed in a - request body. The default value is defined by the compile-time - constant DEFAULT_LIMIT_REQUEST_BODY (0 as - distributed).

    - -

    The LimitRequestBody directive allows - the user to set a limit on the allowed size of an HTTP request - message body within the context in which the directive is given - (server, per-directory, per-file or per-location). If the client - request exceeds that limit, the server will return an error - response instead of servicing the request. The size of a normal - request message body will vary greatly depending on the nature of - the resource and the methods allowed on that resource. CGI scripts - typically use the message body for passing form information to the - server. Implementations of the PUT method will require a value at - least as large as any representation that the server wishes to - accept for that resource.

    - -

    This directive gives the server administrator greater - control over abnormal client request behavior, which may be - useful for avoiding some forms of denial-of-service - attacks.

    -
    -
    - - -LimitRequestFields -Limits the number of HTTP request header fields that -will be accepted from the client -LimitRequestFields number -LimitRequestFields 100 -server config - - -

    Number is an integer from 0 (meaning unlimited) to - 32767. The default value is defined by the compile-time - constant DEFAULT_LIMIT_REQUEST_FIELDS (100 as - distributed).

    - -

    The LimitRequestFields directive allows - the server administrator to modify the limit on the number of - request header fields allowed in an HTTP request. A server needs - this value to be larger than the number of fields that a normal - client request might include. The number of request header fields - used by a client rarely exceeds 20, but this may vary among - different client implementations, often depending upon the extent - to which a user has configured their browser to support detailed - content negotiation. Optional HTTP extensions are often expressed - using request header fields.

    - -

    This directive gives the server administrator greater - control over abnormal client request behavior, which may be - useful for avoiding some forms of denial-of-service attacks. - The value should be increased if normal clients see an error - response from the server that indicates too many fields were - sent in the request.

    -
    -
    - - -LimitRequestFieldSize -Limits the size of the HTTP request header allowed from the -client -LimitRequestFieldsize bytes -LimitRequestFieldsize 8190 -server config - - -

    This directive specifies the number of bytes from 0 - to the value of the compile-time constant - DEFAULT_LIMIT_REQUEST_FIELDSIZE (8190 as - distributed) that will be allowed in an HTTP request - header.

    - -

    The LimitRequestFieldsize directive - allows the server administrator to reduce the limit on the allowed - size of an HTTP request header field below the normal input buffer - size compiled with the server. A server needs this value to be - large enough to hold any one header field from a normal client - request. The size of a normal request header field will vary - greatly among different client implementations, often depending - upon the extent to which a user has configured their browser to - support detailed content negotiation.

    - -

    This directive gives the server administrator greater - control over abnormal client request behavior, which may be - useful for avoiding some forms of denial-of-service attacks. - Under normal conditions, the value should not be changed from - the default.

    -
    -
    - - -LimitRequestLine -Limit the size of the HTTP request line that will be accepted -from the client -LimitRequestLine bytes -LimitRequestLine 8190 -server config - - -

    This directive sets the number of bytes from 0 to - the value of the compile-time constant - DEFAULT_LIMIT_REQUEST_LINE (8190 as distributed) - that will be allowed on the HTTP request-line.

    - -

    The LimitRequestLine directive allows - the server administrator to reduce the limit on the allowed size - of a client's HTTP request-line below the normal input buffer size - compiled with the server. Since the request-line consists of the - HTTP method, URI, and protocol version, the - LimitRequestLine directive places a - restriction on the length of a request-URI allowed for a request - on the server. A server needs this value to be large enough to - hold any of its resource names, including any information that - might be passed in the query part of a GET request.

    - -

    This directive gives the server administrator greater - control over abnormal client request behavior, which may be - useful for avoiding some forms of denial-of-service attacks. - Under normal conditions, the value should not be changed from - the default.

    -
    -
    - - -LimitXMLRequestBody -Limits the size of an XML-based request body -LimitXMLRequestBody number -LimitXMLRequestBody 1000000 -server config - - -

    Limit (in bytes) on maximum size of an XML-based request - body. A value of 0 will disable any checking.

    -
    -
    - - -Location -Applies the enclosed directives only to matching -URLs -<Location - URL-path|URL> ... </Location> -server configvirtual host - - - -

    The Location directive - provides for access control by URL. It is similar to the - Directory - directive, and starts a subsection which is terminated with a - </Location> directive. Location sections are processed in the - order they appear in the configuration file, after the Directory sections and - .htaccess files are read, and after the Files sections.

    - -

    Note that URLs do not have to line up with the filesystem at - all, it should be emphasized that <Location> operates - completely outside the filesystem.

    - -

    For all origin (non-proxy) requests, the URL to be matched - is of the form /path/, and you should not include - any http://servername prefix. For proxy requests, - the URL to be matched is of the form - scheme://servername/path, and you must include the - prefix.

    - -

    The URL may use wildcards In a wild-card string, `?' matches - any single character, and `*' matches any sequences of - characters.

    - -

    Extended regular - expressions can also be used, with the addition of the - ~ character. For example:

    - - <Location ~ "/(extra|special)/data"> - - -

    would match URLs that contained the substring "/extra/data" or - "/special/data". In Apache 1.3 and above, a new directive - LocationMatch - exists which behaves identical to the regex version of - Location.

    - -

    The Location - functionality is especially useful when combined with the - SetHandler - directive. For example, to enable status requests, but allow them - only from browsers at foo.com, you might use:

    - - <Location /status>
    - SetHandler server-status
    - Order Deny,Allow
    - Deny from all
    - Allow from .foo.com
    - </Location> -
    - -Note about / (slash)

    The slash character has -special meaning depending on where in a URL it appears. People may be -used to its behavior in the filesystem where multiple adjacent slashes -are frequently collapsed to a single slash (i.e., -/home///foo is the same as /home/foo). In -URL-space this is not necessarily true. The LocationMatch directive and the regex -version of Location require you -to explicitly specify multiple slashes if that is your intention. For -example, <LocationMatch ^/abc> would match the -request URL /abc but not the request URL -//abc. The (non-regex) Location directive behaves similarly when -used for proxy requests. But when (non-regex) Location is used for non-proxy requests it -will implicitly match multiple slashes with a single slash. For -example, if you specify <Location /abc/def> and the -request is to /abc//def then it will match.

    -
    -
    -How - Directory, Location and Files sections work for an - explanation of how these different sections are combined when a - request is received -
    - - -LocationMatch -Applies the enclosed directives only to regular-expression -matching URLs -<LocationMatch - regex> ... </Location> -server configvirtual host - - - -

    The LocationMatch directive - provides for access control by URL, in an identical manner to - Location. However, it takes a regular - expression as an argument instead of a simple string. For - example:

    - - <LocationMatch "/(extra|special)/data"> - - -

    would match URLs that contained the substring "/extra/data" - or "/special/data".

    -
    - -How - Directory, Location and Files sections work for an - explanation of how these different sections are combined when a - request is received -
    - - -LogLevel -Controls the verbosity of the ErrorLog -LogLevel level -LogLevel warn -server configvirtual host - - - -

    LogLevel adjusts the verbosity of the - messages recorded in the error logs (see ErrorLog directive). The following - levels are available, in order of decreasing - significance:

    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    Level Description
    - Example
    emerg Emergencies - system is unusable.
    - "Child cannot open lock file. Exiting"
    alert Action must be taken immediately.
    - "getpwuid: couldn't determine user name from uid"
    crit Critical Conditions.
    - "socket: Failed to get a socket, exiting child"
    error Error conditions.
    - "Premature end of script headers"
    warn Warning conditions.
    - "child process 1234 did not exit, sending another - SIGHUP"
    notice Normal but significant condition.
    - "httpd: caught SIGBUS, attempting to dump core in - ..."
    info Informational.
    - "Server seems busy, (you may need to increase - StartServers, or Min/MaxSpareServers)..."
    debug Debug-level messages
    - "Opening config file ..."
    - -

    When a particular level is specified, messages from all - other levels of higher significance will be reported as well. - E.g., when LogLevel info is specified, - then messages with log levels of notice and - warn will also be posted.

    - -

    Using a level of at least crit is - recommended.

    -
    -
    - - -MaxKeepAliveRequests -Sets the number of requests allowed on a persistent -connection -MaxKeepAliveRequests number -MaxKeepAliveRequests 100 -server config - - -

    The MaxKeepAliveRequests directive - limits the number of requests allowed per connection when - KeepAlive is on. If it is - set to "0", unlimited requests will be allowed. We - recommend that this setting be kept to a high value for maximum - server performance.

    -
    -
    - - -NameVirtualHost -Configures an IP address for name-virtual -hosting -NameVirtualHost addr[:port] -server config - - -

    The NameVirtualHost directive is a - required directive if you want to configure name-based virtual hosts.

    - -

    Although addr can be hostname it is recommended - that you always use an IP address, e.g.

    - -NameVirtualHost 111.22.33.44 - -

    With the NameVirtualHost directive you - specify the IP address on which the server will receive requests - for the name-based virtual hosts. This will usually be the address - to which your name-based virtual host names resolve. In cases - where a firewall or other proxy receives the requests and forwards - them on a different IP address to the server, you must specify the - IP address of the physical interface on the machine which will be - servicing the requests. If you have multiple name-based hosts on - multiple addresses, repeat the directive for each address.

    - -

    Note: the "main server" and any _default_ servers will - never be served for a request to a - NameVirtualHost IP Address (unless for some - reason you specify NameVirtualHost but then - don't define any VirtualHosts for that address).

    - -

    Optionally you can specify a port number on which the - name-based virtual hosts should be used, e.g.

    - -NameVirtualHost 111.22.33.44:8080 - -

    IPv6 addresses must be enclosed in square brackets, as shown - in the following example:

    - -NameVirtualHost [fe80::a00:20ff:fea7:ccea]:8080 - -
    -
    - - -Options -Configures what features are available in a particular -directory -Options - [+|-]option [[+|-]option] ... -Options All -server configvirtual host -directory.htaccess - -Options - - -

    The Options directive controls which - server features are available in a particular directory.

    - -

    option can be set to None, in which - case none of the extra features are enabled, or one or more of - the following:

    - -
    -
    All
    - -
    All options except for MultiViews. This is the default - setting.
    - -
    ExecCGI
    - -
    - Execution of CGI scripts is permitted.
    - -
    FollowSymLinks
    - -
    - - The server will follow symbolic links in this directory.
    - Note: even though the server follows the - symlink it does not change the pathname used to match - against Directory sections.
    - Note: this option gets ignored if set inside a - Location - section.
    - -
    Includes
    - -
    - Server-side includes are permitted.
    - -
    IncludesNOEXEC
    - -
    - - Server-side includes are permitted, but the #exec command and - #exec CGI are disabled. It is still possible to #include - virtual CGI scripts from ScriptAliase'd directories.
    - -
    Indexes
    - -
    - If a URL which maps to a directory is requested, and the - there is no DirectoryIndex (e.g., index.html) in - that directory, then the server will return a formatted - listing of the directory.
    - -
    MultiViews
    - -
    - Content negotiated - MultiViews are allowed.
    - -
    SymLinksIfOwnerMatch
    - -
    - - The server will only follow symbolic links for which the target - file or directory is owned by the same user id as the link.
    Note: this option gets ignored if set inside - a Location - section.
    -
    -

    Normally, if multiple Options could apply to a - directory, then the most specific one is taken complete; the - options are not merged. However if all the options on - the Options directive are preceded by a + or - - symbol, the options are merged. Any options preceded by a + are - added to the options currently in force, and any options - preceded by a - are removed from the options currently in - force.

    - -

    For example, without any + and - symbols:

    - - -<Directory /web/docs>
    - Options Indexes FollowSymLinks
    - </Directory>
    - <Directory /web/docs/spec>
    - Options Includes
    - </Directory> -
    -

    then only Includes will be set for the - /web/docs/spec directory. However if the second - Options directive uses the + and - symbols:

    - - - <Directory /web/docs>
    - Options Indexes FollowSymLinks
    - </Directory>
    - <Directory /web/docs/spec>
    - Options +Includes -Indexes
    - </Directory> -
    -

    then the options FollowSymLinks and - Includes are set for the /web/docs/spec directory.

    - - -

    Note: Using -IncludesNOEXEC or - -Includes disables server-side includes completely - regardless of the previous setting.

    - -

    The default in the absence of any other settings is - All.

    -
    -
    - - -Require -Selects which authenticated users can access -a resource -Require entity-name [entity-name] ... -directory.htaccess - -AuthConfig - - -

    This directive selects which authenticated users can access - a directory. The allowed syntaxes are:

    - -
      -
    • - Require user userid [userid] ... - -

      Only the named users can access the directory.

      -
    • - -
    • - Require group group-name [group-name] ... - - -

      Only users in the named groups can access the - directory.

      -
    • - -
    • - Require valid-user - -

      All valid users can access the directory.

      -
    • -
    - -

    Require must be accompanied by - AuthName and AuthType directives, and directives such - as AuthUserFile - and AuthGroupFile (to - define users and groups) in order to work correctly. Example:

    - - - AuthType Basic
    - AuthName "Restricted Directory"
    - AuthUserFile /web/users
    - AuthGroupFile /web/groups
    - Require group admin
    -
    - -

    Access controls which are applied in this way are effective for - all methods. This is what is normally - desired. If you wish to apply access controls only to - specific methods, while leaving other methods unprotected, then - place the Require statement into a - Limit - section.

    -
    -Satisfy -mod_access -
    - - -RLimitCPU -Limits the CPU consumption of processes launched -by Apache children -RLimitCPU number|max [number|max] -Unset; uses operating system defaults ->server configvirtual host - -Moved in version 2.0 to - the MPMs - - -

    Takes 1 or 2 parameters. The first parameter sets the soft - resource limit for all processes and the second parameter sets - the maximum resource limit. Either parameter can be a number, - or max to indicate to the server that the limit should - be set to the maximum allowed by the operating system - configuration. Raising the maximum resource limit requires that - the server is running as root, or in the initial startup - phase.

    - -

    This applies to processes forked off from Apache children - servicing requests, not the Apache children themselves. This - includes CGI scripts and SSI exec commands, but not any - processes forked off from the Apache parent such as piped - logs.

    - -

    CPU resource limits are expressed in seconds per - process.

    -
    -RLimitMEM -RLimitNPROC -
    - - -RLimitMEM -Limits the memory consumption of processes launched -by Apache children -RLimitMEM number|max [number|max] -Unset; uses operating system defaults -server configvirtual host - -Moved in version 2.0 to the MPMs. - - -

    Takes 1 or 2 parameters. The first parameter sets the soft - resource limit for all processes and the second parameter sets - the maximum resource limit. Either parameter can be a number, - or max to indicate to the server that the limit should - be set to the maximum allowed by the operating system - configuration. Raising the maximum resource limit requires that - the server is running as root, or in the initial startup - phase.

    - -

    This applies to processes forked off from Apache children - servicing requests, not the Apache children themselves. This - includes CGI scripts and SSI exec commands, but not any - processes forked off from the Apache parent such as piped - logs.

    - -

    Memory resource limits are expressed in bytes per - process.

    -
    -RLimitCPU -RLimitNPROC -
    - - -RLimitNPROC -Limits the number of processes that can be launched by -processes launched by Apache children -RLimitNPROC number|max [number|max] -Unset; uses operating system defaults -server configvirtual host - -Moved in version 2.0 to the MPMs. - - -

    Takes 1 or 2 parameters. The first parameter sets the soft - resource limit for all processes and the second parameter sets - the maximum resource limit. Either parameter can be a number, - or max to indicate to the server that the limit - should be set to the maximum allowed by the operating system - configuration. Raising the maximum resource limit requires that - the server is running as root, or in the initial startup - phase.

    - -

    This applies to processes forked off from Apache children - servicing requests, not the Apache children themselves. This - includes CGI scripts and SSI exec commands, but not any - processes forked off from the Apache parent such as piped - logs.

    - -

    Process limits control the number of processes per user.

    - -

    Note: If CGI processes are not running - under userids other than the web server userid, this directive - will limit the number of processes that the server itself can - create. Evidence of this situation will be indicated by - cannot fork messages in the - error_log.

    -
    -RLimitMEM -RLimitCPU -
    - - -Satisfy -Configures how host-level access control and user authentication -interact -Satisfy any|all -Satisfy all -directory.htaccess - - - -

    Access policy if both Allow and Require used. The parameter can be - either 'all' or 'any'. This directive is only - useful if access to a particular area is being restricted by both - username/password and client host address. In this case - the default behavior ("all") is to require that the client passes - the address access restriction and enters a valid - username and password. With the "any" option the client will be - granted access if they either pass the host restriction or enter a - valid username and password. This can be used to password restrict - an area, but to let clients from particular addresses in without - prompting for a password.

    -
    -
    - - -ScriptInterpreterSource -Controls how the interpreter for CGI scripts is -located -ScriptInterpreterSource registry|script -ScriptInterpreterSource script -directory.htaccess - -Win32 only - - -

    This directive is used to control how Apache finds the - interpreter used to run CGI scripts. The default technique is to - use the interpreter pointed to by the #! line in the - script. Setting ScriptInterpreterSource registry will - cause the Windows Registry to be searched using the script file - extension (e.g., .pl) as a search key.

    -
    -
    - - -ServerAdmin -Sets the email address that the server includes in error -messages sent to the client -ServerAdmin email-address -server configvirtual host - - - -

    The ServerAdmin sets the e-mail address - that the server includes in any error messages it returns to the - client.

    - -

    It may be worth setting up a dedicated address for this, - e.g.

    -ServerAdmin www-admin@foo.bar.com -

    as users do not always mention that they are talking about the - server!

    -
    -
    - - -ServerAlias -Sets alternate names for a host used when matching requests -to name-virtual hosts -ServerAlias hostname [hostname] ... -virtual host - - -

    The ServerAlias directive sets the - alternate names for a host, for use with name-based virtual hosts.

    - - - <VirtualHost *>
    - ServerName server.domain.com
    - ServerAlias server server2.domain.com server2
    - ...
    - </VirtualHost> -
    -
    -Apache Virtual Host documentation -
    - - -ServerName -Sets the hostname and port that the server uses to identify -itself -ServerName fully-qualified-domain-name[:port] -server configvirtual host - -In version 2.0, this - directive supersedes the functionality of the Port - directive from version 1.3. - - -

    The ServerName directive sets the hostname and - port that the server uses to identify itself. This is used when - creating redirection URLs. For example, if the name of the - machine hosting the webserver is simple.example.com, - but the machine also has the DNS alias www.example.com - and you wish the webserver to be so identified, the following - directive should be used:

    - -ServerName www.example.com:80 - -

    If no ServerName is specified, then the - server attempts to deduce the hostname by performing a reverse - lookup on the IP address. If no port is specified in the - servername, then the server will use the port from the incoming - request. For optimal reliability and predictability, you should - specify an explicit hostname and port using the - ServerName directive.

    - -

    If you are using name-based virtual hosts, - the ServerName inside a - VirtualHost - section specifies what hostname must appear in the request's - Host: header to match this virtual host.

    - -

    See the description of the - UseCanonicalName directive for - settings which determine whether self-referential URL's (e.g., by the - mod_dir module) will refer to the - specified port, or to the port number given in the client's request. -

    -
    - -DNS Issues -Apache virtual host - documentation -UseCanonicalName -NameVirtualHost -ServerAlias -
    - - -ServerPath -Sets the legacy URL pathname for a name-virtual host that -is accessed by an incompatible browser -ServerPath directory-path -virtual host - - -

    The ServerPath directive sets the legacy - URL pathname for a host, for use with name-based virtual hosts.

    -
    -Apache Virtual Host documentation -
    - - -ServerRoot -Sets the base directory for the server installation -ServerRoot directory-path -ServerRoot /usr/local/apache -server config - - -

    The ServerRoot directive sets the - directory in which the server lives. Typically it will contain the - subdirectories conf/ and logs/. Relative - paths for other configuration files are taken as relative to this - directory.

    -
    -the -d - option to httpd -the - security tips for information on how to properly set - permissions on the ServerRoot -
    - - -ServerSignature -Configures the footer on server-generated documents -ServerSignature On|Off|EMail -ServerSignature Off -server configvirtual host -directory.htaccess - - - -

    The ServerSignature directive allows the - configuration of a trailing footer line under server-generated - documents (error messages, mod_proxy ftp directory listings, - mod_info output, ...). The reason why you would want to enable - such a footer line is that in a chain of proxies, the user often - has no possibility to tell which of the chained servers actually - produced a returned error message.
    The Off - setting, which is the default, suppresses the error line (and is - therefore compatible with the behavior of Apache-1.2 and - below). The On setting simply adds a line with the - server version number and ServerName of the serving virtual host, - and the EMail setting additionally creates a - "mailto:" reference to the ServerAdmin of the referenced - document.

    -
    -
    - - -ServerTokens -Configures the Server HTTP response header -ServerTokens Minimal|ProductOnly|OS|Full -ServerTokens Full -server config - - -

    This directive controls whether Server response - header field which is sent back to clients includes a - description of the generic OS-type of the server as well as - information about compiled-in modules.

    - -
    -
    ServerTokens Prod[uctOnly]
    - -
    Server sends (e.g.): Server: - Apache
    - -
    ServerTokens Min[imal]
    - -
    Server sends (e.g.): Server: - Apache/1.3.0
    - -
    ServerTokens OS
    - -
    Server sends (e.g.): Server: Apache/1.3.0 - (Unix)
    - -
    ServerTokens Full (or not specified)
    - -
    Server sends (e.g.): Server: Apache/1.3.0 - (Unix) PHP/3.0 MyMod/1.2
    -
    - -

    This setting applies to the entire server, and cannot be - enabled or disabled on a virtualhost-by-virtualhost basis.

    -
    -
    - - -SetHandler -Forces all matching files to be processed by a -handler -SetHandler handler-name -server configvirtual host -directory.htaccess - -Moved into the core in Apache 2.0 - - -

    When placed into an .htaccess file or a - Directory or - Location - section, this directive forces all matching files to be parsed - through the handler given by - handler-name. For example, if you had a directory you - wanted to be parsed entirely as imagemap rule files, regardless - of extension, you might put the following into an - .htaccess file in that directory:

    - - SetHandler imap-file - - -

    Another example: if you wanted to have the server display a - status report whenever a URL of - http://servername/status was called, you might put - the following into httpd.conf:

    - - <Location /status>
    - SetHandler server-status
    - </Location> -
    -
    -
    - - -SetInputFilter -Sets the filters that will process client requests and POST -input -SetInputFilter filter[;filter...] -server configvirtual host -directory.htaccess - - - -

    The SetInputFilter directive sets the - filter or filters which will process client requests and POST - input when they are received by the server. This is in addition to - any filters defined elsewhere, including the - AddInputFilter - directive.

    - -

    If more than one filter is specified, they must be separated - by semicolons in the order in which they should process the - content.

    -
    -Filters documentation -
    - - -SetOutputFilter -Sets the filters that will process responses from the -server -SetOutputFilter filter [filter] ... -server configvirtual host -directory.htaccess - - - -

    The SetOutputFilter directive sets the filters - which will process responses from the server before they are - sent to the client. This is in addition to any filters defined - elsewhere, including the - AddOutputFilter - directive.

    - -

    For example, the following configuration will process all files - in the /www/data/ directory for server-side - includes.

    - -<Directory /www/data/>
    -  SetOutputFilter INCLUDES
    -</Directory> -
    - -

    If more than one filter is specified, they must be separated - by semicolons in the order in which they should process the - content.

    -
    -Filters documentation -
    - - -TimeOut -Defines the amount of time the server will wait for -certain events before failing a request -TimeOut number -TimeOut 300 -server config - - -

    The TimeOut directive currently defines - the amount of time Apache will wait for three things:

    - -
      -
    1. The total amount of time it takes to receive a GET - request.
    2. - -
    3. The amount of time between receipt of TCP packets on a - POST or PUT request.
    4. - -
    5. The amount of time between ACKs on transmissions of TCP - packets in responses.
    6. -
    - -

    We plan on making these separately configurable at some point - down the road. The timer used to default to 1200 before 1.2, - but has been lowered to 300 which is still far more than - necessary in most situations. It is not set any lower by - default because there may still be odd places in the code where - the timer is not reset when a packet is sent.

    -
    -
    - - -UseCanonicalName -Configures how the server determines its own name and -port -UseCanonicalName on|off|dns -UseCanonicalName on -server configvirtual host -directory.htaccess -Options - - -

    In many situations Apache has to construct a - self-referential URL. That is, a URL which refers back to - the same server. With UseCanonicalName on Apache will - use the hostname and port specified in the ServerName directive to construct a canonical - name for the server. This name is used in all self-referential - URLs, and for the values of SERVER_NAME and - SERVER_PORT in CGIs.

    - -

    With UseCanonicalName off Apache will form - self-referential URLs using the hostname and port supplied by - the client if any are supplied (otherwise it will use the - canonical name). These values are the same that are used to - implement name based - virtual hosts, and are available with the same clients. The - CGI variables SERVER_NAME and - SERVER_PORT will be constructed from the client - supplied values as well.

    - -

    An example where this may be useful is on an intranet server - where you have users connecting to the machine using short - names such as www. You'll notice that if the users - type a shortname, and a URL which is a directory, such as - http://www/splat, without the trailing - slash then Apache will redirect them to - http://www.domain.com/splat/. If you have - authentication enabled, this will cause the user to have to - reauthenticate twice (once for www and once again - for www.domain.com). But if - UseCanonicalName is set off, then Apache will - redirect to http://www/splat/.

    - -

    There is a third option, UseCanonicalName DNS, - which is intended for use with mass IP-based virtual hosting to - support ancient clients that do not provide a - Host: header. With this option Apache does a - reverse DNS lookup on the server IP address that the client - connected to in order to work out self-referential URLs.

    - -

    Warning: if CGIs make assumptions about the - values of SERVER_NAME they may be broken by this - option. The client is essentially free to give whatever value - they want as a hostname. But if the CGI is only using - SERVER_NAME to construct self-referential URLs - then it should be just fine.

    -
    -ServerName -Listen -
    - - -VirtualHost -Contains directives that apply only to a specific -hostname or IP address -<VirtualHost - addr[:port] [addr[:port]] - ...> ... </VirtualHost> -server config - - -

    VirtualHost and - </VirtualHost> are used to enclose a group of - directives which will apply only to a particular virtual host. Any - directive which is allowed in a virtual host context may be - used. When the server receives a request for a document on a - particular virtual host, it uses the configuration directives - enclosed in the VirtualHost - section. Addr can be

    - -
      -
    • The IP address of the virtual host
    • - -
    • A fully qualified domain name for the IP address of the - virtual host.
    • -
    - Example: - -<VirtualHost 10.1.2.3>
    - ServerAdmin webmaster@host.foo.com
    - DocumentRoot /www/docs/host.foo.com
    - ServerName host.foo.com
    - ErrorLog logs/host.foo.com-error_log
    - TransferLog logs/host.foo.com-access_log
    - </VirtualHost> -
    - - -

    IPv6 addresses must be specified in square brackets because - the optional port number could not be determined otherwise. An - IPv6 example is shown below:

    - - -<VirtualHost [fe80::a00:20ff:fea7:ccea]>
    - ServerAdmin webmaster@host.foo.com
    - DocumentRoot /www/docs/host.foo.com
    - ServerName host.foo.com
    - ErrorLog logs/host.foo.com-error_log
    - TransferLog logs/host.foo.com-access_log
    - </VirtualHost> -
    - -

    Each Virtual Host must correspond to a different IP address, - different port number or a different host name for the server, - in the former case the server machine must be configured to - accept IP packets for multiple addresses. (If the machine does - not have multiple network interfaces, then this can be - accomplished with the ifconfig alias command (if - your OS supports it), or with kernel patches like VIF (for SunOS(TM) 4.1.x)).

    - -

    The special name _default_ can be specified in - which case this virtual host will match any IP address that is - not explicitly listed in another virtual host. In the absence - of any _default_ virtual host the "main" server config, - consisting of all those definitions outside any VirtualHost - section, is used when no match occurs.

    - -

    You can specify a :port to change the port that is - matched. If unspecified then it defaults to the same port as the - most recent Listen - statement of the main server. You may also specify :* - to match all ports on that address. (This is recommended when used - with _default_.)

    - -

    SECURITY: See the security tips document - for details on why your security could be compromised if the - directory where logfiles are stored is writable by anyone other - than the user that starts the server.

    - -

    NOTE: The use of VirtualHost does not - affect what addresses Apache listens on. You may need to ensure - that Apache is listening on the correct addresses using Listen.

    -
    -Apache Virtual Host documentation -Warnings about DNS and - Apache -Setting - which addresses and ports Apache uses -How - Directory, Location and Files sections work for an - explanation of how these different sections are combined when a - request is received -
    - -
    \ No newline at end of file diff --git a/docs/manual/mod/directive-dict.html b/docs/manual/mod/directive-dict.html deleted file mode 100644 index 780ac3a62705fc19235832540f4af3959a87fe88..0000000000000000000000000000000000000000 --- a/docs/manual/mod/directive-dict.html +++ /dev/null @@ -1,262 +0,0 @@ - - - - Definitions of terms used to describe Apache directives - - - - - -

    Terms Used to Describe Apache Directives

    - -

    - Each Apache configuration directive is described using a common format - that looks like this: -

    -
    -
    Syntax: directive-name some args -
    - Default: - directive-name default-value -
    - Context: context-list -
    - Override: override -
    - Status: status -
    - Module: module-name -
    - Compatibility: compatibility notes -
    -
    -

    - Each of the directive's attributes, complete with possible values - where possible, are described in this document. -

    - -

    Directive Terms

    - - -
    -

    Syntax

    -

    - This indicates the format of the directive as it would appear in a - configuration file. This syntax is extremely directive-specific, so - refer to the text of the directive's description for details. -

    - -
    -

    Default

    -

    - If the directive has a default value (i.e., if you omit it - from your configuration entirely, the Apache Web server will behave as - though you set it to a particular value), it is described here. If - there is no default value, this section should say - "None". -

    - -
    -

    Context

    -

    - This indicates where in the server's configuration files the directive - is legal. It's a comma-separated list of one or more of the following - values: -

    -
    -
    server config -
    -
    This means that the directive may be used in the server - configuration files (e.g., httpd.conf, - srm.conf, and access.conf), but - not within any <VirtualHost> or - <Directory> containers. It is not allowed in - .htaccess files at all. -

    -

    -
    -
    virtual host -
    -
    This context means that the directive may appear inside - <VirtualHost> containers in the server - configuration files. -

    -

    -
    -
    directory -
    -
    A directive marked as being valid in this context may be used - inside <Directory> containers in the server - configuration files. -

    -

    -
    -
    .htaccess -
    -
    If a directive is valid in this context, it means that it can - appear inside per-directory .htaccess files. - It may not be processed, though depending upon the - overrides - currently active. -

    -

    -
    -
    -

    - The directive is only allowed within the designated context; - if you try to use it elsewhere, you'll get a configuration error that - will either prevent the server from handling requests in that context - correctly, or will keep the server from operating at all -- - i.e., the server won't even start. -

    -

    - The valid locations for the directive are actually the result of a - Boolean OR of all of the listed contexts. In other words, a directive - that is marked as being valid in "server config, - .htaccess" can be used in the httpd.conf file - and in .htaccess files, but not within any - <Directory> or <VirtualHost> containers. -

    - -
    -

    Override

    -

    - This directive attribute indicates which configuration override must - be active in order for the directive to be processed when it appears - in a .htaccess file. If the directive's - context - doesn't permit it to appear in .htaccess files, this - attribute should say "Not applicable". -

    -

    - Overrides are activated by the - AllowOverrides - directive, and apply to a particular scope (such as a directory) and - all descendants, unless further modified by other - AllowOverrides directives at lower levels. The - documentation for that directive also lists the possible override - names available. -

    - -
    -

    Status

    -

    - This indicates how tightly bound into the Apache Web server the - directive is; in other words, you may need to recompile the server - with an enhanced set of modules in order to gain access to the - directive and its functionality. Possible values for this attribute - are: -

    -
    -
    Core -
    -
    If a directive is listed as having "Core" status, that - means it is part of the innermost portions of the Apache Web server, - and is always available. -

    -

    -
    -
    Base -
    -
    A directive labeled as having "Base" status is - supported by one of the standard Apache modules which is compiled - into the server by default, and is therefore normally available - unless you've taken steps to remove the module from your configuration. -

    -

    -
    -
    Extension -
    -
    A directive with "Extension" status is provided by one - of the modules included with the Apache server kit, but the module - isn't normally compiled into the server. To enable the directive - and its functionality, you will need to change the server build - configuration files and re-compile Apache. -

    -

    -
    -
    Experimental -
    -
    "Experimental" status indicates that the directive is - available as part of the Apache kit, but you're on your own if you - try to use it. The directive is being documented for completeness, - and is not necessarily supported. The module which provides the - directive may or may not be compiled in by default; check the top of - the page which describes the directive and its module to see if it - remarks on the availability. -

    -

    -
    -
    - -
    -

    Module

    -

    - This quite simply lists the name of the source module which defines - the directive. -

    - -
    -

    Compatibility

    -

    - If the directive wasn't part of the original Apache version 1 - distribution, the version in which it was introduced should be listed - here. If the directive has the same name as one from the NCSA HTTPd - server, any inconsistencies in behaviour between the two should also - be mentioned. Otherwise, this attribute should say "No - compatibility issues." -

    - - - diff --git a/docs/manual/mod/directive-dict.html.en b/docs/manual/mod/directive-dict.html.en deleted file mode 100644 index 780ac3a62705fc19235832540f4af3959a87fe88..0000000000000000000000000000000000000000 --- a/docs/manual/mod/directive-dict.html.en +++ /dev/null @@ -1,262 +0,0 @@ - - - - Definitions of terms used to describe Apache directives - - - - - -

    Terms Used to Describe Apache Directives

    - -

    - Each Apache configuration directive is described using a common format - that looks like this: -

    -
    -
    Syntax: directive-name some args -
    - Default: - directive-name default-value -
    - Context: context-list -
    - Override: override -
    - Status: status -
    - Module: module-name -
    - Compatibility: compatibility notes -
    -
    -

    - Each of the directive's attributes, complete with possible values - where possible, are described in this document. -

    - -

    Directive Terms

    - - -
    -

    Syntax

    -

    - This indicates the format of the directive as it would appear in a - configuration file. This syntax is extremely directive-specific, so - refer to the text of the directive's description for details. -

    - -
    -

    Default

    -

    - If the directive has a default value (i.e., if you omit it - from your configuration entirely, the Apache Web server will behave as - though you set it to a particular value), it is described here. If - there is no default value, this section should say - "None". -

    - -
    -

    Context

    -

    - This indicates where in the server's configuration files the directive - is legal. It's a comma-separated list of one or more of the following - values: -

    -
    -
    server config -
    -
    This means that the directive may be used in the server - configuration files (e.g., httpd.conf, - srm.conf, and access.conf), but - not within any <VirtualHost> or - <Directory> containers. It is not allowed in - .htaccess files at all. -

    -

    -
    -
    virtual host -
    -
    This context means that the directive may appear inside - <VirtualHost> containers in the server - configuration files. -

    -

    -
    -
    directory -
    -
    A directive marked as being valid in this context may be used - inside <Directory> containers in the server - configuration files. -

    -

    -
    -
    .htaccess -
    -
    If a directive is valid in this context, it means that it can - appear inside per-directory .htaccess files. - It may not be processed, though depending upon the - overrides - currently active. -

    -

    -
    -
    -

    - The directive is only allowed within the designated context; - if you try to use it elsewhere, you'll get a configuration error that - will either prevent the server from handling requests in that context - correctly, or will keep the server from operating at all -- - i.e., the server won't even start. -

    -

    - The valid locations for the directive are actually the result of a - Boolean OR of all of the listed contexts. In other words, a directive - that is marked as being valid in "server config, - .htaccess" can be used in the httpd.conf file - and in .htaccess files, but not within any - <Directory> or <VirtualHost> containers. -

    - -
    -

    Override

    -

    - This directive attribute indicates which configuration override must - be active in order for the directive to be processed when it appears - in a .htaccess file. If the directive's - context - doesn't permit it to appear in .htaccess files, this - attribute should say "Not applicable". -

    -

    - Overrides are activated by the - AllowOverrides - directive, and apply to a particular scope (such as a directory) and - all descendants, unless further modified by other - AllowOverrides directives at lower levels. The - documentation for that directive also lists the possible override - names available. -

    - -
    -

    Status

    -

    - This indicates how tightly bound into the Apache Web server the - directive is; in other words, you may need to recompile the server - with an enhanced set of modules in order to gain access to the - directive and its functionality. Possible values for this attribute - are: -

    -
    -
    Core -
    -
    If a directive is listed as having "Core" status, that - means it is part of the innermost portions of the Apache Web server, - and is always available. -

    -

    -
    -
    Base -
    -
    A directive labeled as having "Base" status is - supported by one of the standard Apache modules which is compiled - into the server by default, and is therefore normally available - unless you've taken steps to remove the module from your configuration. -

    -

    -
    -
    Extension -
    -
    A directive with "Extension" status is provided by one - of the modules included with the Apache server kit, but the module - isn't normally compiled into the server. To enable the directive - and its functionality, you will need to change the server build - configuration files and re-compile Apache. -

    -

    -
    -
    Experimental -
    -
    "Experimental" status indicates that the directive is - available as part of the Apache kit, but you're on your own if you - try to use it. The directive is being documented for completeness, - and is not necessarily supported. The module which provides the - directive may or may not be compiled in by default; check the top of - the page which describes the directive and its module to see if it - remarks on the availability. -

    -

    -
    -
    - -
    -

    Module

    -

    - This quite simply lists the name of the source module which defines - the directive. -

    - -
    -

    Compatibility

    -

    - If the directive wasn't part of the original Apache version 1 - distribution, the version in which it was introduced should be listed - here. If the directive has the same name as one from the NCSA HTTPd - server, any inconsistencies in behaviour between the two should also - be mentioned. Otherwise, this attribute should say "No - compatibility issues." -

    - - - diff --git a/docs/manual/mod/directives.html b/docs/manual/mod/directives.html deleted file mode 100644 index 3e55089f5353851ec892cfba4435e7f9304becd3..0000000000000000000000000000000000000000 --- a/docs/manual/mod/directives.html +++ /dev/null @@ -1,121 +0,0 @@ - - - -Apache directives - - - - -

    Apache directives

    - - - - - - diff --git a/docs/manual/mod/directives.xml b/docs/manual/mod/directives.xml deleted file mode 100644 index 6ef8220c07a5332113a925bdd27ab4b2f026f3ca..0000000000000000000000000000000000000000 --- a/docs/manual/mod/directives.xml +++ /dev/null @@ -1,17 +0,0 @@ - - -]> - - - -Directive Index - -

    Each Apache directive available in the standard Apache - distribution is listed here. They are described using a - consistent format, and there is a dictionary of the terms used in their - descriptions available.

    -
    -&allmodules; -
    \ No newline at end of file diff --git a/docs/manual/mod/index.html b/docs/manual/mod/index.html deleted file mode 100644 index 6a4fcfd1a5aca1bd553cffeef1d275b581a921cb..0000000000000000000000000000000000000000 --- a/docs/manual/mod/index.html +++ /dev/null @@ -1,78 +0,0 @@ - - - -Apache modules - - - - -

    Apache modules

    - -
    -
    Core -
    Core Apache features. -
    mod_access -
    Host based access control. -
    mod_actions Apache 1.1 and later. -
    Filetype/method-based script execution -
    mod_alias -
    Aliase and redirects. -
    mod_asis -
    The .asis file handler. -
    mod_auth -
    User authentication using text files. -
    mod_auth_anon -
    Anonymous user authentication, FTP-style. -
    mod_auth_db -
    User authentication using Berkeley DB files. -
    mod_auth_dbm -
    User authentication using DBM files. -
    mod_auth_msql -
    User authentication using mSQL files. -
    mod_cern_meta -
    Support for HTTP header metafiles. -
    mod_cgi -
    Invoking CGI scripts. -
    mod_cookies -
    Support for Netscape-like cookies. -
    mod_digest -
    MD5 authentication -
    mod_dir -
    Automatic directory listings. -
    mod_env -
    Passing of environments to CGI scripts -
    mod_dld -
    Start-time linking with the GNU libdld. -
    mod_imap -
    The imagemap file handler. -
    mod_include -
    Server-parsed documents. -
    mod_info -
    Server configuration information -
    mod_log_agent -
    Logging of User Agents. -
    mod_log_common -
    Standard logging in the Common Logfile Format. -
    mod_log_config -
    User-configurable logging replacement for mod_log_common. -
    mod_log_referer -
    Logging of document references. -
    mod_mime -
    Determining document types. -
    mod_negotiation -
    Content negotation. -
    mod_proxy -
    Caching proxy abilities -
    mod_status -
    Server status display -
    mod_userdir -
    User home directories. -
    - -
    - -Home -Index - - - diff --git a/docs/manual/mod/index.xml b/docs/manual/mod/index.xml deleted file mode 100644 index a509c2eb0d34935d20b93a92ac691b9a0dd225d0..0000000000000000000000000000000000000000 --- a/docs/manual/mod/index.xml +++ /dev/null @@ -1,18 +0,0 @@ - - -]> - - - -Module Index - - -

    Below is a list of all of the modules that come as part of - the Apache distribution. See also the complete - alphabetical list of all Apache - directives.

    - -
    -&allmodules; -
    \ No newline at end of file diff --git a/docs/manual/mod/mod_actions.html b/docs/manual/mod/mod_actions.html deleted file mode 100644 index 297df17ba86c6902fdb2e107ff1c69081811353e..0000000000000000000000000000000000000000 --- a/docs/manual/mod/mod_actions.html +++ /dev/null @@ -1,81 +0,0 @@ - - - -Apache module mod_actions - - - - -

    Apache module mod_actions

    - -This module is contained in the mod_actions.c file, and -is compiled in by default. It provides for -executing CGI scripts based on media type or request method. It is not -present in versions prior to Apache 1.1. - -

    Summary

    - -This module lets you run CGI scripts whenever a file of a certain type -is requested. This makes it much easier to execute scripts that -process files. - -

    Directives

    - - -
    - -

    Action

    -Syntax: Action mime-type cgi-script
    -Context: server config, virutal host, directory, .htaccess
    -Override: FileInfo
    -Status: Base
    -Module: mod_actions
    -Compatibility: Action is only available in Apache 1.1 -and later

    - -This directive adds an action, which will activate cgi-script when -a file of content type mime-type is requested. It sends the -URL and file path of the requested document using the standard -CGI PATH_INFO and PATH_TRANSLATED environment variables. - -


    - -

    Script

    -Syntax: Script method cgi-script
    -Context: server config, virutal host, directory
    -Status: Base
    -Module: mod_actions
    -Compatibility: Script is only available in Apache 1.1 -and later

    - -

    This directive adds an action, which will activate cgi-script when -a file is requested using the method of method, which can be -one of GET, POST, PUT or -DELETE. It sends the -URL and file path of the requested document using the standard -CGI PATH_INFO and PATH_TRANSLATED environment variables. - -

    Note that the Script command defines default actions only. If a CGI -script is called, or some other resource that is capable of handling -the requested method internally, it will do so. Also note that script -with a method of GET will only be called if there are -query arguments present (e.g. foo.html?hi). Otherwise, the request -will proceed normally. - -

    Examples: -

    -    Script GET /cgi-bin/search     #e.g. for <ISINDEX>-style searching
    -    Script PUT /~bob/put.cgi
    -
    - -


    - -Home -Index - - - - diff --git a/docs/manual/mod/mod_actions.xml b/docs/manual/mod/mod_actions.xml deleted file mode 100644 index e702dbe13490518329e4f8b16afdc44937e26206..0000000000000000000000000000000000000000 --- a/docs/manual/mod/mod_actions.xml +++ /dev/null @@ -1,115 +0,0 @@ - - ]> - - - -mod_actions - -This module provides for executing CGI scripts based on -media type or request method. - -Base -mod_actions.c -actions_module - - -

    This module has two directives. The Action directive lets you run CGI - scripts whenever a file of a certain type is requested. The - Script directive lets - you run CGI scripts whenever a particular method is used in a - request. This makes it much easier to execute scripts that process - files.

    -
    - - - -Action - -Activates a CGI script for a particular handler or -content-type - -Action action-type cgi-script - -server configvirtual host -directory.htaccess - -FileInfo - - -

    This directive adds an action, which will activate - cgi-script when action-type is triggered by - the request. The action-type can be either a handler or a MIME content type. It - sends the URL and file path of the requested document using the - standard CGI PATH_INFO and PATH_TRANSLATED environment - variables.

    - - -Examples - - # Requests for files of a particular type:
    - Action image/gif /cgi-bin/images.cgi
    -
    - # Files of a particular file extension
    - AddHandler my-file-type .xyz
    - Action my-file-type /cgi-bin/program.cgi
    -
    - -

    In the first example, requests for files with a MIME content - type of image/gif will instead be handled by the - specified cgi script /cgi-bin/images.cgi.

    - -

    In the second example, requests for files with a file extension of - .xyz are handled instead by the specified cgi script - /cgi-bin/program.cgi.

    -
    - -AddHandler - -
    - - - -Script - -Activates a CGI script for a particular request -method. - Script method cgi-script - -server configvirtual host -directory - -

    This directive adds an action, which will activate - cgi-script when a file is requested using the method of - method. It sends the URL and file path of the requested - document using the standard CGI PATH_INFO and PATH_TRANSLATED - environment variables.

    - - - Any arbitrary method name may be used. Method names are - case-sensitive, so Script PUT and - Script put have two entirely different - effects. - - -

    Note that the Script command defines default actions only. - If a CGI script is called, or some other resource that is - capable of handling the requested method internally, it will do - so. Also note that Script with a method of GET - will only be called if there are query arguments present - (e.g., foo.html?hi). Otherwise, the request will - proceed normally.

    - - -Examples - # For <ISINDEX>-style searching
    - Script GET /cgi-bin/search
    - # A CGI PUT handler
    - Script PUT /~bob/put.cgi
    -
    -
    - -
    - -
    \ No newline at end of file diff --git a/docs/manual/mod/mod_alias.html b/docs/manual/mod/mod_alias.html deleted file mode 100644 index f217051c9543b742eaaa919dba8289145560dc5e..0000000000000000000000000000000000000000 --- a/docs/manual/mod/mod_alias.html +++ /dev/null @@ -1,93 +0,0 @@ - - - - -Apache module mod_alias - - - - - -

    Module mod_alias

    - -This module is contained in the mod_alias.c file, and -is compiled in by default. It provides for mapping different parts of the -host filesystem in the the document tree, and for URL redirection. - - - -
  • Alias -
  • Redirect -
  • ScriptAlias -
  • -
    - - -

    Alias

    - -Syntax: Alias url-path directory-filename
    -Context: server config, virtual host
    -Status: Base
    -Module: mod_alias
    -Compatibility: Alias is only available in Apache 1.1 -and later

    - -The Alias directive allows documents to be stored in the local filesystem -other than under the DocumentRoot. -URLs with a (%-decoded) path beginning with url-path will be -mapped to local files beginning with directory-filename. -Example: -

    Alias /image /ftp/pub/image
    -A request for http://myserver/image/foo.gif would cause the server to -return the file /ftp/pub/image/foo.gif.

    -See also ScriptAlias.


    - -

    Redirect

    - -Syntax: Redirect url-path url
    -Context: server config, virtual host, directory, .htaccess
    -Status: Base
    -Module: mod_alias
    -Compatibility: The directory and .htaccess context's -are only available in versions 1.1 and later

    - -The Redirect directive maps an old URL into a new one. The new URL is returned -to the client which attempts to fetch it again with the new address. -Url-path a (%-decoded) path; any requests for documents beginning with -this path will be returned a redirect error to a new (%-encoded) url -beginning with url. Example: -

    Redirect /service -http://foo2.bar.com/service
    -If the client requests http://myserver/service/foo.txt, it will be told to -access http://foo2.bar.com/service/foo.txt instead.

    -Note: Redirect directives take precedence over Alias and ScriptAlias -directives, irrespective of their ordering in the configuration file.


    - -

    ScriptAlias

    - -Syntax: ScriptAlias url-path directory-filename
    -Context: server config, virtual host
    -Status: Base
    -Module: mod_alias
    -Compatibility: ScriptAlias is only available in Apache 1.1 -and later

    - -The ScriptAlias directive has the same behaviour as the -Alias directive, except that in addition it -marks the target directory as containing CGI scripts. -URLs with a (%-decoded) path beginning with url-path will be -mapped to scripts beginning with directory-filename. -Example: -

    ScriptAlias /cgi-bin/ /web/cgi-bin/
    -A request for http://myserver/cgi-bin/foo would cause the server to -run the script /web/cgi-bin/foo.

    - - -


    - -Home -Index - - - - diff --git a/docs/manual/mod/mod_alias.xml b/docs/manual/mod/mod_alias.xml deleted file mode 100644 index 84db11dc1c4365aefbc57cfbae5a6f5a6347db65..0000000000000000000000000000000000000000 --- a/docs/manual/mod/mod_alias.xml +++ /dev/null @@ -1,279 +0,0 @@ - - - - -mod_alias -Provides for mapping different parts of the host - filesystem in the document tree and for URL redirection -Base -mod_alias.c -alias_module - - -

    The directives contained in this module allow for manipulation - and control of URLs as requests arrive at the server. The - Alias and ScriptAlias directives are used to - map between URLs and filesystem paths. This allows for content - which is not directly under the DocumentRoot served as part of the web - document tree. The ScriptAlias directive has the - additional effect of marking the target directory as containing - only CGI scripts.

    - -

    The Redirect - directives are used to instruct clients to make a new request with - a different URL. They are often used when a resource has moved to - a new location.

    - -

    A more powerful and flexible set of directives for - manipulating URLs is contained in the mod_rewrite - module.

    -
    - - -Alias -Maps URLs to filesystem locations - Alias URL-path - file-path|directory-path -server configvirtual host - - - - -

    The Alias directive allows documents to - be stored in the local filesystem other than under the - DocumentRoot. URLs with a - (%-decoded) path beginning with url-path will be mapped - to local files beginning with directory-filename.

    - -

    Example:

    - -Alias /image /ftp/pub/image - -

    A request for http://myserver/image/foo.gif would cause the - server to return the file /ftp/pub/image/foo.gif.

    - -

    Note that if you include a trailing / on the - url-path then the server will require a trailing / in - order to expand the alias. That is, if you use Alias - /icons/ /usr/local/apache/icons/ then the url - /icons will not be aliased.

    - -

    Note that you may need to specify additional <Directory> sections which cover - the destination of aliases. Aliasing occurs before - <Directory> sections - are checked, so only the destination of aliases are affected. - (Note however <Location> - sections are run through once before aliases are performed, so - they will apply.)

    - -
    -
    - - -AliasMatch -Maps URLs to filesystem locations using regular -expressions -AliasMatch regex - file-path|directory-path -server configvirtual host - - - -

    This directive is equivalent to Alias, but makes use of standard - regular expressions, instead of simple prefix matching. The - supplied regular expression is matched against the URL-path, and - if it matches, the server will substitute any parenthesized - matches into the given string and use it as a filename. For - example, to activate the /icons directory, one might - use:

    - - AliasMatch ^/icons(.*) /usr/local/apache/icons$1 - -
    -
    - - -Redirect -Sends an external redirect asking the client to fetch -a different URL -Redirect [status] URL-path URL -server configvirtual host -directory.htaccess -FileInfo - - -

    The Redirect directive maps an old URL into a new one. The - new URL is returned to the client which attempts to fetch it - again with the new address. URL-path a (%-decoded) - path; any requests for documents beginning with this path will - be returned a redirect error to a new (%-encoded) URL beginning - with URL.

    - -

    Example:

    - -Redirect /service http://foo2.bar.com/service - -

    If the client requests http://myserver/service/foo.txt, it - will be told to access http://foo2.bar.com/service/foo.txt - instead.

    - -Note

    Redirect directives take precedence over -Alias and ScriptAlias directives, irrespective of their ordering in -the configuration file. Also, URL-path must be an absolute -path, not a relative path, even when used with .htaccess files or -inside of <Directory> -sections.

    - -

    If no status argument is given, the redirect will - be "temporary" (HTTP status 302). This indicates to the client - that the resource has moved temporarily. The status - argument can be used to return other HTTP status codes:

    - -
    -
    permanent
    - -
    Returns a permanent redirect status (301) indicating that - the resource has moved permanently.
    - -
    temp
    - -
    Returns a temporary redirect status (302). This is the - default.
    - -
    seeother
    - -
    Returns a "See Other" status (303) indicating that the - resource has been replaced.
    - -
    gone
    - -
    Returns a "Gone" status (410) indicating that the - resource has been permanently removed. When this status is - used the url argument should be omitted.
    -
    - -

    Other status codes can be returned by giving the numeric - status code as the value of status. If the status is - between 300 and 399, the url argument must be present, - otherwise it must be omitted. Note that the status must be - known to the Apache code (see the function - send_error_response in http_protocol.c).

    -
    -
    - - -RedirectMatch -Sends an external redirect asking the client to fetch -a different URL based on a regular expression match of the -current URL -RedirectMatch [status] regex URL -server configvirtual host -directory.htaccess -FileInfo - - -

    This directive is equivalent to Redirect, but makes use of standard - regular expressions, instead of simple prefix matching. The - supplied regular expression is matched against the URL-path, and - if it matches, the server will substitute any parenthesized - matches into the given string and use it as a filename. For - example, to redirect all GIF files to like-named JPEG files on - another server, one might use:

    - - RedirectMatch (.*)\.gif$ http://www.anotherserver.com$1.jpg - -
    -
    - - -RedirectTemp -Sends an external temporary redirect asking the client to fetch -a different URL -RedirectTemp URL-path URL -server configvirtual host -directory.htaccess -FileInfo - - -

    This directive makes the client know that the Redirect is - only temporary (status 302). Exactly equivalent to - Redirect temp.

    -
    -
    - - -RedirectPermanent -Sends an external permanent redirect asking the client to fetch -a different URL -RedirectPermanent URL-path URL -server configvirtual host -directory.htaccess -FileInfo - - -

    This directive makes the client know that the Redirect is - permanent (status 301). Exactly equivalent to Redirect - permanent.

    -
    -
    - - -ScriptAlias -Maps a URL to a filesystem location and designates the -target as a CGI script -ScriptAlias -URL-path file-path|directory-path -server configvirtual host - - - -

    The ScriptAlias directive has the same - behavior as the Alias - directive, except that in addition it marks the target directory - as containing CGI scripts that will be processed by mod_cgi's cgi-script handler. URLs with a - (%-decoded) path beginning with URL-path will be mapped - to scripts beginning with the second argument which is a full - pathname in the local filesystem.

    - -

    Example:

    - -ScriptAlias /cgi-bin/ /web/cgi-bin/ - -

    A request for http://myserver/cgi-bin/foo would cause the - server to run the script /web/cgi-bin/foo.

    -
    -
    - - -ScriptAliasMatch -Maps a URL to a filesystem location using a regular expression -and designates the target as a CGI script -ScriptAliasMatch -regex file-path|directory-path -server configvirtual host - - - -

    This directive is equivalent to ScriptAlias, but makes use of standard - regular expressions, instead of simple prefix matching. The - supplied regular expression is matched against the URL-path, - and if it matches, the server will substitute any parenthesized - matches into the given string and use it as a filename. For - example, to activate the standard /cgi-bin, one - might use:

    - - ScriptAliasMatch ^/cgi-bin(.*) /usr/local/apache/cgi-bin$1 - -
    -
    - -
    - diff --git a/docs/manual/mod/mod_asis.html b/docs/manual/mod/mod_asis.html deleted file mode 100644 index 3597e1618fb42449885589a19a395978cba42a9c..0000000000000000000000000000000000000000 --- a/docs/manual/mod/mod_asis.html +++ /dev/null @@ -1,67 +0,0 @@ - - - - -Apache module mod_asis - - - - - -

    Module mod_asis

    - -This module is contained in the mod_asis.c file, and -is compiled in by default. It provides for .asis files. Any -document with mime type httpd/send-as-is will be processed by -this module. - - -

    Purpose

    -To allow file types to be defined such that Apache sends them without -adding HTTP headers.

    - -This can be used to send any kind of data from the server, including redirects -and other special HTTP responses, without requiring a cgi-script or an nph -script. -

    Usage

    -In the server configuration file, define a new mime type called -httpd/send-as-is e.g. -
    AddType httpd/send-as-is asis
    -this defines the .asis file extension as being of the new -httpd/send-as-is mime type. The contents of any file with a -.asis extension will then be sent by Apache to the client with -almost no changes. Clients will need HTTP headers to be attached, so do not -forget them. A Status: header is also required; the data should be the -3-digit HTTP response code, followed by a textual message.

    - -Here's an example of a file whose contents are sent as is so as to -tell the client that a file has redirected. -

    -Status: 302 Now where did I leave that URL
    -Location: http://xyz.abc.com/foo/bar.html
    -Content-type: text/html
    -
    -<HTML>
    -<HEAD>
    -<TITLE>Lame excuses'R'us</TITLE>
    -</HEAD>
    -<BODY>
    -<H1>Fred's exceptionally wonderful page has moved to
    -<A HREF="http://xyz.abc.com/foo/bar.html">Joe's</A> site.
    -</H1>
    -</BODY>
    -</HTML> -
    -Notes: the server always adds a Date: and Server: header to the data returned -to the client, so these should not be included in the file. -The server does not add a Last-Modified header; it probably should. -

    - - -


    - -Home -Index - - - diff --git a/docs/manual/mod/mod_asis.xml b/docs/manual/mod/mod_asis.xml deleted file mode 100644 index 171e2b668144ab729eda2162638426813117f6e2..0000000000000000000000000000000000000000 --- a/docs/manual/mod/mod_asis.xml +++ /dev/null @@ -1,69 +0,0 @@ - - - - -mod_asis -Sends files that contain their own -HTTP headers -Base -mod_asis.c -asis_module - - -

    This module provides the handler send-as-is - which causes Apache to send the document without adding most of - the usual HTTP headers.

    - -

    This can be used to send any kind of data from the server, - including redirects and other special HTTP responses, without - requiring a cgi-script or an nph script.

    - -

    For historical reasons, this module will also process any - file with the mime type httpd/send-as-is.

    -
    - -
    Usage - -

    In the server configuration file, associate files with the - send-as-is handler e.g.

    - -AddHandler send-as-is asis - -

    The contents of any file with a .asis extension - will then be sent by Apache to the client with almost no - changes. Clients will need HTTP headers to be attached, so do - not forget them. A Status: header is also required; the data - should be the 3-digit HTTP response code, followed by a textual - message.

    - -

    Here's an example of a file whose contents are sent as - is so as to tell the client that a file has - redirected.

    - - -Status: 301 Now where did I leave that URL
    - Location: http://xyz.abc.com/foo/bar.html
    - Content-type: text/html
    -
    - <HTML>
    - <HEAD>
    - <TITLE>Lame excuses'R'us</TITLE>
    - </HEAD>
    - <BODY>
    - <H1>Fred's exceptionally wonderful page has moved - to
    - <A - HREF="http://xyz.abc.com/foo/bar.html">Joe's</A> - site.
    - </H1>
    - </BODY>
    - </HTML> -
    - -

    Notes: the server always adds a Date: and Server: header to - the data returned to the client, so these should not be - included in the file. The server does not add a - Last-Modified header; it probably should.

    -
    - -
    diff --git a/docs/manual/mod/mod_auth_digest.html b/docs/manual/mod/mod_auth_digest.html deleted file mode 100644 index 35c7f0628e19d98e1f7c20c696a08b8c48431be6..0000000000000000000000000000000000000000 --- a/docs/manual/mod/mod_auth_digest.html +++ /dev/null @@ -1,416 +0,0 @@ - - - -Apache module mod_auth_digest - - - - - -

    Module mod_auth_digest

    - -This module is contained in the mod_auth_digest.c file, and is -not compiled in by default. It is only available in Apache 1.3.8 and -later. It provides for user authentication using MD5 Digest -Authentication. - -

    Note this is an updated version of mod_digest. However, it has not been -extensively tested and is therefore marked experimental. If you use this -module, you must make sure to not use mod_digest (because they -share some of the same configuration directives). - - -

    -
  • AuthDigestFile -
  • AuthDigestGroupFile -
  • AuthDigestQop -
  • AuthDigestNonceLifetime -
  • AuthDigestNonceFormat -
  • AuthDigestNcCheck -
  • AuthDigestAlgorithm -
  • AuthDigestDomain -
  • Using Digest Authentication -
  • -
    - - -

    AuthDigestFile

    -Syntax: AuthDigestFile filename
    -Context: directory, .htaccess
    -Override: AuthConfig
    -Status: Base
    -Module: mod_auth_digest
    - -

    The AuthDigestFile directive sets the name of a textual file containing -the list of users and encoded passwords for digest authentication. -Filename is the absolute path to the user file. - -

    The digest file uses a special format. Files in this format can be -created using the "htdigest" utility found in the support/ subdirectory of -the Apache distribution. - -


    - -

    AuthDigestGroupFile

    -Syntax: AuthDigestGroupFile filename
    -Context: directory, .htaccess
    -Override: AuthConfig
    -Status: Base
    -Module: mod_auth_digest
    -Compatibility: Available in Apache 1.3.8 and later - -

    The AuthDigestGroupFile directive sets the name of a textual file -containing the list of groups and their members (user names). -Filename is the absolute path to the group file. - -

    Each line of the group file contains a groupname followed by a colon, -followed by the member usernames separated by spaces. Example: -

    mygroup: bob joe anne
    -Note that searching large text files is very inefficient. - -

    Security: make sure that the AuthGroupFile is stored outside the -document tree of the web-server; do not put it in the directory -that it protects. Otherwise, clients will be able to download the -AuthGroupFile. - -


    - -

    AuthDigestQop

    -Syntax: AuthDigestQop none | 1*{ auth | auth-int }
    -Default: AuthDigestQop auth
    -Context: directory, .htaccess
    -Override: AuthConfig
    -Status: Base
    -Module: mod_auth_digest
    -Compatibility: Available in Apache 1.3.8 and later - -

    The AuthDigestQop directive determines the quality-of-protection to use. -auth will only do authentication (username/password); -auth-int is authentication plus integrity checking (an MD5 hash -of the entity is also computed and checked); none will cause the -module to use the old RFC-2069 digest algorithm (which does not include -integrity checking). Both auth and auth-int may be -specified, in which the case the browser will choose which of these to -use. none should only be used if the browser for some reason -does not like the challenge it receives otherwise. - -

    auth-int is not implemented yet. - -


    - -

    AuthDigestNonceLifetime

    -Syntax: AuthDigestNonceLifetime <time>
    -Default: AuthDigestNonceLifetime 300
    -Context: directory, .htaccess
    -Override: AuthConfig
    -Status: Base
    -Module: mod_auth_digest
    -Compatibility: Available in Apache 1.3.8 and later - -

    The AuthDigestNonceLifetime directive controls how long the server -nonce is valid. When the client contacts the server using an expired -nonce the server will send back a 401 with stale=true. If -<time> is greater than 0 then it specifies the number of -seconds the nonce is valid; this should probably never be set to less -than 10 seconds. If <time> is less than 0 then the nonce -never expires. - - - -


    -

    AuthDigestNonceFormat

    -Syntax: AuthDigestNonceFormat ???
    -Default: AuthDigestNonceFormat ???
    -Context: directory, .htaccess
    -Override: AuthConfig
    -Status: Base
    -Module: mod_auth_digest
    -Compatibility: Available in Apache 1.3.8 and later - -

    Not implemented yet. - - -


    -

    AuthDigestNcCheck

    -Syntax: AuthDigestNcCheck On/Off
    -Default: AuthDigestNcCheck Off
    -Context: server config
    -Override: Not applicable
    -Status: Base
    -Module: mod_auth_digest
    -Compatibility: Available in Apache 1.3.8 and later - -

    Not implemented yet. - - -


    -

    AuthDigestAlgorithm

    -Syntax: AuthDigestAlgorithm MD5 | MD5-sess
    -Default: AuthDigestAlgorithm MD5
    -Context: directory, .htaccess
    -Override: AuthConfig
    -Status: Base
    -Module: mod_auth_digest
    -Compatibility: Available in Apache 1.3.8 and later - -

    The AuthDigestAlgorithm directive selects the algorithm used to calculate -the challenge and response hashes. - -

    MD5-sess is not correctly implemented yet. - - -


    -

    AuthDigestDomain

    -Syntax: AuthDigestDomain URI URI ...
    -Context: directory, .htaccess
    -Override: AuthConfig
    -Status: Base
    -Module: mod_auth_digest
    -Compatibility: Available in Apache 1.3.8 and later - -

    The AuthDigestDomain directive allows you to specify one or more URIs -which are in the same protection space (i.e. use the same realm and -username/password info). The specified URIs are prefixes, i.e. the client -will assume that all URIs "below" these are also protected by the same -username/password. The URIs may be either absolute URIs (i.e. inluding a -scheme, host, port, etc) or relative URIs. - -

    This directive should always be specified and contain at least -the (set of) root URI(s) for this space. Omiting to do so will cause the -client to send the Authorization header for every request sent to -this server. Apart from increasing the size of the request, it may also -have a detrimental effect on performance if "AuthDigestNcCheck" is on. - -

    The URIs specified can also point to different servers, in which case -clients (which understand this) will then share username/password info -across multiple servers without prompting the user each time. - - -


    - -

    Using Digest Authentication

    - -

    Using MD5 Digest authentication is very simple. Simply set up -authentication normally, using "AuthType Digest" and "AuthDigestFile" -instead of the normal "AuthType Basic" and "AuthUserFile"; also, -replace any "AuthGroupFile" with "AuthDigestGroupFile". Then add a -"AuthDigestDomain" directive containing at least the root URI(s) for -this protection space. Example: - -

    -  <Location /private/>
    -  AuthType Digest
    -  AuthName "private area"
    -  AuthDigestDomain /private/ http://mirror.my.dom/private2/
    -  AuthDigestFile /web/auth/.digest_pw
    -  require valid-user
    -  </Location>
    -
    - -

    Note: MD5 authentication provides a more secure -password system than Basic authentication, but only works with supporting -browsers. As of this writing (July 1999), the only major browsers which -support digest authentication are Internet Exploder 5.0 and -Amaya. Therefore, we do not -recommend using this feature on a large Internet site. However, for -personal and intra-net use, where browser users can be controlled, it is -ideal. - - - - - diff --git a/docs/manual/mod/mod_auth_digest.xml b/docs/manual/mod/mod_auth_digest.xml deleted file mode 100644 index 3d3c5442781ee03693d48d2b89cb059c91e749af..0000000000000000000000000000000000000000 --- a/docs/manual/mod/mod_auth_digest.xml +++ /dev/null @@ -1,270 +0,0 @@ - - - -mod_auth_digest -User authentication using MD5 - Digest Authentication. -Experimental -mod_auth_digest.c -auth_digest_module - -

    -

    This module implements HTTP Digest Authentication. However, it - has not been extensively tested and is therefore marked - experimental.

    -
    - -AuthName -AuthType -Require -Satisfy - -
    Using Digest Authentication - -

    Using MD5 Digest authentication is very simple. Simply set - up authentication normally, using "AuthType Digest" and - "AuthDigestFile" instead of the normal "AuthType Basic" and - "AuthUserFile"; also, replace any "AuthGroupFile" with - "AuthDigestGroupFile". Then add a "AuthDigestDomain" directive - containing at least the root URI(s) for this protection space. - Example:

    - - <Location /private/>
    - AuthType Digest
    - AuthName "private area"
    - AuthDigestDomain /private/ http://mirror.my.dom/private2/
    - AuthDigestFile /web/auth/.digest_pw
    - Require valid-user
    - </Location> -
    - -Note -

    MD5 authentication provides a more - secure password system than Basic authentication, but only - works with supporting browsers. As of this writing (October 2001), - the only major browsers which support digest authentication are - Opera 4.0, - MS Internet - Explorer 5.0 and Amaya. - Therefore, we do not yet recommend using this feature on a large - Internet site. However, for personal and intra-net use, where - browser users can be controlled, it is ideal.

    -
    -
    - - -AuthDigestFile -Location of the text file containing the list -of users and encoded passwords for digest authentication -AuthDigestFile file-path -directory.htaccess - -AuthConfig - - -

    The AuthDigestFile directive sets the - name of a textual file containing the list of users and encoded - passwords for digest authentication. File-path is the - absolute path to the user file.

    - -

    The digest file uses a special format. Files in this format - can be created using the htdigest utility found in - the support/ subdirectory of the Apache distribution.

    -
    -
    - - -AuthDigestGroupFile -Name of the text file containing the list of groups -for digest authentication -AuthDigestGroupFile file-path -directory.htaccess - -AuthConfig - - -

    The AuthDigestGroupFile directive sets - the name of a textual file containing the list of groups and their - members (user names). File-path is the absolute path to - the group file.

    - -

    Each line of the group file contains a groupname followed by - a colon, followed by the member usernames separated by spaces. - Example:

    - -mygroup: bob joe anne - -

    Note that searching large text files is very - inefficient.

    - -

    Security: make sure that the AuthGroupFile is stored outside - the document tree of the web-server; do not put it in - the directory that it protects. Otherwise, clients will be able - to download the AuthGroupFile.

    -
    -
    - - -AuthDigestQop -Determines the quality-of-protection to use in digest -authentication -AuthDigestQop none|auth|auth-int [auth|auth-int] -AuthDigestQop auth -directory.htaccess - -AuthConfig - - -

    The AuthDigestQop directive determines - the quality-of-protection to use. auth will only do - authentication (username/password); auth-int is - authentication plus integrity checking (an MD5 hash of the entity - is also computed and checked); none will cause the module - to use the old RFC-2069 digest algorithm (which does not include - integrity checking). Both auth and auth-int may - be specified, in which the case the browser will choose which of - these to use. none should only be used if the browser for - some reason does not like the challenge it receives otherwise.

    - -

    auth-int is not implemented - yet.

    -
    -
    - - -AuthDigestNonceLifetime -How long the server nonce is valid -AuthDigestNonceLifetime seconds -AuthDigestNonceLifetime 300 -directory.htaccess - -AuthConfig - - -

    The AuthDigestNonceLifetime directive - controls how long the server nonce is valid. When the client - contacts the server using an expired nonce the server will send - back a 401 with stale=true. If seconds is - greater than 0 then it specifies the amount of time for which the - nonce is valid; this should probably never be set to less than 10 - seconds. If seconds is less than 0 then the nonce never - expires. -

    -
    -
    - - -AuthDigestNonceFormat -Determines how the nonce is generated -??? -??? -directory.htaccess - -AuthConfig - - -

    Not implemented yet. -

    -
    -
    - - -AuthDigestNcCheck -Enables or disables checking of the nonce-count sent by the -server -AuthDigestNcCheck On|Off -AuthDigestNcCheck Off -server config - - -

    Not implemented yet. -

    -
    -
    - - -AuthDigestAlgorithm -Selects the algorithm used to calculate the challenge and -response hases in digest authentication -AuthDigestAlgorithm MD5|MD5-sess -AuthDigestAlgorithm MD5 -directory.htaccess - -AuthConfig - - -

    The AuthDigestAlgorithm directive - selects the algorithm used to calculate the challenge and response - hashes.

    - -

    MD5-sess is not correctly implemented - yet. -

    -
    -
    - - -AuthDigestDomain -URIs that are in the same protection space for digest -authentication -AuthDigestDomain URI [URI] ... -directory.htaccess - -AuthConfig - - -

    The AuthDigestDomain directive allows - you to specify one or more URIs which are in the same protection - space (i.e. use the same realm and username/password info). The - specified URIs are prefixes, i.e. the client will assume that all - URIs "below" these are also protected by the same - username/password. The URIs may be either absolute URIs - (i.e. inluding a scheme, host, port, etc) or relative URIs.

    - -

    This directive should always be specified and - contain at least the (set of) root URI(s) for this space. - Omitting to do so will cause the client to send the - Authorization header for every request sent to this - server. Apart from increasing the size of the request, it may - also have a detrimental effect on performance if - "AuthDigestNcCheck" is on.

    - -

    The URIs specified can also point to different servers, in - which case clients (which understand this) will then share - username/password info across multiple servers without - prompting the user each time.

    -
    -
    - - - diff --git a/docs/manual/mod/mod_autoindex.html b/docs/manual/mod/mod_autoindex.html deleted file mode 100644 index 960c89ca13f5629abc1c5c18cd3582b8deb5b741..0000000000000000000000000000000000000000 --- a/docs/manual/mod/mod_autoindex.html +++ /dev/null @@ -1,309 +0,0 @@ - - - - -Apache module mod_dir - - - - - -

    Module mod_dir

    - -This module is contained in the mod_dir.c file, and -is compiled in by default. It provides for directory indexing. - -

    Summary

    -This module controls the directory indexing. The index of a directory -can come from one of two sources: -
      -
    • A file written by the user, typically called index.html. -The DirectoryIndex directive sets the name -of this file. -
    • Otherwise, a listing generated by the server. The other directives -control the format of this listing. The AddIcon, -AddIconByEncoding and -AddIconByType are used to set a list of -icons to display for various file types; for each file listed, the -first icon listed that matches the file is displayed. -
    - - -

    Directives

    - - -
  • AddDescription -
  • AddIcon -
  • AddIconByEncoding -
  • AddIconByType -
  • DefaultIcon -
  • DirectoryIndex -
  • FancyIndexing -
  • HeaderName -
  • IndexIgnore -
  • IndexOptions -
  • ReadmeName -
  • -
    - - -

    AddDescription

    - -Syntax: AddDescription string file file...
    -Context: server config, virtual host, directory, .htaccess
    -Override: Indexes
    -Status: Base
    -Module: mod_dir

    - -This sets the description to display for a file, for -FancyIndexing. File is a file -extension, partial filename, wildcard expression or full filename for files -to describe. String is enclosed in double quotes -("). Example: -

    AddDescription "The planet Mars" /web/pics/mars.gif -


    - -

    AddIcon

    - -Syntax: AddIcon icon name name ...
    -Context: server config, virtual host, directory, .htaccess
    -Override: Indexes
    -Status: Base
    -Module: mod_dir

    - -This sets the icon to display next to a file ending in name for -FancyIndexing. Icon is either a -(%-escaped) relative URL to the icon, or of the format -(alttext,url) where alttext is the text tag given -for an icon for non-graphical browsers.

    - -Name is either ^^DIRECTORY^^ for directories, ^^BLANKICON^^ for -blank lines (to format the list correctly), a file extension, a wildcard -expression, a partial filename or a complete filename. Examples: -

    -AddIcon (IMG,/icons/image.xbm) .gif .jpg .xbm
    -AddIcon /icons/dir.xbm ^^DIRECTORY^^
    -AddIcon /icons/backup.xbm *~ -
    -AddIconByType should be used in preference to -AddIcon, when possible.


    - -

    AddIconByEncoding

    - -Syntax: AddIconByEncoding icon mime-encoding mime-encoding -...
    -Context: server config, virtual host, directory, .htaccess
    -Override: Indexes
    -Status: Base
    -Module: mod_dir

    - -This sets the icon to display next to files with -mime-encoding for FancyIndexing. -Icon is either a (%-escaped) relative URL to the icon, or of the -format (alttext,url) where alttext is the text tag -given for an icon for non-graphical browsers.

    - -Mime-encoding is a wildcard expression matching required the -content-encoding. Examples: -

    -AddIconByEncoding /icons/compress.xbm x-compress -


    - -

    AddIconByType

    - -Syntax: AddIconByType icon mime-type mime-type ...
    -Context: server config, virtual host, directory, .htaccess
    -Override: Indexes
    -Status: Base
    -Module: mod_dir

    - -This sets the icon to display next to files of type mime-type for -FancyIndexing. Icon is either a -(%-escaped) relative URL to the icon, or of the format -(alttext,url) where alttext is the text tag given -for an icon for non-graphical browsers.

    -Mime-type is a wildcard expression matching required the mime types. -Examples: -

    -AddIconByType (IMG,/icons/image.xbm) image/* -


    - -

    DefaultIcon

    - -Syntax: DefaultIcon url
    -Context: server config, virtual host, directory, .htaccess
    -Override: Indexes
    -Status: Base
    -Module: mod_dir

    - -The DefaultIcon directive sets the icon to display for files when no -specific icon is known, for FancyIndexing. -Url is a (%-escaped) relative URL to the icon. Examples: -

    -DefaultIcon /icon/unknown.xbm -


    - -

    DirectoryIndex

    - -Syntax: DirectoryIndex local-url local-url ...
    -Default: DirectoryIndex index.html
    -Context: server config, virtual host, directory, .htaccess
    -Override: Indexes
    -Status: Base
    -Module: mod_dir

    - -The DirectoryIndex directive sets the list of resources to look for, when -the client requests an index of the directory by specifying a NULL file -at the end of the a directory name. Local-url is the (%-encoded) URL -of a document on the server relative to the requested directory; it is usually -the name of a file in the directory. Several URLs may be given; the server -will return the first one that it finds. If none of the resources exist, -then the server will generate its own listing of the directory. -Example: -

    -DirectoryIndex index.html -
    -then a request for http://myserver/docs/ would return -http://myserver/docs/index.html if it exists, or would list -the directory if it did not.

    - -Note that the documents do not need to be relative to the directory; -

    -DirectoryIndex index.html index.txt /cgi-bin/index.pl
    -would cause the CGI script /cgi-bin/index.pl to be executed -if neither index.html or index.txt existed in -a directory.


    - -

    FancyIndexing

    - -Syntax: FancyIndexing boolean
    -Context: server config, virtual host, directory, .htaccess
    -Override: Indexes
    -Status: Base
    -Module: mod_dir

    - -The FancyIndexing directive sets the FancyIndexing option for a directory. -Boolean can be on or off. The -IndexOptions directive should be used in -preference.


    - -

    HeaderName

    - -Syntax: HeaderName filename
    -Context: server config, virtual host, directory, .htaccess
    -Override: Indexes
    -Status: Base
    -Module: mod_dir

    - -The HeaderName directive sets the name of the file that will be inserted -at the top of the index listing. Filename is the name of the file -to include, and is taken to be relative to the directory being indexed. -The server first attempts to include filename.html -as an HTML document, otherwise it will include filename as plain -text. Example: -

    HeaderName HEADER
    -when indexing the directory /web, the server will first look for -the HTML file /web/HEADER.html and include it if found, otherwise -it will include the plain text file /web/HEADER, if it exists. - -

    See also ReadmeName.


    - -

    IndexIgnore

    - -Syntax: IndexIgnore file file ...
    -Context: server config, virtual host, directory, .htaccess
    -Override: Indexes
    -Status: Base
    -Module: mod_dir

    - -The IndexIgnore directive adds to the list of files to hide when listing -a directory. File is a file extension, partial filename, -wildcard expression or full filename for files to ignore. Multiple -IndexIgnore directives add to the list, rather than the replacing the list -of ignored files. By default, the list contains `.'. Example: -

    -IndexIgnore README .htaccess *~ -


    - -

    IndexOptions

    - -Syntax: IndexOptions option option ...
    -Context: server config, virtual host, directory, .htaccess
    -Override: Indexes
    -Status: Base
    -Module: mod_dir

    - -The IndexOptions directive specifies the behaviour of the directory indexing. -Option can be one of -

    -
    FancyIndexing -
    -This turns on fancy indexing of directories. -
    IconsAreLinks -
    - -This makes the icons part of the anchor for the filename, for -fancy indexing. -
    ScanHTMLTitles -
    -This enables the extraction of the title from HTML documents for fancy -indexing. If the file does not have a description given by -AddDescription then httpd will read the -document for the value of the TITLE tag. This is CPU and disk intensive. -
    SuppressLastModified -
    - -This will suppress the display of the last modification date, in fancy -indexing listings. -
    SuppressSize -
    - -This will suppress the file size in fancy indexing listings. -
    SuppressDescription -
    - -This will suppress the file description in fancy indexing listings. -
    -This default is that no options are enabled. If multiple IndexOptions -could apply to a directory, then the most specific one is taken complete; -the options are not merged. For example: -
    -<Directory /web/docs>
    -IndexOptions FancyIndexing
    -</Directory>
    -<Directory /web/docs/spec>
    -IndexOptions ScanHTMLTitles
    -</Directory> -
    -then only ScanHTMLTitles will be set for the /web/docs/spec -directory.


    - -

    ReadmeName

    - -Syntax: ReadmeName filename
    -Context: server config, virtual host, directory, .htaccess
    -Override: Indexes
    -Status: Base
    -Module: mod_dir

    - -The ReadmeName directive sets the name of the file that will be appended -to the end of the index listing. Filename is the name of the file -to include, and is taken to be relative to the directory being indexed. -The server first attempts to include filename.html -as an HTML document, otherwise it will include filename as plain -text. Example: -

    ReadmeName README
    -when indexing the directory /web, the server will first look for -the HTML file /web/README.html and include it if found, otherwise -it will include the plain text file /web/README, if it exists. - -

    See also HeaderName.

    - - -


    -Home -Index - - - - diff --git a/docs/manual/mod/mod_autoindex.xml b/docs/manual/mod/mod_autoindex.xml deleted file mode 100644 index 73aeb7dcc6e8b6da3246ff7e6ab177a3c8e0e244..0000000000000000000000000000000000000000 --- a/docs/manual/mod/mod_autoindex.xml +++ /dev/null @@ -1,842 +0,0 @@ - - ]> - - -mod_autoindex - -Generates directory indexes, - automatically, similar to the Unix ls command or the - Win32 dir shell command -Base -mod_autoindex.c -autoindex_module - - -

    The index of a directory can come from one of two - sources:

    - -
      -
    • A file written by the user, typically called - index.html. The DirectoryIndex directive sets the - name of this file. This is controlled by - mod_dir.
    • - -
    • Otherwise, a listing generated by the server. The other - directives control the format of this listing. The AddIcon, AddIconByEncoding and - AddIconByType are - used to set a list of icons to display for various file types; - for each file listed, the first icon listed that matches the - file is displayed. These are controlled by - mod_autoindex.
    • -
    -

    The two functions are separated so that you can completely - remove (or replace) automatic index generation should you want - to.

    - -

    Automatic index generation is enabled with using - Options +Indexes. See the - Options directive for - more details.

    - -

    If the FancyIndexing - option is given with the IndexOptions directive, - the column headers are links that control the order of the - display. If you select a header link, the listing will be - regenerated, sorted by the values in that column. Selecting the - same header repeatedly toggles between ascending and descending - order. These column header links are suppressed with - IndexOptions directive's - SuppressColumnSorting option.

    - -

    Note that when the display is sorted by "Size", it's the - actual size of the files that's used, not the - displayed value - so a 1010-byte file will always be displayed - before a 1011-byte file (if in ascending order) even though - they both are shown as "1K".

    -
    - -
    Autoindex Request Query Arguments - -

    Apache 2.0.23 reorganized the Query Arguments for Column - Sorting, and introduced an entire group of new query options. - To effectively eliminate all client control over the output, - the IndexOptions - IgnoreClient option was introduced.

    - -

    The column sorting headers themselves are self-referencing - hyperlinks that add the sort query options shown below. Any - option below may be added to any request for the directory - resource.

    - -
      -
    • C=N sorts the directory by file name
    • - -
    • C=M sorts the directory by last-modified - date, then file name
    • - -
    • C=S sorts the directory by size, then file - name
    • - -
    • C=D sorts the directory by description, then - file name
      -  
    • - -
    • O=A sorts the listing in Ascending - Order
    • - -
    • O=D sorts the listing in Descending - Order
      -  
    • - -
    • F=0 formats the listing as a simple list - (not FancyIndexed)
    • - -
    • F=1 formats the listing as a FancyIndexed - list
    • - -
    • F=2 formats the listing as an HTMLTable - FancyIndexed list
      -  
    • - -
    • V=0 disables version sorting
    • - -
    • V=1 enables version sorting
      -  
    • - -
    • P=pattern lists only files matching - the given pattern
    • -
    - -

    Note that the 'P'attern query argument is tested - after the usual IndexIgnore directives are processed, - and all file names are still subjected to the same criteria as - any other autoindex listing. The Query Arguments parser in - mod_autoindex will stop abruptly when an unrecognized option is - encountered. The Query Arguments must be well formed, according - to the table above.

    - -

    The simple example below, which can be clipped and saved in - a header.html file, illustrates these query options. Note that - the unknown "X" argument, for the submit button, is listed last - to assure the arguments are all parsed before mod_autoindex - encounters the X=Go input.

    - - -<FORM METHOD="GET">
    -  Show me a <SELECT NAME="F">
    -    <OPTION VALUE="0"> Plain list
    -    <OPTION VALUE="1" SELECTED> Fancy list
    -    <OPTION VALUE="2"> Table list
    -  </SELECT>
    -  Sorted by <SELECT NAME="C">
    -    <OPTION VALUE="N" SELECTED> Name
    -    <OPTION VALUE="M"> Date Modified
    -    <OPTION VALUE="S"> Size
    -    <OPTION VALUE="D"> Description
    -  </SELECT>
    -  <SELECT NAME="O">
    -    <OPTION VALUE="A" SELECTED> Ascending
    -    <OPTION VALUE="D"> Descending
    -  </SELECT>
    -  <SELECT NAME="V">
    -    <OPTION VALUE="0" SELECTED> in Normal order
    -    <OPTION VALUE="1"> in Version order
    -  </SELECT>
    -  Matching <INPUT TYPE="text" NAME="P" VALUE="*">
    -  <INPUT TYPE="submit" NAME="X" VALUE="Go">
    -</FORM> -
    - -
    - - -AddAlt -Alternate text to display for a file, instead of an -icon selected by filename -AddAlt string file [file] ... -server configvirtual host -directory.htaccess - -Indexes - - -

    AddAlt provides the alternate text to - display for a file, instead of an icon, for FancyIndexing. - File is a file extension, partial filename, wild-card - expression or full filename for files to describe. - String is enclosed in double quotes ("). - This alternate text is displayed if the client is image-incapable, - has image loading disabled, or fails to retrieve the icon.

    - -

    Examples:

    - - AddAlt "PDF" *.pdf
    - AddAlt "Compressed" *.gz *.zip *.Z -
    -
    -
    - - -AddAltByEncoding -Alternate text to display for a file instead of an icon -selected by MIME-encoding -AddAltByEncoding string MIME-encoding -[MIME-encoding] ... -server configvirtual host -directory.htaccess - -Indexes - - -

    AddAltByEncoding provides the alternate - text to display for a file, instead of an icon, for FancyIndexing. - MIME-encoding is a valid content-encoding, such as - x-compress. String is enclosed in double - quotes ("). This alternate text is displayed if the - client is image-incapable, has image loading disabled, or fails to - retrieve the icon.

    - -

    Example:

    - - AddAltByEncoding "gzip" x-gzip - -
    -
    - - -AddAltByType -Alternate text to display for a file, instead of an -icon selected by MIME content-type -AddAltByType string - MIME-type [MIME-type] ... -server configvirtual host -directory.htaccess - -Indexes - - -

    AddAltByType sets the alternate text to - display for a file, instead of an icon, for FancyIndexing. - MIME-type is a valid content-type, such as - text/html. String is enclosed in double - quotes ("). This alternate text is displayed if the - client is image-incapable, has image loading disabled, or fails to - retrieve the icon.

    - -

    Example:

    - - AddAltByType "TXT" text/plain - -
    -
    - - -AddDescription -AddDescription - string file [file] ... -server configvirtual host -directory.htaccess - -Indexes - - -

    This sets the description to display for a file, for - FancyIndexing. - File is a file extension, partial filename, wild-card - expression or full filename for files to describe. - String is enclosed in double quotes ("). - Example:

    - -AddDescription "The planet Mars" - /web/pics/mars.gif - -

    The typical, default description field is 23 bytes wide. 6 - more bytes are added by the - IndexOptions SuppressIcon option, 7 bytes are - added by the IndexOptions SuppressSize - option, and 19 bytes are added by the - IndexOptions SuppressLastModified option. - Therefore, the widest default the description column is ever - assigned is 55 bytes.

    - -

    See the DescriptionWidth - IndexOptions keyword - for details on overriding the size of this column, or allowing - descriptions of unlimited length.

    - -Caution

    Descriptive text defined with - AddDescription may contain HTML markup, such as - tags and character entities. If the width of the description - column should happen to truncate a tagged element (such as - cutting off the end of a bolded phrase), the results may - affect the rest of the directory listing.

    -
    -
    -
    - - -AddIcon -Icon to display for a file selected by name -AddIcon icon - name [name] ... -server configvirtual host -directory.htaccess - -Indexes - - -

    This sets the icon to display next to a file ending in - name for FancyIndexing. - Icon is either a (%-escaped) relative URL to the icon, - or of the format (alttext,url) where - alttext is the text tag given for an icon for - non-graphical browsers.

    - -

    Name is either ^^DIRECTORY^^ for directories, - ^^BLANKICON^^ for blank lines (to format the list correctly), a - file extension, a wildcard expression, a partial filename or a - complete filename. Examples:

    - - - AddIcon (IMG,/icons/image.xbm) .gif .jpg .xbm
    - AddIcon /icons/dir.xbm ^^DIRECTORY^^
    - AddIcon /icons/backup.xbm *~ -
    - -

    AddIconByType - should be used in preference to AddIcon, - when possible.

    -
    -
    - - -AddIconByEncoding -Icon to display next to files selected by MIME -content-encoding -AddIconByEncoding - icon MIME-encoding [MIME-encoding] ... -server configvirtual host -directory.htaccess - -Indexes - - -

    This sets the icon to display next to files with FancyIndexing. - Icon is either a (%-escaped) relative URL to the icon, - or of the format (alttext,url) where - alttext is the text tag given for an icon for - non-graphical browsers.

    - -

    Mime-encoding is a wildcard expression matching - required the content-encoding. Examples:

    - -AddIconByEncoding /icons/compress.xbm x-compress -
    -
    - - -AddIconByType -Icon to display next to files selected by MIME -content-type -AddIconByType - icon MIME-type [MIME-type] ... -server configvirtual host -directory.htaccess - -Indexes - - -

    This sets the icon to display next to files of type - MIME-type for FancyIndexing. - Icon is either a (%-escaped) relative URL to the icon, - or of the format (alttext,url) where - alttext is the text tag given for an icon for - non-graphical browsers.

    - -

    Mime-type is a wildcard expression matching - required the mime types. Examples:

    - -AddIconByType (IMG,/icons/image.xbm) image/* -
    -
    - - -DefaultIcon -Icon to display for files when no specific icon is -configured -DefaultIcon url-path -server configvirtual host -directory.htaccess - -Indexes - - -

    The DefaultIcon directive sets the icon - to display for files when no specific icon is known, for FancyIndexing. - Url is a (%-escaped) relative URL to the icon. - Examples:

    -DefaultIcon /icon/unknown.xbm -
    -
    - - -HeaderName -Name of the file that will be inserted at the top -of the index listing -HeaderName filename -server configvirtual host -directory.htaccess - -Indexes - - -

    The HeaderName directive sets the name - of the file that will be inserted at the top of the index - listing. Filename is the name of the file to include.

    - - -

    Both HeaderName and ReadmeName now treat - Filename as a URI path relative to the one used to - access the directory being indexed. Filename must - resolve to a document with a major content type of - "text/*" (e.g., text/html, - text/plain, etc.). This means that - filename may refer to a CGI script if the script's - actual file type (as opposed to its output) is marked as - text/html such as with a directive like:

    - - AddType text/html .cgi - -

    Content negotiation - will be performed if the MultiViews Option is enabled. If - filename resolves to a static text/html - document (not a CGI script) and the Includes - option is enabled, the file - will be processed for server-side includes (see the - mod_include documentation).

    -
    - -

    If the file specified by HeaderName contains - the beginnings of an HTML document (<HTML>, <HEAD>, - etc) then you will probably want to set IndexOptions - +SuppressHTMLPreamble, so that these tags are not - repeated.

    -
    -
    - - -IndexIgnore -Adds to the list of files to hide when listing -a directory -IndexIgnore file [file] ... -server configvirtual host -directory.htaccess - -Indexes - - -

    The IndexIgnore directive adds to the - list of files to hide when listing a directory. File is a - file extension, partial filename, wildcard expression or full - filename for files to ignore. Multiple IndexIgnore directives add - to the list, rather than the replacing the list of ignored - files. By default, the list contains - `.'. Example:

    - -IndexIgnore README .htaccess *~ -
    -
    - - -IndexOptions -Various configuration settings for directory -indexing -IndexOptions [+|-]option [[+|-]option] ... -server configvirtual host -directory.htaccess - -Indexes - - -

    The IndexOptions directive specifies the - behavior of the directory indexing. Option can be one - of

    - -
    -
    DescriptionWidth=[n - | *] (Apache 1.3.10 or 2.0.23 and later)
    - -
    The DescriptionWidth keyword allows you to - specify the width of the description column in - characters.
    - -
    -DescriptionWidth (or unset) allows - mod_autoindex to calculate the best width.
    - -
    DescriptionWidth=n fixes the column width to - n bytes wide.
    - -
    DescriptionWidth=* grows the column to the - width necessary to accommodate the longest description - string.
    - -
    See the section on AddDescription for dangers - inherent in truncating descriptions.
    - -
    FancyIndexing
    - -
    - This turns on fancy indexing of directories.
    - -
    FoldersFirst (Apache - 1.3.10 or 2.0.23 and later)
    - -
    If this option is enabled, subdirectory listings will - always appear first, followed by normal files in the - directory. The listing is basically broken into two - components, the files and the subdirectories, and each is - sorted separately and then displayed subdirectories-first. - For instance, if the sort order is descending by name, and - FoldersFirst is enabled, subdirectory - Zed will be listed before subdirectory - Beta, which will be listed before normal files - Gamma and Alpha. This option - only has an effect if FancyIndexing - is also enabled.
    - -
    HTMLTable (Experimental, - Apache 2.0.23 and later)
    - -
    - This experimental option with FancyIndexing constructs a - simple table for the fancy directory listing. Note this will - confuse older browsers. It is particularly necessary if file - names or description text will alternate between - left-to-right and right-to-left reading order, as can happen - on WinNT or other utf-8 enabled platforms.
    - -
    IconsAreLinks
    - -
    - This makes the icons part of the anchor for the filename, for - fancy indexing.
    - -
    IconHeight[=pixels] - (Apache 1.3 and later)
    - -
    - Presence of this option, when used with IconWidth, will cause - the server to include HEIGHT and - WIDTH attributes in the IMG tag for - the file icon. This allows browser to precalculate the page - layout without having to wait until all the images have been - loaded. If no value is given for the option, it defaults to - the standard height of the icons supplied with the Apache - software.
    - -
    IconWidth[=pixels] (Apache - 1.3 and later)
    - -
    - Presence of this option, when used with IconHeight, will - cause the server to include HEIGHT and - WIDTH attributes in the IMG tag for - the file icon. This allows browser to precalculate the page - layout without having to wait until all the images have been - loaded. If no value is given for the option, it defaults to - the standard width of the icons supplied with the Apache - software.
    - -
    IgnoreClient
    - -
    - This option causes mod_autoindex to ignore all query - variables from the client, including sort order (implies - SuppressColumnSorting.)
    - -
    NameWidth=[n | *] - (Apache 1.3.2 and later)
    - -
    The NameWidth keyword allows you to specify the width of - the filename column in bytes.
    - -
    -NameWidth (or unset) allows mod_autoindex - to calculate the best width.
    - -
    NameWidth=n fixes the column width to n - bytes wide.
    - -
    NameWidth=* grows the column to the - necessary width.
    - -
    ScanHTMLTitles
    - -
    - This enables the extraction of the title from HTML documents - for fancy indexing. If the file does not have a description - given by AddDescription then - httpd will read the document for the value of the TITLE tag. - This is CPU and disk intensive.
    - -
    SuppressColumnSorting - (Apache 1.3 and later)
    - -
    - If specified, Apache will not make the column headings in a - FancyIndexed directory listing into links for sorting. The - default behavior is for them to be links; selecting the - column heading will sort the directory listing by the values - in that column. Prior to Apache 2.0.23, this also - disabled parsing the Query Arguments for the sort - string. That behavior is now controlled by IndexOptions - IgnoreClient in Apache 2.0.23.
    - -
    SuppressDescription
    - -
    - This will suppress the file description in fancy indexing - listings. By default, no file descriptions are defined, and - so the use of this option will regain 23 characters of screen - space to use for something else. See AddDescription for - information about setting the file description. See also the - DescriptionWidth - index option to limit the size of the description - column.
    - -
    SuppressHTMLPreamble - (Apache 1.3 and later)
    - -
    - If the directory actually contains a file specified by the - HeaderName - directive, the module usually includes the contents of the file - after a standard HTML preamble (<HTML>, <HEAD>, - et cetera). The SuppressHTMLPreamble option disables - this behaviour, causing the module to start the display with the - header file contents. The header file must contain appropriate - HTML instructions in this case. If there is no header file, the - preamble is generated as usual.
    - -
    SuppressIcon (Apache - 2.0.23 and later)
    - -
    - This will suppress the icon in fancy indexing listings. - Combining both SuppressIcon and - SuppressRules yields proper HTML 3.2 output, which - by the final specification prohibits IMG and HR tags from the - PRE block (used to format FancyIndexed listings.)
    - -
    SuppressLastModified
    - -
    - This will suppress the display of the last modification date, - in fancy indexing listings.
    - -
    SuppressRules - (Apache 2.0.23 and later)
    - -
    - This will suppress the horizontal rule lines (HR tags) in - directory listings. Combining both SuppressIcon and - SuppressRules yeilds proper HTML 3.2 output, which - by the final specification prohibits IMG and HR tags from the - PRE block (used to format FancyIndexed listings.)
    - -
    SuppressSize
    - -
    - This will suppress the file size in fancy indexing - listings.
    - -
    TrackModified (Apache - 1.3.15 or 2.0.23 and later)
    - -
    - This returns the Last-Modified and ETag values for the listed - directory in the HTTP header. It is only valid if the - operating system and file system return appropriate stat() - results. Some Unix systems do so, as do OS2's JFS and Win32's - NTFS volumes. OS2 and Win32 FAT volumes, for example, do not. - Once this feature is enabled, the client or proxy can track - changes to the list of files when they perform a HEAD - request. Note some operating systems correctly track new and - removed files, but do not track changes for sizes or dates of - the files within the directory. Changes to the size - or date stamp of an existing file will not update the - Last-Modified header on all Unix platforms. If this - is a concern, leave this option disabled.
    - -
    VersionSort (Apache 2.0a3 - and later)
    - -
    - The VersionSort keyword causes files containing version - numbers to sort in a natural way. Strings are sorted as - usual, except that substrings of digits in the name and - description are compared according to their numeric value. - For example: - - -foo-1.7
    -foo-1.7.2
    -foo-1.7.12
    -foo-1.8.2
    -foo-1.8.2a
    -foo-1.12
    -
    - If the number starts with a zero, then it is considered to - be a fraction: - - -foo-1.001
    -foo-1.002
    -foo-1.030
    -foo-1.04 -
    -
    - -
    -

    Incremental IndexOptions

    -
    - -
    - Apache 1.3.3 introduced some significant changes in the - handling of IndexOptions directives. In - particular,
    -
    - - -
      -
    • Multiple IndexOptions directives for a - single directory are now merged together. The result of - the example above will now be the equivalent of - IndexOptions FancyIndexing ScanHTMLTitles.
    • - -
    • The addition of the incremental syntax - (i.e., prefixing keywords with '+' or '-').
    • -
    -
    - Whenever a '+' or '-' prefixed keyword is encountered, it - is applied to the current IndexOptions - settings (which may have been inherited from an upper-level - directory). However, whenever an unprefixed keyword is - processed, it clears all inherited options and any - incremental settings encountered so far. Consider the - following example: - -IndexOptions +ScanHTMLTitles -IconsAreLinks - FancyIndexing
    - IndexOptions +SuppressSize
    -
    - The net effect is equivalent to - IndexOptions FancyIndexing +SuppressSize, - because the unprefixed FancyIndexing discarded - the incremental keywords before it, but allowed them to - start accumulating again afterward.
    -
    - To unconditionally set the IndexOptions for a - particular directory, clearing the inherited settings, - specify keywords without any '+' or '-' prefixes. -
    -
    -
    -
    - - -IndexOrderDefault -Sets the default ordering of the directory index -IndexOrderDefault -Ascending|Descending Name|Date|Size|Description -server configvirtual host -directory.htaccess - -Indexes - - -

    The IndexOrderDefault directive is used - in combination with the FancyIndexing - index option. By default, fancyindexed directory listings are - displayed in ascending order by filename; the - IndexOrderDefault allows you to change this initial - display order.

    - -

    IndexOrderDefault takes two - arguments. The first must be either Ascending or - Descending, indicating the direction of the sort. - The second argument must be one of the keywords Name, - Date, Size, or Description, - and identifies the primary key. The secondary key is - always the ascending filename.

    - -

    You can force a directory listing to only be displayed in a - particular order by combining this directive with the SuppressColumnSorting - index option; this will prevent the client from requesting the - directory listing in a different order.

    -
    -
    - - -ReadmeName -ReadmeName filename -server configvirtual host -directory.htaccess - -Indexes - - -

    The ReadmeName directive sets the name - of the file that will be appended to the end of the index - listing. Filename is the name of the file to include, and - is taken to be relative to the location being indexed.

    - -

    See also HeaderName, where this behavior - is described in greater detail.

    -
    -
    - -
    \ No newline at end of file diff --git a/docs/manual/mod/mod_cern_meta.html b/docs/manual/mod/mod_cern_meta.html deleted file mode 100644 index b48dfffe2beaadf5114bcaa69f7daa59beab1040..0000000000000000000000000000000000000000 --- a/docs/manual/mod/mod_cern_meta.html +++ /dev/null @@ -1,76 +0,0 @@ - - - -Apache module mod_cern_meta - - - - -

    Apache module mod_cern_meta

    - -This module is contained in the mod_cern_meta.c file, and -is not compiled in by default. It provides for CERN httpd metafile -semantics. It is only available in Apache 1.1 and later. - -

    Summary

    - -Emulate the CERN HTTPD Meta file semantics. Meta files are HTTP -headers that can be output in addition to the normal range of headers -for each file accessed. They appear rather like the Apache -.asis files, and are able to provide a crude way of influencing -the Expires: header, as well as providing other curiosities. -There are many ways to manage meta information, this one was -chosen because there is already a large number of CERN users -who can exploit this module. - -

    More information on the -CERN metafile semantics is available. - -

    Directives

    - - -
    - -

    MetaDir

    -Syntax: MetaDir directory name
    -Default: MetaDir .web
    -Context: server config
    -Status: Base
    -Module: mod_cern_meta
    -Compatibility: MetaDir is only available in Apache 1.1 -and later.

    - -Specifies the name of the directory in which Apache can find -meta information files. The directory is usually a 'hidden' -subdirectory of the directory that contains the file being -accessed. Set to "." to look in the same directory as the -file. - -

    MetaSuffix

    -Syntax: MetaSuffix suffix
    -Default: MetaSuffix .meta
    -Context: server config
    -Status: Base
    -Module: mod_cern_meta
    -Compatibility: MetaSuffix is only available in Apache 1.1 -and later.

    - -Specifies the file name suffix for the file containing the -meta information. For example, the default values for the two -directives will cause a request to -DOCUMENT_ROOT/somedir/index.html to look in -DOCUMENT_ROOT/somedir/.web/index.html.meta and will use -its contents to generate additional MIME header information. - -


    - -Home -Index - - - - diff --git a/docs/manual/mod/mod_cern_meta.xml b/docs/manual/mod/mod_cern_meta.xml deleted file mode 100644 index de97c827f40967e46b14a6312d669217a679abd9..0000000000000000000000000000000000000000 --- a/docs/manual/mod/mod_cern_meta.xml +++ /dev/null @@ -1,76 +0,0 @@ - - ]> - - - -mod_cern_meta -CERN httpd metafile semantics -Extension -mod_cern_meta.c -cern_meta_module - - - -

    Emulate the CERN HTTPD Meta file semantics. Meta files are HTTP - headers that can be output in addition to the normal range of - headers for each file accessed. They appear rather like the - Apache .asis files, and are able to provide a crude way of - influencing the Expires: header, as well as providing other - curiosities. There are many ways to manage meta information, - this one was chosen because there is already a large number of - CERN users who can exploit this module.

    - -

    More information on the - CERN metafile semantics is available.

    -
    - - -MetaFiles -Activates CERN meta-file processing -MetaFiles on|off -MetaFiles off -directory - - -

    Turns on/off Meta file processing on a per-directory basis.

    -
    -
    - - -MetaDir -Name of the directory to find CERN-style meta information -files -MetaDir directory -MetaDir .web -directory - - -

    Specifies the name of the directory in which Apache can find - meta information files. The directory is usually a 'hidden' - subdirectory of the directory that contains the file being - accessed. Set to "." to look in the same directory - as the file.

    -
    -
    - - -MetaSuffix -File name suffix for the file containg CERN-style -meta information -MetaSuffix suffix -MetaSuffix .meta -directory - - -

    Specifies the file name suffix for the file containing the - meta information. For example, the default values for the two - directives will cause a request to - DOCUMENT_ROOT/somedir/index.html to look in - DOCUMENT_ROOT/somedir/.web/index.html.meta and - will use its contents to generate additional MIME header - information.

    -
    -
    - -
    diff --git a/docs/manual/mod/mod_cgi.html b/docs/manual/mod/mod_cgi.html deleted file mode 100644 index 5bf6ea78c940d990588700580ddfc3dd85a87f31..0000000000000000000000000000000000000000 --- a/docs/manual/mod/mod_cgi.html +++ /dev/null @@ -1,53 +0,0 @@ - - - - -Apache module mod_cgi - - - - - -

    Module mod_cgi

    - -This module is contained in the mod_cgi.c file, and -is compiled in by default. It provides for execution of CGI scripts. -Any file with mime type application/x-httpd-cgi will be -processed by this module. - - - -

    Summary

    -Any file that has the mime type application/x-httpd-cgi -will be treated as a CGI script, and run by the server, with its output -being returned to the client. Files acquire this type either by -having a name ending in an extension defined by the -AddType directive, or by being in -a ScriptAlias directory.

    - -When the server invokes a CGI script, it will add a variable called -DOCUMENT_ROOT to the environment. This variable will contain the -value of the DocumentRoot -configuration variable. - -

    CGI Environment variables

    -The server will set the CGI environment variables as described in the CGI -specification, with the following provisos: -
    -
    REMOTE_HOST -
    This will only be set if the server has not been compiled with -MINIMAL_DNS. -
    REMOTE_IDENT -
    This will only be set if -IdentityCheck is set to on. -
    REMOTE_USER -
    This will only be set if the CGI script is subject to authentication. -
    -

    - -


    -Home -Index - - - diff --git a/docs/manual/mod/mod_cgi.xml b/docs/manual/mod/mod_cgi.xml deleted file mode 100644 index 4c3ea9c1efaf7228be198af476b40db4370abd04..0000000000000000000000000000000000000000 --- a/docs/manual/mod/mod_cgi.xml +++ /dev/null @@ -1,202 +0,0 @@ - - ]> - - - -mod_cgi -Execution of CGI scripts -Base -mod_cgi.c -cgi_module - - - - - - -

    Any file that has the mime type - application/x-httpd-cgi or handler - cgi-script (Apache 1.1 or later) will be treated - as a CGI script, and run by the server, with its output being - returned to the client. Files acquire this type either by - having a name containing an extension defined by the - AddType directive, or by being - in a ScriptAlias - directory.

    - -

    When the server invokes a CGI script, it will add a variable - called DOCUMENT_ROOT to the environment. This - variable will contain the value of the - DocumentRoot configuration - variable.

    - -

    For an introduction to using CGI scripts with Apache, see - our tutorial on Dynamic Content - With CGI.

    - -

    When using a multi-threaded MPM under unix, the module - mod_cgid should be used in place of - this module. At the user level, the two modules are essentially - identical.

    -
    - -Options -ScriptAlias -AddHandler - -
    CGI Environment variables -

    The server will set the CGI environment variables as described - in the CGI - specification, with the following provisions:

    - -
    -
    PATH_INFO
    - -
    This will not be available if the AcceptPathInfo directive is explicitly set to - off. The default behavior, if AcceptPathInfo is - not given, is that mod_cgi will accept path info (trailing - /more/path/info following the script filename in the URI), while - the core server will return a 404 NOT FOUND error for requests - with additional path info. Omitting the AcceptPathInfo - directive has the same effect as setting it on for - mod_cgi requests.
    - -
    REMOTE_HOST
    - -
    This will only be set if HostnameLookups is set to on (it - is off by default), and if a reverse DNS lookup of the accessing - host's address indeed finds a host name.
    - -
    REMOTE_IDENT
    - -
    This will only be set if IdentityCheck is set to - on and the accessing host supports the ident - protocol. Note that the contents of this variable cannot be - relied upon because it can easily be faked, and if there is a - proxy between the client and the server, it is usually - totally useless.
    - -
    REMOTE_USER
    - -
    This will only be set if the CGI script is subject to - authentication.
    -
    -
    - -
    CGI Debugging -

    Debugging CGI scripts has traditionally been difficult, mainly - because it has not been possible to study the output (standard - output and error) for scripts which are failing to run - properly. These directives, included in Apache 1.2 and later, - provide more detailed logging of errors when they occur.

    - -
    CGI Logfile Format -

    When configured, the CGI error log logs any CGI which does not - execute properly. Each CGI script which fails to operate causes - several lines of information to be logged. The first two lines - are always of the format:

    - - %% [time] request-line
    - %% HTTP-status CGI-script-filename -
    -

    If the error is that CGI script cannot be run, the log file - will contain an extra two lines:

    - - %%error
    - error-message -
    -

    Alternatively, if the error is the result of the script - returning incorrect header information (often due to a bug in - the script), the following information is logged:

    - - %request
    - All HTTP request headers received
    - POST or PUT entity (if any)
    - %response
    - All headers output by the CGI script
    - %stdout
    - CGI standard output
    - %stderr
    - CGI standard error
    -
    -

    (The %stdout and %stderr parts may be missing if the script did - not output anything on standard output or standard error).

    -
    -
    - - -ScriptLog -Location of the CGI script error logfile -ScriptLog file-path -server config -mod_cgimod_cgid - - - -

    The ScriptLog directive sets the CGI - script error logfile. If no ScriptLog is given, no error log is - created. If given, any CGI errors are logged into the filename - given as argument. If this is a relative file or path it is taken - relative to the server root.

    - -

    This log will be opened as the user the child processes run - as, ie. the user specified in the main User directive. This means that - either the directory the script log is in needs to be writable - by that user or the file needs to be manually created and set - to be writable by that user. If you place the script log in - your main logs directory, do NOT change the - directory permissions to make it writable by the user the child - processes run as.

    - -

    Note that script logging is meant to be a debugging feature - when writing CGI scripts, and is not meant to be activated - continuously on running servers. It is not optimized for speed - or efficiency, and may have security problems if used in a - manner other than that for which it was designed.

    -
    -
    - - -ScriptLogLength -Size limit of the CGI script logfile -ScriptLogLength bytes -ScriptLogLength 10385760 -server config -mod_cgimod_cgid - - - -

    ScriptLogLength can be used to limit the - size of the CGI script logfile. Since the logfile logs a lot of - information per CGI error (all request headers, all script output) - it can grow to be a big file. To prevent problems due to unbounded - growth, this directive can be used to set an maximum file-size for - the CGI logfile. If the file exceeds this size, no more - information will be written to it.

    -
    -
    - - -ScriptLogBuffer -Maximum amount of PUT or POST requests that will be recorded -in the scriptlog -ScriptLogBuffer bytes -ScriptLogBuffer 1024 -server config -mod_cgimod_cgid - - - -

    The size of any PUT or POST entity body that is logged to - the file is limited, to prevent the log file growing too big - too quickly if large bodies are being received. By default, up - to 1024 bytes are logged, but this can be changed with this - directive.

    -
    -
    - -
    \ No newline at end of file diff --git a/docs/manual/mod/mod_cgid.html b/docs/manual/mod/mod_cgid.html deleted file mode 100644 index 396d608d5cc76bbcbae19d922e30d713402b3043..0000000000000000000000000000000000000000 --- a/docs/manual/mod/mod_cgid.html +++ /dev/null @@ -1,101 +0,0 @@ - - - -Apache module mod_cgi - - - - - - -

    Module mod_cgid

    - -

    This module provides for execution of CGI scripts using an external -CGI daemon.

    - -

    Status: Base (unix threaded MPMs only) -
    -Source File: mod_cgid.c -
    -Module Identifier: cgid_module -

    - - -

    Summary

    - -

    On certain unix operating systems, forking a process from a -multi-threaded server is a very expensive operation because the new -process will replicate all the threads of the parent process. In -order to avoid incurring this expense on each CGI invocation, mod_cgid -creates an external daemon that is responsible for forking child -processes to run CGI scripts. The main server communicates with this -daemon using a unix domain socket.

    - -

    This module is used by default whenever a multi-threaded MPM is -selected during the compilation process. At the user level, this -module is identical in configuration and operation to mod_cgi. The only exception is the additional -directive ScriptSock which gives the name of the socket -to use for communication with the cgi daemon.

    - -

    Directives

    - - - -
    - -

    ScriptSock directive

    - -

    Syntax: Scriptsock filename
    -Default: logs/cgisock
    -Context: server config
    -Status: Base
    -Module: mod_cgid

    - -

    This directive sets the name of the socket to use for communication -with the CGI daemon. The socket will be opened using the permissions -of the user who starts Apache (usually root). To maintain the security -of communications with CGI scripts, it is important that no other -user has permission to write in the directory where the socket is -located.

    - - - - - - diff --git a/docs/manual/mod/mod_cgid.xml b/docs/manual/mod/mod_cgid.xml deleted file mode 100644 index bebea4f7c3bdf685f1b6d251b03e7296cd968668..0000000000000000000000000000000000000000 --- a/docs/manual/mod/mod_cgid.xml +++ /dev/null @@ -1,68 +0,0 @@ - - ]> - - - -mod_cgid -Execution of CGI scripts using an - external CGI daemon -Base -mod_cgid.c -cgid_module -Unix threaded MPMs only - - -

    Except for the optimizations and the additional ScriptSock directive noted below, - mod_cgid behaves similarly to mod_cgi. See the - mod_cgi Summary for additional details about - Apache and CGI.

    - -

    On certain unix operating systems, forking a process from a - multi-threaded server is a very expensive operation because the - new process will replicate all the threads of the parent - process. In order to avoid incurring this expense on each CGI - invocation, mod_cgid creates an external daemon that is - responsible for forking child processes to run CGI scripts. The - main server communicates with this daemon using a unix domain - socket.

    - -

    This module is used by default whenever a multi-threaded MPM - is selected during the compilation process. At the user level, - this module is identical in configuration and operation to - mod_cgi. The only exception is the - additional directive ScriptSock which gives the - name of the socket to use for communication with the cgi - daemon.

    -
    - - -ScriptLog - - - -ScriptLogLength - - - -ScriptLogBuffer - - - -ScriptSock -ScriptSock file-path -ScriptSock logs/cgisock -server config - - -

    This directive sets the name of the socket to use for - communication with the CGI daemon. The socket will be opened - using the permissions of the user who starts Apache (usually - root). To maintain the security of communications with CGI - scripts, it is important that no other user has permission to - write in the directory where the socket is located.

    -
    -
    - -
    - diff --git a/docs/manual/mod/mod_charset_lite.html b/docs/manual/mod/mod_charset_lite.html deleted file mode 100644 index 8ae3e490b94042752578cae443b12c2413096f1f..0000000000000000000000000000000000000000 --- a/docs/manual/mod/mod_charset_lite.html +++ /dev/null @@ -1,227 +0,0 @@ - - - - Apache module mod_charset_lite - - - - -

    Module mod_charset_lite

    - -

    - This module is contained in the mod_charset_lite.c file, with - Apache 2.0 and later. It provides the ability to specify character set - translation, or recoding, by directory or location or virtual server. It - is not compiled into the server by default. mod_charset_lite - requires that Apache is compiled with APACHE_XLATE defined. -

    - -

    - This module provides a small subset of configuration mechanisms - implemented by Russian Apache and its associated mod_charset. -

    - -

    Summary

    -

    - This is an experimental module and should be used with - care. Experiment with your mod_charset_lite configuration to - ensure that it performs the desired function. -

    -

    - mod_charset_lite allows the administrator to specify the - source character set of objects as well as the character set they should - be translated into before sending to the client. - mod_charset_lite does not translate the data itself but - instead tells Apache what translation to perform. - mod_charset_lite is applicable to EBCDIC and ASCII - host environments. In an EBCDIC environment, Apache normally translates - text content from the code page of the Apache process locale to - ISO-8859-1. mod_charset_lite can be used to specify that - a different translation is to be performed. In an ASCII environment, - Apache normally performs no translation, so mod_charset_lite - is needed in order for any translation to take place. -

    - -

    Directives

    - - -
    - -

    CharsetSourceEnc

    -

    - Syntax: CharsetSourceEnc charset -
    - Default: None -
    - Context: directory, virtual host -
    - Override: FileInfo -
    - Status: Experimental -
    - Module: mod_charset_lite -
    - Compatibility: Only available in Apache 2.0 or later - -

    - The CharsetSourceEnc directive specifies the source charset - of files in the associated container. -

    - -

    - The value of the charset argument must be accepted as a valid - character set name by the character set support in APR. Generally, this - means that it must be supported by iconv. -

    - - Example: - -
    -    <Directory "/export/home/trawick/apacheinst/htdocs/convert">
    -    CharsetSourceEnc  UTF-16BE
    -    CharsetDefault    ISO8859-1
    -    </Directory>
    -  
    - - The character set names in this example work with the iconv - translation support in Solaris 8. -

    - -

    CharsetDefault

    -

    - Syntax: CharsetDefault charset -
    - Default: None -
    - Context: directory, virtual host -
    - Override: FileInfo -
    - Status: Experimental -
    - Module: mod_charset_lite -
    - Compatibility: Only available in Apache 2.0 or later - -

    - The CharsetDefault directive specifies the charset that - content in the associated container should be translated to. -

    - -

    - The value of the charset argument must be accepted as a valid - character set name by the character set support in APR. Generally, this - means that it must be supported by iconv. -

    - - Example: - -
    -    <Directory "/export/home/trawick/apacheinst/htdocs/convert">
    -    CharsetSourceEnc  UTF-16BE
    -    CharsetDefault    ISO8859-1
    -    </Directory>
    -  
    - -

    - -

    CharsetDebug

    -

    - Syntax: CharsetDebug on/off -
    - Default: off -
    - Context: directory, virtual host -
    - Override: FileInfo -
    - Status: Experimental -
    - Module: mod_charset_lite -
    - Compatibility: Only available in Apache 2.0 or later - -

    - The CharsetDebug directive specifies whether or not - verbose logging should be performed by mod_charset_lite. - Such logging is written to the Apache error log with level - debug. -

    - - - - diff --git a/docs/manual/mod/mod_charset_lite.xml b/docs/manual/mod/mod_charset_lite.xml deleted file mode 100644 index dff19f649b49352018e26768c0ea9b06153c1e7f..0000000000000000000000000000000000000000 --- a/docs/manual/mod/mod_charset_lite.xml +++ /dev/null @@ -1,170 +0,0 @@ - - - - -mod_charset_lite -specify character set translation or recoding -Experimental -mod_charset_lite.c -charset_lite_module - - -

    This is an experimental module and should - be used with care. Experiment with your - mod_charset_lite configuration to ensure that it - performs the desired function.

    - -

    mod_charset_lite allows the administrator to - specify the source character set of objects as well as the - character set they should be translated into before sending to the - client. mod_charset_lite does not translate the - data itself but instead tells Apache what translation to - perform. mod_charset_lite is applicable to EBCDIC - and ASCII host environments. In an EBCDIC environment, Apache - normally translates text content from the code page of the Apache - process locale to ISO-8859-1. mod_charset_lite - can be used to specify that a different translation is to be - performed. In an ASCII environment, Apache normally performs no - translation, so mod_charset_lite is needed in - order for any translation to take place.

    - -

    This module provides a small subset of configuration - mechanisms implemented by Russian Apache and its associated - mod_charset.

    -
    - -
    Common Problems - -
    Invalid character set names - -

    The character set name parameters of CharsetSourceEnc and - CharsetDefault - must be acceptable to the translation mechanism used by APR on the - system where mod_charset_lite is deployed. These - character set names are not standardized and are usually not the - same as the corresponding values used in http headers. Currently, - APR can only use iconv(3), so you can easily test your character - set names using the iconv(1) program, as follows:

    - - iconv -f charsetsourceenc-value -t charsetdefault-value - -
    - -
    Mismatch between character set of content and translation - rules - -

    If the translation rules don't make sense for the content, - translation can fail in various ways, including:

    - -
      -
    • The translation mechanism may return a bad return code, - and the connection will be aborted.
    • - -
    • The translation mechanism may silently place special - characters (e.g., question marks) in the output buffer when - it cannot translate the input buffer.
    • -
    -
    -
    - - -CharsetSourceEnc -CharsetSourceEnc charset -server config -virtual hostdirectory -.htaccess - -FileInfo - - -

    The CharsetSourceEnc directive specifies the - source charset of files in the associated container.

    - -

    The value of the charset argument must be accepted - as a valid character set name by the character set support in - APR. Generally, this means that it must be supported by - iconv.

    - Example: - - <Directory "/export/home/trawick/apacheinst/htdocs/convert">
    - CharsetSourceEnc UTF-16BE
    - CharsetDefault ISO8859-1
    - </Directory> -
    -

    The character set names in this example work with the iconv - translation support in Solaris 8.

    -
    -
    - - -CharsetDefault -CharsetDefault charset -server config -virtual hostdirectory -.htaccess - -FileInfo - - -

    The CharsetDefault directive specifies the - charset that content in the associated container should be - translated to.

    - -

    The value of the charset argument must be accepted - as a valid character set name by the character set support in - APR. Generally, this means that it must be supported by - iconv.

    - Example: - - <Directory "/export/home/trawick/apacheinst/htdocs/convert">
    - CharsetSourceEnc UTF-16BE
    - CharsetDefault ISO8859-1
    - </Directory> -
    -
    -
    - - -CharsetOptions -CharsetOptions option [option] ... -CharsetOptions DebugLevel=0 -NoImplicitAdd -server config -virtual hostdirectory -.htaccess - -FileInfo - - -

    The CharsetOptions directive configures certain - behaviors of mod_charset_lite. Option can - be one of

    - -
    -
    DebugLevel=n
    - -
    The DebugLevel keyword allows you to specify - the level of debug messages generated by - mod_charset_lite. By default, no messages are - generated. This is equivalent to DebugLevel=0. - With higher numbers, more debug messages are generated, and - server performance will be degraded. The actual meanings of - the numeric values are described with the definitions of the - DBGLVL_ constants near the beginning of - mod_charset_lite.c.
    - -
    ImplicitAdd | NoImplicitAdd
    - -
    The ImplicitAdd keyword specifies that - mod_charset_lite should implicitly insert its - filter when the configuration specifies that the character - set of content should be translated. If the filter chain is - explicitly configured using the AddOutputFilter directive, - NoImplicitAdd should be specified so that - mod_charset_lite doesn't add its filter.
    -
    -
    -
    - -
    \ No newline at end of file diff --git a/docs/manual/mod/mod_dav.html b/docs/manual/mod/mod_dav.html deleted file mode 100644 index c341095599de023b374d2462fd818ccf4bf72d7a..0000000000000000000000000000000000000000 --- a/docs/manual/mod/mod_dav.html +++ /dev/null @@ -1,272 +0,0 @@ - - - -Apache module mod_dav - - - - - -

    Module mod_dav

    - -This module provides class 1 and class 2 -WebDAV ('Web-based -Distributed Authoring and Versioning') functionality for Apache. -This extension to the HTTP protocol allows creating, moving, -copying, and deleting resources and collections on a remote web -server. - -

    Directives

    - -
    -

    -To enable mod_dav, add the following to a container in your httpd.conf file:

    - -Dav On

    - -Also, specify a valid filename for the DAV lock database by adding the following to the global section in your httpd.conf file:

    - -DavLockDB /tmp/DavLock    (Any web-server writeable filename, without an extension)

    -


    - -

    Dav

    -Syntax: Dav <on | off>
    -Default: - Dav off
    -Context: directory
    -Status: extension
    -Module: mod_dav
    -Compatibility: Apache 1.3.4 and above

    - -Use the Dav directive to enable the WebDAV HTTP methods -for the given container. -You may wish to add a -<Limit> -clause inside the -location -directive to limit access to DAV-enabled locations.

    - - - -
    -Example:

    -DavLockDB /tmp/DavLock
    -
    -<Location /foo>
    -Dav On
    -
    -AuthType Basic
    -AuthName DAV
    -AuthUserFile user.passwd
    -
    -  <LimitExcept GET HEAD OPTIONS>
    -  require user admin
    -  </LimitExcept>
    -</Location>
    -
    -
    - -
    -


    - -

    DavLockDB

    -Syntax: DavLockDB <Full path to lock database>
    -Default: - None
    -Context: server config, virtual host
    -Status: extension
    -Module: mod_dav
    -Compatibility: Apache 1.3.4 and above

    - -Use the DavLockDB directive to specify the full path to the -lock database, excluding an extension. The default (file system) -implementation of mod_dav uses a SDBM database to track user locks. -The utility modules/dav/util/lockview can be -used from the server to display all locks in a lock database.

    - - - -
    -Example:

    -DavLockDB /tmp/DavLock
    -
    -
    -
    - -
    -


    - -

    DavMinTimeout

    -Syntax: DavMinTimeout <seconds>
    -Default: - DavMinTimeout 0
    -Context: directory
    -Status: extension
    -Module: mod_dav
    -Compatibility: Apache 1.3.4 and above

    - -When a client requests a DAV resource lock, it can also specify a time -when the lock will be automatically removed by the server. This value -is only a request, and the server can ignore it or inform the client -of an arbitrary value.

    - -Use the DavMinTimeout directive to specify, in seconds, -the minimum lock timeout to return to a client. Microsoft Web Folders -defaults to a timeout of 120 seconds; the DavMinTimeout -can override this to a higher value (like 600 seconds) to reduce the chance -of the client losing the lock due to network latency.

    - - - -
    -Example:

    -<Location /MSWord>
    -DavMinTimeout 600
    -</Location>
    -
    -
    -
    - -
    -


    - -

    DavDepthInfinity

    -Syntax: DavDepthInfinity <on | off>
    -Default: - DavDepthInfinity off
    -Context: directory
    -Status: extension
    -Module: mod_dav
    -Compatibility: Apache 1.3.4 and above

    - -Use the DavDepthInfinity directive to allow the processing -of PROPFIND requests containing the header 'Depth: Infinity'. -Because this type of request could constitute a denial-of-service attack, -by default it is not allowed. -

    - -


    - -

    LimitXMLRequestBody

    -Syntax: LimitXMLRequestBody <size in bytes>
    -Default: - LimitXMLRequestBody 1000000
    -Context: directory
    -Status: extension
    -Module: mod_dav
    -Compatibility: Apache 1.3.4 and above

    - -Use the LimitXMLRequestBody directive to limit the -size of an XML request which mod_dav will attempt to parse. Specify -a size greater than zero. -

    - - - - diff --git a/docs/manual/mod/mod_dav.xml b/docs/manual/mod/mod_dav.xml deleted file mode 100644 index c7b8f3f5b5b1805c8930aacf9c08405882c652b4..0000000000000000000000000000000000000000 --- a/docs/manual/mod/mod_dav.xml +++ /dev/null @@ -1,136 +0,0 @@ - - ]> - - - -mod_dav -Distributed Authoring and Versioning -(WebDAV) functionality. -Extension -mod_dav.c -dav_module - -

    -

    This module provides class 1 and class 2 WebDAV ('Web-based Distributed - Authoring and Versioning') functionality for Apache. This - extension to the HTTP protocol allows creating, moving, - copying, and deleting resources and collections on a remote web - server.

    - -

    To enable mod_dav, add the following to a container in your - httpd.conf file:

    - -Dav On - -

    Also, specify a valid filename for the DAV lock database by - adding the following to the global section in your - httpd.conf file:

    - -DavLockDB /tmp/DavLock     - (Any web-server writable filename, without an - extension) - -
    - - -Dav -Enable WebDAV HTTP methods -Dav on|off -Dav off -directory - - -

    Use the Dav directive to enable the - WebDAV HTTP methods for the given container. You may wish to add a - Limit clause - inside the location directive to limit access to - DAV-enabled locations.

    - -Example - DavLockDB /tmp/DavLock
    -
    - <Location /foo>
    - Dav On
    -
    - AuthType Basic
    - AuthName DAV
    - AuthUserFile user.passwd
    -
    -   <LimitExcept GET HEAD OPTIONS>
    -   require user admin
    -   </LimitExcept>
    - </Location>
    -
    -
    -
    - - -Location of the DAV lock database -DavLockDB -DavLockDB file-path -server configvirtual host - - - -

    Use the DavLockDB directive to specify - the full path to the lock database, excluding an extension. The - default (file system) implementation of mod_dav uses a SDBM - database to track user locks. The utility - modules/dav/util/lockview can be used from the server - to display all locks in a lock database.

    - -Example -DavLockDB /tmp/DavLock - -
    -
    - - -DavMinTimeout -Minimum amount of time the server holds a lock on -a DAV resource -DavMinTimeout seconds -DavMinTimeout 0 -directory - - -

    When a client requests a DAV resource lock, it can also - specify a time when the lock will be automatically removed by - the server. This value is only a request, and the server can - ignore it or inform the client of an arbitrary value.

    - -

    Use the DavMinTimeout directive to specify, in - seconds, the minimum lock timeout to return to a client. - Microsoft Web Folders defaults to a timeout of 120 seconds; the - DavMinTimeout can override this to a higher value - (like 600 seconds) to reduce the chance of the client losing - the lock due to network latency.

    - -Example - <Location /MSWord>
    - DavMinTimeout 600
    - </Location>
    -
    -
    -
    - - -DavDepthInfinity -Allow PROPFIND, Depth: Infinity requests -DavDepthInfinity on|off -DavDepthInfinity off -directory - - -

    Use the DavDepthInfinity directive to - allow the processing of PROPFIND requests containing the header - 'Depth: Infinity'. Because this type of request could constitute a - denial-of-service attack, by default it is not allowed.

    -
    -
    - - - - diff --git a/docs/manual/mod/mod_deflate.html b/docs/manual/mod/mod_deflate.html deleted file mode 100755 index 48c190fc2d188943b6a84291cf8356d1a3e9e916..0000000000000000000000000000000000000000 --- a/docs/manual/mod/mod_deflate.html +++ /dev/null @@ -1,129 +0,0 @@ - - - - - - - Apache module mod_deflate - - - - - - -

    Module mod_deflate

    - -

    This module provides the ability to set environment - variables based upon attributes of the request.

    - -

    Status: Experimental
    - Source File: - mod_deflate.c
    - Module Identifier: - deflate_module
    - Compatibility: Available in - Apache 2.0 and later.

    - -

    Summary

    - -

    The experimental mod_deflate module allows - output from your server to be compressed before being sent - to the client over the network.

    - -

    Directives

    - - -
    - - -

    DeflateFilterNote - directive

    - -

    Syntax: DeflateFilterNote notename -
    - Default: none
    - Context: server config
    - Override: none
    - Status: Experimental
    - Module: mod_deflate
    - Compatibility: Apache 2.0 and - above

    - -

    The DeflateFilterNote directive specifies that a note about - compression ratios should be attached to the request. The name - of the note is the value specified for the directive.

    - -
    - - -

    DeflateWindowSize directive

    - -

    Syntax: DeflateWindowSize - value
    - Default: none
    - Context: server config
    - Override: none
    - Status: Experimental
    - Module: mod_deflate
    - Compatibility: Apache 2.0 and - above

    - -

    The DeflateWindowSize directive specifies the - zlib compression window size.

    - -
    - - -

    DeflateMemLevel - directive

    - -

    Syntax: DeflateMemLevel - value
    - Default: none
    - Context: server config
    - Override: none
    - Status: Experimental
    - Module: mod_deflate
    - Compatibility: Apache 2.0 and - above

    - -

    The DeflateMemLevel directive specifies the amount of - memory available to zlib for compression.

    - - - - diff --git a/docs/manual/mod/mod_deflate.xml b/docs/manual/mod/mod_deflate.xml deleted file mode 100644 index 44b5efda36f60c324ae8ec2e0d4741ba7f443808..0000000000000000000000000000000000000000 --- a/docs/manual/mod/mod_deflate.xml +++ /dev/null @@ -1,88 +0,0 @@ - - ]> - - - -mod_deflate -Compress content before - it is delivered to the client -experimental -mod_deflate.c -deflate_module - - -

    The experimental mod_deflate module provides - the DEFLATE output filter that allows output from - your server to be compressed before being sent to the client over - the network.

    -
    -AddOutputFilter -SetOutputFilter - -
    Enabling Compression - -

    Compression is implemented by the DEFLATE - filter. The following directive - will enable compression for documents in the container where it - is placed:

    -

    Most popular browsers can not handle compression of all content - so you may want to enable the 'gzip-only-text/html' note (see below) -

    - -SetEnv gzip-only-text/html 1
    -SetOutputFilter DEFLATE -
    - -

    Here is an example of enabling compression for the Apache - documentation:

    - - -<Directory "/your-server-root/manual">
    - SetEnv gzip-only-text/html 1
    - SetOutputFilter DEFLATE
    -</Directory> -
    -
    - - -DeflateFilterNote -Places the compression ratio in a note for logging -DeflateFilterNote notename -server config - - -

    The DeflateFilterNote directive - specifies that a note about compression ratios should be attached - to the request. The name of the note is the value specified for - the directive.

    -
    -
    - - -DeflateWindowSize -Zlib compression window size -DeflateWindowSize value -server config - - - -

    The DeflateWindowSize directive specifies the - zlib compression window size.

    -
    -
    - - -DeflateMemLevel -Amount of memory available to zlib for compression -DeflateMemLevel value -server config - - - -

    The DeflateMemLevel directive specifies - the amount of memory available to zlib for compression.

    -
    -
    - -
    - diff --git a/docs/manual/mod/mod_dir.html b/docs/manual/mod/mod_dir.html deleted file mode 100644 index 960c89ca13f5629abc1c5c18cd3582b8deb5b741..0000000000000000000000000000000000000000 --- a/docs/manual/mod/mod_dir.html +++ /dev/null @@ -1,309 +0,0 @@ - - - - -Apache module mod_dir - - - - - -

    Module mod_dir

    - -This module is contained in the mod_dir.c file, and -is compiled in by default. It provides for directory indexing. - -

    Summary

    -This module controls the directory indexing. The index of a directory -can come from one of two sources: -
      -
    • A file written by the user, typically called index.html. -The DirectoryIndex directive sets the name -of this file. -
    • Otherwise, a listing generated by the server. The other directives -control the format of this listing. The AddIcon, -AddIconByEncoding and -AddIconByType are used to set a list of -icons to display for various file types; for each file listed, the -first icon listed that matches the file is displayed. -
    - - -

    Directives

    - - -
  • AddDescription -
  • AddIcon -
  • AddIconByEncoding -
  • AddIconByType -
  • DefaultIcon -
  • DirectoryIndex -
  • FancyIndexing -
  • HeaderName -
  • IndexIgnore -
  • IndexOptions -
  • ReadmeName -
  • -
    - - -

    AddDescription

    - -Syntax: AddDescription string file file...
    -Context: server config, virtual host, directory, .htaccess
    -Override: Indexes
    -Status: Base
    -Module: mod_dir

    - -This sets the description to display for a file, for -FancyIndexing. File is a file -extension, partial filename, wildcard expression or full filename for files -to describe. String is enclosed in double quotes -("). Example: -

    AddDescription "The planet Mars" /web/pics/mars.gif -


    - -

    AddIcon

    - -Syntax: AddIcon icon name name ...
    -Context: server config, virtual host, directory, .htaccess
    -Override: Indexes
    -Status: Base
    -Module: mod_dir

    - -This sets the icon to display next to a file ending in name for -FancyIndexing. Icon is either a -(%-escaped) relative URL to the icon, or of the format -(alttext,url) where alttext is the text tag given -for an icon for non-graphical browsers.

    - -Name is either ^^DIRECTORY^^ for directories, ^^BLANKICON^^ for -blank lines (to format the list correctly), a file extension, a wildcard -expression, a partial filename or a complete filename. Examples: -

    -AddIcon (IMG,/icons/image.xbm) .gif .jpg .xbm
    -AddIcon /icons/dir.xbm ^^DIRECTORY^^
    -AddIcon /icons/backup.xbm *~ -
    -AddIconByType should be used in preference to -AddIcon, when possible.


    - -

    AddIconByEncoding

    - -Syntax: AddIconByEncoding icon mime-encoding mime-encoding -...
    -Context: server config, virtual host, directory, .htaccess
    -Override: Indexes
    -Status: Base
    -Module: mod_dir

    - -This sets the icon to display next to files with -mime-encoding for FancyIndexing. -Icon is either a (%-escaped) relative URL to the icon, or of the -format (alttext,url) where alttext is the text tag -given for an icon for non-graphical browsers.

    - -Mime-encoding is a wildcard expression matching required the -content-encoding. Examples: -

    -AddIconByEncoding /icons/compress.xbm x-compress -


    - -

    AddIconByType

    - -Syntax: AddIconByType icon mime-type mime-type ...
    -Context: server config, virtual host, directory, .htaccess
    -Override: Indexes
    -Status: Base
    -Module: mod_dir

    - -This sets the icon to display next to files of type mime-type for -FancyIndexing. Icon is either a -(%-escaped) relative URL to the icon, or of the format -(alttext,url) where alttext is the text tag given -for an icon for non-graphical browsers.

    -Mime-type is a wildcard expression matching required the mime types. -Examples: -

    -AddIconByType (IMG,/icons/image.xbm) image/* -


    - -

    DefaultIcon

    - -Syntax: DefaultIcon url
    -Context: server config, virtual host, directory, .htaccess
    -Override: Indexes
    -Status: Base
    -Module: mod_dir

    - -The DefaultIcon directive sets the icon to display for files when no -specific icon is known, for FancyIndexing. -Url is a (%-escaped) relative URL to the icon. Examples: -

    -DefaultIcon /icon/unknown.xbm -


    - -

    DirectoryIndex

    - -Syntax: DirectoryIndex local-url local-url ...
    -Default: DirectoryIndex index.html
    -Context: server config, virtual host, directory, .htaccess
    -Override: Indexes
    -Status: Base
    -Module: mod_dir

    - -The DirectoryIndex directive sets the list of resources to look for, when -the client requests an index of the directory by specifying a NULL file -at the end of the a directory name. Local-url is the (%-encoded) URL -of a document on the server relative to the requested directory; it is usually -the name of a file in the directory. Several URLs may be given; the server -will return the first one that it finds. If none of the resources exist, -then the server will generate its own listing of the directory. -Example: -

    -DirectoryIndex index.html -
    -then a request for http://myserver/docs/ would return -http://myserver/docs/index.html if it exists, or would list -the directory if it did not.

    - -Note that the documents do not need to be relative to the directory; -

    -DirectoryIndex index.html index.txt /cgi-bin/index.pl
    -would cause the CGI script /cgi-bin/index.pl to be executed -if neither index.html or index.txt existed in -a directory.


    - -

    FancyIndexing

    - -Syntax: FancyIndexing boolean
    -Context: server config, virtual host, directory, .htaccess
    -Override: Indexes
    -Status: Base
    -Module: mod_dir

    - -The FancyIndexing directive sets the FancyIndexing option for a directory. -Boolean can be on or off. The -IndexOptions directive should be used in -preference.


    - -

    HeaderName

    - -Syntax: HeaderName filename
    -Context: server config, virtual host, directory, .htaccess
    -Override: Indexes
    -Status: Base
    -Module: mod_dir

    - -The HeaderName directive sets the name of the file that will be inserted -at the top of the index listing. Filename is the name of the file -to include, and is taken to be relative to the directory being indexed. -The server first attempts to include filename.html -as an HTML document, otherwise it will include filename as plain -text. Example: -

    HeaderName HEADER
    -when indexing the directory /web, the server will first look for -the HTML file /web/HEADER.html and include it if found, otherwise -it will include the plain text file /web/HEADER, if it exists. - -

    See also ReadmeName.


    - -

    IndexIgnore

    - -Syntax: IndexIgnore file file ...
    -Context: server config, virtual host, directory, .htaccess
    -Override: Indexes
    -Status: Base
    -Module: mod_dir

    - -The IndexIgnore directive adds to the list of files to hide when listing -a directory. File is a file extension, partial filename, -wildcard expression or full filename for files to ignore. Multiple -IndexIgnore directives add to the list, rather than the replacing the list -of ignored files. By default, the list contains `.'. Example: -

    -IndexIgnore README .htaccess *~ -


    - -

    IndexOptions

    - -Syntax: IndexOptions option option ...
    -Context: server config, virtual host, directory, .htaccess
    -Override: Indexes
    -Status: Base
    -Module: mod_dir

    - -The IndexOptions directive specifies the behaviour of the directory indexing. -Option can be one of -

    -
    FancyIndexing -
    -This turns on fancy indexing of directories. -
    IconsAreLinks -
    - -This makes the icons part of the anchor for the filename, for -fancy indexing. -
    ScanHTMLTitles -
    -This enables the extraction of the title from HTML documents for fancy -indexing. If the file does not have a description given by -AddDescription then httpd will read the -document for the value of the TITLE tag. This is CPU and disk intensive. -
    SuppressLastModified -
    - -This will suppress the display of the last modification date, in fancy -indexing listings. -
    SuppressSize -
    - -This will suppress the file size in fancy indexing listings. -
    SuppressDescription -
    - -This will suppress the file description in fancy indexing listings. -
    -This default is that no options are enabled. If multiple IndexOptions -could apply to a directory, then the most specific one is taken complete; -the options are not merged. For example: -
    -<Directory /web/docs>
    -IndexOptions FancyIndexing
    -</Directory>
    -<Directory /web/docs/spec>
    -IndexOptions ScanHTMLTitles
    -</Directory> -
    -then only ScanHTMLTitles will be set for the /web/docs/spec -directory.


    - -

    ReadmeName

    - -Syntax: ReadmeName filename
    -Context: server config, virtual host, directory, .htaccess
    -Override: Indexes
    -Status: Base
    -Module: mod_dir

    - -The ReadmeName directive sets the name of the file that will be appended -to the end of the index listing. Filename is the name of the file -to include, and is taken to be relative to the directory being indexed. -The server first attempts to include filename.html -as an HTML document, otherwise it will include filename as plain -text. Example: -

    ReadmeName README
    -when indexing the directory /web, the server will first look for -the HTML file /web/README.html and include it if found, otherwise -it will include the plain text file /web/README, if it exists. - -

    See also HeaderName.

    - - -


    -Home -Index - - - - diff --git a/docs/manual/mod/mod_dir.xml b/docs/manual/mod/mod_dir.xml deleted file mode 100644 index 850aa63872e0975966ffb4c3e6b1b58cea1b9817..0000000000000000000000000000000000000000 --- a/docs/manual/mod/mod_dir.xml +++ /dev/null @@ -1,81 +0,0 @@ - - - - -mod_dir -Provides for "trailing slash" redirects and - serving directory index files. -Base -mod_dir.c -dir_module - - -

    The index of a directory can come from one of two sources:

    - -
      -
    • A file written by the user, typically called - index.html. The DirectoryIndex directive sets the - name of this file. This is controlled by - mod_dir.
    • - -
    • Otherwise, a listing generated by the server. This is - provided by mod_autoindex.
    • -
    -

    The two functions are separated so that you can completely - remove (or replace) automatic index generation should you want - to.

    - -

    A "trailing slash" redirect is issued when the server - receives a request for a URL - http://servername/foo/dirname where - dirname is a directory. Directories require a - trailing slash, so mod_dir issues a redirect to - http://servername/foo/dirname/.

    -
    - - -List of resources to look for when the client requests -a directory -DirectoryIndex -DirectoryIndex - local-url [local-url] ... -DirectoryIndex index.html -server config -virtual host -directory -.htaccess - -Indexes - - -

    The DirectoryIndex directive sets the - list of resources to look for, when the client requests an index - of the directory by specifying a / at the end of the a directory - name. Local-url is the (%-encoded) URL of a document on - the server relative to the requested directory; it is usually the - name of a file in the directory. Several URLs may be given, in - which case the server will return the first one that it finds. If - none of the resources exist and the Indexes option is - set, the server will generate its own listing of the - directory.

    - -Example -DirectoryIndex index.html - - -

    then a request for http://myserver/docs/ would - return http://myserver/docs/index.html if it - exists, or would list the directory if it did not.

    - -

    Note that the documents do not need to be relative to the - directory;

    - -DirectoryIndex index.html index.txt /cgi-bin/index.pl -

    would cause the CGI script /cgi-bin/index.pl to be - executed if neither index.html or - index.txt existed in a directory.

    -
    -
    - -
    \ No newline at end of file diff --git a/docs/manual/mod/mod_env.html b/docs/manual/mod/mod_env.html deleted file mode 100644 index 3e32d26080504b117345c4505809078256e2a84c..0000000000000000000000000000000000000000 --- a/docs/manual/mod/mod_env.html +++ /dev/null @@ -1,68 +0,0 @@ - - - -Apache module mod_env - - - - -

    Apache module mod_env

    - -This module is contained in the mod_env.c file, and -is not compiled in by default. It provides for -passing environment variables to CGI/SSI scripts. Is is only available -in Apache 1.1 and later. - -

    Summary

    - -This module allows Apache's CGI and SSI environment to inherit -environment variables from the shell which invoked the httpd process. -CERN webservers are able to do this, so this module is especially -useful to webadmins who wish to migrate from CERN to Apache without -rewriting all their scripts - -

    Directives

    - - -
    - -

    PassEnv

    -Syntax: PassEnv variable
    -Context: server config, virtual host
    -Status: Base
    -Module: mod_env
    -Compatibility: PassEnv is only available in -Apache 1.1 and later.

    - -Passes an environment variable to CGI scripts from the servers's own -environment. Example: -

    -    PassEnv LD_LIBRARY_PATH
    -
    - - -

    SetEnv

    -Syntax: SetEnv variable value
    -Context: server config, virtual host
    -Status: Base
    -Module: mod_env
    -Compatibility: SetEnv is only available in -Apache 1.1 and later.

    - -Sets an environment variable, which is then passed on to CGI -scripts. Example: -

    -    SetEnv SPECIAL_PATH /foo/bin
    -
    - -


    - -Home -Index - - - - diff --git a/docs/manual/mod/mod_env.xml b/docs/manual/mod/mod_env.xml deleted file mode 100644 index a502fb5745ce0e278c508afc6d4b2edcca9afcb7..0000000000000000000000000000000000000000 --- a/docs/manual/mod/mod_env.xml +++ /dev/null @@ -1,80 +0,0 @@ - - - - -mod_env - Modifies the environment which is - passed to CGI scripts and SSI pages - Base - mod_env.c - env_module - -

    This module allows for control of the environment that will - be provided to CGI scripts and SSI pages. Environment variables - may be passed from the shell which invoked the httpd process. - Alternatively, environment variables may be set or unset within - the configuration process.

    -
    - Environment Variables - - - PassEnv - Passes environment variables from the shell - PassEnv - env-variable [env-variable] ... - - server configvirtual host - directory.htaccess - - FileInfo - - -

    Specifies one or more environment variables to pass to CGI - scripts and SSI pages from the environment of the shell which - invoked the httpd process. Example:

    - - PassEnv LD_LIBRARY_PATH - -
    -
    - - -SetEnv -Sets environment variables -SetEnv env-variable value - -server configvirtual host -directory.htaccess - -FileInfo - - -

    Sets an environment variable, which is then passed on to CGI - scripts and SSI pages. Example:

    - - SetEnv SPECIAL_PATH /foo/bin - -
    -
    - - -UnsetEnv -Removes variables from the environment -UnsetEnv env-variable [env-variable] ... - -server configvirtual host -directory.htaccess - -FileInfo - - -

    Removes one or more environment variables from those passed - on to CGI scripts and SSI pages. Example:

    - - UnsetEnv LD_LIBRARY_PATH - -
    -
    - -
    - diff --git a/docs/manual/mod/mod_example.html b/docs/manual/mod/mod_example.html deleted file mode 100644 index 05fb8ef7211b10c7e4a2134c4940825c59d5be9b..0000000000000000000000000000000000000000 --- a/docs/manual/mod/mod_example.html +++ /dev/null @@ -1,133 +0,0 @@ - - - - Apache module mod_example - - - -

    Module mod_example

    -

    - This module is contained in the modules/mod_example.c file, and - is not compiled in by default. It illustrates many of - the aspects of the - Apache 1.2 API - and, when used, demonstrates the manner in which module callbacks are - triggered by the server. -

    -

    Summary

    -

    - The files in the src/modules/example directory under the - Apache distribution directory tree are provided as an example to those - that wish to write modules that use the Apache API. -

    -

    - The main file is mod_example.c, which illustrates all - the different callback mechanisms and call syntaces. By no means does - an add-on module need to include routines for all of the callbacks - - quite the contrary! -

    -

    - The example module is an actual working module. If you link it into - your server, enable the "example-handler" handler for a location, and - then browse to that location, you will see a display of - some of the tracing the example module did as the various callbacks - were made. -

    -

    - To include the example module in your server, follow the steps below: -

    -
      -
    1. Uncomment the "Module example_module" line near the bottom of - the src/Configuration file. If there isn't one, add - it; it should look like this: -
      -     Module example_module        modules/example/mod_example.o
      -    
      -
    2. -
    3. Run the src/Configure script - ("cd src; ./Configure"). This will - build the Makefile for the server itself, and update the - src/modules/Makefile for any additional modules you - have requested from beneath that subdirectory. -
    4. -
    5. Make the server (run "make" in the src - directory). -
    6. -
    -

    - To add another module of your own: -

    -
      -
    1. mkdir src/modules/mymodule -
    2. -
    3. cp src/modules/example/* src/modules/mymodule -
    4. -
    5. Modify the files in the new directory. -
    6. -
    7. Follow steps [1] through [3] above, with appropriate changes. -
    8. -
    -

    - Using the mod_example Module -

    -

    - To activate the example module, include a block similar to the - following in your srm.conf file: -

    -
    -   <Location /example-info>
    -       SetHandler example-handler
    -   </Location>
    -  
    -

    - As an alternative, you can put the following into a - .htaccess - file and then request the file "test.example" from that - location: -

    -
    -   AddHandler example-handler .example
    -  
    -

    - After reloading/restarting your server, you should be able to browse - to this location and see the brief display mentioned earlier. -

    -

    Directives

    -

    -

    -

    -
    - -

    Example

    -
    -

    - Syntax: Example -
    - Default: None -
    - Context: server config, virtual host, directory, .htaccess -
    - Override: Options -
    - Status: Extension -
    - Module: mod_example -

    -

    - The Example directive activates the example module's content handler - for a particular location or file type. It takes no arguments. If - you browse to an URL to which the example content-handler applies, you - will get a display of the routines within the module and how and in - what order they were called to service the document request. -

    - - - diff --git a/docs/manual/mod/mod_example.xml b/docs/manual/mod/mod_example.xml deleted file mode 100644 index 97bd72f71a5636c9c9a3357fa338953762d9a345..0000000000000000000000000000000000000000 --- a/docs/manual/mod/mod_example.xml +++ /dev/null @@ -1,120 +0,0 @@ - - - - - -mod_example -Illustrates the Apache module API -Experimental -mod_example.c -example_module - - - - This document has not been updated - to take into account changes made in the 2.0 version of the - Apache HTTP Server. Some of the information may still be - relevant, but please use it with care. - - -

    The files in the src/modules/example directory - under the Apache distribution directory tree are provided as an - example to those that wish to write modules that use the Apache - API.

    - -

    The main file is mod_example.c, which - illustrates all the different callback mechanisms and call - syntaxes. By no means does an add-on module need to include - routines for all of the callbacks - quite the contrary!

    - -

    The example module is an actual working module. If you link - it into your server, enable the "example-handler" handler for a - location, and then browse to that location, you will see a - display of some of the tracing the example module did as the - various callbacks were made.

    -
    - -
    Compiling the example module - -

    To include the example module in your server, follow the - steps below:

    - -
      -
    1. - Uncomment the "AddModule modules/example/mod_example" line - near the bottom of the src/Configuration file. - If there isn't one, add it; it should look like this: - - AddModule modules/example/mod_example.o - -
    2. - -
    3. Run the src/Configure script - ("cd src; ./Configure"). This will - build the Makefile for the server itself, and update the - src/modules/Makefile for any additional modules - you have requested from beneath that subdirectory.
    4. - -
    5. Make the server (run "make" in the - src directory).
    6. -
    - -

    To add another module of your own:

    - -
      -
    1. mkdir src/modules/mymodule
    2. - -
    3. cp src/modules/example/* - src/modules/mymodule
    4. - -
    5. Modify the files in the new directory.
    6. - -
    7. Follow steps [1] through [3] above, with appropriate - changes.
    8. -
    -
    - -
    Using the <code>mod_example</code> Module - -

    To activate the example module, include a block similar to - the following in your srm.conf file:

    - - <Location /example-info>
    - SetHandler example-handler
    - </Location> -
    - -

    As an alternative, you can put the following into a .htaccess file - and then request the file "test.example" from that location:

    - - AddHandler example-handler .example - - -

    After reloading/restarting your server, you should be able - to browse to this location and see the brief display mentioned - earlier.

    -
    - - -Example -Demonstration directive to illustrate the Apache module -API -Example -server config -virtual hostdirectory -.htaccess - - -

    The Example directive just sets a demonstration - flag which the example module's content handler displays. It - takes no arguments. If you browse to an URL to which the - example content-handler applies, you will get a display of the - routines within the module and how and in what order they were - called to service the document request. The effect of this - directive one can observe under the point "Example - directive declared here: YES/NO".

    -
    -
    - -
    diff --git a/docs/manual/mod/mod_expires.html b/docs/manual/mod/mod_expires.html deleted file mode 100644 index 4dbab5f246902c397c62e5fe6fc904d132a9e8ba..0000000000000000000000000000000000000000 --- a/docs/manual/mod/mod_expires.html +++ /dev/null @@ -1,178 +0,0 @@ - - - - Apache module mod_expires - - - -

    Module mod_expires

    -

    - This module is contained in the mod_expires.c file, and - is not compiled in by default. It provides for the - generation of Expires headers according to user-specified - criteria. -

    -

    Summary

    -

    - This module controls the setting of the Expires HTTP - header in server responses. The expiration date can set to be - relative to either the time the source file was last modified, or to - the time of the client access. -

    -

    - The Expires HTTP header is an instruction to the client - about the document's validity and persistence. If cached, the document - may be fetched from the cache rather than from the source until this - time has passed. After that, the cache copy is considered - "expired" and invalid, and a new copy must be obtained from - the source. -

    -

    Directives

    -

    -

    -
  • ExpiresActive -
  • -
  • ExpiresByType -
  • -
  • ExpiresDefault -
  • -
    -
    - -

    ExpiresActive directive

    -
    - -

    - Syntax: ExpiresActive boolean -
    - Context: server config, virtual host, directory, .htaccess -
    - Override: Indexes -
    - Status: Extension -
    - Module: mod_expires -

    -

    - This directive enables or disables the generation of the - Expires header for the document realm in question. (That - is, if found in an .htaccess file, for instance, it - applies only to documents generated from that directory.) If set to - Off, no Expires header will be - generated for any document in the realm (unless overridden at a lower - level, such as an .htaccess file overriding a server - config file). If set to On, the header will be - added to served documents according to the criteria defined by the - ExpiresByType - and - ExpiresDefault - directives (q.v.). -

    -

    - Note that this directive does not guarantee that an - Expires header will be generated. If the criteria aren't - met, no header will be sent, and the effect will be as though this - directive wasn't even specified. -

    -
    - -

    ExpiresByType directive

    -
    - -

    - Syntax: ExpiresByType mime-type <code>seconds -
    - Context: server config, virtual host, directory, .htaccess -
    - Override: Indexes -
    - Status: Extension -
    - Module: mod_expires -

    -

    - This directive defines the value of the Expires header - generated for documents of the specified type (e.g., - text/html). The second argument sets the number of - seconds that will be added to a base time to construct the expiration - date. -

    -

    - The base time is either the last modification time of the file, or the - time of the client's access to the document. Which should be used is - specified by the <code> field; - M means that the file's last modification time should - be used as the base time, and A means the client's - access time should be used. -

    -

    - The difference in effect is subtle. If M is used, all current - copies of the document in all caches will expire at the same time, - which can be good for something like a weekly notice that's always - found at the same URL. If A is used, the date of expiration - is different for each client; this can be good for image files that - don't change very often, particularly for a set of related documents - that all refer to the same images (i.e., the images will be - accessed repeatedly within a relatively short timespan). -

    -

    - Example: -

    -

    -

    -   ExpiresActive On                  # enable expirations
    -   ExpiresByType image/gif A2592000  # expire GIF images after a month
    -                                     #  in the client's cache
    -   ExpiresByType text/html M604800   # HTML documents are good for a
    -                                     #  week from the time they were
    -                                     #  changed, period
    -  
    -

    -

    - Note that this directive only has effect if ExpiresActive - On has been specified. It overrides, for the specified MIME - type only, any expiration date set by the - ExpiresDefault - directive. -

    -
    - -

    ExpiresDefault directive

    -
    - -

    - Syntax: ExpiresDefault <code>seconds -
    - Context: server config, virtual host, directory, .htaccess -
    - Override: Indexes -
    - Status: Extension -
    - Module: mod_expires -

    -

    - This directive sets the default algorithm for calculating the - expiration time for all documents in the affected realm. It can be - overridden on a type-by-type basis by the - ExpiresByType - directive. See the description of that directive for details about - the syntax of the argument. -

    - - - diff --git a/docs/manual/mod/mod_expires.xml b/docs/manual/mod/mod_expires.xml deleted file mode 100644 index 90ddbe3a7e156ac067c05259f4cf525c94e0d0fd..0000000000000000000000000000000000000000 --- a/docs/manual/mod/mod_expires.xml +++ /dev/null @@ -1,208 +0,0 @@ - - - - - -mod_expires -Generation of - Expires HTTP headers according to user-specified - criteria -Extension -mod_expires.c -expires_module - - -

    This module controls the setting of the Expires - HTTP header in server responses. The expiration date can set to - be relative to either the time the source file was last - modified, or to the time of the client access.

    - -

    The Expires HTTP header is an instruction to - the client about the document's validity and persistence. If - cached, the document may be fetched from the cache rather than - from the source until this time has passed. After that, the - cache copy is considered "expired" and invalid, and a new copy - must be obtained from the source.

    -
    - -
    Alternate Interval - Syntax - -

    The ExpiresDefault and - ExpiresByType directives - can also be defined in a more readable syntax of the form:

    - - - ExpiresDefault "<base> [plus] {<num> - <type>}*"
    - ExpiresByType type/encoding "<base> [plus] - {<num> <type>}*" -
    - -

    where <base> is one of:

    - -
      -
    • access
    • - -
    • now (equivalent to - 'access')
    • - -
    • modification
    • -
    - -

    The 'plus' keyword is optional. <num> - should be an integer value [acceptable to atoi()], - and <type> is one of:

    - -
      -
    • years
    • - -
    • months
    • - -
    • weeks
    • - -
    • days
    • - -
    • hours
    • - -
    • minutes
    • - -
    • seconds
    • -
    - -

    For example, any of the following directives can be used to - make documents expire 1 month after being accessed, by - default:

    - - - ExpiresDefault "access plus 1 month"
    - ExpiresDefault "access plus 4 weeks"
    - ExpiresDefault "access plus 30 days" -
    - -

    The expiry time can be fine-tuned by adding several - '<num> <type>' clauses:

    - - -ExpiresByType text/html "access plus 1 month 15 - days 2 hours"
    - ExpiresByType image/gif "modification plus 5 hours 3 - minutes" -
    - -

    Note that if you use a modification date based setting, the - Expires header will not be added to content - that does not come from a file on disk. This is due to the fact - that there is no modification time for such content.

    -
    - - -ExpiresActive -Enables generation of Expires headers -ExpiresActive On|Off -server config -virtual hostdirectory -.htaccess -Indexes - - -

    This directive enables or disables the generation of the - Expires header for the document realm in question. - (That is, if found in an .htaccess file, for - instance, it applies only to documents generated from that - directory.) If set to Off, no - Expires header will be generated for any document - in the realm (unless overridden at a lower level, such as an - .htaccess file overriding a server config file). - If set to On, the header will be added to - served documents according to the criteria defined by the - ExpiresByType and - ExpiresDefault directives - (q.v.).

    - -

    Note that this directive does not guarantee that an - Expires header will be generated. If the criteria - aren't met, no header will be sent, and the effect will be as - though this directive wasn't even specified.

    -
    -
    - - -ExpiresByType -Value of the Expires header configured -by MIME type -ExpiresByType - MIME-type <code>seconds -server config -virtual hostdirectory -.htaccess -Indexes - - -

    This directive defines the value of the Expires - header generated for documents of the specified type - (e.g., text/html). The second argument - sets the number of seconds that will be added to a base time to - construct the expiration date.

    - -

    The base time is either the last modification time of the - file, or the time of the client's access to the document. Which - should be used is specified by the - <code> field; M - means that the file's last modification time should be used as - the base time, and A means the client's access - time should be used.

    - -

    The difference in effect is subtle. If M is used, - all current copies of the document in all caches will expire at - the same time, which can be good for something like a weekly - notice that's always found at the same URL. If A is - used, the date of expiration is different for each client; this - can be good for image files that don't change very often, - particularly for a set of related documents that all refer to - the same images (i.e., the images will be accessed - repeatedly within a relatively short timespan).

    - -

    Example:

    - -# enable expirations
    -ExpiresActive On
    -# expire GIF images after a month in the client's cache
    -ExpiresByType image/gif A2592000
    -# HTML documents are good for a week from the time they were changed
    -ExpiresByType text/html M604800 -
    - -

    Note that this directive only has effect if - ExpiresActive On has been specified. It overrides, - for the specified MIME type only, any expiration date - set by the ExpiresDefault - directive.

    - -

    You can also specify the expiration time calculation using - an alternate syntax, described earlier in - this document.

    -
    -
    - - -ExpiresDefault -Default algorithm for calculating expiration time -ExpiresDefault <code>seconds -server config -virtual hostdirectory -.htaccess -Indexes - - -

    This directive sets the default algorithm for calculating the - expiration time for all documents in the affected realm. It can be - overridden on a type-by-type basis by the ExpiresByType directive. See the - description of that directive for details about the syntax of the - argument, and the alternate syntax - description as well.

    -
    -
    -
    - diff --git a/docs/manual/mod/mod_ext_filter.html b/docs/manual/mod/mod_ext_filter.html deleted file mode 100644 index 0886782352bf36e541cc88c8a8b10a93de58f2ad..0000000000000000000000000000000000000000 --- a/docs/manual/mod/mod_ext_filter.html +++ /dev/null @@ -1,286 +0,0 @@ - - - - Apache module mod_ext_filter - - - - -

    Module mod_ext_filter

    - -

    - This module is contained in the mod_ext_filter.c file, with - Apache 2.0 and later. It provides the ability to pass the response body - through an external program before delivering to the client. - mod_ext_filter is not compiled into the server by default. -

    - -

    Summary

    -

    - This is an experimental module and should be used with - care. Test your mod_ext_filter configuration carefully to - ensure that it performs the desired function. You may wish to review - XXX for background on the Apache filtering model. -

    - -

    - mod_ext_filter presents a simple and familiar programming - model for filters. With this module, a program which reads from stdin and - writes to stdout (i.e., a Unix-style filter command) can be a filter for - Apache. This filtering mechanism is much slower than using a filter which - is specially written for the Apache API and runs inside of the Apache - server process, but it does have the following benefits: -

    - -
      -
    • the programming model is much simpler -
    • any programming/scripting language can be used, provided that - it allows the program to read from standard input and write to standard - output -
    • existing programs can be used unmodified as Apache filters -
    - -

    - Even when the performance characteristics are not suitable for production - use, mod_ext_filter can be used as a prototype environment - for filters. -

    - -

    Directives

    - - -
    - -

    ExtFilterDefine

    -

    - Syntax: ExtFilterDefine filtername parameters -
    - Default: None -
    - Context: server -
    - Override: none -
    - Status: Experimental -
    - Module: mod_ext_filter -
    - Compatibility: Only available in Apache 2.0 or later - -

    - The ExtFilterDefine directive defines the characteristics of - an external filter, including the program to run and its arguments. -

    - -

    - filtername specifies the name of the filter being defined. This name - can then be used in AddOutputFilter directives. It must be unique among all - registered filters. At the present time, no error is reported by the - register-filter API, so a problem with duplicate names isn't reported to the - user. -

    - -

    - Subsequent parameters can appear in any order and define the external command - to run and certain other characteristics. The only required parameter is - cmd=. These parameters are: -

    - -
    -
    cmd=cmdline -
    - The cmd= keyword allows you to specify the external command - to run. If there are arguments after the program name, the command line - should be surrounded in quotation marks. -
    mode=mode -
    - mode should be output for now (the default). In the - future, mode=input will be used to specify a filter for request - bodies. -
    intype=imt -
    - This parameter specifies the internet media - type (i.e., MIME type) of documents which should be filtered. By default, - all documents are filtered. If intype= is specified, - the filter will be disabled for documents of other types. -
    outtype=imt -
    - This parameter specifies the internet media - type (i.e., MIME type) of filtered documents. It is useful when the filter - changes the internet media type as part of the filtering operation. By - default, the internet media type is unchanged. -
    PreservesContentLength -
    - The PreservesContentLength keyword specifies that the filter - preserves the content length. This is not the default, as most filters - change the content length. In the event that the filter doesn't modify the - length, this keyword should be specified. -
    - -

    ExtFilterOptions

    -

    - Syntax: ExtFilterOptions option option ... -
    - Default: DebugLevel=0 NoLogStderr -
    - Context: directory -
    - Override: none -
    - Status: Experimental -
    - Module: mod_ext_filter -
    - Compatibility: Only available in Apache 2.0 or later - -

    - The ExtFilterOptions directive specifies special processing - options for mod_ext_filter. Option can be one of -

    -
    DebugLevel=n -
    - The DebugLevel keyword allows you to specify the level of - debug messages generated by mod_ext_filter. By default, no - debug messages are generated. This is equivalent to - DebugLevel=0. With higher numbers, more debug messages are - generated, and server performance will be degraded. The actual meanings - of the numeric values are described with the definitions of the DBGLVL_ - constants near the beginning of mod_ext_filter.c. -

    - Note: The core directive LogLevel should be used to cause debug messages - to be stored in the Apache error log. -

    LogStderr | NoLogStderr -
    - The LogStderr keyword specifies that messages written to - standard error by the external filter program will be saved in the Apache - error log. NoLogStderr disables this feature. -
    -

    - - Example: - -
    -    ExtFilterOptions  LogStderr DebugLevel=0
    -  
    - - Messages written to the filter's standard error will be stored in the Apache - error log. No debug messages will be generated by - mod_ext_filter. - -

    - -

    Examples

    - -

    Generating HTML from some other type of response

    - -
    -    # mod_ext_filter directive to define a filter to HTML-ize text/c files 
    -    # using the external program /usr/bin/enscript, with the type of the 
    -    # result set to text/html
    -    ExtFilterDefine c-to-html mode=output intype=text/c outtype=text/html \
    -                    cmd="/usr/bin/enscript --color -W html -Ec -o - -"
    -
    -    <Directory "/export/home/trawick/apacheinst/htdocs/c">
    -
    -    # core directive to cause the new filter to be run on output
    -    AddOutputFilter c-to-heml
    -
    -    # mod_mime directive to set the type of .c files to text/c
    -    AddType text/c .c
    -
    -    # mod_ext_filter directive to set the debug level just high 
    -    # enough to see a log message per request showing the configuration
    -    # in force
    -    ExtFilterOptions DebugLevel=1
    -
    -    </Directory>
    -  
    - -

    Implementing a content encoding filter

    - -
    -  # mod_ext_filter directive to define the external filter
    -  ExtFilterDefine gzip mode=output cmd=/bin/gzip
    -
    -  <Location /gzipped>
    -
    -  # core directive to cause the gzip filter to be run on output
    -  AddOutputFilter gzip
    -
    -  # mod_header directive to add "Content-Encoding: gzip" header field
    -  Header set Content-Encoding gzip
    -
    -  </Location>
    -  
    - -

    Slowing down the server

    -
    -  # mod_ext_filter directive to define a filter which runs everything 
    -  # through cat; cat doesn't modify anything; it just introduces extra
    -  # pathlength and consumes more resources
    -  ExtFilterDefine slowdown mode=output cmd=/bin/cat preservescontentlength
    -
    -  <Location />
    -
    -  # core directive to cause the slowdown filter to be run several times on 
    -  # output
    -  AddOutputFilter slowdown slowdown slowdown
    -
    -  </Location>
    -  
    - - - - diff --git a/docs/manual/mod/mod_ext_filter.xml b/docs/manual/mod/mod_ext_filter.xml deleted file mode 100644 index 20dd458af038d4c4e1ff615c88e98472883a2bc9..0000000000000000000000000000000000000000 --- a/docs/manual/mod/mod_ext_filter.xml +++ /dev/null @@ -1,232 +0,0 @@ - - - - - -mod_ext_filter -Pass the response body - through an external program before delivery to the - client -Experimental -mod_ext_filter.c -ext_filter_module - - -

    This is an experimental module and should - be used with care. Test your mod_ext_filter - configuration carefully to ensure that it performs the desired - function. You may wish to review - this information for background on the Apache filtering - model.

    - -

    mod_ext_filter presents a simple and familiar - programming model for filters. With this module, a program - which reads from stdin and writes to stdout (i.e., a Unix-style - filter command) can be a filter for Apache. This filtering - mechanism is much slower than using a filter which is specially - written for the Apache API and runs inside of the Apache server - process, but it does have the following benefits:

    - -
      -
    • the programming model is much simpler
    • - -
    • any programming/scripting language can be used, provided - that it allows the program to read from standard input and - write to standard output
    • - -
    • existing programs can be used unmodified as Apache - filters
    • -
    - -

    Even when the performance characteristics are not suitable - for production use, mod_ext_filter can be used as - a prototype environment for filters.

    -
    - -
    Examples - -
    Generating HTML from some other type of response - -
    -    # mod_ext_filter directive to define a filter to HTML-ize text/c files 
    -    # using the external program /usr/bin/enscript, with the type of the 
    -    # result set to text/html
    -    ExtFilterDefine c-to-html mode=output intype=text/c outtype=text/html \
    -                    cmd="/usr/bin/enscript --color -W html -Ec -o - -"
    -
    -    <Directory "/export/home/trawick/apacheinst/htdocs/c">
    -
    -    # core directive to cause the new filter to be run on output
    -    SetOutputFilter c-to-html
    -
    -    # mod_mime directive to set the type of .c files to text/c
    -    AddType text/c .c
    -
    -    # mod_ext_filter directive to set the debug level just high 
    -    # enough to see a log message per request showing the configuration
    -    # in force
    -    ExtFilterOptions DebugLevel=1
    -
    -    </Directory>
    -
    -
    -
    - -
    Implementing a content encoding filter - -
    -  # mod_ext_filter directive to define the external filter
    -  ExtFilterDefine gzip mode=output cmd=/bin/gzip
    -
    -  <Location /gzipped>
    -
    -  # core directive to cause the gzip filter to be run on output
    -  SetOutputFilter gzip
    -
    -  # mod_header directive to add "Content-Encoding: gzip" header field
    -  Header set Content-Encoding gzip
    -
    -  </Location>
    -
    -
    - -

    Note: this gzip example is just for the purposes of illustration. - Please refer to mod_deflate for a practical - implementation.

    -
    - -
    Slowing down the server - -
    -  # mod_ext_filter directive to define a filter which runs everything 
    -  # through cat; cat doesn't modify anything; it just introduces extra
    -  # pathlength and consumes more resources
    -  ExtFilterDefine slowdown mode=output cmd=/bin/cat preservescontentlength
    -
    -  <Location />
    -
    -  # core directive to cause the slowdown filter to be run several times on 
    -  # output
    -  SetOutputFilter slowdown slowdown slowdown
    -
    -  </Location>
    -
    -
    -
    - -
    - - -ExtFilterDefine -ExtFilterDefine filtername parameters -server config - - -

    The ExtFilterDefine directive defines the - characteristics of an external filter, including the program to - run and its arguments.

    - -

    filtername specifies the name of the filter being - defined. This name can then be used in SetOutputFilter - directives. It must be unique among all registered filters. - At the present time, no error is reported by the - register-filter API, so a problem with duplicate names isn't - reported to the user.

    - -

    Subsequent parameters can appear in any order and define the - external command to run and certain other characteristics. The - only required parameter is cmd=. These parameters - are:

    - -
    -
    cmd=cmdline
    - -
    The cmd= keyword allows you to specify the - external command to run. If there are arguments after the - program name, the command line should be surrounded in - quotation marks.
    - -
    mode=mode
    - -
    mode should be output for now (the - default). In the future, mode=input will be used to - specify a filter for request bodies.
    - -
    intype=imt
    - -
    This parameter specifies the internet media type (i.e., - MIME type) of documents which should be filtered. By default, - all documents are filtered. If intype= is - specified, the filter will be disabled for documents of other - types.
    - -
    outtype=imt
    - -
    This parameter specifies the internet media type (i.e., - MIME type) of filtered documents. It is useful when the - filter changes the internet media type as part of the - filtering operation. By default, the internet media type is - unchanged.
    - -
    PreservesContentLength
    - -
    The PreservesContentLength keyword specifies - that the filter preserves the content length. This is not the - default, as most filters change the content length. In the - event that the filter doesn't modify the length, this keyword - should be specified.
    -
    -
    -
    - - -ExtFilterOptions -ExtFilterOptions - option [option] ... -ExtFilterOptions DebugLevel=0 NoLogStderr -directory - - -

    The ExtFilterOptions directive specifies - special processing options for mod_ext_filter. - Option can be one of

    - -
    -
    DebugLevel=n
    - -
    - The DebugLevel keyword allows you to specify - the level of debug messages generated by - mod_ext_filter. By default, no debug messages - are generated. This is equivalent to - DebugLevel=0. With higher numbers, more debug - messages are generated, and server performance will be - degraded. The actual meanings of the numeric values are - described with the definitions of the DBGLVL_ constants - near the beginning of mod_ext_filter.c. - -

    Note: The core directive LogLevel should be used to - cause debug messages to be stored in the Apache error - log.

    -
    - -
    LogStderr | NoLogStderr
    - -
    The LogStderr keyword specifies that - messages written to standard error by the external filter - program will be saved in the Apache error log. - NoLogStderr disables this feature.
    -
    - -

    Example:

    - - ExtFilterOptions LogStderr DebugLevel=0 - - -

    Messages written to the filter's standard error will be stored - in the Apache error log. No debug messages will be generated by - mod_ext_filter.

    -
    -
    - -
    \ No newline at end of file diff --git a/docs/manual/mod/mod_file_cache.html b/docs/manual/mod/mod_file_cache.html deleted file mode 100644 index 6abbdcb9e3b328fc233baa3864476f43ff04f89b..0000000000000000000000000000000000000000 --- a/docs/manual/mod/mod_file_cache.html +++ /dev/null @@ -1,267 +0,0 @@ - - - - Apache module mod_file_cache - - - - -

    Module mod_file_cache

    -

    - This module should be used with care. You can easily create a - broken site using mod_file_cache, so read this document - carefully. -

    - -

    - Caching frequently requested files that change very - infrequently is a technique for reducing server load. mod_file_cache - provides two techniques for caching frequently requested - static files. - Through configuration directives, you can direct mod_file_cache - to either open then mmap()a file, or to pre-open a file and save - the file's open file handle. Both techniques reduce server - load when processing requests for these files by doing part of the - work (specifically, the file I/O) for serving the file when the server - is started rather than during each request. -

    - -

    - mod_file_cache is not compiled into the server by - default. To use mod_file_cache you have to enable the - following line in the server build Configuration file: -

    -    AddModule  modules/experimental/mod_file_cache.o
    -  
    -

    - -

    - Notice: You cannot use this for speeding up CGI programs or other files - which are served by special content handlers. It can only be used for - regular files which are usually served by the Apache core content handler. -

    - -

    - This module is an extension of and borrows heavily from the - mod_mmap_static module in Apache 1.3. -

    -

    Summary

    -

    - mod_file_cache caches a list of statically configured - files via MMapFile or CacheFile directives - in the main server configuration. -

    - -

    - Not all platforms support both directives. For - example, Apache on Windows does not currently support the MMapStatic - directive, while other platforms, like AIX, support both. You will - receive an error message in the server error log if you attempt to - use an unsupported directive. If given an unsupported directive, the - server will start but the file will not be cached. On platforms that - support both directives, you should experiment with both to see - which works best for you. -

    - -

    MmapFile Directive

    -

    - The MmapFile directive of mod_file_cache - maps a list of statically configured files into memory through the - system call mmap(). This system call is available on - most modern Unix derivates, but not on all. There are sometimes - system-specific limits on the size and number of files that can be - mmap()d, experimentation is probably the easiest way to find out. -

    -

    - This mmap()ing is done once at server start or restart, only. So whenever - one of the mapped files changes on the filesystem you have to - restart the server (see the Stopping and - Restarting documentation). To reiterate that point: if the - files are modified in place without restarting the server - you may end up serving requests that are completely bogus. You - should update files by unlinking the old copy and putting a new - copy in place. Most tools such as rdist and - mv do this. The reason why this modules doesn't take - care of changes to the files is that this check would need an extra - stat() every time which is a waste and against the - intent of I/O reduction. -

    - -

    CacheFile Directive

    -

    - The CacheFile directive of mod_file_cache - opens an active handle or file descriptor to the - file (or files) listed in the configuration directive and places - these open file handles in the cache. When the file is requested, - the server retrieves the handle from the cache and passes it to the - sendfile() (or TransmitFile() on Windows), socket API. -

    -

    - Insert more details about sendfile API... -

    -

    - This file handle caching is done once at server start or restart, - only. So whenever one of the cached files changes on the filesystem - you have to restart the server (see the Stopping and Restarting documentation). - To reiterate that point: if the files are modified in - place without restarting the server you may end up serving - requests that are completely bogus. You should update files by - unlinking the old copy and putting a new copy in place. Most tools - such as rdist and mv do this. -

    - -

    Directives

    - - -
    - -

    MMapFile

    -

    - Syntax: MMapFile filename ... -
    - Default: None -
    - Context: server-config -
    - Override: Not applicable -
    - Status: Experimental -
    - Module: mod_file_cache -
    - Compatibility: Only in Apache 1.3 (via - mod_mmap_statis) or later. - -

    - The MMapFile directive maps one or more files (given as - whitespace separated arguments) into memory at server startup time. They - are automatically unmapped on a server shutdown. When the files have changed - on the filesystem at least a HUP or USR1 signal should be send to the server - to re-mmap them. -

    - -

    - Be careful with the filename arguments: They have to literally - match the filesystem path Apache's URL-to-filename translation handlers - create. We cannot compare inodes or other stuff to match paths through - symbolic links etc. because that again would cost extra stat() - system calls which is not acceptable. This module may or may not work - with filenames rewritten by mod_alias or - mod_rewrite. -

    - - Example: - -
    -  MMapFile /usr/local/apache/htdocs/index.html
    -  
    - - -

    CacheFile

    -

    - Syntax: CacheFile filename ... -
    - Default: None -
    - Context: server-config -
    - Override: Not applicable -
    - Status: Experimental -
    - Module: mod_file_cache -
    - Compatibility: Only available in Apache 2.0 or later. - -

    - The CacheFile directive opens handles to one or more - files (given as whitespace separated arguments) and places these - handles into the cache at server startup time. Handles to cached - files are automatically closed on a server shutdown. When the files - have changed on the filesystem, the server should be restarted to - to re-cache them. -

    - -

    - Be careful with the filename arguments: They have to literally - match the filesystem path Apache's URL-to-filename translation handlers - create. We cannot compare inodes or other stuff to match paths through - symbolic links etc. because that again would cost extra stat() - system calls which is not acceptable. This module may or may not work - with filenames rewritten by mod_alias or - mod_rewrite. -

    - - Example: - -
    -  CacheFile /usr/local/apache/htdocs/index.html
    -  
    - -

    - Note: don't bother asking for a for a directive which - recursively caches all the files in a directory. Try this - instead... - See the Include directive, and consider this command: -

    -  find /www/htdocs -type f -print \
    -  | sed -e 's/.*/mmapfile &/' > /www/conf/mmap.conf
    -  
    - - - - diff --git a/docs/manual/mod/mod_file_cache.xml b/docs/manual/mod/mod_file_cache.xml deleted file mode 100644 index 3e6f4a4ef652ef9e6177cd5c9c76153a275e9611..0000000000000000000000000000000000000000 --- a/docs/manual/mod/mod_file_cache.xml +++ /dev/null @@ -1,178 +0,0 @@ - - - - - -mod_file_cache -Caches a static list of files in memory -Experimental -mod_file_cache.c -file_cache_module - - - - -This module should be used with care. You can easily - create a broken site using mod_file_cache, so read this - document carefully. - - -

    Caching frequently requested files that change very - infrequently is a technique for reducing server load. - mod_file_cache provides two techniques for caching frequently - requested static files. Through configuration - directives, you can direct mod_file_cache to either open then - mmap()a file, or to pre-open a file and save the file's open - file handle. Both techniques reduce server load when - processing requests for these files by doing part of the work - (specifically, the file I/O) for serving the file when the - server is started rather than during each request.

    - -

    Notice: You cannot use this for speeding up CGI programs or - other files which are served by special content handlers. It - can only be used for regular files which are usually served by - the Apache core content handler.

    - -

    This module is an extension of and borrows heavily from the - mod_mmap_static module in Apache 1.3.

    -
    - -
    Using mod_file_cache - -

    mod_file_cache caches a list of statically - configured files via MMapFile or CacheFile directives in the - main server configuration.

    - -

    Not all platforms support both directives. For example, Apache - on Windows does not currently support the MMapStatic directive, while - other platforms, like AIX, support both. You will receive an error - message in the server error log if you attempt to use an - unsupported directive. If given an unsupported directive, the - server will start but the file will not be cached. On platforms - that support both directives, you should experiment with both to - see which works best for you.

    - -
    MmapFile Directive - -

    The MmapFile - directive of mod_file_cache maps a list of - statically configured files into memory through the system call - mmap(). This system call is available on most modern - Unix derivates, but not on all. There are sometimes - system-specific limits on the size and number of files that can be - mmap()d, experimentation is probably the easiest way to find - out.

    - -

    This mmap()ing is done once at server start or restart, - only. So whenever one of the mapped files changes on the - filesystem you have to restart the server (see the Stopping and Restarting - documentation). To reiterate that point: if the files are - modified in place without restarting the server you - may end up serving requests that are completely bogus. You - should update files by unlinking the old copy and putting a new - copy in place. Most tools such as rdist and - mv do this. The reason why this modules doesn't - take care of changes to the files is that this check would need - an extra stat() every time which is a waste and - against the intent of I/O reduction.

    -
    - -
    CacheFile Directive - -

    The CacheFile - directive of mod_file_cache opens an active - handle or file descriptor to the file (or files) - listed in the configuration directive and places these open file - handles in the cache. When the file is requested, the server - retrieves the handle from the cache and passes it to the - sendfile() (or TransmitFile() on Windows), socket API.

    - -

    Insert more details about sendfile API...

    - -

    This file handle caching is done once at server start or - restart, only. So whenever one of the cached files changes on - the filesystem you have to restart the server (see the - Stopping and Restarting - documentation). To reiterate that point: if the files are - modified in place without restarting the server you - may end up serving requests that are completely bogus. You - should update files by unlinking the old copy and putting a new - copy in place. Most tools such as rdist and - mv do this.

    -
    - -Note Don't bother asking for a for a - directive which recursively caches all the files in a - directory. Try this instead... See the - Include directive, and consider - this command: - - find /www/htdocs -type f -print \
    - | sed -e 's/.*/mmapfile &/' > /www/conf/mmap.conf -
    -
    - -
    - - -MMapFile -MMapFile file-path [file-path] ... -server config - - -

    The MMapFile directive maps one or more files - (given as whitespace separated arguments) into memory at server - startup time. They are automatically unmapped on a server - shutdown. When the files have changed on the filesystem at - least a HUP or USR1 signal should be send to the server to - re-mmap them.

    - -

    Be careful with the file-path arguments: They have - to literally match the filesystem path Apache's URL-to-filename - translation handlers create. We cannot compare inodes or other - stuff to match paths through symbolic links etc. - because that again would cost extra stat() system - calls which is not acceptable. This module may or may not work - with filenames rewritten by mod_alias or - mod_rewrite.

    - -Example - MMapFile /usr/local/apache/htdocs/index.html - -
    -
    - - -CacheFile -CacheFile - file-path [file-path] ... -server config - - -

    The CacheFile directive opens handles to - one or more files (given as whitespace separated arguments) and - places these handles into the cache at server startup - time. Handles to cached files are automatically closed on a server - shutdown. When the files have changed on the filesystem, the - server should be restarted to to re-cache them.

    - -

    Be careful with the file-path arguments: They have - to literally match the filesystem path Apache's URL-to-filename - translation handlers create. We cannot compare inodes or other - stuff to match paths through symbolic links etc. - because that again would cost extra stat() system - calls which is not acceptable. This module may or may not work - with filenames rewritten by mod_alias or - mod_rewrite.

    - -Example - CacheFile /usr/local/apache/htdocs/index.html - -
    - -
    -
    \ No newline at end of file diff --git a/docs/manual/mod/mod_headers.html b/docs/manual/mod/mod_headers.html deleted file mode 100644 index db25271583bc5c349192ca3bf9213a63c5e447e2..0000000000000000000000000000000000000000 --- a/docs/manual/mod/mod_headers.html +++ /dev/null @@ -1,97 +0,0 @@ - - - -Apache module mod_headers - - - - -

    Headers Module

    - -The optional headers module allows for the customisation of HTTP -response headers. Headers can be merged, replaced or removed. The -directives described in this document are only available if Apache is -compiled with mod_headers.c. - -
    - -

    Directive

    - - -
    - -

    Header

    -Sytnax: Header [ set | append | add ] header value
    -Sytnax: Header unset header
    -Context: server config, virtual host, access.conf, .htaccess
    -Status: optional
    -Module: mod_header

    - -This directive can replace, merge or remove HTTP response headers. The -action it performs is determined by the first argument. This can be one -of the following values: - -

      -
    • set
      - The response header is set, replacing any previous header with this name - -
    • append
      - The response header is appended to any existing header of the same - name. When a new value is merged onto an existing header it is - separated from the existing header with a comma. This is the HTTP standard - way of giving a header multiple values. - -
    • add
      - The response header is added to the existing set of headers, even if - this header already exists. This can result in two (or more) headers - having the same name. This can lead to unforseen consequences, and in - general "append" should be used instead. - -
    • unset
      - The response header of this name is removed, if it exists. If there are - multiple headers of the same name, only the first one set will be removed. -
    - -This argument is followed by a header name, which can include the -final colon, but it is not required. Case is ignored. For -add, append and set a value is given as the third argument. If this -value contains spaces, it should be surrounded by double quotes. -For unset, no value should be given. - -

    Order of Processing

    - -The Header directive can occur almost anywhere within the server -configuration. It is valid in the main server config and virtual host -sections, inside <Directory>, <Location> and <Files> -sections, and within .htaccess files. -

    -The Header directives are processed in the following order: -

      -
    1. main server -
    2. virtual host -
    3. <Directory> sections and .htaccess -
    4. <Location> -
    5. <Files> -
    - -Order is important. These two headers have a different effect if reversed: -
    -Header append Author "John P. Doe"
    -Header unset Author
    -
    - -This way round, the Author header is not set. If reversed, the Author -header is set to "John P. Doe". -

    - -The Header directives are processed just before the response is sent -by its handler. These means that some headers that are added just -before the response is sent cannot be unset or overridden. This -includes headers such as "Date" and "Server". -

    - - - - diff --git a/docs/manual/mod/mod_headers.xml b/docs/manual/mod/mod_headers.xml deleted file mode 100644 index b71885c2b9383e0f4c319e4dbaad78c1164ac2df..0000000000000000000000000000000000000000 --- a/docs/manual/mod/mod_headers.xml +++ /dev/null @@ -1,261 +0,0 @@ - - - - - -mod_headers -Customization of HTTP request - and response headers -Extension -mod_headers.c -headers_module -RequestHeader is available only in Apache 2.0 - -

    -

    This module provides directives to control and modify HTTP - request and response headers. Headers can be merged, replaced - or removed.

    -
    - -
    Order of Processing - -

    The directives provided by mod_header can occur almost - anywhere within the server configuration. They are valid in the - main server config and virtual host sections, inside - <Directory>, <Location> and <Files> sections, - and within .htaccess files.

    - -

    The directives are processed in the following order:

    - -
      -
    1. main server
    2. - -
    3. virtual host
    4. - -
    5. <Directory> sections and .htaccess
    6. - -
    7. <Location>
    8. - -
    9. <Files>
    10. -
    - -

    Order is important. These two headers have a different - effect if reversed:

    - - -RequestHeader append MirrorID "mirror 12"
    - RequestHeader unset MirrorID -
    - -

    This way round, the MirrorID header is not set. If reversed, - the MirrorID header is set to "mirror 12".

    -
    - -
    Example - -
      -
    1. Copy all request headers that begin with "TS" to the - response headers: - - - Header echo ^TS* -
    2. - -
    3. Add a header, MyHeader, to the response including a - timestamp for when the request was received and how long it - took to begin serving the request. This header can be used by - the client to intuit load on the server or in isolating - bottlenecks between the client and the server. - - - Header add MyHeader "%D %t" - - results in this header being added to the response: - - MyHeader: D=3775428 t=991424704447256 - -
    4. - -
    5. Say hello to Joe - - - Header add MyHeader "Hello Joe. It took %D microseconds for Apache to serve this request." - - results in this header being added to the response: - - MyHeader: Hello Joe. It took D=3775428 microseconds for Apache to serve this request. - -
    6. - -
    7. Conditionally send MyHeader on the response if and only - if header "MyRequestHeader" is present on the request. This - is useful for constructing headers in response to some client - stimulus. Note that this example requires the services of the - mod_setenvif module. - - - SetEnvIf MyRequestHeader value HAVE_MyRequestHeader
      - Header add MyHeader "%D %t mytext" env=HAVE_MyRequestHeader -
      - If the header "MyRequestHeader: value" is present on the - HTTP request, the response will contain the following - header: - - MyHeader: D=3775428 t=991424704447256 mytext - -
    8. -
    -
    - - -RequestHeader -Configure HTTP request headers -RequestHeader set|append|add|unset header -[value] -server config -virtual host -directory -.htaccess -FileInfo - - -

    This directive can replace, merge or remove HTTP request - headers. The header is modified just before the content handler - is run, allowing incoming headers to be modified. The action it - performs is determined by the first argument. This can be one - of the following values:

    - -
      -
    • set
      - The request header is set, replacing any previous header - with this name
    • - -
    • append
      - The request header is appended to any existing header of the - same name. When a new value is merged onto an existing header - it is separated from the existing header with a comma. This - is the HTTP standard way of giving a header multiple - values.
    • - -
    • add
      - The request header is added to the existing set of headers, - even if this header already exists. This can result in two - (or more) headers having the same name. This can lead to - unforeseen consequences, and in general "append" should be - used instead.
    • - -
    • unset
      - The request header of this name is removed, if it exists. If - there are multiple headers of the same name, all will be - removed.
    • -
    - -

    This argument is followed by a header name, which can - include the final colon, but it is not required. Case is - ignored. For add, append and - set a value is given as the third argument. If - this value contains spaces, it should be surrounded by double - quotes. For unset, no value should be given.

    - -

    The RequestHeader directive is processed - just before the request is run by its handler in the fixup phase. - This should allow headers generated by the browser, or by Apache - input filters to be overridden or modified.

    -
    -
    - - -Header -Configure HTTP response headers -Header set|append|add|unset|echo header -[value] -server config -virtual host -directory -.htaccess -FileInfo - - -

    This directive can replace, merge or remove HTTP response - headers. The header is modified just after the content handler - and output filters are run, allowing outgoing headers to be - modified. The action it performs is determined by the first - argument. This can be one of the following values:

    - -
      -
    • set
      - The response header is set, replacing any previous header - with this name. The value may be a format - string.
    • - -
    • append
      - The response header is appended to any existing header of - the same name. When a new value is merged onto an existing - header it is separated from the existing header with a comma. - This is the HTTP standard way of giving a header multiple - values.
    • - -
    • add
      - The response header is added to the existing set of headers, - even if this header already exists. This can result in two - (or more) headers having the same name. This can lead to - unforeseen consequences, and in general "append" should be - used instead.
    • - -
    • unset
      - The response header of this name is removed, if it exists. - If there are multiple headers of the same name, all will be - removed.
    • - -
    • echo
      - Request headers with this name are echoed back in the - response headers. header may be a regular - expression.
    • -
    - -

    This argument is followed by a header name, which - can include the final colon, but it is not required. Case is - ignored for set, append, add and unset. The header - name for echo is case sensitive and may be a regular - expression.

    - -

    For add, append and - set a value is specified as the third - argument. If value contains spaces, it should be - surrounded by doublequotes. value may be a character - string, a string containing format specifiers or a combination - of both. The following format specifiers are supported in - value:

    - - - - - - -
    %t: The time the request was received in Universal -Coordinated Time since the epoch (Jan. 1, 1970) measured in -microseconds. The value is preceded by "t=".
    %D: The time from when the request was received to -the time the headers are sent on the wire. This is a measure of the -duration of the request. The value is preceded by "D=".
    %{FOOBAR}e: The contents of the environment -variable FOOBAR.
    - -

    When the Header directive is used with the - add, append, or set - argument, a fourth argument may be used to specify conditions - under which the action will be taken. If the environment variable specified in the - env=... argument exists (or if the environment - variable does not exist and env=!... is specified) - then the action specified by the Header directive - will take effect. Otherwise, the directive will have no effect - on the request.

    - -

    The Header directives are processed just before the response - is sent to the network. These means that it is possible to set - and/or override most headers, except for those headers added by - the header filter.

    -
    -
    - - - diff --git a/docs/manual/mod/mod_imap.html b/docs/manual/mod/mod_imap.html deleted file mode 100644 index 195ae374b48cd81d11c052aeff5fd50dd6161c63..0000000000000000000000000000000000000000 --- a/docs/manual/mod/mod_imap.html +++ /dev/null @@ -1,284 +0,0 @@ - - - - -Apache module mod_imap - - - - - -

    Module mod_imap

    - -This module is contained in the mod_imap.c file, and -is compiled in by default. It provides for .map files, -replacing the functionality of the imagemap CGI program. Any -directory or document type configured to use the handler imap-file -(using either AddHandler - or SetHandler) - -will be -processed by this module. - -

    Summary

    - -This module is in the default Apache distribution. The following directive will -activate files ending with .map as imagemap files: - -
    AddHandler imap-file map
    - -Note that the following is still supported: - -
    AddType application/x-httpd-imap map
    - -However, we are trying to phase out "magic MIME types" so we are deprecating -this method. - -

    New Features

    -The imagemap module adds some new features that were not -possible with previously distributed imagemap programs.

    - -

      -
    • URL references relative to the Referer: information. -
    • Default <BASE> assignment through a new map directive -base. -
    • No need for imagemap.conf file. -
    • Point references. -
    • Configurable generation of imagemap menus. -
    -

    - -

    Configuration Directives

    - - - -

    - -

    ImapMenu

    -Syntax: ImapMenu {none, formatted, semiformatted, - unformatted}
    -Context: server config, virtual host, directory, .htaccess
    -Override: Indexes
    -Module: mod_imap.c
    -Compatibility: ImapMenu is only available in Apache -1.1 and later.

    - -The ImapMenu directive determines the action taken if an imagemap file -is called without valid coordinates. -

    -
    none -
    If ImapMenu is - none, no menu is generated, and the default - action is performed. -
    formatted -
    A formatted menu is the simplest menu. Comments - in the imagemap file are ignored. A level one header is - printed, then an hrule, then the links each on a separate line. - The menu has a consistent, plain look close to that of - a directory listing. -
    semiformatted -
    In the semiformatted menu, comments are printed - where they occur in the imagemap file. Blank lines are turned - into HTML breaks. No header or hrule is printed, but otherwise - the menu is the same as a formatted menu. -
    unformatted -
    Comments are printed, blank lines are ignored. Nothing is - printed that does not appear in the imagemap file. All breaks - and headers must be included as comments in the imagemap file. - This gives you the most flexibility over the appearance of your - menus, but requires you to treat your map files as HTML instead - of plaintext. -
    - -

    - -

    ImapDefault

    -Syntax: ImapDefault {error, nocontent, - map, referer, URL}
    -Context: server config, virtual host, directory, .htaccess
    -Override: Indexes
    -Module: mod_imap.c
    -Compatibility: ImapDefault is only available in Apache -1.1 and later.

    - - -The ImapDefault directive sets the default default used in -the imagemap files. It's value is overridden by a default -directive within the imagemap file. If not present, the -default action is nocontent, which means -that a 204 No Content is sent to the client. In this -case, the client should continue to display the original page. - -

    - -

    ImapBase

    -Syntax: ImapBase {map, referer, URL}
    -Context: server config, virtual host, directory, .htaccess
    -Override: Indexes
    -Module: mod_imap.c
    -Compatibility: ImapBase is only available in Apache -1.1 and later.

    - -The ImapBase directive sets the default base used in -the imagemap files. It's value is overridden by a base -directive within the imagemap file. If not present, the -base defaults to http://servername/. - -


    -

    - -

    Imagemap File

    -The lines in the imagemap files can have one of several formats: -
    -directive value [x,y ...]
    -directive value "Menu text" [x,y ...]
    -directive value x,y ... "Menu text"
    -
    -The directive is one of base, default, -poly, circle, rect, or -point. The value is an absolute or relative URL, or one -of the special values listed below. The coordinates are -x,y pairs seperated by whitespace. The quoted text is -used as the text of the link if a imagemap menu is generated. Lines -beginning with '#' are comments. - -

    Imagemap File Directives

    -There are six directives allowed in the imagemap file. The directives -can come in any order, but are processed in the order they are found -in the imagemap file. -
    -
    base Directive -
    Has the effect of <BASE href="value">. The - non-absolute URLs of the mapfile are taken relative to this value. - The base directive overrides ImapBase as set in a - .htaccess file or in the server configuration files. In the absence - of an ImapBase configuration directive, base defaults to - http://server_name/.
    - base_uri is synonymous with base. Note that - a trailing slash on the URL is significant. -

    -

    default Directive -
    The action taken if the coordinates given do not fit any of the - poly, circle or rect - directives, and there are no point directives. Defaults - to nocontent in the absence of an ImapDefault - configuration setting, causing a status code of 204 No - Content to be returned. The client should keep the same - page displayed. -

    -

    poly Directive -
    Takes three to one-hundred points, and is obeyed if the user selected - coordinates fall within the polygon defined by these points. -

    -

    circle -
    Takes the center coordinates of a circle and a point on the circle. Is - obeyed if the user selected point is with the circle. -

    -

    rect Directive -
    Takes the coordinates of two opposing corners of a rectangle. Obeyed - if the point selected is within this rectangle. -

    -

    point Directive -
    Takes a single point. The point directive closest to the user - selected point is obeyed if no other directives are satisfied. - Note that default will not be followed if a - point directive is present and valid coordinates are - given. -
    - - - -

    Values

    -The values for each of the directives can any of the following: -
    -
    a URL -
    The URL can be relative or absolute URL. Relative URLs can - contain '..' syntax and will be resolved relative to the - base value.
    - base itself will not resolved according to the current - value. A statement base mailto: will work properly, though. -

    -

    map -
    Equivalent to the URL of the imagemap file itself. No - coordinates are sent with this, so a menu will be generated - unless ImapMenu is set to 'none'. -

    -

    menu -
    Synonymous with map. -

    -

    referer -
    Equivalent to the URL of the refering document. - Defaults to http://servername/ if no Referer: - header was present. -

    -

    nocontent -
    Sends a status code of 204 No Content, - telling the client to keep the same page displayed. Valid for - all but base. -

    -

    error -
    Fails with a 500 Server Error. Valid for all but - base, but sort of silly for anything but - default. -
    - -

    Coordinates

    -
    -
    0,0 200,200 -
    A coordinate consists of an x and a y value - separated by a comma. The coordinates are separated from each other - by whitespace. To accomodate the way Lynx handles imagemaps, should a - user select the coordinate 0,0, it is as if - no coordinate had been selected. -
    - -

    Quoted Text

    -
    -
    "Menu Text" -
    After the value or after the coordinates, the line optionally may - contain text within double quotes. This string is used as the - text for the link if a menu is generated:
    - <a href="http://foo.com/">Menu text</a>
    - If no quoted text is present, the name of the link will be used - as the text:
    - <a href="http://foo.com/">http://foo.com</a>
    - It is impossible to escape double quotes within this text. -
    - -
    - -

    Example Mapfile

    -
    -#Comments are printed in a 'formatted' or 'semiformatted' menu.
    -#And can contain html tags. <hr>
    -base referer
    -poly map "Could I have a menu, please?" 0,0 0,10 10,10 10,0
    -rect .. 0,0 77,27 "the directory of the referer"
    -circle http://www.inetnebr.com/lincoln/feedback/ 195,0 305,27
    -rect another_file "in same directory as referer" 306,0 419,27
    -point http://www.zyzzyva.com/ 100,100
    -point http://www.tripod.com/ 200,200
    -rect mailto:nate@tripod.com 100,150 200,0 "Bugs?"
    -
    -

    - -

    Referencing your mapfile

    -
    -<A HREF="/maps/imagmap1.map">
    -<IMG ISMAP SRC="/images/imagemap1.gif">
    -</A> -

    - -


    -Home -Index - - - - diff --git a/docs/manual/mod/mod_imap.xml b/docs/manual/mod/mod_imap.xml deleted file mode 100644 index 489a2053b1657e61ef8601bb681a182354a19d26..0000000000000000000000000000000000000000 --- a/docs/manual/mod/mod_imap.xml +++ /dev/null @@ -1,334 +0,0 @@ - - - - - -mod_imap -Server-side imagemap processing -Base -mod_imap.c -imap_module - - -

    This module processes .map files, thereby - replacing the functionality of the imagemap CGI - program. Any directory or document type configured to use the - handler imap-file (using either - AddHandler or - SetHandler) - will be processed by this module.

    - -

    The following directive will activate files ending with - .map as imagemap files:

    - -AddHandler imap-file map - -

    Note that the following is still supported:

    - -AddType application/x-httpd-imap map - -

    However, we are trying to phase out "magic MIME types" so we - are deprecating this method.

    -
    - -
    New Features - -

    The imagemap module adds some new features that were not - possible with previously distributed imagemap programs.

    - -
      -
    • URL references relative to the Referer: information.
    • - -
    • Default <BASE> assignment through a new map - directive base.
    • - -
    • No need for imagemap.conf file.
    • - -
    • Point references.
    • - -
    • Configurable generation of imagemap menus.
    • -
    -
    - -
    Imagemap File - -

    The lines in the imagemap files can have one of several - formats:

    - - - directive value [x,y ...]
    - directive value "Menu text" [x,y ...]
    - directive value x,y ... "Menu text" -
    -

    The directive is one of base, - default, poly, circle, - rect, or point. The value is an - absolute or relative URL, or one of the special values listed - below. The coordinates are x,y pairs separated by - whitespace. The quoted text is used as the text of the link if - a imagemap menu is generated. Lines beginning with '#' are - comments.

    - -
    Imagemap File Directives -

    There are six directives allowed in the imagemap file. The - directives can come in any order, but are processed in the - order they are found in the imagemap file.

    - -
    -
    base Directive
    - -
    Has the effect of <BASE HREF="value">. - The non-absolute URLs of the map-file are taken relative to - this value. The base directive overrides - ImapBase as set in a .htaccess file or in the server - configuration files. In the absence of an ImapBase - configuration directive, base defaults to - http://server_name/.
    - base_uri is synonymous with base. - Note that a trailing slash on the URL is significant.
    - -
    default Directive
    - -
    The action taken if the coordinates given do not fit any - of the poly, circle or - rect directives, and there are no - point directives. Defaults to - nocontent in the absence of an ImapDefault - configuration setting, causing a status code of 204 No - Content to be returned. The client should keep the - same page displayed.
    - -
    poly Directive
    - -
    Takes three to one-hundred points, and is obeyed if the - user selected coordinates fall within the polygon defined by - these points.
    - -
    circle
    - -
    Takes the center coordinates of a circle and a point on - the circle. Is obeyed if the user selected point is with the - circle.
    - -
    rect Directive
    - -
    Takes the coordinates of two opposing corners of a - rectangle. Obeyed if the point selected is within this - rectangle.
    - -
    point Directive
    - -
    Takes a single point. The point directive closest to the - user selected point is obeyed if no other directives are - satisfied. Note that default will not be - followed if a point directive is present and - valid coordinates are given.
    -
    -
    - -
    Values - -

    The values for each of the directives can any of the following:

    - - -
    -
    a URL
    - -
    The URL can be relative or absolute URL. Relative URLs - can contain '..' syntax and will be resolved relative to the - base value.
    - base itself will not resolved according to the - current value. A statement base mailto: will - work properly, though.
    - -
    map
    - -
    Equivalent to the URL of the imagemap file itself. No - coordinates are sent with this, so a menu will be generated - unless ImapMenu is set to 'none'.
    - -
    menu
    - -
    Synonymous with map.
    - -
    referer
    - -
    Equivalent to the URL of the referring document. Defaults - to http://servername/ if no Referer: header was - present.
    - -
    nocontent
    - -
    Sends a status code of 204 No Content, - telling the client to keep the same page displayed. Valid for - all but base.
    - -
    error
    - -
    Fails with a 500 Server Error. Valid for all - but base, but sort of silly for anything but - default.
    -
    -
    - -
    Coordinates - -
    -
    0,0 200,200
    - -
    A coordinate consists of an x and a y - value separated by a comma. The coordinates are separated - from each other by whitespace. To accommodate the way Lynx - handles imagemaps, should a user select the coordinate - 0,0, it is as if no coordinate had been - selected.
    -
    - -
    - -
    Quoted Text - -
    -
    "Menu Text"
    - -
    After the value or after the coordinates, the line - optionally may contain text within double quotes. This string - is used as the text for the link if a menu is - generated:
    - <a HREF="http://foo.com/">Menu - text</a>
    - If no quoted text is present, the name of the link will be - used as the text:
    - <a - HREF="http://foo.com/">http://foo.com</a>
    - It is impossible to escape double quotes within this - text.
    -
    -
    -
    - -
    Example Mapfile - - - #Comments are printed in a 'formatted' or - 'semiformatted' menu.
    - #And can contain html tags. <hr>
    - base referer
    - poly map "Could I have a menu, please?" 0,0 0,10 10,10 - 10,0
    - rect .. 0,0 77,27 "the directory of the referer"
    - circle http://www.inetnebr.com/lincoln/feedback/ 195,0 - 305,27
    - rect another_file "in same directory as referer" 306,0 - 419,27
    - point http://www.zyzzyva.com/ 100,100
    - point http://www.tripod.com/ 200,200
    - rect mailto:nate@tripod.com 100,150 200,0 "Bugs?"
    -
    - -
    - -
    Referencing your mapfile - - - <A HREF="/maps/imagemap1.map">
    - <IMG ISMAP SRC="/images/imagemap1.gif">
    - </A> -
    -
    - - -ImapMenu -Action if no coordinates are given when calling -an imagemap -ImapMenu - none|formatted|semiformatted|unformatted -server config -virtual host -directory -.htaccess -Indexes - - -

    The ImapMenu directive determines the - action taken if an imagemap file is called without valid - coordinates.

    - -
    -
    none
    - -
    If ImapMenu is none, no menu is generated, - and the default action is performed.
    - -
    formatted
    - -
    A formatted menu is the simplest menu. - Comments in the imagemap file are ignored. A level one header - is printed, then an hrule, then the links each on a separate - line. The menu has a consistent, plain look close to that of - a directory listing.
    - -
    semiformatted
    - -
    In the semiformatted menu, comments are - printed where they occur in the imagemap file. Blank lines - are turned into HTML breaks. No header or hrule is printed, - but otherwise the menu is the same as a - formatted menu.
    - -
    unformatted
    - -
    Comments are printed, blank lines are ignored. Nothing is - printed that does not appear in the imagemap file. All breaks - and headers must be included as comments in the imagemap - file. This gives you the most flexibility over the appearance - of your menus, but requires you to treat your map files as - HTML instead of plaintext.
    -
    -
    -
    - - -ImapDefault -Default action when an imagemap is called with coordinates -that are not explicitly mapped -ImapDefault error|nocontent|map|referer|URL -ImapDefault nocontent -server config -virtual host -directory -.htaccess -Indexes - - -

    The ImapDefault directive sets the default - default used in the imagemap files. Its value is - overridden by a default directive within the - imagemap file. If not present, the default action - is nocontent, which means that a 204 No - Content is sent to the client. In this case, the client - should continue to display the original page.

    -
    -
    - - -ImapBase -Default base for imagemap files -ImapBase map|referer|URL -ImapBase http://servername/ -server config -virtual host -directory -.htaccess -Indexes - - -

    The ImapBase directive sets the default - base used in the imagemap files. Its value is - overridden by a base directive within the imagemap - file. If not present, the base defaults to - http://servername/.

    -
    -
    - -
    \ No newline at end of file diff --git a/docs/manual/mod/mod_include.html b/docs/manual/mod/mod_include.html deleted file mode 100644 index 770a8e252109d89a128cd6cd4a08c7e67546791d..0000000000000000000000000000000000000000 --- a/docs/manual/mod/mod_include.html +++ /dev/null @@ -1,211 +0,0 @@ - - - - -Apache module mod_include - - - - - -

    Module mod_include

    - -This module is contained in the mod_include.c file, and -is compiled in by default. It provides for server-parsed html documents, -known as SPML documents. -Any document with mime type text/x-server-parsed-html or -text/x-server-parsed-html3 will be parsed by this module, -with the resulting output given the mime type text/html. - - - -

    SPML -- Include file Format

    - -The document is parsed as an HTML document, with special commands embedded -as SGML comments. A command has the syntax: -
    -<!--#element attribute=value attribute=value ... --> -
    -The value will often be enclosed in double quotes; many commands only allow -a single attribute-value pair. -

    -The allowed elements are:

    -

    -
    config -
    - -This command controls various aspects of the parsing. The valid attributes -are: -
    -
    errmsg -
    The value is a message that is sent back to the client if an error occurs -whilst parsing the document. -
    sizefmt -
    The value sets the format to be used which displaying the size of a file. -Valid values are bytes for a count in bytes, or -abbrev for a count in Kb or Mb as appropriate. -
    timefmt -
    The value is a string to be used by the strftime(3) library -routine when printing dates. -
    - -
    echo -
    - -This command prints one of the include variables, defined below. -If the variable is unset, it is printed as (none). -Any dates printed are subject to the currently configured timefmt. -Attributes: -
    -
    var -
    The value is the name of the variable to print. -
    - -
    exec -
    - -The exec command executes a given shell command or CGI script. -The IncludesNOEXEC Option disables this command -completely. The valid attributes are: -
    -
    cgi -
    - -The value specifies a (%-encoded) URL relative path to the CGI script. -If the path does not begin with a (/), then it is taken to be relative to -the current document. The document referenced by this path is invoked -as a CGI script, even if the server would not normally recognise it as -such. However, the directory containing the script must be enabled for -CGI scripts (with ScriptAlias -or the ExecCGI Option).

    - - -The CGI script is given the PATH_INFO and query string (QUERY_STRING) of the -original request from the client; these cannot be specified in the URL path. -The include variables will be available to the script in addition to the -standard CGI environment.

    -If the script returns a Location: header instead of output, then this -will be translated into an HTML anchor.

    -The include virtual element should be used in preference to -exec cgi. -

    cmd -
    The server will execute the given string using /bin/sh. -The include variables are available to the command. -
    - -
    fsize -
    - -This command prints the size of the specified file, subject to the -sizefmt format specification. Attributes: -
    -
    file -
    The value is a path relative to the directory containing the current -document being parsed. -
    virtual -
    The value is a (%-encoded) URL-path relative to the current document being -parsed. If it does not begin with a slash (/) then it is taken to be relative -to the current document. -
    - -
    flastmod -
    -This command prints the last modification date of the specified file, -subject to the timefmt format specification. The attributes are -the same as for the fsize command. - -
    include -
    -This command inserts the text of another document or file into the parsed -file. Any included file is subject to the usual access control. If the -directory containing the parsed file has the -Option -IncludesNOEXEC set, and the including the document would cause a program -to be executed, then it will not be included; this prevents the execution of -CGI scripts. Otherwise CGI scripts are invoked as normal using the complete -URL given in the command, including any query string. - -

    - -An attribute defines the location of the document; the inclusion is done for -each attribute given to the include command. The valid attributes are: -

    -
    file -
    The value is a path relative to the directory containing the current -document being parsed. It cannot contain ../, nor can it be an -absolute path. The virtual attribute should always be used -in preference to this one. -
    virtual -
    The value is a (%-encoded) URL relative to the current document being -parsed. The URL cannot contain a scheme or hostname, only a path and -an optional query string. If it does not begin with a slash (/) then it -is taken to be relative to the current document. -
    -A URL is constructed from the attribute, and the output the server -would return if the URL were accessed by the client is included in the parsed -output. Thus included files can be nested. -
    - -

    Include variables

    -These are available for the echo command, and to any program -invoked by the document. -
    -
    DATE_GMT -
    The current date in Greenwich Mean Time. -
    DATE_LOCAL -
    The current date in the local time zone. -
    DOCUMENT_NAME -
    The filename (excluding directories) of the document requested by the -user. -
    DOCUMENT_URI -
    The (%-decoded) URL path of the document requested by the user. Note that -in the case of nested include files, this is not then URL for the -current document. -
    LAST_MODIFIED -
    The last modification date of the document requested by the user. -
    -

    - - -


    -

    Directives

    - -
    - - -

    XBitHack

    - -Syntax: XBitHack status
    -Default: XBitHack off
    -Context: server config, virtual host, directory, .htaccess
    -Override: Options
    -Status: Base
    -Module: mod_include

    - -The XBitHack directives controls the parsing of ordinary html documents. -Status can have the following values: -

    -
    off -
    No special treatment of executable files. -
    on -
    Any file that has the user-execute bit set will be treated as a -server-parsed html document. -
    full -
    As for on but also test the group-execute bit. If it -is set, then set the Last-modified date of the returned file to be the -last modified time of the file. If it is not set, then no last-modified date -is sent. Setting this bit allows clients and proxies to cache the result of -the request. -
    -

    - -


    - -Home -Index - - - - diff --git a/docs/manual/mod/mod_include.xml b/docs/manual/mod/mod_include.xml deleted file mode 100644 index c124daa1bffa1d43bb30bf286a27fc741a2ab447..0000000000000000000000000000000000000000 --- a/docs/manual/mod/mod_include.xml +++ /dev/null @@ -1,695 +0,0 @@ - - - - -mod_include -Base -include_module -mod_include.c - -This module provides for server-parsed html -documents. - - - -

    This module provides a filter which will process files - before they are sent to the client. The processing is - controlled by specially formated SGML comments, referred to as - elements. These elements allow conditional text, the - inclusion other files or programs, as well as the setting and - printing of environment variables.

    - - See also: - Options, - SetOutputFilter - and AcceptPathInfo. - -
    - -
    - Enabling Server-Side Includes - -

    Server Side Includes are implemented by the - INCLUDES filter. If - documents containing server-side include directives are given - the extension .shtml, the following directives will make Apache - parse them and assign the resulting document the mime type of - text/html:

    - - - AddType text/html .shtml
    - AddOutputFilter INCLUDES .shtml -
    - -

    The following directive must be given for the directories - containing the shtml files (typically in a - <Directory> section, but this directive is - also valid .htaccess files if AllowOverride - Options is set):

    - - - Options +Includes - - -

    For backwards compatibility, the server-parsed - handler also activates the - INCLUDES filter. As well, Apache will activate the INCLUDES - filter for any document with mime type - text/x-server-parsed-html or - text/x-server-parsed-html3 (and the resulting - output will have the mime type text/html).

    - -

    For more information, see our Tutorial on Server Side - Includes.

    -
    - -
    - Basic Elements -

    The document is parsed as an HTML document, with special - commands embedded as SGML comments. A command has the syntax:

    - - - <!--#element attribute=value - attribute=value ... --> - - -

    The value will often be enclosed in double quotes; many - commands only allow a single attribute-value pair. Note that - the comment terminator (-->) should be preceded - by whitespace to ensure that it isn't considered part of an SSI - token.

    - -

    The allowed elements are:

    - -
    -
    config
    - -
    - This command controls various aspects of the parsing. The - valid attributes are: - -
    -
    errmsg
    - -
    The value is a message that is sent back to the - client if an error occurs whilst parsing the - document.
    - -
    sizefmt
    - -
    The value sets the format to be used which displaying - the size of a file. Valid values are bytes - for a count in bytes, or abbrev for a count - in Kb or Mb as appropriate.
    - -
    timefmt
    - -
    The value is a string to be used by the - strftime(3) library routine when printing - dates.
    -
    -
    - -
    echo
    - -
    - This command prints one of the include - variables, defined - below. If the variable is unset, it is printed as - (none). Any dates printed are subject to the - currently configured timefmt. Attributes: - -
    -
    var
    - -
    The value is the name of the variable to print.
    - -
    encoding
    - -
    Specifies how Apache should encode special characters - contained in the variable before outputting them. If set - to "none", no encoding will be done. If set to "url", - then URL encoding (also known as %-encoding; this is - appropriate for use within URLs in links, etc.) will be - performed. At the start of an echo element, - the default is set to "entity", resulting in entity - encoding (which is appropriate in the context of a - block-level HTML element, eg. a paragraph of text). This - can be changed by adding an encoding - attribute, which will remain in effect until the next - encoding attribute is encountered or the - element ends, whichever comes first. Note that the - encoding attribute must precede the - corresponding var attribute to be effective, - and that only special characters as defined in the - ISO-8859-1 character encoding will be encoded. This - encoding process may not have the desired result if a - different character encoding is in use. Apache 1.3.12 and - above; previous versions do no encoding.
    -
    -
    - -
    exec
    - -
    - The exec command executes a given shell command or CGI - script. The IncludesNOEXEC Option disables this command - completely. The valid attributes are: - -
    -
    cgi
    - -
    - The value specifies a (%-encoded) URL relative path to - the CGI script. If the path does not begin with a (/), - then it is taken to be relative to the current - document. The document referenced by this path is - invoked as a CGI script, even if the server would not - normally recognize it as such. However, the directory - containing the script must be enabled for CGI scripts - (with ScriptAlias or - the ExecCGI Option). - -

    The CGI script is given the PATH_INFO and query - string (QUERY_STRING) of the original request from the - client; these cannot be specified in the URL path. The - include variables will be available to the script in - addition to the standard CGI - environment.

    - -

    For example:

    - - <!--#exec cgi="/cgi-bin/example.cgi" --> - -

    If the script returns a Location: header instead of - output, then this will be translated into an HTML - anchor.

    - -

    The include - virtual element should be - used in preference to exec cgi. In particular, - if you need to pass additional arguments to a CGI program, - using the query string, this cannot be done with exec - cgi, but can be done with include - virtual, as shown here:

    - - <!--#include virtual="/cgi-bin/example.cgi?argument=value" --> -
    - -
    cmd
    - -
    -

    The server will execute the given string using - /bin/sh. The include variables are available - to the command, in addition to the usual set of CGI - variables.

    - -

    The use of #include - virtual is almost always - prefered to using either #exec cgi or #exec - cmd. The former (#include virtual) used the - standard Apache sub-request mechanism to include files or - scripts. It is much better tested and maintained.

    - -

    In addition, on some platforms, like Win32, and on unix - when using suexec, you cannot pass arguments to a command in - an exec directive, or otherwise include spaces in - the command. Thus, while the following will work under a - non-suexec configuration on unix, it will not produce the - desired result under Win32, or when running suexec:

    - - <!--#exec cmd="perl /path/to/perlscript arg1 arg2" --> - -
    -
    -
    - -
    fsize
    - -
    - This command prints the size of the specified file, subject - to the sizefmt format specification. - Attributes: - -
    -
    file
    - -
    The value is a path relative to the directory - containing the current document being parsed.
    - -
    virtual
    - -
    The value is a (%-encoded) URL-path relative to the - current document being parsed. If it does not begin with - a slash (/) then it is taken to be relative to the - current document.
    -
    -
    - -
    flastmod
    - -
    This command prints the last modification date of the - specified file, subject to the timefmt format - specification. The attributes are the same as for the - fsize command.
    - -
    include
    - -
    - This command inserts the text of another document or file - into the parsed file. Any included file is subject to the - usual access control. If the directory containing the - parsed file has the Option - IncludesNOEXEC set, and the including the document would - cause a program to be executed, then it will not be - included; this prevents the execution of CGI scripts. - Otherwise CGI scripts are invoked as normal using the - complete URL given in the command, including any query - string. - -

    An attribute defines the location of the document; the - inclusion is done for each attribute given to the include - command. The valid attributes are:

    - -
    -
    file
    - -
    The value is a path relative to the directory - containing the current document being parsed. It cannot - contain ../, nor can it be an absolute path. - Therefore, you cannot include files that are outside of the - document root, or above the current document in the directory - structure. - The virtual attribute should always be used - in preference to this one.
    - -
    virtual
    - -
    -

    The value is a (%-encoded) URL relative to the - current document being parsed. The URL cannot contain a - scheme or hostname, only a path and an optional query - string. If it does not begin with a slash (/) then it is - taken to be relative to the current document.

    - -

    A URL is constructed from the attribute, and the output the - server would return if the URL were accessed by the client - is included in the parsed output. Thus included files can - be nested.

    - -

    If the specified URL is a CGI program, the program will - be executed and its output inserted in place of the directive - in the parsed file. You may include a query string in a CGI - url:

    - - <!--#include virtual="/cgi-bin/example.cgi?argument=value" --> - -

    include virtual should be used in preference - to exec cgi to include the output of CGI - programs into an HTML document.

    -
    -
    -
    - -
    printenv
    - -
    -

    This prints out a listing of all existing variables and - their values. Starting with Apache 1.3.12, special characters - are entity encoded (see the echo element for details) - before being output. There are no attributes.

    - -

    For example:

    - -

    <!--#printenv -->

    - -

    The printenv element is available only in - Apache 1.2 and above.

    -
    -
    set
    - -
    - This sets the value of a variable. Attributes: - -
    -
    var
    - -
    The name of the variable to set.
    - -
    value
    - -
    The value to give a variable.
    -
    -

    - For example: <!--#set var="category" value="help" - -->

    - -

    The set element is available only in - Apache 1.2 and above.

    -
    -
    -
    - -
    - Include Variables - - In addition to the variables in the standard CGI environment, - these are available for the echo command, for - if and elif, and to any program - invoked by the document. - -
    -
    DATE_GMT
    - -
    The current date in Greenwich Mean Time.
    - -
    DATE_LOCAL
    - -
    The current date in the local time zone.
    - -
    DOCUMENT_NAME
    - -
    The filename (excluding directories) of the document - requested by the user.
    - -
    DOCUMENT_URI
    - -
    The (%-decoded) URL path of the document requested by the - user. Note that in the case of nested include files, this is - not then URL for the current document.
    - -
    LAST_MODIFIED
    - -
    The last modification date of the document requested by - the user.
    -
    -
    - -
    - Variable Substitution - -

    Variable substitution is done within quoted strings in most - cases where they may reasonably occur as an argument to an SSI - directive. This includes the config, - exec, flastmod, fsize, - include, and set directives, as well - as the arguments to conditional operators. You can insert a - literal dollar sign into the string using backslash - quoting:

    -
    -    <!--#if expr="$a = \$test" -->
    -
    - -

    If a variable reference needs to be substituted in the - middle of a character sequence that might otherwise be - considered a valid identifier in its own right, it can be - disambiguated by enclosing the reference in braces, - a la shell substitution:

    -
    -    <!--#set var="Zed" value="${REMOTE_HOST}_${REQUEST_METHOD}" -->
    -
    - -

    This will result in the Zed variable being set - to "X_Y" if REMOTE_HOST is - "X" and REQUEST_METHOD is - "Y".

    - -

    EXAMPLE: the below example will print "in foo" if the - DOCUMENT_URI is /foo/file.html, "in bar" if it is - /bar/file.html and "in neither" otherwise:

    -
    -    <!--#if expr="\"$DOCUMENT_URI\" = \"/foo/file.html\"" -->
    -    in foo
    -    <!--#elif expr="\"$DOCUMENT_URI\" = \"/bar/file.html\"" -->
    -    in bar
    -    <!--#else -->
    -    in neither
    -    <!--#endif -->
    -
    -
    - -
    - Flow Control Elements - - These are available in Apache 1.2 and above. The basic flow - control elements are: -
    -    <!--#if expr="test_condition" -->
    -    <!--#elif expr="test_condition" -->
    -    <!--#else -->
    -    <!--#endif -->
    -
    - -

    The if element works like an - if statement in a programming language. The test condition is - evaluated and if the result is true, then the text until the - next elif, - else. or - endif element is included in the - output stream.

    - -

    The elif or - else statements are be used the - put text into the output stream if the original test_condition - was false. These elements are optional.

    - -

    The endif element ends the - if element and is required.

    - -

    test_condition is one of the following:

    - -
    -
    string
    - -
    true if string is not empty
    - -
    string1 = string2
    - string1 != string2
    - string1 < string2
    - string1 <= string2
    - string1 > string2
    - string1 >= string2
    - -
    Compare string1 with string 2. If string2 has the form - /string/ then it is compared as a regular - expression. Regular expressions have the same syntax as those - found in the Unix egrep command.
    - -
    ( test_condition )
    - -
    true if test_condition is true
    - -
    ! test_condition
    - -
    true if test_condition is false
    - -
    test_condition1 && - test_condition2
    - -
    true if both test_condition1 and - test_condition2 are true
    - -
    test_condition1 || test_condition2
    - -
    true if either test_condition1 or - test_condition2 is true
    -
    - -

    "=" and "!=" bind more tightly than - "&&" and "||". "!" binds - most tightly. Thus, the following are equivalent:

    -
    -    <!--#if expr="$a = test1 && $b = test2" -->
    -    <!--#if expr="($a = test1) && ($b = test2)" -->
    -
    - -

    Anything that's not recognized as a variable or an operator - is treated as a string. Strings can also be quoted: - 'string'. Unquoted strings can't contain whitespace - (blanks and tabs) because it is used to separate tokens such as - variables. If multiple strings are found in a row, they are - concatenated using blanks. So,

    -
    -     string1    string2  results in string1 string2
    -    'string1    string2' results in string1    string2
    -
    - -
    - -
    - Using Server Side Includes for ErrorDocuments - - There is a document - which describes how to use the features of mod_include to offer - internationalized customized server error documents. - -

    PATH_INFO with Server Side Includes

    - -

    Files processed for server-side includes no longer accept - requests with PATH_INFO (trailing pathname information) by - default. You can use the AcceptPathInfo directive to - configure the server to accept requests with PATH_INFO.

    - -
    - - - -SSIEndTag -Changes the string that mod_include looks for to end an -include command. -SSIEndTag tag -SSIEndTag "-->" -server config -virtual host -FileInfo -Apache 1.2 and Available in version 2.0.30 and later. - - - -

    This directive changes the string that mod_include looks for - to mark the end of a include command.

    - - See also: SSIStartTag. -
    -
    - - -SSIErrorMsg -Changes the error message displayed when there is an error -SSIErrorMsg message -SSIErrorMsg -"[an error occurred while processing this directive]" - -server config -virtual host -directory -.htaccess - - -Available in version 2.0.30 and later. - - -

    The SSIErrorMsg directive changes the error message displayed - when mod_include encounters an error. For production servers you - may consider changing the default error message to - "<-- Error -->" so that the message - is not presented to the user. -

    -

    This directive has the same effect as the <--#config - errmsg=message --> element.

    - -
    -
    - - -SSIStartTag - -Changes the string that mod_include looks for to start an -include element -SSIStartTag "<--!" - -server config -virtual host - - -Available in version 2.0.30 and later. - - - -

    This directive changes the string that mod_include looks for - to mark an include element to process.

    - -

    You may want to use this option if have 2 servers parsing the - output of a file each processing different commands (possibly at - different times).

    - - See also: SSIEndTag - -
    -
    - - -SSITimeFormat -Configures the format in which date strings are -displayed -SSITimeFormat formatstring -SSITimeFormat "%A, %d-%b-%Y %H:%M:%S %Z" - -server config -virtual host -directory -.htaccess - - -Available in version 2.0.30 and later. - - -

    This directive changes the format in which date strings are displayed - when echoing DATE environment variables. The formatstring - is as in strftime(3) from the C standard library.

    - -

    This directive has the same effect as the <--#config - timefmt=formatstring --> element.

    -
    -
    - - -XBitHack -XBitHack on|off|full -XBitHack off - -server config -virtual host -directory -.htaccess - -Options - -Parse SSI directives in files with the execute -bit set - - -

    The XBitHack directives controls the parsing of ordinary - html documents. This directive only affects files associated - with the MIME type text/html. XBitHack can take on - the following values:

    - -
    -
    off
    - -
    No special treatment of executable files.
    - -
    on
    - -
    Any text/html file that has the user-execute bit set will - be treated as a server-parsed html document.
    - -
    full
    - -
    - As for on but also test the group-execute bit. - If it is set, then set the Last-modified date of the - returned file to be the last modified time of the file. If - it is not set, then no last-modified date is sent. Setting - this bit allows clients and proxies to cache the result of - the request. - -

    Note: you would not want to use the full - option, unless you assure the group-execute bit is unset for - every SSI script which might #include a CGI - or otherwise produces different output on each hit (or could - potentially change on subsequent requests).

    -
    -
    - -
    -
    - -
    - diff --git a/docs/manual/mod/mod_info.html b/docs/manual/mod/mod_info.html deleted file mode 100644 index 6261f5f32b4c818038c7b7f79bc1cebc386b78fa..0000000000000000000000000000000000000000 --- a/docs/manual/mod/mod_info.html +++ /dev/null @@ -1,44 +0,0 @@ - - - -Apache module mod_info - - - - -

    Module mod_info

    - -This module is contained in the mod_info.c file. It -provides a comprehensive overview of the current server configuration -including all installed modules. This module is not compiled into the -server by default. It is only available in Apache 1.1 and later. To -enable it, add the following line to the server build Configuration -file, and rebuild the server: - -
    -Module info_module   mod_info.o
    -
    - -
    -

    -To configure it, add the following to your access.conf file. - -

    -<Location /server-info>
    -SetHandler server-info
    -</Location>
    -
    - -You may wish to add a limit clause inside the location directive to limit -access to your server configuration information.

    -Once configured, the server information is obtained by accessing -http://your.host.dom/server-info

    - - -


    -Home -Index - - - - diff --git a/docs/manual/mod/mod_info.xml b/docs/manual/mod/mod_info.xml deleted file mode 100644 index c086a891f0b926772e9ca10a686db75fc7be8e51..0000000000000000000000000000000000000000 --- a/docs/manual/mod/mod_info.xml +++ /dev/null @@ -1,79 +0,0 @@ - - - - -mod_info -Extension -This module provides a comprehensive overview of the server -configuration including all installed modules and directives in the -configuration files. -info_module -mod_info.c -Available in Apache 1.1 and later - - - - -

    Using mod_info

    - -

    To configure it, add the following to your - httpd.conf file.

    - - -<Location /server-info>
    -SetHandler server-info
    -</Location>
    -
    - - You may wish to add a - <Limit> - clause inside the - <location> - directive to limit access to your server configuration - information. - -

    Once configured, the server information is obtained by - accessing http://your.host.dom/server-info

    - - - Note that the configuration files are read by the - module at run-time, and therefore the display may - not reflect the running server's active - configuration if the files have been changed since the server - was last reloaded. Also, the configuration files must be - readable by the user as which the server is running (see the - User directive), or - else the directive settings will not be listed. - -

    It should also be noted that if - mod_info is compiled into the server, its - handler capability is available in all configuration - files, including per-directory files (e.g., - .htaccess). This may have security-related - ramifications for your site.

    -
    -
    - - -AddModuleInfo -Allows additional information to be added to the module -information displayed by the server-info handler -AddModuleInfo module-name string -none -server config virtual -host -Apache 1.3 and above - - -

    This allows the content of string to be shown as - HTML interpreted, Additional Information for - the module module-name. Example:

    - - -AddModuleInfo mod_auth.c 'See <A HREF="http://www.apache.org/docs/mod/mod_auth.html">http://www.apache.org/docs/mod/mod_auth.html</A>' - -
    - -
    -
    - diff --git a/docs/manual/mod/mod_isapi.html b/docs/manual/mod/mod_isapi.html deleted file mode 100644 index 5fde08c1a7d213f10aa3093d50daef03de719508..0000000000000000000000000000000000000000 --- a/docs/manual/mod/mod_isapi.html +++ /dev/null @@ -1,73 +0,0 @@ - - - -Apache module mod_isapi - - - - - - -

    Module mod_isapi

    - -

    This module is contained in the mod_isapi.c file, and is - compiled in by default. It provides support for ISAPI Extensions when - running under Microsoft Windows. Any document with a handler of - isapi-isa will be processed by this module. - -

    Purpose

    - -

    This module implements the ISAPI - Extension API. It allows Internet Server Applications (i.e., ISAPI - Extensions) to be used with Apache for Windows. - -

    Usage

    - -

    In the server configuration file, add a handler called - isapi-isa, and map it to files with a .DLL - extension. In other words:

    -
    -    AddHandler isapi-isa dll
    -
    -

    Now simply place the ISA DLLs into your document root, and they will - be loaded when their URLs are accessed.

    - -

    ISAPI Extensions are governed by the same restrictions as CGI - scripts. That is, Options ExecCGI must be active in the - directory that contains the ISA.

    - -

    Notes

    - -

    Apache's ISAPI implementation conforms to all of the ISAPI 2.0 - specification, except for the "Microsoft-specific" extensions dealing - with ascynchronous I/O. Apache's I/O model does not allow asynchronous - reading and writing in a manner that the ISAPI could access. If an ISA - tries to access async I/O, a message will be place in the error log, - to help with debugging. - -

    Some servers, like Microsoft IIS, load the ISA into the server, and - keep it loaded until memory usage is too high, and it is - unloaded. Apache currently loads and unloads the ISA for each - request. This is inefficient, but Apache's request model makes this - method the only method that currently works. A future release may use - a more effective loading method. - -

    Apache 1.3a1 currently limits POST and PUT input to 48k per - request. This is to work around a problem with the ISAPI implementation - that could result in a denial of service attack. It is expected that - support for larger uploads will be added soon. - -

    Also, remember that while Apache supports ISAPI Extensions, it does - not support ISAPI Filters. Support for filters may be added at a later - date, but no support is planned at this time.

    - - - - diff --git a/docs/manual/mod/mod_isapi.xml b/docs/manual/mod/mod_isapi.xml deleted file mode 100644 index c64cbd0b188909f7542cea81301f2f14cbacc8cd..0000000000000000000000000000000000000000 --- a/docs/manual/mod/mod_isapi.xml +++ /dev/null @@ -1,271 +0,0 @@ - - - - - -mod_isapi -ISAPI Extensions within Apache for Windows -Base -mod_isapi.c -isapi_module -Win32 only - - -

    This module implements the Internet Server extension API. It - allows Internet Server extensions (e.g. ISAPI .dll - modules) to be served by Apache for Windows, subject to the - noted restrictions.

    - -

    ISAPI extension modules (.dll files) are written by third - parties. The Apache Group does not author these modules, so we - provide no support for them. Please contact the ISAPI's author - directly if you are experiencing problems running their ISAPI - extention. Please do not post such problems to - Apache's lists or bug reporting pages.

    -
    - -
    Usage

    In the server configuration file, use -the AddHandler directive to -associate ISAPI files with the isapi-isa handler, and map -it to the with their file extensions. To enable any .dll file to be -processed as an ISAPI extention, edit the httpd.conf file and add the -following line:

    - - AddHandler isapi-isa .dll - - -

    There is no capability within the Apache server to leave a - requested module loaded. However, you may preload and keep a - specific module loaded by using the following syntax in your - httpd.conf:

    - - ISAPICacheFile c:/WebWork/Scripts/ISAPI/mytest.dll - - -

    Whether or not you have preloaded an ISAPI extension, all - ISAPI extensions are governed by the same permissions and - restrictions as CGI scripts. That is, Options - ExecCGI must be set for the directory that contains the - ISAPI .dll file.

    - -

    Review the Additional Notes and the Programmer's Journal for additional details - and clarification of the specific ISAPI support offered by - mod_isapi.

    -
    - -
    Additional Notes - -

    Apache's ISAPI implementation conforms to all of the ISAPI - 2.0 specification, except for some "Microsoft-specific" - extensions dealing with asynchronous I/O. Apache's I/O model - does not allow asynchronous reading and writing in a manner - that the ISAPI could access. If an ISA tries to access - unsupported features, including async I/O, a message is placed - in the error log to help with debugging. Since these messages - can become a flood, the directive ISAPILogNotSupported - Off exists to quiet this noise.

    - -

    Some servers, like Microsoft IIS, load the ISAPI extension - into the server and keep it loaded until memory usage is too - high, or unless configuration options are specified. Apache - currently loads and unloads the ISAPI extension each time it is - requested, unless the ISAPICacheFile directive is specified. - This is inefficient, but Apache's memory model makes this the - most effective method. Many ISAPI modules are subtly - incompatible with the Apache server, and unloading these - modules helps to ensure the stability of the server.

    - -

    Also, remember that while Apache supports ISAPI Extensions, - it does not support ISAPI Filters. Support for - filters may be added at a later date, but no support is planned - at this time.

    -
    - -
    Programmer's Journal - -

    If you are programming Apache 2.0 mod_isapi - modules, you must limit your calls to ServerSupportFunction to the - following directives:

    - -
    -
    HSE_REQ_SEND_URL_REDIRECT_RESP
    - -
    Redirect the user to another location.
    - This must be a fully qualified URL (e.g. - http://server/location).
    - -
    HSE_REQ_SEND_URL
    - -
    Redirect the user to another location.
    - This cannot be a fully qualified URL, you are not allowed to - pass the protocol or a server name (e.g. simply - /location).
    - This redirection is handled by the server, not the - browser.
    - Warning: in their recent documentation, - Microsoft appears to have abandoned the distinction between - the two HSE_REQ_SEND_URL functions. Apache continues to treat - them as two distinct functions with different requirements - and behaviors.
    - -
    HSE_REQ_SEND_RESPONSE_HEADER
    - -
    Apache accepts a response body following the header if it - follows the blank line (two consecutive newlines) in the - headers string argument. This body cannot contain NULLs, - since the headers argument is NULL terminated.
    - -
    HSE_REQ_DONE_WITH_SESSION
    - -
    Apache considers this a no-op, since the session will be - finished when the ISAPI returns from processing.
    - -
    HSE_REQ_MAP_URL_TO_PATH
    - -
    Apache will translate a virtual name to a physical - name.
    - -
    HSE_APPEND_LOG_PARAMETER
    - -
    - This logged message may be captured in any of the following - logs: - -
      -
    • in the \"%{isapi-parameter}n\" component in a - CustomLog directive
    • - -
    • in the %q log component with the - ISAPIAppendLogToQuery On directive
    • - -
    • in the error log with the ISAPIAppendLogToErrors On - directive
    • -
    - The first option, the %{isapi-parameter}n component, is - always available and prefered. -
    - -
    HSE_REQ_IS_KEEP_CONN
    - -
    Will return the negotiated Keep-Alive status.
    - -
    HSE_REQ_SEND_RESPONSE_HEADER_EX
    - -
    Will behave as documented, although the fKeepConn flag is - ignored.
    - -
    HSE_REQ_IS_CONNECTED
    - -
    Will report false if the request has been aborted.
    -
    - -

    Apache returns FALSE to any unsupported call to - ServerSupportFunction, and sets the GetLastError value to - ERROR_INVALID_PARAMETER.

    - -

    ReadClient retrieves the request body exceeding the initial - buffer (defined by ISAPIReadAheadBuffer). Based on the - ISAPIReadAheadBuffer setting (number of bytes to buffer prior - to calling the ISAPI handler) shorter requests are sent - complete to the extension when it is invoked. If the request is - longer, the ISAPI extension must use ReadClient to retrieve the - remaining request body.

    - -

    WriteClient is supported, but only with the HSE_IO_SYNC flag - or no option flag (value of 0). Any other WriteClient request - will be rejected with a return value of FALSE, and a - GetLastError value of ERROR_INVALID_PARAMETER.

    - -

    GetServerVariable is supported, although extended server - variables do not exist (as defined by other servers.) All the - usual Apache CGI environment variables are available from - GetServerVariable, as well as the ALL_HTTP and ALL_RAW - values.

    - -

    Apache 2.0 mod_isapi supports additional - features introduced in later versions of the ISAPI specification, - as well as limited emulation of async I/O and the TransmitFile - semantics. Apache also supports preloading ISAPI .dlls for - performance, neither of which were not available under Apache 1.3 - mod_isapi.

    -
    - - -ISAPIFileChache -ISAPI .dll files to be loaded at startup -ISAPIFileCache file-path [file-path] ... -server config - - -

    Specifies a space-separated list of file names to be loaded - when the Apache server is launched, and remain loaded until the - server is shut down. This directive may be repeated for every - ISAPI .dll file desired. The full path name of each file should - be specified.

    -
    -
    - - -ISAPIReadAheadBuffer -Size of the Read Ahead Buffer sent to ISAPI -extensions -ISAPIReadAheadBuffer size -ISAPIReadAheadBuffer 49152 -server config - - -

    Defines the maximum size of the Read Ahead Buffer sent to - ISAPI extensions when they are initially invoked. All remaining - data must be retrieved using the ReadClient callback; some - ISAPI extensions may not support the ReadClient function. Refer - questions to the ISAPI extension's author.

    -
    -
    - - -ISAPILogNotSupported -Log unsupported feature requests from ISAPI -extensions -ISAPILogNotSupported on|off -ISAPILogNotSupported on -server config - - -

    Logs all requests for unsupported features from ISAPI - extensions in the server error log. While this should be turned - off once all desired ISAPI modules are functioning, it defaults - to on to help administrators track down problems.

    -
    -
    - - -ISAPIAppendLogToErrors -Record HSE_APPEND_LOG_PARAMETER requests from ISAPI -extensions to the error log -ISAPIAppendLogToErrors on|off -ISAPIAppendLogToErrors off -server config - - -

    Record HSE_APPEND_LOG_PARAMETER requests from ISAPI - extensions to the server error log.

    -
    -
    - - -ISAPIAppendLogToQuery -Record HSE_APPEND_LOG_PARAMETER requests from ISAPI -extensions to the query field -ISAPIAppendLogToQuery on|off -ISAPIAppendLogToQuery off -server config - - -

    Record HSE_APPEND_LOG_PARAMETER requests from ISAPI - extensions to the query field (appended to the CustomLog %q - component).

    -
    -
    - -
    \ No newline at end of file diff --git a/docs/manual/mod/mod_log_config.html b/docs/manual/mod/mod_log_config.html deleted file mode 100644 index 6855ec5c61bd67fb90c269e935ddc77a4c9b6d8f..0000000000000000000000000000000000000000 --- a/docs/manual/mod/mod_log_config.html +++ /dev/null @@ -1,144 +0,0 @@ - - - - -Apache module mod_log_config - - - - - -

    Module mod_log_config

    - -This module is contained in the mod_log_config.c file, and is not -compiled in by default. It provides for logging of the requests made to -the server, using a user-specified format. - -

    Summary

    -This is an EXPERIMENTAL module, which implements the TransferLog directive -(same as the common log module), and an additional directive, LogFormat. -Bugs would not surprise me.

    - -The argument to the LogFormat is a string, which can -include literal characters copied into the log files, and `%' directives as -follows: - -

    -%...h:          Remote host
    -%...l:          Remote logname (from identd, if supplied)
    -%...u:          Remote user (from auth; may be bogus if return 
    -                status (%s) is 401)
    -%...t:          Time, in common log format time format
    -%...r:          First line of request
    -%...s:          Status.  For requests that got internally redirected, 
    -                this is status of the original request --- %...>s 
    -                for the last.
    -%...b:          Bytes sent.
    -%...{Foobar}i:  The contents of Foobar: header line(s) in the request
    -                sent to the client.
    -%...{Foobar}o:  The contents of Foobar: header line(s) in the reply.
    -
    - -The `...' can be nothing at all (e.g. "%h %u %r %s %b"), or it can -indicate conditions for inclusion of the item (which will cause it -to be replaced with `-' if the condition is not met). Note that -there is no escaping performed on the strings from %r, %...i and -%...o; some with long memories may remember that I thought this was -a bad idea, once upon a time, and I'm still not comfortable with -it, but it is difficult to see how to `do the right thing' with all -of `%..i', unless we URL-escape everything and break with CLF. - -

    - -The forms of condition are a list of HTTP status codes, which may -or may not be preceded by `!'. Thus, `%400,501{User-agent}i' logs -User-agent: on 400 errors and 501 errors (Bad Request, Not -Implemented) only; `%!200,304,302{Referer}i' logs Referer: on all -requests which did not return some sort of normal status. - -

    - -The default LogFormat reproduces CLF; see below. - -

    - -The way this is supposed to work with virtual hosts is as follows: -a virtual host can have its own LogFormat, or its own TransferLog. -If it doesn't have its own LogFormat, it inherits from the main -server. If it doesn't have its own TransferLog, it writes to the -same descriptor (meaning the same process for `| ...'). - -

    - -That means that you can do things like: - -

    -<VirtualHost hosta.com>
    -LogFormat "hosta ..."
    -...
    -</VirtualHost>
    -
    -<VirtualHost hosta.com>
    -LogFormat "hostb ..."
    -...
    -</VirtualHost>
    - -... to have different virtual servers write into the same log file, -but have some indication which host they came from, though a %v -directive may well be a better way to handle this. Look for more -changes to come to this format.

    - - - - -

    Directives

    - - -
    - - -

    LogFormat

    - -Syntax: LogFormat string
    -Default: LogFormat "%h %l %u %t \"%r\" -%s %b"
    -Context: server config, virtual host
    -Status: Experimental
    -Module: mod_log_config

    - -This sets the format of the logfile.


    - - -

    TransferLog

    - -Syntax: TransferLog file-pipe
    -Default: TransferLog logs/transfer_log
    -Context: server config, virtual host
    -Status: Experimental
    -Module: mod_log_config

    - -The TransferLog directive sets the name of the file to which the server will -log the incoming requests. File-pipe is one -of -

    A filename -
    A filename relative to the ServerRoot. -
    `|' followed by a command -
    A program to receive the agent log information on its standard input. -Note the a new program will not be started for a VirtualHost if it inherits -the TransferLog from the main server. -
    -Security: if a program is used, then it will be -run under the user who started httpd. This will be root if the server -was started by root; be sure that the program is secure.

    - - -


    -Home -Index - - - - diff --git a/docs/manual/mod/mod_log_config.xml b/docs/manual/mod/mod_log_config.xml deleted file mode 100644 index b3c3809a1ad8970e3c35d33d1b48737d398b7ac3..0000000000000000000000000000000000000000 --- a/docs/manual/mod/mod_log_config.xml +++ /dev/null @@ -1,389 +0,0 @@ - - - - -mod_log_config -Base -log_config_module - - -This module provides for logging of the requests -made to the server, using the Common Log Format or a -user-specified format. - - - -

    This module provides for flexible logging of client - requests. Logs are written in a customizable format, and may be - written directly to a file, or to an external program. - Conditional logging is provided so that individual requests may - be included or excluded from the logs based on characteristics - of the request.

    - -

    Three directives are provided by this module: - TransferLog to create a log file, - LogFormat to set a custom format, and - CustomLog to define a log file and format in one - step. The TransferLog and CustomLog - directives can be used multiple times in each server to cause - each request to be logged to multiple files.

    - -See also: -Apache Log Files. - -
    -Custom Log Formats - -

    The format argument to the LogFormat and - CustomLog directives is a string. This string is - logged to the log file for each request. It can contain literal - characters copied into the log files and the c-type control - characters "\n" and "\t" to represent new-lines and tabs. - Literal quotes and back-slashes should be escaped with - back-slashes.

    - -

    The characteristics of the request itself are logged by - placing "%" directives in the format string, which are replaced - in the log file by the values as follows:

    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    %...a:Remote IP-address
    %...A:Local IP-address
    %...B:Bytes sent, excluding HTTP headers.
    %...b:Bytes sent, excluding HTTP headers. In CLF format -i.e. a '-' rather than a 0 when no bytes are sent.
    %...{Foobar}C:The contents of cookie "Foobar" in the request sent to the server.
    %...D:The time taken to serve the request, in microseconds.
    %...{FOOBAR}e:The contents of the environment variable FOOBAR
    %...f:Filename
    %...h:Remote host
    %...HThe request protocol
    %...{Foobar}i:The contents of Foobar: header line(s) in the request -sent to the server.
    %...l:Remote logname (from identd, if supplied)
    %...m:The request method
    %...{Foobar}n:The contents of note "Foobar" from another module.
    %...{Foobar}o:The contents of Foobar: header line(s) in the reply.
    %...p:The canonical Port of the server serving the request
    %...P:The process ID of the child that serviced the request.
    %...q:The query string (prepended with a ? if a query string exists, -otherwise an empty string)
    %...r:First line of request
    %...s:Status. For requests that got internally redirected, this is -the status of the *original* request --- %...>s for the last.
    %...t:Time, in common log format time format (standard english format)
    %...{format}t:The time, in the form given by format, which should -be in strftime(3) format. (potentially localized)
    %...T:The time taken to serve the request, in seconds.
    %...u:Remote user (from auth; may be bogus if return status (%s) is 401)
    %...U:The URL path requested, not including any query string.
    %...v:The canonical ServerName of the server serving the request.
    %...V:The server name according to the UseCanonicalName setting.
    %...X:Connection status when response is completed. - -'X' = connection aborted before the response completed.
    -'+' = connection may be kept alive after the response is sent.
    -'-' = connection will be closed after the response is sent. -
    -(This directive was %...c in late versions of Apache 1.3, but -this conflicted with the historical ssl %...{var}c syntax.)
    - -

    The "..." can be nothing at all (e.g., "%h %u - %r %s %b"), or it can indicate conditions for inclusion - of the item (which will cause it to be replaced with "-" if the - condition is not met). The forms of condition are a list of - HTTP status codes, which may or may not be preceded by "!". - Thus, "%400,501{User-agent}i" logs User-agent: on 400 errors - and 501 errors (Bad Request, Not Implemented) only; - "%!200,304,302{Referer}i" logs Referer: on all requests which - did not return some sort of normal status.

    - -

    Note that there is no escaping performed on the strings from - %...r, %...i and %...o. This is mainly to comply with the - requirements of the Common Log Format. This implies that - clients can insert control characters into the log, so care - should be taken when dealing with raw log files.

    - -

    Some commonly used log format strings are:

    - -
    -
    Common Log Format (CLF)
    - -
    "%h %l %u %t \"%r\" %>s %b"
    - -
    Common Log Format with Virtual Host
    - -
    "%v %h %l %u %t \"%r\" %>s %b"
    - -
    NCSA extended/combined log format
    - -
    "%h %l %u %t \"%r\" %>s %b \"%{Referer}i\" - \"%{User-agent}i\""
    - -
    Referer log format
    - -
    "%{Referer}i -> %U"
    - -
    Agent (Browser) log format
    - -
    "%{User-agent}i"
    -
    - -

    Note that the canonical ServerName and Listen of the server serving the - request are used for %v and %p - respectively. This happens regardless of the UseCanonicalName setting - because otherwise log analysis programs would have to duplicate - the entire vhost matching algorithm in order to decide what - host really served the request.

    -
    - -
    - - Security Considerations - -

    See the security tips - document for details on why your security could be compromised - if the directory where logfiles are stored is writable by - anyone other than the user that starts the server.

    - -
    - -
    - - -CookieLog -Sets filename for the logging of cookies -CookieLog filename -none -server configvirtual -host -Only available in Apache 1.2 and above - - - -

    The CookieLog directive sets the - filename for logging of cookies. The filename is relative to the - serverroot. This directive is - included only for compatibility with mod_cookies, - and is deprecated.

    -
    - -
    - - -CustomLog -Sets filename and format of log file -CustomLog - file|pipe format|nickname - [env=[!]environment-variable] -none -server configvirtual -host -Nickname only available in Apache 1.3 or later. -Conditional logging available in 1.3.5 or later. - - - -

    The CustomLog directive is used to - log requests to the server. A log format is specified, and the - logging can optionally be made conditional on request - characteristics using environment variables.

    - -

    The first argument, which specifies the location to which - the logs will be written, can take on one of the following two - types of values:

    - -
    -
    file
    - -
    A filename, relative to the ServerRoot.
    - -
    pipe
    - -
    The pipe character "|", followed by the path - to a program to receive the log information on its standard - input. Security: if a program is used, then - it will be run under the user who started httpd. This will be - root if the server was started by root; be sure that the - program is secure.
    -
    - -

    The second argument specifies what will be written to the - log file. It can specify either a nickname defined by - a previous LogFormat directive, or it - can be an explicit format string as described in the - log formats section.

    - -

    For example, the following two sets of directives have - exactly the same effect:

    - - - # CustomLog with format nickname
    - LogFormat "%h %l %u %t \"%r\" %>s %b" common
    - CustomLog logs/access_log common
    -
    - # CustomLog with explicit format string
    - CustomLog logs/access_log "%h %l %u %t \"%r\" %>s %b"
    -
    - -

    The third argument is optional and allows the decision on - whether or not to log a particular request to be based on the - presence or absence of a particular variable in the server - environment. If the specified environment - variable is set for the request (or is not set, in the case - of a 'env=!name' clause), then the - request will be logged.

    - -

    Environment variables can be set on a per-request - basis using the mod_setenvif - and/or mod_rewrite modules. For - example, if you don't want to record requests for all GIF - images on your server in a separate logfile but not your main - log, you can use:

    - - - SetEnvIf Request_URI \.gif$ gif-image
    - CustomLog gif-requests.log common env=gif-image
    - CustomLog nongif-requests.log common env=!gif-image -
    -
    - -
    - - -LogFormat -Describes a format for use in a log file -LogFormat - format|nickname [nickname] -none -server configvirtual -host -Nickname only available in Apache 1.3 or later. - - - -

    This directive specifies the format of the access log - file.

    - -

    The LogFormat directive can take one of two - forms. In the first form, where only one argument is specified, - this directive sets the log format which will be used by logs - specified in subsequent TransferLog - directives. The single argument can specify an explicit - format as discussed in custom log - formats section above. Alternatively, it can use a - nickname to refer to a log format defined in a - previous LogFormat directive as described - below.

    - -

    The second form of the LogFormat - directive associates an explicit format with a - nickname. This nickname can then be used in - subsequent LogFormat or - CustomLog directives rather than - repeating the entire format string. A - LogFormat - directive which defines a nickname does nothing - else -- that is, it only defines the - nickname, it doesn't actually apply the format and make it the - default. Therefore, it will not affect subsequent - TransferLog directives.

    - -
    -
    - - - -TransferLog -Specifly location of a log file -TransferLog file|pipe -none -server configvirtual -host - - - - -

    This directive has exactly the same arguments and effect as - the CustomLog directive, with the - exception that it does not allow the log format to be specified - explicitly or for conditional logging of requests. Instead, the - log format is determined by the most recently specified - specified LogFormat directive (which - does not define a nickname). Common Log Format is used if no - other format has been specified.

    - -

    Example:

    - - LogFormat "%h %l %u %t \"%r\" %>s %b \"%{Referer}i\" \"%{User-agent}i\""
    - TransferLog logs/access_log -
    - -
    - -
    - -
    diff --git a/docs/manual/mod/mod_mime.html b/docs/manual/mod/mod_mime.html deleted file mode 100644 index c3dc14af92b82715442e1c0f2ab89118ba365d9c..0000000000000000000000000000000000000000 --- a/docs/manual/mod/mod_mime.html +++ /dev/null @@ -1,210 +0,0 @@ - - - - -Apache module mod_mime - - - - - -

    Module mod_mime

    - -This module is contained in the mod_mime.c file, and is -compiled in by default. It provides for determining the types of files -from the filename. - -

    Summary

    -This module is used to determine the mime types of documents. Some mime -types indicate special processing to be performed by the server, otherwise -the type is returned to the client so that the browser can deal with -the document appropriately.

    - -The filename of a document is treated as being composed of a basename followed -by some extensions, in the following order: -

    base.type.language.enc
    -The type extension sets the type of the document; types are defined -in the TypesConfig file and by the -AddType directive. The language extension -sets the language of the document, as defined by the -AddLanguage directive. Finally, the -enc directive sets the encoding of the document, as defined by -the AddEncoding directive. - - -

    Directives

    - -
    - - -

    AddEncoding

    - -Syntax: AddEncoding mime-enc extension extension...
    -Context: server config, virtual host, directory, .htaccess
    -Override: FileInfo
    -Status: Base
    -Module: mod_mime

    - -The AddEncoding directive adds to the list of filename extensions which -filenames may end in for the specified encoding type. Mime-enc -is the mime encoding to use for documents ending in extension. -Example: -

    -AddEncoding x-gzip gz
    -AddEncoding x-compress Z -
    - -This will cause files ending in .gz to be marked as encoded using the x-gzip -encoding, and .Z files to be marked as encoded with x-compress.


    - -

    AddHandler

    - -Syntax: <AddHandler handler-name extention>
    -Context: server config, virtual host, directory, .htaccess
    -Status: Base
    -Module: mod_mime
    -Compatibility: AddHandler is only available in Apache -1.1 and later

    - -

    AddHandler maps the filename extension extension to the -handler -handler-name. For example, to activate CGI scripts -with the file extension ".cgi", you might use: -

    -    AddHandler cgi-script cgi
    -
    - -

    Once that has been put into your srm.conf or httpd.conf file, any -file ending with ".cgi" will be treated as a CGI -program.

    - - -

    AddLanguage

    - -Syntax: AddLanguage mime-lang extension extension...
    -Context: server config, virtual host, directory, .htaccess
    -Override: FileInfo
    -Status: Base
    -Module: mod_mime

    - -The AddLanguage directive adds to the list of filename extensions which -filenames may end in for the specified content language. Mime-lang -is the mime language of files with names ending extension, -after any content encoding extensions have been removed. Example: -

    -AddEncoding x-compress Z
    -AddLanguage en .en
    -AddLanguage fr .fr
    -
    - -Then the document xxxx.en.Z will be treated as being a compressed -English document. Although the content language is reported to the client, -the browser is unlikely to use this information. The AddLanguage directive -is more useful for content negotiation, where the server returns one -from several documents based on the client's language preference.


    - -

    AddType

    - -Syntax: AddType mime-type extension extension...
    -Context: server config, virtual host, directory, .htaccess
    -Override: FileInfo
    -Status: Base
    -Module: mod_mime

    - -The AddType directive adds to the list of filename extensions which -filenames may end in for the specified content type. Mime-enc -is the mime type to use for documents ending in extension. -after content-encoding and language extensions have been removed. Example: -

    -AddType image/gif GIF -
    -It is recommended that new mime types be added using the AddType directive -rather than changing the TypesConfig file.

    -Note that, unlike the NCSA httpd, this directive cannot be used to set the -type of particular files.


    - -

    ForceType

    - -Syntax: <ForceType media type>
    -Context: directory, .htaccess
    -Status: Base
    -Module: mod_mime
    -Compatibility: ForceType is only available in Apache -1.1 and later.

    - -

    When placed into an .htaccess file or a -<Directory> or <Location section, -this directive forces all matching files to be served -as the content type given by media type. For example, if you -had a directory full of GIF files, but did not want to label them all with -".gif", you might want to use: -

    -    ForceType image/gif
    -
    -

    Note that this will override any filename extensions that might -media type.

    - -

    SetHandler

    - -Syntax: <SetHandler handler-name>
    -Context: directory, .htaccess
    -Status: Base
    -Module: mod_mime
    -Compatibility: SetHandler is only available in Apache -1.1 and later.

    - -

    When placed into an .htaccess file or a -<Directory> or <Location section, -this directive forces all matching files to be parsed through the -handler -given by handler-name. For example, if you had a -directory you wanted to be parsed entirely as imagemap rule files, -regardless of extension, you might put the following into an -.htaccess file in that directory: -

    -    SetHandler imap-file
    -
    - -

    Another example: if you wanted to have the server display a status -report whenever a URL of http://servername/status was -called, you might put the following into access.conf: -

    -    <Location /status>
    -    SetHandler server-status
    -    </Location>
    -
    - - -

    TypesConfig

    - -Syntax: TypesConfig filename
    -Default: TypesConfig conf/mime.types
    -Context: server config
    -Status: Base
    -Module: mod_mime

    - -The TypesConfig directive sets the location of the mime types configuration -file. Filename is relative to the -ServerRoot. This file sets the default list of -mappings from filename extensions to content types; changing this file is not -recommended. Use the AddType directive instead. The -file contains lines in the format of the arguments to an AddType command: -

    mime-type extension extension ...
    -The extensions are lower-cased. Blank lines, and lines beginning with a hash -character (`#') are ignored.

    - -


    -Home -Index - - - - diff --git a/docs/manual/mod/mod_mime.xml b/docs/manual/mod/mod_mime.xml deleted file mode 100644 index 77bf64b267b33708eae3b57e7d105fd1f7f7c392..0000000000000000000000000000000000000000 --- a/docs/manual/mod/mod_mime.xml +++ /dev/null @@ -1,922 +0,0 @@ - - - - - -mod_mime -This module associates the request filename's extensions - (e.g. .html) with the file's behavior (handlers and filters) - and content (mime-type, language, character set and - encoding.) - -mod_mime.c -mime_module -Base - - -

    This module is used to associate various bits of "meta - information" with files by their filename extensions. This - information relates the filename of the document to it's - mime-type, language, character set and encoding. This - information is sent to the browser, and participates in content - negotiation, so the user's preferences are respected when - choosing one of several possible files to serve. See - mod_negotiation for more information - about content negotiation.

    - -

    The directives AddCharset, - AddEncoding, - AddLanguage and - AddType all used to map file extensions - onto the meta-information for that file. Respectively they set - the character set, content-encoding, content-language, and - MIME-type (content-type) of documents.

    - -

    In addition, mod_mime may define the "handler" for a - document, which controls which module or script will serve the - document. With the introduction of "filters" in Apache 2.0, - mod_mime can also define the filters that the the content - should be processed through (e.g. the Includes output filter - for server side scripting) and what filters the client request - and POST content should be processed through (the input - filters.)

    - -

    The directives AddHandler, - AddOutputFilter, and - AddInputFilter control the modules - or scripts that serve the document. The - MultiviewsMatch directive allows - mod_negotiation to consider these - file extensions to included when testing Multiviews matches.

    - -

    The directive TypesConfig is used - to specify a file which also maps extensions onto MIME types. - Most administrators use the provided mime.types file which - associates common filename extensions with IANA registered - content types. The current list is maintained at - http://www.isi.edu/in-notes/iana/assignments/media-types/media-types - although it may be mirrored elsewhere). This simplifies the - httpd.conf file by providing the majority of media-type - definitions, and they may be overridden by - AddType directives as needed.

    - - Please do not send requests to the Apache httpd Project - to add any new entries in the distributed mime.types file - unless (1) they are already registered with IANA, and (2) they - use widely accepted, non-conflicting filename extensions across - platforms. category/x-subtype requests will be automatically - rejected, as will any new two-letter extensions as they will - likely conflict later with the already crowded language and - character set namespace. - -

    The core directives ForceType and - SetHandler are used to - associate all the files in a given container (e.g., - <location>, <directory>, or <Files>) with a - particular MIME-type or handler. These settings override any - filename extension mappings defined in mod_mime.

    - -

    Note that changing the type or encoding of a file does not - change the value of the Last-Modified header. - Thus, previously cached copies may still be used by a client or - proxy, with the previous headers. If you change the - meta-information (language, content type, character set or - encoding) you may need to 'touch' affected files (updating - their last modified date) to ensure that all visitors are - receive the corrected content headers.

    -
    - - See also: MimeMagicFile - -
    -Files with Multiple Extensions - -

    Files can have more than one extension, and the order of the - extensions is normally irrelevant. For example, if the - file welcome.html.fr maps onto content type - text/html and language French then the file welcome.fr.html - will map onto exactly the same information. If more than one - extension is given which maps onto the same - type of meta-information, then the one to the right will be - used. For example, if ".gif" maps to the MIME-type image/gif - and ".html" maps to the MIME-type text/html, then the file - welcome.gif.html will be associated with the - MIME-type "text/html".

    - -

    Care should be taken when a file with multiple extensions - gets associated with both a MIME-type and a handler. This will - usually result in the request being by the module associated - with the handler. For example, if the .imap - extension is mapped to the handler "imap-file" (from mod_imap) - and the .html extension is mapped to the MIME-type - "text/html", then the file world.imap.html will be - associated with both the "imap-file" handler and "text/html" - MIME-type. When it is processed, the "imap-file" handler will - be used, and so it will be treated as a mod_imap imagemap - file.

    -
    - -
    Content encoding - -

    A file of a particular MIME type can additionally be encoded a - particular way to simplify transmission over the Internet. - While this usually will refer to compression, such as - gzip, it can also refer to encryption, such a - pgp or to an encoding such as UUencoding, which is - designed for transmitting a binary file in an ASCII (text) - format.

    - -

    The MIME RFC puts it this way:

    - - - The Content-Encoding entity-header field is used as a - modifier to the media-type. When present, its value indicates - what additional content coding has been applied to the - resource, and thus what decoding mechanism must be applied in - order to obtain the media-type referenced by the Content-Type - header field. The Content-Encoding is primarily used to allow - a document to be compressed without losing the identity of - its underlying media type. - - -

    By using more than one file extension (see section above about multiple file - extensions), you can indicate that a file is of a - particular type, and also has a particular - encoding.

    - -

    For example, you may have a file which is a Microsoft Word - document, which is pkzipped to reduce its size. If the - .doc extension is associated with the Microsoft - Word file type, and the .zip extension is - associated with the pkzip file encoding, then the file - Resume.doc.zipwould be known to be a pkzip'ed Word - document.

    - -

    Apache send a Content-encoding header with the - resource, in order to tell the client browser about the - encoding method.

    - - Content-encoding: pkzip - -
    - -
    - -Character sets and languages - -

    In addition to file type and the file encoding, - another important piece of information is what language a - particular document is in, and in what character set the file - should be displayed. For example, the document might be written - in the Vietnamese alphabet, or in Cyrillic, and should be - displayed as such. This information, also, is transmitted in - HTTP headers.

    - -

    The character set, language encoding and mime type are all - used in the process of content negotiation (See - mod_negotiation) to determine - which document to give to the client, when there are - alternative documents in more than one character set, language, - encoding or mime type. All filename extensions associations - created with AddCharset, AddEncoding, - AddLanguage and AddType directives - (and extensions listed in the MimeMagicFile) - participate in this select process. Filename extensions that - are only associated using the AddHandler, - AddInputFilter or AddOutputFilter - directives may be included or excluded from matching by using - the MultiviewsMatch directive.

    - -
    -Charset - -

    To convey this further information, Apache optionally sends - a Content-Language header, to specify the language - that the document is in, and can append additional information - onto the Content-Type header to indicate the - particular character set that should be used to correctly - render the information.

    - - -Content-Language: en, fr
    -Content-Type: text/plain; charset=ISO-8859-2 -
    - -

    The language specification is the two-letter abbreviation - for the language. The charset is the name of the - particular character set which should be used.

    -
    -
    - - - -AddCharset -AddCharset charset extension -[extension] ... -None - -server config -virtual host -directory -.htaccess - -FileInfo -AddCharset is only available in Apache -1.3.10 and later -Maps the given filename extensions - to the specified content charset - - - -

    The AddCharset directive maps the given filename extensions - to the specified content charset. charset is the MIME - charset parameter of filenames containing extension. - This mapping is added to any already in force, overriding any - mappings that already exist for the same extension.

    - -

    Example:

    - - AddLanguage ja .ja
    - AddCharset EUC-JP .euc
    - AddCharset ISO-2022-JP .jis
    - AddCharset SHIFT_JIS .sjis -
    - -

    Then the document xxxx.ja.jis will be treated - as being a Japanese document whose charset is ISO-2022-JP (as - will the document xxxx.jis.ja). The AddCharset - directive is useful for both to inform the client about the - character encoding of the document so that the document can be - interpreted and displayed appropriately, and for content negotiation, - where the server returns one from several documents based on - the client's charset preference.

    - -

    The extension argument is case-insensitive, and can - be specified with or without a leading dot.

    - - See also: - mod_negotiation - -
    - -
    - - -AddEncoding -AddEncoding - MIME-enc extension [extension] ... -None - -server config -virtual host -directory -.htaccess -FileInfo - -Maps the given filename extensions - to the specified encoding type - - - -

    The AddEncoding directive maps the given filename extensions - to the specified encoding type. MIME-enc is the MIME - encoding to use for documents containing the - extension. This mapping is added to any already in - force, overriding any mappings that already exist for the same - extension. Example:

    - - - AddEncoding x-gzip .gz
    - AddEncoding x-compress .Z -
    - -

    This will cause filenames containing the .gz extension to be - marked as encoded using the x-gzip encoding, and filenames - containing the .Z extension to be marked as encoded with - x-compress.

    - -

    Old clients expect x-gzip and - x-compress, however the standard dictates that - they're equivalent to gzip and - compress respectively. Apache does content - encoding comparisons by ignoring any leading x-. - When responding with an encoding Apache will use whatever form - (i.e., x-foo or foo) the - client requested. If the client didn't specifically request a - particular form Apache will use the form given by the - AddEncoding directive. To make this long story - short, you should always use x-gzip and - x-compress for these two specific encodings. More - recent encodings, such as deflate should be - specified without the x-.

    - -

    The extension argument is case-insensitive, and can - be specified with or without a leading dot.

    - - See also: Files with - multiple extensions -
    -
    - - -AddHandler -AddHandler - handler-name extension [extension] ... -None - -server config -virtual host -directory -.htaccess - -FileInfo - -AddHandler maps the filename extensions extension -to the handler handler-name. - - - -

    This mapping is added to any already in - force, overriding any mappings that already exist for the same - extension. For example, to activate CGI scripts with - the file extension ".cgi", you might use:

    - - - AddHandler cgi-script .cgi - - -

    Once that has been put into your srm.conf or httpd.conf - file, any file containing the ".cgi" extension - will be treated as a CGI program.

    - -

    The extension argument is case-insensitive, and can - be specified with or without a leading dot.

    - - See also: Files with - multiple extensions -
    -
    - - -AddInputFilter -AddInputFilter - filter[;filter...] extension - [extension ...] -None - -server config -virtual host -directory -.htaccess - -AddInputFilter - is only available in Apache 2.0.26 and later. -Maps the filename extensions - extension to the filter or filters which will process - client requests and POST input when they are received by the - server. - - - -

    AddInputFilter maps the filename extensions - extension to the filter or filters which will process - client requests and POST input when they are received by the - server. This is in addition to any filters defined elsewhere, - including the SetInputFilter directive. - This mapping is merged over any already in force, overriding - any mappings that already exist for the same - extension.

    - -

    If more than one filter is specified, they must be separated - by semicolons in the order in which they should process the - content. Both the filter and extension arguments are - case-insensitive, and the extension may be specified with or - without a leading dot.

    - - See also the Filters - documentation. -
    - -
    - - - -AddLanguage -AddLanguage - MIME-lang extension [extension] ... -None - -server config -virtual host -directory -.htaccess - -FileInfo -maps the given filename extension -to the specified content language. - - - -

    The AddLanguage directive maps the given filename extension - to the specified content language. MIME-lang is the - MIME language of filenames containing extension. This - mapping is added to any already in force, overriding any - mappings that already exist for the same - extension.

    - -

    Example:

    - - - AddEncoding x-compress .Z
    - AddLanguage en .en
    - AddLanguage fr .fr -
    - -

    Then the document xxxx.en.Z will be treated as - being a compressed English document (as will the document - xxxx.Z.en). Although the content language is - reported to the client, the browser is unlikely to use this - information. The AddLanguage directive is more useful for content negotiation, - where the server returns one from several documents based on - the client's language preference.

    - -

    If multiple language assignments are made for the same - extension, the last one encountered is the one that is used. - That is, for the case of:

    - - - AddLanguage en .en
    - AddLanguage en-uk .en
    - AddLanguage en-us .en -
    - -

    documents with the extension ".en" would be - treated as being "en-us".

    - -

    The extension argument is case-insensitive, and can - be specified with or without a leading dot.

    - - See also: Files with - multiple extensions, mod_negotiation -
    -
    - - -AddOutputFilter -AddOutputFilter - filter[;filter...] extension - [extension ...] -None - -server config -virtual host -directory -.htaccess - - -AddOutputFilter - is only available in Apache 2.0.26 and later. -maps the filename -extensions extension to the filters which will process -responses from the server before they are sent to the -client. - - - -

    The AddOutputFilter directive maps the filename - extensions extension to the filters which will process - responses from the server before they are sent to the client. - This is in addition to any filters defined elsewhere, including - the SetOutputFilter - directive. This mapping is merged over any already in force, - overriding any mappings that already exist for the same - extension.

    - -

    For example, the following configuration will process all - .shtml files for server-side includes.

    - - - -   AddOutputFilter INCLUDES shtml - - -

    If more than one filter is specified, they must be separated - by semicolons in the order in which they should process the - content. Both the filter and extension arguments are - case-insensitive, and the extension may be specified with or - without a leading dot.

    - - See also the Filters - documentation. - -
    -
    - - -AddType -AddType MIME-type - extension [extension] ... -None - -server config -virtual host -directory -.htaccess - -FileInfo -maps the given filename extensions -onto the specified content type. - - - -

    The AddType directive maps the given filename extensions - onto the specified content type. MIME-type is the MIME - type to use for filenames containing extension. This - mapping is added to any already in force, overriding any - mappings that already exist for the same extension. - This directive can be used to add mappings not listed in the - MIME types file (see the TypesConfig - directive).

    - -

    Example:

    - - - AddType image/gif .gif - - - It is recommended that new MIME types be added using the - AddType directive rather than changing the - TypesConfig file. - - Note that, unlike the NCSA httpd, this directive cannot be - used to set the type of particular files. - -

    The extension argument is case-insensitive, and can - be specified with or without a leading dot.

    - - See also: Files with - multiple extensions -
    -
    - - -MultiviewsMatch -MultiviewsMatch - [NegotiatedOnly] [Handlers] [Filters] [Any] -None - -server config -virtual host -directory -.htaccess - -FileInfo -only available - in Apache 2.0.26 and later. - - - -

    MultiviewsMatch permits three different behaviors for - mod_negotiation's Multiviews - feature. Multiviews allows a request for a file, e.g. index.html, - to match any negotiated extensions following the base request, - e.g. index.html.en, index.html,fr, or index.html.gz.

    - -

    The NegotiatedOnly option provides that every extension following - the base name must correlate to a recognized mod_mime extension for - content negotation, e.g. Charset, Content-Type, Language, or - Encoding. This is the strictest implementation with the fewest - unexpected side effects, and is the default behavior.

    - -

    To include extensions associated with Handlers and/or Filters, - set the MultiviewsMatch directive to either Handlers, Filters, or - both option keywords. If all other factors are equal, the smallest - file will be served, e.g. in deciding between index.html.cgi of 500 - characters and index.html.pl of 1000 bytes, the .cgi file would win - in this example. Users of .asis files might prefer to use the - Handler option, if .asis files are associated with the asis-handler.

    - -

    You may finally allow Any extensions to match, even if mod_mime - doesn't recognize the extension. This was the behavior in Apache 1.3, - and can cause unpredicatable results, such as serving .old or .bak - files the webmaster never expected to be served.

    -
    -
    - - -DefaultLanguage -DefaultLanguage - MIME-lang -None - -server config -virtual host -directory -.htaccess - -FileInfo -DefaultLanguage - is only available in Apache 1.3.4 and later. -Sets all files in the given scope to the -specified language - - - -

    The DefaultLanguage directive tells Apache that all files in - the directive's scope (e.g., all files covered by the - current <Directory> container) that don't - have an explicit language extension (such as .fr - or .de as configured by AddLanguage) - should be considered to be in the specified MIME-lang - language. This allows entire directories to be marked as - containing Dutch content, for instance, without having to - rename each file. Note that unlike using extensions to specify - languages, DefaultLanguage can only specify a - single language.

    - -

    If no DefaultLanguage directive is in force, - and a file does not have any language extensions as configured - by AddLanguage, then that file will be considered - to have no language attribute.

    - - See also: Files with - multiple extensions, mod_negotiation -
    -
    - - - -RemoveCharset -RemoveCharset - extension [extension] ... -None - -directory -.htaccess - -RemoveCharset is - only available in Apache 2.0.24 and later. - - -

    The RemoveCharset directive removes any - character set associations for files with the given extensions. - This allows .htaccess files in subdirectories to - undo any associations inherited from parent directories or the - server config files.

    - -

    The extension argument is case-insensitive, and can - be specified with or without a leading dot.

    -
    -
    - - -RemoveEncoding -RemoveEncoding - extension [extension] ... -None - -directory -.htaccess - -RemoveEncoding - is only available in Apache 1.3.13 and later. - - - -

    The RemoveEncoding directive removes any - encoding associations for files with the given extensions. This - allows .htaccess files in subdirectories to undo - any associations inherited from parent directories or the - server config files. An example of its use might be:

    - - - -
    -
    /foo/.htaccess:
    -
    AddEncoding x-gzip .gz
    - AddType text/plain .asc
    - <Files *.gz.asc>
    -     RemoveEncoding - .gz
    - </Files>
    -
    -
    - -

    This will cause foo.gz to be marked as being - encoded with the gzip method, but foo.gz.asc as an - unencoded plaintext file.

    - -

    Note:RemoveEncoding directives are processed - after any AddEncoding directives, so it is possible they - may undo the effects of the latter if both occur within the - same directory configuration.

    - -

    The extension argument is case-insensitive, and can - be specified with or without a leading dot.

    -
    -
    - - - -RemoveHandler -RemoveHandler - extension [extension] ... -None - -directory -.htaccess - -RemoveHandler is - only available in Apache 1.3.4 and later. - - - -

    The RemoveHandler directive removes any handler - associations for files with the given extensions. This allows - .htaccess files in subdirectories to undo any - associations inherited from parent directories or the server - config files. An example of its use might be:

    - - -
    -
    /foo/.htaccess:
    - -
    AddHandler server-parsed .html
    - -
    /foo/bar/.htaccess:
    - -
    RemoveHandler .html
    -
    -
    - -

    This has the effect of returning .html files in - the /foo/bar directory to being treated as normal - files, rather than as candidates for parsing (see the mod_include - module).

    - -

    The extension argument is case-insensitive, and can - be specified with or without a leading dot.

    -
    -
    - - - -RemoveInputFilter -RemoveInputFilter - extension [extension] ... -None - -directory -.htaccess - -RemoveInputFilter is only available in Apache -2.0.26 and later. - - - -

    The RemoveInputFilter directive removes any - input filter associations for files with the given extensions. - This allows .htaccess files in subdirectories to - undo any associations inherited from parent directories or the - server config files.

    - -

    The extension argument is case-insensitive, and can - be specified with or without a leading dot.

    -
    -
    - - -RemoveLanguage -RemoveLanguage - extension [extension] ... -None - -directory -.htaccess - -RemoveLanguage - is only available in Apache 2.0.24 and later. - - - - -

    The RemoveLanguage directive removes any - language associations for files with the given extensions. This - allows .htaccess files in subdirectories to undo - any associations inherited from parent directories or the - server config files.

    - -

    The extension argument is case-insensitive, and can - be specified with or without a leading dot.

    -
    -
    - - -RemoveOutputFilter -RemoveOutputFilter - extension [extension] ... - - -directory -.htaccess - - -RemoveOutputFilter is only available in Apache -2.0.26 and later. - - - -

    The RemoveOutputFilter directive removes any - output filter associations for files with the given extensions. - This allows .htaccess files in subdirectories to - undo any associations inherited from parent directories or the - server config files.

    - -

    The extension argument is case-insensitive, and can - be specified with or without a leading dot.

    -
    -
    - - - -RemoveType -RemoveType - extension [extension] ... - - -directory -.htaccess - - -RemoveType is - only available in Apache 1.3.13 and later. - - -

    The RemoveType directive removes any MIME type - associations for files with the given extensions. This allows - .htaccess files in subdirectories to undo any - associations inherited from parent directories or the server - config files. An example of its use might be:

    - - -
    -
    /foo/.htaccess:
    - -
    RemoveType .cgi
    -
    -
    - -

    This will remove any special handling of .cgi - files in the /foo/ directory and any beneath it, - causing the files to be treated as being of the default type.

    - - Note:RemoveType directives are processed - after any AddType directives, so it is - possible they may undo the effects of the latter if both occur - within the same directory configuration. - -

    The extension argument is case-insensitive, and can - be specified with or without a leading dot.

    -
    -
    - - - - -TypesConfig -TypesConfig file-path -TypesConfig conf/mime.types - -server config - - - - -

    The TypesConfig directive sets the location of the MIME - types configuration file. Filename is relative to the - ServerRoot. This file sets - the default list of mappings from filename extensions to - content types; changing this file is not recommended. Use the - AddType directive instead. The file - contains lines in the format of the arguments to an AddType - command:

    - - - MIME-type extension extension ... - - -

    - The extensions are lower-cased. Blank lines, and lines - beginning with a hash character (`#') are ignored.

    -
    -
    -
    - diff --git a/docs/manual/mod/mod_mime_magic.html b/docs/manual/mod/mod_mime_magic.html deleted file mode 100644 index 56fade84863c425c291819bea8b572286a4a37b9..0000000000000000000000000000000000000000 --- a/docs/manual/mod/mod_mime_magic.html +++ /dev/null @@ -1,251 +0,0 @@ - - - - Apache module mod_mime_magic - - - -

    Module mod_mime_magic

    - - This module is an optional extension to the Apache HTTPD server. - The current version can be obtained from - - http://www.employees.org/~ikluft/apache/mod_mime_magic/. - -

    Summary

    - - This module is derived from a free version of the file(1) - command for Unix, - which uses "magic numbers" and other hints from a file's contents to - figure out what the contents are. - In the case of this module, - it tries to figure out the MIME type of the file. -

    - This module is only active if the magic file exists and - was successfully opened at server-configuration time. - The magic file can be named by the - MimeMagicFile - directive or defaults to conf/magic. -

    - The contents of the file are plain ASCII text in 4-5 columns. - Blank lines are allowed but ignored. - Commented lines use a hash mark "#". - The remaining lines are parsed for the following columns: - - - - - - - - - - - - - - - - - - - - - -
    ColumnDescription
    1byte number to begin checking from -
    - ">" indicates a dependency upon the previous non-">" line
    2type of data to match - - - - - - - - - - - - -
    bytesingle character
    shortmachine-order 16-bit integer
    longmachine-order 32-bit integer
    stringarbitrary-length string
    datelong integer date - (seconds since Unix epoch/1970)
    beshortbig-endian 16-bit integer
    belongbig-endian 32-bit integer
    bedatebig-endian 32-bit integer date
    leshortlittle-endian 16-bit integer
    lelonglittle-endian 32-bit integer
    ledatelittle-endian 32-bit integer date
    -
    3contents of data to match
    4MIME type if matched
    5MIME encoding if matched (optional)
    - -

    - For example, the following magic file lines - would recognize some audio formats. - -

    -# Sun/NeXT audio data
    -0       string          .snd
    ->12     belong          1               audio/basic
    ->12     belong          2               audio/basic
    ->12     belong          3               audio/basic
    ->12     belong          4               audio/basic
    ->12     belong          5               audio/basic
    ->12     belong          6               audio/basic
    ->12     belong          7               audio/basic
    ->12     belong          23              audio/x-adpcm
    -
    - - Or these would recognize the difference between "*.doc" files containing - Microsoft Word or FrameMaker documents. (These are incompatible file - formats which use the same file suffix.) - -
    -# Frame
    -0       string          \<MakerFile     application/x-frame
    -0       string          \<MIFFile       application/x-frame
    -0       string          \<MakerDictionary       application/x-frame
    -0       string          \<MakerScreenFon        application/x-frame
    -0       string          \<MML           application/x-frame
    -0       string          \<Book          application/x-frame
    -0       string          \<Maker         application/x-frame
    -
    -# MS-Word
    -0       string          \376\067\0\043                  application/msword
    -0       string          \320\317\021\340\241\261        application/msword
    -0       string          \333\245-\0\0\0                 application/msword
    -
    - - An optional MIME encoding can be included as a fifth column. - For example, this can recognize gzipped files and set the encoding - for them. - -
    -# gzip (GNU zip, not to be confused with [Info-ZIP/PKWARE] zip archiver)
    -0       string          \037\213        application/octet-stream        x-gzip
    -
    - -

    Performance Issues

    - - This module is not for every system. If your system is barely keeping - up with its load or if you're performing a web server benchmark, - you may not want to enable this because the processing is not free. -

    - However, an effort was made to improve the performance of the original - file(1) code to make it fit in a busy web server. - It was designed for a server where there are thousands of users who - publish their own documents. - This is probably very common on intranets. - Many times, it's helpful - if the server can make more intelligent decisions about a file's - contents than the file name allows - ...even if just to reduce the "why doesn't my page work" calls - when users improperly name their own files. - You have to decide if the extra work suits your environment. -

    - When compiling an Apache server, this module should be at or near the - top of the list of modules in the Configuration file. The modules are - listed in increasing priority so that will mean this one is used only - as a last resort, just like it was designed to. - -

    Directives

    -

    -

    -

    -
    -

    - MimeMagicFile -

    -

    - Syntax: MimeMagicFile magic-file-name -
    - Default: conf/magic -
    - Context: server config, virtual host -
    - Status: Extension -
    - Module: mod_mime_magic -

    - - The MimeMagicFile directive can be used to change the location of the - magic file from its default location at conf/magic. - Non-rooted paths are relative to the ServerRoot. -

    -


    - -

    Notes

    - - Patches and suggestions for mod_mime_magic should be sent to - Ian Kluft <ikluft@cisco.com>. - Note that enhancements are done on a volunteer basis so no timetable can - be committed for any particular request. - Obviously, patches are given much higher priority over plain requests. -

    - The following notes apply to the mod_mime_magic module and are - included here for compliance with contributors' copyright restrictions - that require their acknowledgement. - -

    -/*
    - * mod_mime_magic: MIME type lookup via file magic numbers
    - * Copyright (c) 1996-1997 Cisco Systems, Inc.
    - *
    - * This software was submitted by Cisco Systems to the Apache Group in July
    - * 1997.  Future revisions and derivatives of this source code must
    - * acknowledge Cisco Systems as the original contributor of this module.
    - * All other licensing and usage conditions are those of the Apache Group.
    - *
    - * Some of this code is derived from the free version of the file command
    - * originally posted to comp.sources.unix.  Copyright info for that program
    - * is included below as required.
    - * ---------------------------------------------------------------------------
    - * - Copyright (c) Ian F. Darwin, 1987. Written by Ian F. Darwin.
    - *
    - * This software is not subject to any license of the American Telephone and
    - * Telegraph Company or of the Regents of the University of California.
    - *
    - * Permission is granted to anyone to use this software for any purpose on any
    - * computer system, and to alter it and redistribute it freely, subject to
    - * the following restrictions:
    - *
    - * 1. The author is not responsible for the consequences of use of this
    - * software, no matter how awful, even if they arise from flaws in it.
    - *
    - * 2. The origin of this software must not be misrepresented, either by
    - * explicit claim or by omission.  Since few users ever read sources, credits
    - * must appear in the documentation.
    - *
    - * 3. Altered versions must be plainly marked as such, and must not be
    - * misrepresented as being the original software.  Since few users ever read
    - * sources, credits must appear in the documentation.
    - *
    - * 4. This notice may not be removed or altered.
    - * -------------------------------------------------------------------------
    - *
    - * For complicance with Mr Darwin's terms: this has been very significantly
    - * modified from the free "file" command.
    - * - all-in-one file for compilation convenience when moving from one
    - *   version of Apache to the next.
    - * - Memory allocation is done through the Apache API's pool structure.
    - * - All functions have had necessary Apache API request or server
    - *   structures passed to them where necessary to call other Apache API
    - *   routines.  (i.e. usually for logging, files, or memory allocation in
    - *   itself or a called function.)
    - * - struct magic has been converted from an array to a single-ended linked
    - *   list because it only grows one record at a time, it's only accessed
    - *   sequentially, and the Apache API has no equivalent of realloc().
    - * - Functions have been changed to get their parameters from the server
    - *   configuration instead of globals.  (It should be reentrant now but has
    - *   not been tested in a threaded environment.)
    - * - Places where it used to print results to stdout now saves them in a
    - *   list where they're used to set the MIME type in the Apache request
    - *   record.
    - * - Command-line flags have been removed since they will never be used here.
    - *
    - */
    -
    - - - diff --git a/docs/manual/mod/mod_mime_magic.xml b/docs/manual/mod/mod_mime_magic.xml deleted file mode 100644 index 18f22158d11e65ff2edd271b02ccdbf4f3d3980f..0000000000000000000000000000000000000000 --- a/docs/manual/mod/mod_mime_magic.xml +++ /dev/null @@ -1,304 +0,0 @@ - - - - - -mod_mime_magic -Determines the MIME type of a file - by looking at a few bytes of its contents -Extension -mod_mime_magic.c -mime_magic_module - - -

    This module determines the MIME type of files in the same - way the Unix file(1) command works: it looks at the first few - bytes of the file. It is intended as a "second line of defense" - for cases that mod_mime can't - resolve. To assure that mod_mime gets first try at determining - a file's MIME type, be sure to list mod_mime_magic - before mod_mime in the configuration.

    - -

    This module is derived from a free version of the - file(1) command for Unix, which uses "magic - numbers" and other hints from a file's contents to figure out - what the contents are. This module is active only if the magic - file is specified by the MimeMagicFile directive.

    -
    - -
    Format of the Magic File - -

    The contents of the file are plain ASCII text in 4-5 - columns. Blank lines are allowed but ignored. Commented lines - use a hash mark "#". The remaining lines are parsed for the - following columns:

    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    ColumnDescription
    1byte number to begin checking from
    - ">" indicates a dependency upon the previous non-">" - line
    2 - type of data to match - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    bytesingle character
    shortmachine-order 16-bit integer
    longmachine-order 32-bit integer
    stringarbitrary-length string
    datelong integer date (seconds since Unix - epoch/1970)
    beshortbig-endian 16-bit integer
    belongbig-endian 32-bit integer
    bedatebig-endian 32-bit integer date
    leshortlittle-endian 16-bit integer
    lelonglittle-endian 32-bit integer
    ledatelittle-endian 32-bit integer date
    -
    3contents of data to match
    4MIME type if matched
    5MIME encoding if matched (optional)
    - -

    For example, the following magic file lines would recognize - some audio formats.

    - -
    -# Sun/NeXT audio data
    -0       string          .snd
    ->12     belong          1               audio/basic
    ->12     belong          2               audio/basic
    ->12     belong          3               audio/basic
    ->12     belong          4               audio/basic
    ->12     belong          5               audio/basic
    ->12     belong          6               audio/basic
    ->12     belong          7               audio/basic
    ->12     belong          23              audio/x-adpcm
    -
    -
    -

    Or these would recognize the difference between "*.doc" files - containing Microsoft Word or FrameMaker documents. (These are - incompatible file formats which use the same file suffix.)

    - -
    -# Frame
    -0       string          \<MakerFile     application/x-frame
    -0       string          \<MIFFile       application/x-frame
    -0       string          \<MakerDictionary       application/x-frame
    -0       string          \<MakerScreenFon        application/x-frame
    -0       string          \<MML           application/x-frame
    -0       string          \<Book          application/x-frame
    -0       string          \<Maker         application/x-frame
    -
    -# MS-Word
    -0       string          \376\067\0\043                  application/msword
    -0       string          \320\317\021\340\241\261        application/msword
    -0       string          \333\245-\0\0\0                 application/msword
    -
    -
    -

    An optional MIME encoding can be included as a fifth column. - For example, this can recognize gzipped files and set the - encoding for them.

    - -
    -# gzip (GNU zip, not to be confused with [Info-ZIP/PKWARE] zip archiver)
    -0       string          \037\213        application/octet-stream        x-gzip
    -
    -
    -
    - -
    Performance Issues -

    This module is not for every system. If your system is barely - keeping up with its load or if you're performing a web server - benchmark, you may not want to enable this because the - processing is not free.

    - -

    However, an effort was made to improve the performance of - the original file(1) code to make it fit in a busy web server. - It was designed for a server where there are thousands of users - who publish their own documents. This is probably very common - on intranets. Many times, it's helpful if the server can make - more intelligent decisions about a file's contents than the - file name allows ...even if just to reduce the "why doesn't my - page work" calls when users improperly name their own files. - You have to decide if the extra work suits your - environment.

    - -

    When compiling an Apache server, this module should be at or - near the top of the list of modules in the Configuration file. - The modules are listed in increasing priority so that will mean - this one is used only as a last resort, just like it was - designed to.

    - -
    - -
    Notes - -

    The following notes apply to the mod_mime_magic module and are - included here for compliance with contributors' copyright - restrictions that require their acknowledgment.

    -
    -/*
    - * mod_mime_magic: MIME type lookup via file magic numbers
    - * Copyright (c) 1996-1997 Cisco Systems, Inc.
    - *
    - * This software was submitted by Cisco Systems to the Apache Group in July
    - * 1997.  Future revisions and derivatives of this source code must
    - * acknowledge Cisco Systems as the original contributor of this module.
    - * All other licensing and usage conditions are those of the Apache Group.
    - *
    - * Some of this code is derived from the free version of the file command
    - * originally posted to comp.sources.unix.  Copyright info for that program
    - * is included below as required.
    - * ---------------------------------------------------------------------------
    - * - Copyright (c) Ian F. Darwin, 1987. Written by Ian F. Darwin.
    - *
    - * This software is not subject to any license of the American Telephone and
    - * Telegraph Company or of the Regents of the University of California.
    - *
    - * Permission is granted to anyone to use this software for any purpose on any
    - * computer system, and to alter it and redistribute it freely, subject to
    - * the following restrictions:
    - *
    - * 1. The author is not responsible for the consequences of use of this
    - * software, no matter how awful, even if they arise from flaws in it.
    - *
    - * 2. The origin of this software must not be misrepresented, either by
    - * explicit claim or by omission.  Since few users ever read sources, credits
    - * must appear in the documentation.
    - *
    - * 3. Altered versions must be plainly marked as such, and must not be
    - * misrepresented as being the original software.  Since few users ever read
    - * sources, credits must appear in the documentation.
    - *
    - * 4. This notice may not be removed or altered.
    - * -------------------------------------------------------------------------
    - *
    - * For compliance with Mr Darwin's terms: this has been very significantly
    - * modified from the free "file" command.
    - * - all-in-one file for compilation convenience when moving from one
    - *   version of Apache to the next.
    - * - Memory allocation is done through the Apache API's pool structure.
    - * - All functions have had necessary Apache API request or server
    - *   structures passed to them where necessary to call other Apache API
    - *   routines.  (i.e., usually for logging, files, or memory allocation in
    - *   itself or a called function.)
    - * - struct magic has been converted from an array to a single-ended linked
    - *   list because it only grows one record at a time, it's only accessed
    - *   sequentially, and the Apache API has no equivalent of realloc().
    - * - Functions have been changed to get their parameters from the server
    - *   configuration instead of globals.  (It should be reentrant now but has
    - *   not been tested in a threaded environment.)
    - * - Places where it used to print results to stdout now saves them in a
    - *   list where they're used to set the MIME type in the Apache request
    - *   record.
    - * - Command-line flags have been removed since they will never be used here.
    - *
    - */
    -
    -
    - - -MimeMagicFile -Enable MIME-type determination based on file contents -using the specified magic file -MimeMagicFile file-path -server config -virtual host - - -

    The MimeMagicFile directive can be used to - enable this module, the default file is distributed at - conf/magic. Non-rooted paths are relative to the - ServerRoot. Virtual hosts will use the same file as the main - server unless a more specific setting is used, in which case - the more specific setting overrides the main server's file.

    -
    -
    -
    - diff --git a/docs/manual/mod/mod_negotiation.html b/docs/manual/mod/mod_negotiation.html deleted file mode 100644 index 6b8ac6e7d5b97f19a3650f7fd53934785acdab8d..0000000000000000000000000000000000000000 --- a/docs/manual/mod/mod_negotiation.html +++ /dev/null @@ -1,134 +0,0 @@ - - - - -Apache module mod_negotiation - - - - - -

    Module mod_negotiation

    - -This module is contained in the mod_negotiation.c file, and -is compiled in by default. It provides for -content negotiation. Any document with -mime type application/x-type-map will be processed by this module. - - -

    Summary

    -Content negotiation, or more accurately content selection, is the -selection of the document that best matches the clients -capabilities, from one of several available documents. -There are two implementations of this. -
      -
    • A type map (a file with the mime type application/x-type-map) -which explicitly lists the files containing the variants. -
    • A MultiViews search (enabled by the MultiViews -Option, where the server does an implicit -filename pattern match, and choose from amongst the results. -
    - -

    Type maps

    -A type map has the same format as RFC822 mail headers. It contains document -descriptions separated by blank lines, with lines beginning with a hash -character ('#') treated as comments. A document description consists of -several header records; records may be continued on multiple lines if the -continuation lines start with spaces. The leading space will be deleted -and the lines concatenated. A header record consists of a keyword -name, which always ends in a colon, followed by a value. Whitespace is allowed -between the header name and value, and between the tokens of value. - -The headers -allowed are: - -
    -
    Content-Encoding: -
    The encoding of the file. Currently only two encodings are recognised -by http; x-compress for compressed files, and x-gzip -for gzipped files. -
    Content-Language: -
    The language of the variant, as an Internet standard language code, such -as en. -
    Content-Length: -
    The length of the file, in bytes. If this header is not present, then -the actual length of the file is used. -
    Content-Type: -
    The MIME media type of the document, with optional parameters. -parameters are separated from the media type and from one another by -semi-colons. Parameter syntax is name=value; allowed parameters are: -
    -
    level -
    the value is an integer, which specifies the version of the media type. -For text/html this defaults to 2, otherwise 0. -
    qs -
    the value is a floating-point number with value between 0. and 1. -It indications the 'quality' of this variant. -
    -Example: -
    Content-Type: image/jpeg; qs=0.8
    -
    URI: -
    The path to the file containing this variant, relative to the map file. -
    - -

    MultiViews

    -A MultiViews search is enabled by the MultiViews -Option. -If the server receives a request for /some/dir/foo and -/some/dir/foo does not exist, then the server reads the -directory looking for all files named foo.*, and effectively -fakes up a type map which names all those files, assigning them the same media -types and content-encodings it would have if the client had asked for -one of them by name. It then chooses the best match to the client's -requirements, and returns that document.

    - - - -

    Directives

    - -
    - - -

    CacheNegotiatedDocs

    -Syntax: CacheNegotiatedDocs
    -Context: server config
    -Status: Base
    -Module: mod_negotiation
    -Compatibility: CacheNegotiatedDocs is only available -in Apache 1.1 and later.

    - -

    If set, this directive allows content-negotiated documents to be cached -by -proxy servers. This could mean that clients behind those proxys could -retrieve versions of the documents that are not the best match for -their abilities, but it will make caching more efficient.

    - - -

    LanguagePriority

    - -Syntax: LanguagePriority mime-lang mime-lang...
    -Context: server config, virtual host, directory, .htaccess
    -Override: FileInfo
    -Status: Base
    -Module: mod_negotiation

    - -The LanguagePriority sets the precedence of language variants for the case -where the client does not express a preference, when handling a -MultiViews request. The list of mime-lang are in order of decreasing -preference. Example: -

    LanguagePriority en fr de
    -For a request for foo.html, where foo.html.fr -and foo.html.de both existed, but the browser did not express -a language preference, then foo.html.fr would be returned.

    - -


    - -Home -Index - - - - diff --git a/docs/manual/mod/mod_negotiation.xml b/docs/manual/mod/mod_negotiation.xml deleted file mode 100644 index 12904441a84d95b20089a0269e87da1da2e53902..0000000000000000000000000000000000000000 --- a/docs/manual/mod/mod_negotiation.xml +++ /dev/null @@ -1,243 +0,0 @@ - - - - - -mod_negotiation -Provides for content negotiation -Base -mod_negotiation.c -negotiation_module - - -

    Content negotiation, or more accurately content selection, is - the selection of the document that best matches the clients - capabilities, from one of several available documents. There - are two implementations of this.

    - -
      -
    • A type map (a file with the handler - type-map) which explicitly lists the files - containing the variants.
    • - -
    • A MultiViews search (enabled by the MultiViews Options, where the server does an - implicit filename pattern match, and choose from amongst the - results.
    • -
    -
    - -DefaultLangauge -AddEncoding -AddLanguage -AddType - -
    Type maps -

    A type map has the same format as RFC822 mail headers. It - contains document descriptions separated by blank lines, with - lines beginning with a hash character ('#') treated as - comments. A document description consists of several header - records; records may be continued on multiple lines if the - continuation lines start with spaces. The leading space will be - deleted and the lines concatenated. A header record consists of - a keyword name, which always ends in a colon, followed by a - value. Whitespace is allowed between the header name and value, - and between the tokens of value. The headers allowed are:

    - -
    -
    Content-Encoding:
    - -
    The encoding of the file. Apache only recognizes - encodings that are defined by an AddEncoding directive. - This normally includes the encodings x-compress - for compress'd files, and x-gzip for gzip'd - files. The x- prefix is ignored for encoding - comparisons.
    - -
    Content-Language:
    - -
    The language of the variant, as an Internet standard - language tag (RFC 1766). An example is en, - meaning English.
    - -
    Content-Length:
    - -
    The length of the file, in bytes. If this header is not - present, then the actual length of the file is used.
    - -
    Content-Type:
    - -
    - The MIME media type of the document, with optional - parameters. Parameters are separated from the media type - and from one another by a semi-colon, with a syntax of - name=value. Common parameters include: - -
    -
    level
    - -
    an integer specifying the version of the media type. - For text/html this defaults to 2, otherwise - 0.
    - -
    qs
    - -
    a floating-point number with a value in the range 0.0 - to 1.0, indicating the relative 'quality' of this variant - compared to the other available variants, independent of - the client's capabilities. For example, a jpeg file is - usually of higher source quality than an ascii file if it - is attempting to represent a photograph. However, if the - resource being represented is ascii art, then an ascii - file would have a higher source quality than a jpeg file. - All qs values are therefore specific to a given - resource.
    -
    - Example: - -
    - Content-Type: image/jpeg; qs=0.8 -
    -
    - -
    URI:
    - -
    The path to the file containing this variant, relative to - the map file.
    -
    -
    - -
    MultiViews - -

    A MultiViews search is enabled by the MultiViews Options. If the server receives a - request for /some/dir/foo and - /some/dir/foo does not exist, then the - server reads the directory looking for all files named - foo.*, and effectively fakes up a type map which - names all those files, assigning them the same media types and - content-encodings it would have if the client had asked for one - of them by name. It then chooses the best match to the client's - requirements, and returns that document.

    -
    - - -CacheNegotiatedDocs -Allows content-negotiated documents to be -cached by proxy servers -CacheNegotiatedDocs on|off -CacheNegotiatedDocs off -server config -The syntax changed in version 2.0. - - -

    If set, this directive allows content-negotiated documents - to be cached by proxy servers. This could mean that clients - behind those proxys could retrieve versions of the documents - that are not the best match for their abilities, but it will - make caching more efficient.

    - -

    This directive only applies to requests which come from - HTTP/1.0 browsers. HTTP/1.1 provides much better control over - the caching of negotiated documents, and this directive has no - effect in responses to HTTP/1.1 requests.

    - -

    Prior to version 2.0, - CacheNegotiatedDocs did not take an - argument; it was turned on by the presence of the directive by - itself.

    -
    -
    - - -ForceLangaugePriority -Action to take if a single acceptable document is not -found -ForceLanguagePriority None|Prefer|Fallback [Prefer|Fallback] -ForceLangaugePriority None -server config -virtual host -directory -.htaccess - -FileInfo -Available in version 2.0.30 and later - - -

    The ForceLanguagePriority directive uses - the given LanguagePriority to satisfy - negotation where the server could otherwise not return a single - matching document.

    - -

    ForceLanguagePriority Prefer uses - LanguagePriority to serve a one valid result, rather - than returning an HTTP result 300 (MULTIPLE CHOICES) when there - are several equally valid choices. If the directives below were - given, and the user's Accept-Language header assigned en and de - each as quality .500 (equally acceptable) then then first matching - variant, en, will be served.

    - - - LanguagePriority en fr de
    - ForceLanguagePriority Prefer -
    - -

    ForceLanguagePriority Fallback uses - LanguagePriority to serve a valid result, rather than - returning an HTTP result 406 (NOT ACCEPTABLE). If the directives - below were given, and the user's Accept-Language only permitted an - es langauge response, but such a variant isn't found, then the - first variant from the LanguagePriority list below will be - served.

    - - - LanguagePriority en fr de
    - ForceLanguagePriority Fallback -
    - -

    Both options, Prefer and Fallback, may be specified, so either the - first matching variant from LanguagePriority will be served if more - that one variant is acceptable, or first available document will be - served if none of the variants matched the client's acceptable list of - languages.

    -
    -
    - - -LanguagePriority -The precendence of language variants for cases where -the client does not express a preference -LanguagePriority MIME-lang [MIME-lang] ... -server config -virtual host -directory -.htaccess - -FileInfo - - -

    The LanguagePriority sets the precedence - of language variants for the case where the client does not - express a preference, when handling a MultiViews request. The list - of MIME-lang are in order of decreasing preference. - Example:

    - -LanguagePriority en fr de - -

    For a request for foo.html, where - foo.html.fr and foo.html.de both - existed, but the browser did not express a language preference, - then foo.html.fr would be returned.

    - -

    Note that this directive only has an effect if a 'best' - language cannot be determined by any other means or the ForceLanguagePriority directive - is not None. Correctly implemented HTTP/1.1 requests - will mean this directive has no effect.

    -
    -
    - -
    \ No newline at end of file diff --git a/docs/manual/mod/mod_proxy.html b/docs/manual/mod/mod_proxy.html deleted file mode 100644 index b64dcd9c6dcac8863b30ad752b82942208b09e51..0000000000000000000000000000000000000000 --- a/docs/manual/mod/mod_proxy.html +++ /dev/null @@ -1,212 +0,0 @@ - - - -Apache module mod_proxy - - - - -

    Apache module mod_proxy

    - -This module is contained in the mod_proxy.c file, and -is not compiled in by default. It provides for a caching proxy server. -It is only available in Apache 1.1 and later. - -

    Note:

    -

    This module is experimental. Use at your own risk.

    - -

    Summary

    - -This module implements a proxy/cache for Apache. It implements -proxying capability for -FTP, -HTTP/0.9, and -HTTP/1.0. -The module can be configured to connect to other proxy modules for these -and other protocols. - -

    Directives

    - - -
    - -

    ProxyRequests

    -Syntax: ProxyRequests on/off
    -Default: ProxyRequests Off
    -Context: server config
    -Status: Base
    -Module: mod_proxy
    -Compatibility: ProxyRequest is only available in -Apache 1.1 and later.

    - -This allows or prevents Apache from functioning as a proxy -server. Setting ProxyRequests to 'off' does not disable use of the ProxyPass directive. - -

    ProxyRemote

    -Syntax: ProxyRemote <match> <remote-server>
    -Context: server config
    -Status: Base
    -Module: mod_proxy
    -Compatibility: ProxyRemote is only available in -Apache 1.1 and later.

    - -This defines remote proxies to this proxy. <match> is either the -name of a URL-scheme that the remote server supports, or a partial URL -for which the remote server should be used, or '$' to indicate the -server should be contacted for all requests. <remote-server> is a -partial URL for the remote server. Syntax: - -

    -  <remote-server> = <protocol>://<hostname>[:port]
    -
    -<protocol> is the protocol that should be used to communicate with the -remote -server; only "http" is supported by this module. - -Example: -
    -  ProxyRemote ftp http://ftpproxy.mydomain.com:8080
    -  ProxyRemote http://goodguys.com/ http://mirrorguys.com:8000
    -  ProxyRemote * http://cleversite.com
    -
    - -

    ProxyPass

    -Syntax: ProxyPass <path> <url>
    -Context: server config
    -Status: Base
    -Module: mod_proxy
    -Compatibility: ProxyPass is only available in -Apache 1.1 and later.

    - -This directive allows remote servers to be mapped into the space of the local -server; the local server does not act as a proxy in the conventional sense, -but appears to be a mirror of the remote server. <path> is the name of -a local virtual path; <url> is a partial URL for the remote server. - -Suppose the local server has address http://wibble.org; then -

    -   ProxyPass /mirror/foo http://foo.com
    -
    -Will cause a local request for the http://wibble.org/mirror/foo/bar to be -internally converted into a proxy request to http://foo.com/bar - -

    CacheRoot

    -Syntax: CacheRoot <directory>
    -Context: server config
    -Status: Base
    -Module: mod_proxy
    -Compatibility: CacheRoot is only available in -Apache 1.1 and later.

    - -Sets the name of the directory to contain cache files; this must be -writable -by the httpd server. - -

    CacheSize

    -Syntax: CacheSize <size>
    -Default: CacheSize 5
    -Context: server config
    -Status: Base
    -Module: mod_proxy
    -Compatibility: CacheSize is only available in -Apache 1.1 and later.

    - -Sets the desired space usage of the cache, in Kb (1024 byte units). Although -usage may grow above this setting, the garbage collection will delete files -until the usage is at or below this setting. - -

    CacheGcInterval

    -Syntax: CacheGcInterval <time>
    -Context: server config
    -Status: Base
    -Module: mod_proxy
    -Compatibility: CacheGcinterval is only available in -Apache 1.1 and later.

    - -Check the cache every <time> hours, and delete files if the space -usage is greater than that set by CacheSize. - -

    CacheMaxExpire

    -Syntax: CacheMaxExpire <time>
    -Default: CacheMaxExpire 24
    -Context: server config
    -Status: Base
    -Module: mod_proxy
    -Compatibility: CacheMaxExpire is only available in -Apache 1.1 and later.

    - -Cachable HTTP documents will be retained for at most <time> hours without -checking the origin server. Thus documents can be at most <time> -hours out of date. This restriction is enforced even if an expiry date -was supplied with the document. - -

    CacheLastModifiedFactor

    -Syntax: CacheLastModifiedFactor <factor>
    -Default: CacheLastModifiedFactor 0.1
    -Context: server config
    -Status: Base
    -Module: mod_proxy
    -Compatibility: CacheLastModified is only available in -Apache 1.1 and later.

    - -If the origin HTTP server did not supply an expiry date for the -document, then estimate on using the formula -

    -  expiry-period = time-since-last-modification * <factor>
    -
    -For example, if the document was last modified 10 hours ago, and -<factor> is 0.1, then the expiry period wil be set to 10*0.1 = 1 hour. - -

    If the expiry-period would be longer than that set by CacheMaxExpire, -then the latter takes precedence. - -

    CacheDefaultExpire

    -Syntax: CacheDefaultExpire <time>
    -Default: CacheDefaultExpire 1
    -Context: server config
    -Status: Base
    -Module: mod_proxy
    -Compatibility: CacheDefaultExpire is only available in -Apache 1.1 and later.

    - -If the document is fetched via a protocol that does not support expirytimes, -then use <time> as the expiry time. -CacheMaxExpire does not -override. - -

    NoCache

    -Syntax: NoCache <host/domain list>
    -Context: server config
    -Status: Base
    -Module: mod_proxy
    -Compatibility: NoCache is only available in -Apache 1.1 and later.

    - -The NoCache directive specifies a list of hosts and/or domains, separated -by spaces. HTTP documents from hosts or domains in the list are not -cached by the proxy server. Example: - -

    -  NoCache joes.garage.com some.host.co.uk wotsamattau.edu
    -
    - -


    - -Home -Index - - - - diff --git a/docs/manual/mod/mod_proxy.xml b/docs/manual/mod/mod_proxy.xml deleted file mode 100644 index d4d7551f2e7dfd4f860db241220d1ccd008f029e..0000000000000000000000000000000000000000 --- a/docs/manual/mod/mod_proxy.xml +++ /dev/null @@ -1,722 +0,0 @@ - - - - - -mod_proxy -HTTP/1.1 proxy/gateway server -Extension -mod_proxy.c -proxy_module - - -Warning -This document has been updated to take into account changes -made in the 2.0 version of the Apache HTTP Server. Some of the -information may still be inaccurate, please use it -with care. - - -

    This module implements a proxy/gateway for Apache. It implements -proxying capability for -FTP, -CONNECT (for SSL), -HTTP/0.9, -HTTP/1.0, and -HTTP/1.1. -The module can be configured to connect to other proxy modules for these -and other protocols.

    - -

    This module was experimental in Apache 1.1.x. Improvements and bugfixes -were made in Apache v1.2.x and Apache v1.3.x, then the module underwent a major -overhaul for Apache v2.0. The protocol support was upgraded to HTTP/1.1, -and filter support was enabled.

    - -

    Please note that the caching function present in -mod_proxy up to Apache v1.3.x has been removed from -mod_proxy and will be incorporated into a new module, mod_cache.

    -
    - -
    Common configuration topics - - - -
    Forward and Reverse Proxies - -

    Apache can be configured in both a forward and reverse -proxy configuration.

    - -

    A forward proxy is an intermediate system that enables a browser to connect to a -remote network to which it normally does not have access. A forward proxy -can also be used to cache data, reducing load on the networks between the -forward proxy and the remote webserver.

    - -

    Apache's mod_proxy can be figured to behave like a forward proxy -using the ProxyRemote -directive. In addition, caching of data can be achieved by configuring -Apache mod_cache. Other dedicated forward proxy -packages include Squid.

    - -

    A reverse proxy is a webserver system that is capable of serving webpages -sourced from other webservers - in addition to webpages on disk or generated -dynamically by CGI - making these pages look like they originated at the -reverse proxy.

    - -

    When configured with the mod_cache module the reverse -proxy can act as a cache for slower backend webservers. The reverse proxy -can also enable advanced URL strategies and management techniques, allowing -webpages served using different webserver systems or architectures to -coexist inside the same URL space. Reverse proxy systems are also ideal for -implementing centralised logging websites with many or diverse website -backends. Complex multi-tier webserver systems can be constructed using an -Apache mod_proxy frontend and any number of backend webservers.

    - -

    The reverse proxy is configured using the -ProxyPass and ProxyPassReverse directives. Caching can be -enabled using mod_cache as with the forward proxy.

    - -
    - -
    Controlling access to your proxy - -

    You can control who can access your proxy via the normal Directory -control block using the following example:

    - - -<Directory proxy:*>
    -Order Deny,Allow
    -Deny from all
    -Allow from 192.168.0
    -</Directory> -
    - -

    A Files block -will also work, and is the only method known to work for all possible -URLs in Apache versions earlier than 1.2b10.

    - -

    When configuring a reverse proxy, access control takes on the -attributes of the normal server directory configuration.

    - - - - -
    - -
    Why doesn't file type <em>xxx</em> -download via FTP? - -

    You probably don't have that particular file type defined as -application/octet-stream in your proxy's mime.types configuration -file. A useful line can be

    - - -application/octet-stream bin dms lha lzh exe class tgz taz - -
    - -
    How can I force an FTP ASCII download of -File <em>xxx</em>? - -

    In the rare situation where you must download a specific file using the FTP -ASCII transfer method (while the default transfer is in -binary mode), you can override mod_proxy's default by -suffixing the request with ;type=a to force an ASCII transfer. -(FTP Directory listings are always executed in ASCII mode, however.)

    -
    - -
    How can I access FTP files outside -of my home directory? - -

    -An FTP URI is interpreted relative to the home directory of the user -who is logging in. Alas, to reach higher directory levels you cannot -use /../, as the dots are interpreted by the browser and not actually -sent to the FTP server. To address this problem, the so called "Squid -%2f hack" was implemented in the Apache FTP proxy; it is is a solution -which is also used by other popular proxy servers like the Squid Proxy Cache. By -prepending /%2f to the path of your request, you can make such a proxy -change the FTP starting directory to / (instead of the home -directory).

    - -

    Example: To retrieve the file -/etc/motd, you would use the URL

    -ftp://user@host/%2f/etc/motd -
    - -
    How can I hide the FTP cleartext password -in my browser's URL line? - -

    -To log in to an FTP server by username and password, Apache -uses different strategies. -In absense of a user name and password in the URL altogether, -Apache sends an anomymous login to the FTP server, i.e.,

    - -user: anonymous
    -password: apache_proxy@ -
    -

    This works for all popular FTP servers which are configured for -anonymous access.

    - -

    For a personal login with a specific username, you can embed -the user name into the URL, like in: -ftp://username@host/myfile. If the FTP server -asks for a password when given this username (which it should), -then Apache will reply with a [401 Authorization required] response, -which causes the Browser to pop up the username/password dialog. -Upon entering the password, the connection attempt is retried, -and if successful, the requested resource is presented. -The advantage of this procedure is that your browser does not -display the password in cleartext (which it would if you had used -ftp://username:password@host/myfile in -the first place).

    - -Note -The password which is transmitted in such a way -is not encrypted on its way. It travels between your browser and -the Apache proxy server in a base64-encoded cleartext string, and -between the Apache proxy and the FTP server as plaintext. You should -therefore think twice before accessing your FTP server via HTTP -(or before accessing your personal files via FTP at all!) When -using unsecure channels, an eavesdropper might intercept your -password on its way. - -
    - -
    Why does Apache start more slowly when -using the proxy module? - -

    If you're using the ProxyBlock -directive, hostnames' IP addresses are looked up and cached during -startup for later match test. This may take a few seconds (or more) -depending on the speed with which the hostname lookups occur.

    -
    - - - -
    What other functions are useful for an -intranet proxy server? - -

    An Apache proxy server situated in an intranet needs to forward -external requests through the company's firewall. However, when it has -to access resources within the intranet, it can bypass the firewall -when accessing hosts. The NoProxy directive is useful for -specifying which hosts belong to the intranet and should be accessed -directly.

    - -

    Users within an intranet tend to omit the local domain name from their -WWW requests, thus requesting "http://somehost/" instead of -"http://somehost.my.dom.ain/". Some commercial proxy servers let them get -away with this and simply serve the request, implying a configured -local domain. When the ProxyDomain directive -is used and the server is configured for -proxy service, Apache can return a redirect response and send the client -to the correct, fully qualified, server address. This is the preferred method -since the user's bookmark files will then contain fully qualified hosts.

    -
    - -
    - - -ProxyPreserveHost -ProxyPreserveHost on|off -ProxyPreserveHost Off -server config -virtual host - -Available in -Apache 2.0.31 and later. - - -

    When enabled, this option will pass the Host: line from the -incoming request to the proxied host, instead of the hostname -specified in the proxypass line. -

    -

    This option should normally be turned 'off'.

    -
    -
    - - -ProxyRequests -ProxyRequests on|off -ProxyRequests Off -server config -virtual host - - - -

    This allows or prevents Apache from functioning as a forward proxy -server. (Setting ProxyRequests to 'off' does not disable use of the -ProxyPass directive.)

    - -

    In a typical reverse proxy configuration, this option should be set to -'off'.

    -
    -
    - - -ProxyRemote -ProxyRemote match remote-server -server config -virtual host - - - -

    This defines remote proxies to this proxy. match is either the -name of a URL-scheme that the remote server supports, or a partial URL -for which the remote server should be used, or '*' to indicate the -server should be contacted for all requests. remote-server is a -partial URL for the remote server. Syntax:

    - -
    -  remote-server = protocol://hostname[:port]
    -
    - -

    protocol is the protocol that should be used to communicate -with the remote server; only "http" is supported by this module.

    - -

    -Example:

    - - ProxyRemote http://goodguys.com/ http://mirrorguys.com:8000
    - ProxyRemote * http://cleversite.com
    - ProxyRemote ftp http://ftpproxy.mydomain.com:8080 -
    - -

    In the last example, the proxy will forward FTP requests, encapsulated -as yet another HTTP proxy request, to another proxy which can handle -them.

    - -

    This option also supports reverse proxy configuration - a backend -webserver can be embedded within a virtualhost URL space even if that -server is hidden by another forward proxy.

    -
    -
    - - -ProxyPass -ProxyPass [path] !|url -server config -virtual host - - - - -

    This directive allows remote servers to be mapped into the space of -the local server; the local server does not act as a proxy in the -conventional sense, but appears to be a mirror of the remote -server. path is the name of a local virtual path; -url is a partial URL for the remote server.

    - -

    Suppose the local server has address http://wibble.org/; -then

    - - ProxyPass /mirror/foo/ http://foo.com/ - -

    will cause a local request for the -<http://wibble.org/mirror/foo/bar> to be -internally converted into a proxy request to -<http://foo.com/bar>.

    -

    -The ! directive is useful in situations where you don't want to reverse-proxy -a subdirectory. eg.

    - - ProxyPass /mirror/foo/i !
    - ProxyPass /mirror/foo http://foo.com -
    -

    will proxy all requests to /mirror/foo to foo.com EXCEPT requests made to /mirror/foo/i

    - -NB: order is important. you need to put the exclusions BEFORE the general proxypass directive -
    -
    - - -ProxyPassReverse -ProxyPassReverse [path] url -server config -virtual host - - - - -

    This directive lets Apache adjust the URL in the Location, -Content-Location and URI headers on -HTTP redirect responses. This is essential when Apache is used as -a reverse proxy to avoid by-passing the reverse proxy because of HTTP -redirects on the backend servers which stay behind the reverse proxy.

    - -

    path is the name of a local virtual path.
    -url is a partial URL for the remote server - the same way they are -used for the ProxyPass directive.

    - -

    -Example:
    -Suppose the local server has address http://wibble.org/; then

    - - ProxyPass /mirror/foo/ http://foo.com/
    - ProxyPassReverse /mirror/foo/ http://foo.com/ -
    -

    will not only cause a local request for the -<http://wibble.org/mirror/foo/bar> to be internally -converted into a proxy request to <http://foo.com/bar> (the -functionality ProxyPass provides here). It also takes care of -redirects the server foo.com sends: when http://foo.com/bar is -redirected by him to http://foo.com/quux Apache adjusts this to -http://wibble.org/mirror/foo/quux before forwarding the HTTP -redirect response to the client.

    -

    -Note that this ProxyPassReverse directive can -also be used in conjunction with the proxy pass-through feature -("RewriteRule ... [P]") from -mod_rewrite because its doesn't depend on a -corresponding ProxyPass -directive.

    -
    -
    - - -AllowCONNECT -AllowCONNECT port [port] ... -AllowCONNECT 443 563 -server config -virtual host - - - -

    The AllowCONNECT directive specifies a list -of port numbers to which the proxy CONNECT method may -connect. Today's browsers use this method when a https -connection is requested and proxy tunneling over http is in -effect.
    By default, only the default https port (443) and the -default snews port (563) are enabled. Use the -AllowCONNECT directive to overrride this default and -allow connections to the listed ports only.

    -
    -
    - - -ProxyBlock -ProxyBlock *|word|host|domain -[word|host|domain] ... -server config -virtual host - - - -

    The ProxyBlock directive specifies a list of -words, hosts and/or domains, separated by spaces. HTTP, HTTPS, and -FTP document requests to sites whose names contain matched words, -hosts or domains are blocked by the proxy server. The proxy -module will also attempt to determine IP addresses of list items which -may be hostnames during startup, and cache them for match test as -well. Example:

    - - - ProxyBlock joes-garage.com some-host.co.uk rocky.wotsamattau.edu - - -

    'rocky.wotsamattau.edu' would also be matched if referenced by IP -address.

    - -

    Note that 'wotsamattau' would also be sufficient to match -'wotsamattau.edu'.

    - -

    Note also that

    - - -ProxyBlock * - - -

    blocks connections to all sites.

    - -
    -
    - - -ProxyReceiveBufferSize -ProxyReceiveBufferSize bytes -server config -virtual host - - - -

    The ProxyReceiveBufferSize directive -specifies an explicit network buffer size for outgoing HTTP and FTP -connections, for increased throughput. It has to be greater than 512 -or set to 0 to indicate that the system's default buffer size should -be used.

    -Example - ProxyReceiveBufferSize 2048 - -
    -
    - - -ProxyMaxForwards -ProxyMaxForwards number -ProxyMaxForwards 10 -server config -virtual host - -Available in Apache 2.0 and later - - -

    The ProxyMaxForwards directive specifies the -maximum number of proxies through which a request may pass. This is -set to prevent infinite proxy loops, or a DoS attack.

    - -Example - ProxyMaxForwards 10 - -
    -
    - - -NoProxy -NoProxy - Domain| - SubNet| - IpAddr| - Hostname -[Domain| - SubNet| - IpAddr| - Hostname] ... -server config -virtual host - - - -

    This directive is only useful for Apache proxy servers within -intranets. The NoProxy directive specifies a -list of subnets, IP addresses, hosts and/or domains, separated by -spaces. A request to a host which matches one or more of these is -always served directly, without forwarding to the configured -ProxyRemote proxy server(s).

    - -Example - ProxyRemote * http://firewall.mycompany.com:81
    - NoProxy .mycompany.com 192.168.112.0/21 -
    - -

    The arguments to the NoProxy directive are one of the following type list:

    -
    - -
    - Domain
    -
    A Domain is a partially qualified DNS domain name, preceded - by a period. - It represents a list of hosts which logically belong to the same DNS - domain or zone (i.e., the suffixes of the hostnames are all ending in - Domain).
    - Examples: .com .apache.org.
    - To distinguish Domains from Hostnames (both - syntactically and semantically; a DNS domain can have a DNS A record, - too!), Domains are always written - with a leading period.
    - Note: Domain name comparisons are done without regard to the case, - and Domains are always assumed to be anchored in the root - of the DNS tree, therefore two domains .MyDomain.com and - .mydomain.com. (note the trailing period) are - considered equal. Since a domain comparison does not involve a DNS - lookup, it is much more efficient than subnet comparison.
    - - -
    - SubNet
    -
    A SubNet is a partially qualified internet address in - numeric (dotted quad) form, optionally followed by a slash and the - netmask, specified as the number of significant bits in the - SubNet. It is used to represent a subnet of hosts which can - be reached over a common network interface. In the absence of the - explicit net mask it is assumed that omitted (or zero valued) - trailing digits specify the mask. (In this case, the netmask can - only be multiples of 8 bits wide.)
    - Examples: -
    -
    192.168 or 192.168.0.0
    -
    the subnet 192.168.0.0 with an implied netmask of 16 valid bits - (sometimes used in the netmask form 255.255.0.0)
    -
    192.168.112.0/21
    -
    the subnet 192.168.112.0/21 with a netmask of 21 - valid bits (also used in the form 255.255.248.0)
    -
    - As a degenerate case, a SubNet with 32 valid bits is the - equivalent to an IPAddr, while a SubNet with zero - valid bits (e.g., 0.0.0.0/0) is the same as the constant - _Default_, matching any IP address.
    - - -
    - IPAddr
    -
    A IPAddr represents a fully qualified internet address in - numeric (dotted quad) form. Usually, this address represents a - host, but there need not necessarily be a DNS domain name - connected with the address.
    - Example: 192.168.123.7
    - Note: An IPAddr does not need to be resolved by the DNS - system, so it can result in more effective apache performance.
    - - -
    - Hostname
    -
    A Hostname is a fully qualified DNS domain name which can - be resolved to one or more IPAddrs via the DNS domain name service. - It represents a logical host (in contrast to - Domains, see - above) and must be resolvable to at least one IPAddr (or often to a list of hosts - with different IPAddr's).
    - Examples: prep.ai.mit.edu - www.apache.org.
    - Note: In many situations, it is more effective to specify an - IPAddr in place of a - Hostname since a DNS lookup - can be avoided. Name resolution in Apache can take a remarkable deal - of time when the connection to the name server uses a slow PPP - link.
    - Note: Hostname comparisons are done without regard to the case, - and Hostnames are always assumed to be anchored in the root - of the DNS tree, therefore two hosts WWW.MyDomain.com - and www.mydomain.com. (note the trailing period) are - considered equal.
    -
    -
    -DNS Issues -
    - - -ProxyTimeout -ProxyTimeout seconds -ProxyTimeout 300 -server config -virtual host - -Available in -Apache 2.0.31 and later - - -

    This directive allows a user to specifiy a timeout on proxy requests. -This is usefull when you have a slow/buggy appserver which hangs, -and you would rather just return a timeout and fail gracefully instead -of waiting however long it takes the server to return -

    -
    -
    - - -ProxyDomain -ProxyDomain Domain -server config -virtual host - - - -

    This directive is only useful for Apache proxy servers within -intranets. The ProxyDomain directive specifies -the default domain which the apache proxy server will belong to. If a -request to a host without a domain name is encountered, a redirection -response to the same host with the configured Domain appended -will be generated.

    - -Example - ProxyRemote * http://firewall.mycompany.com:81
    - NoProxy .mycompany.com 192.168.112.0/21
    - ProxyDomain .mycompany.com -
    -
    -
    - - -ProxyVia -ProxyVia on|off|full|block -ProxyVia off -server config -virtual host - - - -

    This directive controls the use of the Via: HTTP -header by the proxy. Its intended use is to control the flow of of -proxy requests along a chain of proxy servers. See RFC2068 (HTTP/1.1) -for an explanation of Via: header lines.

    - -
    • If set -to off, which is the default, no special processing is -performed. If a request or reply contains a Via: header, -it is passed through unchanged.
    • - -
    • If set to on, each -request and reply will get a Via: header line added for -the current host.
    • - -
    • If set to full, each generated Via: header -line will additionally have the Apache server version shown as a -Via: comment field.
    • - -
    • If set to block, every -proxy request will have all its Via: header lines -removed. No new Via: header will be generated.
    • -
    -
    -
    - - -ProxyErrorOverride -ProxyErrorOverride On|Off -ProxyErrorOverride Off -server config -virtual host - -Available in version 2.0 and later - - -

    This directive is useful for reverse-proxy setups, where you want to -have a common look and feel on the error pages seen by the end user. -This also allows for included files (via mod_include's SSI) to get -the error code and act accordingly (default behavior would display -the error page of the proxied server, turning this on shows the SSI -Error message).

    -
    -
    -
    diff --git a/docs/manual/mod/mod_rewrite.html b/docs/manual/mod/mod_rewrite.html deleted file mode 100644 index b7c4e633a00fe6a5056710bb78e221189f88783a..0000000000000000000000000000000000000000 --- a/docs/manual/mod/mod_rewrite.html +++ /dev/null @@ -1,1083 +0,0 @@ - - - - - -Apache module mod_rewrite - - - - -

    Module mod_rewrite (Version 2.3)

    - -This module is contained in the mod_rewrite.c file, with -Apache 1.2 and later. It provides -a rule-based rewriting engine to rewrite requested URLs on the fly. -mod_rewrite is not compiled into the server by -default. To use mod_rewrite you have to enable the following -line in the server build Configuration file: -
    -    Module  rewrite_module   mod_rewrite.o
    -
    - -

    Summary

    - -This module uses a rule-based rewriting engine (based on a -regular-expression parser) to rewrite requested URLs on the fly. - -

    -It supports an unlimited number of additional rule conditions (which can -operate on a lot of variables, including HTTP headers) for granular -matching and external database lookups (either via plain text -tables, DBM hash files or external processes) for advanced URL -substitution. - -

    -It operates on the full URLs (including the PATH_INFO part) both in -per-server context (httpd.conf) and per-dir context (.htaccess) and even -can generate QUERY_STRING parts on result. The rewrittten result can lead to internal sub-processing, external request redirection or to internal proxy throughput. - - -

    -The latest version can be found on
    - -http://www.engelschall.com/sw/mod_rewrite/ - -

    -Copyright © 1996 The Apache Group, All rights reserved.
    -Copyright © 1996 Ralf S. Engelschall, All rights reserved. -

    -Written for The Apache Group by -

    - Ralf S. Engelschall
    - rse@engelschall.com
    - http://www.engelschall.com/~rse -
    - - -
    - - -

    -

    Directives

    - - - - -
    - - - -
    - -

    Configuration Directives

    -
    -
    - -

    RewriteEngine

    -Syntax: RewriteEngine {on,off}
    -Default: RewriteEngine off
    -Context: server config, virtual host, per-directory config
    -

    - -The RewriteEngine directive enables or disables the -runtime rewriting engine. If it is set to off this module does -no runtime processing at all. It does not even update the SCRIPT_URx -environment variables. - -

    -Use this directive to disable the module instead of commenting out -all RewriteRule directives! - -

    -


    -

    - -

    RewriteOptions

    -Syntax: RewriteOptions Option ...
    -Default: -None-
    -Context: server config, virtual host, per-directory config
    -

    - -The RewriteOption directive sets some special options for the -current per-server or per-directory configuration. The Option -strings can be one of the following: - -

      -
    • 'inherit'
      - This forces the current configuration to inherit the configuration of the - parent. In per-virtual-server context this means that the maps, - conditions and rules of the main server gets inherited. In per-directory - context this means that conditions and rules of the parent directory's - .htaccess configuration gets inherited. -

      -

    - -

    -


    -

    - -

    RewriteLog

    -Syntax: RewriteLog Filename
    -Default: -None-
    -Context: server config, virtual host
    -

    - -The RewriteLog directive sets the name of the file to which the -server logs any rewriting actions it performs. If the name does not begin -with a slash ('/') then it is assumed to be relative to the -Server Root. The directive should occur only once per server -config. - -

    - - -
    -To disable the logging of rewriting actions it is not recommended -to set Filename -to /dev/null, because although the rewriting engine does -not create output to a logfile it still creates the logfile -output internally. This will slow down the server with no advantage to the -administrator! -To disable logging either remove or comment out the -RewriteLog directive or use RewriteLogLevel 0! -
    - -

    -Example: -

    -
    -RewriteLog "/usr/local/var/apache/logs/rewrite.log"
    -
    -
    - -

    -


    -

    - -

    RewriteLogLevel

    -Syntax: RewriteLogLevel Level
    -Default: RewriteLogLevel 0
    -Context: server config, virtual host
    -

    - -The RewriteLogLevel directive set the verbosity level of the rewriting -logfile. The default level 0 means no logging, while 9 or more means -that practically all actions are logged. - -

    -To disable the logging of rewriting actions simply set Level to 0. -This disables all rewrite action logs. - -

    - - -
    -Notice: Using a high value for Level will slow down your Apache -server dramatically! Use the rewriting logfile only for debugging or at least -at Level not greater than 2! -
    - - -

    -Example: -

    -
    -RewriteLogLevel 3
    -
    -
    - -

    -


    -

    - -

    RewriteMap

    -Syntax: RewriteMap Mapname {txt,dbm,prg}:Filename
    -Default: not used per default
    -Context: server config, virtual host
    -

    - -The RewriteMap directive defines an external Rewriting Map -which can be used inside rule substitution strings by the mapping-functions -to insert/substitute fields through a key lookup. -

    - -The Mapname is the name of the map and will -be used to specify a mapping-function for the substitution strings of a -rewriting rule via - -

    -${ Mapname : LookupKey -| DefaultValue } -
    - -When such a directive occurs the map Mapname -is consulted and the key LookupKey is looked-up. If the key is -found, the map-function directive is substituted by SubstValue. If -the key is not found then it is substituted by DefaultValue. - -

    -The Filename must be a valid Unix filepath, containing one -of the following formats: - -

      -
    1. Plain Text Format -

      - This is a ASCII file which contains either blank lines, comment lines - (starting with a '#' character) or - -

      - MatchingKey SubstValue -
      - - pairs - one per line. You can create such files either manually, - using your favorite editor, or by using the programs - mapcollect and mapmerge from the support - directory of the mod_rewrite distribution. -

      - To declare such a map prefix, Filename with a txt: - string as in the following example: - -

      - - -
      -#
      -#   map.real-to-user -- maps realnames to usernames
      -#
      -
      -Ralf.S.Engelschall    rse   # Bastard Operator From Hell 
      -Dr.Fred.Klabuster     fred  # Mr. DAU
      -
      - -

      - - -
      -RewriteMap real-to-host txt:/path/to/file/map.real-to-user
      -
      - -

      -

    2. DBM Hashfile Format -

      - This is a binary NDBM format file containing the - same contents as the Plain Text Format files. You can create - such a file with any NDBM tool or with the dbmmanage program - from the support directory of the Apache distribution. -

      - To declare such a map prefix Filename with a dbm: - string. -

      -

    3. Program Format -

      - This is a Unix executable, not a lookup file. To create it you can use - the language of your choice, but the result has to be a runable Unix - binary (i.e. either object-code or a script with the - magic cookie trick '#!/path/to/interpreter' as the first line). -

      - This program gets started once at startup of the Apache servers and then - communicates with the rewriting engine over its stdin and - stdout filehandles. For each map-function lookup it will - receive the key to lookup as a newline-terminated string on - stdin. It then has to give back the looked-up value as a - newline-terminated string on stdout or the four-character string - ``NULL'' if it fails (i.e. there is no corresponding value - for the given key). A trivial program which will implement a 1:1 map - (i.e. key == value) could be: -

      - - -
      -#!/usr/bin/perl
      -$| = 1;
      -while (<STDIN>) {
      -    # ...here any transformations 
      -    # or lookups should occur...
      -    print $_;
      -}
      -
      -

      - But be very careful:
      -

        -
      1. ``Keep the program simple, stupid'' (KISS), because - if this program hangs it will lead to a hang of the Apache server - when the rule occurs. -
      2. Avoid one common mistake: never do buffered I/O on stdout! - This will cause a deadloop! Hence the ``$|=1'' in the above - example... -
      -

      - To declare such a map prefix Filename with a prg: - string. -

    - -The RewriteMap directive can occur more than once. For each -mapping-function use one RewriteMap directive to declare its -rewriting mapfile. While you cannot declare a map in per-directory -context it is of course possible to use this map in per-directory -context. - -

    - - -
    -For plain text and DBM format files the looked-up keys are cached in-core -until the mtime of the mapfile changes or the server does a -restart. This way you can have map-functions in rules which are used -for every request. This is no problem, because the external lookup -only happens once! -
    - - -

    -


    -

    - -

    RewriteBase

    -Syntax: RewriteBase BaseURL
    -Default: default is the physical directory path
    -Context: per-directory config
    -

    - -The RewriteBase directive explicitly sets the base URL for -per-directory rewrites. As you will see below, RewriteRule can be -used in per-directory config files (.htaccess). There it will act -locally, i.e. the local directory prefix is stripped at this stage of -processing and your rewriting rules act only on the remainder. At the end -it is automatically added. - -

    -When a substitution occurs for a new URL, this module has to -re-inject the URL into the server processing. To be able to do this it needs -to know what the corresponding URL-prefix or URL-base is. By default this -prefix is the corresponding filepath itself. But at most websites URLs are -NOT directly related to physical filename paths, so this assumption -will be usually be wrong! There you have to use the RewriteBase -directive to specify the correct URL-prefix. - -

    - - -
    -So, if your webserver's URLs are not directly -related to physical file paths, you have to use RewriteBase in every -.htaccess files where you want to use RewriteRule -directives. -
    - -

    -Example: - -

    - Assume the following per-directory config file: - -

    - - -
    -#
    -#  /abc/def/.htaccess -- per-dir config file for directory /abc/def
    -#  Remember: /abc/def is the physical path of /xyz, i.e. the server
    -#            has a 'Alias /xyz /abc/def' directive e.g.
    -#
    -
    -RewriteEngine On
    -
    -#  let the server know that we are reached via /xyz and not 
    -#  via the physical path prefix /abc/def
    -RewriteBase   /xyz
    -
    -#  now the rewriting rules
    -RewriteRule   ^oldstuff\.html$  newstuff.html
    -
    - -

    -In the above example, a request to /xyz/oldstuff.html gets correctly -rewritten to the physical file /abc/def/newstuff.html. - -

    - - -
    - -For the Apache hackers:
    -The following list gives detailed information about the internal -processing steps: - -

    -

    -Request:
    -  /xyz/oldstuff.html
    -
    -Internal Processing:
    -  /xyz/oldstuff.html     -> /abc/def/oldstuff.html    (per-server Alias)
    -  /abc/def/oldstuff.html -> /abc/def/newstuff.html    (per-dir    RewriteRule)
    -  /abc/def/newstuff.html -> /xyz/newstuff.html        (per-dir    RewriteBase)
    -  /xyz/newstuff.html     -> /abc/def/newstuff.html    (per-server Alias)
    -
    -Result:
    -  /abc/def/newstuff.html
    -
    - -This seems very complicated but is the correct Apache internal processing, -because the per-directory rewriting comes too late in the process. So, -when it occurs the (rewritten) request has to be re-injected into the Apache -kernel! BUT: While this seems like a serious overhead, it really isn't, because -this re-injection happens fully internal to the Apache server and the same -procedure is used by many other operations inside Apache. So, you can be -sure the design and implementation is correct. -
    -
    - -

    - - -

    -


    -

    - -

    RewriteCond

    -Syntax: RewriteCond TestString CondPattern
    -Default: -None-
    -Context: server config, virtual host, per-directory config
    -

    - -The RewriteCond directive defines a rule condition. Precede a -RewriteRule directive with one ore more RewriteCond -directives. - -The following rewriting rule is only used if its pattern matches the current -state of the URI AND if these additional conditions apply, too. - -

    -TestString is a string which contains server-variables of the form - -

    -%{ NAME_OF_VARIABLE } -
    - -where NAME_OF_VARIABLE can be a string -of the following list: - -

    - - - - - - - - - - - - - - - -
    -HTTP headers:

    - -HTTP_USER_AGENT
    -HTTP_REFERER
    -HTTP_COOKIE
    -HTTP_FORWARDED
    -HTTP_HOST
    -HTTP_PROXY_CONNECTION
    -HTTP_ACCEPT
    -
    -

    -connection & request:

    - -REMOTE_ADDR
    -REMOTE_HOST
    -REMOTE_USER
    -REMOTE_IDENT
    -REQUEST_METHOD
    -SCRIPT_FILENAME
    -PATH_INFO
    -QUERY_STRING
    -AUTH_TYPE
    -
    -

    -server internals:

    - -DOCUMENT_ROOT
    -SERVER_ADMIN
    -SERVER_NAME
    -SERVER_PORT
    -SERVER_PROTOCOL
    -SERVER_SOFTWARE
    -SERVER_VERSION
    -
    -

    -system stuff:

    - -TIME_YEAR
    -TIME_MON
    -TIME_DAY
    -TIME_HOUR
    -TIME_MIN
    -TIME_SEC
    -TIME_WDAY
    -
    -

    -specials:

    - -API_VERSION
    -THE_REQUEST
    -REQUEST_URI
    -REQUEST_FILENAME
    -
    -

    - -

    - - -
    -These variables all correspond to the similar named HTTP MIME-headers, C -variables of the Apache server or struct tm fields of the Unix -system. -
    - -

    -Special Notes: -

      -
    1. The variables SCRIPT_FILENAME and REQUEST_FILENAME contain the same -value, i.e. the value of the filename field of the internal -request_rec structure of the Apache server. The first name is just the -commonly known CGI variable name while the second is the consistent -counterpart to REQUEST_URI (which contains the value of the uri -field of request_rec). - -

      -

    2. There is an additional format: %{ENV:variable} where -variable can be any Unix environment variable. This is looked-up -via getenv() from the Apache server process. - -

      -

    3. There is one more additional format: %{HTTP:header} where -header can be any HTTP MIME-header name. This is looked-up -from the HTTP request. Example: %{HTTP:Proxy-Connection} -is the value of the HTTP header ``Proxy-Connection:''. -
    - - -

    -CondPattern is the condition pattern, i.e. a regular expression -which gets applied to the current instance of the TestString, i.e. -TestString gets evaluated and then matched against -CondPattern. - -

    -Remember: CondPattern is a standard -Extended Regular Expression with some additions: - -

      -
    1. You can precede the pattern string with a '!' character -(exclamation mark) to specify a non-matching pattern. - -

      -

    2. -There are some special variants of CondPatterns. Instead of real -regular expression strings you can also use one of the following: -

      -

        -
      • '-d' (is directory)
        -Treats the TestString as a pathname and -tests if it exists and is a directory. -

        -

      • '-f' (is regular file)
        -Treats the TestString as a pathname and -tests if it exists and is a regular file. -

        -

      • '-s' (is regular file with size)
        -Treats the TestString as a pathname and -tests if it exists and is a regular file with size greater then zero. -

        -

      • '-l' (is symbolic link)
        -Treats the TestString as a pathname and -tests if it exists and is a symbolic link. -
      -

      -Notice: All of these tests can also be prefixed by a not ('!') character -to negate their meaning. -

    - -

    -Additionally you can set special flags for CondPattern by appending - -

    -[flags] -
    - -as the third argument to the RewriteCond directive. Flags -is a comma-separated list of the following flags: - -
      -
    • 'nocase|NC' (no case)
      - This makes the condition test case-insensitive, i.e. there is - no difference between 'A-Z' and 'a-z' both in the expanded - TestString and the CondPattern. -

      -

    • 'ornext|OR' (or next condition)
      - Use this to combine rule conditions with a local OR instead of the - implicit AND. Typical example: -

      -

      -RewriteCond %{REMOTE_HOST}  ^host1.*  [OR]
      -RewriteCond %{REMOTE_HOST}  ^host2.*  [OR]
      -RewriteCond %{REMOTE_HOST}  ^host3.*  
      -RewriteRule ...some special stuff for any of these hosts...
      -
      - Without this flag you had to write down the cond/rule three times. -

      -

    - -

    -Example: -

    - -To rewrite the Homepage of a site according to the ``User-Agent:'' -header of the request, you can use the following: - -
    -RewriteCond  %{HTTP_USER_AGENT}  ^Mozilla.*
    -RewriteRule  ^/$                 /homepage.max.html  [L]
    -
    -RewriteCond  %{HTTP_USER_AGENT}  ^Lynx.*
    -RewriteRule  ^/$                 /homepage.min.html  [L]
    -
    -RewriteRule  ^/$                 /homepage.std.html  [L]
    -
    - -Interpretation: If you use Netscape Navigator as your browser (which identifies -itself as 'Mozilla'), then you get the max homepage, which includes -Frames, etc. If you use the Lynx browser (which is Terminal-based), then you -get the min homepage, which contains no images, no tables, etc. If you -use any other browser you get the standard homepage. -
    -

    - -

    -


    -

    - -

    RewriteRule

    -Syntax: RewriteRule Pattern Substitution
    -Default: -None-
    -Context: server config, virtual host, per-directory config
    - -

    -The RewriteRule directive is the real rewriting workhorse. The -directive can occur more than once. Each directive then defines one single -rewriting rule. The definition order of these rules is -important, because this order is used when applying the rules at -run-time. - -

    -Pattern can be (for Apache 1.1.x a System -V8 and for Apache 1.2.x a POSIX) regular expression -which gets applied to the current URL. Here ``current'' means the value of the -URL when this rule gets applied. This may not be the original requested -URL, because there could be any number of rules before which already matched -and made alterations to it. - -

    -Some hints about the syntax of regular expressions: - -

    - - - - -
    -
    -^           Start of line
    -$           End of line
    -.           Any single character
    -[chars]     One of chars 
    -[^chars]    None of chars 
    -
    -?           0 or 1 of the preceding char
    -*           0 or N of the preceding char
    -+           1 or N of the preceding char
    -
    -\char       escape that specific char 
    -            (e.g. for specifying the chars ".[]()" etc.)
    -
    -(string)    Grouping of chars (the Nth group can be used on the RHS with $N)
    -
    -
    - -

    -Additionally the NOT character ('!') is a possible pattern -prefix. This gives you the ability to negate a pattern; to say, for instance: ``if -the current URL does NOT match to this pattern''. This can be used -for special cases where it is better to match the negative pattern or as a -last default rule. - -

    - - -
    -Notice! When using the NOT character to negate a pattern you cannot -have grouped wildcard parts in the pattern. This is impossible because when -the pattern does NOT match, there are no contents for the groups. In -consequence, if negated patterns are used, you cannot use $N in the -substitution string! -
    - -

    -Substitution of a rewriting rule is the string -which is substituted for (or replaces) the original URL for which -Pattern matched. Beside plain text you can use - -

      -
    1. pattern-group back-references ($N) -
    2. server-variables as in rule condition test-strings (%{VARNAME}) -
    3. mapping-function calls (${mapname:key|default}) -
    - -Back-references are $N (N=1..9) identifiers which -will be replaced by the contents of the Nth group of the matched -Pattern. The server-variables are the same as for the -TestString of a RewriteCond directive. The -mapping-functions come from the RewriteMap directive and are -explained there. These three types of variables are expanded in the order of -the above list. - -

    -As already mentioned above, all the rewriting rules are applied to the -Substitution (in the order of definition in the config file). The -URL is completely replaced by the Substitution and the -rewriting process goes on until there are no more rules (unless explicitly -terminated by a L flag - see below). - -

    -There is a special substitution string named '-' which means: -NO substitution! Sounds silly? No, it is useful to provide rewriting -rules which only match some URLs but do no substitution, e.g. in -conjunction with the C (chain) flag to be able to have more than one -pattern to be applied before a substitution occurs. - -

    - - -
    -Notice: There is a special feature. When you prefix a substitution -field with http://thishost[:thisport] then -mod_rewrite automatically strips it out. This auto-reduction on -implicit external redirect URLs is a useful and important feature when -used in combination with a mapping-function which generates the hostname -part. Have a look at the first example in the example section below to -understand this. -

    -Remember: An unconditional external redirect to your own server will -not work with the prefix http://thishost because of this feature. -To achieve such a self-redirect, you have to use the R-flag (see -below). -

    - -

    -Additionally you can set special flags for Substitution by appending - -

    -[flags] -
    - -as the third argument to the RewriteRule directive. Flags is a -comma-separated list of the following flags: - -
      -
    • 'redirect|R' (force redirect)
      - Prefix Substitution - with http://thishost/ (which makes the new URL a URI) to - force a external redirection. Use it for rules which should - canonicalize the URL and gives it back to the client, e.g. translate - ``/~'' into ``/u/'' or always append a slash to - /u/user, etc.
      - Notice: When you use this flag, make sure that the - substitution field is a valid URL! If not, you are redirecting to an invalid - location! -

      -

    • 'proxy|P' (force proxy)
      - This flag forces the substitution part to be internally forced as a proxy - request and immediately (i.e. rewriting rule processing stops here) put - through the proxy module. You have to make sure that the substitution - string is a valid URI (e.g. typically http://) which can - be handled by the Apache proxy module. If not you get an error from - the proxy module. Use this flag to achieve a more powerful implementation - of the mod_proxy directive ProxyPass, to map - some remote stuff into the namespace of the local server. -

      -

    • 'last|L' (last rule)
      - Stop the rewriting process here and - don't apply any more rewriting rules. This corresponds to the Perl - last command or the break command from the C - language. Use this flag to prevent the currently rewritten URL from being - rewritten further by following rules which may be wrong. For - example, use it to rewrite the root-path URL ('/') to a real - one, e.g. '/e/www/'. -

      -

    • 'next|N' (next round)
      - Re-run the rewriting process (starting again with the first rewriting - rule). Here the URL to match is again not the original URL but the URL - from the last rewriting rule. This corresponds to the Perl - next command or the continue command from the C - language. Use this flag to restart the rewriting process, i.e. to - immediately go to the top of the loop.
      - But be careful not to create a deadloop! -

      -

    • 'chain|C' (chained with next rule)
      - This flag chains the current rule with the next rule (which itself can - also be chained with its following rule, etc.). This has the following - effect: if a rule matches, then processing continues as usual, i.e. the - flag has no effect. If the rule does not match, then all following - chained rules are skipped. For instance, use it to remove the - ``.www'' part inside a per-directory rule set when you let an - external redirect happen (where the ``.www'' part should not to - occur!). -

      -

    • 'type|T=mime-type' (force MIME type)
      - Force the MIME-type of the target file to be mime-type. For - instance, this can be used to simulate the old mod_alias - directive ScriptAlias which internally forces all files inside - the mapped directory to have a MIME type of - ``application/x-httpd-cgi''. -

      -

    • 'nosubreq|NS' (used only if no internal sub-request)
      - This flag forces the rewriting engine to skip a rewriting rule if the - current request is an internal sub-request. For instance, sub-requests - occur internally in Apache when mod_include tries to find out - information about possible directory default files (index.xxx). - On sub-requests it is not always useful and even sometimes causes a failure to - if the complete set of rules are applied. Use this flag to exclude some rules.
      -

      - Use the following rule for your decision: whenever you prefix some URLs - with CGI-scripts to force them to be processed by the CGI-script, the - chance is high that you will run into problems (or even overhead) on sub-requests. - In these cases, use this flag. -

      -

    • 'passthrough|PT' (pass through to next handler)
      - This flag forces the rewriting engine to set the uri field - of the internal request_rec structure to the value - of the filename field. This flag is just a hack to be able - to post-process the output of RewriteRule directives by - Alias, ScriptAlias, Redirect, etc. directives - from other URI-to-filename translators. A trivial example to show the - semantics: - If you want to rewrite /abc to /def via the rewriting - engine of mod_rewrite and then /def to /ghi - with mod_alias: -
      -    RewriteRule ^/abc(.*)  /def$1 [PT]
      -    Alias       /def       /ghi   
      -    
      - If you omit the PT flag then mod_rewrite - will do its job fine, i.e. it rewrites uri=/abc/... to - filename=/def/... as a full API-compliant URI-to-filename - translator should do. Then mod_alias comes and tries to do a - URI-to-filename transition which will not work. -

      - Notice: You have to use this flag if you want to intermix directives - of different modules which contain URL-to-filename translators. The - typical example is the use of mod_alias and - mod_rewrite.. - -

      - - -
      - - For the Apache hackers:
      - If the current Apache API had a - filename-to-filename hook additionally to the URI-to-filename hook then - we wouldn't need this flag! But without such a hook this flag is the - only solution. The Apache Group has discussed this problem and will - add such hooks into Apache version 2.0. -
      -
      -

      -

    • 'skip|S=num' (skip next rule(s))
      - This flag forces the rewriting engine to skip the next num rules - in sequence when the current rule matches. Use this to make pseudo - if-then-else constructs: The last rule of the then-clause becomes - a skip=N where N is the number of rules in the else-clause. - (This is not the same as the 'chain|C' flag!) -

      -

    - -

    - - -
    -Remember: Never forget that Pattern gets applied to a complete URL -in per-server configuration files. But in per-directory configuration -files, the per-directory prefix (which always is the same for a specific -directory!) gets automatically removed for the pattern matching and -automatically added after the substitution has been done. This feature is -essential for many sorts of rewriting, because without this prefix stripping -you have to match the parent directory which is not always possible. -

    -There is one exception: If a substitution string starts with -``http://'' then the directory prefix will be not added and a -external redirect or proxy throughput (if flag P is used!) is forced! -

    - -

    - - -
    -Notice! To enable the rewriting engine for per-directory configuration files -you need to set ``RewriteEngine On'' in these files and -``Option FollowSymLinks'' enabled. If your administrator has -disabled override of FollowSymLinks for a user's directory, then -you cannot use the rewriting engine. This restriction is needed for -security reasons. -
    - -

    -Here are all possible substitution combinations and their meanings: - -

    -Inside per-server configuration (httpd.conf)
    -for request ``GET /somepath/pathinfo'':

    - -

    - - - - -
    -
    -Given Rule                                      Resulting Substitution
    -----------------------------------------------  ----------------------------------
    -^/somepath(.*) otherpath$1                      not supported, because invalid!
    -
    -^/somepath(.*) otherpath$1  [R]                 not supported, because invalid!
    -
    -^/somepath(.*) otherpath$1  [P]                 not supported, because invalid!
    -----------------------------------------------  ----------------------------------
    -^/somepath(.*) /otherpath$1                     /otherpath/pathinfo
    -
    -^/somepath(.*) /otherpath$1 [R]                 http://thishost/otherpath/pathinfo
    -                                                via external redirection
    -
    -^/somepath(.*) /otherpath$1 [P]                 not supported, because silly!
    -----------------------------------------------  ----------------------------------
    -^/somepath(.*) http://thishost/otherpath$1      /otherpath/pathinfo
    -
    -^/somepath(.*) http://thishost/otherpath$1 [R]  http://thishost/otherpath/pathinfo
    -                                                via external redirection
    -
    -^/somepath(.*) http://thishost/otherpath$1 [P]  not supported, because silly!
    -----------------------------------------------  ----------------------------------
    -^/somepath(.*) http://otherhost/otherpath$1     http://otherhost/otherpath/pathinfo
    -                                                via external redirection
    -
    -^/somepath(.*) http://otherhost/otherpath$1 [R] http://otherhost/otherpath/pathinfo
    -                                                via external redirection
    -                                                (the [R] flag is redundant)
    -
    -^/somepath(.*) http://otherhost/otherpath$1 [P] http://otherhost/otherpath/pathinfo
    -                                                via internal proxy
    -
    -
    - -

    -Inside per-directory configuration for /somepath
    -(i.e. file .htaccess in dir /physical/path/to/somepath containing -RewriteBase /somepath)
    for -request ``GET /somepath/localpath/pathinfo'':

    - -

    - - - - -
    -
    -Given Rule                                      Resulting Substitution
    -----------------------------------------------  ----------------------------------
    -^localpath(.*) otherpath$1                      /somepath/otherpath/pathinfo
    -
    -^localpath(.*) otherpath$1  [R]                 http://thishost/somepath/otherpath/pathinfo
    -                                                via external redirection
    -
    -^localpath(.*) otherpath$1  [P]                 not supported, because silly!
    -----------------------------------------------  ----------------------------------
    -^localpath(.*) /otherpath$1                     /otherpath/pathinfo
    -
    -^localpath(.*) /otherpath$1 [R]                 http://thishost/otherpath/pathinfo
    -                                                via external redirection
    -
    -^localpath(.*) /otherpath$1 [P]                 not supported, because silly!
    -----------------------------------------------  ----------------------------------
    -^localpath(.*) http://thishost/otherpath$1      /otherpath/pathinfo
    -
    -^localpath(.*) http://thishost/otherpath$1 [R]  http://thishost/otherpath/pathinfo
    -                                                via external redirection
    -
    -^localpath(.*) http://thishost/otherpath$1 [P]  not supported, because silly!
    -----------------------------------------------  ----------------------------------
    -^localpath(.*) http://otherhost/otherpath$1     http://otherhost/otherpath/pathinfo
    -                                                via external redirection
    -
    -^localpath(.*) http://otherhost/otherpath$1 [R] http://otherhost/otherpath/pathinfo
    -                                                via external redirection
    -                                                (the [R] flag is redundant)
    -
    -^localpath(.*) http://otherhost/otherpath$1 [P] http://otherhost/otherpath/pathinfo
    -                                                via internal proxy
    -
    -
    - - -

    - -

    -Example: -

    -

    -We want to rewrite URLs of the form -
    -/ Language -/~ Realname -/.../ File -
    -into -
    -/u/ Username -/.../ File -. Language -
    -

    -We take the rewrite mapfile from above and save it under -/anywhere/map.real-to-user. Then we only have to add the -following lines to the Apache server configuration file: - -

    -
    -RewriteLog   /anywhere/rewrite.log
    -RewriteMap   real-to-user               txt:/anywhere/map.real-to-host
    -RewriteRule  ^/([^/]+)/~([^/]+)/(.*)$   /u/${real-to-user:$2|nobody}/$3.$1
    -
    -
    -
    - - - - - \ No newline at end of file diff --git a/docs/manual/mod/mod_rewrite.xml b/docs/manual/mod/mod_rewrite.xml deleted file mode 100644 index ff31e179bce22e268421d010676e89da714f509e..0000000000000000000000000000000000000000 --- a/docs/manual/mod/mod_rewrite.xml +++ /dev/null @@ -1,1798 +0,0 @@ - - ]> - - - -mod_rewrite - -Provides a rule-based rewriting engine to rewrite requested -URLs on the fly - -Extension -mod_rewrite.c -rewrite_module -Available in Apache 1.3 and later - - -
    - ``The great thing about mod_rewrite is it gives you - all the configurability and flexibility of Sendmail. - The downside to mod_rewrite is that it gives you all - the configurability and flexibility of Sendmail.'' - - -
    - -- Brian Behlendorf
    - Apache Group -
    -
    - -
    - `` Despite the tons of examples and docs, - mod_rewrite is voodoo. Damned cool voodoo, but still - voodoo. '' - -
    - -- Brian Moore
    - bem@news.cmc.net -
    -
    - - -

    Welcome to mod_rewrite, the Swiss Army Knife of URL - manipulation!

    - -

    This module uses a rule-based rewriting engine (based on a - regular-expression parser) to rewrite requested URLs on the - fly. It supports an unlimited number of rules and an - unlimited number of attached rule conditions for each rule to - provide a really flexible and powerful URL manipulation - mechanism. The URL manipulations can depend on various tests, - for instance server variables, environment variables, HTTP - headers, time stamps and even external database lookups in - various formats can be used to achieve a really granular URL - matching.

    - -

    This module operates on the full URLs (including the - path-info part) both in per-server context - (httpd.conf) and per-directory context - (.htaccess) and can even generate query-string - parts on result. The rewritten result can lead to internal - sub-processing, external request redirection or even to an - internal proxy throughput.

    - -

    But all this functionality and flexibility has its - drawback: complexity. So don't expect to understand this - entire module in just one day.

    - -

    This module was invented and originally written in April - 1996 and gifted exclusively to the The Apache Group in July 1997 - by

    - -
    - Ralf S. - Engelschall
    - rse@engelschall.com
    - www.engelschall.com -
    -
    - -
    Interal Processing - -

    The internal processing of this module is very complex but - needs to be explained once even to the average user to avoid - common mistakes and to let you exploit its full - functionality.

    - -
    API Phases - -

    First you have to understand that when Apache processes a - HTTP request it does this in phases. A hook for each of these - phases is provided by the Apache API. Mod_rewrite uses two of - these hooks: the URL-to-filename translation hook which is - used after the HTTP request has been read but before any - authorization starts and the Fixup hook which is triggered - after the authorization phases and after the per-directory - config files (.htaccess) have been read, but - before the content handler is activated.

    - -

    So, after a request comes in and Apache has determined the - corresponding server (or virtual server) the rewriting engine - starts processing of all mod_rewrite directives from the - per-server configuration in the URL-to-filename phase. A few - steps later when the final data directories are found, the - per-directory configuration directives of mod_rewrite are - triggered in the Fixup phase. In both situations mod_rewrite - rewrites URLs either to new URLs or to filenames, although - there is no obvious distinction between them. This is a usage - of the API which was not intended to be this way when the API - was designed, but as of Apache 1.x this is the only way - mod_rewrite can operate. To make this point more clear - remember the following two points:

    - -
      -
    1. Although mod_rewrite rewrites URLs to URLs, URLs to - filenames and even filenames to filenames, the API - currently provides only a URL-to-filename hook. In Apache - 2.0 the two missing hooks will be added to make the - processing more clear. But this point has no drawbacks for - the user, it is just a fact which should be remembered: - Apache does more in the URL-to-filename hook than the API - intends for it.
    2. - -
    3. - Unbelievably mod_rewrite provides URL manipulations in - per-directory context, i.e., within - .htaccess files, although these are reached - a very long time after the URLs have been translated to - filenames. It has to be this way because - .htaccess files live in the filesystem, so - processing has already reached this stage. In other - words: According to the API phases at this time it is too - late for any URL manipulations. To overcome this chicken - and egg problem mod_rewrite uses a trick: When you - manipulate a URL/filename in per-directory context - mod_rewrite first rewrites the filename back to its - corresponding URL (which is usually impossible, but see - the RewriteBase directive below for the - trick to achieve this) and then initiates a new internal - sub-request with the new URL. This restarts processing of - the API phases. - -

      Again mod_rewrite tries hard to make this complicated - step totally transparent to the user, but you should - remember here: While URL manipulations in per-server - context are really fast and efficient, per-directory - rewrites are slow and inefficient due to this chicken and - egg problem. But on the other hand this is the only way - mod_rewrite can provide (locally restricted) URL - manipulations to the average user.

      -
    4. -
    - -

    Don't forget these two points!

    -
    - -
    Ruleset Processing - -

    Now when mod_rewrite is triggered in these two API phases, it - reads the configured rulesets from its configuration - structure (which itself was either created on startup for - per-server context or during the directory walk of the Apache - kernel for per-directory context). Then the URL rewriting - engine is started with the contained ruleset (one or more - rules together with their conditions). The operation of the - URL rewriting engine itself is exactly the same for both - configuration contexts. Only the final result processing is - different.

    - -

    The order of rules in the ruleset is important because the - rewriting engine processes them in a special (and not very - obvious) order. The rule is this: The rewriting engine loops - through the ruleset rule by rule (RewriteRule directives) and - when a particular rule matches it optionally loops through - existing corresponding conditions (RewriteCond - directives). For historical reasons the conditions are given - first, and so the control flow is a little bit long-winded. See - Figure 1 for more details.

    - -
    - - - - - - - - -
    [Needs graphics capability to display]
    Figure 1: The - control flow through the rewriting ruleset
    -
    - -

    As you can see, first the URL is matched against the - Pattern of each rule. When it fails mod_rewrite - immediately stops processing this rule and continues with the - next rule. If the Pattern matches, mod_rewrite looks - for corresponding rule conditions. If none are present, it - just substitutes the URL with a new value which is - constructed from the string Substitution and goes on - with its rule-looping. But if conditions exist, it starts an - inner loop for processing them in the order that they are - listed. For conditions the logic is different: we don't match - a pattern against the current URL. Instead we first create a - string TestString by expanding variables, - back-references, map lookups, etc. and then we try - to match CondPattern against it. If the pattern - doesn't match, the complete set of conditions and the - corresponding rule fails. If the pattern matches, then the - next condition is processed until no more conditions are - available. If all conditions match, processing is continued - with the substitution of the URL with - Substitution.

    - -
    - -
    Quoting Special Characters - -

    As of Apache 1.3.20, special characters in - TestString and Substitution strings can be - escaped (that is, treated as normal characters without their - usual special meaning) by prefixing them with a slosh ('\') - character. In other words, you can include an actual - dollar-sign character in a Substitution string by - using '\$'; this keeps mod_rewrite from trying - to treat it as a backreference.

    -
    - -
    Regex Back-Reference Availability - -

    One important thing here has to be remembered: Whenever you - use parentheses in Pattern or in one of the - CondPattern, back-references are internally created - which can be used with the strings $N and - %N (see below). These are available for creating - the strings Substitution and TestString. - Figure 2 shows to which locations the back-references are - transfered for expansion.

    - -
    - - - - - - - - -
    [Needs graphics capability to display]
    Figure 2: The - back-reference flow through a rule
    -
    - -

    We know this was a crash course on mod_rewrite's internal - processing. But you will benefit from this knowledge when - reading the following documentation of the available - directives.

    - -
    -
    - -
    Environment Variables - -

    This module keeps track of two additional (non-standard) - CGI/SSI environment variables named SCRIPT_URL - and SCRIPT_URI. These contain the - logical Web-view to the current resource, while the - standard CGI/SSI variables SCRIPT_NAME and - SCRIPT_FILENAME contain the physical - System-view.

    - -

    Notice: These variables hold the URI/URL as they were - initially requested, i.e., before any - rewriting. This is important because the rewriting process is - primarily used to rewrite logical URLs to physical - pathnames.

    - -

    Example:

    - - -
    -SCRIPT_NAME=/sw/lib/w3s/tree/global/u/rse/.www/index.html
    -SCRIPT_FILENAME=/u/rse/.www/index.html
    -SCRIPT_URL=/u/rse/
    -SCRIPT_URI=http://en1.engelschall.com/u/rse/
    -
    -
    - -
    - -
    Practical Solutions - -

    We also have an URL - Rewriting Guide available, which provides a collection of - practical solutions for URL-based problems. There you can - find real-life rulesets and additional information about - mod_rewrite.

    -
    - - - - -RewriteEngine - -Enables or disables runtime rewriting engine - -RewriteEngine on|off -RewriteEngine off -server configvirtual host -directory.htaccess -FileInfo - - - -

    The RewriteEngine directive enables or - disables the runtime rewriting engine. If it is set to - off this module does no runtime processing at - all. It does not even update the SCRIPT_URx - environment variables.

    - -

    Use this directive to disable the module instead of - commenting out all the RewriteRule directives!

    - -

    Note that, by default, rewrite configurations are not - inherited. This means that you need to have a - RewriteEngine on directive for each virtual host - in which you wish to use it.

    -
    - -
    - - -RewriteOptions -Sets some special options for the rewrite engine -RewriteOptions Options -None -server configvirtual host -directory.htaccess - - - -

    The RewriteOptions directive sets some - special options for the current per-server or per-directory - configuration. The Option strings can be one of the - following:

    - -
      -
    • 'inherit'
      - This forces the current configuration to inherit the - configuration of the parent. In per-virtual-server context - this means that the maps, conditions and rules of the main - server are inherited. In per-directory context this means - that conditions and rules of the parent directory's - .htaccess configuration are inherited.
    • -
    -
    - -
    - - -RewriteLog -Sets the name of the file used for logging rewrite engine -processing -RewriteLog file-path -server configvirtual host - - - -

    The RewriteLog directive sets the name - of the file to which the server logs any rewriting actions it - performs. If the name does not begin with a slash - ('/') then it is assumed to be relative to the - Server Root. The directive should occur only once per - server config.

    - - To disable the logging of - rewriting actions it is not recommended to set - Filename to /dev/null, because - although the rewriting engine does not then output to a - logfile it still creates the logfile output internally. - This will slow down the server with no advantage - to the administrator! To disable logging either - remove or comment out the RewriteLog - directive or use RewriteLogLevel 0! - - -Security - -See the Apache Security Tips -document for details on why your security could be compromised if the -directory where logfiles are stored is writable by anyone other than -the user that starts the server. - - -Example -RewriteLog "/usr/local/var/apache/logs/rewrite.log" - - -
    - -
    - - -RewriteLogLevel -Sets the verbosity of the log file used by the rewrite -engine -RewriteLogLevel Level -RerwiteLogLevel 0 -server configvirtual host - - - -

    The RewriteLogLevel directive sets the - verbosity level of the rewriting logfile. The default level 0 - means no logging, while 9 or more means that practically all - actions are logged.

    - -

    To disable the logging of rewriting actions simply set - Level to 0. This disables all rewrite action - logs.

    - - Using a high value for - Level will slow down your Apache server - dramatically! Use the rewriting logfile at a - Level greater than 2 only for debugging! - - -Example -RewriteLogLevel 3 - - -
    - -
    - - -RewriteLock -Sets the name of the lock file used for RewriteMap -synchronization -RewriteLock file-path -None -server config - - -

    This directive sets the filename for a synchronization - lockfile which mod_rewrite needs to communicate with RewriteMap - programs. Set this lockfile to a local path (not on a - NFS-mounted device) when you want to use a rewriting - map-program. It is not required for other types of rewriting - maps.

    -
    - -
    - - -RewriteMap -Defines a mapping function for key-lookup -RewriteMap MapName MapType:MapSource - -None -server configvirtual host - - - -

    The RewriteMap directive defines a - Rewriting Map which can be used inside rule - substitution strings by the mapping-functions to - insert/substitute fields through a key lookup. The source of - this lookup can be of various types.

    - -

    The MapName is - the name of the map and will be used to specify a - mapping-function for the substitution strings of a rewriting - rule via one of the following constructs:

    - -
    - ${ MapName : - LookupKey }
    - ${ MapName : - LookupKey | DefaultValue - }
    -
    - -

    When such a construct occurs the map MapName is - consulted and the key LookupKey is looked-up. If the - key is found, the map-function construct is substituted by - SubstValue. If the key is not found then it is - substituted by DefaultValue or by the empty string - if no DefaultValue was specified.

    - -

    The following combinations for MapType and - MapSource can be used:

    - -
      -
    • - Standard Plain Text
      - MapType: txt, MapSource: Unix filesystem - path to valid regular file - -

      This is the standard rewriting map feature where the - MapSource is a plain ASCII file containing - either blank lines, comment lines (starting with a '#' - character) or pairs like the following - one per - line.

      - -
      - MatchingKey - SubstValue -
      - -Example -
      -##
      -##  map.txt -- rewriting map
      -##
      -
      -Ralf.S.Engelschall    rse   # Bastard Operator From Hell
      -Mr.Joe.Average        joe   # Mr. Average
      -
      -
      - - -RewriteMap real-to-user txt:/path/to/file/map.txt - -
    • - -
    • - Randomized Plain Text
      - MapType: rnd, MapSource: Unix filesystem - path to valid regular file - -

      This is identical to the Standard Plain Text variant - above but with a special post-processing feature: After - looking up a value it is parsed according to contained - ``|'' characters which have the meaning of - ``or''. In other words they indicate a set of - alternatives from which the actual returned value is - chosen randomly. Although this sounds crazy and useless, - it was actually designed for load balancing in a reverse - proxy situation where the looked up values are server - names. Example:

      - - -
      -##
      -##  map.txt -- rewriting map
      -##
      -
      -static   www1|www2|www3|www4
      -dynamic  www5|www6
      -
      -
      - - -RewriteMap servers rnd:/path/to/file/map.txt - -
    • - -
    • - Hash File
      - MapType: dbm, MapSource: Unix filesystem - path to valid regular file - -

      Here the source is a binary NDBM format file - containing the same contents as a Plain Text - format file, but in a special representation which is - optimized for really fast lookups. You can create such a - file with any NDBM tool or with the following Perl - script:

      - - -
      -#!/path/to/bin/perl
      -##
      -##  txt2dbm -- convert txt map to dbm format
      -##
      -
      -use NDBM_File;
      -use Fcntl;
      -
      -($txtmap, $dbmmap) = @ARGV;
      -
      -open(TXT, "<$txtmap") or die "Couldn't open $txtmap!\n";
      -tie (%DB, 'NDBM_File', $dbmmap,O_RDWR|O_TRUNC|O_CREAT, 0644) or die "Couldn't create $dbmmap!\n";
      -
      -while (<TXT>) {
      -  next if (/^\s*#/ or /^\s*$/);
      -  $DB{$1} = $2 if (/^\s*(\S+)\s+(\S+)/);
      -}
      -
      -untie %DB;
      -close(TXT);
      -
      -
      - - -$ txt2dbm map.txt map.db - -
    • - -
    • - Internal Function
      - MapType: int, MapSource: Internal Apache - function - -

      Here the source is an internal Apache function. - Currently you cannot create your own, but the following - functions already exists:

      - -
        -
      • toupper:
        - Converts the looked up key to all upper case.
      • - -
      • tolower:
        - Converts the looked up key to all lower case.
      • - -
      • escape:
        - Translates special characters in the looked up key to - hex-encodings.
      • - -
      • unescape:
        - Translates hex-encodings in the looked up key back to - special characters.
      • -
      -
    • - -
    • - External Rewriting Program
      - MapType: prg, MapSource: Unix filesystem - path to valid regular file - -

      Here the source is a program, not a map file. To - create it you can use the language of your choice, but - the result has to be a executable (i.e., either - object-code or a script with the magic cookie trick - '#!/path/to/interpreter' as the first - line).

      - -

      This program is started once at startup of the Apache - servers and then communicates with the rewriting engine - over its stdin and stdout - file-handles. For each map-function lookup it will - receive the key to lookup as a newline-terminated string - on stdin. It then has to give back the - looked-up value as a newline-terminated string on - stdout or the four-character string - ``NULL'' if it fails (i.e., there - is no corresponding value for the given key). A trivial - program which will implement a 1:1 map (i.e., - key == value) could be:

      - - -
      -#!/usr/bin/perl
      -$| = 1;
      -while (<STDIN>) {
      -    # ...put here any transformations or lookups...
      -    print $_;
      -}
      -
      -
      - -

      But be very careful:

      - -
        -
      1. ``Keep it simple, stupid'' (KISS), because - if this program hangs it will hang the Apache server - when the rule occurs.
      2. - -
      3. Avoid one common mistake: never do buffered I/O on - stdout! This will cause a deadloop! Hence - the ``$|=1'' in the above example...
      4. - -
      5. Use the RewriteLock directive to - define a lockfile mod_rewrite can use to synchronize the - communication to the program. By default no such - synchronization takes place.
      6. -
      -
    • -
    - The RewriteMap directive can occur more than - once. For each mapping-function use one - RewriteMap directive to declare its rewriting - mapfile. While you cannot declare a map in - per-directory context it is of course possible to - use this map in per-directory context. - -Note For plain text and DBM format files the -looked-up keys are cached in-core until the mtime of the -mapfile changes or the server does a restart. This way you can have -map-functions in rules which are used for every -request. This is no problem, because the external lookup only happens -once! - - -
    -
    - - -RewriteBase -Sets the base URL for per-directory rewrites -RewriteBase URL-path -RewriteBase physical-directory-path -directory.htaccess - -FileInfo - - -

    The RewriteBase directive explicitly - sets the base URL for per-directory rewrites. As you will see - below, RewriteRule - can be used in per-directory config files - (.htaccess). There it will act locally, - i.e., the local directory prefix is stripped at this - stage of processing and your rewriting rules act only on the - remainder. At the end it is automatically added back to the - path.

    - -

    When a substitution occurs for a new URL, this module has - to re-inject the URL into the server processing. To be able - to do this it needs to know what the corresponding URL-prefix - or URL-base is. By default this prefix is the corresponding - filepath itself. But at most websites URLs are NOT - directly related to physical filename paths, so this - assumption will usually be wrong! There you have to - use the RewriteBase directive to specify the - correct URL-prefix.

    - - If your webserver's URLs are not directly -related to physical file paths, you have to use -RewriteBase in every .htaccess -files where you want to use RewriteRule directives. - - -

    For example, assume the following per-directory config file:

    - - -
    -#
    -#  /abc/def/.htaccess -- per-dir config file for directory /abc/def
    -#  Remember: /abc/def is the physical path of /xyz, i.e., the server
    -#            has a 'Alias /xyz /abc/def' directive e.g.
    -#
    -
    -RewriteEngine On
    -
    -#  let the server know that we were reached via /xyz and not
    -#  via the physical path prefix /abc/def
    -RewriteBase   /xyz
    -
    -#  now the rewriting rules
    -RewriteRule   ^oldstuff\.html$  newstuff.html
    -
    -
    - -

    In the above example, a request to - /xyz/oldstuff.html gets correctly rewritten to - the physical file /abc/def/newstuff.html.

    - -For Apache Hackers -

    The following list gives detailed information about - the internal processing steps:

    -
    -Request:
    -  /xyz/oldstuff.html
    -
    -Internal Processing:
    -  /xyz/oldstuff.html     -> /abc/def/oldstuff.html  (per-server Alias)
    -  /abc/def/oldstuff.html -> /abc/def/newstuff.html  (per-dir    RewriteRule)
    -  /abc/def/newstuff.html -> /xyz/newstuff.html      (per-dir    RewriteBase)
    -  /xyz/newstuff.html     -> /abc/def/newstuff.html  (per-server Alias)
    -
    -Result:
    -  /abc/def/newstuff.html
    -
    -
    -

    This seems very complicated but is - the correct Apache internal processing, because the - per-directory rewriting comes too late in the - process. So, when it occurs the (rewritten) request - has to be re-injected into the Apache kernel! BUT: - While this seems like a serious overhead, it really - isn't, because this re-injection happens fully - internally to the Apache server and the same - procedure is used by many other operations inside - Apache. So, you can be sure the design and - implementation is correct.

    -
    - -
    - -
    - - -RewriteCond -Defines a condition under which rewriting will take place - - RewriteCond - TestString CondPattern -None -server configvirtual host -directory.htaccess -FileInfo - - -

    The RewriteCond directive defines a - rule condition. Precede a RewriteRule directive with one - or more RewriteCond directives. The following - rewriting rule is only used if its pattern matches the current - state of the URI and if these additional - conditions apply too.

    - -

    TestString is a string which can contains the - following expanded constructs in addition to plain text:

    - -
      -
    • - RewriteRule backreferences: These are - backreferences of the form - -
      - $N -
      - (0 <= N <= 9) which provide access to the grouped - parts (parenthesis!) of the pattern from the - corresponding RewriteRule directive (the one - following the current bunch of RewriteCond - directives). -
    • - -
    • - RewriteCond backreferences: These are - backreferences of the form - -
      - %N -
      - (1 <= N <= 9) which provide access to the grouped - parts (parentheses!) of the pattern from the last matched - RewriteCond directive in the current bunch - of conditions. -
    • - -
    • - RewriteMap expansions: These are - expansions of the form - -
      - ${mapname:key|default} -
      - See the documentation for - RewriteMap for more details. -
    • - -
    • - Server-Variables: These are variables of - the form - -
      - %{ NAME_OF_VARIABLE - } -
      - where NAME_OF_VARIABLE can be a string taken - from the following list: - - - - - - - - - - - - - - - -
      - HTTP headers: - -

      HTTP_USER_AGENT
      - HTTP_REFERER
      - HTTP_COOKIE
      - HTTP_FORWARDED
      - HTTP_HOST
      - HTTP_PROXY_CONNECTION
      - HTTP_ACCEPT
      -

      -
      - connection & request: - -

      REMOTE_ADDR
      - REMOTE_HOST
      - REMOTE_USER
      - REMOTE_IDENT
      - REQUEST_METHOD
      - SCRIPT_FILENAME
      - PATH_INFO
      - QUERY_STRING
      - AUTH_TYPE
      -

      -
      - server internals: - -

      DOCUMENT_ROOT
      - SERVER_ADMIN
      - SERVER_NAME
      - SERVER_ADDR
      - SERVER_PORT
      - SERVER_PROTOCOL
      - SERVER_SOFTWARE
      -

      -
      - system stuff: - -

      TIME_YEAR
      - TIME_MON
      - TIME_DAY
      - TIME_HOUR
      - TIME_MIN
      - TIME_SEC
      - TIME_WDAY
      - TIME
      -

      -
      - specials: - -

      API_VERSION
      - THE_REQUEST
      - REQUEST_URI
      - REQUEST_FILENAME
      - IS_SUBREQ
      -

      -
      - - -

      These variables all - correspond to the similarly named HTTP - MIME-headers, C variables of the Apache server or - struct tm fields of the Unix system. - Most are documented elsewhere in the Manual or in - the CGI specification. Those that are special to - mod_rewrite include:

      - -
      -
      IS_SUBREQ
      - -
      Will contain the text "true" if the request - currently being processed is a sub-request, - "false" otherwise. Sub-requests may be generated - by modules that need to resolve additional files - or URIs in order to complete their tasks.
      - -
      API_VERSION
      - -
      This is the version of the Apache module API - (the internal interface between server and - module) in the current httpd build, as defined in - include/ap_mmn.h. The module API version - corresponds to the version of Apache in use (in - the release version of Apache 1.3.14, for - instance, it is 19990320:10), but is mainly of - interest to module authors.
      - -
      THE_REQUEST
      - -
      The full HTTP request line sent by the - browser to the server (e.g., "GET - /index.html HTTP/1.1"). This does not - include any additional headers sent by the - browser.
      - -
      REQUEST_URI
      - -
      The resource requested in the HTTP request - line. (In the example above, this would be - "/index.html".)
      - -
      REQUEST_FILENAME
      - -
      The full local filesystem path to the file or - script matching the request.
      -
      -
      -
    • -
    - -

    Special Notes:

    - -
      -
    1. The variables SCRIPT_FILENAME and REQUEST_FILENAME - contain the same value, i.e., the value of the - filename field of the internal - request_rec structure of the Apache server. - The first name is just the commonly known CGI variable name - while the second is the consistent counterpart to - REQUEST_URI (which contains the value of the - uri field of request_rec).
    2. - -
    3. There is the special format: - %{ENV:variable} where variable can be - any environment variable. This is looked-up via internal - Apache structures and (if not found there) via - getenv() from the Apache server process.
    4. - -
    5. There is the special format: - %{HTTP:header} where header can be - any HTTP MIME-header name. This is looked-up from the HTTP - request. Example: %{HTTP:Proxy-Connection} is - the value of the HTTP header - ``Proxy-Connection:''.
    6. - -
    7. There is the special format - %{LA-U:variable} for look-aheads which perform - an internal (URL-based) sub-request to determine the final - value of variable. Use this when you want to use a - variable for rewriting which is actually set later in an - API phase and thus is not available at the current stage. - For instance when you want to rewrite according to the - REMOTE_USER variable from within the - per-server context (httpd.conf file) you have - to use %{LA-U:REMOTE_USER} because this - variable is set by the authorization phases which come - after the URL translation phase where mod_rewrite - operates. On the other hand, because mod_rewrite implements - its per-directory context (.htaccess file) via - the Fixup phase of the API and because the authorization - phases come before this phase, you just can use - %{REMOTE_USER} there.
    8. - -
    9. There is the special format: - %{LA-F:variable} which performs an internal - (filename-based) sub-request to determine the final value - of variable. Most of the time this is the same as - LA-U above.
    10. -
    - -

    CondPattern is the condition pattern, - i.e., a regular expression which is applied to the - current instance of the TestString, i.e., - TestString is evaluated and then matched against - CondPattern.

    - -

    Remember: CondPattern is a - standard Extended Regular Expression with some - additions:

    - -
      -
    1. You can prefix the pattern string with a - '!' character (exclamation mark) to specify a - non-matching pattern.
    2. - -
    3. - There are some special variants of CondPatterns. - Instead of real regular expression strings you can also - use one of the following: - -
        -
      • '<CondPattern' (is lexically - lower)
        - Treats the CondPattern as a plain string and - compares it lexically to TestString. True if - TestString is lexically lower than - CondPattern.
      • - -
      • '>CondPattern' (is lexically - greater)
        - Treats the CondPattern as a plain string and - compares it lexically to TestString. True if - TestString is lexically greater than - CondPattern.
      • - -
      • '=CondPattern' (is lexically - equal)
        - Treats the CondPattern as a plain string and - compares it lexically to TestString. True if - TestString is lexically equal to - CondPattern, i.e the two strings are exactly - equal (character by character). If CondPattern - is just "" (two quotation marks) this - compares TestString to the empty string.
      • - -
      • '-d' (is - directory)
        - Treats the TestString as a pathname and tests - if it exists and is a directory.
      • - -
      • '-f' (is regular - file)
        - Treats the TestString as a pathname and tests - if it exists and is a regular file.
      • - -
      • '-s' (is regular file with - size)
        - Treats the TestString as a pathname and tests - if it exists and is a regular file with size greater - than zero.
      • - -
      • '-l' (is symbolic - link)
        - Treats the TestString as a pathname and tests - if it exists and is a symbolic link.
      • - -
      • '-F' (is existing file via - subrequest)
        - Checks if TestString is a valid file and - accessible via all the server's currently-configured - access controls for that path. This uses an internal - subrequest to determine the check, so use it with care - because it decreases your servers performance!
      • - -
      • '-U' (is existing URL via - subrequest)
        - Checks if TestString is a valid URL and - accessible via all the server's currently-configured - access controls for that path. This uses an internal - subrequest to determine the check, so use it with care - because it decreases your server's performance!
      • -
      - -Notice - All of these tests can - also be prefixed by an exclamation mark ('!') to - negate their meaning. - -
    4. -
    - -

    Additionally you can set special flags for - CondPattern by appending

    - -
    - [flags] -
    - as the third argument to the RewriteCond - directive. Flags is a comma-separated list of the - following flags: - -
      -
    • 'nocase|NC' - (no case)
      - This makes the test case-insensitive, i.e., there - is no difference between 'A-Z' and 'a-z' both in the - expanded TestString and the CondPattern. - This flag is effective only for comparisons between - TestString and CondPattern. It has no - effect on filesystem and subrequest checks.
    • - -
    • - 'ornext|OR' - (or next condition)
      - Use this to combine rule conditions with a local OR - instead of the implicit AND. Typical example: - - -
      -RewriteCond %{REMOTE_HOST}  ^host1.*  [OR]
      -RewriteCond %{REMOTE_HOST}  ^host2.*  [OR]
      -RewriteCond %{REMOTE_HOST}  ^host3.*
      -RewriteRule ...some special stuff for any of these hosts...
      -
      -
      - - Without this flag you would have to write the cond/rule - three times. -
    • -
    - -

    Example:

    - -

    To rewrite the Homepage of a site according to the - ``User-Agent:'' header of the request, you can - use the following:

    - - -
    -RewriteCond  %{HTTP_USER_AGENT}  ^Mozilla.*
    -RewriteRule  ^/$                 /homepage.max.html  [L]
    -
    -RewriteCond  %{HTTP_USER_AGENT}  ^Lynx.*
    -RewriteRule  ^/$                 /homepage.min.html  [L]
    -
    -RewriteRule  ^/$                 /homepage.std.html  [L]
    -
    -
    - -

    Interpretation: If you use Netscape Navigator as your - browser (which identifies itself as 'Mozilla'), then you - get the max homepage, which includes Frames, etc. - If you use the Lynx browser (which is Terminal-based), then - you get the min homepage, which contains no images, no - tables, etc. If you use any other browser you get - the standard homepage.

    - -
    - -
    - - -RewriteRule -Defines rules for the rewriting engine -RewriteRule - Pattern Substitution -None -server configvirtual host -directory.htaccess -FileInfo - - -

    The RewriteRule directive is the real - rewriting workhorse. The directive can occur more than once. - Each directive then defines one single rewriting rule. The - definition order of these rules is - important, because this order is used when - applying the rules at run-time.

    - -

    Pattern can - be (for Apache 1.1.x a System V8 and for Apache 1.2.x and - later a POSIX) regular - expression which gets applied to the current URL. Here - ``current'' means the value of the URL when this rule gets - applied. This may not be the originally requested URL, - because any number of rules may already have matched and made - alterations to it.

    - -

    Some hints about the syntax of regular expressions:

    - - - - - -
    -
    -Text:
    -  .           Any single character
    -  [chars]     Character class: One  of chars
    -  [^chars]    Character class: None of chars
    -  text1|text2 Alternative: text1 or text2
    -
    -Quantifiers:
    -  ?           0 or 1 of the preceding text
    -  *           0 or N of the preceding text (N > 0)
    -  +           1 or N of the preceding text (N > 1)
    -
    -Grouping:
    -  (text)      Grouping of text
    -              (either to set the borders of an alternative or
    -              for making backreferences where the Nth group can 
    -              be used on the RHS of a RewriteRule with $N)
    -
    -Anchors:
    -  ^           Start of line anchor
    -  $           End   of line anchor
    -
    -Escaping:
    -  \char       escape that particular char
    -              (for instance to specify the chars ".[]()" etc.)
    -
    -
    - -

    For more information about regular expressions either have - a look at your local regex(3) manpage or its - src/regex/regex.3 copy in the Apache 1.3 - distribution. If you are interested in more detailed - information about regular expressions and their variants - (POSIX regex, Perl regex, etc.) have a look at the - following dedicated book on this topic:

    - -
    - Mastering Regular Expressions
    - Jeffrey E.F. Friedl
    - Nutshell Handbook Series
    - O'Reilly & Associates, Inc. 1997
    - ISBN 1-56592-257-3
    -
    - -

    Additionally in mod_rewrite the NOT character - ('!') is a possible pattern prefix. This gives - you the ability to negate a pattern; to say, for instance: - ``if the current URL does NOT match this - pattern''. This can be used for exceptional cases, where - it is easier to match the negative pattern, or as a last - default rule.

    - -Notice -When using the NOT character - to negate a pattern you cannot have grouped wildcard - parts in the pattern. This is impossible because when the - pattern does NOT match, there are no contents for the - groups. In consequence, if negated patterns are used, you - cannot use $N in the substitution - string! - - -

    Substitution of a - rewriting rule is the string which is substituted for (or - replaces) the original URL for which Pattern - matched. Beside plain text you can use

    - -
      -
    1. back-references $N to the RewriteRule - pattern
    2. - -
    3. back-references %N to the last matched - RewriteCond pattern
    4. - -
    5. server-variables as in rule condition test-strings - (%{VARNAME})
    6. - -
    7. mapping-function calls - (${mapname:key|default})
    8. -
    - Back-references are $N - (N=0..9) identifiers which will be replaced - by the contents of the Nth group of the - matched Pattern. The server-variables are the same - as for the TestString of a RewriteCond - directive. The mapping-functions come from the - RewriteMap directive and are explained there. - These three types of variables are expanded in the order of - the above list. - -

    As already mentioned above, all the rewriting rules are - applied to the Substitution (in the order of - definition in the config file). The URL is completely - replaced by the Substitution and the - rewriting process goes on until there are no more rules - unless explicitly terminated by a - L flag - see below.

    - -

    There is a special substitution string named - '-' which means: NO - substitution! Sounds silly? No, it is useful to - provide rewriting rules which only match - some URLs but do no substitution, e.g., in - conjunction with the C (chain) flag to be - able to have more than one pattern to be applied before a - substitution occurs.

    - -

    One more note: You can even create URLs in the - substitution string containing a query string part. Just use - a question mark inside the substitution string to indicate - that the following stuff should be re-injected into the - QUERY_STRING. When you want to erase an existing query - string, end the substitution string with just the question - mark.

    - -Note -There is a special feature: - When you prefix a substitution field with - http://thishost[:thisport] - then mod_rewrite automatically strips it - out. This auto-reduction on implicit external redirect - URLs is a useful and important feature when used in - combination with a mapping-function which generates the - hostname part. Have a look at the first example in the - example section below to understand this. - - -Remember - An unconditional external - redirect to your own server will not work with the prefix - http://thishost because of this feature. To - achieve such a self-redirect, you have to use the - R-flag (see below). - - -

    Additionally you can set special flags for - Substitution by appending

    - -
    - [flags] -
    - as the third argument to the RewriteRule - directive. Flags is a comma-separated list of the - following flags: - -
      -
    • - 'redirect|R - [=code]' (force redirect)
      - Prefix Substitution with - http://thishost[:thisport]/ (which makes the - new URL a URI) to force a external redirection. If no - code is given a HTTP response of 302 (MOVED - TEMPORARILY) is used. If you want to use other response - codes in the range 300-400 just specify them as a number - or use one of the following symbolic names: - temp (default), permanent, - seeother. Use it for rules which should - canonicalize the URL and give it back to the client, - e.g., translate ``/~'' into - ``/u/'' or always append a slash to - /u/user, etc.
      - - -

      Note: When you use this flag, make - sure that the substitution field is a valid URL! If not, - you are redirecting to an invalid location! And remember - that this flag itself only prefixes the URL with - http://thishost[:thisport]/, rewriting - continues. Usually you also want to stop and do the - redirection immediately. To stop the rewriting you also - have to provide the 'L' flag.

      -
    • - -
    • 'forbidden|F' (force URL - to be forbidden)
      - This forces the current URL to be forbidden, - i.e., it immediately sends back a HTTP response of - 403 (FORBIDDEN). Use this flag in conjunction with - appropriate RewriteConds to conditionally block some - URLs.
    • - -
    • 'gone|G' (force URL to be - gone)
      - This forces the current URL to be gone, i.e., it - immediately sends back a HTTP response of 410 (GONE). Use - this flag to mark pages which no longer exist as gone.
    • - -
    • - 'proxy|P' (force - proxy)
      - This flag forces the substitution part to be internally - forced as a proxy request and immediately (i.e., - rewriting rule processing stops here) put through the proxy module. You have to make - sure that the substitution string is a valid URI - (e.g., typically starting with - http://hostname) which can be - handled by the Apache proxy module. If not you get an - error from the proxy module. Use this flag to achieve a - more powerful implementation of the ProxyPass directive, - to map some remote stuff into the namespace of the local - server. - -

      Notice: To use this functionality make sure you have - the proxy module compiled into your Apache server - program. If you don't know please check whether - mod_proxy.c is part of the ``httpd - -l'' output. If yes, this functionality is - available to mod_rewrite. If not, then you first have to - rebuild the ``httpd'' program with mod_proxy - enabled.

      -
    • - -
    • 'last|L' - (last rule)
      - Stop the rewriting process here and don't apply any more - rewriting rules. This corresponds to the Perl - last command or the break command - from the C language. Use this flag to prevent the currently - rewritten URL from being rewritten further by following - rules. For example, use it to rewrite the root-path URL - ('/') to a real one, e.g., - '/e/www/'.
    • - -
    • 'next|N' - (next round)
      - Re-run the rewriting process (starting again with the - first rewriting rule). Here the URL to match is again not - the original URL but the URL from the last rewriting rule. - This corresponds to the Perl next command or - the continue command from the C language. Use - this flag to restart the rewriting process, i.e., - to immediately go to the top of the loop.
      - But be careful not to create an infinite - loop!
    • - -
    • 'chain|C' - (chained with next rule)
      - This flag chains the current rule with the next rule - (which itself can be chained with the following rule, - etc.). This has the following effect: if a rule - matches, then processing continues as usual, i.e., - the flag has no effect. If the rule does - not match, then all following chained - rules are skipped. For instance, use it to remove the - ``.www'' part inside a per-directory rule set - when you let an external redirect happen (where the - ``.www'' part should not to occur!).
    • - -
    • - 'type|T=MIME-type' - (force MIME type)
      - Force the MIME-type of the target file to be - MIME-type. For instance, this can be used to - simulate the mod_alias directive - ScriptAlias which internally forces all files - inside the mapped directory to have a MIME type of - ``application/x-httpd-cgi''.
    • - -
    • - 'nosubreq|NS' (used only if - no internal - sub-request)
      - This flag forces the rewriting engine to skip a - rewriting rule if the current request is an internal - sub-request. For instance, sub-requests occur internally - in Apache when mod_include tries to find out - information about possible directory default files - (index.xxx). On sub-requests it is not - always useful and even sometimes causes a failure to if - the complete set of rules are applied. Use this flag to - exclude some rules.
      - - -

      Use the following rule for your decision: whenever you - prefix some URLs with CGI-scripts to force them to be - processed by the CGI-script, the chance is high that you - will run into problems (or even overhead) on - sub-requests. In these cases, use this flag.

      -
    • - -
    • 'nocase|NC' - (no case)
      - This makes the Pattern case-insensitive, - i.e., there is no difference between 'A-Z' and - 'a-z' when Pattern is matched against the current - URL.
    • - -
    • 'qsappend|QSA' - (query string - append)
      - This flag forces the rewriting engine to append a query - string part in the substitution string to the existing one - instead of replacing it. Use this when you want to add more - data to the query string via a rewrite rule.
    • - -
    • - 'noescape|NE' - (no URI escaping of - output)
      - This flag keeps mod_rewrite from applying the usual URI - escaping rules to the result of a rewrite. Ordinarily, - special characters (such as '%', '$', ';', and so on) - will be escaped into their hexcode equivalents ('%25', - '%24', and '%3B', respectively); this flag prevents this - from being done. This allows percent symbols to appear in - the output, as in - - RewriteRule /foo/(.*) /bar?arg=P1\%3d$1 [R,NE] - - - which would turn '/foo/zed' into a safe - request for '/bar?arg=P1=zed'. -
    • - -
    • - 'passthrough|PT' - (pass through to next - handler)
      - This flag forces the rewriting engine to set the - uri field of the internal - request_rec structure to the value of the - filename field. This flag is just a hack to - be able to post-process the output of - RewriteRule directives by - Alias, ScriptAlias, - Redirect, etc. directives from - other URI-to-filename translators. A trivial example to - show the semantics: If you want to rewrite - /abc to /def via the rewriting - engine of mod_rewrite and then - /def to /ghi with - mod_alias: - - RewriteRule ^/abc(.*) /def$1 [PT]
      - Alias /def /ghi -
      - If you omit the PT flag then - mod_rewrite will do its job fine, - i.e., it rewrites uri=/abc/... to - filename=/def/... as a full API-compliant - URI-to-filename translator should do. Then - mod_alias comes and tries to do a - URI-to-filename transition which will not work. - -

      Note: You have to use this flag if you want to - intermix directives of different modules which contain - URL-to-filename translators. The typical example - is the use of mod_alias and - mod_rewrite..

      - -For Apache hackers - If the current Apache API had a filename-to-filename - hook additionally to the URI-to-filename hook then we - wouldn't need this flag! But without such a hook this - flag is the only solution. The Apache Group has - discussed this problem and will add such a hook in - Apache version 2.0. - -
    • - -
    • 'skip|S=num' - (skip next rule(s))
      - This flag forces the rewriting engine to skip the next - num rules in sequence when the current rule - matches. Use this to make pseudo if-then-else constructs: - The last rule of the then-clause becomes - skip=N where N is the number of rules in the - else-clause. (This is not the same as the - 'chain|C' flag!)
    • - -
    • - 'env|E=VAR:VAL' - (set environment variable)
      - This forces an environment variable named VAR to - be set to the value VAL, where VAL can - contain regexp backreferences $N and - %N which will be expanded. You can use this - flag more than once to set more than one variable. The - variables can be later dereferenced in many situations, but - usually from within XSSI (via <!--#echo - var="VAR"-->) or CGI (e.g. - $ENV{'VAR'}). Additionally you can dereference - it in a following RewriteCond pattern via - %{ENV:VAR}. Use this to strip but remember - information from URLs.
    • -
    - -Note Never forget that Pattern is -applied to a complete URL in per-server configuration -files. But in per-directory configuration files, the -per-directory prefix (which always is the same for a specific -directory!) is automatically removed for the pattern matching -and automatically added after the substitution has been -done. This feature is essential for many sorts of rewriting, -because without this prefix stripping you have to match the parent -directory which is not always possible. - -

    There is one exception: If a substitution string - starts with ``http://'' then the directory - prefix will not be added and an - external redirect or proxy throughput (if flag - P is used!) is forced!

    -
    - -Note - To enable the rewriting engine - for per-directory configuration files you need to set - ``RewriteEngine On'' in these files - and ``Options - FollowSymLinks'' must be enabled. If your - administrator has disabled override of - FollowSymLinks for a user's directory, then - you cannot use the rewriting engine. This restriction is - needed for security reasons. - - -

    Here are all possible substitution combinations and their - meanings:

    - -

    Inside per-server configuration - (httpd.conf)
    - for request ``GET - /somepath/pathinfo'':

    -

    - - - - - -
    -
    -Given Rule                                      Resulting Substitution
    -----------------------------------------------  ----------------------------------
    -^/somepath(.*) otherpath$1                      not supported, because invalid!
    -
    -^/somepath(.*) otherpath$1  [R]                 not supported, because invalid!
    -
    -^/somepath(.*) otherpath$1  [P]                 not supported, because invalid!
    -----------------------------------------------  ----------------------------------
    -^/somepath(.*) /otherpath$1                     /otherpath/pathinfo
    -
    -^/somepath(.*) /otherpath$1 [R]                 http://thishost/otherpath/pathinfo
    -                                                via external redirection
    -
    -^/somepath(.*) /otherpath$1 [P]                 not supported, because silly!
    -----------------------------------------------  ----------------------------------
    -^/somepath(.*) http://thishost/otherpath$1      /otherpath/pathinfo
    -
    -^/somepath(.*) http://thishost/otherpath$1 [R]  http://thishost/otherpath/pathinfo
    -                                                via external redirection
    -
    -^/somepath(.*) http://thishost/otherpath$1 [P]  not supported, because silly!
    -----------------------------------------------  ----------------------------------
    -^/somepath(.*) http://otherhost/otherpath$1     http://otherhost/otherpath/pathinfo
    -                                                via external redirection
    -
    -^/somepath(.*) http://otherhost/otherpath$1 [R] http://otherhost/otherpath/pathinfo
    -                                                via external redirection
    -                                                (the [R] flag is redundant)
    -
    -^/somepath(.*) http://otherhost/otherpath$1 [P] http://otherhost/otherpath/pathinfo
    -                                                via internal proxy
    -
    -
    - -

    Inside per-directory configuration for - /somepath
    - (i.e., file .htaccess in dir - /physical/path/to/somepath containing - RewriteBase /somepath)
    - for request ``GET - /somepath/localpath/pathinfo'':

    -

    - - - - - -
    -
    -Given Rule                                      Resulting Substitution
    -----------------------------------------------  ----------------------------------
    -^localpath(.*) otherpath$1                      /somepath/otherpath/pathinfo
    -
    -^localpath(.*) otherpath$1  [R]                 http://thishost/somepath/otherpath/pathinfo
    -                                                via external redirection
    -
    -^localpath(.*) otherpath$1  [P]                 not supported, because silly!
    -----------------------------------------------  ----------------------------------
    -^localpath(.*) /otherpath$1                     /otherpath/pathinfo
    -
    -^localpath(.*) /otherpath$1 [R]                 http://thishost/otherpath/pathinfo
    -                                                via external redirection
    -
    -^localpath(.*) /otherpath$1 [P]                 not supported, because silly!
    -----------------------------------------------  ----------------------------------
    -^localpath(.*) http://thishost/otherpath$1      /otherpath/pathinfo
    -
    -^localpath(.*) http://thishost/otherpath$1 [R]  http://thishost/otherpath/pathinfo
    -                                                via external redirection
    -
    -^localpath(.*) http://thishost/otherpath$1 [P]  not supported, because silly!
    -----------------------------------------------  ----------------------------------
    -^localpath(.*) http://otherhost/otherpath$1     http://otherhost/otherpath/pathinfo
    -                                                via external redirection
    -
    -^localpath(.*) http://otherhost/otherpath$1 [R] http://otherhost/otherpath/pathinfo
    -                                                via external redirection
    -                                                (the [R] flag is redundant)
    -
    -^localpath(.*) http://otherhost/otherpath$1 [P] http://otherhost/otherpath/pathinfo
    -                                                via internal proxy
    -
    -
    - -

    Example:

    - -

    We want to rewrite URLs of the form

    - -
    - / Language /~ - Realname /.../ File -
    - into - -
    - /u/ Username /.../ - File . Language -
    - -

    We take the rewrite mapfile from above and save it under - /path/to/file/map.txt. Then we only have to - add the following lines to the Apache server configuration - file:

    - - -
    -RewriteLog   /path/to/file/rewrite.log
    -RewriteMap   real-to-user               txt:/path/to/file/map.txt
    -RewriteRule  ^/([^/]+)/~([^/]+)/(.*)$   /u/${real-to-user:$2|nobody}/$3.$1
    -
    -
    - -
    -
    - -
    - diff --git a/docs/manual/mod/mod_setenvif.html b/docs/manual/mod/mod_setenvif.html deleted file mode 100644 index d089fa37dbaa1b33e1266433a94267b56bacfa8f..0000000000000000000000000000000000000000 --- a/docs/manual/mod/mod_setenvif.html +++ /dev/null @@ -1,275 +0,0 @@ - - - - Apache module mod_setenvif - - - - -

    Module mod_setenvif

    -

    - This module is contained in the mod_setenvif.c file, and - is compiled in by default. It provides for - the ability to set environment variables based upon attributes of the - request. -

    -

    Summary

    -

    - The mod_setenvif module allows you to set environment - variables according to whether different aspects of the request match - regular expressions you specify. These envariables can be used by - other parts of the server to make decisions about actions to be taken. -

    -

    Directives

    - - -
    -

    The BrowserMatch Directive

    -

    - Syntax: BrowserMatch regex envar[=value] [...] -
    - Default: none -
    - Context: server config -
    - Override: none -
    - Status: Base -
    - Module: mod_setenvif -
    - Compatibility: Apache 1.2 and above -

    -

    - The BrowserMatch directive defines environment variables based on the - User-Agent HTTP request header field. The first argument - should be a POSIX.2 extended regular expression (similar to an - egrep-style regex). The rest of the arguments give the - names of variables to set, and optionally values to which they should - be set. These take the form of -

    -
      -
    1. varname, or -
    2. -
    3. !varname, or -
    4. -
    5. varname=value -
    6. -
    -

    - In the first form, the value will be set to "1". The second - will remove the given variable if already defined, and the third will - set the variable to the value given by value. If a - User-Agent string matches more than one entry, they will - be merged. Entries are processed in the order in which they appear, - and later entries can override earlier ones. -

    -

    - For example: -

    -
    -    BrowserMatch ^Mozilla forms jpeg=yes browser=netscape
    -    BrowserMatch "^Mozilla/[2-3]" tables agif frames javascript
    -    BrowserMatch MSIE !javascript
    -  
    -

    - Note that the regular expression string is - case-sensitive. For cane-INsensitive matching, see - the - BrowserMatchNoCase - directive. -

    -

    - The BrowserMatch and BrowserMatchNoCase - directives are special cases of the - SetEnvIf - and - SetEnvIfNoCase - directives. The following two lines have the same effect: -

    -
    -   BrowserMatchNoCase Robot is_a_robot
    -   SetEnvIfNoCase User-Agent Robot is_a_robot
    -  
    - -
    -

    - - The BrowserMatchNoCase Directive - -

    -

    - Syntax: BrowserMatchNoCase regex envar[=value] [...] -
    - Default: none -
    - Context: server config -
    - Override: none -
    - Status: Base -
    - Module: mod_setenvif -
    - Compatibility: Apache 1.2 and above -

    -

    - The BrowserMatchNoCase directive is semantically identical to - the - BrowserMatch - directive. However, it provides for case-insensitive matching. For - example: -

    -
    -    BrowserMatchNoCase mac platform=macintosh
    -    BrowserMatchNoCase win platform=windows
    -  
    -

    - The BrowserMatch and BrowserMatchNoCase - directives are special cases of the - SetEnvIf - and - SetEnvIfNoCase - directives. The following two lines have the same effect: -

    -
    -   BrowserMatchNoCase Robot is_a_robot
    -   SetEnvIfNoCase User-Agent Robot is_a_robot
    -  
    - -
    -

    - - The SetEnvIf Directive - -

    -

    - Syntax: SetEnvIf attribute regex envar[=value] [...] -
    - Default: none -
    - Context: server config -
    - Override: none -
    - Status: Base -
    - Module: mod_setenvif -
    - Compatibility: Apache 1.3 and above -

    -

    - The SetEnvIf directive defines environment variables - based on attributes of the request. These attributes can be the - values of various HTTP request header fields (see - RFC2068 - for more information about these), or of other aspects of the request, - including the following: -

    -
      -
    • Remote_Host - the hostname (if available) of the - client making the request -
    • -
    • Remote_Addr - the IP address of the client making - the request -
    • -
    • Remote_User - the authenticated username (if - available) -
    • -
    • Request_Method - the name of the method being used - (GET, POST, et cetera) -
    • -
    • Request_URI - the portion of the URL following the - scheme and host portion -
    • -
    -

    - Some of the more commonly used request header field names include - Host, User-Agent, and Referer. -

    -

    - Example: -

    -
    -   SetEnvIf Request_URI "\.(gif)|(jpg)|(xbm)$" object_is_image
    -   SetEnvIf Referer www\.mydomain\.com intra_site_referral
    -  
    -

    - The first will set the envariable object_is_image if the - request was for an image file, and the second sets - intra_site_referral if the referring page was somewhere - on the www.mydomain.com Web site. -

    - -
    -

    - - The SetEnvIfNoCase Directive - -

    -

    - Syntax: SetEnvIfNoCase - attribute regex envar[=value] [...] -
    - Default: none -
    - Context: server config -
    - Override: none -
    - Status: Base -
    - Module: mod_setenvif -
    - Compatibility: Apache 1.3 and above -

    -

    - The SetEnvIfNoCase is semantically identical to the - SetEnvIf - directive, and differs only in that the regular expression matching is - performed in a case-insensitive manner. For example: -

    -
    -   SetEnvIfNoCase Host Apache\.Org site=apache
    -  
    -

    - This will cause the site envariable to be set to - "apache" if the HTTP request header field - Host: was included and contained Apache.Org, - apache.org, or any other combination. -

    - - - - diff --git a/docs/manual/mod/mod_setenvif.xml b/docs/manual/mod/mod_setenvif.xml deleted file mode 100644 index 41bc4ddb04d110a95ee242755634fd0e00615a3e..0000000000000000000000000000000000000000 --- a/docs/manual/mod/mod_setenvif.xml +++ /dev/null @@ -1,258 +0,0 @@ - - - - -mod_setenvif -Base -setenvif_module -mod_setenvif.c -Available in Apache 1.3 and later - -Allows the setting of environment variables based -on characteristics of the request - - - -

    The mod_setenvif module allows you to set - environment variables according to whether different aspects of - the request match regular expressions you specify. These - environment variables can be used by other parts of the server - to make decisions about actions to be taken.

    - -

    The directives are considered in the order they appear in - the configuration files. So more complex sequences can be used, - such as this example, which sets netscape if the - browser is mozilla but not MSIE.

    - - - BrowserMatch ^Mozilla netscape
    - BrowserMatch MSIE !netscape
    -
    -
    - -Environment Variables in Apache - - -BrowserMatch -Sets environment variables conditional on HTTP User-Agent - -BrowserMatch regex env-variable[=value] -[env-variable[=value]] ... -none -server config, virtual host, directory, .htaccess -FileInfo -Apache 1.2 and - above (in Apache 1.2 this directive was found in the - now-obsolete mod_browser module) - - -

    The BrowserMatch directive defines - environment variables based on the User-Agent HTTP - request header field. The first argument should be a POSIX.2 - extended regular expression (similar to an - egrep-style regex). The rest of the arguments give - the names of variables to set, and optionally values to which they - should be set. These take the form of

    - -
      -
    1. varname, or
    2. - -
    3. !varname, or
    4. - -
    5. varname=value
    6. -
    - -

    In the first form, the value will be set to "1". The second - will remove the given variable if already defined, and the - third will set the variable to the value given by - value. If a User-Agent - string matches more than one entry, they will be merged. - Entries are processed in the order in which they appear, and - later entries can override earlier ones.

    - -

    For example:

    - - BrowserMatch ^Mozilla forms jpeg=yes browser=netscape
    - BrowserMatch "^Mozilla/[2-3]" tables agif frames javascript
    - BrowserMatch MSIE !javascript
    -
    - -

    Note that the regular expression string is - case-sensitive. For case-INsensitive matching, - see the BrowserMatchNoCase - directive.

    - -

    The BrowserMatch and - BrowserMatchNoCase directives are special cases of - the SetEnvIf and SetEnvIfNoCase - directives. The following two lines have the same effect:

    - - BrowserMatchNoCase Robot is_a_robot
    - SetEnvIfNoCase User-Agent Robot is_a_robot
    -
    -
    -
    - - -BrowserMatchNoCase -Sets environment variables conditional on User-Agent without -respect to case -BrowserMatchNoCase regex env-variable[=value] - [env-variable[=value]] ... -none -server config, virtual host, directory, .htaccess -FileInfo -Apache 1.2 and - above (in Apache 1.2 this directive was found in the - now-obsolete mod_browser module) - - - -

    The BrowserMatchNoCase directive is - semantically identical to the BrowserMatch directive. - However, it provides for case-insensitive matching. For - example:

    - - BrowserMatchNoCase mac platform=macintosh
    - BrowserMatchNoCase win platform=windows
    -
    - -

    The BrowserMatch and - BrowserMatchNoCase directives are special cases of - the SetEnvIf and SetEnvIfNoCase - directives. The following two lines have the same effect:

    - - BrowserMatchNoCase Robot is_a_robot
    - SetEnvIfNoCase User-Agent Robot is_a_robot
    -
    -
    -
    - - -SetEnvIf -Sets environment variables based on attributes of the request - -SetEnvIf attribute - regex env-variable[=value] - [env-variable[=value]] ... -none - server config, virtual host, directory, .htaccess -FileInfo -Apache 1.3 and - above; the Request_Protocol keyword and environment-variable - matching are only available with 1.3.7 and later - - -

    The SetEnvIf directive defines environment - variables based on attributes of the request. These attributes - can be the values of various HTTP request header fields (see RFC2616 - for more information about these), or of other aspects of the - request, including the following:

    - -
      -
    • Remote_Host - the hostname (if available) of - the client making the request
    • - -
    • Remote_Addr - the IP address of the client - making the request
    • - -
    • Remote_User - the authenticated username (if - available)
    • - -
    • Request_Method - the name of the method - being used (GET, POST, et - cetera)
    • - -
    • Request_Protocol - the name and version of - the protocol with which the request was made (e.g., - "HTTP/0.9", "HTTP/1.1", etc.)
    • - -
    • Request_URI - the portion of the URL - following the scheme and host portion
    • -
    - -

    Some of the more commonly used request header field names - include Host, User-Agent, and - Referer.

    - -

    If the attribute name doesn't match any of the - special keywords, nor any of the request's header field names, - it is tested as the name of an environment variable in the list - of those associated with the request. This allows - SetEnvIf directives to test against the result of - prior matches.

    - - - Only those environment variables defined by earlier - SetEnvIf[NoCase] directives are available for - testing in this manner. 'Earlier' means that they were - defined at a broader scope (such as server-wide) or - previously in the current directive's scope. - - -

    attribute may be a regular expression when used to - match a request header. If attribute is a regular - expression and it doesn't match any of the request's header - names, then attribute is not tested against the - request's environment variable list.

    - - -Example: - SetEnvIf Request_URI "\.gif$" object_is_image=gif
    - SetEnvIf Request_URI "\.jpg$" object_is_image=jpg
    - SetEnvIf Request_URI "\.xbm$" object_is_image=xbm
    - :
    - SetEnvIf Referer www\.mydomain\.com intra_site_referral
    - :
    - SetEnvIf object_is_image xbm XBIT_PROCESSING=1
    - :
    - SetEnvIf ^TS* ^[a-z].* HAVE_TS
    -
    - -

    The first three will set the environment variable - object_is_image if the request was for an image - file, and the fourth sets intra_site_referral if - the referring page was somewhere on the - www.mydomain.com Web site.

    - -

    The last example will set environment variable - HAVE_TS if the request contains any headers that - begin with "TS" whose values begins with any character in the - set [a-z].

    -
    -
    - - -SetEnvIfNoCase -Sets environment variables based on attributes of the request -without respect to case -SetEnvIfNoCase attribute regex env-variable[=value] - [env-variable[=value]] ... -none -server config, virtual host, directory, .htaccess -FileInfo -Apache 1.3 and above - - - -

    The SetEnvIfNoCase is semantically identical to - the SetEnvIf directive, - and differs only in that the regular expression matching is - performed in a case-insensitive manner. For example:

    - - SetEnvIfNoCase Host Apache\.Org site=apache - - -

    This will cause the site environment variable - to be set to "apache" if the HTTP request header - field Host: was included and contained - Apache.Org, apache.org, or any other - combination.

    -
    -
    -
    \ No newline at end of file diff --git a/docs/manual/mod/mod_so.html b/docs/manual/mod/mod_so.html deleted file mode 100644 index 9ceefee7d12f701fe747b7ff4875d2d15a04cfb9..0000000000000000000000000000000000000000 --- a/docs/manual/mod/mod_so.html +++ /dev/null @@ -1,95 +0,0 @@ - - - -Apache module mod_so - - - - - -

    Module mod_so

    - -This module is contained in the mod_so.c file, and is not -compiled in by default. It provides for loading of executable code and -modules into the server at start-up time, on Unix systems. Win32 -systems use mod_dll instead. This module is -only available in Apache 1.3 and up. - -

    Summary

    - -This is an experimental module. On selected operating systems it can -be used to load modules into Apache at runtime, rather than requiring -a recompilation. - - -

    Directives

    - -
    - - -

    LoadFile

    - -Syntax: LoadFile filename filename ...
    -Context: server config
    -Status: Experimental
    -Module: mod_so

    - -The LoadFile directive links in the named object files or libraries when -the server is started; this is used to load additional code which -may be required for some module to work. Filename is relative -to ServerRoot.


    - -

    LoadModule

    - -Syntax: LoadModule module filename
    -Context: server config
    -Status: Experimental
    -Module: mod_so

    - -The LoadModule directive links in the object file or library filename -and adds the module structure named module to the list of active -modules. Module is the name of the external variable of type -module in the file. Example: -

    -LoadModule status_module modules/mod_status.so -
    -loads the module in the modules subdirectory of the ServerRoot.

    - - - - - - diff --git a/docs/manual/mod/mod_so.xml b/docs/manual/mod/mod_so.xml deleted file mode 100755 index 2c510b9249443c3b740c103f742f43f9ffae3713..0000000000000000000000000000000000000000 --- a/docs/manual/mod/mod_so.xml +++ /dev/null @@ -1,157 +0,0 @@ - - - - -mod_so -Base (Windows>; Optional (Unix) -so_module -mod_so.c -Available in Apache 1.3 and later. - - -This module provides for loading of executable code and -modules into the server at start-up or restart time. - -

    - -

    On selected operating systems this module can be used to - load modules into Apache at runtime via the Dynamic Shared Object (DSO) mechanism, - rather than requiring a recompilation.

    - -

    On Unix, the loaded code typically comes from shared object - files (usually with .so extension), on Windows - this may either the .so or .dll - extension. This module is only available in Apache 1.3 and - up.

    - -

    In previous releases, the functionality of this module was - provided for Unix by mod_dld, and for Windows by mod_dll. On - Windows, mod_dll was used in beta release 1.3b1 through 1.3b5. - mod_so combines these two modules into a single module for all - operating systems.

    - -

    Warning: Apache 1.3 modules cannot be directly used - with Apache 2.0 - the module must be modified to dynamically - load or compile into Apache 2.0.

    -
    - -
    Creating Loadable Modules -for Windows - -

    Note: the module name format changed for Windows - with Apache 1.3.15 and 2.0 - the modules are now named as - mod_foo.so. While mod_so still loads modules with - ApacheModuleFoo.dll names, the new naming convention is - preferred; if you are converting your loadable module for 2.0, - please fix the name to this 2.0 convention.

    - -

    The Apache module API is unchanged between the Unix and - Windows versions. Many modules will run on Windows with no or - little change from Unix, although others rely on aspects of the - Unix architecture which are not present in Windows, and will - not work.

    - -

    When a module does work, it can be added to the server in - one of two ways. As with Unix, it can be compiled into the - server. Because Apache for Windows does not have the - Configure program of Apache for Unix, the module's - source file must be added to the ApacheCore project file, and - its symbols must be added to the - os\win32\modules.c file.

    - -

    The second way is to compile the module as a DLL, a shared - library that can be loaded into the server at runtime, using - the LoadModule - directive. These module DLLs can be distributed and run on any - Apache for Windows installation, without recompilation of the - server.

    - -

    To create a module DLL, a small change is necessary to the - module's source file: The module record must be exported from - the DLL (which will be created later; see below). To do this, - add the AP_MODULE_DECLARE_DATA (defined in the - Apache header files) to your module's module record definition. - For example, if your module has:

    - - - module foo_module; - - -

    Replace the above with:

    - - module AP_MODULE_DECLARE_DATA foo_module; - - -

    Note that this will only be activated on Windows, so the - module can continue to be used, unchanged, with Unix if needed. - Also, if you are familiar with .DEF files, you can - export the module record with that method instead.

    - -

    Now, create a DLL containing your module. You will need to - link this against the libhttpd.lib export library that is - created when the libhttpd.dll shared library is compiled. You - may also have to change the compiler settings to ensure that - the Apache header files are correctly located. You can find - this library in your server root's modules directory. It is - best to grab an existing module .dsp file from the tree to - assure the build environment is configured correctly, or - alternately compare the compiler and link options to your - .dsp.

    - -

    This should create a DLL version of your module. Now simply - place it in the modules directory of your server - root, and use the LoadModule - directive to load it.

    - -
    - - -LoadFile -LoadFile filename [filename] ... -none - -server config - -Link in the named object file or library - - - -

    The LoadFile directive links in the named object files or - libraries when the server is started or restarted; this is used - to load additional code which may be required for some module - to work. Filename is either an absolute path or - relative to ServerRoot.

    -
    -
    - - -LoadModule -LoadModule module filename -none - -server config - -Links in the object file or library, and adds to the list -of active modules - - -

    The LoadModule directive links in the object file or library - filename and adds the module structure named - module to the list of active modules. Module - is the name of the external variable of type - module in the file, and is listed as the Module Identifier - in the module documentation. Example:

    - - - LoadModule status_module modules/mod_status.so - - -

    loads the named module from the modules subdirectory of the - ServerRoot.

    -
    - -
    - - diff --git a/docs/manual/mod/mod_speling.html b/docs/manual/mod/mod_speling.html deleted file mode 100644 index 2db6c4773a93d8dfee821f72aeb6b770c82d4e81..0000000000000000000000000000000000000000 --- a/docs/manual/mod/mod_speling.html +++ /dev/null @@ -1,88 +0,0 @@ - - - - Apache module mod_speling - - - - -

    Module mod_speling

    -

    - This module is contained in the mod_speling.c file, - and is not compiled in by default. - It attemps to correct mispellings of - URLs that users might have entered, by ignoring capitalization - and by allowing up to one misspelling.
    - This catches the majority of misspelled requests. An automatic - "spelling corrected" redirection is returned if only one matching - document was found, and a list of matches is returned if more than - one document with a sufficiently similar name is found. -

    - -

    Summary

    -

    - Requests to documents sometimes cannot be served by the core apache - server because the request was misspelled or miscapitalized. This - module addresses this problem by trying to find a matching document, - even after all other modules gave up. It does its work by comparing - each document name in the requested directory against the requested - document name without regard to case, and allowing - up to one misspelling (character insertion / omission - / transposition or wrong character). A list is built with all document - names which were matched using this strategy. -

    -

    - If, after scanning the directory, -

      -
    • no matching document was found, Apache will proceed as usual - and return a "document not found" error. -
    • only one document is found that "almost" matches the request, - then it is returned in the form of a redirection response. -
    • more than one document with a close match was found, then - the list of the matches is returned to the client, and the client - can select the correct candidate. -
    -

    - -

    Directives

    - - -
  • CheckSpelling -
  • - -
    -

    CheckSpelling

    - - Syntax: CheckSpelling on/off
    - Default: CheckSpelling Off
    - Context: server config, virtual host
    - Status: Base
    - Module: mod_speling
    - Compatibility: CheckSpelling was available as a separately - available module for Apache 1.1, but was limited to miscapitalizations. - As of Apache 1.3, it is part of the apache distribution.

    - - This directive enables or disables the spelling module. When enabled, - keep in mind that -

      -
    • the directory scan which is necessary for the spelling - correction will have an impact on the server's performance - when many spelling corrections have to be performed at the same time. -
    • the document trees should not contain sensitive files which could - be matched inadvertedly, by a spelling "correction". -
    • the module is unable to correct misspelled user names - (as in http://my.host/~apahce/), just file names or - directory names. -
    - - - - - diff --git a/docs/manual/mod/mod_speling.xml b/docs/manual/mod/mod_speling.xml deleted file mode 100755 index dd6df25b746695666f57231bc5dd49373b8dd49d..0000000000000000000000000000000000000000 --- a/docs/manual/mod/mod_speling.xml +++ /dev/null @@ -1,96 +0,0 @@ - - - - -mod_speling -Extension -speling_module -mod_speling.c -Available in Apache 1.3 and later. Available as -an External module in Apache 1.1 and later. - -This module attempts to correct misspellings of URLs that -users might have entered, by ignoring capitalization and by -allowing up to one misspelling. - - - -

    Requests to documents sometimes cannot be served by the core - apache server because the request was misspelled or - miscapitalized. This module addresses this problem by trying to - find a matching document, even after all other modules gave up. - It does its work by comparing each document name in the - requested directory against the requested document name - without regard to case, and allowing - up to one misspelling (character insertion / - omission / transposition or wrong character). A list is built - with all document names which were matched using this - strategy.

    - -

    If, after scanning the directory,

    - -
      -
    • no matching document was found, Apache will proceed as - usual and return a "document not found" error.
    • - -
    • only one document is found that "almost" matches the - request, then it is returned in the form of a redirection - response.
    • - -
    • more than one document with a close match was found, then - the list of the matches is returned to the client, and the - client can select the correct candidate.
    • -
    - -
    - - - -CheckSpelling -CheckSpelling on|off -CheckSpelling Off - -server config -virtual host -directory -.htaccess - -Options -CheckSpelling was available as a separately available -module for Apache 1.1, but was limited to miscapitalizations. As -of Apache 1.3, it is part of the Apache distribution. Prior to Apache -1.3.2, the CheckSpelling directive was only available in the -"server" and "virtual host" contexts. -This directive enables or disables the spelling -module. - - - -

    This directive enables or disables the spelling module. When - enabled, keep in mind that

    - -
      -
    • the directory scan which is necessary for the spelling - correction will have an impact on the server's performance - when many spelling corrections have to be performed at the - same time.
    • - -
    • the document trees should not contain sensitive files - which could be matched inadvertently by a spelling - "correction".
    • - -
    • the module is unable to correct misspelled user names (as - in http://my.host/~apahce/), just file names or - directory names.
    • - -
    • spelling corrections apply strictly to existing files, so - a request for the <Location /status> may - get incorrectly treated as the negotiated file - "/stats.html".
    • -
    -
    - -
    - -
    - diff --git a/docs/manual/mod/mod_ssl.html b/docs/manual/mod/mod_ssl.html deleted file mode 100644 index f7ecb633ffe4dd85b3ff57da0f01ea79834f96e8..0000000000000000000000000000000000000000 --- a/docs/manual/mod/mod_ssl.html +++ /dev/null @@ -1,2539 +0,0 @@ - - -mod_ssl: Reference - - - - - - - - - - -
    - - - - -
    -
    - - - - - - - - - - - - - -
    - - - - - -
    - mod_ssl - - Chapter 3 -
    -
    - - - - - -
    -previous page
    Introduction -
    -next page
    Compatibility -
    -
    -
    - Reference -
    -
    - - - - - - - -
    - -``Try to understand everything, -but believe nothing!'' - -
    - -Unknown - -
    -
    -

    - - - - - - -
    -T -his chapter provides a reference to all configuration directives and -additional user visible features mod_ssl provides. It's intended as the -official resource when you want to know how a particilar mod_ssl functionality -is actually configured or activated. Each directive is documented similar to -the way standard Apache directives are documented in the official Apache -documentation set, i.e. for each directive especially the syntax, default and -context where applicable is given. -

    -Notice that there are three major classes of directives which are used by -mod_ssl: First Global Directives (i.e. directives with context -``server config''), which can occur inside the server config files but only -outside of any sectioning commands like <VirtualHost>. Second -Per-Server Directives (i.e. those with context ``server config, -virtual host''), which can occur inside the server config files both outside -(for the main/default server) and inside <VirtualHost> sections. -

    -   - -
    - - - - - - - -
    - -Table Of Contents - -
    - -Configuration Directives
    -        SSLPassPhraseDialog
    -        SSLMutex
    -        SSLRandomSeed
    -        SSLSessionCache
    -        SSLSessionCacheTimeout
    -        SSLEngine
    -        SSLProtocol
    -        SSLCipherSuite
    -        SSLCertificateFile
    -        SSLCertificateKeyFile
    -        SSLCertificateChainFile
    -        SSLCACertificatePath
    -        SSLCACertificateFile
    -        SSLCARevocationPath
    -        SSLCARevocationFile
    -        SSLVerifyClient
    -        SSLVerifyDepth
    -        SSLLog
    -        SSLLogLevel
    -        SSLOptions
    -        SSLRequireSSL
    -        SSLRequire
    -Additional Features
    -        Environment Variables
    -        Custom Log Formats
    -
    -
    -
    -
    -

    -And third Per-Directory Directives (i.e. those with context ``server -config, virtual host, directory, .htaccess''), which can pretty much occur -everywhere. Especially both inside the server config files and the -per-directory .htaccess files. The three classes are subsets of -each other, i.e. directives from the per-directory class can also be used in -the per-server and global context, and directives from the per-server class -can also be used the in the global context. -

    -Additional directives and environment variables provided by mod_ssl (via -on-the-fly mapping) for backward compatiblity to other Apache SSL solutions -are documented in the Compatibility chapter. -

    Configuration Directives

    -The most visible and error-prone things of mod_ssl are its configuration -directives. So we document them in great detail here to assist you in setting -up the best possible configuration of your SSL-aware webserver. - -

    -
    - -

    SSLPassPhraseDialog

    -

    - - - - -
    - - - - -
    - - - - - - - - - - -
    -Name: SSLPassPhraseDialog
    -Description: Type of pass phrase dialog for encrypted private keys
    Syntax: SSLPassPhraseDialog type
    Default: SSLPassPhraseDialog builtin
    Context: server config
    Override: Not applicable
    Status: Extension
    Module: mod_ssl
    Compatibility: mod_ssl 2.1
    -
    -
    -

    -When Apache starts up it has to read the various Certificate (see SSLCertificateFile) and Private Key (see SSLCertificateKeyFile) files of the -SSL-enabled virtual servers. Because for security reasons the Private Key -files are usually encrypted, mod_ssl needs to query the administrator for a -Pass Phrase in order to decrypt those files. This query can be done in two ways -which can be configured by type: -

      -
    • builtin -

      - This is the default where an interactive terminal dialog occurs at startup - time just before Apache detaches from the terminal. Here the administrator - has to manually enter the Pass Phrase for each encrypted Private Key file. - Because a lot of SSL-enabled virtual hosts can be configured, the - following reuse-scheme is used to minimize the dialog: When a Private Key - file is encrypted, all known Pass Phrases (at the beginning there are - none, of course) are tried. If one of those known Pass Phrases succeeds no - dialog pops up for this particular Private Key file. If none succeeded, - another Pass Phrase is queried on the terminal and remembered for the next - round (where it perhaps can be reused). -

      - This scheme allows mod_ssl to be maximally flexible (because for N encrypted - Private Key files you can use N different Pass Phrases - but then - you have to enter all of them, of course) while minimizing the terminal - dialog (i.e. when you use a single Pass Phrase for all N Private Key files - this Pass Phrase is queried only once). -

      -

    • exec:/path/to/program -

      - Here an external program is configured which is called at startup for each - encrypted Private Key file. It is called with two arguments (the first is - of the form ``servername:portnumber'', the second is either - ``RSA'' or ``DSA''), which indicate for which - server and algorithm it has to print the corresponding Pass Phrase to - stdout. The intent is that this external program first runs - security checks to make sure that the system is not compromised by an - attacker, and only when these checks were passed successfully it provides - the Pass Phrase. -

      - Both these security checks, and the way the Pass Phrase is determined, can - be as complex as you like. Mod_ssl just defines the interface: an - executable program which provides the Pass Phrase on stdout. - Nothing more or less! So, if you're really paranoid about security, here - is your interface. Anything else has to be left as an exercise to the - administrator, because local security requirements are so different. -

      - The reuse-algorithm above is used here, too. In other words: The external - program is called only once per unique Pass Phrase. -

    -

    -Example: -

    -
    -SSLPassPhraseDialog exec:/usr/local/apache/sbin/pp-filter
    -
    -
    - -

    -
    - -

    SSLMutex

    -

    - - - - -
    - - - - -
    - - - - - - - - - - -
    -Name: SSLMutex
    -Description: Semaphore for internal mutual exclusion of operations
    Syntax: SSLMutex type
    Default: SSLMutex none
    Context: server config
    Override: Not applicable
    Status: Extension
    Module: mod_ssl
    Compatibility: mod_ssl 2.1
    -
    -
    -

    -This configures the SSL engine's semaphore (aka. lock) which is used for mutual -exclusion of operations which have to be done in a synchronized way between the -pre-forked Apache server processes. This directive can only be used in the -global server context because it's only useful to have one global mutex. -

    -The following Mutex types are available: -

      -
    • none -

      - This is the default where no Mutex is used at all. Use it at your own - risk. But because currently the Mutex is mainly used for synchronizing - write access to the SSL Session Cache you can live without it as long - as you accept a sometimes garbled Session Cache. So it's not recommended - to leave this the default. Instead configure a real Mutex. -

      -

    • file:/path/to/mutex -

      - This is the portable and (under Unix) always provided Mutex variant where - a physical (lock-)file is used as the Mutex. Always use a local disk - filesystem for /path/to/mutex and never a file residing on a - NFS- or AFS-filesystem. Note: Internally, the Process ID (PID) of the - Apache parent process is automatically appended to - /path/to/mutex to make it unique, so you don't have to worry - about conflicts yourself. Notice that this type of mutex is not available - under the Win32 environment. There you have to use the semaphore - mutex. -

      -

    • sem -

      - This is the most elegant but also most non-portable Mutex variant where a - SysV IPC Semaphore (under Unix) and a Windows Mutex (under Win32) is used - when possible. It is only available when the underlying platform - supports it. -

    -

    -Example: -

    -
    -SSLMutex file:/usr/local/apache/logs/ssl_mutex
    -
    -
    - -

    -
    - -

    SSLRandomSeed

    -

    - - - - -
    - - - - -
    - - - - - - - - - - -
    -Name: SSLRandomSeed
    -Description: Pseudo Random Number Generator (PRNG) seeding source
    Syntax: SSLRandomSeed context source [bytes]
    Default: none
    Context: server config
    Override: Not applicable
    Status: Extension
    Module: mod_ssl
    Compatibility: mod_ssl 2.2
    -
    -
    -

    -This configures one or more sources for seeding the Pseudo Random Number -Generator (PRNG) in OpenSSL at startup time (context is -startup) and/or just before a new SSL connection is established -(context is connect). This directive can only be used -in the global server context because the PRNG is a global facility. -

    -The following source variants are available: -

      -
    • builtin -

      This is the always available builtin seeding source. It's usage - consumes minimum CPU cycles under runtime and hence can be always used - without drawbacks. The source used for seeding the PRNG contains of the - current time, the current process id and (when applicable) a randomly - choosen 1KB extract of the inter-process scoreboard structure of Apache. - The drawback is that this is not really a strong source and at startup - time (where the scoreboard is still not available) this source just - produces a few bytes of entropy. So you should always, at least for the - startup, use an additional seeding source. -

      -

    • file:/path/to/source -

      - This variant uses an external file /path/to/source as the - source for seeding the PRNG. When bytes is specified, only the - first bytes number of bytes of the file form the entropy (and - bytes is given to /path/to/source as the first - argument). When bytes is not specified the whole file forms the - entropy (and 0 is given to /path/to/source as - the first argument). Use this especially at startup time, for instance - with an available /dev/random and/or - /dev/urandom devices (which usually exist on modern Unix - derivates like FreeBSD and Linux). -

      - But be careful: Usually /dev/random provides only as - much entropy data as it actually has, i.e. when you request 512 bytes of - entropy, but the device currently has only 100 bytes available two things - can happen: On some platforms you receive only the 100 bytes while on - other platforms the read blocks until enough bytes are available (which - can take a long time). Here using an existing /dev/urandom is - better, because it never blocks and actually gives the amount of requested - data. The drawback is just that the quality of the received data may not - be the best. -

      - On some platforms like FreeBSD one can even control how the entropy is - actually generated, i.e. by which system interrupts. More details one can - find under rndcontrol(8) on those platforms. Alternatively, when - your system lacks such a random device, you can use tool - like EGD - (Entropy Gathering Daemon) and run it's client program with the - exec:/path/to/program/ variant (see below) or use - egd:/path/to/egd-socket (see below). -

      -

    • exec:/path/to/program -

      - This variant uses an external executable /path/to/program as - the source for seeding the PRNG. When bytes is specified, only the - first bytes number of bytes of its stdout contents - form the entropy. When bytes is not specified, the entirety of - the data produced on stdout form the entropy. Use this only - at startup time when you need a very strong seeding with the help of an - external program (for instance as in the example above with the - truerand utility you can find in the mod_ssl distribution - which is based on the AT&T truerand library). Using this in - the connection context slows down the server too dramatically, of course. - So usually you should avoid using external programs in that context. -

      -

    • egd:/path/to/egd-socket (Unix only) -

      - This variant uses the Unix domain socket of the - external Entropy Gathering Daemon (EGD) (see http://www.lothar.com/tech - /crypto/) to seed the PRNG. Use this if no random device exists - on your platform. -

    -

    -Example: -

    -
    -SSLRandomSeed startup builtin
    -SSLRandomSeed startup file:/dev/random
    -SSLRandomSeed startup file:/dev/urandom 1024
    -SSLRandomSeed startup exec:/usr/local/bin/truerand 16
    -SSLRandomSeed connect builtin
    -SSLRandomSeed connect file:/dev/random
    -SSLRandomSeed connect file:/dev/urandom 1024
    -
    -
    - -

    -
    - -

    SSLSessionCache

    - - - - -
    - - - - -
    - - - - - - - - - - -
    -Name: SSLSessionCache
    -Description: Type of the global/inter-process SSL Session Cache
    Syntax: SSLSessionCache type
    Default: SSLSessionCache none
    Context: server config
    Override: Not applicable
    Status: Extension
    Module: mod_ssl
    Compatibility: mod_ssl 2.1
    -
    -
    -

    -This configures the storage type of the global/inter-process SSL Session -Cache. This cache is an optional facility which speeds up parallel request -processing. For requests to the same server process (via HTTP keep-alive), -OpenSSL already caches the SSL session information locally. But because modern -clients request inlined images and other data via parallel requests (usually -up to four parallel requests are common) those requests are served by -different pre-forked server processes. Here an inter-process cache -helps to avoid unneccessary session handshakes. -

    -The following two storage types are currently supported: -

      -
    • none -

      - This is the default and just disables the global/inter-process Session - Cache. There is no drawback in functionality, but a noticeable speed - penalty can be observed. -

      -

    • dbm:/path/to/datafile -

      - This makes use of a DBM hashfile on the local disk to synchronize the - local OpenSSL memory caches of the server processes. The slight increase - in I/O on the server results in a visible request speedup for your - clients, so this type of storage is generally recommended. -

      -

    • shm:/path/to/datafile[(size)] -

      - This makes use of a high-performance hash table (approx. size bytes - in size) inside a shared memory segment in RAM (established via - /path/to/datafile) to synchronize the local OpenSSL memory - caches of the server processes. This storage type is not available on all - platforms. See the mod_ssl INSTALL document for details on - how to build Apache+EAPI with shared memory support. -

    -

    -Examples: -

    -
    -SSLSessionCache dbm:/usr/local/apache/logs/ssl_gcache_data
    -SSLSessionCache shm:/usr/local/apache/logs/ssl_gcache_data(512000)
    -
    -
    - -

    -
    - -

    SSLSessionCacheTimeout

    - - - - -
    - - - - -
    - - - - - - - - - - -
    -Name: SSLSessionCacheTimeout
    -Description: Number of seconds before an SSL session expires in the Session Cache
    Syntax: SSLSessionCacheTimeout seconds
    Default: SSLSessionCacheTimeout 300
    Context: server config, virtual host
    Override: Not applicable
    Status: Extension
    Module: mod_ssl
    Compatibility: mod_ssl 2.0
    -
    -
    -

    -This directive sets the timeout in seconds for the information stored in the -global/inter-process SSL Session Cache and the OpenSSL internal memory cache. -It can be set as low as 15 for testing, but should be set to higher -values like 300 in real life. -

    -Example: -

    -
    -SSLSessionCacheTimeout 600
    -
    -
    - -

    -
    - -

    SSLEngine

    - - - - -
    - - - - -
    - - - - - - - - - - -
    -Name: SSLEngine
    -Description: SSL Engine Operation Switch
    Syntax: SSLEngine on|off
    Default: SSLEngine off
    Context: server config, virtual host
    Override: Not applicable
    Status: Extension
    Module: mod_ssl
    Compatibility: mod_ssl 2.1
    -
    -
    -

    -This directive toggles the usage of the SSL/TLS Protocol Engine. This is -usually used inside a <VirtualHost> section to enable SSL/TLS for a -particular virtual host. By default the SSL/TLS Protocol Engine is disabled -for both the main server and all configured virtual hosts. -

    -Example: -

    -
    -<VirtualHost _default_:443>
    -SSLEngine on
    -...
    -</VirtualHost>
    -
    -
    - -

    -
    - -

    SSLProtocol

    - - - - -
    - - - - -
    - - - - - - - - - - -
    -Name: SSLProtocol
    -Description: Configure usable SSL protocol flavors
    Syntax: SSLProtocol [+-]protocol ...
    Default: SSLProtocol all
    Context: server config, virtual host
    Override: Options
    Status: Extension
    Module: mod_ssl
    Compatibility: mod_ssl 2.2
    -
    -
    -

    -This directive can be used to control the SSL protocol flavors mod_ssl should -use when establishing its server environment. Clients then can only connect -with one of the provided protocols. -

    -The available (case-insensitive) protocols are: -

      -
    • SSLv2 -

      - This is the Secure Sockets Layer (SSL) protocol, version 2.0. It is the - original SSL protocol as designed by Netscape Corporation. -

      -

    • SSLv3 -

      - This is the Secure Sockets Layer (SSL) protocol, version 3.0. It is the - successor to SSLv2 and the currently (as of February 1999) de-facto - standardized SSL protocol from Netscape Corporation. It's supported by - almost all popular browsers. -

      -

    • TLSv1 -

      - This is the Transport Layer Security (TLS) protocol, version 1.0. It is the - successor to SSLv3 and currently (as of February 1999) still under - construction by the Internet Engineering Task Force (IETF). It's still - not supported by any popular browsers. -

      -

    • All -

      - This is a shortcut for ``+SSLv2 +SSLv3 +TLSv1'' and a - convinient way for enabling all protocols except one when used in - combination with the minus sign on a protocol as the example above shows. -

    -

    -Example: -

    -
    -#   enable SSLv3 and TLSv1, but not SSLv2
    -SSLProtocol all -SSLv2
    -
    -
    - -

    -
    - -

    SSLCipherSuite

    - - - - -
    - - - - -
    - - - - - - - - - - -
    -Name: SSLCipherSuite
    -Description: Cipher Suite available for negotiation in SSL handshake
    Syntax: SSLCipherSuite cipher-spec
    Default: SSLCipherSuite ALL:!ADH:RC4+RSA:+HIGH:+MEDIUM:+LOW:+SSLv2:+EXP
    Context: server config, virtual host, directory, .htaccess
    Override: AuthConfig
    Status: Extension
    Module: mod_ssl
    Compatibility: mod_ssl 2.1
    -
    -
    -

    -This complex directive uses a colon-separated cipher-spec string -consisting of OpenSSL cipher specifications to configure the Cipher Suite the -client is permitted to negotiate in the SSL handshake phase. Notice that this -directive can be used both in per-server and per-directory context. In -per-server context it applies to the standard SSL handshake when a connection -is established. In per-directory context it forces a SSL renegotation with the -reconfigured Cipher Suite after the HTTP request was read but before the HTTP -response is sent. -

    -An SSL cipher specification in cipher-spec is composed of 4 major -attributes plus a few extra minor ones: -

      -
    • Key Exchange Algorithm:
      - RSA or Diffie-Hellman variants. -

      -

    • Authentication Algorithm:
      - RSA, Diffie-Hellman, DSS or none. -

      -

    • Cipher/Encryption Algorithm:
      - DES, Triple-DES, RC4, RC2, IDEA or none. -

      -

    • MAC Digest Algorithm:
      - MD5, SHA or SHA1. -
    -An SSL cipher can also be an export cipher and is either a SSLv2 or SSLv3/TLSv1 -cipher (here TLSv1 is equivalent to SSLv3). To specify which ciphers to use, -one can either specify all the Ciphers, one at a time, or use aliases to -specify the preference and order for the ciphers (see Table -1). -

    -

    - - - -
    Table 1: OpenSSL Cipher Specification Tags
    - - -
    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    Tag Description
    Key Exchange Algorithm:
    kRSA RSA key exchange
    kDHr Diffie-Hellman key exchange with RSA key
    kDHd Diffie-Hellman key exchange with DSA key
    kEDH Ephemeral (temp.key) Diffie-Hellman key exchange (no cert)
    Authentication Algorithm:
    aNULL No authentication
    aRSA RSA authentication
    aDSS DSS authentication
    aDH Diffie-Hellman authentication
    Cipher Encoding Algorithm:
    eNULL No encoding
    DES DES encoding
    3DES Triple-DES encoding
    RC4 RC4 encoding
    RC2 RC2 encoding
    IDEA IDEA encoding
    MAC Digest Algorithm:
    MD5 MD5 hash function
    SHA1 SHA1 hash function
    SHA SHA hash function
    Aliases:
    SSLv2 all SSL version 2.0 ciphers
    SSLv3 all SSL version 3.0 ciphers
    TLSv1 all TLS version 1.0 ciphers
    EXP all export ciphers
    EXPORT40 all 40-bit export ciphers only
    EXPORT56 all 56-bit export ciphers only
    LOW all low strength ciphers (no export, single DES)
    MEDIUM all ciphers with 128 bit encryption
    HIGH all ciphers using Triple-DES
    RSA all ciphers using RSA key exchange
    DH all ciphers using Diffie-Hellman key exchange
    EDH all ciphers using Ephemeral Diffie-Hellman key exchange
    ADH all ciphers using Anonymous Diffie-Hellman key exchange
    DSS all ciphers using DSS authentication
    NULL all ciphers using no encryption
    -
    -
    -
    -

    -Now where this becomes interesting is that these can be put together -to specify the order and ciphers you wish to use. To speed this up -there are also aliases (SSLv2, SSLv3, TLSv1, EXP, LOW, MEDIUM, -HIGH) for certain groups of ciphers. These tags can be joined -together with prefixes to form the cipher-spec. Available -prefixes are: -

      -
    • none: add cipher to list -
    • +: add ciphers to list and pull them to current location in list -
    • -: remove cipher from list (can be added later again) -
    • !: kill cipher from list completely (can not be added later again) -
    -A simpler way to look at all of this is to use the ``openssl ciphers --v'' command which provides a nice way to successively create the -correct cipher-spec string. The default cipher-spec string -is ``ALL:!ADH:RC4+RSA:+HIGH:+MEDIUM:+LOW:+SSLv2:+EXP'' which -means the following: first, remove from consideration any ciphers that do not -authenticate, i.e. for SSL only the Anonymous Diffie-Hellman ciphers. Next, -use ciphers using RC4 and RSA. Next include the high, medium and then the low -security ciphers. Finally pull all SSLv2 and export ciphers to the -end of the list. -
    -
    -$ openssl ciphers -v 'ALL:!ADH:RC4+RSA:+HIGH:+MEDIUM:+LOW:+SSLv2:+EXP'
    -NULL-SHA                SSLv3 Kx=RSA      Au=RSA  Enc=None      Mac=SHA1
    -NULL-MD5                SSLv3 Kx=RSA      Au=RSA  Enc=None      Mac=MD5
    -EDH-RSA-DES-CBC3-SHA    SSLv3 Kx=DH       Au=RSA  Enc=3DES(168) Mac=SHA1
    -...                     ...               ...     ...           ...
    -EXP-RC4-MD5             SSLv3 Kx=RSA(512) Au=RSA  Enc=RC4(40)   Mac=MD5  export
    -EXP-RC2-CBC-MD5         SSLv2 Kx=RSA(512) Au=RSA  Enc=RC2(40)   Mac=MD5  export
    -EXP-RC4-MD5             SSLv2 Kx=RSA(512) Au=RSA  Enc=RC4(40)   Mac=MD5  export
    -
    -
    -The complete list of particular RSA & DH ciphers for SSL is given in Table 2. -

    -Example: -

    -
    -SSLCipherSuite RSA:!EXP:!NULL:+HIGH:+MEDIUM:-LOW
    -
    -
    -

    -

    - - - -
    Table 2: Particular SSL Ciphers
    - - -
    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    Cipher-Tag Protocol Key Ex. Auth. Enc. MAC Type
    RSA Ciphers:
    DES-CBC3-SHA SSLv3 RSA RSA 3DES(168) SHA1  
    DES-CBC3-MD5 SSLv2 RSA RSA 3DES(168) MD5  
    IDEA-CBC-SHA SSLv3 RSA RSA IDEA(128) SHA1  
    RC4-SHA SSLv3 RSA RSA RC4(128) SHA1  
    RC4-MD5 SSLv3 RSA RSA RC4(128) MD5  
    IDEA-CBC-MD5 SSLv2 RSA RSA IDEA(128) MD5  
    RC2-CBC-MD5 SSLv2 RSA RSA RC2(128) MD5  
    RC4-MD5 SSLv2 RSA RSA RC4(128) MD5  
    DES-CBC-SHA SSLv3 RSA RSA DES(56) SHA1  
    RC4-64-MD5 SSLv2 RSA RSA RC4(64) MD5  
    DES-CBC-MD5 SSLv2 RSA RSA DES(56) MD5  
    EXP-DES-CBC-SHA SSLv3 RSA(512) RSA DES(40) SHA1 export
    EXP-RC2-CBC-MD5 SSLv3 RSA(512) RSA RC2(40) MD5 export
    EXP-RC4-MD5 SSLv3 RSA(512) RSA RC4(40) MD5 export
    EXP-RC2-CBC-MD5 SSLv2 RSA(512) RSA RC2(40) MD5 export
    EXP-RC4-MD5 SSLv2 RSA(512) RSA RC4(40) MD5 export
    NULL-SHA SSLv3 RSA RSA None SHA1  
    NULL-MD5 SSLv3 RSA RSA None MD5  
    Diffie-Hellman Ciphers:
    ADH-DES-CBC3-SHA SSLv3 DH None 3DES(168) SHA1  
    ADH-DES-CBC-SHA SSLv3 DH None DES(56) SHA1  
    ADH-RC4-MD5 SSLv3 DH None RC4(128) MD5  
    EDH-RSA-DES-CBC3-SHA SSLv3 DH RSA 3DES(168) SHA1  
    EDH-DSS-DES-CBC3-SHA SSLv3 DH DSS 3DES(168) SHA1  
    EDH-RSA-DES-CBC-SHA SSLv3 DH RSA DES(56) SHA1  
    EDH-DSS-DES-CBC-SHA SSLv3 DH DSS DES(56) SHA1  
    EXP-EDH-RSA-DES-CBC-SHA SSLv3 DH(512) RSA DES(40) SHA1 export
    EXP-EDH-DSS-DES-CBC-SHA SSLv3 DH(512) DSS DES(40) SHA1 export
    EXP-ADH-DES-CBC-SHA SSLv3 DH(512) None DES(40) SHA1 export
    EXP-ADH-RC4-MD5 SSLv3 DH(512) None RC4(40) MD5 export
    -
    -
    -
    - -

    -
    - -

    SSLCertificateFile

    - - - - -
    - - - - -
    - - - - - - - - - - -
    -Name: SSLCertificateFile
    -Description: Server PEM-encoded X.509 Certificate file
    Syntax: SSLCertificateFile filename
    Default: None
    Context: server config, virtual host
    Override: Not applicable
    Status: Extension
    Module: mod_ssl
    Compatibility: mod_ssl 2.0
    -
    -
    -

    -This directive points to the PEM-encoded Certificate file for the server and -optionally also to the corresponding RSA or DSA Private Key file for it -(contained in the same file). If the contained Private Key is encrypted the -Pass Phrase dialog is forced at startup time. This directive can be used up to -two times (referencing different filenames) when both a RSA and a DSA based -server certificate is used in parallel. -

    -Example: -

    -
    -SSLCertificateFile /usr/local/apache/conf/ssl.crt/server.crt
    -
    -
    - -

    -
    - -

    SSLCertificateKeyFile

    - - - - -
    - - - - -
    - - - - - - - - - - -
    -Name: SSLCertificateKeyFile
    -Description: Server PEM-encoded Private Key file
    Syntax: SSLCertificateKeyFile filename
    Default: None
    Context: server config, virtual host
    Override: Not applicable
    Status: Extension
    Module: mod_ssl
    Compatibility: mod_ssl 2.0
    -
    -
    -

    -This directive points to the PEM-encoded Private Key file for the server. If -the Private Key is not combined with the Certificate in the -SSLCertificateFile, use this additional directive to point to the -file with the stand-alone Private Key. When SSLCertificateFile -is used and the file contains both the Certificate and the Private Key this -directive need not be used. But we strongly discourage this practice. -Instead we recommend you to separate the Certificate and the Private Key. If -the contained Private Key is encrypted, the Pass Phrase dialog is forced at -startup time. This directive can be used up to two times (referencing -different filenames) when both a RSA and a DSA based private key is used in -parallel. -

    -Example: -

    -
    -SSLCertificateKeyFile /usr/local/apache/conf/ssl.key/server.key
    -
    -
    - -

    -
    - -

    SSLCertificateChainFile

    - - - - -
    - - - - -
    - - - - - - - - - - -
    -Name: SSLCertificateChainFile
    -Description: File of PEM-encoded Server CA Certificates
    Syntax: SSLCertificateChainFile filename
    Default: None
    Context: server config, virtual host
    Override: Not applicable
    Status: Extension
    Module: mod_ssl
    Compatibility: mod_ssl 2.3.6
    -
    -
    -

    -This directive sets the optional all-in-one file where you can -assemble the certificates of Certification Authorities (CA) which form the -certificate chain of the server certificate. This starts with the issuing CA -certificate of of the server certificate and can range up to the root CA -certificate. Such a file is simply the concatenation of the various -PEM-encoded CA Certificate files, usually in certificate chain order. -

    -This should be used alternatively and/or additionally to SSLCACertificatePath for explicitly -constructing the server certificate chain which is sent to the browser in -addition to the server certificate. It is especially useful to avoid conflicts -with CA certificates when using client authentication. Because although -placing a CA certificate of the server certificate chain into SSLCACertificatePath has the same effect for -the certificate chain construction, it has the side-effect that client -certificates issued by this same CA certificate are also accepted on client -authentication. That's usually not one expect. -

    -But be careful: Providing the certificate chain works only if you are using a -single (either RSA or DSA) based server certificate. If you are -using a coupled RSA+DSA certificate pair, this will work only if actually both -certificates use the same certificate chain. Else the browsers will be -confused in this situation. -

    -Example: -

    -
    -SSLCertificateChainFile /usr/local/apache/conf/ssl.crt/ca.crt
    -
    -
    - -

    -
    - -

    SSLCACertificatePath

    - - - - -
    - - - - -
    - - - - - - - - - - -
    -Name: SSLCACertificatePath
    -Description: Directory of PEM-encoded CA Certificates for Client Auth.
    Syntax: SSLCACertificatePath directory
    Default: None
    Context: server config, virtual host
    Override: Not applicable
    Status: Extension
    Module: mod_ssl
    Compatibility: mod_ssl 2.0
    -
    -
    -

    -This directive sets the directory where you keep the Certificates of -Certification Authorities (CAs) whose clients you deal with. These are used to -verify the client certificate on Client Authentication. -

    -The files in this directory have to be PEM-encoded and are accessed through -hash filenames. So usually you can't just place the Certificate files -there: you also have to create symbolic links named -hash-value.N. And you should always make sure this directory -contains the appropriate symbolic links. Use the Makefile which -comes with mod_ssl to accomplish this task. -

    -Example: -

    -
    -SSLCACertificatePath /usr/local/apache/conf/ssl.crt/
    -
    -
    - -

    -
    - -

    SSLCACertificateFile

    - - - - -
    - - - - -
    - - - - - - - - - - -
    -Name: SSLCACertificateFile
    -Description: File of concatenated PEM-encoded CA Certificates for Client Auth.
    Syntax: SSLCACertificateFile filename
    Default: None
    Context: server config, virtual host
    Override: Not applicable
    Status: Extension
    Module: mod_ssl
    Compatibility: mod_ssl 2.0
    -
    -
    -

    -This directive sets the all-in-one file where you can assemble the -Certificates of Certification Authorities (CA) whose clients you deal -with. These are used for Client Authentication. Such a file is simply the -concatenation of the various PEM-encoded Certificate files, in order of -preference. This can be used alternatively and/or additionally to SSLCACertificatePath. -

    -Example: -

    -
    -SSLCACertificateFile /usr/local/apache/conf/ssl.crt/ca-bundle-client.crt
    -
    -
    - -

    -
    - -

    SSLCARevocationPath

    - - - - -
    - - - - -
    - - - - - - - - - - -
    -Name: SSLCARevocationPath
    -Description: Directory of PEM-encoded CA CRLs for Client Auth.
    Syntax: SSLCARevocationPath directory
    Default: None
    Context: server config, virtual host
    Override: Not applicable
    Status: Extension
    Module: mod_ssl
    Compatibility: mod_ssl 2.3
    -
    -
    -

    -This directive sets the directory where you keep the Certificate Revocation -Lists (CRL) of Certification Authorities (CAs) whose clients you deal with. -These are used to revoke the client certificate on Client Authentication. -

    -The files in this directory have to be PEM-encoded and are accessed through -hash filenames. So usually you have not only to place the CRL files there. -Additionally you have to create symbolic links named -hash-value.rN. And you should always make sure this directory -contains the appropriate symbolic links. Use the Makefile which -comes with mod_ssl to accomplish this task. -

    -Example: -

    -
    -SSLCARevocationPath /usr/local/apache/conf/ssl.crl/
    -
    -
    - -

    -
    - -

    SSLCARevocationFile

    - - - - -
    - - - - -
    - - - - - - - - - - -
    -Name: SSLCARevocationFile
    -Description: File of concatenated PEM-encoded CA CRLs for Client Auth.
    Syntax: SSLCARevocationFile filename
    Default: None
    Context: server config, virtual host
    Override: Not applicable
    Status: Extension
    Module: mod_ssl
    Compatibility: mod_ssl 2.3
    -
    -
    -

    -This directive sets the all-in-one file where you can assemble the -Certificate Revocation Lists (CRL) of Certification Authorities (CA) whose -clients you deal with. These are used for Client Authentication. -Such a file is simply the concatenation of the various PEM-encoded CRL -files, in order of preference. This can be used alternatively and/or -additionally to SSLCARevocationPath. -

    -Example: -

    -
    -SSLCARevocationFile /usr/local/apache/conf/ssl.crl/ca-bundle-client.crl
    -
    -
    - -

    -
    - -

    SSLVerifyClient

    - - - - -
    - - - - -
    - - - - - - - - - - -
    -Name: SSLVerifyClient
    -Description: Type of Client Certificate verification
    Syntax: SSLVerifyClient level
    Default: SSLVerifyClient none
    Context: server config, virtual host, directory, .htaccess
    Override: AuthConfig
    Status: Extension
    Module: mod_ssl
    Compatibility: mod_ssl 2.0
    -
    -
    -

    -This directive sets the Certificate verification level for the Client -Authentication. Notice that this directive can be used both in per-server and -per-directory context. In per-server context it applies to the client -authentication process used in the standard SSL handshake when a connection is -established. In per-directory context it forces a SSL renegotation with the -reconfigured client verification level after the HTTP request was read but -before the HTTP response is sent. -

    -The following levels are available for level: -

      -
    • none: - no client Certificate is required at all -
    • optional: - the client may present a valid Certificate -
    • require: - the client has to present a valid Certificate -
    • optional_no_ca: - the client may present a valid Certificate
      - but it need not to be (successfully) verifiable. -
    -In practice only levels none and require are -really interesting, because level optional doesn't work with -all browsers and level optional_no_ca is actually against the -idea of authentication (but can be used to establish SSL test pages, etc.) -

    -Example: -

    -
    -SSLVerifyClient require
    -
    -
    - -

    -
    - -

    SSLVerifyDepth

    - - - - -
    - - - - -
    - - - - - - - - - - -
    -Name: SSLVerifyDepth
    -Description: Maximum depth of CA Certificates in Client Certificate verification
    Syntax: SSLVerifyDepth number
    Default: SSLVerifyDepth 1
    Context: server config, virtual host, directory, .htaccess
    Override: AuthConfig
    Status: Extension
    Module: mod_ssl
    Compatibility: mod_ssl 2.0
    -
    -
    -

    -This directive sets how deeply mod_ssl should verify before deciding that the -clients don't have a valid certificate. Notice that this directive can be -used both in per-server and per-directory context. In per-server context it -applies to the client authentication process used in the standard SSL -handshake when a connection is established. In per-directory context it forces -a SSL renegotation with the reconfigured client verification depth after the -HTTP request was read but before the HTTP response is sent. -

    -The depth actually is the maximum number of intermediate certificate issuers, -i.e. the number of CA certificates which are max allowed to be followed while -verifying the client certificate. A depth of 0 means that self-signed client -certificates are accepted only, the default depth of 1 means the client -certificate can be self-signed or has to be signed by a CA which is directly -known to the server (i.e. the CA's certificate is under -SSLCACertificatePath), etc. -

    -Example: -

    -
    -SSLVerifyDepth 10
    -
    -
    - -

    -
    - -

    SSLLog

    - - - - -
    - - - - -
    - - - - - - - - - - -
    -Name: SSLLog
    -Description: Where to write the dedicated SSL engine logfile
    Syntax: SSLLog filename
    Default: None
    Context: server config, virtual host
    Override: Not applicable
    Status: Extension
    Module: mod_ssl
    Compatibility: mod_ssl 2.1
    -
    -
    -

    -This directive sets the name of the dedicated SSL protocol engine logfile. -Error type messages are additionally duplicated to the general Apache error -log file (directive ErrorLog). Put this somewhere where it cannot -be used for symlink attacks on a real server (i.e. somewhere where only root -can write). If the filename does not begin with a slash -('/') then it is assumed to be relative to the Server -Root. If filename begins with a bar ('|') then the -following string is assumed to be a path to an executable program to which a -reliable pipe can be established. The directive should occur only once per -virtual server config. -

    -Example: -

    -
    -SSLLog /usr/local/apache/logs/ssl_engine_log
    -
    -
    - -

    -
    - -

    SSLLogLevel

    - - - - -
    - - - - -
    - - - - - - - - - - -
    -Name: SSLLogLevel
    -Description: Logging level for the dedicated SSL engine logfile
    Syntax: SSLLogLevel level
    Default: SSLLogLevel none
    Context: server config, virtual host
    Override: Not applicable
    Status: Extension
    Module: mod_ssl
    Compatibility: mod_ssl 2.1
    -
    -
    -

    -This directive sets the verbosity degree of the dedicated SSL protocol engine -logfile. The level is one of the following (in ascending order where -higher levels include lower levels): -

      -
    • none
      - no dedicated SSL logging is done, but messages of level - ``error'' are still written to the general Apache error - logfile. -

      -

    • error
      - log messages of error type only, i.e. messages which show fatal situations - (processing is stopped). Those messages are also duplicated to the - general Apache error logfile. -

      -

    • warn
      - log also warning messages, i.e. messages which show non-fatal problems - (processing is continued). -

      -

    • info
      - log also informational messages, i.e. messages which show major - processing steps. -

      -

    • trace
      - log also trace messages, i.e. messages which show minor processing steps. -

      -

    • debug
      - log also debugging messages, i.e. messages which show development and - low-level I/O information. -
    -

    -Example: -

    -
    -SSLLogLevel warn
    -
    -
    - -

    -
    - -

    SSLOptions

    - - - - -
    - - - - -
    - - - - - - - - - - -
    -Name: SSLOptions
    -Description: Configure various SSL engine run-time options
    Syntax: SSLOptions [+-]option ...
    Default: None
    Context: server config, virtual host, directory, .htaccess
    Override: Options
    Status: Extension
    Module: mod_ssl
    Compatibility: mod_ssl 2.1
    -
    -
    -

    -This directive can be used to control various run-time options on a -per-directory basis. Normally, if multiple SSLOptions could -apply to a directory, then the most specific one is taken completely; the -options are not merged. However if all the options on the -SSLOptions directive are preceded by a plus (+) or -minus (-) symbol, the options are merged. Any options preceded by -a + are added to the options currently in force, and any options -preceded by a - are removed from the options currently in force. -

    -The available options are: -

      -
    • StdEnvVars -

      - When this option is enabled, the standard set of SSL related CGI/SSI - environment variables are created. This per default is disabled for - performance reasons, because the information extraction step is a - rather expensive operation. So one usually enables this option for - CGI and SSI requests only. -

      -

    • CompatEnvVars -

      - When this option is enabled, additional CGI/SSI environment variables are - created for backward compatibility to other Apache SSL solutions. Look in - the Compatibility chapter for details - on the particular variables generated. -

      -

    • ExportCertData -

      - When this option is enabled, additional CGI/SSI environment variables are - created: SSL_SERVER_CERT, SSL_CLIENT_CERT and - SSL_CLIENT_CERT_CHAINn (with n = 0,1,2,..). - These contain the PEM-encoded X.509 Certificates of server and client for - the current HTTPS connection and can be used by CGI scripts for deeper - Certificate checking. Additionally all other certificates of the client - certificate chain are provided, too. This bloats up the environment a - little bit which is why you have to use this option to enable it on - demand. -

      -

    • FakeBasicAuth -

      - When this option is enabled, the Subject Distinguished Name (DN) of the - Client X509 Certificate is translated into a HTTP Basic Authorization - username. This means that the standard Apache authentication methods can - be used for access control. The user name is just the Subject of the - Client's X509 Certificate (can be determined by running OpenSSL's - openssl x509 command: openssl x509 -noout -subject -in - certificate.crt). Note that no password is - obtained from the user. Every entry in the user file needs this password: - ``xxj31ZMTZzkVA'', which is the DES-encrypted version of the - word `password''. Those who live under MD5-based encryption - (for instance under FreeBSD or BSD/OS, etc.) should use the following MD5 - hash of the same word: ``$1$OXLyS...$Owx8s2/m9/gfkcRVXzgoE/''. -

      -

    • StrictRequire -

      - This forces forbidden access when SSLRequireSSL or - SSLRequire successfully decided that access should be - forbidden. Usually the default is that in the case where a ``Satisfy - any'' directive is used, and other access restrictions are passed, - denial of access due to SSLRequireSSL or - SSLRequire is overridden (because that's how the Apache - Satisfy mechanism should work.) But for strict access restriction - you can use SSLRequireSSL and/or SSLRequire in - combination with an ``SSLOptions +StrictRequire''. Then an - additional ``Satisfy Any'' has no chance once mod_ssl has - decided to deny access. -

      -

    • OptRenegotiate -

      - This enables optimized SSL connection renegotiation handling when SSL - directives are used in per-directory context. By default a strict - scheme is enabled where every per-directory reconfiguration of - SSL parameters causes a full SSL renegotiation handshake. When this - option is used mod_ssl tries to avoid unnecessary handshakes by doing more - granular (but still safe) parameter checks. Nevertheless these granular - checks sometimes maybe not what the user expects, so enable this on a - per-directory basis only, please. -

    -

    -Example: -

    -
    -SSLOptions +FakeBasicAuth -StrictRequire
    -<Files ~ "\.(cgi|shtml)$">
    -    SSLOptions +StdEnvVars +CompatEnvVars -ExportCertData
    -<Files>
    -
    -
    - -

    -
    - -

    SSLRequireSSL

    - - - - -
    - - - - -
    - - - - - - - - - - -
    -Name: SSLRequireSSL
    -Description: Deny access when SSL is not used for the HTTP request
    Syntax: SSLRequireSSL
    Default: None
    Context: directory, .htaccess
    Override: AuthConfig
    Status: Extension
    Module: mod_ssl
    Compatibility: mod_ssl 2.0
    -
    -
    -

    -This directive forbids access unless HTTP over SSL (i.e. HTTPS) is enabled for -the current connection. This is very handy inside the SSL-enabled virtual -host or directories for defending against configuration errors that expose -stuff that should be protected. When this directive is present all requests -are denied which are not using SSL. -

    -Example: -

    -
    -SSLRequireSSL
    -
    -
    - -

    -
    - -

    SSLRequire

    - - - - -
    - - - - -
    - - - - - - - - - - -
    -Name: SSLRequire
    -Description: Allow access only when an arbitrarily complex boolean expression is true
    Syntax: SSLRequire expression
    Default: None
    Context: directory, .htaccess
    Override: AuthConfig
    Status: Extension
    Module: mod_ssl
    Compatibility: mod_ssl 2.1
    -
    -
    -

    -This directive specifies a general access requirement which has to be -fulfilled in order to allow access. It's a very powerful directive because the -requirement specification is an arbitrarily complex boolean expression -containing any number of access checks. -

    -The expression must match the following syntax (given as a BNF -grammar notation): -

    -
    -expr     ::= "true" | "false"
    -           | "!" expr
    -           | expr "&&" expr
    -           | expr "||" expr
    -           | "(" expr ")"
    -           | comp
    -
    -comp     ::= word "==" word | word "eq" word
    -           | word "!=" word | word "ne" word
    -           | word "<"  word | word "lt" word
    -           | word "<=" word | word "le" word
    -           | word ">"  word | word "gt" word
    -           | word ">=" word | word "ge" word
    -           | word "in" "{" wordlist "}"
    -           | word "=~" regex
    -           | word "!~" regex
    -
    -wordlist ::= word
    -           | wordlist "," word
    -
    -word     ::= digit
    -           | cstring
    -           | variable
    -           | function
    -
    -digit    ::= [0-9]+
    -cstring  ::= "..."
    -variable ::= "%{" varname "}"
    -function ::= funcname "(" funcargs ")"
    -
    -
    -while for varname any variable from Table 3 -can be used. Finally for funcname the following functions -are available: -
      -
    • file(filename) -

      - This function takes one string argument and expands to the contents of the - file. This is especially useful for matching this contents against a - regular expression, etc. -

    -Notice that expression is first parsed into an internal machine -representation and then evaluated in a second step. Actually, in Global and -Per-Server Class context expression is parsed at startup time and -at runtime only the machine representation is executed. For Per-Directory -context this is different: here expression has to be parsed and -immediately executed for every request. -

    -Example: -

    -
    -SSLRequire (    %{SSL_CIPHER} !~ m/^(EXP|NULL)-/ \
    -            and %{SSL_CLIENT_S_DN_O} eq "Snake Oil, Ltd." \
    -            and %{SSL_CLIENT_S_DN_OU} in {"Staff", "CA", "Dev"} \
    -            and %{TIME_WDAY} >= 1 and %{TIME_WDAY} <= 5 \
    -            and %{TIME_HOUR} >= 8 and %{TIME_HOUR} <= 20       ) \
    -           or %{REMOTE_ADDR} =~ m/^192\.76\.162\.[0-9]+$/
    -
    -
    -
    - - - -
    Table 3: Available Variables for SSLRequire
    - - -
    -
    -Standard CGI/1.0 and Apache variables: -
    -HTTP_USER_AGENT        PATH_INFO             AUTH_TYPE
    -HTTP_REFERER           QUERY_STRING          SERVER_SOFTWARE
    -HTTP_COOKIE            REMOTE_HOST           API_VERSION
    -HTTP_FORWARDED         REMOTE_IDENT          TIME_YEAR
    -HTTP_HOST              IS_SUBREQ             TIME_MON
    -HTTP_PROXY_CONNECTION  DOCUMENT_ROOT         TIME_DAY
    -HTTP_ACCEPT            SERVER_ADMIN          TIME_HOUR
    -HTTP:headername        SERVER_NAME           TIME_MIN
    -THE_REQUEST            SERVER_PORT           TIME_SEC
    -REQUEST_METHOD         SERVER_PROTOCOL       TIME_WDAY
    -REQUEST_SCHEME         REMOTE_ADDR           TIME
    -REQUEST_URI            REMOTE_USER           ENV:variablename
    -REQUEST_FILENAME
    -
    -SSL-related variables: -
    -HTTPS                  SSL_CLIENT_M_VERSION   SSL_SERVER_M_VERSION
    -                       SSL_CLIENT_M_SERIAL    SSL_SERVER_M_SERIAL
    -SSL_PROTOCOL           SSL_CLIENT_V_START     SSL_SERVER_V_START
    -SSL_SESSION_ID         SSL_CLIENT_V_END       SSL_SERVER_V_END
    -SSL_CIPHER             SSL_CLIENT_S_DN        SSL_SERVER_S_DN
    -SSL_CIPHER_EXPORT      SSL_CLIENT_S_DN_C      SSL_SERVER_S_DN_C
    -SSL_CIPHER_ALGKEYSIZE  SSL_CLIENT_S_DN_ST     SSL_SERVER_S_DN_ST
    -SSL_CIPHER_USEKEYSIZE  SSL_CLIENT_S_DN_L      SSL_SERVER_S_DN_L
    -SSL_VERSION_LIBRARY    SSL_CLIENT_S_DN_O      SSL_SERVER_S_DN_O
    -SSL_VERSION_INTERFACE  SSL_CLIENT_S_DN_OU     SSL_SERVER_S_DN_OU
    -                       SSL_CLIENT_S_DN_CN     SSL_SERVER_S_DN_CN
    -                       SSL_CLIENT_S_DN_T      SSL_SERVER_S_DN_T
    -                       SSL_CLIENT_S_DN_I      SSL_SERVER_S_DN_I
    -                       SSL_CLIENT_S_DN_G      SSL_SERVER_S_DN_G
    -                       SSL_CLIENT_S_DN_S      SSL_SERVER_S_DN_S
    -                       SSL_CLIENT_S_DN_D      SSL_SERVER_S_DN_D
    -                       SSL_CLIENT_S_DN_UID    SSL_SERVER_S_DN_UID
    -                       SSL_CLIENT_S_DN_Email  SSL_SERVER_S_DN_Email
    -                       SSL_CLIENT_I_DN        SSL_SERVER_I_DN
    -                       SSL_CLIENT_I_DN_C      SSL_SERVER_I_DN_C
    -                       SSL_CLIENT_I_DN_ST     SSL_SERVER_I_DN_ST
    -                       SSL_CLIENT_I_DN_L      SSL_SERVER_I_DN_L
    -                       SSL_CLIENT_I_DN_O      SSL_SERVER_I_DN_O
    -                       SSL_CLIENT_I_DN_OU     SSL_SERVER_I_DN_OU
    -                       SSL_CLIENT_I_DN_CN     SSL_SERVER_I_DN_CN
    -                       SSL_CLIENT_I_DN_T      SSL_SERVER_I_DN_T
    -                       SSL_CLIENT_I_DN_I      SSL_SERVER_I_DN_I
    -                       SSL_CLIENT_I_DN_G      SSL_SERVER_I_DN_G
    -                       SSL_CLIENT_I_DN_S      SSL_SERVER_I_DN_S
    -                       SSL_CLIENT_I_DN_D      SSL_SERVER_I_DN_D
    -                       SSL_CLIENT_I_DN_UID    SSL_SERVER_I_DN_UID
    -                       SSL_CLIENT_I_DN_Email  SSL_SERVER_I_DN_Email
    -                       SSL_CLIENT_A_SIG       SSL_SERVER_A_SIG
    -                       SSL_CLIENT_A_KEY       SSL_SERVER_A_KEY
    -                       SSL_CLIENT_CERT        SSL_SERVER_CERT
    -                       SSL_CLIENT_CERT_CHAINn
    -                       SSL_CLIENT_VERIFY
    -
    -
    -
    -
    -
    -
    -
    -

    -

    Additional Features

    -

    Environment Variables

    -This module provides a lot of SSL information as additional environment -variables to the SSI and CGI namespace. The generated variables are listed in -Table 4. For backward compatibility the information can -be made available under different names, too. Look in the Compatibility chapter for details on the -compatibility variables. -

    -

    - - - -
    Table 4: SSI/CGI Environment Variables
    - - -
    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    Variable Name:Value Type:Description:
    HTTPS flag HTTPS is being used.
    SSL_PROTOCOL string The SSL protocol version (SSLv2, SSLv3, TLSv1)
    SSL_SESSION_ID string The hex-encoded SSL session id
    SSL_CIPHER string The cipher specification name
    SSL_CIPHER_EXPORT string true if cipher is an export cipher
    SSL_CIPHER_USEKEYSIZE number Number of cipher bits (actually used)
    SSL_CIPHER_ALGKEYSIZE number Number of cipher bits (possible)
    SSL_VERSION_INTERFACE string The mod_ssl program version
    SSL_VERSION_LIBRARY string The OpenSSL program version
    SSL_CLIENT_M_VERSION string The version of the client certificate
    SSL_CLIENT_M_SERIAL string The serial of the client certificate
    SSL_CLIENT_S_DN string Subject DN in client's certificate
    SSL_CLIENT_S_DN_x509 string Component of client's Subject DN
    SSL_CLIENT_I_DN string Issuer DN of client's certificate
    SSL_CLIENT_I_DN_x509 string Component of client's Issuer DN
    SSL_CLIENT_V_START string Validity of client's certificate (start time)
    SSL_CLIENT_V_END string Validity of client's certificate (end time)
    SSL_CLIENT_A_SIG string Algorithm used for the signature of client's certificate
    SSL_CLIENT_A_KEY string Algorithm used for the public key of client's certificate
    SSL_CLIENT_CERT string PEM-encoded client certificate
    SSL_CLIENT_CERT_CHAINn string PEM-encoded certificates in client certificate chain
    SSL_CLIENT_VERIFY string NONE, SUCCESS, GENEROUS or FAILED:reason
    SSL_SERVER_M_VERSION string The version of the server certificate
    SSL_SERVER_M_SERIAL string The serial of the server certificate
    SSL_SERVER_S_DN string Subject DN in server's certificate
    SSL_SERVER_S_DN_x509 string Component of server's Subject DN
    SSL_SERVER_I_DN string Issuer DN of server's certificate
    SSL_SERVER_I_DN_x509 string Component of server's Issuer DN
    SSL_SERVER_V_START string Validity of server's certificate (start time)
    SSL_SERVER_V_END string Validity of server's certificate (end time)
    SSL_SERVER_A_SIG string Algorithm used for the signature of server's certificate
    SSL_SERVER_A_KEY string Algorithm used for the public key of server's certificate
    SSL_SERVER_CERT string PEM-encoded server certificate
    -[ where x509 is a component of a X.509 DN: - C,ST,L,O,OU,CN,T,I,G,S,D,UID,Email ] -
    -
    -
    -

    -
    -

    Custom Log Formats

    -When mod_ssl is built into Apache or at least loaded (under DSO situation) -additional functions exist for the Custom Log Format of mod_log_config. First there is an additional -``%{varname}x'' eXtension format function -which can be used to expand any variables provided by any module, especially -those provided by mod_ssl which can you find in Table 4. -

    -For backward compatibility there is additionally a special -``%{name}c'' cryptography format function -provided. Information about this function is provided in the Compatibility chapter. -

    -Example: -

    -
    -CustomLog logs/ssl_request_log \
    -          "%t %h %{SSL_PROTOCOL}x %{SSL_CIPHER}x \"%r\" %b"
    -
    -
    -

    -
    - - - - - - - - - - -
    - - - - - -
    -previous page
    Introduction -
    -next page
    Compatibility -
    -
    - - - - -
    - mod_ssl 2.8, User Manual
    - The Apache Interface to OpenSSL -
    -
    - Copyright © 1998-2001 - Ralf S. Engelschall
    - All Rights Reserved
    -
    -
    -
    -

    -
    - - diff --git a/docs/manual/mod/mod_ssl.xml b/docs/manual/mod/mod_ssl.xml deleted file mode 100644 index 71f41d7665ce2fa261e8efacf6908913bcb6f6fb..0000000000000000000000000000000000000000 --- a/docs/manual/mod/mod_ssl.xml +++ /dev/null @@ -1,1256 +0,0 @@ - - - - - -mod_ssl -Strong cryptography using the Secure Sockets -Layer (SSL) and Transport Layer Security (TLS) protocols -Extension -mod_ssl.c -ssl_module - - -

    This module provides SSL v2/v3 and TLS v1 support for the Apache -HTTP Server. It was contributed by Ralf S. Engeschall based on his -mod_ssl project and originally derived from work by Ben Laurie.

    - -

    This module relies on OpenSSL -to provide the cryptography engine.

    - -

    Further details, discussion, and examples are provided in the -SSL documentation.

    -
    - -
    Environment Variables - -

    This module provides a lot of SSL information as additional environment -variables to the SSI and CGI namespace. The generated variables are listed in -the table below. For backward compatibility the information can -be made available under different names, too. Look in the Compatibility chapter for details on the -compatibility variables.

    - -
    - - - -
    SSI/CGI Environment Variables
    - - -
    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    Variable Name:Value Type:Description:
    HTTPS flag HTTPS is being used.
    SSL_PROTOCOL string The SSL protocol version (SSLv2, SSLv3, TLSv1)
    SSL_SESSION_ID string The hex-encoded SSL session id
    SSL_CIPHER string The cipher specification name
    SSL_CIPHER_EXPORT string true if cipher is an export cipher
    SSL_CIPHER_USEKEYSIZE number Number of cipher bits (actually used)
    SSL_CIPHER_ALGKEYSIZE number Number of cipher bits (possible)
    SSL_VERSION_INTERFACE string The mod_ssl program version
    SSL_VERSION_LIBRARY string The OpenSSL program version
    SSL_CLIENT_M_VERSION string The version of the client certificate
    SSL_CLIENT_M_SERIAL string The serial of the client certificate
    SSL_CLIENT_S_DN string Subject DN in client's certificate
    SSL_CLIENT_S_DN_x509 string Component of client's Subject DN
    SSL_CLIENT_I_DN string Issuer DN of client's certificate
    SSL_CLIENT_I_DN_x509 string Component of client's Issuer DN
    SSL_CLIENT_V_START string Validity of client's certificate (start time)
    SSL_CLIENT_V_END string Validity of client's certificate (end time)
    SSL_CLIENT_A_SIG string Algorithm used for the signature of client's certificate
    SSL_CLIENT_A_KEY string Algorithm used for the public key of client's certificate
    SSL_CLIENT_CERT string PEM-encoded client certificate
    SSL_CLIENT_CERT_CHAINn string PEM-encoded certificates in client certificate chain
    SSL_CLIENT_VERIFY string NONE, SUCCESS, GENEROUS or FAILED:reason
    SSL_SERVER_M_VERSION string The version of the server certificate
    SSL_SERVER_M_SERIAL string The serial of the server certificate
    SSL_SERVER_S_DN string Subject DN in server's certificate
    SSL_SERVER_S_DN_x509 string Component of server's Subject DN
    SSL_SERVER_I_DN string Issuer DN of server's certificate
    SSL_SERVER_I_DN_x509 string Component of server's Issuer DN
    SSL_SERVER_V_START string Validity of server's certificate (start time)
    SSL_SERVER_V_END string Validity of server's certificate (end time)
    SSL_SERVER_A_SIG string Algorithm used for the signature of server's certificate
    SSL_SERVER_A_KEY string Algorithm used for the public key of server's certificate
    SSL_SERVER_CERT string PEM-encoded server certificate
    -[ where x509 is a component of a X.509 DN: - C,ST,L,O,OU,CN,T,I,G,S,D,UID,Email ] -
    -
    -
    -
    - -
    Custom Log Formats - -

    When mod_ssl is built into Apache or at least -loaded (under DSO situation) additional functions exist for the Custom Log Format of -mod_log_config. First there is an -additional ``%{varname}x'' -eXtension format function which can be used to expand any variables -provided by any module, especially those provided by mod_ssl which can -you find in the above table.

    -

    -For backward compatibility there is additionally a special -``%{name}c'' cryptography format function -provided. Information about this function is provided in the Compatibility chapter.

    -

    -Example:

    - -CustomLog logs/ssl_request_log \ - "%t %h %{SSL_PROTOCOL}x %{SSL_CIPHER}x \"%r\" %b" - -
    - - -SSLPassPhraseDialog -Type of pass phrase dialog for encrypted private -keys -SSLPassPhraseDialog type -SSLPassPhraseDialog builtin -server config - - -

    -When Apache starts up it has to read the various Certificate (see -SSLCertificateFile) and -Private Key (see SSLCertificateKeyFile) files of the -SSL-enabled virtual servers. Because for security reasons the Private -Key files are usually encrypted, mod_ssl needs to query the -administrator for a Pass Phrase in order to decrypt those files. This -query can be done in two ways which can be configured by -type:

    -
      -
    • builtin -

      - This is the default where an interactive terminal dialog occurs at startup - time just before Apache detaches from the terminal. Here the administrator - has to manually enter the Pass Phrase for each encrypted Private Key file. - Because a lot of SSL-enabled virtual hosts can be configured, the - following reuse-scheme is used to minimize the dialog: When a Private Key - file is encrypted, all known Pass Phrases (at the beginning there are - none, of course) are tried. If one of those known Pass Phrases succeeds no - dialog pops up for this particular Private Key file. If none succeeded, - another Pass Phrase is queried on the terminal and remembered for the next - round (where it perhaps can be reused).

      -

      - This scheme allows mod_ssl to be maximally flexible (because for N encrypted - Private Key files you can use N different Pass Phrases - but then - you have to enter all of them, of course) while minimizing the terminal - dialog (i.e. when you use a single Pass Phrase for all N Private Key files - this Pass Phrase is queried only once).

    • - -
    • exec:/path/to/program -

      - Here an external program is configured which is called at startup for each - encrypted Private Key file. It is called with two arguments (the first is - of the form ``servername:portnumber'', the second is either - ``RSA'' or ``DSA''), which indicate for which - server and algorithm it has to print the corresponding Pass Phrase to - stdout. The intent is that this external program first runs - security checks to make sure that the system is not compromised by an - attacker, and only when these checks were passed successfully it provides - the Pass Phrase.

      -

      - Both these security checks, and the way the Pass Phrase is determined, can - be as complex as you like. Mod_ssl just defines the interface: an - executable program which provides the Pass Phrase on stdout. - Nothing more or less! So, if you're really paranoid about security, here - is your interface. Anything else has to be left as an exercise to the - administrator, because local security requirements are so different.

      -

      - The reuse-algorithm above is used here, too. In other words: The external - program is called only once per unique Pass Phrase.

    • -
    -

    -Example:

    - -SSLPassPhraseDialog exec:/usr/local/apache/sbin/pp-filter - -
    -
    - - -SSLMutex -Semaphore for internal mutual exclusion of -operations -SSLMutex type -SSLMutex none -server config - - -

    -This configures the SSL engine's semaphore (aka. lock) which is used for mutual -exclusion of operations which have to be done in a synchronized way between the -pre-forked Apache server processes. This directive can only be used in the -global server context because it's only useful to have one global mutex.

    -

    -The following Mutex types are available:

    -
      -
    • none -

      - This is the default where no Mutex is used at all. Use it at your own - risk. But because currently the Mutex is mainly used for synchronizing - write access to the SSL Session Cache you can live without it as long - as you accept a sometimes garbled Session Cache. So it's not recommended - to leave this the default. Instead configure a real Mutex.

    • -
    • file:/path/to/mutex -

      - This is the portable and (under Unix) always provided Mutex variant where - a physical (lock-)file is used as the Mutex. Always use a local disk - filesystem for /path/to/mutex and never a file residing on a - NFS- or AFS-filesystem. Note: Internally, the Process ID (PID) of the - Apache parent process is automatically appended to - /path/to/mutex to make it unique, so you don't have to worry - about conflicts yourself. Notice that this type of mutex is not available - under the Win32 environment. There you have to use the semaphore - mutex.

    • -
    • sem -

      - This is the most elegant but also most non-portable Mutex variant where a - SysV IPC Semaphore (under Unix) and a Windows Mutex (under Win32) is used - when possible. It is only available when the underlying platform - supports it.

    • -
    -Example -SSLMutex file:/usr/local/apache/logs/ssl_mutex - -
    -
    - - -SSLRandomSeed -Pseudo Random Number Generator (PRNG) seeding -source -SSLRandomSeed context source -[bytes] -server config - - -

    -This configures one or more sources for seeding the Pseudo Random Number -Generator (PRNG) in OpenSSL at startup time (context is -startup) and/or just before a new SSL connection is established -(context is connect). This directive can only be used -in the global server context because the PRNG is a global facility.

    -

    -The following source variants are available:

    -
      -
    • builtin -

      This is the always available builtin seeding source. It's usage - consumes minimum CPU cycles under runtime and hence can be always used - without drawbacks. The source used for seeding the PRNG contains of the - current time, the current process id and (when applicable) a randomly - choosen 1KB extract of the inter-process scoreboard structure of Apache. - The drawback is that this is not really a strong source and at startup - time (where the scoreboard is still not available) this source just - produces a few bytes of entropy. So you should always, at least for the - startup, use an additional seeding source.

    • -
    • file:/path/to/source -

      - This variant uses an external file /path/to/source as the - source for seeding the PRNG. When bytes is specified, only the - first bytes number of bytes of the file form the entropy (and - bytes is given to /path/to/source as the first - argument). When bytes is not specified the whole file forms the - entropy (and 0 is given to /path/to/source as - the first argument). Use this especially at startup time, for instance - with an available /dev/random and/or - /dev/urandom devices (which usually exist on modern Unix - derivates like FreeBSD and Linux).

      -

      - But be careful: Usually /dev/random provides only as - much entropy data as it actually has, i.e. when you request 512 bytes of - entropy, but the device currently has only 100 bytes available two things - can happen: On some platforms you receive only the 100 bytes while on - other platforms the read blocks until enough bytes are available (which - can take a long time). Here using an existing /dev/urandom is - better, because it never blocks and actually gives the amount of requested - data. The drawback is just that the quality of the received data may not - be the best.

      -

      - On some platforms like FreeBSD one can even control how the entropy is - actually generated, i.e. by which system interrupts. More details one can - find under rndcontrol(8) on those platforms. Alternatively, when - your system lacks such a random device, you can use tool - like EGD - (Entropy Gathering Daemon) and run it's client program with the - exec:/path/to/program/ variant (see below) or use - egd:/path/to/egd-socket (see below).

    • - -
    • exec:/path/to/program -

      - This variant uses an external executable - /path/to/program as the source for seeding the - PRNG. When bytes is specified, only the first - bytes number of bytes of its stdout contents - form the entropy. When bytes is not specified, the - entirety of the data produced on stdout form the - entropy. Use this only at startup time when you need a very strong - seeding with the help of an external program (for instance as in - the example above with the truerand utility you can - find in the mod_ssl distribution which is based on the AT&T - truerand library). Using this in the connection context - slows down the server too dramatically, of course. So usually you - should avoid using external programs in that context.

    • -
    • egd:/path/to/egd-socket (Unix only) -

      - This variant uses the Unix domain socket of the - external Entropy Gathering Daemon (EGD) (see http://www.lothar.com/tech - /crypto/) to seed the PRNG. Use this if no random device exists - on your platform.

    • -
    -Example -SSLRandomSeed startup builtin
    -SSLRandomSeed startup file:/dev/random
    -SSLRandomSeed startup file:/dev/urandom 1024
    -SSLRandomSeed startup exec:/usr/local/bin/truerand 16
    -SSLRandomSeed connect builtin
    -SSLRandomSeed connect file:/dev/random
    -SSLRandomSeed connect file:/dev/urandom 1024
    -
    -
    -
    - - -SSLSessionCache -Type of the global/inter-process SSL Session -Cache -SSLSessionCache type -SSLSessionCache none -server config - - -

    -This configures the storage type of the global/inter-process SSL Session -Cache. This cache is an optional facility which speeds up parallel request -processing. For requests to the same server process (via HTTP keep-alive), -OpenSSL already caches the SSL session information locally. But because modern -clients request inlined images and other data via parallel requests (usually -up to four parallel requests are common) those requests are served by -different pre-forked server processes. Here an inter-process cache -helps to avoid unneccessary session handshakes.

    -

    -The following two storage types are currently supported:

    -
      -
    • none -

      - This is the default and just disables the global/inter-process Session - Cache. There is no drawback in functionality, but a noticeable speed - penalty can be observed.

    • -
    • dbm:/path/to/datafile -

      - This makes use of a DBM hashfile on the local disk to synchronize the - local OpenSSL memory caches of the server processes. The slight increase - in I/O on the server results in a visible request speedup for your - clients, so this type of storage is generally recommended.

    • -
    • shm:/path/to/datafile[(size)] -

      - This makes use of a high-performance hash table (approx. size bytes - in size) inside a shared memory segment in RAM (established via - /path/to/datafile) to synchronize the local OpenSSL memory - caches of the server processes. This storage type is not available on all - platforms. See the mod_ssl INSTALL document for details on - how to build Apache+EAPI with shared memory support.

    • -
    -Examples -SSLSessionCache dbm:/usr/local/apache/logs/ssl_gcache_data
    -SSLSessionCache shm:/usr/local/apache/logs/ssl_gcache_data(512000) -
    -
    -
    - - -SSLSessionCacheTimeout -Number of seconds before an SSL session expires -in the Session Cache -SSLSessionCacheTimeout seconds -SSLSessionCacheTimeout 300 -server config -virtual host - - -

    -This directive sets the timeout in seconds for the information stored in the -global/inter-process SSL Session Cache and the OpenSSL internal memory cache. -It can be set as low as 15 for testing, but should be set to higher -values like 300 in real life.

    -Example -SSLSessionCacheTimeout 600 - -
    -
    - - -SSLEngine -SSL Engine Operation Switch -SSLEngine on|off -SSLEngine off -server config -virtual host - - -

    -This directive toggles the usage of the SSL/TLS Protocol Engine. This -is usually used inside a VirtualHost section to enable SSL/TLS for a -particular virtual host. By default the SSL/TLS Protocol Engine is -disabled for both the main server and all configured virtual hosts.

    -Example -<VirtualHost _default_:443>
    -SSLEngine on
    -...
    -</VirtualHost> -
    -
    -
    - - -SSLProtocol -Configure usable SSL protocol flavors -SSLProtocol [+|-]protocol ... -SSLProtocol all -server config -virtual host -Options - - -

    -This directive can be used to control the SSL protocol flavors mod_ssl should -use when establishing its server environment. Clients then can only connect -with one of the provided protocols.

    -

    -The available (case-insensitive) protocols are:

    -
      -
    • SSLv2 -

      - This is the Secure Sockets Layer (SSL) protocol, version 2.0. It is the - original SSL protocol as designed by Netscape Corporation.

    • - -
    • SSLv3 -

      - This is the Secure Sockets Layer (SSL) protocol, version 3.0. It is the - successor to SSLv2 and the currently (as of February 1999) de-facto - standardized SSL protocol from Netscape Corporation. It's supported by - almost all popular browsers.

    • - -
    • TLSv1 -

      - This is the Transport Layer Security (TLS) protocol, version 1.0. It is the - successor to SSLv3 and currently (as of February 1999) still under - construction by the Internet Engineering Task Force (IETF). It's still - not supported by any popular browsers.

    • - -
    • All -

      - This is a shortcut for ``+SSLv2 +SSLv3 +TLSv1'' and a - convinient way for enabling all protocols except one when used in - combination with the minus sign on a protocol as the example above - shows.

    • -
    -Example -# enable SSLv3 and TLSv1, but not SSLv2
    -SSLProtocol all -SSLv2 -
    -
    -
    - - -SSLCipherSuite -Cipher Suite available for negotiation in SSL -handshake -SSLCipherSuite cipher-spec -SSLCipherSuite ALL:!ADH:RC4+RSA:+HIGH:+MEDIUM:+LOW:+SSLv2:+EXP -server config -virtual host -directory -.htaccess -AuthConfig - - -

    -This complex directive uses a colon-separated cipher-spec string -consisting of OpenSSL cipher specifications to configure the Cipher Suite the -client is permitted to negotiate in the SSL handshake phase. Notice that this -directive can be used both in per-server and per-directory context. In -per-server context it applies to the standard SSL handshake when a connection -is established. In per-directory context it forces a SSL renegotation with the -reconfigured Cipher Suite after the HTTP request was read but before the HTTP -response is sent.

    -

    -An SSL cipher specification in cipher-spec is composed of 4 major -attributes plus a few extra minor ones:

    -
      -
    • Key Exchange Algorithm:
      - RSA or Diffie-Hellman variants. -
    • -
    • Authentication Algorithm:
      - RSA, Diffie-Hellman, DSS or none. -
    • -
    • Cipher/Encryption Algorithm:
      - DES, Triple-DES, RC4, RC2, IDEA or none. -
    • -
    • MAC Digest Algorithm:
      - MD5, SHA or SHA1. -
    • -
    -

    An SSL cipher can also be an export cipher and is either a SSLv2 or SSLv3/TLSv1 -cipher (here TLSv1 is equivalent to SSLv3). To specify which ciphers to use, -one can either specify all the Ciphers, one at a time, or use aliases to -specify the preference and order for the ciphers (see Table -1).

    - -
    - - - -
    Table 1: OpenSSL Cipher Specification Tags
    - - -
    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    Tag Description
    Key Exchange Algorithm:
    kRSA RSA key exchange
    kDHr Diffie-Hellman key exchange with RSA key
    kDHd Diffie-Hellman key exchange with DSA key
    kEDH Ephemeral (temp.key) Diffie-Hellman key exchange (no cert)
    Authentication Algorithm:
    aNULL No authentication
    aRSA RSA authentication
    aDSS DSS authentication
    aDH Diffie-Hellman authentication
    Cipher Encoding Algorithm:
    eNULL No encoding
    DES DES encoding
    3DES Triple-DES encoding
    RC4 RC4 encoding
    RC2 RC2 encoding
    IDEA IDEA encoding
    MAC Digest Algorithm:
    MD5 MD5 hash function
    SHA1 SHA1 hash function
    SHA SHA hash function
    Aliases:
    SSLv2 all SSL version 2.0 ciphers
    SSLv3 all SSL version 3.0 ciphers
    TLSv1 all TLS version 1.0 ciphers
    EXP all export ciphers
    EXPORT40 all 40-bit export ciphers only
    EXPORT56 all 56-bit export ciphers only
    LOW all low strength ciphers (no export, single DES)
    MEDIUM all ciphers with 128 bit encryption
    HIGH all ciphers using Triple-DES
    RSA all ciphers using RSA key exchange
    DH all ciphers using Diffie-Hellman key exchange
    EDH all ciphers using Ephemeral Diffie-Hellman key exchange
    ADH all ciphers using Anonymous Diffie-Hellman key exchange
    DSS all ciphers using DSS authentication
    NULL all ciphers using no encryption
    -
    -
    -
    -

    -Now where this becomes interesting is that these can be put together -to specify the order and ciphers you wish to use. To speed this up -there are also aliases (SSLv2, SSLv3, TLSv1, EXP, LOW, MEDIUM, -HIGH) for certain groups of ciphers. These tags can be joined -together with prefixes to form the cipher-spec. Available -prefixes are:

    -
      -
    • none: add cipher to list
    • -
    • +: add ciphers to list and pull them to current location in list
    • -
    • -: remove cipher from list (can be added later again)
    • -
    • !: kill cipher from list completely (can not be added later again)
    • -
    -

    A simpler way to look at all of this is to use the ``openssl ciphers --v'' command which provides a nice way to successively create the -correct cipher-spec string. The default cipher-spec string -is ``ALL:!ADH:RC4+RSA:+HIGH:+MEDIUM:+LOW:+SSLv2:+EXP'' which -means the following: first, remove from consideration any ciphers that do not -authenticate, i.e. for SSL only the Anonymous Diffie-Hellman ciphers. Next, -use ciphers using RC4 and RSA. Next include the high, medium and then the low -security ciphers. Finally pull all SSLv2 and export ciphers to the -end of the list.

    - -
    -$ openssl ciphers -v 'ALL:!ADH:RC4+RSA:+HIGH:+MEDIUM:+LOW:+SSLv2:+EXP'
    -NULL-SHA                SSLv3 Kx=RSA      Au=RSA  Enc=None      Mac=SHA1
    -NULL-MD5                SSLv3 Kx=RSA      Au=RSA  Enc=None      Mac=MD5
    -EDH-RSA-DES-CBC3-SHA    SSLv3 Kx=DH       Au=RSA  Enc=3DES(168) Mac=SHA1
    -...                     ...               ...     ...           ...
    -EXP-RC4-MD5             SSLv3 Kx=RSA(512) Au=RSA  Enc=RC4(40)   Mac=MD5  export
    -EXP-RC2-CBC-MD5         SSLv2 Kx=RSA(512) Au=RSA  Enc=RC2(40)   Mac=MD5  export
    -EXP-RC4-MD5             SSLv2 Kx=RSA(512) Au=RSA  Enc=RC4(40)   Mac=MD5  export
    -
    -
    -

    The complete list of particular RSA & DH ciphers for SSL is given in Table 2.

    -Example -SSLCipherSuite RSA:!EXP:!NULL:+HIGH:+MEDIUM:-LOW - -
    - - - -
    Table 2: Particular SSL Ciphers
    - - -
    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    Cipher-Tag Protocol Key Ex. Auth. Enc. MAC Type
    RSA Ciphers:
    DES-CBC3-SHA SSLv3 RSA RSA 3DES(168) SHA1  
    DES-CBC3-MD5 SSLv2 RSA RSA 3DES(168) MD5  
    IDEA-CBC-SHA SSLv3 RSA RSA IDEA(128) SHA1  
    RC4-SHA SSLv3 RSA RSA RC4(128) SHA1  
    RC4-MD5 SSLv3 RSA RSA RC4(128) MD5  
    IDEA-CBC-MD5 SSLv2 RSA RSA IDEA(128) MD5  
    RC2-CBC-MD5 SSLv2 RSA RSA RC2(128) MD5  
    RC4-MD5 SSLv2 RSA RSA RC4(128) MD5  
    DES-CBC-SHA SSLv3 RSA RSA DES(56) SHA1  
    RC4-64-MD5 SSLv2 RSA RSA RC4(64) MD5  
    DES-CBC-MD5 SSLv2 RSA RSA DES(56) MD5  
    EXP-DES-CBC-SHA SSLv3 RSA(512) RSA DES(40) SHA1 export
    EXP-RC2-CBC-MD5 SSLv3 RSA(512) RSA RC2(40) MD5 export
    EXP-RC4-MD5 SSLv3 RSA(512) RSA RC4(40) MD5 export
    EXP-RC2-CBC-MD5 SSLv2 RSA(512) RSA RC2(40) MD5 export
    EXP-RC4-MD5 SSLv2 RSA(512) RSA RC4(40) MD5 export
    NULL-SHA SSLv3 RSA RSA None SHA1  
    NULL-MD5 SSLv3 RSA RSA None MD5  
    Diffie-Hellman Ciphers:
    ADH-DES-CBC3-SHA SSLv3 DH None 3DES(168) SHA1  
    ADH-DES-CBC-SHA SSLv3 DH None DES(56) SHA1  
    ADH-RC4-MD5 SSLv3 DH None RC4(128) MD5  
    EDH-RSA-DES-CBC3-SHA SSLv3 DH RSA 3DES(168) SHA1  
    EDH-DSS-DES-CBC3-SHA SSLv3 DH DSS 3DES(168) SHA1  
    EDH-RSA-DES-CBC-SHA SSLv3 DH RSA DES(56) SHA1  
    EDH-DSS-DES-CBC-SHA SSLv3 DH DSS DES(56) SHA1  
    EXP-EDH-RSA-DES-CBC-SHA SSLv3 DH(512) RSA DES(40) SHA1 export
    EXP-EDH-DSS-DES-CBC-SHA SSLv3 DH(512) DSS DES(40) SHA1 export
    EXP-ADH-DES-CBC-SHA SSLv3 DH(512) None DES(40) SHA1 export
    EXP-ADH-RC4-MD5 SSLv3 DH(512) None RC4(40) MD5 export
    -
    -
    -
    -
    -
    - - -SSLCertificateFile -Server PEM-encoded X.509 Certificate file -SSLCertificateFile file-path -server config -virtual host - - -

    -This directive points to the PEM-encoded Certificate file for the server and -optionally also to the corresponding RSA or DSA Private Key file for it -(contained in the same file). If the contained Private Key is encrypted the -Pass Phrase dialog is forced at startup time. This directive can be used up to -two times (referencing different filenames) when both a RSA and a DSA based -server certificate is used in parallel.

    -Example -SSLCertificateFile /usr/local/apache/conf/ssl.crt/server.crt - -
    -
    - - -SSLCertificateKeyFile -Server PEM-encoded Private Key file -SSLCertificateKeyFile file-path -server config -virtual host - - -

    -This directive points to the PEM-encoded Private Key file for the -server. If the Private Key is not combined with the Certificate in the -SSLCertificateFile, use this additional directive to -point to the file with the stand-alone Private Key. When -SSLCertificateFile is used and the file -contains both the Certificate and the Private Key this directive need -not be used. But we strongly discourage this practice. Instead we -recommend you to separate the Certificate and the Private Key. If the -contained Private Key is encrypted, the Pass Phrase dialog is forced -at startup time. This directive can be used up to two times -(referencing different filenames) when both a RSA and a DSA based -private key is used in parallel.

    -Example -SSLCertificateKeyFile /usr/local/apache/conf/ssl.key/server.key - -
    -
    - - -SSLCertificateChainFile -File of PEM-encoded Server CA Certificates -SSLCertificateChainFile file-path -server config -virtual host - - -

    -This directive sets the optional all-in-one file where you can -assemble the certificates of Certification Authorities (CA) which form the -certificate chain of the server certificate. This starts with the issuing CA -certificate of of the server certificate and can range up to the root CA -certificate. Such a file is simply the concatenation of the various -PEM-encoded CA Certificate files, usually in certificate chain order.

    -

    -This should be used alternatively and/or additionally to SSLCACertificatePath for explicitly -constructing the server certificate chain which is sent to the browser -in addition to the server certificate. It is especially useful to -avoid conflicts with CA certificates when using client -authentication. Because although placing a CA certificate of the -server certificate chain into SSLCACertificatePath has the same effect -for the certificate chain construction, it has the side-effect that -client certificates issued by this same CA certificate are also -accepted on client authentication. That's usually not one expect.

    -

    -But be careful: Providing the certificate chain works only if you are using a -single (either RSA or DSA) based server certificate. If you are -using a coupled RSA+DSA certificate pair, this will work only if actually both -certificates use the same certificate chain. Else the browsers will be -confused in this situation.

    -Example -SSLCertificateChainFile /usr/local/apache/conf/ssl.crt/ca.crt - -
    -
    - - -SSLCACertificatePath -Directory of PEM-encoded CA Certificates for -Client Auth -SSLCACertificatePath directory-path -server config -virtual host - - -

    -This directive sets the directory where you keep the Certificates of -Certification Authorities (CAs) whose clients you deal with. These are used to -verify the client certificate on Client Authentication.

    -

    -The files in this directory have to be PEM-encoded and are accessed through -hash filenames. So usually you can't just place the Certificate files -there: you also have to create symbolic links named -hash-value.N. And you should always make sure this directory -contains the appropriate symbolic links. Use the Makefile which -comes with mod_ssl to accomplish this task.

    -Example -SSLCACertificatePath /usr/local/apache/conf/ssl.crt/ - -
    -
    - - -SSLCACertificateFile -File of concatenated PEM-encoded CA Certificates -for Client Auth -SSLCACertificateFile file-path -server config -virtual host - - -

    -This directive sets the all-in-one file where you can assemble the -Certificates of Certification Authorities (CA) whose clients you deal -with. These are used for Client Authentication. Such a file is simply the -concatenation of the various PEM-encoded Certificate files, in order of -preference. This can be used alternatively and/or additionally to -SSLCACertificatePath.

    -Example -SSLCACertificateFile /usr/local/apache/conf/ssl.crt/ca-bundle-client.crt - -
    -
    - - -SSLCARevocationPath -Directory of PEM-encoded CA CRLs for -Client Auth -SSLCARevocationPath directory-path -server config -virtual host - - -

    -This directive sets the directory where you keep the Certificate Revocation -Lists (CRL) of Certification Authorities (CAs) whose clients you deal with. -These are used to revoke the client certificate on Client Authentication.

    -

    -The files in this directory have to be PEM-encoded and are accessed through -hash filenames. So usually you have not only to place the CRL files there. -Additionally you have to create symbolic links named -hash-value.rN. And you should always make sure this directory -contains the appropriate symbolic links. Use the Makefile which -comes with mod_ssl to accomplish this task.

    -Example -SSLCARevocationPath /usr/local/apache/conf/ssl.crl/ - -
    -
    - - -SSLCARevocationFile -File of concatenated PEM-encoded CA CRLs for -Client Auth -SSLCARevocationFile file-path -server config -virtual host - - -

    -This directive sets the all-in-one file where you can -assemble the Certificate Revocation Lists (CRL) of Certification -Authorities (CA) whose clients you deal with. These are used -for Client Authentication. Such a file is simply the concatenation of -the various PEM-encoded CRL files, in order of preference. This can be -used alternatively and/or additionally to SSLCARevocationPath.

    -Example -SSLCARevocationFile /usr/local/apache/conf/ssl.crl/ca-bundle-client.crl - -
    -
    - - -SSLVerifyClient -Type of Client Certificate verification -SSLVerifyClient level -SSLVerifyClient none -server config -virtual host -directory -.htaccess -AuthConfig - - -

    -This directive sets the Certificate verification level for the Client -Authentication. Notice that this directive can be used both in per-server and -per-directory context. In per-server context it applies to the client -authentication process used in the standard SSL handshake when a connection is -established. In per-directory context it forces a SSL renegotation with the -reconfigured client verification level after the HTTP request was read but -before the HTTP response is sent.

    -

    -The following levels are available for level:

    -
      -
    • none: - no client Certificate is required at all
    • -
    • optional: - the client may present a valid Certificate
    • -
    • require: - the client has to present a valid Certificate
    • -
    • optional_no_ca: - the client may present a valid Certificate
      - but it need not to be (successfully) verifiable.
    • -
    -

    In practice only levels none and -require are really interesting, because level -optional doesn't work with all browsers and level -optional_no_ca is actually against the idea of -authentication (but can be used to establish SSL test pages, etc.)

    -Example -SSLVerifyClient require - -
    -
    - - -SSLVerifyDepth -Maximum depth of CA Certificates in Client -Certificate verification -SSLVerifyDepth number -SSLVerifyDepth 1 -server config -virtual host -directory -.htaccess -AuthConfig - - -

    -This directive sets how deeply mod_ssl should verify before deciding that the -clients don't have a valid certificate. Notice that this directive can be -used both in per-server and per-directory context. In per-server context it -applies to the client authentication process used in the standard SSL -handshake when a connection is established. In per-directory context it forces -a SSL renegotation with the reconfigured client verification depth after the -HTTP request was read but before the HTTP response is sent.

    -

    -The depth actually is the maximum number of intermediate certificate issuers, -i.e. the number of CA certificates which are max allowed to be followed while -verifying the client certificate. A depth of 0 means that self-signed client -certificates are accepted only, the default depth of 1 means the client -certificate can be self-signed or has to be signed by a CA which is directly -known to the server (i.e. the CA's certificate is under -SSLCACertificatePath), etc.

    -Example -SSLVerifyDepth 10 - -
    -
    - - -SSLLog -Where to write the dedicated SSL engine logfile -SSLLog file-path -server config -virtual host - - -

    -This directive sets the name of the dedicated SSL protocol engine logfile. -Error type messages are additionally duplicated to the general Apache error -log file (directive ErrorLog). Put this somewhere where it cannot -be used for symlink attacks on a real server (i.e. somewhere where only root -can write). If the file-path does not begin with a slash -('/') then it is assumed to be relative to the Server -Root. If file-path begins with a bar ('|') then the -following string is assumed to be a path to an executable program to which a -reliable pipe can be established. The directive should occur only once per -virtual server config.

    -Example -SSLLog /usr/local/apache/logs/ssl_engine_log - -
    -
    - - -SSLLogLevel -Logging level for the dedicated SSL engine -logfile -SSLLogLevel level -SSLLogLevel none -server config -virtual host - - -

    -This directive sets the verbosity degree of the dedicated SSL protocol engine -logfile. The level is one of the following (in ascending order where -higher levels include lower levels):

    -
      -
    • none
      - no dedicated SSL logging is done, but messages of level - ``error'' are still written to the general Apache error - logfile. -
    • -
    • error
      - log messages of error type only, i.e. messages which show fatal situations - (processing is stopped). Those messages are also duplicated to the - general Apache error logfile. -
    • -
    • warn
      - log also warning messages, i.e. messages which show non-fatal problems - (processing is continued). -
    • -
    • info
      - log also informational messages, i.e. messages which show major - processing steps. -
    • -
    • trace
      - log also trace messages, i.e. messages which show minor processing steps. -
    • -
    • debug
      - log also debugging messages, i.e. messages which show development and - low-level I/O information. -
    • -
    -Example -SSLLogLevel warn - -
    -
    - - -SSLOptions -Configure various SSL engine run-time options -SSLOptions [+|-]option ... -server config -virtual host -directory -.htaccess -Options - - -

    -This directive can be used to control various run-time options on a -per-directory basis. Normally, if multiple SSLOptions -could apply to a directory, then the most specific one is taken -completely; the options are not merged. However if all the -options on the SSLOptions directive are preceded by a -plus (+) or minus (-) symbol, the options -are merged. Any options preceded by a + are added to the -options currently in force, and any options preceded by a -- are removed from the options currently in force.

    -

    -The available options are:

    -
      -
    • StdEnvVars -

      - When this option is enabled, the standard set of SSL related CGI/SSI - environment variables are created. This per default is disabled for - performance reasons, because the information extraction step is a - rather expensive operation. So one usually enables this option for - CGI and SSI requests only.

      -
    • -
    • CompatEnvVars -

      - When this option is enabled, additional CGI/SSI environment variables are - created for backward compatibility to other Apache SSL solutions. Look in - the Compatibility chapter for details - on the particular variables generated.

      -
    • -
    • ExportCertData -

      - When this option is enabled, additional CGI/SSI environment variables are - created: SSL_SERVER_CERT, SSL_CLIENT_CERT and - SSL_CLIENT_CERT_CHAINn (with n = 0,1,2,..). - These contain the PEM-encoded X.509 Certificates of server and client for - the current HTTPS connection and can be used by CGI scripts for deeper - Certificate checking. Additionally all other certificates of the client - certificate chain are provided, too. This bloats up the environment a - little bit which is why you have to use this option to enable it on - demand.

      -
    • -
    • FakeBasicAuth -

      - When this option is enabled, the Subject Distinguished Name (DN) of the - Client X509 Certificate is translated into a HTTP Basic Authorization - username. This means that the standard Apache authentication methods can - be used for access control. The user name is just the Subject of the - Client's X509 Certificate (can be determined by running OpenSSL's - openssl x509 command: openssl x509 -noout -subject -in - certificate.crt). Note that no password is - obtained from the user. Every entry in the user file needs this password: - ``xxj31ZMTZzkVA'', which is the DES-encrypted version of the - word `password''. Those who live under MD5-based encryption - (for instance under FreeBSD or BSD/OS, etc.) should use the following MD5 - hash of the same word: ``$1$OXLyS...$Owx8s2/m9/gfkcRVXzgoE/''.

      -
    • -
    • StrictRequire -

      - This forces forbidden access when SSLRequireSSL or - SSLRequire successfully decided that access should be - forbidden. Usually the default is that in the case where a ``Satisfy - any'' directive is used, and other access restrictions are passed, - denial of access due to SSLRequireSSL or - SSLRequire is overridden (because that's how the Apache - Satisfy mechanism should work.) But for strict access restriction - you can use SSLRequireSSL and/or SSLRequire in - combination with an ``SSLOptions +StrictRequire''. Then an - additional ``Satisfy Any'' has no chance once mod_ssl has - decided to deny access.

      -
    • -
    • OptRenegotiate -

      - This enables optimized SSL connection renegotiation handling when SSL - directives are used in per-directory context. By default a strict - scheme is enabled where every per-directory reconfiguration of - SSL parameters causes a full SSL renegotiation handshake. When this - option is used mod_ssl tries to avoid unnecessary handshakes by doing more - granular (but still safe) parameter checks. Nevertheless these granular - checks sometimes maybe not what the user expects, so enable this on a - per-directory basis only, please.

      -
    • -
    -Example -SSLOptions +FakeBasicAuth -StrictRequire
    -<Files ~ "\.(cgi|shtml)$">
    - SSLOptions +StdEnvVars +CompatEnvVars -ExportCertData
    -<Files> -
    -
    -
    - - -SSLRequireSSL -Deny access when SSL is not used for the -HTTP request -SSLRequireSSL -directory -.htaccess -AuthConfig - - -

    -This directive forbids access unless HTTP over SSL (i.e. HTTPS) is enabled for -the current connection. This is very handy inside the SSL-enabled virtual -host or directories for defending against configuration errors that expose -stuff that should be protected. When this directive is present all requests -are denied which are not using SSL.

    -Example -SSLRequireSSL - -
    -
    - - -SSLRequire -Allow access only when an arbitrarily complex -boolean expression is true -SSLRequire expression -directory -.htaccess -AuthConfig - - -

    -This directive specifies a general access requirement which has to be -fulfilled in order to allow access. It's a very powerful directive because the -requirement specification is an arbitrarily complex boolean expression -containing any number of access checks.

    -

    -The expression must match the following syntax (given as a BNF -grammar notation):

    -
    -
    -expr     ::= "true" | "false"
    -           | "!" expr
    -           | expr "&&" expr
    -           | expr "||" expr
    -           | "(" expr ")"
    -           | comp
    -
    -comp     ::= word "==" word | word "eq" word
    -           | word "!=" word | word "ne" word
    -           | word "<"  word | word "lt" word
    -           | word "<=" word | word "le" word
    -           | word ">"  word | word "gt" word
    -           | word ">=" word | word "ge" word
    -           | word "in" "{" wordlist "}"
    -           | word "=~" regex
    -           | word "!~" regex
    -
    -wordlist ::= word
    -           | wordlist "," word
    -
    -word     ::= digit
    -           | cstring
    -           | variable
    -           | function
    -
    -digit    ::= [0-9]+
    -cstring  ::= "..."
    -variable ::= "%{" varname "}"
    -function ::= funcname "(" funcargs ")"
    -
    -
    -

    while for varname any variable from Table 3 can be used. Finally for -funcname the following functions are available:

    -
      -
    • file(filename) -

      - This function takes one string argument and expands to the contents of the - file. This is especially useful for matching this contents against a - regular expression, etc.

      -
    • -
    -

    Notice that expression is first parsed into an internal machine -representation and then evaluated in a second step. Actually, in Global and -Per-Server Class context expression is parsed at startup time and -at runtime only the machine representation is executed. For Per-Directory -context this is different: here expression has to be parsed and -immediately executed for every request.

    -Example -SSLRequire ( %{SSL_CIPHER} !~ m/^(EXP|NULL)-/ \
    - and %{SSL_CLIENT_S_DN_O} eq "Snake Oil, Ltd." \
    - and %{SSL_CLIENT_S_DN_OU} in {"Staff", "CA", "Dev"} \
    - and %{TIME_WDAY} >= 1 and %{TIME_WDAY} <= 5 \
    - and %{TIME_HOUR} >= 8 and %{TIME_HOUR} <= 20 ) \
    - or %{REMOTE_ADDR} =~ m/^192\.76\.162\.[0-9]+$/ -
    -
    - - - -
    Table 3: Available Variables for SSLRequire
    - - -
    -
    -Standard CGI/1.0 and Apache variables: -
    -HTTP_USER_AGENT        PATH_INFO             AUTH_TYPE
    -HTTP_REFERER           QUERY_STRING          SERVER_SOFTWARE
    -HTTP_COOKIE            REMOTE_HOST           API_VERSION
    -HTTP_FORWARDED         REMOTE_IDENT          TIME_YEAR
    -HTTP_HOST              IS_SUBREQ             TIME_MON
    -HTTP_PROXY_CONNECTION  DOCUMENT_ROOT         TIME_DAY
    -HTTP_ACCEPT            SERVER_ADMIN          TIME_HOUR
    -HTTP:headername        SERVER_NAME           TIME_MIN
    -THE_REQUEST            SERVER_PORT           TIME_SEC
    -REQUEST_METHOD         SERVER_PROTOCOL       TIME_WDAY
    -REQUEST_SCHEME         REMOTE_ADDR           TIME
    -REQUEST_URI            REMOTE_USER           ENV:variablename
    -REQUEST_FILENAME
    -
    -SSL-related variables: -
    -HTTPS                  SSL_CLIENT_M_VERSION   SSL_SERVER_M_VERSION
    -                       SSL_CLIENT_M_SERIAL    SSL_SERVER_M_SERIAL
    -SSL_PROTOCOL           SSL_CLIENT_V_START     SSL_SERVER_V_START
    -SSL_SESSION_ID         SSL_CLIENT_V_END       SSL_SERVER_V_END
    -SSL_CIPHER             SSL_CLIENT_S_DN        SSL_SERVER_S_DN
    -SSL_CIPHER_EXPORT      SSL_CLIENT_S_DN_C      SSL_SERVER_S_DN_C
    -SSL_CIPHER_ALGKEYSIZE  SSL_CLIENT_S_DN_ST     SSL_SERVER_S_DN_ST
    -SSL_CIPHER_USEKEYSIZE  SSL_CLIENT_S_DN_L      SSL_SERVER_S_DN_L
    -SSL_VERSION_LIBRARY    SSL_CLIENT_S_DN_O      SSL_SERVER_S_DN_O
    -SSL_VERSION_INTERFACE  SSL_CLIENT_S_DN_OU     SSL_SERVER_S_DN_OU
    -                       SSL_CLIENT_S_DN_CN     SSL_SERVER_S_DN_CN
    -                       SSL_CLIENT_S_DN_T      SSL_SERVER_S_DN_T
    -                       SSL_CLIENT_S_DN_I      SSL_SERVER_S_DN_I
    -                       SSL_CLIENT_S_DN_G      SSL_SERVER_S_DN_G
    -                       SSL_CLIENT_S_DN_S      SSL_SERVER_S_DN_S
    -                       SSL_CLIENT_S_DN_D      SSL_SERVER_S_DN_D
    -                       SSL_CLIENT_S_DN_UID    SSL_SERVER_S_DN_UID
    -                       SSL_CLIENT_S_DN_Email  SSL_SERVER_S_DN_Email
    -                       SSL_CLIENT_I_DN        SSL_SERVER_I_DN
    -                       SSL_CLIENT_I_DN_C      SSL_SERVER_I_DN_C
    -                       SSL_CLIENT_I_DN_ST     SSL_SERVER_I_DN_ST
    -                       SSL_CLIENT_I_DN_L      SSL_SERVER_I_DN_L
    -                       SSL_CLIENT_I_DN_O      SSL_SERVER_I_DN_O
    -                       SSL_CLIENT_I_DN_OU     SSL_SERVER_I_DN_OU
    -                       SSL_CLIENT_I_DN_CN     SSL_SERVER_I_DN_CN
    -                       SSL_CLIENT_I_DN_T      SSL_SERVER_I_DN_T
    -                       SSL_CLIENT_I_DN_I      SSL_SERVER_I_DN_I
    -                       SSL_CLIENT_I_DN_G      SSL_SERVER_I_DN_G
    -                       SSL_CLIENT_I_DN_S      SSL_SERVER_I_DN_S
    -                       SSL_CLIENT_I_DN_D      SSL_SERVER_I_DN_D
    -                       SSL_CLIENT_I_DN_UID    SSL_SERVER_I_DN_UID
    -                       SSL_CLIENT_I_DN_Email  SSL_SERVER_I_DN_Email
    -                       SSL_CLIENT_A_SIG       SSL_SERVER_A_SIG
    -                       SSL_CLIENT_A_KEY       SSL_SERVER_A_KEY
    -                       SSL_CLIENT_CERT        SSL_SERVER_CERT
    -                       SSL_CLIENT_CERT_CHAINn
    -                       SSL_CLIENT_VERIFY
    -
    -
    -
    -
    -
    -
    -
    - -
    diff --git a/docs/manual/mod/mod_status.html b/docs/manual/mod/mod_status.html deleted file mode 100644 index 34ce9b6cc9fd992811f49ecbf93e80e7cf431955..0000000000000000000000000000000000000000 --- a/docs/manual/mod/mod_status.html +++ /dev/null @@ -1,94 +0,0 @@ - -Apache Status Module - - - -

    Apache Status Module

    -
    - -The Status Module is only available in Apache 1.1 and later.

    - -

    Function

    - -The Status module allows a server administrator to find out how well -their server is performing. A HTML page is presented that gives -the current server statistics in an easily readable form. If required -this page can be made to automatically refresh (given a compatible -browser). Another page gives a simple machine-readable list of the current -server state. -

    -The details given are: -

      -
    • The number of children serving requests -
    • The number of idle children -
    • The status of each child, the number of requests that child has -performed and the total number of bytes served by the child (*) -
    • A total number of accesses and byte count served (*) -
    • The time the server was started/restarted and the -time it has been running for -
    • Averages giving the number of requests per second, -the number of bytes served per second and the average number -of bytes per request (*) -
    • The current percentage CPU used by each child and in total by -Apache (*) -
    • The current hosts and requests being processed (*) -
    - -A compile-time option must be used to display the details marked "(*)" as -the instrumentation required for obtaining these statistics does not -exist within standard Apache. - -

    Enabling Status Support

    - -To enable status reports only for browsers from the foo.com -domain add this code to your access.conf configuration file -
    -    <Location /server-status>
    -    SetHandler server-status
    -    
    -    <Limit GET POST>
    -    order deny,allow
    -    deny from all
    -    allow from .foo.com
    -    </Limit>
    -    </Location>
    -
    -

    -You can now access server statistics by using a Web browser to access the -page http://your.server.name/server-status -

    Automatic Updates

    -You can get the status page to update itself automatically if you have -a browser that supports "refresh". Access the page -http://your.server.name/server-status?refresh=N to refresh the page -every N seconds. -

    Machine Readable Status File

    -A machine-readable version of the status file is available by accessing the -page http://your.server.name/server-status?auto. This is useful -when automatically run, see the Perl program in the /support -directory of Apache, log_server_status. - -

    Full Instrumentation

    - -To obtain full statistics you must compile Apache with a special -directive. On some machines there may be a small performance loss -if you do this. Try full statistics and see if you notice any -difference. If you do please contact -mark@ukweb.com and tell me your configuration. - -

    -Do this by adding the following to the AUX_CFLAGS line in the -"Configuration" file and then recompiling as usual. -

    -	AUX_CFLAGS= (something) -DSTATUS
    -
    - - - - -
    -Home -Index - - - - diff --git a/docs/manual/mod/mod_status.xml b/docs/manual/mod/mod_status.xml deleted file mode 100644 index d3a351f12ff050611fae5492d2df292b989f46bf..0000000000000000000000000000000000000000 --- a/docs/manual/mod/mod_status.xml +++ /dev/null @@ -1,137 +0,0 @@ - - - - -mod_status -Base -status_module -mod_status.c -Available in Apache 1.1 and later - -This module provides information on server activity and -performance. - - - - - Warning: This document has not been updated - to take into account changes made in the 2.0 version of the - Apache HTTP Server. Some of the information may still be - relevant, but please use it with care. - - -

    The Status module allows a server administrator to find out - how well their server is performing. A HTML page is presented - that gives the current server statistics in an easily readable - form. If required this page can be made to automatically - refresh (given a compatible browser). Another page gives a - simple machine-readable list of the current server state.

    - -

    The details given are:

    - -
      -
    • The number of children serving requests
    • - -
    • The number of idle children
    • - -
    • The status of each child, the number of requests that - child has performed and the total number of bytes served by - the child (*)
    • - -
    • A total number of accesses and byte count served (*)
    • - -
    • The time the server was started/restarted and the time it - has been running for
    • - -
    • Averages giving the number of requests per second, the - number of bytes served per second and the average number of - bytes per request (*)
    • - -
    • The current percentage CPU used by each child and in - total by Apache (*)
    • - -
    • The current hosts and requests being processed (*)
    • -
    - - A compile-time option must be used to display the details - marked "(*)" as the instrumentation required for obtaining - these statistics does not exist within standard Apache. -
    - -
    - Enabling Status Support - - To enable status reports only for browsers from the foo.com - domain add this code to your httpd.conf - configuration file - - <Location /server-status>
    - SetHandler server-status
    -
    - Order Deny,Allow
    - Deny from all
    - Allow from .foo.com
    - </Location> -
    - -

    You can now access server statistics by using a Web browser - to access the page - http://your.server.name/server-status

    - -

    Note that mod_status will only work - when you are running Apache in standalone mode and not - inetd mode.

    -
    - -
    - - Automatic Updates - You can get the status page to update itself automatically if - you have a browser that supports "refresh". Access the page - http://your.server.name/server-status?refresh=N to - refresh the page every N seconds. - -
    - -
    - - Machine Readable Status File - A machine-readable version of the status file is available by - accessing the page - http://your.server.name/server-status?auto. This - is useful when automatically run, see the Perl program in the - /support directory of Apache, - log_server_status. - - - It should be noted that if mod_status is - compiled into the server, its handler capability is available - in all configuration files, including - per-directory files (e.g., - .htaccess). This may have security-related - ramifications for your site. - - -
    - - - -ExtendedStatus -This directive controls whether the server keeps track of -extended status information for each request. This is only -useful if the status module is enabled on the server. -ExtendedStatus On|Off -ExtendedStatus Off -server config -ExtendedStatus is only available in Apache 1.3.2 and -later. - - -

    This setting applies to the entire server, and cannot be - enabled or disabled on a virtualhost-by-virtualhost basis.

    -
    - -
    -
    - diff --git a/docs/manual/mod/mod_suexec.html b/docs/manual/mod/mod_suexec.html deleted file mode 100644 index 0910999f1ae4f4fbc69b7c102a24fed0751809c9..0000000000000000000000000000000000000000 --- a/docs/manual/mod/mod_suexec.html +++ /dev/null @@ -1,95 +0,0 @@ - - - -Apache module mod_suexec - - - - - -

    Module mod_suexec

    - -

    -This module provides support for -running CGI scripts as a specified User and Group. -

    - -

    Status: Extension -
    -Source File: mod_suexec.c -
    -Module Identifier: suexec_module -
    -Compatibility: Available in Apache 2.0 and later. -

    - -

    Summary

    - -

    This module allows CGI scripts to run as a specified user and Group.

    - -

    Directives

    - - -

    SuexecUserGroup directive

    -

    -Syntax: SuexecUserGroup User Group
    -Default: None
    -Context: server config, virtual host
    -Status: Extension
    -Module: mod_suexec
    -Compatibility: SuexecUserGroup is only available in 2.0 and later.

    -

    -The SuexecUserGroup directive allows you to specify a user and -group for CGI programs to run as. Non-CGI requests are still processes -with the user specified in the User directive. This directive replaces -using the User and Group directives inside of VirtualHosts. -

    -
    - -

    - Apache HTTP Server Version 2.0 -

    - -Index -Home - - - diff --git a/docs/manual/mod/mod_suexec.xml b/docs/manual/mod/mod_suexec.xml deleted file mode 100644 index 0d575e4913d31aac0699265be155fd49f728a334..0000000000000000000000000000000000000000 --- a/docs/manual/mod/mod_suexec.xml +++ /dev/null @@ -1,40 +0,0 @@ - - - - -mod_suexec -Extension -suexec_module -mod_suexec.c -Available in Apache 2.0 and later - -This module allows CGI scripts to run as a specified user -and Group. - - -

    This module allows CGI scripts to run as a specified user - and Group.

    -
    - - - - -SuexecUserGroup -SuexecUserGroup User Group -None -server config -virtual host -SuexecUserGroup is only available in 2.0 and -later. - - -

    The SuexecUserGroup directive allows you to - specify a user and group for CGI programs to run as. Non-CGI - requests are still processes with the user specified in the - User directive. This directive replaces using the User and - Group directives inside of VirtualHosts.

    -
    - -
    -
    - diff --git a/docs/manual/mod/mod_unique_id.html b/docs/manual/mod/mod_unique_id.html deleted file mode 100644 index ff71fce93425cb97e0a66b2124ff986156a5aacb..0000000000000000000000000000000000000000 --- a/docs/manual/mod/mod_unique_id.html +++ /dev/null @@ -1,180 +0,0 @@ - - - -Apache module mod_unique_id - - - - - -

    Module mod_unique_id

    - -This module provides a magic token for each request which is guaranteed -to be unique across "all" requests under very specific conditions. -The unique identifier is even unique across multiple machines in a -properly configured cluster of machines. The environment variable -UNIQUE_ID is set to the identifier for each request. -Unique identifiers are useful for various reasons which are beyond the -scope of this document. - -

    Theory

    - -

    -First a brief recap of how the Apache server works on Unix machines. -This feature currently isn't supported on Windows NT. On Unix machines, -Apache creates several children, the children process requests one at -a time. Each child can serve multiple requests in its lifetime. For the -purpose of this discussion, the children don't share any data -with each other. We'll refer to the children as httpd processes. - -

    -Your website has one or more machines under your administrative control, -together we'll call them a cluster of machines. Each machine can -possibly run multiple instances of Apache. All of these collectively -are considered "the universe", and with certain assumptions we'll -show that in this universe we can generate unique identifiers for each -request, without extensive communication between machines in the cluster. - -

    -The machines in your cluster should satisfy these requirements. -(Even if you have only one machine you should synchronize its clock -with NTP.) - -

      -
    • The machines' times are synchronized via NTP or other network time - protocol. - -
    • The machines' hostnames all differ, such that the module can do a - hostname lookup on the hostname and receive a different IP address - for each machine in the cluster. -
    - -

    -As far as operating system assumptions go, we assume that pids (process -ids) fit in 32-bits. If the operating system uses more than 32-bits -for a pid, the fix is trivial but must be performed in the code. - -

    -Given those assumptions, at a single point in time we can identify -any httpd process on any machine in the cluster from all other httpd -processes. The machine's IP address and the pid of the httpd process -are sufficient to do this. So in order to generate unique identifiers -for requests we need only distinguish between different points in time. - -

    -To distinguish time we will use a Unix timestamp (seconds since January -1, 1970 UTC), and a 16-bit counter. The timestamp has only one second -granularity, so the counter is used to represent up to 65536 values -during a single second. The quadruple ( ip_addr, pid, time_stamp, -counter ) is sufficient to enumerate 65536 requests per second per -httpd process. There are issues however with pid reuse over -time, and the counter is used to alleviate this issue. - -

    -When an httpd child is created, the counter is initialized with ( -current microseconds divided by 10 ) modulo 65536 (this formula was -chosen to eliminate some variance problems with the low order bits of -the microsecond timers on some systems). When a unique identifier is -generated, the time stamp used is the time the request arrived at the -web server. The counter is incremented every time an identifier is -generated (and allowed to roll over). - -

    -The kernel generates a pid for each process as it forks the process, and -pids are allowed to roll over (they're 16-bits on many Unixes, but newer -systems have expanded to 32-bits). So over time the same pid will be -reused. However unless it is reused within the same second, it does not -destroy the uniqueness of our quadruple. That is, we assume the system -does not spawn 65536 processes in a one second interval (it may even be -32768 processes on some Unixes, but even this isn't likely to happen). - -

    -Suppose that time repeats itself for some reason. That is, suppose that -the system's clock is screwed up and it revisits a past time (or it is -too far forward, is reset correctly, and then revisits the future time). -In this case we can easily show that we can get pid and time stamp reuse. -The choice of initializer for the counter is intended to help defeat this. -Note that we really want a random number to initialize the counter, -but there aren't any readily available numbers on most systems (i.e. you -can't use rand() because you need to seed the generator, and can't seed -it with the time because time, at least at one second resolution, has -repeated itself). This is not a perfect defense. - -

    -How good a defense is it? Well suppose that one of your machines serves -at most 500 requests per second (which is a very reasonable upper bound -at this writing, because systems generally do more than just shovel out -static files). To do that it will require a number of children which -depends on how many concurrent clients you have. But we'll be pessimistic -and suppose that a single child is able to serve 500 requests per second. -There are 1000 possible starting counter values such that two sequences -of 500 requests overlap. So there is a 1.5% chance that if time (at one -second resolution) repeats itself this child will repeat a counter value, -and uniqueness will be broken. This was a very pessimistic example, -and with real world values it's even less likely to occur. If your -system is such that it's still likely to occur, then perhaps you should -make the counter 32 bits (by editing the code). - -

    -You may be concerned about the clock being "set back" during summer -daylight savings. However this isn't an issue because the times used here -are UTC, which "always" go forward. Note that x86 based Unixes may need -proper configuration for this to be true -- they should be configured to -assume that the motherboard clock is on UTC and compensate appropriately. -But even still, if you're running NTP then your UTC time will be correct -very shortly after reboot. - -

    -The UNIQUE_ID environment variable is constructed by -encoding the 112-bit (32-bit IP address, 32 bit pid, 32 bit time stamp, -16 bit counter) quadruple using the alphabet [A-Za-z0-9@-] -in a manner similar to MIME base64 encoding, producing 19 characters. -The MIME base64 alphabet is actually [A-Za-z0-9+/] however -+ and / need to be specially encoded in URLs, -which makes them less desirable. All values are encoded in network -byte ordering so that the encoding is comparable across architectures of -different byte ordering. The actual ordering of the encoding is: time -stamp, IP address, pid, counter. This ordering has a purpose, but it -should be emphasized that applications should not dissect the encoding. -Applications should treat the entire encoded UNIQUE_ID as an -opaque token, which can be compared against other UNIQUE_IDs -for equality only. - -

    -The ordering was chosen such that it's possible to change the encoding -in the future without worrying about collision with an existing database -of UNIQUE_IDs. The new encodings should also keep the time -stamp as the first element, and can otherwise use the same alphabet and -bit length. Since the time stamps are essentially an increasing sequence, -it's sufficient to have a flag second in which all machines in the -cluster stop serving and request, and stop using the old encoding format. -Afterwards they can resume requests and begin issuing the new encodings. - -

    -This we believe is a relatively portable solution to this problem. It can -be extended to multithreaded systems like Windows NT, and can grow with -future needs. The identifiers generated have essentially an infinite -life-time because future identifiers can be made longer as required. -Essentially no communication is required between machines in the cluster -(only NTP synchronization is required, which is low overhead), and no -communication between httpd processes is required (the communication is -implicit in the pid value assigned by the kernel). In very specific -situations the identifier can be shortened, but more information needs -to be assumed (for example the 32-bit IP address is overkill for any -site, but there is no portable shorter replacement for it). - -


    - -

    Directives

    - -mod_unique_id has no directives. - - - - diff --git a/docs/manual/mod/mod_unique_id.xml b/docs/manual/mod/mod_unique_id.xml deleted file mode 100755 index 6c4166c1d828bec31ff7708523b21db5627d309c..0000000000000000000000000000000000000000 --- a/docs/manual/mod/mod_unique_id.xml +++ /dev/null @@ -1,182 +0,0 @@ - - - - -mod_unique_id -Extension -unique_id_module -mod_unique_id.c -Available in Apache 1.3 and later. - -This module provides an environment variable with a unique -identifier for each request. - - - -

    This module provides a magic token for each request which is - guaranteed to be unique across "all" requests under very - specific conditions. The unique identifier is even unique - across multiple machines in a properly configured cluster of - machines. The environment variable UNIQUE_ID is - set to the identifier for each request. Unique identifiers are - useful for various reasons which are beyond the scope of this - document.

    -
    - -
    - Theory - -

    First a brief recap of how the Apache server works on Unix - machines. This feature currently isn't supported on Windows NT. - On Unix machines, Apache creates several children, the children - process requests one at a time. Each child can serve multiple - requests in its lifetime. For the purpose of this discussion, - the children don't share any data with each other. We'll refer - to the children as httpd processes.

    - -

    Your website has one or more machines under your - administrative control, together we'll call them a cluster of - machines. Each machine can possibly run multiple instances of - Apache. All of these collectively are considered "the - universe", and with certain assumptions we'll show that in this - universe we can generate unique identifiers for each request, - without extensive communication between machines in the - cluster.

    - -

    The machines in your cluster should satisfy these - requirements. (Even if you have only one machine you should - synchronize its clock with NTP.)

    - -
      -
    • The machines' times are synchronized via NTP or other - network time protocol.
    • - -
    • The machines' hostnames all differ, such that the module - can do a hostname lookup on the hostname and receive a - different IP address for each machine in the cluster.
    • -
    - -

    As far as operating system assumptions go, we assume that - pids (process ids) fit in 32-bits. If the operating system uses - more than 32-bits for a pid, the fix is trivial but must be - performed in the code.

    - -

    Given those assumptions, at a single point in time we can - identify any httpd process on any machine in the cluster from - all other httpd processes. The machine's IP address and the pid - of the httpd process are sufficient to do this. So in order to - generate unique identifiers for requests we need only - distinguish between different points in time.

    - -

    To distinguish time we will use a Unix timestamp (seconds - since January 1, 1970 UTC), and a 16-bit counter. The timestamp - has only one second granularity, so the counter is used to - represent up to 65536 values during a single second. The - quadruple ( ip_addr, pid, time_stamp, counter ) is - sufficient to enumerate 65536 requests per second per httpd - process. There are issues however with pid reuse over time, and - the counter is used to alleviate this issue.

    - -

    When an httpd child is created, the counter is initialized - with ( current microseconds divided by 10 ) modulo 65536 (this - formula was chosen to eliminate some variance problems with the - low order bits of the microsecond timers on some systems). When - a unique identifier is generated, the time stamp used is the - time the request arrived at the web server. The counter is - incremented every time an identifier is generated (and allowed - to roll over).

    - -

    The kernel generates a pid for each process as it forks the - process, and pids are allowed to roll over (they're 16-bits on - many Unixes, but newer systems have expanded to 32-bits). So - over time the same pid will be reused. However unless it is - reused within the same second, it does not destroy the - uniqueness of our quadruple. That is, we assume the system does - not spawn 65536 processes in a one second interval (it may even - be 32768 processes on some Unixes, but even this isn't likely - to happen).

    - -

    Suppose that time repeats itself for some reason. That is, - suppose that the system's clock is screwed up and it revisits a - past time (or it is too far forward, is reset correctly, and - then revisits the future time). In this case we can easily show - that we can get pid and time stamp reuse. The choice of - initializer for the counter is intended to help defeat this. - Note that we really want a random number to initialize the - counter, but there aren't any readily available numbers on most - systems (i.e., you can't use rand() because you need - to seed the generator, and can't seed it with the time because - time, at least at one second resolution, has repeated itself). - This is not a perfect defense.

    - -

    How good a defense is it? Suppose that one of your machines - serves at most 500 requests per second (which is a very - reasonable upper bound at this writing, because systems - generally do more than just shovel out static files). To do - that it will require a number of children which depends on how - many concurrent clients you have. But we'll be pessimistic and - suppose that a single child is able to serve 500 requests per - second. There are 1000 possible starting counter values such - that two sequences of 500 requests overlap. So there is a 1.5% - chance that if time (at one second resolution) repeats itself - this child will repeat a counter value, and uniqueness will be - broken. This was a very pessimistic example, and with real - world values it's even less likely to occur. If your system is - such that it's still likely to occur, then perhaps you should - make the counter 32 bits (by editing the code).

    - -

    You may be concerned about the clock being "set back" during - summer daylight savings. However this isn't an issue because - the times used here are UTC, which "always" go forward. Note - that x86 based Unixes may need proper configuration for this to - be true -- they should be configured to assume that the - motherboard clock is on UTC and compensate appropriately. But - even still, if you're running NTP then your UTC time will be - correct very shortly after reboot.

    - -

    The UNIQUE_ID environment variable is - constructed by encoding the 112-bit (32-bit IP address, 32 bit - pid, 32 bit time stamp, 16 bit counter) quadruple using the - alphabet [A-Za-z0-9@-] in a manner similar to MIME - base64 encoding, producing 19 characters. The MIME base64 - alphabet is actually [A-Za-z0-9+/] however - + and / need to be specially encoded - in URLs, which makes them less desirable. All values are - encoded in network byte ordering so that the encoding is - comparable across architectures of different byte ordering. The - actual ordering of the encoding is: time stamp, IP address, - pid, counter. This ordering has a purpose, but it should be - emphasized that applications should not dissect the encoding. - Applications should treat the entire encoded - UNIQUE_ID as an opaque token, which can be - compared against other UNIQUE_IDs for equality - only.

    - -

    The ordering was chosen such that it's possible to change - the encoding in the future without worrying about collision - with an existing database of UNIQUE_IDs. The new - encodings should also keep the time stamp as the first element, - and can otherwise use the same alphabet and bit length. Since - the time stamps are essentially an increasing sequence, it's - sufficient to have a flag second in which all machines - in the cluster stop serving and request, and stop using the old - encoding format. Afterwards they can resume requests and begin - issuing the new encodings.

    - -

    This we believe is a relatively portable solution to this - problem. It can be extended to multithreaded systems like - Windows NT, and can grow with future needs. The identifiers - generated have essentially an infinite life-time because future - identifiers can be made longer as required. Essentially no - communication is required between machines in the cluster (only - NTP synchronization is required, which is low overhead), and no - communication between httpd processes is required (the - communication is implicit in the pid value assigned by the - kernel). In very specific situations the identifier can be - shortened, but more information needs to be assumed (for - example the 32-bit IP address is overkill for any site, but - there is no portable shorter replacement for it).

    -
    - - -
    diff --git a/docs/manual/mod/mod_userdir.html b/docs/manual/mod/mod_userdir.html deleted file mode 100644 index a1a517faff8957eb59f2eb1d7b6af5b4f35b61f0..0000000000000000000000000000000000000000 --- a/docs/manual/mod/mod_userdir.html +++ /dev/null @@ -1,54 +0,0 @@ - - - - -Apache module mod_userdir - - - - - -

    Module mod_userdir

    - -This module is contained in the mod_userdir.c file, and -is compiled in by default. It provides for user-specific directories. - - - -
    - - -

    UserDir

    - -Syntax: UserDir directory/filename
    -Default: UserDir public_html
    -Context: server config, virtual host
    -Status: Base
    -Module: mod_userdir

    - -The UserDir directive sets the real directory in a user's home directory -to use when a request for a document for a user is received. -Directory is either disabled, to disable this feature, - or the name of a directory, following one of the following -patterns. If not disabled, then a request for -http://www.foo.com/~bar/one/two.html will be translated to: -

    -UserDir public_html     -> ~bar/public_html/one/two.html
    -UserDir /usr/web        -> /usr/web/bar/one/two.html
    -UserDir /home/*/www     -> /home/bar/www/one/two.html
    -
    -The following directives will send redirects to the client: -
    -UserDir http://www.x.com/users   -> http//www.x.com/users/bar/one/two.html
    -UserDir http://www.x.com/*/y     -> http://www.x.com/y/one/two.html
    -
    - -
    -Home -Index - - - - diff --git a/docs/manual/mod/mod_userdir.xml b/docs/manual/mod/mod_userdir.xml deleted file mode 100755 index 65777a7e45b0cc1004963fdbf3aa0abc93ec192d..0000000000000000000000000000000000000000 --- a/docs/manual/mod/mod_userdir.xml +++ /dev/null @@ -1,107 +0,0 @@ - - - - -mod_userdir -Base -This module provides for user-specific -directories. -userdir_module -mod_userdir.c - - - - - - - -UserDir -Sets the directory from which to serve files when requests -for a particular user are received, denoted by requests containing -~username, such as -http://server.example.com/~bob/ -UserDir directory-filename -UserDir public_html -server config virtual -host -All forms except the UserDir public_html -form are only available in Apache 1.1 or above. Use of the -enabled keyword, or disabled with a -list of usernames, is only available in Apache 1.3 and -above. - - - -

    The UserDir directive sets the real directory in a user's - home directory to use when a request for a document for a user - is received. Directory-filename is one of the - following:

    - -
      -
    • The name of a directory or a pattern such as those shown - below.
    • - -
    • The keyword disabled. This turns off - all username-to-directory translations except those - explicitly named with the enabled keyword (see - below).
    • - -
    • The keyword disabled followed by a - space-delimited list of usernames. Usernames that appear in - such a list will never have directory translation - performed, even if they appear in an enabled - clause.
    • - -
    • The keyword enabled followed by a - space-delimited list of usernames. These usernames will have - directory translation performed even if a global disable is - in effect, but not if they also appear in a - disabled clause.
    • -
    - -

    If neither the enabled nor the - disabled keywords appear in the - Userdir directive, the argument is treated as a - filename pattern, and is used to turn the name into a directory - specification. A request for - http://www.foo.com/~bob/one/two.html will be - translated to:

    - - - - - - - -
    UserDir directive usedTranslated path
    UserDir public_html~bob/public_html/one/two.html
    UserDir /usr/web/usr/web/bob/one/two.html
    UserDir /home/*/www/home/bob/www/one/two.html
    - -

    The following directives will send redirects to the client:

    - - - - - - - -
    UserDir directive usedTranslated path
    UserDir http://www.foo.com/usershttp://www.foo.com/users/bob/one/two.html
    UserDir -http://www.foo.com/*/usrhttp://www.foo.com/bob/usr/one/two.html
    UserDir -http://www.foo.com/~*/http://www.foo.com/~bob/one/two.html
    - -
    - Be careful when using this directive; for instance, - "UserDir ./" would map - "/~root" to "/" - which is probably - undesirable. If you are running Apache 1.3 or above, it is - strongly recommended that your configuration include a - "UserDir disabled root" declaration. - See also the Directory - directive and the Security - Tips page for more information. -
    - -
    - -
    -
    - - diff --git a/docs/manual/mod/mod_usertrack.html b/docs/manual/mod/mod_usertrack.html deleted file mode 100644 index c327020c8f66b07c79927d7d8a21bf36c4b00167..0000000000000000000000000000000000000000 --- a/docs/manual/mod/mod_usertrack.html +++ /dev/null @@ -1,41 +0,0 @@ - - - - -Apache module mod_usertrack - - - - - -

    Module mod_usertrack

    - -This module is contained in the mod_usertrack.c file, and -is not compiled in by default. It provides for user tracking using cookies. -There is no documentation available for this module. Mark is writing this. - - - -
  • CookieLog -
  • -
    - - -

    CookieLog

    - -Syntax: CookieLog filename
    -Context: server config, virtual host
    -Status: Experimental
    -Module: mod_cookies

    - -The CookieLog directive sets the filename for logging of cookies. -The filename is relative to the ServerRoot. -

    - -


    -Home -Index - - - - diff --git a/docs/manual/mod/mod_usertrack.xml b/docs/manual/mod/mod_usertrack.xml deleted file mode 100755 index ab6c0e901a91a1767315f7e5a3064b87d003985c..0000000000000000000000000000000000000000 --- a/docs/manual/mod/mod_usertrack.xml +++ /dev/null @@ -1,228 +0,0 @@ - - - - - -mod_usertrack - - This module uses cookies to provide for a - clickstream log of user activity on a site. - -Extension -mod_usertrack.c -usertrack_module -Known as mod_cookies prior to Apache 1.3. - - - -

    Summary

    - -

    Previous releases of Apache have included a module which - generates a 'clickstream' log of user activity on a site using - cookies. This was called the "cookies" module, mod_cookies. In - Apache 1.2 and later this module has been renamed the "user - tracking" module, mod_usertrack. This module has been - simplified and new directives added.

    -
    - - -
    -Logging - -

    Previously, the cookies module (now the user tracking - module) did its own logging, using the CookieLog - directive. In this release, this module does no logging at all. - Instead, a configurable log format file should be used to log - user click-streams. This is possible because the logging module - now allows multiple log files. The cookie itself is logged by - using the text %{cookie}n in the log file format. For - example:

    - -CustomLog logs/clickstream "%{cookie}n %r %t" - - -

    For backward compatibility the configurable log module - implements the old CookieLog directive, but this - should be upgraded to the above CustomLog directive.

    -
    - -
    -2-digit or 4-digit dates for cookies? - -

    (the following is from message - <022701bda43d$9d32bbb0$1201a8c0@christian.office.sane.com> - in the new-httpd archives) -

    -From: "Christian Allen" <christian@sane.com>
    -Subject: Re: Apache Y2K bug in mod_usertrack.c
    -Date: Tue, 30 Jun 1998 11:41:56 -0400
    -
    -Did some work with cookies and dug up some info that might be useful.
    -
    -True, Netscape claims that the correct format NOW is four digit dates, and
    -four digit dates do in fact work... for Netscape 4.x (Communicator), that
    -is.  However, 3.x and below do NOT accept them.  It seems that Netscape
    -originally had a 2-digit standard, and then with all of the Y2K hype and
    -probably a few complaints, changed to a four digit date for Communicator.
    -Fortunately, 4.x also understands the 2-digit format, and so the best way to
    -ensure that your expiration date is legible to the client's browser is to
    -use 2-digit dates.
    -
    -However, this does not limit expiration dates to the year 2000; if you use
    -an expiration year of "13", for example, it is interpreted as 2013, NOT
    -1913!  In fact, you can use an expiration year of up to "37", and it will be
    -understood as "2037" by both MSIE and Netscape versions 3.x and up (not sure
    -about versions previous to those).  Not sure why Netscape used that
    -particular year as its cut-off point, but my guess is that it was in respect
    -to UNIX's 2038 problem.  Netscape/MSIE 4.x seem to be able to understand
    -2-digit years beyond that, at least until "50" for sure (I think they
    -understand up until about "70", but not for sure).
    -
    -Summary:  Mozilla 3.x and up understands two digit dates up until "37"
    -(2037).  Mozilla 4.x understands up until at least "50" (2050) in 2-digit
    -form, but also understands 4-digit years, which can probably reach up until
    -9999.  Your best bet for sending a long-life cookie is to send it for some
    -time late in the year "37".
    -
    -

    -
    - - -CookieDomain -CookieDomain domain -None - -server config -virtual host -directory -.htaccess - -controls the setting of the domain to which - the tracking cookie applies. - - - -

    This directive controls the setting of the domain to which - the tracking cookie applies. If not present, no domain is - included in the cookie header field.

    - -

    The domain string must begin with a dot, and - must include at least one embedded dot. That is, - ".foo.com" is legal, but "foo.bar.com" and ".com" are not.

    -
    -
    - - - -CookieExpires -CookieExpires expiry-period - - -server config -virtual host -directory -.htaccess - - -In 1.3.20 and earlier, not usable in directory and -.htaccess - - -

    When used, this directive sets an expiry time on the cookie - generated by the usertrack module. The expiry-period - can be given either as a number of seconds, or in the format - such as "2 weeks 3 days 7 hours". Valid denominations are: - years, months, weeks, hours, minutes and seconds. If the expiry - time is in any format other than one number indicating the - number of seconds, it must be enclosed by double quotes.

    - -

    If this directive is not used, cookies last only for the - current browser session.

    -
    -
    - - -CookieName -CookieName token -Apache - -server config -virtual host -directory -.htaccess - - - -

    This directive allows you to change the name of the cookie - this module uses for its tracking purposes. By default the - cookie is named "Apache".

    - -

    You must specify a valid cookie name; results are - unpredictable if you use a name containing unusual characters. - Valid characters include A-Z, a-z, 0-9, "_", and "-".

    -
    -
    - - -CookieStyle -CookieStyle - Netscape|Cookie|Cookie2|RFC2109|RFC2965 - - -server config -virtual host -directory -.htaccess - -Controls the format of the cookie header - field - - -

    This directive controls the format of the cookie header - field. The three formats allowed are:

    - -
      -
    • Netscape, which is the original but now deprecated - syntax. This is the default, and the syntax Apache has - historically used.
    • - -
    • Cookie or RFC2109, which is the syntax that - superseded the Netscape syntax.
    • - -
    • Cookie2 or RFC2965, which is the most - current cookie syntax.
    • -
    - -

    Not all clients can understand all of these formats. but you - should use the newest one that is generally acceptable to your - users' browsers.

    -
    -
    - - - - -CookieTracking -CookieTracking on|off - - -server config -virtual host -directory -.htaccess - -FileInfo - - -

    When the user track module is compiled in, and - "CookieTracking on" is set, Apache will start sending a - user-tracking cookie for all new requests. This directive can - be used to turn this behavior on or off on a per-server or - per-directory basis. By default, compiling mod_usertrack will - not activate cookies.

    - -
    -
    - -
    - diff --git a/docs/manual/mod/mod_vhost_alias.html b/docs/manual/mod/mod_vhost_alias.html deleted file mode 100644 index 9b86a07143bc2b1689f7c535d6456ac3ddea20a5..0000000000000000000000000000000000000000 --- a/docs/manual/mod/mod_vhost_alias.html +++ /dev/null @@ -1,311 +0,0 @@ - - - -Apache module mod_vhost_alias - - - - -
    - [APACHE DOCUMENTATION] -

    - Apache HTTP Server Version 1.3 -

    -
    - -

    Module mod_vhost_alias

    - -

    -This module is contained in the mod_vhost_alias.c file -and is not compiled in by default. It should be mentioned near the -start of the Configuration file so that it doesn't -override the behaviour of other modules that do filename translation, -e.g. mod_userdir and -mod_alias. It provides -support for dynamically configured mass -virtual hosting. -

    - -

    Directory Name Interpolation

    - -

    -All the directives in this module interpolate a string into a -pathname. The interpolated string (henceforth called the "name") may -be either the server name (see the -UseCanonicalName -directive for details on how this is determined) or the IP address of -the virtual host on the server in dotted-quad format. The -interpolation is controlled by specifiers inspired by -printf which have a number of formats: -

    -
    %% -
    insert a % -
    %p -
    insert the port number of the virtual host -
    %N.M -
    insert (part of) the name -
    -

    - -

    -N and M are used to specify substrings of -the name. N selects from the dot-separated components of -the name, and M selects characters within whatever -N has selected. M is optional and defaults -to zero if it isn't present; the dot must be present if and only if -M is present. The interpretation is as follows: -

    -
    0 -
    the whole name -
    1 -
    the first part -
    2 -
    the second part -
    -1 -
    the last part -
    -2 -
    the penultimate part -
    2+ -
    the second and all subsequent parts -
    -2+ -
    the penultimate and all preceding parts -
    1+ and -1+ -
    the same as 0 -
    -If N or M is greater than the number of -parts available a single underscore is interpolated. -

    - -

    Examples

    - -

    -For simple name-based virtual hosts you might use the following -directives in your server configuration file: -

    -	UseCanonicalName	Off
    -	VirtualDocumentRoot	/usr/local/apache/vhosts/%0
    -
    -A request for http://www.example.com/directory/file.html -will be satisfied by the file -/usr/local/apache/vhosts/www.example.com/directory/file.html. -

    - -

    -For a very large number of virtual hosts it is a good idea to arrange -the files to reduce the size of the vhosts directory. To -do this you might use the following in your configuration file: -

    -	UseCanonicalName	Off
    -	VirtualDocumentRoot	/usr/local/apache/vhosts/%3+/%2.1/%2.2/%2.3/%2
    -
    -A request for http://www.example.isp.com/directory/file.html -will be satisfied by the file -/usr/local/apache/isp.com/e/x/a/example/directory/file.html. -A more even spread of files can be acheived by hashing from the end of -the name, for example: -
    -	VirtualDocumentRoot	/u/%3+/%2.-1/%2.-2/%2.-3/%2
    -
    -The example request would come from -/usr/local/apache/vhosts/isp.com/e/l/p/example/directory/file.html. -Alternatively you might use: -
    -	VirtualDocumentRoot	/usr/local/apache/vhosts/%3+/%2.1/%2.2/%2.3/%2.4+
    -
    -The example request would come from -/usr/local/apache/vhosts/isp.com/e/x/a/mple/directory/file.html. -

    - -

    -For IP-based virtual hosting you might use the following in your -configuration file: -

    -	UseCanonicalName DNS
    -	VirtualDocumentRootIP	/usr/local/apache/vhost/%1/%2/%3/%4/docs
    -	VirtualScriptAliasIP	/usr/local/apache/vhost/%1/%2/%3/%4/cgi-bin
    -
    -A request for http://www.example.isp.com/directory/file.html -would be satisfied by the file -/usr/local/apache/10/20/30/40/docs/directory/file.html if -the IP address of www.example.com were 10.20.30.40. -A request for http://www.example.isp.com/cgi-bin/script.pl -would be satisfied by executing the program -/usr/local/apache/10/20/30/40/cgi-bin/script.pl. -

    - -

    -The LogFormat directives -%V and %A are useful in conjunction with -this module. -

    - -
    - -

    Directives

    - -
    - -

    VirtualDocumentRoot directive

    -

    -Syntax: VirtualDocumentRoot interpolated-directory
    -Default: None
    -Context: server config, virtual host
    -Status: Extension
    -Module: mod_vhost_alias
    -Compatibility: VirtualDocumentRoot is only available in 1.3.5 and later.

    -

    -The VirtualDocumentRoot directive allows you to determine -where Apache will find your documents based on the value of the server -name. The result of expanding interpolated-directory is used -as the root of the document tree in a similar manner to the -DocumentRoot -directive's argument. If interpolated-directory is -none then VirtaulDocumentRoot is turned off. -This directive cannot be used in the same context as -VirtualDocumentRootIP. -

    -
    - -

    VirtualDocumentRootIP directive

    -

    -Syntax: VirtualDocumentRootIP interpolated-directory
    -Default: None
    -Context: server config, virtual host
    -Status: Extension
    -Module: mod_vhost_alias
    -Compatibility: VirtualDocumentRootIP is only available in 1.3.5 and later.

    -

    -The VirtualDocumentRootIP directive is like the -VirtualDocumentRoot directive, -except that it uses the IP address of the server end of the connection -instead of the server name. -

    -
    - -

    VirtualScriptAlias directive

    -

    -Syntax: VirtualScriptAlias interpolated-directory
    -Default: None
    -Context: server config, virtual host
    -Status: Extension
    -Module: mod_vhost_alias
    -Compatibility: VirtualScriptAlias is only available in 1.3.5 and later.

    -

    -The VirtualScriptAlias directive allows you to determine -where Apache will find CGI scripts in a similar manner to -VirtualDocumentRoot -does for other documents. It matches requests for URIs starting -/cgi-bin/, much like -ScriptAlias /cgi-bin/ -would. -

    -
    - -

    VirtualScriptAliasIP directive

    -

    -Syntax: VirtualScriptAliasIP interpolated-directory
    -Default: None
    -Context: server config, virtual host
    -Status: Extension
    -Module: mod_vhost_alias
    -Compatibility: VirtualScriptAliasIP is only available in 1.3.5 and later.

    -

    -The VirtualScriptAliasIP directibe is like the -VirtualScriptAlias directive, -except that it uses the IP address of the server end of the connection -instead of the server name. -

    -
    - -

    - Apache HTTP Server Version 1.3 -

    - -Index -Home - - - diff --git a/docs/manual/mod/mod_vhost_alias.xml b/docs/manual/mod/mod_vhost_alias.xml deleted file mode 100644 index d10d21cb396b8f5de42f4394b4de438bdfb51382..0000000000000000000000000000000000000000 --- a/docs/manual/mod/mod_vhost_alias.xml +++ /dev/null @@ -1,287 +0,0 @@ - - - - -mod_vhost_alias -Extension -vhost_alias_module -mod_vhost_alias.c -Available in Apache 1.3.7 and later. - -This module provides support for dynamically configured mass virtual -hosting. - - - -

    This module creates dynamically configured virtual hosts, by - allowing the IP address and/or the Host: header of - the HTTP request to be used as part of the pathname to - determine what files to serve. This allows for easy use of a - huge number of virtual hosts with similar configurations.

    - - See also: UseCanonicalName. - -
    - -
    - Directory Name Interpolation - -

    All the directives in this module interpolate a string into - a pathname. The interpolated string (henceforth called the - "name") may be either the server name (see the UseCanonicalName - directive for details on how this is determined) or the IP - address of the virtual host on the server in dotted-quad - format. The interpolation is controlled by specifiers inspired - by printf which have a number of formats:

    - - - - - - - - - - - - -
    %%insert a %
    %pinsert the port number of the virtual host
    %N.Minsert (part of) the name
    - -

    N and M are used to specify - substrings of the name. N selects from the - dot-separated components of the name, and M - selects characters within whatever N has selected. - M is optional and defaults to zero if it isn't - present; the dot must be present if and only if M - is present. The interpretation is as follows:

    - - - - - - - - - - - - - - - - - - - - - - - - - -
    0the whole name
    1the first part
    2the second part
    -1the last part
    -2the penultimate part
    2+the second and all subsequent parts
    -2+the penultimate and all preceding parts
    1+ and -1+the same as 0
    - -

    If N or M is greater than the number - of parts available a single underscore is interpolated.

    - -
    - -
    - Examples - -

    For simple name-based virtual hosts you might use the - following directives in your server configuration file:

    - - - UseCanonicalName Off
    - VirtualDocumentRoot /usr/local/apache/vhosts/%0 -
    - -

    A request for - http://www.example.com/directory/file.html will be - satisfied by the file - /usr/local/apache/vhosts/www.example.com/directory/file.html. -

    - -

    For a very large number of virtual hosts it is a good idea - to arrange the files to reduce the size of the - vhosts directory. To do this you might use the - following in your configuration file:

    - - - UseCanonicalName Off
    - VirtualDocumentRoot /usr/local/apache/vhosts/%3+/%2.1/%2.2/%2.3/%2 -
    - -

    A request for - http://www.example.isp.com/directory/file.html - will be satisfied by the file - /usr/local/apache/vhosts/isp.com/e/x/a/example/directory/file.html.

    - -

    A more even spread of files can be achieved by hashing from the - end of the name, for example:

    - - - VirtualDocumentRoot /usr/local/apache/vhosts/%3+/%2.-1/%2.-2/%2.-3/%2 - - -

    The example request would come from - /usr/local/apache/vhosts/isp.com/e/l/p/example/directory/file.html.

    - -

    Alternatively you might use:

    - - - VirtualDocumentRoot /usr/local/apache/vhosts/%3+/%2.1/%2.2/%2.3/%2.4+ - - -

    The example request would come from - /usr/local/apache/vhosts/isp.com/e/x/a/mple/directory/file.html.

    - -

    For IP-based virtual hosting you might use the following in - your configuration file:

    - - - UseCanonicalName DNS
    - VirtualDocumentRootIP /usr/local/apache/vhosts/%1/%2/%3/%4/docs
    - VirtualScriptAliasIP /usr/local/apache/vhosts/%1/%2/%3/%4/cgi-bin -
    - -

    A request for - http://www.example.isp.com/directory/file.html - would be satisfied by the file - /usr/local/apache/vhosts/10/20/30/40/docs/directory/file.html - if the IP address of www.example.com were - 10.20.30.40. A request for - http://www.example.isp.com/cgi-bin/script.pl would - be satisfied by executing the program - /usr/local/apache/vhosts/10/20/30/40/cgi-bin/script.pl.

    - -

    If you want to include the . character in a - VirtualDocumentRoot directive, but it clashes with - a % directive, you can work around the problem in - the following way:

    - - - VirtualDocumentRoot /usr/local/apache/vhosts/%2.0.%3.0 - - -

    A request for - http://www.example.isp.com/directory/file.html - will be satisfied by the file - /usr/local/apache/vhosts/example.isp/directory/file.html.

    - -

    The LogFormat - directives %V and %A are useful - in conjunction with this module.

    -
    - - -VirtualDocumentRoot -VirtualDocumentRoot interpolated-directory -none - -server config -virtual host - - -VirtualDocumentRoot is only available in 1.3.7 and -later. -Dynamically configure the location of the document root -for a given virtual host. - - - -

    The VirtualDocumentRoot directive allows you to - determine where Apache will find your documents based on the - value of the server name. The result of expanding - interpolated-directory is used as the root of the - document tree in a similar manner to the DocumentRoot directive's argument. - If interpolated-directory is none then - VirtaulDocumentRoot is turned off. This directive - cannot be used in the same context as - VirtualDocumentRootIP.

    - -
    -
    - - -VirtualDocumentRootIP -VirtualDocumentRootIP interpolated-directory -none - -server config -virtual host - - -VirtualDocumentRootIP is only available in 1.3.7 -and later. -Dynamically configure the location of the document root -for a given virtual host - - - -

    The VirtualDocumentRootIP directive is like the - VirtualDocumentRoot - directive, except that it uses the IP address of the server end - of the connection instead of the server name.

    -
    -
    - - -VirtualScriptAlias -VirtualScriptAlias interpolated-directory -none - -server config -virtual host - - -VirtualScriptAlias is only available in 1.3.7 -and later. -Dynamically configure the location of the CGI directory for -a given virtual host. - - - -

    The VirtualScriptAlias directive allows you to - determine where Apache will find CGI scripts in a similar - manner to VirtualDocumentRoot - does for other documents. It matches requests for URIs starting - /cgi-bin/, much like ScriptAlias - /cgi-bin/ would.

    - -
    -
    - - -VirtualScriptAliasIP -VirtualScriptAliasIP interpolated-directory -none - -server config -virtual host - - -VirtualScriptAliasIP is only available in 1.3.7 -and later. -Dynamically configure the location of the cgi directory for -a given virtual host. - - - -

    The VirtualScriptAliasIP directive is like the - VirtualScriptAlias - directive, except that it uses the IP address of the server end - of the connection instead of the server name.

    - -
    - -
    -
    - diff --git a/docs/manual/mod/module-dict.html b/docs/manual/mod/module-dict.html deleted file mode 100644 index 3e90bbb68025d397fc48b7369d7f6f5f8b7cb579..0000000000000000000000000000000000000000 --- a/docs/manual/mod/module-dict.html +++ /dev/null @@ -1,135 +0,0 @@ - - - - Definitions of terms used to describe Apache modules - - - - - -

    Terms Used to Describe Apache Modules

    - -

    - Each Apache module is described using a common format that looks - like this: -

    -
    -
    Status: status -
    - Source File: source-file -
    - Module Identifier: module-identifier -
    - Compatibility: compatibility notes -
    -
    -

    - Each of the attributes, complete with values where possible, are - described in this document. -

    - -

    Module Terms

    - - -
    -

    Status

    -

    - This indicates how tightly bound into the Apache Web server the - module is; in other words, you may need to recompile the server in - order to gain access to the module and its functionality. Possible - values for this attribute are: -

    -
    -
    Base -
    -
    A module labeled as having "Base" status is compiled - and loaded into the server by default, and is therefore normally - available unless you have taken steps to remove the module from your - configuration. -

    -

    -
    -
    Extension -
    -
    A module with "Extension" status is not normally - compiled and loaded into the server. To enable the module and its - functionality, you may need to change the server build - configuration files and re-compile Apache. -

    -

    -
    -
    Experimental -
    -
    "Experimental" status indicates that the module is - available as part of the Apache kit, but you are on your own if you - try to use it. The module is being documented for completeness, - and is not necessarily supported. -

    -

    -
    -
    External -
    -
    Modules which are not included with the base Apache - distribution ("third-party modules") may use the - "External" status. We are not responsible for, nor do we - support such modules. -

    -

    -
    -
    - -
    -

    Source File

    -

    - This quite simply lists the name of the source file which contains - the code for the module. This is also the name used by the <IfModule> - directive. -

    - -
    -

    Module Identifier

    -

    - This is a string which identifies the module for use in the LoadModule directive when - dynamically loading modules. In particular, it is the name - of the external variable of type module in the source file. -

    - -
    -

    Compatibility

    -

    - If the module was not part of the original Apache version 2 - distribution, the version in which it was introduced should be listed - here. -

    - - - diff --git a/docs/manual/mod/module-dict.html.en b/docs/manual/mod/module-dict.html.en deleted file mode 100644 index 3e90bbb68025d397fc48b7369d7f6f5f8b7cb579..0000000000000000000000000000000000000000 --- a/docs/manual/mod/module-dict.html.en +++ /dev/null @@ -1,135 +0,0 @@ - - - - Definitions of terms used to describe Apache modules - - - - - -

    Terms Used to Describe Apache Modules

    - -

    - Each Apache module is described using a common format that looks - like this: -

    -
    -
    Status: status -
    - Source File: source-file -
    - Module Identifier: module-identifier -
    - Compatibility: compatibility notes -
    -
    -

    - Each of the attributes, complete with values where possible, are - described in this document. -

    - -

    Module Terms

    - - -
    -

    Status

    -

    - This indicates how tightly bound into the Apache Web server the - module is; in other words, you may need to recompile the server in - order to gain access to the module and its functionality. Possible - values for this attribute are: -

    -
    -
    Base -
    -
    A module labeled as having "Base" status is compiled - and loaded into the server by default, and is therefore normally - available unless you have taken steps to remove the module from your - configuration. -

    -

    -
    -
    Extension -
    -
    A module with "Extension" status is not normally - compiled and loaded into the server. To enable the module and its - functionality, you may need to change the server build - configuration files and re-compile Apache. -

    -

    -
    -
    Experimental -
    -
    "Experimental" status indicates that the module is - available as part of the Apache kit, but you are on your own if you - try to use it. The module is being documented for completeness, - and is not necessarily supported. -

    -

    -
    -
    External -
    -
    Modules which are not included with the base Apache - distribution ("third-party modules") may use the - "External" status. We are not responsible for, nor do we - support such modules. -

    -

    -
    -
    - -
    -

    Source File

    -

    - This quite simply lists the name of the source file which contains - the code for the module. This is also the name used by the <IfModule> - directive. -

    - -
    -

    Module Identifier

    -

    - This is a string which identifies the module for use in the LoadModule directive when - dynamically loading modules. In particular, it is the name - of the external variable of type module in the source file. -

    - -
    -

    Compatibility

    -

    - If the module was not part of the original Apache version 2 - distribution, the version in which it was introduced should be listed - here. -

    - - - diff --git a/docs/manual/mod/mpm_common.html b/docs/manual/mod/mpm_common.html deleted file mode 100644 index 75dd0b8082cc04cb6bb1c13aea51a29a6219fe87..0000000000000000000000000000000000000000 --- a/docs/manual/mod/mpm_common.html +++ /dev/null @@ -1,409 +0,0 @@ - - - -Apache MPM Common Directives - - - - - - -

    Multi-Processing Module Common Directives

    - -

    This file documents directives that are implemented by more -than one multi-processing module (MPM). -

    - -

    Directives

    - -
    - -

    CoreDumpDirectory directive

    - -

    Syntax: CoreDumpDirectory directory
    -Default: the same location as ServerRoot
    -Context: server config
    -Status: MPM
    -Module: mpmt_pthread, prefork

    - -

    This controls the directory to which Apache attempts to switch -before dumping core. The default is in the ServerRoot directory, however since -this should not be writable by the user the server runs as, core dumps -won't normally get written. If you want a core dump for debugging, -you can use this directive to place it in a different location.


    - -

    PidFile directive

    - -

    Syntax: PidFile filename
    -Default: PidFile logs/httpd.pid
    -Context: server config
    -Status: MPM
    -Module: mpmt_pthread, prefork

    - -

    The PidFile directive sets the file to which the server records the -process id of the daemon. If the filename does not begin with a slash -(/) then it is assumed to be relative to the ServerRoot.

    - -

    It is often useful to be able to send the server a signal, so that -it closes and then reopens its ErrorLog and TransferLog, and re-reads -its configuration files. This is done by sending a SIGHUP (kill -1) -signal to the process id listed in the PidFile.

    - -

    The PidFile is subject to the same warnings about log file placement and -security.

    - - -


    - - -

    LockFile directive

    -

    Syntax: LockFile filename
    -Default: LockFile logs/accept.lock
    -Context: server config
    -Status: MPM
    -Module: mpmt_pthread, prefork

    - -

    The LockFile directive sets the path to the lockfile used when -Apache is compiled with either USE_FCNTL_SERIALIZED_ACCEPT or -USE_FLOCK_SERIALIZED_ACCEPT. This directive should normally be -left at its default value. The main reason for changing it is if -the logs directory is NFS mounted, since the lockfile -must be stored on a local disk. The PID of the main -server process is automatically appended to the filename.

    - -

    SECURITY: It is best to avoid putting this file in a -world writable directory such as /var/tmp because someone -could create a denial of service attack and prevent the server from -starting by creating a lockfile with the same name as the one the -server will try to create.

    - -
    - -

    MaxClients directive

    - -

    Syntax: MaxClients number
    -Default: MaxClients 8 (with threads) -MaxClients 256 (no threads)
    -Context: server config
    -Status: MPM
    -Module: mpmt_pthread, prefork

    - -

    The MaxClients directive sets the limit on the number of child -processes that will be created to serve requests. When the server is -built without threading, no more than this number of clients can be -served simultaneously. To configure more than 256 clients, you must -edit the HARD_SERVER_LIMIT entry in -mpm_default.h and recompile. - -

    Any connection attempts over the MaxClients limit will normally -be queued, up to a number based on the -ListenBacklog directive. Once a child process is freed at the -end of a different request, the connection will then be serviced.

    - -

    When the server is compiled with threading, then the maximum number -of simultaneous requests that can be served is obtained from the value -of this directive multiplied by ThreadsPerChild.

    - -
    - -

    MaxRequestsPerChild directive

    - -

    Syntax: MaxRequestsPerChild number
    -Default: MaxRequestsPerChild 10000
    -Context: server config
    -Status: MPM
    -Module: mpmt_pthread, prefork

    - -

    The MaxRequestsPerChild directive sets the limit on the number of requests -that an individual child server process will handle. After MaxRequestsPerChild -requests, the child process will die. If MaxRequestsPerChild is 0, then -the process will never expire.

    - -Setting MaxRequestsPerChild to a non-zero limit has two beneficial effects: -

      -
    • it limits the amount of memory that process can consume by (accidental) -memory leakage; -
    • by giving processes a finite lifetime, it helps reduce the -number of processes when the server load reduces. -
    - -

    NOTE: For KeepAlive requests, only the first -request is counted towards this limit. In effect, it changes the -behavior to limit the number of connections per child. - -


    - - -

    MaxSpareThreads directive

    - -

    Syntax: MaxSpareThreads number
    -Default: MaxSpareThreads ??
    -Context: server config
    -Status: core
    -Module: mpmt_pthread

    - -

    Content needed here!

    - -

    See also MinSpareThreads and -StartServers. - -


    - -

    MinSpareThreads directive

    - -

    Syntax: MinSpareServers number
    -Default: MinSpareServers ???
    -Context: server config
    -Status: core
    -Module: mpmt_pthread

    - -

    fix me

    - -

    The MinSpareServers directive sets the desired minimum number of idle -child server processes. An idle process is one which is not handling -a request. If there are fewer than MinSpareServers idle, then the parent -process creates new children at a maximum rate of 1 per second.

    - -Tuning of this parameter should only be necessary on very busy sites. -Setting this parameter to a large number is almost always a bad idea.

    - -This directive has no effect on Microsoft Windows. - -

    - -See also MaxSpareThreads and -StartServers.


    - - -

    ScoreBoardFile directive

    - -

    Syntax: ScoreBoardFile filename
    -Default: ScoreBoardFile logs/apache_status -
    -Context: server config
    -Status: MPM
    - -Module: mpmt_pthread, prefork

    - -

    The ScoreBoardFile directive is required on some architectures to place -a file that the server will use to communicate between its children and -the parent. The easiest way to find out if your architecture requires -a scoreboard file is to run Apache and see if it creates the file named -by the directive. If your architecture requires it then you must ensure -that this file is not used at the same time by more than one invocation -of Apache.

    - -

    If you have to use a ScoreBoardFile then you may see improved speed by -placing it on a RAM disk. But be careful that you heed the same warnings -about log file placement and -security.

    - -

    See Also: -Stopping and Restarting Apache

    - - -


    - -

    StartServers directive

    - -

    Syntax: StartServers number
    -Default: StartServers 5
    -Context: server config
    -Status: MPM
    -Module: mpmt_pthread, prefork

    - -

    The StartServers directive sets the number of child server processes created -on startup. As the number of processes is dynamically controlled depending -on the load, there is usually little reason to adjust this parameter.

    - -

    See also MinSpareThreads and -MaxSpareThreads.


    - -

    ThreadsPerChild

    -

    Syntax: ThreadsPerChild number
    -Default: ThreadsPerChild 50
    -Context: server config
    -Status: Base
    -Module: mpmt_pthread

    - -

    This directive sets the number of threads created by each child -process.

    - - - - - diff --git a/docs/manual/mod/mpm_common.xml b/docs/manual/mod/mpm_common.xml deleted file mode 100644 index 3e3e4b7a5f70e3bf1d0c0771e0d2effd549d7ddd..0000000000000000000000000000000000000000 --- a/docs/manual/mod/mpm_common.xml +++ /dev/null @@ -1,613 +0,0 @@ - - - - -mpm_common -A collection of directives that are implemented by -more than one multi-processing module (MPM) -MPM - - -CoreDumpDirectory -Sets the directory where Apache attempts to -switch before dumping core -CoreDumpDirectory directory -CoreDumpDirectory ServerRoot -server config -workerperchild -preforkmpm_winnt - - - - -

    This controls the directory to which Apache attempts to - switch before dumping core. The default is in the - ServerRoot directory, however - since this should not be writable by the user the server runs - as, core dumps won't normally get written. If you want a core - dump for debugging, you can use this directive to place it in a - different location.

    -
    -
    - - -Group -Sets the group under which the server will answer -requests -Group unix-group -Group #-1 -server configvirtual host - -workerperchild -prefork - - -

    The Group directive sets the group under - which the server will answer requests. In order to use this - directive, the stand-alone server must be run initially as root. - Unix-group is one of:

    - -
    -
    A group name
    - -
    Refers to the given group by name.
    - -
    # followed by a group number.
    - -
    Refers to a group by its number.
    -
    -

    It is recommended that you set up a new group specifically for - running the server. Some admins use user nobody, - but this is not always possible or desirable.

    - -

    Note: if you start the server as a non-root user, it will - fail to change to the specified group, and will instead - continue to run as the group of the original user.

    - -

    Special note: Use of this directive in <VirtualHost< is - no longer supported. To implement the suEXEC wrapper with Apache 2.0, use the - SuexecUserGroup - directive. SECURITY: See User for a discussion of the - security considerations.

    -
    -
    - - -PidFile -Sets the file where the server records the process ID -of the daemon -PidFile filename -PidFile logs/httpd.pid -server config -workerperchilde -preforkmpm_winnt - - - -

    The PidFile directive sets the file to - which the server records the process id of the daemon. If the - filename does not begin with a slash (/) then it is assumed to be - relative to the ServerRoot.

    - -

    It is often useful to be able to send the server a signal, - so that it closes and then reopens its ErrorLog and TransferLog, and - re-reads its configuration files. This is done by sending a - SIGHUP (kill -1) signal to the process id listed in the - PidFile.

    - -

    The PidFile is subject to the same warnings about log file - placement and security.

    -
    -
    - - -Listen -Sets the IP addresses and ports that the server -listens to -Listen [IP-address:]portnumber -server config -workerperchild -preforkmpm_winnt - - - -

    The Listen directive instructs Apache to - listen to only specific IP addresses or ports; by default it - responds to requests on all IP interfaces. The Listen directive is - now a required directive. If it is not in the config file, the - server will fail to start. This is a change from previous versions - of Apache.

    - -

    The Listen directive tells the server to accept incoming - requests on the specified port or address-and-port combination. - If only a port number is specified, the server listens to the - given port on all interfaces. If an IP address is given as well - as a port, the server will listen on the given port and - interface.

    - -

    Multiple Listen directives may be used to specify a number - of addresses and ports to listen to. The server will respond to - requests from any of the listed addresses and ports.

    - -

    For example, to make the server accept connections on both - port 80 and port 8000, use:

    - - Listen 80
    - Listen 8000 -
    - To make the server accept connections on two specified - interfaces and port numbers, use - - Listen 192.170.2.1:80
    - Listen 192.170.2.5:8000 -
    - IPv6 addresses must be surrounded in square brackets, as in the - following example: - - Listen [fe80::a00:20ff:fea7:ccea]:80 - -
    - -DNS Issues -Setting - which addresses and ports Apache uses -
    - - -ListenBackLog -Maximum length of the queue of pending connections -ListenBacklog backlog -ListenBacklog 511 -server config -workerperchild -preforkmpm_winnt - - - -

    The maximum length of the queue of pending connections. - Generally no tuning is needed or desired, however on some - systems it is desirable to increase this when under a TCP SYN - flood attack. See the backlog parameter to the - listen(2) system call.

    - -

    This will often be limited to a smaller number by the - operating system. This varies from OS to OS. Also note that - many OSes do not use exactly what is specified as the backlog, - but use a number based on (but normally larger than) what is - set.

    -
    -
    - - -LockFile -Location of the accept serialization lock file -LockFile filename -LockFile logs/accept.lock -server config -workerperchild -prefork - - -

    The LockFile directive sets the path to - the lockfile used when Apache is compiled with either - USE_FCNTL_SERIALIZED_ACCEPT or USE_FLOCK_SERIALIZED_ACCEPT. This - directive should normally be left at its default value. The main - reason for changing it is if the logs directory is - NFS mounted, since the lockfile must be stored on a local - disk. The PID of the main server process is - automatically appended to the filename.

    - -

    SECURITY: It is best to avoid putting this - file in a world writable directory such as - /var/tmp because someone could create a denial of - service attack and prevent the server from starting by creating - a lockfile with the same name as the one the server will try to - create.

    -
    -
    - - -MaxClients -Maximum number of child processes that will be created -to serve requests -MaxClients number ->MaxClients - 8 (with threads) MaxClients 256 -server config -workerprefork - - - -

    The MaxClients directive sets the limit - on the number of child processes that will be created to serve - requests. When the server is built without threading, no more than - this number of clients can be served simultaneously. To configure - more than 256 clients with the prefork MPM, you must use the - ServerLimit directive. - To configure more than 1024 clients with the worker MPM, you must - use the ServerLimit and - ThreadLimit directives.

    - -

    Any connection attempts over the - MaxClients limit will normally be queued, - up to a number based on the ListenBacklog directive. Once a child - process is freed at the end of a different request, the connection - will then be serviced.

    - -

    When the server is compiled with threading, then the maximum - number of simultaneous requests that can be served is obtained - from the value of this directive multiplied by - ThreadsPerChild.

    -
    -
    - - -MaxRequestPerChild -Limit on the number of requests that an individual child server -will handle during its life -MaxRequestsPerChild number -MaxRequestsPerChild 10000 -server config -workerperchild -preforkmpm_winnt - - - -

    The MaxRequestsPerChild directive sets - the limit on the number of requests that an individual child - server process will handle. After - MaxRequestsPerChild requests, the child - process will die. If MaxRequestsPerChild is - 0, then the process will never expire.

    - -

    Setting MaxRequestsPerChild to a - non-zero limit has two beneficial effects:

    - -
      -
    • it limits the amount of memory that process can consume - by (accidental) memory leakage;
    • - -
    • by giving processes a finite lifetime, it helps reduce - the number of processes when the server load reduces.
    • -
    - -

    NOTE: For KeepAlive requests, only - the first request is counted towards this limit. In effect, it - changes the behavior to limit the number of - connections per child.

    -
    -
    - - -MaxSpareThreads -Maximum number of idle threads -MaxSpareThreads number -MaxSpareThreads 10 (Perchild) or 500 (worker) -server config -workerperchild - - - -

    Maximum number of idle threads. Different MPMs deal with this - directive differently. perchild monitors the - number of idle threads on a per-child basis. If there are too many - idle threads in that child, the server will begin to kill threads - within that child.

    - -

    worker deals with idle threads on a - server-wide basis. If there are too many idle threads in the - server then child processes are killed until the number of idle - threads is less than this number.

    - -
    -MinSpareThreads -StartServers -
    - - -MaxThreadsPerChild -Maximum number of threads per child process -MaxThreadsPerChild number -MaxThreadsPerChild 64 -server config -workerperchild - - - -

    Maximum number of threads per child. For MPMs with a - variable number of threads per child, this directive sets the - maximum number of threads that will be created in each child - process. To increase this value beyond its default, it is - necessary to change the value of the compile-time define - HARD_THREAD_LIMIT and recompile the server.

    -
    -
    - - -MinSpareThreads -Minimum number of idle threads available to handle request -spikes -MinSpareServers number -MinSpareThreads 5 (Perchild) or 250 (worker) -server config -workerperchild - - - -

    Minimum number of idle threads to handle request spikes. - Different MPMs deal with this directive - differently. perchild monitors the number of idle - threads on a per-child basis. If there aren't enough idle threads - in that child, the server will begin to create new threads within - that child.

    - -

    worker deals with idle threads on a - server-wide basis. If there aren't enough idle threads in the - server then child processes are created until the number of idle - threads is greater than number.

    -
    -MaxSpareThreads -StartServers -
    - - -NumServers -Total number of children alive at the same time -NumServers number -NumServers 2 -server config -perchild - - -

    Number of children alive at the same time. MPMs that use - this directive do not dynamically create new child processes so - this number should be large enough to handle the requests for - the entire site.

    -
    -
    - - -ScoreBoardFile -Location of the file used to store coordination data for -the child processes -ScoreBoardFile file-path -ScoreBoardFile logs/apache_status -server config -workerperchild -prefork - - -

    The ScoreBoardFile directive is required - on some architectures to place a file that the server will use to - communicate between its children and the parent. The easiest way - to find out if your architecture requires a scoreboard file is to - run Apache and see if it creates the file named by the - directive. If your architecture requires it then you must ensure - that this file is not used at the same time by more than one - invocation of Apache.

    - -

    If you have to use a ScoreBoardFile then - you may see improved speed by placing it on a RAM disk. But be - careful that you heed the same warnings about log file placement - and security.

    -
    -Stopping and Restarting Apache -
    - - -SendBufferSize -TCP buffer size -SendBufferSize bytes -server config -workerperchild -preforkmpm_winnt - - - -

    The server will set the TCP buffer size to the number of bytes - specified. Very useful to increase past standard OS defaults on - high speed high latency (i.e., 100ms or so, such as - transcontinental fast pipes).

    -
    -
    - - -ServerLimit -Upper limit on configurable number of processes -ServerLimit number -ServerLimit 256 (prefork), ServerLimit 16 (worker) -server config -workerprefork - - - -

    For the prefork MPM, this directive sets the - maximum configured value for MaxClients for the lifetime of the - Apache process. For the worker MPM, this directive in combination - with ThreadLimit sets - the maximum configured value for MaxClients for the lifetime of the - Apache process. Any attempts to change this directive during a - restart will be ignored, but MaxClients can be modified during - a restart.

    - -

    Special care must be taken when using this directive. If - ServerLimit is set to a value much higher - than necessary, extra, unused shared memory will be allocated. If - both ServerLimit and MaxClients are set to values - higher than the system can handle, Apache may not start or the - system may become unstable.

    - -

    With the prefork MPM, use this directive only - if you need to set MaxClients higher higher than 256. - Do not set the value of this directive any higher than what you - might want to set MaxClients to.

    - -

    With the worker MPM, use this directive only - if your MaxClients and - ThreadsPerChild - settings require more than 16 server processes. Do not set the - value of this directive any higher than the number of server - processes required by what you may want for MaxClients and ThreadsPerChild.

    -
    -
    - - -StartServers -Number of child server processes created at startup -StartServers number -StartServers 5 -server config -worker - - -

    The StartServers directive sets the - number of child server processes created on startup. As the number - of processes is dynamically controlled depending on the load, - there is usually little reason to adjust this parameter.

    -
    -MinSpareThreads -MaxSpareThreads -
    - - -StartThreads -Nubmer of threads each child creates on startup -StartThreads number -StartThreads 5 -server config -perchild - - -

    Number of threads each child creates on startup. As the - number of threads is dynamically controlled depending on the - load, there is usually little reason to adjust this - parameter.

    -
    -
    - - -ThreadLimit -Sets the upper limit on the configurable number of threads -per child process -ThreadLimit number -ThreadLimit 64 -server config -worker - - -

    This directive sets the maximum configured value for ThreadsPerChild for the lifetime - of the Apache process. Any attempts to change this directive - during a restart will be ignored, but ThreadsPerChild can be modified - during a restart up to the value of this directive.

    - -

    Special care must be taken when using this directive. If - ThreadLimit is set to a value much higher - than ThreadsPerChild, - extra unused shared memory will be allocated. If both - ThreadLimit and ThreadsPerChild are set to values - higher than the system can handle, Apache may not start or the - system may become unstable.

    - -

    Use this directive only if you need to set ThreadsPerChild higher than 64. Do - not set the value of this directive any higher than what you might - want to set ThreadsPerChild to.

    -
    -
    - - -ThreadsPerChild -Number of threads created by each child process -ThreadsPerChild number -ThreadsPerChild 50 -server config -workermpm_winnt - - - -

    This directive sets the number of threads created by each - child process. The child creates these threads at startup and - never creates more. if using an MPM like mpmt_winnt, where - there is only one child process, this number should be high - enough to handle the entire load of the server. If using an MPM - like worker, where there are multiple child processes, the - total number of threads should be high enough to handle the - common load on the server.

    -
    -
    - - -User -The userid under which the server will answer -requests -User unix-userid -User #-1 -server configvirtual host - -workerperchild -prefork - - -

    The User directive sets the userid as - which the server will answer requests. In order to use this - directive, the standalone server must be run initially as - root. Unix-userid is one of:

    - -
    -
    A username
    - -
    Refers to the given user by name.
    - -
    # followed by a user number.
    - -
    Refers to a user by their number.
    -
    - -

    The user should have no privileges which result in it being - able to access files which are not intended to be visible to the - outside world, and similarly, the user should not be able to - execute code which is not meant for httpd requests. It is - recommended that you set up a new user and group specifically for - running the server. Some admins use user nobody, but - this is not always possible or desirable. For example - mod_proxy's cache, when enabled, must be - accessible to this user (see CacheRoot).

    - -

    Notes: If you start the server as a non-root user, it will - fail to change to the lesser privileged user, and will instead - continue to run as that original user. If you do start the - server as root, then it is normal for the parent process to - remain running as root.

    - -

    Special note: Use of this directive in VirtualHost is no longer supported. To - configure your server for suexec use - SuexecUserGroup.

    - -Security

    Don't set User -(or Group) to -root unless you know exactly what you are doing, and what -the dangers are.

    -
    -
    - -
    \ No newline at end of file diff --git a/docs/manual/mod/mpm_netware.html b/docs/manual/mod/mpm_netware.html deleted file mode 100644 index 38aef8348552d63418eeb7c42ff79e465b0b57e0..0000000000000000000000000000000000000000 --- a/docs/manual/mod/mpm_netware.html +++ /dev/null @@ -1,199 +0,0 @@ - - - - - - - Apache MPM prefork - - - - - - -

    Multi-Processing Module NetWare

    - -

    This Multi-Processing Module implements an exclusively threaded web - server optimized for Novell NetWare.

    - -

    Status: MPM
    - Source File: mpm_netware.c
    - Module Identifier: - mpm_netware_module

    - -

    Summary

    - -

    This Multi-Processing Module (MPM) implements an exclusively threaded web server - that has been optimized for Novell NetWare.

    - -

    The main thread is responsible for launching child - worker threads which listen for connections and serve them when they - arrive. Apache always tries to maintain several spare - or idle worker threads, which stand ready to serve incoming - requests. In this way, clients do not need to wait for a new - child threads to be spawned before their requests can be - served.

    - -

    The StartThreads, MinSpareThreads, - MaxSpareThreads, and MaxThreads - regulate how the main thread creates worker threads to serve - requests. In general, Apache is very self-regulating, so most - sites do not need to adjust these directives from their default - values. Sites which need to serve more than 250 simultaneous - requests may need to increase MaxThreads, while - sites with limited memory may need to decrease - MaxThreads to keep the server from thrashing (spawning and - terminating idle threads). More information about - tuning process creation is provided in the performance hints - documentation.

    - -

    MaxRequestsPerChild controls how frequently the - server recycles processes by killing old ones and launching new - ones.  On the NetWare OS it is highly recommended that this directive - remain set to 0.  This allows worker threads to continue servicing - requests indefinitely.

    - -

    See also: Setting which addresses and - ports Apache uses.

    - -

    Directives

    - - -
    - -

    MaxThreads directive

    - - Syntax: MaxThreads - number
    - Default: MaxThreads 250
    - Context: server config
    - Status: core

    The MaxThreads directive sets the desired maximum - number worker threads allowable.

    - -

    See also MinSpareThreads, MaxSpareThreads and - StartThreads.

    -
    - -

    MaxSpareThreads directive

    - - Syntax: MaxSpareThreads - number
    - Default: MaxSpareThreads 100
    - Context: server config
    - Status: core - -

    The MaxSpareThreads directive sets the desired maximum - number of idle worker threads. An idle worker thread - is one which is not handling a request. If there are more than - MaxSpareThreads idle, then the main thread will kill off the - excess worker threads.

    - -

    Tuning of this parameter should only be necessary on very - busy sites. Setting this parameter to a large number is almost - always a bad idea.

    - -

    See also MinSpareThreads, MaxThreads and - StartThreads.

    -
    - -

    MinSpareThreads directive

    - - Syntax: MinSpareThreads - number
    - Default: MinSpareThreads 10
    - Context: server config
    - Status: core

    The MinSpareThreads directive sets the desired minimum - number of idle worker threads. An idle worker thread - is one which is not handling a request. If there are fewer than MinSpareThreads idle, then the - main thread spawns new worker.

    - -

    Tuning of this parameter should only be necessary on very - busy sites. Setting this parameter to a large number is almost - always a bad idea.

    - -

    See also MaxSpareThreads, MaxThreads and - StartThreads. -


    - -

    StartThreads directive

    - - Syntax: StartThreads - number
    - Default: StartThreads - 50
    - Context: server config
    - Status: core

    The StartThreads directive sets the desired - number of worker threads to spawn and startup. 

    - -

    See also MaxSpareThreadsMinSpareThreads - and MaxThreads. -


    - -

    ThreadStackSize

    - Syntax: ThreadStackSize - number
    - Default: ThreadStackSize - 65536
    - Context: server config
    - Status: core -

    This directive tells the server what stack size to use for - each of the running threads. If you ever get a stack overflow - you will need to bump this number to a higher setting.

    - -
    - - - - - diff --git a/docs/manual/mod/mpm_netware.xml b/docs/manual/mod/mpm_netware.xml deleted file mode 100644 index e10f259409717bb2cadc6e729ffa8e6963d5b4af..0000000000000000000000000000000000000000 --- a/docs/manual/mod/mpm_netware.xml +++ /dev/null @@ -1,131 +0,0 @@ - - - - -mpm_netware -Multi-Processing Module implementing an exclusively threaded web - server optimized for Novell NetWare -MPM -mpm_netware.c -mpm_netware_module - - -

    This Multi-Processing Module (MPM) implements an exclusively threaded web server - that has been optimized for Novell NetWare.

    - -

    The main thread is responsible for launching child - worker threads which listen for connections and serve them when they - arrive. Apache always tries to maintain several spare - or idle worker threads, which stand ready to serve incoming - requests. In this way, clients do not need to wait for a new - child threads to be spawned before their requests can be - served.

    - -

    The StartThreads, MinSpareThreads, - MaxSpareThreads, and MaxThreads - regulate how the main thread creates worker threads to serve - requests. In general, Apache is very self-regulating, so most - sites do not need to adjust these directives from their default - values. Sites which need to serve more than 250 simultaneous - requests may need to increase MaxThreads, while - sites with limited memory may need to decrease - MaxThreads to keep the server from thrashing (spawning and - terminating idle threads). More information about - tuning process creation is provided in the performance hints - documentation.

    - -

    MaxRequestsPerChild controls how frequently the - server recycles processes by killing old ones and launching new - ones.  On the NetWare OS it is highly recommended that this directive - remain set to 0.  This allows worker threads to continue servicing - requests indefinitely.

    - -

    See also: Setting which addresses and - ports Apache uses.

    -
    - -Listen - -ListenBacklog - -MaxRequestsPerChild - -SendBufferSize - - - -MaxThreads -MaxThreads number -MaxThreads 250 -server config - - -

    The MaxThreads directive sets the desired maximum - number worker threads allowable.

    -
    -
    - - -MaxSpareThreads -MaxSpareThreads number -MaxSpareThreads 100 -server config - - -

    The MaxSpareThreads directive sets the - desired maximum number of idle worker threads. An idle - worker thread is one which is not handling a request. If there are - more than MaxSpareThreads idle, then the main thread will kill off - the excess worker threads.

    - -

    Tuning of this parameter should only be necessary on very - busy sites. Setting this parameter to a large number is almost - always a bad idea.

    -
    -
    - - -MinSpareThreads -MinSpareThreads number -MinSpareThreads 10 -server config - - -

    The MinSpareThreads directive sets the -desired minimum number of idle worker threads. An idle worker -thread is one which is not handling a request. If there are fewer than -MinSpareThreads idle, then the main thread spawns new worker.

    - -

    Tuning of this parameter should only be necessary on very - busy sites. Setting this parameter to a large number is almost - always a bad idea.

    -
    -
    - - -StartThreads -StartThreads number -StartThreads 50 -server config - - -

    The StartThreads directive sets the desired - number of worker threads to spawn and startup

    -
    -
    - - -ThreadStackSize -ThreadStackSize number -ThreadStackSize 65536 -server config - - -

    This directive tells the server what stack size to use for - each of the running threads. If you ever get a stack overflow - you will need to bump this number to a higher setting.

    -
    -
    - -
    \ No newline at end of file diff --git a/docs/manual/mod/mpm_winnt.html b/docs/manual/mod/mpm_winnt.html deleted file mode 100644 index f4a90f03cfaf8e9685e22ae8459f41f327a6e93e..0000000000000000000000000000000000000000 --- a/docs/manual/mod/mpm_winnt.html +++ /dev/null @@ -1,59 +0,0 @@ - - - -Apache MPM pthread - - - - - - -

    Multi-Processing Module mpm_winnt

    -

    -This Multi-Processing Module is optimized for Windows NT. -

    - -

    Status: MPM -
    -Source File: mpm_winnt.c -
    -Module Identifier: mpm_winnt_module -

    - -

    Summary

    - -

    This Multi-Processing Module (MPM) is the default for -the Windows NT operating systems. It uses a single control -process which launches a single child process which in turn -creates threads to handle requests

    - - -

    Directives

    - - - - - diff --git a/docs/manual/mod/mpm_winnt.xml b/docs/manual/mod/mpm_winnt.xml deleted file mode 100644 index ca51b38063ed37f742d8959e5e0cb222af4c3c74..0000000000000000000000000000000000000000 --- a/docs/manual/mod/mpm_winnt.xml +++ /dev/null @@ -1,34 +0,0 @@ - - - - -mpm_winnt -This Multi-Processing Module is optimized for Windows - NT. -MPM -mpm_winnt.c -mpm_winnt_module - - -

    This Multi-Processing Module (MPM) is the default for the - Windows NT operating systems. It uses a single control process - which launches a single child process which in turn creates - threads to handle requests

    -
    - -CoreDumpDirectory - -PidFile - -Listen - -ListenBacklog - -MaxRequestsPerChild - -SendBufferSize - -ThreadsPerChild - - -
    \ No newline at end of file diff --git a/docs/manual/mod/perchild.html b/docs/manual/mod/perchild.html deleted file mode 100644 index cabafdab90c192003774701d29d16cd8c96d6932..0000000000000000000000000000000000000000 --- a/docs/manual/mod/perchild.html +++ /dev/null @@ -1,123 +0,0 @@ - - - -Apache MPM mpmt_pthread - - - - - - -

    Multi-Processing Module perchild

    -

    -This Multi-Processing Module allows for daemon processes serving requests -to be assigned a variety of different userids. -

    - -

    Status: MPM -
    -Source File: perchild.c -
    -Module Identifier: mpm_perchild_module -

    - -

    Summary

    - -

    Some description on how this whole thing works with a couple examples.

    - - -

    Directives

    - - -


    - -

    AssignUserID directive

    -

    Syntax:
    -Default:
    -Context: server config
    -Status: MPM
    -Module: perchild

    - -

    Tie a virtual host to a specific child process.

    - -


    - -

    ChilePerUserID directive

    -

    Syntax:
    -Default:
    -Context: server config
    -Status: MPM
    -Module: perchild

    - -

    Specify a User and Group for a specific child process.

    - - - - - - - - diff --git a/docs/manual/mod/perchild.xml b/docs/manual/mod/perchild.xml deleted file mode 100644 index 62a9245f9afd480b3af847b6d1eb97149f6bf4a5..0000000000000000000000000000000000000000 --- a/docs/manual/mod/perchild.xml +++ /dev/null @@ -1,150 +0,0 @@ - - - - - -perchild -Multi-Processing Module allowing for daemon processes - serving requests to be assigned a variety of different - userids -MPM -perchild.c -mpm_perchild_module - - - -This MPM does not currently work on most platforms. Work is ongoing to -make it functional. - - -

    This Multi-Processing Module (MPM) implements a hybrid - multi-process, multi-threaded web server. A fixed number of - processes create threads to handle requests. Fluctuations in - load are handled by increasing or decreasing the number of - threads in each process.

    - -

    A single control process launches the number of child processes - indicated by the NumServers directive at server - startup. Each child process creates threads as specified in the - StartThreads directive. The individual threads then - listen for connections and serve them when they arrive.

    - -

    Apache always tries to maintain a pool of spare or - idle server threads, which stand ready to serve incoming - requests. In this way, clients do not need to wait for new - threads to be created. For each child process, Apache assesses - the number of idle threads and creates or destroys threads to - keep this number within the boundaries specified by - MinSpareThreads and MaxSpareThreads. - Since this process is very self-regulating, it is rarely - necessary to modify these directives from their default values. - The maximum number of clients that may be served simultaneously - is determined by multiplying the number of server processes - that will be created (NumServers) by the maximum - number of threads created in each process - (MaxThreadsPerChild).

    - -

    While the parent process is usually started as root under - Unix in order to bind to port 80, the child processes and - threads are launched by Apache as a less-privileged user. The - User and Group directives are used to - set the privileges of the Apache child processes. The child - processes must be able to read all the content that will be - served, but should have as few privileges beyond that as - possible. In addition, unless suexec is used, these directives also - set the privileges which will be inherited by CGI scripts.

    - -

    MaxRequestsPerChild controls how frequently the - server recycles processes by killing old ones and launching new - ones.

    - -

    See also: Setting which addresses and - ports Apache uses.

    - -

    In addition it adds the extra ability to specify that - specific processes should serve requests under different - userids. These processes can then be associated with specific - virtual hosts.

    - -
    - - -CoreDumpDirectory - - -Group - - -PidFile - - -Listen - - -ListenBacklog - - -LockFile - - -MaxRequestsPerChild - - -MaxSpareThreads - - -MaxThreadsPerChild - - -MinSpareThreads - - -NumServers - - -ScoreBoardFile - - -SendBufferSize - - -StartThreads - - -User - - - -AssignUserId -AssignUserID user_id group_id -virtual host - - -

    Tie a virtual host to a specific child process. Requests addressed to -the virtual host where this directive appears will be served by the process -running with the specified user and group id.

    -
    -
    - - -ChildPerUserId -ChildPerUserID user_id -group_id child_id -server config - - -

    Specify a user id and group id for a specific child process. The number of -children if set by the NumServers -directive. For example, the default value for NumServers is 5 and that means -children ids 1,2,3,4 and 5 are available for assigment. If a child does not -have an associated ChildPerUserID, it inherits the User and Group settings from the main server

    -
    -
    - -
    - diff --git a/docs/manual/mod/prefork.html b/docs/manual/mod/prefork.html deleted file mode 100644 index ba305704f11fb363d8cab9e011ff08c1da048f7d..0000000000000000000000000000000000000000 --- a/docs/manual/mod/prefork.html +++ /dev/null @@ -1,130 +0,0 @@ - - - -Apache MPM mpmt_pthread - - - - - - -

    Multi-Processing Module prefork

    -

    -This Multi-Processing Module implements a pre-forking web server. -

    - -

    Status: MPM -
    -Source File: prefork.c -
    -Module Identifier: mpm_prefork_module -

    - -

    Summary

    - -

    This Multi-Processing Module (MPM) implements a pre-forking -non-threaded web server which handles request in a manner -very similar to the default behavior of Apache 1.3 on Unix.

    - - -

    Directives

    - - -
    - - -

    MaxSpareServers directive

    - -Syntax: MaxSpareServers number
    -Default: MaxSpareServers 10
    -Context: server config
    -Status: core

    - -The MaxSpareServers directive sets the desired maximum number of idle -child server processes. An idle process is one which is not handling -a request. If there are more than MaxSpareServers idle, then the parent -process will kill off the excess processes.

    - -Tuning of this parameter should only be necessary on very busy sites. -Setting this parameter to a large number is almost always a bad idea.

    - -

    - -See also MinSpareServers and -StartServers.


    - -

    MinSpareServers directive

    - -Syntax: MinSpareServers number
    -Default: MinSpareServers 5
    -Context: server config
    -Status: core

    - -The MinSpareServers directive sets the desired minimum number of idle -child server processes. An idle process is one which is not handling -a request. If there are fewer than MinSpareServers idle, then the parent -process creates new children at a maximum rate of 1 per second.

    - -Tuning of this parameter should only be necessary on very busy sites. -Setting this parameter to a large number is almost always a bad idea.

    - -This directive has no effect on Microsoft Windows. - -

    - -See also MaxSpareServers and -StartServers.


    - - - - - diff --git a/docs/manual/mod/prefork.xml b/docs/manual/mod/prefork.xml deleted file mode 100644 index 1dd788813bd1b5c0e26f6a12f5c9530171638f83..0000000000000000000000000000000000000000 --- a/docs/manual/mod/prefork.xml +++ /dev/null @@ -1,207 +0,0 @@ - - - -prefork -Implements a non-threaded, pre-forking web server -MPM -prefork.c -mpm_prefork_module - - -

    This Multi-Processing Module (MPM) implements a - non-threaded, pre-forking web server which handles request in a - manner very similar to the default behavior of Apache 1.3 on - Unix.

    - -

    A single control process is responsible for launching child - processes which listen for connections and serve them when they - arrive. Apache always tries to maintain several spare - or idle server processes, which stand ready to serve incoming - requests. In this way, clients do not need to wait for a new - child processes to be forked before their requests can be - served.

    - -

    The StartServers, - MinSpareServers, - MaxSpareServers, and - MaxClients regulate how - the parent process creates children to serve requests. In general, - Apache is very self-regulating, so most sites do not need to - adjust these directives from their default values. Sites which - need to serve more than 256 simultaneous requests may need to - increase MaxClients, - while sites with limited memory may need to decrease MaxClients to keep the server from - thrashing (swapping memory to disk and back). More information - about tuning process creation is provided in the performance hints - documentation.

    - -

    While the parent process is usually started as root under Unix - in order to bind to port 80, the child processes are launched by - Apache as a less-privileged user. The User and Group directives are used to set - the privileges of the Apache child processes. The child processes - must be able to read all the content that will be served, but - should have as few privileges beyond that as possible. In - addition, unless suexec is used, - these directives also set the privileges which will be inherited - by CGI scripts.

    - -

    MaxRequestsPerChild - controls how frequently the server recycles processes by killing - old ones and launching new ones.

    -
    -Setting which addresses and - ports Apache uses - - -CoreDumpDirectory - - - -PidFile - - - -Listen - - - -ListenBacklog - - - -LockFile - - - -MaxRequestsPerChild - - - -MaxSpareServers - - - -MinSpareServers - - - -ScoreBoardFile - - - -SendBufferSize - - - -ServerLimit - - - -StartServers - - - -User - - - -AcceptMutex -Method that Apache uses to serialize multiple children -accepting requests on network sockets -AcceptMutex default|method -AcceptMutex default -server config - - -

    The AcceptMutex directives sets the - method that Apache uses to serialize multiple children accepting - requests on network sockets. Prior to Apache 2.0, the method was - selectable only at compile time. The optimal method to use is - highly architecture and platform dependent. For further details, - see the performance tuning - documentation.

    - -

    If this directive is set to default, then the - compile-time selected default will be used. Other possible - methods are listed below. Note that not all methods are - available on all platforms. If a method is specified which is - not available, a message will be written to the error log - listing the available methods.

    - -
    -
    flock
    - -
    uses the flock(2) system call to lock the - file defined by the LockFile directive.
    - -
    fcntl
    - -
    uses the fnctl(2) system call to lock the - file defined by the LockFile directive.
    - -
    sysvsem
    - -
    uses SySV-style semaphores to implement the mutex.
    - -
    pthread
    - -
    uses POSIX mutexes as implemented by the POSIX Threads - (PThreads) specification.
    -
    -
    -
    - - -MaxSpareServers -Maximum number of idle child server processes -MaxSpareServers number
    -MaxSpareServers 10 -server config - - -

    The MaxSpareServers directive sets the - desired maximum number of idle child server processes. An - idle process is one which is not handling a request. If there are - more than MaxSpareServers idle, then the parent process will kill - off the excess processes.

    - -

    Tuning of this parameter should only be necessary on very - busy sites. Setting this parameter to a large number is almost - always a bad idea.

    -
    -MinSpareServers -StartServers -
    - - -MinSpareServers -Minimum number of idle child server processes -MinSpareServers number -MinSpareServers 5 -server config - - -

    The MinSpareServers directive sets the - desired minimum number of idle child server processes. An - idle process is one which is not handling a request. If there are - fewer than MinSpareServers idle, then the parent process creates - new children at a maximum rate of 1 per second.

    - -

    Tuning of this parameter should only be necessary on very - busy sites. Setting this parameter to a large number is almost - always a bad idea.

    - -

    This directive has no effect on Microsoft Windows.

    -
    -MaxSpareServers -StartServers -
    - -
    - diff --git a/docs/manual/mod/worker.html b/docs/manual/mod/worker.html deleted file mode 100644 index 48e4d6642c53c1bb5dd6658bb05a314e09af4b3c..0000000000000000000000000000000000000000 --- a/docs/manual/mod/worker.html +++ /dev/null @@ -1,121 +0,0 @@ - - - - - - - Apache MPM worker - - - - - - -

    Multi-Processing Module worker

    - -

    This Multi-Processing Module implements a hybrid - multi-threaded multi-process web server.

    - -

    Status: MPM
    - Source File: worker.c
    - Module Identifier: - mpm_worker_module

    - -

    Summary

    - -

    This Multi-Processing Module (MPM) is the default for most - unix-like operating systems. It implements a hybrid - multi-process multi-threaded server. Each process has a fixed - number of threads. The server adjusts to handle load by - increasing or decreasing the number of processes.

    - -

    A single control process is responsible for launching child - processes. Each child process creates a fixed number of threads - as specified in the ThreadsPerChild directive. The - individual threads then listen for connections and serve them - when they arrive.

    - -

    Apache always tries to maintain a pool of spare or - idle server threads, which stand ready to serve incoming - requests. In this way, clients do not need to wait for a new - threads or processes to be created before their requests can be - served. Apache assesses the total number of idle threads in all - processes, and forks or kills processes to keep this number - within the boundaries specified by MinSpareThreads - and MaxSpareThreads. Since this process is very - self-regulating, it is rarely necessary to modify these - directives from their default values. The maximum number of - clients that may be served simultaneously is determined by - multiplying the maximum number of server processes that will be - created (MaxClients) by the number of threads - created in each process (ThreadsPerChild).

    - -

    While the parent process is usually started as root under - Unix in order to bind to port 80, the child processes and - threads are launched by Apache as a less-privileged user. The - User and Group directives are used to - set the privileges of the Apache child processes. The child - processes must be able to read all the content that will be - served, but should have as few privileges beyond that as - possible. In addition, unless suexec is used, these directives also - set the privileges which will be inherited by CGI scripts.

    - -

    MaxRequestsPerChild controls how frequently the - server recycles processes by killing old ones and launching new - ones.

    - -

    See also: Setting which addresses and - ports Apache uses.

    - -

    Directives

    - - - - - - diff --git a/docs/manual/mod/worker.xml b/docs/manual/mod/worker.xml deleted file mode 100644 index c0d38ce98221d54f54cf0f4b58bf8d76c443d7f9..0000000000000000000000000000000000000000 --- a/docs/manual/mod/worker.xml +++ /dev/null @@ -1,94 +0,0 @@ - - - - -worker -Multi-Processing Module implementing a hybrid - multi-threaded multi-process web server -MPM -worker.c -mpm_worker_module - - -

    This Multi-Processing Module (MPM) is the default for most - unix-like operating systems. It implements a hybrid - multi-process multi-threaded server. Each process has a fixed - number of threads. The server adjusts to handle load by - increasing or decreasing the number of processes.

    - -

    A single control process is responsible for launching child - processes. Each child process creates a fixed number of threads - as specified in the ThreadsPerChild directive. The - individual threads then listen for connections and serve them - when they arrive.

    - -

    Apache always tries to maintain a pool of spare or - idle server threads, which stand ready to serve incoming - requests. In this way, clients do not need to wait for a new - threads or processes to be created before their requests can be - served. Apache assesses the total number of idle threads in all - processes, and forks or kills processes to keep this number - within the boundaries specified by MinSpareThreads - and MaxSpareThreads. Since this process is very - self-regulating, it is rarely necessary to modify these - directives from their default values. The maximum number of - clients that may be served simultaneously is determined by - multiplying the maximum number of server processes that will be - created (MaxClients) by the number of threads - created in each process (ThreadsPerChild).

    - -

    While the parent process is usually started as root under - Unix in order to bind to port 80, the child processes and - threads are launched by Apache as a less-privileged user. The - User and Group directives are used to - set the privileges of the Apache child processes. The child - processes must be able to read all the content that will be - served, but should have as few privileges beyond that as - possible. In addition, unless suexec is used, these directives also - set the privileges which will be inherited by CGI scripts.

    - -

    MaxRequestsPerChild controls how frequently the - server recycles processes by killing old ones and launching new - ones.

    - -

    See also: Setting which addresses and - ports Apache uses.

    -
    - -CoreDumpDirectory - -Group - -PidFile - -Listen - -ListenBacklog - -LockFile - -MaxClients - -MaxRequestsPerChild - -MaxSpareThreads - -MinSpareThreads - -ScoreBoardFile - -SendBufferSize - -ServerLimit - -StartServers - -ThreadLimit - -ThreadsPerChild - -User - - -
    \ No newline at end of file diff --git a/docs/manual/mpm.html b/docs/manual/mpm.html deleted file mode 100644 index 7521751bfe2bab299a3c3efd480df59876e26784..0000000000000000000000000000000000000000 --- a/docs/manual/mpm.html +++ /dev/null @@ -1,96 +0,0 @@ - - - -Available MPM's for Apache 2.0 - - - - -

    Apache 2.0 - Available MPM's

    -

    Dated 15th January 2000

    -

    Apache 2.0 has a new architecture that moves the processing of requests from the code server into a MultiProcessing Module (MPM). By selecting the MPM to use you can alter the way the server behaves. Additionally the introduction of the MPM's has led to platforms developing their own optimised modules. On some platforms there is no choice, whilst on others there are different options, each with differing processing models. This list aims to help you select a suitable MPM for your system.

    -
    -

    Platforms

    - -

    Unix

    - - - - - - - - - - - - - - - - - - - - - -
    MPMDescriptionMaintainer
    preforkThe prefork MPM reproduces the behaviour of Apache 1.3.??
    mpmt_pthreadThis MPM uses a multi-process, multi-threaded model to provide good scability and stability.Manoj?
    dexterThis is Manoj's plaything. It has a number of hybrid features that Manoj has been looking at to improve performance.Manoj
    - -

    Windows

    - - - - - - - - - - - -
    MPMDescriptionMaintainer
    winntThe Windows MPM. This is mainly aimed at Windows NT.Bill Stoddard
    - -

    OS/2

    - - - - - - - - - - - -
    MPMDescriptionMaintainer
    spmt_os2Single process, multiple thread MPM for OS2.Brian Havard
    - -

    BeOS

    - - - - - - - - - - - -
    MPMDescriptionMaintainer
    mpmt_beosMulti-threaded MPM for BeOS. This follows the mpmt_pthread model.David Reid
    - -
    -David Reid, 15th January 2000 - - - diff --git a/docs/manual/mpm.html.en b/docs/manual/mpm.html.en deleted file mode 100644 index 7521751bfe2bab299a3c3efd480df59876e26784..0000000000000000000000000000000000000000 --- a/docs/manual/mpm.html.en +++ /dev/null @@ -1,96 +0,0 @@ - - - -Available MPM's for Apache 2.0 - - - - -

    Apache 2.0 - Available MPM's

    -

    Dated 15th January 2000

    -

    Apache 2.0 has a new architecture that moves the processing of requests from the code server into a MultiProcessing Module (MPM). By selecting the MPM to use you can alter the way the server behaves. Additionally the introduction of the MPM's has led to platforms developing their own optimised modules. On some platforms there is no choice, whilst on others there are different options, each with differing processing models. This list aims to help you select a suitable MPM for your system.

    -
    -

    Platforms

    -
    -

    Unix

    - - - - - - - - - - - - - - - - - - - - - -
    MPMDescriptionMaintainer
    preforkThe prefork MPM reproduces the behaviour of Apache 1.3.??
    mpmt_pthreadThis MPM uses a multi-process, multi-threaded model to provide good scability and stability.Manoj?
    dexterThis is Manoj's plaything. It has a number of hybrid features that Manoj has been looking at to improve performance.Manoj
    - -

    Windows

    - - - - - - - - - - - -
    MPMDescriptionMaintainer
    winntThe Windows MPM. This is mainly aimed at Windows NT.Bill Stoddard
    - -

    OS/2

    - - - - - - - - - - - -
    MPMDescriptionMaintainer
    spmt_os2Single process, multiple thread MPM for OS2.Brian Havard
    - -

    BeOS

    - - - - - - - - - - - -
    MPMDescriptionMaintainer
    mpmt_beosMulti-threaded MPM for BeOS. This follows the mpmt_pthread model.David Reid
    - -
    -David Reid, 15th January 2000 - - - diff --git a/docs/manual/new_features_2_0.html b/docs/manual/new_features_2_0.html deleted file mode 100644 index 325696f453c5f9caf5a472461e4dad2f7f016e74..0000000000000000000000000000000000000000 --- a/docs/manual/new_features_2_0.html +++ /dev/null @@ -1,50 +0,0 @@ - - -New features with Apache 2.0 - - - - - -

    Overview of New Features in Apache 2.0

    - -

    Enhancements: Core | - -


    - -

    Core Enhancements:

    - -
    -
    Unix Threading -
    On Unix systems with POSIX threads support, Apache can now run in a - hybrid multiprocess, multithreaded mode. This should improve - scalability. - -
    New Build System -
    The build system has been rewritten from scratch to be based on - autoconf and libtool. This makes Apache's configuration system more - similar to that of other packages. - -
    Multiprotocol Support -
    Apache now has some of the infrastructure in place to support serving - multiple protocols. mod_echo has been written as an example. - -
    Better support for non-Unix platforms -
    Apache 2.0 should be faster and more stable on non-Unix platforms such - as BeOS, OS/2, and Windows. With the introduction of platform-specific - multiprocessing modules and the Apache Portable Runtime, these - platforms can now avoid using POSIX-emulation functions that are - sometimes buggy and always hurt performance. - -
    New API -
    The API for modules has changed significantly for 2.0. Many of the - module-ordering problems from 1.3 should be gone, since 2.0 does much - of this automatically now. Also, new calls have been added that should - allow modules to do more without requiring patching of the core Apache - server. - - - - - diff --git a/docs/manual/new_features_2_0.html.de b/docs/manual/new_features_2_0.html.de deleted file mode 100644 index b32085498ed4c76061ca82a4400b5eb3a8adce26..0000000000000000000000000000000000000000 --- a/docs/manual/new_features_2_0.html.de +++ /dev/null @@ -1,180 +0,0 @@ - - - - - - - New features with Apache 2.0 - - - - - - -

    Übersicht der neuen Funktionen in Apache 2.0

    -

    übersetzt von simon.putz@t-online.de

    -

    Erweiterungen: Core | Module

    - -
    - -

    Core Erweiterungen:

    - -
    -
    Unix Threading
    - -
    Auf Unix Systemen mit POSIX threads Unterstützung, kann Apache jetzt - in einem hybrid multiprocess im multithreaded mode gestartet werden. Dies - verbessiert die Skalierfähigkeit für viele, aber nicht alle Konfigurationen.
    - -
    Neues Build System
    - -
    Das build system wurde komplett auf der Basis von autoconf und libtool neugeschrieben. - Dadurch wird Apaches Konfigurationssystem dem vieler anderer Packages ähnlicher.
    - -
    Multiprotocol Unterstützung
    - -
    Apache hat jetzt einiges der Infrastruktur bereit um mehrere Protokolle zu unterstützen. - mod_echo wurde zum Beispiel neugeschrieben.
    - -
    Bessere Unterstützung von nicht-Unix Plattformen
    - -
    Apache 2.0 ist schneller und stabiler auf nicht-Unix - Plattformen wie BeOS, OS/2, und Windows. Mit der Einführung von Plattform-spezifischen - multi-processing Modulen (MPMs) und der - Apache Portable Runtime (APR), sind diese Plattformen jetzt in ihrer - eigenen API implementiert, was die häufigen Fehler der schlecht funktionierenden - POSIX-emulation layer vermeidet.
    - -
    Neue Apache API
    - -
    Die API für Module hat sich in 2.0 stark verändert. - Viele der module-ordering Probleme von 1.3 sollten verschwunden sein. - 2.0 macht einiges hiervon automatisch, und das module ordering wird - jetzt per-hook vorgenommen, um mehr Flexibilität zu bieten. Außerdem wurden neue calls - hinzugefügt, die zusätzliche Modul-Fähigkeiten bieten, ohne den core zu patchen.
    - -
    IPv6 Unterstützung
    - -
    Auf Systemen, bei denen IPv6 durch die zugrunde liegende - Apache Portable Runtime library unterstützt ist, bekommt Apache standarmäßig IPv6 listening - sockets. Zusätzlich unterstützen die Listen, - NameVirtualHost, and <VirtualHost> Directiven - numerische IPv6 address strings (z.B., "Listen - [fe80::1]:8080").
    - -
    Filtering
    - -
    Apache Module können jetzt als Filter die auf den Inhalts-Stream wirken, wie er - von oder zum Server kommt. - Dadurch können z. B. die Ausgabe von CGI scripts von den Server Side Include Direktiven - durch den INCLUDE filter in mod_include bearbeitet werden.
    - -
    Mehrsprachige Fehlermeldungen
    - -
    Fehlermeldungen zum Browser werden jetzt, durch SSI Dokumente, in verschiedenen Sprachen zur Verfügung gestellt. - Sie können durch den Administrator angepasst werden, um ein einheitliches Design zu erreichen.
    - -
    Vereinfachte Konfiguration
    - -
    Viele komplizierte Direktiven wurden vereinfacht. Die oft verwirrenden - Port und BindAddress Direktiven wurden entfernt; nur die - Listen Direktive wird zum IP address binding benutzt; die - ServerName Direktive bestimmt den Server-Namen und Port-Nummer - nur zur Weiterleitung und vhost Erkennung.
    - -
    Eingebaute Windows NT Unicode Unterstützung
    - -
    Apache 2.0 auf Windows NT benutzt jetzt utf-8 für alle Dateinamen - Encodierungen. Diese werden direkt zum zugrunde liegenden unicode Dateisystem übersetzt, - somit wird die Mehrsprach-Unterstützung, fü alle Windows NT-basiernde Installationen, - inclusive Windows 2000 und Windows XP gewährt. - Diese Unterstützung geht nicht auf Windows 95, 98 oder ME über, diese - benutzen noch immer die lokale codepage des Rechners zum Dateisystem-Zugriff.
    - -
    -
    - -

    Modul Erweiterungen:

    - -
    -
    mod_ssl
    - -
    Neues Modul in Apache 2.0. Dieses Modul ist ein Interface - zu den SSL/TLS Verschlüsselungs-Protokollen, die von OpenSSL bereitgestellt werden.
    - -
    mod_dav
    - -
    Neues Modul in Apache 2.0. Dieses Modul bietet die HTTP - Distributed Authoring and Versioning (DAV) Spezifikation, um - Web-Inhalte zu Posten und zu Warten.
    - -
    mod_auth_digest
    - -
    Zusätzliche Unterstützung für prozessübergreifendes session caching mittels shared memory. -
    - -
    mod_charset_lite
    - -
    Neues Modul in Apache 2.0. Dieses experimentelle Modul erlaubt Zeichensatz-Übersetung oder Wiederkodierung.
    - -
    mod_file_cache
    - -
    Neues Modul in Apache 2.0. Dieses Modul beinhaltet die Funktionen von mod_mmap_static aus Apache 1.3 und - weitere Zwischenspeicherungs-Möglichkeiten.
    - -
    mod_headers
    - -
    Dieses Modul ist in Apache 2.0 viel flexibler geworden. Es kann jetzt request-header die von mod_proxy benutzt werden, verändern - und es kann Response-Header nach Fallunterscheidung setzen.
    - -
    mod_proxy
    - -
    Das Proxy Modul wurde komplett neugeschrieben um die Funktionen der neuen Filter Infrastruktur auszuschöpfen und - um einen zuverlässigen, mit HTTP/1.1 übereinstimmenden Proxy zu erstellen.
    - -
    mod_negotiation
    - -
    Eine neue ForceLanguagePriority - Direktive kann benutzt werden, um zu sichern, dass der Client auf jeden Fall ein einzelnes Dokument anstatt - NOT ACCEPTABLE oder MULTIPLE CHOICES Antworten bekommt. Zusätzlich wurden die Verhandlungs und Multiview - Algorithmen gesäubert um einheitlichere Ergebnisse zu liefern. Außerdem wird eine neue Form der Type Map - die Dokumente einschließen kann, bereitgestellt.
    - -
    mod_autoindex
    - -
    Automatisch indizierte Verzeichnis Auflistungen können für bessere Übersichtlichkeit - durch eine HTML Tabelle dargestellt werden. Genauerere Sortierungen, wie Versions-Sorting und Platzhalter-Filtering - des Verzeichnislistings werden unterstützt.
    - -
    mod_include
    - -
    Neue Direktiven erlauben es, die Standard Start- und Endtags von SSI Elementen - zu ändern und die Fehler and Zeitformat Konfiguration in der Haupkonfigurationsdatei - anstatt im SSI Dokument stattzufinden. - Ergebnisse von regular expression parsing und grouping können duch die mod_include Variablen $0 bis $9 eingeholt werden.
    - -
    mod_auth_dbm
    - -
    DBM-ähnliche Datenbanken werden jetzt durch die AuthDBMType - Direktive unterstützt. - -
    mod_auth_db
    - -
    Berkeley DB 3.0 wird jetzt unterstützt
    - -
    mod_proxy
    - -
    Neue Konfigurations Sections bringen eine lesbarere - (und intern schnellere) Kontrolle der zwischengespeicherten Seiten; die überladene - Konfiguration wird nicht unterstützt. Das - Modul is jetzt in eigene Protokoll-Unterstützungs Module wie proxy_connect, proxy_ftp and proxy_http gegliedert.
    - -
    - - - - - diff --git a/docs/manual/new_features_2_0.html.en b/docs/manual/new_features_2_0.html.en deleted file mode 100644 index 325696f453c5f9caf5a472461e4dad2f7f016e74..0000000000000000000000000000000000000000 --- a/docs/manual/new_features_2_0.html.en +++ /dev/null @@ -1,50 +0,0 @@ - - -New features with Apache 2.0 - - - - - -

    Overview of New Features in Apache 2.0

    - -

    Enhancements: Core | - -


    - -

    Core Enhancements:

    - -
    -
    Unix Threading -
    On Unix systems with POSIX threads support, Apache can now run in a - hybrid multiprocess, multithreaded mode. This should improve - scalability. - -
    New Build System -
    The build system has been rewritten from scratch to be based on - autoconf and libtool. This makes Apache's configuration system more - similar to that of other packages. - -
    Multiprotocol Support -
    Apache now has some of the infrastructure in place to support serving - multiple protocols. mod_echo has been written as an example. - -
    Better support for non-Unix platforms -
    Apache 2.0 should be faster and more stable on non-Unix platforms such - as BeOS, OS/2, and Windows. With the introduction of platform-specific - multiprocessing modules and the Apache Portable Runtime, these - platforms can now avoid using POSIX-emulation functions that are - sometimes buggy and always hurt performance. - -
    New API -
    The API for modules has changed significantly for 2.0. Many of the - module-ordering problems from 1.3 should be gone, since 2.0 does much - of this automatically now. Also, new calls have been added that should - allow modules to do more without requiring patching of the core Apache - server. - - - - - diff --git a/docs/manual/new_features_2_0.html.fr b/docs/manual/new_features_2_0.html.fr deleted file mode 100644 index 0b5188f0c055b96e10a96464d04d7e29c20a6261..0000000000000000000000000000000000000000 --- a/docs/manual/new_features_2_0.html.fr +++ /dev/null @@ -1,88 +0,0 @@ - - -Nouvelles fonctionnalités d'Apache 2.0 - - - - - -

    Aperçu des nouvelles fonctionnalités -d'Apache 2.0

    - -

    Améliorations : Noyau -| Module - -


    - -

    Améliorations du noyau  :

    - -
    -
    Threads sur Unix -
    Sur les systèmes Unix, Apache peut s'exécuter selon -un modèle hybride multi-processus et multi-threads, -en employant les threads selon la norme POSIX. Ceci devrait améliorer -les performances. - -
    Nouveau système de construction -
    Le système de construction a été entièrement -réécrit et repose sur autoconf et libtool. Cela rend le -système de configuration plus semblables aux autres paquetages. - -
    Support multiprotocole -
    Apache possède maintenant une infrastructure afin de servir de multiples -protocoles. mod_echo a été écrit comme exemple de ces -nouvelles fonctions. - -
    Meilleur support des plates-formes autres qu'Unix -
    Apache 2.0 est plus rapide et plus stable sur les plates-formes non Unix -telles que BeOS, OS/2, et Windows. Avec l'introduction des -modules multi traitements (MPMs) spécifiques aux -plates-formes et l'exécuteur portable Apache (APR), le code pour ces -plates-formes est réalisé en employant leurs API natives, -permettant ainsi d'éviter les couches d'émulations POSIX -souvent boguées et peu performantes. - -
    Nouvelle API Apache -
    L'API pour les modules de la version 2.0 a changé de manière -importante. Beaucoup de problèmes d'ordonnancement des modules existants -dans la version 1.3 devraient disparaître. La version 2.0 gère ceci de -manière automatique, et l'ordonnancement des modules s'effectue selon -une fonction d'accrochage afin de permettre une plus grande flexibilité. - -
    - -


    -

    Améliorations concernant les modules :

    - -
    - -
    mod_auth_db -
    Il accepte maintenant les bases Berkeley DB 3.0. - -
    mod_auth_digest -
    Il inclut une nouvelle gestion des sessions en utilisant un cache commun -aux processus grace à une mémoire partagée. - -
    mod_charset_lite
    Nouveau module dans Apache 2.0. -Ce module expérimental permet la traduction des pages de caractères -ou leur recodage. - -
    mod_dav -
    Nouveau module dans Apache 2.0. Ce module met en oeuvre la spécification -"HTTP Distributed Authoring and Versioning (DAV)" permettant de distribuer et -maintenir le contenu d'un site web. - -
    mod_file_cache -
    Nouveau module dans Apache 2.0. Ce module inclut les fonctionnalités -du module mod_mmap_static existant dans la version d'Apache 1.3, en ajoutant -davantage de possibilités de cache. - -
    - - - - - - diff --git a/docs/manual/platform/netware.html b/docs/manual/platform/netware.html deleted file mode 100644 index 8add778b5f10f308a05e07adf5373da1a5300e06..0000000000000000000000000000000000000000 --- a/docs/manual/platform/netware.html +++ /dev/null @@ -1,278 +0,0 @@ - - - -Using Apache with Novell NetWare 5 - - - - - - -

    Using Apache With Novell NetWare 5

    - -

    This document explains how to install, configure and run - Apache 1.3 under Novell NetWare 5. Please note that at - this time, NetWare support is entirely experimental, and is - recommended only for experienced users. The Apache Group does not - guarantee that this software will work as documented, or even at - all. If you find any bugs, or wish to contribute in other ways, please - use our bug reporting - page.

    - -

    Warning: Apache on NetWare has not yet been optimized for performance. -Apache still performs best, and is most reliable on Unix platforms. Over -time we will improve NetWare performance. Folks doing comparative reviews -of webserver performance are asked to compare against Apache -on a Unix platform such as Solaris, FreeBSD, or Linux.

    - -

    - -Most of this document assumes that you are installing Apache from a -binary distribution. If you want to compile Apache yourself (possibly -to help with development, or to track down bugs), see the section on -Compiling Apache for NetWare below. - -


    - - - -
    - -

    Requirements

    - -Apache 1.3 is designed to run on NetWare 5.0 and 5.1. -

    - -If running on NetWare 5.0 you must install Service Pack 4. - -

    -

    - -Service pack 4 is available here. - -

    Downloading Apache for NetWare 5

    - -

    Information on the latest version of Apache can be found on the -Apache web server at http://www.apache.org/. This will -list the current release, any more recent alpha or beta-test releases, -together with details of mirror web and anonymous ftp sites.

    - -

    -

    Installing Apache for NetWare

    - -There is no Apache install program for NetWare currently. You will need -to compile apache and copy the files over to the server manually. An -install program will be posted at a later date. -

    -Follow these steps to install Apache on NetWare (assuming you will install to sys:/apache): - -

      -
    • Create a directory called Apache on a NetWare volume -
    • Copy Apache.nlm, Apachec.nlm, htdigest.nlm, and htpasswd.nlm to sys:/apache -
    • Create a directory under sys:/Apache called conf -
    • Copy all the *.conf-dist-nw files to the sys:/apache/conf directory - and rename them all as *.conf files -
    • Copy the mime.types and magic files to sys:/apache/conf directory -
    • Copy all files and subdirectories of \apache-1.3\htdocs to sys:/apache/htdocs and - rename the proper index file (index.html.en) to index.html -
    • Copy all files and subdirectories in \apache-1.3\icons to sys:/apache/icons -
    • Create the directory sys:/apache/logs on the server -
    • Create the directory sys:/apache/cgi-bin on the server -
    • Create the directory sys:/apache/modules and copy all nlm modules built into the - modules directory -
    • Edit the httpd.conf file setting ServerRoot and ServerName to reflect your correct - server settings -
    • Add sys:/apache to the search path. EXAMPLE: search add sys:\apache -
    - -

    Apache may be installed to other volumes besides the default sys volume. - -

    Running Apache for NetWare

    - -To start Apache just type apache at the console. This -will load apache in the OS address space. If you prefer to load -Apache in a protected address space you may specify the address space -with the load statement as follows: -

    -

    -    load address space = apache apache
    -
    -

    -This will load Apache into an address space called apache. Running multiple instances -of Apache concurrently on NetWare is possible by loading each instance into its own -protected address space. - -

    -After starting Apache it will be listening to port 80 (unless you -changed the Port, Listen or -BindAddress directives in the configuration files). -To connect to the server and access the default page, launch a browser -and enter the server's name or address. - -This should respond with a welcome page, and a link to the Apache -manual. If nothing happens or you get an error, look in the -error_log file in the logs directory. - -

    - -Once your basic installation is working, you should configure it -properly by editing the files in the conf directory. - -

    -To unload Apache running in the OS address space just type the -following at the console: -

    -    unload apache
    -
    -If apache is running in a protected address space specify the -address space in the unload statement: -
    -    unload address space = apache apache
    -
    - -

    -When working with Apache it is important to know how it will find the -configuration files. You can specify a configuration file on the command line -in two ways: - -

      -
    • -f specifies a path to a particular configuration file -
    -
        apache -f "vol:/my server/conf/my.conf"
    -
        apache -f test/test.conf
    - -In these cases, the proper ServerRoot should be set in the configuration file. - -

    - -If you don't specify a configuration file name with -f, Apache will -use the file name compiled into the server, usually "conf/httpd.conf". Invoking -Apache with the -V switch will display this value labeled as SERVER_CONFIG_FILE. -Apache will then determine its ServerRoot by trying the following, in this order: - -

      -
    • A ServerRoot directive via a -C switch. -
    • The -d switch on the command line. -
    • Current working directory -
    • The server root compiled into the server. -
    - -

    -The server root compiled into the server is usually "sys:/apache". -invoking apache with the -V switch will display this value -labeled as HTTPD_ROOT. - -

    Configuring Apache for NetWare

    - -Apache is configured by files in the conf -directory. These are the same as files used to configure the Unix -version, but there are a few different directives for Apache on -NetWare. See the Apache documentation for all the -available directives. - -

    - -The main differences in Apache for NetWare are: - -

      -
    • Because Apache for NetWare is multithreaded, it does not use a - separate process for each request, as Apache does with - Unix. Instead there are only threads running: a parent thread, and - a child which handles the requests. Within the child each request is - handled by a separate thread. -

      - - So the "process"-management directives are different: -

      MaxRequestsPerChild - - Like the Unix directive, this controls how many requests a - process will serve before exiting. However, unlike Unix, a - process serves all the requests at once, not just one, so if - this is set, it is recommended that a very high number is - used. The recommended default, MaxRequestsPerChild - 0, does not cause the process to ever exit. -

      ThreadsPerChild - - This directive is new, and tells the server how many threads it - should use. This is the maximum number of connections the server - can handle at once; be sure and set this number high enough for - your site if you get a lot of hits. The recommended default is - ThreadsPerChild 50. -

      ThreadStackSize - - This directive tells the server what size of stack to use for - the individual threads. The recommended default is - ThreadStackSize 65536. -

      -

    • The directives that accept filenames as arguments now must use - NetWare filenames instead of Unix ones. However, because Apache - uses Unix-style names internally, you must use forward slashes, not - backslashes. Volumes can be used; if omitted, the drive with the - Apache executable will be assumed.

      -
    • Apache for NetWare contains the ability to load modules at runtime, - without recompiling the server. If Apache is compiled normally, it - will install a number of optional modules in the - \Apache\modules directory. To activate these, or other - modules, the new LoadModule - directive must be used. For example, to active the status module, - use the following (in addition to the status-activating directives - in access.conf):

      -
      -    LoadModule status_module modules/status
      -
      -

      Information on creating loadable - modules is also available.

      -
    - -

    Compiling Apache for NetWare

    - -

    Compiling Apache requires MetroWerks CodeWarrior 5 to be properly - installed. - -

    First, unpack the Apache distribution into an appropriate - directory. Then go to the src subdirectory of the Apache - distribution and unzip ApacheNW.mcp.gz. You may use a - recent version of WinZip to accomplish this or gzip for Windows. The main - Metrowerks project file for Apache (ApacheNW.mcp) is now ready - to use. Just double click on it from within explorer and it should - automatically launch MetroWerks CodeWarrior. -

    - -

    All major pieces of Apache may be built using the ApacheNW.mcp project - file. This includes modules such as status, info, and proxy. In addition, - the following project files have been provided as well: -

       
    -       /apache-1.3/src/support/htpasswd.mcp.gz
    -       /apache-1.3/src/support/htdigest.mcp.gz
    -
    - -

    -htpasswd.mcp.gz and htdigest.mcp.gz will also need -to be unzipped before they can be used with MetroWerks CodeWarrior. - -

    Once Apache has been compiled, it needs to be installed in its server - root directory. The default is the sys:/Apache - directory.

    -

    -Before running the server you must fill out the conf directory. -Copy the *.conf-dist-nw from the distribution conf directory -and rename *.conf. Edit the ServerRoot entries to your -actual server root (for example "sys:/apache"). Copy over -the conf/magic and conf/mime.types files as well. - - - - - diff --git a/docs/manual/platform/perf-hp.html b/docs/manual/platform/perf-hp.html deleted file mode 100644 index 0bf286747df93ade8d82c4fe587babf47e2f315c..0000000000000000000000000000000000000000 --- a/docs/manual/platform/perf-hp.html +++ /dev/null @@ -1,124 +0,0 @@ - - - -Running a High-Performance Web Server on HPUX - - - - - -

    - - -

    Running a High-Performance Web Server for HPUX

    - -
    -Date: Wed, 05 Nov 1997 16:59:34 -0800
    -From: Rick Jones <raj@cup.hp.com>
    -Reply-To: raj@cup.hp.com
    -Organization: Network Performance
    -Subject: HP-UX tuning tips
    -
    - -Here are some tuning tips for HP-UX to add to the tuning page. - -

    - -For HP-UX 9.X: Upgrade to 10.20
    -For HP-UX 10.[00|01|10]: Upgrade to 10.20 - -

    - -For HP-UX 10.20: - -

    - -Install the latest cumulative ARPA Transport Patch. This will allow you -to configure the size of the TCP connection lookup hash table. The -default is 256 buckets and must be set to a power of two. This is -accomplished with adb against the *disc* image of the kernel. The -variable name is tcp_hash_size. - -

    - -How to pick the value? Examine the output of - -ftp://ftp.cup.hp.com/dist/networking/tools/connhist and see how many -total TCP connections exist on the system. You probably want that number -divided by the hash table size to be reasonably small, say less than 10. -Folks can look at HP's SPECweb96 disclosures for some common settings. -These can be found at -http://www.specbench.org/. If an HP-UX system was -performing at 1000 SPECweb96 connections per second, the TIME_WAIT time -of 60 seconds would mean 60,000 TCP "connections" being tracked. - -

    - -Folks can check their listen queue depths with - -ftp://ftp.cup.hp.com/dist/networking/misc/listenq. - -

    - -If folks are running Apache on a PA-8000 based system, they should -consider "chatr'ing" the Apache executable to have a large page size. -This would be "chatr +pi L ." The GID of the running executable -must have MLOCK priviledges. Setprivgrp(1m) should be consulted for -assigning MLOCK. The change can be validated by running Glance and -examining the memory regions of the server(s) to make sure that they -show a non-trivial fraction of the text segment being locked. - -

    - -If folks are running Apache on MP systems, they might consider writing a -small program that uses mpctl() to bind processes to processors. A -simple pid % numcpu algorithm is probably sufficient. This might even go -into the source code. - -

    - -If folks are concerned about the number of FIN_WAIT_2 connections, they -can use nettune to shrink the value of tcp_keepstart. However, they -should be careful there - certainly do not make it less than oh two to -four minutes. If tcp_hash_size has been set well, it is probably OK to -let the FIN_WAIT_2's take longer to timeout (perhaps even the default -two hours) - they will not on average have a big impact on performance. - -

    - -There are other things that could go into the code base, but that might -be left for another email. Feel free to drop me a message if you or -others are interested. - -

    - -sincerely, - -

    - -rick jones
    - -http://www.cup.hp.com/netperf/NetperfPage.html - -


    - -

    - Apache HTTP Server Version 1.3 -

    - -Index -Home - - - diff --git a/docs/manual/platform/win_compiling.html b/docs/manual/platform/win_compiling.html deleted file mode 100644 index 54970ea86d0615275abfba717ea0491531dc1e67..0000000000000000000000000000000000000000 --- a/docs/manual/platform/win_compiling.html +++ /dev/null @@ -1,120 +0,0 @@ - - - -Compiling Apache for Microsoft Windows - - - - - - - - - -Using Apache with Microsoft Windows - - - - - - -

    Compiling Apache for Microsoft Windows

    - -

    There are many important points before you begin compiling Apache. - See Using Apache with Microsoft Windows - before you begin.

    - -

    Compiling Apache requires Microsoft Visual C++ 5.0 (or later) to be - properly installed. It is easiest to compile with the command-line tools - (nmake, etc...). Consult the VC++ manual to determine how to install - them.

    - -

    First, unpack the Apache distribution into an appropriate - directory. Open a command-line prompt, and change to the - src subdirectory of the Apache distribution.

    - -

    The master Apache makefile instructions are contained in the - Makefile.win file. To compile Apache on Windows, simply - use one of the following commands: -

      -
    • nmake /f Makefile.win _apacher (release build) -
    • nmake /f Makefile.win _apached (debug build) -
    - -

    These will both compile Apache. The latter will include debugging - information in the resulting files, making it easier to find bugs and - track down problems.

    - -

    Apache can also be compiled using VC++'s Visual Studio development - environment. Although compiling Apache in this manner is not as - simple, it makes it possible to easily modify the Apache source, or - to compile Apache if the command-line tools are not installed. - Project files (.DSP) are included for each of the - portions of Apache. To build Apache from the these projects files - you will need to build the following projects in this order: - This needs updating for Apache 2.0 -

      -
    1. os\win32\ApacheOS.dsp -
    2. regex\regex.dsp -
    3. ap\ap.dsp -
    4. main\gen_uri_delims.dsp -
    5. main\gen_test_char.dsp -
    6. ApacheCore.dsp -
    7. Apache.dsp -
    - - In addition, the src\os\win32 subdirectory contains - project files for the optional modules (see below).

    - -

    Once Apache has been compiled, it needs to be installed in its server - root directory. The default is the \Apache - directory, on the current hard drive.

    - -

    To install the files into the \Apache directory - automatically, use one the following nmake commands (see above):

    -
      -
    • nmake /f Makefile.win installr INSTDIR=dir - (for release build) -
    • nmake /f Makefile.win installd INSTDIR=dir - (for debug build) -
    - -The dir argument to INSTDIR gives the installation directory; it can -be omitted if Apache is to be installed into \Apache. - -

    This will install the following:

    - -
      -
    • dir\Apache.exe - Apache executable -
    • dir\ApacheCore.dll - Main Apache shared library -
    • dir\modules\ApacheModule*.dll - Optional Apache - modules (7 files) -
    • dir\conf - Empty configuration directory -
    • dir\logs - Empty logging directory -
    - -

    If you do not have nmake, or wish to install in a different directory, - be sure to use a similar naming scheme.

    - -

    -Before running the server you must fill out the conf directory. -Copy the *.conf-dist-win from the distribution conf directory -and rename *.conf. Edit the @@ServerRoot@@ entries to your -actual server root (for example "C:\apache"). Copy over -the conf/magic and conf/mime.types files as well. - - - - diff --git a/docs/manual/platform/windows.html b/docs/manual/platform/windows.html deleted file mode 100644 index 43889ca90891a835236724893fce89b91abaf065..0000000000000000000000000000000000000000 --- a/docs/manual/platform/windows.html +++ /dev/null @@ -1,229 +0,0 @@ - - - -Using Apache with Microsoft Windows - - - - - - -

    Using Apache With Microsoft Windows

    - -

    This document explains how to compile, install, configure and run - Apache 1.3a1 (or later) under Microsoft Windows. Please note that at - this time, Windows support is entirely experimental, and is - recommended only for experienced users. The Apache Group does not - guarantee that this software will work as documented, or even at - all. If you find any bugs, or wish to contribute in other ways, please - use our bug reporting - page.

    - -
    - - - -
    - -

    Requirements

    - -

    Apache 1.3a1 requires the following:

    - -
      -
    • Microsoft Windows NT 4.0*, or Windows 95. -
    • An Intel-based PC-compatible capable of running above OS (exact - requirements unknown) with a connection to a TCP/IP network. -
    • Microsoft Visual C++ 5.0 or later. -
    - -

    * Apache may run with Windows NT 3.5.1, but - has not been tested.

    - -

    Apache 1.3a1 is available only in source form. Future releases will - contain prebuilt binaries for use by those without compilers (which we - understand are the vast majority of Windows users), however the - current release requires Microsoft Visual C++ 5.0 or later. The Apache - Group is releasing 1.3a1 only as source to limit the alpha release to - those who have the tools and knowledge to assist with the development - processes.

    - -

    This documentation assumes good working knowledge of Microsoft - Windows, Microsoft Visual C++, and the Apache web server (for - Unix).

    - -

    Downloading Apache for Windows

    - -

    Information on the latest version of Apache can be found on the Apache -web server at http://www.apache.org/. This will -list the current release, any more recent alpha or beta-test release, -together with details of mirror web and anonymous ftp sites.

    - -

    You will be able to download Apache 1.3a1 or a later release in - several forms, including a WinZip (.zip) - archive. Although this contains the same files as the others (likely - .tar.gz and .tar.Z), it is recommended for - Windows use, as all the files contained therein will contain Windows - line breaks. The other archives may contain files with Unix line - breaks, which will not function on Windows (although they may).

    - -

    Compiling Apache for Windows

    - -

    Compiling Apache requires Microsoft Visual C++ 5.0 to be properly - installed. It is easiest to compile with the command-line tools - (nmake, etc...). Consult the VC++ manual to determine how to install - them.

    - -

    First, unpack the Apache distribution into an appropriate - directory. Open a command-line prompt, and change to the - src subdirectory of the Apache distribution.

    - -

    The master Apache makefile instructions are contained in the - Makefile.nt file. To compile Apache, simply use one of - the following commands: -

      -
    • nmake /f Makefile.nt release -
    • nmake /f Makefile.nt debug -
    - -

    These will both compile Apache. The latter will include debugging - information in the resulting files, making it easier to find bugs and - track down problems.

    - -

    Apache can also be compiled using VC++'s Visual Studio development - environment. Although compiling Apache in this manner is not as simple, - it makes it possible to easily modify the Apache source, or to compile - Apache if the command-line tools are not installed.

    - -

    Project files (.DSP) are included for each of the - portions of Apache. The two projects that are necessary for Apache to - run are Apache.dsp and ApacheCore.dsp. The - src\nt subdirectory also contains project files for the - optional modules (see below).

    - -

    Installing Apache for Windows

    - -

    Once Apache has been compiled, it needs to be installed in its server - root directory. The hard-coded default is the \Apache - directory, on the current hard drive. Another directory may be used, - but the files will need to be installed manually.

    - -

    To install the files into the \Apache directory - automatically, use one the following nmake commands (see above):

    -
      -
    • nmake /f Makefile.nt installr (for release build) -
    • nmake /f Makefile.nt installd (for debug build) -
    - -

    This will install the following:

    - -
      -
    • \Apache\Apache.exe - Apache executable -
    • \Apache\ApacheCore.dll - Main Apache shared library -
    • \Apache\modules\ApacheModule*.dll - Optional Apache - modules (7 files) -
    • \Apache\conf - Empty configuration directory -
    • \Apache\logs - Empty logging directory -
    - -

    If you do not have nmake, or wish to install in a different directory, - be sure to use a similar naming scheme.

    - -

    Using Apache for Windows

    - -

    The first step is to set up Apache's configuration files. Default - configuration files for Windows are located in the conf - subdirectory in the Apache distribution, and are named - httpd.conf-dist-win, access.conf-dist-win - and srm.conf-dist-win. Move these into - \Apache\conf, and rename them httpd.conf, - access.conf and srm.conf, respectively.

    - -

    Configuring Apache is nearly identical to the Unix version of Apache, - so most of the standard Apache documentation is - applicable. A few things are, however, different:

    - -
      -
    • Because Apache for Windows is multithreaded, it does not use a - separate process for each request, as Apache does with - Unix. Therefore, the "process"-management directives are different: -

      StartServers - This - tells the server how many processes to use. Unlike Unix, there - will never be more than this number, and only one will be used - at a time (the others will be held in reserve in case the main - processes crashes or otherwise dies). The recommended default is - StartServers 3. -

      MaxRequestsPerChild - - Like the Unix directive, this controls how many requests a - process will serve before exiting. However, unlike Unix, a - process serves all the requests at once, not just one, so if - this is set, it is recommended that a very high number is - used. The recommended default, MaxRequestsPerChild - 0, does not cause the process to ever exit. -

      ThreadsPerChild - - This directive is new, and tells the server how many threads it - should use. This is the maximum number of connections the server - can handle at once; be sure and set this number high enough for - your site if you get a lot of hits. The recommended default is - ThreadsPerChild 20.

      -
    • The directives that accept filenames as arguments now must use - Windows filenames instead of Unix ones. However, because Apache - uses Unix-style names internally, you must use forward slashes, not - backslashes. Drive letters can be used; if omitted, the drive with - the Apache executable will be assumed.

      -
    • Apache for Windows contains the ability to load modules at runtime, - without recompiling the server. If Apache is compiled normally, it - will install a number of optional modules in the - \Apache\modules directory. To activate these, or other - modules, the new LoadModule - directive must be used. For example, to active the status module, - use the following (in addition to the status-activating directives - in access.conf):

      -
      -    LoadModule status_module modules/ApacheModuleStatus.dll
      -
      -

      Information on creating module - DLLs is also available.

      -
    - -

    Once Apache is configured correctly, it is nearly ready to be -run. However, we recommend you copy the icons and -htdocs subdirectories from the Apache distribution to -\Apache. The latter is especially important, as it contains -the document root (what the server actually serves). - -

    Apache can be executed in one of two ways, directly from the command - line, or as a Windows NT service. To run it from the command line, use - the following command: -

    -    C:\Apache> apache -s
    -
    - -

    Apache will then execute, and will remain running until it is - exited. To use Apache as a Windows NT service, use the following:

    -
    -    C:\Apache> apache -i
    -
    -

    Then open the Services control panel, and start the Apache service.

    - -

    If you installed Apache in a server root other than - \Apache, you must use the -f command-line - option to specify the httpd.conf file, or the -d option - to specify the server root.

    - - - - diff --git a/docs/manual/programs/ab.html b/docs/manual/programs/ab.html deleted file mode 100644 index 5cc22202d01260fce8591b7b1177f42c9e4b8c5b..0000000000000000000000000000000000000000 --- a/docs/manual/programs/ab.html +++ /dev/null @@ -1,121 +0,0 @@ - -Manual Page: ab - Apache HTTP Server - - - -
    -NAME
    -     ab - Apache HTTP server benchmarking tool
    -
    -SYNOPSIS
    -     ab [ -k ] [ -n requests ] [ -t timelimit ] [ -c  concurrency
    -     ]  [  -p POST file ] [ -A Authenticate username:password ] [
    -     -P Proxy Authenticate username:password ] [ -H Custom header
    -     ]  [ -C Cookie name=value ] [ -T content-type ] [ -v verbos-
    -     ity ] ] [ -w output HTML ] ] [ -x <table> attributes ]  ]  [
    -     -y   <tr>   attributes   ]   ]   [   -z  <td>  attributes  ]
    -     [http://]hostname[:port]/path
    -
    -     ab [ -V ] [ -h ]
    -
    -DESCRIPTION
    -     ab is a tool for benchmarking your Apache HyperText Transfer
    -     Protocol  (HTTP)  server.  It  is  designed  to  give you an
    -     impression on how performant is your current Apache  instal-
    -     lation.   This  especially  shows  you how much requests per
    -     time your Apache installation is capable to serve.
    -
    -OPTIONS
    -     -k          Enable the HTTP KeepAlive feature, i.e.  perform
    -                 multiple   requests   within  one  HTTP  session
    -                 instead. Default is no KeepAlive.
    -
    -     -n requests Number of requests to perform for the benchmark-
    -                 ing session.  The default is to just perform one
    -                 single request which usually leads to  not  very
    -                 representative benchmarking results.
    -
    -     -t timelimit
    -                 Seconds to max.  spend  for  benchmarking.  This
    -                 implies  a  -n  50000  internally.  Use  this to
    -                 benchmark the server within a fixed total amount
    -                 of time.  Per default there is no timelimit.
    -
    -     -c concurrency
    -                 Number of multiple requests per time to perform.
    -                 Default is one request per time.
    -
    -     -p POST file
    -                 File containing data to POST.
    -
    -     -A Authorization username:password
    -                 Supply BASIC Authentification credentials to the
    -                 server.  The username and password are separated
    -                 by a single ':' and send on the wire  uuencoded.
    -                 The  string  is  send  regardless  of wether the
    -                 server  needs  it;  (i.e.  has  send   an   401.
    -                 Authentifcation needed).
    -
    -     -p Proxy-Authorization username:password
    -                 Supply BASIC Authentification credentials  to  a
    -                 proxy  en-route.  The  username and password are
    -                 separated by a single ':' and send on  the  wire
    -                 uuencoded.   The  string  is  send regardless of
    -                 wether the proxy needs it; (i.e. has send an 407
    -                 Proxy authentifcation needed).
    -
    -     -C Cookie name=value
    -                 Add a 'Cookie:' line to the request.  The  argu-
    -                 ment  is typically in the form of a 'name=value'
    -                 pair. This field is repeatable.
    -
    -     -p Header string
    -                 Postfix extra headers to the request. The  argu-
    -                 ment  is typically in the form of a valid header
    -                 line; containing a colon separated  field  value
    -                 pair. (i.e.
    -
    -     -T content-type
    -                 Content-type header to use for POST data.
    -
    -     -v          Set verbosity level - 4 and above prints  infor-
    -                 mation  on  headers, 3 and above prints response
    -                 codes (404, 200, etc.), 2 and above prints warn-
    -                 ings and info.
    -
    -     -w          Print out results in HTML tables.  Default table
    -                 is two columns wide, with a white background.
    -
    -     -x attributes
    -                 String to use as attributes for <table>.  Attri-
    -                 butes are inserted <table here >
    -
    -     -y attributes
    -                 String to use as attributes for <tr>.
    -
    -     -z attributes
    -                 String to use as attributes for <td>.
    -
    -     -V          Display version number and exit.
    -
    -     -h          Display usage information.
    -
    -BUGS
    -     There are  various  statically  declared  buffers  of  fixed
    -     length.  Combined  with the lazy parsing of the command line
    -     arguments, the response headers from the  server  and  other
    -     external inputs this might bite you.
    -
    -     It does not implement  HTTP/1.x  fully;  only  accepts  some
    -     'expected'  forms  of  responses.  The  rather  heavy use of
    -     strstr(3) shows up top in profile, which  might  indicate  a
    -     performance  problem;  i.e. you would measure the ab perfor-
    -     mance rather than the server's.
    -
    -SEE ALSO
    -     httpd(8)
    -
    -
    - - diff --git a/docs/manual/programs/apachectl.html b/docs/manual/programs/apachectl.html deleted file mode 100644 index b16a717961e1e72899144f31cfb687ad70b366d6..0000000000000000000000000000000000000000 --- a/docs/manual/programs/apachectl.html +++ /dev/null @@ -1,82 +0,0 @@ - -Manual Page: apachectl - Apache HTTP Server - - - -
    -NAME
    -     apachectl - Apache HTTP server control interface
    -
    -SYNOPSIS
    -     apachectl command [...]
    -
    -DESCRIPTION
    -     apachectl is a front end to the  Apache  HyperText  Transfer
    -     Protocol (HTTP) server.  It is designed to help the adminis-
    -     trator control the functioning of the Apache httpd daemon.
    -
    -     NOTE: If your Apache installation uses  non-standard  paths,
    -     you  will  need  to  edit  the  apachectl  script to set the
    -     appropriate paths to your PID file and  your  httpd  binary.
    -     See the comments in the script for details.
    -
    -     The apachectl script returns a 0 exit value on success,  and
    -     >0  if an error occurs.  For more details, view the comments
    -     in the script.
    -
    -     Full   documentation   for   Apache    is    available    at
    -     http://www.apache.org/
    -
    -OPTIONS
    -     The command can be any one or more of the following options:
    -
    -     start       Start the Apache daemon.  Gives an error  if  it
    -                 is already running.
    -
    -     stop        Stops the Apache daemon.
    -
    -     restart     Restarts the  Apache  daemon  by  sending  it  a
    -                 SIGHUP.   If  the  daemon  is not running, it is
    -                 started.  This command automatically checks  the
    -                 configuration  files  via configtest before ini-
    -                 tiating the restart to make sure Apache  doesn't
    -                 die.
    -
    -     fullstatus  Displays a full status report  from  mod_status.
    -                 For  this  to  work, you need to have mod_status
    -                 enabled on your server and a text-based  browser
    -                 such  as lynx available on your system.  The URL
    -                 used to access the status report can be  set  by
    -                 editing the STATUSURL variable in the script.
    -
    -     status      Displays a brief status report.  Similar to  the
    -                 fullstatus  option,  except  that  the  list  of
    -                 requests currently being served is omitted.
    -
    -     graceful    Gracefully restarts the Apache daemon by sending
    -                 it  a SIGUSR1.  If the daemon is not running, it
    -                 is started.  This differs from a normal  restart
    -                 in  that  currently  open  connections  are  not
    -                 aborted.  A side effect is that  old  log  files
    -                 will not be closed immediately.  This means that
    -                 if used in a log rotation script, a  substantial
    -                 delay  may  be  necessary to ensure that the old
    -                 log files are  closed  before  processing  them.
    -                 This command automatically checks the configura-
    -                 tion files via configtest before initiating  the
    -                 restart to make sure Apache doesn't die.
    -
    -     configtest  Run a configuration file syntax test. It  parses
    -                 the  configuration files and either reports Syn-
    -                 tax Ok or detailed information about the partic-
    -                 ular syntax error.
    -
    -     help        Displays a short help message.
    -
    -SEE ALSO
    -     httpd(8)
    -
    -
    - - diff --git a/docs/manual/programs/apxs.html b/docs/manual/programs/apxs.html deleted file mode 100644 index 14ff1965c93ae78b89297ad2098ab830592a82a6..0000000000000000000000000000000000000000 --- a/docs/manual/programs/apxs.html +++ /dev/null @@ -1,269 +0,0 @@ - -Manual Page: apxs - Apache HTTP Server - - - -
    -NAME
    -     apxs - APache eXtenSion tool
    -
    -SYNOPSIS
    -     apxs -g [ -S name=value ] -n modname
    -
    -     apxs -q [ -S name=value ] query ...
    -
    -     apxs -c [ -S name=value ] [ -o dsofile ] [ -I incdir ] [  -D
    -     name=value  ]  [  -L libdir ] [ -l libname ] [ -Wc,compiler-
    -     flags ] [ -Wl,linker-flags ] files ...
    -
    -     apxs -i [ -S name=value ] [ -n modname ] [ -a ] [ -A ]  dso-
    -     file ...
    -
    -     apxs -e [ -S name=value ] [ -n modname ] [ -a ] [ -A ]  dso-
    -     file ...
    -
    -DESCRIPTION
    -     apxs is a tool for building and installing extension modules
    -     for  the  Apache  HyperText Transfer Protocol (HTTP) server.
    -     This is achieved by building a dynamic shared  object  (DSO)
    -     from  one  or  more source or object files which then can be
    -     loaded into the Apache server under runtime via the  LoadMo-
    -     dule directive from mod_so.
    -
    -     So to use this extension mechanism your platform has to sup-
    -     port  the DSO feature and your Apache httpd binary has to be
    -     built with the mod_so module.  The apxs  tool  automatically
    -     complains if this is not the case.  You can check this your-
    -     self by manually running the command
    -
    -       $ httpd -l
    -
    -     The module mod_so should be part of the displayed list.   If
    -     these  requirements are fulfilled you can easily extend your
    -     Apache server's functionality by installing your own modules
    -     with the DSO mechanism by the help of this apxs tool:
    -
    -       $ apxs -i -a -c mod_foo.c
    -       gcc -fpic -DSHARED_MODULE -I/path/to/apache/include -c mod_foo.c
    -       ld -Bshareable -o mod_foo.so mod_foo.o
    -       cp mod_foo.so /path/to/apache/libexec/mod_foo.so
    -       chmod 755 /path/to/apache/libexec/mod_foo.so
    -       [activating module `foo' in /path/to/apache/etc/httpd.conf]
    -       $ apachectl restart
    -       /path/to/apache/sbin/apachectl restart: httpd not running, trying to start
    -       [Tue Mar 31 11:27:55 1998] [debug] mod_so.c(303): loaded module foo_module
    -       /path/to/apache/sbin/apachectl restart: httpd started
    -       $ _
    -
    -     The arguments files can be any C source file (.c), a  object
    -     file  (.o)  or  even  a  library archive (.a). The apxs tool
    -     automatically recognizes these extensions and  automtaically
    -     used the C source files for compilation while just using the
    -     object and archive files for the  linking  phase.  But  when
    -     using  such pre-compiled objects make sure they are compiled
    -     for position independend code (PIC) to be able to  use  them
    -     for  a  dynamically loaded shared object.  For instance with
    -     GCC you always just have to use -fpic.   For  other  C  com-
    -     pilers  consult  its  manual  page or at watch for the flags
    -     apxs uses to compile the object files.
    -
    -     For more details about DSO support in Apache read the  docu-
    -     mentation    of    mod_so   or   perhaps   even   read   the
    -     src/modules/standard/mod_so.c source file.
    -
    -OPTIONS
    -     Common options:
    -
    -     -n modname  This explicitly sets the module name for the  -i
    -                 (install)  and  -g (template generation) option.
    -                 Use this to explicitly specify the module  name.
    -                 For  option  -g  this is required, for option -i
    -                 the apxs tool tries to determine the  name  from
    -                 the source or (as a fallback) at least by guess-
    -                 ing it from the filename.
    -
    -     Query options:
    -
    -     -q          Performs a query for apxs's knowledge about cer-
    -                 tain  settings.  The query parameters can be one
    -                 or more of the following strings:
    -                   CC              TARGET
    -                   CFLAGS          SBINDIR
    -                   CFLAGS_SHLIB    INCLUDEDIR
    -                   LD_SHLIB        LIBEXECDIR
    -                   LDFLAGS_SHLIB   SYSCONFDIR
    -                   LIBS_SHLIB
    -                 Use this for manually determining settings.  For
    -                 instance use
    -                   INC=-I`apxs -q INCLUDEDIR`
    -                 inside your own Makefiles  if  you  need  manual
    -                 access to Apache's C header files.
    -
    -     Configuration options:
    -
    -     -S name=value
    -                 This option changes the apxs settings  described
    -                 above.
    -
    -     Template Generation options:
    -
    -     -g          This generates a subdirectory name  (see  option
    -                 -n)  and there two files: A sample module source
    -                 file named mod_name.c which can  be  used  as  a
    -                 template  for  creating your own modules or as a
    -                 quick start for playing with the APXS mechanism.
    -                 And  a  corresponding  Makefile  for even easier
    -                 build and installing of this module.
    -
    -     DSO compilation options:
    -
    -     -c          This indicates  the  compilation  operation.  It
    -                 first  compiles the C source files (.c) of files
    -                 into corresponding object files  (.o)  and  then
    -                 builds a dynamically shared object in dsofile by
    -                 linking these object files  plus  the  remaining
    -                 object  files  (.o  and  .a)  of  files If no -o
    -                 option is specified the output file  is  guessed
    -                 from  the  first filename in files and thus usu-
    -                 ally defaults to mod_name.so
    -
    -     -o dsofile  Explicitly specifies the filename of the created
    -                 dynamically  shared object. If not specified and
    -                 the name cannot be guessed from the files  list,
    -                 the fallback name mod_unknown.so is used.
    -
    -     -D name=value
    -                 This option is directly passed  through  to  the
    -                 compilation  command(s).   Use  this to add your
    -                 own defines to the build process.
    -
    -     -I incdir   This option is directly passed  through  to  the
    -                 compilation  command(s).   Use  this to add your
    -                 own include directories to search to  the  build
    -                 process.
    -
    -     -L libdir   This option is directly passed  through  to  the
    -                 linker  command.   Use  this  to  add  your  own
    -                 library directories to search to the build  pro-
    -                 cess.
    -
    -     -l libname  This option is directly passed  through  to  the
    -                 linker  command.   Use  this  to  add  your  own
    -                 libraries to search to the build process.
    -
    -     -Wc,compiler-flags
    -                 This option passes compiler-flags as  additional
    -                 flags  to the compiler command.  Use this to add
    -                 local compiler-specific options.
    -
    -     -Wl,linker-flags
    -                 This option passes  linker-flags  as  additional
    -                 flags  to  the  linker command.  Use this to add
    -                 local linker-specific options.
    -
    -     DSO installation and configuration options:
    -
    -     -i          This indicates the  installation  operation  and
    -                 installs  one or more dynamically shared objects
    -                 into the server's libexec directory.
    -
    -     -a          This  activates  the  module  by   automatically
    -                 adding   a   corresponding  LoadModule  line  to
    -                 Apache's httpd.conf configuration  file,  or  by
    -                 enabling it if it already exists.
    -
    -     -A          Same as option -a  but  the  created  LoadModule
    -                 directive is prefixed with a hash sign (#), i.e.
    -                 the module is just prepared for later activation
    -                 but initially disabled.
    -
    -     -e          This indicates the editing operation, which  can
    -                 be  used with the -a and -A options similarly to
    -                 the -i operation  to  edit  Apache's  httpd.conf
    -                 configuration file without attempting to install
    -                 the module.
    -
    -EXAMPLES
    -     Assume you have an Apache module named  mod_foo.c  available
    -     which should extend Apache's server functionality. To accom-
    -     plish this you first have to compile the  C  source  into  a
    -     shared  object  suitable  for loading into the Apache server
    -     under runtime via the following command:
    -
    -       $ apxs -c mod_foo.c
    -       gcc -fpic -DSHARED_MODULE -I/path/to/apache/include -c mod_foo.c
    -       ld -Bshareable -o mod_foo.so mod_foo.o
    -       $ _
    -
    -     Then you have to update the Apache configuration  by  making
    -     sure  a  LoadModule directive is present to load this shared
    -     object. To simplify this step apxs provides an automatic way
    -     to  install the shared object in its "libexec" directory and
    -     updating  the  httpd.conf  file  accordingly.  This  can  be
    -     achieved by running:
    -
    -       $ apxs -i -a mod_foo.c
    -       cp mod_foo.so /path/to/apache/libexec/mod_foo.so
    -       chmod 755 /path/to/apache/libexec/mod_foo.so
    -       [activating module `foo' in /path/to/apache/etc/httpd.conf]
    -       $ _
    -
    -     This way a line named
    -
    -       LoadModule foo_module libexec/mod_foo.so
    -
    -     is added to the configuration file if still not present.  If
    -     you  want  to have this this disabled per default use the -A
    -     option, i.e.
    -
    -       $ apxs -i -A mod_foo.c
    -
    -     For a quick test of the APXS mechanism you can create a sam-
    -     ple  Apache  module  template  plus a corresponding Makefile
    -     via:
    -
    -       $ apxs -g -n foo
    -       Creating [DIR]  foo
    -       Creating [FILE] foo/Makefile
    -       Creating [FILE] foo/mod_foo.c
    -       $ _
    -
    -     Then you can immediately compile this sample module  into  a
    -     shared object and load it into the Apache server:
    -
    -       $ cd foo
    -       $ make all reload
    -       apxs -c mod_foo.c
    -       gcc -fpic -DSHARED_MODULE -I/path/to/apache/include -c mod_foo.c
    -       ld -Bshareable -o mod_foo.so mod_foo.o
    -       apxs -i -a -n "foo" mod_foo.so
    -       cp mod_foo.so /path/to/apache/libexec/mod_foo.so
    -       chmod 755 /path/to/apache/libexec/mod_foo.so
    -       [activating module `foo' in /path/to/apache/etc/httpd.conf]
    -       apachectl restart
    -       /path/to/apache/sbin/apachectl restart: httpd not running, trying to start
    -       [Tue Mar 31 11:27:55 1998] [debug] mod_so.c(303): loaded module foo_module
    -       /path/to/apache/sbin/apachectl restart: httpd started
    -       $ _
    -
    -     You can even use apxs to compile complex modules outside the
    -     Apache source tree, like PHP3:
    -
    -       $ cd php3
    -       $ ./configure --with-shared-apache=../apache-1.3
    -       $ apxs -c -o libphp3.so mod_php3.c libmodphp3-so.a
    -       gcc -fpic -DSHARED_MODULE -I/tmp/apache/include  -c mod_php3.c
    -       ld -Bshareable -o libphp3.so mod_php3.o libmodphp3-so.a
    -       $ _
    -
    -     because apxs automatically recognized  C  source  files  and
    -     object  files.   Only  C  source  files  are  compiled while
    -     remaining object files are used for the linking phase.
    -
    -SEE ALSO
    -     apachectl(1), httpd(8).
    -
    -
    - - diff --git a/docs/manual/programs/dbmmanage.html b/docs/manual/programs/dbmmanage.html deleted file mode 100644 index da860698f53880d3c93e5bc3583d7bb4e332a728..0000000000000000000000000000000000000000 --- a/docs/manual/programs/dbmmanage.html +++ /dev/null @@ -1,103 +0,0 @@ - -Manual Page: dbmmanage - Apache HTTP Server - - - -
    -NAME
    -     dbmmanage - Create and update user authentication  files  in
    -     DBM format
    -
    -SYNOPSIS
    -     dbmmanage filename [ command ] [ username [ encpasswd ] ]
    -
    -DESCRIPTION
    -     dbmmanage is used to create and update the DBM format  files
    -     used  to  store usernames and password for basic authentica-
    -     tion of HTTP users.   Resources  available  from  the  httpd
    -     Apache web server can be restricted to just the users listed
    -     in the files created by dbmmanage. This program can only  be
    -     used  when  the usernames are stored in a DBM file. To use a
    -     flat-file database see htpasswd.
    -
    -     This manual page only lists the command line arguments.  For
    -     details  of  the  directives  necessary  to  configure  user
    -     authentication in httpd see the Apache manual, which is part
    -     of   the   Apache   distribution   or   can   be   found  at
    -     http://www.apache.org/.
    -
    -OPTIONS
    -     filename
    -          The filename of the DBM format  file.  Usually  without
    -          the extension .db, .pag, or .dir.
    -
    -     command
    -          This selects the operation to perform:
    -
    -     add         Adds an entry for username to filename using the
    -                 encrypted password encpassword.
    -
    -     adduser     Asks for a password and then adds an  entry  for
    -                 username to filename .
    -
    -     check       Asks for a password and then checks if  username
    -                 is  in filename and if it's password matches the
    -                 specified one.
    -
    -     delete      Deletes the username entry from filename.
    -
    -     import      Reads username:password entries (one  per  line)
    -                 from  STDIN and adds them to filename. The pass-
    -                 words already has to be crypted.
    -
    -     update      Same as the "adduser" command,  except  that  it
    -                 makes sure username already exists in filename.
    -
    -     view        Just displays the complete contents of  the  DBM
    -                 file.
    -
    -     username    The user for which the update operation is  per-
    -                 formed.
    -
    -BUGS
    -     One should be aware that there are a number of different DBM
    -     file   formats   in  existance,  and  with  all  likelihood,
    -     libraries for more than one format may exist on your system.
    -     The three primary examples are NDBM, the GNU project's GDBM,
    -     and Berkeley DB 2.  Unfortunately, all these  libraries  use
    -     different file formats, and you must make sure that the file
    -     format used by filename is the same  format  that  dbmmanage
    -     expects  to see. dbmmanage currently has no way of determin-
    -     ing what type of DBM file it is looking at.  If used against
    -     the  wrong format, will simply return nothing, or may create
    -     a different DBM file with a different name, or at worst,  it
    -     may  corrupt the DBM file if you were attempting to write to
    -     it.
    -
    -     dbmmanage has a list of DBM format preferences,  defined  by
    -     the  @AnyDBM::ISA  array  near the beginning of the program.
    -     Since we prefer the Berkeley DB 2 file format, the order  in
    -     which  dbmmanage  will look for system libraries is Berkeley
    -     DB 2, then NDBM, and then GDBM.   The  first  library  found
    -     will  be  the  library dbmmanage will attempt to use for all
    -     DBM file transactions.  This ordering is slightly  different
    -     than  the standard @AnyDBM::ISA ordering in perl, as well as
    -     the ordering used by the simple dbmopen() call in  Perl,  so
    -     if  you  use  any  other utilities to manage your DBM files,
    -     they must also follow  this  preference  ordering.   Similar
    -     care  must  be  taken  if using programs in other languages,
    -     like C, to access these files.
    -
    -     Apache's mod_auth_db.c module corresponds to Berkeley  DB  2
    -     library,   while  mod_auth_dbm.c  corresponds  to  the  NDBM
    -     library.  Also, one can usually use the  file  program  sup-
    -     plied  with  most Unix systems to see what format a DBM file
    -     is in.
    -
    -SEE ALSO
    -     httpd(8)
    -
    -
    - - diff --git a/docs/manual/programs/htdigest.html b/docs/manual/programs/htdigest.html deleted file mode 100644 index 1891e0d066b85e2884b2c636e8ac5f84213a126e..0000000000000000000000000000000000000000 --- a/docs/manual/programs/htdigest.html +++ /dev/null @@ -1,50 +0,0 @@ - -Manual Page: htdigest - Apache HTTP Server - - - -
    -NAME
    -     htdigest - Create and update user authentication files
    -
    -SYNOPSIS
    -     htdigest [ -c ] passwdfile realm username
    -
    -DESCRIPTION
    -     htdigest is used to create and update the flat-files used to
    -     store  usernames,  realm and password for digest authentica-
    -     tion of HTTP users.   Resources  available  from  the  httpd
    -     Apache web server can be restricted to just the users listed
    -     in the files created by htdigest.
    -
    -     This manual page only lists the command line arguments.  For
    -     details  of  the  directives  necessary  to configure digest
    -     authentication in httpd see the Apache manual, which is part
    -     of   the   Apache   distribution   or   can   be   found  at
    -     http://www.apache.org/.
    -
    -OPTIONS
    -     -c   Create the passwdfile. If passwdfile already exists, it
    -          is deleted first.
    -
    -     passwdfile
    -          Name of the file to contain  the  username,  realm  and
    -          password.  If  -c  is given, this file is created if it
    -          does not already exist, or deleted and recreated if  it
    -          does exist.
    -
    -     realm
    -          The realm name to which the user name belongs.
    -
    -     username
    -          The user name to create or  update  in  passwdfile.  If
    -          username  does  not  exist  is  this  file, an entry is
    -          added. If it does exist, the password is changed.
    -
    -SEE ALSO
    -     httpd(8)
    -
    -
    - - diff --git a/docs/manual/programs/htpasswd.html b/docs/manual/programs/htpasswd.html deleted file mode 100644 index 6c95b6d77ea57b7ee19d78ab721c99d30007e488..0000000000000000000000000000000000000000 --- a/docs/manual/programs/htpasswd.html +++ /dev/null @@ -1,158 +0,0 @@ - -Manual Page: htpasswd - Apache HTTP Server - - - -
    -NAME
    -     htpasswd - Create and update user authentication files
    -
    -SYNOPSIS
    -     htpasswd [ -c ] [ -m ] passwdfile username
    -     htpasswd -b [ -c ] [ -m | -d | -p | -s ] passwdfile username
    -     password
    -     htpasswd -n [ -m | -d | -s | -p ] username
    -     htpasswd -nb [ -m | -d | -s | -p ] username password
    -
    -DESCRIPTION
    -     htpasswd is used to create and update the flat-files used to
    -     store  usernames  and  password  for basic authentication of
    -     HTTP users.  If htpasswd cannot access a file, such  as  not
    -     being  able to write to the output file or not being able to
    -     read the file in order to update it,  it  returns  an  error
    -     status and makes no changes.
    -
    -     Resources available from the httpd Apache web server can  be
    -     restricted  to just the users listed in the files created by
    -     htpasswd. This program can only manage usernames  and  pass-
    -     words  stored  in  a  flat-file.  It can encrypt and display
    -     password information for use in other types of data  stores,
    -     though.  To use a DBM database see dbmmanage.
    -
    -     htpasswd encrypts passwords using either a  version  of  MD5
    -     modified for Apache, or the system's crypt() routine.  Files
    -     managed by htpasswd may contain  both  types  of  passwords;
    -     some  user  records  may  have MD5-encrypted passwords while
    -     others in the same file may have  passwords  encrypted  with
    -     crypt().
    -
    -     This manual page only lists the command line arguments.  For
    -     details  of  the  directives  necessary  to  configure  user
    -     authentication in httpd see the Apache manual, which is part
    -     of   the   Apache   distribution   or   can   be   found  at
    -     <URL:http://www.apache.org/>.
    -
    -OPTIONS
    -     -b   Use batch mode; i.e., get the password from the command
    -          line  rather  than prompting for it. This option should
    -          be used  with  extreme  care,  since  the  password  is
    -          clearly visible on the command line.
    -
    -     -c   Create the passwdfile. If passwdfile already exists, it
    -          is rewritten and truncated.  This option cannot be com-
    -          bined with the -n option.
    -
    -     -n   Display the results  on  standard  output  rather  than
    -          updating  a  file.  This is useful for generating pass-
    -          word records acceptable  to  Apache  for  inclusion  in
    -          non-text  data  stores.  This option changes the syntax
    -          of the command  line,  since  the  passwdfile  argument
    -          (usually  the first one) is omitted.  It cannot be com-
    -          bined with the -c option.
    -
    -     -m   Use MD5 encryption for passwords. On Windows  and  TPF,
    -          this is the default.
    -
    -     -d   Use crypt() encryption for passwords.  The  default  on
    -          all platforms but Windows and TPF. Though possibly sup-
    -          ported by htpasswd on all platforms,  it  is  not  sup-
    -          ported by the httpd server on Windows and TPF.
    -
    -     -s   Use SHA encryption for passwords. Faciliates  migration
    -          from/to  Netscape  servers  using  the  LDAP  Directory
    -          Interchange Format (ldif).
    -
    -     -p   Use plaintext passwords. Though htpasswd  will  support
    -          creation  on  all platofrms, the httpd deamon will only
    -          accept plain text passwords on Windows and TPF.
    -
    -     passwdfile
    -          Name of the file to contain the user name and password.
    -          If  -c  is  given,  this file is created if it does not
    -          already exist, or rewritten and truncated  if  it  does
    -          exist.
    -
    -     username
    -          The username to create  or  update  in  passwdfile.  If
    -          username  does  not  exist  in  this  file, an entry is
    -          added. If it does exist, the password is changed.
    -
    -     password
    -          The plaintext password to be encrypted  and  stored  in
    -          the file.  Only used with the -b flag.
    -
    -EXIT STATUS
    -     htpasswd returns a zero status ("true") if the username  and
    -     password  have  been  successfully  added  or updated in the
    -     passwdfile.  htpasswd returns 1 if it encounters some  prob-
    -     lem  accessing  files,  2 if there was a syntax problem with
    -     the command line, 3 if the  password  was  entered  interac-
    -     tively  and  the  verification  entry didn't match, 4 if its
    -     operation was interrupted, 5 if a value is too  long  (user-
    -     name,  filename,  password, or final computed record), and 6
    -     if the username contains illegal characters  (see  the  RES-
    -     TRICTIONS section).
    -
    -EXAMPLES
    -     htpasswd /usr/local/etc/apache/.htpasswd-users jsmith
    -
    -          Adds or modifies the password for user jsmith. The user
    -          is prompted for the password.  If executed on a Windows
    -          system, the password will be encrypted using the  modi-
    -          fied  Apache  MD5  algorithm;  otherwise,  the system's
    -          crypt() routine will be used.  If  the  file  does  not
    -          exist, htpasswd will do nothing except return an error.
    -
    -     htpasswd -c /home/doe/public_html/.htpasswd jane
    -
    -          Creates a new file and stores a record in it  for  user
    -          jane.   The  user is prompted for the password.  If the
    -          file exists and cannot be read, or cannot  be  written,
    -          it  is  not altered and htpasswd will display a message
    -          and return an error status.
    -
    -     htpasswd -mb /usr/web/.htpasswd-all jones Pwd4Steve
    -
    -          Encrypts the password from the command line (Pwd4Steve)
    -          using the MD5 algorithm, and stores it in the specified
    -          file.
    -
    -SECURITY CONSIDERATIONS
    -     Web password files such as those managed by htpasswd  should
    -     not  be  within  the Web server's URI space -- that is, they
    -     should not be fetchable with a browser.
    -
    -     The use of the -b option is discouraged, since  when  it  is
    -     used the unencrypted password appears on the command line.
    -
    -RESTRICTIONS
    -     On the Windows and MPE platforms, passwords  encrypted  with
    -     htpasswd  are  limited  to  no  more  than 255 characters in
    -     length.  Longer passwords will be truncated to  255  charac-
    -     ters.
    -
    -     The MD5 algorithm used by htpasswd is specific to the Apache
    -     software;  passwords  encrypted  using it will not be usable
    -     with other Web servers.
    -
    -     Usernames are limited to 255 bytes and may not  include  the
    -     character ':'.
    -
    -SEE ALSO
    -     httpd(8) and the scripts in support/SHA1 which come with the
    -     distribution.
    -
    -
    - - diff --git a/docs/manual/programs/httpd.html b/docs/manual/programs/httpd.html deleted file mode 100644 index ff5a16f46235859ce23f5dbdae8111eaf5e20125..0000000000000000000000000000000000000000 --- a/docs/manual/programs/httpd.html +++ /dev/null @@ -1,117 +0,0 @@ - -Manual Page: httpd - Apache HTTP Server - - - -
    -NAME
    -     httpd - Apache hypertext transfer protocol server
    -
    -SYNOPSIS
    -     httpd [ -X ] [ -R libexecdir ] [ -d serverroot ] [ -f config
    -     ] [ -C directive ] [ -c directive ] [ -D parameter ]
    -
    -     httpd [ -h ] [ -l ] [ -L ] [ -v ] [ -V ] [ -S ] [ -t ] [  -T
    -     ]
    -
    -DESCRIPTION
    -     httpd is  the  Apache  HyperText  Transfer  Protocol  (HTTP)
    -     server  program.  It  is  designed to be run as a standalone
    -     daemon process. When used like this it will create a pool of
    -     child  processes to handle requests. To stop it, send a TERM
    -     signal to the initial (parent) process. The PID of this pro-
    -     cess  is  written  to  a  file as given in the configuration
    -     file.  Alternatively httpd may be invoked  by  the  Internet
    -     daemon  inetd(8)  each time a connection to the HTTP service
    -     is made.
    -
    -     This manual page only lists the command line arguments.  For
    -     details  of  the directives necessary to configure httpd see
    -     the Apache manual, which is part of the Apache  distribution
    -     or  can  be  found  at http://www.apache.org/. Paths in this
    -     manual may not reflect those compiled into httpd.
    -
    -OPTIONS
    -     -R libexecdir
    -                 This option is  only  available  if  Apache  was
    -                 built  with  the  SHARED_CORE rule enabled which
    -                 forces the Apache core code to be placed into  a
    -                 dynamic  shared  object (DSO) file. This file is
    -                 searched in a hardcoded  path  under  ServerRoot
    -                 per  default.  Use  this  option  if you want to
    -                 override it.
    -
    -     -d serverroot
    -                 Set the initial value for the ServerRoot  direc-
    -                 tive  to  serverroot.  This can be overridden by
    -                 the  ServerRoot  command  in  the  configuration
    -                 file. The default is /usr/local/apache.
    -
    -     -f config   Execute the  commands  in  the  file  config  on
    -                 startup. If config does not begin with a /, then
    -                 it is taken to be a path relative to the Server-
    -                 Root. The default is conf/httpd.conf.
    -
    -     -C directive
    -                 Process the configuration directive before read-
    -                 ing config files.
    -
    -     -c directive
    -                 Process the configuration directive after  read-
    -                 ing config files.
    -
    -     -D parameter
    -                 Sets a configuration parameter which can be used
    -                 with  <IfDefine>...</IfDefine>  sections  in the
    -                 configuration files  to  conditionally  skip  or
    -                 process commands.
    -
    -     -h          Output a short summary of available command line
    -                 options.
    -
    -     -l          Output a  list  of  modules  compiled  into  the
    -                 server.
    -
    -     -L          Output  a  list  of  directives  together   with
    -                 expected  arguments  and places where the direc-
    -                 tive is valid.
    -
    -     -S          Show the settings as parsed from the config file
    -                 (currently only shows the virtualhost settings).
    -
    -     -t          Run syntax tests for configuration  files  only.
    -                 The program immediately exits after these syntax
    -                 parsing with either a return code of  0  (Syntax
    -                 OK)  or  return  code  not  equal  to  0 (Syntax
    -                 Error).
    -
    -     -T          Same as option -t but does not check the config-
    -                 ured document roots.
    -
    -     -X          Run in single-process mode, for internal  debug-
    -                 ging  purposes  only; the daemon does not detach
    -                 from the terminal or fork any children.  Do  NOT
    -                 use this mode to provide ordinary web service.
    -
    -     -v          Print the version of httpd , and then exit.
    -
    -     -V          Print the version and build parameters of  httpd
    -                 , and then exit.
    -
    -FILES
    -     /usr/local/apache/conf/httpd.conf
    -     /usr/local/apache/conf/srm.conf
    -     /usr/local/apache/conf/access.conf
    -     /usr/local/apache/conf/mime.types
    -     /usr/local/apache/conf/magic
    -     /usr/local/apache/logs/error_log
    -     /usr/local/apache/logs/access_log
    -     /usr/local/apache/logs/httpd.pid
    -
    -SEE ALSO
    -     inetd(8).
    -
    -
    - - diff --git a/docs/manual/programs/index.html b/docs/manual/programs/index.html deleted file mode 100755 index 3e246aae4b1695b01a4c32013858233aa40ef422..0000000000000000000000000000000000000000 --- a/docs/manual/programs/index.html +++ /dev/null @@ -1,60 +0,0 @@ - - - - Apache HTTP Server and Supporting Programs - - - - - -

    Server and Supporting Programs

    - -

    This page documents all the executable programs included with the -Apache HTTP Server.

    - -
    - -
    httpd
    -
    Apache hypertext transfer protocol server
    - -
    apachectl
    -
    Apache HTTP server control interface
    - -
    ab
    -
    Apache HTTP server benchmarking tool
    - -
    apxs
    -
    APache eXtenSion tool
    - -
    dbmmanage
    -
    Create and update user authentication files in DBM format for basic -authentication
    - -
    htdigest
    -
    Create and update user authentication files for digest authentication
    - -
    htpasswd
    -
    Create and update user authentication files for basic authentication
    - -
    logresolve
    -
    Resolve hostnames for IP-addresses in Apache logfiles
    - -
    rotatelogs
    -
    Rotate Apache logs without having to kill the server
    - -
    suexec
    -
    Switch User For Exec
    - -
    Other Programs
    - -
    - - - - diff --git a/docs/manual/programs/logresolve.html b/docs/manual/programs/logresolve.html deleted file mode 100644 index 32efc42934c234d6fd0716b5468d641052d8e5a6..0000000000000000000000000000000000000000 --- a/docs/manual/programs/logresolve.html +++ /dev/null @@ -1,38 +0,0 @@ - -Manual Page: logresolve - Apache HTTP Server - - - -
    -
    -NAME
    -     logresolve - resolve hostnames  for  IP-adresses  in  Apache
    -     logfiles
    -
    -SYNOPSIS
    -     logresolve  [  -s  filename  ]  [  -c  ]  <   access_log   >
    -     access_log.new
    -
    -DESCRIPTION
    -     logresolve is  a  post-processing  program  to  resolve  IP-
    -     adresses in Apache's access logfiles.  To minimize impact on
    -     your nameserver, logresolve has its very own internal  hash-
    -     table  cache.  This  means  that each IP number will only be
    -     looked up the first time it is found in the log file.
    -
    -OPTIONS
    -     -s filename Specifies a filename to record statistics.
    -
    -     -c          This causes logresolve to apply some DNS checks:
    -                 after  finding the hostname from the IP address,
    -                 it looks up the IP addresses  for  the  hostname
    -                 and  checks that one of these matches the origi-
    -                 nal address.
    -
    -SEE ALSO
    -     httpd(8)
    -
    -
    - - diff --git a/docs/manual/programs/other.html b/docs/manual/programs/other.html deleted file mode 100755 index e80e8a2d9beeb9b34a3ac21dbbaa132081070a89..0000000000000000000000000000000000000000 --- a/docs/manual/programs/other.html +++ /dev/null @@ -1,48 +0,0 @@ - - - - Other Programs - Apache HTTP Server - - - - - -

    Other Programs

    - -

    The following programs are simple support programs included with -the Apache HTTP Server which do not have their own manual pages.

    - - -

    log_server_status

    - -

    This Perl script is designed to be run at a frequent interval by something -like cron. It connects to the server and downloads the status -information. It reformats the information to a single line and logs -it to a file. Adjust the variables at the top of the script -to specify the location of the resulting logfile.

    - -

    split-logfile

    - -

    This Perl script will take a combined Web server access -log file and break its contents into separate files. -It assumes that the first field of each line is the -virtual host identity (put there by "%v"), and that -the logfiles should be named that+".log" in the current -directory.

    - -

    The combined log file is read from stdin. Records read -will be appended to any existing log files.

    - - - -
    - - - - diff --git a/docs/manual/programs/rotatelogs.html b/docs/manual/programs/rotatelogs.html deleted file mode 100644 index 70d2295110bf339247d72178ac28f0d067d05f9d..0000000000000000000000000000000000000000 --- a/docs/manual/programs/rotatelogs.html +++ /dev/null @@ -1,42 +0,0 @@ - -Manual Page: rotatelogs - Apache HTTP Server - - - -
    -
    -NAME
    -     rotatelogs - rotate Apache logs without having to  kill  the
    -     server
    -
    -SYNOPSIS
    -     rotatelogs logfile rotationtime
    -
    -DESCRIPTION
    -     rotatelogs is a simple program for use in  conjunction  with
    -     Apache's piped logfile feature which can be used like this:
    -
    -        TransferLog "|rotatelogs /path/to/logs/access_log 86400"
    -
    -     This creates the files  /path/to/logs/access_log.nnnn  where
    -     nnnn  is  the  system time at which the log nominally starts
    -     (this time will always be a multiple of the  rotation  time,
    -     so you can synchronize cron scripts with it).  At the end of
    -     each rotation time (here  after  24  hours)  a  new  log  is
    -     started.
    -
    -OPTIONS
    -     logfile
    -          The path plus basename of the logfile. The suffix .nnnn
    -          is automatically added.
    -
    -     rotationtime
    -          The rotation time in seconds.
    -
    -SEE ALSO
    -     httpd(8)
    -
    -
    - - diff --git a/docs/manual/programs/suexec.html b/docs/manual/programs/suexec.html deleted file mode 100644 index f9f9b76a63153c3a0d5399b7778fd9314851e3f4..0000000000000000000000000000000000000000 --- a/docs/manual/programs/suexec.html +++ /dev/null @@ -1,29 +0,0 @@ - -Manual Page: suexec - Apache HTTP Server - - - -
    -
    -NAME
    -     suexec - Switch User For Exec
    -
    -SYNOPSIS
    -     No synopsis for usage, because this program is  used  inter-
    -     nally by Apache only.
    -
    -DESCRIPTION
    -     suexec is the  "wrapper"  support  program  for  the  suEXEC
    -     behaviour for Apache.  It is run from within Apache automat-
    -     ically to switch the user when an external program has to be
    -     run  under  a  different  user.  For  more information about
    -     suEXEC  see  the  document  `Apache  suEXEC  Support'  under
    -     http://httpd.apache.org/docs-2.0/suexec.html .
    -
    -SEE ALSO
    -     httpd(8)
    -
    -
    - - diff --git a/docs/manual/sections.html b/docs/manual/sections.html deleted file mode 100644 index a145a56531427d31859dea8f824ea150eeeee4d5..0000000000000000000000000000000000000000 --- a/docs/manual/sections.html +++ /dev/null @@ -1,139 +0,0 @@ - - -How Directory, Location and Files sections work - - - - - -

    How Directory, Location and Files sections work

    - -The sections <Directory>, <Location> and <Files> can contain -directives which only apply to specified directories, URLs or files -respectively. Also htaccess files can be used inside a directory to -apply directives to that directory. This document explains how these -different sections differ and how they relate to each other when -Apache decides which directives apply for a particular directory or -request URL. - -

    Directives allowed in the sections

    - -Everything that is syntactically allowed in -<Directory> is also allowed in -<Location> (except a sub-<Files> -section, but the code doesn't test for that, Lars has an open bug -report on that). Semantically however some things, and the most -notable is AllowOverrides, make no sense in -<Location>. The same for -<Files> -- syntactically everything is fine, but -semantically some things are different. - -

    How the sections are merged

    - -The order of merging is: - -
      - -
    1. - - <Directory> (except regular expressions) and - .htaccess done simultaneously (with .htaccess overriding - <Directory>) - -
    2. - -
    3. - <DirectoryMatch>, and - <Directory> with regular expressions - -
    4. - -
    5. <Files> and <FilesMatch> done simultaneously -
    6. - -
    7. <Location> and <LocationMatch> done simultaneously -
    8. - -
    - -Apart from <Directory>, each group is processed in -the order that they appear in the configuration -files. <Directory> (group 1 above) is processed in -the order shortest directory component to longest. If multiple -<Directory> sections apply to the same directory -they they are processed in the configuration file order. The -configuration files are read in the order httpd.conf, srm.conf and -access.conf. Configurations included via the Include -directive will be treated as if they where inside the including file -at the location of the Include directive. - -

    - -Sections inside <VirtualHost> sections are applied -after the corresponding sections outside the virtual host -definition. This allows virtual hosts to override the main server -configuration. (Note: this only works correctly from 1.2.2 and 1.3a2 -onwards. Before those releases sections inside virtual hosts were -applied before the main server). - -

    Notes about using sections

    - -The general guidelines are: - -

    - -

      -
    • - If you are attempting to match objects at the filesystem level - then you must use <Directory> and/or - <Files>. -
    • - -
    • - If you are attempting to match objects at the URL level then you - must use <Location> -
    • -
    - -But a notable exception is: - -
      -
    • - proxy control is done via <Directory>. This is - a legacy mistake because the proxy existed prior to - <Location>. A future version of the config - language should probably switch this to - <Location>. -
    • -
    - -Note also that modifying .htaccess parsing during Location doesn't do -anything because .htaccess parsing has already occured. - -

    - -Another note: -

    - -

      -
    • - There is actually a - <Location>/<LocationMatch> - sequence performed just before the name translation phase (where - Aliases and DocumentRoots are used to - map URLs to filenames). The results of this sequence are - completely thrown away after the translation has completed. -
    • -
    - - - diff --git a/docs/manual/sections.html.en b/docs/manual/sections.html.en deleted file mode 100644 index a145a56531427d31859dea8f824ea150eeeee4d5..0000000000000000000000000000000000000000 --- a/docs/manual/sections.html.en +++ /dev/null @@ -1,139 +0,0 @@ - - -How Directory, Location and Files sections work - - - - - -

    How Directory, Location and Files sections work

    - -The sections <Directory>, <Location> and <Files> can contain -directives which only apply to specified directories, URLs or files -respectively. Also htaccess files can be used inside a directory to -apply directives to that directory. This document explains how these -different sections differ and how they relate to each other when -Apache decides which directives apply for a particular directory or -request URL. - -

    Directives allowed in the sections

    - -Everything that is syntactically allowed in -<Directory> is also allowed in -<Location> (except a sub-<Files> -section, but the code doesn't test for that, Lars has an open bug -report on that). Semantically however some things, and the most -notable is AllowOverrides, make no sense in -<Location>. The same for -<Files> -- syntactically everything is fine, but -semantically some things are different. - -

    How the sections are merged

    - -The order of merging is: - -
      - -
    1. - - <Directory> (except regular expressions) and - .htaccess done simultaneously (with .htaccess overriding - <Directory>) - -
    2. - -
    3. - <DirectoryMatch>, and - <Directory> with regular expressions - -
    4. - -
    5. <Files> and <FilesMatch> done simultaneously -
    6. - -
    7. <Location> and <LocationMatch> done simultaneously -
    8. - -
    - -Apart from <Directory>, each group is processed in -the order that they appear in the configuration -files. <Directory> (group 1 above) is processed in -the order shortest directory component to longest. If multiple -<Directory> sections apply to the same directory -they they are processed in the configuration file order. The -configuration files are read in the order httpd.conf, srm.conf and -access.conf. Configurations included via the Include -directive will be treated as if they where inside the including file -at the location of the Include directive. - -

    - -Sections inside <VirtualHost> sections are applied -after the corresponding sections outside the virtual host -definition. This allows virtual hosts to override the main server -configuration. (Note: this only works correctly from 1.2.2 and 1.3a2 -onwards. Before those releases sections inside virtual hosts were -applied before the main server). - -

    Notes about using sections

    - -The general guidelines are: - -

    - -

      -
    • - If you are attempting to match objects at the filesystem level - then you must use <Directory> and/or - <Files>. -
    • - -
    • - If you are attempting to match objects at the URL level then you - must use <Location> -
    • -
    - -But a notable exception is: - -
      -
    • - proxy control is done via <Directory>. This is - a legacy mistake because the proxy existed prior to - <Location>. A future version of the config - language should probably switch this to - <Location>. -
    • -
    - -Note also that modifying .htaccess parsing during Location doesn't do -anything because .htaccess parsing has already occured. - -

    - -Another note: -

    - -

      -
    • - There is actually a - <Location>/<LocationMatch> - sequence performed just before the name translation phase (where - Aliases and DocumentRoots are used to - map URLs to filenames). The results of this sequence are - completely thrown away after the translation has completed. -
    • -
    - - - diff --git a/docs/manual/server-wide.html b/docs/manual/server-wide.html deleted file mode 100644 index 4636e49ab0b45ef8f5c3deda5933da66e05e55ca..0000000000000000000000000000000000000000 --- a/docs/manual/server-wide.html +++ /dev/null @@ -1,215 +0,0 @@ - - - -Server-Wide Configuration - - - - - -

    Server-Wide Configuration

    - -

    This document explains some of the directives provided by -core server which are used to configure -the basic operations of the server.

    - - - -
    - -

    Server Identification

    - - -
    -Related Directives

    - -ServerName
    -ServerAdmin
    -ServerSignature
    -ServerTokens
    -UseCanonicalName
    -
    - -

    The ServerAdmin and ServerTokens -directives control what information about the server will be presented -in server-generated documents such as error messages. -The ServerTokens directive sets the value of the -Server HTTP response header field.

    - -

    The ServerName and UseCanonicalName -directives are used by the server to determine how to construct -self-referential URLs. For example, when a client requests a -directory, but does not include the trailing slash in the directory -name, Apache must redirect the client to the full name including the -trailing slash so that the client will correctly resolve relative -references in the document.

    - -
    - -

    File Locations

    - - -
    -Related Directives

    - -CoreDumpDirectory
    -DocumentRoot
    -ErrorLog
    -Lockfile
    -PidFile
    -ScoreBoardFile
    -ServerRoot
    -
    - -

    These directives control the locations of the various files that -Apache needs for proper operation. When the pathname used does not -begin with a slash "/", the files are located relative to the -ServerRoot. Be careful about locating files in paths -which are writable by non-root users. See the security tips documentation for -more details.

    - -
    - -

    Process Creation

    - - -
    -Related Directives

    - -BS2000Account
    -Group
    -MaxClients
    -MaxRequestsPerChild
    -MaxSpareServers
    -MinSpareServers
    -ServerType
    -StartServers
    -ThreadsPerChild
    -User
    -
    - -

    When ServerType is set to its recommended value of -Standalone, Apache 1.3 for Unix is a pre-forking web -server. A single control process is responsible for launching child -processes which listen for connections and serve them when they -arrive. Apache always tries to maintain several spare or -idle server processes, which stand ready to serve incoming requests. -In this way, clients do not need to wait for a new child processes to -be forked before their requests can be served.

    - -

    The StartServers, MinSpareServers, -MaxSpareServers, and MaxServers regulate how -the parent process creates children to serve requests. In general, -Apache is very self-regulating, so most sites do not need to adjust -these directives from their default values. Sites which need to serve -more than 256 simultaneous requests may need to increase -MaxClients, while sites with limited memory may need to -decrease MaxClients to keep the server from thrashing -(swapping memory to disk and back).

    - -

    While the parent process is usually started as root under Unix -in order to bind to port 80, the child processes are launched -by Apache as a less-privileged user. The User and -Group directives are used to set the privileges -of the Apache child processes. The child processes must -be able to read all the content that will be served, but -should have as few privileges beyond that as possible. -In addition, unless suexec is used, -these directives also set the privileges which will be inherited -by CGI scripts.

    - -

    MaxRequestsPerChild controls how frequently the server -recycles processes by killing old ones and launching new ones.

    - -

    Under Windows, Apache launches one control process and one -child process. The child process creates multiple threads to -serve requests. The number of threads is controlled by the -ThreadsPerChild directive.

    - -
    - -

    Network Configuration

    - - -
    -Related Directives

    - -BindAddress
    -KeepAlive
    -KeepAliveTimeout
    -Listen
    -ListenBackLog
    -MaxKeepAliveRequests
    -Port
    -SendBufferSize
    -TimeOut
    -
    - -

    When Apache starts, it connects to some port and address on the -local machine and waits for incoming requests. By default, it listens -to all addresses on the machine, and to the port as specified by the -Port directive in the server configuration. However, it -can be told to listen to more than one port, to listen to only -selected addresses, or a combination. This is often combined with the -Virtual Host feature which determines how Apache -responds to different IP addresses, hostnames and ports.

    - -

    There are two directives used to restrict or specify which addresses -and ports Apache listens to. The BindAddress directive -is used to restrict the server to listening to a single IP address. -The Listen directive can be used to specify multiple -IP addresses and/or Ports to which Apache will listen.

    - -

    The ListenBackLog, SendBufferSize, and -TimeOut directives are used to adjust how Apache -interacts with the network.

    - -

    The KeepAlive, KeepAliveTimeout, -and MaxKeepAliveRequests directives are used to -configure how Apache handles persistent connections.

    - -
    -

    Limiting Resource Usage

    - -
    -Related Directives

    - -LimitRequestBody
    -LimitRequestFields
    -LimitRequestFieldsize
    -LimitRequestLine
    -RLimitCPU
    -RLimitMEM
    -RLimitNPROC
    -ThreadStackSize
    -
    - -

    The Limit* directives are used to place limits -on the amount of resources Apache will use in reading requests -from clients. By limiting these values, some kinds of denial -of service attacks can be mitigated.

    - -

    The RLimit* directives are used to limit the amount -of resources which can be used by processes forked off from -the Apache children. In particular, this will control -resources used by CGI scripts and SSI exec commands.

    - -

    The ThreadStackSize directive is used only -on Netware to control the stock size.

    - - - - diff --git a/docs/manual/server-wide.html.en b/docs/manual/server-wide.html.en deleted file mode 100644 index 4636e49ab0b45ef8f5c3deda5933da66e05e55ca..0000000000000000000000000000000000000000 --- a/docs/manual/server-wide.html.en +++ /dev/null @@ -1,215 +0,0 @@ - - - -Server-Wide Configuration - - - - - -

    Server-Wide Configuration

    - -

    This document explains some of the directives provided by -core server which are used to configure -the basic operations of the server.

    - - - -
    - -

    Server Identification

    - - -
    -Related Directives

    - -ServerName
    -ServerAdmin
    -ServerSignature
    -ServerTokens
    -UseCanonicalName
    -
    - -

    The ServerAdmin and ServerTokens -directives control what information about the server will be presented -in server-generated documents such as error messages. -The ServerTokens directive sets the value of the -Server HTTP response header field.

    - -

    The ServerName and UseCanonicalName -directives are used by the server to determine how to construct -self-referential URLs. For example, when a client requests a -directory, but does not include the trailing slash in the directory -name, Apache must redirect the client to the full name including the -trailing slash so that the client will correctly resolve relative -references in the document.

    - -
    - -

    File Locations

    - - -
    -Related Directives

    - -CoreDumpDirectory
    -DocumentRoot
    -ErrorLog
    -Lockfile
    -PidFile
    -ScoreBoardFile
    -ServerRoot
    -
    - -

    These directives control the locations of the various files that -Apache needs for proper operation. When the pathname used does not -begin with a slash "/", the files are located relative to the -ServerRoot. Be careful about locating files in paths -which are writable by non-root users. See the security tips documentation for -more details.

    - -
    - -

    Process Creation

    - - -
    -Related Directives

    - -BS2000Account
    -Group
    -MaxClients
    -MaxRequestsPerChild
    -MaxSpareServers
    -MinSpareServers
    -ServerType
    -StartServers
    -ThreadsPerChild
    -User
    -
    - -

    When ServerType is set to its recommended value of -Standalone, Apache 1.3 for Unix is a pre-forking web -server. A single control process is responsible for launching child -processes which listen for connections and serve them when they -arrive. Apache always tries to maintain several spare or -idle server processes, which stand ready to serve incoming requests. -In this way, clients do not need to wait for a new child processes to -be forked before their requests can be served.

    - -

    The StartServers, MinSpareServers, -MaxSpareServers, and MaxServers regulate how -the parent process creates children to serve requests. In general, -Apache is very self-regulating, so most sites do not need to adjust -these directives from their default values. Sites which need to serve -more than 256 simultaneous requests may need to increase -MaxClients, while sites with limited memory may need to -decrease MaxClients to keep the server from thrashing -(swapping memory to disk and back).

    - -

    While the parent process is usually started as root under Unix -in order to bind to port 80, the child processes are launched -by Apache as a less-privileged user. The User and -Group directives are used to set the privileges -of the Apache child processes. The child processes must -be able to read all the content that will be served, but -should have as few privileges beyond that as possible. -In addition, unless suexec is used, -these directives also set the privileges which will be inherited -by CGI scripts.

    - -

    MaxRequestsPerChild controls how frequently the server -recycles processes by killing old ones and launching new ones.

    - -

    Under Windows, Apache launches one control process and one -child process. The child process creates multiple threads to -serve requests. The number of threads is controlled by the -ThreadsPerChild directive.

    - -
    - -

    Network Configuration

    - - -
    -Related Directives

    - -BindAddress
    -KeepAlive
    -KeepAliveTimeout
    -Listen
    -ListenBackLog
    -MaxKeepAliveRequests
    -Port
    -SendBufferSize
    -TimeOut
    -
    - -

    When Apache starts, it connects to some port and address on the -local machine and waits for incoming requests. By default, it listens -to all addresses on the machine, and to the port as specified by the -Port directive in the server configuration. However, it -can be told to listen to more than one port, to listen to only -selected addresses, or a combination. This is often combined with the -Virtual Host feature which determines how Apache -responds to different IP addresses, hostnames and ports.

    - -

    There are two directives used to restrict or specify which addresses -and ports Apache listens to. The BindAddress directive -is used to restrict the server to listening to a single IP address. -The Listen directive can be used to specify multiple -IP addresses and/or Ports to which Apache will listen.

    - -

    The ListenBackLog, SendBufferSize, and -TimeOut directives are used to adjust how Apache -interacts with the network.

    - -

    The KeepAlive, KeepAliveTimeout, -and MaxKeepAliveRequests directives are used to -configure how Apache handles persistent connections.

    - -
    -

    Limiting Resource Usage

    - -
    -Related Directives

    - -LimitRequestBody
    -LimitRequestFields
    -LimitRequestFieldsize
    -LimitRequestLine
    -RLimitCPU
    -RLimitMEM
    -RLimitNPROC
    -ThreadStackSize
    -
    - -

    The Limit* directives are used to place limits -on the amount of resources Apache will use in reading requests -from clients. By limiting these values, some kinds of denial -of service attacks can be mitigated.

    - -

    The RLimit* directives are used to limit the amount -of resources which can be used by processes forked off from -the Apache children. In particular, this will control -resources used by CGI scripts and SSI exec commands.

    - -

    The ThreadStackSize directive is used only -on Netware to control the stock size.

    - - - - diff --git a/docs/manual/server-wide.html.ja.jis b/docs/manual/server-wide.html.ja.jis deleted file mode 100644 index 1ed7d254abc5db54a18590766f7e118c366ec573..0000000000000000000000000000000000000000 --- a/docs/manual/server-wide.html.ja.jis +++ /dev/null @@ -1,113 +0,0 @@ - - - -Server-Wide Configuration - - - - - - -

    $B%5!<%PA4BN$N@_Dj(B

    - -

    $B$3$N%I%-%e%a%s%H$G$O(B$B%3%"(B$B%5!<%P$N(B -$B%G%#%l%/%F%#%V$NCf$G!"4pK\F0:n$r@_Dj$9$k$?$a$N$b$N$r@bL@$7$^$9!#(B

    - - - -
    - -

    $B%5!<%P(B ID

    - - -
    -$B4XO"%G%#%l%/%F%#%V(B

    - -ServerName
    -ServerAdmin
    -ServerSignature
    -ServerTokens
    -UseCanonicalName
    -
    - -

    ServerAdmin $B%G%#%l%/%F%#%V$H(B ServerTokens -$B%G%#%l%/%F%#%V$O!"%(%i!<%a%C%;!<%8$J$I$N%5!<%P$,:n$k%I%-%e%a%s%H$K!"(B -$B$I$N$h$&$J%5!<%P$N>pJs$rI=<($9$k$+$r@)8f$7$^$9!#(BServerTokens -$B%G%#%l%/%F%#%V$O!"(BServer HTTP $B%l%9%]%s%9%X%C%@%U%#!<%k%I$NCM$r(B -$B@_Dj$7$^$9!#(B

    - -

    ServerName $B%G%#%l%/%F%#%V$H(B UseCanonicalName -$B%G%#%l%/%F%#%V$O!"%5!<%P$,<+J,<+?H$r;2>H$9$k(B URL $B$r:n$k$H$-$K(B -$B;H$o$l$^$9!#$?$H$($P!"%/%i%$%"%s%H$,%G%#%l%/%H%j$rMW5a$7$F!"(B -$B$=$N%G%#%l%/%H%jL>$N:G8e$K%9%i%C%7%e$,IU$$$F$$$J$$$h$&$J>l9g$K$O!"(B -$B%I%-%e%a%s%H$NAjBPE*$J;2>H$r@5$7$/2r7h$G$-$k$h$&$K$9$k$?$a$K!"(B -Apache $B$O:G8e$N%9%i%C%7%e$r4^$s$@40A4$J%Q%9$K%/%i%$%"%s%H$r(B -$B%j%@%$%l%/%H$5$;$kI,MW$,$"$j$^$9!#(B

    - -
    - -

    $B%U%!%$%k$N0LCV(B

    - - -
    -$B4XO"%G%#%l%/%F%#%V(B

    - -CoreDumpDirectory
    -DocumentRoot
    -ErrorLog
    -Lockfile
    -PidFile
    -ScoreBoardFile
    -ServerRoot
    -
    - -

    $B$3$l$i$N%G%#%l%/%F%#%V$O(B Apache $B$,E,@Z$JF0:n$r$9$k$?$a$KI,MW$J(B -$B3FServerRoot $B$+$i$NAjBP%Q%9$H$7$F(B -$BC5$5$l$^$9!#(Broot $B0J30$N%f!<%6$,=q$-9~$_2DG=$J%Q%9$K%U%!%$%k$r(B -$BCV$/>l9g$OCm0U$,I,MW$G$9!#>\:Y$O(B$B!V%;%-%e%j%F%#>pJs!W(B$B$r(B -$B;2>H$7$F$/$@$5$$!#(B

    - -
    -

    $B%j%=!<%9$N@)8B(B

    - -
    -$B4XO"%G%#%l%/%F%#%V(B

    - -LimitRequestBody
    -LimitRequestFields
    -LimitRequestFieldsize
    -LimitRequestLine
    -RLimitCPU
    -RLimitMEM
    -RLimitNPROC
    -ThreadStackSize
    -
    - -

    LimitRequest* $B%G%#%l%/%F%#%V$O(B Apache $B$,(B -$B%/%i%$%"%s%H$+$i$N%j%/%(%9%HFI$_9~$_$G;H$&%j%=!<%9$r@)8B$9$k$?$a$K(B -$B;H$o$l$^$9!#$3$l$i$NCM$r@)8B$9$k$3$H$G!"$$$/$D$+$N%5!<%S%95qH]967b$O(B -$B1F6A$rOB$i$2$k$3$H$,$G$-$^$9!#(B

    - -

    RLimit* $B%G%#%l%/%F%#%V$O!"(BApache $B$N;R%W%m%;%9$+$i(B -fork $B$5$l$?%W%m%;%9$,;HMQ$9$k%j%=!<%9$r@)8B$9$k$?$a$K(B -$B;H$o$l$^$9!#FC$K!"$3$l$O(B CGI $B%9%/%j%W%H$H(B SSI exec $B%3%^%s%I$G(B -$B;H$o$l$k%j%=!<%9$r@)8f$7$^$9!#(B

    - -

    ThreadStackSize $B$O(B Netware $B$G$N$_!"%9%?%C%/$NBg$-$5$r(B -$B@)8f$9$k$?$a$K;H$o$l$^$9!#(B

    - - - - diff --git a/docs/manual/sitemap.html b/docs/manual/sitemap.html deleted file mode 100644 index 34e21dad8af228b3d70800a8289d18dcb1b0f938..0000000000000000000000000000000000000000 --- a/docs/manual/sitemap.html +++ /dev/null @@ -1,201 +0,0 @@ - - - - - Site Map - Apache HTTP Server 2.0 - - - - - - -

    Site Map

    - - - - - - \ No newline at end of file diff --git a/docs/manual/sitemap.html.en b/docs/manual/sitemap.html.en deleted file mode 100644 index 34e21dad8af228b3d70800a8289d18dcb1b0f938..0000000000000000000000000000000000000000 --- a/docs/manual/sitemap.html.en +++ /dev/null @@ -1,201 +0,0 @@ - - - - - Site Map - Apache HTTP Server 2.0 - - - - - - -

    Site Map

    - - - - - - \ No newline at end of file diff --git a/docs/manual/ssl/index.html b/docs/manual/ssl/index.html deleted file mode 100644 index fb39a4440b01877ba08e4c36dbd1b290c08da41a..0000000000000000000000000000000000000000 --- a/docs/manual/ssl/index.html +++ /dev/null @@ -1,223 +0,0 @@ - - -mod_ssl: Title Page - - - - - - - -
    - - - - -
    -
    - - - - - - - - - - -
    - - - - - - - -
    - User Manual -
    - mod_ssl version 2.8    -
    -
    -
    - mod_ssl - The Apache Interface to OpenSSL -
    - - - - - - - -
    - Ralf S. Engelschall
    - rse@engelschall.com
    - www.engelschall.com
    -
    -      - -next page
    Overview -
    - -
    -
    -
    -
    - - diff --git a/docs/manual/ssl/index.html.en b/docs/manual/ssl/index.html.en deleted file mode 100644 index fb39a4440b01877ba08e4c36dbd1b290c08da41a..0000000000000000000000000000000000000000 --- a/docs/manual/ssl/index.html.en +++ /dev/null @@ -1,223 +0,0 @@ - - -mod_ssl: Title Page - - - - - - - -
    - - - - -
    -
    - - - - - - - - - - -
    - - - - - - - -
    - User Manual -
    - mod_ssl version 2.8    -
    -
    -
    - mod_ssl - The Apache Interface to OpenSSL -
    - - - - - - - -
    - Ralf S. Engelschall
    - rse@engelschall.com
    - www.engelschall.com
    -
    -      - -next page
    Overview -
    - -
    -
    -
    -
    - - diff --git a/docs/manual/ssl/ssl_compat.html b/docs/manual/ssl/ssl_compat.html deleted file mode 100644 index 391c0668c607a2f06a59f19fb22a70a58b913e6d..0000000000000000000000000000000000000000 --- a/docs/manual/ssl/ssl_compat.html +++ /dev/null @@ -1,551 +0,0 @@ - - -mod_ssl: Compatibility - - - - - - - - - - -
    - - - - -
    -
    - - - - - - - - - - - - - -
    - - - - - -
    - mod_ssl - - Chapter 4 -
    -
    - - - - - -
    -previous page
    Reference -
    -next page
    HowTo -
    -
    -
    - Compatibility -
    -
    - - - - - - - -
    - -All PCs are compatible. But some of -them are more compatible than others. - -
    - -Unknown - -
    -
    -

    - - - - - - -
    -H -ere we talk about backward compatibility to other SSL solutions. As you -perhaps know, mod_ssl is not the only existing SSL solution for Apache. -Actually there are four additional major products available on the market: Ben -Laurie's freely available Apache-SSL -(from where mod_ssl were originally derived in 1998), RedHat's commercial Secure Web -Server (which is based on mod_ssl), Covalent's commercial Raven SSL Module (also based on mod_ssl) -and finally C2Net's commercial product Stronghold (based on a -different evolution branch named Sioux up to Stronghold 2.x and based on -mod_ssl since Stronghold 3.x). - -   - -
    - - - - - - - -
    - -Table Of Contents - -
    - -        Configuration Directives
    -        Environment Variables
    -        Custom Log Functions
    -
    -
    -
    -
    -

    -The idea in mod_ssl is mainly the following: because mod_ssl provides mostly a -superset of the functionality of all other solutions we can easily provide -backward compatibility for most of the cases. Actually there are three -compatibility areas we currently address: configuration directives, -environment variables and custom log functions. -

    Configuration Directives

    -For backward compatibility to the configuration directives of other SSL -solutions we do an on-the-fly mapping: directives which have a direct -counterpart in mod_ssl are mapped silently while other directives lead to a -warning message in the logfiles. The currently implemented directive mapping -is listed in Table 1. Currently full backward -compatibilty is provided only for Apache-SSL 1.x and mod_ssl 2.0.x. -Compatibility to Sioux 1.x and Stronghold 2.x is only partial because of -special functionality in these interfaces which mod_ssl (still) doesn't -provide. -

    -

    - - - -
    Table 1: Configuration Directive Mapping
    - - -
    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    Old Directivemod_ssl DirectiveComment
    Apache-SSL 1.x & mod_ssl 2.0.x compatibility:
    SSLEnableSSLEngine oncompactified
    SSLDisableSSLEngine offcompactified
    SSLLogFile fileSSLLog filecompactified
    SSLRequiredCiphers specSSLCipherSuite specrenamed
    SSLRequireCipher c1 ...SSLRequire %{SSL_CIPHER} in {"c1", ...}generalized
    SSLBanCipher c1 ...SSLRequire not (%{SSL_CIPHER} in {"c1", ...})generalized
    SSLFakeBasicAuthSSLOptions +FakeBasicAuthmerged
    SSLCacheServerPath dir-functionality removed
    SSLCacheServerPort integer-functionality removed
    Apache-SSL 1.x compatibility:
    SSLExportClientCertificatesSSLOptions +ExportCertDatamerged
    SSLCacheServerRunDir dir-functionality not supported
    Sioux 1.x compatibility:
    SSL_CertFile fileSSLCertificateFile filerenamed
    SSL_KeyFile fileSSLCertificateKeyFile filerenamed
    SSL_CipherSuite argSSLCipherSuite argrenamed
    SSL_X509VerifyDir argSSLCACertificatePath argrenamed
    SSL_Log fileSSLLogFile filerenamed
    SSL_Connect flagSSLEngine flagrenamed
    SSL_ClientAuth argSSLVerifyClient argrenamed
    SSL_X509VerifyDepth argSSLVerifyDepth argrenamed
    SSL_FetchKeyPhraseFrom arg-not directly mappable; use SSLPassPhraseDialog
    SSL_SessionDir dir-not directly mappable; use SSLSessionCache
    SSL_Require expr-not directly mappable; use SSLRequire
    SSL_CertFileType arg-functionality not supported
    SSL_KeyFileType arg-functionality not supported
    SSL_X509VerifyPolicy arg-functionality not supported
    SSL_LogX509Attributes arg-functionality not supported
    Stronghold 2.x compatibility:
    StrongholdAccelerator dir-functionality not supported
    StrongholdKey dir-functionality not supported
    StrongholdLicenseFile dir-functionality not supported
    SSLFlag flagSSLEngine flagrenamed
    SSLSessionLockFile fileSSLMutex filerenamed
    SSLCipherList specSSLCipherSuite specrenamed
    RequireSSLSSLRequireSSLrenamed
    SSLErrorFile file-functionality not supported
    SSLRoot dir-functionality not supported
    SSL_CertificateLogDir dir-functionality not supported
    AuthCertDir dir-functionality not supported
    SSL_Group name-functionality not supported
    SSLProxyMachineCertPath dir-functionality not supported
    SSLProxyMachineCertFile file-functionality not supported
    SSLProxyCACertificatePath dir-functionality not supported
    SSLProxyCACertificateFile file-functionality not supported
    SSLProxyVerifyDepth number-functionality not supported
    SSLProxyCipherList spec-functionality not supported
    -
    -
    -
    -

    -
    -

    Environment Variables

    -When you use ``SSLOptions +CompatEnvVars'' additional environment -variables are generated. They all correspond to existing official mod_ssl -variables. The currently implemented variable derivation is listed in Table 2. -

    -

    - - - -
    Table 2: Environment Variable Derivation
    - - -
    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    Old Variablemod_ssl VariableComment
    SSL_PROTOCOL_VERSIONSSL_PROTOCOLrenamed
    SSLEAY_VERSIONSSL_VERSION_LIBRARYrenamed
    HTTPS_SECRETKEYSIZESSL_CIPHER_USEKEYSIZErenamed
    HTTPS_KEYSIZESSL_CIPHER_ALGKEYSIZErenamed
    HTTPS_CIPHERSSL_CIPHERrenamed
    HTTPS_EXPORTSSL_CIPHER_EXPORTrenamed
    SSL_SERVER_KEY_SIZESSL_CIPHER_ALGKEYSIZErenamed
    SSL_SERVER_CERTIFICATESSL_SERVER_CERTrenamed
    SSL_SERVER_CERT_STARTSSL_SERVER_V_STARTrenamed
    SSL_SERVER_CERT_ENDSSL_SERVER_V_ENDrenamed
    SSL_SERVER_CERT_SERIALSSL_SERVER_M_SERIALrenamed
    SSL_SERVER_SIGNATURE_ALGORITHMSSL_SERVER_A_SIGrenamed
    SSL_SERVER_DNSSL_SERVER_S_DNrenamed
    SSL_SERVER_CNSSL_SERVER_S_DN_CNrenamed
    SSL_SERVER_EMAILSSL_SERVER_S_DN_Emailrenamed
    SSL_SERVER_OSSL_SERVER_S_DN_Orenamed
    SSL_SERVER_OUSSL_SERVER_S_DN_OUrenamed
    SSL_SERVER_CSSL_SERVER_S_DN_Crenamed
    SSL_SERVER_SPSSL_SERVER_S_DN_SPrenamed
    SSL_SERVER_LSSL_SERVER_S_DN_Lrenamed
    SSL_SERVER_IDNSSL_SERVER_I_DNrenamed
    SSL_SERVER_ICNSSL_SERVER_I_DN_CNrenamed
    SSL_SERVER_IEMAILSSL_SERVER_I_DN_Emailrenamed
    SSL_SERVER_IOSSL_SERVER_I_DN_Orenamed
    SSL_SERVER_IOUSSL_SERVER_I_DN_OUrenamed
    SSL_SERVER_ICSSL_SERVER_I_DN_Crenamed
    SSL_SERVER_ISPSSL_SERVER_I_DN_SPrenamed
    SSL_SERVER_ILSSL_SERVER_I_DN_Lrenamed
    SSL_CLIENT_CERTIFICATESSL_CLIENT_CERTrenamed
    SSL_CLIENT_CERT_STARTSSL_CLIENT_V_STARTrenamed
    SSL_CLIENT_CERT_ENDSSL_CLIENT_V_ENDrenamed
    SSL_CLIENT_CERT_SERIALSSL_CLIENT_M_SERIALrenamed
    SSL_CLIENT_SIGNATURE_ALGORITHMSSL_CLIENT_A_SIGrenamed
    SSL_CLIENT_DNSSL_CLIENT_S_DNrenamed
    SSL_CLIENT_CNSSL_CLIENT_S_DN_CNrenamed
    SSL_CLIENT_EMAILSSL_CLIENT_S_DN_Emailrenamed
    SSL_CLIENT_OSSL_CLIENT_S_DN_Orenamed
    SSL_CLIENT_OUSSL_CLIENT_S_DN_OUrenamed
    SSL_CLIENT_CSSL_CLIENT_S_DN_Crenamed
    SSL_CLIENT_SPSSL_CLIENT_S_DN_SPrenamed
    SSL_CLIENT_LSSL_CLIENT_S_DN_Lrenamed
    SSL_CLIENT_IDNSSL_CLIENT_I_DNrenamed
    SSL_CLIENT_ICNSSL_CLIENT_I_DN_CNrenamed
    SSL_CLIENT_IEMAILSSL_CLIENT_I_DN_Emailrenamed
    SSL_CLIENT_IOSSL_CLIENT_I_DN_Orenamed
    SSL_CLIENT_IOUSSL_CLIENT_I_DN_OUrenamed
    SSL_CLIENT_ICSSL_CLIENT_I_DN_Crenamed
    SSL_CLIENT_ISPSSL_CLIENT_I_DN_SPrenamed
    SSL_CLIENT_ILSSL_CLIENT_I_DN_Lrenamed
    SSL_EXPORTSSL_CIPHER_EXPORTrenamed
    SSL_KEYSIZESSL_CIPHER_ALGKEYSIZErenamed
    SSL_SECKEYSIZESSL_CIPHER_USEKEYSIZErenamed
    SSL_SSLEAY_VERSIONSSL_VERSION_LIBRARYrenamed
    SSL_STRONG_CRYPTO-Not supported by mod_ssl
    SSL_SERVER_KEY_EXP-Not supported by mod_ssl
    SSL_SERVER_KEY_ALGORITHM-Not supported by mod_ssl
    SSL_SERVER_KEY_SIZE-Not supported by mod_ssl
    SSL_SERVER_SESSIONDIR-Not supported by mod_ssl
    SSL_SERVER_CERTIFICATELOGDIR-Not supported by mod_ssl
    SSL_SERVER_CERTFILE-Not supported by mod_ssl
    SSL_SERVER_KEYFILE-Not supported by mod_ssl
    SSL_SERVER_KEYFILETYPE-Not supported by mod_ssl
    SSL_CLIENT_KEY_EXP-Not supported by mod_ssl
    SSL_CLIENT_KEY_ALGORITHM-Not supported by mod_ssl
    SSL_CLIENT_KEY_SIZE-Not supported by mod_ssl
    -
    -
    -
    -

    -
    -

    Custom Log Functions

    -When mod_ssl is built into Apache or at least loaded (under DSO situation) -additional functions exist for the Custom Log Format of mod_log_config as documented in the Reference -Chapter. Beside the ``%{varname}x'' -eXtension format function which can be used to expand any variables provided -by any module, an additional Cryptography -``%{name}c'' cryptography format function -exists for backward compatibility. The currently implemented function calls -are listed in Table 3. -

    -

    - - - -
    Table 3: Custom Log Cryptography Function
    - - -
    - - - - - - - - - - - -
    Function CallDescription
    %...{version}c SSL protocol version
    %...{cipher}c SSL cipher
    %...{subjectdn}c Client Certificate Subject Distinguished Name
    %...{issuerdn}c Client Certificate Issuer Distinguished Name
    %...{errcode}c Certificate Verification Error (numerical)
    %...{errstr}c Certificate Verification Error (string)
    -
    -
    -
    -

    -
    - - - - - - - - - - -
    - - - - - -
    -previous page
    Reference -
    -next page
    HowTo -
    -
    - - - - -
    - mod_ssl 2.8, User Manual
    - The Apache Interface to OpenSSL -
    -
    - Copyright © 1998-2001 - Ralf S. Engelschall
    - All Rights Reserved
    -
    -
    -
    -

    -
    - - diff --git a/docs/manual/ssl/ssl_faq.html b/docs/manual/ssl/ssl_faq.html deleted file mode 100644 index e3d3aa8f26d3ae232b1c02d66cc38e7d6167d1b9..0000000000000000000000000000000000000000 --- a/docs/manual/ssl/ssl_faq.html +++ /dev/null @@ -1,1643 +0,0 @@ - - -mod_ssl: F.A.Q. - - - - - - - - - - -
    - - - - -
    -
    - - - - - - - - - - - - - -
    - - - - - -
    - mod_ssl - - Chapter 6 -
    -
    - - - - - -
    -previous page
    HowTo -
    -next page
    Glossary -
    -
    -
    - F.A.Q. -
    -
    - - - - - - - -
    - -``The wise man doesn't give the right answers, -he poses the right questions.'' - -
    - -Claude Levi-Strauss - -
    -
    -

    - - - - - - -
    -T -his chapter is a collection of frequently asked questions (FAQ) and -corresponding answers following the popular USENET tradition. Most of these -questions occured on the Newsgroup -comp.infosystems.www.servers.unix or the mod_ssl Support -Mailing List -modssl-users@modssl.org. They are collected at this place -to avoid answering the same questions over and over. -

    -Please read this chapter at least once when installing mod_ssl or at least -search for your problem here before submitting a problem report to the -author. -

    -   - -
    - - - - - - - -
    - -Table Of Contents - -
    - -        About the module
    -                What is the history of mod_ssl?
    -                Apache-SSL vs. mod_ssl: differences?
    -                mod_ssl vs. commercial alternatives?
    -                mod_ssl/Apache versions?
    -                mod_ssl and Year 2000?
    -                mod_ssl and Wassenaar Arrangement?
    -        About Installation
    -                Core dumps for HTTPS requests?
    -                Core dumps for Apache+mod_ssl+PHP3?
    -                Undefined symbols on startup?
    -                Permission problem on SSLMutex
    -                Shared memory and process size?
    -                Shared memory and pathname?
    -                PRNG and not enough entropy?
    -        About Configuration
    -                HTTP and HTTPS with a single server?
    -                Where is the HTTPS port?
    -                How to test HTTPS manually?
    -                Why does my connection hang?
    -                Why do I get connection refused?
    -                Why are the SSL_XXX variables missing?
    -                How to switch with relative hyperlinks?
    -        About Certificates
    -                What are Keys, CSRs and Certs?
    -                Difference on startup?
    -                How to create a dummy cert?
    -                How to create a real cert?
    -                How to create my own CA?
    -                How to change a pass phrase?
    -                How to remove a pass phrase?
    -                How to verify a key/cert pair?
    -                Bad Certificate Error?
    -                Why does a 2048-bit key not work?
    -                Why is client auth broken?
    -                How to convert from PEM to DER?
    -                Verisign and the magic getca program?
    -                Global IDs or SGC?
    -                Global IDs and Cert Chain?
    -        About SSL Protocol
    -                Random SSL errors under heavy load?
    -                Why has the server a higher load?
    -                Why are connections horribly slow?
    -                Which ciphers are supported?
    -                How to use Anonymous-DH ciphers
    -                Why do I get 'no shared ciphers'?
    -                HTTPS and name-based vhosts
    -                The lock icon in Netscape locks very late
    -                Why do I get I/O errors with MSIE clients?
    -                Why do I get I/O errors with NS clients?
    -        About Support
    -                Resources in case of problems?
    -                Support in case of problems?
    -                How to write a problem report?
    -                I got a core dump, can you help me?
    -                How to get a backtrace?
    -
    -
    -
    -
    -

    About the module

    -
      -

      -

    • - - -What is the history of mod_ssl? -   - [L] -

      - The mod_ssl v1 package was initially created in April 1998 by Ralf S. Engelschall via porting Ben Laurie's Apache-SSL 1.17 source patches for - Apache 1.2.6 to Apache 1.3b6. Because of conflicts with Ben - Laurie's development cycle it then was re-assembled from scratch for - Apache 1.3.0 by merging the old mod_ssl 1.x with the newer Apache-SSL - 1.18. From this point on mod_ssl lived its own life as mod_ssl v2. The - first publically released version was mod_ssl 2.0.0 from August 10th, - 1998. As of this writing (August 1999) the current mod_ssl version is 2.4.0. -

      - After one year of very active development with over 1000 working hours and - over 40 releases mod_ssl reached its current state. The result is an - already very clean source base implementing a very rich functionality. - The code size increased by a factor of 4 to currently a total of over - 10.000 lines of ANSI C consisting of approx. 70% code and 30% code - documentation. From the original Apache-SSL code currently approx. 5% is - remaining only. -

      -

    • - - -What are the functional differences between mod_ssl and Apache-SSL, from where -it is originally derived? -   - [L] -

      - This neither can be answered in short (there were too many code changes) - nor can be answered at all by the author (there would immediately be flame - wars with no reasonable results at the end). But as you easily can guess - from the 5% of remaining Apache-SSL code, a lot of differences exists, - although user-visible backward compatibility exists for most things. -

      - When you really want a detailed comparison you have to read the entries in - the large CHANGES file that is in the mod_ssl - distribution. Usually this is much too hard-core. So I recommend you to - either believe in the opinion and recommendations of other users (the - simplest approach) or do a comparison yourself (the most reasonable - approach). For the latter, grab distributions of mod_ssl (from http://www.modssl.org) and Apache-SSL - (from http://www.apache-ssl.org), - install both packages, read their documentation and try them out yourself. - Then choose the one which pleases you most. -

      - A few final hints to help direct your comparison: quality of documentation - ("can you easily find answers and are they sufficient?"), quality of - source code ("is the source code reviewable so you can make sure there - aren't any trapdoors or inherent security risks because of bad programming - style?"), easy and clean installation ("can the SSL functionality easily - added to an Apache source tree without manual editing or patching?"), - clean integration into Apache ("is the SSL functionality encapsulated and - cleanly separated from the remaining Apache functionality?"), support for - Dynamic Shared Object (DSO) facility ("can the SSL functionality built as - a separate DSO for maximum flexibility?"), Win32 port ("is the SSL - functionality available also under the Win32 platform?"), amount and - quality of functionality ("is the provided SSL functionality and control - possibilities sufficient for your situation?"), quality of problem tracing - ("is it possible for you to easily trace down the problems via logfiles, - etc?"), etc. pp. -

      -

    • - - -What are the major differences between mod_ssl and -the commercial alternatives like Raven or Stronghold? -   - [L] -

      - In the past (until September 20th, 2000) the major difference was - the RSA license which one received (very cheaply in contrast to - a direct licensing from RSA DSI) with the commercial Apache SSL - products. On the other hand, one needed this license only in the US, - of course. So for non-US citizens this point was useless. But now - even for US citizens the situations changed because the RSA patent - expired on September 20th, 2000 and RSA DSI also placed the RSA - algorithm explicitly into the public domain. -

      - Second, there is the point that one has guaranteed support from - the commercial vendors. On the other hand, if you monitored the - Open Source quality of mod_ssl and the support activities - found on - modssl-users@modssl.org, you could ask yourself - whether you are really convinced that you can get better support - from a commercial vendor. -

      - Third, people often think they would receive perhaps at least a - better technical SSL solution than mod_ssl from the commercial - vendors. But this is not really true, because all commercial - alternatives (Raven 1.4.x, Stronghold 3.x, RedHat SWS 2.x, etc.) - are actually based on mod_ssl and OpenSSL. The reason for - this common misunderstanding is mainly because some vendors make no - attempt to make it reasonably clear that their product is actually - mod_ssl based. So, do not think, just because the commercial - alternatives are usually more expensive, that you are also receiving - an alternative technical SSL solution. This is usually not - the case. Actually the vendor versions of Apache, mod_ssl and OpenSSL - often stay behind the latest free versions and perhaps this way still do not - include important bug and security fixes. On the other hand, - it sometimes occurs that a vendor version includes useful changes - which are not available through the official freely available - packages. But most vendors play fair and contribute back those - changes to the free software world, of course. -

      - So, in short: There are lots of commercial versions of the popular - Apache+mod_ssl+OpenSSL server combination available. Every user - should decide carefully whether they really need to buy a commercial - version or whether it would not be sufficient to directly use the - free and official versions of the Apache, mod_ssl and OpenSSL - packages. -

      -

    • - - -How do I know which mod_ssl version is for which Apache version? -   - [L] -

      - That's trivial: mod_ssl uses version strings of the syntax - <mod_ssl-version>-<apache-version>, for - instance 2.4.0-1.3.9. This directly indicates that it's - mod_ssl version 2.4.0 for Apache version 1.3.9. And this also means you - only can apply this mod_ssl version to exactly this Apache - version (unless you use the --force option to mod_ssl's - configure command ;-). -

      -

    • - - -Is mod_ssl Year 2000 compliant? -   - [L] -

      - Yes, mod_ssl is Year 2000 compliant. -

      - Because first mod_ssl internally never stores years as two digits. - Instead it always uses the ANSI C & POSIX numerical data type - time_t type, which on almost all Unix platforms at the moment - is a signed long (usually 32-bits) representing seconds since - epoch of January 1st, 1970, 00:00 UTC. This signed value overflows in - early January 2038 and not in the year 2000. Second, date and time - presentations (for instance the variable ``%{TIME_YEAR}'') - are done with full year value instead of abbreviating to two digits. -

      - Additionally according to a Year 2000 - statement from the Apache Group, the Apache webserver is Year 2000 - compliant, too. But whether OpenSSL or the underlaying Operating System - (either a Unix or Win32 platform) is Year 2000 compliant is a different - question which cannot be answered here. -

      -

    • - - -What about mod_ssl and the Wassenaar Arrangement? -   - [L] -

      - First, let us explain what Wassenaar and it's Arrangement on - Export Controls for Conventional Arms and Dual-Use Goods and - Technologies is: This is a international regime, established 1995, to - control trade in conventional arms and dual-use goods and technology. It - replaced the previous CoCom regime. 33 countries are signatories: - Argentina, Australia, Austria, Belgium, Bulgaria, Canada, Czech Republic, - Denmark, Finland, France, Germany, Greece, Hungary, Ireland, Italy, Japan, - Luxembourg, Netherlands, New Zealand, Norway, Poland, Portugal, Republic - of Korea, Romania, Russian Federation, Slovak Republic, Spain, Sweden, - Switzerland, Turkey, Ukraine, United Kingdom and United States. For more - details look at http://www.wassenaar.org/. -

      - In short: The aim of the Wassenaar Arrangement is to prevent the build up - of military capabilities that threaten regional and international security - and stability. The Wassenaar Arrangement controls the export of - cryptography as a dual-use good, i.e., one that has both military and - civilian applications. However, the Wassenaar Arrangement also provides an - exemption from export controls for mass-market software and free software. -

      - In the current Wassenaar ``List of Dual Use Goods and Technologies And - Munitions'', under ``GENERAL SOFTWARE NOTE'' (GSN) it says - ``The Lists do not control "software" which is either: 1. [...] 2. "in - the public domain".'' And under ``DEFINITIONS OF TERMS USED IN - THESE LISTS'' one can find the definition: ``"In the public - domain": This means "technology" or "software" which has been made - available without restrictions upon its further dissemination. N.B. - Copyright restrictions do not remove "technology" or "software" from being - "in the public domain".'' -

      - So, both mod_ssl and OpenSSL are ``in the public domain'' for the purposes - of the Wassenaar Agreement and its ``List of Dual Use Goods and - Technologies And Munitions List''. -

      - Additionally the Wassenaar Agreement itself has no direct consequence for - exporting cryptography software. What is actually allowed or forbidden to - be exported from the countries has still to be defined in the local laws - of each country. And at least according to official press releases from - the German BMWi (see here) and the - Switzerland Bawi (see here) there - will be no forthcoming export restriction for free cryptography software - for their countries. Remember that mod_ssl is created in Germany and - distributed from Switzerland. -

      - So, mod_ssl and OpenSSL are not affected by the Wassenaar Agreement. -

    -

    -
    -

    About Installation

    -
      -

      -

    • - - -When I access my website the first time via HTTPS I get a core dump? -   - [L] -

      - There can be a lot of reasons why a core dump can occur, of course. - Ranging from buggy third-party modules, over buggy vendor libraries up to - a buggy mod_ssl version. But the above situation is often caused by old or - broken vendor DBM libraries. To solve it either build mod_ssl with the - built-in SDBM library (specify --enable-rule=SSL_SDBM at the - APACI command line) or switch from ``SSLSessionCache dbm:'' to the - newer ``SSLSessionCache shm:'' variant (after you have rebuilt - Apache with MM, of course). -

      -

    • - - -My Apache dumps core when I add both mod_ssl and PHP3? -   - [L] -

      - Make sure you add mod_ssl to the Apache source tree first and then do a - fresh configuration and installation of PHP3. For SSL support EAPI patches - are required which have to change internal Apache structures. PHP3 needs - to know about these in order to work correctly. Always make sure that - -DEAPI is contained in the compiler flags when PHP3 is build. -

      -

    • - - -When I startup Apache I get errors about undefined symbols like ap_global_ctx? -   - [L] -

      - This actually means you installed mod_ssl as a DSO, but without rebuilding - Apache with EAPI. Because EAPI is a requirement for mod_ssl, you need an - extra patched Apache (containing the EAPI patches) and you have to build - this Apache with EAPI enabled (explicitly specify - --enable-rule=EAPI at the APACI command line). -

      -

    • - - -When I startup Apache I get permission errors related to SSLMutex? -   - [L] -

      - When you receive entries like ``mod_ssl: Child could not open - SSLMutex lockfile /opt/apache/logs/ssl_mutex.18332 (System error follows) - [...] System: Permission denied (errno: 13)'' this is usually - caused by to restrictive permissions on the parent directories. - Make sure that all parent directories (here /opt, - /opt/apache and /opt/apache/logs) have the x-bit - set at least for the UID under which Apache's children are running (see - the User directive of Apache). -

      -

    • - - -When I use the MM library and the shared memory cache each process grows -1.5MB according to `top' although I specified 512000 as the cache size? -   - [L] -

      - The additional 1MB are caused by the global shared memory pool EAPI - allocates for all modules and which is not used by mod_ssl for - various reasons. So the actually allocated shared memory is always - 1MB more than what you specify on SSLSessionCache. - But don't be confused by the display of `top': although is - indicates that each process grow, this is not reality, of - course. Instead the additional memory consumption is shared by - all processes, i.e. the 1.5MB are allocated only once per Apache - instance and not once per Apache server process. -

      -

    • - - -Apache creates files in a directory declared by the internal -EAPI_MM_CORE_PATH define. Is there a way to override the path using a -configuration directive? -   - [L] -

      - No, there is not configuration directive, because for technical - bootstrapping reasons, a directive not possible at all. Instead - use ``CFLAGS='-DEAPI_MM_CORE_PATH="/path/to/wherever/"' - ./configure ...'' when building Apache or use option - -d when starting httpd. -

      -

    • - - -When I fire up the server, mod_ssl stops with the error -"Failed to generate temporary 512 bit RSA private key", why? -And a "PRNG not seeded" error occurs if I try "make certificate". -   - [L] -

      - Cryptographic software needs a source of unpredictable data - to work correctly. Many open source operating systems provide - a "randomness device" that serves this purpose (usually named - /dev/random). On other systems, applications have to - seed the OpenSSL Pseudo Random Number Generator (PRNG) manually with - appropriate data before generating keys or performing public key - encryption. As of version 0.9.5, the OpenSSL functions that need - randomness report an error if the PRNG has not been seeded with - at least 128 bits of randomness. So mod_ssl has to provide enough - entropy to the PRNG to work correctly. For this one has to use the - SSLRandomSeed directives (to solve the run-time problem) - and create a $HOME/.rnd file to make sure enough - entropy is available also for the "make certificate" - step (in case the "make certificate" procedure is not - able to gather enough entropy theirself by searching for system - files). -

    -

    -
    -

    About Configuration

    -
      -

      -

    • - - -Is it possible to provide HTTP and HTTPS with a single server? -   - [L] -

      - Yes, HTTP and HTTPS use different server ports, so there is no direct - conflict between them. Either run two separate server instances (one binds - to port 80, the other to port 443) or even use Apache's elegant virtual - hosting facility where you can easily create two virtual servers which - Apache dispatches: one responding to port 80 and speaking HTTP and one - responding to port 443 speaking HTTPS. -

      -

    • - - -I know that HTTP is on port 80, but where is HTTPS? -   - [L] -

      - You can run HTTPS on any port, but the standards specify port 443, which - is where any HTTPS compliant browser will look by default. You can force - your browser to look on a different port by specifying it in the URL like - this (for port 666): https://secure.server.dom:666/ -

      -

    • - - -How can I speak HTTPS manually for testing purposes? -   - [L] -

      - While you usually just use -

      - $ telnet localhost 80
      - GET / HTTP/1.0 -

      - for simple testing the HTTP protocol of Apache, it's not such easy for - HTTPS because of the SSL protocol between TCP and HTTP. But with the - help of OpenSSL's s_client command you can do a similar - check even for HTTPS: -

      - $ openssl s_client -connect localhost:443 -state -debug
      - GET / HTTP/1.0 -

      - Before the actual HTTP response you receive detailed information about the - SSL handshake. For a more general command line client which directly - understands both the HTTP and HTTPS scheme, can perform GET and POST - methods, can use a proxy, supports byte ranges, etc. you should have a - look at nifty cURL - tool. With it you can directly check if your Apache is running fine on - Port 80 and 443 as following: -

      - $ curl http://localhost/
      - $ curl https://localhost/
      -

      -

    • - - -Why does the connection hang when I connect to my SSL-aware Apache server? -   - [L] -

      - Because you connected with HTTP to the HTTPS port, i.e. you used an URL of - the form ``http://'' instead of ``https://''. - This also happens the other way round when you connect via HTTPS to a HTTP - port, i.e. when you try to use ``https://'' on a server that - doesn't support SSL (on this port). Make sure you are connecting to a - virtual server that supports SSL, which is probably the IP associated with - your hostname, not localhost (127.0.0.1). -

      -

    • - - -Why do I get ``Connection Refused'' messages when trying to access my freshly -installed Apache+mod_ssl server via HTTPS? -   - [L] -

      - There can be various reasons. Some of the common mistakes is that people - start Apache with just ``apachectl start'' (or - ``httpd'') instead of ``apachectl startssl'' (or - ``httpd -DSSL''. Or you're configuration is not correct. At - least make sure that your ``Listen'' directives match your - ``<VirtualHost>'' directives. And if all fails, please do - yourself a favor and start over with the default configuration mod_ssl - provides you. -

      -

    • - - -In my CGI programs and SSI scripts the various documented -SSL_XXX variables do not exists. Why? -   - [L] -

      - Just make sure you have ``SSLOptions +StdEnvVars'' - enabled for the context of your CGI/SSI requests. -

      -

    • - - -How can I use relative hyperlinks to switch between HTTP and HTTPS? -   - [L] -

      - Usually you have to use fully-qualified hyperlinks because - you have to change the URL scheme. But with the help of some URL - manipulations through mod_rewrite you can achieve the same effect while - you still can use relative URLs: -

      -    RewriteEngine on
      -    RewriteRule   ^/(.*):SSL$   https://%{SERVER_NAME}/$1 [R,L]
      -    RewriteRule   ^/(.*):NOSSL$ http://%{SERVER_NAME}/$1  [R,L]
      -    
      - This rewrite ruleset lets you use hyperlinks of the form -
      -    <a href="document.html:SSL">
      -    
      -
    -

    -
    -

    About Certificates

    -
      -

      -

    • - - -What are RSA Private Keys, CSRs and Certificates? -   - [L] -

      - The RSA private key file is a digital file that you can use to decrypt - messages sent to you. It has a public component which you distribute (via - your Certificate file) which allows people to encrypt those messages to - you. A Certificate Signing Request (CSR) is a digital file which contains - your public key and your name. You send the CSR to a Certifying Authority - (CA) to be converted into a real Certificate. A Certificate contains your - RSA public key, your name, the name of the CA, and is digitally signed by - your CA. Browsers that know the CA can verify the signature on that - Certificate, thereby obtaining your RSA public key. That enables them to - send messages which only you can decrypt. - See the Introduction chapter for a general - description of the SSL protocol. -

      -

    • - - -Seems like there is a difference on startup between the original Apache and an SSL-aware Apache? -   - [L] -

      - Yes, in general, starting Apache with a built-in mod_ssl is just like - starting an unencumbered Apache, except for the fact that when you have a - pass phrase on your SSL private key file. Then a startup dialog pops up - asking you to enter the pass phrase. -

      - To type in the pass phrase manually when starting the server can be - problematic, for instance when starting the server from the system boot - scripts. As an alternative to this situation you can follow the steps - below under ``How can I get rid of the pass-phrase dialog at Apache - startup time?''. -

      -

    • - - -How can I create a dummy SSL server Certificate for testing purposes? -   - [L] -

      - A Certificate does not have to be signed by a public CA. You can use your - private key to sign the Certificate which contains your public key. You - can install this Certificate into your server, and people using Netscape - Navigator (not MSIE) will be able to connect after clicking OK to a - warning dialogue. You can get MSIE to work, and your customers can - eliminate the dialogue, by installing that Certificate manually into their - browsers. -

      - Just use the ``make certificate'' command at the top-level - directory of the Apache source tree right before installing Apache via - ``make install''. This creates a self-signed SSL Certificate - which expires after 30 days and isn't encrypted (which means you don't - need to enter a pass-phrase at Apache startup time). -

      - BUT REMEMBER: YOU REALLY HAVE TO CREATE A REAL CERTIFICATE FOR THE LONG - RUN! HOW THIS IS DONE IS DESCRIBED IN THE NEXT ANSWER. -

      -

    • - - -Ok, I've got my server installed and want to create a real SSL -server Certificate for it. How do I do it? -   - [L] -

      - Here is a step-by-step description: -

      -

        -
      1. Make sure OpenSSL is really installed and in your PATH. - But some commands even work ok when you just run the - ``openssl'' program from within the OpenSSL source tree as - ``./apps/openssl''. -

        -

      2. Create a RSA private key for your Apache server - (will be Triple-DES encrypted and PEM formatted): -

        - $ openssl genrsa -des3 -out server.key 1024 -

        - Please backup this server.key file and remember the - pass-phrase you had to enter at a secure location. - You can see the details of this RSA private key via the command: -

        - $ openssl rsa -noout -text -in server.key -

        - And you could create a decrypted PEM version (not recommended) - of this RSA private key via: -

        - $ openssl rsa -in server.key -out server.key.unsecure -

        -

      3. Create a Certificate Signing Request (CSR) with the server RSA private - key (output will be PEM formatted): -

        - $ openssl req -new -key server.key -out server.csr -

        - Make sure you enter the FQDN ("Fully Qualified Domain Name") of the - server when OpenSSL prompts you for the "CommonName", i.e. when you - generate a CSR for a website which will be later accessed via - https://www.foo.dom/, enter "www.foo.dom" here. - You can see the details of this CSR via the command -

        - $ openssl req -noout -text -in server.csr -

        -

      4. You now have to send this Certificate Signing Request (CSR) to - a Certifying Authority (CA) for signing. The result is then a real - Certificate which can be used for Apache. Here you have two options: - First you can let the CSR sign by a commercial CA like Verisign or - Thawte. Then you usually have to post the CSR into a web form, pay for - the signing and await the signed Certificate you then can store into a - server.crt file. For more information about commercial CAs have a look - at the following locations: -

        -

        -

        - Second you can use your own CA and now have to sign the CSR yourself by - this CA. Read the next answer in this FAQ on how to sign a CSR with - your CA yourself. - You can see the details of the received Certificate via the command: -

        - $ openssl x509 -noout -text -in server.crt -

        -

      5. Now you have two files: server.key and - server.crt. These now can be used as following inside your - Apache's httpd.conf file: -
        -       SSLCertificateFile    /path/to/this/server.crt
        -       SSLCertificateKeyFile /path/to/this/server.key
        -       
        - The server.csr file is no longer needed. -
      -

      -

    • - - -How can I create and use my own Certificate Authority (CA)? -   - [L] -

      - The short answer is to use the CA.sh or CA.pl - script provided by OpenSSL. The long and manual answer is this: -

      -

        -
      1. Create a RSA private key for your CA - (will be Triple-DES encrypted and PEM formatted): -

        - $ openssl genrsa -des3 -out ca.key 1024 -

        - Please backup this ca.key file and remember the - pass-phrase you currently entered at a secure location. - You can see the details of this RSA private key via the command -

        - $ openssl rsa -noout -text -in ca.key -

        - And you can create a decrypted PEM version (not recommended) of this - private key via: -

        - $ openssl rsa -in ca.key -out ca.key.unsecure -

        -

      2. Create a self-signed CA Certificate (X509 structure) - with the RSA key of the CA (output will be PEM formatted): -

        - $ openssl req -new -x509 -days 365 -key ca.key -out ca.crt -

        - You can see the details of this Certificate via the command: -

        - $ openssl x509 -noout -text -in ca.crt -

        -

      3. Prepare a script for signing which is needed because - the ``openssl ca'' command has some strange requirements - and the default OpenSSL config doesn't allow one easily to use - ``openssl ca'' directly. So a script named - sign.sh is distributed with the mod_ssl distribution - (subdir pkg.contrib/). Use this script for signing. -

        -

      4. Now you can use this CA to sign server CSR's in order to create real - SSL Certificates for use inside an Apache webserver (assuming - you already have a server.csr at hand): -

        - $ ./sign.sh server.csr -

        - This signs the server CSR and results in a server.crt file. -

      -

      -

    • - - -How can I change the pass-phrase on my private key file? -   - [L] -

      - You simply have to read it with the old pass-phrase and write it again - by specifying the new pass-phrase. You can accomplish this with the following - commands: -

      - $ openssl rsa -des3 -in server.key -out server.key.new
      - $ mv server.key.new server.key
      -

      - Here you're asked two times for a PEM pass-phrase. At the first - prompt enter the old pass-phrase and at the second prompt - enter the new pass-phrase. -

      -

    • - - -How can I get rid of the pass-phrase dialog at Apache startup time? -   - [L] -

      - The reason why this dialog pops up at startup and every re-start - is that the RSA private key inside your server.key file is stored in - encrypted format for security reasons. The pass-phrase is needed to be - able to read and parse this file. When you can be sure that your server is - secure enough you perform two steps: -

      -

        -
      1. Remove the encryption from the RSA private key (while - preserving the original file): -

        - $ cp server.key server.key.org
        - $ openssl rsa -in server.key.org -out server.key -

        -

      2. Make sure the server.key file is now only readable by root: -

        - $ chmod 400 server.key -

      -

      - Now server.key will contain an unencrypted copy of the key. - If you point your server at this file it will not prompt you for a - pass-phrase. HOWEVER, if anyone gets this key they will be able to - impersonate you on the net. PLEASE make sure that the permissions on that - file are really such that only root or the web server user can read it - (preferably get your web server to start as root but run as another - server, and have the key readable only by root). -

      - As an alternative approach you can use the ``SSLPassPhraseDialog - exec:/path/to/program'' facility. But keep in mind that this is - neither more nor less secure, of course. -

      -

    • - - -How do I verify that a private key matches its Certificate? -   - [L] -

      - The private key contains a series of numbers. Two of those numbers form - the "public key", the others are part of your "private key". The "public - key" bits are also embedded in your Certificate (we get them from your - CSR). To check that the public key in your cert matches the public - portion of your private key, you need to view the cert and the key and - compare the numbers. To view the Certificate and the key run the - commands: -

      - $ openssl x509 -noout -text -in server.crt
      - $ openssl rsa -noout -text -in server.key -

      - The `modulus' and the `public exponent' portions in the key and the - Certificate must match. But since the public exponent is usually 65537 - and it's bothering comparing long modulus you can use the following - approach: -

      - $ openssl x509 -noout -modulus -in server.crt | openssl md5
      - $ openssl rsa -noout -modulus -in server.key | openssl md5 -

      - And then compare these really shorter numbers. With overwhelming - probability they will differ if the keys are different. BTW, if I want to - check to which key or certificate a particular CSR belongs you can compute -

      - $ openssl req -noout -modulus -in server.csr | openssl md5 -

      -

    • - - -What does it mean when my connections fail with an "alert bad certificate" -error? -   - [L] -

      - Usually when you see errors like ``OpenSSL: error:14094412: SSL - routines:SSL3_READ_BYTES:sslv3 alert bad certificate'' in the SSL - logfile, this means that the browser was unable to handle the server - certificate/private-key which perhaps contain a RSA-key not equal to 1024 - bits. For instance Netscape Navigator 3.x is one of those browsers. -

      -

    • - - -Why does my 2048-bit private key not work? -   - [L] -

      - The private key sizes for SSL must be either 512 or 1024 for compatibility - with certain web browsers. A keysize of 1024 bits is recommended because - keys larger than 1024 bits are incompatible with some versions of Netscape - Navigator and Microsoft Internet Explorer, and with other browsers that - use RSA's BSAFE cryptography toolkit. -

      -

    • - - -Why is client authentication broken after upgrading from -SSLeay version 0.8 to 0.9? -   - [L] -

      - The CA certificates under the path you configured with - SSLCACertificatePath are found by SSLeay through hash - symlinks. These hash values are generated by the `openssl x509 -noout - -hash' command. But the algorithm used to calculate the hash for a - certificate has changed between SSLeay 0.8 and 0.9. So you have to remove - all old hash symlinks and re-create new ones after upgrading. Use the - Makefile mod_ssl placed into this directory. -

      -

    • - - -How can I convert a certificate from PEM to DER format? -   - [L] -

      - The default certificate format for SSLeay/OpenSSL is PEM, which actually - is Base64 encoded DER with header and footer lines. For some applications - (e.g. Microsoft Internet Explorer) you need the certificate in plain DER - format. You can convert a PEM file cert.pem into the - corresponding DER file cert.der with the following command: - $ openssl x509 -in cert.pem -out cert.der -outform DER -

      -

    • - - -I try to install a Verisign certificate. Why can't I find neither the -getca nor getverisign programs Verisign mentions? -   - [L] -

      - This is because Verisign has never provided specific instructions - for Apache+mod_ssl. Rather they tell you what you should do - if you were using C2Net's Stronghold (a commercial Apache - based server with SSL support). The only thing you have to do - is to save the certificate into a file and give the name of - that file to the SSLCertificateFile directive. - Remember that you need to give the key file in as well (see - SSLCertificateKeyFile directive). For a better - CA-related overview on SSL certificate fiddling you can look at - Thawte's mod_ssl instructions. -

      -

    • - - -Can I use the Server Gated Cryptography (SGC) facility (aka Verisign Global -ID) also with mod_ssl? -   - [L] -

      - Yes, mod_ssl since version 2.1 supports the SGC facility. You don't have - to configure anything special for this, just use a Global ID as your - server certificate. The step up of the clients are then - automatically handled by mod_ssl under run-time. For details please read - the README.GlobalID document in the mod_ssl distribution. -

      -

    • - - -After I have installed my new Verisign Global ID server certificate, the -browsers complain that they cannot verify the server certificate? -   - [L] -

      - That is because Verisign uses an intermediate CA certificate between - the root CA certificate (which is installed in the browsers) and - the server certificate (which you installed in the server). You - should have received this additional CA certificate from Verisign. - If not, complain to them. Then configure this certificate with the - SSLCertificateChainFile directive in the server. This - makes sure the intermediate CA certificate is send to the browser - and this way fills the gap in the certificate chain. -

    -

    -
    -

    About SSL Protocol

    -
      -

      -

    • - - -Why do I get lots of random SSL protocol errors under heavy server load? -   - [L] -

      - There can be a number of reasons for this, but the main one - is problems with the SSL session Cache specified by the - SSLSessionCache directive. The DBM session cache is most - likely the source of the problem, so trying the SHM session cache or - no cache at all may help. -

      -

    • - - -Why has my webserver a higher load now that I run SSL there? -   - [L] -

      - Because SSL uses strong cryptographic encryption and this needs a lot of - number crunching. And because when you request a webpage via HTTPS even - the images are transfered encrypted. So, when you have a lot of HTTPS - traffic the load increases. -

      -

    • - - -Often HTTPS connections to my server require up to 30 seconds for establishing -the connection, although sometimes it works faster? -   - [L] -

      - Usually this is caused by using a /dev/random device for - SSLRandomSeed which is blocking in read(2) calls if not - enough entropy is available. Read more about this problem in the refernce - chapter under SSLRandomSeed. -

      -

    • - - -What SSL Ciphers are supported by mod_ssl? -   - [L] -

      - Usually just all SSL ciphers which are supported by the - version of OpenSSL in use (can depend on the way you built - OpenSSL). Typically this at least includes the following: -

      -

        -
      • RC4 with MD5 -
      • RC4 with MD5 (export version restricted to 40-bit key) -
      • RC2 with MD5 -
      • RC2 with MD5 (export version restricted to 40-bit key) -
      • IDEA with MD5 -
      • DES with MD5 -
      • Triple-DES with MD5 -
      -

      - To determine the actual list of supported ciphers you can - run the following command: -

      - $ openssl ciphers -v
      -

      -

    • - - -I want to use Anonymous Diffie-Hellman (ADH) ciphers, but I always get ``no -shared cipher'' errors? -   - [L] -

      - In order to use Anonymous Diffie-Hellman (ADH) ciphers, it is not enough - to just put ``ADH'' into your SSLCipherSuite. - Additionally you have to build OpenSSL with - ``-DSSL_ALLOW_ADH''. Because per default OpenSSL does not - allow ADH ciphers for security reasons. So if you are actually enabling - these ciphers make sure you are informed about the side-effects. -

      -

    • - - -I always just get a 'no shared ciphers' error if -I try to connect to my freshly installed server? -   - [L] -

      - Either you have messed up your SSLCipherSuite - directive (compare it with the pre-configured example in - httpd.conf-dist) or you have choosen the DSA/DH - algorithms instead of RSA under "make certificate" - and ignored or overseen the warnings. Because if you have choosen - DSA/DH, then your server no longer speaks RSA-based SSL ciphers - (at least not until you also configure an additional RSA-based - certificate/key pair). But current browsers like NS or IE only speak - RSA ciphers. The result is the "no shared ciphers" error. To fix - this, regenerate your server certificate/key pair and this time - choose the RSA algorithm. -

      -

    • - - -Why can't I use SSL with name-based/non-IP-based virtual hosts? -   - [L] -

      - The reason is very technical. Actually it's some sort of a chicken and - egg problem: The SSL protocol layer stays below the HTTP protocol layer - and encapsulates HTTP. When an SSL connection (HTTPS) is established - Apache/mod_ssl has to negotiate the SSL protocol parameters with the - client. For this mod_ssl has to consult the configuration of the virtual - server (for instance it has to look for the cipher suite, the server - certificate, etc.). But in order to dispatch to the correct virtual server - Apache has to know the Host HTTP header field. For this the - HTTP request header has to be read. This cannot be done before the SSL - handshake is finished. But the information is already needed at the SSL - handshake phase. Bingo! -

      -

    • - - -When I use Basic Authentication over HTTPS the lock icon in Netscape browsers -still show the unlocked state when the dialog pops up. Does this mean the -username/password is still transmitted unencrypted? -   - [L] -

      - No, the username/password is already transmitted encrypted. The icon in - Netscape browsers is just not really synchronized with the SSL/TLS layer - (it toggles to the locked state when the first part of the actual webpage - data is transferred which is not quite correct) and this way confuses - people. The Basic Authentication facility is part of the HTTP layer and - this layer is above the SSL/TLS layer in HTTPS. And before any HTTP data - communication takes place in HTTPS the SSL/TLS layer has already done the - handshake phase and switched to encrypted communication. So, don't get - confused by this icon. -

      -

    • - - -When I connect via HTTPS to an Apache+mod_ssl+OpenSSL server with Microsoft Internet -Explorer (MSIE) I get various I/O errors. What is the reason? -   - [L] -

      - The first reason is that the SSL implementation in some MSIE versions has - some subtle bugs related to the HTTP keep-alive facility and the SSL close - notify alerts on socket connection close. Additionally the interaction - between SSL and HTTP/1.1 features are problematic with some MSIE versions, - too. You've to work-around these problems by forcing - Apache+mod_ssl+OpenSSL to not use HTTP/1.1, keep-alive connections or - sending the SSL close notify messages to MSIE clients. This can be done by - using the following directive in your SSL-aware virtual host section: -

      -    SetEnvIf User-Agent ".*MSIE.*" \
      -             nokeepalive ssl-unclean-shutdown \
      -             downgrade-1.0 force-response-1.0
      - Additionally it is known some MSIE versions have also problems - with particular ciphers. Unfortunately one cannot workaround these - bugs only for those MSIE particular clients, because the ciphers - are already used in the SSL handshake phase. So a MSIE-specific - SetEnvIf doesn't work to solve these problems. Instead one - has to do more drastic adjustments to the global parameters. But - before you decide to do this, make sure your clients really have - problems. If not, do not do this, because it affects all(!) your - clients, i.e., also your non-MSIE clients. -

      - The next problem is that 56bit export versions of MSIE 5.x browsers have a - broken SSLv3 implementation which badly interacts with OpenSSL versions - greater than 0.9.4. You can either accept this and force your clients to - upgrade their browsers, or you downgrade to OpenSSL 0.9.4 (hmmm), or you - can decide to workaround it by accepting the drawback that your workaround - will horribly affect also other browsers: -

      -    SSLProtocol all -SSLv3
      - This completely disables the SSLv3 protocol and lets those browsers work. - But usually this is an even less acceptable workaround. A more reasonable - workaround is to address the problem more closely and disable only the - ciphers which cause trouble. -
      -    SSLCipherSuite ALL:!ADH:!EXPORT56:RC4+RSA:+HIGH:+MEDIUM:+LOW:+SSLv2:+EXP
      - This also lets the broken MSIE versions work, but only removes the - newer 56bit TLS ciphers. -

      - Another problem with MSIE 5.x clients is that they refuse to connect to - URLs of the form https://12.34.56.78/ (IP-addresses are used - instead of the hostname), if the server is using the Server Gated - Cryptography (SGC) facility. This can only be avoided by using the fully - qualified domain name (FQDN) of the website in hyperlinks instead, because - MSIE 5.x has an error in the way it handles the SGC negotiation. -

      - And finally there are versions of MSIE which seem to require that - an SSL session can be reused (a totally non standard-conforming - behaviour, of course). Connection with those MSIE versions only work - if a SSL session cache is used. So, as a work-around, make sure you - are using a session cache (see SSLSessionCache directive). -

      -

    • - - -When I connect via HTTPS to an Apache+mod_ssl server with Netscape Navigator I -get I/O errors and the message "Netscape has encountered bad data from the -server" What's the reason? -   - [L] -

      - The problem usually is that you had created a new server certificate with - the same DN, but you had told your browser to accept forever the old - server certificate. Once you clear the entry in your browser for the old - certificate, everything usually will work fine. Netscape's SSL - implementation is correct, so when you encounter I/O errors with Netscape - Navigator it is most of the time caused by the configured certificates. -

    -

    -
    -

    About Support

    -
      -

      -

    • - - -What information resources are available in case of mod_ssl problems? -   - [L] -

      -The following information resources are available. -In case of problems you should search here first. -

      -

        -
      1. Answers in the User Manual's F.A.Q. List (this)
        - - http://www.modssl.org/docs/2.8/ssl_faq.html
        - First look inside the F.A.Q. (this text), perhaps your problem is such - popular that it was already answered a lot of times in the past. -

        -

      2. Postings from the modssl-users Support Mailing List - - http://www.modssl.org/support/
        - Second search for your problem in one of the existing archives of the - modssl-users mailing list. Perhaps your problem popped up at least once for - another user, too. -

        -

      3. Problem Reports in the Bug Database - - http://www.modssl.org/support/bugdb/
        - Third look inside the mod_ssl Bug Database. Perhaps - someone else already has reported the problem. -
      -

      -

    • - - -What support contacts are available in case of mod_ssl problems? -   - [L] -

      -The following lists all support possibilities for mod_ssl, in order of -preference, i.e. start in this order and do not pick the support possibility -you just like most, please. -

      -

        -
      1. Write a Problem Report into the Bug Database
        - - http://www.modssl.org/support/bugdb/
        - This is the preferred way of submitting your problem report, because this - way it gets filed into the bug database (it cannot be lost) and - send to the modssl-users mailing list (others see the current problems and - learn from answers). -

        -

      2. Write a Problem Report to the modssl-users Support Mailing List
        - - modssl-users @ modssl.org
        - This is the second way of submitting your problem report. You have to - subscribe to the list first, but then you can easily discuss your problem - with both the author and the whole mod_ssl user community. -

        -

      3. Write a Problem Report to the author
        - - rse @ engelschall.com
        - This is the last way of submitting your problem report. Please avoid this - in your own interest because the author is really a very busy men. Your - mail will always be filed to one of his various mail-folders and is - usually not processed as fast as a posting on modssl-users. -
      -

      -

    • - - -What information and details I've to provide to -the author when writing a bug report? -   - [L] -

      -You have to at least always provide the following information: -

      -

        -
      • Apache, mod_ssl and OpenSSL version information
        - The mod_ssl version you should really know. For instance, it's the version - number in the distribution tarball. The Apache version can be determined - by running ``httpd -v''. The OpenSSL version can be - determined by running ``openssl version''. Alternatively when - you have Lynx installed you can run the command ``lynx -mime_header - http://localhost/ | grep Server'' to determine all information in a - single step. -

        -

      • The details on how you built and installed Apache+mod_ssl+OpenSSL
        - For this you can provide a logfile of your terminal session which shows - the configuration and install steps. Alternatively you can at least - provide the author with the APACI `configure'' command line - you used (assuming you used APACI, of course). -

        -

      • In case of core dumps please include a Backtrace
        - In case your Apache+mod_ssl+OpenSSL should really dumped core please attach - a stack-frame ``backtrace'' (see the next question on how to get it). - Without this information the reason for your core dump cannot be found. - So you have to provide the backtrace, please. -

        -

      • A detailed description of your problem
        - Don't laugh, I'm totally serious. I already got a lot of problem reports - where the people not really said what's the actual problem is. So, in your - own interest (you want the problem be solved, don't you?) include as much - details as possible, please. But start with the essentials first, of - course. -
      -

      -

    • - - -I got a core dump, can you help me? -   - [L] -

      - In general no, at least not unless you provide more details about the code - location where Apache dumped core. What is usually always required in - order to help you is a backtrace (see next question). Without this - information it is mostly impossible to find the problem and help you in - fixing it. -

      -

    • - - -Ok, I got a core dump but how do I get a backtrace to find out the reason for it? -   - [L] -

      -Follow the following steps: -

      -

        -
      1. Make sure you have debugging symbols available in at least - Apache and mod_ssl. On platforms where you use GCC/GDB you have to build - Apache+mod_ssl with ``OPTIM="-g -ggdb3"'' to achieve this. On - other platforms at least ``OPTIM="-g"'' is needed. -

        -

      2. Startup the server and try to produce the core-dump. For this you perhaps - want to use a directive like ``CoreDumpDirectory /tmp'' to - make sure that the core-dump file can be written. You then should get a - /tmp/core or /tmp/httpd.core file. When you - don't get this, try to run your server under an UID != 0 (root), because - most "current" kernels do not allow a process to dump core after it has - done a setuid() (unless it does an exec()) for - security reasons (there can be privileged information left over in - memory). Additionally you can run ``/path/to/httpd -X'' - manually to force Apache to not fork. -

        -

      3. Analyze the core-dump. For this run ``gdb /path/to/httpd - /tmp/httpd.core'' or a similar command has to run. In GDB you then - just have to enter the ``bt'' command and, voila, you get the - backtrace. For other debuggers consult your local debugger manual. Send - this backtrace to the author. -
      -
    -

    -
    - - - - - - - - - - -
    - - - - - -
    -previous page
    HowTo -
    -next page
    Glossary -
    -
    - - - - -
    - mod_ssl 2.8, User Manual
    - The Apache Interface to OpenSSL -
    -
    - Copyright © 1998-2001 - Ralf S. Engelschall
    - All Rights Reserved
    -
    -
    -
    -

    -
    - - diff --git a/docs/manual/ssl/ssl_howto.html b/docs/manual/ssl/ssl_howto.html deleted file mode 100644 index 01ff7a99ac19879b9b1d3d3440636b3844b5d33e..0000000000000000000000000000000000000000 --- a/docs/manual/ssl/ssl_howto.html +++ /dev/null @@ -1,929 +0,0 @@ - - -mod_ssl: HowTo - - - - - - - - - - -
    - - - - -
    -
    - - - - - - - - - - - - - -
    - - - - - -
    - mod_ssl - - Chapter 5 -
    -
    - - - - - -
    -previous page
    Compatibility -
    -next page
    F.A.Q. List -
    -
    -
    - HowTo -
    -
    - - - - - - - -
    - -``The solution of this problem is trivial - and is left as an exercise for the reader.'' - -
    - -Standard textbook cookie - -
    -
    -

    - - - - - - -
    -H -ow to solve particular security constraints for an SSL-aware webserver -is not always obvious because of the coherences between SSL, HTTP and Apache's -way of processing requests. This chapter gives instructions on how to solve -such typical situations. Treat is as a first step to find out the final -solution, but always try to understand the stuff before you use it. Nothing is -worse than using a security solution without knowing it's restrictions and -coherences. - -   - -
    - - - - - - - -
    - -Table Of Contents - -
    - -        Cipher Suites and Enforced Strong Security
    -                SSLv2 only server
    -                strong encryption only server
    -                server gated cryptography
    -                stronger per-directory requirements
    -        Client Authentication and Access Control
    -                simple certificate-based client authentication
    -                selective certificate-based client authentication
    -                particular certificate-based client authentication
    -                intranet vs. internet authentication
    -
    -
    -
    -
    -

    Cipher Suites and Enforced Strong Security

    -
      -

      -

    • - - -How can I create a real SSLv2-only server? -   - [L] -

      -The following creates an SSL server which speaks only the SSLv2 protocol and -its ciphers. -

      - - - - - - - - - - - - - - - - - - - - - - - - -
        httpd.conf  
      - - - - -
      -
      -
      -SSLProtocol -all +SSLv2
      -SSLCipherSuite SSLv2:+HIGH:+MEDIUM:+LOW:+EXP
      -
      -
      -
      -
      -

      -

    • - - -How can I create an SSL server which accepts strong encryption only? -   - [L] -

      -The following enables only the seven strongest ciphers: -

      - - - - - - - - - - - - - - - - - - - - - - - - -
        httpd.conf  
      - - - - -
      -
      -
      -SSLProtocol all
      -SSLCipherSuite HIGH:MEDIUM
      -
      -
      -
      -
      -

      -

    • - - -How can I create an SSL server which accepts strong encryption only, -but allows export browsers to upgrade to stronger encryption? -   - [L] -

      -This facility is called Server Gated Cryptography (SGC) and details you can -find in the README.GlobalID document in the mod_ssl distribution. -In short: The server has a Global ID server certificate, signed by a special -CA certificate from Verisign which enables strong encryption in export -browsers. This works as following: The browser connects with an export cipher, -the server sends it's Global ID certificate, the browser verifies it and -subsequently upgrades the cipher suite before any HTTP communication takes -place. The question now is: How can we allow this upgrade, but enforce strong -encryption. Or in other words: Browser either have to initially connect with -strong encryption or have to upgrade to strong encryption, but are not allowed -to keep the export ciphers. The following does the trick: -

      - - - - - - - - - - - - - - - - - - - - - - - - -
        httpd.conf  
      - - - - -
      -
      -
      -#   allow all ciphers for the inital handshake,
      -#   so export browsers can upgrade via SGC facility
      -SSLCipherSuite ALL:!ADH:RC4+RSA:+HIGH:+MEDIUM:+LOW:+SSLv2:+EXP:+eNULL
      -<Directory /usr/local/apache/htdocs>
      -#   but finally deny all browsers which haven't upgraded
      -SSLRequire %{SSL_CIPHER_USEKEYSIZE} >= 128
      -</Directory>
      -
      -
      -
      -
      -

      -

    • - - -How can I create an SSL server which accepts all types of ciphers in general, -but requires a strong ciphers for access to a particular URL? -   - [L] -

      -Obviously you cannot just use a server-wide SSLCipherSuite which -restricts the ciphers to the strong variants. But mod_ssl allows you to -reconfigure the cipher suite in per-directory context and automatically forces -a renegotiation of the SSL parameters to meet the new configuration. So, the -solution is: -

      - - - - - - - - - - - - - - - - - - - - - - - - -
        httpd.conf  
      - - - - -
      -
      -
      -#   be liberal in general
      -SSLCipherSuite ALL:!ADH:RC4+RSA:+HIGH:+MEDIUM:+LOW:+SSLv2:+EXP:+eNULL
      -<Location /strong/area>
      -#   but https://hostname/strong/area/ and below requires strong ciphers
      -SSLCipherSuite HIGH:MEDIUM
      -</Location>
      -
      -
      -
      -
      -

    -

    Client Authentication and Access Control

    -
      -

      -

    • - - -How can I authenticate clients based on certificates when I know all my -clients? -   - [L] -

      -When you know your user community (i.e. a closed user group situation), as -it's the case for instance in an Intranet, you can use plain certificate -authentication. All you have to do is to create client certificates signed by -your own CA certificate ca.crt and then verifiy the clients -against this certificate. -

      - - - - - - - - - - - - - - - - - - - - - - - - -
        httpd.conf  
      - - - - -
      -
      -
      -#   require a client certificate which has to be directly
      -#   signed by our CA certificate in ca.crt
      -SSLVerifyClient require
      -SSLVerifyDepth 1
      -SSLCACertificateFile conf/ssl.crt/ca.crt
      -
      -
      -
      -
      -

      -

    • - - -How can I authenticate my clients for a particular URL based on certificates -but still allow arbitrary clients to access the remaining parts of the server? -   - [L] -

      -For this we again use the per-directory reconfiguration feature of mod_ssl: -

      - - - - - - - - - - - - - - - - - - - - - - - - -
        httpd.conf  
      - - - - -
      -
      -
      -SSLVerifyClient none
      -SSLCACertificateFile conf/ssl.crt/ca.crt
      -<Location /secure/area>
      -SSLVerifyClient require
      -SSLVerifyDepth 1
      -</Location>
      -
      -
      -
      -
      -

      -

    • - - -How can I authenticate only particular clients for a some URLs based -on certificates but still allow arbitrary clients to access the remaining -parts of the server? -   - [L] -

      -The key is to check for various ingredients of the client certficate. Usually -this means to check the whole or part of the Distinguished Name (DN) of the -Subject. For this two methods exists: The mod_auth based variant -and the SSLRequire variant. The first method is good when the -clients are of totally different type, i.e. when their DNs have no common -fields (usually the organisation, etc.). In this case you've to establish a -password database containing all clients. The second method is better -when your clients are all part of a common hierarchy which is encoded into the -DN. Then you can match them more easily. -

      -The first method: -

      - - - - - - - - - - - - - - - - - - - - - - - - -
        /usr/local/apache/conf/httpd.conf  
      - - - - -
      -
      -
      -SSLVerifyClient      none
      -<Directory /usr/local/apache/htdocs/secure/area>
      -SSLVerifyClient      require
      -SSLVerifyDepth       5
      -SSLCACertificateFile conf/ssl.crt/ca.crt
      -SSLCACertificatePath conf/ssl.crt
      -SSLOptions           +FakeBasicAuth
      -SSLRequireSSL
      -AuthName             "Snake Oil Authentication"
      -AuthType             Basic
      -AuthUserFile         /usr/local/apache/conf/httpd.passwd
      -require              valid-user
      -</Directory>
      -
      -
      -
      -
      -

      - - - - - - - - - - - - - - - - - - - - - - - - -
        /usr/local/apache/conf/httpd.passwd  
      - - - - -
      -
      -
      -/C=DE/L=Munich/O=Snake Oil, Ltd./OU=Staff/CN=Foo:xxj31ZMTZzkVA
      -/C=US/L=S.F./O=Snake Oil, Ltd./OU=CA/CN=Bar:xxj31ZMTZzkVA
      -/C=US/L=L.A./O=Snake Oil, Ltd./OU=Dev/CN=Quux:xxj31ZMTZzkVA
      -
      -
      -
      -
      -

      -The second method: -

      - - - - - - - - - - - - - - - - - - - - - - - - -
        httpd.conf  
      - - - - -
      -
      -
      -SSLVerifyClient      none
      -<Directory /usr/local/apache/htdocs/secure/area>
      -SSLVerifyClient      require
      -SSLVerifyDepth       5
      -SSLCACertificateFile conf/ssl.crt/ca.crt
      -SSLCACertificatePath conf/ssl.crt
      -SSLOptions           +FakeBasicAuth
      -SSLRequireSSL
      -SSLRequire           %{SSL_CLIENT_S_DN_O}  eq "Snake Oil, Ltd." and \
      -                     %{SSL_CLIENT_S_DN_OU} in {"Staff", "CA", "Dev"}
      -</Directory>
      -
      -
      -
      -
      -

      -

    • - - How can -I require HTTPS with strong ciphers and either basic authentication or client -certificates for access to a subarea on the Intranet website for clients -coming from the Internet but still allow plain HTTP access for clients on the -Intranet? -   - [L] -

      -Let us assume the Intranet can be distinguished through the IP network -192.160.1.0/24 and the subarea on the Intranet website has the URL -/subarea. Then configure the following outside your HTTPS virtual -host (so it applies to both HTTPS and HTTP): -

      - - - - - - - - - - - - - - - - - - - - - - - - -
        httpd.conf  
      - - - - -
      -
      -
      -SSLCACertificateFile conf/ssl.crt/company-ca.crt
      -
      -<Directory /usr/local/apache/htdocs>
      -#   Outside the subarea only Intranet access is granted
      -Order                deny,allow
      -Deny                 from all
      -Allow                from 192.168.1.0/24
      -</Directory>
      -
      -<Directory /usr/local/apache/htdocs/subarea>
      -#   Inside the subarea any Intranet access is allowed
      -#   but from the Internet only HTTPS + Strong-Cipher + Password
      -#   or the alternative HTTPS + Strong-Cipher + Client-Certificate
      -
      -#   If HTTPS is used, make sure a strong cipher is used.
      -#   Additionally allow client certs as alternative to basic auth.
      -SSLVerifyClient      optional
      -SSLVerifyDepth       1
      -SSLOptions           +FakeBasicAuth +StrictRequire
      -SSLRequire           %{SSL_CIPHER_USEKEYSIZE} >= 128
      -
      -#   Force clients from the Internet to use HTTPS
      -RewriteEngine        on
      -RewriteCond          %{REMOTE_ADDR} !^192\.168\.1\.[0-9]+$
      -RewriteCond          %{HTTPS} !=on
      -RewriteRule          .* - [F]
      -
      -#   Allow Network Access and/or Basic Auth
      -Satisfy              any
      -
      -#   Network Access Control
      -Order                deny,allow
      -Deny                 from all
      -Allow                192.168.1.0/24
      -
      -#   HTTP Basic Authentication
      -AuthType             basic
      -AuthName             "Protected Intranet Area"
      -AuthUserFile         conf/protected.passwd
      -Require              valid-user
      -</Directory>
      -
      -
      -
      -
      -

    -

    -
    - - - - - - - - - - -
    - - - - - -
    -previous page
    Compatibility -
    -next page
    F.A.Q. List -
    -
    - - - - -
    - mod_ssl 2.8, User Manual
    - The Apache Interface to OpenSSL -
    -
    - Copyright © 1998-2001 - Ralf S. Engelschall
    - All Rights Reserved
    -
    -
    -
    -

    -
    - - diff --git a/docs/manual/ssl/ssl_intro.html b/docs/manual/ssl/ssl_intro.html deleted file mode 100644 index fae805f07a4dc05655e8f088c72f3de1f283f98b..0000000000000000000000000000000000000000 --- a/docs/manual/ssl/ssl_intro.html +++ /dev/null @@ -1,919 +0,0 @@ - - -mod_ssl: Introduction - - - - - - - - - - -
    - - - - -
    -
    - - - - - - - - - - - - - -
    - - - - - -
    - mod_ssl - - Chapter 2 -
    -
    - - - - - -
    -previous page
    Overview -
    -next page
    Reference -
    -
    -
    - Introduction -
    -
    - - - - - - - -
    - -``The nice thing about standards is that there are so many to choose from. -And if you really don't like all the standards you just have to wait another -year until the one arises you are looking for.'' - -
    - -A. Tanenbaum, ``Introduction to Computer Networks'' - -
    -
    -

    - - - - - - -
    -A -s an introduction this chapter is aimed at readers who are familiar -with the Web, HTTP, and Apache, but are not security experts. It is not -intended to be a definitive guide to the SSL protocol, nor does it discuss -specific techniques for managing certificates in an organization, or the -important legal issues of patents and import and export restrictions. Rather, -it is intended to provide a common background to mod_ssl users by pulling -together various concepts, definitions, and examples as a starting point for -further exploration. -

    -The presented content is mainly derived, with permission by the author, from -the article Introducing SSL -and Certificates using SSLeay from Frederick J. Hirsch, of The Open -Group Research Institute, which was published in Web Security: A Matter of -Trust, World Wide Web Journal, Volume 2, Issue 3, Summer 1997. -Please send any postive feedback to Frederick Hirsch (the original -article author) and all negative feedback to Ralf S. Engelschall (the mod_ssl -author). -

    -   - -
    - - - - - - - -
    - -Table Of Contents - -
    - -        Cryptographic Techniques
    -                Cryptographic Algorithms
    -                Message Digests
    -                Digital Signatures
    -        Certificates
    -                Certificate Contents
    -                Certificate Authorities
    -                        Certificate Chains
    -                        Creating a Root-Level CA
    -                        Certificate Management
    -        Secure Sockets Layer (SSL)
    -                Session Establishment
    -                Key Exchange Method
    -                Cipher for Data Transfer
    -                Digest Function
    -                Handshake Sequence Protocol
    -                Data Transfer
    -                Securing HTTP Communication
    -        References
    -
    -
    -
    -
    -

    Cryptographic Techniques

    -Understanding SSL requires an understanding of cryptographic algorithms, -message digest functions (aka. one-way or hash functions), and digital -signatures. These techniques are the subject of entire books (see for instance -[AC96]) and provide the basis for privacy, integrity, and -authentication. -

    Cryptographic Algorithms

    -Suppose Alice wants to send a message to her bank to transfer some money. -Alice would like the message to be private, since it will include information -such as her account number and transfer amount. One solution is to use a -cryptographic algorithm, a technique that would transform her message into an -encrypted form, unreadable except by those it is intended for. Once in this -form, the message may only be interpreted through the use of a secret key. -Without the key the message is useless: good cryptographic algorithms make it -so difficult for intruders to decode the original text that it isn't worth -their effort. -

    -There are two categories of cryptographic algorithms: -conventional and public key. -

      -
    • Conventional cryptography, also known as symmetric -cryptography, requires the sender and receiver to share a key: a secret -piece of information that may be used to encrypt or decrypt a message. -If this key is secret, then nobody other than the sender or receiver may -read the message. If Alice and the bank know a secret key, then they -may send each other private messages. The task of privately choosing a key -before communicating, however, can be problematic. -

      -

    • Public key cryptography, also known as asymmetric cryptography, -solves the key exchange problem by defining an algorithm which uses two keys, -each of which may be used to encrypt a message. If one key is used to encrypt -a message then the other must be used to decrypt it. This makes it possible -to receive secure messages by simply publishing one key (the public key) and -keeping the other secret (the private key). -

      -Anyone may encrypt a message using the public key, but only the owner of the -private key will be able to read it. In this way, Alice may send private -messages to the owner of a key-pair (the bank), by encrypting it using their -public key. Only the bank will be able to decrypt it. -

    -

    Message Digests

    -Although Alice may encrypt her message to make it private, there is still a -concern that someone might modify her original message or substitute -it with a different one, in order to transfer the money to themselves, for -instance. One way of guaranteeing the integrity of Alice's message is to -create a concise summary of her message and send this to the bank as well. -Upon receipt of the message, the bank creates its own summary and compares it -with the one Alice sent. If they agree then the message was received intact. -

    -A summary such as this is called a message digest, one-way -function or hash function. Message digests are used to create -short, fixed-length representations of longer, variable-length messages. -Digest algorithms are designed to produce unique digests for different -messages. Message digests are designed to make it too difficult to determine -the message from the digest, and also impossible to find two different -messages which create the same digest -- thus eliminating the possibility of -substituting one message for another while maintaining the same digest. -

    -Another challenge that Alice faces is finding a way to send the digest to the -bank securely; when this is achieved, the integrity of the associated message -is assured. One way to to this is to include the digest in a digital -signature. -

    Digital Signatures

    -When Alice sends a message to the bank, the bank needs to ensure that the -message is really from her, so an intruder does not request a transaction -involving her account. A digital signature, created by Alice and -included with the message, serves this purpose. -

    -Digital signatures are created by encrypting a digest of the message, -and other information (such as a sequence number) with the sender's -private key. Though anyone may decrypt the signature using the public -key, only the signer knows the private key. This means that only they may -have signed it. Including the digest in the signature means the signature is -only good for that message; it also ensures the integrity of the message since -no one can change the digest and still sign it. -

    -To guard against interception and reuse of the signature by an intruder at a -later date, the signature contains a unique sequence number. This protects -the bank from a fraudulent claim from Alice that she did not send the message --- only she could have signed it (non-repudiation). -

    Certificates

    -Although Alice could have sent a private message to the bank, signed it, and -ensured the integrity of the message, she still needs to be sure that she is -really communicating with the bank. This means that she needs to be sure that -the public key she is using corresponds to the bank's private key. Similarly, -the bank also needs to verify that the message signature really corresponds to -Alice's signature. -

    -If each party has a certificate which validates the other's identity, confirms -the public key, and is signed by a trusted agency, then they both will be -assured that they are communicating with whom they think they are. Such a -trusted agency is called a Certificate Authority, and certificates are -used for authentication. -

    Certificate Contents

    -A certificate associates a public key with the real identity of an individual, -server, or other entity, known as the subject. As shown in Table 1, information about the subject includes identifying -information (the distinguished name), and the public key. It also includes -the identification and signature of the Certificate Authority that issued the -certificate, and the period of time during which the certificate is valid. It -may have additional information (or extensions) as well as administrative -information for the Certificate Authority's use, such as a serial number. -

    -

    - - - -
    Table 1: Certificate Information
    - - -
    - - - - - - - - - - - -
    Subject:Distinguished Name, Public Key
    Issuer:Distinguished Name, Signature
    Period of Validity:Not Before Date, Not After Date
    Administrative Information:Version, Serial Number
    Extended Information:Basic Contraints, Netscape Flags, etc.
    -
    -
    -
    -

    -A distinguished name is used to provide an identity in a specific context -- -for instance, an individual might have a personal certificate as well as one -for their identity as an employee. Distinguished names are defined by the -X.509 standard [X509], which defines the fields, field -names, and abbreviations used to refer to the fields -(see Table 2). -

    -

    - - - -
    Table 2: Distinguished Name Information
    - - -
    - - - - - - - - - - - - - - - - -
    DN Field:Abbrev.:Description:Example:
    Common NameCNName being certifiedCN=Joe Average
    Organization or CompanyOName is associated with this
    organization
    O=Snake Oil, Ltd.
    Organizational UnitOUName is associated with this
    organization unit, such as a department
    OU=Research Institute
    City/LocalityLName is located in this CityL=Snake City
    State/ProvinceSTName is located in this State/ProvinceST=Desert
    CountryCName is located in this Country (ISO code)C=XZ
    -
    -
    -
    -

    -A Certificate Authority may define a policy specifying which distinguished -field names are optional, and which are required. It may also place -requirements upon the field contents, as may users of certificates. As an -example, a Netscape browser requires that the Common Name for a certificate -representing a server has a name which matches a wildcard pattern for the -domain name of that server, such as *.snakeoil.com. -

    -The binary format of a certificate is defined using the ASN.1 notation [ X208] [PKCS]. This notation defines how to -specify the contents, and encoding rules define how this information is -translated into binary form. The binary encoding of the certificate is -defined using Distinguished Encoding Rules (DER), which are based on the more -general Basic Encoding Rules (BER). For those transmissions which cannot -handle binary, the binary form may be translated into an ASCII form by using -Base64 encoding [MIME]. This encoded version is called PEM -encoded (the name comes from "Privacy Enhanced Mail"), when placed between -begin and end delimiter lines as illustrated in Table 3. -

    -

    - - - -
    Table 3: Example of a PEM-encoded certificate (snakeoil.crt)
    - - -
    -
    -
    ------BEGIN CERTIFICATE-----
    -MIIC7jCCAlegAwIBAgIBATANBgkqhkiG9w0BAQQFADCBqTELMAkGA1UEBhMCWFkx
    -FTATBgNVBAgTDFNuYWtlIERlc2VydDETMBEGA1UEBxMKU25ha2UgVG93bjEXMBUG
    -A1UEChMOU25ha2UgT2lsLCBMdGQxHjAcBgNVBAsTFUNlcnRpZmljYXRlIEF1dGhv
    -cml0eTEVMBMGA1UEAxMMU25ha2UgT2lsIENBMR4wHAYJKoZIhvcNAQkBFg9jYUBz
    -bmFrZW9pbC5kb20wHhcNOTgxMDIxMDg1ODM2WhcNOTkxMDIxMDg1ODM2WjCBpzEL
    -MAkGA1UEBhMCWFkxFTATBgNVBAgTDFNuYWtlIERlc2VydDETMBEGA1UEBxMKU25h
    -a2UgVG93bjEXMBUGA1UEChMOU25ha2UgT2lsLCBMdGQxFzAVBgNVBAsTDldlYnNl
    -cnZlciBUZWFtMRkwFwYDVQQDExB3d3cuc25ha2VvaWwuZG9tMR8wHQYJKoZIhvcN
    -AQkBFhB3d3dAc25ha2VvaWwuZG9tMIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKB
    -gQDH9Ge/s2zcH+da+rPTx/DPRp3xGjHZ4GG6pCmvADIEtBtKBFAcZ64n+Dy7Np8b
    -vKR+yy5DGQiijsH1D/j8HlGE+q4TZ8OFk7BNBFazHxFbYI4OKMiCxdKzdif1yfaa
    -lWoANFlAzlSdbxeGVHoT0K+gT5w3UxwZKv2DLbCTzLZyPwIDAQABoyYwJDAPBgNV
    -HRMECDAGAQH/AgEAMBEGCWCGSAGG+EIBAQQEAwIAQDANBgkqhkiG9w0BAQQFAAOB
    -gQAZUIHAL4D09oE6Lv2k56Gp38OBDuILvwLg1v1KL8mQR+KFjghCrtpqaztZqcDt
    -2q2QoyulCgSzHbEGmi0EsdkPfg6mp0penssIFePYNI+/8u9HT4LuKMJX15hxBam7
    -dUHzICxBVC1lnHyYGjDuAMhe396lYAn8bCld1/L4NMGBCQ==
    ------END CERTIFICATE-----
    -
    -
    -
    -
    -

    Certificate Authorities

    -By first verifying the information in a certificate request before granting -the certificate, the Certificate Authority assures the identity of the private -key owner of a key-pair. For instance, if Alice requests a personal -certificate, the Certificate Authority must first make sure that Alice really -is the person the certificate request claims. -

    Certificate Chains

    -A Certificate Authority may also issue a certificate for another Certificate -Authority. When examining a certificate, Alice may need to examine the -certificate of the issuer, for each parent Certificate Authority, until -reaching one which she has confidence in. She may decide to trust only -certificates with a limited chain of issuers, to reduce her risk of a "bad" -certificate in the chain. -

    Creating a Root-Level CA

    -As noted earlier, each certificate requires an issuer to assert the validity -of the identity of the certificate subject, up to the top-level Certificate -Authority (CA). This presents a problem: Since this is who vouches for the -certificate of the top-level authority, which has no issuer? -In this unique case, the certificate is "self-signed", so the issuer of the -certificate is the same as the subject. As a result, one must exercise extra -care in trusting a self-signed certificate. The wide publication of a public -key by the root authority reduces the risk in trusting this key -- it would be -obvious if someone else publicized a key claiming to be the authority. -Browsers are preconfigured to trust well-known certificate authorities. -

    -A number of companies, such as Thawte and -VeriSign have established themselves as -Certificate Authorities. These companies provide the following services: -

      -
    • Verifying certificate requests -
    • Processing certificate requests -
    • Issuing and managing certificates -
    -

    -It is also possible to create your own Certificate Authority. Although risky -in the Internet environment, it may be useful within an Intranet where the -organization can easily verify the identities of individuals and servers. -

    Certificate Management

    -Establishing a Certificate Authority is a responsibility which requires a -solid administrative, technical, and management framework. -Certificate Authorities not only issue certificates, they also manage them -- -that is, they determine how long certificates are valid, they renew them, and -they keep lists of certificates that have already been issued but are no -longer valid (Certificate Revocation Lists, or CRLs). -Say Alice is entitled to a certificate as an employee of a company. Say too, -that the certificate needs to be revoked when Alice leaves the company. Since -certificates are objects that get passed around, it is impossible to tell from -the certificate alone that it has been revoked. -When examining certificates for validity, therefore, it is necessary to -contact the issuing Certificate Authority to check CRLs -- this is not usually -an automated part of the process. -

    -

    Note:
    -If you use a Certificate Authority that is not configured into browsers by -default, it is necessary to load the Certificate Authority certificate into -the browser, enabling the browser to validate server certificates signed by -that Certificate Authority. Doing so may be dangerous, since once loaded, the -browser will accept all certificates signed by that Certificate Authority. -

    Secure Sockets Layer (SSL)

    -The Secure Sockets Layer protocol is a protocol layer which may be placed -between a reliable connection-oriented network layer protocol (e.g. TCP/IP) -and the application protocol layer (e.g. HTTP). SSL provides for secure -communication between client and server by allowing mutual authentication, the -use of digital signatures for integrity, and encryption for privacy. -

    -The protocol is designed to support a range of choices for specific algorithms -used for cryptography, digests, and signatures. This allows algorithm -selection for specific servers to be made based on legal, export or other -concerns, and also enables the protocol to take advantage of new algorithms. -Choices are negotiated between client and server at the start of establishing -a protocol session. -

    -

    - - - -
    Table 4: Versions of the SSL protocol
    - - -
    - - - - - - - - - - - - - - - - - - - - - - - - -
    Version:Source:Description:Browser Support:
    SSL v2.0Vendor Standard (from Netscape Corp.) [SSL2]First SSL protocol for which implementations exists- NS Navigator 1.x/2.x
    - - MS IE 3.x
    - - Lynx/2.8+OpenSSL -
    SSL v3.0Expired Internet Draft (from Netscape Corp.) [SSL3]Revisions to prevent specific security attacks, add non-RSA ciphers, and support for certificate chains- NS Navigator 2.x/3.x/4.x
    - - MS IE 3.x/4.x
    - - Lynx/2.8+OpenSSL -
    TLS v1.0Proposed Internet Standard (from IETF) [TLS1]Revision of SSL 3.0 to update the MAC layer to HMAC, add block padding for - block ciphers, message order standardization and more alert messages. -- Lynx/2.8+OpenSSL
    -
    -
    -
    -

    -There are a number of versions of the SSL protocol, as shown in Table 4. As noted there, one of the benefits in SSL 3.0 is -that it adds support of certificate chain loading. This feature allows a -server to pass a server certificate along with issuer certificates to the -browser. Chain loading also permits the browser to validate the server -certificate, even if Certificate Authority certificates are not installed for -the intermediate issuers, since they are included in the certificate chain. -SSL 3.0 is the basis for the Transport Layer Security [TLS] protocol standard, currently in development by the -Internet Engineering Task Force (IETF). -

    Session Establishment

    -The SSL session is established by following a handshake sequence -between client and server, as shown in Figure 1. This -sequence may vary, depending on whether the server is configured to provide a -server certificate or request a client certificate. Though cases exist where -additional handshake steps are required for management of cipher information, -this article summarizes one common scenario: see the SSL specification for the -full range of possibilities. -

    -

    Note
    -Once an SSL session has been established it may be reused, thus avoiding the -performance penalty of repeating the many steps needed to start a session. -For this the server assigns each SSL session a unique session identifier which -is cached in the server and which the client can use on forthcoming -connections to reduce the handshake (until the session identifer expires in -the cache of the server). -

    -

    - - - -
    Figure 1: Simplified SSL Handshake Sequence
    - - -
    - -
    -
    -
    -

    -The elements of the handshake sequence, as used by the client and server, are -listed below: -

      -
    1. Negotiate the Cipher Suite to be used during data transfer -
    2. Establish and share a session key between client and server -
    3. Optionally authenticate the server to the client -
    4. Optionally authenticate the client to the server -
    -

    -The first step, Cipher Suite Negotiation, allows the client and server to -choose a Cipher Suite supportable by both of them. The SSL3.0 protocol -specification defines 31 Cipher Suites. A Cipher Suite is defined by the -following components: -

      -
    • Key Exchange Method -
    • Cipher for Data Transfer -
    • Message Digest for creating the Message Authentication Code (MAC) -
    -These three elements are described in the sections that follow. -

    Key Exchange Method

    -The key exchange method defines how the shared secret symmetric cryptography -key used for application data transfer will be agreed upon by client and -server. SSL 2.0 uses RSA key exchange only, while SSL 3.0 supports a choice of -key exchange algorithms including the RSA key exchange when certificates are -used, and Diffie-Hellman key exchange for exchanging keys without certificates -and without prior communication between client and server. -

    -One variable in the choice of key exchange methods is digital signatures -- -whether or not to use them, and if so, what kind of signatures to use. -Signing with a private key provides assurance against a -man-in-the-middle-attack during the information exchange used in generating -the shared key [AC96, p516]. -

    Cipher for Data Transfer

    -SSL uses the conventional cryptography algorithm (symmetric cryptography) -described earlier for encrypting messages in a session. There are nine -choices, including the choice to perform no encryption: -
      -
    • No encryption -
    • Stream Ciphers -
        -
      • RC4 with 40-bit keys -
      • RC4 with 128-bit keys -
      -
    • CBC Block Ciphers -
        -
      • RC2 with 40 bit key -
      • DES with 40 bit key -
      • DES with 56 bit key -
      • Triple-DES with 168 bit key -
      • Idea (128 bit key) -
      • Fortezza (96 bit key) -
      -
    -Here "CBC" refers to Cipher Block Chaining, which means that a portion of the -previously encrypted cipher text is used in the encryption of the current -block. "DES" refers to the Data Encryption Standard [AC96, -ch12], which has a number of variants (including DES40 and 3DES_EDE). "Idea" -is one of the best and cryptographically strongest available algorithms, and -"RC2" is a proprietary algorithm from RSA DSI [AC96, -ch13]. -

    Digest Function

    -The choice of digest function determines how a digest is created from a record -unit. SSL supports the following: -
      -
    • No digest (Null choice) -
    • MD5, a 128-bit hash -
    • Secure Hash Algorithm (SHA-1), a 160-bit hash -
    -The message digest is used to create a Message Authentication Code (MAC) which -is encrypted with the message to provide integrity and to prevent against -replay attacks. -

    Handshake Sequence Protocol

    -The handshake sequence uses three protocols: -
      -
    • The SSL Handshake Protocol - for performing the client and server SSL session establishment. -
    • The SSL Change Cipher Spec Protocol for actually establishing agreement - on the Cipher Suite for the session. -
    • The SSL Alert Protocol for - conveying SSL error messages between client and server. -
    -These protocols, as well as application protocol data, are encapsulated in the -SSL Record Protocol, as shown in Figure 2. An -encapsulated protocol is transferred as data by the lower layer protocol, -which does not examine the data. The encapsulated protocol has no knowledge of -the underlying protocol. -

    -

    - - - -
    Figure 2: SSL Protocol Stack
    - - -
    - -
    -
    -
    -

    -The encapsulation of SSL control protocols by the record protocol means that -if an active session is renegotiated the control protocols will be transmitted -securely. If there were no session before, then the Null cipher suite is -used, which means there is no encryption and messages have no integrity -digests until the session has been established. -

    Data Transfer

    -The SSL Record Protocol, shown in Figure 3, is used to -transfer application and SSL Control data between the client and server, -possibly fragmenting this data into smaller units, or combining multiple -higher level protocol data messages into single units. It may compress, attach -digest signatures, and encrypt these units before transmitting them using the -underlying reliable transport protocol (Note: currently all major SSL -implementations lack support for compression). -

    -

    - - - -
    Figure 3: SSL Record Protocol
    - - -
    - -
    -
    -
    -

    Securing HTTP Communication

    -One common use of SSL is to secure Web HTTP communication between a browser -and a webserver. This case does not preclude the use of non-secured HTTP. The -secure version is mainly plain HTTP over SSL (named HTTPS), but with one major -difference: it uses the URL scheme https rather than -http and a different server port (by default 443). This mainly -is what mod_ssl provides to you for the Apache webserver... -

    References

    - -

    -
    - - - - - - - - - - -
    - - - - - -
    -previous page
    Overview -
    -next page
    Reference -
    -
    - - - - -
    - mod_ssl 2.8, User Manual
    - The Apache Interface to OpenSSL -
    -
    - Copyright © 1998-2001 - Ralf S. Engelschall
    - All Rights Reserved
    -
    -
    -
    -

    -
    - - diff --git a/docs/manual/ssl/ssl_intro_fig1.gif b/docs/manual/ssl/ssl_intro_fig1.gif deleted file mode 100644 index 3c209864f19a32c79c520e238cace9db01df65f6..0000000000000000000000000000000000000000 Binary files a/docs/manual/ssl/ssl_intro_fig1.gif and /dev/null differ diff --git a/docs/manual/ssl/ssl_intro_fig2.gif b/docs/manual/ssl/ssl_intro_fig2.gif deleted file mode 100644 index 26b295a67b0a5fe44bc4dcd9f06cba8e281eed6b..0000000000000000000000000000000000000000 Binary files a/docs/manual/ssl/ssl_intro_fig2.gif and /dev/null differ diff --git a/docs/manual/ssl/ssl_intro_fig3.gif b/docs/manual/ssl/ssl_intro_fig3.gif deleted file mode 100644 index 00a975b5a4e4835c1faaf6c05ac4430ab2703f01..0000000000000000000000000000000000000000 Binary files a/docs/manual/ssl/ssl_intro_fig3.gif and /dev/null differ diff --git a/docs/manual/stopping.html b/docs/manual/stopping.html deleted file mode 100644 index 898acca3ca523eba974c6910d65bd7b22bea4877..0000000000000000000000000000000000000000 --- a/docs/manual/stopping.html +++ /dev/null @@ -1,137 +0,0 @@ - - - -Stopping and Restarting Apache - - - - -

    Stopping and Restarting Apache

    - -

    You will notice many httpd executables running on your system, -but you should not send signals to any of them except the parent, whose -pid is in the PidFile. That is to -say you shouldn't ever need to send signals to any process except the -parent. There are three signals that you can send the parent: -TERM, HUP, and USR1, which will -be described in a moment. - -

    To send a signal to the parent you should issue a command such as: -

    -    kill -TERM `cat /usr/local/etc/httpd/logs/httpd.pid`
    -
    - -You can read about its progress by issuing: - -
    -    tail -f /usr/local/etc/httpd/logs/error_log
    -
    - -Modify those examples to match your -ServerRoot and -PidFile settings. - -

    TERM Signal: stop now

    - -

    Sending the TERM signal to the parent causes it to -immediately attempt to kill off all of its children. It may take it -several seconds to complete killing off its children. Then the -parent itself exits. Any requests in progress are terminated, and no -further requests are served. - -

    HUP Signal: restart now

    - -

    Sending the HUP signal to the parent causes it to kill off -its children like in TERM but the parent doesn't exit. It -re-reads its configuration files, and re-opens any log files. -Then it spawns a new set of children and continues -serving hits. - -

    Users of the -status module -will notice that the server statistics are -set to zero when a HUP is sent. - -

    USR1 Signal: graceful restart

    - -

    Note: prior to release 1.2b9 this code is quite unstable and -shouldn't be used at all. - -

    The USR1 signal causes the parent process to advise -the children to exit after their current request (or to exit immediately -if they're not serving anything). The parent re-reads its configuration -files and re-opens its log files. As each child dies off the parent -replaces it with a child from the new generation of the -configuration, which begins serving new requests immediately. - -

    This code is designed to always respect the -MaxClients, -MinSpareServers, -and MaxSpareServers settings. -Furthermore, it respects StartServers -in the following manner: if after one second at least StartServers new -children have not been created, then create enough to pick up the slack. -This is to say that the code tries to maintain both the number of children -appropriate for the current load on the server, and respect your wishes -with the StartServers parameter. - -

    Users of the -status module -will notice that the server statistics -are not set to zero when a USR1 is sent. The code -was written to both minimize the time in which the server is unable to serve -new requests (they will be queued up by the operating system, so they're -not lost in any event) and to respect your tuning parameters. In order -to do this it has to keep the scoreboard used to keep track -of all children across generations. - -

    The status module will also use a G to indicate those -children which are still serving requests started before the graceful -restart was given. - -

    At present there is no way for a log rotation script using -USR1 to know for certain that all children writing the -pre-restart log have finished. We suggest that you use a suitable delay -after sending the USR1 signal before you do anything with the -old log. For example if most of your hits take less than 10 minutes to -complete for users on low bandwidth links then you could wait 15 minutes -before doing anything with the old log. - -

    Appendix: signals and race conditions

    - -

    Prior to Apache 1.2b9 there were several race conditions -involving the restart and die signals (a simple description of race -condition is: a time-sensitive problem, as in if something happens at just -the wrong time it won't behave as expected). For those architectures that -have the "right" feature set we have eliminated as many as we can. -But it should be noted that there still do exist race conditions on -certain architectures. - -

    Architectures that use an on disk ScoreBoardFile have the potential -to lose track of a child during graceful restart (you'll see an ErrorLog message saying something about -a long lost child). The ScoreBoardFile directive explains how -to figure out if your server uses a file, and possibly how to avoid it. -There is also the potential that the scoreboard will be corrupted during -any signalling, but this only has bad effects on graceful restart. - -

    NEXT and MACHTEN have small race conditions -which can cause a restart/die signal to be lost, but should not cause the -server to do anything otherwise problematic. - - -

    All architectures have a small race condition in each child involving -the second and subsequent requests on a persistent HTTP connection -(KeepAlive). It may exit after reading the request line but before -reading any of the request headers. There is a fix that was discovered -too late to make 1.2. In theory this isn't an issue because the KeepAlive -client has to expect these events because of network latencies and -server timeouts. In practice it doesn't seem to affect anything either --- in a test case the server was restarted twenty times per second and -clients successfully browsed the site without getting broken images or -empty documents. - - - - diff --git a/docs/manual/stopping.html.en b/docs/manual/stopping.html.en deleted file mode 100644 index 898acca3ca523eba974c6910d65bd7b22bea4877..0000000000000000000000000000000000000000 --- a/docs/manual/stopping.html.en +++ /dev/null @@ -1,137 +0,0 @@ - - - -Stopping and Restarting Apache - - - - -

    Stopping and Restarting Apache

    - -

    You will notice many httpd executables running on your system, -but you should not send signals to any of them except the parent, whose -pid is in the PidFile. That is to -say you shouldn't ever need to send signals to any process except the -parent. There are three signals that you can send the parent: -TERM, HUP, and USR1, which will -be described in a moment. - -

    To send a signal to the parent you should issue a command such as: -

    -    kill -TERM `cat /usr/local/etc/httpd/logs/httpd.pid`
    -
    - -You can read about its progress by issuing: - -
    -    tail -f /usr/local/etc/httpd/logs/error_log
    -
    - -Modify those examples to match your -ServerRoot and -PidFile settings. - -

    TERM Signal: stop now

    - -

    Sending the TERM signal to the parent causes it to -immediately attempt to kill off all of its children. It may take it -several seconds to complete killing off its children. Then the -parent itself exits. Any requests in progress are terminated, and no -further requests are served. - -

    HUP Signal: restart now

    - -

    Sending the HUP signal to the parent causes it to kill off -its children like in TERM but the parent doesn't exit. It -re-reads its configuration files, and re-opens any log files. -Then it spawns a new set of children and continues -serving hits. - -

    Users of the -status module -will notice that the server statistics are -set to zero when a HUP is sent. - -

    USR1 Signal: graceful restart

    - -

    Note: prior to release 1.2b9 this code is quite unstable and -shouldn't be used at all. - -

    The USR1 signal causes the parent process to advise -the children to exit after their current request (or to exit immediately -if they're not serving anything). The parent re-reads its configuration -files and re-opens its log files. As each child dies off the parent -replaces it with a child from the new generation of the -configuration, which begins serving new requests immediately. - -

    This code is designed to always respect the -MaxClients, -MinSpareServers, -and MaxSpareServers settings. -Furthermore, it respects StartServers -in the following manner: if after one second at least StartServers new -children have not been created, then create enough to pick up the slack. -This is to say that the code tries to maintain both the number of children -appropriate for the current load on the server, and respect your wishes -with the StartServers parameter. - -

    Users of the -status module -will notice that the server statistics -are not set to zero when a USR1 is sent. The code -was written to both minimize the time in which the server is unable to serve -new requests (they will be queued up by the operating system, so they're -not lost in any event) and to respect your tuning parameters. In order -to do this it has to keep the scoreboard used to keep track -of all children across generations. - -

    The status module will also use a G to indicate those -children which are still serving requests started before the graceful -restart was given. - -

    At present there is no way for a log rotation script using -USR1 to know for certain that all children writing the -pre-restart log have finished. We suggest that you use a suitable delay -after sending the USR1 signal before you do anything with the -old log. For example if most of your hits take less than 10 minutes to -complete for users on low bandwidth links then you could wait 15 minutes -before doing anything with the old log. - -

    Appendix: signals and race conditions

    - -

    Prior to Apache 1.2b9 there were several race conditions -involving the restart and die signals (a simple description of race -condition is: a time-sensitive problem, as in if something happens at just -the wrong time it won't behave as expected). For those architectures that -have the "right" feature set we have eliminated as many as we can. -But it should be noted that there still do exist race conditions on -certain architectures. - -

    Architectures that use an on disk ScoreBoardFile have the potential -to lose track of a child during graceful restart (you'll see an ErrorLog message saying something about -a long lost child). The ScoreBoardFile directive explains how -to figure out if your server uses a file, and possibly how to avoid it. -There is also the potential that the scoreboard will be corrupted during -any signalling, but this only has bad effects on graceful restart. - -

    NEXT and MACHTEN have small race conditions -which can cause a restart/die signal to be lost, but should not cause the -server to do anything otherwise problematic. - - -

    All architectures have a small race condition in each child involving -the second and subsequent requests on a persistent HTTP connection -(KeepAlive). It may exit after reading the request line but before -reading any of the request headers. There is a fix that was discovered -too late to make 1.2. In theory this isn't an issue because the KeepAlive -client has to expect these events because of network latencies and -server timeouts. In practice it doesn't seem to affect anything either --- in a test case the server was restarted twenty times per second and -clients successfully browsed the site without getting broken images or -empty documents. - - - - diff --git a/docs/manual/style/modulesynopsis.dtd b/docs/manual/style/modulesynopsis.dtd deleted file mode 100644 index 65b3c30a7624caf78a9bec10ebb1a34de3c452a1..0000000000000000000000000000000000000000 --- a/docs/manual/style/modulesynopsis.dtd +++ /dev/null @@ -1,109 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/docs/manual/suexec.html b/docs/manual/suexec.html deleted file mode 100644 index c1207ac01a5f98643f565a922f4d3c164a597065..0000000000000000000000000000000000000000 --- a/docs/manual/suexec.html +++ /dev/null @@ -1,20 +0,0 @@ - -Apache SetUserID Support - - - -

    Apache SetUserID Support

    - -
    - -

    What is SUExec?

    - -

    Enabling SUExec Support

    - -

    When SUExec Is Used

    - - - - - - diff --git a/docs/manual/suexec.html.en b/docs/manual/suexec.html.en deleted file mode 100644 index c1207ac01a5f98643f565a922f4d3c164a597065..0000000000000000000000000000000000000000 --- a/docs/manual/suexec.html.en +++ /dev/null @@ -1,20 +0,0 @@ - -Apache SetUserID Support - - - -

    Apache SetUserID Support

    - -
    - -

    What is SUExec?

    - -

    Enabling SUExec Support

    - -

    When SUExec Is Used

    - - - - - - diff --git a/docs/manual/upgrading.html b/docs/manual/upgrading.html deleted file mode 100644 index 990a0649368334382434191db79992770cab1fe9..0000000000000000000000000000000000000000 --- a/docs/manual/upgrading.html +++ /dev/null @@ -1,94 +0,0 @@ - - -Upgrading to 2.0 from 1.3 - - - - - -

    Upgrading to 2.0 from 1.3

    - -

    In order to assist folks upgrading, we maintain a document -describing information critical to existing Apache users. These are -intended to be brief notes, and you should be able to find more -information in either the New -Features document, or in the src/CHANGES file. - -

    Compile-Time Configuration Changes

    - -
      -
    • Apache now uses an autoconf and libtool -system for configuring the build processes. Using this system -is similar to, but not the same as, using the APACI system in -Apache 1.3. Further documentation to follow.
    • - -
    • In addition to the usual selection of modules which you can -choose to compile, Apache 2.0 has moved the main part of request -processing into Multi-Processing-Modules (MPMs). Documentation -on how to select an MPM is to follow.
    • -
    - -

    Run-Time Configuration Changes

    - -
      -
    • The CacheNegotiatedDocs directive now takes -the argument on or off. Existing -instances of CacheNegotiatedDocs should be replaced -with CachNegotiatedDocs on.
    • - -
    • The ErrorDocument directive no longer uses a single -quote at the beginning of the argument to indicate a text message. -Instead, you should enclose the message in double quotes. For -example, existing instances of ErrorDocument 403 "Some -Message should be replaced with ErrorDocument 403 "Some -Message". As long as the second argument is not a valid URL or -pathname, it will be treated as a text message.
    • - -
    • The AccessConfig and ResourceConfig -directives no longer exist. Existing instances of these directives -can be replaced with the Include directive which -has equivalent functionality. If you were making use of the -default values of these directives without including them in -the configuration files, you may need to add -Include conf/access.conf and Include conf/srm.conf -to your httpd.conf.
    • - -
    • The ExtendedStatus directive no longer exists.
    • - -
    • The ServerType directive no longer exists.
    • - -
    • The CoreDumpDirectory directive no longer exists.
    • - -
    • Many directives that were in the core server in Apache 1.3 -are now in the MPMs.
    • - - -
    - -

    Misc Changes

    - -
      -
    • The module mod_auth_digest, which was experimental in Apache 1.3 -is now a standard module.
    • - -
    • The mod_mmap_static module, which was experimental in Apache 1.3 -has been replaced with mod_file_cache.
    • - - -
    - -

    Third Party Modules

    - -

    Extensive changes were made to the server API in Apache 2.0. -Existing modules designed for the Apache 1.3 API will not -work in Apache 2.0 without modification. Details to follow. - - - - diff --git a/docs/manual/upgrading.html.en b/docs/manual/upgrading.html.en deleted file mode 100644 index 990a0649368334382434191db79992770cab1fe9..0000000000000000000000000000000000000000 --- a/docs/manual/upgrading.html.en +++ /dev/null @@ -1,94 +0,0 @@ - - -Upgrading to 2.0 from 1.3 - - - - - -

    Upgrading to 2.0 from 1.3

    - -

    In order to assist folks upgrading, we maintain a document -describing information critical to existing Apache users. These are -intended to be brief notes, and you should be able to find more -information in either the New -Features document, or in the src/CHANGES file. - -

    Compile-Time Configuration Changes

    - -
      -
    • Apache now uses an autoconf and libtool -system for configuring the build processes. Using this system -is similar to, but not the same as, using the APACI system in -Apache 1.3. Further documentation to follow.
    • - -
    • In addition to the usual selection of modules which you can -choose to compile, Apache 2.0 has moved the main part of request -processing into Multi-Processing-Modules (MPMs). Documentation -on how to select an MPM is to follow.
    • -
    - -

    Run-Time Configuration Changes

    - -
      -
    • The CacheNegotiatedDocs directive now takes -the argument on or off. Existing -instances of CacheNegotiatedDocs should be replaced -with CachNegotiatedDocs on.
    • - -
    • The ErrorDocument directive no longer uses a single -quote at the beginning of the argument to indicate a text message. -Instead, you should enclose the message in double quotes. For -example, existing instances of ErrorDocument 403 "Some -Message should be replaced with ErrorDocument 403 "Some -Message". As long as the second argument is not a valid URL or -pathname, it will be treated as a text message.
    • - -
    • The AccessConfig and ResourceConfig -directives no longer exist. Existing instances of these directives -can be replaced with the Include directive which -has equivalent functionality. If you were making use of the -default values of these directives without including them in -the configuration files, you may need to add -Include conf/access.conf and Include conf/srm.conf -to your httpd.conf.
    • - -
    • The ExtendedStatus directive no longer exists.
    • - -
    • The ServerType directive no longer exists.
    • - -
    • The CoreDumpDirectory directive no longer exists.
    • - -
    • Many directives that were in the core server in Apache 1.3 -are now in the MPMs.
    • - - -
    - -

    Misc Changes

    - -
      -
    • The module mod_auth_digest, which was experimental in Apache 1.3 -is now a standard module.
    • - -
    • The mod_mmap_static module, which was experimental in Apache 1.3 -has been replaced with mod_file_cache.
    • - - -
    - -

    Third Party Modules

    - -

    Extensive changes were made to the server API in Apache 2.0. -Existing modules designed for the Apache 1.3 API will not -work in Apache 2.0 without modification. Details to follow. - - - - diff --git a/docs/manual/upgrading.html.fr b/docs/manual/upgrading.html.fr deleted file mode 100644 index eb4a1bc6fa0fddb42f915a769fe48c80bedd459a..0000000000000000000000000000000000000000 --- a/docs/manual/upgrading.html.fr +++ /dev/null @@ -1,131 +0,0 @@ - - -Mise à jour de la version 1.3 à la version 2.0 - - - - - -

    Mise à de la version 1.3 à la version 2.0

    - -

    Afin d'aider les personnes souhaitant se mettre à jour, nous -maintenons un document décrivant les informations critiques concernant -les utilisateurs d'Apache. Ces informations sont sous la forme de brèves -notes, et vous pouvez trouver plus d'informations dans le document - Nouvelles fonctionnalités - ou dans le fichier src/CHANGES. - -

    Changement de la configuration à la compilation

    - -
      -
    • Apache utilise maintenant autoconf et libtool -afin de configurer la compilation. L'utilisation de ces outils est -similaire, mais pas tout à fait identique, au système APACI -de configuration existant dans la version 1.3 d'Apache. -
    • - -
    • En plus de l'habituelle sélection de modules que vous pouvez choisir -de compiler, Apache 2.0 a déplacé la majeure partie du traitement -des requêtes dans les modules multi-traitements (MPMs).
    • -
    - -

    Changement de la configuration à l'exécution

    - -
      -
    • La directive CacheNegotiatedDocs prend maintenant un -paramètre qui est soit on soit off. Les configurations -existantes utilisant la directive CacheNegotiatedDocs doivent -la remplacer par CacheNegotiatedDocs on.
    • - -
    • La directive ErrorDocument n'utilise plus de guillemets -ou d'apostrophes au début du paramètre indiquant le message. -Dorénavant, le message devra être entre guillemets. Par exemple, la -directive
      ErrorDocument 403 "Some Message
      -devra être remplacé par
      ErrorDocument 403 "Some -Message"
      Si le second argument n'est pas une URL ou un chemin -valide, il sera traité comme un message.
    • - -
    • Les directives AccessConfig et ResourceConfig -n'existent plus. Ces directives peuvent être remplacées de manière -équivalente par la directive -Include. -Si vous utilisiez ces directives en utilisant les valeurs par défaut sans -les définir explicitement, vous devez -ajouter les lignes Include conf/access.conf et -Include conf/srm.conf dans votre fichier httpd.conf. -Afin de garantir qu'Apache lit les différents fichiers de configuration -dans le même ordre que celui pour les anciennes directives, Les directives -Include doivent être situées à la fin du fichier -httpd.conf, celle représentant srm.conf avant celle pour -access.conf.
    • - -
    • La directive BindAddress n'existe plus. La même -fonctionnalité est fournie par la directive -Listen.
    • - -
    • La directive ExtendedStatus n'existe plus. -Le suivi des statuts a été entièrement réécrit -afin de bénéficier du nouveau système MPM.
    • - -
    • La directive ServerType n'existe plus. -La méthode utilisée pour servir les requêtes est -déterminée maintenant par la sélection d'un MPM. -Il n'existe pas actuellement de MPM conçu pour être lancé -par inetd.
    • - -
    • Beaucoup de directives qui étaient situées dans le noyau -du serveur pour la version 1.3 se trouvent maintenant dans les MPMs.
    • - -
    • Les modules mod_log_agent et mod_log_referer qui traitaient les directives -AgentLog, RefererLog et -RefererIgnore ont été supprimés. -Le traçage des agents et référants et toujours disponible -en utilisant la directive -CustomLog du module -mod_log_config.
    • - -
    - -

    Changements divers

    - -
      - -
    • Le redémarrage en douceur du serveur est maintenant traité en envoyant -au processus père le signal WINCH à la place du -signal USR1.
    • - -
    • L'option -S du programme httpd -qui servait à afficher la configuration des hôtes virtuels est -remplacé par -t -D DUMP_VHOSTS.
    • - -
    • L'option -X du programme httpd -est supprime. La majorité des MPM permettent la même fonctionnalité -en définissant les variables d'environnement ONE_PROCESS et -NO_DETACH avant de lancer httpd.
    • - -
    • Le module mod_auth_digest, qui était expérimental dans la version 1.3, -est maintenant un module standard.
    • - -
    • Le module mod_mmap_static, qui était expérimental dans la version 1.3 -a été remplacé par le module mod_file_cache.
    • - - -
    - -

    Modules tiers

    - -

    D'énormes changements ont été réalisés -sur l'API du serveur Apache 2.0. Les modules conçus à l'aide de -l'API Apache 1.3 ne fonctionneront pas sur Apache 2.0 sans -modifications. Plus de détails sont fournis dans la -documentation du développeur.

    - - - - diff --git a/docs/manual/urlmapping.html b/docs/manual/urlmapping.html deleted file mode 100755 index 47e48731629e46ad11de397135b79afb44395ff0..0000000000000000000000000000000000000000 --- a/docs/manual/urlmapping.html +++ /dev/null @@ -1,253 +0,0 @@ - - - -Mapping URLs to Filesystem Locations - Apache HTTP Server - - - - - -

    Mapping URLs to Filesystem Locations

    - -

    This document explains the method in which Apache determines -what filesystem location to serve a file from based on the -URL of a request.

    - - - -
    - - -
    -Related Modules

    - -mod_alias
    -mod_rewrite
    -mod_userdir
    -mod_speling
    -mod_vhost_alias
    - -
    -Related Directives

    - -Alias
    -AliasMatch
    -CheckSpelling
    -DocumentRoot
    -ErrorDocument
    -Options
    -Redirect
    -RedirectMatch
    -RewriteCond
    -RewriteRule
    -ScriptAlias
    -ScriptAliasMatch
    -UserDir
    - -
    - -

    DocumentRoot

    - -

    In deciding what file to serve for a given request, Apache's -default behavior is to take the URL-Path for the request (the part of -the URL following the first single slash) and add it to the end of the -DocumentRoot specified in -your configuration files. Therefore, the files and directories -underneath the DocumentRoot make up the basic document -tree which will be visible from the web.

    - -

    Apache is also capable of Virtual Hosting, -where the server receives requests for more than one host. In this -case, a different DocumentRoot can be specified for each -virtual host, or alternatively, the directives provided by the module -mod_vhost_alias can be used to -dynamically determine the appropriate place from which to serve -content based on the requested IP address or hostname.

    - -

    Files Outside the DocumentRoot

    - -

    There are frequently circumstances where it is necessary to allow -web access to parts of the filesystem which are not strictly -underneath the DocumentRoot. -Apache offers several different ways to accomplish this. On Unix -systems, symbolic links can be used to bring other parts of the -filesystem under the DocumentRoot. For security reasons, -symbolic links will only be followed if the Options setting for the relevant -directory includes FollowSymLinks or -SymLinksIfOwnerMatch.

    - -

    Alternatively, the Alias -directive can be used to map any part of the filesystem into the web -space. For example, with

    - -
    Alias /docs /var/web/ -
    - -

    the URL http://www.example.com/docs/dir/file.html will -be served from /var/web/dir/file.html. The ScriptAlias directive works -the same way, with the additional effect that all content located at -the target path is treated as CGI scripts.

    - -

    For situations where additional flexibility is required, the AliasMatch and ScriptAliasMatch -directives can do powerful regular-expression based matching and -substitution. For example,

    - -
    ScriptAliasMatch ^/~([^/]*)/cgi-bin/(.*) -/home/$1/cgi-bin/$2
    - -

    will map a request to -http://example.com/~user/cgi-bin/script.cgi to the path -/home/user/cgi-bin/script.cgi and will treat the -resulting file as a CGI script.

    - -

    User Directories

    - -

    Traditionally on Unix systems, the home directory of a particular -user can be referred to as ~user/. The module -mod_userdir extends this idea to -the web by allowing files under each user's home directory to be -accessed using URLs such as the following.

    - -
    http://www.example.com/~user/file.html
    - -

    For security reasons, it would be inappropriate to give direct -access to a user's home directory from the web. Therefore, the UserDir directive is used to -specify a directory underneath the user's home directory where web -files will be located. Using the default setting of Userdir -public_html, the above URL would look for a file at a directory -like /home/user/public_html/file.html where the -/home/user/ is the user's home directory as specified in -/etc/passwd.

    - -

    There are also several other forms of the Userdir -directive which can be used on systems where /etc/passwd -cannot be used to find the location of the home directory.

    - -

    Some people find the "~" symbol (which is often encoded on the web -as %7e) to be awkward and prefer to use an alternate -string to represent user directories. This functionality is not -supported by mod_userdir. However, if users' home directories are -structured in a regular way, then it is possible to use the AliasMatch directive to -achieve the desired effect. For example, to make -http://www.example.com/upages/user/file.html map to -/home/user/public_html/file.html, the following -AliasMatch directive can be used.

    - -
    -AliasMatch ^/upages/([^/]*)/?(.*) /home/$1/public_html/$2 -
    - -

    URL Redirection

    - -

    The configuration directives discussed in the above sections are -used to tell Apache to get content from a specific place in the -filesystem and return it to the client. Sometimes, it is desirable -instead to inform the client that the content being requested is -located at an different URL, and instruct the client to make a new -request with the new URL. This is referred to as redirection -and is implemented by the Redirect directive. For example, -if the contents of the directory /foo/ under the -DocumentRoot have been moved to the new directory -/bar/, clients can instructed to request the content at -the new location as follows.

    - -
    Redirect permanent -/foo/ http://www.example.com/bar/
    - -

    This will redirect any URL-Path starting in /foo/ to -the same URL path on the www.example.com server with -/bar/ substituted for /foo/. Note that -clients can be redirected to any server, not only the origin -server.

    - -

    Apache also provides a RedirectMatch directive -which can be used for more complicated rewriting problems. For -example, to redirect requests for the site home page to a different -site, but leave all other requests alone, the following configuration -can be used.

    - -
    -RedirectMatch permanent ^/$ http://www.example.com/startpage.html -
    - -

    Alternatively, to temporarily redirect all pages on a site to one -particular page, the following configuration is useful.

    - -
    -RedirectMatch temp .* http://www.example.com/startpage.html -
    - -

    Rewriting Engine

    - -

    When even more powerful substitution is required, the rewriting -engine provided by mod_rewrite can -be useful. The directives provided by this module can use -characteristics of the request such as browser type or source IP -address in deciding from where to serve content. In addition, -mod_rewrite can use external database files or programs to determine -how to handle a request. Many practical examples employing -mod_rewrite are discussed in the URL -Rewriting Guide.

    - -

    File Not Found

    - -

    Inevitably, URLs will be requested for which no matching file can -be found in the filesystem. This can happen for several reasons. In -some cases, it can be a result of moving documents from one location -to another. In this case, it is best to use URL -redirection to inform clients of the new location of the resource. -In this way, you can assure that old bookmarks and links will continue -to work, even though the resource is at a new location.

    - -

    Another common cause of "File Not Found" errors is accidental -mistyping of URLs, either directly in the browser, or in HTML links. -Apache provides the module mod_speling -(sic) to help with this problem. When this module is activated, it -will intercept "File Not Found" errors and look for a resource with a -similar filename. If one such file is found, mod_speling will send an -HTTP redirect to the client informing it of the correct location. If -several "close" files are found, a list of available alternatives will -be presented to the client.

    - -

    An especially useful feature of mod_speling, is that it will -compare filenames without respect to case. This can be useful for -systems where users are unaware of the case-sensitive nature of URLs -and the unix filesystem. However, using mod_speling for anything more -than the occasional URL correction can lead to additional load on the -server, since each "incorrect" request is followed by a URL -redirection and a new request from the client.

    - -

    If all attempts to locate the content fail, Apache returns an error -page with HTTP status code 404 (file not found). The appearance of -this page is controlled with the ErrorDocument directive and can -be customized in a flexible manner as discussed in the Custom error responses and International Server Error -Responses documents.

    - - - - diff --git a/docs/manual/urlmapping.html.en b/docs/manual/urlmapping.html.en deleted file mode 100755 index 47e48731629e46ad11de397135b79afb44395ff0..0000000000000000000000000000000000000000 --- a/docs/manual/urlmapping.html.en +++ /dev/null @@ -1,253 +0,0 @@ - - - -Mapping URLs to Filesystem Locations - Apache HTTP Server - - - - - -

    Mapping URLs to Filesystem Locations

    - -

    This document explains the method in which Apache determines -what filesystem location to serve a file from based on the -URL of a request.

    - - - -
    - - -
    -Related Modules

    - -mod_alias
    -mod_rewrite
    -mod_userdir
    -mod_speling
    -mod_vhost_alias
    - -
    -Related Directives

    - -Alias
    -AliasMatch
    -CheckSpelling
    -DocumentRoot
    -ErrorDocument
    -Options
    -Redirect
    -RedirectMatch
    -RewriteCond
    -RewriteRule
    -ScriptAlias
    -ScriptAliasMatch
    -UserDir
    - -
    - -

    DocumentRoot

    - -

    In deciding what file to serve for a given request, Apache's -default behavior is to take the URL-Path for the request (the part of -the URL following the first single slash) and add it to the end of the -DocumentRoot specified in -your configuration files. Therefore, the files and directories -underneath the DocumentRoot make up the basic document -tree which will be visible from the web.

    - -

    Apache is also capable of Virtual Hosting, -where the server receives requests for more than one host. In this -case, a different DocumentRoot can be specified for each -virtual host, or alternatively, the directives provided by the module -mod_vhost_alias can be used to -dynamically determine the appropriate place from which to serve -content based on the requested IP address or hostname.

    - -

    Files Outside the DocumentRoot

    - -

    There are frequently circumstances where it is necessary to allow -web access to parts of the filesystem which are not strictly -underneath the DocumentRoot. -Apache offers several different ways to accomplish this. On Unix -systems, symbolic links can be used to bring other parts of the -filesystem under the DocumentRoot. For security reasons, -symbolic links will only be followed if the Options setting for the relevant -directory includes FollowSymLinks or -SymLinksIfOwnerMatch.

    - -

    Alternatively, the Alias -directive can be used to map any part of the filesystem into the web -space. For example, with

    - -
    Alias /docs /var/web/ -
    - -

    the URL http://www.example.com/docs/dir/file.html will -be served from /var/web/dir/file.html. The ScriptAlias directive works -the same way, with the additional effect that all content located at -the target path is treated as CGI scripts.

    - -

    For situations where additional flexibility is required, the AliasMatch and ScriptAliasMatch -directives can do powerful regular-expression based matching and -substitution. For example,

    - -
    ScriptAliasMatch ^/~([^/]*)/cgi-bin/(.*) -/home/$1/cgi-bin/$2
    - -

    will map a request to -http://example.com/~user/cgi-bin/script.cgi to the path -/home/user/cgi-bin/script.cgi and will treat the -resulting file as a CGI script.

    - -

    User Directories

    - -

    Traditionally on Unix systems, the home directory of a particular -user can be referred to as ~user/. The module -mod_userdir extends this idea to -the web by allowing files under each user's home directory to be -accessed using URLs such as the following.

    - -
    http://www.example.com/~user/file.html
    - -

    For security reasons, it would be inappropriate to give direct -access to a user's home directory from the web. Therefore, the UserDir directive is used to -specify a directory underneath the user's home directory where web -files will be located. Using the default setting of Userdir -public_html, the above URL would look for a file at a directory -like /home/user/public_html/file.html where the -/home/user/ is the user's home directory as specified in -/etc/passwd.

    - -

    There are also several other forms of the Userdir -directive which can be used on systems where /etc/passwd -cannot be used to find the location of the home directory.

    - -

    Some people find the "~" symbol (which is often encoded on the web -as %7e) to be awkward and prefer to use an alternate -string to represent user directories. This functionality is not -supported by mod_userdir. However, if users' home directories are -structured in a regular way, then it is possible to use the AliasMatch directive to -achieve the desired effect. For example, to make -http://www.example.com/upages/user/file.html map to -/home/user/public_html/file.html, the following -AliasMatch directive can be used.

    - -
    -AliasMatch ^/upages/([^/]*)/?(.*) /home/$1/public_html/$2 -
    - -

    URL Redirection

    - -

    The configuration directives discussed in the above sections are -used to tell Apache to get content from a specific place in the -filesystem and return it to the client. Sometimes, it is desirable -instead to inform the client that the content being requested is -located at an different URL, and instruct the client to make a new -request with the new URL. This is referred to as redirection -and is implemented by the Redirect directive. For example, -if the contents of the directory /foo/ under the -DocumentRoot have been moved to the new directory -/bar/, clients can instructed to request the content at -the new location as follows.

    - -
    Redirect permanent -/foo/ http://www.example.com/bar/
    - -

    This will redirect any URL-Path starting in /foo/ to -the same URL path on the www.example.com server with -/bar/ substituted for /foo/. Note that -clients can be redirected to any server, not only the origin -server.

    - -

    Apache also provides a RedirectMatch directive -which can be used for more complicated rewriting problems. For -example, to redirect requests for the site home page to a different -site, but leave all other requests alone, the following configuration -can be used.

    - -
    -RedirectMatch permanent ^/$ http://www.example.com/startpage.html -
    - -

    Alternatively, to temporarily redirect all pages on a site to one -particular page, the following configuration is useful.

    - -
    -RedirectMatch temp .* http://www.example.com/startpage.html -
    - -

    Rewriting Engine

    - -

    When even more powerful substitution is required, the rewriting -engine provided by mod_rewrite can -be useful. The directives provided by this module can use -characteristics of the request such as browser type or source IP -address in deciding from where to serve content. In addition, -mod_rewrite can use external database files or programs to determine -how to handle a request. Many practical examples employing -mod_rewrite are discussed in the URL -Rewriting Guide.

    - -

    File Not Found

    - -

    Inevitably, URLs will be requested for which no matching file can -be found in the filesystem. This can happen for several reasons. In -some cases, it can be a result of moving documents from one location -to another. In this case, it is best to use URL -redirection to inform clients of the new location of the resource. -In this way, you can assure that old bookmarks and links will continue -to work, even though the resource is at a new location.

    - -

    Another common cause of "File Not Found" errors is accidental -mistyping of URLs, either directly in the browser, or in HTML links. -Apache provides the module mod_speling -(sic) to help with this problem. When this module is activated, it -will intercept "File Not Found" errors and look for a resource with a -similar filename. If one such file is found, mod_speling will send an -HTTP redirect to the client informing it of the correct location. If -several "close" files are found, a list of available alternatives will -be presented to the client.

    - -

    An especially useful feature of mod_speling, is that it will -compare filenames without respect to case. This can be useful for -systems where users are unaware of the case-sensitive nature of URLs -and the unix filesystem. However, using mod_speling for anything more -than the occasional URL correction can lead to additional load on the -server, since each "incorrect" request is followed by a URL -redirection and a new request from the client.

    - -

    If all attempts to locate the content fail, Apache returns an error -page with HTTP status code 404 (file not found). The appearance of -this page is controlled with the ErrorDocument directive and can -be customized in a flexible manner as discussed in the Custom error responses and International Server Error -Responses documents.

    - - - - diff --git a/docs/manual/vhosts/details.html b/docs/manual/vhosts/details.html deleted file mode 100644 index 0e992170c379962a58c11738528f1cea17f8e908..0000000000000000000000000000000000000000 --- a/docs/manual/vhosts/details.html +++ /dev/null @@ -1,367 +0,0 @@ - - -An In-Depth Discussion of Virtual Host Matching - - - - - -

    An In-Depth Discussion of Virtual Host Matching

    - -

    The virtual host code was completely rewritten in Apache 1.3. -This document attempts to explain exactly what Apache does when -deciding what virtual host to serve a hit from. With the help of the -new NameVirtualHost -directive virtual host configuration should be a lot easier and safer -than with versions prior to 1.3. - -

    If you just want to make it work without understanding -how, here are some examples. - -

    Config File Parsing

    - -

    There is a main_server which consists of all -the definitions appearing outside of <VirtualHost> sections. -There are virtual servers, called vhosts, which are defined by -<VirtualHost> -sections. - -

    The directives -Port, -ServerName, -ServerPath, -and -ServerAlias -can appear anywhere within the definition of -a server. However, each appearance overrides the previous appearance -(within that server). - -

    The default value of the Port field for main_server -is 80. The main_server has no default ServerPath, or -ServerAlias. The default ServerName is -deduced from the servers IP address. - -

    The main_server Port directive has two functions due to legacy -compatibility with NCSA configuration files. One function is -to determine the default network port Apache will bind to. This -default is overridden by the existence of any -Listen directives. -The second function is to specify the port number which is used -in absolute URIs during redirects. - -

    Unlike the main_server, vhost ports do not affect what -ports Apache listens for connections on. - -

    Each address appearing in the VirtualHost directive -can have an optional port. If the port is unspecified it defaults to -the value of the main_server's most recent Port statement. -The special port * indicates a wildcard that matches any port. -Collectively the entire set of addresses (including multiple -A record -results from DNS lookups) are called the vhost's address set. - -

    Unless a NameVirtualHost -directive is used for a specific IP address the first vhost with -that address is treated as an IP-based vhost. - -

    If name-based vhosts should be used a NameVirtualHost -directive must appear with the IP address set to be used for the -name-based vhosts. In other words, you must specify the IP address that -holds the hostname aliases (CNAMEs) for your name-based vhosts via a -NameVirtualHost directive in your configuration file. - -

    Multiple NameVirtualHost directives can be used each -with a set of VirtualHost directives. - -

    The ordering of NameVirtualHost and -VirtualHost directives is not important which makes the -following two examples identical (only the order of the -VirtualHost directives for one address set -is important, see below): - -

    -                                |
    -  NameVirtualHost 111.22.33.44  | <VirtualHost 111.22.33.44>
    -  <VirtualHost 111.22.33.44>    | # server A
    -  # server A  		        | </VirtualHost>
    -  ... 			        | <VirtualHost 111.22.33.55>
    -  </VirtualHost>	        | # server C
    -  <VirtualHost 111.22.33.44>    | ...
    -  # server B  		        | </VirtualHost>
    -  ... 			        | <VirtualHost 111.22.33.44>
    -  </VirtualHost>	        | # server B
    -                                | ...
    -  NameVirtualHost 111.22.33.55  | </VirtualHost>
    -  <VirtualHost 111.22.33.55>    | <VirtualHost 111.22.33.55>
    -  # server C  		        | # server D
    -  ... 			        | ...
    -  </VirtualHost>	        | </VirtualHost>
    -  <VirtualHost 111.22.33.55>    |
    -  # server D  		        | NameVirtualHost 111.22.33.44
    -  ... 			        | NameVirtualHost 111.22.33.55
    -  </VirtualHost>	        |
    -                                |
    -
    - -

    (To aid the readability of your configuration you should prefer the -left variant.) - -

    After parsing the VirtualHost directive, the vhost server -is given a default Port equal to the port assigned to the -first name in its VirtualHost directive. - -

    The complete list of names in the VirtualHost directive -are treated just like a ServerAlias (but are not overridden by any -ServerAlias statement) if all names resolve to the same address set. -Note that subsequent Port statements for this vhost will not affect -the ports assigned in the address set. - -

    During initialization a list for each IP address -is generated an inserted into an hash table. If the IP address is -used in a NameVirtualHost directive the list contains -all name-based vhosts for the given IP address. If there are no -vhosts defined for that address the NameVirtualHost directive -is ignored and an error is logged. For an IP-based vhost the list in the -hash table is empty. - -

    Due to a fast hashing function the overhead of hashing an IP address -during a request is minimal and almost not existent. Additionally -the table is optimized for IP addresses which vary in the last octet. - -

    For every vhost various default values are set. In particular: - -

      -
    1. If a vhost has no - ServerAdmin, - ResourceConfig, - AccessConfig, - Timeout, - KeepAliveTimeout, - KeepAlive, - MaxKeepAliveRequests, - or - SendBufferSize - directive then the respective value is - inherited from the main_server. (That is, inherited from whatever - the final setting of that value is in the main_server.) - -
    2. The "lookup defaults" that define the default directory - permissions - for a vhost are merged with those of the main_server. This includes - any per-directory configuration information for any module. - -
    3. The per-server configs for each module from the main_server are - merged into the vhost server. -
    - -Essentially, the main_server is treated as "defaults" or a -"base" on which to build each vhost. -But the positioning of these main_server -definitions in the config file is largely irrelevant -- the entire -config of the main_server has been parsed when this final merging occurs. -So even if a main_server definition appears after a vhost definition -it might affect the vhost definition. - -

    If the main_server has no ServerName at this point, -then the hostname of the machine that httpd is running on is used -instead. We will call the main_server address set those IP -addresses returned by a DNS lookup on the ServerName of -the main_server. - -

    For any undefined ServerName fields, a name-based vhost -defaults to the address given first in the VirtualHost -statement defining the vhost. - -

    Any vhost that includes the magic _default_ wildcard -is given the same ServerName as the main_server. - - -

    Virtual Host Matching

    - -

    The server determines which vhost to use for a request as follows: - -

    Hash table lookup

    - -

    When the connection is first made by a client, the IP address to -which the client connected is looked up in the internal IP hash table. - -

    If the lookup fails (the IP address wasn't found) the request is -served from the _default_ vhost if there is such a vhost -for the port to which the client sent the request. If there is no -matching _default_ vhost the request is served from the -main_server. - -

    If the lookup succeeded (a corresponding list for the IP address was -found) the next step is to decide if we have to deal with an IP-based -or a name-base vhost. - -

    IP-based vhost

    - -

    If the entry we found has an empty name list then we have found an -IP-based vhost, no further actions are performed and the request is -served from that vhost. - -

    Name-based vhost

    - -

    If the entry corresponds to a name-based vhost the name list contains -one or more vhost structures. This list contains the vhosts in the same -order as the VirtualHost directives appear in the config -file. - -

    The first vhost on this list (the first vhost that appears after the -corresponding NameVirtualHost directive in the config file) -has the highest priority and catches any request to an unknown -server name or a request without a Host: header. - -

    If the client provided a Host: header the list is -searched for a matching vhost and the first hit on a ServerName -or ServerAlias is taken and the request is served from -that vhost. A Host: header can contain a port number, but -Apache always matches against the real port to which the client sent -the request. - -

    If the client submitted a HTTP/1.0 request without Host: -header we don't know to what server the client tried to connect and -any existing ServerPath is matched against the URI -from the request. The first matching path on the list is used and the -request is served from that vhost. - -

    If no matching vhost could be found the request is served from the -first vhost with a matching port number that is on the list for the IP -to which the client connected (as already mentioned before). - -

    Persistent connections

    -The IP lookup described above is only done once for a particular -TCP/IP session while the name lookup is done on every request -during a KeepAlive/persistent connection. In other words a client may -request pages from different name-based vhosts during a single -persistent connection. - - -

    Absolute URI

    - -

    If the URI from the request is an absolute URI, and its hostname and -port match the main server or one of the configured virtual hosts -and match the address and port to which the client sent the request, -then the scheme/hostname/port prefix is stripped off and the remaining -relative URI is served by the corresponding main server or virtual host. -If it does not match, then the URI remains untouched and the request is -taken to be a proxy request. - - -

    Observations

    - -
      - -
    • A name-based vhost can never interfere with an IP-base vhost and - vice versa. IP-based vhosts can only be reached through an IP address - of its own address set and never through any other address. - The same applies to name-based vhosts, they can only be reached - through an IP address of the corresponding address set which must - be defined with a NameVirtualHost directive. -

      - -

    • ServerAlias and ServerPath checks are never - performed for an IP-based vhost. -

      - -

    • The order of name-/IP-based, the _default_ - vhost and the NameVirtualHost directive within the config - file is not important. Only the ordering - of name-based vhosts for a specific address set is significant. The one - name-based vhosts that comes first in the configuration file has - the highest priority for its corresponding address set. -

      - -

    • For security reasons the port number given in a Host: - header is never used during the matching process. Apache always - uses the real port to which the client sent the request. -

      - -

    • If a ServerPath directive exists which is a prefix of - another ServerPath directive that appears later in - the configuration file, then the former will always be matched - and the latter will never be matched. (That is assuming that no - Host header was available to disambiguate the two.) -

      - -

    • If two IP-based vhosts have an address in common, the vhost appearing - first in the config file is always matched. Such a thing might happen - inadvertently. The server will give a warning in the error - logfile when it detects this. -

      - -

    • A _default_ vhost catches a request only if there is no - other vhost with a matching IP address and a matching port - number for the request. The request is only catched if the port number - to which the client sent the request matches the port number of your - _default_ vhost which is your standard Port - by default. A wildcard port can be specified (i.e. - _default_:*) to catch requests to any available port. -

      - -

    • The main_server is only used to serve a request if the IP address - and port number to which the client connected is unspecified - and does not match any other vhost (including a _default_ - vhost). In other words the main_server only catches a request for an - unspecified address/port combination (unless there is a _default_ - vhost which matches that port). -

      - -

    • A _default_ vhost or the main_server is never - matched for a request with an unknown or missing Host: header - if the client connected to an address (and port) which is used - for name-based vhosts, e.g. in a NameVirtualHost directive. -

      - -

    • You should never specify DNS names in VirtualHost - directives because it will force your server to rely on DNS to boot. - Furthermore it poses a security threat if you do not control the - DNS for all the domains listed. - There's more information - available on this and the next two topics. -

      - -

    • ServerName should always be set for each vhost. Otherwise - A DNS lookup is required for each vhost. -

      - -

    - -

    Tips

    - -

    In addition to the tips on the DNS -Issues page, here are some further tips: - -

      - -
    • Place all main_server definitions before any VirtualHost - definitions. (This is to aid the readability of the configuration -- - the post-config merging process makes it non-obvious that definitions - mixed in around virtual hosts might affect all virtual hosts.) -

      - -

    • Group corresponding NameVirtualHost and - VirtualHost definitions in your configuration to ensure - better readability. -

      - -

    • Avoid ServerPaths which are prefixes of other - ServerPaths. If you cannot avoid this then you have to - ensure that the longer (more specific) prefix vhost appears earlier in - the configuration file than the shorter (less specific) prefix - (i.e., "ServerPath /abc" should appear after - "ServerPath /abc/def"). -

      - -

    - - - - diff --git a/docs/manual/vhosts/examples.html b/docs/manual/vhosts/examples.html deleted file mode 100644 index c537f06dbb08b4d46fcdb3f730613b9d835e2e6b..0000000000000000000000000000000000000000 --- a/docs/manual/vhosts/examples.html +++ /dev/null @@ -1,512 +0,0 @@ - - -VirtualHost Examples - - - - - -

    Virtual Host examples for common setups

    - - -

    Base configuration

    - - - -

    Additional features

    - - - -
    - -

    IP-based vhosts only

    - -
      - -
    • Setup 1: - The server machine has two IP addresses (111.22.33.44 - and 111.22.33.55) - which resolve to the names server.domain.tld and - www.otherdomain.tld respectively. - The hostname www.domain.tld is an alias (CNAME) - for server.domain.tld and will represent the - main server. -

      - Server configuration: - - -

      -    ...
      -    Port 80
      -    DocumentRoot /www/domain
      -    ServerName www.domain.tld
      -
      -    <VirtualHost 111.22.33.55>
      -    DocumentRoot /www/otherdomain
      -    ServerName www.otherdomain.tld
      -    ...
      -    </VirtualHost>
      -    
      - www.otherdomain.tld can only be reached through the - address 111.22.33.55, while www.domain.tld - can only be reached through 111.22.33.44 - (which represents our main server). -
      -

      - -

    • Setup 2: - Same as setup 1, but we don't want to have a dedicated main server. -

      - Server configuration: - -

      -    ...
      -    Port 80
      -    ServerName server.domain.tld
      -    
      -    <VirtualHost 111.22.33.44>
      -    DocumentRoot /www/domain
      -    ServerName www.domain.tld
      -    ...
      -    </VirtualHost>
      -
      -    <VirtualHost 111.22.33.55>
      -    DocumentRoot /www/otherdomain
      -    ServerName www.otherdomain.tld
      -    ...
      -    </VirtualHost>
      -    
      - The main server can never catch a request, because all IP address - of our machine are in use for IP-based virtual hosts - (only localhost requests can hit the main server). -
      -

      - -

    • Setup 3: - The server machine has two IP addresses (111.22.33.44 - and 111.22.33.55) - which resolve to the names server.domain.tld and - www-cache.domain.tld respectively. - The hostname www.domain.tld is an alias (CNAME) - for server.domain.tld and will represent the - main server. - www-cache.domain.tld will become our proxy-cache - listening on port 8080, while the web server itself uses the default - port 80. -

      - Server configuration: - -

      -    ...
      -    Port 80
      -    Listen 111.22.33.44:80
      -    Listen 111.22.33.55:8080
      -    ServerName server.domain.tld
      -    
      -    <VirtualHost 111.22.33.44:80>
      -    DocumentRoot /www/domain
      -    ServerName www.domain.tld
      -    ...
      -    </VirtualHost>
      -
      -    <VirtualHost 111.22.33.55:8080>
      -    ServerName www-cache.domain.tld
      -    ...
      -      <Directory proxy:>
      -      order deny,allow
      -      deny from all
      -      allow from 111.22.33
      -      </Directory>
      -    </VirtualHost>
      -    
      - The main server can never catch a request, because all IP addresss - (apart from localhost) of our machine are in use for IP-based - virtual hosts. The web server can only be reached on the first address - through port 80 and the proxy only on the second address through port 8080. -
      -
    -
    - -

    Name-based vhosts only

    - -
      - -
    • Setup 1: - The server machine has one IP address (111.22.33.44) - which resolves to the name server.domain.tld. - There are two aliases (CNAMEs) www.domain.tld and - www.sub.domain.tld for the address 111.22.33.44. -

      - Server configuration: - -

      -    ...
      -    Port 80
      -    ServerName server.domain.tld
      -
      -    NameVirtualHost 111.22.33.44 
      -
      -    <VirtualHost 111.22.33.44>
      -    DocumentRoot /www/domain
      -    ServerName www.domain.tld
      -    ...
      -    </VirtualHost>
      -    
      -    <VirtualHost 111.22.33.44>
      -    DocumentRoot /www/subdomain
      -    ServerName www.sub.domain.tld
      -    ...
      -    </VirtualHost> 
      -    
      - Apart from localhost there are no unspecified - addresses/ports, therefore the main server only serves - localhost requests. Due to the fact - that www.domain.tld has the highest priority - it can be seen as the default or - primary server. -
      -

      - -

    • Setup 2: - The server machine has two IP addresses (111.22.33.44 - and 111.22.33.55) - which resolve to the names server1.domain.tld and - server2.domain.tld respectively. - The alias www.domain.tld should be used for the - main server which should also catch any unspecified addresses. - We want to use a virtual host for the alias - www.otherdomain.tld and one virtual host should - catch any request to hostnames of the form - *.sub.domain.tld with www.sub.domain.tld - as its server name. The address 111.22.33.55 should be - used for the virtual hosts. -

      - Server configuration: - -

      -    ...
      -    Port 80
      -    ServerName www.domain.tld
      -    DocumentRoot /www/domain
      -
      -    NameVirtualHost 111.22.33.55
      -
      -    <VirtualHost 111.22.33.55>
      -    DocumentRoot /www/otherdomain
      -    ServerName www.otherdomain.tld
      -    ...
      -    </VirtualHost>
      -   
      -    <VirtualHost 111.22.33.55>
      -    DocumentRoot /www/subdomain
      -    ServerName www.sub.domain.tld
      -    ServerAlias *.sub.domain.tld
      -    ...
      -    </VirtualHost> 
      -    
      - Any request to an address other than 111.22.33.55 - will be served from the main server. A request to - 111.22.33.55 with an unknown or no Host: - header will be served from www.otherdomain.tld. -
      -
    - -
    - -

    Mixed name-/IP-based vhosts

    - -
      - -
    • Setup: - The server machine has three IP addresses (111.22.33.44, - 111.22.33.55 and 111.22.33.66) - which resolve to the names server.domain.tld, - www.otherdomain1.tld and www.otherdomain2.tld - respectively. - The address 111.22.33.44 should we used for a couple - of name-based vhosts and the other addresses for IP-based vhosts. -

      - Server configuration: - -

      -    ...
      -    Port 80
      -    ServerName server.domain.tld
      -
      -    NameVirtualHost 111.22.33.44
      -
      -    <VirtualHost 111.22.33.44>
      -    DocumentRoot /www/domain
      -    ServerName www.domain.tld
      -    ...
      -    </VirtualHost>
      -   
      -    <VirtualHost 111.22.33.44>
      -    DocumentRoot /www/subdomain1
      -    ServerName www.sub1.domain.tld
      -    ...
      -    </VirtualHost> 
      -    
      -    <VirtualHost 111.22.33.44>
      -    DocumentRoot /www/subdomain2
      -    ServerName www.sub2.domain.tld
      -    ...
      -    </VirtualHost> 
      - 
      -    <VirtualHost 111.22.33.55>
      -    DocumentRoot /www/otherdomain1
      -    ServerName www.otherdomain1.tld
      -    ...
      -    </VirtualHost> 
      -    
      -    <VirtualHost 111.22.33.66>
      -    DocumentRoot /www/otherdomain2
      -    ServerName www.otherdomain2.tld
      -    ...
      -    </VirtualHost>     
      -    
      - -
    - -
    - -

    Port-based vhosts

    - -
      - -
    • Setup: - The server machine has one IP address (111.22.33.44) - which resolves to the name www.domain.tld. - If we don't have the option to get another address or alias - for our server we can use port-based vhosts if we need - a virtual host with a different configuration. -

      - Server configuration: - -

      -    ...
      -    Listen 80
      -    Listen 8080
      -    ServerName www.domain.tld
      -    DocumentRoot /www/domain
      -
      -    <VirtualHost 111.22.33.44:8080>
      -    DocumentRoot /www/domain2
      -    ...
      -    </VirtualHost>
      -    
      - A request to www.domain.tld on port 80 is served - from the main server and a request to port 8080 is served from - the virtual host. -
      -
    - -
    - -

    Using _default_ vhosts

    - -
      - -
    • Setup 1: - Catching every request to any unspecified IP address and port, - i.e. an address/port combination that is not used for any other - virtual host. -

      - Server configuration: - -

      -    ...
      -    <VirtualHost _default_:*>
      -    DocumentRoot /www/default
      -    ...
      -    </VirtualHost>
      -    
      - Using such a default vhost with a wildcard port effectively - prevents any request going to the main server.
      - A default vhost never serves a request that was sent to an - address/port that is used for name-based vhosts. If the request - contained an unknown or no Host: header it is - always served from the primary name-based vhost (the - vhost for that address/port appearing first in the configuration - file).
      - You can use - AliasMatch - or - RewriteRule - to rewrite any request to a single information page (or script). -
      -

      - -

    • Setup 2: - Same as setup 1, but the server listens on several ports and - we want to use a second _default_ vhost for port 80. -

      - Server configuration: - -

      -    ...
      -    <VirtualHost _default_:80>
      -    DocumentRoot /www/default80
      -    ...
      -    </VirtualHost>
      -    
      -    <VirtualHost _default_:*>
      -    DocumentRoot /www/default
      -    ...
      -    </VirtualHost>    
      -    
      - The default vhost for port 80 (which must appear before - any default vhost with a wildcard port) catches all requests that - were sent to an unspecified IP address. The main server is - never used to serve a request. -
      -

      - -

    • Setup 3: - We want to have a default vhost for port 80, but no other default vhosts. -

      - Server configuration: - -

      -    ...
      -    <VirtualHost _default_:80>
      -    DocumentRoot /www/default
      -    ...
      -    </VirtualHost>
      -    
      - A request to an unspecified address on port 80 is served from the - default vhost any other request to an unspecified address and port - is served from the main server. -
      - -
    - -
    - -

    Migrating a name-based vhost to an IP-based vhost

    - -
      - -
    • Setup: - The name-based vhost with the hostname - www.otherdomain.tld (from our name-based - example, setup 2) should get its own IP address. - To avoid problems with name servers or proxies who cached the old - IP address for the name-based vhost we want to provide both variants - during a migration phase.
      - The solution is easy, because we can simply add the new IP address - (111.22.33.66) to the VirtualHost directive. -

      - Server configuration: - -

      -    ...
      -    Port 80
      -    ServerName www.domain.tld
      -    DocumentRoot /www/domain
      -
      -    NameVirtualHost 111.22.33.55
      -
      -    <VirtualHost 111.22.33.55 111.22.33.66>
      -    DocumentRoot /www/otherdomain
      -    ServerName www.otherdomain.tld
      -    ...
      -    </VirtualHost>
      -   
      -    <VirtualHost 111.22.33.55>
      -    DocumentRoot /www/subdomain
      -    ServerName www.sub.domain.tld
      -    ServerAlias *.sub.domain.tld
      -    ...
      -    </VirtualHost>
      -    
      - The vhost can now be accessed through the new address (as an IP-based - vhost) and through the old address (as a name-based vhost). -
      - -
    - -
    - -

    Using the ServerPath directive

    - -
      - -
    • Setup: - We have a server with two name-based vhosts. In order to match the correct - virtual host a client must send the correct Host: header. - Old HTTP/1.0 clients do not send such a header and Apache has no clue - what vhost the client tried to reach (and serves the request from - the primary vhost). To provide as much backward compatibility - as possible we create a primary vhost which returns a single page - containing links with an URL prefix to the name-based virtual hosts. -

      - Server configuration: - -

      -    ...
      -    NameVirtualHost 111.22.33.44
      -
      -    <VirtualHost 111.22.33.44>
      -    # primary vhost
      -    DocumentRoot /www/subdomain
      -    RewriteEngine On
      -    RewriteRule ^/.* /www/subdomain/index.html
      -    ...
      -    </VirtualHost>
      -
      -    <VirtualHost 111.22.33.44>
      -    DocumentRoot /www/subdomain/sub1
      -    ServerName www.sub1.domain.tld
      -    ServerPath /sub1/
      -    RewriteEngine On
      -    RewriteRule ^(/sub1/.*) /www/subdomain$1 
      -    ...
      -    </VirtualHost>
      -
      -    <VirtualHost 111.22.33.44>
      -    DocumentRoot /www/subdomain/sub2
      -    ServerName www.sub2.domain.tld
      -    ServerPath /sub2/
      -    RewriteEngine On
      -    RewriteRule ^(/sub2/.*) /www/subdomain$1 
      -    ...
      -    </VirtualHost>
      -    
      - Due to the ServerPath - directive a request to the - URL http://www.sub1.domain.tld/sub1/ is always - served from the sub1-vhost.
      - A request to the URL http://www.sub1.domain.tld/ - is only served from the sub1-vhost if the client sent a correct - Host: header. - If no Host: header is sent the client gets the - information page from the primary host.
      - Please note that there is one oddity: A request to - http://www.sub2.domain.tld/sub1/ is also served from - the sub1-vhost if the client sent no Host: header.
      - The RewriteRule directives are used to make sure that - a client which sent a correct Host: header can use - both URL variants, i.e. with or without URL prefix. -
      - -
    - - - - diff --git a/docs/manual/vhosts/fd-limits.html b/docs/manual/vhosts/fd-limits.html deleted file mode 100644 index 77f4d8254d9b4db7789b590cced728fa213442b8..0000000000000000000000000000000000000000 --- a/docs/manual/vhosts/fd-limits.html +++ /dev/null @@ -1,59 +0,0 @@ - - - -Apache Server Virtual Host Support - - - - - -

    File Descriptor Limits

    - -

    -When using a large number of Virtual Hosts, Apache may run out of available -file descriptors (sometimes called file handles if each Virtual -Host specifies different log files. -The total number of file descriptors used by Apache is one for each distinct -error log file, one for every other log file directive, plus 10-20 for -internal use. Unix operating systems limit the number of file descriptors that -may be used by a process; the limit is typically 64, and may usually be -increased up to a large hard-limit. -

    -Although Apache attempts to increase the limit as required, this -may not work if: -

      -
    1. Your system does not provide the setrlimit() system call. -
    2. The setrlimit(RLIMIT_NOFILE) call does not function on your system - (such as Solaris 2.3) -
    3. The number of file descriptors required exceeds the hard limit. -
    4. Your system imposes other limits on file descriptors, such as a limit -on stdio streams only using file descriptors below 256. (Solaris 2) -
    - -In the event of problems you can: -
      -
    • Reduce the number of log files; don't specify log files in the VirtualHost -sections, but only log to the main log files. -
    • If you system falls into 1 or 2 (above), then increase the file descriptor -limit before starting Apache, using a script like -
      -#!/bin/sh
      -ulimit -S -n 100
      -exec httpd
      -
    -

    -Please see the -Descriptors and Apache -document containing further details about file descriptor problems and how -they can be solved on your operating system. -

    - - - - diff --git a/docs/manual/vhosts/fd-limits.html.en b/docs/manual/vhosts/fd-limits.html.en deleted file mode 100644 index 77f4d8254d9b4db7789b590cced728fa213442b8..0000000000000000000000000000000000000000 --- a/docs/manual/vhosts/fd-limits.html.en +++ /dev/null @@ -1,59 +0,0 @@ - - - -Apache Server Virtual Host Support - - - - - -

    File Descriptor Limits

    - -

    -When using a large number of Virtual Hosts, Apache may run out of available -file descriptors (sometimes called file handles if each Virtual -Host specifies different log files. -The total number of file descriptors used by Apache is one for each distinct -error log file, one for every other log file directive, plus 10-20 for -internal use. Unix operating systems limit the number of file descriptors that -may be used by a process; the limit is typically 64, and may usually be -increased up to a large hard-limit. -

    -Although Apache attempts to increase the limit as required, this -may not work if: -

      -
    1. Your system does not provide the setrlimit() system call. -
    2. The setrlimit(RLIMIT_NOFILE) call does not function on your system - (such as Solaris 2.3) -
    3. The number of file descriptors required exceeds the hard limit. -
    4. Your system imposes other limits on file descriptors, such as a limit -on stdio streams only using file descriptors below 256. (Solaris 2) -
    - -In the event of problems you can: -
      -
    • Reduce the number of log files; don't specify log files in the VirtualHost -sections, but only log to the main log files. -
    • If you system falls into 1 or 2 (above), then increase the file descriptor -limit before starting Apache, using a script like -
      -#!/bin/sh
      -ulimit -S -n 100
      -exec httpd
      -
    -

    -Please see the -Descriptors and Apache -document containing further details about file descriptor problems and how -they can be solved on your operating system. -

    - - - - diff --git a/docs/manual/vhosts/index.html b/docs/manual/vhosts/index.html deleted file mode 100644 index 0b1a22678ee50fd75541f57faca334a599ca579c..0000000000000000000000000000000000000000 --- a/docs/manual/vhosts/index.html +++ /dev/null @@ -1,58 +0,0 @@ - - - -Apache Virtual Host documentation - - - - - -

    Apache Virtual Host documentation

    - -

    The term Virtual Host refers to the practice of maintaining -more than one server on one machine, as differentiated by their apparent -hostname. For example, it is often desirable for companies sharing a -web server to have their own domains, with web servers accessible as -www.company1.com and www.company2.com, -without requiring the user to know any extra path information.

    - -

    Apache was one of the first servers to support IP-based -virtual hosts right out of the box. Versions 1.1 and later of -Apache support both, IP-based and name-based virtual hosts (vhosts). -The latter variant of virtual hosts is sometimes also called host-based or -non-IP virtual hosts.

    - -

    Below is a list of documentation pages which explain all details -of virtual host support in Apache version 1.3 and later.

    - -
    - -

    Virtual Host Support

    - - - -

    Configuration directives

    - - - - - - diff --git a/docs/manual/vhosts/index.html.en b/docs/manual/vhosts/index.html.en deleted file mode 100644 index 0b1a22678ee50fd75541f57faca334a599ca579c..0000000000000000000000000000000000000000 --- a/docs/manual/vhosts/index.html.en +++ /dev/null @@ -1,58 +0,0 @@ - - - -Apache Virtual Host documentation - - - - - -

    Apache Virtual Host documentation

    - -

    The term Virtual Host refers to the practice of maintaining -more than one server on one machine, as differentiated by their apparent -hostname. For example, it is often desirable for companies sharing a -web server to have their own domains, with web servers accessible as -www.company1.com and www.company2.com, -without requiring the user to know any extra path information.

    - -

    Apache was one of the first servers to support IP-based -virtual hosts right out of the box. Versions 1.1 and later of -Apache support both, IP-based and name-based virtual hosts (vhosts). -The latter variant of virtual hosts is sometimes also called host-based or -non-IP virtual hosts.

    - -

    Below is a list of documentation pages which explain all details -of virtual host support in Apache version 1.3 and later.

    - -
    - -

    Virtual Host Support

    - - - -

    Configuration directives

    - - - - - - diff --git a/docs/manual/vhosts/ip-based.html b/docs/manual/vhosts/ip-based.html deleted file mode 100644 index e1cc14ff056866ece1fc1fd22ba5ac4dbdb0ccb4..0000000000000000000000000000000000000000 --- a/docs/manual/vhosts/ip-based.html +++ /dev/null @@ -1,129 +0,0 @@ - - - -Apache IP-based Virtual Host Support - - - - - -

    Apache IP-based Virtual Host Support

    - -See also: -Name-based Virtual Hosts Support - -
    - -

    System requirements

    -As the term IP-based indicates, the server must have a -different IP address for each IP-based virtual host. -This can be achieved by the machine having several physical network connections, -or by use of virtual interfaces which are supported by most modern -operating systems (see system documentation for details). - -

    How to set up Apache

    -There are two ways of configuring apache to support multiple hosts. -Either by running a separate httpd daemon for each hostname, or by running a -single daemon which supports all the virtual hosts. -

    -Use multiple daemons when: -

      -
    • The different virtual hosts need very different httpd configurations, such - as different values for: ServerType, - User, - Group, - TypesConfig or - ServerRoot. -
    • The machine does not process a very high request rate. -
    -Use a single daemon when: -
      -
    • Sharing of the httpd configuration between virtual hosts is acceptable. -
    • The machine services a large number of requests, and so the performance - loss in running separate daemons may be significant. -
    - -

    Setting up multiple daemons

    -Create a separate httpd installation for each virtual host. -For each installation, use the -Listen directive in the configuration -file to select which IP address (or virtual host) that daemon services. -e.g. -
    -    Listen www.smallco.com:80
    -
    -It is recommended that you use an IP address instead of a hostname -(see DNS page). - -

    Setting up a single daemon with virtual hosts

    -For this case, a single httpd will service requests for the main server -and all the virtual hosts. -The VirtualHost directive in the - configuration file is used to set the values of -ServerAdmin, -ServerName, -DocumentRoot, -ErrorLog and -TransferLog or -CustomLog -configuration directives to different values for each virtual host. -e.g. -
    -    <VirtualHost www.smallco.com>
    -    ServerAdmin webmaster@mail.smallco.com
    -    DocumentRoot /groups/smallco/www
    -    ServerName www.smallco.com
    -    ErrorLog /groups/smallco/logs/error_log
    -    TransferLog /groups/smallco/logs/access_log
    -    </VirtualHost>
    -
    -    <VirtualHost www.baygroup.org>
    -    ServerAdmin webmaster@mail.baygroup.org
    -    DocumentRoot /groups/baygroup/www
    -    ServerName www.baygroup.org
    -    ErrorLog /groups/baygroup/logs/error_log
    -    TransferLog /groups/baygroup/logs/access_log
    -    </VirtualHost>
    -
    - -It is recommended that you use an IP address instead of a hostname -(see DNS page). - -

    - -Almost any configuration directive can be put -in the VirtualHost directive, with the exception of -ServerType, -StartServers, -MaxSpareServers, -MinSpareServers, -MaxRequestsPerChild, -BindAddress, -Listen, -PidFile, -TypesConfig, -ServerRoot and -NameVirtualHost. -

    -User and -Group maybe used inside a VirtualHost -directive if the suEXEC wrapper is used. -

    - -SECURITY: When specifying where to write log files, be aware -of some security risks which are present if anyone other than the -user that starts Apache has write access to the directory where they -are written. See the security -tips document for details. -

    - - - - - diff --git a/docs/manual/vhosts/mass.html b/docs/manual/vhosts/mass.html deleted file mode 100644 index 4ecd952e2d207c802bf7a0c787631dba09b11117..0000000000000000000000000000000000000000 --- a/docs/manual/vhosts/mass.html +++ /dev/null @@ -1,330 +0,0 @@ - - -Dynamically configured mass virtual hosting - - - - - -

    Dynamically configured mass virtual hosting

    - -

    This document describes how to efficiently serve an arbitrary number -of virtual hosts with Apache 1.3. Some familiarity with -mod_rewrite is -useful.

    - - - -

    Contents:

    - - - -

    Motivation

    - -

    The techniques described here are of interest if your -httpd.conf contains hundreds of -<VirtualHost> sections that are substantially the -same, for example: -

    -NameVirtualHost 111.22.33.44
    -<VirtualHost 111.22.33.44>
    -	ServerName		           www.customer-1.com
    -	DocumentRoot		/www/hosts/www.customer-1.com/docs
    -	ScriptAlias  /cgi-bin/  /www/hosts/www.customer-1.com/cgi-bin
    -</VirtualHost>
    -<VirtualHost 111.22.33.44>
    -	ServerName		           www.customer-2.com
    -	DocumentRoot		/www/hosts/www.customer-2.com/docs
    -	ScriptAlias  /cgi-bin/  /www/hosts/www.customer-2.com/cgi-bin
    -</VirtualHost>
    -# blah blah blah
    -<VirtualHost 111.22.33.44>
    -	ServerName		           www.customer-N.com
    -	DocumentRoot		/www/hosts/www.customer-N.com/docs
    -	ScriptAlias  /cgi-bin/  /www/hosts/www.customer-N.com/cgi-bin
    -</VirtualHost>
    -
    -

    - -

    The basic idea is to replace all of the static -<VirtualHost> configuration with a mechanism that -works it out dynamically. This has a number of advantages: -

      -
    1. Your configuration file is smaller so Apache starts faster and - uses less memory. -
    2. Adding virtual hosts is simply a matter of creating the - appropriate directories in the filesystem and entries in the DNS - - you don't need to reconfigure or restart Apache. -
    -

    - -

    The main disadvantage is that you cannot have a different log file -for each server; however if you have very many virtual hosts then -doing this is dubious anyway because it eats file descriptors. It's -better to log to a pipe or a fifo and arrange for the process at the -other end to distribute the logs (and perhaps accumulate statistics, -etc.). A LogFormat directive that includes -%v for the virtual host makes it easy to do this.

    - - -

    Overview of the technique

    - -

    All of the dynamic virtual hosts will either be configured as part -of the main server configuration, or within a -<VirtualHost> section. For a simple (very uniform) -setup, <VirtualHost> sections aren't needed at all.

    - -

    A couple of things need to be `faked' to make the dynamic virtual -host look like a normal one. The most important is the server name -(configured with ServerName and available to CGIs via the -SERVER_NAME environment variable). The way it is -determined is controlled by the UseCanonicalName -directive: with UseCanonicalName off the server name -comes from the contents of the Host: header in the -request. If there is no Host: header then the value -configured with ServerName is used instead.

    - -

    The other one is the document root (configured with -DocumentRoot and available to CGIs via the -DOCUMENT_ROOT environment variable). This is used by the -core module when mapping URIs to filenames, but in the context of -dynamic virtual hosting its value only matters if any CGIs or SSI -documents make use of the DOCUMENT_ROOT environment -variable. This is an Apache extension to the CGI specification and as -such shouldn't really be relied upon, especially because this -technique breaks it: there isn't currently a way of setting -DOCUMENT_ROOT dynamically.

    - -

    The meat of the mechanism works via Apache's URI-to-filename -translation API phase. This is used by a number of modules: -mod_rewrite, -mod_alias, -mod_userdir, -and the core module. -In the default configuration these modules are called in that order -and given a chance to say that they know what the filename is. Most of -these modules do it in a fairly simple fashion (e.g. the core module -concatenates the document root and the URI) except for -mod_rewrite, which provides enough functionality to do -all sorts of sick and twisted things (like dynamic virtual hosting). -Note that because of the order in which the modules are called, using -a mod_rewrite configuration that matches any URI means -that the other modules (particularly mod_alias) will -cease to function. The examples below show how to deal with this.

    - -

    The dynamic virtual hosting idea is very simple: use the -server name as well as the URI to determine the corresponding -filename.

    - - -

    Simple name-based dynamic virtual hosts

    - -

    This extract from httpd.conf implements the virtual -host arrangement outlined in the Motivation -section above, but in a generic fashion.

    - -

    The first half shows some other configuration options that are -needed to make the mod_rewrite part work as expected; the -second half uses mod_rewrite to do the actual work. Some -care is taken to do a per-dynamic-virtual-host equivalent of -ScriptAlias.

    - -
    -# dynamic ServerName
    -UseCanonicalName Off
    -
    -# splittable logs
    -LogFormat "%v %h %l %u %t \"%r\" %s %b" vcommon
    -CustomLog logs/access_log vcommon
    -
    -<Directory /www/hosts>
    -	# ExecCGI is needed here because we can't force
    -	# CGI execution in the way that ScriptAlias does
    -	Options FollowSymLinks ExecCGI
    -</Directory>
    -
    -# now for the hard bit
    -
    -RewriteEngine On
    -
    -# a ServerName derived from a Host: header may be any case at all
    -RewriteMap  lowercase  int:tolower
    -
    -## deal with normal documents first:
    -# allow Alias /icons/ to work - repeat for other aliases
    -RewriteCond  %{REQUEST_URI}  !^/icons/
    -# allow CGIs to work
    -RewriteCond  %{REQUEST_URI}  !^/cgi-bin/
    -# do the magic
    -RewriteRule  ^/(.*)$  /www/hosts/${lowercase:%{SERVER_NAME}}/docs/$1
    -
    -## and now deal with CGIs - we have to force a MIME type
    -RewriteCond  %{REQUEST_URI}  ^/cgi-bin/
    -RewriteRule  ^/(.*)$  /www/hosts/${lowercase:%{SERVER_NAME}}/cgi-bin/$1  [T=application/x-httpd-cgi]
    -
    -# that's it!
    -
    - - -

    A virtually hosted homepages system

    - -

    This is an adjustment of the above system tailored for an ISP's -homepages server. Using slightly more complicated rewriting rules we -can select substrings of the server name to use in the filename so -that e.g. the documents for www.user.isp.com are found in -/home/user/. It uses a single cgi-bin -directory instead of one per virtual host.

    - -
    -RewriteEngine on
    -
    -RewriteMap   lowercase  int:tolower
    -
    -# allow CGIs to work
    -RewriteCond  %{REQUEST_URI}  !^/cgi-bin/
    -
    -# check the hostname is right so that the RewriteRule works
    -RewriteCond  ${lowercase:%{HTTP_HOST}}  ^www\.[a-z-]+\.isp\.com$
    -
    -# concatenate the virtual host name onto the start of the URI
    -# the [C] means do the next rewrite on the result of this one
    -RewriteRule  ^(.+)  ${lowercase:%{HTTP_HOST}}$1  [C]
    -
    -# now create the real file name
    -RewriteRule  ^www\.([a-z-]+)\.isp\.com/(.*) /home/$1/$2
    -
    -# define the global CGI directory
    -ScriptAlias  /cgi-bin/  /www/std-cgi/
    -
    - - -

    Using a separate virtual host configuration file

    - -

    This arrangement uses a separate configuration file to specify the -translation from virtual host to document root. This provides more -flexibility but requires more configuration.

    - -

    The vhost.map file contains something like this: -

    -www.customer-1.com  /www/customers/1
    -www.customer-2.com  /www/customers/2
    -# ...
    -www.customer-N.com  /www/customers/N
    -
    -

    - -

    The http.conf contains this: -

    -RewriteEngine on
    -
    -RewriteMap   lowercase  int:tolower
    -
    -# define the map file
    -RewriteMap   vhost      txt:/www/conf/vhost.map
    -
    -# deal with aliases as above
    -RewriteCond  %{REQUEST_URI}               !^/icons/
    -RewriteCond  %{REQUEST_URI}               !^/cgi-bin/
    -RewriteCond  ${lowercase:%{SERVER_NAME}}  ^(.+)$
    -# this does the file-based remap
    -RewriteCond  ${vhost:%1}                  ^(/.*)$
    -RewriteRule  ^/(.*)$                      %1/docs/$1
    -
    -RewriteCond  %{REQUEST_URI}               ^/cgi-bin/
    -RewriteCond  ${lowercase:%{SERVER_NAME}}  ^(.+)$
    -RewriteCond  ${vhost:%1}                  ^(/.*)$
    -RewriteRule  ^/(.*)$                      %1/cgi-bin/$1
    -
    -

    - - -

    Using more than one virtual hosting system on the same server

    - -

    With more complicated setups, you can use Apache's normal -<VirtualHost> directives to control the scope of -the various rewrite configurations. For example, you could have one IP -address for homepages customers and another for commercial customers -with the following setup. This can of course be combined with -convential <VirtualHost> configuration -sections.

    - -
    -UseCanonicalName Off
    -
    -LogFormat "%v %h %l %u %t \"%r\" %s %b" vcommon
    -CustomLog logs/access_log vcommon
    -
    -<Directory /www/commercial>
    -	Options FollowSymLinks ExecCGI
    -	AllowOverride All
    -</Directory>
    -
    -<Directory /www/homepages>
    -	Options FollowSymLinks
    -	AllowOverride None
    -</Directory>
    -
    -<VirtualHost 111.22.33.44>
    -	ServerName www.commercial.isp.com
    -
    -	RewriteEngine On
    -	RewriteMap    lowercase  int:tolower
    -
    -	RewriteCond   %{REQUEST_URI}  !^/icons/
    -	RewriteCond   %{REQUEST_URI}  !^/cgi-bin/
    -	RewriteRule   ^/(.*)$  /www/commercial/${lowercase:%{SERVER_NAME}}/docs/$1
    -
    -	RewriteCond   %{REQUEST_URI}  ^/cgi-bin/
    -	RewriteRule   ^/(.*)$  /www/commercial/${lowercase:%{SERVER_NAME}}/cgi-bin/$1  [T=application/x-httpd-cgi]
    -</VirtualHost>
    -
    -<VirtualHost 111.22.33.45>
    -	ServerName www.homepages.isp.com
    -
    -	RewriteEngine on
    -	RewriteMap    lowercase  int:tolower
    -
    -	RewriteCond   %{REQUEST_URI}  !^/cgi-bin/
    -
    -	RewriteCond   ${lowercase:%{HTTP_HOST}}  ^www\.[a-z-]+\.isp\.com$
    -	RewriteRule   ^(.+)  ${lowercase:%{HTTP_HOST}}$1  [C]
    -	RewriteRule   ^www\.([a-z-]+)\.isp\.com/(.*) /www/homepages/$1/$2
    -
    -	ScriptAlias   /cgi-bin/ /www/std-cgi/
    -</VirtualHost>
    -
    - - -
    - -

    - Apache HTTP Server Version 1.3 -

    - -Index -Home - - - diff --git a/docs/manual/vhosts/name-based.html b/docs/manual/vhosts/name-based.html deleted file mode 100644 index f26dd5f8ed71c42477a5257cfcd2b2e18a0b98e0..0000000000000000000000000000000000000000 --- a/docs/manual/vhosts/name-based.html +++ /dev/null @@ -1,141 +0,0 @@ - - -Apache name-based Virtual Hosts - - - - - -

    Apache name-based Virtual Host Support

    - -See Also: -IP-based Virtual Host Support - -
    - -

    Name-based vs. IP-based virtual hosts

    - -

    While the approach with IP-based virtual hosts works still very well, -it is not the most elegant solution, because a dedicated IP address -is needed for every virtual host and it is hard to implement on some -machines. The HTTP/1.1 protocol contains a method for the -server to identify what name it is being addressed as. Apache 1.1 and -later support this approach as well as the traditional -IP-address-per-hostname method.

    - -

    The benefits of using the new name-based virtual host support is a -practically unlimited number of servers, ease of configuration and use, and -requires no additional hardware or software. -The main disadvantage is that the client must support this part of the -protocol. The latest versions of most browsers do, but there are still -old browsers in use who do not. This can cause problems, although a possible -solution is addressed below.

    - -

    Using non-IP Virtual Hosts

    - -

    Using the new virtual hosts is quite easy, and superficially looks -like the old method. You simply add to one of the Apache configuration -files (most likely httpd.conf or srm.conf) -code similar to the following:

    -
    -    NameVirtualHost 111.22.33.44
    -
    -    <VirtualHost 111.22.33.44>
    -    ServerName www.domain.tld
    -    DocumentRoot /web/domain
    -    </VirtualHost>
    -
    - -

    The notable difference between IP-based and name-based virtual host -configuration is the -NameVirtualHost -directive which specifies any IP address that should be used as a target for -name-based virtual hosts. - -

    Of course, any additional directives can (and should) be placed -into the <VirtualHost> section. To make this work, -all that is needed is to make sure that the name -www.domain.tld is an alias (CNAME) pointing to the IP address -111.22.33.44

    - -

    Additionally, many servers may wish to be accessible by more than -one name. For example, the example server might want to be accessible -as domain.tld, or www2.domain.tld, assuming -the IP addresses pointed to the same server. In fact, one might want it -so that all addresses at domain.tld were picked up by the -server. This is possible with the -ServerAlias -directive, placed inside the <VirtualHost> section. For -example:

    - -
    -    ServerAlias domain.tld *.domain.tld
    -
    - -

    Note that you can use * and ? as wild-card -characters.

    - -

    You also might need ServerAlias if you are -serving local users who do not always include the domain name. -For example, if local users are -familiar with typing "www" or "www.foobar" then you will need to add -ServerAlias www www.foobar. It isn't possible for the -server to know what domain the client uses for their name resolution -because the client doesn't provide that information in the request.

    - -

    Compatibility with Older Browsers

    - -

    As mentioned earlier, there are still some clients in use who -do not send the required data for the name-based virtual hosts to work -properly. These clients will always be sent the pages from the -primary name-based virtual host (the first virtual host -appearing in the configuration file for a specific IP address).

    - -

    There is a possible workaround with the -ServerPath -directive, albeit a slightly cumbersome one:

    - -

    Example configuration: - -

    -    NameVirtualHost 111.22.33.44
    -
    -    <VirtualHost 111.22.33.44>
    -    ServerName www.domain.tld
    -    ServerPath /domain
    -    DocumentRoot /web/domain
    -    </VirtualHost>
    -
    - -

    What does this mean? It means that a request for any URI beginning -with "/domain" will be served from the virtual host -www.domain.tld This means that the pages can be accessed as -http://www.domain.tld/domain/ for all clients, although -clients sending a Host: header can also access it as -http://www.domain.tld/.

    - -

    In order to make this work, put a link on your primary virtual host's page -to http://www.domain.tld/domain/ -Then, in the virtual host's pages, be sure to use either purely -relative links (e.g. "file.html" or -"../icons/image.gif" or links containing the prefacing -/domain/ -(e.g. "http://www.domain.tld/domain/misc/file.html" or -"/domain/misc/file.html").

    - -

    This requires a bit of -discipline, but adherence to these guidelines will, for the most part, -ensure that your pages will work with all browsers, new and old.

    - -

    See also: ServerPath configuration -example

    - - - - diff --git a/docs/manual/vhosts/name-based.html.en b/docs/manual/vhosts/name-based.html.en deleted file mode 100644 index f26dd5f8ed71c42477a5257cfcd2b2e18a0b98e0..0000000000000000000000000000000000000000 --- a/docs/manual/vhosts/name-based.html.en +++ /dev/null @@ -1,141 +0,0 @@ - - -Apache name-based Virtual Hosts - - - - - -

    Apache name-based Virtual Host Support

    - -See Also: -IP-based Virtual Host Support - -
    - -

    Name-based vs. IP-based virtual hosts

    - -

    While the approach with IP-based virtual hosts works still very well, -it is not the most elegant solution, because a dedicated IP address -is needed for every virtual host and it is hard to implement on some -machines. The HTTP/1.1 protocol contains a method for the -server to identify what name it is being addressed as. Apache 1.1 and -later support this approach as well as the traditional -IP-address-per-hostname method.

    - -

    The benefits of using the new name-based virtual host support is a -practically unlimited number of servers, ease of configuration and use, and -requires no additional hardware or software. -The main disadvantage is that the client must support this part of the -protocol. The latest versions of most browsers do, but there are still -old browsers in use who do not. This can cause problems, although a possible -solution is addressed below.

    - -

    Using non-IP Virtual Hosts

    - -

    Using the new virtual hosts is quite easy, and superficially looks -like the old method. You simply add to one of the Apache configuration -files (most likely httpd.conf or srm.conf) -code similar to the following:

    -
    -    NameVirtualHost 111.22.33.44
    -
    -    <VirtualHost 111.22.33.44>
    -    ServerName www.domain.tld
    -    DocumentRoot /web/domain
    -    </VirtualHost>
    -
    - -

    The notable difference between IP-based and name-based virtual host -configuration is the -NameVirtualHost -directive which specifies any IP address that should be used as a target for -name-based virtual hosts. - -

    Of course, any additional directives can (and should) be placed -into the <VirtualHost> section. To make this work, -all that is needed is to make sure that the name -www.domain.tld is an alias (CNAME) pointing to the IP address -111.22.33.44

    - -

    Additionally, many servers may wish to be accessible by more than -one name. For example, the example server might want to be accessible -as domain.tld, or www2.domain.tld, assuming -the IP addresses pointed to the same server. In fact, one might want it -so that all addresses at domain.tld were picked up by the -server. This is possible with the -ServerAlias -directive, placed inside the <VirtualHost> section. For -example:

    - -
    -    ServerAlias domain.tld *.domain.tld
    -
    - -

    Note that you can use * and ? as wild-card -characters.

    - -

    You also might need ServerAlias if you are -serving local users who do not always include the domain name. -For example, if local users are -familiar with typing "www" or "www.foobar" then you will need to add -ServerAlias www www.foobar. It isn't possible for the -server to know what domain the client uses for their name resolution -because the client doesn't provide that information in the request.

    - -

    Compatibility with Older Browsers

    - -

    As mentioned earlier, there are still some clients in use who -do not send the required data for the name-based virtual hosts to work -properly. These clients will always be sent the pages from the -primary name-based virtual host (the first virtual host -appearing in the configuration file for a specific IP address).

    - -

    There is a possible workaround with the -ServerPath -directive, albeit a slightly cumbersome one:

    - -

    Example configuration: - -

    -    NameVirtualHost 111.22.33.44
    -
    -    <VirtualHost 111.22.33.44>
    -    ServerName www.domain.tld
    -    ServerPath /domain
    -    DocumentRoot /web/domain
    -    </VirtualHost>
    -
    - -

    What does this mean? It means that a request for any URI beginning -with "/domain" will be served from the virtual host -www.domain.tld This means that the pages can be accessed as -http://www.domain.tld/domain/ for all clients, although -clients sending a Host: header can also access it as -http://www.domain.tld/.

    - -

    In order to make this work, put a link on your primary virtual host's page -to http://www.domain.tld/domain/ -Then, in the virtual host's pages, be sure to use either purely -relative links (e.g. "file.html" or -"../icons/image.gif" or links containing the prefacing -/domain/ -(e.g. "http://www.domain.tld/domain/misc/file.html" or -"/domain/misc/file.html").

    - -

    This requires a bit of -discipline, but adherence to these guidelines will, for the most part, -ensure that your pages will work with all browsers, new and old.

    - -

    See also: ServerPath configuration -example

    - - - - diff --git a/emacs-style b/emacs-style deleted file mode 100644 index a0f16e2209dccc386886ac93c9ad099936e9ab29..0000000000000000000000000000000000000000 --- a/emacs-style +++ /dev/null @@ -1,9 +0,0 @@ -(add-hook 'c-mode-hook - (function (lambda () - (c-set-offset 'inclass' ++) - (c-set-offset 'defun-block-intro' ++) - (c-set-offset 'statement-block-intro' ++) - (c-set-offset 'substatement' ++) - (c-set-offset 'brace-list-intro' ++) - ))) -(setq c++-mode-hook c-mode-hook) diff --git a/include/.cvsignore b/include/.cvsignore deleted file mode 100644 index 49eae948bd539f62d6d0ab92d9dbef5a81f0d2aa..0000000000000000000000000000000000000000 --- a/include/.cvsignore +++ /dev/null @@ -1 +0,0 @@ -ap_config_auto.h diff --git a/include/.indent.pro b/include/.indent.pro deleted file mode 100644 index a9fbe9f9a1f2e6e7bcc54171c215bdacd44171ba..0000000000000000000000000000000000000000 --- a/include/.indent.pro +++ /dev/null @@ -1,54 +0,0 @@ --i4 -npsl -di0 -br -nce -d0 -cli0 -npcs -nfc1 --TBUFF --TFILE --TTRANS --TUINT4 --T_trans --Tallow_options_t --Tapache_sfio --Tarray_header --Tbool_int --Tbuf_area --Tbuff_struct --Tbuffy --Tcmd_how --Tcmd_parms --Tcommand_rec --Tcommand_struct --Tconn_rec --Tcore_dir_config --Tcore_server_config --Tdir_maker_func --Tevent --Tglobals_s --Thandler_func --Thandler_rec --Tjoblist_s --Tlisten_rec --Tmerger_func --Tmode_t --Tmodule --Tmodule_struct --Tmutex --Tn_long --Tother_child_rec --Toverrides_t --Tparent_score --Tpid_t --Tpiped_log --Tpool --Trequest_rec --Trequire_line --Trlim_t --Tscoreboard --Tsemaphore --Tserver_addr_rec --Tserver_rec --Tserver_rec_chain --Tshort_score --Ttable --Ttable_entry --Tthread --Tu_wide_int --Tvtime_t --Twide_int diff --git a/include/ap_compat.h b/include/ap_compat.h deleted file mode 100644 index e6187c97ae80e6ac9517e14432342319e417987a..0000000000000000000000000000000000000000 --- a/include/ap_compat.h +++ /dev/null @@ -1,11 +0,0 @@ -#ifndef APR_COMPAT_H -#define APR_COMPAT_H - -/* Drag in apu (and therefore apr) renamed symbols */ -#include "apu_compat.h" - -/* redefine 1.3.x symbols to the new symbol names */ - -#define MODULE_VAR_EXPORT AP_MODULE_DECLARE_DATA - -#endif /* APR_COMPAT_H */ \ No newline at end of file diff --git a/include/ap_config.h b/include/ap_config.h deleted file mode 100644 index e7219cf892e76ac1e30e5109e6b4db3608792084..0000000000000000000000000000000000000000 --- a/include/ap_config.h +++ /dev/null @@ -1,1394 +0,0 @@ -/* ==================================================================== - * Copyright (c) 1995-1999 The Apache Group. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in - * the documentation and/or other materials provided with the - * distribution. - * - * 3. All advertising materials mentioning features or use of this - * software must display the following acknowledgment: - * "This product includes software developed by the Apache Group - * for use in the Apache HTTP server project (http://www.apache.org/)." - * - * 4. The names "Apache Server" and "Apache Group" must not be used to - * endorse or promote products derived from this software without - * prior written permission. For written permission, please contact - * apache@apache.org. - * - * 5. Products derived from this software may not be called "Apache" - * nor may "Apache" appear in their names without prior written - * permission of the Apache Group. - * - * 6. Redistributions of any form whatsoever must retain the following - * acknowledgment: - * "This product includes software developed by the Apache Group - * for use in the Apache HTTP server project (http://www.apache.org/)." - * - * THIS SOFTWARE IS PROVIDED BY THE APACHE GROUP ``AS IS'' AND ANY - * EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR - * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE APACHE GROUP OR - * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT - * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, - * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED - * OF THE POSSIBILITY OF SUCH DAMAGE. - * ==================================================================== - * - * This software consists of voluntary contributions made by many - * individuals on behalf of the Apache Group and was originally based - * on public domain software written at the National Center for - * Supercomputing Applications, University of Illinois, Urbana-Champaign. - * For more information on the Apache Group and the Apache HTTP server - * project, please see . - * - */ - -#ifndef AP_CONFIG_H -#define AP_CONFIG_H - -#ifdef __cplusplus -extern "C" { -#endif - -/* - * ap_config.h: system-dependant #defines and includes... - * See PORTING for a listing of what they mean - */ - -#include "ap_mmn.h" /* MODULE_MAGIC_NUMBER_ */ - -/* - * Support for platform dependent autogenerated defines - */ -#ifndef WIN32 -#include "ap_config_auto.h" -#else -/* not available under WIN32, so provide important entries manually */ -#undef HAVE_UNISTD_H -#endif - -/* Have to include sys/stat.h before ../os/win32/os.h so we can override -stat() properly */ -#include -#include - -/* So that we can use inline on some critical functions, and use - * GNUC attributes (such as to get -Wall warnings for printf-like - * functions). Only do this in gcc 2.7 or later ... it may work - * on earlier stuff, but why chance it. - * - * We've since discovered that the gcc shipped with NeXT systems - * as "cc" is completely broken. It claims to be __GNUC__ and so - * on, but it doesn't implement half of the things that __GNUC__ - * means. In particular it's missing inline and the __attribute__ - * stuff. So we hack around it. PR#1613. -djg - */ -#if !defined(__GNUC__) || __GNUC__ < 2 || \ - (__GNUC__ == 2 && __GNUC_MINOR__ < 7) ||\ - defined(NEXT) -#define ap_inline -#define __attribute__(__x) -#define ENUM_BITFIELD(e,n,w) signed int n : w -#else -#define ap_inline __inline__ -#define USE_GNU_INLINE -#define ENUM_BITFIELD(e,n,w) e n : w -#endif - -#ifdef WIN32 -/* include process.h first so we can override spawn[lv]e* properly */ -#include -#include "../os/win32/os.h" -#else -#include "os.h" -#endif - -#if !defined(QNX) && !defined(MPE) && !defined(WIN32) && !defined(TPF) -#include -#endif - -/* Define one of these according to your system. */ -#if defined(MINT) -typedef int rlim_t; -#define JMP_BUF sigjmp_buf -#define NO_LONG_DOUBLE -#define USE_FLOCK_SERIALIZED_ACCEPT -#define _BSD_SOURCE -#define EAGAIN EWOULDBLOCK -int initgroups (char *, int); -char *crypt (const char *pw, const char *salt); -int gethostname (char *name, int namelen); - -#elif defined(MPE) -#include -#define NO_SETSID -#define NO_KILLPG -#define NO_WRITEV -#define HAVE_SHMGET 1 -#define USE_SHMGET_SCOREBOARD -#define SHM_R 0400 /* Read permission */ -#define SHM_W 0200 /* Write permission */ -#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_GETTIMEOFDAY -#define S_IEXEC S_IXUSR -#define S_IREAD S_IRUSR -#define S_IWRITE S_IWUSR -#define PF_INET AF_INET - -#elif defined(SUNOS4) -#define HAVE_GMTOFF 1 -#undef NO_KILLPG -#undef NO_SETSID -char *crypt(const char *pw, const char *salt); -char *mktemp(char *template); -#define HAVE_MMAP 1 -#define USE_MMAP_SCOREBOARD -#define USE_MMAP_FILES -#include -#define NEED_STRERROR -typedef int rlim_t; -#define memmove(a,b,c) bcopy(b,a,c) -#define NO_LINGCLOSE -#define USE_FLOCK_SERIALIZED_ACCEPT -#define NEED_DIFFTIME -#define HAVE_SYSLOG 1 - -#elif defined(SOLARIS2) -#undef HAVE_GMTOFF -#define NO_KILLPG -#undef NO_SETSID -#define bzero(a,b) memset(a,0,b) -#if !defined(USE_SYSVSEM_SERIALIZED_ACCEPT) && \ - !defined(USE_PTHREAD_SERIALIZED_ACCEPT) -#define USE_FCNTL_SERIALIZED_ACCEPT -#endif -#define NEED_UNION_SEMUN -#define HAVE_MMAP 1 -#define USE_MMAP_SCOREBOARD -#define USE_MMAP_FILES -int gethostname(char *name, int namelen); -#define HAVE_SYSLOG 1 -#define SYS_SIGLIST _sys_siglist - -#elif defined(IRIX) -#undef HAVE_GMTOFF -/* IRIX has killpg, but it's only in _BSD_COMPAT, so don't use it in case - * there's some weird conflict with non-BSD signals */ -#define NO_KILLPG -#undef NO_SETSID -#if !defined(USE_FLOCK_SERIALIZED_ACCEPT) && \ - !defined(USE_USLOCK_SERIALIZED_ACCEPT) && \ - !defined(USE_SYSVSEM_SERIALIZED_ACCEPT) -#define USE_FCNTL_SERIALIZED_ACCEPT -#endif -#define HAVE_SHMGET 1 -#define USE_SHMGET_SCOREBOARD -#define HAVE_MMAP 1 -#define USE_MMAP_FILES -#define NO_LONG_DOUBLE -#define NO_LINGCLOSE -#define HAVE_SYSLOG 1 - -#elif defined(HIUX) -#undef HAVE_GMTOFF -#define NO_KILLPG -#undef NO_SETSID -#ifndef _HIUX_SOURCE -#define _HIUX_SOURCE -#endif -#define HAVE_SHMGET 1 -#define USE_SHMGET_SCOREBOARD -#define SELECT_NEEDS_CAST -#define HAVE_SYSLOG 1 - -#elif defined(HPUX) || defined(HPUX10) -#undef HAVE_GMTOFF -#define NO_KILLPG -#undef NO_SETSID -#define USE_FCNTL_SERIALIZED_ACCEPT -#ifndef _HPUX_SOURCE -#define _HPUX_SOURCE -#endif -#define HAVE_SHMGET 1 -#define USE_SHMGET_SCOREBOARD -#define HAVE_SYSLOG 1 -#ifndef HPUX10 -#define SELECT_NEEDS_CAST -typedef int rlim_t; -#endif - -#elif defined(HPUX11) -#ifndef _HPUX_SOURCE -#define _HPUX_SOURCE -#endif -#define HAVE_SHMGET -#define USE_SHMGET_SCOREBOARD -#undef HAVE_GMTOFF -#define USE_FCNTL_SERIALIZED_ACCEPT -/* feeling brave? want to try using POSIX mutexes? */ -/* #define HAVE_MMAP */ -/* #define USE_MMAP_SCOREBOARD */ -/* #define USE_MMAP_FILES */ -/* #define USE_PTHREAD_SERIALIZED_ACCEPT */ -#define NO_KILLPG -#undef NO_SETSID -#define HAVE_SYSLOG - -#elif defined(AIX) -#undef HAVE_GMTOFF -#undef NO_KILLPG -#undef NO_SETSID -#ifndef __ps2__ -#define HAVE_MMAP 1 -#define USE_MMAP_SCOREBOARD -#define USE_MMAP_FILES -#define HAVE_SYSLOG 1 -#ifndef DEFAULT_GROUP -#define DEFAULT_GROUP "nobody" -#endif -#endif -#ifndef DEFAULT_USER -#define DEFAULT_USER "nobody" -#endif -#ifdef NEED_RLIM_T -typedef int rlim_t; -#endif -#define USE_FCNTL_SERIALIZED_ACCEPT -#ifdef USEBCOPY -#define memmove(a,b,c) bcopy(b,a,c) -#endif -#if AIX >= 42 -#define NET_SIZE_T size_t -#endif - -#elif defined(ULTRIX) -/* we don't want to use sys/resource.h under - Ultrix although this header exists. */ -#undef HAVE_SYS_RESOURCE_H -#define HAVE_GMTOFF 1 -#undef NO_KILLPG -#undef NO_SETSID -#define ULTRIX_BRAIN_DEATH -#define NEED_STRDUP -/* If you have Ultrix 4.3, and are using cc, const is broken */ -#ifndef __ultrix__ /* Hack to check for pre-Ultrix 4.4 cc */ -#define const /* Not implemented */ -#endif - -#elif defined(OSF1) -#define HAVE_GMTOFF 1 -#undef NO_KILLPG -#undef NO_SETSID -#define HAVE_MMAP 1 -#define USE_MMAP_SCOREBOARD -#define USE_MMAP_FILES -#define NO_LONG_DOUBLE -#define HAVE_SYSLOG 1 -#define USE_FLOCK_SERIALIZED_ACCEPT -#define SINGLE_LISTEN_UNSERIALIZED_ACCEPT - -#elif defined(PARAGON) -#define HAVE_GMTOFF 1 -#undef NO_KILLPG -#undef NO_SETSID -#define HAVE_MMAP 1 -#define USE_MMAP_SCOREBOARD -#define USE_MMAP_FILES -#define NO_LONG_DOUBLE -#define HAVE_SYSLOG 1 -typedef int rlim_t; - -#elif defined(SEQUENT) -#define DEFAULT_USER "nobody" -#define DEFAULT_GROUP "nobody" -#define NO_SHMGET 1 -#define HAVE_MMAP 1 -#define HAVE_SYSLOG 1 -#define USE_MMAP_FILES 1 -#define USE_MMAP_SCOREBOARD 1 -#define USE_FCNTL_SERIALIZED_ACCEPT 1 -#define JMP_BUF sigjmp_buf -#undef NO_SETSID -#if SEQUENT < 40 -typedef int rlim_t; -#define NO_GETTIMEOFDAY -#undef HAVE_SYS_RESOURCE_H /* exists but does not provide *rlimit funcs */ -#include -#endif -#if SEQUENT < 42 -#define NEED_STRCASECMP -#define NEED_STRNCASECMP -#endif -#if SEQUENT < 44 -#define NO_KILLPG 1 -#define NET_SIZE_T int -#endif -#if SEQUENT >= 44 -#undef NO_KILLPG -#define NET_SIZE_T size_t -#endif - -#elif defined(NEXT) -typedef unsigned short mode_t; -#define HAVE_GMTOFF 1 -#undef NO_KILLPG -#define NO_SETSID -#define NEED_STRDUP -#define NO_LINGCLOSE -#undef _POSIX_SOURCE -#ifndef FD_CLOEXEC -#define FD_CLOEXEC 1 -#endif -#ifndef S_ISDIR -#define S_ISDIR(m) (((m)&(S_IFMT)) == (S_IFDIR)) -#endif -#ifndef S_ISREG -#define S_ISREG(m) (((m)&(S_IFMT)) == (S_IFREG)) -#endif -#ifndef S_IXUSR -#define S_IXUSR 00100 -#endif -#ifndef S_IRGRP -#define S_IRGRP 00040 -#endif -#ifndef S_IXGRP -#define S_IXGRP 00010 -#endif -#ifndef S_IROTH -#define S_IROTH 00004 -#endif -#ifndef S_IXOTH -#define S_IXOTH 00001 -#endif -#ifndef S_IRUSR -#define S_IRUSR S_IREAD -#endif -#ifndef S_IWUSR -#define S_IWUSR S_IWRITE -#endif -#ifndef S_IWGRP -#define S_IWGRP 000020 -#endif -#ifndef S_IWOTH -#define S_IWOTH 000002 -#endif - -#define STDIN_FILENO 0 -#define STDOUT_FILENO 1 -#define STDERR_FILENO 2 - -/* PR#2293 fix */ -#define ap_wait_t union wait -#define waitpid(a,b,c) wait4((a) == -1 ? 0 : (a),(union wait *)(b),c,NULL) -#define WEXITSTATUS(status) (int)( WIFEXITED(status) ? ( (status).w_retcode ) : -1) -#define WTERMSIG(status) (int)( (status).w_termsig ) - -typedef int pid_t; -#define USE_LONGJMP -#define NO_USE_SIGACTION -#define HAVE_SYSLOG 1 - -#if defined(__DYNAMIC__) -#define HAVE_DYLD -#define DYLD_CANT_UNLOAD -#endif - -#elif defined(MAC_OS) || defined(MAC_OS_X_SERVER) /* Mac OS (>= 10.0) and Mac OS X Server (<= 5.x) */ -#undef PLATFORM -#ifdef MAC_OS_X_SERVER -#define PLATFORM "Mac OS X Server" -#else -#define PLATFORM "Mac OS" -#endif -#define HAVE_DYLD -#ifdef MAC_OS_X_SERVER -#define DYLD_CANT_UNLOAD -#endif /* MAC_OS_X_SERVER */ -#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 USE_FLOCK_SERIALIZED_ACCEPT -#define SINGLE_LISTEN_UNSERIALIZED_ACCEPT -/* - * If you are using APACI, (you probably should be on Mac OS) these - * values are set at configure time. - */ -#ifndef HTTPD_ROOT -#define HTTPD_ROOT "/Local/Library/WebServer" -#endif -#ifndef DOCUMENT_LOCATION -#define DOCUMENT_LOCATION HTTPD_ROOT "/Documents" -#endif -#ifndef DEFAULT_XFERLOG -#define DEFAULT_XFERLOG "Logs/Access" -#endif -#ifndef DEFAULT_ERRORLOG -#define DEFAULT_ERRORLOG "Logs/Errors" -#endif -#ifndef DEFAULT_PIDLOG -#define DEFAULT_PIDLOG "Logs/Process" -#endif -#ifndef DEFAULT_SCOREBOARD -#define DEFAULT_SCOREBOARD "Logs/Status" -#endif -#ifndef DEFAULT_LOCKFILE -#define DEFAULT_LOCKFILE "Logs/Lock" -#endif -#ifndef SERVER_CONFIG_FILE -#define SERVER_CONFIG_FILE "Configuration/Server" -#endif -#ifndef RESOURCE_CONFIG_FILE -#define RESOURCE_CONFIG_FILE "Configuration/Resources" -#endif -#ifndef TYPES_CONFIG_FILE -#define TYPES_CONFIG_FILE "Configuration/MIME" -#endif -#ifndef ACCESS_CONFIG_FILE -#define ACCESS_CONFIG_FILE "Configuration/Access" -#endif -#ifndef DEFAULT_USER_DIR -#define DEFAULT_USER_DIR "Library/Web Documents" -#endif -#ifndef DEFAULT_USER -#define DEFAULT_USER "www" -#endif -#ifndef DEFAULT_GROUP -#define DEFAULT_GROUP "www" -#endif -#ifndef DEFAULT_PATH -#define DEFAULT_PATH "/bin:/usr/bin:/usr/local/bin" -#endif - -#elif defined(LINUX) - -#if LINUX > 1 -#include - -/* libc4 systems probably still work, it probably doesn't define - * __GNU_LIBRARY__ - * libc5 systems define __GNU_LIBRARY__ == 1, but don't define __GLIBC__ - * glibc 2.x and later systems define __GNU_LIBRARY__ == 6, but list it as - * "deprecated in favour of __GLIBC__"; the value 6 will never be changed. - * glibc 1.x systems (i.e. redhat 4.x on sparc/alpha) should have - * __GLIBC__ < 2 - * all glibc based systems need crypt.h - */ -#if defined(__GNU_LIBRARY__) && __GNU_LIBRARY__ > 1 -#include -#endif - -/* glibc 2.0.0 through 2.0.4 need size_t * here, where 2.0.5 needs socklen_t * - * there's no way to discern between these two libraries. But using int should - * be portable because otherwise these libs would be hopelessly broken with - * reams of existing networking code. We'll use socklen_t * for 2.1.x and - * later. - * - * int works for all the earlier libs, and is picked up by default later. - */ -#if defined(__GLIBC__) && (__GLIBC__ > 2 || (__GLIBC__ == 2 && __GLIBC_MINOR__ > 0)) -#define NET_SIZE_T socklen_t -#endif - -#define HAVE_SHMGET 1 -#define USE_SHMGET_SCOREBOARD -#define HAVE_MMAP 1 -#define USE_MMAP_FILES - -/* flock is faster ... but hasn't been tested on 1.x systems */ -/* PR#3531 indicates flock() may not be stable, probably depends on - * kernel version. Go back to using fcntl, but provide a way for - * folks to tweak their Configuration to get flock. - */ -#ifndef USE_FLOCK_SERIALIZED_ACCEPT -#define USE_FCNTL_SERIALIZED_ACCEPT -#endif - -#define SYS_SIGLIST _sys_siglist - -#else -#define USE_FCNTL_SERIALIZED_ACCEPT -#endif - -#undef HAVE_GMTOFF -#undef NO_KILLPG -#undef NO_SETSID -#undef NEED_STRDUP -#include -#define HAVE_SYSLOG 1 - -/* glibc 2.1 and later finally define rlim_t */ -#if !defined(__GLIBC__) || __GLIBC__ < 2 || (__GLIBC__ == 2 && __GLIBC_MINOR__ < 1) -typedef int rlim_t; -#endif - -#elif defined(SCO) -#undef HAVE_GMTOFF -#undef NO_KILLPG -#undef NO_SETSID -#define NEED_INITGROUPS -#define NO_WRITEV -#include -#define HAVE_SYSLOG 1 -#undef HAVE_SYS_RESOURCE_H - -#elif defined(SCO5) - -#define USE_FCNTL_SERIALIZED_ACCEPT -#define HAVE_MMAP 1 -#define USE_MMAP_SCOREBOARD -#define USE_MMAP_FILES -#define SecureWare -#define HAVE_SYSLOG 1 - -/* Although SCO 5 defines these in (note the "s") they don't have - consts. Sigh. */ -extern int strcasecmp(const char *, const char *); -extern int strncasecmp(const char *, const char *, unsigned); - -#elif defined(AUX3) -/* These are to let -Wall compile more cleanly */ -extern int strcasecmp(const char *, const char *); -extern int strncasecmp(const char *, const char *, unsigned); -extern int set42sig(), getopt(), getpeername(), bzero(); -extern int listen(), bind(), socket(), getsockname(); -extern int accept(), gethostname(), connect(), lstat(); -extern int select(), killpg(), shutdown(); -extern int initgroups(), setsockopt(); -extern char *shmat(); -extern int shmctl(); -extern int shmget(); -extern char *sbrk(); -extern char *crypt(); -#include -#undef HAVE_GMTOFF -#undef NO_KILLPG -#undef NO_SETSID -#define NEED_STRDUP -/* fcntl() locking is expensive with NFS */ -#define USE_FLOCK_SERIALIZED_ACCEPT -#define SINGLE_LISTEN_UNSERIALIZED_ACCEPT -#define HAVE_SHMGET 1 -#define USE_SHMGET_SCOREBOARD -/* - * NOTE: If when you run Apache under A/UX and you get a warning - * that httpd couldn't move break, then the below value for - * MOVEBREAK (64megs) is too large for your setup. Try reducing - * to 0x2000000 which is still PLENTY of space. I doubt if - * even on heavy systems sbrk() would be called at all... - */ -#define MOVEBREAK 0x4000000 -#define NO_LINGCLOSE -#define NO_SLACK -#define HAVE_SYSLOG 1 -#undef HAVE_SYS_RESOURCE_H /* exists but does not provide *rlimit funcs */ - -#elif defined(SVR4) -#define NO_KILLPG -#undef NO_SETSID -#undef NEED_STRDUP -#ifndef MPRAS -#define NEED_STRCASECMP -#ifndef ENCORE -#define NEED_STRNCASECMP -#endif /* ENCORE */ -#endif /* MPRAS */ -#define bzero(a,b) memset(a,0,b) -/* A lot of SVR4 systems need this */ -#ifndef USE_SYSVSEM_SERIALIZED_ACCEPT -#define USE_FCNTL_SERIALIZED_ACCEPT -#endif -#define HAVE_SYSLOG 1 -#define NET_SIZE_T size_t -#define HAVE_SHMGET 1 -#define USE_SHMGET_SCOREBOARD -#ifdef _OSD_POSIX /* BS2000-POSIX mainframe needs initgroups */ -#define NEED_HASHBANG_EMUL /* execve() doesn't start shell scripts by default */ -#define _KMEMUSER /* Enable SHM_R/SHM_W defines in */ -#undef NEED_STRCASECMP -#undef NEED_STRNCASECMP -#undef bzero -#endif /*_OSD_POSIX*/ - -#elif defined(UW) -#if UW < 700 -#define USE_FCNTL_SERIALIZED_ACCEPT -#define NO_LINGCLOSE -#define NO_KILLPG -#endif -#undef NO_SETSID -#undef NEED_STRDUP -#define NEED_STRCASECMP -#define NEED_STRNCASECMP -#define bzero(a,b) memset(a,0,b) -#define HAVE_MMAP 1 -#define USE_MMAP_SCOREBOARD -#define USE_MMAP_FILES -#define HAVE_SHMGET 1 -#undef USE_SHMGET_SCOREBOARD /* force use of mmap() scoreboard */ -#include -#if UW >= 200 -#define _POSIX_SOURCE -#endif -#define NET_SIZE_T size_t -#define HAVE_SYSLOG 1 - -#elif defined(DGUX) -#define NO_KILLPG -#undef NO_SETSID -#undef NEED_STRDUP -#ifdef _IX86_DG -#undef NEED_STRCASECMP -#undef NEED_STRNCASECMP -#else -#define NEED_STRCASECMP -#define NEED_STRNCASECMP -#endif -#define bzero(a,b) memset(a,0,b) -/* A lot of SVR4 systems need this */ -#define USE_FCNTL_SERIALIZED_ACCEPT -#define ap_inet_addr inet_network -#define HAVE_SYSLOG 1 - -#elif defined(__NetBSD__) || defined(__OpenBSD__) || defined(NETBSD) -#define HAVE_GMTOFF 1 -#undef NO_KILLPG -#undef NO_SETSID -#define HAVE_SYSLOG 1 -#ifndef DEFAULT_USER -#define DEFAULT_USER "nobody" -#endif -#ifndef DEFAULT_GROUP -#define DEFAULT_GROUP "nogroup" -#endif -#define HAVE_SHMGET 1 -#define HAVE_MMAP 1 -#define USE_MMAP_SCOREBOARD -#define USE_MMAP_FILES -#define USE_FLOCK_SERIALIZED_ACCEPT -#define SINGLE_LISTEN_UNSERIALIZED_ACCEPT - -#elif defined(UTS21) -#undef HAVE_GMTOFF -#undef NO_KILLPG -#define NO_SETSID -#define NEED_WAITPID -#define STDIN_FILENO 0 -#define STDOUT_FILENO 1 -#define STDERR_FILENO 2 -#define HAVE_SYSLOG 1 -#define USE_LONGJMP -#define JMP_BUF jmp_buf -#define NO_USE_SIGACTION -#define NEED_STRERROR -#define NEED_STRSTR -#define NEED_HASHBANG_EMUL -#define NDELAY_PIPE_RETURNS_ZERO -#define NO_DATA NO_ADDRESS -#define ap_wait_t union wait -#define WEXITSTATUS(status) (int)((status).w_retcode) -#define WTERMSIG(status) (int)((status).w_termsig) -#define strftime(buf,bufsize,fmt,tm) ascftime(buf,fmt,tm) -#undef HAVE_SYS_RESOURCE_H /* exists but does not provide *rlimit funcs */ -#include -#include - -#elif defined(APOLLO) -#undef HAVE_GMTOFF -#undef NO_KILLPG -#undef NO_SETSID -#define HAVE_SYSLOG 1 - -#elif defined(__FreeBSD__) || defined(__bsdi__) -#if defined(__FreeBSD__) -#include -#endif -#define HAVE_GMTOFF 1 -#undef NO_KILLPG -#undef NO_SETSID -#define HAVE_MMAP 1 -#define USE_MMAP_SCOREBOARD -#define USE_MMAP_FILES -#ifndef DEFAULT_USER -#define DEFAULT_USER "nobody" -#endif -#ifndef DEFAULT_GROUP -#define DEFAULT_GROUP "nogroup" -#endif -#if defined(__bsdi__) || \ -(defined(__FreeBSD_version) && (__FreeBSD_version < 220000)) -typedef quad_t rlim_t; -#endif -#define USE_FLOCK_SERIALIZED_ACCEPT -#define SINGLE_LISTEN_UNSERIALIZED_ACCEPT -#define HAVE_SYSLOG 1 -#define SYS_SIGLIST sys_siglist - -#elif defined(QNX) -#ifndef crypt -char *crypt(const char *pw, const char *salt); -#endif -#ifndef initgroups -int initgroups(char *, int); -#endif -#ifndef strncasecmp -#define strncasecmp strnicmp -#endif -#undef NO_KILLPG -#undef NO_SETSID -#define NEED_INITGROUPS -#define NEED_SELECT_H -#define NEED_PROCESS_H -#include -#define HAVE_MMAP 1 -#define USE_POSIX_SCOREBOARD -#define USE_FLOCK_SERIALIZED_ACCEPT -#define SINGLE_LISTEN_UNSERIALIZED_ACCEPT -#define HAVE_SYSLOG 1 - -#elif defined(LYNXOS) -#undef HAVE_GMTOFF -#undef USE_MMAP_SCOREBOARD -#undef USE_SHMGET_SCOREBOARD -#undef USE_FCNTL_SERIALIZED_ACCEPT -#undef USE_FLOCK_SERIALIZED_ACCEPT -#define USE_LONGJMP -#undef NO_KILLPG -#undef NO_SETSID -#undef NO_USE_SIGACTION -#undef NO_LINGCLOSE -extern char *crypt(char *pw, char *salt); -typedef int rlim_t; -#define HAVE_SYSLOG 1 - -#elif defined(UXPDS) -#undef NEED_STRCASECMP -#undef NEED_STRNCASECMP -#undef NEED_STRDUP -#undef HAVE_GMTOFF -#define NO_KILLPG -#undef NO_SETSID -#define bzero(a,b) memset(a,0,b) -#define USE_FCNTL_SERIALIZED_ACCEPT -#define HAVE_MMAP 1 -#define USE_MMAP_SCOREBOARD -#define USE_MMAP_FILES -#define HAVE_SYSLOG 1 - -#elif defined(OS2) -/* Defines required for EMX OS/2 port. */ -#define NO_KILLPG -#define NEED_STRCASECMP -#define NEED_STRNCASECMP -#define NEED_PROCESS_H -#define NO_SETSID -#define NO_TIMES -#define CASE_BLIND_FILESYSTEM -/* Add some drive name support */ -#define chdir _chdir2 -#include -#define MAXSOCKETS 2048 -#define USE_OS2_SCOREBOARD -#define NO_RELIABLE_PIPED_LOGS -#define USE_OS2SEM_SERIALIZED_ACCEPT -#define SINGLE_LISTEN_UNSERIALIZED_ACCEPT - -#elif defined(__MACHTEN__) -typedef int rlim_t; -#undef NO_KILLPG -#define NO_SETSID -#define HAVE_GMTOFF 1 -#ifndef __MACHTEN_PPC__ -#ifndef __MACHTEN_68K__ -#define __MACHTEN_68K__ -#endif -#define USE_FLOCK_SERIALIZED_ACCEPT -#define NO_USE_SIGACTION -#define JMP_BUF sigjmp_buf -#define USE_LONGJMP -#undef NEED_STRDUP -#else -#define HAVE_SHMGET 1 -#define USE_SHMGET_SCOREBOARD -#define USE_FCNTL_SERIALIZED_ACCEPT -#endif - -/* Convex OS v11 */ -#elif defined(CONVEXOS11) -#undef HAVE_GMTOFF -#undef NO_KILLPG -#undef NO_SETSID -#undef NEED_STRDUP -#define HAVE_MMAP 1 -#define USE_MMAP_SCOREBOARD -#define USE_MMAP_FILES -#define HAVE_SYSLOG 1 - -#define NO_TIMEZONE -#include -#include -typedef int rlim_t; - -#elif defined(ISC) -#include -#define NO_KILLPG -#undef NO_SETSID -#define HAVE_SHMGET 1 -#define USE_SHMGET_SCOREBOARD -#define USE_FCNTL_SERIALIZED_ACCEPT -#define HAVE_SYSLOG 1 - -#elif defined(NEWSOS) -#define HAVE_SHMGET 1 -#define USE_SHMGET_SCOREBOARD -#define USE_LONGJMP -#define NO_SETSID -#define NO_USE_SIGACTION -#define NEED_WAITPID -#define NO_OTHER_CHILD -#define HAVE_SYSLOG 1 -#include -#include -#include -typedef int pid_t; -typedef int rlim_t; -typedef int mode_t; - -#elif defined(RISCIX) -#include -typedef int rlim_t; -#define NO_USE_SIGACTION -#define USE_LONGJMP -#define NEED_STRCASECMP -#define NEED_STRNCASECMP -#define NEED_STRDUP - -#elif defined(BEOS) -#include - -#define NO_WRITEV -#define NO_KILLPG -#define NEED_INITGROUPS - -#elif defined(_CX_SX) -#define JMP_BUF sigjmp_buf -#include -#include - -#elif defined(WIN32) - -/* All windows stuff is now in os/win32/os.h */ - -#elif defined(TPF) /* IBM Transaction Processing Facility operating system */ - -#include -#include -#include -#include -#define PRIMECRAS 0x010000 -#define JMP_BUF jmp_buf -#define HAVE_SHMGET -#undef HAVE_SYS_RESOURCE_H -#define NEED_INITGROUPS -#define NEED_SIGNAL_INTERRUPT -#include -#ifndef __strings_h -#define NEED_STRCASECMP -#define NEED_STRNCASECMP -#endif -#define NEED_STRDUP -#define NO_DBM_REWRITEMAP -#define NO_GETTIMEOFDAY -#define NO_KILLPG -#define NO_LINGCLOSE -#define NO_MMAP -#define NO_OTHER_CHILD -#define NO_RELIABLE_PIPED_LOGS -#define NO_SETSID -#define NO_SLACK -#define NO_TIMES -#define NO_USE_SIGACTION -#define NO_WRITEV -#define USE_LONGJMP -/*#define USE_SHMGET_SCOREBOARD*/ -#define USE_TPF_ACCEPT -#define USE_TPF_CORE_SERIALIZED_ACCEPT -/*#define USE_TPF_DAEMON*/ -#define USE_TPF_SCOREBOARD -#define USE_TPF_SELECT -#undef offsetof -#define offsetof(s_type,field) ((size_t)&(((s_type*)0)->field)) - -#elif defined(__TANDEM) -#define NO_WRITEV -#define NO_KILLPG -#define NEED_INITGROUPS -#define NO_SLACK - -#else -/* Unknown system - Edit these to match */ -#ifdef BSD -#define HAVE_GMTOFF 1 -#else -#undef HAVE_GMTOFF -#endif -/* NO_KILLPG is set on systems that don't have killpg */ -#undef NO_KILLPG -/* NO_SETSID is set on systems that don't have setsid */ -#undef NO_SETSID -/* NEED_STRDUP is set on stupid systems that don't have strdup. */ -#undef NEED_STRDUP -#endif - -/* stuff marked API_EXPORT is part of the API, and intended for use - * by modules - */ -#ifndef API_EXPORT -#define API_EXPORT(type) type -#endif - -/* Stuff marked API_EXPORT_NONSTD is part of the API, and intended for - * use by modules. The difference between API_EXPORT and - * API_EXPORT_NONSTD is that the latter is required for any functions - * which use varargs or are used via indirect function call. This - * is to accomodate the two calling conventions in windows dlls. - */ -#ifndef API_EXPORT_NONSTD -#define API_EXPORT_NONSTD(type) type -#endif - -#ifndef MODULE_VAR_EXPORT -#define MODULE_VAR_EXPORT -#endif -#ifndef API_VAR_EXPORT -#define API_VAR_EXPORT -#endif - -/* modules should not used functions marked CORE_EXPORT - * or CORE_EXPORT_NONSTD */ -#ifndef CORE_EXPORT -#define CORE_EXPORT API_EXPORT -#endif -#ifndef CORE_EXPORT_NONSTD -#define CORE_EXPORT_NONSTD API_EXPORT_NONSTD -#endif - -/* On Mac OS X Server, symbols that conflict with loaded dylibs - * (eg. System framework) need to be declared as private symbols with - * __private_extern__. - * For other systems, make that a no-op. - */ -#if (defined(MAC_OS) || defined(MAC_OS_X_SERVER)) && defined(__DYNAMIC__) -#define ap_private_extern __private_extern__ -#else -#define ap_private_extern -#endif - -/* - * The particular directory style your system supports. If you have dirent.h - * in /usr/include (POSIX) or /usr/include/sys (SYSV), #include - * that file and define DIR_TYPE to be dirent. Otherwise, if you have - * /usr/include/sys/dir.h, define DIR_TYPE to be direct and include that - * file. If you have neither, I'm confused. - */ - -#include -#include - -#if !defined(NEXT) && !defined(WIN32) -#include -#define DIR_TYPE dirent -#elif !defined(WIN32) -#include -#define DIR_TYPE direct -#else -#define DIR_TYPE dirent -#endif - -#include -#include -#include -#ifdef __TANDEM -#include -#endif -#include "ap_ctype.h" -#if !defined(MPE) && !defined(WIN32) && !defined(TPF) && !defined(__TANDEM) -#include -#endif -#ifndef WIN32 -#include -#ifdef HAVE_SYS_SELECT_H -#include -#endif /* HAVE_SYS_SELECT_H */ -#ifndef TPF -#include -#endif /* TPF */ -#include -#include -#if !defined(MPE) && !defined(BEOS) && !defined(TPF) -#include /* for inet_ntoa */ -#endif -#include -#include -#include -#include -#define closesocket(s) close(s) -#ifndef O_BINARY -#define O_BINARY (0) -#endif - -#else /* WIN32 */ -#include -#include -#include -#include -#endif /* ndef WIN32 */ -#include -#include /* for ctime */ -#ifdef WIN32 -#define strftime(s,max,format,tm) os_strftime(s,max,format,tm) -#endif -#include -#if defined(TPF) && defined(NSIG) -#undef NSIG -#endif -#include -#if !defined(QNX) && !defined(CONVEXOS11) && !defined(NEXT) && !defined(TPF) -#include -#endif - -#ifdef NEED_PROCESS_H -#include -#endif - -#ifdef WIN32 -#include "../include/hsregex.h" -#elif defined(USE_HSREGEX) -#include "hsregex.h" -#else -#include -#endif - -#ifdef HAVE_SYS_RESOURCE_H -#include -#ifdef SUNOS4 -int getrlimit(int, struct rlimit *); -int setrlimit(int, struct rlimit *); -#endif -#endif -#ifdef USE_MMAP_SCOREBOARD -#if !defined(OS2) && !defined(WIN32) -/* This file is not needed for OS/2 */ -#include -#endif -#endif -#if !defined(MAP_ANON) && defined(MAP_ANONYMOUS) -#define MAP_ANON MAP_ANONYMOUS -#endif - -#if defined(USE_MMAP_FILES) && (defined(NO_MMAP) || !defined(HAVE_MMAP)) -#undef USE_MMAP_FILES -#endif - -#if defined(USE_MMAP_SCOREBOARD) && (defined(NO_MMAP) || !defined(HAVE_MMAP)) -#undef USE_MMAP_SCOREBOARD -#endif - -#if defined(USE_SHMGET_SCOREBOARD) && (defined(NO_SHMGET) || !defined(HAVE_SHMGET)) -#undef USE_SHMGET_SCOREBOARD -#endif - -#ifndef LOGNAME_MAX -#define LOGNAME_MAX 25 -#endif - -#ifdef HAVE_UNISTD_H -#include -#endif - -#ifdef ultrix -#define ULTRIX_BRAIN_DEATH -#endif - -#ifndef S_ISLNK -#define S_ISLNK(m) (((m) & S_IFMT) == S_IFLNK) -#endif - -#ifndef INADDR_NONE -#define INADDR_NONE ((unsigned long) -1) -#endif - -/* - * Replace signal function with sigaction equivalent - */ -#ifndef NO_USE_SIGACTION -typedef void Sigfunc(int); - -#if defined(SIG_IGN) && !defined(SIG_ERR) -#define SIG_ERR ((Sigfunc *)-1) -#endif - -/* - * For some strange reason, QNX defines signal to signal. Eliminate it. - */ -#ifdef signal -#undef signal -#endif -#define signal(s,f) ap_signal(s,f) -Sigfunc *signal(int signo, Sigfunc * func); -#endif - -#include - -#if defined(USE_LONGJMP) -#define ap_longjmp(x, y) longjmp((x), (y)) -#define ap_setjmp(x) setjmp(x) -#ifndef JMP_BUF -#define JMP_BUF jmp_buf -#endif -#else -#define ap_longjmp(x, y) siglongjmp((x), (y)) -#define ap_setjmp(x) sigsetjmp((x), 1) -#ifndef JMP_BUF -#define JMP_BUF sigjmp_buf -#endif -#endif - -/* Majority of os's want to verify FD_SETSIZE */ -#if !defined(WIN32) && !defined(TPF) -#define CHECK_FD_SETSIZE -#endif - -#ifdef USE_TPF_SELECT -#define ap_select(_a, _b, _c, _d, _e) \ - tpf_select(_a, _b, _c, _d, _e) -#elif defined(SELECT_NEEDS_CAST) -#define ap_select(_a, _b, _c, _d, _e) \ - select((_a), (int *)(_b), (int *)(_c), (int *)(_d), (_e)) -#else -#define ap_select(_a, _b, _c, _d, _e) \ - select(_a, _b, _c, _d, _e) -#endif - -#ifdef USE_TPF_ACCEPT -#define ap_accept(_fd, _sa, _ln) tpf_accept(_fd, _sa, _ln) -#else -#define ap_accept(_fd, _sa, _ln) accept(_fd, _sa, _ln) -#endif - -#ifdef NEED_SIGNAL_INTERRUPT -#define ap_check_signals() tpf_process_signals() -#else -#define ap_check_signals() -#endif - -#ifdef ULTRIX_BRAIN_DEATH -#define ap_fdopen(d,m) fdopen((d), (char *)(m)) -#else -#define ap_fdopen(d,m) fdopen((d), (m)) -#endif - -#ifndef ap_inet_addr -#define ap_inet_addr inet_addr -#endif - -#ifdef NO_OTHER_CHILD -#define NO_RELIABLE_PIPED_LOGS -#endif - -/* When the underlying OS doesn't support exec() of scripts which start - * with a HASHBANG (#!) followed by interpreter name and args, define this. - */ -#ifdef NEED_HASHBANG_EMUL -extern int ap_execle(const char *filename, const char *arg,...); -extern int ap_execve(const char *filename, const char *argv[], - const char *envp[]); -/* ap_execle() is a wrapper function around ap_execve(). */ -#define execle ap_execle -#define execve(path,argv,envp) ap_execve(path,argv,envp) -#endif - -/* Finding offsets of elements within structures. - * Taken from the X code... they've sweated portability of this stuff - * so we don't have to. Sigh... - */ - -#if defined(CRAY) || (defined(__arm) && !defined(LINUX)) -#ifdef __STDC__ -#define XtOffset(p_type,field) _Offsetof(p_type,field) -#else -#ifdef CRAY2 -#define XtOffset(p_type,field) \ - (sizeof(int)*((unsigned int)&(((p_type)NULL)->field))) - -#else /* !CRAY2 */ - -#define XtOffset(p_type,field) ((unsigned int)&(((p_type)NULL)->field)) - -#endif /* !CRAY2 */ -#endif /* __STDC__ */ -#else /* ! (CRAY || __arm) */ - -#define XtOffset(p_type,field) \ - ((long) (((char *) (&(((p_type)NULL)->field))) - ((char *) NULL))) - -#endif /* !CRAY */ - -#ifdef offsetof -#define XtOffsetOf(s_type,field) offsetof(s_type,field) -#else -#define XtOffsetOf(s_type,field) XtOffset(s_type*,field) -#endif - -/* - * NET_SIZE_T exists because of shortsightedness on the POSIX committee. BSD - * systems used "int *" as the parameter to accept(), getsockname(), - * getpeername() et al. Consequently many unixes took an int * for that - * parameter. The POSIX committee decided that "int" was just too generic and - * had to be replaced with size_t almost everywhere. There's no problem with - * that when you're passing by value. But when you're passing by reference - * this creates a gross source incompatibility with existing programs. On - * 32-bit architectures it creates only a warning. On 64-bit architectures it - * creates broken code -- because "int *" is a pointer to a 64-bit quantity and - * "size_t *" is frequently a pointer to a 32-bit quantity. - * - * Some Unixes adopted "size_t *" for the sake of POSIX compliance. Others - * ignored it because it was such a broken interface. Chaos ensued. POSIX - * finally woke up and decided that it was wrong and created a new type - * socklen_t. The only useful value for socklen_t is int, and that's how - * everyone who has a clue implements it. It is almost always the case that - * 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 - -/* Linux defines __WCOREDUMP, but doesn't define WCOREDUMP unless __USE_BSD - * is in use... we'd prefer to just use WCOREDUMP everywhere. - */ -#if defined(__WCOREDUMP) && !defined(WCOREDUMP) -#define WCOREDUMP __WCOREDUMP -#endif - -#ifdef SUNOS_LIB_PROTOTYPES -/* Prototypes needed to get a clean compile with gcc -Wall. - * Believe it or not, these do have to be declared, at least on SunOS, - * because they aren't mentioned in the relevant system headers. - * Sun Quality Software. Gotta love it. This section is not - * currently (13Nov97) used. - */ - -int getopt(int, char **, char *); - -int strcasecmp(const char *, const char *); -int strncasecmp(const char *, const char *, int); -int toupper(int); -int tolower(int); - -int printf(char *,...); -int fprintf(FILE *, char *,...); -int fputs(char *, FILE *); -int fread(char *, int, int, FILE *); -int fwrite(char *, int, int, FILE *); -int fgetc(FILE *); -char *fgets(char *s, int, FILE*); -int fflush(FILE *); -int fclose(FILE *); -int ungetc(int, FILE *); -int _filbuf(FILE *); /* !!! */ -int _flsbuf(unsigned char, FILE *); /* !!! */ -int sscanf(char *, char *,...); -void setbuf(FILE *, char *); -void perror(char *); - -time_t time(time_t *); -int strftime(char *, int, const char *, struct tm *); - -int initgroups(char *, int); -int wait3(int *, int, void *); /* Close enough for us... */ -int lstat(const char *, struct stat *); -int stat(const char *, struct stat *); -int flock(int, int); -#ifndef NO_KILLPG -int killpg(int, int); -#endif -int socket(int, int, int); -int setsockopt(int, int, int, const char *, int); -int listen(int, int); -int bind(int, struct sockaddr *, int); -int connect(int, struct sockaddr *, int); -int accept(int, struct sockaddr *, int *); -int shutdown(int, int); - -int getsockname(int s, struct sockaddr *name, int *namelen); -int getpeername(int s, struct sockaddr *name, int *namelen); -int gethostname(char *name, int namelen); -void syslog(int, char *,...); -char *mktemp(char *); - -long vfprintf(FILE *, const char *, va_list); - -#endif /* SUNOS_LIB_PROTOTYPES */ - -/* The assumption is that when the functions are missing, - * then there's no matching prototype available either. - * Declare what is needed exactly as the replacement routines implement it. - */ -#ifdef NEED_STRDUP -extern char *strdup (const char *str); -#endif -#ifdef NEED_STRCASECMP -extern int strcasecmp (const char *a, const char *b); -#endif -#ifdef NEED_STRNCASECMP -extern int strncasecmp (const char *a, const char *b, int n); -#endif -#ifdef NEED_INITGROUPS -extern int initgroups(const char *name, gid_t basegid); -#endif -#ifdef NEED_WAITPID -extern int waitpid(pid_t pid, int *statusp, int options); -#endif -#ifdef NEED_STRERROR -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 - -#ifdef __cplusplus -} -#endif - -#endif /* !AP_CONFIG_H */ diff --git a/include/ap_listen.h b/include/ap_listen.h deleted file mode 100644 index 600f6fca28d7cef2236c68dfbac4a5727f123dfb..0000000000000000000000000000000000000000 --- a/include/ap_listen.h +++ /dev/null @@ -1,86 +0,0 @@ -/* ==================================================================== - * Copyright (c) 1996-1999 The Apache Group. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in - * the documentation and/or other materials provided with the - * distribution. - * - * 3. All advertising materials mentioning features or use of this - * software must display the following acknowledgment: - * "This product includes software developed by the Apache Group - * for use in the Apache HTTP server project (http://www.apache.org/)." - * - * 4. The names "Apache Server" and "Apache Group" must not be used to - * endorse or promote products derived from this software without - * prior written permission. For written permission, please contact - * apache@apache.org. - * - * 5. Products derived from this software may not be called "Apache" - * nor may "Apache" appear in their names without prior written - * permission of the Apache Group. - * - * 6. Redistributions of any form whatsoever must retain the following - * acknowledgment: - * "This product includes software developed by the Apache Group - * for use in the Apache HTTP server project (http://www.apache.org/)." - * - * THIS SOFTWARE IS PROVIDED BY THE APACHE GROUP ``AS IS'' AND ANY - * EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR - * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE APACHE GROUP OR - * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT - * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, - * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED - * OF THE POSSIBILITY OF SUCH DAMAGE. - * ==================================================================== - * - * This software consists of voluntary contributions made by many - * individuals on behalf of the Apache Group and was originally based - * on public domain software written at the National Center for - * Supercomputing Applications, University of Illinois, Urbana-Champaign. - * For more information on the Apache Group and the Apache HTTP server - * project, please see . - * - */ - -#ifndef AP_LISTEN_H -#define AP_LISTEN_H - -typedef struct ap_listen_rec ap_listen_rec; -struct ap_listen_rec { - ap_listen_rec *next; - struct sockaddr_in local_addr; /* local IP address and port */ -/* TODO: replace the fd with APR stuff */ - int fd; -/* more stuff here, like which protocol is bound to the port */ -}; - -ap_listen_rec *ap_listeners; - -void ap_listen_pre_config(void); -int ap_listen_open(pool *pconf, unsigned port); -const char *ap_set_listenbacklog(cmd_parms *cmd, void *dummy, char *arg); -const char *ap_set_listener(cmd_parms *cmd, void *dummy, char *ips); -const char *ap_set_send_buffer_size(cmd_parms *cmd, void *dummy, char *arg); - -#define LISTEN_COMMANDS \ -{ "ListenBacklog", ap_set_listenbacklog, NULL, RSRC_CONF, TAKE1, \ - "Maximum length of the queue of pending connections, as used by listen(2)" }, \ -{ "Listen", ap_set_listener, NULL, RSRC_CONF, TAKE1, \ - "A port number or a numeric IP address and a port number"}, \ -{ "SendBufferSize", ap_set_send_buffer_size, NULL, RSRC_CONF, TAKE1, \ - "Send buffer size in bytes"}, - -#endif diff --git a/include/ap_mmn.h b/include/ap_mmn.h deleted file mode 100644 index 6f3138346d0b8f6d7f70673a145cb00ac4534354..0000000000000000000000000000000000000000 --- a/include/ap_mmn.h +++ /dev/null @@ -1,256 +0,0 @@ -/* ==================================================================== - * Copyright (c) 1998-1999 The Apache Group. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in - * the documentation and/or other materials provided with the - * distribution. - * - * 3. All advertising materials mentioning features or use of this - * software must display the following acknowledgment: - * "This product includes software developed by the Apache Group - * for use in the Apache HTTP server project (http://www.apache.org/)." - * - * 4. The names "Apache Server" and "Apache Group" must not be used to - * endorse or promote products derived from this software without - * prior written permission. For written permission, please contact - * apache@apache.org. - * - * 5. Products derived from this software may not be called "Apache" - * nor may "Apache" appear in their names without prior written - * permission of the Apache Group. - * - * 6. Redistributions of any form whatsoever must retain the following - * acknowledgment: - * "This product includes software developed by the Apache Group - * for use in the Apache HTTP server project (http://www.apache.org/)." - * - * THIS SOFTWARE IS PROVIDED BY THE APACHE GROUP ``AS IS'' AND ANY - * EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR - * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE APACHE GROUP OR - * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT - * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, - * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED - * OF THE POSSIBILITY OF SUCH DAMAGE. - * ==================================================================== - * - * This software consists of voluntary contributions made by many - * individuals on behalf of the Apache Group and was originally based - * on public domain software written at the National Center for - * Supercomputing Applications, University of Illinois, Urbana-Champaign. - * For more information on the Apache Group and the Apache HTTP server - * project, please see . - * - */ - -#ifndef APACHE_AP_MMN_H -#define APACHE_AP_MMN_H - -/* - * 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() - */ - -#define MODULE_MAGIC_COOKIE 0x41503133UL /* "AP13" */ - -#ifndef MODULE_MAGIC_NUMBER_MAJOR -#define MODULE_MAGIC_NUMBER_MAJOR 19990320 -#endif -#define MODULE_MAGIC_NUMBER_MINOR 6 /* 0...n */ -#define MODULE_MAGIC_NUMBER MODULE_MAGIC_NUMBER_MAJOR /* backward compat */ - -/* Useful for testing for features. */ -#define 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 MODULE_MAGIC_AT_LEAST(19980812,2) - ... use ap_overlap_tables() -#else - ... alternative code which doesn't use ap_overlap_tables() -#endif - -*/ - -#endif /* !APACHE_AP_MMN_H */ diff --git a/include/ap_mpm.h b/include/ap_mpm.h deleted file mode 100644 index e025bbc075ebeab6f65606743e7142436de740cd..0000000000000000000000000000000000000000 --- a/include/ap_mpm.h +++ /dev/null @@ -1,109 +0,0 @@ -/* ==================================================================== - * Copyright (c) 1995-1999 The Apache Group. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in - * the documentation and/or other materials provided with the - * distribution. - * - * 3. All advertising materials mentioning features or use of this - * software must display the following acknowledgment: - * "This product includes software developed by the Apache Group - * for use in the Apache HTTP server project (http://www.apache.org/)." - * - * 4. The names "Apache Server" and "Apache Group" must not be used to - * endorse or promote products derived from this software without - * prior written permission. For written permission, please contact - * apache@apache.org. - * - * 5. Products derived from this software may not be called "Apache" - * nor may "Apache" appear in their names without prior written - * permission of the Apache Group. - * - * 6. Redistributions of any form whatsoever must retain the following - * acknowledgment: - * "This product includes software developed by the Apache Group - * for use in the Apache HTTP server project (http://www.apache.org/)." - * - * THIS SOFTWARE IS PROVIDED BY THE APACHE GROUP ``AS IS'' AND ANY - * EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR - * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE APACHE GROUP OR - * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT - * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, - * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED - * OF THE POSSIBILITY OF SUCH DAMAGE. - * ==================================================================== - * - * This software consists of voluntary contributions made by many - * individuals on behalf of the Apache Group and was originally based - * on public domain software written at the National Center for - * Supercomputing Applications, University of Illinois, Urbana-Champaign. - * For more information on the Apache Group and the Apache HTTP server - * project, please see . - * - */ - -#ifndef AP_MMN_H -#define AP_MMN_H - -/* run until a restart/shutdown is indicated, return 1 for shutdown - 0 otherwise */ -API_EXPORT(int) ap_mpm_run(pool *pconf, pool *plog, server_rec *server_conf); - -/* predicate indicating if a graceful stop has been requested ... - used by the connection loop */ -API_EXPORT(int) ap_mpm_graceful_stop(void); - -#ifdef HAS_OTHER_CHILD -/* - * register an other_child -- a child which the main loop keeps track of - * and knows it is different than the rest of the scoreboard. - * - * pid is the pid of the child. - * - * maintenance is a function that is invoked with a reason, the data - * pointer passed here, and when appropriate a status result from waitpid(). - * - * write_fd is an fd that is probed for writing by select() if it is ever - * unwritable, then maintenance is invoked with reason OC_REASON_UNWRITABLE. - * 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); -#define OC_REASON_DEATH 0 /* child has died, caller must call - * unregister still */ -#define OC_REASON_UNWRITABLE 1 /* write_fd is unwritable */ -#define OC_REASON_RESTART 2 /* a restart is occuring, perform - * any necessary cleanup (including - * sending a special signal to child) - */ -#define OC_REASON_UNREGISTER 3 /* unregister has been called, do - * whatever is necessary (including - * kill the child) */ -#define OC_REASON_LOST 4 /* somehow the child exited without - * us knowing ... buggy os? */ - -/* - * unregister an other_child. Note that the data pointer is used here, and - * 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); - -#endif - -#endif diff --git a/include/ap_release.h b/include/ap_release.h deleted file mode 100644 index 8ff04158e842bf0e4eba2a1b70b174217019baa9..0000000000000000000000000000000000000000 --- a/include/ap_release.h +++ /dev/null @@ -1,74 +0,0 @@ -/* ==================================================================== - * The Apache Software License, Version 1.1 - * - * Copyright (c) 2000 The Apache Software Foundation. All rights - * reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in - * the documentation and/or other materials provided with the - * distribution. - * - * 3. The end-user documentation included with the redistribution, - * if any, must include the following acknowledgment: - * "This product includes software developed by the - * Apache Software Foundation (http://www.apache.org/)." - * Alternately, this acknowledgment may appear in the software itself, - * if and wherever such third-party acknowledgments normally appear. - * - * 4. The names "Apache" and "Apache Software Foundation" must - * not be used to endorse or promote products derived from this - * software without prior written permission. For written - * permission, please contact apache@apache.org. - * - * 5. Products derived from this software may not be called "Apache", - * nor may "Apache" appear in their name, without prior written - * permission of the Apache Software Foundation. - * - * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED - * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES - * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR - * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF - * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND - * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, - * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT - * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * ==================================================================== - * - * This software consists of voluntary contributions made by many - * individuals on behalf of the Apache Software Foundation. For more - * information on the Apache Software Foundation, please see - * . - * - * Portions of this software are based upon public domain software - * originally written at the National Center for Supercomputing Applications, - * University of Illinois, Urbana-Champaign. - */ - -#ifndef AP_RELEASE_H -#define AP_RELEASE_H - -#define AP_SERVER_BASEVENDOR "Apache Software Foundation" -#define AP_SERVER_BASEPRODUCT "Apache" -#define AP_SERVER_BASEREVISION "2.0b1-dev" -#define AP_SERVER_BASEVERSION AP_SERVER_BASEPRODUCT "/" AP_SERVER_BASEREVISION -#define AP_SERVER_VERSION AP_SERVER_BASEVERSION - -/* Numeric release version identifier: MMNNFFRBB: major minor fix final beta - * Always increases along the same track as the source branch. - * For example, Apache 1.4.2 would be '10402100', 2.5b7 would be '20500007'. - */ -#define APACHE_RELEASE 20000009 - -#endif diff --git a/include/http_config.h b/include/http_config.h deleted file mode 100644 index e0c29306f8c2235a1deb1367905ddc6cef977d9b..0000000000000000000000000000000000000000 --- a/include/http_config.h +++ /dev/null @@ -1,414 +0,0 @@ -/* ==================================================================== - * Copyright (c) 1995-1999 The Apache Group. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in - * the documentation and/or other materials provided with the - * distribution. - * - * 3. All advertising materials mentioning features or use of this - * software must display the following acknowledgment: - * "This product includes software developed by the Apache Group - * for use in the Apache HTTP server project (http://www.apache.org/)." - * - * 4. The names "Apache Server" and "Apache Group" must not be used to - * endorse or promote products derived from this software without - * prior written permission. For written permission, please contact - * apache@apache.org. - * - * 5. Products derived from this software may not be called "Apache" - * nor may "Apache" appear in their names without prior written - * permission of the Apache Group. - * - * 6. Redistributions of any form whatsoever must retain the following - * acknowledgment: - * "This product includes software developed by the Apache Group - * for use in the Apache HTTP server project (http://www.apache.org/)." - * - * THIS SOFTWARE IS PROVIDED BY THE APACHE GROUP ``AS IS'' AND ANY - * EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR - * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE APACHE GROUP OR - * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT - * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, - * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED - * OF THE POSSIBILITY OF SUCH DAMAGE. - * ==================================================================== - * - * This software consists of voluntary contributions made by many - * individuals on behalf of the Apache Group and was originally based - * on public domain software written at the National Center for - * Supercomputing Applications, University of Illinois, Urbana-Champaign. - * For more information on the Apache Group and the Apache HTTP server - * project, please see . - * - */ - -#ifndef APACHE_HTTP_CONFIG_H -#define APACHE_HTTP_CONFIG_H - -#ifdef __cplusplus -extern "C" { -#endif - -/* - * 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. - */ -enum 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 */ -}; - -typedef struct command_struct { - const char *name; /* Name of this command */ - const char *(*func) (); /* Function invoked */ - void *cmd_data; /* Extra data, for functions which - * implement multiple commands... - */ - int req_override; /* What overrides need to be allowed to - * enable this command. - */ - enum cmd_how args_how; /* What the command expects as arguments */ - - const char *errmsg; /* 'usage' message, in case of syntax errors */ -} 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 - */ -#define OR_NONE 0 -#define OR_LIMIT 1 -#define OR_OPTIONS 2 -#define OR_FILEINFO 4 -#define OR_AUTHCFG 8 -#define OR_INDEXES 16 -#define OR_UNSET 32 -#define ACCESS_CONF 64 -#define RSRC_CONF 128 -#define OR_ALL (OR_LIMIT|OR_OPTIONS|OR_FILEINFO|OR_AUTHCFG|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. - */ - -#define 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*... - */ - -typedef struct { - void *info; /* Argument to command from cmd_table */ - int override; /* Which allow-override bits are set */ - int limited; /* Which methods are ed */ - - configfile_t *config_file; /* Config file structure from pcfg_openfile() */ - - ap_pool *pool; /* Pool to allocate new storage in */ - struct pool *temp_pool; /* Pool for scratch memory; persists during - * configuration, but wiped before the first - * request is served... - */ - server_rec *server; /* Server_rec being configured for */ - char *path; /* 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). - */ - const command_rec *cmd; /* configuration command */ - const char *end_token; /* end token required to end a nested section */ - void *context; /* per_dir_config vector passed - * to handle_command */ -} cmd_parms; - -/* This structure records the existence of handlers in a module... */ - -typedef struct { - const char *content_type; /* MUST be all lower case */ - int (*handler) (request_rec *); -} handler_rec; - -/* - * Module structures. Just about everything is dispatched through - * these, directly or indirectly (through the command and handler - * tables). - */ - -typedef struct module_struct { - int version; /* API version, *not* module version; - * check that module is compatible with this - * version of the server. - */ - int minor_version; /* API minor version. Provides API feature - * milestones. Not checked during module init - */ - int module_index; /* Index to this modules structures in - * config vectors. - */ - - const char *name; - void *dynamic_load_handle; - - struct module_struct *next; - - unsigned long magic; /* 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. - */ -#ifdef ULTRIX_BRAIN_DEATH - void (*init) (); - void *(*create_dir_config) (); - void *(*merge_dir_config) (); - void *(*create_server_config) (); - void *(*merge_server_config) (); -#else - void (*init) (server_rec *, pool *); - void *(*create_dir_config) (pool *p, char *dir); - void *(*merge_dir_config) (pool *p, void *base_conf, void *new_conf); - void *(*create_server_config) (pool *p, server_rec *s); - void *(*merge_server_config) (pool *p, void *base_conf, void *new_conf); -#endif - - const command_rec *cmds; - const handler_rec *handlers; - - /* 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. - */ - - int (*translate_handler) (request_rec *); - int (*ap_check_user_id) (request_rec *); - int (*auth_checker) (request_rec *); - int (*access_checker) (request_rec *); - int (*type_checker) (request_rec *); - int (*fixer_upper) (request_rec *); - int (*logger) (request_rec *); - int (*header_parser) (request_rec *); - - /* 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 - void (*child_init) (server_rec *, pool *); - void (*child_exit) (server_rec *, pool *); -#endif - int (*post_read_request) (request_rec *); -} 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. - */ - -#define STANDARD_MODULE_STUFF MODULE_MAGIC_NUMBER_MAJOR, \ - MODULE_MAGIC_NUMBER_MINOR, \ - -1, \ - __FILE__, \ - NULL, \ - NULL, \ - MODULE_MAGIC_COOKIE - -/* 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... */ - -void ap_single_module_configure(pool *p, server_rec *s, module *m); - -/* For http_main.c... */ - -server_rec *ap_read_config(pool *conf_pool, pool *temp_pool, char *config_name); -void ap_init_modules(pool *p, server_rec *s); -void ap_child_init_modules(pool *p, server_rec *s); -void ap_child_exit_modules(pool *p, server_rec *s); -void ap_setup_prelinked_modules(void); -void ap_show_directives(void); -void ap_show_modules(void); - -/* For http_request.c... */ - -void *ap_create_request_config(pool *p); -CORE_EXPORT(void *) ap_create_per_dir_config(pool *p); -void *ap_merge_per_dir_configs(pool *p, void *base, void *new); - -/* For http_core.c... ( command and virtual hosts) */ - -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 **); -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: */ -#define NOT_IN_VIRTUALHOST 0x01 /* */ -#define NOT_IN_LIMIT 0x02 /* */ -#define NOT_IN_DIRECTORY 0x04 /* */ -#define NOT_IN_LOCATION 0x08 /* */ -#define NOT_IN_FILES 0x10 /* */ -#define NOT_IN_DIR_LOC_FILE (NOT_IN_DIRECTORY|NOT_IN_LOCATION|NOT_IN_FILES) /* //*/ -#define GLOBAL_ONLY (NOT_IN_VIRTUALHOST|NOT_IN_LIMIT|NOT_IN_DIR_LOC_FILE) - - -/* Module-method dispatchers, also for http_request.c */ - -int ap_translate_name(request_rec *); -int ap_check_access(request_rec *); /* check access on non-auth basis */ -int ap_check_user_id(request_rec *); /* obtain valid username from client auth */ -int ap_check_auth(request_rec *); /* check (validated) user is authorized here */ -int ap_find_types(request_rec *); /* identify MIME type */ -int ap_run_fixups(request_rec *); /* poke around for other metainfo, etc.... */ -int ap_invoke_handler(request_rec *); -int ap_log_transaction(request_rec *r); -int ap_header_parse(request_rec *); -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 - -#ifdef __cplusplus -} -#endif - -#endif /* !APACHE_HTTP_CONFIG_H */ diff --git a/include/http_connection.h b/include/http_connection.h deleted file mode 100644 index cbe8e74f4e756327226e6bb8c5b67f2197514282..0000000000000000000000000000000000000000 --- a/include/http_connection.h +++ /dev/null @@ -1,71 +0,0 @@ -/* ==================================================================== - * Copyright (c) 1995-1999 The Apache Group. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in - * the documentation and/or other materials provided with the - * distribution. - * - * 3. All advertising materials mentioning features or use of this - * software must display the following acknowledgment: - * "This product includes software developed by the Apache Group - * for use in the Apache HTTP server project (http://www.apache.org/)." - * - * 4. The names "Apache Server" and "Apache Group" must not be used to - * endorse or promote products derived from this software without - * prior written permission. For written permission, please contact - * apache@apache.org. - * - * 5. Products derived from this software may not be called "Apache" - * nor may "Apache" appear in their names without prior written - * permission of the Apache Group. - * - * 6. Redistributions of any form whatsoever must retain the following - * acknowledgment: - * "This product includes software developed by the Apache Group - * for use in the Apache HTTP server project (http://www.apache.org/)." - * - * THIS SOFTWARE IS PROVIDED BY THE APACHE GROUP ``AS IS'' AND ANY - * EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR - * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE APACHE GROUP OR - * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT - * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, - * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED - * OF THE POSSIBILITY OF SUCH DAMAGE. - * ==================================================================== - * - * This software consists of voluntary contributions made by many - * individuals on behalf of the Apache Group and was originally based - * on public domain software written at the National Center for - * Supercomputing Applications, University of Illinois, Urbana-Champaign. - * For more information on the Apache Group and the Apache HTTP server - * project, please see . - * - */ - -#ifndef APACHE_HTTP_CONNECTION_H -#define APACHE_HTTP_CONNECTION_H - -#ifdef __cplusplus -extern "C" { -#endif - -CORE_EXPORT(void) ap_process_connection(conn_rec *); - -#ifdef __cplusplus -} -#endif - -#endif /* !APACHE_HTTP_REQUEST_H */ diff --git a/include/http_core.h b/include/http_core.h deleted file mode 100644 index 459fd248f354ea50da759b2458da423ef2be94d8..0000000000000000000000000000000000000000 --- a/include/http_core.h +++ /dev/null @@ -1,310 +0,0 @@ -/* ==================================================================== - * Copyright (c) 1995-1999 The Apache Group. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in - * the documentation and/or other materials provided with the - * distribution. - * - * 3. All advertising materials mentioning features or use of this - * software must display the following acknowledgment: - * "This product includes software developed by the Apache Group - * for use in the Apache HTTP server project (http://www.apache.org/)." - * - * 4. The names "Apache Server" and "Apache Group" must not be used to - * endorse or promote products derived from this software without - * prior written permission. For written permission, please contact - * apache@apache.org. - * - * 5. Products derived from this software may not be called "Apache" - * nor may "Apache" appear in their names without prior written - * permission of the Apache Group. - * - * 6. Redistributions of any form whatsoever must retain the following - * acknowledgment: - * "This product includes software developed by the Apache Group - * for use in the Apache HTTP server project (http://www.apache.org/)." - * - * THIS SOFTWARE IS PROVIDED BY THE APACHE GROUP ``AS IS'' AND ANY - * EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR - * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE APACHE GROUP OR - * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT - * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, - * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED - * OF THE POSSIBILITY OF SUCH DAMAGE. - * ==================================================================== - * - * This software consists of voluntary contributions made by many - * individuals on behalf of the Apache Group and was originally based - * on public domain software written at the National Center for - * Supercomputing Applications, University of Illinois, Urbana-Champaign. - * For more information on the Apache Group and the Apache HTTP server - * project, please see . - * - */ - -#ifndef APACHE_HTTP_CORE_H -#define APACHE_HTTP_CORE_H - -#ifdef __cplusplus -extern "C" { -#endif - -/***************************************************************** - * - * 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). - */ - -#define OPT_NONE 0 -#define OPT_INDEXES 1 -#define OPT_INCLUDES 2 -#define OPT_SYM_LINKS 4 -#define OPT_EXECCGI 8 -#define OPT_UNSET 16 -#define OPT_INCNOEXEC 32 -#define OPT_SYM_OWNER 64 -#define OPT_MULTI 128 -#define OPT_ALL (OPT_INDEXES|OPT_INCLUDES|OPT_SYM_LINKS|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. - */ -#define 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. - */ -#define REMOTE_NAME (1) - -/* REMOTE_NOLOOKUP is like REMOTE_NAME except that a DNS lookup is - * never forced. - */ -#define 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. - */ -#define REMOTE_DOUBLE_REV (3) - -#define SATISFY_ALL 0 -#define SATISFY_ANY 1 -#define SATISFY_NOSPEC 2 - -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); - -/* 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. - */ - -typedef struct { - int method_mask; - char *requirement; -} require_line; - -API_EXPORT(const char *) ap_auth_type (request_rec *); -API_EXPORT(const char *) ap_auth_name (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 } 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. - */ - -char *ap_response_code_string (request_rec *r, int error_index); - -extern API_VAR_EXPORT module core_module; - -/* Per-directory configuration */ - -typedef unsigned char allow_options_t; -typedef unsigned char overrides_t; - -typedef struct { - /* path of the directory/regex/etc. see also d_is_fnmatch below */ - char *d; - /* the number of slashes in d */ - unsigned d_components; - - /* 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. - */ - allow_options_t opts; - allow_options_t opts_add; - allow_options_t opts_remove; - overrides_t override; - - /* 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... - */ - - char *ap_default_type; - - /* Authentication stuff. Groan... */ - - int satisfy; - char *ap_auth_type; - char *ap_auth_name; - array_header *ap_requires; - - /* 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(). - */ - - char **response_code_strings; - - /* Hostname resolution etc */ -#define HOSTNAME_LOOKUP_OFF 0 -#define HOSTNAME_LOOKUP_ON 1 -#define HOSTNAME_LOOKUP_DOUBLE 2 -#define HOSTNAME_LOOKUP_UNSET 3 - 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? */ - -#define USE_CANONICAL_NAME_OFF (0) -#define USE_CANONICAL_NAME_ON (1) -#define USE_CANONICAL_NAME_DNS (2) -#define USE_CANONICAL_NAME_UNSET (3) - 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; - - /* System Resource Control */ -#ifdef RLIMIT_CPU - struct rlimit *limit_cpu; -#endif -#if defined (RLIMIT_DATA) || defined (RLIMIT_VMEM) || defined(RLIMIT_AS) - struct rlimit *limit_mem; -#endif -#ifdef RLIMIT_NPROC - struct rlimit *limit_nproc; -#endif - unsigned long limit_req_body; /* limit on bytes in request msg body */ - - /* logging options */ - enum { srv_sig_unset, srv_sig_off, srv_sig_on, - srv_sig_withmail } server_signature; - int loglevel; - - /* Access control */ - array_header *sec; - regex_t *r; - -#ifdef WIN32 - /* Where to find interpreter to run scripts */ - interpreter_source_e script_interpreter_source; -#endif - -} core_dir_config; - -/* Per-server core configuration */ - -typedef struct { - -#ifdef GPROF - char *gprof_dir; -#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: - */ - char *ap_document_root; - - /* Access control */ - - char *access_name; - array_header *sec; - array_header *sec_url; -} core_server_config; - -/* for http_config.c */ -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 - -#ifdef __cplusplus -} -#endif - -#endif /* !APACHE_HTTP_CORE_H */ diff --git a/include/http_log.h b/include/http_log.h deleted file mode 100644 index d9162bd22fb68e6d4a4dc4ecc051b7430e6228c7..0000000000000000000000000000000000000000 --- a/include/http_log.h +++ /dev/null @@ -1,162 +0,0 @@ -/* ==================================================================== - * Copyright (c) 1995-1999 The Apache Group. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in - * the documentation and/or other materials provided with the - * distribution. - * - * 3. All advertising materials mentioning features or use of this - * software must display the following acknowledgment: - * "This product includes software developed by the Apache Group - * for use in the Apache HTTP server project (http://www.apache.org/)." - * - * 4. The names "Apache Server" and "Apache Group" must not be used to - * endorse or promote products derived from this software without - * prior written permission. For written permission, please contact - * apache@apache.org. - * - * 5. Products derived from this software may not be called "Apache" - * nor may "Apache" appear in their names without prior written - * permission of the Apache Group. - * - * 6. Redistributions of any form whatsoever must retain the following - * acknowledgment: - * "This product includes software developed by the Apache Group - * for use in the Apache HTTP server project (http://www.apache.org/)." - * - * THIS SOFTWARE IS PROVIDED BY THE APACHE GROUP ``AS IS'' AND ANY - * EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR - * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE APACHE GROUP OR - * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT - * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, - * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED - * OF THE POSSIBILITY OF SUCH DAMAGE. - * ==================================================================== - * - * This software consists of voluntary contributions made by many - * individuals on behalf of the Apache Group and was originally based - * on public domain software written at the National Center for - * Supercomputing Applications, University of Illinois, Urbana-Champaign. - * For more information on the Apache Group and the Apache HTTP server - * project, please see . - * - */ - -#ifndef APACHE_HTTP_LOG_H -#define APACHE_HTTP_LOG_H - -#ifdef __cplusplus -extern "C" { -#endif - -#ifdef HAVE_SYSLOG -#include - -#define APLOG_EMERG LOG_EMERG /* system is unusable */ -#define APLOG_ALERT LOG_ALERT /* action must be taken immediately */ -#define APLOG_CRIT LOG_CRIT /* critical conditions */ -#define APLOG_ERR LOG_ERR /* error conditions */ -#define APLOG_WARNING LOG_WARNING /* warning conditions */ -#define APLOG_NOTICE LOG_NOTICE /* normal but significant condition */ -#define APLOG_INFO LOG_INFO /* informational */ -#define APLOG_DEBUG LOG_DEBUG /* debug-level messages */ - -#define APLOG_LEVELMASK LOG_PRIMASK /* mask off the level value */ - -#else - -#define APLOG_EMERG 0 /* system is unusable */ -#define APLOG_ALERT 1 /* action must be taken immediately */ -#define APLOG_CRIT 2 /* critical conditions */ -#define APLOG_ERR 3 /* error conditions */ -#define APLOG_WARNING 4 /* warning conditions */ -#define APLOG_NOTICE 5 /* normal but significant condition */ -#define APLOG_INFO 6 /* informational */ -#define APLOG_DEBUG 7 /* debug-level messages */ - -#define APLOG_LEVELMASK 7 /* mask off the level value */ - -#endif - -#define APLOG_NOERRNO (APLOG_LEVELMASK + 1) -#ifdef WIN32 -/* Set to indicate that error msg should come from Win32's GetLastError(), - * not errno. */ -#define APLOG_WIN32ERROR ((APLOG_LEVELMASK+1) * 2) -#endif - -#ifndef DEFAULT_LOGLEVEL -#define DEFAULT_LOGLEVEL APLOG_WARNING -#endif - -#define APLOG_MARK __FILE__,__LINE__ - -void ap_open_logs (server_rec *, pool *p); - -/* The two primary logging functions, ap_log_error and ap_log_rerror, - * use a printf style format string to build the log message. It is - * VERY IMPORTANT that you not include any raw data from the network, - * such as the request-URI or request header fields, within the format - * string. Doing so makes the server vulnerable to a denial-of-service - * attack and other messy behavior. Instead, use a simple format string - * like "%s", followed by the string containing the untrusted data. - */ -API_EXPORT(void) ap_log_error(const char *file, int line, int level, - const server_rec *s, const char *fmt, ...) - __attribute__((format(printf,5,6))); -API_EXPORT(void) ap_log_rerror(const char *file, int line, int level, - const request_rec *s, const char *fmt, ...) - __attribute__((format(printf,5,6))); -API_EXPORT(void) ap_error_log2stderr (server_rec *); - -void ap_log_pid (pool *p, char *fname); -/* These are for legacy code, new code should use ap_log_error, - * or ap_log_rerror. - */ -API_EXPORT(void) ap_log_error_old(const char *err, server_rec *s); -API_EXPORT(void) ap_log_unixerr(const char *routine, const char *file, - const char *msg, server_rec *s); -API_EXPORT(void) ap_log_printf(const server_rec *s, const char *fmt, ...) - __attribute__((format(printf,2,3))); -API_EXPORT(void) ap_log_reason(const char *reason, const char *fname, - request_rec *r); - -typedef struct piped_log { - pool *p; -#ifndef NO_RELIABLE_PIPED_LOGS - char *program; - int pid; - int fds[2]; -#else - FILE *write_f; -#endif -} piped_log; - -API_EXPORT(piped_log *) ap_open_piped_log (pool *p, const char *program); -API_EXPORT(void) ap_close_piped_log (piped_log *); -#ifndef NO_RELIABLE_PIPED_LOGS -#define ap_piped_log_read_fd(pl) ((pl)->fds[0]) -#define ap_piped_log_write_fd(pl) ((pl)->fds[1]) -#else -#define ap_piped_log_read_fd(pl) (-1) -#define ap_piped_log_write_fd(pl) (fileno((pl)->write_f)) -#endif - -#ifdef __cplusplus -} -#endif - -#endif /* !APACHE_HTTP_LOG_H */ diff --git a/include/http_main.h b/include/http_main.h deleted file mode 100644 index a0d014de785e76c0caa0efd806aa7fb5ea27be43..0000000000000000000000000000000000000000 --- a/include/http_main.h +++ /dev/null @@ -1,174 +0,0 @@ -/* ==================================================================== - * Copyright (c) 1995-1999 The Apache Group. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in - * the documentation and/or other materials provided with the - * distribution. - * - * 3. All advertising materials mentioning features or use of this - * software must display the following acknowledgment: - * "This product includes software developed by the Apache Group - * for use in the Apache HTTP server project (http://www.apache.org/)." - * - * 4. The names "Apache Server" and "Apache Group" must not be used to - * endorse or promote products derived from this software without - * prior written permission. For written permission, please contact - * apache@apache.org. - * - * 5. Products derived from this software may not be called "Apache" - * nor may "Apache" appear in their names without prior written - * permission of the Apache Group. - * - * 6. Redistributions of any form whatsoever must retain the following - * acknowledgment: - * "This product includes software developed by the Apache Group - * for use in the Apache HTTP server project (http://www.apache.org/)." - * - * THIS SOFTWARE IS PROVIDED BY THE APACHE GROUP ``AS IS'' AND ANY - * EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR - * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE APACHE GROUP OR - * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT - * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, - * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED - * OF THE POSSIBILITY OF SUCH DAMAGE. - * ==================================================================== - * - * This software consists of voluntary contributions made by many - * individuals on behalf of the Apache Group and was originally based - * on public domain software written at the National Center for - * Supercomputing Applications, University of Illinois, Urbana-Champaign. - * For more information on the Apache Group and the Apache HTTP server - * project, please see . - * - */ - -#ifndef APACHE_HTTP_MAIN_H -#define APACHE_HTTP_MAIN_H - -#ifdef __cplusplus -extern "C" { -#endif - -/* - * Routines in http_main.c which other code --- in particular modules --- - * may want to call. Right now, that's limited to timeout handling. - * There are two functions which modules can call to trigger a timeout - * (with the per-virtual-server timeout duration); these are hard_timeout - * and soft_timeout. - * - * The difference between the two is what happens when the timeout - * expires (or earlier than that, if the client connection aborts) --- - * a soft_timeout just puts the connection to the client in an - * "aborted" state, which will cause http_protocol.c to stop trying to - * talk to the client, but otherwise allows the code to continue normally. - * hard_timeout(), by contrast, logs the request, and then aborts it - * completely --- longjmp()ing out to the accept() loop in http_main. - * Any resources tied into the request's resource pool will be cleaned up; - * everything that isn't will leak. - * - * soft_timeout() is recommended as a general rule, because it gives your - * code a chance to clean up. However, hard_timeout() may be the most - * convenient way of dealing with timeouts waiting for some external - * resource other than the client, if you can live with the restrictions. - * - * (When a hard timeout is in scope, critical sections can be guarded - * with block_alarms() and unblock_alarms() --- these are declared in - * alloc.c because they are most often used in conjunction with - * routines to allocate something or other, to make sure that the - * cleanup does get registered before any alarm is allowed to happen - * which might require it to be cleaned up; they * are, however, - * implemented in http_main.c). - * - * NOTE! It's not "fair" for a hard_timeout to be in scope through calls - * across modules. Your module code really has no idea what other modules may - * be present in the server, and they may not take too kindly to having a - * longjmp() happen -- it could result in corrupted state. Heck they may not - * even take to kindly to a soft_timeout()... because it can cause EINTR to - * happen on pretty much any syscall, and unless all the libraries and modules - * in use are known to deal well with EINTR it could cause corruption as well. - * But things are likely to do much better with a soft_timeout in scope than a - * hard_timeout. - * - * A module MAY NOT use a hard_timeout() across * sub_req_lookup_xxx() - * functions, or across run_sub_request() functions. A module SHOULD NOT use a - * soft_timeout() in either of these cases, but sometimes there's just no - * choice. - * - * kill_timeout() will disarm either variety of timeout. - * - * reset_timeout() resets the timeout in progress. - */ - -void ap_start_shutdown(void); -void ap_start_restart(int); -API_EXPORT(void) ap_hard_timeout(char *, request_rec *); -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 *); - -API_EXPORT(void) ap_child_terminate(request_rec *r); -API_EXPORT(void) ap_sync_scoreboard_image(void); -int ap_update_child_status(int child_num, int status, request_rec *r); -void ap_time_process_request(int child_num, int status); -unsigned int ap_set_callback_and_alarm(void (*fn) (int), int x); -API_EXPORT(int) ap_check_alarm(void); - -#ifndef NO_OTHER_CHILD -/* - * register an other_child -- a child which the main loop keeps track of - * and knows it is different than the rest of the scoreboard. - * - * pid is the pid of the child. - * - * maintenance is a function that is invoked with a reason, the data - * pointer passed here, and when appropriate a status result from waitpid(). - * - * write_fd is an fd that is probed for writing by select() if it is ever - * unwritable, then maintenance is invoked with reason OC_REASON_UNWRITABLE. - * 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); -#define OC_REASON_DEATH 0 /* child has died, caller must call - * unregister still */ -#define OC_REASON_UNWRITABLE 1 /* write_fd is unwritable */ -#define OC_REASON_RESTART 2 /* a restart is occuring, perform - * any necessary cleanup (including - * sending a special signal to child) - */ -#define OC_REASON_UNREGISTER 3 /* unregister has been called, do - * whatever is necessary (including - * kill the child) */ -#define OC_REASON_LOST 4 /* somehow the child exited without - * us knowing ... buggy os? */ - -/* - * unregister an other_child. Note that the data pointer is used here, and - * 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); - -#endif - -#ifdef __cplusplus -} -#endif - -#endif /* !APACHE_HTTP_MAIN_H */ diff --git a/include/http_protocol.h b/include/http_protocol.h deleted file mode 100644 index 3824c1aba069813f7274eb68b9d165bab561a34f..0000000000000000000000000000000000000000 --- a/include/http_protocol.h +++ /dev/null @@ -1,223 +0,0 @@ -/* ==================================================================== - * Copyright (c) 1995-1999 The Apache Group. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in - * the documentation and/or other materials provided with the - * distribution. - * - * 3. All advertising materials mentioning features or use of this - * software must display the following acknowledgment: - * "This product includes software developed by the Apache Group - * for use in the Apache HTTP server project (http://www.apache.org/)." - * - * 4. The names "Apache Server" and "Apache Group" must not be used to - * endorse or promote products derived from this software without - * prior written permission. For written permission, please contact - * apache@apache.org. - * - * 5. Products derived from this software may not be called "Apache" - * nor may "Apache" appear in their names without prior written - * permission of the Apache Group. - * - * 6. Redistributions of any form whatsoever must retain the following - * acknowledgment: - * "This product includes software developed by the Apache Group - * for use in the Apache HTTP server project (http://www.apache.org/)." - * - * THIS SOFTWARE IS PROVIDED BY THE APACHE GROUP ``AS IS'' AND ANY - * EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR - * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE APACHE GROUP OR - * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT - * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, - * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED - * OF THE POSSIBILITY OF SUCH DAMAGE. - * ==================================================================== - * - * This software consists of voluntary contributions made by many - * individuals on behalf of the Apache Group and was originally based - * on public domain software written at the National Center for - * Supercomputing Applications, University of Illinois, Urbana-Champaign. - * For more information on the Apache Group and the Apache HTTP server - * project, please see . - * - */ - -#ifndef APACHE_HTTP_PROTOCOL_H -#define APACHE_HTTP_PROTOCOL_H - -#ifdef __cplusplus -extern "C" { -#endif - -/* - * Prototypes for routines which either talk directly back to the user, - * or control the ones that eventually do. - */ - -/* Read a request and fill in the fields. */ - -request_rec *ap_read_request(conn_rec *c); - -/* Send a single HTTP header field */ - -API_EXPORT_NONSTD(int) ap_send_header_field(request_rec *r, const char *fieldname, - const char *fieldval); - -/* Send the minimal part of an HTTP response header... but modules should be - * very careful about using this, and should prefer ap_send_http_header(). - * Much of the HTTP/1.1 implementation correctness depends on code in - * ap_send_http_header(). - */ -API_EXPORT(void) ap_basic_http_header(request_rec *r); - -/* Send the Status-Line and header fields for HTTP response */ - -API_EXPORT(void) ap_send_http_header(request_rec *l); - -/* Send the response to special method requests */ - -API_EXPORT(int) ap_send_http_trace(request_rec *r); -int ap_send_http_options(request_rec *r); - -/* Finish up stuff after a request */ - -API_EXPORT(void) ap_finalize_request_protocol(request_rec *r); - -/* Send error back to client... last arg indicates error status in case - * we get an error in the process of trying to deal with an ErrorDocument - * to handle some other error. In that case, we print the default report - * for the first thing that went wrong, and more briefly report on the - * problem with the ErrorDocument. - */ - -void ap_send_error_response(request_rec *r, int recursive_error); - -/* Set last modified header line from the lastmod date of the associated file. - * Also, set content length. - * - * May return an error status, typically USE_LOCAL_COPY (that when the - * 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); - -/* Other ways to send stuff at the client. All of these keep track - * of bytes_sent automatically. This indirection is intended to make - * it a little more painless to slide things like HTTP-NG packetization - * underneath the main body of the code later. In the meantime, it lets - * us centralize a bit of accounting (bytes_sent). - * - * These also return the number of bytes written by the call. - * They should only be called with a timeout registered, for obvious reaasons. - * (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); - -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); - -API_EXPORT(size_t) ap_send_mmap(void *mm, request_rec *r, size_t offset, - size_t length); - -/* Hmmm... could macrofy these for now, and maybe forever, though the - * definitions of the macros would get a whole lot hairier. - */ - -API_EXPORT(int) ap_rputc(int c, request_rec *r); -API_EXPORT(int) ap_rputs(const char *str, request_rec *r); -API_EXPORT(int) ap_rwrite(const void *buf, int nbyte, request_rec *r); -API_EXPORT_NONSTD(int) ap_rvputs(request_rec *r,...); -API_EXPORT(int) ap_vrprintf(request_rec *r, const char *fmt, va_list vlist); -API_EXPORT_NONSTD(int) ap_rprintf(request_rec *r, const char *fmt,...) - __attribute__((format(printf,2,3))); -API_EXPORT(int) ap_rflush(request_rec *r); - -/* - * Index used in custom_responses array for a specific error code - * (only use outside protocol.c is in getting them configured). - */ - -API_EXPORT(int) ap_index_of_response(int status); - -/* 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); - -/* 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); - -/* Support for the Basic authentication protocol. Note that there's - * nothing that prevents these from being in mod_auth.c, except that other - * modules which wanted to provide their own variants on finding users and - * passwords for Basic auth (a fairly common request) would then require - * mod_auth to be loaded or they wouldn't work. - * - * get_basic_auth_pw returns 0 (OK) if it set the 'pw' argument (and assured - * a correct value in r->connection->user); otherwise it returns an error - * code, either SERVER_ERROR if things are really confused, AUTH_REQUIRED - * if no authentication at all seemed to be in use, or DECLINED if there - * was authentication but it wasn't Basic (in which case, the caller should - * presumably decline as well). - * - * note_basic_auth_failure arranges for the right stuff to be scribbled on - * the HTTP return so that the client knows how to authenticate itself the - * next time. As does note_digest_auth_failure for Digest auth. - * - * note_auth_failure does the same thing, but will call the correct one - * based on the authentication type in use. - * - */ - -API_EXPORT(void) ap_note_auth_failure(request_rec *r); -API_EXPORT(void) ap_note_basic_auth_failure(request_rec *r); -API_EXPORT(void) ap_note_digest_auth_failure(request_rec *r); -API_EXPORT(int) ap_get_basic_auth_pw(request_rec *r, const char **pw); - -/* - * Setting up the protocol fields for subsidiary requests... - * Also, a wrapup function to keep the internal accounting straight. - */ - -void ap_set_sub_req_protocol(request_rec *rnew, const request_rec *r); -void ap_finalize_sub_req_protocol(request_rec *sub_r); - -/* This is also useful for putting sub_reqs and internal_redirects together */ - -CORE_EXPORT(void) ap_parse_uri(request_rec *r, const char *uri); - -/* Get the method number associated with the given string, assumed to - * contain an HTTP method. Returns M_INVALID if not recognized. - */ -API_EXPORT(int) ap_method_number_of(const char *method); - -#ifdef __cplusplus -} -#endif - -#endif /* !APACHE_HTTP_PROTOCOL_H */ diff --git a/include/http_request.h b/include/http_request.h deleted file mode 100644 index 4d83c543d6abe5141a66d38c8463249d1238aa16..0000000000000000000000000000000000000000 --- a/include/http_request.h +++ /dev/null @@ -1,117 +0,0 @@ -/* ==================================================================== - * Copyright (c) 1995-1999 The Apache Group. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in - * the documentation and/or other materials provided with the - * distribution. - * - * 3. All advertising materials mentioning features or use of this - * software must display the following acknowledgment: - * "This product includes software developed by the Apache Group - * for use in the Apache HTTP server project (http://www.apache.org/)." - * - * 4. The names "Apache Server" and "Apache Group" must not be used to - * endorse or promote products derived from this software without - * prior written permission. For written permission, please contact - * apache@apache.org. - * - * 5. Products derived from this software may not be called "Apache" - * nor may "Apache" appear in their names without prior written - * permission of the Apache Group. - * - * 6. Redistributions of any form whatsoever must retain the following - * acknowledgment: - * "This product includes software developed by the Apache Group - * for use in the Apache HTTP server project (http://www.apache.org/)." - * - * THIS SOFTWARE IS PROVIDED BY THE APACHE GROUP ``AS IS'' AND ANY - * EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR - * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE APACHE GROUP OR - * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT - * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, - * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED - * OF THE POSSIBILITY OF SUCH DAMAGE. - * ==================================================================== - * - * This software consists of voluntary contributions made by many - * individuals on behalf of the Apache Group and was originally based - * on public domain software written at the National Center for - * Supercomputing Applications, University of Illinois, Urbana-Champaign. - * For more information on the Apache Group and the Apache HTTP server - * project, please see . - * - */ - -#ifndef APACHE_HTTP_REQUEST_H -#define APACHE_HTTP_REQUEST_H - -#ifdef __cplusplus -extern "C" { -#endif - -/* http_request.c is the code which handles the main line of request - * processing, once a request has been read in (finding the right per- - * directory configuration, building it if necessary, and calling all - * the module dispatch functions in the right order). - * - * The pieces here which are public to the modules, allow them to learn - * how the server would handle some other file or URI, or perhaps even - * direct the server to serve that other file instead of the one the - * client requested directly. - * - * There are two ways to do that. The first is the sub_request mechanism, - * which handles looking up files and URIs as adjuncts to some other - * request (e.g., directory entries for multiviews and directory listings); - * the lookup functions stop short of actually running the request, but - * (e.g., for includes), a module may call for the request to be run - * by calling run_sub_req. The space allocated to create sub_reqs can be - * reclaimed by calling destroy_sub_req --- be sure to copy anything you care - * 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); - -/* - * Then there's the case that you want some other request to be served - * as the top-level request INSTEAD of what the client requested directly. - * 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); - -#ifdef CORE_PRIVATE -/* Function called by main.c to handle first-level request */ -void ap_process_request(request_rec *); -API_EXPORT(void) ap_die(int type, request_rec *r); -#endif - -#ifdef __cplusplus -} -#endif - -#endif /* !APACHE_HTTP_REQUEST_H */ diff --git a/include/http_vhost.h b/include/http_vhost.h deleted file mode 100644 index acdb6e2f4261b4b6a43279c58c127cda2ba603cd..0000000000000000000000000000000000000000 --- a/include/http_vhost.h +++ /dev/null @@ -1,95 +0,0 @@ -/* ==================================================================== - * Copyright (c) 1995-1999 The Apache Group. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in - * the documentation and/or other materials provided with the - * distribution. - * - * 3. All advertising materials mentioning features or use of this - * software must display the following acknowledgment: - * "This product includes software developed by the Apache Group - * for use in the Apache HTTP server project (http://www.apache.org/)." - * - * 4. The names "Apache Server" and "Apache Group" must not be used to - * endorse or promote products derived from this software without - * prior written permission. For written permission, please contact - * apache@apache.org. - * - * 5. Products derived from this software may not be called "Apache" - * nor may "Apache" appear in their names without prior written - * permission of the Apache Group. - * - * 6. Redistributions of any form whatsoever must retain the following - * acknowledgment: - * "This product includes software developed by the Apache Group - * for use in the Apache HTTP server project (http://www.apache.org/)." - * - * THIS SOFTWARE IS PROVIDED BY THE APACHE GROUP ``AS IS'' AND ANY - * EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR - * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE APACHE GROUP OR - * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT - * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, - * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED - * OF THE POSSIBILITY OF SUCH DAMAGE. - * ==================================================================== - * - * This software consists of voluntary contributions made by many - * individuals on behalf of the Apache Group and was originally based - * on public domain software written at the National Center for - * Supercomputing Applications, University of Illinois, Urbana-Champaign. - * For more information on the Apache Group and the Apache HTTP server - * project, please see . - * - */ - -#ifndef APACHE_HTTP_VHOST_H -#define APACHE_HTTP_VHOST_H - -#ifdef __cplusplus -extern "C" { -#endif - -/* called before any config is read */ -void ap_init_vhost_config(pool *p); - -/* called after the config has been read */ -void ap_fini_vhost_config(pool *p, server_rec *main_server); - -/* handle addresses in statement */ -const char *ap_parse_vhost_addrs(pool *p, const char *hostname, server_rec *s); - -/* handle NameVirtualHost directive */ -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 */ -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. - */ -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); - -#ifdef __cplusplus -} -#endif - -#endif /* !APACHE_HTTP_VHOST_H */ diff --git a/include/httpd.h b/include/httpd.h deleted file mode 100644 index 7f19d99cc52060c95e3d76f13dccb38e5af20369..0000000000000000000000000000000000000000 --- a/include/httpd.h +++ /dev/null @@ -1,1167 +0,0 @@ -/* ==================================================================== - * Copyright (c) 1995-1999 The Apache Group. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in - * the documentation and/or other materials provided with the - * distribution. - * - * 3. All advertising materials mentioning features or use of this - * software must display the following acknowledgment: - * "This product includes software developed by the Apache Group - * for use in the Apache HTTP server project (http://www.apache.org/)." - * - * 4. The names "Apache Server" and "Apache Group" must not be used to - * endorse or promote products derived from this software without - * prior written permission. For written permission, please contact - * apache@apache.org. - * - * 5. Products derived from this software may not be called "Apache" - * nor may "Apache" appear in their names without prior written - * permission of the Apache Group. - * - * 6. Redistributions of any form whatsoever must retain the following - * acknowledgment: - * "This product includes software developed by the Apache Group - * for use in the Apache HTTP server project (http://www.apache.org/)." - * - * THIS SOFTWARE IS PROVIDED BY THE APACHE GROUP ``AS IS'' AND ANY - * EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR - * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE APACHE GROUP OR - * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT - * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, - * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED - * OF THE POSSIBILITY OF SUCH DAMAGE. - * ==================================================================== - * - * This software consists of voluntary contributions made by many - * individuals on behalf of the Apache Group and was originally based - * on public domain software written at the National Center for - * Supercomputing Applications, University of Illinois, Urbana-Champaign. - * For more information on the Apache Group and the Apache HTTP server - * project, please see . - * - */ - -#ifndef APACHE_HTTPD_H -#define APACHE_HTTPD_H - -#ifdef __cplusplus -extern "C" { -#endif - -/* - * httpd.h: header for simple (ha! not anymore) http daemon - */ - -/* Headers in which EVERYONE has an interest... */ - -#include "ap_config.h" -#include "alloc.h" -#include "buff.h" -#include "ap.h" - -/* ----------------------------- config dir ------------------------------ */ - -/* Define this to be the default server home dir. Most things later in this - * file with a relative pathname will have this added. - */ -#ifndef HTTPD_ROOT -#ifdef OS2 -/* Set default for OS/2 file system */ -#define HTTPD_ROOT "/os2httpd" -#elif defined(WIN32) -/* Set default for Windows file system */ -#define HTTPD_ROOT "/apache" -#elif defined(BEOS) -#define HTTPD_ROOT "/boot/home/apache" -#else -#define HTTPD_ROOT "/usr/local/apache" -#endif -#endif /* HTTPD_ROOT */ - -/* Default location of documents. Can be overridden by the DocumentRoot - * directive. - */ -#ifndef DOCUMENT_LOCATION -#ifdef OS2 -/* Set default for OS/2 file system */ -#define DOCUMENT_LOCATION HTTPD_ROOT "/docs" -#else -#define DOCUMENT_LOCATION HTTPD_ROOT "/htdocs" -#endif -#endif /* DOCUMENT_LOCATION */ - -/* Max. number of dynamically loaded modules */ -#ifndef DYNAMIC_MODULE_LIMIT -#define DYNAMIC_MODULE_LIMIT 64 -#endif - -/* Default administrator's address */ -#define DEFAULT_ADMIN "[no address given]" - -/* The target name of the installed Apache */ -#ifndef TARGET -#define TARGET "httpd" -#endif - -/* - * --------- You shouldn't have to edit anything below this line ---------- - * - * Any modifications to any defaults not defined above should be done in the - * respective config. file. - * - */ - - -/* -- Internal representation for a HTTP protocol number, e.g., HTTP/1.1 -- */ - -#define HTTP_VERSION(major,minor) (1000*(major)+(minor)) -#define HTTP_VERSION_MAJOR(number) ((number)/1000) -#define HTTP_VERSION_MINOR(number) ((number)%1000) - - -/* -------------- Port number for server running standalone --------------- */ - -#define DEFAULT_HTTP_PORT 80 -#define DEFAULT_HTTPS_PORT 443 -#define ap_is_default_port(port,r) ((port) == ap_default_port(r)) -#define ap_http_method(r) "http" -#define ap_default_port(r) DEFAULT_HTTP_PORT - -/* --------- Default user name and group name running standalone ---------- */ -/* --- These may be specified as numbers by placing a # before a number --- */ - -#ifndef DEFAULT_USER -#define DEFAULT_USER "#-1" -#endif -#ifndef DEFAULT_GROUP -#define DEFAULT_GROUP "#-1" -#endif - -/* The name of the log files */ -#ifndef DEFAULT_XFERLOG -#if defined(OS2) || defined(WIN32) -#define DEFAULT_XFERLOG "logs/access.log" -#else -#define DEFAULT_XFERLOG "logs/access_log" -#endif -#endif /* DEFAULT_XFERLOG */ - -#ifndef DEFAULT_ERRORLOG -#if defined(OS2) || defined(WIN32) -#define DEFAULT_ERRORLOG "logs/error.log" -#else -#define DEFAULT_ERRORLOG "logs/error_log" -#endif -#endif /* DEFAULT_ERRORLOG */ - -#ifndef DEFAULT_PIDLOG -#define DEFAULT_PIDLOG "logs/httpd.pid" -#endif -#ifndef DEFAULT_SCOREBOARD -#define DEFAULT_SCOREBOARD "logs/apache_runtime_status" -#endif -#ifndef DEFAULT_LOCKFILE -#define DEFAULT_LOCKFILE "logs/accept.lock" -#endif - -/* Define this to be what your HTML directory content files are called */ -#ifndef DEFAULT_INDEX -#define DEFAULT_INDEX "index.html" -#endif - -/* Define this to 1 if you want fancy indexing, 0 otherwise */ -#ifndef DEFAULT_INDEXING -#define DEFAULT_INDEXING 0 -#endif - -/* Define this to be what type you'd like returned for files with unknown */ -/* suffixes. MUST be all lower case. */ -#ifndef DEFAULT_CONTENT_TYPE -#define DEFAULT_CONTENT_TYPE "text/plain" -#endif - -/* Define this to be what your per-directory security files are called */ -#ifndef DEFAULT_ACCESS_FNAME -#ifdef OS2 -/* Set default for OS/2 file system */ -#define DEFAULT_ACCESS_FNAME "htaccess" -#else -#define DEFAULT_ACCESS_FNAME ".htaccess" -#endif -#endif /* DEFAULT_ACCESS_FNAME */ - -/* The name of the server config file */ -#ifndef SERVER_CONFIG_FILE -#define SERVER_CONFIG_FILE "conf/httpd.conf" -#endif - -/* The name of the document config file */ -#ifndef RESOURCE_CONFIG_FILE -#define RESOURCE_CONFIG_FILE "conf/srm.conf" -#endif - -/* The name of the MIME types file */ -#ifndef TYPES_CONFIG_FILE -#define TYPES_CONFIG_FILE "conf/mime.types" -#endif - -/* The name of the access file */ -#ifndef ACCESS_CONFIG_FILE -#define ACCESS_CONFIG_FILE "conf/access.conf" -#endif - -/* Whether we should enable rfc1413 identity checking */ -#ifndef DEFAULT_RFC1413 -#define DEFAULT_RFC1413 0 -#endif -/* The default directory in user's home dir */ -#ifndef DEFAULT_USER_DIR -#define DEFAULT_USER_DIR "public_html" -#endif - -/* The default path for CGI scripts if none is currently set */ -#ifndef DEFAULT_PATH -#define DEFAULT_PATH "/bin:/usr/bin:/usr/ucb:/usr/bsd:/usr/local/bin" -#endif - -/* The path to the shell interpreter, for parsed docs */ -#ifndef SHELL_PATH -#if defined(OS2) || defined(WIN32) -/* Set default for OS/2 and Windows file system */ -#define SHELL_PATH "CMD.EXE" -#else -#define SHELL_PATH "/bin/sh" -#endif -#endif /* SHELL_PATH */ - -/* The path to the suExec wrapper, can be overridden in Configuration */ -#ifndef SUEXEC_BIN -#define SUEXEC_BIN HTTPD_ROOT "/sbin/suexec" -#endif - -/* The default string lengths */ -#define MAX_STRING_LEN HUGE_STRING_LEN -#define HUGE_STRING_LEN 8192 - -/* The timeout for waiting for messages */ -#ifndef DEFAULT_TIMEOUT -#define DEFAULT_TIMEOUT 300 -#endif - -/* The timeout for waiting for keepalive timeout until next request */ -#ifndef DEFAULT_KEEPALIVE_TIMEOUT -#define DEFAULT_KEEPALIVE_TIMEOUT 15 -#endif - -/* The number of requests to entertain per connection */ -#ifndef DEFAULT_KEEPALIVE -#define DEFAULT_KEEPALIVE 100 -#endif - -/* The size of the server's internal read-write buffers */ -#define IOBUFSIZE 8192 - -/* Number of servers to spawn off by default --- also, if fewer than - * this free when the caretaker checks, it will spawn more. - */ -#ifndef DEFAULT_START_DAEMON -#define DEFAULT_START_DAEMON 5 -#endif - -/* Maximum number of *free* server processes --- more than this, and - * they will die off. - */ - -#ifndef DEFAULT_MAX_FREE_DAEMON -#define DEFAULT_MAX_FREE_DAEMON 10 -#endif - -/* Minimum --- fewer than this, and more will be created */ - -#ifndef DEFAULT_MIN_FREE_DAEMON -#define DEFAULT_MIN_FREE_DAEMON 5 -#endif - -/* Limit on the total --- clients will be locked out if more servers than - * this are needed. It is intended solely to keep the server from crashing - * when things get out of hand. - * - * We keep a hard maximum number of servers, for two reasons --- first off, - * in case something goes seriously wrong, we want to stop the fork bomb - * short of actually crashing the machine we're running on by filling some - * kernel table. Secondly, it keeps the size of the scoreboard file small - * enough that we can read the whole thing without worrying too much about - * the overhead. - */ -#ifndef HARD_SERVER_LIMIT -#ifdef WIN32 -#define HARD_SERVER_LIMIT 1024 -#else -#define HARD_SERVER_LIMIT 256 -#endif -#endif - -/* - * Special Apache error codes. These are basically used - * in http_main.c so we can keep track of various errors. - * - * APEXIT_OK: - * A normal exit - * APEXIT_INIT: - * A fatal error arising during the server's init sequence - * APEXIT_CHILDINIT: - * The child died during it's init sequence - * APEXIT_CHILDFATAL: - * A fatal error, resulting in the whole server aborting. - * If a child exits with this error, the parent process - * considers this a server-wide fatal error and aborts. - * - */ -#define APEXIT_OK 0x0 -#define APEXIT_INIT 0x2 -#define APEXIT_CHILDINIT 0x3 -#define APEXIT_CHILDFATAL 0xf - -/* - * (Unix, OS/2 only) - * Interval, in microseconds, between scoreboard maintenance. During - * each scoreboard maintenance cycle the parent decides if it needs to - * spawn a new child (to meet MinSpareServers requirements), or kill off - * a child (to meet MaxSpareServers requirements). It will only spawn or - * kill one child per cycle. Setting this too low will chew cpu. The - * default is probably sufficient for everyone. But some people may want - * to raise this on servers which aren't dedicated to httpd and where they - * don't like the httpd waking up each second to see what's going on. - */ -#ifndef SCOREBOARD_MAINTENANCE_INTERVAL -#define SCOREBOARD_MAINTENANCE_INTERVAL 1000000 -#endif - -/* Number of requests to try to handle in a single process. If <= 0, - * the children don't die off. That's the default here, since I'm still - * interested in finding and stanching leaks. - */ - -#ifndef DEFAULT_MAX_REQUESTS_PER_CHILD -#define DEFAULT_MAX_REQUESTS_PER_CHILD 0 -#endif - -#ifndef DEFAULT_THREADS_PER_CHILD -#define DEFAULT_THREADS_PER_CHILD 50 -#endif -#ifndef DEFAULT_EXCESS_REQUESTS_PER_CHILD -#define DEFAULT_EXCESS_REQUESTS_PER_CHILD 0 -#endif - -/* The maximum length of the queue of pending connections, as defined - * by listen(2). Under some systems, it should be increased if you - * are experiencing a heavy TCP SYN flood attack. - * - * It defaults to 511 instead of 512 because some systems store it - * as an 8-bit datatype; 512 truncated to 8-bits is 0, while 511 is - * 255 when truncated. - */ - -#ifndef DEFAULT_LISTENBACKLOG -#define DEFAULT_LISTENBACKLOG 511 -#endif - -/* Limits on the size of various request items. These limits primarily - * exist to prevent simple denial-of-service attacks on a server based - * on misuse of the protocol. The recommended values will depend on the - * nature of the server resources -- CGI scripts and database backends - * might require large values, but most servers could get by with much - * smaller limits than we use below. The request message body size can - * be limited by the per-dir config directive LimitRequestBody. - * - * Internal buffer sizes are two bytes more than the DEFAULT_LIMIT_REQUEST_LINE - * and DEFAULT_LIMIT_REQUEST_FIELDSIZE below, which explains the 8190. - * These two limits can be lowered (but not raised) by the server config - * directives LimitRequestLine and LimitRequestFieldsize, respectively. - * - * DEFAULT_LIMIT_REQUEST_FIELDS can be modified or disabled (set = 0) by - * the server config directive LimitRequestFields. - */ -#ifndef DEFAULT_LIMIT_REQUEST_LINE -#define DEFAULT_LIMIT_REQUEST_LINE 8190 -#endif /* default limit on bytes in Request-Line (Method+URI+HTTP-version) */ -#ifndef DEFAULT_LIMIT_REQUEST_FIELDSIZE -#define DEFAULT_LIMIT_REQUEST_FIELDSIZE 8190 -#endif /* default limit on bytes in any one header field */ -#ifndef DEFAULT_LIMIT_REQUEST_FIELDS -#define DEFAULT_LIMIT_REQUEST_FIELDS 100 -#endif /* default limit on number of request header fields */ - -/* - * The below defines the base string of the Server: header. Additional - * tokens can be added via the ap_add_version_component() API call. - * - * The tokens are listed in order of their significance for identifying the - * application. - * - * "Product tokens should be short and to the point -- use of them for - * advertizing or other non-essential information is explicitly forbidden." - * - * Example: "Apache/1.1.0 MrWidget/0.1-alpha" - */ - -#define SERVER_BASEVERSION "Apache/1.3.9" /* SEE COMMENTS ABOVE */ -#define SERVER_VERSION SERVER_BASEVERSION -enum server_token_type { - SrvTk_MIN, /* eg: Apache/1.3.0 */ - SrvTk_OS, /* eg: Apache/1.3.0 (UNIX) */ - SrvTk_FULL /* eg: Apache/1.3.0 (UNIX) PHP/3.0 FooBar/1.2b */ -}; - -API_EXPORT(const char *) ap_get_server_version(void); -API_EXPORT(void) ap_add_version_component(const char *component); -API_EXPORT(const char *) ap_get_server_built(void); - -/* Numeric release version identifier: MMNNFFRBB: major minor fix final beta - * Always increases along the same track as the source branch. - * For example, Apache 1.4.2 would be '10402100', 2.5b7 would be '20500007'. - */ -#define APACHE_RELEASE 10309100 - -#define SERVER_PROTOCOL "HTTP/1.1" -#ifndef SERVER_SUPPORT -#define SERVER_SUPPORT "http://www.apache.org/" -#endif - -#define DECLINED -1 /* Module declines to handle */ -#define DONE -2 /* Module has served the response completely - * - it's safe to die() with no more output - */ -#define OK 0 /* Module has handled this stage. */ - - -/* ----------------------- HTTP Status Codes ------------------------- */ - -/* The size of the static array in http_protocol.c for storing - * all of the potential response status-lines (a sparse table). - * A future version should dynamically generate the table at startup. - */ -#define RESPONSE_CODES 55 - -#define HTTP_CONTINUE 100 -#define HTTP_SWITCHING_PROTOCOLS 101 -#define HTTP_PROCESSING 102 -#define HTTP_OK 200 -#define HTTP_CREATED 201 -#define HTTP_ACCEPTED 202 -#define HTTP_NON_AUTHORITATIVE 203 -#define HTTP_NO_CONTENT 204 -#define HTTP_RESET_CONTENT 205 -#define HTTP_PARTIAL_CONTENT 206 -#define HTTP_MULTI_STATUS 207 -#define HTTP_MULTIPLE_CHOICES 300 -#define HTTP_MOVED_PERMANENTLY 301 -#define HTTP_MOVED_TEMPORARILY 302 -#define HTTP_SEE_OTHER 303 -#define HTTP_NOT_MODIFIED 304 -#define HTTP_USE_PROXY 305 -#define HTTP_TEMPORARY_REDIRECT 307 -#define HTTP_BAD_REQUEST 400 -#define HTTP_UNAUTHORIZED 401 -#define HTTP_PAYMENT_REQUIRED 402 -#define HTTP_FORBIDDEN 403 -#define HTTP_NOT_FOUND 404 -#define HTTP_METHOD_NOT_ALLOWED 405 -#define HTTP_NOT_ACCEPTABLE 406 -#define HTTP_PROXY_AUTHENTICATION_REQUIRED 407 -#define HTTP_REQUEST_TIME_OUT 408 -#define HTTP_CONFLICT 409 -#define HTTP_GONE 410 -#define HTTP_LENGTH_REQUIRED 411 -#define HTTP_PRECONDITION_FAILED 412 -#define HTTP_REQUEST_ENTITY_TOO_LARGE 413 -#define HTTP_REQUEST_URI_TOO_LARGE 414 -#define HTTP_UNSUPPORTED_MEDIA_TYPE 415 -#define HTTP_RANGE_NOT_SATISFIABLE 416 -#define HTTP_EXPECTATION_FAILED 417 -#define HTTP_UNPROCESSABLE_ENTITY 422 -#define HTTP_LOCKED 423 -#define HTTP_FAILED_DEPENDENCY 424 -#define HTTP_INTERNAL_SERVER_ERROR 500 -#define HTTP_NOT_IMPLEMENTED 501 -#define HTTP_BAD_GATEWAY 502 -#define HTTP_SERVICE_UNAVAILABLE 503 -#define HTTP_GATEWAY_TIME_OUT 504 -#define HTTP_VERSION_NOT_SUPPORTED 505 -#define HTTP_VARIANT_ALSO_VARIES 506 -#define HTTP_INSUFFICIENT_STORAGE 507 -#define HTTP_NOT_EXTENDED 510 - -#define DOCUMENT_FOLLOWS HTTP_OK -#define PARTIAL_CONTENT HTTP_PARTIAL_CONTENT -#define MULTIPLE_CHOICES HTTP_MULTIPLE_CHOICES -#define MOVED HTTP_MOVED_PERMANENTLY -#define REDIRECT HTTP_MOVED_TEMPORARILY -#define USE_LOCAL_COPY HTTP_NOT_MODIFIED -#define BAD_REQUEST HTTP_BAD_REQUEST -#define AUTH_REQUIRED HTTP_UNAUTHORIZED -#define FORBIDDEN HTTP_FORBIDDEN -#define NOT_FOUND HTTP_NOT_FOUND -#define METHOD_NOT_ALLOWED HTTP_METHOD_NOT_ALLOWED -#define NOT_ACCEPTABLE HTTP_NOT_ACCEPTABLE -#define LENGTH_REQUIRED HTTP_LENGTH_REQUIRED -#define PRECONDITION_FAILED HTTP_PRECONDITION_FAILED -#define SERVER_ERROR HTTP_INTERNAL_SERVER_ERROR -#define NOT_IMPLEMENTED HTTP_NOT_IMPLEMENTED -#define BAD_GATEWAY HTTP_BAD_GATEWAY -#define VARIANT_ALSO_VARIES HTTP_VARIANT_ALSO_VARIES - -#define ap_is_HTTP_INFO(x) (((x) >= 100)&&((x) < 200)) -#define ap_is_HTTP_SUCCESS(x) (((x) >= 200)&&((x) < 300)) -#define ap_is_HTTP_REDIRECT(x) (((x) >= 300)&&((x) < 400)) -#define ap_is_HTTP_ERROR(x) (((x) >= 400)&&((x) < 600)) -#define ap_is_HTTP_CLIENT_ERROR(x) (((x) >= 400)&&((x) < 500)) -#define ap_is_HTTP_SERVER_ERROR(x) (((x) >= 500)&&((x) < 600)) - -#define ap_status_drops_connection(x) \ - (((x) == HTTP_BAD_REQUEST) || \ - ((x) == HTTP_REQUEST_TIME_OUT) || \ - ((x) == HTTP_LENGTH_REQUIRED) || \ - ((x) == HTTP_REQUEST_ENTITY_TOO_LARGE) || \ - ((x) == HTTP_REQUEST_URI_TOO_LARGE) || \ - ((x) == HTTP_INTERNAL_SERVER_ERROR) || \ - ((x) == HTTP_SERVICE_UNAVAILABLE) || \ - ((x) == HTTP_NOT_IMPLEMENTED)) - -/* Methods recognized (but not necessarily handled) by the server. - * These constants are used in bit shifting masks of size int, so it is - * unsafe to have more methods than bits in an int. HEAD == M_GET. - */ -#define M_GET 0 -#define M_PUT 1 -#define M_POST 2 -#define M_DELETE 3 -#define M_CONNECT 4 -#define M_OPTIONS 5 -#define M_TRACE 6 -#define M_PATCH 7 -#define M_PROPFIND 8 -#define M_PROPPATCH 9 -#define M_MKCOL 10 -#define M_COPY 11 -#define M_MOVE 12 -#define M_LOCK 13 -#define M_UNLOCK 14 -#define M_INVALID 15 - -#define METHODS 16 - -#define CGI_MAGIC_TYPE "application/x-httpd-cgi" -#define INCLUDES_MAGIC_TYPE "text/x-server-parsed-html" -#define INCLUDES_MAGIC_TYPE3 "text/x-server-parsed-html3" -#ifdef CHARSET_EBCDIC -#define ASCIITEXT_MAGIC_TYPE_PREFIX "text/x-ascii-" /* Text files whose content-type starts with this are passed thru unconverted */ -#endif /*CHARSET_EBCDIC*/ -#define MAP_FILE_MAGIC_TYPE "application/x-type-map" -#define ASIS_MAGIC_TYPE "httpd/send-as-is" -#define DIR_MAGIC_TYPE "httpd/unix-directory" -#define STATUS_MAGIC_TYPE "application/x-httpd-status" - -/* - * Define the HTML doctype strings centrally. - */ -#define DOCTYPE_HTML_2_0 "\n" -#define DOCTYPE_HTML_3_2 "\n" -#define DOCTYPE_HTML_4_0S "\n" -#define DOCTYPE_HTML_4_0T "\n" -#define DOCTYPE_HTML_4_0F "\n" - -/* Just in case your linefeed isn't the one the other end is expecting. */ -#ifndef CHARSET_EBCDIC -#define LF 10 -#define CR 13 -#else /* CHARSET_EBCDIC */ -#include "ebcdic.h" -/* OSD_POSIX uses the EBCDIC charset. The transition ASCII->EBCDIC is done in - * the buff package (bread/bputs/bwrite), so everywhere else, we use - * "native EBCDIC" CR and NL characters. These are therefore defined as - * '\r' and '\n'. - * NB: this is not the whole truth - sometimes \015 and \012 are contained - * in literal (EBCDIC!) strings, so these are not converted but passed. - */ -#define CR '\r' -#define LF '\n' -#endif /* CHARSET_EBCDIC */ - -/* Possible values for request_rec.read_body (set by handling module): - * REQUEST_NO_BODY Send 413 error if message has any body - * REQUEST_CHUNKED_ERROR Send 411 error if body without Content-Length - * REQUEST_CHUNKED_DECHUNK If chunked, remove the chunks for me. - * REQUEST_CHUNKED_PASS Pass the chunks to me without removal. - */ -#define REQUEST_NO_BODY 0 -#define REQUEST_CHUNKED_ERROR 1 -#define REQUEST_CHUNKED_DECHUNK 2 -#define REQUEST_CHUNKED_PASS 3 - -/* Things which may vary per file-lookup WITHIN a request --- - * e.g., state of MIME config. Basically, the name of an object, info - * about the object, and any other info we may ahve which may need to - * change as we go poking around looking for it (e.g., overridden by - * .htaccess files). - * - * Note how the default state of almost all these things is properly - * zero, so that allocating it with pcalloc does the right thing without - * a whole lot of hairy initialization... so long as we are willing to - * make the (fairly) portable assumption that the bit pattern of a NULL - * pointer is, in fact, zero. - */ - -/* This represents the result of calling htaccess; these are cached for - * each request. - */ -struct htaccess_result { - char *dir; /* the directory to which this applies */ - int override; /* the overrides allowed for the .htaccess file */ - void *htaccess; /* the configuration directives */ -/* the next one, or NULL if no more; N.B. never change this */ - const struct htaccess_result *next; -}; - -typedef struct conn_rec conn_rec; -typedef struct server_rec server_rec; -typedef struct request_rec request_rec; -typedef struct listen_rec listen_rec; - -#include "util_uri.h" - -struct request_rec { - - ap_pool *pool; - conn_rec *connection; - server_rec *server; - - request_rec *next; /* If we wind up getting redirected, - * pointer to the request we redirected to. - */ - request_rec *prev; /* If this is an internal redirect, - * pointer to where we redirected *from*. - */ - - request_rec *main; /* If this is a sub_request (see request.h) - * pointer back to the main request. - */ - - /* Info about the request itself... we begin with stuff that only - * protocol.c should ever touch... - */ - - char *the_request; /* First line of request, so we can log it */ - int assbackwards; /* HTTP/0.9, "simple" request */ - int proxyreq; /* A proxy request (calculated during - * post_read_request or translate_name) */ - int header_only; /* HEAD request, as opposed to GET */ - char *protocol; /* Protocol, as given to us, or HTTP/0.9 */ - int proto_num; /* Number version of protocol; 1.1 = 1001 */ - const char *hostname; /* Host, as set by full URI or Host: */ - - time_t request_time; /* When the request started */ - - const char *status_line; /* Status line, if set by script */ - int status; /* In any case */ - - /* Request method, two ways; also, protocol, etc.. Outside of protocol.c, - * look, but don't touch. - */ - - const char *method; /* GET, HEAD, POST, etc. */ - int method_number; /* M_GET, M_POST, etc. */ - - /* - allowed is a bitvector of the allowed methods. - - A handler must ensure that the request method is one that - it is capable of handling. Generally modules should DECLINE - any request methods they do not handle. Prior to aborting the - handler like this the handler should set r->allowed to the list - of methods that it is willing to handle. This bitvector is used - to construct the "Allow:" header required for OPTIONS requests, - and METHOD_NOT_ALLOWED and NOT_IMPLEMENTED status codes. - - Since the default_handler deals with OPTIONS, all modules can - usually decline to deal with OPTIONS. TRACE is always allowed, - modules don't need to set it explicitly. - - Since the default_handler will always handle a GET, a - module which does *not* implement GET should probably return - METHOD_NOT_ALLOWED. Unfortunately this means that a Script GET - handler can't be installed by mod_actions. - */ - int allowed; /* Allowed methods - for 405, OPTIONS, etc */ - - int sent_bodyct; /* byte count in stream is for body */ - long bytes_sent; /* body byte count, for easy access */ - time_t mtime; /* Time the resource was last modified */ - - /* HTTP/1.1 connection-level features */ - - int chunked; /* sending chunked transfer-coding */ - int byterange; /* number of byte ranges */ - char *boundary; /* multipart/byteranges boundary */ - const char *range; /* The Range: header */ - long clength; /* The "real" content length */ - - long remaining; /* bytes left to read */ - long read_length; /* bytes that have been read */ - int read_body; /* how the request body should be read */ - int read_chunked; /* reading chunked transfer-coding */ - unsigned expecting_100; /* is client waiting for a 100 response? */ - - /* MIME header environments, in and out. Also, an array containing - * environment variables to be passed to subprocesses, so people can - * write modules to add to that environment. - * - * The difference between headers_out and err_headers_out is that the - * latter are printed even on error, and persist across internal redirects - * (so the headers printed for ErrorDocument handlers will have them). - * - * The 'notes' table is for notes from one module to another, with no - * other set purpose in mind... - */ - - table *headers_in; - table *headers_out; - table *err_headers_out; - table *subprocess_env; - table *notes; - - /* content_type, handler, content_encoding, content_language, and all - * content_languages MUST be lowercased strings. They may be pointers - * to static strings; they should not be modified in place. - */ - const char *content_type; /* Break these out --- we dispatch on 'em */ - const char *handler; /* What we *really* dispatch on */ - - const char *content_encoding; - const char *content_language; /* for back-compat. only -- do not use */ - array_header *content_languages; /* array of (char*) */ - - char *vlist_validator; /* variant list validator (if negotiated) */ - - int no_cache; - int no_local_copy; - - /* What object is being requested (either directly, or via include - * or content-negotiation mapping). - */ - - char *unparsed_uri; /* the uri without any parsing performed */ - char *uri; /* the path portion of the URI */ - char *filename; - char *path_info; - char *args; /* QUERY_ARGS, if any */ - struct stat finfo; /* ST_MODE set to zero if no such file */ - uri_components parsed_uri; /* components of uri, dismantled */ - - /* Various other config info which may change with .htaccess files - * These are config vectors, with one void* pointer for each module - * (the thing pointed to being the module's business). - */ - - void *per_dir_config; /* Options set in config files, etc. */ - void *request_config; /* Notes on *this* request */ - -/* - * a linked list of the configuration directives in the .htaccess files - * accessed by this request. - * N.B. always add to the head of the list, _never_ to the end. - * that way, a sub request's list can (temporarily) point to a parent's list - */ - const struct htaccess_result *htaccess; - -/* Things placed at the end of the record to avoid breaking binary - * compatibility. It would be nice to remember to reorder the entire - * record to improve 64bit alignment the next time we need to break - * binary compatibility for some other reason. - */ -}; - - -/* Things which are per connection - */ - -struct conn_rec { - - ap_pool *pool; - server_rec *server; - server_rec *base_server; /* Physical vhost this conn come in on */ - void *vhost_lookup_data; /* used by http_vhost.c */ - - /* Information about the connection itself */ - - int child_num; /* The number of the child handling conn_rec */ - BUFF *client; /* Connection to the guy */ - - /* Who is the client? */ - - struct sockaddr_in local_addr; /* local address */ - struct sockaddr_in remote_addr; /* remote address */ - char *remote_ip; /* Client's IP address */ - char *remote_host; /* Client's DNS name, if known. - * NULL if DNS hasn't been checked, - * "" if it has and no address was found. - * N.B. Only access this though - * get_remote_host() */ - char *remote_logname; /* Only ever set if doing rfc1413 lookups. - * N.B. Only access this through - * get_remote_logname() */ - char *user; /* If an authentication check was made, - * this gets set to the user name. We assume - * that there's only one user per connection(!) - */ - char *ap_auth_type; /* Ditto. */ - - unsigned aborted:1; /* Are we still talking? */ - signed int keepalive:2; /* Are we using HTTP Keep-Alive? - * -1 fatal error, 0 undecided, 1 yes */ - unsigned keptalive:1; /* Did we use HTTP Keep-Alive? */ - signed int double_reverse:2;/* have we done double-reverse DNS? - * -1 yes/failure, 0 not yet, 1 yes/success */ - int keepalives; /* How many times have we used it? */ - char *local_ip; /* server IP address */ - char *local_host; /* used for ap_get_server_name when - * UseCanonicalName is set to DNS - * (ignores setting of HostnameLookups) */ -}; - -/* Per-vhost config... */ - -/* The address 255.255.255.255, when used as a virtualhost address, - * will become the "default" server when the ip doesn't match other vhosts. - */ -#define DEFAULT_VHOST_ADDR 0xfffffffful - -typedef struct server_addr_rec server_addr_rec; -struct server_addr_rec { - server_addr_rec *next; - struct in_addr host_addr; /* The bound address, for this server */ - unsigned short host_port; /* The bound port, for this server */ - char *virthost; /* The name given in */ -}; - -struct server_rec { - - server_rec *next; - - /* description of where the definition came from */ - const char *defn_name; - unsigned defn_line_number; - - /* Full locations of server config info */ - - char *srm_confname; - char *access_confname; - - /* Contact information */ - - char *server_admin; - char *server_hostname; - unsigned short port; /* for redirects, etc. */ - - /* Log files --- note that transfer log is now in the modules... */ - - char *error_fname; - FILE *error_log; - int loglevel; - - /* Module-specific configuration for server, and defaults... */ - - int is_virtual; /* true if this is the virtual server */ - void *module_config; /* Config vector containing pointers to - * modules' per-server config structures. - */ - void *lookup_defaults; /* MIME type info, etc., before we start - * checking per-directory info. - */ - /* Transaction handling */ - - server_addr_rec *addrs; - int timeout; /* Timeout, in seconds, before we give up */ - int keep_alive_timeout; /* Seconds we'll wait for another request */ - int keep_alive_max; /* Maximum requests per connection */ - int keep_alive; /* Use persistent connections? */ - int send_buffer_size; /* size of TCP send buffer (in bytes) */ - - char *path; /* Pathname for ServerPath */ - int pathlen; /* Length of path */ - - array_header *names; /* Normal names for ServerAlias servers */ - array_header *wild_names; /* Wildcarded names for ServerAlias servers */ - - uid_t server_uid; /* effective user id when calling exec wrapper */ - gid_t server_gid; /* effective group id when calling exec wrapper */ - - int limit_req_line; /* limit on size of the HTTP request line */ - int limit_req_fieldsize; /* limit on size of any request header field */ - int limit_req_fields; /* limit on number of request header fields */ -}; - -/* These are more like real hosts than virtual hosts */ -struct listen_rec { - listen_rec *next; - struct sockaddr_in local_addr; /* local IP address and port */ - int fd; - int used; /* Only used during restart */ -/* more stuff here, like which protocol is bound to the port */ -}; - -/* Prototypes for utilities... util.c. - */ - -extern void ap_util_init(void); - -/* Time */ -extern API_VAR_EXPORT const char ap_month_snames[12][4]; -extern API_VAR_EXPORT const char ap_day_snames[7][4]; - -API_EXPORT(struct tm *) ap_get_gmtoff(int *tz); -API_EXPORT(char *) ap_get_time(void); -API_EXPORT(char *) ap_field_noparam(pool *p, const char *intype); -API_EXPORT(char *) ap_ht_time(pool *p, time_t t, const char *fmt, int gmt); -API_EXPORT(char *) ap_gm_timestr_822(pool *p, time_t t); - -/* String handling. The *_nc variants allow you to use non-const char **s as - arguments (unfortunately C won't automatically convert a char ** to a const - char **) */ - -API_EXPORT(char *) ap_getword(pool *p, const char **line, char stop); -API_EXPORT(char *) ap_getword_nc(pool *p, char **line, char stop); -API_EXPORT(char *) ap_getword_white(pool *p, const char **line); -API_EXPORT(char *) ap_getword_white_nc(pool *p, char **line); -API_EXPORT(char *) ap_getword_nulls(pool *p, const char **line, char stop); -API_EXPORT(char *) ap_getword_nulls_nc(pool *p, char **line, char stop); -API_EXPORT(char *) ap_getword_conf(pool *p, const char **line); -API_EXPORT(char *) ap_getword_conf_nc(pool *p, char **line); - -API_EXPORT(const char *) ap_size_list_item(const char **field, int *len); -API_EXPORT(char *) ap_get_list_item(pool *p, const char **field); -API_EXPORT(int) ap_find_list_item(pool *p, const char *line, const char *tok); - -API_EXPORT(char *) ap_get_token(pool *p, const char **accept_line, int accept_white); -API_EXPORT(int) ap_find_token(pool *p, const char *line, const char *tok); -API_EXPORT(int) ap_find_last_token(pool *p, const char *line, const char *tok); - -API_EXPORT(int) ap_is_url(const char *u); -API_EXPORT(int) ap_unescape_url(char *url); -API_EXPORT(void) ap_no2slash(char *name); -API_EXPORT(void) ap_getparents(char *name); -API_EXPORT(char *) ap_escape_path_segment(pool *p, const char *s); -API_EXPORT(char *) ap_os_escape_path(pool *p, const char *path, int partial); -#define ap_escape_uri(ppool,path) ap_os_escape_path(ppool,path,1) -API_EXPORT(char *) ap_escape_html(pool *p, const char *s); -API_EXPORT(char *) ap_construct_server(pool *p, const char *hostname, - unsigned port, const request_rec *r); -API_EXPORT(char *) ap_escape_shell_cmd(pool *p, const char *s); - -API_EXPORT(int) ap_count_dirs(const char *path); -API_EXPORT(char *) ap_make_dirstr_prefix(char *d, const char *s, int n); -API_EXPORT(char *) ap_make_dirstr_parent(pool *p, const char *s); -/* deprecated. The previous two routines are preferred. */ -API_EXPORT(char *) ap_make_dirstr(pool *a, const char *s, int n); -API_EXPORT(char *) ap_make_full_path(pool *a, const char *dir, const char *f); - -API_EXPORT(int) ap_is_matchexp(const char *str); -API_EXPORT(int) ap_strcmp_match(const char *str, const char *exp); -API_EXPORT(int) ap_strcasecmp_match(const char *str, const char *exp); -API_EXPORT(char *) ap_pbase64decode(pool *p, const char *bufcoded); -API_EXPORT(char *) ap_pbase64encode(pool *p, char *string); -API_EXPORT(char *) ap_uudecode(pool *p, const char *bufcoded); -API_EXPORT(char *) ap_uuencode(pool *p, char *string); - -#ifdef OS2 -void os2pathname(char *path); -char *ap_double_quotes(pool *p, char *str); -#endif - -API_EXPORT(int) ap_regexec(const regex_t *preg, const char *string, - size_t nmatch, regmatch_t pmatch[], int eflags); -API_EXPORT(size_t) ap_regerror(int errcode, const regex_t *preg, - char *errbuf, size_t errbuf_size); -API_EXPORT(char *) ap_pregsub(pool *p, const char *input, const char *source, - size_t nmatch, regmatch_t pmatch[]); - -API_EXPORT(void) ap_content_type_tolower(char *); -API_EXPORT(void) ap_str_tolower(char *); -API_EXPORT(int) ap_ind(const char *, char); /* Sigh... */ -API_EXPORT(int) ap_rind(const char *, char); - -API_EXPORT(char *) ap_escape_quotes (pool *p, const char *instring); - -/* Common structure for reading of config files / passwd files etc. */ -typedef struct { - int (*getch) (void *param); /* a getc()-like function */ - void *(*getstr) (void *buf, size_t bufsiz, void *param); /* a fgets()-like function */ - int (*close) (void *param); /* a close hander function */ - void *param; /* the argument passed to getch/getstr/close */ - const char *name; /* the filename / description */ - unsigned line_number; /* current line number, starting at 1 */ -} configfile_t; - -/* Open a configfile_t as FILE, return open configfile_t struct pointer */ -API_EXPORT(configfile_t *) ap_pcfg_openfile(pool *p, const char *name); - -/* Allocate a configfile_t handle with user defined functions and params */ -API_EXPORT(configfile_t *) ap_pcfg_open_custom(pool *p, const char *descr, - void *param, - int(*getc_func)(void*), - void *(*gets_func) (void *buf, size_t bufsiz, void *param), - int(*close_func)(void *param)); - -/* Read one line from open configfile_t, strip LF, increase line number */ -API_EXPORT(int) ap_cfg_getline(char *buf, size_t bufsize, configfile_t *cfp); - -/* Read one char from open configfile_t, increase line number upon LF */ -API_EXPORT(int) ap_cfg_getc(configfile_t *cfp); - -/* Detach from open configfile_t, calling the close handler */ -API_EXPORT(int) ap_cfg_closefile(configfile_t *cfp); - -#ifdef NEED_STRERROR -char *strerror(int err); -#endif - -/* 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_can_exec(const struct stat *); -API_EXPORT(void) ap_chdir_file(const char *file); - -#ifndef HAVE_CANONICAL_FILENAME -/* - * We can't define these in os.h because of dependence on pool pointer. - */ -#define ap_os_canonical_filename(p,f) (f) -#define ap_os_case_canonical_filename(p,f) (f) -#define ap_os_systemcase_filename(p,f) (f) -#else -API_EXPORT(char *) ap_os_canonical_filename(pool *p, const char *file); -#ifdef WIN32 -API_EXPORT(char *) ap_os_case_canonical_filename(pool *pPool, const char *szFile); -API_EXPORT(char *) ap_os_systemcase_filename(pool *pPool, const char *szFile); -#else -#define ap_os_case_canonical_filename(p,f) ap_os_canonical_filename(p,f) -#define ap_os_systemcase_filename(p,f) ap_os_canonical_filename(p,f) -#endif -#endif - -#ifdef _OSD_POSIX -extern const char *os_set_account(pool *p, const char *account); -extern int os_init_job_environment(server_rec *s, const char *user_name, int one_process); -#endif /* _OSD_POSIX */ - -char *ap_get_local_host(pool *); -unsigned long ap_get_virthost_addr(char *hostname, unsigned short *port); - -extern API_VAR_EXPORT time_t ap_restart_time; - -/* - * Apache tries to keep all of its long term filehandles (such as log files, - * and sockets) above this number. This is to workaround problems in many - * third party libraries that are compiled with a small FD_SETSIZE. There - * should be no reason to lower this, because it's only advisory. If a file - * can't be allocated above this number then it will remain in the "slack" - * area. - * - * Only the low slack line is used by default. If HIGH_SLACK_LINE is defined - * then an attempt is also made to keep all non-FILE * files above the high - * slack line. This is to work around a Solaris C library limitation, where it - * uses an unsigned char to store the file descriptor. - */ -#ifndef LOW_SLACK_LINE -#define LOW_SLACK_LINE 15 -#endif -/* #define HIGH_SLACK_LINE 255 */ - -/* - * The ap_slack() function takes a fd, and tries to move it above the indicated - * line. It returns an fd which may or may not have moved above the line, and - * never fails. If the high line was requested and it fails it will also try - * the low line. - */ -#ifdef NO_SLACK -#define ap_slack(fd,line) (fd) -#else -int ap_slack(int fd, int line); -#define AP_SLACK_LOW 1 -#define AP_SLACK_HIGH 2 -#endif - -API_EXPORT(char *) ap_escape_quotes(pool *p, const char *instr); - -/* - * Redefine assert() to something more useful for an Apache... - */ -API_EXPORT(void) ap_log_assert(const char *szExp, const char *szFile, int nLine) - __attribute__((noreturn)); -#define ap_assert(exp) ((exp) ? (void)0 : ap_log_assert(#exp,__FILE__,__LINE__)) - -/* The optimized timeout code only works if we're not MULTITHREAD and we're - * also not using a scoreboard file - */ -#if !defined (MULTITHREAD) && \ - (defined (USE_MMAP_SCOREBOARD) || defined (USE_SHMGET_SCOREBOARD)) -#define OPTIMIZE_TIMEOUTS -#endif - -/* A set of flags which indicate places where the server should raise(SIGSTOP). - * This is useful for debugging, because you can then attach to that process - * with gdb and continue. This is important in cases where one_process - * debugging isn't possible. - */ -#define SIGSTOP_DETACH 1 -#define SIGSTOP_MAKE_CHILD 2 -#define SIGSTOP_SPAWN_CHILD 4 -#define SIGSTOP_PIPED_LOG_SPAWN 8 -#define SIGSTOP_CGI_CHILD 16 - -#ifdef DEBUG_SIGSTOP -extern int raise_sigstop_flags; -#define RAISE_SIGSTOP(x) do { \ - if (raise_sigstop_flags & SIGSTOP_##x) raise(SIGSTOP);\ - } while (0) -#else -#define RAISE_SIGSTOP(x) -#endif - -API_EXPORT(extern const char *) ap_psignature(const char *prefix, request_rec *r); - -/* strtoul does not exist on sunos4. */ -#ifdef strtoul -#undef strtoul -#endif -#define strtoul strtoul_is_not_a_portable_function_use_strtol_instead - -#ifdef __cplusplus -} -#endif - -#endif /* !APACHE_HTTPD_H */ diff --git a/include/mpm_common.h b/include/mpm_common.h deleted file mode 100644 index f693f6011cbdc3c57d99ded4badf1afeaa5a22e7..0000000000000000000000000000000000000000 --- a/include/mpm_common.h +++ /dev/null @@ -1,84 +0,0 @@ -/* ==================================================================== - * The Apache Software License, Version 1.1 - * - * Copyright (c) 2000 The Apache Software Foundation. All rights - * reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in - * the documentation and/or other materials provided with the - * distribution. - * - * 3. The end-user documentation included with the redistribution, - * if any, must include the following acknowledgment: - * "This product includes software developed by the - * Apache Software Foundation (http://www.apache.org/)." - * Alternately, this acknowledgment may appear in the software itself, - * if and wherever such third-party acknowledgments normally appear. - * - * 4. The names "Apache" and "Apache Software Foundation" must - * not be used to endorse or promote products derived from this - * software without prior written permission. For written - * permission, please contact apache@apache.org. - * - * 5. Products derived from this software may not be called "Apache", - * nor may "Apache" appear in their name, without prior written - * permission of the Apache Software Foundation. - * - * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED - * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES - * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR - * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF - * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND - * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, - * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT - * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * ==================================================================== - * - * This software consists of voluntary contributions made by many - * individuals on behalf of the Apache Software Foundation. For more - * information on the Apache Software Foundation, please see - * . - * - * Portions of this software are based upon public domain software - * originally written at the National Center for Supercomputing Applications, - * University of Illinois, Urbana-Champaign. - */ - -/* The purpose of this file is to store the code that MOST mpm's will need - * this does not mean a function only goes into this file if every MPM needs - * it. It means that if a function is needed by more than one MPM, and - * future maintenance would be served by making the code common, then the - * function belongs here. - * - * This is going in src/main because it is not platform specific, it is - * specific to multi-process servers, but NOT to Unix. Which is why it - * does not belong in src/os/unix - */ - -#ifndef APACHE_MPM_COMMON_H -#define APACHE_MPM_COMMON_H - -#ifdef __cplusplus -extern "C" { -#endif - -void ap_reclaim_child_processes(int terminate); -ap_proc_t *ap_wait_or_timeout(ap_wait_t *status, ap_pool_t *p); - -#ifdef __cplusplus -} -#endif - -#endif /* !APACHE_MPM_COMMON_H */ diff --git a/include/pcreposix.h b/include/pcreposix.h deleted file mode 100644 index 47838a8bc56b8a9a1e4f963780df5eb55903ee55..0000000000000000000000000000000000000000 --- a/include/pcreposix.h +++ /dev/null @@ -1,89 +0,0 @@ -/************************************************* -* Perl-Compatible Regular Expressions * -*************************************************/ - -/* Copyright (c) 1997-2000 University of Cambridge */ -/* Do not edit this file, this is provided by PCRE */ - -#ifndef _PCREPOSIX_H -#define _PCREPOSIX_H - -/* This is the header for the POSIX wrapper interface to the PCRE Perl- -Compatible Regular Expression library. It defines the things POSIX says should -be there. I hope. */ - -/* Have to include stdlib.h in order to ensure that size_t is defined. */ - -#include - -/* Allow for C++ users */ - -#ifdef __cplusplus -extern "C" { -#endif - -/* Options defined by POSIX. */ - -#define REG_ICASE 0x01 -#define REG_NEWLINE 0x02 -#define REG_NOTBOL 0x04 -#define REG_NOTEOL 0x08 - -/* These are not used by PCRE, but by defining them we make it easier -to slot PCRE into existing programs that make POSIX calls. */ - -#define REG_EXTENDED 0 -#define REG_NOSUB 0 - -/* Error values. Not all these are relevant or used by the wrapper. */ - -enum { - REG_ASSERT = 1, /* internal error ? */ - REG_BADBR, /* invalid repeat counts in {} */ - REG_BADPAT, /* pattern error */ - REG_BADRPT, /* ? * + invalid */ - REG_EBRACE, /* unbalanced {} */ - REG_EBRACK, /* unbalanced [] */ - REG_ECOLLATE, /* collation error - not relevant */ - REG_ECTYPE, /* bad class */ - REG_EESCAPE, /* bad escape sequence */ - REG_EMPTY, /* empty expression */ - REG_EPAREN, /* unbalanced () */ - REG_ERANGE, /* bad range inside [] */ - REG_ESIZE, /* expression too big */ - REG_ESPACE, /* failed to get memory */ - REG_ESUBREG, /* bad back reference */ - REG_INVARG, /* bad argument */ - REG_NOMATCH /* match failed */ -}; - - -/* The structure representing a compiled regular expression. */ - -typedef struct { - void *re_pcre; - size_t re_nsub; - size_t re_erroffset; -} regex_t; - -/* The structure in which a captured offset is returned. */ - -typedef int regoff_t; - -typedef struct { - regoff_t rm_so; - regoff_t rm_eo; -} regmatch_t; - -/* The functions */ - -extern int regcomp(regex_t *, const char *, int); -extern int regexec(regex_t *, const char *, size_t, regmatch_t *, int); -extern size_t regerror(int, const regex_t *, char *, size_t); -extern void regfree(regex_t *); - -#ifdef __cplusplus -} /* extern "C" */ -#endif - -#endif /* End of pcreposix.h */ diff --git a/include/scoreboard.h b/include/scoreboard.h deleted file mode 100644 index affca9545169b97eec4e2e84069e237ee091b0f9..0000000000000000000000000000000000000000 --- a/include/scoreboard.h +++ /dev/null @@ -1,242 +0,0 @@ -/* ==================================================================== - * The Apache Software License, Version 1.1 - * - * Copyright (c) 2000 The Apache Software Foundation. All rights - * reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in - * the documentation and/or other materials provided with the - * distribution. - * - * 3. The end-user documentation included with the redistribution, - * if any, must include the following acknowledgment: - * "This product includes software developed by the - * Apache Software Foundation (http://www.apache.org/)." - * Alternately, this acknowledgment may appear in the software itself, - * if and wherever such third-party acknowledgments normally appear. - * - * 4. The names "Apache" and "Apache Software Foundation" must - * not be used to endorse or promote products derived from this - * software without prior written permission. For written - * permission, please contact apache@apache.org. - * - * 5. Products derived from this software may not be called "Apache", - * nor may "Apache" appear in their name, without prior written - * permission of the Apache Software Foundation. - * - * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED - * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES - * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR - * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF - * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND - * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, - * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT - * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * ==================================================================== - * - * This software consists of voluntary contributions made by many - * individuals on behalf of the Apache Software Foundation. For more - * information on the Apache Software Foundation, please see - * . - * - * Portions of this software are based upon public domain software - * originally written at the National Center for Supercomputing Applications, - * University of Illinois, Urbana-Champaign. - */ - -#ifndef APACHE_SCOREBOARD_H -#define APACHE_SCOREBOARD_H -#ifdef __cplusplus -extern "C" { -#endif - -#ifdef HAVE_SYS_TIMES_H -#include -#include -#elif defined(TPF) -#include -#endif - -#include "mpm_default.h" /* For HARD_.*_LIMIT */ -#include "apr_thread_proc.h" - -/*The optimized timeout code only works if we're not using a scoreboard file*/ -#if defined(AP_USE_MEM_BASED_SCOREBOARD) -#define OPTIMIZE_TIMEOUTS -#endif - -/* Scoreboard info on a process is, for now, kept very brief --- - * just status value and pid (the latter so that the caretaker process - * can properly update the scoreboard when a process dies). We may want - * to eventually add a separate set of long_score structures which would - * give, for each process, the number of requests serviced, and info on - * the current, or most recent, request. - * - * Status values: - */ - -#define SERVER_DEAD 0 -#define SERVER_STARTING 1 /* Server Starting up */ -#define SERVER_READY 2 /* Waiting for connection (or accept() lock) */ -#define SERVER_BUSY_READ 3 /* Reading a client request */ -#define SERVER_BUSY_WRITE 4 /* Processing a client request */ -#define SERVER_BUSY_KEEPALIVE 5 /* Waiting for more requests via keepalive */ -#define SERVER_BUSY_LOG 6 /* Logging the request */ -#define SERVER_BUSY_DNS 7 /* Looking up a hostname */ -#define SERVER_GRACEFUL 8 /* server is gracefully finishing request */ -#define SERVER_ACCEPTING 9 /* thread is accepting connections */ -#define SERVER_QUEUEING 10 /* thread is putting connection on the queue */ -#define SERVER_NUM_STATUS 11 /* number of status settings */ - -/* A "virtual time" is simply a counter that indicates that a child is - * making progress. The parent checks up on each child, and when they have - * made progress it resets the last_rtime element. But when the child hasn't - * made progress in a time that's roughly timeout_len seconds long, it is - * sent a SIGALRM. - * - * vtime is an optimization that is used only when the scoreboard is in - * shared memory (it's not easy/feasible to do it in a scoreboard file). - * The essential observation is that timeouts rarely occur, the vast majority - * of hits finish before any timeout happens. So it really sucks to have to - * ask the operating system to set up and destroy alarms many times during - * a request. - */ -typedef unsigned vtime_t; - -/* Type used for generation indicies. Startup and every restart cause a - * new generation of children to be spawned. Children within the same - * generation share the same configuration information -- pointers to stuff - * created at config time in the parent are valid across children. For - * example, the vhostrec pointer in the scoreboard below is valid in all - * children of the same generation. - * - * The safe way to access the vhost pointer is like this: - * - * short_score *ss = pointer to whichver slot is interesting; - * parent_score *ps = pointer to whichver slot is interesting; - * server_rec *vh = ss->vhostrec; - * - * if (ps->generation != ap_my_generation) { - * vh = NULL; - * } - * - * then if vh is not NULL it's valid in this child. - * - * This avoids various race conditions around restarts. - */ -typedef int ap_generation_t; - -/* stuff which is thread/process specific */ -typedef struct { -#ifdef OPTIMIZE_TIMEOUTS - vtime_t cur_vtime; /* the child's current vtime */ - unsigned short timeout_len; /* length of the timeout */ -#endif - int thread_num; - unsigned char status; - unsigned long access_count; - unsigned long bytes_served; - unsigned long my_access_count; - unsigned long my_bytes_served; - unsigned long conn_bytes; - unsigned short conn_count; - apr_time_t start_time; - apr_time_t stop_time; -#ifdef HAVE_TIMES - struct tms times; -#endif -#ifndef OPTIMIZE_TIMEOUTS - time_t last_used; -#endif - char client[32]; /* Keep 'em small... */ - char request[64]; /* We just want an idea... */ - server_rec *vhostrec; /* What virtual host is being accessed? */ - /* SEE ABOVE FOR SAFE USAGE! */ -} short_score; - -typedef struct { - ap_generation_t running_generation; /* the generation of children which - * should still be serving requests. */ -} global_score; - -/* stuff which the parent generally writes and the children rarely read */ -typedef struct { - pid_t pid; - ap_generation_t generation; /* generation of this child */ - int worker_threads; -#ifdef OPTIMIZE_TIMEOUTS - time_t last_rtime; /* time(0) of the last change */ - vtime_t last_vtime; /* the last vtime the parent has seen */ -#endif -} parent_score; - -typedef struct { - short_score servers[HARD_SERVER_LIMIT][HARD_THREAD_LIMIT]; - parent_score parent[HARD_SERVER_LIMIT]; - global_score global; -} scoreboard; - -#define KEY_LENGTH 16 -#define VALUE_LENGTH 64 -typedef struct { - char key[KEY_LENGTH]; - char value[VALUE_LENGTH]; -} status_table_entry; - -#define STATUSES_PER_CONNECTION 10 - -typedef struct { - status_table_entry - table[HARD_SERVER_LIMIT*HARD_THREAD_LIMIT][STATUSES_PER_CONNECTION]; -} new_scoreboard; - -#define SCOREBOARD_SIZE sizeof(scoreboard) -#define NEW_SCOREBOARD_SIZE sizeof(new_scoreboard) -#ifdef TPF -#define SCOREBOARD_NAME "SCOREBRD" -#define SCOREBOARD_FRAMES SCOREBOARD_SIZE/4095 + 1 -#endif - -AP_DECLARE(int) ap_exists_scoreboard_image(void); -void reinit_scoreboard(apr_pool_t *p); -apr_status_t ap_cleanup_shared_mem(void *d); -AP_DECLARE(void) ap_sync_scoreboard_image(void); - -AP_DECLARE(void) reopen_scoreboard(apr_pool_t *p); - -apr_inline void ap_sync_scoreboard_image(void); -void increment_counts(int child_num, int thread_num, request_rec *r); -void update_scoreboard_global(void); -AP_DECLARE(int) find_child_by_pid(apr_proc_t *pid); -int ap_update_child_status(int child_num, int thread_num, int status, request_rec *r); -void ap_time_process_request(int child_num, int thread_num, int status); - - -AP_DECLARE_DATA extern scoreboard *ap_scoreboard_image; -AP_DECLARE_DATA extern const char *ap_scoreboard_fname; -AP_DECLARE_DATA extern int ap_extended_status; -AP_DECLARE_DATA apr_time_t ap_restart_time; - -AP_DECLARE_DATA extern ap_generation_t volatile ap_my_generation; - -/* for time_process_request() in http_main.c */ -#define START_PREQUEST 1 -#define STOP_PREQUEST 2 - -#ifdef __cplusplus -} -#endif - -#endif /* !APACHE_SCOREBOARD_H */ diff --git a/include/util_cfgtree.h b/include/util_cfgtree.h deleted file mode 100644 index 6a4a2f6f27eb0e223f33222d0dec52de6c8d0c74..0000000000000000000000000000000000000000 --- a/include/util_cfgtree.h +++ /dev/null @@ -1,70 +0,0 @@ -/* ==================================================================== - * The Apache Software License, Version 1.1 - * - * Copyright (c) 2000 The Apache Software Foundation. All rights - * reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in - * the documentation and/or other materials provided with the - * distribution. - * - * 3. The end-user documentation included with the redistribution, - * if any, must include the following acknowledgment: - * "This product includes software developed by the - * Apache Software Foundation (http://www.apache.org/)." - * Alternately, this acknowledgment may appear in the software itself, - * if and wherever such third-party acknowledgments normally appear. - * - * 4. The names "Apache" and "Apache Software Foundation" must - * not be used to endorse or promote products derived from this - * software without prior written permission. For written - * permission, please contact apache@apache.org. - * - * 5. Products derived from this software may not be called "Apache", - * nor may "Apache" appear in their name, without prior written - * permission of the Apache Software Foundation. - * - * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED - * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES - * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR - * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF - * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND - * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, - * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT - * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * ==================================================================== - * - * This software consists of voluntary contributions made by many - * individuals on behalf of the Apache Software Foundation. For more - * information on the Apache Software Foundation, please see - * . - */ - -#ifndef AP_CONFTREE_H -#define AP_CONFTREE_H - -typedef struct ap_directive_t { - const char *directive; - const char *args; - int line_num; - struct ap_directive_t *next; - struct ap_directive_t *first_child; - struct ap_directive_t *parent; -} ap_directive_t; - -ap_directive_t *ap_add_node(ap_directive_t **parent, ap_directive_t *current, - ap_directive_t *todadd, int child); - -#endif diff --git a/include/util_charset.h b/include/util_charset.h deleted file mode 100644 index aea3f23356634821ddbe01b6b0007a9604f54d52..0000000000000000000000000000000000000000 --- a/include/util_charset.h +++ /dev/null @@ -1,109 +0,0 @@ -/* ==================================================================== - * The Apache Software License, Version 1.1 - * - * Copyright (c) 2000 The Apache Software Foundation. All rights - * reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in - * the documentation and/or other materials provided with the - * distribution. - * - * 3. The end-user documentation included with the redistribution, - * if any, must include the following acknowledgment: - * "This product includes software developed by the - * Apache Software Foundation (http://www.apache.org/)." - * Alternately, this acknowledgment may appear in the software itself, - * if and wherever such third-party acknowledgments normally appear. - * - * 4. The names "Apache" and "Apache Software Foundation" must - * not be used to endorse or promote products derived from this - * software without prior written permission. For written - * permission, please contact apache@apache.org. - * - * 5. Products derived from this software may not be called "Apache", - * nor may "Apache" appear in their name, without prior written - * permission of the Apache Software Foundation. - * - * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED - * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES - * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR - * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF - * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND - * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, - * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT - * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * ==================================================================== - * - * This software consists of voluntary contributions made by many - * individuals on behalf of the Apache Software Foundation. For more - * information on the Apache Software Foundation, please see - * . - * - * Portions of this software are based upon public domain software - * originally written at the National Center for Supercomputing Applications, - * University of Illinois, Urbana-Champaign. - */ - -#ifndef APACHE_UTIL_CHARSET_H -#define APACHE_UTIL_CHARSET_H - -#ifdef APACHE_XLATE - -#ifdef __cplusplus -extern "C" { -#endif - -#include "apr_xlate.h" - -extern ap_xlate_t *ap_hdrs_to_ascii, *ap_hdrs_from_ascii; -extern ap_xlate_t *ap_locale_to_ascii, *ap_locale_from_ascii; - -/* Save & Restore the current conversion settings - * - * On an EBCDIC machine: - * - * "input" means: ASCII -> EBCDIC (when reading MIME Headers and - * PUT/POST data) - * "output" means: EBCDIC -> ASCII (when sending MIME Headers and Chunks) - * - * On an ASCII machine: - * - * no conversion of headers, so we need to set the translation handle - * to NULL - */ - -#define AP_PUSH_INPUTCONVERSION_STATE(_buff, _newx) \ - ap_xlate_t *saved_input_xlate; \ - ap_bgetopt(_buff, BO_RXLATE, &saved_input_xlate); \ - ap_bsetopt(_buff, BO_RXLATE, &(_newx)) - -#define AP_POP_INPUTCONVERSION_STATE(_buff) \ - ap_bsetopt(_buff, BO_RXLATE, &saved_input_xlate) - -#define AP_PUSH_OUTPUTCONVERSION_STATE(_buff, _newx) \ - ap_xlate_t *saved_output_xlate; \ - ap_bgetopt(_buff, BO_WXLATE, &saved_output_xlate); \ - ap_bsetopt(_buff, BO_WXLATE, &(_newx)) - -#define AP_POP_OUTPUTCONVERSION_STATE(_buff) \ - ap_bsetopt(_buff, BO_WXLATE, &saved_output_xlate) - -#ifdef __cplusplus -} -#endif - -#endif /* APACHE_XLATE */ - -#endif /* !APACHE_UTIL_CHARSET_H */ diff --git a/include/util_ebcdic.h b/include/util_ebcdic.h deleted file mode 100644 index 21360e2bf9cdbe4f64003e09cc3d223678e6ab5a..0000000000000000000000000000000000000000 --- a/include/util_ebcdic.h +++ /dev/null @@ -1,81 +0,0 @@ -/* ==================================================================== - * The Apache Software License, Version 1.1 - * - * Copyright (c) 2000 The Apache Software Foundation. All rights - * reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in - * the documentation and/or other materials provided with the - * distribution. - * - * 3. The end-user documentation included with the redistribution, - * if any, must include the following acknowledgment: - * "This product includes software developed by the - * Apache Software Foundation (http://www.apache.org/)." - * Alternately, this acknowledgment may appear in the software itself, - * if and wherever such third-party acknowledgments normally appear. - * - * 4. The names "Apache" and "Apache Software Foundation" must - * not be used to endorse or promote products derived from this - * software without prior written permission. For written - * permission, please contact apache@apache.org. - * - * 5. Products derived from this software may not be called "Apache", - * nor may "Apache" appear in their name, without prior written - * permission of the Apache Software Foundation. - * - * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED - * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES - * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR - * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF - * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND - * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, - * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT - * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * ==================================================================== - * - * This software consists of voluntary contributions made by many - * individuals on behalf of the Apache Software Foundation. For more - * information on the Apache Software Foundation, please see - * . - * - * Portions of this software are based upon public domain software - * originally written at the National Center for Supercomputing Applications, - * University of Illinois, Urbana-Champaign. - */ - -#ifndef APACHE_UTIL_EBCDIC_H -#define APACHE_UTIL_EBCDIC_H - -#ifdef CHARSET_EBCDIC - -#ifdef __cplusplus -extern "C" { -#endif - -#include "apr_xlate.h" - -extern ap_xlate_t *hdrs_to_ascii, *hdrs_from_ascii; -extern ap_xlate_t *locale_to_ascii, *locale_from_ascii; - -ap_status_t ap_init_ebcdic(ap_pool_t *); - -#ifdef __cplusplus -} -#endif - -#endif /* CHARSET_EBCDIC */ - -#endif /* !APACHE_UTIL_EBCDIC_H */ diff --git a/include/util_filter.h b/include/util_filter.h deleted file mode 100644 index f2f564a5a21b35dfd51bafce808d4a880923d5fd..0000000000000000000000000000000000000000 --- a/include/util_filter.h +++ /dev/null @@ -1,220 +0,0 @@ -/* ==================================================================== - * The Apache Software License, Version 1.1 - * - * Copyright (c) 2000 The Apache Software Foundation. All rights - * reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in - * the documentation and/or other materials provided with the - * distribution. - * - * 3. The end-user documentation included with the redistribution, - * if any, must include the following acknowledgment: - * "This product includes software developed by the - * Apache Software Foundation (http://www.apache.org/)." - * Alternately, this acknowledgment may appear in the software itself, - * if and wherever such third-party acknowledgments normally appear. - * - * 4. The names "Apache" and "Apache Software Foundation" must - * not be used to endorse or promote products derived from this - * software without prior written permission. For written - * permission, please contact apache@apache.org. - * - * 5. Products derived from this software may not be called "Apache", - * nor may "Apache" appear in their name, without prior written - * permission of the Apache Software Foundation. - * - * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED - * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES - * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR - * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF - * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND - * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, - * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT - * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * ==================================================================== - * - * This software consists of voluntary contributions made by many - * individuals on behalf of the Apache Software Foundation. For more - * information on the Apache Software Foundation, please see - * . - */ - -#ifndef AP_FILTER_H -#define AP_FILTER_H - -#ifdef __cplusplus -extern "C" { -#endif - -#ifdef APR_HAVE_STDARG_H -#include -#endif - -#include "httpd.h" -#include "apr.h" - -/* - * FILTER CHAIN - * - * Filters operate using a "chaining" mechanism. The filters are chained - * together into a sequence. When output is generated, it is passed through - * each of the filters on this chain, until it reaches the end (or "bottom") - * and is placed onto the network. - * - * The top of the chain, the code generating the output, is typically called - * a "content generator." The content generator's output is fed into the - * filter chain using the standard Apache output mechanisms: ap_rputs(), - * ap_rprintf(), ap_rwrite(), etc. - * - * Each filter is defined by a callback. This callback takes the output from - * the previous filter (or the content generator if there is no previous - * filter), operates on it, and passes the result to the next filter in the - * chain. This pass-off is performed using the ap_fc_* functions, such as - * ap_fc_puts(), ap_fc_printf(), ap_fc_write(), etc. - * - * When content generation is complete, the system will pass an "end of - * stream" marker into the filter chain. The filters will use this to flush - * out any internal state and to detect incomplete syntax (for example, an - * unterminated SSI directive). - */ - -/* forward declare the filter type */ -typedef struct ap_filter_t ap_filter_t; - -/* - * ap_filter_func: - * - * This function type is used for filter callbacks. It will be passed a - * pointer to "this" filter, and a "bucket" containing the content to be - * filtered. - * - * In filter->ctx, the callback will find its context. This context is - * provided here, so that a filter may be installed multiple times, each - * receiving its own per-install context pointer. - * - * Callbacks are associated with a filter definition, which is specified - * by name. See ap_register_filter() for setting the association between - * a name for a filter and its associated callback (and other information). - * - * The *bucket structure (and all those referenced by ->next and ->prev) - * should be considered "const". The filter is allowed to modify the - * next/prev to insert/remove/replace elements in the bucket list, but - * the types and values of the individual buckets should not be altered. - */ -typedef ap_status_t (*ap_filter_func)(); - -/* - * ap_filter_type: - * - * Filters have different types/classifications. These are used to group - * and sort the filters to properly sequence their operation. - * - * AP_FTYPE_CONTENT: - * These filters are used to alter the content that is passed through - * them. Examples are SSI or PHP. - * - * AP_FTYPE_CONNECTION: - * These filters will alter the content, but in ways that are more - * strongly associated with the output connection. Examples are - * compression, character recoding, or chunked transfer coding. - * - * It is important to note that these types of filters are not allowed - * in a sub-request. A sub-requests output can certainly be filtered - * by AP_FTYPE_CONTENT filters, but all of the "final processing" is - * determined by the main request. - * - * The types have a particular sort order, which allows us to insert them - * into the filter chain in a determistic order. Within a particular grouping, - * the ordering is equivalent to the order of calls to ap_add_filter(). - */ -typedef enum { - AP_FTYPE_CONTENT, - AP_FTYPE_CONNECTION -} ap_filter_type; - -/* - * ap_filter_t: - * - * This is the request-time context structure for an installed filter (in - * the output filter chain). It provides the callback to use for filtering, - * the request this filter is associated with (which is important when - * an output chain also includes sub-request filters), the context for this - * installed filter, and the filter ordering/chaining fields. - * - * Filter callbacks are free to use ->ctx as they please, to store context - * during the filter process. Generally, this is superior over associating - * the state directly with the request. A callback should not change any of - * the other fields. - */ -struct ap_filter_t { - ap_filter_func filter_func; - - void *ctx; - - ap_filter_type ftype; - ap_filter_t *next; -}; - -/* - * ap_register_filter(): - * - * This function is used to register a filter with the system. After this - * registration is performed, then a filter may be added into the filter - * chain by using ap_add_filter() and simply specifying the name. - * - * The filter's callback and type should be passed. - */ -API_EXPORT(void) ap_register_filter(const char *name, - ap_filter_func filter_func, - ap_filter_type ftype); - -/* - * ap_add_filter(): - * - * Adds a named filter into the filter chain on the specified request record. - * The filter will be installed with the specified context pointer. - * - * Filters added in this way will always be placed at the end of the filters - * that have the same type (thus, the filters have the same order as the - * calls to ap_add_filter). If the current filter chain contains filters - * from another request, then this filter will be added before those other - * filters. - */ -API_EXPORT(void) ap_add_filter(const char *name, void *ctx, request_rec *r); - - -/* - * Things to do later: - * Add parameters to ap_filter_func type. Those parameters will be something - * like: - * (request_rec *r, ap_filter_t *filter, ap_data_list *the_data) - * obviously, the request_rec is the current request, and the filter - * is the current filter stack. The data_list is a bucket list or - * bucket_brigade, but I am trying to keep this patch neutral. (If this - * comment breaks that, well sorry, but the information must be there - * somewhere. :-) - * - * Add a function like ap_pass_data. This function will basically just - * call the next filter in the chain, until the current filter is NULL. If the - * current filter is NULL, that means that nobody wrote to the network, and - * we have a HUGE bug, so we need to return an error and log it to the - * log file. - */ -#ifdef __cplusplus -} -#endif - -#endif /* !AP_FILTER_H */ diff --git a/include/util_ldap.h b/include/util_ldap.h deleted file mode 100644 index 10dc2eabe559bd536bc16308f03ece04f274ad89..0000000000000000000000000000000000000000 --- a/include/util_ldap.h +++ /dev/null @@ -1,275 +0,0 @@ -/* ==================================================================== - * The Apache Software License, Version 1.1 - * - * Copyright (c) 2000-2001 The Apache Software Foundation. All rights - * reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in - * the documentation and/or other materials provided with the - * distribution. - * - * 3. The end-user documentation included with the redistribution, - * if any, must include the following acknowledgment: - * "This product includes software developed by the - * Apache Software Foundation (http://www.apache.org/)." - * Alternately, this acknowledgment may appear in the software itself, - * if and wherever such third-party acknowledgments normally appear. - * - * 4. The names "Apache" and "Apache Software Foundation" must - * not be used to endorse or promote products derived from this - * software without prior written permission. For written - * permission, please contact apache@apache.org. - * - * 5. Products derived from this software may not be called "Apache", - * nor may "Apache" appear in their name, without prior written - * permission of the Apache Software Foundation. - * - * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED - * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES - * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR - * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF - * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND - * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, - * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT - * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * ==================================================================== - * - * This software consists of voluntary contributions made by many - * individuals on behalf of the Apache Software Foundation. For more - * information on the Apache Software Foundation, please see - * . - */ - -#ifndef UTIL_LDAP_H -#define UTIL_LDAP_H - -#include - -/* this whole thing disappears if LDAP is not enabled */ -#ifdef APU_HAS_LDAP - -/* APR header files */ -#include -#include -#include - -/* Apache header files */ -#include "ap_config.h" -#include "httpd.h" -#include "http_config.h" -#include "http_core.h" -#include "http_log.h" -#include "http_protocol.h" -#include "http_request.h" - - -/* - * LDAP Connections - */ - -/* Values that the deref member can have */ -typedef enum { - never=LDAP_DEREF_NEVER, - searching=LDAP_DEREF_SEARCHING, - finding=LDAP_DEREF_FINDING, - always=LDAP_DEREF_ALWAYS -} deref_options; - -/* Structure representing an LDAP connection */ -typedef struct util_ldap_connection_t { - LDAP *ldap; - apr_lock_t *lock; /* Lock to indicate this connection is in use */ - int bound; /* Flag to indicate whether this connection is bound yet */ - - const char *host; /* Name of the LDAP server (or space separated list) */ - int port; /* Port of the LDAP server */ - deref_options deref; /* how to handle alias dereferening */ - - const char *binddn; /* DN to bind to server (can be NULL) */ - const char *bindpw; /* Password to bind to server (can be NULL) */ - - int netscapessl; /* True if use Netscape SSL connection */ - const char *certtdb; /* Path to Netscape CA database */ - - int starttls; /* True if StartTLS is enabled */ - int withtls; /* True if StartTLS on this connection */ - - const char *reason; /* Reason for an error failure */ - - struct util_ldap_connection_t *next; -} util_ldap_connection_t; - -/* LDAP cache state information */ -typedef struct util_ldap_state_t { - apr_pool_t *pool; /* pool from which this state is allocated */ - apr_lock_t *mutex; /* mutex lock for the connection list */ - - apr_size_t cache_bytes; /* Size (in bytes) of shared memory cache */ - long search_cache_ttl; /* TTL for search cache */ - long search_cache_size; /* Size (in entries) of search cache */ - long compare_cache_ttl; /* TTL for compare cache */ - long compare_cache_size; /* Size (in entries) of compare cache */ - - struct util_ldap_connection_t *connections; -#ifdef APU_HAS_LDAP_NETSCAPE_SSL - int have_certdb; -#endif -} util_ldap_state_t; - - -/** - * Open a connection to an LDAP server - * @param ldc A structure containing the expanded details of the server - * to connect to. The handle to the LDAP connection is returned - * as ldc->ldap. - * @tip This function connects to the LDAP server and binds. It does not - * connect if already connected (ldc->ldap != NULL). Does not bind - * if already bound. - * @return If successful LDAP_SUCCESS is returned. - * @deffunc int util_ldap_connection_open(util_ldap_connection_t *ldc) - */ -int util_ldap_connection_open(util_ldap_connection_t *ldc); - -/** - * Close a connection to an LDAP server - * @param ldc A structure containing the expanded details of the server - that was connected. - * @tip This function unbinds from the LDAP server, and clears ldc->ldap. - * It is possible to rebind to this server again using the same ldc - * structure, using apr_ldap_open_connection(). - * @deffunc util_ldap_close_connection(util_ldap_connection_t *ldc) - */ -void util_ldap_connection_close(util_ldap_connection_t *ldc); - -/** - * Find a connection in a list of connections - * @param r The request record - * @param host The hostname to connect to (multiple hosts space separated) - * @param port The port to connect to - * @param binddn The DN to bind with - * @param bindpw The password to bind with - * @param deref The dereferencing behavior - * @param netscapessl Start SSL on the connection using ldapssl_client_init() [0|1] - * @param starttls Start TLS using STARTTLS parameter [0|1] - * @tip Once a connection is found and returned, a lock will be acquired to - * lock that particular connection, so that another thread does not try and - * use this connection while it is busy. Once you are finished with a connection, - * apr_ldap_connection_close() must be called to release this connection. - * @deffunc util_ldap_connection_t *util_ldap_connection_find(request_rec *r, const char *host, int port, - * const char *binddn, const char *bindpw, deref_options deref, - * int netscapessl, int starttls) - */ -util_ldap_connection_t *util_ldap_connection_find(request_rec *r, const char *host, int port, - const char *binddn, const char *bindpw, deref_options deref, - int netscapessl, int starttls); - - -/** - * Compare two DNs for sameness - * @param r The request record - * @param ldc The LDAP connection being used. - * @param url The URL of the LDAP connection - used for deciding which cache to use. - * @param dn The first DN to compare. - * @param reqdn The DN to compare the first DN to. - * @param compare_dn_on_server Flag to determine whether the DNs should be checked using - * LDAP calls or with a direct string comparision. A direct - * string comparison is faster, but not as accurate - false - * negative comparisons are possible. - * @tip Two DNs can be equal and still fail a string comparison. Eg "dc=example,dc=com" - * and "dc=example, dc=com". Use the compare_dn_on_server unless there are serious - * performance issues. - * @deffunc int util_ldap_cache_comparedn(request_rec *r, util_ldap_connection_t *ldc, - * const char *url, const char *dn, const char *reqdn, - * int compare_dn_on_server) - */ -int util_ldap_cache_comparedn(request_rec *r, util_ldap_connection_t *ldc, - const char *url, const char *dn, const char *reqdn, - int compare_dn_on_server); - -/** - * A generic LDAP compare function - * @param r The request record - * @param ldc The LDAP connection being used. - * @param url The URL of the LDAP connection - used for deciding which cache to use. - * @param dn The DN of the object in which we do the compare. - * @param attrib The attribute within the object we are comparing for. - * @param value The value of the attribute we are trying to compare for. - * @tip Use this function to determine whether an attribute/value pair exists within an - * object. Typically this would be used to determine LDAP group membership. - * @deffunc int util_ldap_cache_compare(request_rec *r, util_ldap_connection_t *ldc, - * const char *url, const char *dn, const char *attrib, const char *value) - */ -int util_ldap_cache_compare(request_rec *r, util_ldap_connection_t *ldc, - const char *url, const char *dn, const char *attrib, const char *value); - -/** - * Checks a username/password combination by binding to the LDAP server - * @param r The request record - * @param ldc The LDAP connection being used. - * @param url The URL of the LDAP connection - used for deciding which cache to use. - * @param basedn The Base DN to search for the user in. - * @param scope LDAP scope of the search. - * @param filter The user to search for in the form of an LDAP filter. This filter must return - * exactly one user for the check to be successful. - * @param bindpw The user password to bind as. - * @param binddn The DN of the user will be returned in this variable. - * @tip The filter supplied will be searched for. If a single entry is returned, an attempt - * is made to bind as that user. If this bind succeeds, the user is not validated. - * @deffunc int util_ldap_cache_checkuserid(request_rec *r, util_ldap_connection_t *ldc, - * char *url, const char *basedn, int scope, - * char *filter, char *bindpw, char **binddn) - */ -int util_ldap_cache_checkuserid(request_rec *r, util_ldap_connection_t *ldc, - const char *url, const char *basedn, int scope, - const char *filter, const char *bindpw, const char **binddn); - -/* from apr_ldap_cache.c */ - -/** - * Init the LDAP cache - * @param pool The pool to use to initialise the cache - * @param reqsize The size of the shared memory segement to request. A size - * of zero requests the max size possible from - * apr_shmem_init() - * @deffunc void util_ldap_cache_init(apr_pool_t *p) - * @return The status code returned is the status code of the - * apr_smmem_init() call. Regardless of the status, the cache - * will be set up at least for in-process or in-thread operation. - */ -apr_status_t util_ldap_cache_init(apr_pool_t *pool, apr_size_t reqsize); - -/** - * Display formatted stats for cache - * @param The pool to allocate the returned string from - * @tip This function returns a string allocated from the provided pool that describes - * various stats about the cache. - * @deffunc char *util_ald_cache_display(apr_pool_t *pool) - */ -char *util_ald_cache_display(apr_pool_t *pool); - - -/* from apr_ldap_cache_mgr.c */ - -/** - * Display formatted stats for cache - * @param The pool to allocate the returned string from - * @tip This function returns a string allocated from the provided pool that describes - * various stats about the cache. - * @deffunc char *util_ald_cache_display(apr_pool_t *pool) - */ -char *util_ald_cache_display(apr_pool_t *pool); - -#endif /* APU_HAS_LDAP */ -#endif /* UTIL_LDAP_H */ diff --git a/include/util_md5.h b/include/util_md5.h deleted file mode 100644 index 0a0dc9c9b3c68a48ef894b2c06108d34bbd23c32..0000000000000000000000000000000000000000 --- a/include/util_md5.h +++ /dev/null @@ -1,80 +0,0 @@ -/* ==================================================================== - * Copyright (c) 1995-1999 The Apache Group. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in - * the documentation and/or other materials provided with the - * distribution. - * - * 3. All advertising materials mentioning features or use of this - * software must display the following acknowledgment: - * "This product includes software developed by the Apache Group - * for use in the Apache HTTP server project (http://www.apache.org/)." - * - * 4. The names "Apache Server" and "Apache Group" must not be used to - * endorse or promote products derived from this software without - * prior written permission. For written permission, please contact - * apache@apache.org. - * - * 5. Products derived from this software may not be called "Apache" - * nor may "Apache" appear in their names without prior written - * permission of the Apache Group. - * - * 6. Redistributions of any form whatsoever must retain the following - * acknowledgment: - * "This product includes software developed by the Apache Group - * for use in the Apache HTTP server project (http://www.apache.org/)." - * - * THIS SOFTWARE IS PROVIDED BY THE APACHE GROUP ``AS IS'' AND ANY - * EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR - * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE APACHE GROUP OR - * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT - * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, - * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED - * OF THE POSSIBILITY OF SUCH DAMAGE. - * ==================================================================== - * - * This software consists of voluntary contributions made by many - * individuals on behalf of the Apache Group and was originally based - * on public domain software written at the National Center for - * Supercomputing Applications, University of Illinois, Urbana-Champaign. - * For more information on the Apache Group and the Apache HTTP server - * project, please see . - * - */ - -#ifndef APACHE_UTIL_MD5_H -#define APACHE_UTIL_MD5_H - -#ifdef __cplusplus -extern "C" { -#endif - -#include "ap_md5.h" - -API_EXPORT(char *) ap_md5(pool *a, const unsigned char *string); -API_EXPORT(char *) ap_md5_binary(pool *a, const unsigned char *buf, int len); -API_EXPORT(char *) ap_md5contextTo64(pool *p, AP_MD5_CTX * context); -#ifdef CHARSET_EBCDIC -API_EXPORT(char *) ap_md5digest(pool *p, FILE *infile, int convert); -#else -API_EXPORT(char *) ap_md5digest(pool *p, FILE *infile); -#endif /* CHARSET_EBCDIC */ - -#ifdef __cplusplus -} -#endif - -#endif /* !APACHE_UTIL_MD5_H */ diff --git a/include/util_script.h b/include/util_script.h deleted file mode 100644 index 416d72942dca52cbc379e09e438f9af0297cee65..0000000000000000000000000000000000000000 --- a/include/util_script.h +++ /dev/null @@ -1,91 +0,0 @@ -/* ==================================================================== - * Copyright (c) 1995-1999 The Apache Group. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in - * the documentation and/or other materials provided with the - * distribution. - * - * 3. All advertising materials mentioning features or use of this - * software must display the following acknowledgment: - * "This product includes software developed by the Apache Group - * for use in the Apache HTTP server project (http://www.apache.org/)." - * - * 4. The names "Apache Server" and "Apache Group" must not be used to - * endorse or promote products derived from this software without - * prior written permission. For written permission, please contact - * apache@apache.org. - * - * 5. Products derived from this software may not be called "Apache" - * nor may "Apache" appear in their names without prior written - * permission of the Apache Group. - * - * 6. Redistributions of any form whatsoever must retain the following - * acknowledgment: - * "This product includes software developed by the Apache Group - * for use in the Apache HTTP server project (http://www.apache.org/)." - * - * THIS SOFTWARE IS PROVIDED BY THE APACHE GROUP ``AS IS'' AND ANY - * EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR - * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE APACHE GROUP OR - * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT - * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, - * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED - * OF THE POSSIBILITY OF SUCH DAMAGE. - * ==================================================================== - * - * This software consists of voluntary contributions made by many - * individuals on behalf of the Apache Group and was originally based - * on public domain software written at the National Center for - * Supercomputing Applications, University of Illinois, Urbana-Champaign. - * For more information on the Apache Group and the Apache HTTP server - * project, please see . - * - */ - -#ifndef APACHE_UTIL_SCRIPT_H -#define APACHE_UTIL_SCRIPT_H - -#ifdef __cplusplus -extern "C" { -#endif - -#ifndef APACHE_ARG_MAX -#ifdef _POSIX_ARG_MAX -#define APACHE_ARG_MAX _POSIX_ARG_MAX -#else -#define APACHE_ARG_MAX 512 -#endif -#endif - -API_EXPORT(char **) ap_create_environment(pool *p, table *t); -API_EXPORT(int) ap_find_path_info(const char *uri, const char *path_info); -API_EXPORT(void) ap_add_cgi_vars(request_rec *r); -API_EXPORT(void) ap_add_common_vars(request_rec *r); -API_EXPORT(int) ap_scan_script_header_err(request_rec *r, FILE *f, char *buffer); -API_EXPORT(int) ap_scan_script_header_err_buff(request_rec *r, BUFF *f, - char *buffer); -API_EXPORT(int) ap_scan_script_header_err_core(request_rec *r, char *buffer, - int (*getsfunc) (char *, int, void *), - void *getsfunc_data); -API_EXPORT(void) ap_send_size(size_t size, request_rec *r); -API_EXPORT(int) ap_call_exec(request_rec *r, child_info *pinfo, char *argv0, char **env, - int shellcmd); - -#ifdef __cplusplus -} -#endif - -#endif /* !APACHE_UTIL_SCRIPT_H */ diff --git a/include/util_time.h b/include/util_time.h deleted file mode 100644 index 704d0e02d556a3a153c286a97ae5615fb2717afb..0000000000000000000000000000000000000000 --- a/include/util_time.h +++ /dev/null @@ -1,111 +0,0 @@ -/* ==================================================================== - * The Apache Software License, Version 1.1 - * - * Copyright (c) 2001 The Apache Software Foundation. All rights - * reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in - * the documentation and/or other materials provided with the - * distribution. - * - * 3. The end-user documentation included with the redistribution, - * if any, must include the following acknowledgment: - * "This product includes software developed by the - * Apache Software Foundation (http://www.apache.org/)." - * Alternately, this acknowledgment may appear in the software itself, - * if and wherever such third-party acknowledgments normally appear. - * - * 4. The names "Apache" and "Apache Software Foundation" must - * not be used to endorse or promote products derived from this - * software without prior written permission. For written - * permission, please contact apache@apache.org. - * - * 5. Products derived from this software may not be called "Apache", - * nor may "Apache" appear in their name, without prior written - * permission of the Apache Software Foundation. - * - * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED - * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES - * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR - * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF - * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND - * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, - * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT - * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * ==================================================================== - * - * This software consists of voluntary contributions made by many - * individuals on behalf of the Apache Software Foundation. For more - * information on the Apache Software Foundation, please see - * . - * - */ - -#ifndef APACHE_UTIL_TIME_H -#define APACHE_UTIL_TIME_H - -#include "apr.h" -#include "apr_time.h" -#include "httpd.h" - -#ifdef __cplusplus -extern "C" { -#endif - -/** - * @package Apache date/time handling functions - */ - -/* Maximum delta from the current time, in seconds, for a past time - * to qualify as "recent" for use in the ap_explode_recent_*() functions: - */ -#define AP_TIME_RECENT_THRESHOLD 15 - -/** - * convert a recent time to its human readable components in local timezone - * @param tm the exploded time - * @param t the time to explode: MUST be within the last - * AP_TIME_RECENT_THRESHOLD seconds - * @note This is a faster alternative to apr_explode_localtime that uses - * a cache of pre-exploded time structures. It is useful for things - * that need to explode the current time multiple times per second, - * like loggers. - * @return APR_SUCCESS iff successful - * @deffunc apr_status_t ap_explode_recent_localtime(apr_exploded_time_t *tm, apr_time_t t); - */ -AP_DECLARE(apr_status_t) ap_explode_recent_localtime(apr_exploded_time_t *tm, - apr_time_t t); - -/** - * convert a recent time to its human readable components in GMT timezone - * @param tm the exploded time - * @param t the time to explode: MUST be within the last - * AP_TIME_RECENT_THRESHOLD seconds - * @note This is a faster alternative to apr_explode_gmt that uses - * a cache of pre-exploded time structures. It is useful for things - * that need to explode the current time multiple times per second, - * like loggers. - * @return APR_SUCCESS iff successful - * @deffunc apr_status_t ap_explode_recent_gmt(apr_exploded_time_t *tm, apr_time_t t); - */ -AP_DECLARE(apr_status_t) ap_explode_recent_gmt(apr_exploded_time_t *tm, - apr_time_t t); - - -#ifdef __cplusplus -} -#endif - -#endif /* !APACHE_UTIL_TIME_H */ diff --git a/include/util_xml.h b/include/util_xml.h deleted file mode 100644 index f7e45d4769f8968b5cf9d034f7003c6fabb6c152..0000000000000000000000000000000000000000 --- a/include/util_xml.h +++ /dev/null @@ -1,220 +0,0 @@ -/* ==================================================================== - * The Apache Software License, Version 1.1 - * - * Copyright (c) 2000 The Apache Software Foundation. All rights - * reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in - * the documentation and/or other materials provided with the - * distribution. - * - * 3. The end-user documentation included with the redistribution, - * if any, must include the following acknowledgment: - * "This product includes software developed by the - * Apache Software Foundation (http://www.apache.org/)." - * Alternately, this acknowledgment may appear in the software itself, - * if and wherever such third-party acknowledgments normally appear. - * - * 4. The names "Apache" and "Apache Software Foundation" must - * not be used to endorse or promote products derived from this - * software without prior written permission. For written - * permission, please contact apache@apache.org. - * - * 5. Products derived from this software may not be called "Apache", - * nor may "Apache" appear in their name, without prior written - * permission of the Apache Software Foundation. - * - * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED - * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES - * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR - * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF - * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND - * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, - * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT - * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * ==================================================================== - * - * This software consists of voluntary contributions made by many - * individuals on behalf of the Apache Software Foundation. For more - * information on the Apache Software Foundation, please see - * . - */ - -#ifndef UTIL_XML_H -#define UTIL_XML_H - -#ifdef __cplusplus -extern "C" { -#endif - -#include "httpd.h" -#include "apr_lib.h" - - -/* -------------------------------------------------------------------- */ - -/* ### these will need to move at some point to a more logical spot */ - -/* simple strutures to keep a linked list of pieces of text */ -typedef struct ap_text -{ - const char *text; - struct ap_text *next; -} ap_text; - -typedef struct -{ - ap_text *first; - ap_text *last; -} ap_text_header; - -API_EXPORT(void) ap_text_append(ap_pool_t *p, ap_text_header *hdr, - const char *text); - - -/* -------------------------------------------------------------------- -** -** XML PARSING -*/ - -/* -** Qualified namespace values -** -** AP_XML_NS_DAV_ID -** We always insert the "DAV:" namespace URI at the head of the -** namespace array. This means that it will always be at ID==0, -** making it much easier to test for. -** -** AP_XML_NS_NONE -** This special ID is used for two situations: -** -** 1) The namespace prefix begins with "xml" (and we do not know -** what it means). Namespace prefixes with "xml" (any case) as -** their first three characters are reserved by the XML Namespaces -** specification for future use. mod_dav will pass these through -** unchanged. When this identifier is used, the prefix is LEFT in -** the element/attribute name. Downstream processing should not -** prepend another prefix. -** -** 2) The element/attribute does not have a namespace. -** -** a) No prefix was used, and a default namespace has not been -** defined. -** b) No prefix was used, and the default namespace was specified -** to mean "no namespace". This is done with a namespace -** declaration of: xmlns="" -** (this declaration is typically used to override a previous -** specification for the default namespace) -** -** In these cases, we need to record that the elem/attr has no -** namespace so that we will not attempt to prepend a prefix. -** All namespaces that are used will have a prefix assigned to -** them -- mod_dav will never set or use the default namespace -** when generating XML. This means that "no prefix" will always -** mean "no namespace". -** -** In both cases, the XML generation will avoid prepending a prefix. -** For the first case, this means the original prefix/name will be -** inserted into the output stream. For the latter case, it means -** the name will have no prefix, and since we never define a default -** namespace, this means it will have no namespace. -** -** Note: currently, mod_dav understands the "xmlns" prefix and the -** "xml:lang" attribute. These are handled specially (they aren't -** left within the XML tree), so the AP_XML_NS_NONE value won't ever -** really apply to these values. -*/ -#define AP_XML_NS_DAV_ID 0 /* namespace ID for "DAV:" */ -#define AP_XML_NS_NONE -10 /* no namespace for this elem/attr */ - -#define AP_XML_NS_ERROR_BASE -100 /* used only during processing */ -#define AP_XML_NS_IS_ERROR(e) ((e) <= AP_XML_NS_ERROR_BASE) - -/* -** ap_xml_doc: holds a parsed XML document -** ap_xml_elem: holds a parsed XML element -** ap_xml_attr: holds a parsed XML attribute -*/ - -typedef struct ap_xml_attr -{ - const char *name; /* attribute name */ - int ns; /* index into namespace array */ - - const char *value; /* attribute value */ - - struct ap_xml_attr *next; /* next attribute */ -} ap_xml_attr; - -typedef struct ap_xml_elem -{ - const char *name; /* element name */ - int ns; /* index into namespace array */ - const char *lang; /* xml:lang for attrs/contents */ - - ap_text_header first_cdata; /* cdata right after start tag */ - ap_text_header following_cdata; /* cdata after MY end tag */ - - struct ap_xml_elem *parent; /* parent element */ - struct ap_xml_elem *next; /* next (sibling) element */ - struct ap_xml_elem *first_child; /* first child element */ - struct ap_xml_attr *attr; /* first attribute */ - - /* used only during parsing */ - struct ap_xml_elem *last_child; /* last child element */ - struct ap_xml_ns_scope *ns_scope; /* namespaces scoped by this elem */ - - /* used by modules during request processing */ - void *private; -} ap_xml_elem; - -#define AP_XML_ELEM_IS_EMPTY(e) ((e)->first_child == NULL && \ - (e)->first_cdata.first == NULL) - -typedef struct ap_xml_doc -{ - ap_xml_elem *root; /* root element */ - ap_array_header_t *namespaces; /* array of namespaces used */ -} ap_xml_doc; - -API_EXPORT(int) ap_xml_parse_input(request_rec *r, ap_xml_doc **pdoc); - - -/* Converts an XML element tree to flat text */ -API_EXPORT(void) ap_xml_to_text(ap_pool_t *p, const ap_xml_elem *elem, - int style, ap_array_header_t *namespaces, - int *ns_map, const char **pbuf, size_t *psize); - -/* style argument values: */ -#define AP_XML_X2T_FULL 0 /* start tag, contents, end tag */ -#define AP_XML_X2T_INNER 1 /* contents only */ -#define AP_XML_X2T_LANG_INNER 2 /* xml:lang + inner contents */ -#define AP_XML_X2T_FULL_NS_LANG 3 /* FULL + ns defns + xml:lang */ - -API_EXPORT(const char *) ap_xml_empty_elem(ap_pool_t *p, - const ap_xml_elem *elem); - -API_EXPORT(const char *) ap_xml_quote_string(ap_pool_t *p, const char *s, - int quotes); -API_EXPORT(void) ap_xml_quote_elem(ap_pool_t *p, ap_xml_elem *elem); - -/* manage an array of unique URIs: ap_xml_insert_uri() and AP_XML_URI_ITEM() */ - -/* return the URI's (existing) index, or insert it and return a new index */ -API_EXPORT(int) ap_xml_insert_uri(ap_array_header_t *uri_array, - const char *uri); -#define AP_XML_GET_URI_ITEM(ary, i) (((const char * const *)(ary)->elts)[i]) - -#endif /* UTIL_XML_H */ diff --git a/libhttpd.dsp b/libhttpd.dsp deleted file mode 100644 index 3664cee98a2c379ea993260e8a5c103244915cb8..0000000000000000000000000000000000000000 --- a/libhttpd.dsp +++ /dev/null @@ -1,100 +0,0 @@ -# Microsoft Developer Studio Project File - Name="ApacheCoreDll" - Package Owner=<4> -# Microsoft Developer Studio Generated Build File, Format Version 6.00 -# ** DO NOT EDIT ** - -# TARGTYPE "Win32 (x86) Dynamic-Link Library" 0x0102 - -CFG=ApacheCoreDll - Win32 Release -!MESSAGE This is not a valid makefile. To build this project using NMAKE, -!MESSAGE use the Export Makefile command and run -!MESSAGE -!MESSAGE NMAKE /f "ApacheCoreDll.mak". -!MESSAGE -!MESSAGE You can specify a configuration when running NMAKE -!MESSAGE by defining the macro CFG on the command line. For example: -!MESSAGE -!MESSAGE NMAKE /f "ApacheCoreDll.mak" CFG="ApacheCoreDll - Win32 Release" -!MESSAGE -!MESSAGE Possible choices for configuration are: -!MESSAGE -!MESSAGE "ApacheCoreDll - Win32 Release" (based on "Win32 (x86) Dynamic-Link Library") -!MESSAGE "ApacheCoreDll - Win32 Debug" (based on "Win32 (x86) Dynamic-Link Library") -!MESSAGE - -# Begin Project -# PROP AllowPerConfigDependencies 0 -# PROP Scc_ProjName "" -# PROP Scc_LocalPath "" -CPP=cl.exe -MTL=midl.exe -RSC=rc.exe - -!IF "$(CFG)" == "ApacheCoreDll - Win32 Release" - -# PROP BASE Use_MFC 0 -# PROP BASE Use_Debug_Libraries 0 -# PROP BASE Output_Dir ".\CoreR" -# PROP BASE Intermediate_Dir ".\CoreR" -# PROP BASE Target_Dir "" -# PROP Use_MFC 0 -# PROP Use_Debug_Libraries 0 -# PROP Output_Dir ".\CoreR" -# PROP Intermediate_Dir ".\CoreR" -# PROP Ignore_Export_Lib 0 -# PROP Target_Dir "" -# ADD BASE CPP /nologo /MD /W3 /GX /O2 /I ".\include" /I ".\lib\apr\include" /I ".\os\win32" /D "NDEBUG" /D "WIN32" /D "_WINDOWS" /D "API_EXPORT_SYMBOLS" /FD /c -# ADD CPP /nologo /MD /W3 /GX /O2 /I ".\include" /I ".\lib\apr\include" /I ".\os\win32" /D "NDEBUG" /D "WIN32" /D "_WINDOWS" /D "API_EXPORT_SYMBOLS" /FD /c -# ADD BASE MTL /nologo /D "NDEBUG" /win32 -# ADD MTL /nologo /D "NDEBUG" /mktyplib203 /win32 -# ADD BASE RSC /l 0x809 /d "NDEBUG" -# ADD RSC /l 0x809 /d "NDEBUG" -BSC32=bscmake.exe -# ADD BASE BSC32 /nologo -# ADD BSC32 /nologo -LINK32=link.exe -# ADD BASE LINK32 kernel32.lib user32.lib advapi32.lib ws2_32.lib mswsock.lib /nologo /subsystem:windows /dll /map /machine:I386 /base:@"os\win32\BaseAddr.ref",ApacheCore -# ADD LINK32 kernel32.lib user32.lib advapi32.lib ws2_32.lib mswsock.lib /nologo /subsystem:windows /dll /map /machine:I386 /out:".\CoreR/ApacheCore.dll" /base:@"os\win32\BaseAddr.ref",ApacheCore - -!ELSEIF "$(CFG)" == "ApacheCoreDll - Win32 Debug" - -# PROP BASE Use_MFC 0 -# PROP BASE Use_Debug_Libraries 1 -# PROP BASE Output_Dir ".\CoreD" -# PROP BASE Intermediate_Dir ".\CoreD" -# PROP BASE Target_Dir "" -# PROP Use_MFC 0 -# PROP Use_Debug_Libraries 1 -# PROP Output_Dir ".\CoreD" -# PROP Intermediate_Dir ".\CoreD" -# PROP Ignore_Export_Lib 0 -# PROP Target_Dir "" -# ADD BASE CPP /nologo /MDd /W3 /GX /ZI /Od /I ".\include" /I ".\lib\apr\include" /I ".\os\win32" /D "_DEBUG" /D "WIN32" /D "_WINDOWS" /D "API_EXPORT_SYMBOLS" /FD /c -# ADD CPP /nologo /MDd /W3 /GX /ZI /Od /I ".\include" /I ".\lib\apr\include" /I ".\os\win32" /D "_DEBUG" /D "WIN32" /D "_WINDOWS" /D "API_EXPORT_SYMBOLS" /FD /c -# SUBTRACT CPP /YX -# ADD BASE MTL /nologo /D "_DEBUG" /win32 -# ADD MTL /nologo /D "_DEBUG" /mktyplib203 /win32 -# ADD BASE RSC /l 0x809 /d "_DEBUG" -# ADD RSC /l 0x809 /d "_DEBUG" -BSC32=bscmake.exe -# ADD BASE BSC32 /nologo -# ADD BSC32 /nologo -LINK32=link.exe -# ADD BASE LINK32 kernel32.lib user32.lib advapi32.lib ws2_32.lib mswsock.lib /nologo /subsystem:windows /dll /map /debug /machine:I386 /base:@"os\win32\BaseAddr.ref",ApacheCore -# ADD LINK32 kernel32.lib user32.lib advapi32.lib ws2_32.lib mswsock.lib /nologo /subsystem:windows /dll /map /debug /machine:I386 /out:".\CoreD/ApacheCore.dll" /base:@"os\win32\BaseAddr.ref",ApacheCore - -!ENDIF - -# Begin Target - -# Name "ApacheCoreDll - Win32 Release" -# Name "ApacheCoreDll - Win32 Debug" -# Begin Source File - -SOURCE=.\os\win32\ApacheCore.c -# End Source File -# Begin Source File - -SOURCE=.\ApacheCore.def -# End Source File -# End Target -# End Project diff --git a/modules/.cvsignore b/modules/.cvsignore deleted file mode 100644 index f3c7a7c5da68804a1bdf391127ba34aed33c3cca..0000000000000000000000000000000000000000 --- a/modules/.cvsignore +++ /dev/null @@ -1 +0,0 @@ -Makefile diff --git a/modules/Makefile.in b/modules/Makefile.in deleted file mode 100644 index da8a82274b520da3732c026b786d97d192c7c624..0000000000000000000000000000000000000000 --- a/modules/Makefile.in +++ /dev/null @@ -1,10 +0,0 @@ - -DEPTH = .. -topsrcdir = @topsrcdir@ -srcdir = @srcdir@ -VPATH = @srcdir@ - -SUBDIRS = mpm $(MODULE_DIRS) - -include $(topsrcdir)/build/rules.mk - diff --git a/modules/NWGNUmakefile b/modules/NWGNUmakefile deleted file mode 100644 index ca36291d9e65555d56147992957e9d899b56d96c..0000000000000000000000000000000000000000 --- a/modules/NWGNUmakefile +++ /dev/null @@ -1,35 +0,0 @@ -# -# Declare the sub-directories to be built here -# - -SUBDIRS = \ - aaa \ - dav\main \ - dav\fs \ - echo \ - generators \ - mappers \ - metadata \ - proxy \ - $(EOLIST) - -# -# Get the 'head' of the build environment. This includes default targets and -# paths to tools -# - -include $(AP_WORK)\build\NWGNUhead.inc - -# -# build this level's files - -ifeq "$(wildcard NWGNUmakefile.mak)" "NWGNUmakefile.mak" -include NWGNUmakefile.mak -endif - -# -# You can use this target if all that is needed is to copy files to the -# installation area -# -install :: nlms FORCE - diff --git a/modules/README b/modules/README deleted file mode 100644 index df25f051f25e160e32b5111994a0a4b216bd823a..0000000000000000000000000000000000000000 --- a/modules/README +++ /dev/null @@ -1,34 +0,0 @@ -The directory structure for this level is as follows: - -standard/ - - In this directory are the standard supported modules for - Apache. Not all are compiled by default. - -proxy/ - - This houses the code for the proxy module for Apache. - -experimental/ - - In this directory we've placed some modules which we think - provide some pretty interesting functionality, but which - are still in the early stages of development and could - evolve radically in the future. This code isn't supported - officially. - -extra/ - - This is the directory for third-party modules, such as mod_jserv. - -test/ - - This directory houses modules which test various components - of Apache. You should not compile these into a production - server. - -example/ - - This directory houses example modules, to help module authors - figure their way around the Apache API and module concept. - diff --git a/modules/aaa/.cvsignore b/modules/aaa/.cvsignore deleted file mode 100644 index c3690626fe36b14e3f8cfab83dfc4bfa65af85cc..0000000000000000000000000000000000000000 --- a/modules/aaa/.cvsignore +++ /dev/null @@ -1,6 +0,0 @@ -Makefile -*.lo -*.so -*.dll -*.def -*.exp diff --git a/modules/aaa/.indent.pro b/modules/aaa/.indent.pro deleted file mode 100644 index a9fbe9f9a1f2e6e7bcc54171c215bdacd44171ba..0000000000000000000000000000000000000000 --- a/modules/aaa/.indent.pro +++ /dev/null @@ -1,54 +0,0 @@ --i4 -npsl -di0 -br -nce -d0 -cli0 -npcs -nfc1 --TBUFF --TFILE --TTRANS --TUINT4 --T_trans --Tallow_options_t --Tapache_sfio --Tarray_header --Tbool_int --Tbuf_area --Tbuff_struct --Tbuffy --Tcmd_how --Tcmd_parms --Tcommand_rec --Tcommand_struct --Tconn_rec --Tcore_dir_config --Tcore_server_config --Tdir_maker_func --Tevent --Tglobals_s --Thandler_func --Thandler_rec --Tjoblist_s --Tlisten_rec --Tmerger_func --Tmode_t --Tmodule --Tmodule_struct --Tmutex --Tn_long --Tother_child_rec --Toverrides_t --Tparent_score --Tpid_t --Tpiped_log --Tpool --Trequest_rec --Trequire_line --Trlim_t --Tscoreboard --Tsemaphore --Tserver_addr_rec --Tserver_rec --Tserver_rec_chain --Tshort_score --Ttable --Ttable_entry --Tthread --Tu_wide_int --Tvtime_t --Twide_int diff --git a/modules/aaa/Makefile.in b/modules/aaa/Makefile.in deleted file mode 100644 index ccd3c1975523f3db93363a4874d7c44967d37bbd..0000000000000000000000000000000000000000 --- a/modules/aaa/Makefile.in +++ /dev/null @@ -1,8 +0,0 @@ - -DEPTH = ../.. -topsrcdir = @topsrcdir@ -srcdir = @srcdir@ -VPATH = @srcdir@ - -include $(topsrcdir)/build/special.mk - diff --git a/modules/aaa/NWGNUmakefile b/modules/aaa/NWGNUmakefile deleted file mode 100644 index fc72c7355e4df29aa75093b888d242bee9f0ea65..0000000000000000000000000000000000000000 --- a/modules/aaa/NWGNUmakefile +++ /dev/null @@ -1,246 +0,0 @@ -# -# Declare the sub-directories to be built here -# - -SUBDIRS = \ - $(EOLIST) - -# -# Get the 'head' of the build environment. This includes default targets and -# paths to tools -# - -include $(AP_WORK)\build\NWGNUhead.inc - -# -# build this level's files - -# -# Make sure all needed macro's are defined -# - -# -# These directories will be at the beginning of the include list, followed by -# INCDIRS -# -XINCDIRS += \ - $(EOLIST) - -# -# These flags will come after CFLAGS -# -XCFLAGS += \ - $(EOLIST) - -# -# These defines will come after DEFINES -# -XDEFINES += \ - $(EOLIST) - -# -# These flags will be added to the link.opt file -# -XLFLAGS += \ - $(EOLIST) - -# -# These values will be appended to the correct variables based on the value of -# RELEASE -# -ifeq "$(RELEASE)" "debug" -XINCDIRS += \ - $(EOLIST) - -XCFLAGS += \ - $(EOLIST) - -XDEFINES += \ - $(EOLIST) - -XLFLAGS += \ - $(EOLIST) -endif - -ifeq "$(RELEASE)" "noopt" -XINCDIRS += \ - $(EOLIST) - -XCFLAGS += \ - $(EOLIST) - -XDEFINES += \ - $(EOLIST) - -XLFLAGS += \ - $(EOLIST) -endif - -ifeq "$(RELEASE)" "release" -XINCDIRS += \ - $(EOLIST) - -XCFLAGS += \ - $(EOLIST) - -XDEFINES += \ - $(EOLIST) - -XLFLAGS += \ - $(EOLIST) -endif - -# -# These are used by the link target if an NLM is being generated -# This is used by the link 'name' directive to name the nlm. If left blank -# TARGET_nlm (see below) will be used. -# -NLM_NAME = - -# -# This is used by the link '-desc ' directive. -# If left blank, NLM_NAME will be used. -# -NLM_DESCRIPTION = - -# -# This is used by the '-threadname' directive. If left blank, -# NLM_NAME Thread will be used. -# -NLM_THREAD_NAME = - -# -# If this is specified, it will override VERSION value in -# $(AP_WORK)\build\NWGNUenvironment.inc -# -NLM_VERSION = - -# -# If this is specified, it will override the default of 64K -# -NLM_STACK_SIZE = - - -# -# If this is specified it will be used by the link '-entry' directive -# -NLM_ENTRY_SYM = - -# -# If this is specified it will be used by the link '-exit' directive -# -NLM_EXIT_SYM = - -# -# If this is specified it will be used by the link '-check' directive -# -NLM_CHECK_SYM = - -# -# If these are specified it will be used by the link '-flags' directive -# -NLM_FLAGS = - -# -# If this is specified it will be linked in with the XDCData option in the def -# file instead of the default of $(NWOS)/apache.xdc. XDCData can be disabled -# by setting APACHE_UNIPROC in the environment -# -XDCDATA = - -# -# If there is an NLM target, put it here -# -TARGET_nlm = \ - $(OBJDIR)/authanon.nlm \ - $(OBJDIR)/authdbm.nlm \ - $(OBJDIR)/digest.nlm \ - $(EOLIST) - -# -# If there is an LIB target, put it here -# -TARGET_lib = \ - $(EOLIST) - -# -# These are the OBJ files needed to create the NLM target above. -# Paths must all use the '/' character -# -FILES_nlm_objs = \ - $(EOLIST) - -# -# These are the LIB files needed to create the NLM target above. -# These will be added as a library command in the link.opt file. -# -FILES_nlm_libs = \ - $(EOLIST) - -# -# These are the modules that the above NLM target depends on to load. -# These will be added as a module command in the link.opt file. -# -FILES_nlm_modules = \ - $(EOLIST) - -# -# If the nlm has a msg file, put it's path here -# -FILE_nlm_msg = - -# -# If the nlm has a hlp file put it's path here -# -FILE_nlm_hlp = - -# -# If this is specified, it will override $(NWOS)\copyright.txt. -# -FILE_nlm_copyright = - -# -# Any additional imports go here -# -FILES_nlm_Ximports = \ - $(EOLIST) - -# -# Any symbols exported to here -# -FILES_nlm_exports = \ - $(EOLIST) - -# -# These are the OBJ files needed to create the LIB target above. -# Paths must all use the '/' character -# -FILES_lib_objs = \ - $(EOLIST) - -# -# implement targets and dependancies (leave this section alone) -# - -libs :: $(OBJDIR) $(TARGET_lib) - -nlms :: libs $(TARGET_nlm) - -# -# Updated this target to create necessary directories and copy files to the -# correct place. (See $(AP_WORK)\build\NWGNUhead.inc for examples) -# -install :: nlms FORCE - copy $(OBJDIR)\*.nlm $(INSTALL)\Apache2\modules\*.* - -# -# Any specialized rules here -# - -# -# Include the 'tail' makefile that has targets that depend on variables defined -# in this makefile -# - -include $(AP_WORK)\build\NWGNUtail.inc - diff --git a/modules/aaa/config.m4 b/modules/aaa/config.m4 deleted file mode 100644 index 9d069b51c769ce61183c6d5fd60fe72e417275ea..0000000000000000000000000000000000000000 --- a/modules/aaa/config.m4 +++ /dev/null @@ -1 +0,0 @@ -APACHE_MODULE(standard) diff --git a/modules/aaa/mod_auth_digest.c b/modules/aaa/mod_auth_digest.c deleted file mode 100644 index 43795221f867dea785ee0eabce87635bdc4ec4cb..0000000000000000000000000000000000000000 --- a/modules/aaa/mod_auth_digest.c +++ /dev/null @@ -1,1919 +0,0 @@ -/* ==================================================================== - * Copyright (c) 1995-1999 The Apache Group. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in - * the documentation and/or other materials provided with the - * distribution. - * - * 3. All advertising materials mentioning features or use of this - * software must display the following acknowledgment: - * "This product includes software developed by the Apache Group - * for use in the Apache HTTP server project (http://www.apache.org/)." - * - * 4. The names "Apache Server" and "Apache Group" must not be used to - * endorse or promote products derived from this software without - * prior written permission. For written permission, please contact - * apache@apache.org. - * - * 5. Products derived from this software may not be called "Apache" - * nor may "Apache" appear in their names without prior written - * permission of the Apache Group. - * - * 6. Redistributions of any form whatsoever must retain the following - * acknowledgment: - * "This product includes software developed by the Apache Group - * for use in the Apache HTTP server project (http://www.apache.org/)." - * - * THIS SOFTWARE IS PROVIDED BY THE APACHE GROUP ``AS IS'' AND ANY - * EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR - * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE APACHE GROUP OR - * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT - * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, - * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED - * OF THE POSSIBILITY OF SUCH DAMAGE. - * ==================================================================== - * - * This software consists of voluntary contributions made by many - * individuals on behalf of the Apache Group and was originally based - * on public domain software written at the National Center for - * Supercomputing Applications, University of Illinois, Urbana-Champaign. - * For more information on the Apache Group and the Apache HTTP server - * project, please see . - * - */ - -/* - * mod_auth_digest: MD5 digest authentication - * - * Originally by Alexei Kosut - * Updated to RFC-2617 by Ronald Tschalär - * based on mod_auth, by Rob McCool and Robert S. Thau - * - * This module an updated version of modules/standard/mod_digest.c - * However, it has not been extensively tested yet, and is therefore - * currently marked experimental. Send problem reports to me - * (ronald@innovation.ch) - * - * Requires either /dev/random (or equivalent) or the truerand library, - * available for instance from - * ftp://research.att.com/dist/mab/librand.shar - * - * Open Issues: - * - qop=auth-int (when streams and trailer support available) - * - nonce-format configurability - * - Proxy-Authorization-Info header is set by this module, but is - * currently ignored by mod_proxy (needs patch to mod_proxy) - * - generating the secret takes a while (~ 8 seconds) if using the - * truerand library - * - shared-mem not completely tested yet. Seems to work ok for me, - * but... (definitely won't work on Windoze) - */ - -/* The section for the Configure script: - * MODULE-DEFINITION-START - * Name: digest_auth_module - * ConfigStart - - RULE_DEV_RANDOM=`./helpers/CutRule DEV_RANDOM $file` - if [ "$RULE_DEV_RANDOM" = "default" ]; then - if [ -r "/dev/random" ]; then - RULE_DEV_RANDOM="/dev/random" - elif [ -r "/dev/urandom" ]; then - RULE_DEV_RANDOM="/dev/urandom" - else - RULE_DEV_RANDOM="truerand" - if helpers/TestCompile func randbyte; then - : - elif helpers/TestCompile lib rand randbyte; then - : - else - echo " (mod_auth_digest) truerand library missing!" - echo "** This will most probably defeat successful compilation." - echo "** See Rule DEV_RANDOM in src/Configuration.tmpl for more information." - fi - fi - fi - if [ "$RULE_DEV_RANDOM" = "truerand" ]; then - echo " using truerand library (-lrand) for the random seed" - LIBS="$LIBS -L/usr/local/lib -lrand" - else - echo " using $RULE_DEV_RANDOM for the random seed" - CFLAGS="$CFLAGS -DDEV_RANDOM=$RULE_DEV_RANDOM" - fi - - * ConfigEnd - * MODULE-DEFINITION-END - */ - -#include "httpd.h" -#include "http_config.h" -#include "http_conf_globals.h" -#include "http_core.h" -#include "http_request.h" -#include "http_log.h" -#include "http_protocol.h" -#include "ap_config.h" -#include "ap_ctype.h" -#include "util_uri.h" -#include "util_md5.h" -#include "ap_sha1.h" -#ifdef HAVE_SHMEM_MM -#include "mm.h" -#endif /* HAVE_SHMEM_MM */ - - -/* struct to hold the configuration info */ - -typedef struct digest_config_struct { - const char *dir_name; - const char *pwfile; - const char *grpfile; - const char *realm; - const char **qop_list; - AP_SHA1_CTX nonce_ctx; - long nonce_lifetime; - const char *nonce_format; - int check_nc; - const char *algorithm; - char *uri_list; - const char *ha1; -} digest_config_rec; - - -#define DFLT_ALGORITHM "MD5" - -#define DFLT_NONCE_LIFE 300L -#define NEXTNONCE_DELTA 30 - - -#define NONCE_TIME_LEN (((sizeof(time_t)+2)/3)*4) -#define NONCE_HASH_LEN 40 -#define NONCE_LEN (NONCE_TIME_LEN + NONCE_HASH_LEN) - -#define SECRET_LEN 20 - - -/* client list definitions */ - -typedef struct hash_entry { - unsigned long key; /* the key for this entry */ - struct hash_entry *next; /* next entry in the bucket */ - unsigned long nonce_count; /* for nonce-count checking */ - char ha1[17]; /* for algorithm=MD5-sess */ - char last_nonce[NONCE_LEN+1]; /* for one-time nonce's */ -} client_entry; - -static struct hash_table { - client_entry **table; - unsigned long tbl_len; - unsigned long num_entries; - unsigned long num_created; - unsigned long num_removed; - unsigned long num_renewed; -} *client_list; - - -/* struct to hold a parsed Authorization header */ - -enum hdr_sts { NO_HEADER, NOT_DIGEST, INVALID, VALID }; - -typedef struct digest_header_struct { - const char *scheme; - const char *realm; - const char *username; - char *nonce; - const char *uri; - const char *digest; - const char *algorithm; - const char *cnonce; - const char *opaque; - unsigned long opaque_num; - const char *message_qop; - const char *nonce_count; - /* the following fields are not (directly) from the header */ - time_t nonce_time; - enum hdr_sts auth_hdr_sts; - uri_components *request_uri; - int needed_auth; - client_entry *client; -} digest_header_rec; - - -/* (mostly) nonce stuff */ - -typedef union time_union { - time_t time; - unsigned char arr[sizeof(time_t)]; -} time_rec; - - -static unsigned char secret[SECRET_LEN]; -static int call_cnt = 0; - - -#ifdef HAVE_SHMEM_MM -/* opaque stuff */ - -static MM *opaque_mm; -static unsigned long *opaque_cntr; - -static MM *client_mm; - -static MM *otn_count_mm; -static time_t *otn_counter; /* one-time-nonce counter */ - -#define SHMEM_SIZE 1000 /* ~ 12 entries */ -#define NUM_BUCKETS 15UL - -#else /* HAVE_SHMEM_MM */ -static void *client_mm = NULL; -#endif /* HAVE_SHMEM_MM */ - -module MODULE_VAR_EXPORT digest_auth_module; - -/* - * initialization code - */ - -#ifdef HAVE_SHMEM_MM -static void cleanup_tables(void *not_used) -{ - fprintf(stderr, "Digest: cleaning up shared memory\n"); - fflush(stderr); - - if (client_mm) { - mm_destroy(client_mm); - client_mm = NULL; - } - - if (opaque_mm) { - mm_destroy(opaque_mm); - opaque_mm = NULL; - } - - if (otn_count_mm) { - mm_destroy(otn_count_mm); - otn_count_mm = NULL; - } -} -#endif /* HAVE_SHMEM_MM */ - -static void initialize_secret(server_rec *s) -{ -#ifdef DEV_RANDOM - FILE *rnd; - size_t got, tot; -#else - extern int randbyte(void); /* from the truerand library */ - unsigned int idx; -#endif - - ap_log_error(APLOG_MARK, APLOG_NOERRNO|APLOG_NOTICE, s, - "Digest: generating secret for digest authentication ..."); - -#ifdef DEV_RANDOM -#define XSTR(x) #x -#define STR(x) XSTR(x) - if ((rnd = fopen(STR(DEV_RANDOM), "rb")) == NULL) { - ap_log_error(APLOG_MARK, APLOG_CRIT, s, - "Digest: Couldn't open " STR(DEV_RANDOM)); - exit(EXIT_FAILURE); - } - if (setvbuf(rnd, NULL, _IONBF, 0) != 0) { - ap_log_error(APLOG_MARK, APLOG_NOERRNO|APLOG_CRIT, s, - "Digest: Error trying to disable buffering for " STR(DEV_RANDOM)); - exit(EXIT_FAILURE); - } - for (tot=0; tottable = (client_entry**) (client_list + 1); - for (idx=0; idxtable[idx] = NULL; - client_list->tbl_len = NUM_BUCKETS; - client_list->num_entries = 0; - - - /* setup opaque */ - - opaque_mm = mm_create(sizeof(*opaque_cntr), tmpnam(NULL)); - if (opaque_mm == NULL) - goto failed; -#ifdef MPE - if (geteuid() == 1) { -#else - if (geteuid() == 0) { -#endif - if (mm_permission(opaque_mm, 0600, ap_user_id, ap_group_id)) - goto failed; - } - opaque_cntr = mm_malloc(opaque_mm, sizeof(*opaque_cntr)); - if (opaque_cntr == NULL) - goto failed; - *opaque_cntr = 1UL; - - - /* setup one-time-nonce counter */ - - otn_count_mm = mm_create(sizeof(*otn_counter), tmpnam(NULL)); - if (otn_count_mm == NULL) - goto failed; -#ifdef MPE - if (geteuid() == 1) { -#else - if (geteuid() == 0) { -#endif - if (mm_permission(otn_count_mm, 0600, ap_user_id, ap_group_id)) - goto failed; - } - otn_counter = mm_malloc(otn_count_mm, sizeof(*otn_counter)); - if (otn_counter == NULL) - goto failed; - *otn_counter = 0; - - - /* success */ - return; - -failed: - if (!client_mm || (client_list && client_list->table && !opaque_mm) - || (opaque_cntr && !otn_count_mm)) - ap_log_error(APLOG_MARK, APLOG_NOERRNO|APLOG_ERR, s, - "Digest: failed to create shared memory segments; reason " - "was `%s' - all nonce-count checking, one-time nonces, " - "and MD5-sess algorithm disabled", mm_error()); - else - ap_log_error(APLOG_MARK, APLOG_NOERRNO|APLOG_ERR, s, - "Digest: failed to allocate shared mem; reason was `%s' " - "- all nonce-count checking, one-time nonces, and " - "MD5-sess algorithm disabled", mm_error()); - - cleanup_tables(NULL); -} -#endif /* HAVE_SHMEM_MM */ - -static void initialize_module(server_rec *s, pool *p) -{ - /* keep from doing the init more than once at startup, and delay - * the init until the second round - */ - if (++call_cnt < 2) - return; - - /* only initialize the secret on startup, not on restarts */ - if (call_cnt == 2) - initialize_secret(s); - -#ifdef HAVE_SHMEM_MM - /* Note: this stuff is currently fixed for the lifetime of the server, - * i.e. even across restarts. This means that A) any shmem-size - * configuration changes are ignored, and B) certain optimizations, - * such as only allocating the smallest necessary entry for each - * client, can't be done. However, the alternative is a nightmare: - * we can't call mm_destroy on a graceful restart because there will - * be children using the tables, and we also don't know when the - * last child dies. Therefore we can never clean up the old stuff, - * creating a creeping memory leak. - */ - initialize_tables(s); - /* atexit(cleanup_tables); */ - ap_register_cleanup(p, NULL, cleanup_tables, ap_null_cleanup); -#endif /* HAVE_SHMEM_MM */ -} - - -/* - * configuration code - */ - -static void *create_digest_dir_config(pool *p, char *dir) -{ - digest_config_rec *conf; - - if (dir == NULL) return NULL; - - conf = (digest_config_rec *) ap_pcalloc(p, sizeof(digest_config_rec)); - if (conf) { - conf->qop_list = ap_palloc(p, sizeof(char*)); - conf->qop_list[0] = NULL; - conf->nonce_lifetime = DFLT_NONCE_LIFE; - conf->dir_name = ap_pstrdup(p, dir); - conf->algorithm = DFLT_ALGORITHM; - } - - return conf; -} - -static const char *set_realm(cmd_parms *cmd, void *config, const char *realm) -{ - digest_config_rec *conf = (digest_config_rec *) config; - - /* The core already handles the realm, but it's just too convenient to - * grab it ourselves too and cache some setups. However, we need to - * let the core get at it too, which is why we decline at the end - - * this relies on the fact that http_core is last in the list. - */ - conf->realm = realm; - - /* we precompute the part of the nonce hash that is constant (well, - * the host:port would be too, but that varies for .htaccess files - * and directives outside a virtual host section) - */ - ap_SHA1Init(&conf->nonce_ctx); - ap_SHA1Update_binary(&conf->nonce_ctx, (const unsigned char *) realm, - strlen(realm)); - ap_SHA1Update_binary(&conf->nonce_ctx, secret, sizeof(secret)); - - return DECLINE_CMD; -} - -static const char *set_digest_file(cmd_parms *cmd, void *config, - const char *file) -{ - ((digest_config_rec *) config)->pwfile = file; - return NULL; -} - -static const char *set_group_file(cmd_parms *cmd, void *config, - const char *file) -{ - ((digest_config_rec *) config)->grpfile = file; - return NULL; -} - -static const char *set_qop(cmd_parms *cmd, void *config, const char *op) -{ - digest_config_rec *conf = (digest_config_rec *) config; - const char **tmp; - int cnt; - - if (!strcasecmp(op, "none")) { - if (conf->qop_list[0] == NULL) { - conf->qop_list = ap_palloc(cmd->pool, 2 * sizeof(char*)); - conf->qop_list[1] = NULL; - } - conf->qop_list[0] = "none"; - return NULL; - } - - if (!strcasecmp(op, "auth-int")) - ap_log_error(APLOG_MARK, APLOG_NOERRNO|APLOG_WARNING, cmd->server, - "Digest: WARNING: qop `auth-int' currently only works " - "correctly for responses with no entity"); - else if (strcasecmp(op, "auth")) - return ap_pstrcat(cmd->pool, "Unrecognized qop: ", op, NULL); - - for (cnt=0; conf->qop_list[cnt] != NULL; cnt++) - ; - tmp = ap_palloc(cmd->pool, (cnt+2)*sizeof(char*)); - memcpy(tmp, conf->qop_list, cnt*sizeof(char*)); - tmp[cnt] = ap_pstrdup(cmd->pool, op); - tmp[cnt+1] = NULL; - conf->qop_list = tmp; - - return NULL; -} - -static const char *set_nonce_lifetime(cmd_parms *cmd, void *config, - const char *t) -{ - char *endptr; - long lifetime; - - lifetime = strtol(t, &endptr, 10); - if (endptr < (t+strlen(t)) && !ap_isspace(*endptr)) - return ap_pstrcat(cmd->pool, "Invalid time in AuthDigestNonceLifetime: ", t, NULL); - - ((digest_config_rec *) config)->nonce_lifetime = lifetime; - return NULL; -} - -static const char *set_nonce_format(cmd_parms *cmd, void *config, - const char *fmt) -{ - ((digest_config_rec *) config)->nonce_format = fmt; - return "AuthDigestNonceFormat is not implemented (yet)"; -} - -static const char *set_nc_check(cmd_parms *cmd, void *config, int flag) -{ - ((digest_config_rec *) config)->check_nc = flag; - return NULL; -} - -static const char *set_algorithm(cmd_parms *cmd, void *config, const char *alg) -{ - if (!strcasecmp(alg, "MD5-sess")) -#ifdef HAVE_SHMEM_MM - ; -#else /* HAVE_SHMEM_MM */ - ap_log_error(APLOG_MARK, APLOG_NOERRNO|APLOG_WARNING, cmd->server, - "Digest: WARNING: algorithm `MD5-sess' is currently not " - "correctly implemented"); -#endif /* HAVE_SHMEM_MM */ - else if (strcasecmp(alg, "MD5")) - return ap_pstrcat(cmd->pool, "Invalid algorithm in AuthDigestAlgorithm: ", alg, NULL); - - ((digest_config_rec *) config)->algorithm = alg; - return NULL; -} - -static const char *set_uri_list(cmd_parms *cmd, void *config, const char *uri) -{ - digest_config_rec *c = (digest_config_rec *) config; - if (c->uri_list) { - c->uri_list[strlen(c->uri_list)-1] = '\0'; - c->uri_list = ap_pstrcat(cmd->pool, c->uri_list, " ", uri, "\"", NULL); - } - else - c->uri_list = ap_pstrcat(cmd->pool, ", domain=\"", uri, "\"", NULL); - return NULL; -} - -static const command_rec digest_cmds[] = -{ - {"AuthName", set_realm, NULL, OR_AUTHCFG, TAKE1, - "The authentication realm (e.g. \"Members Only\")"}, - {"AuthDigestFile", set_digest_file, NULL, OR_AUTHCFG, TAKE1, - "The name of the file containing the usernames and password hashes"}, - {"AuthDigestGroupFile", set_group_file, NULL, OR_AUTHCFG, TAKE1, - "The name of the file containing the group names and members"}, - {"AuthDigestQop", set_qop, NULL, OR_AUTHCFG, ITERATE, - "A list of quality-of-protection options"}, - {"AuthDigestNonceLifetime", set_nonce_lifetime, NULL, OR_AUTHCFG, TAKE1, - "Maximum lifetime of the server nonce (seconds)"}, - {"AuthDigestNonceFormat", set_nonce_format, NULL, OR_AUTHCFG, TAKE1, - "The format to use when generating the server nonce"}, - {"AuthDigestNcCheck", set_nc_check, NULL, OR_AUTHCFG, FLAG, - "Whether or not to check the nonce-count sent by the client"}, - {"AuthDigestAlgorithm", set_algorithm, NULL, OR_AUTHCFG, TAKE1, - "The algorithm used for the hash calculation"}, - {"AuthDigestDomain", set_uri_list, NULL, OR_AUTHCFG, ITERATE, - "A list of URI's which belong to the same protection space as the current URI"}, - {NULL} -}; - - -#ifdef HAVE_SHMEM_MM -/* - * client list code - * - * Each client is assigned a number, which is transfered in the opaque - * field of the WWW-Authenticate and Authorization headers. The number - * is just a simple counter which is incremented for each new client. - * Clients can't forge this number because it is hashed up into the - * server nonce, and that is checked. - * - * The clients are kept in a simple hash table, which consists of an - * array of client_entry's, each with a linked list of entries hanging - * off it. The client's number modulo the size of the array gives the - * bucket number. - * - * The clients are garbage collected whenever a new client is allocated - * but there is not enough space left in the shared memory segment. A - * simple semi-LRU is used for this: whenever a client entry is accessed - * it is moved to the beginning of the linked list in its bucket (this - * also makes for faster lookups for current clients). The garbage - * collecter then just removes the oldest entry (i.e. the one at the - * end of the list) in each bucket. - * - * The main advantages of the above scheme are that it's easy to implement - * and it keeps the hash table evenly balanced (i.e. same number of entries - * in each bucket). The major disadvantage is that you may be throwing - * entries out which are in active use. This is not tragic, as these - * clients will just be sent a new client id (opaque field) and nonce - * with a stale=true (i.e. it will just look like the nonce expired, - * thereby forcing an extra round trip). If the shared memory segment - * has enough headroom over the current client set size then this should - * not occur too often. - * - * To help tune the size of the shared memory segment (and see if the - * above algorithm is really sufficient) a set of counters is kept - * indicating the number of clients held, the number of garbage collected - * clients, and the number of erroneously purged clients. These are printed - * out at each garbage collection run. Note that access to the counters is - * not synchronized because they are just indicaters, and whether they are - * off by a few doesn't matter; and for the same reason no attempt is made - * to guarantee the num_renewed is correct in the face of clients spoofing - * the opaque field. - */ - -/* - * Get the client given its client number (the key). Returns the entry, - * or NULL if its not found. - * - * Access to the list itself is synchronized via locks. However, access - * to the entry returned by get_client() is NOT synchronized. This means - * that there are potentially problems if a client uses multiple, - * simultaneous connections to access url's within the same protection - * space. However, these problems are not new: when using multiple - * connections you have no guarantee of the order the requests are - * processed anyway, so you have problems with the nonce-count and - * one-time nonces anyway. - */ -static client_entry *get_client(unsigned long key, const request_rec *r) -{ - int bucket; - client_entry *entry, *prev = NULL; - - - if (!key || !client_mm) return NULL; - - bucket = key % client_list->tbl_len; - entry = client_list->table[bucket]; - - mm_lock(client_mm, MM_LOCK_RD); - - while(entry && key != entry->key) { - prev = entry; - entry = entry->next; - } - - if (entry && prev) { /* move entry to front of list */ - prev->next = entry->next; - entry->next = client_list->table[bucket]; - client_list->table[bucket] = entry; - } - - mm_unlock(client_mm); - - if (entry) - ap_log_rerror(APLOG_MARK, APLOG_NOERRNO|APLOG_DEBUG, r, - "get_client(): client %lu found", key); - else - ap_log_rerror(APLOG_MARK, APLOG_NOERRNO|APLOG_DEBUG, r, - "get_client(): client %lu not found", key); - - return entry; -} - - -/* A simple garbage-collecter to remove unused clients. It removes the - * last entry in each bucket and updates the counters. Returns the - * number of removed entries. - */ -static long gc(void) -{ - client_entry *entry, *prev; - unsigned long num_removed = 0, idx; - - /* garbage collect all last entries */ - - for (idx=0; idxtbl_len; idx++) { - entry = client_list->table[idx]; - prev = NULL; - while (entry->next) { /* find last entry */ - prev = entry; - entry = entry->next; - } - if (prev) prev->next = NULL; /* cut list */ - else client_list->table[idx] = NULL; - if (entry) { /* remove entry */ - mm_free(client_mm, entry); - num_removed++; - } - } - - /* update counters and log */ - - client_list->num_entries -= num_removed; - client_list->num_removed += num_removed; - - return num_removed; -} - - -/* - * Add a new client to the list. Returns the entry if successful, NULL - * otherwise. This triggers the garbage collection is memory is low. - */ -static client_entry *add_client(unsigned long key, client_entry *new, - server_rec *s) -{ - int bucket; - client_entry *entry; - - - if (!key || !client_mm) return NULL; - - bucket = key % client_list->tbl_len; - entry = client_list->table[bucket]; - - mm_lock(client_mm, MM_LOCK_RW); - - /* try to allocate a new entry */ - - entry = mm_malloc(client_mm, sizeof(client_entry)); - if (!entry) { - long num_removed = gc(); - ap_log_error(APLOG_MARK, APLOG_NOERRNO|APLOG_INFO, s, - "Digest: gc'd %ld client entries. Total new clients: " - "%ld; Total removed clients: %ld; Total renewed clients: " - "%ld", num_removed, - client_list->num_created - client_list->num_renewed, - client_list->num_removed, client_list->num_renewed); - entry = mm_malloc(client_mm, sizeof(client_entry)); - if (!entry) return NULL; /* give up */ - } - - /* now add the entry */ - - memcpy(entry, new, sizeof(client_entry)); - entry->key = key; - entry->next = client_list->table[bucket]; - client_list->table[bucket] = entry; - client_list->num_created++; - client_list->num_entries++; - - mm_unlock(client_mm); - - ap_log_error(APLOG_MARK, APLOG_NOERRNO|APLOG_DEBUG, s, - "allocated new client %lu", key); - - return entry; -} -#else /* HAVE_SHMEM_MM */ -static client_entry *get_client(unsigned long key, const request_rec *r) -{ - return NULL; -} -#endif /* HAVE_SHMEM_MM */ - - -/* - * Authorization header parser code - */ - -/* Parse the Authorization header, if it exists */ -static int get_digest_rec(request_rec *r, digest_header_rec *resp) -{ - const char *auth_line = ap_table_get(r->headers_in, - r->proxyreq ? "Proxy-Authorization" - : "Authorization"); - size_t l; - int vk = 0, vv = 0; - char *key, *value; - - - if (!auth_line) { - resp->auth_hdr_sts = NO_HEADER; - return !OK; - } - - resp->scheme = ap_getword_white(r->pool, &auth_line); - if (strcasecmp(resp->scheme, "Digest")) { - resp->auth_hdr_sts = NOT_DIGEST; - return !OK; - } - - l = strlen(auth_line); - - key = ap_palloc(r->pool, l+1); - value = ap_palloc(r->pool, l+1); - - while (auth_line[0] != '\0') { - - /* find key */ - - while (ap_isspace(auth_line[0])) auth_line++; - vk = 0; - while (auth_line[0] != '=' && auth_line[0] != ',' - && auth_line[0] != '\0' && !ap_isspace(auth_line[0])) - key[vk++] = *auth_line++; - key[vk] = '\0'; - while (ap_isspace(auth_line[0])) auth_line++; - - /* find value */ - - if (auth_line[0] == '=') { - auth_line++; - while (ap_isspace(auth_line[0])) auth_line++; - - vv = 0; - if (auth_line[0] == '\"') { /* quoted string */ - auth_line++; - while (auth_line[0] != '\"' && auth_line[0] != '\0') { - if (auth_line[0] == '\\' && auth_line[1] != '\0') - auth_line++; /* escaped char */ - value[vv++] = *auth_line++; - } - if (auth_line[0] != '\0') auth_line++; - } - else { /* token */ - while (auth_line[0] != ',' && auth_line[0] != '\0' - && !ap_isspace(auth_line[0])) - value[vv++] = *auth_line++; - } - value[vv] = '\0'; - } - - while (auth_line[0] != ',' && auth_line[0] != '\0') auth_line++; - if (auth_line[0] != '\0') auth_line++; - - if (!strcasecmp(key, "username")) - resp->username = ap_pstrdup(r->pool, value); - else if (!strcasecmp(key, "realm")) - resp->realm = ap_pstrdup(r->pool, value); - else if (!strcasecmp(key, "nonce")) - resp->nonce = ap_pstrdup(r->pool, value); - else if (!strcasecmp(key, "uri")) - resp->uri = ap_pstrdup(r->pool, value); - else if (!strcasecmp(key, "response")) - resp->digest = ap_pstrdup(r->pool, value); - else if (!strcasecmp(key, "algorithm")) - resp->algorithm = ap_pstrdup(r->pool, value); - else if (!strcasecmp(key, "cnonce")) - resp->cnonce = ap_pstrdup(r->pool, value); - else if (!strcasecmp(key, "opaque")) - resp->opaque = ap_pstrdup(r->pool, value); - else if (!strcasecmp(key, "qop")) - resp->message_qop = ap_pstrdup(r->pool, value); - else if (!strcasecmp(key, "nc")) - resp->nonce_count = ap_pstrdup(r->pool, value); - } - - if (!resp->username || !resp->realm || !resp->nonce || !resp->uri - || !resp->digest) { - resp->auth_hdr_sts = INVALID; - return !OK; - } - - if (resp->opaque) - resp->opaque_num = (unsigned long) strtol(resp->opaque, NULL, 16); - - resp->auth_hdr_sts = VALID; - return OK; -} - - -/* Because the browser may preemptively send auth info, incrementing the - * nonce-count when it does, and because the client does not get notified - * if the URI didn't need authentication after all, we need to be sure to - * update the nonce-count each time we receive an Authorization header no - * matter what the final outcome of the request. Furthermore this is a - * convenient place to get the request-uri (before any subrequests etc - * are initiated) and to initialize the request_config. - * - * Note that this must be called after mod_proxy had its go so that - * r->proxyreq is set correctly. - */ -static int update_nonce_count(request_rec *r) -{ - digest_header_rec *resp; - int res; - - if (!ap_is_initial_req(r)) - return DECLINED; - - resp = ap_pcalloc(r->pool, sizeof(digest_header_rec)); - resp->request_uri = &r->parsed_uri; - resp->needed_auth = 0; - ap_set_module_config(r->request_config, &digest_auth_module, resp); - - res = get_digest_rec(r, resp); - resp->client = get_client(resp->opaque_num, r); - if (res == OK && resp->client) - resp->client->nonce_count++; - - return DECLINED; -} - - -/* - * Nonce generation code - */ - -/* The hash part of the nonce is a SHA-1 hash of the time, realm, opaque, - * and our secret. - */ -static void gen_nonce_hash(char *hash, const char *timestr, const char *opaque, - const server_rec *server, - const digest_config_rec *conf) -{ - const char *hex = "0123456789abcdef"; - unsigned char sha1[SHA_DIGESTSIZE]; - AP_SHA1_CTX ctx; - int idx; - - memcpy(&ctx, &conf->nonce_ctx, sizeof(ctx)); - ap_SHA1Update_binary(&ctx, (const unsigned char *) server->server_hostname, - strlen(server->server_hostname)); - ap_SHA1Update_binary(&ctx, (const unsigned char *) &server->port, - sizeof(server->port)); - ap_SHA1Update_binary(&ctx, (const unsigned char *) timestr, strlen(timestr)); - if (opaque) - ap_SHA1Update_binary(&ctx, (const unsigned char *) opaque, - strlen(opaque)); - ap_SHA1Final(sha1, &ctx); - - for (idx=0; idx> 4]; - *hash++ = hex[sha1[idx] & 0xF]; - } - - *hash++ = '\0'; -} - - -/* The nonce has the format b64(time)+hash . - */ -static const char *gen_nonce(pool *p, time_t now, const char *opaque, - const server_rec *server, - const digest_config_rec *conf) -{ - char *nonce = ap_palloc(p, NONCE_LEN+1); - time_rec t; - - if (conf->nonce_lifetime != 0) - t.time = now; - else -#ifdef HAVE_SHMEM_MM - /* this counter is not synch'd, because it doesn't really matter - * if it counts exactly. - */ - t.time = (*otn_counter)++; -#else /* HAVE_SHMEM_MM */ - t.time = 42; -#endif /* HAVE_SHMEM_MM */ - ap_base64encode_binary(nonce, t.arr, sizeof(t.arr)); - gen_nonce_hash(nonce+NONCE_TIME_LEN, nonce, opaque, server, conf); - - return nonce; -} - - -/* - * Opaque and hash-table management - */ - -#ifdef HAVE_SHMEM_MM -/* - * Generate a new client entry, add it to the list, and return the - * entry. Returns NULL if failed. - */ -static client_entry *gen_client(const request_rec *r) -{ - unsigned long op; - client_entry new = { 0, NULL, 0, "", "" }, *entry; - - if (!opaque_mm) return 0; - - mm_lock(opaque_mm, MM_LOCK_RW); - op = (*opaque_cntr)++; - mm_unlock(opaque_mm); - - if (!(entry = add_client(op, &new, r->server))) { - ap_log_rerror(APLOG_MARK, APLOG_ERR, r, - "Digest: failed to allocate client entry - ignoring " - "client"); - return NULL; - } - - return entry; -} -#else /* HAVE_SHMEM_MM */ -static client_entry *gen_client(const request_rec *r) { return NULL; } -#endif /* HAVE_SHMEM_MM */ - - - -/* - * MD5-sess code. - * - * If you want to use algorithm=MD5-sess you must write get_userpw_hash() - * yourself (see below). The dummy provided here just returns the hash - * from the auth-file, i.e. it is only useful for testing client - * implementations of MD5-sess . - */ - -/* - * get_userpw_hash() will be called each time a new session needs to be - * generated and is expected to return the equivalent of - * - * ap_md5(r->pool, - * ap_pstrcat(r->pool, username, ":", ap_auth_name(r), ":", passwd)) - * - * You must implement this yourself, and will probably consist of code - * contacting the password server and retrieving the hash from it. - * - * TBD: This function should probably be in a seperate source file so that - * people need not modify mod_auth_digest.c each time they install a new version - * of apache. - */ -static const char *get_userpw_hash(const request_rec *r, - const digest_header_rec *resp, - const digest_config_rec *conf) -{ - /* for now, just get it from pwfile */ - return conf->ha1; -} - - -static const char *get_session(const request_rec *r, - digest_header_rec *resp, - const digest_config_rec *conf) -{ - const char *ha1 = NULL, *urp; - - /* get ha1 from client list */ - if (resp->opaque && resp->client) - ha1 = resp->client->ha1; - - /* generate new session if necessary */ - if (ha1 == NULL || ha1[0] == '\0') { - urp = get_userpw_hash(r, resp, conf); - ha1 = ap_md5(r->pool, - (unsigned char *) ap_pstrcat(r->pool, ha1, ":", resp->nonce, - ":", resp->cnonce, NULL)); - if (!resp->client) - resp->client = gen_client(r); - if (resp->client) - memcpy(resp->client->ha1, ha1, 17); - } - - return ha1; -} - - -static void clear_session(const digest_header_rec *resp) -{ - if (resp->client) - resp->client->ha1[0] = '\0'; -} - - -/* - * Authorization challenge generation code (for WWW-Authenticate) - */ - -static const char *guess_domain(pool *p, const char *uri, const char *filename, - const char *dir) -{ - size_t u_len = strlen(uri), f_len = strlen(filename), d_len = strlen(dir); - const char *u, *f; - - - /* Because of things like mod_alias and mod_rewrite and the fact that - * protection is often on a directory basis (not a location basis) it - * is hard to determine the uri to put in the domain attribute. - * - * What we do is the following: first we see if the directory is - * a prefix for the uri - if this is the case we assume that therefore - * a directive was protecting this uri and we can use it - * for the domain. - */ - if (u_len >= d_len && !memcmp(uri, dir, d_len)) - return dir; - - /* Now we check for , and if we find one we send back a - * dummy uri - this is the only way to specify that the protection - * space only covers a single uri. - */ - if (dir[0] != '/') - /* This doesn't work for Amaya (ok, it's of arguable validity in - * the first place), so just return the file name instead - return "http://0.0.0.0/"; - */ - return dir; - - /* Next we find the largest common common suffix of the request-uri - * and the final file name, ignoring any extensions; this gives us a - * hint as to where any rewriting could've occured (assuming that some - * prefix of the uri is rewritten, not a suffix). - */ - u = uri + u_len - 1; /* strip any extension */ - while (u > uri && *u != '/') u--; - while (*u && *u != '.') u++; - if (*u == '.') u--; - if (*u == '/') u--; - - f = filename + f_len - 1; /* strip any extension */ - while (f > filename && *f != '/') f--; - while (*f && *f != '.') f++; - if (*f == '.') f--; - if (*f == '/') f--; - - while (*f == *u && f > filename && u > uri) u--, f--; - f++; u++; - - while (*f && *f != '/') f++, u++; /* suffix must start with / */ - - /* Now, if the directory reaches into this common suffix then we can - * take the uri with the same reach. - */ - if ((unsigned long) (f-filename) < d_len) { - char *tmp = ap_pstrdup(p, uri); - tmp[(u-uri)+(d_len-(f-filename))] = '\0'; - return tmp; - } - - return ""; /* give up */ -} - - -static const char *ltox(pool *p, unsigned long num) -{ - if (num != 0) - return ap_psprintf(p, "%lx", num); - else - return ""; -} - -static void note_digest_auth_failure(request_rec *r, - const digest_config_rec *conf, - digest_header_rec *resp, int stale) -{ - const char *qop, *opaque, *opaque_param, *domain, *nonce; - int cnt; - - - /* Setup qop */ - - if (conf->qop_list[0] == NULL) - qop = ", qop=\"auth\""; - else if (!strcasecmp(conf->qop_list[0], "none")) - qop = ""; - else { - qop = ap_pstrcat(r->pool, ", qop=\"", conf->qop_list[0], NULL); - for (cnt=1; conf->qop_list[cnt] != NULL; cnt++) - qop = ap_pstrcat(r->pool, qop, ",", conf->qop_list[cnt], NULL); - qop = ap_pstrcat(r->pool, qop, "\"", NULL); - } - - /* MD5-sess stuff */ - - if (!stale && !strcasecmp(conf->algorithm, "MD5-sess")) - clear_session(resp); - - /* Setup opaque */ - - if (resp->opaque == NULL) { - /* new client */ - if ((conf->check_nc || conf->nonce_lifetime == 0 - || !strcasecmp(conf->algorithm, "MD5-sess")) - && (resp->client = gen_client(r)) != NULL) - opaque = ltox(r->pool, resp->client->key); - else - opaque = ""; /* opaque not needed */ - } - else if (resp->client == NULL) { - /* client info was gc'd */ - resp->client = gen_client(r); - if (resp->client != NULL) { - opaque = ltox(r->pool, resp->client->key); - stale = 1; - client_list->num_renewed++; - } - else - opaque = ""; /* ??? */ - } - else { - opaque = resp->opaque; - /* we're generating a new nonce, so reset the nonce-count */ - resp->client->nonce_count = 0; - } - - if (opaque[0]) - opaque_param = ap_pstrcat(r->pool, ", opaque=\"", opaque, "\"", NULL); - else - opaque_param = NULL; - - /* Setup nonce */ - - nonce = gen_nonce(r->pool, r->request_time, opaque, r->server, conf); - if (resp->client && conf->nonce_lifetime == 0) - memcpy(resp->client->last_nonce, nonce, NONCE_LEN+1); - - /* setup domain attribute. We want to send this attribute wherever - * possible so that the client won't send the Authorization header - * unneccessarily (it's usually > 200 bytes!). - */ - - if (conf->uri_list) - domain = conf->uri_list; - else { - /* They didn't specify any domain, so let's guess at it */ - domain = guess_domain(r->pool, resp->request_uri->path, r->filename, - conf->dir_name); - if (domain[0] == '/' && domain[1] == '\0') - domain = ""; /* "/" is the default, so no need to send it */ - else - domain = ap_pstrcat(r->pool, ", domain=\"", domain, "\"", NULL); - } - - ap_table_mergen(r->err_headers_out, - r->proxyreq ? "Proxy-Authenticate" : "WWW-Authenticate", - ap_psprintf(r->pool, "Digest realm=\"%s\", nonce=\"%s\", " - "algorithm=%s%s%s%s%s", - ap_auth_name(r), nonce, conf->algorithm, - opaque_param ? opaque_param : "", - domain ? domain : "", - stale ? ", stale=true" : "", qop)); -} - - -/* - * Authorization header verification code - */ - -static const char *get_hash(request_rec *r, const char *user, - const char *realm, const char *auth_pwfile) -{ - configfile_t *f; - char l[MAX_STRING_LEN]; - const char *rpw; - char *w, *x; - - if (!(f = ap_pcfg_openfile(r->pool, auth_pwfile))) { - ap_log_rerror(APLOG_MARK, APLOG_ERR, r, - "Digest: Could not open password file: %s", auth_pwfile); - return NULL; - } - while (!(ap_cfg_getline(l, MAX_STRING_LEN, f))) { - if ((l[0] == '#') || (!l[0])) - continue; - rpw = l; - w = ap_getword(r->pool, &rpw, ':'); - x = ap_getword(r->pool, &rpw, ':'); - - if (x && w && !strcmp(user, w) && !strcmp(realm, x)) { - ap_cfg_closefile(f); - return ap_pstrdup(r->pool, rpw); - } - } - ap_cfg_closefile(f); - return NULL; -} - -static int check_nc(const request_rec *r, const digest_header_rec *resp, - const digest_config_rec *conf) -{ - if (conf->check_nc && client_mm) { - unsigned long nc; - - const char *snc = resp->nonce_count; - char *endptr; - - nc = strtol(snc, &endptr, 16); - if (endptr < (snc+strlen(snc)) && !ap_isspace(*endptr)) { - ap_log_rerror(APLOG_MARK, APLOG_NOERRNO|APLOG_ERR, r, - "Digest: invalid nc %s received - not a number", snc); - return !OK; - } - - if (!resp->client) - return !OK; - - if (nc != resp->client->nonce_count) { - ap_log_rerror(APLOG_MARK, APLOG_NOERRNO|APLOG_DEBUG, r, - "nonce-count check failed: %lu != %lu", nc, - resp->client->nonce_count); - return !OK; - } - } - - return OK; -} - -static int check_nonce(request_rec *r, digest_header_rec *resp, - const digest_config_rec *conf) -{ - double dt; - time_rec nonce_time; - char tmp, hash[NONCE_HASH_LEN+1]; - - if (strlen(resp->nonce) != NONCE_LEN) { - ap_log_rerror(APLOG_MARK, APLOG_NOERRNO|APLOG_ERR, r, - "Digest: invalid nonce %s received - length is not %d", - resp->nonce, NONCE_LEN); - note_digest_auth_failure(r, conf, resp, 1); - return AUTH_REQUIRED; - } - - tmp = resp->nonce[NONCE_TIME_LEN]; - resp->nonce[NONCE_TIME_LEN] = '\0'; - ap_base64decode_binary(nonce_time.arr, resp->nonce); - gen_nonce_hash(hash, resp->nonce, resp->opaque, r->server, conf); - resp->nonce[NONCE_TIME_LEN] = tmp; - resp->nonce_time = nonce_time.time; - - if (strcmp(hash, resp->nonce+NONCE_TIME_LEN)) { - ap_log_rerror(APLOG_MARK, APLOG_NOERRNO|APLOG_ERR, r, - "Digest: invalid nonce %s received - hash is not %s", - resp->nonce, hash); - note_digest_auth_failure(r, conf, resp, 1); - return AUTH_REQUIRED; - } - - dt = difftime(r->request_time, nonce_time.time); - if (conf->nonce_lifetime > 0 && dt < 0) { - ap_log_rerror(APLOG_MARK, APLOG_NOERRNO|APLOG_ERR, r, - "Digest: invalid nonce %s received - user attempted " - "time travel", resp->nonce); - note_digest_auth_failure(r, conf, resp, 1); - return AUTH_REQUIRED; - } - - if (conf->nonce_lifetime > 0) { - if (dt > conf->nonce_lifetime) { - ap_log_rerror(APLOG_MARK, APLOG_NOERRNO|APLOG_INFO, r, - "Digest: user %s: nonce expired - sending new nonce", - r->connection->user); - note_digest_auth_failure(r, conf, resp, 1); - return AUTH_REQUIRED; - } - } - else if (conf->nonce_lifetime == 0 && resp->client) { - if (memcmp(resp->client->last_nonce, resp->nonce, NONCE_LEN)) { - ap_log_rerror(APLOG_MARK, APLOG_NOERRNO|APLOG_INFO, r, - "Digest: user %s: one-time-nonce mismatch - sending " - "new nonce", r->connection->user); - note_digest_auth_failure(r, conf, resp, 1); - return AUTH_REQUIRED; - } - } - /* else (lifetime < 0) => never expires */ - - return OK; -} - -/* The actual MD5 code... whee */ - -static const char *old_digest(const request_rec *r, - const digest_header_rec *resp, const char *ha1) -{ - const char *ha2; - - /* rfc-2069 */ - ha2 = ap_md5(r->pool, (unsigned char *)ap_pstrcat(r->pool, r->method, ":", - resp->uri, NULL)); - return ap_md5(r->pool, - (unsigned char *)ap_pstrcat(r->pool, ha1, ":", resp->nonce, - ":", ha2, NULL)); -} - -static const char *new_digest(const request_rec *r, - digest_header_rec *resp, - const digest_config_rec *conf) -{ - const char *ha1, *ha2, *a2; - - /* draft-ietf-http-authentication-03 */ - if (resp->algorithm && !strcasecmp(resp->algorithm, "MD5-sess")) - ha1 = get_session(r, resp, conf); - else - ha1 = conf->ha1; - - if (resp->message_qop && !strcasecmp(resp->message_qop, "auth-int")) - a2 = ap_pstrcat(r->pool, r->method, ":", resp->uri, ":", - ap_md5(r->pool, (const unsigned char*) ""), NULL); /* TBD */ - else - a2 = ap_pstrcat(r->pool, r->method, ":", resp->uri, NULL); - ha2 = ap_md5(r->pool, (const unsigned char *)a2); - - return ap_md5(r->pool, - (unsigned char *)ap_pstrcat(r->pool, ha1, ":", resp->nonce, - ":", resp->nonce_count, ":", - resp->cnonce, ":", - resp->message_qop, ":", ha2, - NULL)); -} - - -/* These functions return 0 if client is OK, and proper error status - * if not... either AUTH_REQUIRED, if we made a check, and it failed, or - * SERVER_ERROR, if things are so totally confused that we couldn't - * figure out how to tell if the client is authorized or not. - * - * If they return DECLINED, and all other modules also decline, that's - * treated by the server core as a configuration error, logged and - * reported as such. - */ - -/* Determine user ID, and check if the attributes are correct, if it - * really is that user, if the nonce is correct, etc. - */ - -static int authenticate_digest_user(request_rec *r) -{ - digest_config_rec *conf; - digest_header_rec *resp; - request_rec *mainreq; - conn_rec *conn = r->connection; - const char *t; - int res; - - - /* do we require Digest auth for this URI? */ - - if (!(t = ap_auth_type(r)) || strcasecmp(t, "Digest")) - return DECLINED; - - if (!ap_auth_name(r)) { - ap_log_rerror(APLOG_MARK, APLOG_NOERRNO|APLOG_ERR, r, - "Digest: need AuthName: %s", r->uri); - return SERVER_ERROR; - } - - - /* get the client response and mark */ - - mainreq = r; - while (mainreq->main != NULL) mainreq = mainreq->main; - while (mainreq->prev != NULL) mainreq = mainreq->prev; - resp = (digest_header_rec *) ap_get_module_config(mainreq->request_config, - &digest_auth_module); - resp->needed_auth = 1; - - - /* get our conf */ - - conf = (digest_config_rec *) ap_get_module_config(r->per_dir_config, - &digest_auth_module); - - - /* check for existence and syntax of Auth header */ - - if (resp->auth_hdr_sts != VALID) { - if (resp->auth_hdr_sts == NOT_DIGEST) - ap_log_rerror(APLOG_MARK, APLOG_NOERRNO|APLOG_ERR, r, - "Digest: client used wrong authentication scheme " - "`%s': %s", resp->scheme, r->uri); - else if (resp->auth_hdr_sts == INVALID) - ap_log_rerror(APLOG_MARK, APLOG_NOERRNO|APLOG_ERR, r, - "Digest: missing user, realm, nonce, uri, or digest " - "in authorization header: %s", r->uri); - /* else (resp->auth_hdr_sts == NO_HEADER) */ - note_digest_auth_failure(r, conf, resp, 0); - return AUTH_REQUIRED; - } - - r->connection->user = (char *) resp->username; - r->connection->ap_auth_type = (char *) "Digest"; - - - /* check the auth attributes */ - - if (strcmp(resp->uri, resp->request_uri->path)) { - uri_components *r_uri = resp->request_uri, d_uri; - ap_parse_uri_components(r->pool, resp->uri, &d_uri); - - if ((d_uri.hostname && d_uri.hostname[0] != '\0' - && strcasecmp(d_uri.hostname, r->server->server_hostname)) - || (d_uri.port_str && d_uri.port != r->server->port) - || (!d_uri.port_str && r->server->port != 80) - || strcmp(d_uri.path, r_uri->path) - || (d_uri.query != r_uri->query - && (!d_uri.query || !r_uri->query - || strcmp(d_uri.query, r_uri->query))) - ) { - ap_log_rerror(APLOG_MARK, APLOG_NOERRNO|APLOG_ERR, r, - "Digest: uri mismatch - <%s> does not match " - "request-uri <%s>", resp->uri, - ap_unparse_uri_components(r->pool, r_uri, 0)); - return BAD_REQUEST; - } - } - - if (resp->opaque && resp->opaque_num == 0) { - ap_log_rerror(APLOG_MARK, APLOG_NOERRNO|APLOG_ERR, r, - "Digest: received invalid opaque - got `%s'", - resp->opaque); - note_digest_auth_failure(r, conf, resp, 0); - return AUTH_REQUIRED; - } - - if (strcmp(resp->realm, conf->realm)) { - ap_log_rerror(APLOG_MARK, APLOG_NOERRNO|APLOG_ERR, r, - "Digest: realm mismatch - got `%s' but expected `%s'", - resp->realm, conf->realm); - note_digest_auth_failure(r, conf, resp, 0); - return AUTH_REQUIRED; - } - - if (resp->algorithm != NULL - && strcasecmp(resp->algorithm, "MD5") - && strcasecmp(resp->algorithm, "MD5-sess")) { - ap_log_rerror(APLOG_MARK, APLOG_NOERRNO|APLOG_ERR, r, - "Digest: unknown algorithm `%s' received: %s", - resp->algorithm, r->uri); - note_digest_auth_failure(r, conf, resp, 0); - return AUTH_REQUIRED; - } - - if (!conf->pwfile) - return DECLINED; - - if (!(conf->ha1 = get_hash(r, conn->user, conf->realm, conf->pwfile))) { - ap_log_rerror(APLOG_MARK, APLOG_NOERRNO|APLOG_ERR, r, - "Digest: user `%s' in realm `%s' not found: %s", - conn->user, conf->realm, r->uri); - note_digest_auth_failure(r, conf, resp, 0); - return AUTH_REQUIRED; - } - - if (resp->message_qop == NULL) { - /* old (rfc-2069) style digest */ - if (strcmp(resp->digest, old_digest(r, resp, conf->ha1))) { - ap_log_rerror(APLOG_MARK, APLOG_NOERRNO|APLOG_ERR, r, - "Digest: user %s: password mismatch: %s", conn->user, - r->uri); - note_digest_auth_failure(r, conf, resp, 0); - return AUTH_REQUIRED; - } - } - else { - int match = 0, idx; - for (idx=0; conf->qop_list[idx] != NULL; idx++) { - if (!strcasecmp(conf->qop_list[idx], resp->message_qop)) { - match = 1; - break; - } - } - - if (!match - && !(conf->qop_list[0] == NULL - && !strcasecmp(resp->message_qop, "auth"))) { - ap_log_rerror(APLOG_MARK, APLOG_NOERRNO|APLOG_ERR, r, - "Digest: invalid qop `%s' received: %s", - resp->message_qop, r->uri); - note_digest_auth_failure(r, conf, resp, 0); - return AUTH_REQUIRED; - } - - if (strcmp(resp->digest, new_digest(r, resp, conf))) { - ap_log_rerror(APLOG_MARK, APLOG_NOERRNO|APLOG_ERR, r, - "Digest: user %s: password mismatch: %s", conn->user, - r->uri); - note_digest_auth_failure(r, conf, resp, 0); - return AUTH_REQUIRED; - } - } - - if (check_nc(r, resp, conf) != OK) { - note_digest_auth_failure(r, conf, resp, 0); - return AUTH_REQUIRED; - } - - /* Note: this check is done last so that a "stale=true" can be - generated if the nonce is old */ - if ((res = check_nonce(r, resp, conf))) - return res; - - return OK; -} - - -/* - * Checking ID - */ - -static table *groups_for_user(request_rec *r, const char *user, - const char *grpfile) -{ - configfile_t *f; - table *grps = ap_make_table(r->pool, 15); - pool *sp; - char l[MAX_STRING_LEN]; - const char *group_name, *ll, *w; - - if (!(f = ap_pcfg_openfile(r->pool, grpfile))) { - ap_log_rerror(APLOG_MARK, APLOG_ERR, r, - "Digest: Could not open group file: %s", grpfile); - return NULL; - } - - sp = ap_make_sub_pool(r->pool); - - while (!(ap_cfg_getline(l, MAX_STRING_LEN, f))) { - if ((l[0] == '#') || (!l[0])) - continue; - ll = l; - ap_clear_pool(sp); - - group_name = ap_getword(sp, &ll, ':'); - - while (ll[0]) { - w = ap_getword_conf(sp, &ll); - if (!strcmp(w, user)) { - ap_table_setn(grps, ap_pstrdup(r->pool, group_name), "in"); - break; - } - } - } - - ap_cfg_closefile(f); - ap_destroy_pool(sp); - return grps; -} - - -static int digest_check_auth(request_rec *r) -{ - const digest_config_rec *conf = - (digest_config_rec *) ap_get_module_config(r->per_dir_config, - &digest_auth_module); - const char *user = r->connection->user; - int m = r->method_number; - int method_restricted = 0; - register int x; - const char *t, *w; - table *grpstatus; - const array_header *reqs_arr; - require_line *reqs; - - if (!(t = ap_auth_type(r)) || strcasecmp(t, "Digest")) - return DECLINED; - - reqs_arr = ap_requires(r); - /* If there is no "requires" directive, then any user will do. - */ - if (!reqs_arr) - return OK; - reqs = (require_line *) reqs_arr->elts; - - if (conf->grpfile) - grpstatus = groups_for_user(r, user, conf->grpfile); - else - grpstatus = NULL; - - for (x = 0; x < reqs_arr->nelts; x++) { - - if (!(reqs[x].method_mask & (1 << m))) - continue; - - method_restricted = 1; - - t = reqs[x].requirement; - w = ap_getword_white(r->pool, &t); - if (!strcasecmp(w, "valid-user")) - return OK; - else if (!strcasecmp(w, "user")) { - while (t[0]) { - w = ap_getword_conf(r->pool, &t); - if (!strcmp(user, w)) - return OK; - } - } - else if (!strcasecmp(w, "group")) { - if (!grpstatus) - return DECLINED; - - while (t[0]) { - w = ap_getword_conf(r->pool, &t); - if (ap_table_get(grpstatus, w)) - return OK; - } - } - else { - ap_log_rerror(APLOG_MARK, APLOG_NOERRNO|APLOG_ERR, r, - "Digest: access to %s failed, reason: unknown require " - "directive \"%s\"", r->uri, reqs[x].requirement); - return DECLINED; - } - } - - if (!method_restricted) - return OK; - - ap_log_rerror(APLOG_MARK, APLOG_NOERRNO|APLOG_ERR, r, - "Digest: access to %s failed, reason: user %s not allowed access", - r->uri, user); - - note_digest_auth_failure(r, conf, - (digest_header_rec *) ap_get_module_config(r->request_config, - &digest_auth_module), - 0); - return AUTH_REQUIRED; -} - - -/* - * Authorization-Info header code - */ - -#ifdef SEND_DIGEST -static const char *hdr(const table *tbl, const char *name) -{ - const char *val = ap_table_get(tbl, name); - if (val) - return val; - else - return ""; -} -#endif - -static int add_auth_info(request_rec *r) -{ - const digest_config_rec *conf = - (digest_config_rec *) ap_get_module_config(r->per_dir_config, - &digest_auth_module); - digest_header_rec *resp = - (digest_header_rec *) ap_get_module_config(r->request_config, - &digest_auth_module); - const char *ai = NULL, *digest = NULL, *nextnonce = ""; - - if (resp == NULL || !resp->needed_auth || conf == NULL) - return OK; - - - /* rfc-2069 digest - */ - if (resp->message_qop == NULL) { - /* old client, so calc rfc-2069 digest */ - -#ifdef SEND_DIGEST - /* most of this totally bogus because the handlers don't set the - * headers until the final handler phase (I wonder why this phase - * is called fixup when there's almost nothing you can fix up...) - * - * Because it's basically impossible to get this right (e.g. the - * Content-length is never set yet when we get here, and we can't - * calc the entity hash) it's best to just leave this #def'd out. - */ - char *entity_info = - ap_md5(r->pool, - (unsigned char *) ap_pstrcat(r->pool, - ap_unparse_uri_components(r->pool, - resp->request_uri, 0), ":", - r->content_type ? r->content_type : ap_default_type(r), ":", - hdr(r->headers_out, "Content-Length"), ":", - r->content_encoding ? r->content_encoding : "", ":", - hdr(r->headers_out, "Last-Modified"), ":", - r->no_cache && !ap_table_get(r->headers_out, "Expires") ? - ap_gm_timestr_822(r->pool, r->request_time) : - hdr(r->headers_out, "Expires"), - NULL)); - digest = - ap_md5(r->pool, - (unsigned char *)ap_pstrcat(r->pool, conf->ha1, ":", - resp->nonce, ":", - r->method, ":", - ap_gm_timestr_822(r->pool, r->request_time), ":", - entity_info, ":", - ap_md5(r->pool, (unsigned char *) ""), /* H(entity) - TBD */ - NULL)); -#endif - } - - - /* setup nextnonce - */ - if (conf->nonce_lifetime > 0) { - /* send nextnonce if current nonce will expire in less than 30 secs */ - if (difftime(r->request_time, resp->nonce_time) > (conf->nonce_lifetime-NEXTNONCE_DELTA)) { - nextnonce = ap_pstrcat(r->pool, ", nextnonce=\"", - gen_nonce(r->pool, r->request_time, - resp->opaque, r->server, conf), - "\"", NULL); - resp->client->nonce_count = 0; - } - } - else if (conf->nonce_lifetime == 0 && resp->client) { - const char *nonce = gen_nonce(r->pool, 0, resp->opaque, r->server, - conf); - nextnonce = ap_pstrcat(r->pool, ", nextnonce=\"", nonce, "\"", NULL); - memcpy(resp->client->last_nonce, nonce, NONCE_LEN+1); - } - /* else nonce never expires, hence no nextnonce */ - - - /* do rfc-2069 digest - */ - if (conf->qop_list[0] && !strcasecmp(conf->qop_list[0], "none") - && resp->message_qop == NULL) { - /* use only RFC-2069 format */ - if (digest) - ai = ap_pstrcat(r->pool, "digest=\"", digest, "\"", nextnonce,NULL); - else - ai = nextnonce; - } - else { - const char *resp_dig, *ha1, *a2, *ha2; - - /* calculate rspauth attribute - */ - if (resp->algorithm && !strcasecmp(resp->algorithm, "MD5-sess")) - ha1 = get_session(r, resp, conf); - else - ha1 = conf->ha1; - - if (resp->message_qop && !strcasecmp(resp->message_qop, "auth-int")) - a2 = ap_pstrcat(r->pool, ":", resp->uri, ":", - ap_md5(r->pool, (const unsigned char *) ""), NULL); /* TBD */ - else - a2 = ap_pstrcat(r->pool, ":", resp->uri, NULL); - ha2 = ap_md5(r->pool, (const unsigned char *)a2); - - resp_dig = ap_md5(r->pool, - (unsigned char *)ap_pstrcat(r->pool, ha1, ":", - resp->nonce, ":", - resp->nonce_count, ":", - resp->cnonce, ":", - resp->message_qop ? - resp->message_qop : "", - ":", ha2, NULL)); - - /* assemble Authentication-Info header - */ - ai = ap_pstrcat(r->pool, - "rspauth=\"", resp_dig, "\"", - nextnonce, - resp->cnonce ? ", cnonce=\"" : "", - resp->cnonce ? ap_escape_quotes(r->pool, resp->cnonce) : - "", - resp->cnonce ? "\"" : "", - resp->nonce_count ? ", nc=" : "", - resp->nonce_count ? resp->nonce_count : "", - resp->message_qop ? ", qop=" : "", - resp->message_qop ? resp->message_qop : "", - digest ? "digest=\"" : "", - digest ? digest : "", - digest ? "\"" : "", - NULL); - } - - if (ai && ai[0]) - ap_table_mergen(r->headers_out, - r->proxyreq ? "Proxy-Authentication-Info" : - "Authentication-Info", - ai); - return OK; -} - - -module MODULE_VAR_EXPORT digest_auth_module = -{ - STANDARD_MODULE_STUFF, - initialize_module, /* initializer */ - create_digest_dir_config, /* dir config creater */ - NULL, /* dir merger --- default is to override */ - NULL, /* server config */ - NULL, /* merge server config */ - digest_cmds, /* command table */ - NULL, /* handlers */ - NULL, /* filename translation */ - authenticate_digest_user, /* check_user_id */ - digest_check_auth, /* check auth */ - NULL, /* check access */ - NULL, /* type_checker */ - add_auth_info, /* fixups */ - NULL, /* logger */ - NULL, /* header parser */ - NULL, /* child_init */ - NULL, /* child_exit */ - update_nonce_count /* post read-request */ -}; - diff --git a/modules/aaa/mod_auth_digest.dsp b/modules/aaa/mod_auth_digest.dsp deleted file mode 100644 index 2f700573f5f0885a19f1072c69fddea9443de470..0000000000000000000000000000000000000000 --- a/modules/aaa/mod_auth_digest.dsp +++ /dev/null @@ -1,97 +0,0 @@ -# Microsoft Developer Studio Project File - Name="ApacheModuleAuthDigest" - Package Owner=<4> -# Microsoft Developer Studio Generated Build File, Format Version 5.00 -# ** DO NOT EDIT ** - -# TARGTYPE "Win32 (x86) Dynamic-Link Library" 0x0102 - -CFG=ApacheModuleAuthDigest - Win32 Debug -!MESSAGE This is not a valid makefile. To build this project using NMAKE, -!MESSAGE use the Export Makefile command and run -!MESSAGE -!MESSAGE NMAKE /f "ApacheModuleAuthDigest.mak". -!MESSAGE -!MESSAGE You can specify a configuration when running NMAKE -!MESSAGE by defining the macro CFG on the command line. For example: -!MESSAGE -!MESSAGE NMAKE /f "ApacheModuleAuthDigest.mak"\ - CFG="ApacheModuleAuthDigest - Win32 Debug" -!MESSAGE -!MESSAGE Possible choices for configuration are: -!MESSAGE -!MESSAGE "ApacheModuleAuthDigest - Win32 Release" (based on\ - "Win32 (x86) Dynamic-Link Library") -!MESSAGE "ApacheModuleAuthDigest - Win32 Debug" (based on\ - "Win32 (x86) Dynamic-Link Library") -!MESSAGE - -# Begin Project -# PROP Scc_ProjName "" -# PROP Scc_LocalPath "" -CPP=cl.exe -MTL=midl.exe -RSC=rc.exe - -!IF "$(CFG)" == "ApacheModuleAuthDigest - Win32 Release" - -# PROP BASE Use_MFC 0 -# PROP BASE Use_Debug_Libraries 0 -# PROP BASE Output_Dir "Release" -# PROP BASE Intermediate_Dir "Release" -# PROP BASE Target_Dir "" -# PROP Use_MFC 0 -# PROP Use_Debug_Libraries 0 -# PROP Output_Dir ".\ApacheModuleAuthDigestR" -# PROP Intermediate_Dir ".\ApacheModuleAuthDigestR" -# PROP Ignore_Export_Lib 0 -# PROP Target_Dir "" -# ADD BASE CPP /nologo /MT /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /YX /FD /c -# ADD CPP /nologo /MT /W3 /GX /O2 /I "..\..\include" /I ".\\" /I "..\..\lib\apr\include" /D "NDEBUG" /D "WIN32" /D "_WINDOWS" /D "SHARED_MODULE" /YX /FD /c -# ADD BASE MTL /nologo /D "NDEBUG" /mktyplib203 /o NUL /win32 -# ADD MTL /nologo /D "NDEBUG" /mktyplib203 /o NUL /win32 -# ADD BASE RSC /l 0x409 /d "NDEBUG" -# ADD RSC /l 0x409 /d "NDEBUG" -BSC32=bscmake.exe -# ADD BASE BSC32 /nologo -# ADD BSC32 /nologo -LINK32=link.exe -# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:windows /dll /machine:I386 -# ADD LINK32 ApacheCore.lib aprlib.lib kernel32.lib /nologo /subsystem:windows /dll /map /machine:I386 /libpath:"..\..\CoreR" /libpath:"..\..\lib\apr\Release" - -!ELSEIF "$(CFG)" == "ApacheModuleAuthDigest - Win32 Debug" - -# PROP BASE Use_MFC 0 -# PROP BASE Use_Debug_Libraries 1 -# PROP BASE Output_Dir "Debug" -# PROP BASE Intermediate_Dir "Debug" -# PROP BASE Target_Dir "" -# PROP Use_MFC 0 -# PROP Use_Debug_Libraries 1 -# PROP Output_Dir ".\ApacheModuleAuthDigestD" -# PROP Intermediate_Dir ".\ApacheModuleAuthDigestD" -# PROP Ignore_Export_Lib 0 -# PROP Target_Dir "" -# ADD BASE CPP /nologo /MTd /W3 /Gm /GX /Zi /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /YX /FD /c -# ADD CPP /nologo /MTd /W3 /Gm /GX /Zi /Od /I "..\..\include" /I ".\\" /I "..\..\lib\apr\include" /D "_DEBUG" /D "SHARED_MODULE" /D "WIN32" /D "_WINDOWS" /YX /FD /c -# ADD BASE MTL /nologo /D "_DEBUG" /mktyplib203 /o NUL /win32 -# ADD MTL /nologo /D "_DEBUG" /mktyplib203 /o NUL /win32 -# ADD BASE RSC /l 0x409 /d "_DEBUG" -# ADD RSC /l 0x409 /d "_DEBUG" -BSC32=bscmake.exe -# ADD BASE BSC32 /nologo -# ADD BSC32 /nologo -LINK32=link.exe -# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:windows /dll /debug /machine:I386 /pdbtype:sept -# ADD LINK32 ApacheCore.lib aprlib.lib kernel32.lib /nologo /subsystem:windows /dll /map /debug /machine:I386 /pdbtype:sept /libpath:"..\..\CoreD" /libpath:"..\..\lib\apr\Debug" - -!ENDIF - -# Begin Target - -# Name "ApacheModuleAuthDigest - Win32 Release" -# Name "ApacheModuleAuthDigest - Win32 Debug" -# Begin Source File - -SOURCE=..\..\modules\standard\mod_auth_digest.c -# End Source File -# End Target -# End Project diff --git a/modules/arch/netware/libprews.c b/modules/arch/netware/libprews.c deleted file mode 100644 index efa475fc69761fb0a2479ce7f8d3abbcc48a8386..0000000000000000000000000000000000000000 --- a/modules/arch/netware/libprews.c +++ /dev/null @@ -1,54 +0,0 @@ -/*------------------------------------------------------------------ - These functions are to be called when the shared NLM starts and - stops. By using these functions instead of defining a main() - and calling ExitThread(TSR_THREAD, 0), the load time of the - shared NLM is faster and memory size reduced. - - You may also want to override these in your own Apache module - to do any cleanup other than the mechanism Apache modules - provide. -------------------------------------------------------------------*/ -#include -//#include "stddef.h" -#include "ws2nlm.h" - -int _NonAppStart -( - void *NLMHandle, - void *errorScreen, - const char *cmdLine, - const char *loadDirPath, - size_t uninitializedDataLength, - void *NLMFileHandle, - int (*readRoutineP)( int conn, void *fileHandle, size_t offset, - size_t nbytes, size_t *bytesRead, void *buffer ), - size_t customDataOffset, - size_t customDataSize, - int messageCount, - const char **messages -) -{ -#pragma unused(cmdLine) -#pragma unused(loadDirPath) -#pragma unused(uninitializedDataLength) -#pragma unused(NLMFileHandle) -#pragma unused(readRoutineP) -#pragma unused(customDataOffset) -#pragma unused(customDataSize) -#pragma unused(messageCount) -#pragma unused(messages) - - WSADATA wsaData; - - return WSAStartup((WORD) MAKEWORD(2, 0), &wsaData); -} - -void _NonAppStop( void ) -{ - WSACleanup(); -} - -int _NonAppCheckUnload( void ) -{ - return 0; -} diff --git a/modules/arch/netware/mod_auth_digest.def b/modules/arch/netware/mod_auth_digest.def deleted file mode 100644 index 6a3aa085d21e9fd6d6330c5987d96ffca25e979a..0000000000000000000000000000000000000000 --- a/modules/arch/netware/mod_auth_digest.def +++ /dev/null @@ -1 +0,0 @@ -EXPORT auth_digest_module diff --git a/modules/arch/netware/mod_cache.def b/modules/arch/netware/mod_cache.def deleted file mode 100644 index c7ab6ca4e951a25674adc33b0b37f1ea20e7538c..0000000000000000000000000000000000000000 --- a/modules/arch/netware/mod_cache.def +++ /dev/null @@ -1,6 +0,0 @@ -EXPORT cache_module -EXPORT cache_hook_create_entity -EXPORT cache_hook_open_entity -EXPORT cache_hook_remove_url - - diff --git a/modules/arch/netware/mod_cern_meta.def b/modules/arch/netware/mod_cern_meta.def deleted file mode 100644 index 5638325bbdaaf70ea86aea2e34e52cf3fd388078..0000000000000000000000000000000000000000 --- a/modules/arch/netware/mod_cern_meta.def +++ /dev/null @@ -1 +0,0 @@ -EXPORT cern_meta_module diff --git a/modules/arch/netware/mod_dav.def b/modules/arch/netware/mod_dav.def deleted file mode 100644 index fb56c92fc678380cc8e4827512d6fd021bc6dbcf..0000000000000000000000000000000000000000 --- a/modules/arch/netware/mod_dav.def +++ /dev/null @@ -1,3 +0,0 @@ -EXPORT dav_module -EXPORT @dav.imp - diff --git a/modules/arch/netware/mod_echo.def b/modules/arch/netware/mod_echo.def deleted file mode 100644 index 694135a52c113d762fe4eb75876409f956c3aa27..0000000000000000000000000000000000000000 --- a/modules/arch/netware/mod_echo.def +++ /dev/null @@ -1,2 +0,0 @@ -EXPORT echo_module - diff --git a/modules/arch/netware/mod_expires.def b/modules/arch/netware/mod_expires.def deleted file mode 100644 index bc416630b0af8d2d658fa123f0a6b3b2bddb61e7..0000000000000000000000000000000000000000 --- a/modules/arch/netware/mod_expires.def +++ /dev/null @@ -1 +0,0 @@ -EXPORT expires_module diff --git a/modules/arch/netware/mod_file_cache.def b/modules/arch/netware/mod_file_cache.def deleted file mode 100644 index 8ab98cfb22d1ff8e1338509e3feabaa902b5aeda..0000000000000000000000000000000000000000 --- a/modules/arch/netware/mod_file_cache.def +++ /dev/null @@ -1,2 +0,0 @@ -EXPORT file_cache_module - diff --git a/modules/arch/netware/mod_headers.def b/modules/arch/netware/mod_headers.def deleted file mode 100644 index 2fe35a858b394c3cbfd47224503ba86c13a9c31a..0000000000000000000000000000000000000000 --- a/modules/arch/netware/mod_headers.def +++ /dev/null @@ -1 +0,0 @@ -EXPORT headers_module diff --git a/modules/arch/netware/mod_info.def b/modules/arch/netware/mod_info.def deleted file mode 100644 index ce71cb37cf06c55890cea0a471eadb73e5474a64..0000000000000000000000000000000000000000 --- a/modules/arch/netware/mod_info.def +++ /dev/null @@ -1 +0,0 @@ -EXPORT info_module diff --git a/modules/arch/netware/mod_mem_cache.def b/modules/arch/netware/mod_mem_cache.def deleted file mode 100644 index ce8b67a5ca46dedbfbd47246acaf916d43189b2b..0000000000000000000000000000000000000000 --- a/modules/arch/netware/mod_mem_cache.def +++ /dev/null @@ -1,5 +0,0 @@ -IMPORT cache_hook_create_entity -IMPORT cache_hook_open_entity -IMPORT cache_hook_remove_url -EXPORT mem_cache_module - diff --git a/modules/arch/netware/mod_mime_magic.def b/modules/arch/netware/mod_mime_magic.def deleted file mode 100644 index 95307476de867e90ad40996495ab740c56bb8a92..0000000000000000000000000000000000000000 --- a/modules/arch/netware/mod_mime_magic.def +++ /dev/null @@ -1 +0,0 @@ -EXPORT mime_magic_module diff --git a/modules/arch/netware/mod_nw_ssl.c b/modules/arch/netware/mod_nw_ssl.c deleted file mode 100644 index c29d6bda31ec0899e27b648892764d16125cee6e..0000000000000000000000000000000000000000 --- a/modules/arch/netware/mod_nw_ssl.c +++ /dev/null @@ -1,462 +0,0 @@ -/* ==================================================================== - * The Apache Software License, Version 1.1 - * - * Copyright (c) 2000 The Apache Software Foundation. All rights - * reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in - * the documentation and/or other materials provided with the - * distribution. - * - * 3. The end-user documentation included with the redistribution, - * if any, must include the following acknowledgment: - * "This product includes software developed by the - * Apache Software Foundation (http://www.apache.org/)." - * Alternately, this acknowledgment may appear in the software itself, - * if and wherever such third-party acknowledgments normally appear. - * - * 4. The names "Apache" and "Apache Software Foundation" must - * not be used to endorse or promote products derived from this - * software without prior written permission. For written - * permission, please contact apache@apache.org. - * - * 5. Products derived from this software may not be called "Apache", - * nor may "Apache" appear in their name, without prior written - * permission of the Apache Software Foundation. - * - * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED - * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES - * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR - * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF - * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND - * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, - * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT - * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * ==================================================================== - * - * This software consists of voluntary contributions made by many - * individuals on behalf of the Apache Software Foundation. For more - * information on the Apache Software Foundation, please see - * . - * - * Portions of this software are based upon public domain software - * originally written at the National Center for Supercomputing Applications, - * University of Illinois, Urbana-Champaign. - */ - -/* - * mod_tls.c - Apache SSL/TLS module for NetWare by Mike Gardiner. - * - * This module gives Apache the ability to do SSL/TLS with a minimum amount - * of effort. All of the SSL/TLS logic is already on NetWare versions 5 and - * above and is interfaced through WinSock on NetWare. As you can see in - * the code below SSL/TLS sockets can be created with three WinSock calls. - * - * To load, simply place the module in the modules directory under the main - * apache tree. Then add a "SecureListen" with two arguments. The first - * argument is an address and/or port. The second argument is the key pair - * name as created in ConsoleOne. - * - * Examples: - * - * SecureListen 443 "SSL CertificateIP" - * SecureListen 123.45.67.89:443 mycert - */ - -#define WS_SSL - -#define MAX_ADDRESS 512 -#define MAX_KEY 80 - - -#include "httpd.h" -#include "http_config.h" -#include "http_log.h" -#include "ap_listen.h" -#include "apr_strings.h" - -module AP_MODULE_DECLARE_DATA nwssl_module; - -typedef struct NWSSLSrvConfigRec NWSSLSrvConfigRec; -typedef struct seclisten_rec seclisten_rec; - -struct seclisten_rec { - seclisten_rec *next; - struct sockaddr_in local_addr; /* local IP address and port */ - int fd; - int used; /* Only used during restart */ - char key[MAX_KEY]; - int mutual; - char *addr; - int port; -}; - -struct NWSSLSrvConfigRec { - apr_table_t *sltable; -}; - -static seclisten_rec* ap_seclisteners = NULL; - -#define get_nwssl_cfg(srv) (NWSSLSrvConfigRec *) ap_get_module_config(srv->module_config, &nwssl_module) - -/* - * Parses a host of the form
    [:port] - * :port is permitted if 'port' is not NULL - */ -static unsigned long parse_addr(const char *w, unsigned short *ports) -{ - struct hostent *hep; - unsigned long my_addr; - char *p; - - p = strchr(w, ':'); - if (ports != NULL) { - *ports = 0; - if (p != NULL && strcmp(p + 1, "*") != 0) - *ports = atoi(p + 1); - } - - if (p != NULL) - *p = '\0'; - if (strcmp(w, "*") == 0) { - if (p != NULL) - *p = ':'; - return htonl(INADDR_ANY); - } - - my_addr = apr_inet_addr((char *)w); - if (my_addr != INADDR_NONE) { - if (p != NULL) - *p = ':'; - return my_addr; - } - - hep = gethostbyname(w); - - if ((!hep) || (hep->h_addrtype != AF_INET || !hep->h_addr_list[0])) { - fprintf(stderr, "Cannot resolve host name %s --- exiting!\n", w); - exit(1); - } - - if (hep->h_addr_list[1]) { - fprintf(stderr, "Host %s has multiple addresses ---\n", w); - fprintf(stderr, "you must choose one explicitly for use as\n"); - fprintf(stderr, "a secure port. Exiting!!!\n"); - exit(1); - } - - if (p != NULL) - *p = ':'; - - return ((struct in_addr *) (hep->h_addr))->s_addr; -} - -static int find_secure_listener(seclisten_rec *lr) -{ - seclisten_rec *sl; - - for (sl = ap_seclisteners; sl; sl = sl->next) { - if (!memcmp(&sl->local_addr, &lr->local_addr, sizeof(sl->local_addr))) { - sl->used = 1; - return sl->fd; - } - } - return -1; -} - - -static int make_secure_socket(apr_pool_t *pconf, const struct sockaddr_in *server, - char* key, int mutual, server_rec *server_conf) -{ - int s; - int one = 1; - char addr[MAX_ADDRESS]; - struct sslserveropts opts; - unsigned int optParam; - WSAPROTOCOL_INFO SecureProtoInfo; - int no = 1; - - if (server->sin_addr.s_addr != htonl(INADDR_ANY)) - apr_snprintf(addr, sizeof(addr), "address %s port %d", - inet_ntoa(server->sin_addr), ntohs(server->sin_port)); - else - apr_snprintf(addr, sizeof(addr), "port %d", ntohs(server->sin_port)); - - /* note that because we're about to slack we don't use psocket */ - memset(&SecureProtoInfo, 0, sizeof(WSAPROTOCOL_INFO)); - - SecureProtoInfo.iAddressFamily = AF_INET; - SecureProtoInfo.iSocketType = SOCK_STREAM; - SecureProtoInfo.iProtocol = IPPROTO_TCP; - SecureProtoInfo.iSecurityScheme = SECURITY_PROTOCOL_SSL; - - s = WSASocket(AF_INET, SOCK_STREAM, IPPROTO_TCP, - (LPWSAPROTOCOL_INFO)&SecureProtoInfo, 0, 0); - - if (s == INVALID_SOCKET) { - errno = WSAGetLastError(); - ap_log_error(APLOG_MARK, APLOG_CRIT, errno, server_conf, - "make_secure_socket: failed to get a socket for %s", addr); - return -1; - } - - if (!mutual) { - optParam = SO_SSL_ENABLE | SO_SSL_SERVER; - - if (WSAIoctl(s, SO_SSL_SET_FLAGS, (char *)&optParam, - sizeof(optParam), NULL, 0, NULL, NULL, NULL)) { - errno = WSAGetLastError(); - ap_log_error(APLOG_MARK, APLOG_CRIT, errno, server_conf, - "make_secure_socket: for %s, WSAIoctl: (SO_SSL_SET_FLAGS)", addr); - return -1; - } - } - - opts.cert = key; - opts.certlen = strlen(key); - opts.sidtimeout = 0; - opts.sidentries = 0; - opts.siddir = NULL; - - if (WSAIoctl(s, SO_SSL_SET_SERVER, (char *)&opts, sizeof(opts), - NULL, 0, NULL, NULL, NULL) != 0) { - errno = WSAGetLastError(); - ap_log_error(APLOG_MARK, APLOG_CRIT, errno, server_conf, - "make_secure_socket: for %s, WSAIoctl: (SO_SSL_SET_SERVER)", addr); - return -1; - } - - if (mutual) { - optParam = 0x07; // SO_SSL_AUTH_CLIENT - - if(WSAIoctl(s, SO_SSL_SET_FLAGS, (char*)&optParam, - sizeof(optParam), NULL, 0, NULL, NULL, NULL)) { - errno = WSAGetLastError(); - ap_log_error( APLOG_MARK, APLOG_CRIT, errno, server_conf, - "make_secure_socket: for %s, WSAIoctl: (SO_SSL_SET_FLAGS)", addr ); - return -1; - } - } - - return s; -} - -static const char *set_secure_listener(cmd_parms *cmd, void *dummy, - const char *ips, const char* key, - const char* mutual) -{ - NWSSLSrvConfigRec* sc = get_nwssl_cfg(cmd->server); - const char *err = ap_check_cmd_context(cmd, GLOBAL_ONLY); - char *ports, *addr; - unsigned short port; - seclisten_rec *new; - - - if (err != NULL) - return err; - - ports = strchr(ips, ':'); - - if (ports != NULL) { - if (ports == ips) - return "Missing IP address"; - else if (ports[1] == '\0') - return "Address must end in :"; - - *(ports++) = '\0'; - } - else { - ports = (char*)ips; - } - - new = apr_pcalloc(cmd->pool, sizeof(seclisten_rec)); - new->local_addr.sin_family = AF_INET; - - if (ports == ips) { - new->local_addr.sin_addr.s_addr = htonl(INADDR_ANY); - addr = apr_pstrdup(cmd->pool, "0.0.0.0"); - } - else { - new->local_addr.sin_addr.s_addr = parse_addr(ips, NULL); - addr = apr_pstrdup(cmd->pool, ips); - } - - port = atoi(ports); - - if (!port) - return "Port must be numeric"; - - apr_table_set(sc->sltable, ports, "T"); - - new->local_addr.sin_port = htons(port); - new->fd = -1; - new->used = 0; - new->next = ap_seclisteners; - strcpy(new->key, key); - new->mutual = (mutual) ? 1 : 0; - new->addr = addr; - new->port = port; - ap_seclisteners = new; - return NULL; -} - -static apr_status_t nwssl_socket_cleanup(void *data) -{ - ap_listen_rec* slr = (ap_listen_rec*)data; - ap_listen_rec* lr; - - /* Remove our secure listener from the listener list */ - for (lr = ap_listeners; lr; lr = lr->next) { - /* slr is at the head of the list */ - if (lr == slr) { - ap_listeners = slr->next; - break; - } - /* slr is somewhere in between or at the end*/ - if (lr->next == slr) { - lr->next = slr->next; - break; - } - } - return APR_SUCCESS; -} - -static void nwssl_pre_config(apr_pool_t *pconf, apr_pool_t *plog, - apr_pool_t *ptemp) -{ - ap_seclisteners = NULL; -} - -static void nwssl_post_config(apr_pool_t *pconf, apr_pool_t *plog, - apr_pool_t *ptemp, server_rec *s) -{ - seclisten_rec* sl; - ap_listen_rec* lr; - apr_socket_t* sd; - apr_status_t status; - - for (sl = ap_seclisteners; sl != NULL; sl = sl->next) { - sl->fd = find_secure_listener(sl); - - if (sl->fd < 0) - sl->fd = make_secure_socket(pconf, &sl->local_addr, sl->key, sl->mutual, s); - - if (sl->fd >= 0) { - apr_os_sock_info_t sock_info; - - sock_info.os_sock = &(sl->fd); - sock_info.local = (struct sockaddr*)&(sl->local_addr); - sock_info.remote = NULL; - sock_info.family = APR_INET; - sock_info.type = SOCK_STREAM; - - apr_os_sock_make(&sd, &sock_info, pconf); - - lr = apr_pcalloc(pconf, sizeof(ap_listen_rec)); - - if (lr) { - lr->sd = sd; - if ((status = apr_sockaddr_info_get(&lr->bind_addr, sl->addr, APR_UNSPEC, sl->port, 0, - pconf)) != APR_SUCCESS) { - ap_log_perror(APLOG_MARK, APLOG_CRIT, status, pconf, - "alloc_listener: failed to set up sockaddr for %s:%d", sl->addr, sl->port); - exit(1); - } - lr->next = ap_listeners; - ap_listeners = lr; - apr_pool_cleanup_register(pconf, lr, nwssl_socket_cleanup, apr_pool_cleanup_null); - } - } else { - exit(1); - } - } -} - -static void *nwssl_config_server_create(apr_pool_t *p, server_rec *s) -{ - NWSSLSrvConfigRec *new = apr_palloc(p, sizeof(NWSSLSrvConfigRec)); - new->sltable = apr_table_make(p, 5); - return new; -} - -static void *nwssl_config_server_merge(apr_pool_t *p, void *basev, void *addv) -{ - NWSSLSrvConfigRec *base = (NWSSLSrvConfigRec *)basev; - NWSSLSrvConfigRec *add = (NWSSLSrvConfigRec *)addv; - NWSSLSrvConfigRec *merged = (NWSSLSrvConfigRec *)apr_palloc(p, sizeof(NWSSLSrvConfigRec)); - return merged; -} - -static int isSecure (const request_rec *r) -{ - NWSSLSrvConfigRec *sc = get_nwssl_cfg(r->server); - const char *s_secure = NULL; - char port[8]; - int ret = 0; - - itoa(((r->connection)->local_addr)->port, port, 10); - s_secure = apr_table_get(sc->sltable, port); - if (s_secure) - ret = 1; - - return ret; -} - -static int nwssl_hook_Fixup(request_rec *r) -{ - apr_table_t *e = r->subprocess_env; - if (!isSecure(r)) - return DECLINED; - - apr_table_set(e, "HTTPS", "on"); - - return DECLINED; -} - -static const char *nwssl_hook_http_method (const request_rec *r) -{ - if (isSecure(r)) - return "https"; - - return NULL; -} - -static const command_rec nwssl_module_cmds[] = -{ - AP_INIT_TAKE23("SecureListen", set_secure_listener, NULL, RSRC_CONF, - "specify an address and/or port with a key pair name.\n" - "Optional third parameter of MUTUAL configures the port for mutual authentication."), - {NULL} -}; - -static void register_hooks(apr_pool_t *p) -{ - ap_hook_pre_config(nwssl_pre_config, NULL, NULL, APR_HOOK_MIDDLE); - ap_hook_post_config(nwssl_post_config, NULL, NULL, APR_HOOK_MIDDLE); - ap_hook_fixups(nwssl_hook_Fixup, NULL, NULL, APR_HOOK_MIDDLE); - ap_hook_http_method(nwssl_hook_http_method, NULL,NULL, APR_HOOK_MIDDLE); -} - -module AP_MODULE_DECLARE_DATA nwssl_module = -{ - STANDARD20_MODULE_STUFF, - NULL, /* dir config creater */ - NULL, /* dir merger --- default is to override */ - nwssl_config_server_create, /* server config */ - nwssl_config_server_merge, /* merge server config */ - nwssl_module_cmds, /* command apr_table_t */ - register_hooks -}; - diff --git a/modules/arch/netware/mod_proxy.def b/modules/arch/netware/mod_proxy.def deleted file mode 100644 index 6e51eedb50dda5cf1252786677d943305e9882ba..0000000000000000000000000000000000000000 --- a/modules/arch/netware/mod_proxy.def +++ /dev/null @@ -1 +0,0 @@ -EXPORT proxy_module diff --git a/modules/arch/netware/mod_rewrite.def b/modules/arch/netware/mod_rewrite.def deleted file mode 100644 index cfdcf6b13268fca307a772dec4dcd161bf2f267f..0000000000000000000000000000000000000000 --- a/modules/arch/netware/mod_rewrite.def +++ /dev/null @@ -1 +0,0 @@ -EXPORT rewrite_module diff --git a/modules/arch/netware/mod_speling.def b/modules/arch/netware/mod_speling.def deleted file mode 100644 index 3d45a6aa1ab6ba85b97545d762a0fcb42eac4dbe..0000000000000000000000000000000000000000 --- a/modules/arch/netware/mod_speling.def +++ /dev/null @@ -1 +0,0 @@ -EXPORT speling_module diff --git a/modules/arch/netware/mod_status.def b/modules/arch/netware/mod_status.def deleted file mode 100644 index 9a5a32d46cfa26c121593405a6e8dcaeefc1ad8b..0000000000000000000000000000000000000000 --- a/modules/arch/netware/mod_status.def +++ /dev/null @@ -1,2 +0,0 @@ -EXPORT status_module - diff --git a/modules/arch/netware/mod_unique_id.def b/modules/arch/netware/mod_unique_id.def deleted file mode 100644 index 0b72c1ecc04af12d2d64da838b4e8bf99da1c81f..0000000000000000000000000000000000000000 --- a/modules/arch/netware/mod_unique_id.def +++ /dev/null @@ -1 +0,0 @@ -EXPORT unique_id_module diff --git a/modules/arch/netware/mod_usertrack.def b/modules/arch/netware/mod_usertrack.def deleted file mode 100644 index 7264c41ecfff4102d99ad5c7620c59b0503810aa..0000000000000000000000000000000000000000 --- a/modules/arch/netware/mod_usertrack.def +++ /dev/null @@ -1 +0,0 @@ -EXPORT usertrack_module diff --git a/modules/arch/netware/mod_vhost_alias.def b/modules/arch/netware/mod_vhost_alias.def deleted file mode 100644 index 574b85f98733b2a8928199dff119c704c74f8dc9..0000000000000000000000000000000000000000 --- a/modules/arch/netware/mod_vhost_alias.def +++ /dev/null @@ -1,2 +0,0 @@ -EXPORT vhost_alias_module - diff --git a/modules/arch/netware/moddavfs.def b/modules/arch/netware/moddavfs.def deleted file mode 100644 index 67ec311758d4a398533aabca835ad45eb67d5873..0000000000000000000000000000000000000000 --- a/modules/arch/netware/moddavfs.def +++ /dev/null @@ -1 +0,0 @@ -EXPORT dav_fs_module diff --git a/modules/arch/win32/.cvsignore b/modules/arch/win32/.cvsignore deleted file mode 100644 index 14ac4568b5c7a7c5c383710d03cb549a8fab9e89..0000000000000000000000000000000000000000 --- a/modules/arch/win32/.cvsignore +++ /dev/null @@ -1,4 +0,0 @@ -Debug -Release -*.mak -*.rc diff --git a/modules/arch/win32/mod_isapi.c b/modules/arch/win32/mod_isapi.c deleted file mode 100644 index fa002708ba59a60837c7207642d39a3910ffad60..0000000000000000000000000000000000000000 --- a/modules/arch/win32/mod_isapi.c +++ /dev/null @@ -1,569 +0,0 @@ -/* ==================================================================== - * Copyright (c) 1995-1999 The Apache Group. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in - * the documentation and/or other materials provided with the - * distribution. - * - * 3. All advertising materials mentioning features or use of this - * software must display the following acknowledgment: - * "This product includes software developed by the Apache Group - * for use in the Apache HTTP server project (http://www.apache.org/)." - * - * 4. The names "Apache Server" and "Apache Group" must not be used to - * endorse or promote products derived from this software without - * prior written permission. For written permission, please contact - * apache@apache.org. - * - * 5. Products derived from this software may not be called "Apache" - * nor may "Apache" appear in their names without prior written - * permission of the Apache Group. - * - * 6. Redistributions of any form whatsoever must retain the following - * acknowledgment: - * "This product includes software developed by the Apache Group - * for use in the Apache HTTP server project (http://www.apache.org/)." - * - * THIS SOFTWARE IS PROVIDED BY THE APACHE GROUP ``AS IS'' AND ANY - * EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR - * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE APACHE GROUP OR - * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT - * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, - * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED - * OF THE POSSIBILITY OF SUCH DAMAGE. - * ==================================================================== - * - * This software consists of voluntary contributions made by many - * individuals on behalf of the Apache Group and was originally based - * on public domain software written at the National Center for - * Supercomputing Applications, University of Illinois, Urbana-Champaign. - * For more information on the Apache Group and the Apache HTTP server - * project, please see . - * - */ - -/* - * mod_isapi.c - Internet Server Application (ISA) module for Apache - * by Alexei Kosut - * - * This module implements Microsoft's ISAPI, allowing Apache (when running - * under Windows) to load Internet Server Applications (ISAPI extensions). - * It implements all of the ISAPI 2.0 specification, except for the - * "Microsoft-only" extensions dealing with asynchronous I/O. All ISAPI - * extensions that use only synchronous I/O and are compatible with the - * ISAPI 2.0 specification should work (most ISAPI 1.0 extensions should - * function as well). - * - * To load, simply place the ISA in a location in the document tree. - * Then add an "AddHandler isapi-isa dll" into your config file. - * You should now be able to load ISAPI DLLs just be reffering to their - * URLs. Make sure the ExecCGI option is active in the directory - * the ISA is in. - */ - -#include "httpd.h" -#include "http_config.h" -#include "http_core.h" -#include "http_protocol.h" -#include "http_request.h" -#include "http_log.h" -#include "util_script.h" - -/* We use the exact same header file as the original */ -#include - -/* Seems IIS does not enforce the requirement for \r\n termination on HSE_REQ_SEND_RESPONSE_HEADER, - define this to conform */ -#define RELAX_HEADER_RULE - -module isapi_module; - -/* Our "Connection ID" structure */ - -typedef struct { - LPEXTENSION_CONTROL_BLOCK ecb; - request_rec *r; - int status; -} isapi_cid; - -/* Declare the ISAPI functions */ - -BOOL WINAPI GetServerVariable (HCONN hConn, LPSTR lpszVariableName, - LPVOID lpvBuffer, LPDWORD lpdwSizeofBuffer); -BOOL WINAPI WriteClient (HCONN ConnID, LPVOID Buffer, LPDWORD lpwdwBytes, - DWORD dwReserved); -BOOL WINAPI ReadClient (HCONN ConnID, LPVOID lpvBuffer, LPDWORD lpdwSize); -BOOL WINAPI ServerSupportFunction (HCONN hConn, DWORD dwHSERequest, - LPVOID lpvBuffer, LPDWORD lpdwSize, - LPDWORD lpdwDataType); - -/* - The optimiser blows it totally here. What happens is that autos are addressed relative to the - stack pointer, which, of course, moves around. The optimiser seems to lose track of it somewhere - between setting isapi_entry and calling through it. We work around the problem by forcing it to - use frame pointers. -*/ -#pragma optimize("y",off) - -int isapi_handler (request_rec *r) { - LPEXTENSION_CONTROL_BLOCK ecb = - ap_pcalloc(r->pool, sizeof(struct _EXTENSION_CONTROL_BLOCK)); - HSE_VERSION_INFO *pVer = ap_pcalloc(r->pool, sizeof(HSE_VERSION_INFO)); - - HINSTANCE isapi_handle; - BOOL (*isapi_version)(HSE_VERSION_INFO *); /* entry point 1 */ - DWORD (*isapi_entry)(LPEXTENSION_CONTROL_BLOCK); /* entry point 2 */ - BOOL (*isapi_term)(DWORD); /* optional entry point 3 */ - - isapi_cid *cid = ap_pcalloc(r->pool, sizeof(isapi_cid)); - table *e = r->subprocess_env; - int retval; - - /* Use similar restrictions as CGIs */ - - if (!(ap_allow_options(r) & OPT_EXECCGI)) - return FORBIDDEN; - - if (r->finfo.st_mode == 0) - return NOT_FOUND; - - if (S_ISDIR(r->finfo.st_mode)) - return FORBIDDEN; - - /* Load the module */ - - if (!(isapi_handle = LoadLibraryEx(r->filename, NULL, - LOAD_WITH_ALTERED_SEARCH_PATH))) { - ap_log_rerror(APLOG_MARK, APLOG_ALERT, r, - "Could not load DLL: %s", r->filename); - return SERVER_ERROR; - } - - if (!(isapi_version = - (void *)(GetProcAddress(isapi_handle, "GetExtensionVersion")))) { - ap_log_rerror(APLOG_MARK, APLOG_ALERT, r, - "DLL could not load GetExtensionVersion(): %s", r->filename); - FreeLibrary(isapi_handle); - return SERVER_ERROR; - } - - if (!(isapi_entry = - (void *)(GetProcAddress(isapi_handle, "HttpExtensionProc")))) { - ap_log_rerror(APLOG_MARK, APLOG_ALERT, r, - "DLL could not load HttpExtensionProc(): %s", r->filename); - FreeLibrary(isapi_handle); - return SERVER_ERROR; - } - - isapi_term = (void *)(GetProcAddress(isapi_handle, "TerminateExtension")); - - /* Run GetExtensionVersion() */ - - if ((*isapi_version)(pVer) != TRUE) { - ap_log_rerror(APLOG_MARK, APLOG_ALERT, r, - "ISAPI GetExtensionVersion() failed: %s", r->filename); - FreeLibrary(isapi_handle); - return SERVER_ERROR; - } - - /* Set up variables */ - ap_add_common_vars(r); - ap_add_cgi_vars(r); - - /* Set up connection ID */ - ecb->ConnID = (HCONN)cid; - cid->ecb = ecb; - cid->r = r; - cid->status = 0; - - ecb->cbSize = sizeof(struct _EXTENSION_CONTROL_BLOCK); - ecb->dwVersion = MAKELONG(0, 2); - ecb->dwHttpStatusCode = 0; - strcpy(ecb->lpszLogData, ""); - ecb->lpszMethod = r->method; - ecb->lpszQueryString = ap_table_get(e, "QUERY_STRING"); - ecb->lpszPathInfo = ap_table_get(e, "PATH_INFO"); - ecb->lpszPathTranslated = ap_table_get(e, "PATH_TRANSLATED"); - ecb->lpszContentType = ap_table_get(e, "CONTENT_TYPE"); - - /* Set up client input */ - if ((retval = ap_setup_client_block(r, REQUEST_CHUNKED_ERROR))) { - if (isapi_term) (*isapi_term)(HSE_TERM_MUST_UNLOAD); - FreeLibrary(isapi_handle); - return retval; - } - - if (ap_should_client_block(r)) { - /* Unlike IIS, which limits this to 48k, we read the whole - * sucker in. I suppose this could be bad for memory if someone - * uploaded the complete works of Shakespeare. Well, WebSite - * does the same thing. - */ - long to_read = atol(ap_table_get(e, "CONTENT_LENGTH")); - long read; - - /* Actually, let's cap it at 48k, until we figure out what - * to do with this... we don't want a Content-Length: 1000000000 - * taking out the machine. - */ - - if (to_read > 49152) { - if (isapi_term) (*isapi_term)(HSE_TERM_MUST_UNLOAD); - FreeLibrary(isapi_handle); - return HTTP_REQUEST_ENTITY_TOO_LARGE; - } - - ecb->lpbData = ap_pcalloc(r->pool, 1 + to_read); - - if ((read = ap_get_client_block(r, ecb->lpbData, to_read)) < 0) { - if (isapi_term) (*isapi_term)(HSE_TERM_MUST_UNLOAD); - FreeLibrary(isapi_handle); - return SERVER_ERROR; - } - - /* Although its not to spec, IIS seems to null-terminate - * its lpdData string. So we will too. To make sure - * cbAvailable matches cbTotalBytes, we'll up the latter - * and equalize them. - */ - ecb->cbAvailable = ecb->cbTotalBytes = read + 1; - ecb->lpbData[read] = '\0'; - } - else { - ecb->cbTotalBytes = 0; - ecb->cbAvailable = 0; - ecb->lpbData = NULL; - } - - /* Set up the callbacks */ - - ecb->GetServerVariable = &GetServerVariable; - ecb->WriteClient = &WriteClient; - ecb->ReadClient = &ReadClient; - ecb->ServerSupportFunction = &ServerSupportFunction; - - /* All right... try and load the sucker */ - retval = (*isapi_entry)(ecb); - - /* Set the status (for logging) */ - if (ecb->dwHttpStatusCode) - r->status = ecb->dwHttpStatusCode; - - /* Check for a log message - and log it */ - if (ecb->lpszLogData && strcmp(ecb->lpszLogData, "")) - ap_log_rerror(APLOG_MARK, APLOG_ERR, r, - "%s: %s", ecb->lpszLogData, r->filename); - - /* All done with the DLL... get rid of it */ - if (isapi_term) (*isapi_term)(HSE_TERM_MUST_UNLOAD); - FreeLibrary(isapi_handle); - - switch(retval) { - case HSE_STATUS_SUCCESS: - case HSE_STATUS_SUCCESS_AND_KEEP_CONN: - /* Ignore the keepalive stuff; Apache handles it just fine without - * the ISA's "advice". - */ - - if (cid->status) /* We have a special status to return */ - return cid->status; - - return OK; - case HSE_STATUS_PENDING: /* We don't support this */ - ap_log_rerror(APLOG_MARK, APLOG_WARNING, r, - "ISAPI asynchronous I/O not supported: %s", r->filename); - case HSE_STATUS_ERROR: - default: - return SERVER_ERROR; - } - -} -#pragma optimize("",on) - -BOOL WINAPI GetServerVariable (HCONN hConn, LPSTR lpszVariableName, - LPVOID lpvBuffer, LPDWORD lpdwSizeofBuffer) { - request_rec *r = ((isapi_cid *)hConn)->r; - table *e = r->subprocess_env; - const char *result; - - /* Mostly, we just grab it from the environment, but there are - * a couple of special cases - */ - - if (!strcasecmp(lpszVariableName, "UNMAPPED_REMOTE_USER")) { - /* We don't support NT users, so this is always the same as - * REMOTE_USER - */ - result = ap_table_get(e, "REMOTE_USER"); - } - else if (!strcasecmp(lpszVariableName, "SERVER_PORT_SECURE")) { - /* Apache doesn't support secure requests inherently, so - * we have no way of knowing. We'll be conservative, and say - * all requests are insecure. - */ - result = "0"; - } - else if (!strcasecmp(lpszVariableName, "URL")) { - result = r->uri; - } - else { - result = ap_table_get(e, lpszVariableName); - } - - if (result) { - if (strlen(result) > *lpdwSizeofBuffer) { - *lpdwSizeofBuffer = strlen(result); - SetLastError(ERROR_INSUFFICIENT_BUFFER); - return FALSE; - } - strncpy(lpvBuffer, result, *lpdwSizeofBuffer); - return TRUE; - } - - /* Didn't find it */ - SetLastError(ERROR_INVALID_INDEX); - return FALSE; -} - -BOOL WINAPI WriteClient (HCONN ConnID, LPVOID Buffer, LPDWORD lpwdwBytes, - DWORD dwReserved) { - request_rec *r = ((isapi_cid *)ConnID)->r; - int writ; /* written, actually, but why shouldn't I make up words? */ - - /* We only support synchronous writing */ - if (dwReserved && dwReserved != HSE_IO_SYNC) { - ap_log_rerror(APLOG_MARK, APLOG_WARNING, r, - "ISAPI asynchronous I/O not supported: %s", r->filename); - SetLastError(ERROR_INVALID_PARAMETER); - return FALSE; - } - - if ((writ = ap_rwrite(Buffer, *lpwdwBytes, r)) == EOF) { - SetLastError(ERROR); /* XXX: Find the right error code */ - return FALSE; - } - - *lpwdwBytes = writ; - return TRUE; -} - -BOOL WINAPI ReadClient (HCONN ConnID, LPVOID lpvBuffer, LPDWORD lpdwSize) { - /* Doesn't need to do anything; we've read all the data already */ - return TRUE; -} - -/* XXX: There is an O(n^2) attack possible here. */ -BOOL WINAPI ServerSupportFunction (HCONN hConn, DWORD dwHSERequest, - LPVOID lpvBuffer, LPDWORD lpdwSize, - LPDWORD lpdwDataType) { - isapi_cid *cid = (isapi_cid *)hConn; - request_rec *subreq, *r = cid->r; - char *data; - - switch (dwHSERequest) { - case HSE_REQ_SEND_URL_REDIRECT_RESP: - /* Set the status to be returned when the HttpExtensionProc() - * is done. - */ - ap_table_set (r->headers_out, "Location", lpvBuffer); - cid->status = cid->r->status = cid->ecb->dwHttpStatusCode = REDIRECT; - return TRUE; - - case HSE_REQ_SEND_URL: - /* Read any additional input */ - - if (r->remaining > 0) { - char argsbuffer[HUGE_STRING_LEN]; - - while (ap_get_client_block(r, argsbuffer, HUGE_STRING_LEN)); - } - - /* Reset the method to GET */ - r->method = ap_pstrdup(r->pool, "GET"); - r->method_number = M_GET; - - /* Don't let anyone think there's still data */ - ap_table_unset(r->headers_in, "Content-Length"); - - ap_internal_redirect((char *)lpvBuffer, r); - return TRUE; - - case HSE_REQ_SEND_RESPONSE_HEADER: - r->status_line = lpvBuffer ? lpvBuffer : ap_pstrdup(r->pool, "200 OK"); - sscanf(r->status_line, "%d", &r->status); - cid->ecb->dwHttpStatusCode = r->status; - - /* Now fill in the HTTP headers, and the rest of it. Ick. - * lpdwDataType contains a string that has headers (in MIME - * format), a blank like, then (possibly) data. We need - * to parse it. - * - * Easy case first: - */ - if (!lpdwDataType) { - ap_send_http_header(r); - return TRUE; - } - - /* Make a copy - don't disturb the original */ - data = ap_pstrdup(r->pool, (char *)lpdwDataType); - - /* We *should* break before this while loop ends */ - while (*data) { - char *value, *lf = strchr(data, '\n'); - int p; - -#ifdef RELAX_HEADER_RULE - if (lf) - *lf = '\0'; -#else - if (!lf) { /* Huh? Invalid data, I think */ - ap_log_rerror(APLOG_MARK, APLOG_ERR, r, - "ISA sent invalid headers: %s", r->filename); - SetLastError(ERROR); /* XXX: Find right error */ - return FALSE; - } - - /* Get rid of \n and \r */ - *lf = '\0'; -#endif - p = strlen(data); - if (p > 0 && data[p-1] == '\r') data[p-1] = '\0'; - - /* End of headers */ - if (*data == '\0') { -#ifdef RELAX_HEADER_RULE - if (lf) -#endif - data = lf + 1; /* Reset data */ - break; - } - - if (!(value = strchr(data, ':'))) { - SetLastError(ERROR); /* XXX: Find right error */ - ap_log_rerror(APLOG_MARK, APLOG_ERR, r, - "ISA sent invalid headers", r->filename); - return FALSE; - } - - *value++ = '\0'; - while (*value && ap_isspace(*value)) ++value; - - /* Check all the special-case headers. Similar to what - * ap_scan_script_header_err() does (see that function for - * more detail) - */ - - if (!strcasecmp(data, "Content-Type")) { - char *tmp; - /* Nuke trailing whitespace */ - - char *endp = value + strlen(value) - 1; - while (endp > value && ap_isspace(*endp)) *endp-- = '\0'; - - tmp = ap_pstrdup (r->pool, value); - ap_str_tolower(tmp); - r->content_type = tmp; - } - else if (!strcasecmp(data, "Content-Length")) { - ap_table_set(r->headers_out, data, value); - } - else if (!strcasecmp(data, "Transfer-Encoding")) { - ap_table_set(r->headers_out, data, value); - } - else if (!strcasecmp(data, "Set-Cookie")) { - ap_table_add(r->err_headers_out, data, value); - } - else { - ap_table_merge(r->err_headers_out, data, value); - } - - /* Reset data */ -#ifdef RELAX_HEADER_RULE - if (!lf) { - data += p; - break; - } -#endif - data = lf + 1; - } - - /* All the headers should be set now */ - - ap_send_http_header(r); - - /* Any data left should now be sent directly */ - ap_rputs(data, r); - - return TRUE; - - case HSE_REQ_MAP_URL_TO_PATH: - /* Map a URL to a filename */ - subreq = ap_sub_req_lookup_uri(ap_pstrndup(r->pool, (char *)lpvBuffer, - *lpdwSize), r); - - GetFullPathName(subreq->filename, *lpdwSize - 1, (char *)lpvBuffer, NULL); - - /* IIS puts a trailing slash on directories, Apache doesn't */ - - if (S_ISDIR (subreq->finfo.st_mode)) { - int l = strlen((char *)lpvBuffer); - - ((char *)lpvBuffer)[l] = '\\'; - ((char *)lpvBuffer)[l + 1] = '\0'; - } - - return TRUE; - - case HSE_REQ_DONE_WITH_SESSION: - /* Do nothing... since we don't support async I/O, they'll - * return from HttpExtensionProc soon - */ - return TRUE; - - /* We don't support all this async I/O, Microsoft-specific stuff */ - case HSE_REQ_IO_COMPLETION: - case HSE_REQ_TRANSMIT_FILE: - ap_log_rerror(APLOG_MARK, APLOG_WARNING, r, - "ISAPI asynchronous I/O not supported: %s", r->filename); - default: - SetLastError(ERROR_INVALID_PARAMETER); - return FALSE; - } -} - -handler_rec isapi_handlers[] = { -{ "isapi-isa", isapi_handler }, -{ NULL} -}; - -module isapi_module = { - STANDARD_MODULE_STUFF, - NULL, /* initializer */ - NULL, /* create per-dir config */ - NULL, /* merge per-dir config */ - NULL, /* server config */ - NULL, /* merge server config */ - NULL, /* command table */ - isapi_handlers, /* handlers */ - NULL, /* filename translation */ - NULL, /* check_user_id */ - NULL, /* check auth */ - NULL, /* check access */ - NULL, /* type_checker */ - NULL, /* logger */ - NULL /* header parser */ -}; diff --git a/modules/arch/win32/mod_isapi.dsp b/modules/arch/win32/mod_isapi.dsp deleted file mode 100644 index bf9fb802fa6b3711ffb8a788267ff6dd692ccebf..0000000000000000000000000000000000000000 --- a/modules/arch/win32/mod_isapi.dsp +++ /dev/null @@ -1,128 +0,0 @@ -# Microsoft Developer Studio Project File - Name="mod_isapi" - Package Owner=<4> -# Microsoft Developer Studio Generated Build File, Format Version 6.00 -# ** DO NOT EDIT ** - -# TARGTYPE "Win32 (x86) Dynamic-Link Library" 0x0102 - -CFG=mod_isapi - Win32 Release -!MESSAGE This is not a valid makefile. To build this project using NMAKE, -!MESSAGE use the Export Makefile command and run -!MESSAGE -!MESSAGE NMAKE /f "mod_isapi.mak". -!MESSAGE -!MESSAGE You can specify a configuration when running NMAKE -!MESSAGE by defining the macro CFG on the command line. For example: -!MESSAGE -!MESSAGE NMAKE /f "mod_isapi.mak" CFG="mod_isapi - Win32 Release" -!MESSAGE -!MESSAGE Possible choices for configuration are: -!MESSAGE -!MESSAGE "mod_isapi - Win32 Release" (based on "Win32 (x86) Dynamic-Link Library") -!MESSAGE "mod_isapi - Win32 Debug" (based on "Win32 (x86) Dynamic-Link Library") -!MESSAGE - -# Begin Project -# PROP AllowPerConfigDependencies 0 -# PROP Scc_ProjName "" -# PROP Scc_LocalPath "" -CPP=cl.exe -MTL=midl.exe -RSC=rc.exe - -!IF "$(CFG)" == "mod_isapi - Win32 Release" - -# PROP BASE Use_MFC 0 -# PROP BASE Use_Debug_Libraries 0 -# PROP BASE Output_Dir "Release" -# PROP BASE Intermediate_Dir "Release" -# PROP BASE Target_Dir "" -# PROP Use_MFC 0 -# PROP Use_Debug_Libraries 0 -# PROP Output_Dir "Release" -# PROP Intermediate_Dir "Release" -# PROP Ignore_Export_Lib 0 -# PROP Target_Dir "" -# ADD BASE CPP /nologo /MD /W3 /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /FD /c -# ADD CPP /nologo /MD /W3 /O2 /I "../../../include" /I "../../../srclib/apr/include" /I "../../../srclib/apr-util/include" /D "NDEBUG" /D "WIN32" /D "_WINDOWS" /Fd"Release\mod_isapi" /FD /c -# ADD BASE MTL /nologo /D "NDEBUG" /win32 -# ADD MTL /nologo /D "NDEBUG" /mktyplib203 /win32 -# ADD BASE RSC /l 0x409 /d "NDEBUG" -# ADD RSC /l 0x409 /d "NDEBUG" -BSC32=bscmake.exe -# ADD BASE BSC32 /nologo -# ADD BSC32 /nologo -LINK32=link.exe -# ADD BASE LINK32 kernel32.lib ws2_32.lib mswsock.lib /nologo /subsystem:windows /dll /map /machine:I386 /out:"Release/mod_isapi.so" /base:@..\..\..\os\win32\BaseAddr.ref,mod_isapi -# ADD LINK32 kernel32.lib ws2_32.lib mswsock.lib /nologo /subsystem:windows /dll /map /machine:I386 /out:"Release/mod_isapi.so" /base:@..\..\..\os\win32\BaseAddr.ref,mod_isapi - -!ELSEIF "$(CFG)" == "mod_isapi - Win32 Debug" - -# PROP BASE Use_MFC 0 -# PROP BASE Use_Debug_Libraries 1 -# PROP BASE Output_Dir "Debug" -# PROP BASE Intermediate_Dir "Debug" -# PROP BASE Target_Dir "" -# PROP Use_MFC 0 -# PROP Use_Debug_Libraries 1 -# PROP Output_Dir "Debug" -# PROP Intermediate_Dir "Debug" -# PROP Ignore_Export_Lib 0 -# PROP Target_Dir "" -# ADD BASE CPP /nologo /MDd /W3 /GX /Zi /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /FD /c -# ADD CPP /nologo /MDd /W3 /GX /Zi /Od /I "../../../include" /I "../../../srclib/apr/include" /I "../../../srclib/apr-util/include" /D "_DEBUG" /D "WIN32" /D "_WINDOWS" /Fd"Debug\mod_isapi" /FD /c -# ADD BASE MTL /nologo /D "_DEBUG" /win32 -# ADD MTL /nologo /D "_DEBUG" /mktyplib203 /win32 -# ADD BASE RSC /l 0x409 /d "_DEBUG" -# ADD RSC /l 0x409 /d "_DEBUG" -BSC32=bscmake.exe -# ADD BASE BSC32 /nologo -# ADD BSC32 /nologo -LINK32=link.exe -# ADD BASE LINK32 kernel32.lib ws2_32.lib mswsock.lib /nologo /subsystem:windows /dll /incremental:no /map /debug /machine:I386 /out:"Debug/mod_isapi.so" /base:@..\..\..\os\win32\BaseAddr.ref,mod_isapi -# ADD LINK32 kernel32.lib ws2_32.lib mswsock.lib /nologo /subsystem:windows /dll /map /debug /machine:I386 /out:"Debug/mod_isapi.so" /base:@..\..\..\os\win32\BaseAddr.ref,mod_isapi - -!ENDIF - -# Begin Target - -# Name "mod_isapi - Win32 Release" -# Name "mod_isapi - Win32 Debug" -# Begin Source File - -SOURCE=.\mod_isapi.c -# End Source File -# Begin Source File - -SOURCE=.\mod_isapi.rc -# End Source File -# Begin Source File - -SOURCE=..\..\..\build\win32\win32ver.awk - -!IF "$(CFG)" == "mod_isapi - Win32 Release" - -# PROP Ignore_Default_Tool 1 -# Begin Custom Build - Creating Version Resource -InputPath=..\..\..\build\win32\win32ver.awk - -".\mod_isapi.rc" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)" - awk -f ../../../build/win32/win32ver.awk mod_isapi "isapi_module for Apache" ../../../include/ap_release.h > .\mod_isapi.rc - -# End Custom Build - -!ELSEIF "$(CFG)" == "mod_isapi - Win32 Debug" - -# PROP Ignore_Default_Tool 1 -# Begin Custom Build - Creating Version Resource -InputPath=..\..\..\build\win32\win32ver.awk - -".\mod_isapi.rc" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)" - awk -f ../../../build/win32/win32ver.awk mod_isapi "isapi_module for Apache" ../../../include/ap_release.h > .\mod_isapi.rc - -# End Custom Build - -!ENDIF - -# End Source File -# End Target -# End Project diff --git a/modules/arch/win32/mod_win32.c b/modules/arch/win32/mod_win32.c deleted file mode 100644 index 77fb0cdec0e9436615c07966f23b1772988ba86b..0000000000000000000000000000000000000000 --- a/modules/arch/win32/mod_win32.c +++ /dev/null @@ -1,510 +0,0 @@ -/* ==================================================================== - * The Apache Software License, Version 1.1 - * - * Copyright (c) 2000-2001 The Apache Software Foundation. All rights - * reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in - * the documentation and/or other materials provided with the - * distribution. - * - * 3. The end-user documentation included with the redistribution, - * if any, must include the following acknowledgment: - * "This product includes software developed by the - * Apache Software Foundation (http://www.apache.org/)." - * Alternately, this acknowledgment may appear in the software itself, - * if and wherever such third-party acknowledgments normally appear. - * - * 4. The names "Apache" and "Apache Software Foundation" must - * not be used to endorse or promote products derived from this - * software without prior written permission. For written - * permission, please contact apache@apache.org. - * - * 5. Products derived from this software may not be called "Apache", - * nor may "Apache" appear in their name, without prior written - * permission of the Apache Software Foundation. - * - * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED - * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES - * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR - * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF - * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND - * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, - * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT - * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * ==================================================================== - * - * This software consists of voluntary contributions made by many - * individuals on behalf of the Apache Software Foundation. For more - * information on the Apache Software Foundation, please see - * . - * - * Portions of this software are based upon public domain software - * originally written at the National Center for Supercomputing Applications, - * University of Illinois, Urbana-Champaign. - */ - - -#include "apr_strings.h" -#include "apr_portable.h" -#include "apr_buckets.h" -#include "ap_config.h" -#include "httpd.h" -#include "http_config.h" -#include "http_core.h" -#include "http_protocol.h" -#include "http_request.h" -#include "http_log.h" -#include "util_script.h" -#include "mod_core.h" -#include "apr_optional.h" -#include "apr_lib.h" - -#ifdef WIN32 - -/* - * CGI Script stuff for Win32... - */ -typedef enum { eFileTypeUNKNOWN, eFileTypeBIN, eFileTypeEXE16, eFileTypeEXE32, - eFileTypeSCRIPT } file_type_e; -typedef enum { INTERPRETER_SOURCE_UNSET, INTERPRETER_SOURCE_REGISTRY_STRICT, - INTERPRETER_SOURCE_REGISTRY, INTERPRETER_SOURCE_SHEBANG - } interpreter_source_e; -AP_DECLARE(file_type_e) ap_get_win32_interpreter(const request_rec *, - char **interpreter, - char **arguments); - -module AP_MODULE_DECLARE_DATA win32_module; - -typedef struct { - /* Where to find interpreter to run scripts */ - interpreter_source_e script_interpreter_source; -} win32_dir_conf; - -static void *create_win32_dir_config(apr_pool_t *p, char *dir) -{ - win32_dir_conf *conf = (win32_dir_conf*)apr_palloc(p, sizeof(win32_dir_conf)); - conf->script_interpreter_source = INTERPRETER_SOURCE_UNSET; - return conf; -} - -static void *merge_win32_dir_configs(apr_pool_t *p, void *basev, void *addv) -{ - win32_dir_conf *new = (win32_dir_conf *) apr_pcalloc(p, sizeof(win32_dir_conf)); - win32_dir_conf *base = (win32_dir_conf *) basev; - win32_dir_conf *add = (win32_dir_conf *) addv; - - new->script_interpreter_source = (add->script_interpreter_source - != INTERPRETER_SOURCE_UNSET) - ? add->script_interpreter_source - : base->script_interpreter_source; - return new; -} - -static const char *set_interpreter_source(cmd_parms *cmd, void *dv, - char *arg) -{ - win32_dir_conf *d = (win32_dir_conf *)dv; - if (!strcasecmp(arg, "registry")) { - d->script_interpreter_source = INTERPRETER_SOURCE_REGISTRY; - } else if (!strcasecmp(arg, "registry-strict")) { - d->script_interpreter_source = INTERPRETER_SOURCE_REGISTRY_STRICT; - } else if (!strcasecmp(arg, "script")) { - d->script_interpreter_source = INTERPRETER_SOURCE_SHEBANG; - } else { - return apr_pstrcat(cmd->temp_pool, "ScriptInterpreterSource \"", arg, - "\" must be \"registry\", \"registry-strict\" or " - "\"script\"", NULL); - } - return NULL; -} - -/* Pretty unexciting ... yank a registry value, and explode any envvars - * that the system has configured (e.g. %SystemRoot%/someapp.exe) - * - * XXX: Need Unicode versions for i18n - */ -static apr_status_t get_win32_registry_default_value(apr_pool_t *p, HKEY hkey, - char* relativepath, - char **value) -{ - HKEY hkeyOpen; - DWORD type; - DWORD size = 0; - DWORD result = RegOpenKeyEx(hkey, relativepath, 0, - KEY_QUERY_VALUE, &hkeyOpen); - - if (result != ERROR_SUCCESS) - return APR_FROM_OS_ERROR(result); - - /* Read to NULL buffer to determine value size */ - result = RegQueryValueEx(hkeyOpen, "", 0, &type, NULL, &size); - - if (result == ERROR_SUCCESS) { - if ((size < 2) || (type != REG_SZ && type != REG_EXPAND_SZ)) { - result = ERROR_INVALID_PARAMETER; - } - else { - *value = apr_palloc(p, size); - /* Read value based on size query above */ - result = RegQueryValueEx(hkeyOpen, "", 0, &type, *value, &size); - } - } - - /* TODO: This might look fine, but we need to provide some warning - * somewhere that some environment variables may -not- be translated, - * seeing as we may have chopped the environment table down somewhat. - */ - if ((result == ERROR_SUCCESS) && (type == REG_EXPAND_SZ)) - { - char *tmp = *value; - size = ExpandEnvironmentStrings(tmp, *value, 0); - if (size) { - *value = apr_palloc(p, size); - size = ExpandEnvironmentStrings(tmp, *value, size); - } - } - - RegCloseKey(hkeyOpen); - return APR_FROM_OS_ERROR(result); -} - -/* Somewhat more exciting ... figure out where the registry has stashed the - * ExecCGI or Open command - it may be nested one level deep (or more???) - */ -static char* get_interpreter_from_win32_registry(apr_pool_t *p, - const char* ext, - int strict) -{ - char execcgi_path[] = "SHELL\\EXECCGI\\COMMAND"; - char execopen_path[] = "SHELL\\OPEN\\COMMAND"; - char typeName[MAX_PATH]; - int cmdOfName = FALSE; - HKEY hkeyName; - HKEY hkeyType; - DWORD type; - int size; - int result; - char *buffer; - - if (!ext) - return NULL; - /* - * Future optimization: - * When the registry is successfully searched, store the strings for - * interpreter and arguments in an ext hash to speed up subsequent look-ups - */ - - /* Open the key associated with the script filetype extension */ - result = RegOpenKeyEx(HKEY_CLASSES_ROOT, ext, 0, KEY_QUERY_VALUE, - &hkeyType); - - if (result != ERROR_SUCCESS) - return NULL; - - /* Retrieve the name of the script filetype extension */ - size = sizeof(typeName); - result = RegQueryValueEx(hkeyType, "", NULL, &type, typeName, &size); - - if (result == ERROR_SUCCESS && type == REG_SZ && typeName[0]) { - /* Open the key associated with the script filetype extension */ - result = RegOpenKeyEx(HKEY_CLASSES_ROOT, typeName, 0, - KEY_QUERY_VALUE, &hkeyName); - - if (result == ERROR_SUCCESS) - cmdOfName = TRUE; - } - - /* Open the key for the script command path by: - * - * 1) the 'named' filetype key for ExecCGI/Command - * 2) the extension's type key for ExecCGI/Command - * - * and if the strict arg is false, then continue trying: - * - * 3) the 'named' filetype key for Open/Command - * 4) the extension's type key for Open/Command - */ - - if (cmdOfName) { - result = get_win32_registry_default_value(p, hkeyName, - execcgi_path, &buffer); - } - - if (!cmdOfName || (result != ERROR_SUCCESS)) { - result = get_win32_registry_default_value(p, hkeyType, - execcgi_path, &buffer); - } - - if (!strict && cmdOfName && (result != ERROR_SUCCESS)) { - result = get_win32_registry_default_value(p, hkeyName, - execopen_path, &buffer); - } - - if (!strict && (result != ERROR_SUCCESS)) { - result = get_win32_registry_default_value(p, hkeyType, - execopen_path, &buffer); - } - - if (cmdOfName) - RegCloseKey(hkeyName); - - RegCloseKey(hkeyType); - - if (result != ERROR_SUCCESS || !buffer[0]) - return NULL; - - return buffer; -} - - -static apr_array_header_t *split_argv(apr_pool_t *p, const char *interp, const char *cgiprg, const char *cgiargs) -{ - apr_array_header_t *args = apr_array_make(p, 8, sizeof(char*)); - char *d = apr_palloc(p, strlen(interp)); - const char *ch = interp; - const char **arg; - int prgtaken = 0; - int argtaken = 0; - int inquo; - int sl; - - while (*ch) { - /* Skip on through Deep Space */ - if (isspace(*ch)) { - ++ch; continue; - } - /* One Arg */ - if (((*ch == '$') || (*ch == '%')) && (*(ch + 1) == '*')) { - const char *cgiarg = cgiargs; - argtaken = 1; - for (;;) { - char *w = ap_getword_nulls(p, &cgiarg, '+'); - if (!*w) - break; - ap_unescape_url(w); - arg = (const char**)apr_array_push(args); - *arg = ap_escape_shell_cmd(p, w); - } - ch += 2; - continue; - } - if (((*ch == '$') || (*ch == '%')) && (*(ch + 1) == '1')) { - prgtaken = 1; - arg = (const char**)apr_array_push(args); - *arg = cgiprg; - ch += 2; - continue; - } - if ((*ch == '\"') && ((*(ch + 1) == '$') - || (*(ch + 1) == '%')) && (*(ch + 2) == '1') - && (*(ch + 3) == '\"')) { - prgtaken = 1; - arg = (const char**)apr_array_push(args); - *arg = cgiprg; - ch += 4; - continue; - } - arg = (const char**)apr_array_push(args); - *arg = d; - inquo = 0; - while (*ch) { - if (isspace(*ch) && !inquo) { - ++ch; break; - } - /* Get 'em backslashes */ - for (sl = 0; *ch == '\\'; ++sl) - *d++ = *ch++; - if (sl & 1) { - /* last unmatched '\' + '"' sequence is a '"' */ - if (*ch == '\"') - *(d - 1) = *ch++; - continue; - } - if (*ch == '\"') { - /* '""' sequence within quotes is a '"' */ - if (*++ch == '\"' && inquo) { - *d++ = *ch++; continue; - } - /* Flip quote state */ - inquo = !inquo; - if (isspace(*ch) && !inquo) { - ++ch; break; - } - /* All other '"'s are Munched */ - continue; - } - /* Anything else is, well, something else */ - *d++ = *ch++; - } - /* Term that arg, already pushed on args */ - *d++ = '\0'; - } - - if (!prgtaken) { - arg = (const char**)apr_array_push(args); - *arg = cgiprg; - } - - if (!argtaken) { - char *cgiargs = cgiarg; - for (;;) { - char *w = ap_getword_nulls(p, &cgiargs, '+'); - if (!*w) - break; - ap_unescape_url(w); - arg = (const char**)apr_array_push(args); - *arg = ap_escape_shell_cmd(p, w); - } - } - - arg = (const char**)apr_array_push(args); - *arg = NULL; - - return args; -} - - -static apr_status_t ap_cgi_build_command(const char **cmd, const char ***argv, - request_rec *r, apr_pool_t *p) -{ - const char *ext = NULL; - const char *interpreter = NULL; - win32_dir_conf *d = - (win32_dir_conf *)ap_get_module_config(r->per_dir_config, - &win32_module); - apr_file_t *fh; - const char *args = r->args; - - /* Handle the complete file name, we DON'T want to follow suexec, since - * an unrooted command is as predictable as shooting craps in Win32. - * - * Notice that unlike most mime extension parsing, we have to use the - * win32 parsing here, therefore the final extension is the only one - * we will consider - */ - ext = strrchr(apr_filename_of_pathname(r->filename), '.'); - if (ext) - ++ext; - - /* If the file has an extension and it is not .com and not .exe and - * we've been instructed to search the registry, then do so. - */ - if (ext && (!strcasecmp(ext,".exe") || !strcasecmp(ext,".com") - || !strcasecmp(ext,".bat") || !strcasecmp(ext,".cmd"))) { - interpreter = ""; - } - if (!interpreter) - { - apr_status_t rv; - char buffer[1024]; - apr_size_t bytes = sizeof(buffer); - int i; - - /* Need to peek into the file figure out what it really is... - * ### aught to go back and build a cache for this one of these days. - */ - if (((rv = apr_file_open(&fh, r->filename, APR_READ | APR_BUFFERED, - APR_OS_DEFAULT, r->pool)) != APR_SUCCESS) - || ((rv = apr_file_read(fh, buffer, &bytes)) != APR_SUCCESS)) { - ap_log_rerror(APLOG_MARK, APLOG_ERR, rv, r, - "Failed to read cgi file %s for testing", r->filename); - return rv; - } - apr_file_close(fh); - - /* Script or executable, that is the question... */ - if ((buffer[0] == '#') && (buffer[1] == '!')) { - /* Assuming file is a script since it starts with a shebang */ - for (i = 2; i < sizeof(buffer); i++) { - if ((buffer[i] == '\r') || (buffer[i] == '\n')) { - buffer[i] = '\0'; - break; - } - } - if (i < sizeof(buffer)) { - interpreter = buffer + 2; - while (isspace(*interpreter)) - ++interpreter; - } - } - else { - /* Not a script, is it an executable? */ - IMAGE_DOS_HEADER *hdr = (IMAGE_DOS_HEADER*)buffer; - if ((bytes >= sizeof(IMAGE_DOS_HEADER)) && (hdr->e_magic == IMAGE_DOS_SIGNATURE)) { - if (hdr->e_lfarlc < 0x40) - /* Aught to invoke this 16 bit exe by a stub, (cmd /c?) */ - interpreter = ""; - else - interpreter = ""; - } - } - } - if (!interpreter && ext && - (d->script_interpreter_source == INTERPRETER_SOURCE_REGISTRY || - d->script_interpreter_source == INTERPRETER_SOURCE_REGISTRY_STRICT)) { - /* Check the registry */ - int strict = (d->script_interpreter_source - == INTERPRETER_SOURCE_REGISTRY_STRICT); - interpreter = get_interpreter_from_win32_registry(r->pool, ext, strict); - if (!interpreter) { - ap_log_error(APLOG_MARK, APLOG_NOERRNO|APLOG_INFO, 0, r->server, - strict ? "No ExecCGI verb found for files of type '%s'." - : "No ExecCGI or Open verb found for files of type '%s'.", - ext); - } - } - if (!interpreter) { - ap_log_rerror(APLOG_MARK, APLOG_ERR|APLOG_NOERRNO, 0, r, - "%s is not executable; ensure interpreted scripts have " - "\"#!\" first line", - r->filename); - return APR_EBADF; - } - - if (!args || ap_strchr_c(args, '=')) - args = ""; - - *argv = (const char **)(split_argv(p, interpreter, r->filename, args)->elts); - *cmd = (*argv)[0]; - return APR_SUCCESS; -} - -APR_DECLARE_OPTIONAL_FN(apr_status_t, ap_cgi_build_command, (const char **cmd, - const char ***argv, request_rec *r, apr_pool_t *p)); - -static void register_hooks(apr_pool_t *p) -{ - APR_REGISTER_OPTIONAL_FN(ap_cgi_build_command); -} - -static const command_rec win32_cmds[] = { -AP_INIT_TAKE1("ScriptInterpreterSource", set_interpreter_source, NULL, - OR_FILEINFO, - "Where to find interpreter to run Win32 scripts (Registry or script shebang line)"), -{ NULL } -}; - -module AP_MODULE_DECLARE_DATA win32_module = { - STANDARD20_MODULE_STUFF, - create_win32_dir_config, /* create per-dir config */ - merge_win32_dir_configs, /* merge per-dir config */ - NULL, /* server config */ - NULL, /* merge server config */ - win32_cmds, /* command apr_table_t */ - register_hooks /* register hooks */ -}; - -#endif \ No newline at end of file diff --git a/modules/cache/.cvsignore b/modules/cache/.cvsignore deleted file mode 100644 index f2f7a70d2c9528e7ef84cf1b3bf9ff721fa08b08..0000000000000000000000000000000000000000 --- a/modules/cache/.cvsignore +++ /dev/null @@ -1,10 +0,0 @@ -.deps -.libs -*.la -modules.mk -Makefile -*.lo -*.slo -*.so -*.dll -*.def diff --git a/modules/cache/.indent.pro b/modules/cache/.indent.pro deleted file mode 100644 index a9fbe9f9a1f2e6e7bcc54171c215bdacd44171ba..0000000000000000000000000000000000000000 --- a/modules/cache/.indent.pro +++ /dev/null @@ -1,54 +0,0 @@ --i4 -npsl -di0 -br -nce -d0 -cli0 -npcs -nfc1 --TBUFF --TFILE --TTRANS --TUINT4 --T_trans --Tallow_options_t --Tapache_sfio --Tarray_header --Tbool_int --Tbuf_area --Tbuff_struct --Tbuffy --Tcmd_how --Tcmd_parms --Tcommand_rec --Tcommand_struct --Tconn_rec --Tcore_dir_config --Tcore_server_config --Tdir_maker_func --Tevent --Tglobals_s --Thandler_func --Thandler_rec --Tjoblist_s --Tlisten_rec --Tmerger_func --Tmode_t --Tmodule --Tmodule_struct --Tmutex --Tn_long --Tother_child_rec --Toverrides_t --Tparent_score --Tpid_t --Tpiped_log --Tpool --Trequest_rec --Trequire_line --Trlim_t --Tscoreboard --Tsemaphore --Tserver_addr_rec --Tserver_rec --Tserver_rec_chain --Tshort_score --Ttable --Ttable_entry --Tthread --Tu_wide_int --Tvtime_t --Twide_int diff --git a/modules/cache/Makefile.in b/modules/cache/Makefile.in deleted file mode 100644 index 167b343d0db75f7876a55cef1681570eba813202..0000000000000000000000000000000000000000 --- a/modules/cache/Makefile.in +++ /dev/null @@ -1,3 +0,0 @@ - -include $(top_srcdir)/build/special.mk - diff --git a/modules/cache/config.m4 b/modules/cache/config.m4 deleted file mode 100644 index 30160ba70bfef5f33eace111771659cec5669c21..0000000000000000000000000000000000000000 --- a/modules/cache/config.m4 +++ /dev/null @@ -1,17 +0,0 @@ -dnl modules enabled in this directory by default - -dnl AC_DEFUN(modulename, modulestructname, defaultonoroff, configmacros) -dnl XXX - Need to allow --enable-module to fail if optional config fails - -AC_DEFUN(APACHE_CHECK_STANDARD_MODULE, [ - APACHE_MODULE([$1],[$2],,[$3],[$4],[$5]) -]) - -APACHE_MODPATH_INIT(cache) - -APACHE_CHECK_STANDARD_MODULE(file_cache, File cache, , no) - -LTFLAGS="$LTFLAGS -export-dynamic" -APACHE_MODPATH_FINISH - -APACHE_SUBST(STANDARD_LIBS) diff --git a/modules/cache/mod_file_cache.c b/modules/cache/mod_file_cache.c deleted file mode 100644 index 81e269dc4c28b9f6044c7c928c788fe46ed2f858..0000000000000000000000000000000000000000 --- a/modules/cache/mod_file_cache.c +++ /dev/null @@ -1,559 +0,0 @@ -/* ==================================================================== - * Copyright (c) 1998-1999 The Apache Group. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in - * the documentation and/or other materials provided with the - * distribution. - * - * 3. All advertising materials mentioning features or use of this - * software must display the following acknowledgment: - * "This product includes software developed by the Apache Group - * for use in the Apache HTTP server project (http://www.apache.org/)." - * - * 4. The names "Apache Server" and "Apache Group" must not be used to - * endorse or promote products derived from this software without - * prior written permission. For written permission, please contact - * apache@apache.org. - * - * 5. Products derived from this software may not be called "Apache" - * nor may "Apache" appear in their names without prior written - * permission of the Apache Group. - * - * 6. Redistributions of any form whatsoever must retain the following - * acknowledgment: - * "This product includes software developed by the Apache Group - * for use in the Apache HTTP server project (http://www.apache.org/)." - * - * THIS SOFTWARE IS PROVIDED BY THE APACHE GROUP ``AS IS'' AND ANY - * EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR - * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE APACHE GROUP OR - * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT - * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, - * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED - * OF THE POSSIBILITY OF SUCH DAMAGE. - * ==================================================================== - * - * This software consists of voluntary contributions made by many - * individuals on behalf of the Apache Group and was originally based - * on public domain software written at the National Center for - * Supercomputing Applications, University of Illinois, Urbana-Champaign. - * For more information on the Apache Group and the Apache HTTP server - * project, please see . - * - */ - -/* - * Author: mod_file_cache by Bill Stoddard - * Based on mod_mmap_static by Dean Gaudet - * - * v0.01: initial implementation - */ - -/* - Documentation: - - Some sites have a set of static files that are really busy, and - change infrequently (or even on a regular schedule). Save time - by caching open handles to these files. This module, unlike - mod_mmap_static, caches open file handles, not file content. - On systems (like Windows) with heavy system call overhead and - that have an efficient sendfile implementation, caching file handles - offers several advantages over caching content. First, the file system - can manage the memory, allowing infrequently hit cached files to - be paged out. Second, since caching open handles does not consume - significant resources, it will be possible to enable an AutoLoadCache - feature where static files are dynamically loaded in the cache - as the server runs. On systems that have file change notification, - this module can be enhanced to automatically garbage collect - cached files that change on disk. - - This module should work on Unix systems that have sendfile. Place - cachefile directives into your configuration to direct files to - be cached. - - cachefile /path/to/file1 - cachefile /path/to/file2 - ... - - These files are only cached when the server is restarted, so if you - change the list, or if the files are changed, then you'll need to - restart the server. - - To reiterate that point: if the files are modified *in place* - without restarting the server you may end up serving requests that - are completely bogus. You should update files by unlinking the old - copy and putting a new copy in place. - - There's no such thing as inheriting these files across vhosts or - whatever... place the directives in the main server only. - - Known problems: - - Don't use Alias or RewriteRule to move these files around... unless - you feel like paying for an extra stat() on each request. This is - a deficiency in the Apache API that will hopefully be solved some day. - The file will be served out of the file handle cache, but there will be - an extra stat() that's a waste. -*/ - -#include -#include -#include -#include -#include -#include - -#define CORE_PRIVATE - -#include "httpd.h" -#include "http_config.h" -#include "http_log.h" -#include "http_protocol.h" -#include "http_request.h" -#include "http_core.h" -#include "apr_mmap.h" - -module MODULE_VAR_EXPORT file_cache_module; -static ap_pool_t *context; -static int once_through = 0; - -typedef struct { -#if 1 - ap_file_t *file; -#else - ap_mmap_t *mm; -#endif - char *filename; - ap_finfo_t finfo; -} a_file; - -typedef struct { - ap_array_header_t *files; - ap_array_header_t *inode_sorted; -} a_server_config; - - -static void *create_server_config(ap_pool_t *p, server_rec *s) -{ - a_server_config *sconf = ap_palloc(p, sizeof(*sconf)); - - sconf->files = ap_make_array(p, 20, sizeof(a_file)); - sconf->inode_sorted = NULL; - return sconf; -} -#if 0 -static void pre_config(ap_pool_t *pconf, ap_pool_t *plog, ap_pool_t *ptemp) -{ - context = pconf; -} -#endif -static ap_status_t open_file(ap_file_t **file, char* filename, int flg1, int flg2, - ap_pool_t *context) -{ - ap_status_t rv; -#ifdef WIN32 - /* The Windows file needs to be opened for overlapped i/o, which APR doesn't - * support. - */ - HANDLE hFile; - hFile = CreateFile(filename, /* pointer to name of the file */ - GENERIC_READ, /* access (read-write) mode */ - FILE_SHARE_READ, /* share mode */ - NULL, /* pointer to security attributes */ - OPEN_EXISTING, /* how to create */ - FILE_FLAG_OVERLAPPED | FILE_FLAG_SEQUENTIAL_SCAN, /* file attributes */ - NULL); /* handle to file with attributes to copy */ - if (hFile != INVALID_HANDLE_VALUE) { - rv = ap_put_os_file(file, &hFile, context); - } - else { - rv = GetLastError(); - *file = NULL; - } -#else - rv = ap_open(file, filename, flg1, flg2, context); -#endif - - return rv; -} - -ap_status_t cleanup_mmap(void *sconfv) -{ - a_server_config *sconf = sconfv; - size_t n; - a_file *file; - - n = sconf->files->nelts; - file = (a_file *)sconf->files->elts; - while(n) { -#if 1 - ap_close(file->file); -#else - ap_mmap_delete(file->mm); -#endif - ++file; - --n; - } - return APR_SUCCESS; -} - -static const char *cachefile(cmd_parms *cmd, void *dummy, char *filename) -{ - a_server_config *sconf; - a_file *new_file; - a_file tmp; - ap_file_t *fd = NULL; -#if 0 - caddr_t mm; -#endif - ap_status_t rc; - /* canonicalize the file name */ - /* os_canonical... */ - if (ap_stat(&tmp.finfo, filename, NULL) != APR_SUCCESS) { - ap_log_error(APLOG_MARK, APLOG_WARNING, errno, cmd->server, - "file_cache: unable to stat(%s), skipping", filename); - return NULL; - } - if (tmp.finfo.filetype != APR_REG) { - ap_log_error(APLOG_MARK, APLOG_WARNING, errno, cmd->server, - "file_cache: %s isn't a regular file, skipping", filename); - return NULL; - } - /* Note: open_file should call ap_open for Unix and CreateFile for Windows. - * The Windows file needs to be opened for async I/O to allow multiple threads - * to serve it up at once. - */ - rc = open_file(&fd, filename, APR_READ, APR_OS_DEFAULT, cmd->pool); //context); - if (rc != APR_SUCCESS) { - ap_log_error(APLOG_MARK, APLOG_WARNING, rc, cmd->server, - "file_cache: unable to open(%s, O_RDONLY), skipping", filename); - return NULL; - } -#if 1 - tmp.file = fd; -#else - if (ap_mmap_create(&tmp.mm, fd, 0, tmp.finfo.st_size, context) != APR_SUCCESS) { - int save_errno = errno; - ap_close(fd); - errno = save_errno; - ap_log_error(APLOG_MARK, APLOG_WARNING, errno, cmd->server, - "file_cache: unable to mmap %s, skipping", filename); - return NULL; - } - ap_close(fd); -#endif - tmp.filename = ap_pstrdup(cmd->pool, filename); - sconf = ap_get_module_config(cmd->server->module_config, &file_cache_module); - new_file = ap_push_array(sconf->files); - *new_file = tmp; - if (sconf->files->nelts == 1) { - /* first one, register the cleanup */ - ap_register_cleanup(cmd->pool, sconf, cleanup_mmap, ap_null_cleanup); - } - return NULL; -} - -#ifdef WIN32 -/* Windows doesn't have inodes. This ifdef should be changed to - * something like HAVE_INODES - */ -static int file_compare(const void *av, const void *bv) -{ - const a_file *a = av; - const a_file *b = bv; - - return strcmp(a->filename, b->filename); -} -#else -static int inode_compare(const void *av, const void *bv) -{ - const a_file *a = *(a_file **)av; - const a_file *b = *(a_file **)bv; - long c; - - c = a->finfo.st_ino - b->finfo.st_ino; - if (c == 0) { - return a->finfo.st_dev - b->finfo.st_dev; - } - return c; -} -#endif -static void file_cache_post_config(ap_pool_t *p, ap_pool_t *plog, - ap_pool_t *ptemp, server_rec *s) -{ - a_server_config *sconf; - ap_array_header_t *inodes; - a_file *elts; - int nelts; - int i; - - context = p; - /* sort the elements of the main_server, by filename */ - sconf = ap_get_module_config(s->module_config, &file_cache_module); - elts = (a_file *)sconf->files->elts; - nelts = sconf->files->nelts; - qsort(elts, nelts, sizeof(a_file), file_compare); - - /* build an index by inode as well, speeds up the search in the handler */ -#ifndef WIN32 - inodes = ap_make_array(p, nelts, sizeof(a_file *)); - sconf->inode_sorted = inodes; - for (i = 0; i < nelts; ++i) { - *(a_file **)ap_push_array(inodes) = &elts[i]; - } - qsort(inodes->elts, nelts, sizeof(a_file *), inode_compare); -#endif - /* and make the virtualhosts share the same thing */ - for (s = s->next; s; s = s->next) { - ap_set_module_config(s->module_config, &file_cache_module, sconf); - } -} - -/* If it's one of ours, fill in r->finfo now to avoid extra stat()... this is a - * bit of a kludge, because we really want to run after core_translate runs. - */ -int core_translate_copy(request_rec *r) -{ - void *sconf = r->server->module_config; - core_server_config *conf = ap_get_module_config(sconf, &core_module); - - if (r->proxyreq) { - return HTTP_FORBIDDEN; - } - if ((r->uri[0] != '/') && strcmp(r->uri, "*")) { - ap_log_rerror(APLOG_MARK, APLOG_NOERRNO|APLOG_ERR, 0, r, - "Invalid URI in request %s", r->the_request); - return BAD_REQUEST; - } - - if (r->server->path - && !strncmp(r->uri, r->server->path, r->server->pathlen) - && (r->server->path[r->server->pathlen - 1] == '/' - || r->uri[r->server->pathlen] == '/' - || r->uri[r->server->pathlen] == '\0')) { - r->filename = ap_pstrcat(r->pool, conf->ap_document_root, - (r->uri + r->server->pathlen), NULL); - } - else { - /* - * Make sure that we do not mess up the translation by adding two - * /'s in a row. This happens under windows when the document - * root ends with a / - */ - if ((conf->ap_document_root[strlen(conf->ap_document_root)-1] == '/') - && (*(r->uri) == '/')) { - r->filename = ap_pstrcat(r->pool, conf->ap_document_root, r->uri+1, - NULL); - } - else { - r->filename = ap_pstrcat(r->pool, conf->ap_document_root, r->uri, - NULL); - } - - return OK; - } -} -static int file_cache_xlat(request_rec *r) -{ - a_server_config *sconf; - a_file tmp; - a_file *match; - int res; - -#ifdef WIN32 -/* - * This is really broken on Windows. The call to get the core_module config - * in core_translate_copy seg faults because 'core_module' is not exported - * properly and needs a thunk. - * Will be fixed when we get API_VAR_EXPORTS working correctly again - */ - return DECLINED; -#endif - - sconf = ap_get_module_config(r->server->module_config, &file_cache_module); - - /* we only operate when at least one cachefile directive was used */ - if (ap_is_empty_table(sconf->files)) - return DECLINED; - - res = core_translate_copy(r); - if (res == DECLINED || !r->filename) { - return res; - } - if (!r->filename) - return DECLINED; - tmp.filename = r->filename; - match = (a_file *)bsearch(&tmp, sconf->files->elts, sconf->files->nelts, - sizeof(a_file), file_compare); - if (match == NULL) - return DECLINED; - - /* shortcircuit the get_path_info() stat() calls and stuff */ - r->finfo = match->finfo; - return OK; -} - - -static int file_cache_handler(request_rec *r) -{ - a_server_config *sconf; - a_file tmp; - a_file *ptmp; - a_file **pmatch; - a_file *match; - int rangestatus, errstatus; - - /* we don't handle anything but GET */ - if (r->method_number != M_GET) return DECLINED; - - /* file doesn't exist, we won't be dealing with it */ - if (r->finfo.protection == 0) return DECLINED; - - sconf = ap_get_module_config(r->server->module_config, &file_cache_module); -#ifdef WIN32 - tmp.filename = r->filename; -#else - tmp.finfo.st_dev = r->finfo.st_dev; - tmp.finfo.st_ino = r->finfo.st_ino; -#endif - ptmp = &tmp; -#ifdef WIN32 - match = (a_file *)bsearch(ptmp, sconf->files->elts, - sconf->files->nelts, sizeof(a_file), file_compare); - if (match == NULL) { - return DECLINED; - } -#else - pmatch = (a_file **)bsearch(&ptmp, sconf->inode_sorted->elts, - sconf->inode_sorted->nelts, sizeof(a_file *), inode_compare); - if (pmatch == NULL) { - return DECLINED; - } - match = *pmatch; -#endif - - /* note that we would handle GET on this resource */ - r->allowed |= (1 << M_GET); - - /* This handler has no use for a request body (yet), but we still - * need to read and discard it if the client sent one. - */ - if ((errstatus = ap_discard_request_body(r)) != OK) - return errstatus; - - ap_update_mtime(r, match->finfo.mtime); - ap_set_last_modified(r); - ap_set_etag(r); - if (((errstatus = ap_meets_conditions(r)) != OK) - || (errstatus = ap_set_content_length (r, match->finfo.size))) { - return errstatus; - } - - rangestatus = ap_set_byterange(r); - ap_send_http_header(r); - - if (!r->header_only) { - long length = match->finfo.size; - ap_off_t offset = 0; -#if 1 - /* ap_bflush(r->connection->client->); */ - struct iovec iov; - ap_hdtr_t hdtr; - ap_hdtr_t *phdtr = &hdtr; - - /* frob the client buffer */ - iov.iov_base = r->connection->client->outbase; - iov.iov_len = r->connection->client->outcnt; - r->connection->client->outcnt = 0; - - /* initialize the ap_hdtr_t struct */ - phdtr->headers = &iov; - phdtr->numheaders = 1; - phdtr->trailers = NULL; - phdtr->numtrailers = 0; - - if (!rangestatus) { - iol_sendfile(r->connection->client->iol, - match->file, - phdtr, - &offset, - &length, - 0); - } - else { - while (ap_each_byterange(r, &offset, &length)) { - iol_sendfile(r->connection->client->iol, - match->file, - phdtr, - &offset, - &length, - 0); - phdtr = NULL; - } - } -#else - if (!rangestatus) { - ap_send_mmap (match->mm, r, 0, match->finfo.st_size); - } - else { - while (ap_each_byterange(r, &offset, &length)) { - ap_send_mmap(match->mm, r, offset, length); - } - } -#endif - } - - return OK; -} - -static command_rec mmap_cmds[] = -{ - {"cachefile", cachefile, NULL, RSRC_CONF, ITERATE, - "A space seperated list of files to mmap at config time"}, - {NULL} -}; - -static void register_hooks(void) -{ - /* static const char* const aszPre[]={"http_core.c",NULL}; */ - /* ap_hook_pre_config(pre_config,NULL,NULL,HOOK_MIDDLE); */ - ap_hook_post_config(file_cache_post_config, NULL, NULL, HOOK_MIDDLE); - ap_hook_translate_name(file_cache_xlat, NULL, NULL, HOOK_MIDDLE); - /* This trick doesn't work apparently because the translate hooks - are single shot. If the core_hook returns OK, then our hook is - not called. - ap_hook_translate_name(file_cache_xlat, aszPre, NULL, HOOK_MIDDLE); - */ - -}; - -static const handler_rec file_cache_handlers[] = -{ - { "*/*", file_cache_handler }, - { NULL } -}; - -module MODULE_VAR_EXPORT file_cache_module = -{ - STANDARD20_MODULE_STUFF, - NULL, /* create per-directory config structure */ - NULL, /* merge per-directory config structures */ - create_server_config, /* create per-server config structure */ - NULL, /* merge per-server config structures */ - mmap_cmds, /* command handlers */ - file_cache_handlers, /* handlers */ - register_hooks /* register hooks */ -}; diff --git a/modules/cache/mod_file_cache.dsp b/modules/cache/mod_file_cache.dsp deleted file mode 100644 index f5a10bf4a61bc4d28bc95dae6256bed1c536df3b..0000000000000000000000000000000000000000 --- a/modules/cache/mod_file_cache.dsp +++ /dev/null @@ -1,99 +0,0 @@ -# Microsoft Developer Studio Project File - Name="ApacheModuleFileCache" - Package Owner=<4> -# Microsoft Developer Studio Generated Build File, Format Version 5.00 -# ** DO NOT EDIT ** - -# TARGTYPE "Win32 (x86) Dynamic-Link Library" 0x0102 - -CFG=ApacheModuleFileCache - Win32 Debug -!MESSAGE This is not a valid makefile. To build this project using NMAKE, -!MESSAGE use the Export Makefile command and run -!MESSAGE -!MESSAGE NMAKE /f "ApacheModuleFileCache.mak". -!MESSAGE -!MESSAGE You can specify a configuration when running NMAKE -!MESSAGE by defining the macro CFG on the command line. For example: -!MESSAGE -!MESSAGE NMAKE /f "ApacheModuleFileCache.mak"\ - CFG="ApacheModuleFileCache - Win32 Debug" -!MESSAGE -!MESSAGE Possible choices for configuration are: -!MESSAGE -!MESSAGE "ApacheModuleFileCache - Win32 Release" (based on\ - "Win32 (x86) Dynamic-Link Library") -!MESSAGE "ApacheModuleFileCache - Win32 Debug" (based on\ - "Win32 (x86) Dynamic-Link Library") -!MESSAGE - -# Begin Project -# PROP Scc_ProjName "" -# PROP Scc_LocalPath "" -CPP=cl.exe -MTL=midl.exe -RSC=rc.exe - -!IF "$(CFG)" == "ApacheModuleFileCache - Win32 Release" - -# PROP BASE Use_MFC 0 -# PROP BASE Use_Debug_Libraries 0 -# PROP BASE Output_Dir "Release" -# PROP BASE Intermediate_Dir "Release" -# PROP BASE Target_Dir "" -# PROP Use_MFC 0 -# PROP Use_Debug_Libraries 0 -# PROP Output_Dir ".\ApacheModuleFileCacheR" -# PROP Intermediate_Dir ".\ApacheModuleFileCacheR" -# PROP Ignore_Export_Lib 0 -# PROP Target_Dir "" -# ADD BASE CPP /nologo /MT /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /YX /FD /c -# ADD CPP /nologo /MT /W3 /GX /O2 /I "..\..\include" /I ".\\" /I "..\..\lib\apr\include" /D "NDEBUG" /D "WIN32" /D "_WINDOWS" /D "SHARED_MODULE" /FD /c -# SUBTRACT CPP /YX -# ADD BASE MTL /nologo /D "NDEBUG" /mktyplib203 /o NUL /win32 -# ADD MTL /nologo /D "NDEBUG" /mktyplib203 /o NUL /win32 -# ADD BASE RSC /l 0x409 /d "NDEBUG" -# ADD RSC /l 0x409 /d "NDEBUG" -BSC32=bscmake.exe -# ADD BASE BSC32 /nologo -# ADD BSC32 /nologo -LINK32=link.exe -# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:windows /dll /machine:I386 -# ADD LINK32 user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib ApacheCore.lib aprlib.lib kernel32.lib /nologo /subsystem:windows /dll /map /machine:I386 /libpath:"..\..\CoreR" /libpath:"..\..\lib\apr\Release" - -!ELSEIF "$(CFG)" == "ApacheModuleFileCache - Win32 Debug" - -# PROP BASE Use_MFC 0 -# PROP BASE Use_Debug_Libraries 1 -# PROP BASE Output_Dir "Debug" -# PROP BASE Intermediate_Dir "Debug" -# PROP BASE Target_Dir "" -# PROP Use_MFC 0 -# PROP Use_Debug_Libraries 1 -# PROP Output_Dir ".\ApacheModuleFileCacheD" -# PROP Intermediate_Dir ".\ApacheModuleFileCacheD" -# PROP Ignore_Export_Lib 0 -# PROP Target_Dir "" -# ADD BASE CPP /nologo /MTd /W3 /Gm /GX /Zi /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /YX /FD /c -# ADD CPP /nologo /MTd /W3 /Gm /GX /Zi /Od /I "..\..\include" /I ".\\" /I "..\..\lib\apr\include" /D "_DEBUG" /D "WIN32" /D "_WINDOWS" /D "SHARED_MODULE" /FD /c -# SUBTRACT CPP /YX -# ADD BASE MTL /nologo /D "_DEBUG" /mktyplib203 /o NUL /win32 -# ADD MTL /nologo /D "_DEBUG" /mktyplib203 /o NUL /win32 -# ADD BASE RSC /l 0x409 /d "_DEBUG" -# ADD RSC /l 0x409 /d "_DEBUG" -BSC32=bscmake.exe -# ADD BASE BSC32 /nologo -# ADD BSC32 /nologo -LINK32=link.exe -# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:windows /dll /debug /machine:I386 /pdbtype:sept -# ADD LINK32 ApacheCore.lib aprlib.lib kernel32.lib /nologo /subsystem:windows /dll /incremental:no /map /debug /machine:I386 /pdbtype:sept /libpath:"..\..\CoreD" /libpath:"..\..\lib\apr\Debug" - -!ENDIF - -# Begin Target - -# Name "ApacheModuleFileCache - Win32 Release" -# Name "ApacheModuleFileCache - Win32 Debug" -# Begin Source File - -SOURCE=..\..\modules\standard\mod_file_cache.c -# End Source File -# End Target -# End Project diff --git a/modules/cache/mod_file_cache.exp b/modules/cache/mod_file_cache.exp deleted file mode 100644 index 23b092a64062646cb9e6564d72d7d74521a96a14..0000000000000000000000000000000000000000 --- a/modules/cache/mod_file_cache.exp +++ /dev/null @@ -1 +0,0 @@ -file_cache_module diff --git a/modules/config5.m4 b/modules/config5.m4 deleted file mode 100644 index caa40eaf70603ca25c2ddb673d9cbc497bb5cb81..0000000000000000000000000000000000000000 --- a/modules/config5.m4 +++ /dev/null @@ -1,43 +0,0 @@ -AC_MSG_CHECKING(for extra modules) -AC_ARG_WITH(module, - [ --with-module=location Include the specified module. location is the - path to the new module.], - [ - modtype=`echo $withval | sed -e's/\(.*\):.*/\1/'` - pkg=`echo $withval | sed -e's/.*:\(.*\)/\1/'` - modfilec=`echo $pkg | sed -e 's;^.*/;;'` - modfileo=`echo $pkg | sed -e 's;^.*/;;' -e 's;\.c$;.o;'` - - if test "x$withval" != "xmodules/$modtype/$modfilec"; then - cp $pkg modules/$modtype/$modfilec - fi - module=`echo $pkg | sed -e 's;.*/mod_\(.*\).c;\1;'` - objects="mod_$module.lo" - libname="mod_$module.la" - modpath_current="modules/$modtype" - BUILTIN_LIBS="$BUILTIN_LIBS $modpath_current/$libname" - if test ! -s "$modpath_current/modules.mk"; then - cat >>$modpath_current/modules.mk<>$modpath_current/modules.mk.tmp<> $modpath_current/modules.mk.tmp - rm $modpath_current/modules.mk - mv $modpath_current/modules.mk.tmp $modpath_current/modules.mk - sed -e "s/\(static =.*\)/\1 $libname/" $modpath_current/modules.mk > $modpath_current/modules.mk.tmp - rm $modpath_current/modules.mk - mv $modpath_current/modules.mk.tmp $modpath_current/modules.mk - fi - MODLIST="$MODLIST $module" - AC_MSG_RESULT(added $withval) - ], - [ AC_MSG_RESULT(no extra modules) - ]) diff --git a/modules/dav/fs/.cvsignore b/modules/dav/fs/.cvsignore deleted file mode 100644 index f2f7a70d2c9528e7ef84cf1b3bf9ff721fa08b08..0000000000000000000000000000000000000000 --- a/modules/dav/fs/.cvsignore +++ /dev/null @@ -1,10 +0,0 @@ -.deps -.libs -*.la -modules.mk -Makefile -*.lo -*.slo -*.so -*.dll -*.def diff --git a/modules/dav/fs/Makefile.in b/modules/dav/fs/Makefile.in deleted file mode 100644 index d149b757bf5bfcb3df7a85c9ab8b9ebca0944632..0000000000000000000000000000000000000000 --- a/modules/dav/fs/Makefile.in +++ /dev/null @@ -1,5 +0,0 @@ - -LTLIBRARY_NAME = libapachemod_dav_fs.la -LTLIBRARY_SOURCES = dbm.c lock.c repos.c - -include $(top_srcdir)/build/ltlib.mk diff --git a/modules/dav/fs/NWGNUmakefile b/modules/dav/fs/NWGNUmakefile deleted file mode 100644 index eb3c0fc5a4b72e0a838e294f2449d2b4c242dd06..0000000000000000000000000000000000000000 --- a/modules/dav/fs/NWGNUmakefile +++ /dev/null @@ -1,270 +0,0 @@ -# -# Declare the sub-directories to be built here -# - -SUBDIRS = \ - $(EOLIST) - -# -# Get the 'head' of the build environment. This includes default targets and -# paths to tools -# - -include $(AP_WORK)\build\NWGNUhead.inc - -# -# build this level's files - -# -# Make sure all needed macro's are defined -# - -# -# These directories will be at the beginning of the include list, followed by -# INCDIRS -# -XINCDIRS += \ - $(AP_WORK)/srclib/apr/include \ - $(AP_WORK)/srclib/include/arch/NetWare \ - $(AP_WORK)/srclib/apr-util/include \ - $(AP_WORK)/include \ - $(AP_WORK)/os/NetWare \ - $(AP_WORK)/server/mpm/NetWare \ - $(AP_WORK)/srclib/pcre \ - $(AP_WORK)/modules/dav/main \ - $(NWOS) \ - $(EOLIST) - -# -# These flags will come after CFLAGS -# -XCFLAGS += \ - $(EOLIST) - -# -# These defines will come after DEFINES -# -XDEFINES += \ - $(EOLIST) - -# -# These flags will be added to the link.opt file -# -XLFLAGS += \ - XDCData $(NWOS)\apache.xdc \ - $(EOLIST) - -# -# These values will be appended to the correct variables based on the value of -# RELEASE -# -ifeq "$(RELEASE)" "debug" -XINCDIRS += \ - $(EOLIST) - -XCFLAGS += \ - $(EOLIST) - -XDEFINES += \ - $(EOLIST) - -XLFLAGS += \ - $(EOLIST) -endif - -ifeq "$(RELEASE)" "noopt" -XINCDIRS += \ - $(EOLIST) - -XCFLAGS += \ - $(EOLIST) - -XDEFINES += \ - $(EOLIST) - -XLFLAGS += \ - $(EOLIST) -endif - -ifeq "$(RELEASE)" "release" -XINCDIRS += \ - $(EOLIST) - -XCFLAGS += \ - $(EOLIST) - -XDEFINES += \ - $(EOLIST) - -XLFLAGS += \ - $(EOLIST) -endif - -# -# These are used by the link target if an NLM is being generated -# This is used by the link 'name' directive to name the nlm. If left blank -# TARGET_nlm (see below) will be used. -# -NLM_NAME = modDAVFS - -# -# This is used by the link '-desc ' directive. -# If left blank, NLM_NAME will be used. -# -NLM_DESCRIPTION = Apache DAV_FS module - -# -# This is used by the '-threadname' directive. If left blank, -# NLM_NAME Thread will be used. -# -NLM_THREAD_NAME = modDAVFS Thread - -# -# If this is specified, it will override VERSION value in -# $(AP_WORK)\build\NWGNUenvironment.inc -# -NLM_VERSION = - -# -# If this is specified, it will override the default of 64K -# -NLM_STACK_SIZE = 65536 - - -# -# If this is specified it will be used by the link '-entry' directive -# -NLM_ENTRY_SYM = _LibCPrelude - -# -# If this is specified it will be used by the link '-exit' directive -# -NLM_EXIT_SYM = _LibCPostlude - -# -# If this is specified it will be used by the link '-check' directive -# -NLM_CHECK_SYM = - -# -# If this is specified it will be used by the link '-flags' directive -# -NLM_FLAGS = AUTOUNLOAD, PSEUDOPREEMPTION - -# -# Declare all target files (you must add your files here) -# - -# -# If there is an NLM target, put it here -# -TARGET_nlm = \ - $(OBJDIR)/moddavfs.nlm \ - $(EOLIST) - -# -# If there is an LIB target, put it here -# -TARGET_lib = \ - $(EOLIST) - -# -# These are the OBJ files needed to create the NLM target above. -# Paths must all use the '/' character -# -FILES_nlm_objs = \ - $(OBJDIR)/mod_dav_fs.o \ - $(OBJDIR)/dbm.o \ - $(OBJDIR)/lock.o \ - $(OBJDIR)/repos.o \ - $(OBJDIR)/libprews.o \ - $(EOLIST) - -# -# These are the LIB files needed to create the NLM target above. -# These will be added as a library command in the link.opt file. -# -FILES_nlm_libs = \ - libcpre.o \ - $(EOLIST) - -# -# These are the modules that the above NLM target depends on to load. -# These will be added as a module command in the link.opt file. -# -FILES_nlm_modules = \ - Apache2 \ - Libc \ - $(EOLIST) - -# -# If the nlm has a msg file, put it's path here -# -FILE_nlm_msg = - -# -# If the nlm has a hlp file put it's path here -# -FILE_nlm_hlp = - -# -# If this is specified, it will override $(NWOS)\copyright.txt. -# -FILE_nlm_copyright = - -# -# Any additional imports go here -# -FILES_nlm_Ximports = \ - @libc.imp \ - @$(APR)/aprlib.imp \ - @httpd.imp \ - @ws2nlm.imp \ - @../main/dav.imp \ - $(EOLIST) - -# -# Any symbols exported to here -# -FILES_nlm_exports = \ - dav_fs_module \ - $(EOLIST) - -# -# These are the OBJ files needed to create the LIB target above. -# Paths must all use the '/' character -# -FILES_lib_objs = \ - $(EOLIST) - -# -# implement targets and dependancies (leave this section alone) -# - -libs :: $(OBJDIR) $(TARGET_lib) - -nlms :: libs $(TARGET_nlm) - -# -# Updated this target to create necessary directories and copy files to the -# correct place. (See $(AP_WORK)\build\NWGNUhead.inc for examples) -# -install :: nlms FORCE - copy $(OBJDIR)\moddavfs.nlm $(INSTALL)\Apache2\modules -# -# Any specialized rules here -# - -$(OBJDIR)/%.o: ../../arch/netware/%.c $(OBJDIR)\cc.opt - @echo compiling $< - $(CC) $< -o=$(OBJDIR)\$(@F) @$(OBJDIR)\cc.opt - -# -# Include the 'tail' makefile that has targets that depend on variables defined -# in this makefile -# - -include $(AP_WORK)\build\NWGNUtail.inc - - - diff --git a/modules/dav/fs/config6.m4 b/modules/dav/fs/config6.m4 deleted file mode 100644 index 394b02dc141b566570ebdaa28bec31aa3bb5fa9b..0000000000000000000000000000000000000000 --- a/modules/dav/fs/config6.m4 +++ /dev/null @@ -1,11 +0,0 @@ -dnl modules enabled in this directory by default - -APACHE_MODPATH_INIT(dav/fs) - -dav_fs_objects="mod_dav_fs.lo dbm.lo lock.lo repos.lo" - -dnl ### we want to default this based on whether dav is being used... -dnl ### but there is no ordering to the config.m4 files right now... -APACHE_MODULE(dav_fs, DAV provider for the filesystem, $dav_fs_objects, , most) - -APACHE_MODPATH_FINISH diff --git a/modules/dav/fs/dbm.c b/modules/dav/fs/dbm.c deleted file mode 100644 index ff69ba7559d35b1e4f5286959dae642eb19c3b2e..0000000000000000000000000000000000000000 --- a/modules/dav/fs/dbm.c +++ /dev/null @@ -1,315 +0,0 @@ -/* -** Copyright (C) 1998-2000 Greg Stein. All Rights Reserved. -** -** By using this file, you agree to the terms and conditions set forth in -** the LICENSE.html file which can be found at the top level of the mod_dav -** distribution or at http://www.webdav.org/mod_dav/license-1.html. -** -** Contact information: -** Greg Stein, PO Box 760, Palo Alto, CA, 94302 -** gstein@lyra.org, http://www.webdav.org/mod_dav/ -*/ - -/* -** DAV extension module for Apache 1.3.* -** - Database support using DBM-style databases, -** part of the filesystem repository implementation -** -** Written by Greg Stein, gstein@lyra.org, http://www.lyra.org/ -*/ - -/* -** This implementation uses a SDBM or GDBM database per file and directory to -** record the properties. These databases are kept in a subdirectory (of -** the directory in question or the directory that holds the file in -** question) named by the macro DAV_FS_STATE_DIR (.DAV). The filename of the -** database is equivalent to the target filename, and is -** DAV_FS_STATE_FILE_FOR_DIR (.state_for_dir) for the directory itself. -*/ - -#ifdef DAV_USE_GDBM -#include -#else -#include /* for O_RDONLY, O_WRONLY */ -#include "sdbm/sdbm.h" -#endif - -#include "mod_dav.h" -#include "dav_fs_repos.h" - - -#ifdef DAV_USE_GDBM - -typedef GDBM_FILE dav_dbm_file; - -#define DAV_DBM_CLOSE(f) gdbm_close(f) -#define DAV_DBM_FETCH(f, k) gdbm_fetch((f), (k)) -#define DAV_DBM_STORE(f, k, v) gdbm_store((f), (k), (v), GDBM_REPLACE) -#define DAV_DBM_DELETE(f, k) gdbm_delete((f), (k)) -#define DAV_DBM_FIRSTKEY(f) gdbm_firstkey(f) -#define DAV_DBM_NEXTKEY(f, k) gdbm_nextkey((f), (k)) -#define DAV_DBM_CLEARERR(f) if (0) ; else /* stop "no effect" warning */ -#define DAV_DBM_FREEDATUM(f, d) ((d).dptr ? free((d).dptr) : 0) - -#else - -typedef DBM *dav_dbm_file; - -#define DAV_DBM_CLOSE(f) sdbm_close(f) -#define DAV_DBM_FETCH(f, k) sdbm_fetch((f), (k)) -#define DAV_DBM_STORE(f, k, v) sdbm_store((f), (k), (v), DBM_REPLACE) -#define DAV_DBM_DELETE(f, k) sdbm_delete((f), (k)) -#define DAV_DBM_FIRSTKEY(f) sdbm_firstkey(f) -#define DAV_DBM_NEXTKEY(f, k) sdbm_nextkey(f) -#define DAV_DBM_CLEARERR(f) sdbm_clearerr(f) -#define DAV_DBM_FREEDATUM(f, d) if (0) ; else /* stop "no effect" warning */ - -#endif - -struct dav_db { - pool *pool; - dav_dbm_file file; -}; - -#define D2G(d) (*(datum*)&(d)) - - -void dav_dbm_get_statefiles(pool *p, const char *fname, - const char **state1, const char **state2) -{ - char *work; - - if (fname == NULL) - fname = DAV_FS_STATE_FILE_FOR_DIR; - -#ifndef DAV_USE_GDBM - fname = ap_pstrcat(p, fname, DIRFEXT, NULL); -#endif - - *state1 = fname; - -#ifdef DAV_USE_GDBM - *state2 = NULL; -#else - { - int extension; - - work = ap_pstrdup(p, fname); - - /* we know the extension is 4 characters -- len(DIRFEXT) */ - extension = strlen(work) - 4; - memcpy(&work[extension], PAGFEXT, 4); - *state2 = work; - } -#endif -} - -static dav_error * dav_fs_dbm_error(dav_db *db, pool *p) -{ - int save_errno = errno; - int errcode; - const char *errstr; - dav_error *err; - - p = db ? db->pool : p; - -#ifdef DAV_USE_GDBM - errcode = gdbm_errno; - errstr = gdbm_strerror(gdbm_errno); -#else - /* There might not be a if we had problems creating it. */ - errcode = !db || sdbm_error(db->file); - if (errcode) - errstr = "I/O error occurred."; - else - errstr = "No error."; -#endif - - err = dav_new_error(p, HTTP_INTERNAL_SERVER_ERROR, errcode, errstr); - err->save_errno = save_errno; - return err; -} - -/* ensure that our state subdirectory is present */ -/* ### does this belong here or in dav_fs_repos.c ?? */ -void dav_fs_ensure_state_dir(pool * p, const char *dirname) -{ - const char *pathname = ap_pstrcat(p, dirname, "/" DAV_FS_STATE_DIR, NULL); - - /* ### do we need to deal with the umask? */ - - /* just try to make it, ignoring any resulting errors */ - mkdir(pathname, DAV_FS_MODE_DIR); -} - -/* dav_dbm_open_direct: Opens a *dbm database specified by path. - * ro = boolean read-only flag. - */ -dav_error * dav_dbm_open_direct(pool *p, const char *pathname, int ro, - dav_db **pdb) -{ - dav_dbm_file file; - - *pdb = NULL; - - /* NOTE: stupid cast to get rid of "const" on the pathname */ -#ifdef DAV_USE_GDBM - file = gdbm_open((char *) pathname, - 0, - ro ? GDBM_READER : GDBM_WRCREAT, - DAV_FS_MODE_FILE, - NULL); -#else - file = sdbm_open((char *) pathname, - ro ? O_RDONLY : (O_RDWR | O_CREAT), - DAV_FS_MODE_FILE); -#endif - - /* we can't continue if we couldn't open the file and we need to write */ - if (file == NULL && !ro) { - return dav_fs_dbm_error(NULL, p); - } - - /* may be NULL if we tried to open a non-existent db as read-only */ - if (file != NULL) { - /* we have an open database... return it */ - *pdb = ap_pcalloc(p, sizeof(**pdb)); - (*pdb)->pool = p; - (*pdb)->file = file; - } - - return NULL; -} - -static dav_error * dav_dbm_open(pool * p, const dav_resource *resource, int ro, - dav_db **pdb) -{ - const char *dirpath; - const char *fname; - const char *pathname; - - /* Get directory and filename for resource */ - dav_fs_dir_file_name(resource, &dirpath, &fname); - - /* If not opening read-only, ensure the state dir exists */ - if (!ro) { - /* ### what are the perf implications of always checking this? */ - dav_fs_ensure_state_dir(p, dirpath); - } - - pathname = ap_pstrcat(p, - dirpath, - "/" DAV_FS_STATE_DIR "/", - fname ? fname : DAV_FS_STATE_FILE_FOR_DIR, - NULL); - - /* ### readers cannot open while a writer has this open; we should - ### perform a few retries with random pauses. */ - - /* ### do we need to deal with the umask? */ - - return dav_dbm_open_direct(p, pathname, ro, pdb); -} - -static void dav_dbm_close(dav_db *db) -{ - DAV_DBM_CLOSE(db->file); -} - -static dav_error * dav_dbm_fetch(dav_db *db, dav_datum key, dav_datum *pvalue) -{ - *(datum *) pvalue = DAV_DBM_FETCH(db->file, D2G(key)); - - /* we don't need the error; we have *pvalue to tell */ - DAV_DBM_CLEARERR(db->file); - - return NULL; -} - -static dav_error * dav_dbm_store(dav_db *db, dav_datum key, dav_datum value) -{ - int rv; - - rv = DAV_DBM_STORE(db->file, D2G(key), D2G(value)); - - /* ### fetch more specific error information? */ - - /* we don't need the error; we have rv to tell */ - DAV_DBM_CLEARERR(db->file); - - if (rv == -1) { - return dav_fs_dbm_error(db, NULL); - } - return NULL; -} - -static dav_error * dav_dbm_delete(dav_db *db, dav_datum key) -{ - int rv; - - rv = DAV_DBM_DELETE(db->file, D2G(key)); - - /* ### fetch more specific error information? */ - - /* we don't need the error; we have rv to tell */ - DAV_DBM_CLEARERR(db->file); - - if (rv == -1) { - return dav_fs_dbm_error(db, NULL); - } - return NULL; -} - -static int dav_dbm_exists(dav_db *db, dav_datum key) -{ - int exists; - -#ifdef DAV_USE_GDBM - exists = gdbm_exists(db->file, D2G(key)) != 0; -#else - { - datum value = sdbm_fetch(db->file, D2G(key)); - sdbm_clearerr(db->file); /* unneeded */ - exists = value.dptr != NULL; - } -#endif - return exists; -} - -static dav_error * dav_dbm_firstkey(dav_db *db, dav_datum *pkey) -{ - *(datum *) pkey = DAV_DBM_FIRSTKEY(db->file); - - /* we don't need the error; we have *pkey to tell */ - DAV_DBM_CLEARERR(db->file); - - return NULL; -} - -static dav_error * dav_dbm_nextkey(dav_db *db, dav_datum *pkey) -{ - *(datum *) pkey = DAV_DBM_NEXTKEY(db->file, D2G(*pkey)); - - /* we don't need the error; we have *pkey to tell */ - DAV_DBM_CLEARERR(db->file); - - return NULL; -} - -static void dav_dbm_freedatum(dav_db *db, dav_datum data) -{ - DAV_DBM_FREEDATUM(db, data); -} - -const dav_hooks_db dav_hooks_db_dbm = -{ - dav_dbm_open, - dav_dbm_close, - dav_dbm_fetch, - dav_dbm_store, - dav_dbm_delete, - dav_dbm_exists, - dav_dbm_firstkey, - dav_dbm_nextkey, - dav_dbm_freedatum, -}; diff --git a/modules/dav/fs/lock.c b/modules/dav/fs/lock.c deleted file mode 100644 index 3b2d83c18eabc314b978514c29d1c171be986876..0000000000000000000000000000000000000000 --- a/modules/dav/fs/lock.c +++ /dev/null @@ -1,1486 +0,0 @@ -/* -** Copyright (C) 1998-2000 Greg Stein. All Rights Reserved. -** -** By using this file, you agree to the terms and conditions set forth in -** the LICENSE.html file which can be found at the top level of the mod_dav -** distribution or at http://www.webdav.org/mod_dav/license-1.html. -** -** Contact information: -** Greg Stein, PO Box 760, Palo Alto, CA, 94302 -** gstein@lyra.org, http://www.webdav.org/mod_dav/ -*/ - -/* -** DAV filesystem lock implementation -** -** Written 06/99 by Keith Wannamaker, wannamak@us.ibm.com -** -** Modified 08/99 by John Vasta, vasta@rational.com. to extract -** repository-dependent code from dav_lock.c -*/ - -#include - -#include "httpd.h" -#include "http_log.h" - -#include "mod_dav.h" -#include "dav_opaquelock.h" -#include "dav_fs_repos.h" - - -/* --------------------------------------------------------------- -** -** Lock database primitives -** -*/ - -/* -** LOCK DATABASES -** -** Lockdiscovery information is stored in the single lock database specified -** by the DAVLockDB directive. Information about this db is stored in the -** global server configuration. -** -** KEY -** -** The database is keyed by a key_type unsigned char (DAV_TYPE_INODE or -** DAV_TYPE_FNAME) followed by inode and device number if possible, -** otherwise full path (in the case of Win32 or lock-null resources). -** -** VALUE -** -** The value consists of a list of elements. -** DIRECT LOCK: [char (DAV_LOCK_DIRECT), -** char (dav_lock_scope), -** char (dav_lock_type), -** int depth, -** time_t expires, -** uuid_t locktoken, -** char[] owner, -** char[] auth_user] -** -** INDIRECT LOCK: [char (DAV_LOCK_INDIRECT), -** uuid_t locktoken, -** time_t expires, -** int key_size, -** char[] key] -** The key is to the collection lock that resulted in this indirect lock -*/ - -#define DAV_TRUE 1 -#define DAV_FALSE 0 - -#define DAV_CREATE_LIST 23 -#define DAV_APPEND_LIST 24 - -/* Stored lock_discovery prefix */ -#define DAV_LOCK_DIRECT 1 -#define DAV_LOCK_INDIRECT 2 - -#define DAV_TYPE_INODE 10 -#define DAV_TYPE_FNAME 11 - - -/* ack. forward declare. */ -static dav_error * dav_fs_remove_locknull_member(pool *p, - const char *filename, - dav_buffer *pbuf); - -/* -** Use the opaquelock scheme for locktokens -*/ -struct dav_locktoken { - uuid_t uuid; -}; - - -/* ################################################################# -** ### keep these structures (internal) or move fully to dav_lock? -*/ - -/* -** We need to reliably size the fixed-length portion of -** dav_lock_discovery; best to separate it into another -** struct for a convenient sizeof, unless we pack lock_discovery. -*/ -typedef struct dav_lock_discovery_fixed -{ - char scope; - char type; - int depth; - time_t timeout; -} dav_lock_discovery_fixed; - -typedef struct dav_lock_discovery -{ - struct dav_lock_discovery_fixed f; - - dav_locktoken *locktoken; - const char *owner; /* owner field from activelock */ - const char *auth_user; /* authenticated user who created the lock */ - struct dav_lock_discovery *next; -} dav_lock_discovery; - -/* Indirect locks represent locks inherited from containing collections. - * They reference the lock token for the collection the lock is - * inherited from. A lock provider may also define a key to the - * inherited lock, for fast datbase lookup. The key is opaque outside - * the lock provider. - */ -typedef struct dav_lock_indirect -{ - dav_locktoken *locktoken; - dav_datum key; - struct dav_lock_indirect *next; - time_t timeout; -} dav_lock_indirect; - -/* ################################################################# */ - - -/* -** Stored direct lock info - full lock_discovery length: -** prefix + Fixed length + lock token + 2 strings + 2 nulls (one for each string) -*/ -#define dav_size_direct(a) (1 + sizeof(dav_lock_discovery_fixed) \ - + sizeof(uuid_t) \ - + ((a)->owner ? strlen((a)->owner) : 0) \ - + ((a)->auth_user ? strlen((a)->auth_user) : 0) \ - + 2) - -/* Stored indirect lock info - lock token and dav_datum */ -#define dav_size_indirect(a) (1 + sizeof(uuid_t) \ - + sizeof(time_t) \ - + sizeof(int) + (a)->key.dsize) - -/* -** The lockdb structure. -** -** The field may be NULL, meaning one of two things: -** 1) That we have not actually opened the underlying database (yet). The -** field should be false. -** 2) We opened it readonly and it wasn't present. -** -** The delayed opening (determined by ) makes creating a lockdb -** quick, while deferring the underlying I/O until it is actually required. -** -** We export the notion of a lockdb, but hide the details of it. Most -** implementations will use a database of some kind, but it is certainly -** possible that alternatives could be used. -*/ -struct dav_lockdb_private -{ - request_rec *r; /* for accessing the uuid state */ - pool *pool; /* a pool to use */ - const char *lockdb_path; /* where is the lock database? */ - - int opened; /* we opened the database */ - dav_db *db; /* if non-NULL, the lock database */ -}; -typedef struct -{ - dav_lockdb pub; - dav_lockdb_private priv; -} dav_lockdb_combined; - -/* -** The private part of the lock structure. -*/ -struct dav_lock_private -{ - dav_datum key; /* key into the lock database */ -}; -typedef struct -{ - dav_lock pub; - dav_lock_private priv; - dav_locktoken token; -} dav_lock_combined; - -/* -** This must be forward-declared so the open_lockdb function can use it. -*/ -extern const dav_hooks_locks dav_hooks_locks_fs; - - -/* internal function for creating locks */ -static dav_lock *dav_fs_alloc_lock(dav_lockdb *lockdb, dav_datum key, - const dav_locktoken *locktoken) -{ - dav_lock_combined *comb; - - comb = ap_pcalloc(lockdb->info->pool, sizeof(*comb)); - comb->pub.rectype = DAV_LOCKREC_DIRECT; - comb->pub.info = &comb->priv; - comb->priv.key = key; - - if (locktoken == NULL) { - comb->pub.locktoken = &comb->token; - dav_create_opaquelocktoken(dav_get_uuid_state(lockdb->info->r), - &comb->token.uuid); - } - else { - comb->pub.locktoken = locktoken; - } - - return &comb->pub; -} - -/* -** dav_fs_parse_locktoken -** -** Parse an opaquelocktoken URI into a locktoken. -*/ -static dav_error * dav_fs_parse_locktoken( - pool *p, - const char *char_token, - dav_locktoken **locktoken_p) -{ - dav_locktoken *locktoken; - - if (strstr(char_token, "opaquelocktoken:") != char_token) { - return dav_new_error(p, - HTTP_BAD_REQUEST, DAV_ERR_LOCK_UNK_STATE_TOKEN, - "The lock token uses an unknown State-token " - "format and could not be parsed."); - } - char_token += 16; - - locktoken = ap_pcalloc(p, sizeof(*locktoken)); - if (dav_parse_opaquelocktoken(char_token, &locktoken->uuid)) { - return dav_new_error(p, HTTP_BAD_REQUEST, DAV_ERR_LOCK_PARSE_TOKEN, - "The opaquelocktoken has an incorrect format " - "and could not be parsed."); - } - - *locktoken_p = locktoken; - return NULL; -} - -/* -** dav_fs_format_locktoken -** -** Generate the URI for a locktoken -*/ -static const char *dav_fs_format_locktoken( - pool *p, - const dav_locktoken *locktoken) -{ - const char *uuid_token = dav_format_opaquelocktoken(p, &locktoken->uuid); - return ap_pstrcat(p, "opaquelocktoken:", uuid_token, NULL); -} - -/* -** dav_fs_compare_locktoken -** -** Determine whether two locktokens are the same -*/ -static int dav_fs_compare_locktoken( - const dav_locktoken *lt1, - const dav_locktoken *lt2) -{ - return dav_compare_opaquelocktoken(lt1->uuid, lt2->uuid); -} - -/* -** dav_fs_really_open_lockdb: -** -** If the database hasn't been opened yet, then open the thing. -*/ -static dav_error * dav_fs_really_open_lockdb(dav_lockdb *lockdb) -{ - dav_error *err; - - if (lockdb->info->opened) - return NULL; - - err = dav_dbm_open_direct(lockdb->info->pool, - lockdb->info->lockdb_path, - lockdb->ro, - &lockdb->info->db); - if (err != NULL) { - return dav_push_error(lockdb->info->pool, - HTTP_INTERNAL_SERVER_ERROR, - DAV_ERR_LOCK_OPENDB, - "Could not open the lock database.", - err); - } - - /* all right. it is opened now. */ - lockdb->info->opened = 1; - - return NULL; -} - -/* -** dav_fs_open_lockdb: -** -** "open" the lock database, as specified in the global server configuration. -** If force is TRUE, then the database is opened now, rather than lazily. -** -** Note that only one can be open read/write. -*/ -static dav_error * dav_fs_open_lockdb(request_rec *r, int ro, int force, - dav_lockdb **lockdb) -{ - dav_lockdb_combined *comb; - - comb = ap_pcalloc(r->pool, sizeof(*comb)); - comb->pub.hooks = &dav_hooks_locks_fs; - comb->pub.ro = ro; - comb->pub.info = &comb->priv; - comb->priv.r = r; - comb->priv.pool = r->pool; - - comb->priv.lockdb_path = dav_get_lockdb_path(r); - if (comb->priv.lockdb_path == NULL) { - return dav_new_error(r->pool, HTTP_INTERNAL_SERVER_ERROR, - DAV_ERR_LOCK_NO_DB, - "A lock database was not specified with the " - "DAVLockDB directive. One must be specified " - "to use the locking functionality."); - } - - /* done initializing. return it. */ - *lockdb = &comb->pub; - - if (force) { - /* ### add a higher-level comment? */ - return dav_fs_really_open_lockdb(*lockdb); - } - - return NULL; -} - -/* -** dav_fs_close_lockdb: -** -** Close it. Duh. -*/ -static void dav_fs_close_lockdb(dav_lockdb *lockdb) -{ - if (lockdb->info->db != NULL) - (*dav_hooks_db_dbm.close)(lockdb->info->db); -} - -/* -** dav_fs_build_fname_key -** -** Given a pathname, build a DAV_TYPE_FNAME lock database key. -*/ -static dav_datum dav_fs_build_fname_key(pool *p, const char *pathname) -{ - dav_datum key; - - /* ### does this allocation have a proper lifetime? need to check */ - /* ### can we use a buffer for this? */ - - /* size is TYPE + pathname + null */ - key.dsize = strlen(pathname) + 2; - key.dptr = ap_palloc(p, key.dsize); - *key.dptr = DAV_TYPE_FNAME; - memcpy(key.dptr + 1, pathname, key.dsize - 1); - if (key.dptr[key.dsize - 2] == '/') - key.dptr[--key.dsize - 1] = '\0'; - return key; -} - -/* -** dav_fs_build_key: Given a resource, return a dav_datum key -** to look up lock information for this file. -** -** (Win32 or file is lock-null): -** dav_datum->dvalue = full path -** -** (non-Win32 and file exists ): -** dav_datum->dvalue = inode, dev_major, dev_minor -*/ -static dav_datum dav_fs_build_key(pool *p, const dav_resource *resource) -{ - const char *file = dav_fs_pathname(resource); -#ifndef WIN32 - dav_datum key; - struct stat finfo; - - /* ### use lstat() ?? */ - if (stat(file, &finfo) == 0) { - - /* ### can we use a buffer for this? */ - key.dsize = 1 + sizeof(finfo.st_ino) + sizeof(finfo.st_dev); - key.dptr = ap_palloc(p, key.dsize); - *key.dptr = DAV_TYPE_INODE; - memcpy(key.dptr + 1, &finfo.st_ino, sizeof(finfo.st_ino)); - memcpy(key.dptr + 1 + sizeof(finfo.st_ino), &finfo.st_dev, - sizeof(finfo.st_dev)); - - return key; - } -#endif - - return dav_fs_build_fname_key(p, file); -} - -/* -** dav_fs_lock_expired: return 1 (true) if the given timeout is in the past -** or present (the lock has expired), or 0 (false) if in the future -** (the lock has not yet expired). -*/ -static int dav_fs_lock_expired(time_t expires) -{ - return expires != DAV_TIMEOUT_INFINITE && time(NULL) >= expires; -} - -/* -** dav_fs_save_lock_record: Saves the lock information specified in the -** direct and indirect lock lists about path into the lock database. -** If direct and indirect == NULL, the key is removed. -*/ -static dav_error * dav_fs_save_lock_record(dav_lockdb *lockdb, dav_datum key, - dav_lock_discovery *direct, - dav_lock_indirect *indirect) -{ - dav_error *err; - dav_datum val = { 0 }; - char *ptr; - dav_lock_discovery *dp = direct; - dav_lock_indirect *ip = indirect; - -#if DAV_DEBUG - if (lockdb->ro) { - return dav_new_error(lockdb->info->pool, - HTTP_INTERNAL_SERVER_ERROR, 0, - "INTERNAL DESIGN ERROR: the lockdb was opened " - "readonly, but an attempt to save locks was " - "performed."); - } -#endif - - if ((err = dav_fs_really_open_lockdb(lockdb)) != NULL) { - /* ### add a higher-level error? */ - return err; - } - - /* If nothing to save, delete key */ - if (dp == NULL && ip == NULL) { - /* don't fail if the key is not present */ - /* ### but what about other errors? */ - (void) (*dav_hooks_db_dbm.remove)(lockdb->info->db, key); - return NULL; - } - - while(dp) { - val.dsize += dav_size_direct(dp); - dp = dp->next; - } - while(ip) { - val.dsize += dav_size_indirect(ip); - ip = ip->next; - } - - /* ### can this be ap_palloc() ? */ - /* ### hmmm.... investigate the use of a buffer here */ - ptr = val.dptr = ap_pcalloc(lockdb->info->pool, val.dsize); - dp = direct; - ip = indirect; - - while(dp) { - *ptr++ = DAV_LOCK_DIRECT; /* Direct lock - lock_discovery struct follows */ - memcpy(ptr, dp, sizeof(dp->f)); /* Fixed portion of struct */ - ptr += sizeof(dp->f); - memcpy(ptr, dp->locktoken, sizeof(*dp->locktoken)); - ptr += sizeof(*dp->locktoken); - if (dp->owner == NULL) { - *ptr++ = '\0'; - } - else { - memcpy(ptr, dp->owner, strlen(dp->owner) + 1); - ptr += strlen(dp->owner) + 1; - } - if (dp->auth_user == NULL) { - *ptr++ = '\0'; - } - else { - memcpy(ptr, dp->auth_user, strlen(dp->auth_user) + 1); - ptr += strlen(dp->auth_user) + 1; - } - - dp = dp->next; - } - - while(ip) { - *ptr++ = DAV_LOCK_INDIRECT; /* Indirect lock prefix */ - memcpy(ptr, ip->locktoken, sizeof(*ip->locktoken)); /* Locktoken */ - ptr += sizeof(*ip->locktoken); - memcpy(ptr, &ip->timeout, sizeof(ip->timeout)); /* Expire time */ - ptr += sizeof(ip->timeout); - memcpy(ptr, &ip->key.dsize, sizeof(ip->key.dsize)); /* Size of key */ - ptr += sizeof(ip->key.dsize); - memcpy(ptr, ip->key.dptr, ip->key.dsize); /* Key data */ - ptr += ip->key.dsize; - ip = ip->next; - } - - if ((err = (*dav_hooks_db_dbm.store)(lockdb->info->db, - key, val)) != NULL) { - /* ### more details? add an error_id? */ - return dav_push_error(lockdb->info->pool, - HTTP_INTERNAL_SERVER_ERROR, - DAV_ERR_LOCK_SAVE_LOCK, - "Could not save lock information.", - err); - } - - return NULL; -} - -/* -** dav_load_lock_record: Reads lock information about key from lock db; -** creates linked lists of the direct and indirect locks. -** -** If add_method = DAV_APPEND_LIST, the result will be appended to the -** head of the direct and indirect lists supplied. -** -** Passive lock removal: If lock has timed out, it will not be returned. -** ### How much "logging" does RFC 2518 require? -*/ -static dav_error * dav_fs_load_lock_record(dav_lockdb *lockdb, dav_datum key, - int add_method, - dav_lock_discovery **direct, - dav_lock_indirect **indirect) -{ - dav_error *err; - size_t offset = 0; - int need_save = DAV_FALSE; - dav_datum val = { 0 }; - dav_lock_discovery *dp; - dav_lock_indirect *ip; - dav_buffer buf = { 0 }; - - if (add_method != DAV_APPEND_LIST) { - *direct = NULL; - *indirect = NULL; - } - - if ((err = dav_fs_really_open_lockdb(lockdb)) != NULL) { - /* ### add a higher-level error? */ - return err; - } - - /* - ** If we opened readonly and the db wasn't there, then there are no - ** locks for this resource. Just exit. - */ - if (lockdb->info->db == NULL) - return NULL; - - if ((err = (*dav_hooks_db_dbm.fetch)(lockdb->info->db, key, &val)) != NULL) - return err; - - if (!val.dsize) - return NULL; - - while (offset < val.dsize) { - switch (*(val.dptr + offset++)) { - case DAV_LOCK_DIRECT: - /* Create and fill a dav_lock_discovery structure */ - - dp = ap_pcalloc(lockdb->info->pool, sizeof(*dp)); - memcpy(dp, val.dptr + offset, sizeof(dp->f)); - offset += sizeof(dp->f); - dp->locktoken = ap_palloc(lockdb->info->pool, sizeof(*dp->locktoken)); - memcpy(dp->locktoken, val.dptr + offset, sizeof(*dp->locktoken)); - offset += sizeof(*dp->locktoken); - if (*(val.dptr + offset) == '\0') { - ++offset; - } - else { - dp->owner = ap_pstrdup(lockdb->info->pool, val.dptr + offset); - offset += strlen(dp->owner) + 1; - } - - if (*(val.dptr + offset) == '\0') { - ++offset; - } - else { - dp->auth_user = ap_pstrdup(lockdb->info->pool, val.dptr + offset); - offset += strlen(dp->auth_user) + 1; - } - - if (!dav_fs_lock_expired(dp->f.timeout)) { - dp->next = *direct; - *direct = dp; - } - else { - need_save = DAV_TRUE; - - /* Remove timed-out locknull fm .locknull list */ - if (*key.dptr == DAV_TYPE_FNAME) { - const char *fname = key.dptr + 1; - struct stat finfo; - - /* if we don't see the file, then it's a locknull */ - if (lstat(fname, &finfo) != 0) { - if ((err = dav_fs_remove_locknull_member(lockdb->info->pool, fname, &buf)) != NULL) { - /* ### push a higher-level description? */ - return err; - } - } - } - } - break; - - case DAV_LOCK_INDIRECT: - /* Create and fill a dav_lock_indirect structure */ - - ip = ap_pcalloc(lockdb->info->pool, sizeof(*ip)); - ip->locktoken = ap_palloc(lockdb->info->pool, sizeof(*ip->locktoken)); - memcpy(ip->locktoken, val.dptr + offset, sizeof(*ip->locktoken)); - offset += sizeof(*ip->locktoken); - memcpy(&ip->timeout, val.dptr + offset, sizeof(ip->timeout)); - offset += sizeof(ip->timeout); - ip->key.dsize = *((int *) (val.dptr + offset)); /* length of datum */ - offset += sizeof(ip->key.dsize); - ip->key.dptr = ap_palloc(lockdb->info->pool, ip->key.dsize); - memcpy(ip->key.dptr, val.dptr + offset, ip->key.dsize); - offset += ip->key.dsize; - - if (!dav_fs_lock_expired(ip->timeout)) { - ip->next = *indirect; - *indirect = ip; - } - else { - need_save = DAV_TRUE; - /* A locknull resource will never be locked indirectly */ - } - - break; - - default: - (*dav_hooks_db_dbm.freedatum)(lockdb->info->db, val); - - /* ### should use a computed_desc and insert corrupt token data */ - --offset; - return dav_new_error(lockdb->info->pool, - HTTP_INTERNAL_SERVER_ERROR, - DAV_ERR_LOCK_CORRUPT_DB, - ap_psprintf(lockdb->info->pool, - "The lock database was found to " - "be corrupt. offset %i, c=%02x", - offset, val.dptr[offset])); - } - } - - (*dav_hooks_db_dbm.freedatum)(lockdb->info->db, val); - - /* Clean up this record if we found expired locks */ - /* - ** ### shouldn't do this if we've been opened READONLY. elide the - ** ### timed-out locks from the response, but don't save that info back - */ - if (need_save == DAV_TRUE) { - return dav_fs_save_lock_record(lockdb, key, *direct, *indirect); - } - - return NULL; -} - -/* resolve , returning <*direct> */ -static dav_error * dav_fs_resolve(dav_lockdb *lockdb, - dav_lock_indirect *indirect, - dav_lock_discovery **direct, - dav_lock_discovery **ref_dp, - dav_lock_indirect **ref_ip) -{ - dav_error *err; - dav_lock_discovery *dir; - dav_lock_indirect *ind; - - if ((err = dav_fs_load_lock_record(lockdb, indirect->key, - DAV_CREATE_LIST, - &dir, &ind)) != NULL) { - /* ### insert a higher-level description? */ - return err; - } - if (ref_dp != NULL) { - *ref_dp = dir; - *ref_ip = ind; - } - - for (; dir != NULL; dir = dir->next) { - if (!dav_compare_opaquelocktoken(indirect->locktoken->uuid, - dir->locktoken->uuid)) { - *direct = dir; - return NULL; - } - } - - /* No match found (but we should have found one!) */ - - /* ### use a different description and/or error ID? */ - return dav_new_error(lockdb->info->pool, - HTTP_INTERNAL_SERVER_ERROR, - DAV_ERR_LOCK_CORRUPT_DB, - "The lock database was found to be corrupt. " - "An indirect lock's direct lock could not " - "be found."); -} - -/* --------------------------------------------------------------- -** -** Property-related lock functions -** -*/ - -/* -** dav_fs_get_supportedlock: Returns a static string for all supportedlock -** properties. I think we save more returning a static string than -** constructing it every time, though it might look cleaner. -*/ -static const char *dav_fs_get_supportedlock(void) -{ - static const char supported[] = DEBUG_CR - "" DEBUG_CR - "" DEBUG_CR - "" DEBUG_CR - "" DEBUG_CR - "" DEBUG_CR - "" DEBUG_CR - "" DEBUG_CR - "" DEBUG_CR; - - return supported; -} - -/* --------------------------------------------------------------- -** -** General lock functions -** -*/ - -/* --------------------------------------------------------------- -** -** Functions dealing with lock-null resources -** -*/ - -/* -** dav_fs_load_locknull_list: Returns a dav_buffer dump of the locknull file -** for the given directory. -*/ -static dav_error * dav_fs_load_locknull_list(pool *p, const char *dirpath, - dav_buffer *pbuf) -{ - struct stat finfo; - int fd; - dav_error *err = NULL; - - dav_buffer_init(p, pbuf, dirpath); - - if (pbuf->buf[pbuf->cur_len - 1] == '/') - pbuf->buf[--pbuf->cur_len] = '\0'; - - dav_buffer_place(p, pbuf, "/" DAV_FS_STATE_DIR "/" DAV_FS_LOCK_NULL_FILE); - - /* reset this in case we leave w/o reading into the buffer */ - pbuf->cur_len = 0; - - if ((fd = open(pbuf->buf, O_RDONLY | O_BINARY)) == -1) { - return NULL; - } - - if (fstat(fd, &finfo) == -1) { - err = dav_new_error(p, HTTP_INTERNAL_SERVER_ERROR, 0, - ap_psprintf(p, - "Opened but could not stat file %s", - pbuf->buf)); - goto loaderror; - } - - dav_set_bufsize(p, pbuf, finfo.st_size); - if (read(fd, pbuf->buf, finfo.st_size) != finfo.st_size) { - err = dav_new_error(p, HTTP_INTERNAL_SERVER_ERROR, 0, - ap_psprintf(p, - "Failure reading locknull file " - "for %s", dirpath)); - - /* just in case the caller disregards the returned error */ - pbuf->cur_len = 0; - goto loaderror; - } - - loaderror: - close(fd); - return err; -} - -/* -** dav_fs_save_locknull_list: Saves contents of pbuf into the -** locknull file for dirpath. -*/ -static dav_error * dav_fs_save_locknull_list(pool *p, const char *dirpath, - dav_buffer *pbuf) -{ - const char *pathname; - int fd; - dav_error *err = NULL; - - if (pbuf->buf == NULL) - return NULL; - - dav_fs_ensure_state_dir(p, dirpath); - pathname = ap_pstrcat(p, - dirpath, - dirpath[strlen(dirpath) - 1] == '/' ? "" : "/", - DAV_FS_STATE_DIR "/" DAV_FS_LOCK_NULL_FILE, - NULL); - - if (pbuf->cur_len == 0) { - /* delete the file if cur_len == 0 */ - if (remove(pathname) != 0) { - return dav_new_error(p, HTTP_INTERNAL_SERVER_ERROR, 0, - ap_psprintf(p, - "Error removing %s", pathname)); - } - return NULL; - } - - if ((fd = open(pathname, O_WRONLY | O_CREAT | O_TRUNC | O_BINARY, - DAV_FS_MODE_FILE)) == -1) { - return dav_new_error(p, HTTP_INTERNAL_SERVER_ERROR, 0, - ap_psprintf(p, - "Error opening %s for writing", - pathname)); - } - - if (write(fd, pbuf->buf, pbuf->cur_len) != pbuf->cur_len) { - err = dav_new_error(p, HTTP_INTERNAL_SERVER_ERROR, 0, - ap_psprintf(p, - "Error writing %i bytes to %s", - pbuf->cur_len, pathname)); - } - - close(fd); - return err; -} - -/* -** dav_fs_remove_locknull_member: Removes filename from the locknull list -** for directory path. -*/ -static dav_error * dav_fs_remove_locknull_member(pool *p, const char *filename, - dav_buffer *pbuf) -{ - dav_error *err; - size_t len; - size_t scanlen; - char *scan; - const char *scanend; - char *dirpath = ap_pstrdup(p, filename); - char *fname = strrchr(dirpath, '/'); - int dirty = 0; - - if (fname != NULL) - *fname++ = '\0'; - else - fname = dirpath; - len = strlen(fname) + 1; - - if ((err = dav_fs_load_locknull_list(p, dirpath, pbuf)) != NULL) { - /* ### add a higher level description? */ - return err; - } - - for (scan = pbuf->buf, scanend = scan + pbuf->cur_len; - scan < scanend; - scan += scanlen) { - scanlen = strlen(scan) + 1; - if (len == scanlen && memcmp(fname, scan, scanlen) == 0) { - pbuf->cur_len -= scanlen; - memmove(scan, scan + scanlen, scanend - (scan + scanlen)); - dirty = 1; - break; - } - } - - if (dirty) { - if ((err = dav_fs_save_locknull_list(p, dirpath, pbuf)) != NULL) { - /* ### add a higher level description? */ - return err; - } - } - - return NULL; -} - -/* Note: used by dav_fs_repos.c */ -dav_error * dav_fs_get_locknull_members( - const dav_resource *resource, - dav_buffer *pbuf) -{ - const char *dirpath; - - dav_fs_dir_file_name(resource, &dirpath, NULL); - return dav_fs_load_locknull_list(dav_fs_pool(resource), dirpath, pbuf); -} - -/* ### fold into append_lock? */ -/* ### take an optional buf parameter? */ -static dav_error * dav_fs_add_locknull_state( - dav_lockdb *lockdb, - const dav_resource *resource) -{ - dav_buffer buf = { 0 }; - pool *p = lockdb->info->pool; - const char *dirpath; - const char *fname; - dav_error *err; - - dav_fs_dir_file_name(resource, &dirpath, &fname); - - if ((err = dav_fs_load_locknull_list(p, dirpath, &buf)) != NULL) { - return dav_push_error(p, HTTP_INTERNAL_SERVER_ERROR, 0, - "Could not load .locknull file.", err); - } - - dav_buffer_append(p, &buf, fname); - buf.cur_len++; /* we want the null-term here */ - - if ((err = dav_fs_save_locknull_list(p, dirpath, &buf)) != NULL) { - return dav_push_error(p, HTTP_INTERNAL_SERVER_ERROR, 0, - "Could not save .locknull file.", err); - } - - return NULL; -} - -/* -** dav_fs_remove_locknull_state: Given a request, check to see if r->filename -** is/was a lock-null resource. If so, return it to an existant state. -** -** ### this function is broken... it doesn't check! -** -** In this implementation, this involves two things: -** (a) remove it from the list in the appropriate .DAV/locknull file -** (b) on *nix, convert the key from a filename to an inode. -*/ -static dav_error * dav_fs_remove_locknull_state( - dav_lockdb *lockdb, - const dav_resource *resource) -{ - dav_buffer buf = { 0 }; - dav_error *err; - pool *p = lockdb->info->pool; - const char *pathname = dav_fs_pathname(resource); - - if ((err = dav_fs_remove_locknull_member(p, pathname, &buf)) != NULL) { - /* ### add a higher-level description? */ - return err; - } - -#ifndef WIN32 - { - dav_lock_discovery *ld; - dav_lock_indirect *id; - dav_datum key; - - /* - ** Fetch the lock(s) that made the resource lock-null. Remove - ** them under the filename key. Obtain the new inode key, and - ** save the same lock information under it. - */ - key = dav_fs_build_fname_key(p, pathname); - if ((err = dav_fs_load_lock_record(lockdb, key, DAV_CREATE_LIST, - &ld, &id)) != NULL) { - /* ### insert a higher-level error description */ - return err; - } - - if ((err = dav_fs_save_lock_record(lockdb, key, NULL, NULL)) != NULL) { - /* ### insert a higher-level error description */ - return err; - } - - key = dav_fs_build_key(p, resource); - if ((err = dav_fs_save_lock_record(lockdb, key, ld, id)) != NULL) { - /* ### insert a higher-level error description */ - return err; - } - } -#endif - - return NULL; -} - -static dav_error * dav_fs_create_lock(dav_lockdb *lockdb, - const dav_resource *resource, - dav_lock **lock) -{ - dav_datum key; - - key = dav_fs_build_key(lockdb->info->pool, resource); - - *lock = dav_fs_alloc_lock(lockdb, - key, - NULL); - - (*lock)->is_locknull = !resource->exists; - - return NULL; -} - -static dav_error * dav_fs_get_locks(dav_lockdb *lockdb, - const dav_resource *resource, - int calltype, - dav_lock **locks) -{ - pool *p = lockdb->info->pool; - dav_datum key; - dav_error *err; - dav_lock *lock = NULL; - dav_lock *newlock; - dav_lock_discovery *dp; - dav_lock_indirect *ip; - -#if DAV_DEBUG - if (calltype == DAV_GETLOCKS_COMPLETE) { - return dav_new_error(lockdb->info->pool, - HTTP_INTERNAL_SERVER_ERROR, 0, - "INTERNAL DESIGN ERROR: DAV_GETLOCKS_COMPLETE " - "is not yet supported"); - } -#endif - - key = dav_fs_build_key(p, resource); - if ((err = dav_fs_load_lock_record(lockdb, key, DAV_CREATE_LIST, - &dp, &ip)) != NULL) { - /* ### push a higher-level desc? */ - return err; - } - - /* copy all direct locks to the result list */ - for (; dp != NULL; dp = dp->next) { - newlock = dav_fs_alloc_lock(lockdb, key, dp->locktoken); - newlock->is_locknull = !resource->exists; - newlock->scope = dp->f.scope; - newlock->type = dp->f.type; - newlock->depth = dp->f.depth; - newlock->timeout = dp->f.timeout; - newlock->owner = dp->owner; - newlock->auth_user = dp->auth_user; - - /* hook into the result list */ - newlock->next = lock; - lock = newlock; - } - - /* copy all the indirect locks to the result list. resolve as needed. */ - for (; ip != NULL; ip = ip->next) { - newlock = dav_fs_alloc_lock(lockdb, ip->key, ip->locktoken); - newlock->is_locknull = !resource->exists; - - if (calltype == DAV_GETLOCKS_RESOLVED) { - if ((err = dav_fs_resolve(lockdb, ip, &dp, NULL, NULL)) != NULL) { - /* ### push a higher-level desc? */ - return err; - } - - newlock->scope = dp->f.scope; - newlock->type = dp->f.type; - newlock->depth = dp->f.depth; - newlock->timeout = dp->f.timeout; - newlock->owner = dp->owner; - newlock->auth_user = dp->auth_user; - } - else { - /* DAV_GETLOCKS_PARTIAL */ - newlock->rectype = DAV_LOCKREC_INDIRECT_PARTIAL; - } - - /* hook into the result list */ - newlock->next = lock; - lock = newlock; - } - - *locks = lock; - return NULL; -} - -static dav_error * dav_fs_find_lock(dav_lockdb *lockdb, - const dav_resource *resource, - const dav_locktoken *locktoken, - int partial_ok, - dav_lock **lock) -{ - dav_error *err; - dav_datum key; - dav_lock_discovery *dp; - dav_lock_indirect *ip; - - *lock = NULL; - - key = dav_fs_build_key(lockdb->info->pool, resource); - if ((err = dav_fs_load_lock_record(lockdb, key, DAV_CREATE_LIST, - &dp, &ip)) != NULL) { - /* ### push a higher-level desc? */ - return err; - } - - for (; dp != NULL; dp = dp->next) { - if (!dav_compare_opaquelocktoken(locktoken->uuid, - dp->locktoken->uuid)) { - *lock = dav_fs_alloc_lock(lockdb, key, locktoken); - (*lock)->is_locknull = !resource->exists; - (*lock)->scope = dp->f.scope; - (*lock)->type = dp->f.type; - (*lock)->depth = dp->f.depth; - (*lock)->timeout = dp->f.timeout; - (*lock)->owner = dp->owner; - (*lock)->auth_user = dp->auth_user; - return NULL; - } - } - - for (; ip != NULL; ip = ip->next) { - if (!dav_compare_opaquelocktoken(locktoken->uuid, - ip->locktoken->uuid)) { - *lock = dav_fs_alloc_lock(lockdb, ip->key, locktoken); - (*lock)->is_locknull = !resource->exists; - - /* ### nobody uses the resolving right now! */ - if (partial_ok) { - (*lock)->rectype = DAV_LOCKREC_INDIRECT_PARTIAL; - } - else { - (*lock)->rectype = DAV_LOCKREC_INDIRECT; - if ((err = dav_fs_resolve(lockdb, ip, &dp, - NULL, NULL)) != NULL) { - /* ### push a higher-level desc? */ - return err; - } - (*lock)->scope = dp->f.scope; - (*lock)->type = dp->f.type; - (*lock)->depth = dp->f.depth; - (*lock)->timeout = dp->f.timeout; - (*lock)->owner = dp->owner; - (*lock)->auth_user = dp->auth_user; - } - return NULL; - } - } - - return NULL; -} - -static dav_error * dav_fs_has_locks(dav_lockdb *lockdb, - const dav_resource *resource, - int *locks_present) -{ - dav_error *err; - dav_datum key; - - *locks_present = 0; - - if ((err = dav_fs_really_open_lockdb(lockdb)) != NULL) { - /* ### insert a higher-level error description */ - return err; - } - - /* - ** If we opened readonly and the db wasn't there, then there are no - ** locks for this resource. Just exit. - */ - if (lockdb->info->db == NULL) - return NULL; - - key = dav_fs_build_key(lockdb->info->pool, resource); - - *locks_present = (*dav_hooks_db_dbm.exists)(lockdb->info->db, key); - - return NULL; -} - -static dav_error * dav_fs_append_locks(dav_lockdb *lockdb, - const dav_resource *resource, - int make_indirect, - const dav_lock *lock) -{ - pool *p = lockdb->info->pool; - dav_error *err; - dav_lock_indirect *ip; - dav_lock_discovery *dp; - dav_datum key; - - key = dav_fs_build_key(lockdb->info->pool, resource); - if ((err = dav_fs_load_lock_record(lockdb, key, 0, &dp, &ip)) != NULL) { - /* ### maybe add in a higher-level description */ - return err; - } - - /* - ** ### when we store the lock more directly, we need to update - ** ### lock->rectype and lock->is_locknull - */ - - if (make_indirect) { - for (; lock != NULL; lock = lock->next) { - - /* ### this works for any rectype */ - dav_lock_indirect *newi = ap_pcalloc(p, sizeof(*newi)); - - /* ### shut off the const warning for now */ - newi->locktoken = (dav_locktoken *)lock->locktoken; - newi->timeout = lock->timeout; - newi->key = lock->info->key; - newi->next = ip; - ip = newi; - } - } - else { - for (; lock != NULL; lock = lock->next) { - /* create and link in the right kind of lock */ - - if (lock->rectype == DAV_LOCKREC_DIRECT) { - dav_lock_discovery *newd = ap_pcalloc(p, sizeof(*newd)); - - newd->f.scope = lock->scope; - newd->f.type = lock->type; - newd->f.depth = lock->depth; - newd->f.timeout = lock->timeout; - /* ### shut off the const warning for now */ - newd->locktoken = (dav_locktoken *)lock->locktoken; - newd->owner = lock->owner; - newd->auth_user = lock->auth_user; - newd->next = dp; - dp = newd; - } - else { - /* DAV_LOCKREC_INDIRECT(_PARTIAL) */ - - dav_lock_indirect *newi = ap_pcalloc(p, sizeof(*newi)); - - /* ### shut off the const warning for now */ - newi->locktoken = (dav_locktoken *)lock->locktoken; - newi->key = lock->info->key; - newi->next = ip; - ip = newi; - } - } - } - - if ((err = dav_fs_save_lock_record(lockdb, key, dp, ip)) != NULL) { - /* ### maybe add a higher-level description */ - return err; - } - - /* we have a special list for recording locknull resources */ - /* ### ack! this can add two copies to the locknull list */ - if (!resource->exists - && (err = dav_fs_add_locknull_state(lockdb, resource)) != NULL) { - /* ### maybe add a higher-level description */ - return err; - } - - return NULL; -} - -static dav_error * dav_fs_remove_lock(dav_lockdb *lockdb, - const dav_resource *resource, - const dav_locktoken *locktoken) -{ - dav_error *err; - dav_buffer buf = { 0 }; - dav_lock_discovery *dh = NULL; - dav_lock_indirect *ih = NULL; - dav_datum key; - - key = dav_fs_build_key(lockdb->info->pool, resource); - - if (locktoken != NULL) { - dav_lock_discovery *dp; - dav_lock_discovery *dprev = NULL; - dav_lock_indirect *ip; - dav_lock_indirect *iprev = NULL; - - if ((err = dav_fs_load_lock_record(lockdb, key, DAV_CREATE_LIST, - &dh, &ih)) != NULL) { - /* ### maybe add a higher-level description */ - return err; - } - - for (dp = dh; dp != NULL; dp = dp->next) { - if (dav_compare_opaquelocktoken(locktoken->uuid, - dp->locktoken->uuid) == 0) { - if (dprev) - dprev->next = dp->next; - else - dh = dh->next; - } - dprev = dp; - } - - for (ip = ih; ip != NULL; ip = ip->next) { - if (dav_compare_opaquelocktoken(locktoken->uuid, - ip->locktoken->uuid) == 0) { - if (iprev) - iprev->next = ip->next; - else - ih = ih->next; - } - iprev = ip; - } - - } - - /* save the modified locks, or remove all locks (dh=ih=NULL). */ - if ((err = dav_fs_save_lock_record(lockdb, key, dh, ih)) != NULL) { - /* ### maybe add a higher-level description */ - return err; - } - - /* - ** If this resource is a locknull resource AND no more locks exist, - ** then remove the locknull member. - ** - ** Note: remove_locknull_state() attempts to convert a locknull member - ** to a real member. In this case, all locks are gone, so the - ** locknull resource returns to the null state (ie. doesn't exist), - ** so there is no need to update the lockdb (and it won't find - ** any because a precondition is that none exist). - */ - if (!resource->exists && dh == NULL && ih == NULL - && (err = dav_fs_remove_locknull_member(lockdb->info->pool, - dav_fs_pathname(resource), - &buf)) != NULL) { - /* ### maybe add a higher-level description */ - return err; - } - - return NULL; -} - -static int dav_fs_do_refresh(dav_lock_discovery *dp, - const dav_locktoken_list *ltl, - time_t new_time) -{ - int dirty = 0; - - for (; ltl != NULL; ltl = ltl->next) { - if (dav_compare_opaquelocktoken(dp->locktoken->uuid, - ltl->locktoken->uuid) == 0) - { - dp->f.timeout = new_time; - dirty = 1; - } - } - - return dirty; -} - -static dav_error * dav_fs_refresh_locks(dav_lockdb *lockdb, - const dav_resource *resource, - const dav_locktoken_list *ltl, - time_t new_time, - dav_lock **locks) -{ - dav_error *err; - dav_datum key; - dav_lock_discovery *dp; - dav_lock_discovery *dp_scan; - dav_lock_indirect *ip; - int dirty = 0; - dav_lock *newlock; - - *locks = NULL; - - key = dav_fs_build_key(lockdb->info->pool, resource); - if ((err = dav_fs_load_lock_record(lockdb, key, DAV_CREATE_LIST, - &dp, &ip)) != NULL) { - /* ### maybe add in a higher-level description */ - return err; - } - - /* ### we should be refreshing direct AND (resolved) indirect locks! */ - - /* refresh all of the direct locks on this resource */ - for (dp_scan = dp; dp_scan != NULL; dp_scan = dp_scan->next) { - if (dav_fs_do_refresh(dp_scan, ltl, new_time)) { - /* the lock was refreshed. return the lock. */ - newlock = dav_fs_alloc_lock(lockdb, key, dp_scan->locktoken); - newlock->is_locknull = !resource->exists; - newlock->scope = dp_scan->f.scope; - newlock->type = dp_scan->f.type; - newlock->depth = dp_scan->f.depth; - newlock->timeout = dp_scan->f.timeout; - newlock->owner = dp_scan->owner; - newlock->auth_user = dp_scan->auth_user; - - newlock->next = *locks; - *locks = newlock; - - dirty = 1; - } - } - - /* if we refreshed any locks, then save them back. */ - if (dirty - && (err = dav_fs_save_lock_record(lockdb, key, dp, ip)) != NULL) { - /* ### maybe add in a higher-level description */ - return err; - } - - /* for each indirect lock, find its direct lock and refresh it. */ - for (; ip != NULL; ip = ip->next) { - dav_lock_discovery *ref_dp; - dav_lock_indirect *ref_ip; - - if ((err = dav_fs_resolve(lockdb, ip, &dp_scan, - &ref_dp, &ref_ip)) != NULL) { - /* ### push a higher-level desc? */ - return err; - } - if (dav_fs_do_refresh(dp_scan, ltl, new_time)) { - /* the lock was refreshed. return the lock. */ - newlock = dav_fs_alloc_lock(lockdb, ip->key, dp->locktoken); - newlock->is_locknull = !resource->exists; - newlock->scope = dp->f.scope; - newlock->type = dp->f.type; - newlock->depth = dp->f.depth; - newlock->timeout = dp->f.timeout; - newlock->owner = dp->owner; - newlock->auth_user = dp_scan->auth_user; - - newlock->next = *locks; - *locks = newlock; - - /* save the (resolved) direct lock back */ - if ((err = dav_fs_save_lock_record(lockdb, ip->key, ref_dp, - ref_ip)) != NULL) { - /* ### push a higher-level desc? */ - return err; - } - } - } - - return NULL; -} - - -const dav_hooks_locks dav_hooks_locks_fs = -{ - dav_fs_get_supportedlock, - dav_fs_parse_locktoken, - dav_fs_format_locktoken, - dav_fs_compare_locktoken, - dav_fs_open_lockdb, - dav_fs_close_lockdb, - dav_fs_remove_locknull_state, - dav_fs_create_lock, - dav_fs_get_locks, - dav_fs_find_lock, - dav_fs_has_locks, - dav_fs_append_locks, - dav_fs_remove_lock, - dav_fs_refresh_locks, - NULL, /* get_resource */ -}; diff --git a/modules/dav/fs/mod_dav_fs.c b/modules/dav/fs/mod_dav_fs.c deleted file mode 100644 index 0fc9fecd05eb1080d74f9024df5adf32c49fda11..0000000000000000000000000000000000000000 --- a/modules/dav/fs/mod_dav_fs.c +++ /dev/null @@ -1,137 +0,0 @@ -/* ==================================================================== - * The Apache Software License, Version 1.1 - * - * Copyright (c) 2000 The Apache Software Foundation. All rights - * reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in - * the documentation and/or other materials provided with the - * distribution. - * - * 3. The end-user documentation included with the redistribution, - * if any, must include the following acknowledgment: - * "This product includes software developed by the - * Apache Software Foundation (http://www.apache.org/)." - * Alternately, this acknowledgment may appear in the software itself, - * if and wherever such third-party acknowledgments normally appear. - * - * 4. The names "Apache" and "Apache Software Foundation" must - * not be used to endorse or promote products derived from this - * software without prior written permission. For written - * permission, please contact apache@apache.org. - * - * 5. Products derived from this software may not be called "Apache", - * nor may "Apache" appear in their name, without prior written - * permission of the Apache Software Foundation. - * - * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED - * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES - * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR - * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF - * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND - * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, - * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT - * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * ==================================================================== - * - * This software consists of voluntary contributions made by many - * individuals on behalf of the Apache Software Foundation. For more - * information on the Apache Software Foundation, please see - * . - */ - -#include "httpd.h" -#include "http_config.h" - -#include "mod_dav.h" -#include "repos.h" - -/* per-server configuration */ -typedef struct { - const char *lockdb_path; - -} dav_fs_server_conf; - -extern module MODULE_VAR_EXPORT dav_fs_module; - -const char *dav_get_lockdb_path(const request_rec *r) -{ - dav_fs_server_conf *conf; - - conf = ap_get_module_config(r->server->module_config, &dav_fs_module); - return conf->lockdb_path; -} - -static void *dav_fs_create_server_config(ap_pool_t *p, server_rec *s) -{ - return ap_pcalloc(p, sizeof(dav_fs_server_conf)); -} - -static void *dav_fs_merge_server_config(ap_pool_t *p, - void *base, void *overrides) -{ - dav_fs_server_conf *parent = base; - dav_fs_server_conf *child = overrides; - dav_fs_server_conf *newconf; - - newconf = ap_pcalloc(p, sizeof(*newconf)); - - newconf->lockdb_path = - child->lockdb_path ? child->lockdb_path : parent->lockdb_path; - - return newconf; -} - -/* - * Command handler for the DAVLockDB directive, which is TAKE1 - */ -static const char *dav_fs_cmd_davlockdb(cmd_parms *cmd, void *config, - const char *arg1) -{ - dav_fs_server_conf *conf; - - conf = ap_get_module_config(cmd->server->module_config, - &dav_fs_module); - arg1 = ap_os_canonical_filename(cmd->pool, arg1); - conf->lockdb_path = ap_server_root_relative(cmd->pool, arg1); - - return NULL; -} - -static const command_rec dav_fs_cmds[] = -{ - /* per server */ - AP_INIT_TAKE1("DAVLockDB", dav_fs_cmd_davlockdb, NULL, RSRC_CONF, - "specify a lock database"), - - { NULL } -}; - -static void register_hooks(void) -{ - /* nothing yet */ -} - -module MODULE_VAR_EXPORT dav_fs_module = -{ - STANDARD20_MODULE_STUFF, - NULL, /* dir config creater */ - NULL, /* dir merger --- default is to override */ - dav_fs_create_server_config, /* server config */ - dav_fs_merge_server_config, /* merge server config */ - dav_fs_cmds, /* command table */ - NULL, /* handlers */ - register_hooks, /* register hooks */ -}; diff --git a/modules/dav/fs/mod_dav_fs.dsp b/modules/dav/fs/mod_dav_fs.dsp deleted file mode 100644 index ac52774d5a0975a8f38062e84ef4d0b8844186b0..0000000000000000000000000000000000000000 --- a/modules/dav/fs/mod_dav_fs.dsp +++ /dev/null @@ -1,120 +0,0 @@ -# Microsoft Developer Studio Project File - Name="mod_dav_fs" - Package Owner=<4> -# Microsoft Developer Studio Generated Build File, Format Version 6.00 -# ** DO NOT EDIT ** - -# TARGTYPE "Win32 (x86) Dynamic-Link Library" 0x0102 - -CFG=mod_dav_fs - Win32 Release -!MESSAGE This is not a valid makefile. To build this project using NMAKE, -!MESSAGE use the Export Makefile command and run -!MESSAGE -!MESSAGE NMAKE /f "mod_dav_fs.mak". -!MESSAGE -!MESSAGE You can specify a configuration when running NMAKE -!MESSAGE by defining the macro CFG on the command line. For example: -!MESSAGE -!MESSAGE NMAKE /f "mod_dav_fs.mak" CFG="mod_dav_fs - Win32 Release" -!MESSAGE -!MESSAGE Possible choices for configuration are: -!MESSAGE -!MESSAGE "mod_dav_fs - Win32 Release" (based on "Win32 (x86) Dynamic-Link Library") -!MESSAGE "mod_dav_fs - Win32 Debug" (based on "Win32 (x86) Dynamic-Link Library") -!MESSAGE - -# Begin Project -# PROP AllowPerConfigDependencies 0 -# PROP Scc_ProjName "" -# PROP Scc_LocalPath "" -CPP=cl.exe -MTL=midl.exe -RSC=rc.exe - -!IF "$(CFG)" == "mod_dav_fs - Win32 Release" - -# PROP BASE Use_MFC 0 -# PROP BASE Use_Debug_Libraries 0 -# PROP BASE Output_Dir ".\ApacheMo" -# PROP BASE Intermediate_Dir ".\ApacheMo" -# PROP BASE Target_Dir "" -# PROP Use_MFC 0 -# PROP Use_Debug_Libraries 0 -# PROP Output_Dir ".\mod_dav_fsR" -# PROP Intermediate_Dir ".\mod_dav_fsR" -# PROP Ignore_Export_Lib 0 -# PROP Target_Dir "" -# ADD BASE CPP /nologo /MT /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /YX /c -# ADD CPP /nologo /MD /W3 /GX /O2 /I "..\..\modules\dav\main" /I "..\..\lib\sdbm" /I "..\..\lib\expat-lite" /I "..\..\lib\apr\include" /I "..\..\include" /I "..\..\os\win32" /D "NDEBUG" /D "WIN32" /D "_WINDOWS" /D "SHARED_MODULE" /YX /FD /c -# ADD BASE MTL /nologo /D "NDEBUG" /win32 -# ADD MTL /nologo /D "NDEBUG" /mktyplib203 /win32 -# ADD BASE RSC /l 0x809 /d "NDEBUG" -# ADD RSC /l 0x809 /d "NDEBUG" -BSC32=bscmake.exe -# ADD BASE BSC32 /nologo -# ADD BSC32 /nologo -LINK32=link.exe -# ADD BASE LINK32 ApacheCore.lib aprlib.lib kernel32.lib ws2_32.lib mswsock.lib /nologo /subsystem:windows /dll /map /machine:I386 /libpath:"..\..\CoreR" /libpath:"..\..\lib\apr\Release" /base:@BaseAddr.ref,mod_dav_fs -# ADD LINK32 ApacheCore.lib aprlib.lib kernel32.lib ws2_32.lib mswsock.lib /nologo /subsystem:windows /dll /map /machine:I386 /libpath:"..\..\CoreR" /libpath:"..\..\lib\apr\Release" /base:@BaseAddr.ref,mod_dav_fs - -!ELSEIF "$(CFG)" == "mod_dav_fs - Win32 Debug" - -# PROP BASE Use_MFC 0 -# PROP BASE Use_Debug_Libraries 1 -# PROP BASE Output_Dir ".\ApacheM0" -# PROP BASE Intermediate_Dir ".\ApacheM0" -# PROP BASE Target_Dir "" -# PROP Use_MFC 0 -# PROP Use_Debug_Libraries 1 -# PROP Output_Dir ".\mod_dav_fsD" -# PROP Intermediate_Dir ".\mod_dav_fsD" -# PROP Ignore_Export_Lib 0 -# PROP Target_Dir "" -# ADD BASE CPP /nologo /MTd /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /YX /c -# ADD CPP /nologo /MDd /W3 /Gm /GX /ZI /Od /I "..\..\modules\dav\main" /I "..\..\lib\sdbm" /I "..\..\lib\expat-lite" /I "..\..\lib\apr\include" /I "..\..\include" /I "..\..\os\win32" /D "_DEBUG" /D "WIN32" /D "_WINDOWS" /D "SHARED_MODULE" /YX /FD /c -# ADD BASE MTL /nologo /D "_DEBUG" /win32 -# ADD MTL /nologo /D "_DEBUG" /mktyplib203 /win32 -# ADD BASE RSC /l 0x809 /d "_DEBUG" -# ADD RSC /l 0x809 /d "_DEBUG" -BSC32=bscmake.exe -# ADD BASE BSC32 /nologo -# ADD BSC32 /nologo -LINK32=link.exe -# ADD BASE LINK32 ApacheCore.lib aprlib.lib kernel32.lib ws2_32.lib mswsock.lib /nologo /subsystem:windows /dll /map /debug /machine:I386 /libpath:"..\..\CoreD" /libpath:"..\..\lib\apr\Debug" /base:@BaseAddr.ref,mod_dav_fs -# ADD LINK32 ApacheCore.lib aprlib.lib kernel32.lib ws2_32.lib mswsock.lib /nologo /subsystem:windows /dll /debug /machine:I386 /libpath:"..\..\CoreD" /libpath:"..\..\lib\apr\Debug" /base:@BaseAddr.ref,mod_dav_fs -# SUBTRACT LINK32 /incremental:no /map - -!ENDIF - -# Begin Target - -# Name "mod_dav_fs - Win32 Release" -# Name "mod_dav_fs - Win32 Debug" -# Begin Group "Source Files" - -# PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;hpj;bat;for;f90" -# Begin Source File - -SOURCE=..\..\modules\dav\fs\dbm.c -# End Source File -# Begin Source File - -SOURCE=..\..\modules\dav\fs\lock.c -# End Source File -# Begin Source File - -SOURCE=..\..\modules\dav\fs\mod_dav_fs.c -# End Source File -# Begin Source File - -SOURCE=..\..\modules\dav\fs\repos.c -# End Source File -# End Group -# Begin Group "Header Files" - -# PROP Default_Filter "h;hpp;hxx;hm;inl;fi;fd" -# Begin Source File - -SOURCE=..\..\modules\dav\fs\repos.h -# End Source File -# End Group -# End Target -# End Project diff --git a/modules/dav/fs/repos.c b/modules/dav/fs/repos.c deleted file mode 100644 index 26471ac901e872d33dbb3f40cdc43d12d3ece233..0000000000000000000000000000000000000000 --- a/modules/dav/fs/repos.c +++ /dev/null @@ -1,2007 +0,0 @@ -/* -** Copyright (C) 1998-2000 Greg Stein. All Rights Reserved. -** -** By using this file, you agree to the terms and conditions set forth in -** the LICENSE.html file which can be found at the top level of the mod_dav -** distribution or at http://www.webdav.org/mod_dav/license-1.html. -** -** Contact information: -** Greg Stein, PO Box 760, Palo Alto, CA, 94302 -** gstein@lyra.org, http://www.webdav.org/mod_dav/ -** -*/ - -/* -** DAV filesystem-based repository provider -** -** Written 08/99 by John Vasta, vasta@rational.com, by separating -** mod_dav into repository-independent and provider modules. -*/ - -#include - -#include "httpd.h" -#include "http_log.h" -#include "http_protocol.h" /* for ap_set_* (in dav_fs_set_headers) */ -#include "http_request.h" /* for ap_update_mtime() */ - -#include "mod_dav.h" -#include "dav_fs_repos.h" - - -/* to assist in debugging mod_dav's GET handling */ -#define DEBUG_GET_HANDLER 0 -#define DEBUG_PATHNAME_STYLE 0 - -#define DAV_FS_COPY_BLOCKSIZE 16384 /* copy 16k at a time */ - -/* context needed to identify a resource */ -struct dav_resource_private { - pool *pool; /* memory storage pool associated with request */ - const char *pathname; /* full pathname to resource */ - struct stat finfo; /* filesystem info */ -}; - -/* private context for doing a filesystem walk */ -typedef struct { - dav_walker_ctx *wctx; - - dav_resource res1; - dav_resource res2; - dav_resource_private info1; - dav_resource_private info2; - dav_buffer path1; - dav_buffer path2; - - dav_buffer locknull_buf; - -} dav_fs_walker_context; - -/* pull this in from the other source file */ -extern const dav_hooks_locks dav_hooks_locks_fs; - -/* forward-declare this sucker */ -static const dav_hooks_repository dav_hooks_repository_fs; - -/* -** The Provider ID is used to differentiate "logical" providers that use -** the same set of hook functions. Essentially, the ID is an instance -** handle and the hooks are a vtable. -** -** In this module, we only have a single provider for each type, so we -** actually ignore the Provider ID. -*/ -#define DAV_FS_PROVIDER_ID 0 - -/* -** The namespace URIs that we use. This list and the enumeration must -** stay in sync. -*/ -static const char * const dav_fs_namespace_uris[] = -{ - "DAV:", - "http://apache.org/dav/props/", - - NULL /* sentinel */ -}; -enum { - DAV_FS_URI_DAV, /* the DAV: namespace URI */ - DAV_FS_URI_MYPROPS /* the namespace URI for our custom props */ -}; - -/* -** The properties that we define. -*/ -enum { - /* using DAV_FS_URI_DAV */ - DAV_PROPID_FS_creationdate = DAV_PROPID_FS, - DAV_PROPID_FS_displayname, - DAV_PROPID_FS_getcontentlength, - DAV_PROPID_FS_getetag, - DAV_PROPID_FS_getlastmodified, - DAV_PROPID_FS_source, - - /* using DAV_FS_URI_MYPROPS */ - DAV_PROPID_FS_executable -}; -/* NOTE: the magic "200" is derived from the ranges in mod_dav.h */ -#define DAV_PROPID_FS_OURS(id) (DAV_PROPID_FS <= (id) && \ - (id) < DAV_PROPID_FS + 200) - -typedef struct { - int ns; - const char * name; - - int propid; -} dav_fs_liveprop_name; - -static const dav_fs_liveprop_name dav_fs_props[] = -{ - { DAV_FS_URI_DAV, "creationdate", DAV_PROPID_FS_creationdate }, - { DAV_FS_URI_DAV, "getcontentlength", DAV_PROPID_FS_getcontentlength }, - { DAV_FS_URI_DAV, "getetag", DAV_PROPID_FS_getetag }, - { DAV_FS_URI_DAV, "getlastmodified", DAV_PROPID_FS_getlastmodified }, - - { DAV_FS_URI_MYPROPS, "executable", DAV_PROPID_FS_executable }, - - /* ### these aren't FS specific */ - { DAV_FS_URI_DAV, "displayname", DAV_PROPID_FS_displayname }, - { DAV_FS_URI_DAV, "source", DAV_PROPID_FS_source }, - - { 0 } /* sentinel */ -}; - - -/* define the dav_stream structure for our use */ -struct dav_stream { - pool *p; - int fd; - const char *pathname; /* we may need to remove it at close time */ -}; - -/* forward declaration for internal treewalkers */ -static dav_error * dav_fs_walk(dav_walker_ctx *wctx, int depth); - -/* -------------------------------------------------------------------- -** -** PRIVATE REPOSITORY FUNCTIONS -*/ -pool *dav_fs_pool(const dav_resource *resource) -{ - return resource->info->pool; -} - -const char *dav_fs_pathname(const dav_resource *resource) -{ - return resource->info->pathname; -} - -void dav_fs_dir_file_name( - const dav_resource *resource, - const char **dirpath_p, - const char **fname_p) -{ - dav_resource_private *ctx = resource->info; - - if (resource->collection) { - *dirpath_p = ctx->pathname; - if (fname_p != NULL) - *fname_p = NULL; - } - else { - char *dirpath = ap_make_dirstr_parent(ctx->pool, ctx->pathname); - size_t dirlen = strlen(dirpath); - - if (fname_p != NULL) - *fname_p = ctx->pathname + dirlen; - *dirpath_p = dirpath; - - /* remove trailing slash from dirpath, unless it's the root dir */ - /* ### Win32 check */ - if (dirlen > 1 && dirpath[dirlen - 1] == '/') { - dirpath[dirlen - 1] = '\0'; - } - } -} - -/* Note: picked up from ap_gm_timestr_822() */ -/* NOTE: buf must be at least DAV_TIMEBUF_SIZE chars in size */ -static void dav_format_time(int style, time_t sec, char *buf) -{ - struct tm *tms; - - tms = gmtime(&sec); - - if (style == DAV_STYLE_ISO8601) { - /* ### should we use "-00:00" instead of "Z" ?? */ - - /* 20 chars plus null term */ - sprintf(buf, "%.4d-%.2d-%.2dT%.2d:%.2d:%.2dZ", - tms->tm_year + 1900, tms->tm_mon + 1, tms->tm_mday, - tms->tm_hour, tms->tm_min, tms->tm_sec); - return; - } - - /* RFC 822 date format; as strftime '%a, %d %b %Y %T GMT' */ - - /* 29 chars plus null term */ - sprintf(buf, - "%s, %.2d %s %d %.2d:%.2d:%.2d GMT", - ap_day_snames[tms->tm_wday], - tms->tm_mday, ap_month_snames[tms->tm_mon], - tms->tm_year + 1900, - tms->tm_hour, tms->tm_min, tms->tm_sec); -} - -static int dav_sync_write(int fd, const char *buf, ssize_t bufsize) -{ - ssize_t amt; - - do { - amt = write(fd, buf, bufsize); - if (amt > 0) { - bufsize -= amt; - buf += amt; - } - } while (amt > 0 && bufsize > 0); - - return amt < 0 ? -1 : 0; -} - -static dav_error * dav_fs_copymove_file( - int is_move, - pool * p, - const char *src, - const char *dst, - dav_buffer *pbuf) -{ - dav_buffer work_buf = { 0 }; - int fdi; - int fdo; - - if (pbuf == NULL) - pbuf = &work_buf; - - dav_set_bufsize(p, pbuf, DAV_FS_COPY_BLOCKSIZE); - - if ((fdi = open(src, O_RDONLY | O_BINARY)) == -1) { - /* ### use something besides 500? */ - return dav_new_error(p, HTTP_INTERNAL_SERVER_ERROR, 0, - "Could not open file for reading"); - } - - /* ### do we need to deal with the umask? */ - if ((fdo = open(dst, O_WRONLY | O_CREAT | O_TRUNC | O_BINARY, - DAV_FS_MODE_FILE)) == -1) { - close(fdi); - - /* ### use something besides 500? */ - return dav_new_error(p, HTTP_INTERNAL_SERVER_ERROR, 0, - "Could not open file for writing"); - } - - while (1) { - ssize_t len = read(fdi, pbuf->buf, DAV_FS_COPY_BLOCKSIZE); - - if (len == -1) { - close(fdi); - close(fdo); - - if (remove(dst) != 0) { - /* ### ACK! Inconsistent state... */ - - /* ### use something besides 500? */ - return dav_new_error(p, HTTP_INTERNAL_SERVER_ERROR, 0, - "Could not delete output after read " - "failure. Server is now in an " - "inconsistent state."); - } - - /* ### use something besides 500? */ - return dav_new_error(p, HTTP_INTERNAL_SERVER_ERROR, 0, - "Could not read input file"); - } - if (len == 0) - break; - - if (dav_sync_write(fdo, pbuf->buf, len) != 0) { - int save_errno = errno; - - close(fdi); - close(fdo); - - if (remove(dst) != 0) { - /* ### ACK! Inconsistent state... */ - - /* ### use something besides 500? */ - return dav_new_error(p, HTTP_INTERNAL_SERVER_ERROR, 0, - "Could not delete output after write " - "failure. Server is now in an " - "inconsistent state."); - } - - if (save_errno == ENOSPC) { - return dav_new_error(p, HTTP_INSUFFICIENT_STORAGE, 0, - "There is not enough storage to write to " - "this resource."); - } - - /* ### use something besides 500? */ - return dav_new_error(p, HTTP_INTERNAL_SERVER_ERROR, 0, - "Could not write output file"); - } - } - - close(fdi); - close(fdo); - - if (is_move && remove(src) != 0) { - dav_error *err; - int save_errno = errno; /* save the errno that got us here */ - - if (remove(dst) != 0) { - /* ### ACK. this creates an inconsistency. do more!? */ - - /* ### use something besides 500? */ - /* Note that we use the latest errno */ - return dav_new_error(p, HTTP_INTERNAL_SERVER_ERROR, 0, - "Could not remove source or destination " - "file. Server is now in an inconsistent " - "state."); - } - - /* ### use something besides 500? */ - err = dav_new_error(p, HTTP_INTERNAL_SERVER_ERROR, 0, - "Could not remove source file after move. " - "Destination was removed to ensure consistency."); - err->save_errno = save_errno; - return err; - } - - return NULL; -} - -/* copy/move a file from within a state dir to another state dir */ -/* ### need more buffers to replace the pool argument */ -static dav_error * dav_fs_copymove_state( - int is_move, - pool * p, - const char *src_dir, const char *src_file, - const char *dst_dir, const char *dst_file, - dav_buffer *pbuf) -{ - struct stat src_finfo; /* finfo for source file */ - struct stat dst_state_finfo; /* finfo for STATE directory */ - const char *src; - const char *dst; - - /* build the propset pathname for the source file */ - src = ap_pstrcat(p, src_dir, "/" DAV_FS_STATE_DIR "/", src_file, NULL); - - /* the source file doesn't exist */ - if (stat(src, &src_finfo) != 0) { - return NULL; - } - - /* build the pathname for the destination state dir */ - dst = ap_pstrcat(p, dst_dir, "/" DAV_FS_STATE_DIR, NULL); - - /* ### do we need to deal with the umask? */ - - /* ensure that it exists */ - if (mkdir(dst, DAV_FS_MODE_DIR) != 0) { - if (errno != EEXIST) { - /* ### use something besides 500? */ - return dav_new_error(p, HTTP_INTERNAL_SERVER_ERROR, 0, - "Could not create internal state directory"); - } - } - - /* get info about the state directory */ - if (stat(dst, &dst_state_finfo) != 0) { - /* Ack! Where'd it go? */ - /* ### use something besides 500? */ - return dav_new_error(p, HTTP_INTERNAL_SERVER_ERROR, 0, - "State directory disappeared"); - } - - /* The mkdir() may have failed because a *file* exists there already */ - if (!S_ISDIR(dst_state_finfo.st_mode)) { - /* ### try to recover by deleting this file? (and mkdir again) */ - /* ### use something besides 500? */ - return dav_new_error(p, HTTP_INTERNAL_SERVER_ERROR, 0, - "State directory is actually a file"); - } - - /* append the target file to the state directory pathname */ - dst = ap_pstrcat(p, dst, "/", dst_file, NULL); - - /* copy/move the file now */ - if (is_move && src_finfo.st_dev == dst_state_finfo.st_dev) { - /* simple rename is possible since it is on the same device */ - if (rename(src, dst) != 0) { - /* ### use something besides 500? */ - return dav_new_error(p, HTTP_INTERNAL_SERVER_ERROR, 0, - "Could not move state file."); - } - } - else { - /* gotta copy (and delete) */ - return dav_fs_copymove_file(is_move, p, src, dst, pbuf); - } - - return NULL; -} - -static dav_error *dav_fs_copymoveset(int is_move, pool *p, - const dav_resource *src, - const dav_resource *dst, - dav_buffer *pbuf) -{ - const char *src_dir; - const char *src_file; - const char *src_state1; - const char *src_state2; - const char *dst_dir; - const char *dst_file; - const char *dst_state1; - const char *dst_state2; - dav_error *err; - - /* Get directory and filename for resources */ - dav_fs_dir_file_name(src, &src_dir, &src_file); - dav_fs_dir_file_name(dst, &dst_dir, &dst_file); - - /* Get the corresponding state files for each resource */ - dav_dbm_get_statefiles(p, src_file, &src_state1, &src_state2); - dav_dbm_get_statefiles(p, dst_file, &dst_state1, &dst_state2); -#if DAV_DEBUG - if ((src_state2 != NULL && dst_state2 == NULL) || - (src_state2 == NULL && dst_state2 != NULL)) { - return dav_new_error(p, HTTP_INTERNAL_SERVER_ERROR, 0, - "DESIGN ERROR: dav_dbm_get_statefiles() " - "returned inconsistent results."); - } -#endif - - err = dav_fs_copymove_state(is_move, p, - src_dir, src_state1, - dst_dir, dst_state1, - pbuf); - - if (err == NULL && src_state2 != NULL) { - err = dav_fs_copymove_state(is_move, p, - src_dir, src_state2, - dst_dir, dst_state2, - pbuf); - - if (err != NULL) { - /* ### CRAP. inconsistency. */ - /* ### should perform some cleanup at the target if we still - ### have the original files */ - - /* Change the error to reflect the bad server state. */ - err->status = HTTP_INTERNAL_SERVER_ERROR; - err->desc = - "Could not fully copy/move the properties. " - "The server is now in an inconsistent state."; - } - } - - return err; -} - -static dav_error *dav_fs_deleteset(pool *p, const dav_resource *resource) -{ - const char *dirpath; - const char *fname; - const char *state1; - const char *state2; - const char *pathname; - - /* Get directory, filename, and state-file names for the resource */ - dav_fs_dir_file_name(resource, &dirpath, &fname); - dav_dbm_get_statefiles(p, fname, &state1, &state2); - - /* build the propset pathname for the file */ - pathname = ap_pstrcat(p, - dirpath, - "/" DAV_FS_STATE_DIR "/", - state1, - NULL); - - /* note: we may get ENOENT if the state dir is not present */ - if (remove(pathname) != 0 && errno != ENOENT) { - return dav_new_error(p, HTTP_INTERNAL_SERVER_ERROR, 0, - "Could not remove properties."); - } - - if (state2 != NULL) { - /* build the propset pathname for the file */ - pathname = ap_pstrcat(p, - dirpath, - "/" DAV_FS_STATE_DIR "/", - state2, - NULL); - - if (remove(pathname) != 0 && errno != ENOENT) { - /* ### CRAP. only removed half. */ - return dav_new_error(p, HTTP_INTERNAL_SERVER_ERROR, 0, - "Could not fully remove properties. " - "The server is now in an inconsistent " - "state."); - } - } - - return NULL; -} - -/* -------------------------------------------------------------------- -** -** REPOSITORY HOOK FUNCTIONS -*/ - -static dav_resource * dav_fs_get_resource( - request_rec *r, - const char *root_dir, - const char *workspace) -{ - dav_resource_private *ctx; - dav_resource *resource; - char *s; - char *filename; - size_t len; - - /* ### optimize this into a single allocation! */ - - /* Create private resource context descriptor */ - ctx = ap_pcalloc(r->pool, sizeof(*ctx)); - ctx->pool = r->pool; - ctx->finfo = r->finfo; - - /* Preserve case on OSes which fold canonical filenames */ -#if MODULE_MAGIC_NUMBER_MAJOR > 19990320 || (MODULE_MAGIC_NUMBER_MAJOR == 19990320 && MODULE_MAGIC_NUMBER_MINOR >= 8) - filename = r->case_preserved_filename; -#else - filename = r->filename; -#endif - - /* - ** If there is anything in the path_info, then this indicates that the - ** entire path was not used to specify the file/dir. We want to append - ** it onto the filename so that we get a "valid" pathname for null - ** resources. - */ - s = ap_pstrcat(r->pool, filename, r->path_info, NULL); - - /* make sure the pathname does not have a trailing "/" */ - len = strlen(s); - if (len > 1 && s[len - 1] == '/') { - s[len - 1] = '\0'; - } - ctx->pathname = s; - - /* Create resource descriptor */ - resource = ap_pcalloc(r->pool, sizeof(*resource)); - resource->type = DAV_RESOURCE_TYPE_REGULAR; - resource->info = ctx; - resource->hooks = &dav_hooks_repository_fs; - - /* make sure the URI does not have a trailing "/" */ - len = strlen(r->uri); - if (len > 1 && r->uri[len - 1] == '/') { - s = ap_pstrdup(r->pool, r->uri); - s[len - 1] = '\0'; - resource->uri = s; - } - else { - resource->uri = r->uri; - } - - if (r->finfo.st_mode != 0) { - resource->exists = 1; - resource->collection = S_ISDIR(r->finfo.st_mode); - - /* unused info in the URL will indicate a null resource */ - - if (r->path_info != NULL && *r->path_info != '\0') { - if (resource->collection) { - /* only a trailing "/" is allowed */ - if (*r->path_info != '/' || r->path_info[1] != '\0') { - - /* - ** This URL/filename represents a locknull resource or - ** possibly a destination of a MOVE/COPY - */ - resource->exists = 0; - resource->collection = 0; - } - } - else - { - /* - ** The base of the path refers to a file -- nothing should - ** be in path_info. The resource is simply an error: it - ** can't be a null or a locknull resource. - */ - return NULL; /* becomes HTTP_NOT_FOUND */ - } - - /* retain proper integrity across the structures */ - if (!resource->exists) { - ctx->finfo.st_mode = 0; - } - } - } - - return resource; -} - -static dav_resource * dav_fs_get_parent_resource(const dav_resource *resource) -{ - dav_resource_private *ctx = resource->info; - dav_resource_private *parent_ctx; - dav_resource *parent_resource; - char *dirpath; - - /* If given resource is root, then there is no parent */ - if (strcmp(resource->uri, "/") == 0 || -#ifdef WIN32 - (strlen(ctx->pathname) == 3 && ctx->pathname[1] == ':' && ctx->pathname[2] == '/') -#else - strcmp(ctx->pathname, "/") == 0 -#endif - ) - return NULL; - - /* ### optimize this into a single allocation! */ - - /* Create private resource context descriptor */ - parent_ctx = ap_pcalloc(ctx->pool, sizeof(*parent_ctx)); - parent_ctx->pool = ctx->pool; - - dirpath = ap_make_dirstr_parent(ctx->pool, ctx->pathname); - if (strlen(dirpath) > 1 && dirpath[strlen(dirpath) - 1] == '/') - dirpath[strlen(dirpath) - 1] = '\0'; - parent_ctx->pathname = dirpath; - - parent_resource = ap_pcalloc(ctx->pool, sizeof(*parent_resource)); - parent_resource->info = parent_ctx; - parent_resource->collection = 1; - parent_resource->hooks = &dav_hooks_repository_fs; - - if (resource->uri != NULL) { - char *uri = ap_make_dirstr_parent(ctx->pool, resource->uri); - if (strlen(uri) > 1 && uri[strlen(uri) - 1] == '/') - uri[strlen(uri) - 1] = '\0'; - parent_resource->uri = uri; - } - - if (stat(parent_ctx->pathname, &parent_ctx->finfo) == 0) { - parent_resource->exists = 1; - } - - return parent_resource; -} - -static int dav_fs_is_same_resource( - const dav_resource *res1, - const dav_resource *res2) -{ - dav_resource_private *ctx1 = res1->info; - dav_resource_private *ctx2 = res2->info; - - if (res1->hooks != res2->hooks) - return 0; - -#ifdef WIN32 - return stricmp(ctx1->pathname, ctx2->pathname) == 0; -#else - if (ctx1->finfo.st_mode != 0) - return ctx1->finfo.st_ino == ctx2->finfo.st_ino; - else - return strcmp(ctx1->pathname, ctx2->pathname) == 0; -#endif -} - -static int dav_fs_is_parent_resource( - const dav_resource *res1, - const dav_resource *res2) -{ - dav_resource_private *ctx1 = res1->info; - dav_resource_private *ctx2 = res2->info; - size_t len1 = strlen(ctx1->pathname); - size_t len2; - - if (res1->hooks != res2->hooks) - return 0; - - /* it is safe to use ctx2 now */ - len2 = strlen(ctx2->pathname); - - return (len2 > len1 - && memcmp(ctx1->pathname, ctx2->pathname, len1) == 0 - && ctx2->pathname[len1] == '/'); -} - -static dav_error * dav_fs_open_stream(const dav_resource *resource, - dav_stream_mode mode, - dav_stream **stream) -{ - pool *p = resource->info->pool; - dav_stream *ds = ap_palloc(p, sizeof(*ds)); - int flags; - - switch (mode) { - case DAV_MODE_READ: - case DAV_MODE_READ_SEEKABLE: - default: - flags = O_RDONLY; - break; - - case DAV_MODE_WRITE_TRUNC: - flags = O_WRONLY | O_CREAT | O_TRUNC | O_BINARY; - break; - case DAV_MODE_WRITE_SEEKABLE: - flags = O_WRONLY | O_CREAT | O_BINARY; - break; - } - - ds->p = p; - ds->pathname = resource->info->pathname; - ds->fd = open(ds->pathname, flags, DAV_FS_MODE_FILE); - if (ds->fd == -1) { - /* ### use something besides 500? */ - return dav_new_error(p, HTTP_INTERNAL_SERVER_ERROR, 0, - "An error occurred while opening a resource."); - } - ap_note_cleanups_for_fd(p, ds->fd); - - *stream = ds; - return NULL; -} - -static dav_error * dav_fs_close_stream(dav_stream *stream, int commit) -{ - ap_kill_cleanups_for_fd(stream->p, stream->fd); - close(stream->fd); - - if (!commit) { - if (remove(stream->pathname) != 0) { - /* ### use a better description? */ - return dav_new_error(stream->p, HTTP_INTERNAL_SERVER_ERROR, 0, - "There was a problem removing (rolling " - "back) the resource " - "when it was being closed."); - } - } - - return NULL; -} - -static dav_error * dav_fs_read_stream(dav_stream *stream, - void *buf, size_t *bufsize) -{ - ssize_t amt; - - amt = read(stream->fd, buf, *bufsize); - if (amt == -1) { - /* ### use something besides 500? */ - return dav_new_error(stream->p, HTTP_INTERNAL_SERVER_ERROR, 0, - "An error occurred while reading from a " - "resource."); - } - *bufsize = (size_t)amt; - return NULL; -} - -static dav_error * dav_fs_write_stream(dav_stream *stream, - const void *buf, size_t bufsize) -{ - if (dav_sync_write(stream->fd, buf, bufsize) != 0) { - if (errno == ENOSPC) { - return dav_new_error(stream->p, HTTP_INSUFFICIENT_STORAGE, 0, - "There is not enough storage to write to " - "this resource."); - } - - /* ### use something besides 500? */ - return dav_new_error(stream->p, HTTP_INTERNAL_SERVER_ERROR, 0, - "An error occurred while writing to a " - "resource."); - } - return NULL; -} - -static dav_error * dav_fs_seek_stream(dav_stream *stream, off_t abs_pos) -{ - if (lseek(stream->fd, abs_pos, SEEK_SET) == (off_t)-1) { - /* ### use something besides 500? */ - return dav_new_error(stream->p, HTTP_INTERNAL_SERVER_ERROR, 0, - "Could not seek to specified position in the " - "resource."); - } - return NULL; -} - -static dav_error * dav_fs_set_headers(request_rec *r, - const dav_resource *resource) -{ - /* ### this function isn't really used since we have a get_pathname */ -#if DEBUG_GET_HANDLER - if (!resource->exists) - return NULL; - - /* make sure the proper mtime is in the request record */ - ap_update_mtime(r, resource->info->finfo.st_mtime); - - /* ### note that these use r->filename rather than */ - ap_set_last_modified(r); - ap_set_etag(r); - - /* we accept byte-ranges */ - ap_table_setn(r->headers_out, "Accept-Ranges", "bytes"); - - /* set up the Content-Length header */ - ap_set_content_length(r, resource->info->finfo.st_size); - - /* ### how to set the content type? */ - /* ### until this is resolved, the Content-Type header is busted */ - -#endif - - return NULL; -} - -#if DEBUG_PATHNAME_STYLE -static const char * dav_fs_get_pathname( - const dav_resource *resource, - void **free_handle_p) -{ - return resource->info->pathname; -} -#endif - -static void dav_fs_free_file(void *free_handle) -{ - /* nothing to free ... */ -} - -static dav_error * dav_fs_create_collection(pool *p, dav_resource *resource) -{ - dav_resource_private *ctx = resource->info; - - if (mkdir(ctx->pathname, DAV_FS_MODE_DIR) != 0) { - if (errno == ENOSPC) - return dav_new_error(p, HTTP_INSUFFICIENT_STORAGE, 0, - "There is not enough storage to create " - "this collection."); - - /* ### refine this error message? */ - return dav_new_error(p, HTTP_FORBIDDEN, 0, - "Unable to create collection."); - } - - /* update resource state to show it exists as a collection */ - resource->exists = 1; - resource->collection = 1; - - return NULL; -} - -static dav_error * dav_fs_copymove_walker(dav_walker_ctx *ctx, int calltype) -{ - dav_resource_private *srcinfo = ctx->resource->info; - dav_resource_private *dstinfo = ctx->res2->info; - dav_error *err = NULL; - - if (ctx->resource->collection) { - if (calltype == DAV_CALLTYPE_POSTFIX) { - /* Postfix call for MOVE. delete the source dir. - * Note: when copying, we do not enable the postfix-traversal. - */ - /* ### we are ignoring any error here; what should we do? */ - (void) rmdir(srcinfo->pathname); - } - else { - /* copy/move of a collection. Create the new, target collection */ - if (mkdir(dstinfo->pathname, DAV_FS_MODE_DIR) != 0) { - /* ### assume it was a permissions problem */ - /* ### need a description here */ - err = dav_new_error(ctx->pool, HTTP_FORBIDDEN, 0, NULL); - } - } - } - else { - err = dav_fs_copymove_file(ctx->is_move, ctx->pool, srcinfo->pathname, - dstinfo->pathname, &ctx->work_buf); - /* ### push a higher-level description? */ - } - - /* - ** If we have a "not so bad" error, then it might need to go into a - ** multistatus response. - ** - ** For a MOVE, it will always go into the multistatus. It could be - ** that everything has been moved *except* for the root. Using a - ** multistatus (with no errors for the other resources) will signify - ** this condition. - ** - ** For a COPY, we are traversing in a prefix fashion. If the root fails, - ** then we can just bail out now. - */ - if (err != NULL - && !ap_is_HTTP_SERVER_ERROR(err->status) - && (ctx->is_move - || !dav_fs_is_same_resource(ctx->resource, ctx->root))) { - /* ### use errno to generate DAV:responsedescription? */ - dav_add_response(ctx, ctx->resource->uri, err->status, NULL); - - /* the error is in the multistatus now. do not stop the traversal. */ - return NULL; - } - - return err; -} - -static dav_error *dav_fs_copymove_resource( - int is_move, - const dav_resource *src, - const dav_resource *dst, - int depth, - dav_response **response) -{ - dav_error *err = NULL; - dav_buffer work_buf = { 0 }; - - *response = NULL; - - /* if a collection, recursively copy/move it and its children, - * including the state dirs - */ - if (src->collection) { - dav_walker_ctx ctx = { 0 }; - - ctx.walk_type = DAV_WALKTYPE_ALL | DAV_WALKTYPE_HIDDEN; - ctx.func = dav_fs_copymove_walker; - ctx.pool = src->info->pool; - ctx.resource = src; - ctx.res2 = dst; - ctx.is_move = is_move; - ctx.postfix = is_move; /* needed for MOVE to delete source dirs */ - - /* copy over the source URI */ - dav_buffer_init(ctx.pool, &ctx.uri, src->uri); - - if ((err = dav_fs_walk(&ctx, depth)) != NULL) { - /* on a "real" error, then just punt. nothing else to do. */ - return err; - } - - if ((*response = ctx.response) != NULL) { - /* some multistatus responses exist. wrap them in a 207 */ - return dav_new_error(src->info->pool, HTTP_MULTI_STATUS, 0, - "Error(s) occurred on some resources during " - "the COPY/MOVE process."); - } - - return NULL; - } - - /* not a collection */ - if ((err = dav_fs_copymove_file(is_move, src->info->pool, - src->info->pathname, dst->info->pathname, - &work_buf)) != NULL) { - /* ### push a higher-level description? */ - return err; - } - - /* copy/move properties as well */ - return dav_fs_copymoveset(is_move, src->info->pool, src, dst, &work_buf); -} - -static dav_error * dav_fs_copy_resource( - const dav_resource *src, - dav_resource *dst, - int depth, - dav_response **response) -{ - dav_error *err; - -#if DAV_DEBUG - if (src->hooks != dst->hooks) { - /* - ** ### strictly speaking, this is a design error; we should not - ** ### have reached this point. - */ - return dav_new_error(src->info->pool, HTTP_INTERNAL_SERVER_ERROR, 0, - "DESIGN ERROR: a mix of repositories " - "was passed to copy_resource."); - } -#endif - - if ((err = dav_fs_copymove_resource(0, src, dst, depth, - response)) == NULL) { - - /* update state of destination resource to show it exists */ - dst->exists = 1; - dst->collection = src->collection; - } - - return err; -} - -static dav_error * dav_fs_move_resource( - dav_resource *src, - dav_resource *dst, - dav_response **response) -{ - dav_resource_private *srcinfo = src->info; - dav_resource_private *dstinfo = dst->info; - dav_error *err; - int can_rename = 0; - -#if DAV_DEBUG - if (src->hooks != dst->hooks) { - /* - ** ### strictly speaking, this is a design error; we should not - ** ### have reached this point. - */ - return dav_new_error(src->info->pool, HTTP_INTERNAL_SERVER_ERROR, 0, - "DESIGN ERROR: a mix of repositories " - "was passed to move_resource."); - } -#endif - - /* determine whether a simple rename will work. - * Assume source exists, else we wouldn't get called. - */ - if (dstinfo->finfo.st_mode != 0) { - if (dstinfo->finfo.st_dev == srcinfo->finfo.st_dev) { - /* target exists and is on the same device. */ - can_rename = 1; - } - } - else { - const char *dirpath; - struct stat finfo; - - /* destination does not exist, but the parent directory should, - * so try it - */ - dirpath = ap_make_dirstr_parent(dstinfo->pool, dstinfo->pathname); - if (stat(dirpath, &finfo) == 0 - && finfo.st_dev == srcinfo->finfo.st_dev) { - can_rename = 1; - } - } - - /* if we can't simply renamed, then do it the hard way... */ - if (!can_rename) { - if ((err = dav_fs_copymove_resource(1, src, dst, DAV_INFINITY, response)) == NULL) { - /* update resource states */ - dst->exists = 1; - dst->collection = src->collection; - src->exists = 0; - src->collection = 0; - } - - return err; - } - - /* a rename should work. do it, and move properties as well */ - - /* no multistatus response */ - *response = NULL; - - if (rename(srcinfo->pathname, dstinfo->pathname) != 0) { - /* ### should have a better error than this. */ - return dav_new_error(srcinfo->pool, HTTP_INTERNAL_SERVER_ERROR, 0, - "Could not rename resource."); - } - - /* update resource states */ - dst->exists = 1; - dst->collection = src->collection; - src->exists = 0; - src->collection = 0; - - if ((err = dav_fs_copymoveset(1, src->info->pool, - src, dst, NULL)) == NULL) { - /* no error. we're done. go ahead and return now. */ - return NULL; - } - - /* error occurred during properties move; try to put resource back */ - if (rename(dstinfo->pathname, srcinfo->pathname) != 0) { - /* couldn't put it back! */ - return dav_push_error(srcinfo->pool, - HTTP_INTERNAL_SERVER_ERROR, 0, - "The resource was moved, but a failure " - "occurred during the move of its " - "properties. The resource could not be " - "restored to its original location. The " - "server is now in an inconsistent state.", - err); - } - - /* update resource states again */ - src->exists = 1; - src->collection = dst->collection; - dst->exists = 0; - dst->collection = 0; - - /* resource moved back, but properties may be inconsistent */ - return dav_push_error(srcinfo->pool, - HTTP_INTERNAL_SERVER_ERROR, 0, - "The resource was moved, but a failure " - "occurred during the move of its properties. " - "The resource was moved back to its original " - "location, but its properties may have been " - "partially moved. The server may be in an " - "inconsistent state.", - err); -} - -static dav_error * dav_fs_delete_walker(dav_walker_ctx *ctx, int calltype) -{ - dav_resource_private *info = ctx->resource->info; - - /* do not attempt to remove a null resource, - * or a collection with children - */ - if (ctx->resource->exists && - (!ctx->resource->collection || calltype == DAV_CALLTYPE_POSTFIX)) { - /* try to remove the resource */ - int result; - - result = ctx->resource->collection - ? rmdir(info->pathname) - : remove(info->pathname); - - /* - ** If an error occurred, then add it to multistatus response. - ** Note that we add it for the root resource, too. It is quite - ** possible to delete the whole darn tree, yet fail on the root. - ** - ** (also: remember we are deleting via a postfix traversal) - */ - if (result != 0) { - /* ### assume there is a permissions problem */ - - /* ### use errno to generate DAV:responsedescription? */ - dav_add_response(ctx, ctx->resource->uri, HTTP_FORBIDDEN, NULL); - } - } - - return NULL; -} - -static dav_error * dav_fs_remove_resource(dav_resource *resource, - dav_response **response) -{ - dav_resource_private *info = resource->info; - - *response = NULL; - - /* if a collection, recursively remove it and its children, - * including the state dirs - */ - if (resource->collection) { - dav_walker_ctx ctx = { 0 }; - dav_error *err = NULL; - - ctx.walk_type = DAV_WALKTYPE_ALL | DAV_WALKTYPE_HIDDEN; - ctx.postfix = 1; - ctx.func = dav_fs_delete_walker; - ctx.pool = info->pool; - ctx.resource = resource; - - dav_buffer_init(info->pool, &ctx.uri, resource->uri); - - if ((err = dav_fs_walk(&ctx, DAV_INFINITY)) != NULL) { - /* on a "real" error, then just punt. nothing else to do. */ - return err; - } - - if ((*response = ctx.response) != NULL) { - /* some multistatus responses exist. wrap them in a 207 */ - return dav_new_error(info->pool, HTTP_MULTI_STATUS, 0, - "Error(s) occurred on some resources during " - "the deletion process."); - } - - /* no errors... update resource state */ - resource->exists = 0; - resource->collection = 0; - - return NULL; - } - - /* not a collection; remove the file and its properties */ - if (remove(info->pathname) != 0) { - /* ### put a description in here */ - return dav_new_error(info->pool, HTTP_FORBIDDEN, 0, NULL); - } - - /* update resource state */ - resource->exists = 0; - resource->collection = 0; - - /* remove properties and return its result */ - return dav_fs_deleteset(info->pool, resource); -} - -/* ### move this to dav_util? */ -/* Walk recursively down through directories, * - * including lock-null resources as we go. */ -dav_error * dav_fs_walker(dav_fs_walker_context *fsctx, int depth) -{ - dav_error *err = NULL; - dav_walker_ctx *wctx = fsctx->wctx; - int isdir = wctx->resource->collection; - DIR *dirp; - struct dirent *ep; - - /* ensure the context is prepared properly, then call the func */ - err = (*wctx->func)(wctx, - isdir - ? DAV_CALLTYPE_COLLECTION - : DAV_CALLTYPE_MEMBER); - if (err != NULL) { - return err; - } - - if (depth == 0 || !isdir) { - return NULL; - } - - /* put a trailing slash onto the directory, in preparation for appending - * files to it as we discovery them within the directory */ - dav_check_bufsize(wctx->pool, &fsctx->path1, DAV_BUFFER_PAD); - fsctx->path1.buf[fsctx->path1.cur_len++] = '/'; - fsctx->path1.buf[fsctx->path1.cur_len] = '\0'; /* in pad area */ - - /* if a secondary path is present, then do that, too */ - if (fsctx->path2.buf != NULL) { - dav_check_bufsize(wctx->pool, &fsctx->path2, DAV_BUFFER_PAD); - fsctx->path2.buf[fsctx->path2.cur_len++] = '/'; - fsctx->path2.buf[fsctx->path2.cur_len] = '\0'; /* in pad area */ - } - - /* Note: the URI should ALREADY have a trailing "/" */ - - /* for this first pass of files, all resources exist */ - fsctx->res1.exists = 1; - - /* a file is the default; we'll adjust if we hit a directory */ - fsctx->res1.collection = 0; - fsctx->res2.collection = 0; - - /* open and scan the directory */ - if ((dirp = opendir(fsctx->path1.buf)) == NULL) { - /* ### need a better error */ - return dav_new_error(wctx->pool, HTTP_NOT_FOUND, 0, NULL); - } - while ((ep = readdir(dirp)) != NULL) { - size_t len = strlen(ep->d_name); - - /* avoid recursing into our current, parent, or state directories */ - if (ep->d_name[0] == '.' - && (len == 1 || (ep->d_name[1] == '.' && len == 2))) { - continue; - } - - if (wctx->walk_type & DAV_WALKTYPE_AUTH) { - /* ### need to authorize each file */ - /* ### example: .htaccess is normally configured to fail auth */ - - /* stuff in the state directory is never authorized! */ - if (!strcmp(ep->d_name, DAV_FS_STATE_DIR)) { - continue; - } - } - /* skip the state dir unless a HIDDEN is performed */ - if (!(wctx->walk_type & DAV_WALKTYPE_HIDDEN) - && !strcmp(ep->d_name, DAV_FS_STATE_DIR)) { - continue; - } - - /* append this file onto the path buffer (copy null term) */ - dav_buffer_place_mem(wctx->pool, - &fsctx->path1, ep->d_name, len + 1, 0); - - if (lstat(fsctx->path1.buf, &fsctx->info1.finfo) != 0) { - /* woah! where'd it go? */ - /* ### should have a better error here */ - err = dav_new_error(wctx->pool, HTTP_NOT_FOUND, 0, NULL); - break; - } - - /* copy the file to the URI, too. NOTE: we will pad an extra byte - for the trailing slash later. */ - dav_buffer_place_mem(wctx->pool, &wctx->uri, ep->d_name, len + 1, 1); - - /* if there is a secondary path, then do that, too */ - if (fsctx->path2.buf != NULL) { - dav_buffer_place_mem(wctx->pool, &fsctx->path2, - ep->d_name, len + 1, 0); - } - - /* set up the (internal) pathnames for the two resources */ - fsctx->info1.pathname = fsctx->path1.buf; - fsctx->info2.pathname = fsctx->path2.buf; - - /* set up the URI for the current resource */ - fsctx->res1.uri = wctx->uri.buf; - - /* ### for now, only process regular files (e.g. skip symlinks) */ - if (S_ISREG(fsctx->info1.finfo.st_mode)) { - /* call the function for the specified dir + file */ - if ((err = (*wctx->func)(wctx, DAV_CALLTYPE_MEMBER)) != NULL) { - /* ### maybe add a higher-level description? */ - break; - } - } - else if (S_ISDIR(fsctx->info1.finfo.st_mode)) { - size_t save_path_len = fsctx->path1.cur_len; - size_t save_uri_len = wctx->uri.cur_len; - size_t save_path2_len = fsctx->path2.cur_len; - - /* adjust length to incorporate the subdir name */ - fsctx->path1.cur_len += len; - fsctx->path2.cur_len += len; - - /* adjust URI length to incorporate subdir and a slash */ - wctx->uri.cur_len += len + 1; - wctx->uri.buf[wctx->uri.cur_len - 1] = '/'; - wctx->uri.buf[wctx->uri.cur_len] = '\0'; - - /* switch over to a collection */ - fsctx->res1.collection = 1; - fsctx->res2.collection = 1; - - /* recurse on the subdir */ - /* ### don't always want to quit on error from single child */ - if ((err = dav_fs_walker(fsctx, depth - 1)) != NULL) { - /* ### maybe add a higher-level description? */ - break; - } - - /* put the various information back */ - fsctx->path1.cur_len = save_path_len; - fsctx->path2.cur_len = save_path2_len; - wctx->uri.cur_len = save_uri_len; - - fsctx->res1.collection = 0; - fsctx->res2.collection = 0; - - /* assert: res1.exists == 1 */ - } - } - - /* ### check the return value of this? */ - closedir(dirp); - - if (err != NULL) - return err; - - if (wctx->walk_type & DAV_WALKTYPE_LOCKNULL) { - size_t offset = 0; - - /* null terminate the directory name */ - fsctx->path1.buf[fsctx->path1.cur_len - 1] = '\0'; - - /* Include any lock null resources found in this collection */ - fsctx->res1.collection = 1; - if ((err = dav_fs_get_locknull_members(&fsctx->res1, - &fsctx->locknull_buf)) != NULL) { - /* ### maybe add a higher-level description? */ - return err; - } - - /* put a slash back on the end of the directory */ - fsctx->path1.buf[fsctx->path1.cur_len - 1] = '/'; - - /* these are all non-existant (files) */ - fsctx->res1.exists = 0; - fsctx->res1.collection = 0; - memset(&fsctx->info1.finfo, 0, sizeof(fsctx->info1.finfo)); - - while (offset < fsctx->locknull_buf.cur_len) { - size_t len = strlen(fsctx->locknull_buf.buf + offset); - dav_lock *locks = NULL; - - /* - ** Append the locknull file to the paths and the URI. Note that - ** we don't have to pad the URI for a slash since a locknull - ** resource is not a collection. - */ - dav_buffer_place_mem(wctx->pool, &fsctx->path1, - fsctx->locknull_buf.buf + offset, len + 1, 0); - dav_buffer_place_mem(wctx->pool, &wctx->uri, - fsctx->locknull_buf.buf + offset, len + 1, 0); - if (fsctx->path2.buf != NULL) { - dav_buffer_place_mem(wctx->pool, &fsctx->path2, - fsctx->locknull_buf.buf + offset, - len + 1, 0); - } - - /* set up the (internal) pathnames for the two resources */ - fsctx->info1.pathname = fsctx->path1.buf; - fsctx->info2.pathname = fsctx->path2.buf; - - /* set up the URI for the current resource */ - fsctx->res1.uri = wctx->uri.buf; - - /* - ** To prevent a PROPFIND showing an expired locknull - ** resource, query the lock database to force removal - ** of both the lock entry and .locknull, if necessary.. - ** Sure, the query in PROPFIND would do this.. after - ** the locknull resource was already included in the - ** return. - ** - ** NOTE: we assume the caller has opened the lock database - ** if they have provided DAV_WALKTYPE_LOCKNULL. - */ - /* ### we should also look into opening it read-only and - ### eliding timed-out items from the walk, yet leaving - ### them in the locknull database until somebody opens - ### the thing writable. - */ - /* ### probably ought to use has_locks. note the problem - ### mentioned above, though... we would traverse this as - ### a locknull, but then a PROPFIND would load the lock - ### info, causing a timeout and the locks would not be - ### reported. Therefore, a null resource would be returned - ### in the PROPFIND. - ### - ### alternative: just load unresolved locks. any direct - ### locks will be timed out (correct). any indirect will - ### not (correct; consider if a parent timed out -- the - ### timeout routines do not walk and remove indirects; - ### even the resolve func would probably fail when it - ### tried to find a timed-out direct lock). - */ - if ((err = dav_lock_query(wctx->lockdb, wctx->resource, &locks)) != NULL) { - /* ### maybe add a higher-level description? */ - return err; - } - - /* call the function for the specified dir + file */ - if (locks != NULL && - (err = (*wctx->func)(wctx, DAV_CALLTYPE_LOCKNULL)) != NULL) { - /* ### maybe add a higher-level description? */ - return err; - } - - offset += len + 1; - } - - /* reset the exists flag */ - fsctx->res1.exists = 1; - } - - if (wctx->postfix) { - /* replace the dirs' trailing slashes with null terms */ - fsctx->path1.buf[--fsctx->path1.cur_len] = '\0'; - wctx->uri.buf[--wctx->uri.cur_len] = '\0'; - if (fsctx->path2.buf != NULL) { - fsctx->path2.buf[--fsctx->path2.cur_len] = '\0'; - } - - /* this is a collection which exists */ - fsctx->res1.collection = 1; - - return (*wctx->func)(wctx, DAV_CALLTYPE_POSTFIX); - } - - return NULL; -} - -static dav_error * dav_fs_walk(dav_walker_ctx *wctx, int depth) -{ - dav_fs_walker_context fsctx = { 0 }; - -#if DAV_DEBUG - if ((wctx->walk_type & DAV_WALKTYPE_LOCKNULL) != 0 - && wctx->lockdb == NULL) { - return dav_new_error(wctx->pool, HTTP_INTERNAL_SERVER_ERROR, 0, - "DESIGN ERROR: walker called to walk locknull " - "resources, but a lockdb was not provided."); - } - - /* ### an assertion that we have space for a trailing slash */ - if (wctx->uri.cur_len + 1 > wctx->uri.alloc_len) { - return dav_new_error(wctx->pool, HTTP_INTERNAL_SERVER_ERROR, 0, - "DESIGN ERROR: walker should have been called " - "with padding in the URI buffer."); - } -#endif - - fsctx.wctx = wctx; - - wctx->root = wctx->resource; - - /* ### zero out versioned, working, baselined? */ - - fsctx.res1 = *wctx->resource; - - fsctx.res1.info = &fsctx.info1; - fsctx.info1 = *wctx->resource->info; - - dav_buffer_init(wctx->pool, &fsctx.path1, fsctx.info1.pathname); - fsctx.info1.pathname = fsctx.path1.buf; - - if (wctx->res2 != NULL) { - fsctx.res2 = *wctx->res2; - fsctx.res2.exists = 0; - fsctx.res2.collection = 0; - - fsctx.res2.info = &fsctx.info2; - fsctx.info2 = *wctx->res2->info; - - /* res2 does not exist -- clear its finfo structure */ - memset(&fsctx.info2.finfo, 0, sizeof(fsctx.info2.finfo)); - - dav_buffer_init(wctx->pool, &fsctx.path2, fsctx.info2.pathname); - fsctx.info2.pathname = fsctx.path2.buf; - } - - /* if we have a directory, then ensure the URI has a trailing "/" */ - if (fsctx.res1.collection - && wctx->uri.buf[wctx->uri.cur_len - 1] != '/') { - - /* this will fall into the pad area */ - wctx->uri.buf[wctx->uri.cur_len++] = '/'; - wctx->uri.buf[wctx->uri.cur_len] = '\0'; - } - - /* - ** URI is tracked in the walker context. Ensure that people do not try - ** to fetch it from res2. We will ensure that res1 and uri will remain - ** synchronized. - */ - fsctx.res1.uri = wctx->uri.buf; - fsctx.res2.uri = NULL; - - /* use our resource structures */ - wctx->resource = &fsctx.res1; - wctx->res2 = &fsctx.res2; - - return dav_fs_walker(&fsctx, depth); -} - -/* dav_fs_etag: Stolen from ap_make_etag. Creates a strong etag - * for file path. - * ### do we need to return weak tags sometimes? - */ -static const char *dav_fs_getetag(const dav_resource *resource) -{ - dav_resource_private *ctx = resource->info; - - if (!resource->exists) - return ap_pstrdup(ctx->pool, ""); - - if (ctx->finfo.st_mode != 0) { - return ap_psprintf(ctx->pool, "\"%lx-%lx-%lx\"", - (unsigned long) ctx->finfo.st_ino, - (unsigned long) ctx->finfo.st_size, - (unsigned long) ctx->finfo.st_mtime); - } - - return ap_psprintf(ctx->pool, "\"%lx\"", (unsigned long) ctx->finfo.st_mtime); -} - -static const dav_hooks_repository dav_hooks_repository_fs = -{ - DEBUG_GET_HANDLER, /* normally: special GET handling not required */ - dav_fs_get_resource, - dav_fs_get_parent_resource, - dav_fs_is_same_resource, - dav_fs_is_parent_resource, - dav_fs_open_stream, - dav_fs_close_stream, - dav_fs_read_stream, - dav_fs_write_stream, - dav_fs_seek_stream, - dav_fs_set_headers, -#if DEBUG_PATHNAME_STYLE - dav_fs_get_pathname, -#else - 0, -#endif - dav_fs_free_file, - dav_fs_create_collection, - dav_fs_copy_resource, - dav_fs_move_resource, - dav_fs_remove_resource, - dav_fs_walk, - dav_fs_getetag, -}; - -static int dav_fs_find_prop(const char *ns_uri, const char *name) -{ - const dav_fs_liveprop_name *scan; - int ns; - - if (*ns_uri == 'h' - && strcmp(ns_uri, dav_fs_namespace_uris[DAV_FS_URI_MYPROPS]) == 0) { - ns = DAV_FS_URI_MYPROPS; - } - else if (*ns_uri == 'D' && strcmp(ns_uri, "DAV:") == 0) { - ns = DAV_FS_URI_DAV; - } - else { - /* we don't define this property */ - return 0; - } - - for (scan = dav_fs_props; scan->name != NULL; ++scan) - if (ns == scan->ns && strcmp(name, scan->name) == 0) - return scan->propid; - - return 0; -} - -static dav_prop_insert dav_fs_insert_prop(const dav_resource *resource, - int propid, int insvalue, - const int *ns_map, - dav_text_header *phdr) -{ - const char *value; - const char *s; - dav_prop_insert which; - pool *p = resource->info->pool; - const dav_fs_liveprop_name *scan; - int ns; - - /* an HTTP-date can be 29 chars plus a null term */ - /* a 64-bit size can be 20 chars plus a null term */ - char buf[DAV_TIMEBUF_SIZE]; - - if (!DAV_PROPID_FS_OURS(propid)) - return DAV_PROP_INSERT_NOTME; - - /* - ** None of FS provider properties are defined if the resource does not - ** exist. Just bail for this case. - ** - ** Note that DAV:displayname and DAV:source will be stored as dead - ** properties; the NOTDEF return code indicates that dav_props.c should - ** look there for the value. - ** - ** Even though we state that the FS properties are not defined, the - ** client cannot store dead values -- we deny that thru the is_writable - ** hook function. - */ - if (!resource->exists) - return DAV_PROP_INSERT_NOTDEF; - - switch (propid) { - case DAV_PROPID_FS_creationdate: - /* - ** Closest thing to a creation date. since we don't actually - ** perform the operations that would modify ctime (after we - ** create the file), then we should be pretty safe here. - */ - dav_format_time(DAV_STYLE_ISO8601, - resource->info->finfo.st_ctime, - buf); - value = buf; - break; - - case DAV_PROPID_FS_getcontentlength: - /* our property, but not defined on collection resources */ - if (resource->collection) - return DAV_PROP_INSERT_NOTDEF; - - (void) sprintf(buf, "%ld", resource->info->finfo.st_size); - value = buf; - break; - - case DAV_PROPID_FS_getetag: - value = dav_fs_getetag(resource); - break; - - case DAV_PROPID_FS_getlastmodified: - dav_format_time(DAV_STYLE_RFC822, - resource->info->finfo.st_mtime, - buf); - value = buf; - break; - - case DAV_PROPID_FS_executable: -#ifdef WIN32 - /* our property, but not defined on the Win32 platform */ - return DAV_PROP_INSERT_NOTDEF; -#else - /* our property, but not defined on collection resources */ - if (resource->collection) - return DAV_PROP_INSERT_NOTDEF; - - /* the files are "ours" so we only need to check owner exec privs */ - if (resource->info->finfo.st_mode & DAV_FS_MODE_XUSR) - value = "T"; - else - value = "F"; - break; -#endif /* WIN32 */ - - case DAV_PROPID_FS_displayname: - case DAV_PROPID_FS_source: - default: - /* - ** This property is not defined. However, it may be a dead - ** property. - */ - return DAV_PROP_INSERT_NOTDEF; - } - - /* assert: value != NULL */ - - for (scan = dav_fs_props; scan->name != NULL; ++scan) - if (scan->propid == propid) - break; - /* assert: scan->name != NULL */ - - /* map our NS index into a global NS index */ - ns = ns_map[scan->ns]; - - /* DBG3("FS: inserting lp%d:%s (local %d)", ns, scan->name, scan->ns); */ - - if (insvalue) { - /* use D: prefix to refer to the DAV: namespace URI */ - s = ap_psprintf(p, "%s" DEBUG_CR, - ns, scan->name, value, ns, scan->name); - which = DAV_PROP_INSERT_VALUE; - } - else { - /* use D: prefix to refer to the DAV: namespace URI */ - s = ap_psprintf(p, "" DEBUG_CR, ns, scan->name); - which = DAV_PROP_INSERT_NAME; - } - dav_text_append(p, phdr, s); - - /* we inserted a name or value (this prop is done) */ - return which; -} - -static void dav_fs_insert_all(const dav_resource *resource, int insvalue, - const int *ns_map, dav_text_header *phdr) -{ - if (!resource->exists) { - /* a lock-null resource */ - /* - ** ### technically, we should insert empty properties. dunno offhand - ** ### what part of the spec said this, but it was essentially thus: - ** ### "the properties should be defined, but may have no value". - */ - return; - } - - (void) dav_fs_insert_prop(resource, DAV_PROPID_FS_creationdate, - insvalue, ns_map, phdr); - (void) dav_fs_insert_prop(resource, DAV_PROPID_FS_getcontentlength, - insvalue, ns_map, phdr); - (void) dav_fs_insert_prop(resource, DAV_PROPID_FS_getlastmodified, - insvalue, ns_map, phdr); - (void) dav_fs_insert_prop(resource, DAV_PROPID_FS_getetag, - insvalue, ns_map, phdr); - -#ifndef WIN32 - /* - ** Note: this property is not defined on the Win32 platform. - ** dav_fs_insert_prop() won't insert it, but we may as - ** well not even call it. - */ - (void) dav_fs_insert_prop(resource, DAV_PROPID_FS_executable, - insvalue, ns_map, phdr); -#endif - - /* ### we know the others aren't defined as liveprops */ -} - -static dav_prop_rw dav_fs_is_writeable(const dav_resource *resource, - int propid) -{ - if (!DAV_PROPID_FS_OURS(propid)) - return DAV_PROP_RW_NOTME; - - if (propid == DAV_PROPID_FS_displayname - || propid == DAV_PROPID_FS_source -#ifndef WIN32 - /* this property is not usable (writeable) on the Win32 platform */ - || (propid == DAV_PROPID_FS_executable && !resource->collection) -#endif - ) - return DAV_PROP_RW_YES; - - return DAV_PROP_RW_NO; -} - -static dav_error *dav_fs_patch_validate(const dav_resource *resource, - const dav_xml_elem *elem, - int operation, - void **context, - int *defer_to_dead) -{ - const dav_text *cdata; - const dav_text *f_cdata; - char value; - - if (elem->propid != DAV_PROPID_FS_executable) { - *defer_to_dead = 1; - return NULL; - } - - if (operation == DAV_PROP_OP_DELETE) { - return dav_new_error(resource->info->pool, HTTP_CONFLICT, 0, - "The 'executable' property cannot be removed."); - } - - cdata = elem->first_cdata.first; - f_cdata = elem->last_child == NULL - ? NULL - : elem->last_child->following_cdata.first; - - /* DBG3("name=%s cdata=%s f_cdata=%s",elem->name,cdata ? cdata->text : "[null]",f_cdata ? f_cdata->text : "[null]"); */ - - if (cdata == NULL) { - if (f_cdata == NULL) { - return dav_new_error(resource->info->pool, HTTP_CONFLICT, 0, - "The 'executable' property expects a single " - "character, valued 'T' or 'F'. There was no " - "value submitted."); - } - cdata = f_cdata; - } - else if (f_cdata != NULL) - goto too_long; - - if (cdata->next != NULL || strlen(cdata->text) != 1) - goto too_long; - - value = cdata->text[0]; - if (value != 'T' && value != 'F') { - return dav_new_error(resource->info->pool, HTTP_CONFLICT, 0, - "The 'executable' property expects a single " - "character, valued 'T' or 'F'. The value " - "submitted is invalid."); - } - - *context = (void *)(value == 'T'); - - return NULL; - - too_long: - return dav_new_error(resource->info->pool, HTTP_CONFLICT, 0, - "The 'executable' property expects a single " - "character, valued 'T' or 'F'. The value submitted" - "has too many characters."); - -} - -static dav_error *dav_fs_patch_exec(dav_resource *resource, - const dav_xml_elem *elem, - int operation, - void *context, - dav_liveprop_rollback **rollback_ctx) -{ - int value = context != NULL; - mode_t mode = resource->info->finfo.st_mode; - int old_value = (resource->info->finfo.st_mode & DAV_FS_MODE_XUSR) != 0; - - /* assert: prop == executable. operation == SET. */ - - /* don't do anything if there is no change. no rollback info either. */ - if (value == old_value) - return NULL; - - mode &= ~DAV_FS_MODE_XUSR; - if (value) - mode |= DAV_FS_MODE_XUSR; - - if (chmod(resource->info->pathname, mode) == -1) { - return dav_new_error(resource->info->pool, - HTTP_INTERNAL_SERVER_ERROR, 0, - "Could not set the executable flag of the " - "target resource."); - } - - /* update the resource and set up the rollback context */ - resource->info->finfo.st_mode = mode; - *rollback_ctx = (dav_liveprop_rollback *)old_value; - - return NULL; -} - -static void dav_fs_patch_commit(dav_resource *resource, - int operation, - void *context, - dav_liveprop_rollback *rollback_ctx) -{ - /* nothing to do */ -} - -static dav_error *dav_fs_patch_rollback(dav_resource *resource, - int operation, - void *context, - dav_liveprop_rollback *rollback_ctx) -{ - mode_t mode = resource->info->finfo.st_mode & ~DAV_FS_MODE_XUSR; - int value = rollback_ctx != NULL; - - /* assert: prop == executable. operation == SET. */ - - /* restore the executable bit */ - if (value) - mode |= DAV_FS_MODE_XUSR; - - if (chmod(resource->info->pathname, mode) == -1) { - return dav_new_error(resource->info->pool, - HTTP_INTERNAL_SERVER_ERROR, 0, - "After a failure occurred, the resource's " - "executable flag could not be restored."); - } - - /* restore the resource's state */ - resource->info->finfo.st_mode = mode; - - return NULL; -} - - -static const dav_hooks_liveprop dav_hooks_liveprop_fs = -{ -#ifdef WIN32 - NULL, -#else - "http://apache.org/dav/propset/fs/1", /* filesystem, set 1 */ -#endif - dav_fs_find_prop, - dav_fs_insert_prop, - dav_fs_insert_all, - dav_fs_is_writeable, - dav_fs_namespace_uris, - dav_fs_patch_validate, - dav_fs_patch_exec, - dav_fs_patch_commit, - dav_fs_patch_rollback, -}; - -/* -** Note: we do not provide an is_active function at this point. In the -** future, mod_dav may use that to determine if a particular provider is -** active/enabled, but it doesn't now. -*/ -static const dav_dyn_provider dav_dyn_providers_fs[] = -{ - /* repository provider */ - { - DAV_FS_PROVIDER_ID, - DAV_DYN_TYPE_REPOSITORY, - &dav_hooks_repository_fs, - NULL - }, - /* liveprop provider */ - { - DAV_FS_PROVIDER_ID, - DAV_DYN_TYPE_LIVEPROP, - &dav_hooks_liveprop_fs, - NULL - }, - /* propdb provider */ - { - DAV_FS_PROVIDER_ID, - DAV_DYN_TYPE_PROPDB, - &dav_hooks_db_dbm, - NULL - }, - /* locks provider */ - { - DAV_FS_PROVIDER_ID, - DAV_DYN_TYPE_LOCKS, - &dav_hooks_locks_fs, - NULL - }, - /* must always be last */ - DAV_DYN_END_MARKER -}; - -const dav_dyn_module dav_dyn_module_default = -{ - DAV_DYN_MAGIC, - DAV_DYN_VERSION, - "filesystem", - - NULL, /* module_open */ - NULL, /* module_close */ - NULL, /* dir_open */ - NULL, /* dir_param */ - NULL, /* dir_merge */ - NULL, /* dir_close */ - - dav_dyn_providers_fs -}; diff --git a/modules/dav/fs/repos.h b/modules/dav/fs/repos.h deleted file mode 100644 index 2330c1ee02da7e94fa1a0f63ea540cf2430488f6..0000000000000000000000000000000000000000 --- a/modules/dav/fs/repos.h +++ /dev/null @@ -1,75 +0,0 @@ -/* -** Copyright (C) 1998-2000 Greg Stein. All Rights Reserved. -** -** By using this file, you agree to the terms and conditions set forth in -** the LICENSE.html file which can be found at the top level of the mod_dav -** distribution or at http://www.webdav.org/mod_dav/license-1.html. -** -** Contact information: -** Greg Stein, PO Box 760, Palo Alto, CA, 94302 -** gstein@lyra.org, http://www.webdav.org/mod_dav/ -*/ - -/* -** Declarations for the filesystem repository implementation -** -** Written by John Vasta, vasta@rational.com, by separating from mod_dav.h -*/ - -#ifndef _DAV_FS_REPOS_H_ -#define _DAV_FS_REPOS_H_ - -/* the subdirectory to hold all DAV-related information for a directory */ -#define DAV_FS_STATE_DIR ".DAV" -#define DAV_FS_STATE_FILE_FOR_DIR ".state_for_dir" -#define DAV_FS_LOCK_NULL_FILE ".locknull" - -#ifndef WIN32 - -#define DAV_FS_MODE_DIR (S_IRWXU | S_IRWXG) -#define DAV_FS_MODE_FILE (S_IRUSR | S_IWUSR | S_IRGRP | S_IWGRP) -#define DAV_FS_MODE_XUSR (S_IXUSR) - -#else /* WIN32 */ - -#define DAV_FS_MODE_DIR (_S_IREAD | _S_IWRITE) -#define DAV_FS_MODE_FILE (_S_IREAD | _S_IWRITE) -#define DAV_FS_MODE_XUSR (_S_IEXEC) - -#include - -typedef int ssize_t; - -#define mkdir(p,m) _mkdir(p) - -#endif /* WIN32 */ - -/* ensure that our state subdirectory is present */ -void dav_fs_ensure_state_dir(pool *p, const char *dirname); - -/* return the storage pool associated with a resource */ -pool *dav_fs_pool(const dav_resource *resource); - -/* return the full pathname for a resource */ -const char *dav_fs_pathname(const dav_resource *resource); - -/* return the directory and filename for a resource */ -void dav_fs_dir_file_name(const dav_resource *resource, - const char **dirpath, - const char **fname); - -/* return the list of locknull members in this resource's directory */ -dav_error * dav_fs_get_locknull_members(const dav_resource *resource, - dav_buffer *pbuf); - - -/* DBM functions used by the repository and locking providers */ -extern const dav_hooks_db dav_hooks_db_dbm; - -dav_error * dav_dbm_open_direct(pool *p, const char *pathname, int ro, - dav_db **pdb); -void dav_dbm_get_statefiles(pool *p, const char *fname, - const char **state1, const char **state2); - - -#endif /* _DAV_FS_REPOS_H_ */ diff --git a/modules/dav/main/.cvsignore b/modules/dav/main/.cvsignore deleted file mode 100644 index f2f7a70d2c9528e7ef84cf1b3bf9ff721fa08b08..0000000000000000000000000000000000000000 --- a/modules/dav/main/.cvsignore +++ /dev/null @@ -1,10 +0,0 @@ -.deps -.libs -*.la -modules.mk -Makefile -*.lo -*.slo -*.so -*.dll -*.def diff --git a/modules/dav/main/Makefile.in b/modules/dav/main/Makefile.in deleted file mode 100644 index 3fc5925b91c0a9dde92975620e9d444c6be1d018..0000000000000000000000000000000000000000 --- a/modules/dav/main/Makefile.in +++ /dev/null @@ -1,6 +0,0 @@ - -LTLIBRARY_NAME = libapachemod_dav.la -LTLIBRARY_SOURCES = mod_dav.c props.c util.c util_lock.c \ - opaquelock.c dav_dyn.c - -include $(top_srcdir)/build/ltlib.mk diff --git a/modules/dav/main/NWGNUmakefile b/modules/dav/main/NWGNUmakefile deleted file mode 100644 index 507384276f3a05d0ee2c67846bb059f9a85052b0..0000000000000000000000000000000000000000 --- a/modules/dav/main/NWGNUmakefile +++ /dev/null @@ -1,272 +0,0 @@ -# -# Declare the sub-directories to be built here -# - -SUBDIRS = \ - $(EOLIST) - -# -# Get the 'head' of the build environment. This includes default targets and -# paths to tools -# - -include $(AP_WORK)\build\NWGNUhead.inc - -# -# build this level's files -# -# Make sure all needed macro's are defined -# - -# -# These directories will be at the beginning of the include list, followed by -# INCDIRS -# -XINCDIRS += \ - $(AP_WORK)/srclib/apr/include \ - $(AP_WORK)/srclib/include/arch/NetWare \ - $(AP_WORK)/srclib/apr-util/include \ - $(AP_WORK)/include \ - $(AP_WORK)/os/NetWare \ - $(AP_WORK)/server/mpm/NetWare \ - $(AP_WORK)/srclib/pcre \ - $(NWOS) \ - $(EOLIST) - -# -# These flags will come after CFLAGS -# -XCFLAGS += \ - $(EOLIST) - -# -# These defines will come after DEFINES -# -XDEFINES += \ - $(EOLIST) - -# -# These flags will be added to the link.opt file -# -XLFLAGS += \ - $(EOLIST) - -# -# These values will be appended to the correct variables based on the value of -# RELEASE -# -ifeq "$(RELEASE)" "debug" -XINCDIRS += \ - $(EOLIST) - -XCFLAGS += \ - $(EOLIST) - -XDEFINES += \ - $(EOLIST) - -XLFLAGS += \ - $(EOLIST) -endif - -ifeq "$(RELEASE)" "noopt" -XINCDIRS += \ - $(EOLIST) - -XCFLAGS += \ - $(EOLIST) - -XDEFINES += \ - $(EOLIST) - -XLFLAGS += \ - $(EOLIST) -endif - -ifeq "$(RELEASE)" "release" -XINCDIRS += \ - $(EOLIST) - -XCFLAGS += \ - $(EOLIST) - -XDEFINES += \ - $(EOLIST) - -XLFLAGS += \ - $(EOLIST) -endif - -# -# These are used by the link target if an NLM is being generated -# This is used by the link 'name' directive to name the nlm. If left blank -# TARGET_nlm (see below) will be used. -# -NLM_NAME = mod_DAV - -# -# This is used by the link '-desc ' directive. -# If left blank, NLM_NAME will be used. -# -NLM_DESCRIPTION = Apache DAV module - -# -# This is used by the '-threadname' directive. If left blank, -# NLM_NAME Thread will be used. -# -NLM_THREAD_NAME = mod_DAV - -# -# If this is specified, it will override VERSION value in -# $(AP_WORK)\build\NWGNUenvironment.inc -# -NLM_VERSION = - -# -# If this is specified, it will override the default of 64K -# -NLM_STACK_SIZE = 65536 - - -# -# If this is specified it will be used by the link '-entry' directive -# -NLM_ENTRY_SYM = _LibCPrelude - -# -# If this is specified it will be used by the link '-exit' directive -# -NLM_EXIT_SYM = _LibCPostlude - -# -# If this is specified it will be used by the link '-check' directive -# -NLM_CHECK_SYM = - -# -# If this is specified it will be used by the link '-flags' directive -# -NLM_FLAGS = AUTOUNLOAD, PSEUDOPREEMPTION - -# -# If this is specified it will be linked in with the XDCData option in the def -# file instead of the default of $(NWOS)/apache.xdc. XDCData can be disabled -# by setting APACHE_UNIPROC in the environment -# -XDCDATA = - -# -# Declare all target files (you must add your files here) -# - -# -# If there is an NLM target, put it here -# -TARGET_nlm = \ - $(OBJDIR)/mod_dav.nlm \ - $(EOLIST) - -# -# If there is an LIB target, put it here -# -TARGET_lib = \ - $(EOLIST) - -# -# These are the OBJ files needed to create the NLM target above. -# Paths must all use the '/' character -# -FILES_nlm_objs = \ - $(OBJDIR)/mod_dav.o \ - $(OBJDIR)/props.o \ - $(OBJDIR)/util.o \ - $(OBJDIR)/util_lock.o \ - $(OBJDIR)/liveprop.o \ - $(OBJDIR)/providers.o \ - $(OBJDIR)/std_liveprop.o \ - $(EOLIST) - -# -# These are the LIB files needed to create the NLM target above. -# These will be added as a library command in the link.opt file. -# -FILES_nlm_libs = \ - libcpre.o \ - $(EOLIST) - -# -# These are the modules that the above NLM target depends on to load. -# These will be added as a module command in the link.opt file. -# -FILES_nlm_modules = \ - Apache2 \ - Libc \ - $(EOLIST) - -# -# If the nlm has a msg file, put it's path here -# -FILE_nlm_msg = - -# -# If the nlm has a hlp file put it's path here -# -FILE_nlm_hlp = - -# -# If this is specified, it will override $(NWOS)\copyright.txt. -# -FILE_nlm_copyright = - -# -# Any additional imports go here -# -FILES_nlm_Ximports = \ - @libc.imp \ - @$(APR)/aprlib.imp \ - @httpd.imp \ - $(EOLIST) - -# -# Any symbols exported to here -# -FILES_nlm_exports = \ - dav_module \ - @dav.imp \ - $(EOLIST) - -# -# These are the OBJ files needed to create the LIB target above. -# Paths must all use the '/' character -# -FILES_lib_objs = \ - $(EOLIST) - -# -# implement targets and dependancies (leave this section alone) -# - -libs :: $(OBJDIR) $(TARGET_lib) - -nlms :: libs $(TARGET_nlm) - -# -# Updated this target to create necessary directories and copy files to the -# correct place. (See $(AP_WORK)\build\NWGNUhead.inc for examples) -# -install :: nlms FORCE - copy $(OBJDIR)\mod_dav.nlm $(INSTALL)\Apache2\modules\*.* - -# -# Any specialized rules here -# - -# -# Include the 'tail' makefile that has targets that depend on variables defined -# in this makefile -# - -include $(AP_WORK)\build\NWGNUtail.inc - - - diff --git a/modules/dav/main/config5.m4 b/modules/dav/main/config5.m4 deleted file mode 100644 index bf435023ffe01bda6a8d1badc720ba919fde8535..0000000000000000000000000000000000000000 --- a/modules/dav/main/config5.m4 +++ /dev/null @@ -1,22 +0,0 @@ -dnl modules enabled in this directory by default - -APACHE_MODPATH_INIT(dav/main) - -dav_objects="mod_dav.lo props.lo util.lo util_lock.lo liveprop.lo providers.lo std_liveprop.lo" - -if test "$enable_http" = "no"; then - dav_enable=no -else - dav_enable=most -fi - -APACHE_MODULE(dav, WebDAV protocol handling, $dav_objects, , $dav_enable) - -if test "$enable_dav" != "no"; then - apache_need_expat=yes - - INCLUDES="$INCLUDES -I\$(top_srcdir)/$modpath_current" -fi - - -APACHE_MODPATH_FINISH diff --git a/modules/dav/main/dav.imp b/modules/dav/main/dav.imp deleted file mode 100644 index 725bfb4ba015c1eef3c451315f2be293343b63ea..0000000000000000000000000000000000000000 --- a/modules/dav/main/dav.imp +++ /dev/null @@ -1,19 +0,0 @@ -(mod_dav) -dav_hook_gather_propsets, -dav_hook_find_liveprop, -dav_hook_insert_all_liveprops, -dav_new_error, -dav_set_bufsize, -dav_xmlns_add, -dav_check_bufsize, -dav_push_error, -dav_buffer_init, -dav_buffer_place, -dav_buffer_append, -dav_add_response, -dav_buffer_place_mem, -dav_lock_query, -dav_get_liveprop_info, -dav_do_find_liveprop, -dav_register_liveprop_group, -dav_register_provider \ No newline at end of file diff --git a/modules/dav/main/liveprop.c b/modules/dav/main/liveprop.c deleted file mode 100644 index cd720feb2296961281ff2ab48ef760d5e5afe251..0000000000000000000000000000000000000000 --- a/modules/dav/main/liveprop.c +++ /dev/null @@ -1,122 +0,0 @@ -/* ==================================================================== - * The Apache Software License, Version 1.1 - * - * Copyright (c) 2000 The Apache Software Foundation. All rights - * reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in - * the documentation and/or other materials provided with the - * distribution. - * - * 3. The end-user documentation included with the redistribution, - * if any, must include the following acknowledgment: - * "This product includes software developed by the - * Apache Software Foundation (http://www.apache.org/)." - * Alternately, this acknowledgment may appear in the software itself, - * if and wherever such third-party acknowledgments normally appear. - * - * 4. The names "Apache" and "Apache Software Foundation" must - * not be used to endorse or promote products derived from this - * software without prior written permission. For written - * permission, please contact apache@apache.org. - * - * 5. Products derived from this software may not be called "Apache", - * nor may "Apache" appear in their name, without prior written - * permission of the Apache Software Foundation. - * - * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED - * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES - * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR - * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF - * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND - * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, - * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT - * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * ==================================================================== - * - * This software consists of voluntary contributions made by many - * individuals on behalf of the Apache Software Foundation. For more - * information on the Apache Software Foundation, please see - * . - */ - -#include "apr_pools.h" -#include "apr_hash.h" -#include "apr_errno.h" - -#include "ap_hooks.h" /* ### for ap_global_hook_pool */ -#include "util_xml.h" /* for ap_text_header */ - -#include "mod_dav.h" - - -static ap_hash_t *dav_liveprop_uris = NULL; -static int dav_liveprop_count = 0; - - -static ap_status_t dav_cleanup_liveprops(void *ctx) -{ - dav_liveprop_uris = NULL; - dav_liveprop_count = 0; - return APR_SUCCESS; -} - -void dav_register_liveprop_namespace(ap_pool_t *p, const char *uri) -{ - int value; - - /* ### ignore the pool; it is NULL right now */ - p = ap_global_hook_pool; - - if (dav_liveprop_uris == NULL) { - dav_liveprop_uris = ap_make_hash(p); - ap_register_cleanup(p, NULL, dav_cleanup_liveprops, ap_null_cleanup); - } - - value = (int)ap_hash_get(dav_liveprop_uris, uri, 0); - if (value != 0) { - /* already registered */ - return; - } - - /* start at 1, and count up */ - ap_hash_set(dav_liveprop_uris, uri, 0, (void *)++dav_liveprop_count); -} - -int dav_get_liveprop_ns_index(const char *uri) -{ - return (int)ap_hash_get(dav_liveprop_uris, uri, 0); -} - -int dav_get_liveprop_ns_count(void) -{ - return dav_liveprop_count; -} - -void dav_add_all_liveprop_xmlns(ap_pool_t *p, ap_text_header *phdr) -{ - ap_hash_index_t *idx = ap_hash_first(dav_liveprop_uris); - - for ( ; idx != NULL; idx = ap_hash_next(idx) ) { - const void *key; - void *val; - const char *s; - - ap_hash_this(idx, &key, NULL, &val); - - s = ap_psprintf(p, " xmlns:lp%d=\"%s\"", (int)val, key); - ap_text_append(p, phdr, s); - } -} diff --git a/modules/dav/main/mod_dav.c b/modules/dav/main/mod_dav.c deleted file mode 100644 index 749994a5e8db462a2f674e05f67b465df9ddd563..0000000000000000000000000000000000000000 --- a/modules/dav/main/mod_dav.c +++ /dev/null @@ -1,3313 +0,0 @@ -/* -** Copyright (C) 1998-2000 Greg Stein. All Rights Reserved. -** -** By using this file, you agree to the terms and conditions set forth in -** the LICENSE.html file which can be found at the top level of the mod_dav -** distribution or at http://www.webdav.org/mod_dav/license-1.html. -** -** Contact information: -** Greg Stein, PO Box 760, Palo Alto, CA, 94302 -** gstein@lyra.org, http://www.webdav.org/mod_dav/ -*/ - -/* -** DAV extension module for Apache 1.3.* -** This module is repository-independent. It depends on hooks provided by a -** repository implementation. -** -** Written by Greg Stein, gstein@lyra.org, http://www.lyra.org/ -** -** APACHE ISSUES: -** - within a DAV hierarchy, if an unknown method is used and we default -** to Apache's implementation, it sends back an OPTIONS with the wrong -** set of methods -- there is NO HOOK for us. -** therefore: we need to manually handle the HTTP_METHOD_NOT_ALLOWED -** and HTTP_NOT_IMPLEMENTED responses (not ap_send_error_response). -** - process_mkcol_body() had to dup code from ap_setup_client_block(). -** - it would be nice to get status lines from Apache for arbitrary -** status codes -** - it would be nice to be able to extend Apache's set of response -** codes so that it doesn't return 500 when an unknown code is placed -** into r->status. -** - http_vhost functions should apply "const" to their params -** -** DESIGN NOTES: -** - For PROPFIND, we batch up the entire response in memory before -** sending it. We may want to reorganize around sending the information -** as we suck it in from the propdb. Alternatively, we should at least -** generate a total Content-Length if we're going to buffer in memory -** so that we can keep the connection open. -*/ - -#include "httpd.h" -#include "http_config.h" -#include "http_core.h" -#include "http_log.h" -#include "http_main.h" -#include "http_protocol.h" -#include "http_request.h" -#include "util_script.h" - -#include "mod_dav.h" - -#include "dav_opaquelock.h" - - -enum { - DAV_ENABLED_UNSET = 0, - DAV_ENABLED_OFF, - DAV_ENABLED_ON -}; - -/* per-dir configuration */ -typedef struct { - int enabled; - const char *dir; - int locktimeout; - int handle_get; /* cached from repository hook structure */ - int allow_depthinfinity; - long limit_xml_body; - - table *d_params; /* per-directory DAV config parameters */ - struct dav_dyn_mod_ctx *dmc; - - dav_dyn_hooks propdb; - dav_dyn_hooks locks; - dav_dyn_hooks *liveprop; - dav_dyn_hooks repository; - dav_dyn_hooks vsn; -} dav_dir_conf; - -/* per-server configuration */ -typedef struct { - const char *lockdb_path; /* lock database path */ - - uuid_state st; /* UUID state for opaquelocktoken */ - -} dav_server_conf; - -#define DAV_INHERIT_VALUE(parent, child, field) \ - ((child)->field ? (child)->field : (parent)->field) - -/* LimitXMLRequestBody handling */ -#define DAV_LIMIT_UNSET ((long) -1) -#define DAV_DEFAULT_LIMIT_XML_BODY ((size_t)1000000) - - -/* forward-declare for use in configuration lookup */ -extern module MODULE_VAR_EXPORT dav_module; - -/* copy a module's providers into our per-directory configuration state */ -static void dav_copy_providers(pool *p, const char *name, dav_dir_conf *conf) -{ - const dav_dyn_module *mod; - const dav_dyn_provider *provider; - dav_dyn_hooks hooks; - void *ctx; - - mod = dav_find_module(name); - /* ### if NULL? need to error out somehow... */ - - /* Set hooks for any providers in the module */ - ctx = dav_prepare_scan(p, mod); - if (ctx == NULL) { - /* ### how to signal an error? */ - return; - } - - while (!dav_scan_providers(ctx, &provider, &hooks)) { - - switch (provider->type) { - - case DAV_DYN_TYPE_PROPDB: - conf->propdb = hooks; - break; - - case DAV_DYN_TYPE_LOCKS: - conf->locks = hooks; - break; - - case DAV_DYN_TYPE_QUERY_GRAMMAR: - /* ### not yet defined */ - break; - - case DAV_DYN_TYPE_ACL: - /* ### not yet defined */ - break; - - case DAV_DYN_TYPE_VSN: - conf->vsn = hooks; - break; - - case DAV_DYN_TYPE_REPOSITORY: - conf->repository = hooks; - conf->handle_get = DAV_AS_HOOKS_REPOSITORY(&hooks)->handle_get; - break; - - case DAV_DYN_TYPE_LIVEPROP: - { - dav_dyn_hooks *ddh = ap_palloc(p, sizeof(*ddh)); - - *ddh = hooks; - ddh->next = conf->liveprop; - conf->liveprop = ddh; - break; - } - - default: - /* ### need to error out somehow... */ - break; - } - } -} - -static void dav_init_handler(server_rec *s, pool *p) -{ - /* DBG0("dav_init_handler"); */ - - ap_add_version_component("DAV/" DAV_VERSION); - - dav_process_builtin_modules(p); -} - -static void *dav_create_server_config(pool *p, server_rec *s) -{ - dav_server_conf *newconf; - - newconf = (dav_server_conf *) ap_pcalloc(p, sizeof(*newconf)); - - newconf->lockdb_path = NULL; - dav_create_uuid_state(&newconf->st); - - return newconf; -} - -static void *dav_merge_server_config(pool *p, void *base, void *overrides) -{ - dav_server_conf *parent = base; - dav_server_conf *child = overrides; - dav_server_conf *newconf; - - newconf = (dav_server_conf *) ap_pcalloc(p, sizeof(*newconf)); - - newconf->lockdb_path = DAV_INHERIT_VALUE(parent, child, lockdb_path); - - memcpy(&newconf->st, &child->st, sizeof(newconf->st)); - - return newconf; -} - -static void *dav_create_dir_config(pool *p, char *dir) -{ - /* NOTE: dir==NULL creates the default per-dir config */ - - dav_dir_conf *conf; - - conf = (dav_dir_conf *) ap_pcalloc(p, sizeof(*conf)); - conf->dir = ap_pstrdup(p, dir); - conf->d_params = ap_make_table(p, 1); - conf->limit_xml_body = DAV_LIMIT_UNSET; - - /* DBG1("dav_create_dir_config: %08lx", (long)conf); */ - - /* - ** Locate the appropriate module (NULL == default) and copy the module's - ** providers' hooks into our configuration state. - */ - dav_copy_providers(p, NULL, conf); - - return conf; -} - -static void *dav_merge_dir_config(pool *p, void *base, void *overrides) -{ - dav_dir_conf *parent = base; - dav_dir_conf *child = overrides; - dav_dir_conf *newconf = (dav_dir_conf *) ap_pcalloc(p, sizeof(*newconf)); - - /* DBG3("dav_merge_dir_config: new=%08lx base=%08lx overrides=%08lx", - (long)newconf, (long)base, (long)overrides); */ - - newconf->enabled = DAV_INHERIT_VALUE(parent, child, enabled); - newconf->locktimeout = DAV_INHERIT_VALUE(parent, child, locktimeout); - newconf->dir = DAV_INHERIT_VALUE(parent, child, dir); - newconf->allow_depthinfinity = DAV_INHERIT_VALUE(parent, child, - allow_depthinfinity); - - if (child->limit_xml_body != DAV_LIMIT_UNSET) - newconf->limit_xml_body = child->limit_xml_body; - else - newconf->limit_xml_body = parent->limit_xml_body; - - newconf->d_params = ap_copy_table(p, parent->d_params); - ap_overlap_tables(newconf->d_params, child->d_params, - AP_OVERLAP_TABLES_SET); - - if (child->propdb.hooks != NULL) - newconf->propdb = child->propdb; - else - newconf->propdb = parent->propdb; - - if (child->locks.hooks != NULL) - newconf->locks = child->locks; - else - newconf->locks = parent->locks; - - if (child->vsn.hooks != NULL) - newconf->vsn = child->vsn; - else - newconf->vsn = parent->vsn; - - if (child->repository.hooks != NULL) - newconf->repository = child->repository; - else - newconf->repository = parent->repository; - newconf->handle_get = - newconf->repository.hooks != NULL - && DAV_AS_HOOKS_REPOSITORY(&newconf->repository)->handle_get; - - if (child->liveprop != NULL) - newconf->liveprop = child->liveprop; - else - newconf->liveprop = parent->liveprop; - - return newconf; -} - -uuid_state *dav_get_uuid_state(const request_rec *r) -{ - dav_server_conf *conf; - - conf = ap_get_module_config(r->server->module_config, &dav_module); - - return &conf->st; -} - -const char *dav_get_lockdb_path(const request_rec *r) -{ - dav_server_conf *conf; - - conf = ap_get_module_config(r->server->module_config, &dav_module); - return conf->lockdb_path; -} - -table *dav_get_dir_params(const request_rec *r) -{ - dav_dir_conf *conf; - - conf = ap_get_module_config(r->per_dir_config, &dav_module); - return conf->d_params; -} - -size_t dav_get_limit_xml_body(const request_rec *r) -{ - dav_dir_conf *conf; - - conf = ap_get_module_config(r->per_dir_config, &dav_module); - if (conf->limit_xml_body == DAV_LIMIT_UNSET) - return DAV_DEFAULT_LIMIT_XML_BODY; - return (size_t)conf->limit_xml_body; -} - -const dav_dyn_hooks *dav_get_provider_hooks(request_rec *r, int provider_type) -{ - dav_dir_conf *conf; - const dav_dyn_hooks *hooks; - static const dav_dyn_hooks null_hooks = { { 0 } }; - - /* Call repository hook to resolve resource */ - conf = (dav_dir_conf *) ap_get_module_config(r->per_dir_config, - &dav_module); - switch (provider_type) { - - case DAV_DYN_TYPE_PROPDB: - hooks = &conf->propdb; - break; - - case DAV_DYN_TYPE_LOCKS: - hooks = &conf->locks; - break; - - case DAV_DYN_TYPE_QUERY_GRAMMAR: - /* ### not yet defined */ - hooks = &null_hooks; - break; - - case DAV_DYN_TYPE_ACL: - /* ### not yet defined */ - hooks = &null_hooks; - break; - - case DAV_DYN_TYPE_VSN: - hooks = &conf->vsn; - break; - - case DAV_DYN_TYPE_REPOSITORY: - hooks = &conf->repository; - break; - - case DAV_DYN_TYPE_LIVEPROP: - hooks = conf->liveprop; - break; - - default: - /* unknown provider type */ - hooks = &null_hooks; - break; - } - - return hooks; -} - -/* - * Command handler for the DAV directive, which is FLAG. - */ -static const char *dav_cmd_dav(cmd_parms *cmd, void *config, int arg) -{ - dav_dir_conf *conf = (dav_dir_conf *) config; - - if (arg) - conf->enabled = DAV_ENABLED_ON; - else - conf->enabled = DAV_ENABLED_OFF; - return NULL; -} - -/* - * Command handler for the DAVDepthInfinity directive, which is FLAG. - */ -static const char *dav_cmd_davdepthinfinity(cmd_parms *cmd, void *config, - int arg) -{ - dav_dir_conf *conf = (dav_dir_conf *) config; - - if (arg) - conf->allow_depthinfinity = DAV_ENABLED_ON; - else - conf->allow_depthinfinity = DAV_ENABLED_OFF; - return NULL; -} - -/* - * Command handler for the DAVLockDB directive, which is TAKE1 - */ -static const char *dav_cmd_davlockdb(cmd_parms *cmd, void *config, char *arg1) -{ - dav_server_conf *conf; - - conf = (dav_server_conf *) ap_get_module_config(cmd->server->module_config, - &dav_module); - arg1 = ap_os_canonical_filename(cmd->pool, arg1); - conf->lockdb_path = ap_server_root_relative(cmd->pool, arg1); - - return NULL; -} - -/* - * Command handler for DAVMinTimeout directive, which is TAKE1 - */ -static const char *dav_cmd_davmintimeout(cmd_parms *cmd, void *config, - char *arg1) -{ - dav_dir_conf *conf = (dav_dir_conf *) config; - - conf->locktimeout = atoi(arg1); - if (conf->locktimeout < 0) - return "DAVMinTimeout requires a non-negative integer."; - - return NULL; -} - -/* - * Command handler for DAVParam directive, which is TAKE2 - */ -static const char *dav_cmd_davparam(cmd_parms *cmd, void *config, - char *arg1, char *arg2) -{ - dav_dir_conf *conf = (dav_dir_conf *) config; - - ap_table_set(conf->d_params, arg1, arg2); - - return NULL; -} - -/* - * Command handler for LimitXMLRequestBody directive, which is TAKE1 - */ -static const char *dav_cmd_limitxmlrequestbody(cmd_parms *cmd, void *config, - char *arg1) -{ - dav_dir_conf *conf = (dav_dir_conf *) config; - - conf->limit_xml_body = atol(arg1); - if (conf->limit_xml_body < 0) - return "LimitXMLRequestBody requires a non-negative integer."; - - return NULL; -} - -/* -** dav_error_response() -** -** Send a nice response back to the user. In most cases, Apache doesn't -** allow us to provide details in the body about what happened. This -** function allows us to completely specify the response body. -*/ -static int dav_error_response(request_rec *r, int status, const char *body) -{ - r->status = status; - r->content_type = "text/html"; - - /* since we're returning DONE, ensure the request body is consumed. */ - (void) ap_discard_request_body(r); - - /* begin the response now... */ - ap_send_http_header(r); - - /* ### hard or soft? */ - ap_soft_timeout("send error body", r); - - ap_rvputs(r, - DAV_RESPONSE_BODY_1, - r->status_line, - DAV_RESPONSE_BODY_2, - &r->status_line[4], - DAV_RESPONSE_BODY_3, - NULL); - - ap_rputs(body, r); - - ap_rputs(ap_psignature("\n


    \n", r), r); - ap_rputs(DAV_RESPONSE_BODY_4, r); - - ap_kill_timeout(r); - - /* the response has been sent. */ - /* - * ### Use of DONE obviates logging..! - */ - return DONE; -} - -/* -** Apache's URI escaping does not replace '&' since that is a valid character -** in a URI (to form a query section). We must explicitly handle it so that -** we can embed the URI into an XML document. -*/ -static const char *dav_xml_escape_uri(pool *p, const char *uri) -{ - const char *e_uri = ap_escape_uri(p, uri); - - /* check the easy case... */ - if (strchr(e_uri, '&') == NULL) - return e_uri; - - /* more work needed... sigh. */ - - /* - ** Note: this is a teeny bit of overkill since we know there are no - ** '<' or '>' characters, but who cares. - */ - return dav_quote_string(p, e_uri, 0); -} - -static void dav_send_multistatus(request_rec *r, int status, - dav_response *first, - array_header *namespaces) -{ - /* Set the correct status and Content-Type */ - r->status = status; - r->content_type = DAV_XML_CONTENT_TYPE; - - /* Send all of the headers now */ - ap_send_http_header(r); - - /* Start a timeout for delivering the response. */ - ap_soft_timeout("sending multistatus response", r); - - /* Send the actual multistatus response now... */ - ap_rputs(DAV_XML_HEADER DEBUG_CR - "nelts; i--; ) { - ap_rprintf(r, " xmlns:ns%d=\"%s\"", i, - DAV_GET_URI_ITEM(namespaces, i)); - } - } - - /* ap_rputc('>', r); */ - ap_rputs(">" DEBUG_CR, r); - - for (; first != NULL; first = first->next) { - dav_text *t; - - if (first->propresult.xmlns == NULL) { - ap_rputs("", r); - } - else { - ap_rputs("propresult.xmlns; t; t = t->next) { - ap_rputs(t->text, r); - } - ap_rputc('>', r); - } - - ap_rputs(DEBUG_CR "", r); - ap_rputs(dav_xml_escape_uri(r->pool, first->href), r); - ap_rputs("" DEBUG_CR, r); - - if (first->propresult.propstats == NULL) { - /* ### it would be nice to get a status line from Apache */ - ap_rprintf(r, - "HTTP/1.1 %d status text goes here" - DEBUG_CR, first->status); - } - else { - /* assume this includes and is quoted properly */ - for (t = first->propresult.propstats; t; t = t->next) { - ap_rputs(t->text, r); - } - } - - if (first->desc != NULL) { - /* - ** We supply the description, so we know it doesn't have to - ** have any escaping/encoding applied to it. - */ - ap_rputs("", r); - ap_rputs(first->desc, r); - ap_rputs("" DEBUG_CR, r); - } - - ap_rputs("" DEBUG_CR, r); - } - - ap_rputs("" DEBUG_CR, r); - - /* Done with sending and the timeout. */ - ap_kill_timeout(r); -} - -/* -** dav_log_err() -** -** Write error information to the log. -*/ -static void dav_log_err(request_rec *r, dav_error *err, int level) -{ - dav_error *errscan; - - /* Log the errors */ - /* ### should have a directive to log the first or all */ - for (errscan = err; errscan != NULL; errscan = errscan->prev) { - if (errscan->desc == NULL) - continue; - if (errscan->save_errno != 0) { - errno = errscan->save_errno; - ap_log_rerror(APLOG_MARK, level, r, "%s [%d, #%d]", - errscan->desc, errscan->status, errscan->error_id); - } - else { - ap_log_rerror(APLOG_MARK, level | APLOG_NOERRNO, r, - "%s [%d, #%d]", - errscan->desc, errscan->status, errscan->error_id); - } - } -} - -/* -** dav_handle_err() -** -** Handle the standard error processing. must be non-NULL. -** -** is set by the following: -** - dav_validate_request() -** - dav_add_lock() -** - repos_hooks->remove_resource -** - repos_hooks->move_resource -** - repos_hooks->copy_resource -*/ -static int dav_handle_err(request_rec *r, dav_error *err, - dav_response *response) -{ - /* log the errors */ - dav_log_err(r, err, APLOG_ERR); - - if (response == NULL) { - /* our error messages are safe; tell Apache this */ - ap_table_setn(r->notes, "verbose-error-to", "*"); - return err->status; - } - - /* since we're returning DONE, ensure the request body is consumed. */ - (void) ap_discard_request_body(r); - - /* send the multistatus and tell Apache the request/response is DONE. */ - dav_send_multistatus(r, err->status, response, NULL); - return DONE; -} - -/* handy function for return values of methods that (may) create things */ -static int dav_created(request_rec *r, request_rec *rnew, - dav_resource *res, const char *what, - int replaced) -{ - const char *body; - - if (rnew == NULL) { - rnew = r; - } - - /* did the target resource already exist? */ - if (replaced) { - /* Apache will supply a default message */ - return HTTP_NO_CONTENT; - } - - /* Per HTTP/1.1, S10.2.2: add a Location header to contain the - * URI that was created. */ - - /* ### rnew->uri does not contain an absoluteURI. S14.30 states that - * ### the Location header requires an absoluteURI. where to get it? */ - /* ### disable until we get the right value */ -#if 0 - ap_table_setn(r->headers_out, "Location", rnew->uri); -#endif - - /* ### insert an ETag header? see HTTP/1.1 S10.2.2 */ - - /* Apache doesn't allow us to set a variable body for HTTP_CREATED, so - * we must manufacture the entire response. */ - body = ap_psprintf(r->pool, "%s %s has been created.", - what, - ap_escape_html(rnew->pool, rnew->uri)); - return dav_error_response(r, HTTP_CREATED, body); -} - -/* ### move to dav_util? */ -int dav_get_depth(request_rec *r, int def_depth) -{ - const char *depth = ap_table_get(r->headers_in, "Depth"); - - if (depth == NULL) { - return def_depth; - } - if (strcasecmp(depth, "infinity") == 0) { - return DAV_INFINITY; - } - else if (strcmp(depth, "0") == 0) { - return 0; - } - else if (strcmp(depth, "1") == 0) { - return 1; - } - - /* The caller will return an HTTP_BAD_REQUEST. This will augment the - * default message that Apache provides. */ - ap_log_rerror(APLOG_MARK, APLOG_ERR | APLOG_NOERRNO, r, - "An invalid Depth header was specified."); - return -1; -} - -static int dav_get_overwrite(request_rec *r) -{ - const char *overwrite = ap_table_get(r->headers_in, "Overwrite"); - - if (overwrite == NULL) { - return 1; /* default is "T" */ - } - - if ((*overwrite == 'F' || *overwrite == 'f') && overwrite[1] == '\0') { - return 0; - } - if ((*overwrite == 'T' || *overwrite == 't') && overwrite[1] == '\0') { - return 1; - } - - /* The caller will return an HTTP_BAD_REQUEST. This will augment the - * default message that Apache provides. */ - ap_log_rerror(APLOG_MARK, APLOG_ERR | APLOG_NOERRNO, r, - "An invalid Overwrite header was specified."); - return -1; -} - -/* resolve a request URI to a resource descriptor */ -static int dav_get_resource(request_rec *r, dav_resource **res_p) -{ - dav_dir_conf *conf; - const dav_hooks_repository *repos_hooks; - - /* Call repository hook to resolve resource */ - conf = (dav_dir_conf *) ap_get_module_config(r->per_dir_config, - &dav_module); - - repos_hooks = DAV_AS_HOOKS_REPOSITORY(&conf->repository); - if (repos_hooks == NULL || repos_hooks->get_resource == NULL) { - /* ### this should happen at startup rather than per-request */ - ap_log_rerror(APLOG_MARK, APLOG_ERR | APLOG_NOERRNO, r, - "No %s has been configured.", - repos_hooks == NULL - ? "repository module" - : "GET handler"); - return HTTP_INTERNAL_SERVER_ERROR; - } - - *res_p = (*repos_hooks->get_resource)(r, conf->dir, - dav_get_target_selector(r)); - if (*res_p == NULL) { - /* Apache will supply a default error for this. */ - return HTTP_NOT_FOUND; - } - - return OK; -} - -static dav_error * dav_open_lockdb(request_rec *r, int ro, dav_lockdb **lockdb) -{ - const dav_hooks_locks *hooks = DAV_GET_HOOKS_LOCKS(r); - - if (hooks == NULL) { - *lockdb = NULL; - return NULL; - } - - /* open the thing lazily */ - return (*hooks->open_lockdb)(r, ro, 0, lockdb); -} - -static int dav_parse_range(request_rec *r, - off_t *range_start, off_t *range_end) -{ - const char *range; - char *dash; - char *slash; - - range = ap_table_get(r->headers_in, "content-range"); - if (range == NULL) - return 0; - - range = ap_pstrdup(r->pool, range); - if (strncasecmp(range, "bytes ", 6) != 0 - || (dash = strchr(range, '-')) == NULL - || (slash = strchr(range, '/')) == NULL) { - /* malformed header. ignore it (per S14.16 of RFC2616) */ - return 0; - } - - *dash = *slash = '\0'; - *range_start = atol(range + 6); - *range_end = atol(dash + 1); - if (*range_end < *range_start - || (slash[1] != '*' && atol(slash + 1) <= *range_end)) { - /* invalid range. ignore it (per S14.16 of RFC2616) */ - return 0; - } - - /* we now have a valid range */ - return 1; -} - -/* handle the GET method */ -static int dav_method_get(request_rec *r) -{ - dav_resource *resource; - int result; - - /* This method should only be called when the resource is not - * visible to Apache. We will fetch the resource from the repository, - * then create a subrequest for Apache to handle. - */ - result = dav_get_resource(r, &resource); - if (result != OK) - return result; - if (!resource->exists) { - /* Apache will supply a default error for this. */ - return HTTP_NOT_FOUND; - } - - /* Check resource type */ - if (resource->type != DAV_RESOURCE_TYPE_REGULAR && - resource->type != DAV_RESOURCE_TYPE_REVISION) { - return dav_error_response(r, HTTP_CONFLICT, - "Cannot GET this type of resource."); - } - - /* Cannot handle GET of a collection from a repository */ - if (resource->collection) { - return dav_error_response(r, HTTP_CONFLICT, - "No default response to GET for a " - "collection."); - } - - /* - ** We can use two different approaches for a GET. - ** - ** 1) get_pathname will return a pathname to a file which should be - ** sent to the client. If the repository provides this, then we - ** use it. - ** - ** This is the best alternative since it allows us to do a sub- - ** request on the file, which gives the Apache framework a chance - ** to deal with negotiation, MIME types, or whatever. - ** - ** 2) open_stream and read_stream. - */ - if (resource->hooks->get_pathname != NULL) { - const char *pathname; - void *fhandle; - request_rec *new_req; - - /* Ask repository for copy of file */ - pathname = (*resource->hooks->get_pathname)(resource, &fhandle); - if (pathname == NULL) { - return HTTP_NOT_FOUND; - } - - /* Convert to canonical filename, so Apache detects component - * separators (on Windows, it only looks for '/', not '\') - */ - pathname = ap_os_case_canonical_filename(r->pool, pathname); - - /* Create a sub-request with the new filename */ - new_req = ap_sub_req_lookup_file(pathname, r); - if (new_req == NULL) { - (*resource->hooks->free_file)(fhandle); - return HTTP_INTERNAL_SERVER_ERROR; - } - - /* This may be a HEAD request */ - new_req->header_only = r->header_only; - - /* ### this enables header generation */ - new_req->assbackwards = 0; - - /* Run the sub-request */ - result = ap_run_sub_req(new_req); - ap_destroy_sub_req(new_req); - - /* Free resources */ - (*resource->hooks->free_file)(fhandle); - - return result; - } - else { - dav_stream_mode mode; - dav_stream *stream; - dav_error *err; - void *buffer; - int has_range; - off_t range_start; - off_t range_end; - - /* set up the HTTP headers for the response */ - if ((err = (*resource->hooks->set_headers)(r, resource)) != NULL) { - err = dav_push_error(r->pool, err->status, 0, - "Unable to set up HTTP headers.", - err); - return dav_handle_err(r, err, NULL); - } - - /* use plain READ mode unless we see a Content-Range */ - mode = DAV_MODE_READ; - - /* process the Content-Range header (if present) */ - has_range = dav_parse_range(r, &range_start, &range_end); - if (has_range) { - /* use a read mode which is seekable */ - mode = DAV_MODE_READ_SEEKABLE; - - /* prep the output */ - r->status = HTTP_PARTIAL_CONTENT; - ap_table_setn(r->headers_out, - "Content-Range", - ap_psprintf(r->pool, "bytes %ld-%ld/*", - range_start, range_end)); - ap_set_content_length(r, range_end - range_start + 1); - } - - if (r->header_only) { - ap_send_http_header(r); - return DONE; - } - - if ((err = (*resource->hooks->open_stream)(resource, mode, - &stream)) != NULL) { - /* ### assuming FORBIDDEN is probably not quite right... */ - err = dav_push_error(r->pool, HTTP_FORBIDDEN, 0, - ap_psprintf(r->pool, - "Unable to GET contents for %s.", - ap_escape_html(r->pool, r->uri)), - err); - return dav_handle_err(r, err, NULL); - } - - if (has_range - && (err = (*resource->hooks->seek_stream)(stream, - range_start)) != NULL) { - err = dav_push_error(r->pool, err->status, 0, - "Could not seek to beginning of the " - "specified Content-Range.", err); - return dav_handle_err(r, err, NULL); - } - - /* all set. send the headers now. */ - ap_send_http_header(r); - - /* start a timeout for delivering the response. */ - ap_soft_timeout("sending GET response", r); - - buffer = ap_palloc(r->pool, DAV_READ_BLOCKSIZE); - while (1) { - size_t amt; - - if (!has_range) - amt = DAV_READ_BLOCKSIZE; - else if ((range_end - range_start + 1) > DAV_READ_BLOCKSIZE) - amt = DAV_READ_BLOCKSIZE; - else { - /* note: range_end - range_start is an ssize_t */ - amt = (size_t)(range_end - range_start + 1); - } - - if ((err = (*resource->hooks->read_stream)(stream, buffer, - &amt)) != NULL) { - break; - } - if (amt == 0) { - /* no more content */ - break; - } - if (ap_rwrite(buffer, amt, r) < 0) { - /* ### what to do with this error? */ - break; - } - - if (has_range) { - range_start += amt; - if (range_start > range_end) - break; - } - - /* reset the timeout after a successful write */ - ap_reset_timeout(r); - } - - /* Done with the request; clear its timeout */ - ap_kill_timeout(r); - - if (err != NULL) - return dav_handle_err(r, err, NULL); - - /* - ** ### range_start should equal range_end+1. if it doesn't, then - ** ### we did not send enough data to the client. the client will - ** ### hang (and timeout) waiting for the data. - ** - ** ### what to do? abort the connection? - */ - return DONE; - } - - /* NOTREACHED */ -} - -/* validate resource on POST, then pass it off to the default handler */ -static int dav_method_post(request_rec *r) -{ - dav_resource *resource; - dav_error *err; - int result; - - /* Ask repository module to resolve the resource */ - result = dav_get_resource(r, &resource); - if (result != OK) { - return result; - } - - /* Note: depth == 0. Implies no need for a multistatus response. */ - if ((err = dav_validate_request(r, resource, 0, NULL, NULL, - DAV_VALIDATE_RESOURCE, NULL)) != NULL) { - /* ### add a higher-level description? */ - return dav_handle_err(r, err, NULL); - } - - return DECLINED; -} - -/* handle the PUT method */ -static int dav_method_put(request_rec *r) -{ - dav_resource *resource; - int resource_state; - dav_resource *resource_parent; - const dav_hooks_locks *locks_hooks = DAV_GET_HOOKS_LOCKS(r); - const char *body; - dav_error *err; - dav_error *err2; - int result; - int resource_existed = 0; - int resource_was_writable = 0; - int parent_was_writable = 0; - dav_stream_mode mode; - dav_stream *stream; - dav_response *multi_response; - int has_range; - off_t range_start; - off_t range_end; - - if ((result = ap_setup_client_block(r, REQUEST_CHUNKED_DECHUNK)) != OK) { - return result; - } - - /* Ask repository module to resolve the resource */ - result = dav_get_resource(r, &resource); - if (result != OK) { - return result; - } - - /* If not a file or collection resource, PUT not allowed */ - if (resource->type != DAV_RESOURCE_TYPE_REGULAR) { - body = ap_psprintf(r->pool, - "Cannot create resource %s with PUT.", - ap_escape_html(r->pool, r->uri)); - return dav_error_response(r, HTTP_CONFLICT, body); - } - - /* Cannot PUT a collection */ - if (resource->collection) { - return dav_error_response(r, HTTP_CONFLICT, - "Cannot PUT to a collection."); - - } - - resource_state = dav_get_resource_state(r, resource); - - /* - ** Note: depth == 0 normally requires no multistatus response. However, - ** if we pass DAV_VALIDATE_PARENT, then we could get an error on a URI - ** other than the Request-URI, thereby requiring a multistatus. - ** - ** If the resource does not exist (DAV_RESOURCE_NULL), then we must - ** check the resource *and* its parent. If the resource exists or is - ** a locknull resource, then we check only the resource. - */ - if ((err = dav_validate_request(r, resource, 0, NULL, &multi_response, - resource_state == DAV_RESOURCE_NULL ? - DAV_VALIDATE_PARENT : - DAV_VALIDATE_RESOURCE, NULL)) != NULL) { - /* ### add a higher-level description? */ - return dav_handle_err(r, err, multi_response); - } - - /* make sure the resource can be modified (if versioning repository) */ - if ((err = dav_ensure_resource_writable(r, resource, - 0 /* not parent_only */, - &resource_parent, - &resource_existed, - &resource_was_writable, - &parent_was_writable)) != NULL) { - /* ### add a higher-level description? */ - return dav_handle_err(r, err, NULL); - } - - /* truncate and rewrite the file unless we see a Content-Range */ - mode = DAV_MODE_WRITE_TRUNC; - - has_range = dav_parse_range(r, &range_start, &range_end); - if (has_range) { - mode = DAV_MODE_WRITE_SEEKABLE; - } - - /* Create the new file in the repository */ - if ((err = (*resource->hooks->open_stream)(resource, mode, - &stream)) != NULL) { - /* ### assuming FORBIDDEN is probably not quite right... */ - err = dav_push_error(r->pool, HTTP_FORBIDDEN, 0, - ap_psprintf(r->pool, - "Unable to PUT new contents for %s.", - ap_escape_html(r->pool, r->uri)), - err); - } - - if (err == NULL && has_range) { - /* a range was provided. seek to the start */ - err = (*resource->hooks->seek_stream)(stream, range_start); - } - - if (err == NULL) { - if (ap_should_client_block(r)) { - char *buffer = ap_palloc(r->pool, DAV_READ_BLOCKSIZE); - long len; - - /* - ** Once we start reading the request, then we must read the - ** whole darn thing. ap_discard_request_body() won't do anything - ** for a partially-read request. - */ - - while ((len = ap_get_client_block(r, buffer, - DAV_READ_BLOCKSIZE)) > 0) { - if (err == NULL) { - /* write whatever we read, until we see an error */ - err = (*resource->hooks->write_stream)(stream, - buffer, len); - } - } - - /* - ** ### what happens if we read more/less than the amount - ** ### specified in the Content-Range? eek... - */ - - if (len == -1) { - /* - ** Error reading request body. This has precedence over - ** prior errors. - */ - err = dav_new_error(r->pool, HTTP_BAD_REQUEST, 0, - "An error occurred while reading the " - "request body."); - } - } - - err2 = (*resource->hooks->close_stream)(stream, - err == NULL /* commit */); - if (err2 != NULL && err == NULL) { - /* no error during the write, but we hit one at close. use it. */ - err = err2; - } - } - - /* - ** Ensure that we think the resource exists now. - ** ### eek. if an error occurred during the write and we did not commit, - ** ### then the resource might NOT exist (e.g. dav_fs_repos.c) - */ - if (err == NULL) { - resource->exists = 1; - } - - /* restore modifiability of resources back to what they were */ - err2 = dav_revert_resource_writability(r, resource, resource_parent, - err != NULL /* undo if error */, - resource_existed, - resource_was_writable, - parent_was_writable); - - /* check for errors now */ - if (err != NULL) { - return dav_handle_err(r, err, NULL); - } - if (err2 != NULL) { - /* just log a warning */ - err2 = dav_push_error(r->pool, err->status, 0, - "The PUT was successful, but there " - "was a problem reverting the writability of " - "the resource or its parent collection.", - err2); - dav_log_err(r, err2, APLOG_WARNING); - } - - /* ### place the Content-Type and Content-Language into the propdb */ - - if (locks_hooks != NULL) { - dav_lockdb *lockdb; - - if ((err = (*locks_hooks->open_lockdb)(r, 0, 0, &lockdb)) != NULL) { - /* The file creation was successful, but the locking failed. */ - err = dav_push_error(r->pool, err->status, 0, - "The file was PUT successfully, but there " - "was a problem opening the lock database " - "which prevents inheriting locks from the " - "parent resources.", - err); - return dav_handle_err(r, err, NULL); - } - - /* notify lock system that we have created/replaced a resource */ - err = dav_notify_created(r, lockdb, resource, resource_state, 0); - - (*locks_hooks->close_lockdb)(lockdb); - - if (err != NULL) { - /* The file creation was successful, but the locking failed. */ - err = dav_push_error(r->pool, err->status, 0, - "The file was PUT successfully, but there " - "was a problem updating its lock " - "information.", - err); - return dav_handle_err(r, err, NULL); - } - } - - /* NOTE: WebDAV spec, S8.7.1 states properties should be unaffected */ - - /* return an appropriate response (HTTP_CREATED or HTTP_NO_CONTENT) */ - return dav_created(r, NULL, resource, "Resource", resource_existed); -} - -/* ### move this to dav_util? */ -void dav_add_response(dav_walker_ctx *ctx, const char *href, int status, - dav_get_props_result *propstats) -{ - dav_response *resp; - - /* just drop some data into an dav_response */ - resp = ap_pcalloc(ctx->pool, sizeof(*resp)); - resp->href = ap_pstrdup(ctx->pool, href); - resp->status = status; - if (propstats) { - resp->propresult = *propstats; - } - resp->next = ctx->response; - - ctx->response = resp; -} - -/* handle the DELETE method */ -static int dav_method_delete(request_rec *r) -{ - dav_resource *resource; - dav_resource *resource_parent = NULL; - dav_error *err; - dav_error *err2; - dav_response *multi_response; - const char *body; - int result; - int depth; - int parent_was_writable = 0; - - /* We don't use the request body right now, so torch it. */ - if ((result = ap_discard_request_body(r)) != OK) { - return result; - } - - /* Ask repository module to resolve the resource */ - result = dav_get_resource(r, &resource); - if (result != OK) - return result; - if (!resource->exists) { - /* Apache will supply a default error for this. */ - return HTTP_NOT_FOUND; - } - - /* 2518 says that depth must be infinity only for collections. - * For non-collections, depth is ignored, unless it is an illegal value (1). - */ - depth = dav_get_depth(r, DAV_INFINITY); - - if (resource->collection && depth != DAV_INFINITY) { - /* This supplies additional information for the default message. */ - ap_log_rerror(APLOG_MARK, APLOG_ERR | APLOG_NOERRNO, r, - "Depth must be \"infinity\" for DELETE of a collection."); - return HTTP_BAD_REQUEST; - } - if (!resource->collection && depth == 1) { - /* This supplies additional information for the default message. */ - ap_log_rerror(APLOG_MARK, APLOG_ERR | APLOG_NOERRNO, r, - "Depth of \"1\" is not allowed for DELETE."); - return HTTP_BAD_REQUEST; - } - - /* Check for valid resource type */ - /* ### allow DAV_RESOURCE_TYPE_REVISION with All-Bindings header */ - if (resource->type != DAV_RESOURCE_TYPE_REGULAR && - resource->type != DAV_RESOURCE_TYPE_WORKSPACE) { - body = ap_psprintf(r->pool, - "Cannot delete resource %s.", - ap_escape_html(r->pool, r->uri)); - return dav_error_response(r, HTTP_CONFLICT, body); - } - - /* - ** If any resources fail the lock/If: conditions, then we must fail - ** the delete. Each of the failing resources will be listed within - ** a DAV:multistatus body, wrapped into a 424 response. - ** - ** Note that a failure on the resource itself does not generate a - ** multistatus response -- only internal members/collections. - */ - if ((err = dav_validate_request(r, resource, depth, NULL, - &multi_response, - DAV_VALIDATE_PARENT - | DAV_VALIDATE_USE_424, NULL)) != NULL) { - err = dav_push_error(r->pool, err->status, 0, - ap_psprintf(r->pool, - "Could not DELETE %s due to a failed " - "precondition (e.g. locks).", - ap_escape_html(r->pool, r->uri)), - err); - return dav_handle_err(r, err, multi_response); - } - - /* ### RFC 2518 s. 8.10.5 says to remove _all_ locks, not just those - * locked by the token(s) in the if_header. - */ - if ((result = dav_unlock(r, resource, NULL)) != OK) { - return result; - } - - /* if versioned resource, make sure parent is checked out */ - if ((err = dav_ensure_resource_writable(r, resource, 1 /* parent_only */, - &resource_parent, - NULL, NULL, - &parent_was_writable)) != NULL) { - /* ### add a higher-level description? */ - return dav_handle_err(r, err, NULL); - } - - /* try to remove the resource */ - err = (*resource->hooks->remove_resource)(resource, &multi_response); - - /* restore writability of parent back to what it was */ - err2 = dav_revert_resource_writability(r, NULL, resource_parent, - err != NULL /* undo if error */, - 0, 0, parent_was_writable); - - /* check for errors now */ - if (err != NULL) { - err = dav_push_error(r->pool, err->status, 0, - ap_psprintf(r->pool, - "Could not DELETE %s.", - ap_escape_html(r->pool, r->uri)), - err); - return dav_handle_err(r, err, multi_response); - } - if (err2 != NULL) { - /* just log a warning */ - err = dav_push_error(r->pool, err2->status, 0, - "The DELETE was successful, but there " - "was a problem reverting the writability of " - "its parent collection.", - err2); - dav_log_err(r, err, APLOG_WARNING); - } - - /* ### HTTP_NO_CONTENT if no body, HTTP_OK if there is a body (some day) */ - - /* Apache will supply a default error for this. */ - return HTTP_NO_CONTENT; -} - -/* handle the OPTIONS method */ -static int dav_method_options(request_rec *r) -{ - const dav_hooks_locks *locks_hooks = DAV_GET_HOOKS_LOCKS(r); - const dav_hooks_vsn *vsn_hooks = DAV_GET_HOOKS_VSN(r); - dav_resource *resource; - const char *options; - const char *dav_level; - const char *vsn_level; - int result; - const dav_dir_conf *conf; - const dav_dyn_hooks *lp; - - /* per HTTP/1.1 S9.2, we can discard this body */ - if ((result = ap_discard_request_body(r)) != OK) { - return result; - } - - /* no body */ - ap_set_content_length(r, 0); - - /* resolve the resource */ - result = dav_get_resource(r, &resource); - if (result != OK) - return result; - - /* determine which providers are available */ - dav_level = "1"; - vsn_level = NULL; - - if (locks_hooks != NULL) { - dav_level = "1,2"; - } - if (vsn_hooks != NULL) { - vsn_level = (*vsn_hooks->get_vsn_header)(); - } - - /* - ** Iterate through the live property providers; add their URIs to - ** the dav_level string. - */ - conf = (dav_dir_conf *) ap_get_module_config(r->per_dir_config, - &dav_module); - for (lp = conf->liveprop; lp != NULL; lp = lp->next) { - const char *uri = DAV_AS_HOOKS_LIVEPROP(lp)->propset_uri; - - if (uri != NULL) - dav_level = ap_pstrcat(r->pool, dav_level, ",<", uri, ">", NULL); - } - - /* this tells MSFT products to skip looking for FrontPage extensions */ - ap_table_setn(r->headers_out, "MS-Author-Via", "DAV"); - - /* - ** Three cases: resource is null (3), is lock-null (7.4), or exists. - ** - ** All cases support OPTIONS and LOCK. - ** (Lock-) null resources also support MKCOL and PUT. - ** Lock-null support PROPFIND and UNLOCK. - ** Existing resources support lots of stuff. - */ - - /* ### take into account resource type */ - switch (dav_get_resource_state(r, resource)) - { - case DAV_RESOURCE_EXISTS: - /* resource exists */ - if (resource->collection) { - options = ap_pstrcat(r->pool, - "OPTIONS, " - "GET, HEAD, POST, DELETE, TRACE, " - "PROPFIND, PROPPATCH, COPY, MOVE", - locks_hooks != NULL ? ", LOCK, UNLOCK" : "", - NULL); - } - else { - /* files also support PUT */ - options = ap_pstrcat(r->pool, - "OPTIONS, " - "GET, HEAD, POST, DELETE, TRACE, " - "PROPFIND, PROPPATCH, COPY, MOVE, PUT", - locks_hooks != NULL ? ", LOCK, UNLOCK" : "", - NULL); - } - break; - - case DAV_RESOURCE_LOCK_NULL: - /* resource is lock-null. */ - options = ap_pstrcat(r->pool, "OPTIONS, MKCOL, PUT, PROPFIND", - locks_hooks != NULL ? ", LOCK, UNLOCK" : "", - NULL); - break; - - case DAV_RESOURCE_NULL: - /* resource is null. */ - options = ap_pstrcat(r->pool, "OPTIONS, MKCOL, PUT", - locks_hooks != NULL ? ", LOCK" : "", - NULL); - break; - - default: - /* ### internal error! */ - options = "OPTIONS"; - break; - } - - /* If there is a versioning provider, add versioning options */ - if (vsn_hooks != NULL) { - const char *vsn_options = NULL; - - /* ### take into account resource type */ - if (!resource->exists) { - if ((*vsn_hooks->versionable)(resource)) - vsn_options = ", MKRESOURCE"; - } - else if (!resource->versioned) { - if ((*vsn_hooks->versionable)(resource)) - vsn_options = ", CHECKIN"; - } - else if (resource->working) - vsn_options = ", CHECKIN, UNCHECKOUT"; - else - vsn_options = ", CHECKOUT"; - - if (vsn_options != NULL) - options = ap_pstrcat(r->pool, options, vsn_options, NULL); - } - - ap_table_setn(r->headers_out, "Allow", options); - ap_table_setn(r->headers_out, "DAV", dav_level); - - if (vsn_level != NULL) - ap_table_setn(r->headers_out, "Versioning", vsn_level); - - /* ### this will send a Content-Type. the default OPTIONS does not. */ - ap_send_http_header(r); - - /* ### the default (ap_send_http_options) returns OK, but I believe - * ### that is because it is the default handler and nothing else - * ### will run after the thing. */ - - /* we've sent everything necessary to the client. */ - return DONE; -} - -static void dav_cache_badprops(dav_walker_ctx *ctx) -{ - const dav_xml_elem *elem; - dav_text_header hdr = { 0 }; - - /* just return if we built the thing already */ - if (ctx->propstat_404 != NULL) { - return; - } - - dav_text_append(ctx->pool, &hdr, - "" DEBUG_CR - "" DEBUG_CR); - - elem = dav_find_child(ctx->doc->root, "prop"); - for (elem = elem->first_child; elem; elem = elem->next) { - dav_text_append(ctx->pool, &hdr, dav_empty_elem(ctx->pool, elem)); - } - - dav_text_append(ctx->pool, &hdr, - "" DEBUG_CR - "HTTP/1.1 404 Not Found" DEBUG_CR - "" DEBUG_CR); - - ctx->propstat_404 = hdr.first; -} - -static dav_error * dav_propfind_walker(dav_walker_ctx *ctx, int calltype) -{ - dav_error *err; - dav_propdb *propdb; - dav_get_props_result propstats = { 0 }; - - /* - ** Note: ctx->doc can only be NULL for DAV_PROPFIND_IS_ALLPROP. Since - ** dav_get_allprops() does not need to do namespace translation, - ** we're okay. - ** - ** Note: we cast to lose the "const". The propdb won't try to change - ** the resource, however, since we are opening readonly. - */ - err = dav_open_propdb(ctx->r, ctx->lockdb, - (dav_resource *)ctx->resource, 1, - ctx->doc ? ctx->doc->namespaces : NULL, &propdb); - if (err != NULL) { - /* ### do something with err! */ - - if (ctx->propfind_type == DAV_PROPFIND_IS_PROP) { - dav_get_props_result badprops = { 0 }; - - /* some props were expected on this collection/resource */ - dav_cache_badprops(ctx); - badprops.propstats = ctx->propstat_404; - dav_add_response(ctx, ctx->uri.buf, 0, &badprops); - } - else { - /* no props on this collection/resource */ - dav_add_response(ctx, ctx->uri.buf, HTTP_OK, NULL); - } - return NULL; - } - /* ### what to do about closing the propdb on server failure? */ - - if (ctx->propfind_type == DAV_PROPFIND_IS_PROP) { - propstats = dav_get_props(propdb, ctx->doc); - } - else { - propstats = dav_get_allprops(propdb, - ctx->propfind_type == DAV_PROPFIND_IS_ALLPROP); - } - dav_close_propdb(propdb); - - dav_add_response(ctx, ctx->uri.buf, 0, &propstats); - - return NULL; -} - -/* handle the PROPFIND method */ -static int dav_method_propfind(request_rec *r) -{ - dav_resource *resource; - int depth; - dav_error *err; - int result; - dav_xml_doc *doc; - const dav_xml_elem *child; - dav_walker_ctx ctx = { 0 }; - - /* Ask repository module to resolve the resource */ - result = dav_get_resource(r, &resource); - if (result != OK) - return result; - - if (dav_get_resource_state(r, resource) == DAV_RESOURCE_NULL) { - /* Apache will supply a default error for this. */ - return HTTP_NOT_FOUND; - } - - if ((depth = dav_get_depth(r, DAV_INFINITY)) < 0) { - /* dav_get_depth() supplies additional information for the - * default message. */ - return HTTP_BAD_REQUEST; - } - - if (depth == DAV_INFINITY) { - dav_dir_conf *conf; - conf = (dav_dir_conf *) ap_get_module_config(r->per_dir_config, - &dav_module); - /* default is to DISALLOW these requests */ - if (conf->allow_depthinfinity != DAV_ENABLED_ON) { - return dav_error_response(r, HTTP_FORBIDDEN, - ap_psprintf(r->pool, - "PROPFIND requests with a " - "Depth of \"infinity\" are " - "not allowed for %s.", - ap_escape_html(r->pool, - r->uri))); - } - } - - if ((result = dav_parse_input(r, &doc)) != OK) { - return result; - } - /* note: doc == NULL if no request body */ - - if (doc && !dav_validate_root(doc, "propfind")) { - /* This supplies additional information for the default message. */ - ap_log_rerror(APLOG_MARK, APLOG_ERR | APLOG_NOERRNO, r, - "The \"propfind\" element was not found."); - return HTTP_BAD_REQUEST; - } - - /* ### validate that only one of these three elements is present */ - - if (doc == NULL - || (child = dav_find_child(doc->root, "allprop")) != NULL) { - /* note: no request body implies allprop */ - ctx.propfind_type = DAV_PROPFIND_IS_ALLPROP; - } - else if ((child = dav_find_child(doc->root, "propname")) != NULL) { - ctx.propfind_type = DAV_PROPFIND_IS_PROPNAME; - } - else if ((child = dav_find_child(doc->root, "prop")) != NULL) { - ctx.propfind_type = DAV_PROPFIND_IS_PROP; - } - else { - /* "propfind" element must have one of the above three children */ - - /* This supplies additional information for the default message. */ - ap_log_rerror(APLOG_MARK, APLOG_ERR | APLOG_NOERRNO, r, - "The \"propfind\" element does not contain one of " - "the required child elements (the specific command)."); - return HTTP_BAD_REQUEST; - } - - ctx.walk_type = DAV_WALKTYPE_ALL | DAV_WALKTYPE_AUTH; - ctx.func = dav_propfind_walker; - ctx.pool = r->pool; - ctx.doc = doc; - ctx.r = r; - ctx.resource = resource; - - dav_buffer_init(r->pool, &ctx.uri, r->uri); - - /* ### should open read-only */ - if ((err = dav_open_lockdb(r, 0, &ctx.lockdb)) != NULL) { - err = dav_push_error(r->pool, err->status, 0, - "The lock database could not be opened, " - "preventing access to the various lock " - "properties for the PROPFIND.", - err); - return dav_handle_err(r, err, NULL); - } - if (ctx.lockdb != NULL) { - /* if we have a lock database, then we can walk locknull resources */ - ctx.walk_type |= DAV_WALKTYPE_LOCKNULL; - } - - err = (*resource->hooks->walk)(&ctx, depth); - - if (ctx.lockdb != NULL) { - (*ctx.lockdb->hooks->close_lockdb)(ctx.lockdb); - } - - if (err != NULL) { - /* ### add a higher-level description? */ - return dav_handle_err(r, err, NULL); - } - - /* return a 207 (Multi-Status) response now. */ - - /* if a 404 was generated for an HREF, then we need to spit out the - * doc's namespaces for use by the 404. Note that elements - * will override these ns0, ns1, etc, but NOT within the - * scope for the badprops. */ - /* NOTE: propstat_404 != NULL implies doc != NULL */ - if (ctx.propstat_404 != NULL) { - dav_send_multistatus(r, HTTP_MULTI_STATUS, ctx.response, - doc->namespaces); - } - else { - dav_send_multistatus(r, HTTP_MULTI_STATUS, ctx.response, NULL); - } - - /* the response has been sent. */ - return DONE; -} - -static dav_text * dav_failed_proppatch(pool *p, array_header *prop_ctx) -{ - dav_text_header hdr = { 0 }; - int i = prop_ctx->nelts; - dav_prop_ctx *ctx = (dav_prop_ctx *)prop_ctx->elts; - dav_error *err424_set = NULL; - dav_error *err424_delete = NULL; - const char *s; - - /* ### might be nice to sort by status code and description */ - - for ( ; i-- > 0; ++ctx ) { - dav_text_append(p, &hdr, - "" DEBUG_CR - ""); - dav_text_append(p, &hdr, dav_empty_elem(p, ctx->prop)); - dav_text_append(p, &hdr, "" DEBUG_CR); - - if (ctx->err == NULL) { - /* nothing was assigned here yet, so make it a 424 */ - - if (ctx->operation == DAV_PROP_OP_SET) { - if (err424_set == NULL) - err424_set = dav_new_error(p, HTTP_FAILED_DEPENDENCY, 0, - "Attempted DAV:set operation " - "could not be completed due " - "to other errors."); - ctx->err = err424_set; - } - else if (ctx->operation == DAV_PROP_OP_DELETE) { - if (err424_delete == NULL) - err424_delete = dav_new_error(p, HTTP_FAILED_DEPENDENCY, 0, - "Attempted DAV:remove " - "operation could not be " - "completed due to other " - "errors."); - ctx->err = err424_delete; - } - } - - s = ap_psprintf(p, - "" - "HTTP/1.1 %d (status)" - "" DEBUG_CR, - ctx->err->status); - dav_text_append(p, &hdr, s); - - /* ### we should use compute_desc if necessary... */ - if (ctx->err->desc != NULL) { - dav_text_append(p, &hdr, "" DEBUG_CR); - dav_text_append(p, &hdr, ctx->err->desc); - dav_text_append(p, &hdr, "" DEBUG_CR); - } - - dav_text_append(p, &hdr, "" DEBUG_CR); - } - - return hdr.first; -} - -static dav_text * dav_success_proppatch(pool *p, array_header *prop_ctx) -{ - dav_text_header hdr = { 0 }; - int i = prop_ctx->nelts; - dav_prop_ctx *ctx = (dav_prop_ctx *)prop_ctx->elts; - - /* - ** ### we probably need to revise the way we assemble the response... - ** ### this code assumes everything will return status==200. - */ - - dav_text_append(p, &hdr, - "" DEBUG_CR - "" DEBUG_CR); - - for ( ; i-- > 0; ++ctx ) { - dav_text_append(p, &hdr, dav_empty_elem(p, ctx->prop)); - } - - dav_text_append(p, &hdr, - "" DEBUG_CR - "HTTP/1.1 200 OK" DEBUG_CR - "" DEBUG_CR); - - return hdr.first; -} - -static void dav_prop_log_errors(dav_prop_ctx *ctx) -{ - dav_log_err(ctx->r, ctx->err, APLOG_ERR); -} - -/* -** Call for each context. This can stop when an error occurs, or -** simply iterate through the whole list. -** -** Returns 1 if an error occurs (and the iteration is aborted). Returns 0 -** if all elements are processed. -** -** If is true (non-zero), then the list is traversed in -** reverse order. -*/ -static int dav_process_ctx_list(void (*func)(dav_prop_ctx *ctx), - array_header *ctx_list, int stop_on_error, - int reverse) -{ - int i = ctx_list->nelts; - dav_prop_ctx *ctx = (dav_prop_ctx *)ctx_list->elts; - - if (reverse) - ctx += i; - - while (i--) { - if (reverse) - --ctx; - - (*func)(ctx); - if (stop_on_error && DAV_PROP_CTX_HAS_ERR(*ctx)) { - return 1; - } - - if (!reverse) - ++ctx; - } - - return 0; -} - -/* handle the PROPPATCH method */ -static int dav_method_proppatch(request_rec *r) -{ - dav_error *err; - dav_resource *resource; - int result; - dav_xml_doc *doc; - dav_xml_elem *child; - dav_propdb *propdb; - int failure = 0; - dav_response resp = { 0 }; - dav_text *propstat_text; - array_header *ctx_list; - dav_prop_ctx *ctx; - - /* Ask repository module to resolve the resource */ - result = dav_get_resource(r, &resource); - if (result != OK) - return result; - if (!resource->exists) { - /* Apache will supply a default error for this. */ - return HTTP_NOT_FOUND; - } - - if ((result = dav_parse_input(r, &doc)) != OK) { - return result; - } - /* note: doc == NULL if no request body */ - - if (doc == NULL || !dav_validate_root(doc, "propertyupdate")) { - /* This supplies additional information for the default message. */ - ap_log_rerror(APLOG_MARK, APLOG_ERR | APLOG_NOERRNO, r, - "The request body does not contain " - "a \"propertyupdate\" element."); - return HTTP_BAD_REQUEST; - } - - /* Check If-Headers and existing locks */ - /* Note: depth == 0. Implies no need for a multistatus response. */ - if ((err = dav_validate_request(r, resource, 0, NULL, NULL, - DAV_VALIDATE_RESOURCE, NULL)) != NULL) { - /* ### add a higher-level description? */ - return dav_handle_err(r, err, NULL); - } - - if ((err = dav_open_propdb(r, NULL, resource, 0, doc->namespaces, - &propdb)) != NULL) { - err = dav_push_error(r->pool, HTTP_INTERNAL_SERVER_ERROR, 0, - ap_psprintf(r->pool, - "Could not open the property " - "database for %s.", - ap_escape_html(r->pool, r->uri)), - err); - return dav_handle_err(r, err, NULL); - } - /* ### what to do about closing the propdb on server failure? */ - - /* ### validate "live" properties */ - - /* set up an array to hold property operation contexts */ - ctx_list = ap_make_array(r->pool, 10, sizeof(dav_prop_ctx)); - - /* do a first pass to ensure that all "remove" properties exist */ - for (child = doc->root->first_child; child; child = child->next) { - int is_remove; - dav_xml_elem *prop_group; - dav_xml_elem *one_prop; - - /* Ignore children that are not set/remove */ - if (child->ns != DAV_NS_DAV_ID - || (!(is_remove = strcmp(child->name, "remove") == 0) - && strcmp(child->name, "set") != 0)) { - continue; - } - - /* make sure that a "prop" child exists for set/remove */ - if ((prop_group = dav_find_child(child, "prop")) == NULL) { - dav_close_propdb(propdb); - - /* This supplies additional information for the default message. */ - ap_log_rerror(APLOG_MARK, APLOG_ERR | APLOG_NOERRNO, r, - "A \"prop\" element is missing inside " - "the propertyupdate command."); - return HTTP_BAD_REQUEST; - } - - for (one_prop = prop_group->first_child; one_prop; - one_prop = one_prop->next) { - - ctx = (dav_prop_ctx *)ap_push_array(ctx_list); - ctx->propdb = propdb; - ctx->operation = is_remove ? DAV_PROP_OP_DELETE : DAV_PROP_OP_SET; - ctx->prop = one_prop; - - ctx->r = r; /* for later use by dav_prop_log_errors() */ - - dav_prop_validate(ctx); - - if ( DAV_PROP_CTX_HAS_ERR(*ctx) ) { - failure = 1; - } - } - } - - /* ### should test that we found at least one set/remove */ - - /* execute all of the operations */ - if (!failure && dav_process_ctx_list(dav_prop_exec, ctx_list, 1, 0)) { - failure = 1; - } - - /* generate a failure/success response */ - if (failure) { - (void)dav_process_ctx_list(dav_prop_rollback, ctx_list, 0, 1); - propstat_text = dav_failed_proppatch(r->pool, ctx_list); - } - else { - (void)dav_process_ctx_list(dav_prop_commit, ctx_list, 0, 0); - propstat_text = dav_success_proppatch(r->pool, ctx_list); - } - - /* make sure this gets closed! */ - dav_close_propdb(propdb); - - /* log any errors that occurred */ - (void)dav_process_ctx_list(dav_prop_log_errors, ctx_list, 0, 0); - - resp.href = resource->uri; - - /* ### should probably use something new to pass along this text... */ - resp.propresult.propstats = propstat_text; - - dav_send_multistatus(r, HTTP_MULTI_STATUS, &resp, doc->namespaces); - - /* the response has been sent. */ - return DONE; -} - -static int process_mkcol_body(request_rec *r) -{ - /* This is snarfed from ap_setup_client_block(). We could get pretty - * close to this behavior by passing REQUEST_NO_BODY, but we need to - * return HTTP_UNSUPPORTED_MEDIA_TYPE (while ap_setup_client_block - * returns HTTP_REQUEST_ENTITY_TOO_LARGE). */ - - const char *tenc = ap_table_get(r->headers_in, "Transfer-Encoding"); - const char *lenp = ap_table_get(r->headers_in, "Content-Length"); - - /* make sure to set the Apache request fields properly. */ - r->read_body = REQUEST_NO_BODY; - r->read_chunked = 0; - r->remaining = 0; - - if (tenc) { - if (strcasecmp(tenc, "chunked")) { - /* Use this instead of Apache's default error string */ - ap_log_rerror(APLOG_MARK, APLOG_ERR | APLOG_NOERRNO, r, - "Unknown Transfer-Encoding %s", tenc); - return HTTP_NOT_IMPLEMENTED; - } - - r->read_chunked = 1; - } - else if (lenp) { - const char *pos = lenp; - - while (ap_isdigit(*pos) || ap_isspace(*pos)) { - ++pos; - } - if (*pos != '\0') { - /* This supplies additional information for the default message. */ - ap_log_rerror(APLOG_MARK, APLOG_ERR | APLOG_NOERRNO, r, - "Invalid Content-Length %s", lenp); - return HTTP_BAD_REQUEST; - } - - r->remaining = atol(lenp); - } - - if (r->read_chunked || r->remaining > 0) { - /* ### log something? */ - - /* Apache will supply a default error for this. */ - return HTTP_UNSUPPORTED_MEDIA_TYPE; - } - - /* - ** Get rid of the body. this will call ap_setup_client_block(), but - ** our copy above has already verified its work. - */ - return ap_discard_request_body(r); -} - -/* handle the MKCOL method */ -static int dav_method_mkcol(request_rec *r) -{ - dav_resource *resource; - int resource_state; - dav_resource *resource_parent; - const dav_hooks_locks *locks_hooks = DAV_GET_HOOKS_LOCKS(r); - dav_error *err; - dav_error *err2; - int result; - dav_dir_conf *conf; - int parent_was_writable = 0; - dav_response *multi_status; - - /* handle the request body */ - /* ### this may move lower once we start processing bodies */ - if ((result = process_mkcol_body(r)) != OK) { - return result; - } - - conf = (dav_dir_conf *) ap_get_module_config(r->per_dir_config, - &dav_module); - - /* Ask repository module to resolve the resource */ - result = dav_get_resource(r, &resource); - if (result != OK) - return result; - - if (resource->exists) { - /* oops. something was already there! */ - - /* Apache will supply a default error for this. */ - /* ### we should provide a specific error message! */ - return HTTP_METHOD_NOT_ALLOWED; - } - - resource_state = dav_get_resource_state(r, resource); - - /* - ** Check If-Headers and existing locks. - ** - ** Note: depth == 0 normally requires no multistatus response. However, - ** if we pass DAV_VALIDATE_PARENT, then we could get an error on a URI - ** other than the Request-URI, thereby requiring a multistatus. - ** - ** If the resource does not exist (DAV_RESOURCE_NULL), then we must - ** check the resource *and* its parent. If the resource exists or is - ** a locknull resource, then we check only the resource. - */ - if ((err = dav_validate_request(r, resource, 0, NULL, &multi_status, - resource_state == DAV_RESOURCE_NULL ? - DAV_VALIDATE_PARENT : - DAV_VALIDATE_RESOURCE, NULL)) != NULL) { - /* ### add a higher-level description? */ - return dav_handle_err(r, err, multi_status); - } - - /* if versioned resource, make sure parent is checked out */ - if ((err = dav_ensure_resource_writable(r, resource, 1 /* parent_only */, - &resource_parent, - NULL, NULL, - &parent_was_writable)) != NULL) { - /* ### add a higher-level description? */ - return dav_handle_err(r, err, NULL); - } - - /* try to create the collection */ - resource->collection = 1; - err = (*resource->hooks->create_collection)(r->pool, resource); - - /* restore modifiability of parent back to what it was */ - err2 = dav_revert_resource_writability(r, NULL, resource_parent, - err != NULL /* undo if error */, - 0, 0, parent_was_writable); - - /* check for errors now */ - if (err != NULL) { - return dav_handle_err(r, err, NULL); - } - if (err2 != NULL) { - /* just log a warning */ - err = dav_push_error(r->pool, err->status, 0, - "The MKCOL was successful, but there " - "was a problem reverting the writability of " - "its parent collection.", - err2); - dav_log_err(r, err, APLOG_WARNING); - } - - if (locks_hooks != NULL) { - dav_lockdb *lockdb; - - if ((err = (*locks_hooks->open_lockdb)(r, 0, 0, &lockdb)) != NULL) { - /* The directory creation was successful, but the locking failed. */ - err = dav_push_error(r->pool, err->status, 0, - "The MKCOL was successful, but there " - "was a problem opening the lock database " - "which prevents inheriting locks from the " - "parent resources.", - err); - return dav_handle_err(r, err, NULL); - } - - /* notify lock system that we have created/replaced a resource */ - err = dav_notify_created(r, lockdb, resource, resource_state, 0); - - (*locks_hooks->close_lockdb)(lockdb); - - if (err != NULL) { - /* The dir creation was successful, but the locking failed. */ - err = dav_push_error(r->pool, err->status, 0, - "The MKCOL was successful, but there " - "was a problem updating its lock " - "information.", - err); - return dav_handle_err(r, err, NULL); - } - } - - /* return an appropriate response (HTTP_CREATED) */ - return dav_created(r, NULL, resource, "Collection", 0); -} - -/* handle the COPY and MOVE methods */ -static int dav_method_copymove(request_rec *r, int is_move) -{ - dav_resource *resource; - dav_resource *resource_parent = NULL; - dav_resource *resnew; - dav_resource *resnew_parent = NULL; - const char *body; - const char *dest; - dav_error *err; - dav_error *err2; - dav_error *err3; - dav_response *multi_response; - dav_lookup_result lookup; - int is_dir; - int overwrite; - int depth; - int result; - dav_lockdb *lockdb; - int replaced; - int src_parent_was_writable = 0; - int dst_parent_was_writable = 0; - - /* Ask repository module to resolve the resource */ - result = dav_get_resource(r, &resource); - if (result != OK) - return result; - if (!resource->exists) { - /* Apache will supply a default error for this. */ - return HTTP_NOT_FOUND; - } - - /* If not a file or collection resource, COPY/MOVE not allowed */ - if (resource->type != DAV_RESOURCE_TYPE_REGULAR) { - body = ap_psprintf(r->pool, - "Cannot COPY/MOVE resource %s.", - ap_escape_html(r->pool, r->uri)); - return dav_error_response(r, HTTP_METHOD_NOT_ALLOWED, body); - } - - /* get the destination URI */ - dest = ap_table_get(r->headers_in, "Destination"); - if (dest == NULL) { - /* Look in headers provided by Netscape's Roaming Profiles */ - const char *nscp_host = ap_table_get(r->headers_in, "Host"); - const char *nscp_path = ap_table_get(r->headers_in, "New-uri"); - - if (nscp_host != NULL && nscp_path != NULL) - dest = ap_psprintf(r->pool, "http://%s%s", nscp_host, nscp_path); - } - if (dest == NULL) { - /* This supplies additional information for the default message. */ - ap_log_rerror(APLOG_MARK, APLOG_ERR | APLOG_NOERRNO, r, - "The request is missing a Destination header."); - return HTTP_BAD_REQUEST; - } - - lookup = dav_lookup_uri(dest, r); - if (lookup.rnew == NULL) { - if (lookup.err.status == HTTP_BAD_REQUEST) { - /* This supplies additional information for the default message. */ - ap_log_rerror(APLOG_MARK, APLOG_ERR | APLOG_NOERRNO, r, - lookup.err.desc); - return HTTP_BAD_REQUEST; - } - - /* ### this assumes that dav_lookup_uri() only generates a status - * ### that Apache can provide a status line for!! */ - - return dav_error_response(r, lookup.err.status, lookup.err.desc); - } - if (lookup.rnew->status != HTTP_OK) { - /* ### how best to report this... */ - return dav_error_response(r, lookup.rnew->status, - "Destination URI had an error."); - } - - /* Resolve destination resource */ - result = dav_get_resource(lookup.rnew, &resnew); - if (result != OK) - return result; - - /* are the two resources handled by the same repository? */ - if (resource->hooks != resnew->hooks) { - /* ### this message exposes some backend config, but screw it... */ - return dav_error_response(r, HTTP_BAD_GATEWAY, - "Destination URI is handled by a " - "different repository than the source URI. " - "MOVE or COPY between repositories is " - "not possible."); - } - - /* get and parse the overwrite header value */ - if ((overwrite = dav_get_overwrite(r)) < 0) { - /* dav_get_overwrite() supplies additional information for the - * default message. */ - return HTTP_BAD_REQUEST; - } - - /* quick failure test: if dest exists and overwrite is false. */ - if (resnew->exists && !overwrite) { - /* Supply some text for the error response body. */ - return dav_error_response(r, HTTP_PRECONDITION_FAILED, - "Destination is not empty and " - "Overwrite is not \"T\""); - } - - /* are the source and destination the same? */ - if ((*resource->hooks->is_same_resource)(resource, resnew)) { - /* Supply some text for the error response body. */ - return dav_error_response(r, HTTP_FORBIDDEN, - "Source and Destination URIs are the same."); - - } - - is_dir = resource->collection; - - /* get and parse the Depth header value. "0" and "infinity" are legal. */ - if ((depth = dav_get_depth(r, DAV_INFINITY)) < 0) { - /* dav_get_depth() supplies additional information for the - * default message. */ - return HTTP_BAD_REQUEST; - } - if (depth == 1) { - /* This supplies additional information for the default message. */ - ap_log_rerror(APLOG_MARK, APLOG_ERR | APLOG_NOERRNO, r, - "Depth must be \"0\" or \"infinity\" for COPY or MOVE."); - return HTTP_BAD_REQUEST; - } - if (is_move && is_dir && depth != DAV_INFINITY) { - /* This supplies additional information for the default message. */ - ap_log_rerror(APLOG_MARK, APLOG_ERR | APLOG_NOERRNO, r, - "Depth must be \"infinity\" when moving a collection."); - return HTTP_BAD_REQUEST; - } - - /* - ** Check If-Headers and existing locks for each resource in the source - ** if we are performing a MOVE. We will return a 424 response with a - ** DAV:multistatus body. The multistatus responses will contain the - ** information about any resource that fails the validation. - ** - ** We check the parent resource, too, since this is a MOVE. Moving the - ** resource effectively removes it from the parent collection, so we - ** must ensure that we have met the appropriate conditions. - ** - ** If a problem occurs with the Request-URI itself, then a plain error - ** (rather than a multistatus) will be returned. - */ - if (is_move - && (err = dav_validate_request(r, resource, depth, NULL, - &multi_response, - DAV_VALIDATE_PARENT - | DAV_VALIDATE_USE_424, - NULL)) != NULL) { - err = dav_push_error(r->pool, err->status, 0, - ap_psprintf(r->pool, - "Could not MOVE %s due to a failed " - "precondition on the source " - "(e.g. locks).", - ap_escape_html(r->pool, r->uri)), - err); - return dav_handle_err(r, err, multi_response); - } - - /* - ** Check If-Headers and existing locks for destination. Note that we - ** use depth==infinity since the target (hierarchy) will be deleted - ** before the move/copy is completed. - ** - ** Note that we are overwriting the target, which implies a DELETE, so - ** we are subject to the error/response rules as a DELETE. Namely, we - ** will return a 424 error if any of the validations fail. - ** (see dav_method_delete() for more information) - */ - if ((err = dav_validate_request(lookup.rnew, resnew, DAV_INFINITY, NULL, - &multi_response, - DAV_VALIDATE_PARENT - | DAV_VALIDATE_USE_424, NULL)) != NULL) { - err = dav_push_error(r->pool, err->status, 0, - ap_psprintf(r->pool, - "Could not MOVE/COPY %s due to a " - "failed precondition on the " - "destination (e.g. locks).", - ap_escape_html(r->pool, r->uri)), - err); - return dav_handle_err(r, err, multi_response); - } - - if (is_dir - && depth == DAV_INFINITY - && (*resource->hooks->is_parent_resource)(resource, resnew)) { - /* Supply some text for the error response body. */ - return dav_error_response(r, HTTP_FORBIDDEN, - "Source collection contains the " - "Destination."); - - } - if (is_dir - && (*resnew->hooks->is_parent_resource)(resnew, resource)) { - /* The destination must exist (since it contains the source), and - * a condition above implies Overwrite==T. Obviously, we cannot - * delete the Destination before the MOVE/COPY, as that would - * delete the Source. - */ - - /* Supply some text for the error response body. */ - return dav_error_response(r, HTTP_FORBIDDEN, - "Destination collection contains the Source " - "and Overwrite has been specified."); - } - - /* ### for now, we don't need anything in the body */ - if ((result = ap_discard_request_body(r)) != OK) { - return result; - } - - if ((err = dav_open_lockdb(r, 0, &lockdb)) != NULL) { - /* ### add a higher-level description? */ - return dav_handle_err(r, err, NULL); - } - - /* remove any locks from the old resources */ - /* - ** ### this is Yet Another Traversal. if we do a rename(), then we - ** ### really don't have to do this in some cases since the inode - ** ### values will remain constant across the move. but we can't - ** ### know that fact from outside the provider :-( - ** - ** ### note that we now have a problem atomicity in the move/copy - ** ### since a failure after this would have removed locks (technically, - ** ### this is okay to do, but really...) - */ - if (is_move && lockdb != NULL) { - /* ### this is wrong! it blasts direct locks on parent resources */ - /* ### pass lockdb! */ - (void)dav_unlock(r, resource, NULL); - } - - /* remember whether target resource existed */ - replaced = resnew->exists; - - /* if this is a move, then the source parent collection will be modified */ - if (is_move) { - if ((err = dav_ensure_resource_writable(r, resource, - 1 /* parent_only */, - &resource_parent, - NULL, NULL, - &src_parent_was_writable)) != NULL) { - if (lockdb != NULL) - (*lockdb->hooks->close_lockdb)(lockdb); - - /* ### add a higher-level description? */ - return dav_handle_err(r, err, NULL); - } - } - - /* prepare the destination collection for modification */ - if ((err = dav_ensure_resource_writable(r, resnew, 1 /* parent_only */, - &resnew_parent, - NULL, NULL, - &dst_parent_was_writable)) != NULL) { - /* could not make destination writable: - * if move, restore state of source parent - */ - if (is_move) { - (void) dav_revert_resource_writability(r, NULL, resource_parent, - 1 /* undo */, - 0, 0, - src_parent_was_writable); - } - - if (lockdb != NULL) - (*lockdb->hooks->close_lockdb)(lockdb); - - /* ### add a higher-level description? */ - return dav_handle_err(r, err, NULL); - } - - /* If source and destination parents are the same, then - * use the same object, so status updates to one are reflected - * in the other. - */ - if (resource_parent != NULL - && (*resource_parent->hooks->is_same_resource)(resource_parent, - resnew_parent)) - resnew_parent = resource_parent; - - /* New resource will be same kind as source */ - resnew->collection = resource->collection; - - /* If target exists, remove it first (we know Ovewrite must be TRUE). - * Then try to copy/move the resource. - */ - if (resnew->exists) - err = (*resnew->hooks->remove_resource)(resnew, &multi_response); - - if (err == NULL) { - if (is_move) - err = (*resource->hooks->move_resource)(resource, resnew, - &multi_response); - else - err = (*resource->hooks->copy_resource)(resource, resnew, depth, - &multi_response); - } - - /* restore parent collection states */ - err2 = dav_revert_resource_writability(r, NULL, resnew_parent, - err != NULL /* undo if error */, - 0, 0, dst_parent_was_writable); - - if (is_move) { - err3 = dav_revert_resource_writability(r, NULL, resource_parent, - err != NULL /* undo if error */, - 0, 0, src_parent_was_writable); - } - else - err3 = NULL; - - /* check for error from remove/copy/move operations */ - if (err != NULL) { - if (lockdb != NULL) - (*lockdb->hooks->close_lockdb)(lockdb); - - err = dav_push_error(r->pool, err->status, 0, - ap_psprintf(r->pool, - "Could not MOVE/COPY %s.", - ap_escape_html(r->pool, r->uri)), - err); - return dav_handle_err(r, err, multi_response); - } - - /* check for errors from reverting writability */ - if (err2 != NULL) { - /* just log a warning */ - err = dav_push_error(r->pool, err2->status, 0, - "The MOVE/COPY was successful, but there was a " - "problem reverting the writability of the " - "source parent collection.", - err2); - dav_log_err(r, err, APLOG_WARNING); - } - if (err3 != NULL) { - /* just log a warning */ - err = dav_push_error(r->pool, err3->status, 0, - "The MOVE/COPY was successful, but there was a " - "problem reverting the writability of the " - "destination parent collection.", - err3); - dav_log_err(r, err, APLOG_WARNING); - } - - /* propagate any indirect locks at the target */ - if (lockdb != NULL) { - int resource_state = dav_get_resource_state(lookup.rnew, resnew); - - /* notify lock system that we have created/replaced a resource */ - err = dav_notify_created(r, lockdb, resnew, resource_state, depth); - - (*lockdb->hooks->close_lockdb)(lockdb); - - if (err != NULL) { - /* The move/copy was successful, but the locking failed. */ - err = dav_push_error(r->pool, err->status, 0, - "The MOVE/COPY was successful, but there " - "was a problem updating the lock " - "information.", - err); - return dav_handle_err(r, err, NULL); - } - } - - /* return an appropriate response (HTTP_CREATED or HTTP_NO_CONTENT) */ - return dav_created(r, lookup.rnew, resnew, "Destination", replaced); -} - -/* dav_method_lock: Handler to implement the DAV LOCK method -** Returns appropriate HTTP_* response. -*/ -static int dav_method_lock(request_rec *r) -{ - dav_error *err; - dav_resource *resource; - const dav_hooks_locks *locks_hooks; - int result; - int depth; - int new_lock_request = 0; - dav_xml_doc *doc = NULL; - dav_lock *lock; - dav_response *multi_response = NULL; - dav_lockdb *lockdb; - int resource_state; - - /* If no locks provider, decline the request */ - locks_hooks = DAV_GET_HOOKS_LOCKS(r); - if (locks_hooks == NULL) - return DECLINED; - - if ((result = dav_parse_input(r, &doc)) != OK) - return result; - - depth = dav_get_depth(r, DAV_INFINITY); - if (depth != 0 && depth != DAV_INFINITY) { - ap_log_rerror(APLOG_MARK, APLOG_ERR | APLOG_NOERRNO, r, - "Depth must be 0 or \"infinity\" for LOCK."); - return HTTP_BAD_REQUEST; - } - - /* Ask repository module to resolve the resource */ - result = dav_get_resource(r, &resource); - if (result != OK) - return result; - - /* - ** Open writable. Unless an error occurs, we'll be - ** writing into the database. - */ - if ((err = (*locks_hooks->open_lockdb)(r, 0, 0, &lockdb)) != NULL) { - /* ### add a higher-level description? */ - return dav_handle_err(r, err, NULL); - } - - if (doc != NULL) { - if ((err = dav_lock_parse_lockinfo(r, resource, lockdb, doc, - &lock)) != NULL) { - /* ### add a higher-level description to err? */ - goto error; - } - new_lock_request = 1; - - lock->auth_user = ap_pstrdup(r->pool, r->connection->user); - } - - resource_state = dav_get_resource_state(r, resource); - - /* - ** Check If-Headers and existing locks. - ** - ** If this will create a locknull resource, then the LOCK will affect - ** the parent collection (much like a PUT/MKCOL). For that case, we must - ** validate the parent resource's conditions. - */ - if ((err = dav_validate_request(r, resource, depth, NULL, &multi_response, - (resource_state == DAV_RESOURCE_NULL - ? DAV_VALIDATE_PARENT - : DAV_VALIDATE_RESOURCE) - | (new_lock_request ? lock->scope : 0) - | DAV_VALIDATE_ADD_LD, - lockdb)) != OK) { - err = dav_push_error(r->pool, err->status, 0, - ap_psprintf(r->pool, - "Could not LOCK %s due to a failed " - "precondition (e.g. other locks).", - ap_escape_html(r->pool, r->uri)), - err); - goto error; - } - - if (new_lock_request == 0) { - dav_locktoken_list *ltl; - - /* - ** Refresh request - ** ### Assumption: We can renew multiple locks on the same resource - ** ### at once. First harvest all the positive lock-tokens given in - ** ### the If header. Then modify the lock entries for this resource - ** ### with the new Timeout val. - */ - - if ((err = dav_get_locktoken_list(r, <l)) != NULL) { - err = dav_push_error(r->pool, err->status, 0, - ap_psprintf(r->pool, - "The lock refresh for %s failed " - "because no lock tokens were " - "specified in an \"If:\" " - "header.", - ap_escape_html(r->pool, r->uri)), - err); - goto error; - } - - if ((err = (*locks_hooks->refresh_locks)(lockdb, resource, ltl, - dav_get_timeout(r), - &lock)) != NULL) { - /* ### add a higher-level description to err? */ - goto error; - } - } else { - /* New lock request */ - char *locktoken_txt; - dav_dir_conf *conf; - - conf = (dav_dir_conf *) ap_get_module_config(r->per_dir_config, - &dav_module); - - /* apply lower bound (if any) from DAVMinTimeout directive */ - if (lock->timeout != DAV_TIMEOUT_INFINITE - && lock->timeout < time(NULL) + conf->locktimeout) - lock->timeout = time(NULL) + conf->locktimeout; - - err = dav_add_lock(r, resource, lockdb, lock, &multi_response); - if (err != NULL) { - /* ### add a higher-level description to err? */ - goto error; - } - - locktoken_txt = ap_pstrcat(r->pool, "<", - (*locks_hooks->format_locktoken)(r->pool, lock->locktoken), - ">", NULL); - - ap_table_set(r->headers_out, "Lock-Token", locktoken_txt); - } - - (*locks_hooks->close_lockdb)(lockdb); - - r->status = HTTP_OK; - r->content_type = DAV_XML_CONTENT_TYPE; - - ap_send_http_header(r); - ap_soft_timeout("send LOCK response", r); - - ap_rputs(DAV_XML_HEADER DEBUG_CR "" DEBUG_CR, r); - if (lock == NULL) - ap_rputs("" DEBUG_CR, r); - else { - ap_rprintf(r, - "" DEBUG_CR - "%s" DEBUG_CR - "" DEBUG_CR, - dav_lock_get_activelock(r, lock, NULL)); - } - ap_rputs("", r); - - ap_kill_timeout(r); - - /* the response has been sent. */ - return DONE; - - error: - (*locks_hooks->close_lockdb)(lockdb); - return dav_handle_err(r, err, multi_response); -} - -/* dav_method_unlock: Handler to implement the DAV UNLOCK method - * Returns appropriate HTTP_* response. - */ -static int dav_method_unlock(request_rec *r) -{ - dav_error *err; - dav_resource *resource; - const dav_hooks_locks *locks_hooks; - int result; - const char *const_locktoken_txt; - char *locktoken_txt; - dav_locktoken *locktoken = NULL; - int resource_state; - dav_response *multi_response; - - /* If no locks provider, decline the request */ - locks_hooks = DAV_GET_HOOKS_LOCKS(r); - if (locks_hooks == NULL) - return DECLINED; - - if ((const_locktoken_txt = ap_table_get(r->headers_in, "Lock-Token")) == NULL) { - ap_log_rerror(APLOG_MARK, APLOG_ERR | APLOG_NOERRNO, r, - "Unlock failed (%s): No Lock-Token specified in header", r->filename); - return HTTP_BAD_REQUEST; - } - - locktoken_txt = ap_pstrdup(r->pool, const_locktoken_txt); - if (locktoken_txt[0] != '<') { - /* ### should provide more specifics... */ - return HTTP_BAD_REQUEST; - } - locktoken_txt++; - - if (locktoken_txt[strlen(locktoken_txt) - 1] != '>') { - /* ### should provide more specifics... */ - return HTTP_BAD_REQUEST; - } - locktoken_txt[strlen(locktoken_txt) - 1] = '\0'; - - if ((err = (*locks_hooks->parse_locktoken)(r->pool, locktoken_txt, - &locktoken)) != NULL) { - err = dav_push_error(r->pool, HTTP_BAD_REQUEST, 0, - ap_psprintf(r->pool, - "The UNLOCK on %s failed -- an " - "invalid lock token was specified " - "in the \"If:\" header.", - ap_escape_html(r->pool, r->uri)), - err); - return dav_handle_err(r, err, NULL); - } - - /* Ask repository module to resolve the resource */ - result = dav_get_resource(r, &resource); - if (result != OK) - return result; - - resource_state = dav_get_resource_state(r, resource); - - /* - ** Check If-Headers and existing locks. - ** - ** Note: depth == 0 normally requires no multistatus response. However, - ** if we pass DAV_VALIDATE_PARENT, then we could get an error on a URI - ** other than the Request-URI, thereby requiring a multistatus. - ** - ** If the resource is a locknull resource, then the UNLOCK will affect - ** the parent collection (much like a delete). For that case, we must - ** validate the parent resource's conditions. - */ - if ((err = dav_validate_request(r, resource, 0, locktoken, - &multi_response, - resource_state == DAV_RESOURCE_LOCK_NULL - ? DAV_VALIDATE_PARENT - : DAV_VALIDATE_RESOURCE, NULL)) != NULL) { - /* ### add a higher-level description? */ - return dav_handle_err(r, err, multi_response); - } - - /* ### RFC 2518 s. 8.11: If this resource is locked by locktoken, - * _all_ resources locked by locktoken are released. It does not say - * resource has to be the root of an infinte lock. Thus, an UNLOCK - * on any part of an infinte lock will remove the lock on all resources. - * - * For us, if r->filename represents an indirect lock (part of an infinity lock), - * we must actually perform an UNLOCK on the direct lock for this resource. - */ - if ((result = dav_unlock(r, resource, locktoken)) != OK) { - return result; - } - - return HTTP_NO_CONTENT; -} - -/* handle the SEARCH method from DASL */ -static int dav_method_search(request_rec *r) -{ - /* ### we know this method, but we won't allow it yet */ - /* Apache will supply a default error for this. */ - return HTTP_METHOD_NOT_ALLOWED; - - /* Do some error checking, like if the querygrammar is - * supported by the content type, and then pass the - * request on to the appropriate query module. - */ -} - -/* handle the CHECKOUT method */ -static int dav_method_checkout(request_rec *r) -{ - dav_resource *resource; - const dav_hooks_vsn *vsn_hooks = DAV_GET_HOOKS_VSN(r); - dav_error *err; - int result; - - /* If no versioning provider, decline the request */ - if (vsn_hooks == NULL) - return DECLINED; - - /* ### eventually check body for DAV:checkin-policy */ - if ((result = ap_discard_request_body(r)) != OK) { - return result; - } - - /* Ask repository module to resolve the resource */ - result = dav_get_resource(r, &resource); - if (result != OK) - return result; - if (!resource->exists) { - /* Apache will supply a default error for this. */ - return HTTP_NOT_FOUND; - } - - /* Check the state of the resource: must be a file or collection, - * must be versioned, and must not already be checked out. - */ - if (resource->type != DAV_RESOURCE_TYPE_REGULAR) { - return dav_error_response(r, HTTP_CONFLICT, - "Cannot checkout this type of resource."); - } - - if (!resource->versioned) { - return dav_error_response(r, HTTP_CONFLICT, - "Cannot checkout unversioned resource."); - } - - if (resource->working) { - return dav_error_response(r, HTTP_CONFLICT, - "The resource is already checked out to the workspace."); - } - - /* ### do lock checks, once behavior is defined */ - - /* Do the checkout */ - if ((err = (*vsn_hooks->checkout)(resource)) != NULL) { - err = dav_push_error(r->pool, HTTP_CONFLICT, 0, - ap_psprintf(r->pool, - "Could not CHECKOUT resource %s.", - ap_escape_html(r->pool, r->uri)), - err); - return dav_handle_err(r, err, NULL); - } - - /* no body */ - ap_set_content_length(r, 0); - ap_send_http_header(r); - - return DONE; -} - -/* handle the UNCHECKOUT method */ -static int dav_method_uncheckout(request_rec *r) -{ - dav_resource *resource; - const dav_hooks_vsn *vsn_hooks = DAV_GET_HOOKS_VSN(r); - dav_error *err; - int result; - - /* If no versioning provider, decline the request */ - if (vsn_hooks == NULL) - return DECLINED; - - if ((result = ap_discard_request_body(r)) != OK) { - return result; - } - - /* Ask repository module to resolve the resource */ - result = dav_get_resource(r, &resource); - if (result != OK) - return result; - if (!resource->exists) { - /* Apache will supply a default error for this. */ - return HTTP_NOT_FOUND; - } - - /* Check the state of the resource: must be a file or collection, - * must be versioned, and must be checked out. - */ - if (resource->type != DAV_RESOURCE_TYPE_REGULAR) { - return dav_error_response(r, HTTP_CONFLICT, - "Cannot uncheckout this type of resource."); - } - - if (!resource->versioned) { - return dav_error_response(r, HTTP_CONFLICT, - "Cannot uncheckout unversioned resource."); - } - - if (!resource->working) { - return dav_error_response(r, HTTP_CONFLICT, - "The resource is not checked out to the workspace."); - } - - /* ### do lock checks, once behavior is defined */ - - /* Do the uncheckout */ - if ((err = (*vsn_hooks->uncheckout)(resource)) != NULL) { - err = dav_push_error(r->pool, HTTP_CONFLICT, 0, - ap_psprintf(r->pool, - "Could not UNCHECKOUT resource %s.", - ap_escape_html(r->pool, r->uri)), - err); - return dav_handle_err(r, err, NULL); - } - - /* no body */ - ap_set_content_length(r, 0); - ap_send_http_header(r); - - return DONE; -} - -/* handle the CHECKIN method */ -static int dav_method_checkin(request_rec *r) -{ - dav_resource *resource; - const dav_hooks_vsn *vsn_hooks = DAV_GET_HOOKS_VSN(r); - dav_error *err; - int result; - - /* If no versioning provider, decline the request */ - if (vsn_hooks == NULL) - return DECLINED; - - if ((result = ap_discard_request_body(r)) != OK) { - return result; - } - - /* Ask repository module to resolve the resource */ - result = dav_get_resource(r, &resource); - if (result != OK) - return result; - if (!resource->exists) { - /* Apache will supply a default error for this. */ - return HTTP_NOT_FOUND; - } - - /* Check the state of the resource: must be a file or collection, - * must be versioned, and must be checked out. - */ - if (resource->type != DAV_RESOURCE_TYPE_REGULAR) { - return dav_error_response(r, HTTP_CONFLICT, - "Cannot checkin this type of resource."); - } - - if (!resource->versioned) { - return dav_error_response(r, HTTP_CONFLICT, - "Cannot checkin unversioned resource."); - } - - if (!resource->working) { - return dav_error_response(r, HTTP_CONFLICT, - "The resource is not checked out to the workspace."); - } - - /* ### do lock checks, once behavior is defined */ - - /* Do the checkin */ - if ((err = (*vsn_hooks->checkin)(resource)) != NULL) { - err = dav_push_error(r->pool, HTTP_CONFLICT, 0, - ap_psprintf(r->pool, - "Could not CHECKIN resource %s.", - ap_escape_html(r->pool, r->uri)), - err); - return dav_handle_err(r, err, NULL); - } - - /* no body */ - ap_set_content_length(r, 0); - ap_send_http_header(r); - - return DONE; -} - - -/* - * Response handler for DAV resources - */ -static int dav_handler(request_rec *r) -{ - dav_dir_conf *conf; - - /* quickly ignore any HTTP/0.9 requests */ - if (r->assbackwards) { - return DECLINED; - } - - /* ### do we need to do anything with r->proxyreq ?? */ - - conf = (dav_dir_conf *) ap_get_module_config(r->per_dir_config, - &dav_module); - - /* - * Set up the methods mask, since that's one of the reasons this handler - * gets called, and lower-level things may need the info. - * - * First, set the mask to the methods we handle directly. Since by - * definition we own our managed space, we unconditionally set - * the r->allowed field rather than ORing our values with anything - * any other module may have put in there. - * - * These are the HTTP-defined methods that we handle directly. - */ - r->allowed = 0 - | (1 << M_GET) - | (1 << M_PUT) - | (1 << M_DELETE) - | (1 << M_OPTIONS) - | (1 << M_INVALID); - /* - * These are the DAV methods we handle. - */ - r->allowed |= 0 - | (1 << M_COPY) - | (1 << M_LOCK) - | (1 << M_UNLOCK) - | (1 << M_MKCOL) - | (1 << M_MOVE) - | (1 << M_PROPFIND) - | (1 << M_PROPPATCH); - /* - * These are methods that we don't handle directly, but let the - * server's default handler do for us as our agent. - */ - r->allowed |= 0 - | (1 << M_POST); - - /* ### hrm. if we return HTTP_METHOD_NOT_ALLOWED, then an Allow header - * ### is sent; it will need the other allowed states; since the default - * ### handler is not called on error, then it doesn't add the other - * ### allowed states, so we must */ - /* ### we might need to refine this for just where we return the error. - * ### also, there is the issue with other methods (see ISSUES) */ - /* ### more work necessary, now that we have M_foo for DAV methods */ - - /* dispatch the appropriate method handler */ - if (r->method_number == M_GET) { - return dav_method_get(r); - } - - if (r->method_number == M_PUT) { - return dav_method_put(r); - } - - if (r->method_number == M_POST) { - return dav_method_post(r); - } - - if (r->method_number == M_DELETE) { - return dav_method_delete(r); - } - - if (r->method_number == M_OPTIONS) { - return dav_method_options(r); - } - - if (r->method_number == M_PROPFIND) { - return dav_method_propfind(r); - } - - if (r->method_number == M_PROPPATCH) { - return dav_method_proppatch(r); - } - - if (r->method_number == M_MKCOL) { - return dav_method_mkcol(r); - } - - if (r->method_number == M_COPY) { - return dav_method_copymove(r, DAV_DO_COPY); - } - - if (r->method_number == M_MOVE) { - return dav_method_copymove(r, DAV_DO_MOVE); - } - - if (r->method_number == M_LOCK) { - return dav_method_lock(r); - } - - if (r->method_number == M_UNLOCK) { - return dav_method_unlock(r); - } - - /* - * NOTE: When Apache moves creates defines for the add'l DAV methods, - * then it will no longer use M_INVALID. This code must be - * updated each time Apache adds method defines. - */ - if (r->method_number != M_INVALID) { - return DECLINED; - } - - if (!strcmp(r->method, "SEARCH")) { - return dav_method_search(r); - } - - if (!strcmp(r->method, "CHECKOUT")) { - return dav_method_checkout(r); - } - - if (!strcmp(r->method, "UNCHECKOUT")) { - return dav_method_uncheckout(r); - } - - if (!strcmp(r->method, "CHECKIN")) { - return dav_method_checkin(r); - } - -#if 0 - if (!strcmp(r->method, "MKRESOURCE")) { - return dav_method_mkresource(r); - } - - if (!strcmp(r->method, "REPORT")) { - return dav_method_report(r); - } -#endif - - /* ### add'l methods for Advanced Collections, ACLs, DASL */ - - return DECLINED; -} - -static int dav_type_checker(request_rec *r) -{ - dav_dir_conf *conf; - - conf = (dav_dir_conf *) ap_get_module_config(r->per_dir_config, - &dav_module); - - /* if DAV is not enabled, then we've got nothing to do */ - if (conf->enabled != DAV_ENABLED_ON) { - return DECLINED; - } - - if (r->method_number == M_GET) { - /* - ** ### need some work to pull Content-Type and Content-Language - ** ### from the property database. - */ - - /* - ** If the repository hasn't indicated that it will handle the - ** GET method, then just punt. - ** - ** ### this isn't quite right... taking over the response can break - ** ### things like mod_negotiation. need to look into this some more. - */ - if (!conf->handle_get) - return DECLINED; - } - - /* ### we should (instead) trap the ones that we DO understand */ - /* ### the handler DOES handle POST, so we need to fix one of these */ - if (r->method_number != M_POST) { - - /* - ** ### anything else to do here? could another module and/or - ** ### config option "take over" the handler here? i.e. how do - ** ### we lock down this hierarchy so that we are the ultimate - ** ### arbiter? (or do we simply depend on the administrator - ** ### to avoid conflicting configurations?) - ** - ** ### I think the OK stops running type-checkers. need to look. - */ - r->handler = "dav-handler"; - return OK; - } - - return DECLINED; -} - - -/*--------------------------------------------------------------------------- -** -** Configuration info for the module -*/ - -static const command_rec dav_cmds[] = -{ - { - "DAV", - dav_cmd_dav, - NULL, - ACCESS_CONF, /* per directory/location */ - FLAG, - "turn DAV on/off for a directory or location" - }, - { - "DAVLockDB", - dav_cmd_davlockdb, - NULL, - RSRC_CONF, /* per server */ - TAKE1, - "specify a lock database" - }, - { - "DAVMinTimeout", - dav_cmd_davmintimeout, - NULL, - ACCESS_CONF|RSRC_CONF, /* per directory/location, or per server */ - TAKE1, - "specify minimum allowed timeout" - }, - { - "DAVDepthInfinity", - dav_cmd_davdepthinfinity, - NULL, - ACCESS_CONF|RSRC_CONF, /* per directory/location, or per server */ - FLAG, - "allow Depth infinity PROPFIND requests" - }, - { - "DAVParam", - dav_cmd_davparam, - NULL, - ACCESS_CONF|RSRC_CONF, /* per directory/location, or per server */ - TAKE2, - "DAVParam " - }, - { - "LimitXMLRequestBody", - dav_cmd_limitxmlrequestbody, - NULL, - ACCESS_CONF|RSRC_CONF, /* per directory/location, or per server */ - TAKE1, - "Limit (in bytes) on maximum size of an XML-based request body" - }, - { NULL } -}; - -static const handler_rec dav_handlers[] = -{ - {"dav-handler", dav_handler}, - { NULL } -}; - -module MODULE_VAR_EXPORT dav_module = -{ - STANDARD_MODULE_STUFF, - dav_init_handler, /* initializer */ - dav_create_dir_config, /* dir config creater */ - dav_merge_dir_config, /* dir merger --- default is to override */ - dav_create_server_config, /* server config */ - dav_merge_server_config, /* merge server config */ - dav_cmds, /* command table */ - dav_handlers, /* handlers */ - NULL, /* filename translation */ - NULL, /* check_user_id */ - NULL, /* check auth */ - NULL, /* check access */ - dav_type_checker, /* type_checker */ - NULL, /* fixups */ - NULL, /* logger */ - NULL, /* header parser */ - NULL, /* child_init */ - NULL, /* child_exit */ - NULL /* post read-request */ -}; diff --git a/modules/dav/main/mod_dav.dsp b/modules/dav/main/mod_dav.dsp deleted file mode 100644 index e103a8d5dd3c073694a61d5e9f0c18e4b4f6ac7d..0000000000000000000000000000000000000000 --- a/modules/dav/main/mod_dav.dsp +++ /dev/null @@ -1,128 +0,0 @@ -# Microsoft Developer Studio Project File - Name="mod_dav" - Package Owner=<4> -# Microsoft Developer Studio Generated Build File, Format Version 6.00 -# ** DO NOT EDIT ** - -# TARGTYPE "Win32 (x86) Dynamic-Link Library" 0x0102 - -CFG=mod_dav - Win32 Release -!MESSAGE This is not a valid makefile. To build this project using NMAKE, -!MESSAGE use the Export Makefile command and run -!MESSAGE -!MESSAGE NMAKE /f "mod_dav.mak". -!MESSAGE -!MESSAGE You can specify a configuration when running NMAKE -!MESSAGE by defining the macro CFG on the command line. For example: -!MESSAGE -!MESSAGE NMAKE /f "mod_dav.mak" CFG="mod_dav - Win32 Release" -!MESSAGE -!MESSAGE Possible choices for configuration are: -!MESSAGE -!MESSAGE "mod_dav - Win32 Release" (based on "Win32 (x86) Dynamic-Link Library") -!MESSAGE "mod_dav - Win32 Debug" (based on "Win32 (x86) Dynamic-Link Library") -!MESSAGE - -# Begin Project -# PROP AllowPerConfigDependencies 0 -# PROP Scc_ProjName "" -# PROP Scc_LocalPath "" -CPP=cl.exe -MTL=midl.exe -RSC=rc.exe - -!IF "$(CFG)" == "mod_dav - Win32 Release" - -# PROP BASE Use_MFC 0 -# PROP BASE Use_Debug_Libraries 0 -# PROP BASE Output_Dir ".\ApacheMo" -# PROP BASE Intermediate_Dir ".\ApacheMo" -# PROP BASE Target_Dir "" -# PROP Use_MFC 0 -# PROP Use_Debug_Libraries 0 -# PROP Output_Dir ".\mod_davR" -# PROP Intermediate_Dir ".\mod_davR" -# PROP Ignore_Export_Lib 0 -# PROP Target_Dir "" -# ADD BASE CPP /nologo /MT /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /YX /c -# ADD CPP /nologo /MD /W3 /GX /O2 /I "..\..\modules\dav\main" /I "..\..\lib\sdbm" /I "..\..\lib\expat-lite" /I "..\..\lib\apr\include" /I "..\..\include" /I "..\..\os\win32" /D "NDEBUG" /D "WIN32" /D "_WINDOWS" /D "SHARED_MODULE" /D "DAV_EXPORT_SYMBOLS" /YX /FD /c -# ADD BASE MTL /nologo /D "NDEBUG" /win32 -# ADD MTL /nologo /D "NDEBUG" /mktyplib203 /win32 -# ADD BASE RSC /l 0x809 /d "NDEBUG" -# ADD RSC /l 0x809 /d "NDEBUG" -BSC32=bscmake.exe -# ADD BASE BSC32 /nologo -# ADD BSC32 /nologo -LINK32=link.exe -# ADD BASE LINK32 ApacheCore.lib aprlib.lib kernel32.lib ws2_32.lib mswsock.lib /nologo /subsystem:windows /dll /map /machine:I386 /libpath:"..\..\CoreR" /libpath:"..\..\lib\apr\Release" /base:@BaseAddr.ref,mod_dav -# ADD LINK32 ApacheCore.lib aprlib.lib kernel32.lib ws2_32.lib mswsock.lib /nologo /subsystem:windows /dll /map /machine:I386 /libpath:"..\..\CoreR" /libpath:"..\..\lib\apr\Release" /base:@BaseAddr.ref,mod_dav - -!ELSEIF "$(CFG)" == "mod_dav - Win32 Debug" - -# PROP BASE Use_MFC 0 -# PROP BASE Use_Debug_Libraries 1 -# PROP BASE Output_Dir ".\ApacheM0" -# PROP BASE Intermediate_Dir ".\ApacheM0" -# PROP BASE Target_Dir "" -# PROP Use_MFC 0 -# PROP Use_Debug_Libraries 1 -# PROP Output_Dir ".\mod_davD" -# PROP Intermediate_Dir ".\mod_davD" -# PROP Ignore_Export_Lib 0 -# PROP Target_Dir "" -# ADD BASE CPP /nologo /MTd /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /YX /c -# ADD CPP /nologo /MDd /W3 /Gm /GX /ZI /Od /I "..\..\modules\dav\main" /I "..\..\lib\sdbm" /I "..\..\lib\expat-lite" /I "..\..\lib\apr\include" /I "..\..\include" /I "..\..\os\win32" /D "_DEBUG" /D "WIN32" /D "_WINDOWS" /D "SHARED_MODULE" /D "DAV_EXPORT_SYMBOLS" /YX /FD /c -# ADD BASE MTL /nologo /D "_DEBUG" /win32 -# ADD MTL /nologo /D "_DEBUG" /mktyplib203 /win32 -# ADD BASE RSC /l 0x809 /d "_DEBUG" -# ADD RSC /l 0x809 /d "_DEBUG" -BSC32=bscmake.exe -# ADD BASE BSC32 /nologo -# ADD BSC32 /nologo -LINK32=link.exe -# ADD BASE LINK32 ApacheCore.lib aprlib.lib kernel32.lib ws2_32.lib mswsock.lib /nologo /subsystem:windows /dll /map /debug /machine:I386 /libpath:"..\..\CoreD" /libpath:"..\..\lib\apr\Debug" /base:@BaseAddr.ref,mod_dav -# ADD LINK32 ApacheCore.lib aprlib.lib kernel32.lib ws2_32.lib mswsock.lib /nologo /subsystem:windows /dll /debug /machine:I386 /libpath:"..\..\CoreD" /libpath:"..\..\lib\apr\Debug" /base:@BaseAddr.ref,mod_dav -# SUBTRACT LINK32 /incremental:no /map - -!ENDIF - -# Begin Target - -# Name "mod_dav - Win32 Release" -# Name "mod_dav - Win32 Debug" -# Begin Group "Source Files" - -# PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;hpj;bat;for;f90" -# Begin Source File - -SOURCE=..\..\modules\dav\main\liveprop.c -# End Source File -# Begin Source File - -SOURCE=..\..\modules\dav\main\mod_dav.c -# End Source File -# Begin Source File - -SOURCE=..\..\modules\dav\main\props.c -# End Source File -# Begin Source File - -SOURCE=..\..\modules\dav\main\providers.c -# End Source File -# Begin Source File - -SOURCE=..\..\modules\dav\main\util.c -# End Source File -# Begin Source File - -SOURCE=..\..\modules\dav\main\util_lock.c -# End Source File -# End Group -# Begin Group "Header Files" - -# PROP Default_Filter "h;hpp;hxx;hm;inl;fi;fd" -# Begin Source File - -SOURCE=..\..\modules\dav\main\mod_dav.h -# End Source File -# End Group -# End Target -# End Project diff --git a/modules/dav/main/mod_dav.h b/modules/dav/main/mod_dav.h deleted file mode 100644 index df38d4fbbb441d15f3f7196a88603320e7f4b215..0000000000000000000000000000000000000000 --- a/modules/dav/main/mod_dav.h +++ /dev/null @@ -1,1809 +0,0 @@ -/* -** Copyright (C) 1998-2000 Greg Stein. All Rights Reserved. -** -** By using this file, you agree to the terms and conditions set forth in -** the LICENSE.html file which can be found at the top level of the mod_dav -** distribution or at http://www.webdav.org/mod_dav/license-1.html. -** -** Contact information: -** Greg Stein, PO Box 760, Palo Alto, CA, 94302 -** gstein@lyra.org, http://www.webdav.org/mod_dav/ -*/ - -/* -** DAV extension module for Apache 1.3.* -** -** Written by Greg Stein, gstein@lyra.org, http://www.lyra.org/ -*/ - -#ifndef _MOD_DAV_H_ -#define _MOD_DAV_H_ - -#ifdef __cplusplus -extern "C" { -#endif - -#include "httpd.h" - - -#define DAV_VERSION "1.0.1" - -#define DAV_XML_HEADER "" -#define DAV_XML_CONTENT_TYPE "text/xml; charset=\"utf-8\"" - -#define DAV_READ_BLOCKSIZE 2048 /* used for reading input blocks */ - -#ifdef WIN32 -#include -typedef int ssize_t; -#endif /* WIN32 */ - -#define DAV_RESPONSE_BODY_1 "\n\n" -#define DAV_RESPONSE_BODY_2 "\n\n

    " -#define DAV_RESPONSE_BODY_3 "

    \n" -#define DAV_RESPONSE_BODY_4 "\n" - -#define DAV_DO_COPY 0 -#define DAV_DO_MOVE 1 - - -#if 1 -#define DAV_DEBUG 1 -#define DEBUG_CR "\n" -#define DBG0(f) ap_log_error(APLOG_MARK, \ - APLOG_ERR|APLOG_NOERRNO, NULL, (f)) -#define DBG1(f,a1) ap_log_error(APLOG_MARK, \ - APLOG_ERR|APLOG_NOERRNO, NULL, f, a1) -#define DBG2(f,a1,a2) ap_log_error(APLOG_MARK, \ - APLOG_ERR|APLOG_NOERRNO, NULL, f, a1, a2) -#define DBG3(f,a1,a2,a3) ap_log_error(APLOG_MARK, \ - APLOG_ERR|APLOG_NOERRNO, NULL, f, a1, a2, a3) -#else -#undef DAV_DEBUG -#define DEBUG_CR "" -#endif - -#define DAV_INFINITY INT_MAX /* for the Depth: header */ - - -/* -------------------------------------------------------------------- -** -** ERROR MANAGEMENT -*/ - -/* -** dav_error structure. -** -** In most cases, mod_dav uses a pointer to a dav_error structure. If the -** pointer is NULL, then no error has occurred. -** -** In certain cases, a dav_error structure is directly used. In these cases, -** a status value of 0 means that an error has not occurred. -** -** Note: this implies that status != 0 whenever an error occurs. -** -** The desc field is optional (it may be NULL). When NULL, it typically -** implies that Apache has a proper description for the specified status. -*/ -typedef struct dav_error { - int status; /* suggested HTTP status (0 for no error) */ - int error_id; /* DAV-specific error ID */ - const char *desc; /* DAV:responsedescription and error log */ - - int save_errno; /* copy of errno causing the error */ - - struct dav_error *prev; /* previous error (in stack) */ - - /* deferred computation of the description */ - void (*compute_desc)(struct dav_error *err, pool *p); - int ctx_i; - const char *ctx_s; - void *ctx_p; - -} dav_error; - -/* -** Create a new error structure. save_errno will be filled with the current -** errno value. -*/ -dav_error *dav_new_error(pool *p, int status, int error_id, const char *desc); - -/* -** Push a new error description onto the stack of errors. -** -** This function is used to provide an additional description to an existing -** error. -** -** should contain the caller's view of what the current status is, -** given the underlying error. If it doesn't have a better idea, then the -** caller should pass prev->status. -** -** can specify a new error_id since the topmost description has -** changed. -*/ -dav_error *dav_push_error(pool *p, int status, int error_id, const char *desc, - dav_error *prev); - - -/* error ID values... */ - -/* IF: header errors */ -#define DAV_ERR_IF_PARSE 100 /* general parsing error */ -#define DAV_ERR_IF_MULTIPLE_NOT 101 /* multiple "Not" found */ -#define DAV_ERR_IF_UNK_CHAR 102 /* unknown char in header */ -#define DAV_ERR_IF_ABSENT 103 /* no locktokens given */ -#define DAV_ERR_IF_TAGGED 104 /* in parsing tagged-list */ -#define DAV_ERR_IF_UNCLOSED_PAREN 105 /* in no-tagged-list */ - -/* Prop DB errors */ -#define DAV_ERR_PROP_BAD_MAJOR 200 /* major version was wrong */ -#define DAV_ERR_PROP_READONLY 201 /* prop is read-only */ -#define DAV_ERR_PROP_NO_DATABASE 202 /* writeable db not avail */ -#define DAV_ERR_PROP_NOT_FOUND 203 /* prop not found */ -#define DAV_ERR_PROP_BAD_LOCKDB 204 /* could not open lockdb */ -#define DAV_ERR_PROP_OPENING 205 /* problem opening propdb */ -#define DAV_ERR_PROP_EXEC 206 /* problem exec'ing patch */ - -/* Predefined DB errors */ -/* ### any to define?? */ - -/* Predefined locking system errors */ -#define DAV_ERR_LOCK_OPENDB 400 /* could not open lockdb */ -#define DAV_ERR_LOCK_NO_DB 401 /* no database defined */ -#define DAV_ERR_LOCK_CORRUPT_DB 402 /* DB is corrupt */ -#define DAV_ERR_LOCK_UNK_STATE_TOKEN 403 /* unknown State-token */ -#define DAV_ERR_LOCK_PARSE_TOKEN 404 /* bad opaquelocktoken */ -#define DAV_ERR_LOCK_SAVE_LOCK 405 /* err saving locks */ - -/* -** Some comments on Error ID values: -** -** The numbers do not necessarily need to be unique. Uniqueness simply means -** that two errors that have not been predefined above can be distinguished -** from each other. At the moment, mod_dav does not use this distinguishing -** feature, but it could be used in the future to collapse elements -** into groups based on the error ID (and associated responsedescription). -** -** If a compute_desc is provided, then the error ID should be unique within -** the context of the compute_desc function (so the function can figure out -** what to filled into the desc). -** -** Basically, subsystems can ignore defining new error ID values if they want -** to. The subsystems *do* need to return the predefined errors when -** appropriate, so that mod_dav can figure out what to do. Subsystems can -** simply leave the error ID field unfilled (zero) if there isn't an error -** that must be placed there. -*/ - - -/* -------------------------------------------------------------------- -** -** HOOK STRUCTURES -** -** These are here for forward-declaration purposes. For more info, see -** the section title "HOOK HANDLING" for more information, plus each -** structure definition. -*/ - -/* forward-declare this structure */ -typedef struct dav_hooks_db dav_hooks_db; -typedef struct dav_hooks_locks dav_hooks_locks; -typedef struct dav_hooks_vsn dav_hooks_vsn; -typedef struct dav_hooks_repository dav_hooks_repository; -typedef struct dav_hooks_liveprop dav_hooks_liveprop; - - -/* -------------------------------------------------------------------- -** -** RESOURCE HANDLING -*/ - -/* -** Resource Types: -** The base protocol defines only file and collection resources. -** The versioning protocol defines several additional resource types -** to represent artifacts of a version control system. -*/ -typedef enum { - DAV_RESOURCE_TYPE_REGULAR, /* file or collection, working resource - or revision */ - DAV_RESOURCE_TYPE_REVISION, /* explicit revision-id */ - DAV_RESOURCE_TYPE_HISTORY, /* explicit history-id */ - DAV_RESOURCE_TYPE_WORKSPACE, /* workspace */ - DAV_RESOURCE_TYPE_ACTIVITY, /* activity */ - DAV_RESOURCE_TYPE_CONFIGURATION /* configuration */ -} dav_resource_type; - -/* -** Opaque, repository-specific information for a resource. -*/ -typedef struct dav_resource_private dav_resource_private; - -/* Resource descriptor, generated by a repository provider. - * Note: the lock-null state is not explicitly represented here, - * since it may be expensive to compute. Use dav_get_resource_state() - * to determine whether a non-existent resource is a lock-null resource. - */ -typedef struct dav_resource { - dav_resource_type type; - - int exists; /* 0 => null resource */ - int collection; /* 0 => file (if type == DAV_RESOURCE_TYPE_REGULAR) */ - int versioned; /* 0 => unversioned */ - int working; /* 0 => revision (if versioned) */ - int baselined; /* 0 => not baselined */ - - const char *uri; /* the URI for this resource */ - - dav_resource_private *info; - - const dav_hooks_repository *hooks; /* hooks used for this resource */ - -} dav_resource; - -/* -** Lock token type. Lock providers define the details of a lock token. -** However, all providers are expected to at least be able to parse -** the "opaquelocktoken" scheme, which is represented by a uuid_t. -*/ -typedef struct dav_locktoken dav_locktoken; - - -/* -------------------------------------------------------------------- -** -** BUFFER HANDLING -** -** These buffers are used as a lightweight buffer reuse mechanism. Apache -** provides sub-pool creation and destruction to much the same effect, but -** the sub-pools are a bit more general and heavyweight than these buffers. -*/ - -/* buffer for reuse; can grow to accomodate needed size */ -typedef struct -{ - size_t alloc_len; /* how much has been allocated */ - size_t cur_len; /* how much is currently being used */ - char *buf; /* buffer contents */ -} dav_buffer; -#define DAV_BUFFER_MINSIZE 256 /* minimum size for buffer */ -#define DAV_BUFFER_PAD 64 /* amount of pad when growing */ - -/* set the cur_len to the given size and ensure space is available */ -void dav_set_bufsize(pool *p, dav_buffer *pbuf, size_t size); - -/* initialize a buffer and copy the specified (null-term'd) string into it */ -void dav_buffer_init(pool *p, dav_buffer *pbuf, const char *str); - -/* check that the buffer can accomodate more bytes */ -void dav_check_bufsize(pool *p, dav_buffer *pbuf, size_t extra_needed); - -/* append a string to the end of the buffer, adjust length */ -void dav_buffer_append(pool *p, dav_buffer *pbuf, const char *str); - -/* place a string on the end of the buffer, do NOT adjust length */ -void dav_buffer_place(pool *p, dav_buffer *pbuf, const char *str); - -/* place some memory on the end of a buffer; do NOT adjust length */ -void dav_buffer_place_mem(pool *p, dav_buffer *pbuf, const void *mem, - size_t amt, size_t pad); - - -/* -------------------------------------------------------------------- -** -** HANDY UTILITIES -*/ - -/* simple strutures to keep a linked list of pieces of text */ -typedef struct dav_text -{ - const char *text; - struct dav_text *next; -} dav_text; - -typedef struct -{ - dav_text *first; - dav_text *last; -} dav_text_header; - -/* contains results from one of the getprop functions */ -typedef struct -{ - dav_text * propstats; /* element text */ - dav_text * xmlns; /* namespace decls for elem */ -} dav_get_props_result; - -/* holds the contents of a element */ -typedef struct dav_response -{ - const char *href; /* always */ - const char *desc; /* optional description at level */ - - /* use status if propresult.propstats is NULL. */ - dav_get_props_result propresult; - - int status; - - struct dav_response *next; -} dav_response; - -typedef struct -{ - request_rec *rnew; /* new subrequest */ - dav_error err; /* potential error response */ -} dav_lookup_result; - - -void dav_text_append(pool *p, dav_text_header *hdr, const char *text); - -dav_lookup_result dav_lookup_uri(const char *uri, request_rec *r); - -/* format a time string (buf must be at least DAV_TIMEBUF_SIZE chars) */ -#define DAV_STYLE_ISO8601 1 -#define DAV_STYLE_RFC822 2 -#define DAV_TIMEBUF_SIZE 30 - -int dav_get_depth(request_rec *r, int def_depth); - - -/* -------------------------------------------------------------------- -** -** DYNAMIC EXTENSIONS -*/ - -/* ### docco goes here... */ - - -/* -** This structure is used to define the runtime, per-directory/location -** operating context for a single provider. -*/ -typedef struct -{ - int id; /* provider ID */ - - void *m_context; /* module-level context (i.e. managed globals) */ - - void *d_context; /* per-directory context */ - table *d_params; /* per-directory DAV config parameters */ - - int *ns_map; /* for LIVEPROP, map provider URI to global URI */ - -} dav_dyn_context; - -/* -** This structure is used to specify a set of hooks and its associated -** context, on a per-directory/location basis. -** -** Note: the context is assembled from various sources. dav_dyn_hooks -** structures will typically have the same pointer values within the -** context (e.g. ctx.m_context is shared across all providers in a module). -*/ -typedef struct dav_dyn_hooks -{ - dav_dyn_context ctx; /* context for this set of hooks */ - const void *hooks; /* the type-specific hooks */ - - struct dav_dyn_hooks *next; /* next set of hooks, if applicable */ - -} dav_dyn_hooks; - -/* -** These enumerated values define the different types of functionality that -** a provider can implement. -*/ -enum -{ - DAV_DYN_TYPE_SENTINEL, - - DAV_DYN_TYPE_PROPDB, /* property database (1 per dir) */ - DAV_DYN_TYPE_LOCKS, /* lock handling (1 per dir) */ - DAV_DYN_TYPE_QUERY_GRAMMAR, /* DASL search grammar (N per dir) */ - DAV_DYN_TYPE_ACL, /* ACL handling (1 per dir) */ - DAV_DYN_TYPE_VSN, /* versioning (1 per dir) */ - DAV_DYN_TYPE_REPOSITORY, /* resource repository (1 per dir) */ - DAV_DYN_TYPE_LIVEPROP, /* live property handler (N per dir) */ - - DAV_DYN_TYPE_MAX -}; - -/* -** This structure defines a provider for a particular type of functionality. -** -** The ID is private to a provider and can be used to differentiate between -** different subclasses of functionality which are implemented using the -** same set of hooks. For example, a hook function could perform two entirely -** different operations based on the ID which is passed. -** -** is_active() is used by the system to determine whether a particular -** provider is "active" for the given context. It is possible that a provider -** is configured for a directory, but has not been enabled -- the is_active() -** function is used to determine that information. -** -** ### is_active is not used right now -** -** Note: dav_dyn_provider structures are always treated as "const" by mod_dav. -*/ -typedef struct dav_dyn_provider -{ - int id; /* provider ID */ - - int type; /* provider's functionality type */ - const void *hooks; /* pointer to type-specific hooks */ - - int (*is_active)(dav_dyn_context *ctx, int id); - -} dav_dyn_provider; - -#define DAV_DYN_END_MARKER { 0, DAV_DYN_TYPE_SENTINEL, NULL, NULL } - -/* -** This structure defines a module (a set of providers). -** -** The friendly name should be a single word. It is used with the "DAV" -** directive to specify the module to use for a particular directory/location. -** -** The module_open/close functions are used to initialize per-module "global" -** data. The functions are expected to update ctx->m_context. -** -** ### module_open/close are not used at the moment -** ### dir_* are not well-defined, nor are they used -** -** Note: The DAV_DYN_VERSION specifies the version of the dav_dyn_module -** structure itself. It will be updated if changes in the structure -** are made. There are no provisions for forward or backward -** compatible changes. -** -** Note: dav_dyn_module structures are always treated as "const" by mod_dav. -*/ -typedef struct -{ - int magic; -#define DAV_DYN_MAGIC 0x44415621 /* "DAV!" */ - - int version; -#define DAV_DYN_VERSION 1 /* must match exactly */ - - const char *name; /* friendly name */ - - int (*module_open)(dav_dyn_context *ctx); - int (*module_close)(dav_dyn_context *ctx); - - int (*dir_open)(dav_dyn_context *ctx); - int (*dir_param)(dav_dyn_context *ctx, const char *param_name, - const char *param_value); - int (*dir_merge)(dav_dyn_context *base, dav_dyn_context *overrides, - dav_dyn_context *result); - int (*dir_close)(dav_dyn_context *ctx); - - const dav_dyn_provider *providers; /* providers in this module */ - -} dav_dyn_module; - -int dav_load_module(const char *name, const char *module_sym, - const char *filename); -const dav_dyn_module *dav_find_module(const char *name); - -/* -** Various management functions. -** -** NOTE: the pool should be the "configuration pool" -*/ -void dav_process_builtin_modules(pool *p); -void dav_process_module(pool *p, const dav_dyn_module *mod); - -int * dav_collect_liveprop_uris(pool *p, const dav_hooks_liveprop *hooks); -extern array_header *dav_liveprop_uris; - -void *dav_prepare_scan(pool *p, const dav_dyn_module *mod); -int dav_scan_providers(void *ctx, - const dav_dyn_provider **provider, - dav_dyn_hooks *output); - -/* handy macros to assist with dav_dyn_hooks.hooks usage */ -#define DAV_AS_HOOKS_PROPDB(ph) ((const dav_hooks_db *)((ph)->hooks)) -#define DAV_AS_HOOKS_LOCKS(ph) ((const dav_hooks_locks *)((ph)->hooks)) -#define DAV_AS_HOOKS_QUERY_GRAMMAR(ph) ((void *)((ph)->hooks)) -#define DAV_AS_HOOKS_ACL(ph) ((void *)((ph)->hooks)) -#define DAV_AS_HOOKS_VSN(ph) ((const dav_hooks_vsn *)((ph)->hooks)) -#define DAV_AS_HOOKS_REPOSITORY(ph) ((const dav_hooks_repository *)((ph)->hooks)) -#define DAV_AS_HOOKS_LIVEPROP(ph) ((const dav_hooks_liveprop *)((ph)->hooks)) - -/* get provider hooks, given a request record */ -const dav_dyn_hooks *dav_get_provider_hooks(request_rec *r, int provider_type); - -#define DAV_GET_HOOKS_PROPDB(r) DAV_AS_HOOKS_PROPDB(dav_get_provider_hooks(r, DAV_DYN_TYPE_PROPDB)) -#define DAV_GET_HOOKS_LOCKS(r) DAV_AS_HOOKS_LOCKS(dav_get_provider_hooks(r, DAV_DYN_TYPE_LOCKS)) -#define DAV_GET_HOOKS_QUERY_GRAMMAR(r) DAV_AS_HOOKS_QUERY_GRAMMAR(dav_get_provider_hooks(r, DAV_DYN_TYPE_QUERY_GRAMMAR)) -#define DAV_GET_HOOKS_ACL(r) DAV_AS_HOOKS_ACL(dav_get_provider_hooks(r, DAV_DYN_TYPE_ACL)) -#define DAV_GET_HOOKS_VSN(r) DAV_AS_HOOKS_VSN(dav_get_provider_hooks(r, DAV_DYN_TYPE_VSN)) -#define DAV_GET_HOOKS_REPOSITORY(r) DAV_AS_HOOKS_REPOSITORY(dav_get_provider_hooks(r, DAV_DYN_TYPE_REPOSITORY)) -#define DAV_GET_HOOKS_LIVEPROP(r) DAV_AS_HOOKS_LIVEPROP(dav_get_provider_hooks(r, DAV_DYN_TYPE_LIVEPROP)) - - -/* -------------------------------------------------------------------- -** -** IF HEADER PROCESSING -** -** Here is the definition of the If: header from RFC 2518, S9.4: -** -** If = "If" ":" (1*No-tag-list | 1*Tagged-list) -** No-tag-list = List -** Tagged-list = Resource 1*List -** Resource = Coded-URL -** List = "(" 1*(["Not"](State-token | "[" entity-tag "]")) ")" -** State-token = Coded-URL -** Coded-URL = "<" absoluteURI ">" ; absoluteURI from RFC 2616 -** -** List corresponds to dav_if_state_list. No-tag-list corresponds to -** dav_if_header with uri==NULL. Tagged-list corresponds to a sequence of -** dav_if_header structures with (duplicate) uri==Resource -- one -** dav_if_header per state_list. A second Tagged-list will start a new -** sequence of dav_if_header structures with the new URI. -** -** A summary of the semantics, mapped into our structures: -** - Chained dav_if_headers: OR -** - Chained dav_if_state_lists: AND -** - NULL uri matches all resources -*/ - -typedef enum -{ - dav_if_etag, - dav_if_opaquelock -} dav_if_state_type; - -typedef struct dav_if_state_list -{ - dav_if_state_type type; - - int condition; -#define DAV_IF_COND_NORMAL 0 -#define DAV_IF_COND_NOT 1 /* "Not" was applied */ - - const char *etag; /* etag */ - dav_locktoken *locktoken; /* locktoken */ - - struct dav_if_state_list *next; -} dav_if_state_list; - -typedef struct dav_if_header -{ - const char *uri; - size_t uri_len; - struct dav_if_state_list *state; - struct dav_if_header *next; - - int dummy_header; /* used internally by the lock/etag validation */ -} dav_if_header; - -typedef struct dav_locktoken_list -{ - dav_locktoken *locktoken; - struct dav_locktoken_list *next; -} dav_locktoken_list; - -dav_error * dav_get_locktoken_list(request_rec *r, dav_locktoken_list **ltl); - - -/* -------------------------------------------------------------------- -** -** XML PARSING -*/ - -/* -** Qualified namespace values -** -** DAV_NS_DAV_ID -** We always insert the "DAV:" namespace URI at the head of the -** namespace array. This means that it will always be at ID==0, -** making it much easier to test for. -** -** DAV_NS_NONE -** This special ID is used for two situations: -** -** 1) The namespace prefix begins with "xml" (and we do not know -** what it means). Namespace prefixes with "xml" (any case) as -** their first three characters are reserved by the XML Namespaces -** specification for future use. mod_dav will pass these through -** unchanged. When this identifier is used, the prefix is LEFT in -** the element/attribute name. Downstream processing should not -** prepend another prefix. -** -** 2) The element/attribute does not have a namespace. -** -** a) No prefix was used, and a default namespace has not been -** defined. -** b) No prefix was used, and the default namespace was specified -** to mean "no namespace". This is done with a namespace -** declaration of: xmlns="" -** (this declaration is typically used to override a previous -** specification for the default namespace) -** -** In these cases, we need to record that the elem/attr has no -** namespace so that we will not attempt to prepend a prefix. -** All namespaces that are used will have a prefix assigned to -** them -- mod_dav will never set or use the default namespace -** when generating XML. This means that "no prefix" will always -** mean "no namespace". -** -** In both cases, the XML generation will avoid prepending a prefix. -** For the first case, this means the original prefix/name will be -** inserted into the output stream. For the latter case, it means -** the name will have no prefix, and since we never define a default -** namespace, this means it will have no namespace. -** -** Note: currently, mod_dav understands the "xmlns" prefix and the -** "xml:lang" attribute. These are handled specially (they aren't -** left within the XML tree), so the DAV_NS_NONE value won't ever -** really apply to these values. -*/ -#define DAV_NS_DAV_ID 0 /* namespace ID for "DAV:" */ -#define DAV_NS_NONE -10 /* no namespace for this elem/attr */ - -#define DAV_NS_ERROR_BASE -100 /* used only during processing */ -#define DAV_NS_IS_ERROR(e) ((e) <= DAV_NS_ERROR_BASE) - - -/* -** dav_xml_doc: holds a parsed XML document -** dav_xml_elem: holds a parsed XML element -** dav_xml_attr: holds a parsed XML attribute -** -** dav_xml_ns_scope: internal struct used during processing to scope -** namespace declarations -*/ - -typedef struct dav_xml_attr -{ - const char *name; /* attribute name */ - int ns; /* index into namespace array */ - - const char *value; /* attribute value */ - - struct dav_xml_attr *next; /* next attribute */ -} dav_xml_attr; - -typedef struct dav_xml_elem -{ - const char *name; /* element name */ - int ns; /* index into namespace array */ - const char *lang; /* xml:lang for attrs/contents */ - - dav_text_header first_cdata; /* cdata right after start tag */ - dav_text_header following_cdata; /* cdata after MY end tag */ - - struct dav_xml_elem *parent; /* parent element */ - struct dav_xml_elem *next; /* next (sibling) element */ - struct dav_xml_elem *first_child; /* first child element */ - struct dav_xml_attr *attr; /* first attribute */ - - /* used only during parsing */ - struct dav_xml_elem *last_child; /* last child element */ - struct dav_xml_ns_scope *ns_scope; /* namespaces scoped by this elem */ - - /* used during request processing */ - int propid; /* live property ID */ - const dav_hooks_liveprop *provider; /* the provider defining this prop */ - const int *ns_map; /* ns map for this provider */ - -} dav_xml_elem; - -#define DAV_ELEM_IS_EMPTY(e) ((e)->first_child == NULL && \ - (e)->first_cdata.first == NULL) - -typedef struct dav_xml_doc -{ - dav_xml_elem *root; /* root element */ - array_header *namespaces; /* array of namespaces used */ - -} dav_xml_doc; - - -int dav_parse_input(request_rec *r, dav_xml_doc **pdoc); - -int dav_validate_root(const dav_xml_doc *doc, const char *tagname); - -dav_xml_elem *dav_find_child( - const dav_xml_elem *elem, - const char *tagname); - -void dav_xml2text( - pool *p, - const dav_xml_elem *elem, - int style, - array_header *namespaces, - int *ns_map, - const char **pbuf, - size_t *psize - ); -#define DAV_X2T_FULL 0 /* start tag, contents, end tag */ -#define DAV_X2T_INNER 1 /* contents only */ -#define DAV_X2T_LANG_INNER 2 /* xml:lang + inner contents */ -#define DAV_X2T_FULL_NS_LANG 3 /* FULL + ns defns + xml:lang */ - -const char *dav_empty_elem(pool *p, const dav_xml_elem *elem); -void dav_quote_xml_elem(pool *p, dav_xml_elem *elem); -const char * dav_quote_string(pool *p, const char *s, int quotes); - - -/* -------------------------------------------------------------------- -** -** LIVE PROPERTY HANDLING -*/ - -typedef enum { - DAV_PROP_INSERT_NOTME, /* prop not defined by this provider */ - DAV_PROP_INSERT_NOTDEF, /* property is defined by this provider, - but nothing was inserted because the - (live) property is not defined for this - resource (it may be present as a dead - property). */ - DAV_PROP_INSERT_NAME, /* a property name (empty elem) was - inserted into the text block */ - DAV_PROP_INSERT_VALUE /* a property name/value pair was inserted - into the text block */ -} dav_prop_insert; - -typedef enum { - DAV_PROP_RW_NOTME, /* not my property */ - DAV_PROP_RW_NO, /* property is NOT writeable */ - DAV_PROP_RW_YES /* property IS writeable */ -} dav_prop_rw; - -/* opaque type for PROPPATCH rollback information */ -typedef struct dav_liveprop_rollback dav_liveprop_rollback; - -struct dav_hooks_liveprop -{ - /* - ** This URI is returned in the DAV: header to let clients know what - ** sets of live properties are supported by the installation. mod_dav - ** will place open/close angle brackets around this value (much like - ** a Coded-URL); quotes and brackets should not be in the value. - ** - ** Example: http://apache.org/dav/props/ - ** - ** (of course, use your own domain to ensure a unique value) - */ - const char * propset_uri; - - /* - ** Find a property, returning a non-zero, unique, opaque identifier. - ** - ** NOTE: Providers must ensure this identifier is universally unique. - ** See the registration table below. - ** ### it would be nice to avoid this uniqueness constraint. however, - ** ### that would mean our xml_elem annotation concept would need to - ** ### change (w.r.t. the fact that it acts as a cache for find_prop). - ** - ** Returns 0 if the property is not defined by this provider. - */ - int (*find_prop)(const char *ns_uri, const char *name); - - /* - ** Insert a property name/value into a text block. The property to - ** insert is identified by the propid value. Providers should return - ** DAV_PROP_INSERT_NOTME if they do not define the specified propid. - ** If insvalue is true, then the property's value should be inserted; - ** otherwise, an empty element (ie. just the prop's name) should be - ** inserted. - ** - ** Returns one of DAV_PROP_INSERT_* based on what happened. - ** - ** ### we may need more context... ie. the lock database - */ - dav_prop_insert (*insert_prop)(const dav_resource *resource, - int propid, int insvalue, - const int *ns_map, dav_text_header *phdr); - - /* - ** Insert all known/defined property names (and values). This is - ** similar to insert_prop, but *all* properties will be inserted - ** rather than specific, individual properties. - */ - void (*insert_all)(const dav_resource *resource, int insvalue, - const int *ns_map, dav_text_header *phdr); - - /* - ** Determine whether a given property is writeable. - ** - ** ### we may want a different semantic. i.e. maybe it should be - ** ### "can we write into this property?" - ** - ** Returns appropriate read/write status. - */ - dav_prop_rw (*is_writeable)(const dav_resource *resource, int propid); - - /* - ** This member defines the set of namespace URIs that the provider - ** uses for its properties. When insert_all is called, it will be - ** passed a list of integers that map from indices into this list - ** to namespace IDs for output generation. - ** - ** The last entry in this list should be a NULL value (sentinel). - */ - const char * const * namespace_uris; - - /* - ** ### this is not the final design. we want an open-ended way for - ** ### liveprop providers to attach *new* properties. To this end, - ** ### we'll have a "give me a list of the props you define", a way - ** ### to check for a prop's existence, a way to validate a set/remove - ** ### of a prop, and a way to execute/commit/rollback that change. - */ - - /* - ** Validate that the live property can be assigned a value, and that - ** the provided value is valid. - ** - ** elem will point to the XML element that names the property. For - ** example: - ** T - ** - ** The provider can access the cdata fields and the child elements - ** to extract the relevant pieces. - ** - ** operation is one of DAV_PROP_OP_SET or _DELETE. - ** - ** The provider may return a value in *context which will be passed - ** to each of the exec/commit/rollback functions. For example, this - ** may contain an internal value which has been processed from the - ** input element. - ** - ** The provider must set defer_to_dead to true (non-zero) or false. - ** If true, then the set/remove is deferred to the dead property - ** database. Note: it will be set to zero on entry. - */ - dav_error * (*patch_validate)(const dav_resource *resource, - const dav_xml_elem *elem, - int operation, - void **context, - int *defer_to_dead); - - /* ### doc... */ - dav_error * (*patch_exec)(dav_resource *resource, - const dav_xml_elem *elem, - int operation, - void *context, - dav_liveprop_rollback **rollback_ctx); - - /* ### doc... */ - void (*patch_commit)(dav_resource *resource, - int operation, - void *context, - dav_liveprop_rollback *rollback_ctx); - - /* ### doc... */ - dav_error * (*patch_rollback)(dav_resource *resource, - int operation, - void *context, - dav_liveprop_rollback *rollback_ctx); -}; - -/* -** Property Identifier Registration -** -** At the moment, mod_dav requires live property providers to ensure that -** each property returned has a unique value. For now, this is done through -** central registration (there are no known providers other than the default, -** so this remains manageable). -** -** WARNING: the TEST ranges should never be "shipped". -*/ -#define DAV_PROPID_CORE 10000 /* ..10099. defined by mod_dav */ -#define DAV_PROPID_FS 10100 /* ..10299. - mod_dav filesystem provider. */ -#define DAV_PROPID_TEST1 10300 /* ..10399 */ -#define DAV_PROPID_TEST2 10400 /* ..10499 */ -#define DAV_PROPID_TEST3 10500 /* ..10599 */ -/* Next: 10600 */ - - -/* -------------------------------------------------------------------- -** -** DATABASE FUNCTIONS -*/ - -typedef struct dav_db dav_db; -typedef struct -{ - char *dptr; - size_t dsize; -} dav_datum; - -/* hook functions to enable pluggable databases */ -struct dav_hooks_db -{ - dav_error * (*open)(pool *p, const dav_resource *resource, int ro, - dav_db **pdb); - void (*close)(dav_db *db); - - /* - ** Fetch the value from the database. If the value does not exist, - ** then *pvalue should be zeroed. - ** - ** Note: it is NOT an error for the key/value pair to not exist. - */ - dav_error * (*fetch)(dav_db *db, dav_datum key, dav_datum *pvalue); - - dav_error * (*store)(dav_db *db, dav_datum key, dav_datum value); - dav_error * (*remove)(dav_db *db, dav_datum key); - - /* returns 1 if the record specified by "key" exists; 0 otherwise */ - int (*exists)(dav_db *db, dav_datum key); - - dav_error * (*firstkey)(dav_db *db, dav_datum *pkey); - dav_error * (*nextkey)(dav_db *db, dav_datum *pkey); - - void (*freedatum)(dav_db *db, dav_datum data); -}; - - -/* -------------------------------------------------------------------- -** -** LOCK FUNCTIONS -*/ - -/* Used to represent a Timeout header of "Infinity" */ -#define DAV_TIMEOUT_INFINITE 0 - -time_t dav_get_timeout(request_rec *r); - -/* -** Opaque, repository-specific information for a lock database. -*/ -typedef struct dav_lockdb_private dav_lockdb_private; - -/* -** Opaque, repository-specific information for a lock record. -*/ -typedef struct dav_lock_private dav_lock_private; - -/* -** Lock database type. Lock providers are urged to implement a "lazy" open, so -** doing an "open" is cheap until something is actually needed from the DB. -*/ -typedef struct -{ - const dav_hooks_locks *hooks; /* the hooks used for this lockdb */ - int ro; /* was it opened readonly? */ - - dav_lockdb_private *info; - -} dav_lockdb; - -typedef enum { - DAV_LOCKSCOPE_UNKNOWN, - DAV_LOCKSCOPE_EXCLUSIVE, - DAV_LOCKSCOPE_SHARED -} dav_lock_scope; - -typedef enum { - DAV_LOCKTYPE_UNKNOWN, - DAV_LOCKTYPE_WRITE -} dav_lock_type; - -typedef enum { - DAV_LOCKREC_DIRECT, /* lock asserted on this resource */ - DAV_LOCKREC_INDIRECT, /* lock inherited from a parent */ - DAV_LOCKREC_INDIRECT_PARTIAL /* most info is not filled in */ -} dav_lock_rectype; - -/* -** dav_lock: hold information about a lock on a resource. -** -** This structure is used for both direct and indirect locks. A direct lock -** is a lock applied to a specific resource by the client. An indirect lock -** is one that is inherited from a parent resource by virtue of a non-zero -** Depth: header when the lock was applied. -** -** mod_dav records both types of locks in the lock database, managing their -** addition/removal as resources are moved about the namespace. -** -** Note that the lockdb is free to marshal this structure in any form that -** it likes. -** -** For a "partial" lock, the and fields must be filled -** in. All other (user) fields should be zeroed. The lock provider will -** usually fill in the field, and the field may be used to -** construct a list of partial locks. -** -** The lock provider MUST use the info field to store a value such that a -** dav_lock structure can locate itself in the underlying lock database. -** This requirement is needed for refreshing: when an indirect dav_lock is -** refreshed, its reference to the direct lock does not specify the direct's -** resource, so the only way to locate the (refreshed, direct) lock in the -** database is to use the info field. -** -** Note that only refers to the resource where this lock was -** found. -** ### hrm. that says the abstraction is wrong. is_locknull may disappear. -*/ -typedef struct dav_lock -{ - dav_lock_rectype rectype; /* type of lock record */ - int is_locknull; /* lock establishes a locknull resource */ - - /* ### put the resource in here? */ - - dav_lock_scope scope; /* scope of the lock */ - dav_lock_type type; /* type of lock */ - int depth; /* depth of the lock */ - time_t timeout; /* when the lock will timeout */ - - const dav_locktoken *locktoken; /* the token that was issued */ - - const char *owner; /* (XML) owner of the lock */ - const char *auth_user; /* auth'd username owning lock */ - - dav_lock_private *info; /* private to the lockdb */ - - struct dav_lock *next; /* for managing a list of locks */ -} dav_lock; - -/* Property-related public lock functions */ -const char *dav_lock_get_activelock(request_rec *r, dav_lock *locks, - dav_buffer *pbuf); - -/* LockDB-related public lock functions */ -const char *dav_get_lockdb_path(const request_rec *r); -dav_error * dav_lock_parse_lockinfo(request_rec *r, - const dav_resource *resrouce, - dav_lockdb *lockdb, - const dav_xml_doc *doc, - dav_lock **lock_request); -int dav_unlock(request_rec *r, const dav_resource *resource, - const dav_locktoken *locktoken); -dav_error * dav_add_lock(request_rec *r, const dav_resource *resource, - dav_lockdb *lockdb, dav_lock *request, - dav_response **response); -dav_error * dav_notify_created(request_rec *r, - dav_lockdb *lockdb, - const dav_resource *resource, - int resource_state, - int depth); - -dav_error * dav_lock_query(dav_lockdb *lockdb, const dav_resource *resource, - dav_lock **locks); - -dav_error * dav_validate_request(request_rec *r, dav_resource *resource, - int depth, dav_locktoken *locktoken, - dav_response **response, int flags, - dav_lockdb *lockdb); -/* -** flags: -** 0x0F -- reserved for values -** -** other flags, detailed below -*/ -#define DAV_VALIDATE_RESOURCE 0x0010 /* validate just the resource */ -#define DAV_VALIDATE_PARENT 0x0020 /* validate resource AND its parent */ -#define DAV_VALIDATE_ADD_LD 0x0040 /* add DAV:lockdiscovery into - the 424 DAV:response */ -#define DAV_VALIDATE_USE_424 0x0080 /* return 424 status, not 207 */ -#define DAV_VALIDATE_IS_PARENT 0x0100 /* for internal use */ - -/* Lock-null related public lock functions */ -int dav_get_resource_state(request_rec *r, const dav_resource *resource); - -/* Lock provider hooks. Locking is optional, so there may be no - * lock provider for a given repository. - */ -struct dav_hooks_locks -{ - /* Return the supportedlock property for this provider */ - /* ### maybe this should take a resource argument? */ - const char * (*get_supportedlock)(void); - - /* Parse a lock token URI, returning a lock token object allocated - * in the given pool. - */ - dav_error * (*parse_locktoken)( - pool *p, - const char *char_token, - dav_locktoken **locktoken_p - ); - - /* Format a lock token object into a URI string, allocated in - * the given pool. - * - * Always returns non-NULL. - */ - const char * (*format_locktoken)( - pool *p, - const dav_locktoken *locktoken - ); - - /* Compare two lock tokens. - * - * Result < 0 => lt1 < lt2 - * Result == 0 => lt1 == lt2 - * Result > 0 => lt1 > lt2 - */ - int (*compare_locktoken)( - const dav_locktoken *lt1, - const dav_locktoken *lt2 - ); - - /* Open the provider's lock database. - * - * The provider may or may not use a "real" database for locks - * (a lock could be an attribute on a resource, for example). - * - * The provider may choose to use the value of the DAVLockDB directive - * (as returned by dav_get_lockdb_path()) to decide where to place - * any storage it may need. - * - * The request storage pool should be associated with the lockdb, - * so it can be used in subsequent operations. - * - * If ro != 0, only readonly operations will be performed. - * If force == 0, the open can be "lazy"; no subsequent locking operations - * may occur. - * If force != 0, locking operations will definitely occur. - */ - dav_error * (*open_lockdb)( - request_rec *r, - int ro, - int force, - dav_lockdb **lockdb - ); - - /* Indicates completion of locking operations */ - void (*close_lockdb)( - dav_lockdb *lockdb - ); - - /* Take a resource out of the lock-null state. */ - dav_error * (*remove_locknull_state)( - dav_lockdb *lockdb, - const dav_resource *resource - ); - - /* - ** Create a (direct) lock structure for the given resource. A locktoken - ** will be created. - ** - ** The lock provider may store private information into lock->info. - */ - dav_error * (*create_lock)(dav_lockdb *lockdb, - const dav_resource *resource, - dav_lock **lock); - - /* - ** Get the locks associated with the specified resource. - ** - ** If resolve_locks is true (non-zero), then any indirect locks are - ** resolved to their actual, direct lock (i.e. the reference to followed - ** to the original lock). - ** - ** The locks, if any, are returned as a linked list in no particular - ** order. If no locks are present, then *locks will be NULL. - */ - dav_error * (*get_locks)(dav_lockdb *lockdb, - const dav_resource *resource, - int calltype, - dav_lock **locks); - -#define DAV_GETLOCKS_RESOLVED 0 /* resolve indirects to directs */ -#define DAV_GETLOCKS_PARTIAL 1 /* leave indirects partially filled */ -#define DAV_GETLOCKS_COMPLETE 2 /* fill out indirect locks */ - - /* - ** Find a particular lock on a resource (specified by its locktoken). - ** - ** *lock will be set to NULL if the lock is not found. - ** - ** Note that the provider can optimize the unmarshalling -- only one - ** lock (or none) must be constructed and returned. - ** - ** If partial_ok is true (non-zero), then an indirect lock can be - ** partially filled in. Otherwise, another lookup is done and the - ** lock structure will be filled out as a DAV_LOCKREC_INDIRECT. - */ - dav_error * (*find_lock)(dav_lockdb *lockdb, - const dav_resource *resource, - const dav_locktoken *locktoken, - int partial_ok, - dav_lock **lock); - - /* - ** Quick test to see if the resource has *any* locks on it. - ** - ** This is typically used to determine if a non-existent resource - ** has a lock and is (therefore) a locknull resource. - ** - ** WARNING: this function may return TRUE even when timed-out locks - ** exist (i.e. it may not perform timeout checks). - */ - dav_error * (*has_locks)(dav_lockdb *lockdb, - const dav_resource *resource, - int *locks_present); - - /* - ** Append the specified lock(s) to the set of locks on this resource. - ** - ** If "make_indirect" is true (non-zero), then the specified lock(s) - ** should be converted to an indirect lock (if it is a direct lock) - ** before appending. Note that the conversion to an indirect lock does - ** not alter the passed-in lock -- the change is internal the - ** append_locks function. - ** - ** Multiple locks are specified using the lock->next links. - */ - dav_error * (*append_locks)(dav_lockdb *lockdb, - const dav_resource *resource, - int make_indirect, - const dav_lock *lock); - - /* - ** Remove any lock that has the specified locktoken. - ** - ** If locktoken == NULL, then ALL locks are removed. - */ - dav_error * (*remove_lock)(dav_lockdb *lockdb, - const dav_resource *resource, - const dav_locktoken *locktoken); - - /* - ** Refresh all locks, found on the specified resource, which has a - ** locktoken in the provided list. - ** - ** If the lock is indirect, then the direct lock is referenced and - ** refreshed. - ** - ** Each lock that is updated is returned in the argument. - ** Note that the locks will be fully resolved. - */ - dav_error * (*refresh_locks)(dav_lockdb *lockdb, - const dav_resource *resource, - const dav_locktoken_list *ltl, - time_t new_time, - dav_lock **locks); - - /* - ** Look up the resource associated with a particular locktoken. - ** - ** The search begins at the specified and the lock - ** specified by . - ** - ** If the resource/token specifies an indirect lock, then the direct - ** lock will be looked up, and THAT resource will be returned. In other - ** words, this function always returns the resource where a particular - ** lock (token) was asserted. - ** - ** NOTE: this function pointer is allowed to be NULL, indicating that - ** the provider does not support this type of functionality. The - ** caller should then traverse up the repository hierarchy looking - ** for the resource defining a lock with this locktoken. - */ - dav_error * (*lookup_resource)(dav_lockdb *lockdb, - const dav_locktoken *locktoken, - const dav_resource *start_resource, - const dav_resource **resource); -}; - -/* what types of resources can be discovered by dav_get_resource_state() */ -#define DAV_RESOURCE_LOCK_NULL 10 /* resource lock-null */ -#define DAV_RESOURCE_NULL 11 /* resource null */ -#define DAV_RESOURCE_EXISTS 12 /* resource exists */ -#define DAV_RESOURCE_ERROR 13 /* an error occurred */ - - -/* -------------------------------------------------------------------- -** -** PROPERTY HANDLING -*/ - -typedef struct dav_propdb dav_propdb; - - -dav_error *dav_open_propdb( - request_rec *r, - dav_lockdb *lockdb, - dav_resource *resource, - int ro, - array_header *ns_xlate, - dav_propdb **propdb); - -void dav_close_propdb(dav_propdb *db); - -dav_get_props_result dav_get_props( - dav_propdb *db, - dav_xml_doc *doc); - -dav_get_props_result dav_get_allprops( - dav_propdb *db, - int getvals); - -/* -** 3-phase property modification. -** -** 1) validate props. readable? unlocked? ACLs allow access? -** 2) execute operation (set/delete) -** 3) commit or rollback -** -** ### eventually, auth must be available. a ref to the request_rec (which -** ### contains the auth info) should be in the shared context struct. -** -** Each function may alter the error values and information contained within -** the context record. This should be done as an "increasing" level of -** error, rather than overwriting any previous error. -** -** Note that commit() cannot generate errors. It should simply free the -** rollback information. -** -** rollback() may generate additional errors because the rollback operation -** can sometimes fail(!). -** -** The caller should allocate an array of these, one per operation. It should -** be zero-initialized, then the db, operation, and prop fields should be -** filled in before calling dav_prop_validate. Note that the set/delete -** operations are order-dependent. For a given (logical) context, the same -** pointer must be passed to each phase. -** -** error_type is an internal value, but will have the same numeric value -** for each possible "desc" value. This allows the caller to group the -** descriptions via the error_type variable, rather than through string -** comparisons. Note that "status" does not provide enough granularity to -** differentiate/group the "desc" values. -** -** Note that the propdb will maintain some (global) context across all -** of the property change contexts. This implies that you can have only -** one open transaction per propdb. -*/ -typedef struct dav_prop_ctx -{ - dav_propdb *propdb; - - int operation; -#define DAV_PROP_OP_SET 1 /* set a property value */ -#define DAV_PROP_OP_DELETE 2 /* delete a prop value */ -/* ### add a GET? */ - - dav_xml_elem *prop; /* property to affect */ - - dav_error *err; /* error (if any) */ - - /* private items to the propdb */ - int is_liveprop; - void *liveprop_ctx; - struct dav_rollback_item *rollback; /* optional rollback info */ - - /* private to mod_dav.c */ - request_rec *r; - -} dav_prop_ctx; - -void dav_prop_validate(dav_prop_ctx *ctx); -void dav_prop_exec(dav_prop_ctx *ctx); -void dav_prop_commit(dav_prop_ctx *ctx); -void dav_prop_rollback(dav_prop_ctx *ctx); - -#define DAV_PROP_CTX_HAS_ERR(dpc) ((dpc).err && (dpc).err->status >= 300) - - -/* -------------------------------------------------------------------- -** -** WALKER STRUCTURE -*/ - -/* private, opaque info structure for repository walking context */ -typedef struct dav_walker_private dav_walker_private; - -/* directory tree walking context */ -typedef struct dav_walker_ctx -{ - int walk_type; -#define DAV_WALKTYPE_AUTH 1 /* limit to authorized files */ -#define DAV_WALKTYPE_ALL 2 /* walk normal files */ -#define DAV_WALKTYPE_HIDDEN 4 /* walk hidden files */ -#define DAV_WALKTYPE_LOCKNULL 8 /* walk locknull resources */ - - int postfix; /* call func for dirs after files */ - - dav_error * (*func)(struct dav_walker_ctx *ctx, int calltype); -#define DAV_CALLTYPE_MEMBER 1 /* called for a member resource */ -#define DAV_CALLTYPE_COLLECTION 2 /* called for a collection */ -#define DAV_CALLTYPE_LOCKNULL 3 /* called for a locknull resource */ -#define DAV_CALLTYPE_POSTFIX 4 /* postfix call for a collection */ - - struct pool *pool; - - request_rec *r; /* original request */ - dav_buffer uri; /* current URI */ - const dav_resource *resource; /* current resource */ - const dav_resource *res2; /* optional secondary resource */ - - const dav_resource *root; /* RO: root resource of the walk */ - - dav_lockdb *lockdb; - - dav_response *response; /* OUT: multistatus responses */ - - /* for PROPFIND operations */ - dav_xml_doc *doc; - int propfind_type; -#define DAV_PROPFIND_IS_ALLPROP 1 -#define DAV_PROPFIND_IS_PROPNAME 2 -#define DAV_PROPFIND_IS_PROP 3 - - dav_text *propstat_404; /* (cached) propstat giving a 404 error */ - - /* for COPY and MOVE operations */ - int is_move; - dav_buffer work_buf; - - const dav_if_header *if_header; /* for validation */ - const dav_locktoken *locktoken; /* for UNLOCK */ - const dav_lock *lock; /* for LOCK */ - int skip_root; /* for dav_inherit_locks() */ - - int flags; - - dav_walker_private *info; /* for use by repository manager */ - -} dav_walker_ctx; - -void dav_add_response(dav_walker_ctx *ctx, const char *href, int status, - dav_get_props_result *propstats); - - -/* -------------------------------------------------------------------- -** -** "STREAM" STRUCTURE -** -** mod_dav uses this abstraction for interacting with the repository -** while fetching/storing resources. mod_dav views resources as a stream -** of bytes. -** -** Note that the structure is opaque -- it is private to the repository -** that created the stream in the repository's "open" function. -*/ - -typedef struct dav_stream dav_stream; - -typedef enum { - DAV_MODE_READ, /* open for reading */ - DAV_MODE_READ_SEEKABLE, /* open for random access reading */ - DAV_MODE_WRITE_TRUNC, /* truncate and open for writing */ - DAV_MODE_WRITE_SEEKABLE /* open for writing; random access */ -} dav_stream_mode; - -/* -------------------------------------------------------------------- -** -** REPOSITORY FUNCTIONS -*/ - -/* Repository provider hooks */ -struct dav_hooks_repository -{ - /* Flag for whether repository requires special GET handling. - * If resources in the repository are not visible in the - * filesystem location which URLs map to, then special handling - * is required to first fetch a resource from the repository, - * respond to the GET request, then free the resource copy. - */ - int handle_get; - - /* Get a resource descriptor for the URI in a request. - * A descriptor is returned even if the resource does not exist. - * The return value should only be NULL for some kind of fatal error. - * - * The root_dir is the root of the directory for which this repository - * is configured. - * The workspace is the value of any Target-Selector header, or NULL - * if there is none. - * - * The provider may associate the request storage pool with the resource, - * to use in other operations on that resource. - */ - dav_resource * (*get_resource)( - request_rec *r, - const char *root_dir, - const char *workspace - ); - - /* Get a resource descriptor for the parent of the given resource. - * The resources need not exist. NULL is returned if the resource - * is the root collection. - */ - dav_resource * (*get_parent_resource)( - const dav_resource *resource - ); - - /* Determine whether two resource descriptors refer to the same resource. - * - * Result != 0 => the resources are the same. - */ - int (*is_same_resource)( - const dav_resource *res1, - const dav_resource *res2 - ); - - /* Determine whether one resource is a parent (immediate or otherwise) - * of another. - * - * Result != 0 => res1 is a parent of res2. - */ - int (*is_parent_resource)( - const dav_resource *res1, - const dav_resource *res2 - ); - - /* - ** Open a stream for this resource, using the specified mode. The - ** stream will be returned in *stream. - */ - dav_error * (*open_stream)(const dav_resource *resource, - dav_stream_mode mode, - dav_stream **stream); - - /* - ** Close the specified stream. - ** - ** mod_dav will (ideally) make sure to call this. For safety purposes, - ** a provider should (ideally) register a cleanup function with the - ** request pool to get this closed and cleaned up. - ** - ** Note the possibility of an error from the close -- it is entirely - ** feasible that the close does a "commit" of some kind, which can - ** produce an error. - ** - ** commit should be TRUE (non-zero) or FALSE (0) if the stream was - ** opened for writing. This flag states whether to retain the file - ** or not. - ** Note: the commit flag is ignored for streams opened for reading. - */ - dav_error * (*close_stream)(dav_stream *stream, int commit); - - /* - ** Read data from the stream. - ** - ** The size of the buffer is passed in *bufsize, and the amount read - ** is returned in *bufsize. - ** - ** *bufsize should be set to zero when the end of file is reached. - ** As a corollary, this function should always read at least one byte - ** on each call, until the EOF condition is met. - */ - dav_error * (*read_stream)(dav_stream *stream, - void *buf, size_t *bufsize); - - /* - ** Write data to the stream. - ** - ** All of the bytes must be written, or an error should be returned. - */ - dav_error * (*write_stream)(dav_stream *stream, - const void *buf, size_t bufsize); - - /* - ** Seek to an absolute position in the stream. This is used to support - ** Content-Range in a GET/PUT. - ** - ** NOTE: if this function is NULL (which is allowed), then any - ** operations using Content-Range will be refused. - */ - dav_error * (*seek_stream)(dav_stream *stream, off_t abs_position); - - /* - ** If a GET is processed using a stream (open_stream, read_stream) - ** rather than via a sub-request (on get_pathname), then this function - ** is used to provide the repository with a way to set the headers - ** in the response. - ** - ** It may be NULL if get_pathname is provided. - */ - dav_error * (*set_headers)(request_rec *r, - const dav_resource *resource); - - /* Get a pathname for the file represented by the resource descriptor. - * A provider may need to create a temporary copy of the file, if it is - * not directly accessible in a filesystem. free_handle_p will be set by - * the provider to point to information needed to clean up any temporary - * storage used. - * - * Returns NULL if the file could not be made accessible. - */ - const char * (*get_pathname)( - const dav_resource *resource, - void **free_handle_p - ); - - /* Free any temporary storage associated with a file made accessible by - * get_pathname(). - */ - void (*free_file)( - void *free_handle - ); - - /* Create a collection resource. The resource must not already exist. - * - * Result == NULL if the collection was created successfully. Also, the - * resource object is updated to reflect that the resource exists, and - * is a collection. - */ - dav_error * (*create_collection)( - pool *p, dav_resource *resource - ); - - /* Copy one resource to another. The destination must not exist. - * Handles both files and collections. Properties are copied as well. - * The depth argument is ignored for a file, and can be either 0 or - * DAV_INFINITY for a collection. - * If an error occurs in a child resource, then the return value is - * non-NULL, and *response is set to a multistatus response. - * If the copy is successful, the dst resource object is - * updated to reflect that the resource exists. - */ - dav_error * (*copy_resource)( - const dav_resource *src, - dav_resource *dst, - int depth, - dav_response **response - ); - - /* Move one resource to another. The destination must not exist. - * Handles both files and collections. Properties are moved as well. - * If an error occurs in a child resource, then the return value is - * non-NULL, and *response is set to a multistatus response. - * If the move is successful, the src and dst resource objects are - * updated to reflect that the source no longer exists, and the - * destination does. - */ - dav_error * (*move_resource)( - dav_resource *src, - dav_resource *dst, - dav_response **response - ); - - /* Remove a resource. Handles both files and collections. - * Removes any associated properties as well. - * If an error occurs in a child resource, then the return value is - * non-NULL, and *response is set to a multistatus response. - * If the delete is successful, the resource object is updated to - * reflect that the resource no longer exists. - */ - dav_error * (*remove_resource)( - dav_resource *resource, - dav_response **response - ); - - /* Walk a resource hierarchy. - * - * Iterates over the resource hierarchy specified by wctx->resource. - * Parameter for control of the walk and the callback are specified - * by wctx. - * - * An HTTP_* status code is returned if an error occurs during the - * walk or the callback indicates an error. OK is returned on success. - */ - dav_error * (*walk)(dav_walker_ctx *wctx, int depth); - - /* Get the entity tag for a resource */ - const char * (*getetag)(const dav_resource *resource); -}; - - -/* -------------------------------------------------------------------- -** -** VERSIONING FUNCTIONS -*/ - -/* dav_get_target_selector: - * - * Returns any Target-Selector header in a request - * (used by versioning clients) - */ -const char *dav_get_target_selector(request_rec *r); - -/* Ensure that a resource is writable. If there is no versioning - * provider, then this is essentially a no-op. Versioning repositories - * require explicit resource creation and checkout before they can - * be written to. If a new resource is to be created, or an existing - * resource deleted, the parent collection must be checked out as well. - * - * Set the parent_only flag to only make the parent collection writable. - * Otherwise, both parent and child are made writable as needed. If the - * child does not exist, then a new versioned resource is created and - * checked out. - * - * The parent_resource and parent_was_writable arguments are optional - * (i.e. they may be NULL). If parent_only is set, then the - * resource_existed and resource_was_writable arguments are ignored. - * - * The previous states of the resources are returned, so they can be - * restored after the operation completes (see - * dav_revert_resource_writability()) - */ -dav_error *dav_ensure_resource_writable(request_rec *r, - dav_resource *resource, - int parent_only, - dav_resource **parent_resource, - int *resource_existed, - int *resource_was_writable, - int *parent_was_writable); - -/* Revert the writability of resources back to what they were - * before they were modified. If undo == 0, then the resource - * modifications are maintained (i.e. they are checked in). - * If undo != 0, then resource modifications are discarded - * (i.e. they are unchecked out). - * - * The resource and parent_resource arguments are optional - * (i.e. they may be NULL). - */ -dav_error *dav_revert_resource_writability(request_rec *r, - dav_resource *resource, - dav_resource *parent_resource, - int undo, - int resource_existed, - int resource_was_writable, - int parent_was_writable); - -/* Versioning provider hooks */ -struct dav_hooks_vsn -{ - /* Return supported versioning level - * for the Versioning header - */ - const char * (*get_vsn_header)(void); - - /* Create a new (empty) resource. If successful, - * the resource object state is updated appropriately. - */ - dav_error * (*mkresource)(dav_resource *resource); - - /* Checkout a resource. If successful, the resource - * object state is updated appropriately. - */ - dav_error * (*checkout)(dav_resource *resource); - - /* Uncheckout a resource. If successful, the resource - * object state is updated appropriately. - */ - dav_error * (*uncheckout)(dav_resource *resource); - - /* Checkin a working resource. If successful, the resource - * object state is updated appropriately. - */ - dav_error * (*checkin)(dav_resource *resource); - - /* Determine whether a non-versioned (or non-existent) resource - * is versionable. Returns != 0 if resource can be versioned. - */ - int (*versionable)(const dav_resource *resource); - - /* Determine whether auto-versioning is enabled for a resource - * (which may not exist, or may not be versioned). - * Returns != 0 if auto-versioning is enabled. - */ - int (*auto_version_enabled)(const dav_resource *resource); -}; - - -/* -------------------------------------------------------------------- -** -** MISCELLANEOUS STUFF -*/ - -/* allow providers access to the per-directory parameters */ -table *dav_get_dir_params(const request_rec *r); - -/* fetch the "LimitXMLRequestBody" in force for this resource */ -size_t dav_get_limit_xml_body(const request_rec *r); - -/* manage an array of unique URIs: dav_insert_uri() and DAV_GET_URI_ITEM() */ - -/* return the URI's (existing) index, or insert it and return a new index */ -int dav_insert_uri(array_header *uri_array, const char *uri); -#define DAV_GET_URI_ITEM(ary, i) (((const char * const *)(ary)->elts)[i]) - - -#ifdef __cplusplus -} -#endif - -#endif /* _MOD_DAV_H_ */ diff --git a/modules/dav/main/props.c b/modules/dav/main/props.c deleted file mode 100644 index d4ab203bdcc100ea17752273044690c0b0621b47..0000000000000000000000000000000000000000 --- a/modules/dav/main/props.c +++ /dev/null @@ -1,1525 +0,0 @@ -/* -** Copyright (C) 1998-2000 Greg Stein. All Rights Reserved. -** -** By using this file, you agree to the terms and conditions set forth in -** the LICENSE.html file which can be found at the top level of the mod_dav -** distribution or at http://www.webdav.org/mod_dav/license-1.html. -** -** Contact information: -** Greg Stein, PO Box 760, Palo Alto, CA, 94302 -** gstein@lyra.org, http://www.webdav.org/mod_dav/ -*/ - -/* -** DAV extension module for Apache 1.3.* -** - Property database handling (repository-independent) -** -** Written by Greg Stein, gstein@lyra.org, http://www.lyra.org/ -** -** NOTES: -** -** PROPERTY DATABASE -** -** This version assumes that there is a per-resource database provider -** to record properties. The database provider decides how and where to -** store these databases. -** -** The DBM keys for the properties have the following form: -** -** namespace ":" propname -** -** For example: 5:author -** -** The namespace provides an integer index into the namespace table -** (see below). propname is simply the property name, without a namespace -** prefix. -** -** A special case exists for properties that had a prefix starting with -** "xml". The XML Specification reserves these for future use. mod_dav -** stores and retrieves them unchanged. The keys for these properties -** have the form: -** -** ":" propname -** -** The propname will contain the prefix and the property name. For -** example, a key might be ":xmlfoo:name" -** -** The ":name" style will also be used for properties that do not -** exist within a namespace. -** -** The DBM values consist of two null-terminated strings, appended -** together (the null-terms are retained and stored in the database). -** The first string is the xml:lang value for the property. An empty -** string signifies that a lang value was not in context for the value. -** The second string is the property value itself. -** -** -** NAMESPACE TABLE -** -** The namespace table is an array that lists each of the namespaces -** that are in use by the properties in the given propdb. Each entry -** in the array is a simple URI. -** -** For example: http://www.foo.bar/standards/props/ -** -** The prefix used for the property is stripped and the URI for it -** is entered into the namespace table. Also, any namespaces used -** within the property value will be entered into the table (and -** stripped from the child elements). -** -** The namespaces are stored in the DBM database under the "METADATA" key. -** -** -** STRIPPING NAMESPACES -** -** Within the property values, the namespace declarations (xmlns...) -** are stripped. Each element and attribute will have its prefix removed -** and a new prefix inserted. -** -** This must be done so that we can return multiple properties in a -** PROPFIND which may have (originally) used conflicting prefixes. For -** that case, we must bind all property value elements to new namespace -** values. -** -** This implies that clients must NOT be sensitive to the namespace -** prefix used for their properties. It WILL change when the properties -** are returned (we return them as "ns", e.g. "ns5"). Also, the -** property value can contain ONLY XML elements and CDATA. PI and comment -** elements will be stripped. CDATA whitespace will be preserved, but -** whitespace within element tags will be altered. Attribute ordering -** may be altered. Element and CDATA ordering will be preserved. -** -** -** ATTRIBUTES ON PROPERTY NAME ELEMENTS -** -** When getting/setting properties, the XML used looks like: -** -** -** value -** value -** -** -** This implementation (mod_dav) DOES NOT save any attributes that are -** associated with the element. The property value is deemed -** to be only the contents ("value" in the above example). -** -** We do store the xml:lang value (if any) that applies to the context -** of the element. Whether the xml:lang attribute is on -** itself, or from a higher level element, we will store it -** with the property value. -** -** -** VERSIONING -** -** The DBM db contains a key named "METADATA" that holds database-level -** information, such as the namespace table. The record also contains the -** db's version number as the very first 16-bit value. This first number -** is actually stored as two single bytes: the first byte is a "major" -** version number. The second byte is a "minor" number. -** -** If the major number is not what mod_dav expects, then the db is closed -** immediately and an error is returned. A minor number change is -** acceptable -- it is presumed that old/new dav_props.c can deal with -** the database format. For example, a newer dav_props might update the -** minor value and append information to the end of the metadata record -** (which would be ignored by previous versions). -** -** -** ISSUES: -** -** At the moment, for the dav_get_allprops() and dav_get_props() functions, -** we must return a set of xmlns: declarations for ALL known namespaces -** in the file. There isn't a way to filter this because we don't know -** which are going to be used or not. Examining property names is not -** sufficient because the property values could use entirely different -** namespaces. -** -** ==> we must devise a scheme where we can "garbage collect" the namespace -** entries from the property database. -*/ - -#include "mod_dav.h" - -#include "http_log.h" -#include "http_request.h" - -/* -** There is some rough support for writeable DAV:getcontenttype and -** DAV:getcontentlanguage properties. If this #define is (1), then -** this support is disabled. -** -** We are disabling it because of a lack of support in GET and PUT -** operations. For GET, it would be "expensive" to look for a propdb, -** open it, and attempt to extract the Content-Type and Content-Language -** values for the response. -** (Handling the PUT would not be difficult, though) -*/ -#define DAV_DISABLE_WRITEABLE_PROPS 1 - -#define DAV_GDBM_NS_KEY "METADATA" -#define DAV_GDBM_NS_KEY_LEN 8 - -#define DAV_EMPTY_VALUE "\0" /* TWO null terms */ - -/* the namespace URI was not found; no ID is available */ -#define DAV_NS_ERROR_NOT_FOUND (DAV_NS_ERROR_BASE) - -typedef struct { - unsigned char major; -#define DAV_DBVSN_MAJOR 4 - /* - ** V4 -- 0.9.9 .. - ** Prior versions could have keys or values with invalid - ** namespace prefixes as a result of the xmlns="" form not - ** resetting the default namespace to be "no namespace". The - ** namespace would be set to "" which is invalid; it should - ** be set to "no namespace". - ** - ** V3 -- 0.9.8 - ** Prior versions could have values with invalid namespace - ** prefixes due to an incorrect mapping of input to propdb - ** namespace indices. Version bumped to obsolete the old - ** values. - ** - ** V2 -- 0.9.7 - ** This introduced the xml:lang value into the property value's - ** record in the propdb. - ** - ** V1 -- .. 0.9.6 - ** Initial version. - */ - - - unsigned char minor; -#define DAV_DBVSN_MINOR 0 - - short ns_count; - -} dav_propdb_metadata; - -struct dav_propdb { - int version; /* *minor* version of this db */ - - pool *p; /* the pool we should use */ - request_rec *r; /* the request record */ - - dav_resource *resource; /* the target resource */ - - int deferred; /* open of db has been deferred */ - dav_db *db; /* underlying database containing props */ - - dav_buffer ns_table; /* table of namespace URIs */ - short ns_count; /* number of entries in table */ - int ns_table_dirty; /* ns_table was modified */ - - array_header *ns_xlate; /* translation of an elem->ns to URI */ - int *ns_map; /* map elem->ns to propdb ns values */ - int incomplete_map; /* some mappings do not exist */ - - dav_lockdb *lockdb; /* the lock database */ - - dav_buffer wb_key; /* work buffer for dav_gdbm_key */ - dav_buffer wb_lock; /* work buffer for lockdiscovery property */ - - /* if we ever run a GET subreq, it will be stored here */ - request_rec *subreq; - - /* hooks we should use for processing (based on the target resource) */ - const dav_hooks_db *db_hooks; - const dav_hooks_vsn *vsn_hooks; - - const dav_dyn_hooks *liveprop; /* head of list */ -}; - -/* ### move these into a "core" liveprop provider? */ -static const char * const dav_core_props[] = -{ - "getcontenttype", - "getcontentlanguage", - "lockdiscovery", - "resourcetype", - "supportedlock", - - NULL /* sentinel */ -}; -enum { - DAV_PROPID_CORE_getcontenttype = DAV_PROPID_CORE, - DAV_PROPID_CORE_getcontentlanguage, - DAV_PROPID_CORE_lockdiscovery, - DAV_PROPID_CORE_resourcetype, - DAV_PROPID_CORE_supportedlock, - - DAV_PROPID_CORE_UNKNOWN -}; -#define DAV_IS_CORE_PROP(propid) ((propid) >= DAV_PROPID_CORE && \ - (propid) <= DAV_PROPID_CORE_UNKNOWN) - -/* -** This structure is used to track information needed for a rollback. -** If a SET was performed and no prior value existed, then value.dptr -** will be NULL. -*/ -typedef struct dav_rollback_item { - dav_datum key; /* key for the item being saved */ - dav_datum value; /* value before set/replace/delete */ - - /* or use the following (choice selected by dav_prop_ctx.is_liveprop) */ - struct dav_liveprop_rollback *liveprop; /* liveprop rollback ctx */ - -} dav_rollback_item; - - -#if 0 -/* ### unused */ -static const char *dav_get_ns_table_uri(dav_propdb *propdb, int ns) -{ - const char *p = propdb->ns_table.buf + sizeof(dav_propdb_metadata); - - while (ns--) - p += strlen(p) + 1; - - return p; -} -#endif - -static void dav_find_liveprop(dav_propdb *propdb, dav_xml_elem *elem) -{ - int propid; - const char *ns_uri; - const dav_dyn_hooks *ddh; - - if (elem->ns == DAV_NS_DAV_ID) { - const char * const *p = dav_core_props; - - for (propid = DAV_PROPID_CORE; *p != NULL; ++p, ++propid) - if (strcmp(elem->name, *p) == 0) { - elem->propid = propid; - return; - } - - /* didn't find it. fall thru. a provider can define DAV: props */ - } - else if (elem->ns == DAV_NS_NONE) { - /* policy: liveprop providers cannot define no-namespace properties */ - elem->propid = DAV_PROPID_CORE_UNKNOWN; - return; - } - - ns_uri = DAV_GET_URI_ITEM(propdb->ns_xlate, elem->ns); - - for (ddh = propdb->liveprop; ddh != NULL; ddh = ddh->next) { - propid = (*DAV_AS_HOOKS_LIVEPROP(ddh)->find_prop)(ns_uri, elem->name); - if (propid != 0) { - elem->propid = propid; - elem->provider = DAV_AS_HOOKS_LIVEPROP(ddh); - elem->ns_map = ddh->ctx.ns_map; - return; - } - } - - elem->propid = DAV_PROPID_CORE_UNKNOWN; -} - -/* is the live property read/write? */ -static int dav_rw_liveprop(dav_propdb *propdb, int propid) -{ - dav_prop_rw rw; - const dav_dyn_hooks *ddh; - - /* these are defined as read-only */ - if (propid == DAV_PROPID_CORE_lockdiscovery - || propid == DAV_PROPID_CORE_resourcetype -#if DAV_DISABLE_WRITEABLE_PROPS - || propid == DAV_PROPID_CORE_getcontenttype - || propid == DAV_PROPID_CORE_getcontentlanguage -#endif - || propid == DAV_PROPID_CORE_supportedlock) { - - return 0; - } - - /* these are defined as read/write */ - if (propid == DAV_PROPID_CORE_getcontenttype - || propid == DAV_PROPID_CORE_getcontentlanguage - || propid == DAV_PROPID_CORE_UNKNOWN) { - - return 1; - } - - /* - ** Check the liveprop providers - */ - for (ddh = propdb->liveprop; ddh != NULL; ddh = ddh->next) { - rw = (*DAV_AS_HOOKS_LIVEPROP(ddh)->is_writeable)(propdb->resource, - propid); - if (rw == DAV_PROP_RW_YES) - return 1; - if (rw == DAV_PROP_RW_NO) - return 0; - } - - /* - ** No provider recognized the property, so it must be dead (and writable) - */ - return 1; -} - -/* do a sub-request to fetch properties for the target resource's URI. */ -static void dav_do_prop_subreq(dav_propdb *propdb) -{ - /* perform a "GET" on the resource's URI (note that the resource - may not correspond to the current request!). */ - propdb->subreq = ap_sub_req_lookup_uri(propdb->resource->uri, propdb->r); -} - -static dav_error * dav_insert_coreprop(dav_propdb *propdb, - int propid, const char *name, - int getvals, - dav_text_header *phdr, - int *inserted) -{ - const char *value = NULL; - - *inserted = 0; - - /* fast-path the common case */ - if (propid == DAV_PROPID_CORE_UNKNOWN) - return NULL; - - switch (propid) { - - case DAV_PROPID_CORE_resourcetype: - switch (propdb->resource->type) { - case DAV_RESOURCE_TYPE_REGULAR: - if (propdb->resource->collection) { - value = ""; - } - else { - /* ### should we denote lock-null resources? */ - - value = ""; /* becomes: */ - } - break; - case DAV_RESOURCE_TYPE_HISTORY: - value = ""; - break; - case DAV_RESOURCE_TYPE_WORKSPACE: - value = ""; - break; - case DAV_RESOURCE_TYPE_ACTIVITY: - value = ""; - break; - case DAV_RESOURCE_TYPE_CONFIGURATION: - value = ""; - break; - case DAV_RESOURCE_TYPE_REVISION: - value = ""; - break; - - default: - /* ### bad juju */ - break; - } - break; - - case DAV_PROPID_CORE_lockdiscovery: - if (propdb->lockdb != NULL) { - dav_error *err; - dav_lock *locks; - - if ((err = dav_lock_query(propdb->lockdb, propdb->resource, - &locks)) != NULL) { - return dav_push_error(propdb->p, err->status, 0, - "DAV:lockdiscovery could not be " - "determined due to a problem fetching " - "the locks for this resource.", - err); - } - - /* fast-path the no-locks case */ - if (locks == NULL) { - value = ""; - } - else { - /* - ** This may modify the buffer. value may point to - ** wb_lock.pbuf or a string constant. - */ - value = dav_lock_get_activelock(propdb->r, locks, - &propdb->wb_lock); - - /* make a copy to isolate it from changes to wb_lock */ - value = ap_pstrdup(propdb->p, propdb->wb_lock.buf); - } - } - break; - - case DAV_PROPID_CORE_supportedlock: - if (propdb->lockdb != NULL) { - value = (*propdb->lockdb->hooks->get_supportedlock)(); - } - break; - - case DAV_PROPID_CORE_getcontenttype: - if (propdb->subreq == NULL) { - dav_do_prop_subreq(propdb); - } - if (propdb->subreq->content_type != NULL) { - value = propdb->subreq->content_type; - } - break; - - case DAV_PROPID_CORE_getcontentlanguage: - { - const char *lang; - - if (propdb->subreq == NULL) { - dav_do_prop_subreq(propdb); - } - if ((lang = ap_table_get(propdb->subreq->headers_out, - "Content-Language")) != NULL) { - value = lang; - } - break; - } - - case DAV_PROPID_CORE_UNKNOWN: - default: - /* fall through to interpret as a dead property */ - break; - } - - /* if something was supplied, then insert it */ - if (value != NULL) { - const char *s; - - if (getvals && *value != '\0') { - /* use D: prefix to refer to the DAV: namespace URI */ - s = ap_psprintf(propdb->p, "%s" DEBUG_CR, - name, value, name); - } - else { - /* use D: prefix to refer to the DAV: namespace URI */ - s = ap_psprintf(propdb->p, "" DEBUG_CR, name); - } - dav_text_append(propdb->p, phdr, s); - - *inserted = 1; - } - - return NULL; -} - -static dav_error * dav_insert_liveprop(dav_propdb *propdb, - const dav_xml_elem *elem, - int getvals, - dav_text_header *phdr, - int *inserted) -{ - dav_prop_insert pi; - - *inserted = 0; - - if (DAV_IS_CORE_PROP(elem->propid)) - return dav_insert_coreprop(propdb, elem->propid, elem->name, - getvals, phdr, inserted); - - /* ask the provider (that defined this prop) to insert the prop */ - pi = (*elem->provider->insert_prop)(propdb->resource, elem->propid, - getvals, elem->ns_map, phdr); -#if DAV_DEBUG - if (pi == DAV_PROP_INSERT_NOTME) { - /* ### the provider should have returned NOTDEF, at least */ - return dav_new_error(propdb->p, HTTP_INTERNAL_SERVER_ERROR, 0, - "DESIGN ERROR: a liveprop provider defined " - "a property, but did not respond to the " - "insert_prop hook for it."); - } -#endif - - if (pi != DAV_PROP_INSERT_NOTDEF) - *inserted = 1; - - return NULL; -} - -static void dav_append_prop(dav_propdb *propdb, - const char *name, const char *value, - dav_text_header *phdr) -{ - const char *s; - const char *lang = value; - - /* skip past the xml:lang value */ - value += strlen(lang) + 1; - - if (*value == '\0') { - /* the property is an empty value */ - if (*name == ':') { - /* "no namespace" case */ - s = ap_psprintf(propdb->p, "<%s/>" DEBUG_CR, name+1); - } - else { - s = ap_psprintf(propdb->p, "" DEBUG_CR, name); - } - } - else if (*lang != '\0') { - if (*name == ':') { - /* "no namespace" case */ - s = ap_psprintf(propdb->p, "<%s xml:lang=\"%s\">%s" DEBUG_CR, - name+1, lang, value, name+1); - } - else { - s = ap_psprintf(propdb->p, "%s" DEBUG_CR, - name, lang, value, name); - } - } - else if (*name == ':') { - /* "no namespace" case */ - s = ap_psprintf(propdb->p, "<%s>%s" DEBUG_CR, name+1, value, name+1); - } - else { - s = ap_psprintf(propdb->p, "%s" DEBUG_CR, name, value, name); - } - dav_text_append(propdb->p, phdr, s); -} - -/* -** Prepare the ns_map variable in the propdb structure. This entails copying -** all URIs from the "input" namespace list (in propdb->ns_xlate) into the -** propdb's list of namespaces. As each URI is copied (or pre-existing -** URI looked up), the index mapping is stored into the ns_map variable. -** -** Note: we must copy all declared namespaces because we cannot easily -** determine which input namespaces were actually used within the property -** values that are being stored within the propdb. Theoretically, we can -** determine this at the point where we serialize the property values -** back into strings. This would require a bit more work, and will be -** left to future optimizations. -** -** ### we should always initialize the propdb namespace array with "DAV:" -** ### since we know it will be entered anyhow (by virtue of it always -** ### occurring in the ns_xlate array). That will allow us to use -** ### DAV_NS_DAV_ID for propdb ns values, too. -*/ -static void dav_prep_ns_map(dav_propdb *propdb, int add_ns) -{ - int i; - const char **puri; - const int orig_count = propdb->ns_count; - int *pmap; - int updating = 0; /* are we updating an existing ns_map? */ - - if (propdb->ns_map) { - if (add_ns && propdb->incomplete_map) { - /* we must revisit the map and insert new entries */ - updating = 1; - propdb->incomplete_map = 0; - } - else { - /* nothing to do: we have a proper ns_map */ - return; - } - } - else { - propdb->ns_map = ap_palloc(propdb->p, propdb->ns_xlate->nelts * sizeof(*propdb->ns_map)); - } - - pmap = propdb->ns_map; - - /* ### stupid O(n * orig_count) algorithm */ - for (i = propdb->ns_xlate->nelts, puri = (const char **)propdb->ns_xlate->elts; - i-- > 0; - ++puri, ++pmap) { - - const char *uri = *puri; - const size_t uri_len = strlen(uri); - - if (updating) { - /* updating an existing mapping... we can skip a lot of stuff */ - - if (*pmap != DAV_NS_ERROR_NOT_FOUND) { - /* This entry has been filled in, so we can skip it */ - continue; - } - } - else { - int j; - size_t len; - const char *p; - - /* - ** GIVEN: uri (a namespace URI from the request input) - ** - ** FIND: an equivalent URI in the propdb namespace table - */ - - /* only scan original entries (we may have added some in here) */ - for (p = propdb->ns_table.buf + sizeof(dav_propdb_metadata), - j = 0; - j < orig_count; - ++j, p += len + 1) { - - len = strlen(p); - - if (uri_len != len) - continue; - if (memcmp(uri, p, len) == 0) { - *pmap = j; - goto next_input_uri; - } - } - - if (!add_ns) { - *pmap = DAV_NS_ERROR_NOT_FOUND; - - /* - ** This flag indicates that we have an ns_map with missing - ** entries. If dav_prep_ns_map() is called with add_ns==1 AND - ** this flag is set, then we zip thru the array and add those - ** URIs (effectively updating the ns_map as if add_ns=1 was - ** passed when the initial prep was called). - */ - propdb->incomplete_map = 1; - - continue; - } - } - - /* - ** The input URI was not found in the propdb namespace table, and - ** we are supposed to add it. Append it to the table and store - ** the index into the ns_map. - */ - dav_check_bufsize(propdb->p, &propdb->ns_table, uri_len + 1); - memcpy(propdb->ns_table.buf + propdb->ns_table.cur_len, uri, uri_len + 1); - propdb->ns_table.cur_len += uri_len + 1; - - propdb->ns_table_dirty = 1; - - *pmap = propdb->ns_count++; - - next_input_uri: - ; - } -} - -/* find the "DAV:" namespace in our table and return its ID. */ -static int dav_find_dav_id(dav_propdb *propdb) -{ - const char *p = propdb->ns_table.buf + sizeof(dav_propdb_metadata); - int ns; - - for (ns = 0; ns < propdb->ns_count; ++ns) { - size_t len = strlen(p); - - if (len == 4 && memcmp(p, "DAV:", 5) == 0) - return ns; - p += len + 1; - } - - /* the "DAV:" namespace is not present */ - return -1; -} - -static void dav_insert_xmlns(pool *p, const char *pre_prefix, int ns, - const char *ns_uri, dav_text_header *phdr) -{ - const char *s; - - s = ap_psprintf(p, " xmlns:%s%d=\"%s\"", pre_prefix, ns, ns_uri); - dav_text_append(p, phdr, s); -} - -/* return all known namespaces (in this propdb) */ -static void dav_get_propdb_xmlns(dav_propdb *propdb, dav_text_header *phdr) -{ - int i; - const char *p = propdb->ns_table.buf + sizeof(dav_propdb_metadata); - size_t len; - - /* note: ns_count == 0 when we have no propdb file */ - for (i = 0; i < propdb->ns_count; ++i, p += len + 1) { - - len = strlen(p); - - dav_insert_xmlns(propdb->p, "ns", i, p, phdr); - } -} - -/* add a namespace decl from one of the namespace tables */ -static void dav_add_marked_xmlns(dav_propdb *propdb, char *marks, int ns, - array_header *ns_table, - const char *pre_prefix, - dav_text_header *phdr) -{ - if (marks[ns]) - return; - marks[ns] = 1; - - dav_insert_xmlns(propdb->p, - pre_prefix, ns, DAV_GET_URI_ITEM(ns_table, ns), - phdr); -} - -/* -** Internal function to build a key -** -** WARNING: returns a pointer to a "static" buffer holding the key. The -** value must be copied or no longer used if this function is -** called again. -*/ -static dav_datum dav_gdbm_key(dav_propdb *propdb, const dav_xml_elem *elem) -{ - int ns; - char nsbuf[20]; - size_t l_ns; - size_t l_name = strlen(elem->name); - dav_datum key = { 0 }; - - /* - * Convert namespace ID to a string. "no namespace" is an empty string, - * so the keys will have the form ":name". Otherwise, the keys will - * have the form "#:name". - */ - if (elem->ns == DAV_NS_NONE) { - nsbuf[0] = '\0'; - l_ns = 0; - } - else { - if (propdb->ns_map == NULL) { - /* - * Note that we prep the map and do NOT add namespaces. If that - * is required, then the caller should have called prep - * beforehand, passing the correct values. - */ - dav_prep_ns_map(propdb, 0); - } - - ns = propdb->ns_map[elem->ns]; - if (DAV_NS_IS_ERROR(ns)) - return key; /* zeroed */ - - l_ns = sprintf(nsbuf, "%d", ns); - } - - /* assemble: #:name */ - dav_set_bufsize(propdb->p, &propdb->wb_key, l_ns + 1 + l_name + 1); - memcpy(propdb->wb_key.buf, nsbuf, l_ns); - propdb->wb_key.buf[l_ns] = ':'; - memcpy(&propdb->wb_key.buf[l_ns + 1], elem->name, l_name + 1); - - /* build the database key */ - key.dsize = l_ns + 1 + l_name + 1; - key.dptr = propdb->wb_key.buf; - - return key; -} - -dav_error *dav_really_open_db(dav_propdb *propdb, int ro) -{ - dav_error *err; - dav_datum key; - dav_datum value = { 0 }; - - /* we're trying to open the db; turn off the 'deferred' flag */ - propdb->deferred = 0; - - /* ask the DB provider to open the thing */ - err = (*propdb->db_hooks->open)(propdb->p, propdb->resource, ro, - &propdb->db); - if (err != NULL) { - return dav_push_error(propdb->p, HTTP_INTERNAL_SERVER_ERROR, - DAV_ERR_PROP_OPENING, - "Could not open the property database.", - err); - } - - /* - ** NOTE: propdb->db could be NULL if we attempted to open a readonly - ** database that doesn't exist. If we require read/write - ** access, then a database was created and opened. - */ - - if (propdb->db != NULL) { - key.dptr = DAV_GDBM_NS_KEY; - key.dsize = DAV_GDBM_NS_KEY_LEN; - if ((err = (*propdb->db_hooks->fetch)(propdb->db, key, - &value)) != NULL) { - /* ### push a higher-level description? */ - return err; - } - } - if (value.dptr == NULL) { - dav_propdb_metadata m = { - DAV_DBVSN_MAJOR, DAV_DBVSN_MINOR, 0 - }; - - if (propdb->db != NULL) { - /* - * If there is no METADATA key, then the database may be - * from versions 0.9.0 .. 0.9.4 (which would be incompatible). - * These can be identified by the presence of an NS_TABLE entry. - */ - key.dptr = "NS_TABLE"; - key.dsize = 8; - if ((*propdb->db_hooks->exists)(propdb->db, key)) { - (*propdb->db_hooks->close)(propdb->db); - - /* call it a major version error */ - return dav_new_error(propdb->p, HTTP_INTERNAL_SERVER_ERROR, - DAV_ERR_PROP_BAD_MAJOR, - "Prop database has the wrong major " - "version number and cannot be used."); - } - } - - /* initialize a new metadata structure */ - dav_set_bufsize(propdb->p, &propdb->ns_table, sizeof(m)); - memcpy(propdb->ns_table.buf, &m, sizeof(m)); - } - else { - dav_propdb_metadata m; - - dav_set_bufsize(propdb->p, &propdb->ns_table, value.dsize); - memcpy(propdb->ns_table.buf, value.dptr, value.dsize); - - memcpy(&m, value.dptr, sizeof(m)); - if (m.major != DAV_DBVSN_MAJOR) { - (*propdb->db_hooks->close)(propdb->db); - - return dav_new_error(propdb->p, HTTP_INTERNAL_SERVER_ERROR, - DAV_ERR_PROP_BAD_MAJOR, - "Prop database has the wrong major " - "version number and cannot be used."); - } - propdb->version = m.minor; - propdb->ns_count = ntohs(m.ns_count); - - (*propdb->db_hooks->freedatum)(propdb->db, value); - } - - return NULL; -} - -dav_error *dav_open_propdb(request_rec *r, dav_lockdb *lockdb, - dav_resource *resource, - int ro, - array_header * ns_xlate, - dav_propdb **p_propdb) -{ - dav_propdb *propdb = ap_pcalloc(r->pool, sizeof(*propdb)); - dav_error *err; - - *p_propdb = NULL; - -#if DAV_DEBUG - if (resource->uri == NULL) { - return dav_new_error(r->pool, HTTP_INTERNAL_SERVER_ERROR, 0, - "INTERNAL DESIGN ERROR: resource must define " - "its URI."); - } -#endif - - propdb->version = DAV_DBVSN_MINOR; - propdb->r = r; - propdb->p = r->pool; /* ### get rid of this */ - propdb->resource = resource; - propdb->ns_xlate = ns_xlate; - - propdb->db_hooks = DAV_GET_HOOKS_PROPDB(r); - propdb->vsn_hooks = DAV_GET_HOOKS_VSN(r); - - propdb->liveprop = dav_get_provider_hooks(r, DAV_DYN_TYPE_LIVEPROP); - - propdb->lockdb = lockdb; - - if (!ro) { - propdb->deferred = 1; - } - else if ((err = dav_really_open_db(propdb, 1 /* ro */)) != NULL) { - return err; - } - - /* ### what to do about closing the propdb on server failure? */ - - *p_propdb = propdb; - return NULL; -} - -void dav_close_propdb(dav_propdb *propdb) -{ - if (propdb->db == NULL) - return; - - if (propdb->ns_table_dirty) { - dav_propdb_metadata m; - dav_datum key; - dav_datum value; - dav_error *err; - - key.dptr = DAV_GDBM_NS_KEY; - key.dsize = DAV_GDBM_NS_KEY_LEN; - - value.dptr = propdb->ns_table.buf; - value.dsize = propdb->ns_table.cur_len; - - /* fill in the metadata that we store into the prop db. */ - m.major = DAV_DBVSN_MAJOR; - m.minor = propdb->version; /* ### keep current minor version? */ - m.ns_count = htons(propdb->ns_count); - - memcpy(propdb->ns_table.buf, &m, sizeof(m)); - - err = (*propdb->db_hooks->store)(propdb->db, key, value); - /* ### what to do with the error? */ - } - - (*propdb->db_hooks->close)(propdb->db); -} - -dav_get_props_result dav_get_allprops(dav_propdb *propdb, int getvals) -{ - const dav_hooks_db *db_hooks = propdb->db_hooks; - dav_text_header hdr = { 0 }; - dav_text_header hdr_ns = { 0 }; - dav_get_props_result result = { 0 }; - int found_resourcetype = 0; - int found_contenttype = 0; - int found_contentlang = 0; - int unused_inserted; - int i; - const char * const * scan_uri; - const dav_dyn_hooks *ddh; - - /* generate all the namespaces that are in the propdb */ - dav_get_propdb_xmlns(propdb, &hdr_ns); - - /* initialize the result with some start tags... */ - dav_text_append(propdb->p, &hdr, - "" DEBUG_CR - "" DEBUG_CR); - - /* if there ARE properties, then scan them */ - if (propdb->db != NULL) { - dav_datum key; - int dav_id = dav_find_dav_id(propdb); - - (void) (*db_hooks->firstkey)(propdb->db, &key); - while (key.dptr) { - dav_datum prevkey; - - /* any keys with leading capital letters should be skipped - (real keys start with a number or a colon) */ - if (*key.dptr >= 'A' && *key.dptr <= 'Z') - goto next_key; - - /* - ** See if this is the property. We need to - ** know whether it was found (and therefore, whether to supply - ** a default later). - ** - ** We also look for and - ** . If they are not stored as dead - ** properties, then we need to perform a subrequest to get - ** their values (if any). - */ - if (dav_id != -1 - && *key.dptr != ':' - && dav_id == atoi(key.dptr)) { - - const char *colon; - - /* find the colon */ - if ( key.dptr[1] == ':' ) { - colon = key.dptr + 1; - } - else { - colon = strchr(key.dptr + 2, ':'); - } - - if (colon[1] == 'r' - && strcmp(colon + 1, "resourcetype") == 0) { - - found_resourcetype = 1; - } - else if (colon[1] == 'g') { - if (strcmp(colon + 1, "getcontenttype") == 0) { - found_contenttype = 1; - } - else if (strcmp(colon + 1, "getcontentlanguage") == 0) { - found_contentlang = 1; - } - } - } - - if (getvals) { - dav_datum value; - - (void) (*db_hooks->fetch)(propdb->db, key, &value); - if (value.dptr == NULL) { - /* ### anything better to do? */ - /* ### probably should enter a 500 error */ - goto next_key; - } - - /* put the prop name and value into the result */ - dav_append_prop(propdb, key.dptr, value.dptr, &hdr); - - (*db_hooks->freedatum)(propdb->db, value); - } - else { - /* simple, empty element if a value isn't needed */ - dav_append_prop(propdb, key.dptr, DAV_EMPTY_VALUE, &hdr); - } - - next_key: - prevkey = key; - (void) (*db_hooks->nextkey)(propdb->db, &key); - (*db_hooks->freedatum)(propdb->db, prevkey); - } - } - - /* add namespaces for all the liveprop providers */ - for (i = 0, scan_uri = (const char * const *)dav_liveprop_uris->elts; - i < dav_liveprop_uris->nelts; - ++i, ++scan_uri) - dav_insert_xmlns(propdb->p, "lp", i, *scan_uri, &hdr_ns); - - /* ask the liveprop providers to insert their properties */ - for (ddh = propdb->liveprop; ddh != NULL; ddh = ddh->next) { - (*DAV_AS_HOOKS_LIVEPROP(ddh)->insert_all)(propdb->resource, getvals, - ddh->ctx.ns_map, - &hdr); - } - - /* insert the standard properties */ - /* ### should be handling the return errors here */ - (void)dav_insert_coreprop(propdb, - DAV_PROPID_CORE_supportedlock, "supportedlock", - getvals, &hdr, &unused_inserted); - (void)dav_insert_coreprop(propdb, - DAV_PROPID_CORE_lockdiscovery, "lockdiscovery", - getvals, &hdr, &unused_inserted); - - /* if the resourcetype wasn't stored, then prepare one */ - if (!found_resourcetype) { - /* ### should be handling the return error here */ - (void)dav_insert_coreprop(propdb, - DAV_PROPID_CORE_resourcetype, "resourcetype", - getvals, &hdr, &unused_inserted); - } - - /* if we didn't find these, then do the whole subreq thing. */ - if (!found_contenttype) { - /* ### should be handling the return error here */ - (void)dav_insert_coreprop(propdb, - DAV_PROPID_CORE_getcontenttype, - "getcontenttype", - getvals, &hdr, &unused_inserted); - } - if (!found_contentlang) { - /* ### should be handling the return error here */ - (void)dav_insert_coreprop(propdb, - DAV_PROPID_CORE_getcontentlanguage, - "getcontentlanguage", - getvals, &hdr, &unused_inserted); - } - - /* terminate the result */ - dav_text_append(propdb->p, &hdr, - "" DEBUG_CR - "HTTP/1.1 200 OK" DEBUG_CR - "" DEBUG_CR); - - result.propstats = hdr.first; - result.xmlns = hdr_ns.first; - return result; -} - -dav_get_props_result dav_get_props(dav_propdb *propdb, dav_xml_doc *doc) -{ - const dav_hooks_db *db_hooks = propdb->db_hooks; - dav_xml_elem *elem = dav_find_child(doc->root, "prop"); - dav_text_header hdr_good = { 0 }; - dav_text_header hdr_bad = { 0 }; - dav_text_header hdr_ns = { 0 }; - int have_good = 0; - dav_get_props_result result = { 0 }; - char *marks_input; - char *marks_liveprop; - - /* ### NOTE: we should pass in TWO buffers -- one for keys, one for - the marks */ - - /* we will ALWAYS provide a "good" result, even if it is EMPTY */ - dav_text_append(propdb->p, &hdr_good, - "" DEBUG_CR - "" DEBUG_CR); - - /* generate all the namespaces that are in the propdb */ - dav_get_propdb_xmlns(propdb, &hdr_ns); - - /* ### the marks should be in a buffer! */ - /* allocate zeroed-memory for the marks. These marks indicate which - input namespaces we've generated into the output xmlns buffer */ - marks_input = ap_pcalloc(propdb->p, propdb->ns_xlate->nelts); - - /* same for the liveprops */ - marks_liveprop = ap_pcalloc(propdb->p, dav_liveprop_uris->nelts); - - for (elem = elem->first_child; elem; elem = elem->next) { - dav_datum key; - dav_datum value = { 0 }; - - /* - ** Note: the key may be NULL if we have no properties that are in - ** a namespace that matches the requested prop's namespace. - */ - key = dav_gdbm_key(propdb, elem); - - /* fetch IF we have a db and a key. otherwise, value is NULL */ - if (propdb->db != NULL && key.dptr != NULL) { - (void) (*db_hooks->fetch)(propdb->db, key, &value); - } - - /* - ** If we did not find the property in the database, then it may - ** be a liveprop that we can handle specially. - */ - if (value.dptr == NULL) { - dav_error *err; - int inserted; - - /* cache the propid; dav_get_props() could be called many times */ - if (elem->propid == 0) - dav_find_liveprop(propdb, elem); - - /* insert the property. returns 1 if an insertion was done. */ - if ((err = dav_insert_liveprop(propdb, elem, 1, &hdr_good, - &inserted)) != NULL) { - /* ### need to propagate the error to the caller... */ - /* ### skip it for now, as if nothing was inserted */ - } - if (inserted) { - have_good = 1; - - /* - ** Add the liveprop's namespace URIs. Note that provider==NULL - ** for core properties. - */ - if (elem->provider != NULL) { - const char * const * scan_ns_uri; - const int * scan_ns; - - for (scan_ns_uri = elem->provider->namespace_uris, - scan_ns = elem->ns_map; - *scan_ns_uri != NULL; - ++scan_ns_uri, ++scan_ns) { - - dav_add_marked_xmlns(propdb, marks_liveprop, *scan_ns, - dav_liveprop_uris, "lp", &hdr_ns); - } - } - - continue; - } - } - - if (value.dptr == NULL) { - /* not found. add a record to the "bad" propstats */ - - /* make sure we've started our "bad" propstat */ - if (hdr_bad.first == NULL) { - dav_text_append(propdb->p, &hdr_bad, - "" DEBUG_CR - "" DEBUG_CR); - } - - /* note: key.dptr may be NULL if the propdb doesn't have an - equivalent namespace stored */ - if (key.dptr == NULL) { - const char *s; - - if (elem->ns == DAV_NS_NONE) { - /* - * elem has a prefix already (xml...:name) or the elem - * simply has no namespace. - */ - s = ap_psprintf(propdb->p, "<%s/>" DEBUG_CR, elem->name); - } - else { - /* ensure that an xmlns is generated for the - input namespace */ - dav_add_marked_xmlns(propdb, marks_input, elem->ns, - propdb->ns_xlate, "i", &hdr_ns); - s = ap_psprintf(propdb->p, "" DEBUG_CR, - elem->ns, elem->name); - } - dav_text_append(propdb->p, &hdr_bad, s); - } - else { - /* add in the bad prop using our namespace decl */ - dav_append_prop(propdb, key.dptr, DAV_EMPTY_VALUE, &hdr_bad); - } - } - else { - /* found it. put the value into the "good" propstats */ - - have_good = 1; - - dav_append_prop(propdb, key.dptr, value.dptr, &hdr_good); - - (*db_hooks->freedatum)(propdb->db, value); - } - } - - dav_text_append(propdb->p, &hdr_good, - "" DEBUG_CR - "HTTP/1.1 200 OK" DEBUG_CR - "" DEBUG_CR); - - /* default to start with the good */ - result.propstats = hdr_good.first; - - /* we may not have any "bad" results */ - if (hdr_bad.first != NULL) { - dav_text_append(propdb->p, &hdr_bad, - "" DEBUG_CR - "HTTP/1.1 404 Not Found" DEBUG_CR - "" DEBUG_CR); - - /* if there are no good props, then just return the bad */ - if (!have_good) { - result.propstats = hdr_bad.first; - } - else { - /* hook the bad propstat to the end of the good one */ - hdr_good.last->next = hdr_bad.first; - } - } - - result.xmlns = hdr_ns.first; - return result; -} - -void dav_prop_validate(dav_prop_ctx *ctx) -{ - dav_propdb *propdb = ctx->propdb; - dav_xml_elem *prop = ctx->prop; - - /* - ** Check to see if this is a live property, and fill the fields - ** in the XML elem, as appropriate. - ** - ** Verify that the property is read/write. If not, then it cannot - ** be SET or DELETEd. - */ - if (prop->propid == 0) { - dav_find_liveprop(propdb, prop); - - /* it's a liveprop if a provider was found */ - /* ### actually the "core" props should really be liveprops, but - ### there is no "provider" for those and the r/w props are - ### treated as dead props anyhow */ - ctx->is_liveprop = prop->provider != NULL; - } - - if (!dav_rw_liveprop(propdb, prop->propid)) { - ctx->err = dav_new_error(propdb->p, HTTP_CONFLICT, - DAV_ERR_PROP_READONLY, - "Property is read-only."); - return; - } - - if (ctx->is_liveprop) { - int defer_to_dead = 0; - - ctx->err = (*prop->provider->patch_validate)(propdb->resource, - prop, ctx->operation, - &ctx->liveprop_ctx, - &defer_to_dead); - if (ctx->err != NULL || !defer_to_dead) - return; - - /* clear is_liveprop -- act as a dead prop now */ - ctx->is_liveprop = 0; - } - - /* - ** The property is supposed to be stored into the dead-property - ** database. Make sure the thing is truly open (and writeable). - */ - if (propdb->deferred - && (ctx->err = dav_really_open_db(propdb, 0 /* ro */)) != NULL) { - return; - } - - /* - ** There should be an open, writable database in here! - ** - ** Note: the database would be NULL if it was opened readonly and it - ** did not exist. - */ - if (propdb->db == NULL) { - ctx->err = dav_new_error(propdb->p, HTTP_INTERNAL_SERVER_ERROR, - DAV_ERR_PROP_NO_DATABASE, - "Attempted to set/remove a property " - "without a valid, open, read/write " - "property database."); - return; - } - - if (ctx->operation == DAV_PROP_OP_SET) { - /* - ** Prep the element => propdb namespace index mapping, inserting - ** namespace URIs into the propdb that don't exist. - */ - dav_prep_ns_map(propdb, 1); - } - else if (ctx->operation == DAV_PROP_OP_DELETE) { - /* - ** There are no checks to perform here. If a property exists, then - ** we will delete it. If it does not exist, then it does not matter - ** (see S12.13.1). - ** - ** Note that if a property does not exist, that does not rule out - ** that a SET will occur during this PROPPATCH (thusly creating it). - */ - } -} - -void dav_prop_exec(dav_prop_ctx *ctx) -{ - dav_propdb *propdb = ctx->propdb; - dav_error *err = NULL; - dav_rollback_item *rollback; - - rollback = ap_pcalloc(propdb->p, sizeof(*rollback)); - ctx->rollback = rollback; - - if (ctx->is_liveprop) { - err = (*ctx->prop->provider->patch_exec)(propdb->resource, - ctx->prop, ctx->operation, - ctx->liveprop_ctx, - &ctx->rollback->liveprop); - } - else { - dav_datum key; - - /* we're going to need the key for all operations */ - key = dav_gdbm_key(propdb, ctx->prop); - - /* save the old value so that we can do a rollback. */ - rollback->key = key; - if ((err = (*propdb->db_hooks->fetch)(propdb->db, key, - &rollback->value)) != NULL) - goto error; - - if (ctx->operation == DAV_PROP_OP_SET) { - - dav_datum value; - - /* Note: propdb->ns_map was set in dav_prop_validate() */ - - /* quote all the values in the element */ - dav_quote_xml_elem(propdb->p, ctx->prop); - - /* generate a text blob for the xml:lang plus the contents */ - dav_xml2text(propdb->p, ctx->prop, DAV_X2T_LANG_INNER, NULL, - propdb->ns_map, - (const char **)&value.dptr, &value.dsize); - - err = (*propdb->db_hooks->store)(propdb->db, key, value); - - /* - ** If an error occurred, then assume that we didn't change the - ** value. Remove the rollback item so that we don't try to set - ** its value during the rollback. - */ - } - else if (ctx->operation == DAV_PROP_OP_DELETE) { - - /* - ** Delete the property. Ignore errors -- the property is there, or - ** we are deleting it for a second time. - */ - /* ### but what about other errors? */ - (void) (*propdb->db_hooks->remove)(propdb->db, key); - } - } - - error: - /* push a more specific error here */ - if (err != NULL) { - /* - ** Use HTTP_INTERNAL_SERVER_ERROR because we shouldn't have seen - ** any errors at this point. - */ - ctx->err = dav_push_error(propdb->p, HTTP_INTERNAL_SERVER_ERROR, - DAV_ERR_PROP_EXEC, - "Could not execute PROPPATCH.", err); - } -} - -void dav_prop_commit(dav_prop_ctx *ctx) -{ - /* - ** Note that a commit implies ctx->err is NULL. The caller should assume - ** a status of HTTP_OK for this case. - */ - - if (ctx->is_liveprop) { - (*ctx->prop->provider->patch_commit)(ctx->propdb->resource, - ctx->operation, - ctx->liveprop_ctx, - ctx->rollback->liveprop); - } -} - -void dav_prop_rollback(dav_prop_ctx *ctx) -{ - dav_error *err = NULL; - - /* do nothing if there is no rollback information. */ - if (ctx->rollback == NULL) - return; - - /* - ** ### if we have an error, and a rollback occurs, then the namespace - ** ### mods should not happen at all. Basically, the namespace management - ** ### is simply a bitch. - */ - - if (ctx->is_liveprop) { - err = (*ctx->prop->provider->patch_rollback)(ctx->propdb->resource, - ctx->operation, - ctx->liveprop_ctx, - ctx->rollback->liveprop); - } - else if (ctx->rollback->value.dptr == NULL) { - /* don't fail if the thing isn't really there */ - /* ### but what about other errors? */ - (void) (*ctx->propdb->db_hooks->remove)(ctx->propdb->db, - ctx->rollback->key); - } - else { - err = (*ctx->propdb->db_hooks->store)(ctx->propdb->db, - ctx->rollback->key, - ctx->rollback->value); - } - - if (err != NULL) { - if (ctx->err == NULL) - ctx->err = err; - else { - dav_error *scan = err; - - /* hook previous errors at the end of the rollback error */ - while (scan->prev != NULL) - scan = scan->prev; - scan->prev = ctx->err; - ctx->err = err; - } - } -} diff --git a/modules/dav/main/providers.c b/modules/dav/main/providers.c deleted file mode 100644 index 74173096411db0eb945d45f83c6c3e6f159c0a19..0000000000000000000000000000000000000000 --- a/modules/dav/main/providers.c +++ /dev/null @@ -1,90 +0,0 @@ -/* ==================================================================== - * The Apache Software License, Version 1.1 - * - * Copyright (c) 2000 The Apache Software Foundation. All rights - * reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in - * the documentation and/or other materials provided with the - * distribution. - * - * 3. The end-user documentation included with the redistribution, - * if any, must include the following acknowledgment: - * "This product includes software developed by the - * Apache Software Foundation (http://www.apache.org/)." - * Alternately, this acknowledgment may appear in the software itself, - * if and wherever such third-party acknowledgments normally appear. - * - * 4. The names "Apache" and "Apache Software Foundation" must - * not be used to endorse or promote products derived from this - * software without prior written permission. For written - * permission, please contact apache@apache.org. - * - * 5. Products derived from this software may not be called "Apache", - * nor may "Apache" appear in their name, without prior written - * permission of the Apache Software Foundation. - * - * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED - * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES - * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR - * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF - * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND - * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, - * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT - * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * ==================================================================== - * - * This software consists of voluntary contributions made by many - * individuals on behalf of the Apache Software Foundation. For more - * information on the Apache Software Foundation, please see - * . - */ - -#include "apr_pools.h" -#include "apr_hash.h" - -#include "ap_hooks.h" /* ### for ap_global_hook_pool */ - -#include "mod_dav.h" - - -static apr_hash_t *dav_repos_providers = NULL; - - -static apr_status_t dav_cleanup_providers(void *ctx) -{ - dav_repos_providers = NULL; - return APR_SUCCESS; -} - -void dav_register_repository(apr_pool_t *p, const char *name, - const dav_hooks_repository *hooks) -{ - /* ### ignore the pool; it is NULL right now */ - p = ap_global_hook_pool; - - if (dav_repos_providers == NULL) { - dav_repos_providers = apr_make_hash(p); - apr_register_cleanup(p, NULL, dav_cleanup_providers, apr_null_cleanup); - } - - /* just set it. no biggy if it was there before. */ - apr_hash_set(dav_repos_providers, name, 0, hooks); -} - -const dav_hooks_repository * dav_lookup_repository(const char *name) -{ - return apr_hash_get(dav_repos_providers, name, 0); -} diff --git a/modules/dav/main/std_liveprop.c b/modules/dav/main/std_liveprop.c deleted file mode 100644 index a7acd24c29acf3b44d08bab306c26f9eef4416e2..0000000000000000000000000000000000000000 --- a/modules/dav/main/std_liveprop.c +++ /dev/null @@ -1,289 +0,0 @@ -/* ==================================================================== - * The Apache Software License, Version 1.1 - * - * Copyright (c) 2000 The Apache Software Foundation. All rights - * reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in - * the documentation and/or other materials provided with the - * distribution. - * - * 3. The end-user documentation included with the redistribution, - * if any, must include the following acknowledgment: - * "This product includes software developed by the - * Apache Software Foundation (http://www.apache.org/)." - * Alternately, this acknowledgment may appear in the software itself, - * if and wherever such third-party acknowledgments normally appear. - * - * 4. The names "Apache" and "Apache Software Foundation" must - * not be used to endorse or promote products derived from this - * software without prior written permission. For written - * permission, please contact apache@apache.org. - * - * 5. Products derived from this software may not be called "Apache", - * nor may "Apache" appear in their name, without prior written - * permission of the Apache Software Foundation. - * - * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED - * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES - * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR - * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF - * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND - * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, - * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT - * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * ==================================================================== - * - * This software consists of voluntary contributions made by many - * individuals on behalf of the Apache Software Foundation. For more - * information on the Apache Software Foundation, please see - * . - */ - -#include "httpd.h" -#include "util_xml.h" -#include "apr_strings.h" - -#include "mod_dav.h" - -/* forward-declare */ -static const dav_hooks_liveprop dav_core_hooks_liveprop; - -/* -** The namespace URIs that we use. There will only ever be "DAV:". -*/ -static const char * const dav_core_namespace_uris[] = -{ - "DAV:", - NULL /* sentinel */ -}; - -/* -** Define each of the core properties that this provider will handle. -** Note that all of them are in the DAV: namespace, which has a -** provider-local index of 0. -*/ -static const dav_liveprop_spec dav_core_props[] = -{ - { 0, "comment", DAV_PROPID_comment, 1 }, - { 0, "creator-displayname", DAV_PROPID_creator_displayname, 1 }, - { 0, "displayname", DAV_PROPID_displayname, 1 }, - { 0, "resourcetype", DAV_PROPID_resourcetype, 0 }, - { 0, "source", DAV_PROPID_source, 1 }, - { 0, "supported-live-property-set", - DAV_PROPID_supported_live_property_set, 0 }, - { 0, "supported-method-set", DAV_PROPID_supported_method_set, 0 }, - { 0, "supported-report-set", DAV_PROPID_supported_report_set, 0 }, - - { 0 } /* sentinel */ -}; - -static const dav_liveprop_group dav_core_liveprop_group = -{ - dav_core_props, - dav_core_namespace_uris, - &dav_core_hooks_liveprop -}; - -static dav_prop_insert dav_core_insert_prop(const dav_resource *resource, - int propid, int insvalue, - ap_text_header *phdr) -{ - const char *value; - const char *s; - dav_prop_insert which; - apr_pool_t *p = resource->pool; - const dav_liveprop_spec *info; - int global_ns; - - switch (propid) - { - case DAV_PROPID_resourcetype: - switch (resource->type) { - case DAV_RESOURCE_TYPE_VERSION: - if (resource->baselined) { - value = ""; - break; - } - /* fall through */ - case DAV_RESOURCE_TYPE_REGULAR: - case DAV_RESOURCE_TYPE_WORKING: - if (resource->collection) { - value = ""; - } - else { - /* ### should we denote lock-null resources? */ - - value = ""; /* becomes: */ - } - break; - case DAV_RESOURCE_TYPE_HISTORY: - value = ""; - break; - case DAV_RESOURCE_TYPE_WORKSPACE: - value = ""; - break; - case DAV_RESOURCE_TYPE_ACTIVITY: - value = ""; - break; - - default: - /* ### bad juju */ - return DAV_PROP_INSERT_NOTDEF; - } - break; - - case DAV_PROPID_supported_live_property_set: - /* ### insert all live property names ### */ - break; - - case DAV_PROPID_supported_method_set: - /* ### leverage code from dav_method_options ### */ - break; - - case DAV_PROPID_supported_report_set: -#if 0 - { - /* ### where to get "r" ??? */ - const dav_hooks_vsn *vsn_hooks = dav_get_vsn_hooks(r); - - if (vsn_hooks != NULL) { - const dav_report_elem *reports; - dav_error *err; - - if ((err = (*vsn_hooks->avail_reports)(resource, - &reports)) != NULL) { - err = dav_push_error(p, err->status, 0, - "DAV:supported-report-set could not " - "be determined due to a problem " - "fetching the available reports " - "for this resource.", - err); - /* ### can't return err... sigh. punt for now. */ - return DAV_PROP_INSERT_NOTDEF; - } - - value = ""; - - if (reports == NULL) { - /* no reports are defined. break with value="" */ - break; - } - - for (; reports->nmspace != NULL; ++reports) { - /* Note: presume reports->namespace is XML/URL quoted */ - const char *v = apr_psprintf(p, "<%s xmlns=\"%s\"/>" DEBUG_CR, - reports->name, reports->nmspace); - - /* This isn't very memory-efficient, but there should only - be a small number of reports */ - value = apr_pstrcat(p, value, v, NULL); - } - } - break; - } -#endif - /* above code disabled. FALLTHROUGH */ - - case DAV_PROPID_comment: - case DAV_PROPID_creator_displayname: - case DAV_PROPID_displayname: - case DAV_PROPID_source: - default: - /* - ** This property is known, but not defined as a liveprop. However, - ** it may be a dead property. - */ - return DAV_PROP_INSERT_NOTDEF; - } - - /* assert: value != NULL */ - - /* get the information and global NS index for the property */ - global_ns = dav_get_liveprop_info(propid, &dav_core_liveprop_group, &info); - - /* assert: info != NULL && info->name != NULL */ - - if (insvalue) { - s = apr_psprintf(p, "%s" DEBUG_CR, - global_ns, info->name, value, global_ns, info->name); - which = DAV_PROP_INSERT_VALUE; - } - else { - s = apr_psprintf(p, "" DEBUG_CR, global_ns, info->name); - which = DAV_PROP_INSERT_NAME; - } - ap_text_append(p, phdr, s); - - /* we inserted a name or value (this prop is done) */ - return which; -} - -static int dav_core_is_writable(const dav_resource *resource, int propid) -{ - const dav_liveprop_spec *info; - - (void) dav_get_liveprop_info(propid, &dav_core_liveprop_group, &info); - return info->is_writable; -} - -static dav_error * dav_core_patch_validate(const dav_resource *resource, - const ap_xml_elem *elem, - int operation, void **context, - int *defer_to_dead) -{ - /* all of our writeable props go in the dead prop database */ - *defer_to_dead = 1; - - return NULL; -} - -static const dav_hooks_liveprop dav_core_hooks_liveprop = { - dav_core_insert_prop, - dav_core_is_writable, - dav_core_namespace_uris, - dav_core_patch_validate, - NULL, /* patch_exec */ - NULL, /* patch_commit */ - NULL, /* patch_rollback */ -}; - -int dav_core_find_liveprop(request_rec *r, const char *ns_uri, - const char *name, - const dav_hooks_liveprop **hooks) -{ - return dav_do_find_liveprop(ns_uri, name, &dav_core_liveprop_group, hooks); -} - -void dav_core_insert_all_liveprops(request_rec *r, - const dav_resource *resource, - int insvalue, ap_text_header *phdr) -{ - (void) dav_core_insert_prop(resource, DAV_PROPID_resourcetype, - insvalue, phdr); - (void) dav_core_insert_prop(resource, - DAV_PROPID_supported_live_property_set, - insvalue, phdr); - (void) dav_core_insert_prop(resource, DAV_PROPID_supported_method_set, - insvalue, phdr); - (void) dav_core_insert_prop(resource, DAV_PROPID_supported_report_set, - insvalue, phdr); -} - -void dav_core_register_uris(apr_pool_t *p) -{ - /* register the namespace URIs */ - dav_register_liveprop_group(p, &dav_core_liveprop_group); -} diff --git a/modules/dav/main/util.c b/modules/dav/main/util.c deleted file mode 100644 index 63ae2c880ac595152c21a0bb3dc5f3dbbf3586ca..0000000000000000000000000000000000000000 --- a/modules/dav/main/util.c +++ /dev/null @@ -1,2087 +0,0 @@ -/* -** Copyright (C) 1998-2000 Greg Stein. All Rights Reserved. -** -** By using this file, you agree to the terms and conditions set forth in -** the LICENSE.html file which can be found at the top level of the mod_dav -** distribution or at http://www.webdav.org/mod_dav/license-1.html. -** -** Contact information: -** Greg Stein, PO Box 760, Palo Alto, CA, 94302 -** gstein@lyra.org, http://www.webdav.org/mod_dav/ -*/ - -/* -** DAV extension module for Apache 1.3.* -** - various utilities, repository-independent -** -** Written by Greg Stein, gstein@lyra.org, http://www.lyra.org/ -*/ - -#include "mod_dav.h" - -#include "http_request.h" -#include "http_config.h" -#include "http_vhost.h" -#include "http_log.h" -#include "http_protocol.h" - - -dav_error *dav_new_error(pool *p, int status, int error_id, const char *desc) -{ - int save_errno = errno; - dav_error *err = ap_pcalloc(p, sizeof(*err)); - - /* DBG3("dav_new_error: %d %d %s", status, error_id, desc ? desc : "(no desc)"); */ - - err->status = status; - err->error_id = error_id; - err->desc = desc; - err->save_errno = save_errno; - - return err; -} - -dav_error *dav_push_error(pool *p, int status, int error_id, const char *desc, - dav_error *prev) -{ - dav_error *err = ap_pcalloc(p, sizeof(*err)); - - err->status = status; - err->error_id = error_id; - err->desc = desc; - err->prev = prev; - - return err; -} - -void dav_text_append(pool * p, dav_text_header *hdr, const char *text) -{ - dav_text *t = ap_palloc(p, sizeof(*t)); - - t->text = text; - t->next = NULL; - - if (hdr->first == NULL) { - /* no text elements yet */ - hdr->first = hdr->last = t; - } - else { - /* append to the last text element */ - hdr->last->next = t; - hdr->last = t; - } -} - -void dav_check_bufsize(pool * p, dav_buffer *pbuf, size_t extra_needed) -{ - /* grow the buffer if necessary */ - if (pbuf->cur_len + extra_needed > pbuf->alloc_len) { - char *newbuf; - - pbuf->alloc_len += extra_needed + DAV_BUFFER_PAD; - newbuf = ap_palloc(p, pbuf->alloc_len); - memcpy(newbuf, pbuf->buf, pbuf->cur_len); - pbuf->buf = newbuf; - } -} - -void dav_set_bufsize(pool * p, dav_buffer *pbuf, size_t size) -{ - /* NOTE: this does not retain prior contents */ - - /* NOTE: this function is used to init the first pointer, too, since - the PAD will be larger than alloc_len (0) for zeroed structures */ - - /* grow if we don't have enough for the requested size plus padding */ - if (size + DAV_BUFFER_PAD > pbuf->alloc_len) { - /* set the new length; min of MINSIZE */ - pbuf->alloc_len = size + DAV_BUFFER_PAD; - if (pbuf->alloc_len < DAV_BUFFER_MINSIZE) - pbuf->alloc_len = DAV_BUFFER_MINSIZE; - - pbuf->buf = ap_palloc(p, pbuf->alloc_len); - } - pbuf->cur_len = size; -} - - -/* initialize a buffer and copy the specified (null-term'd) string into it */ -void dav_buffer_init(pool *p, dav_buffer *pbuf, const char *str) -{ - dav_set_bufsize(p, pbuf, strlen(str)); - memcpy(pbuf->buf, str, pbuf->cur_len + 1); -} - -/* append a string to the end of the buffer, adjust length */ -void dav_buffer_append(pool *p, dav_buffer *pbuf, const char *str) -{ - size_t len = strlen(str); - - dav_check_bufsize(p, pbuf, len + 1); - memcpy(pbuf->buf + pbuf->cur_len, str, len + 1); - pbuf->cur_len += len; -} - -/* place a string on the end of the buffer, do NOT adjust length */ -void dav_buffer_place(pool *p, dav_buffer *pbuf, const char *str) -{ - size_t len = strlen(str); - - dav_check_bufsize(p, pbuf, len + 1); - memcpy(pbuf->buf + pbuf->cur_len, str, len + 1); -} - -/* place some memory on the end of a buffer; do NOT adjust length */ -void dav_buffer_place_mem(pool *p, dav_buffer *pbuf, const void *mem, - size_t amt, size_t pad) -{ - dav_check_bufsize(p, pbuf, amt + pad); - memcpy(pbuf->buf + pbuf->cur_len, mem, amt); -} - - -#if APACHE_RELEASE == 10304100 -/* ### this code can be used for 1.3.4 installations. use this function - * ### instead of ap_sub_req_method_uri() - */ -/* - * ### don't look at this code. - * ### it is a Crime Against All That is Right and Good - */ -#include "http_core.h" /* for SATISFY_* */ -static request_rec *gross_hack(const char *new_file, const request_rec * r) -{ - request_rec *rnew = ap_sub_req_lookup_uri(new_file, r); - int res; - - /* ### these aren't exported properly from the headers */ - extern int ap_check_access(request_rec *); /* check access on non-auth basis */ - extern int ap_check_user_id(request_rec *); /* obtain valid username from client auth */ - extern int ap_check_auth(request_rec *); /* check (validated) user is authorized here */ - - if (rnew->status != HTTP_OK) - return rnew; - - /* re-run portions with a modified method */ - rnew->method = r->method; - rnew->method_number = r->method_number; - - if ((ap_satisfies(rnew) == SATISFY_ALL - || ap_satisfies(rnew) == SATISFY_NOSPEC) - ? ((res = ap_check_access(rnew)) - || (ap_some_auth_required(rnew) - && ((res = ap_check_user_id(rnew)) - || (res = ap_check_auth(rnew))))) - : ((res = ap_check_access(rnew)) - && (!ap_some_auth_required(rnew) - || ((res = ap_check_user_id(rnew)) - || (res = ap_check_auth(rnew))))) - ) { - rnew->status = res; - } - - return rnew; -} -#endif /* APACHE_RELEASE == 10304100 */ - -/* -** dav_lookup_uri() -** -** Extension for ap_sub_req_lookup_uri() which can't handle absolute -** URIs properly. -** -** If NULL is returned, then an error occurred with parsing the URI or -** the URI does not match the current server. -*/ -dav_lookup_result dav_lookup_uri(const char *uri, request_rec * r) -{ - dav_lookup_result result = { 0 }; - const char *scheme; - unsigned short port = ntohs(r->connection->local_addr.sin_port); - uri_components comp; - char *new_file; - const char *domain; - - /* first thing to do is parse the URI into various components */ - if (ap_parse_uri_components(r->pool, uri, &comp) != HTTP_OK) { - result.err.status = HTTP_BAD_REQUEST; - result.err.desc = "Invalid syntax in Destination URI."; - return result; - } - - /* the URI must be an absoluteURI (WEBDAV S9.3) */ - if (comp.scheme == NULL) { - result.err.status = HTTP_BAD_REQUEST; - result.err.desc = "Destination URI must be an absolute URI."; - return result; - } - - /* ### not sure this works if the current request came in via https: */ - scheme = r->parsed_uri.scheme; - if (scheme == NULL) - scheme = ap_http_method(r); - - /* insert a port if the URI did not contain one */ - if (comp.port == 0) - comp.port = ap_default_port_for_scheme(comp.scheme); - - /* now, verify that the URI uses the same scheme as the current request. - the port, must match our port. - the URI must not have a query (args) or a fragment - */ - if (strcasecmp(comp.scheme, scheme) != 0 || - comp.port != port) { - result.err.status = HTTP_BAD_GATEWAY; - result.err.desc = ap_psprintf(r->pool, - "Destination URI refers to different " - "scheme or port (%s://hostname:%d)\n" - "(want: %s://hostname:%d)", - comp.scheme ? comp.scheme : scheme, - comp.port ? comp.port : port, - scheme, port); - return result; - } - if (comp.query != NULL || comp.fragment != NULL) { - result.err.status = HTTP_BAD_REQUEST; - result.err.desc = - "Destination URI contains invalid components " - "(a query or a fragment)."; - return result; - } - - /* we have verified the scheme, port, and general structure */ - - /* - ** Hrm. IE5 will pass unqualified hostnames for both the - ** Host: and Destination: headers. This breaks the - ** http_vhost.c::matches_aliases function. - ** - ** For now, qualify unqualified comp.hostnames with - ** r->server->server_hostname. - ** - ** ### this is a big hack. Apache should provide a better way. - ** ### maybe the admin should list the unqualified hosts in a - ** ### block? - */ - if (strrchr(comp.hostname, '.') == NULL && - (domain = strchr(r->server->server_hostname, '.')) != NULL) { - comp.hostname = ap_pstrcat(r->pool, comp.hostname, domain, NULL); - } - - /* now, if a hostname was provided, then verify that it represents the - same server as the current connection. note that we just use our - port, since we've verified the URI matches ours */ - if (comp.hostname != NULL && - !ap_matches_request_vhost(r, comp.hostname, port)) { - result.err.status = HTTP_BAD_GATEWAY; - result.err.desc = "Destination URI refers to a different server."; - return result; - } - - /* we have verified that the requested URI denotes the same server as - the current request. Therefore, we can use ap_sub_req_lookup_uri() */ - - /* reconstruct a URI as just the path */ - new_file = ap_unparse_uri_components(r->pool, &comp, UNP_OMITSITEPART); - - /* - * Lookup the URI and return the sub-request. Note that we use the - * same HTTP method on the destination. This allows the destination - * to apply appropriate restrictions (e.g. readonly). - */ -#if APACHE_RELEASE == 10304100 - result.rnew = gross_hack(new_file, r); -#else - result.rnew = ap_sub_req_method_uri(r->method, new_file, r); -#endif - - return result; -} - -/* --------------------------------------------------------------- -** -** XML UTILITY FUNCTIONS -*/ - -/* validate that the root element uses a given DAV: tagname (TRUE==valid) */ -int dav_validate_root(const dav_xml_doc *doc, const char *tagname) -{ - return doc->root && - doc->root->ns == DAV_NS_DAV_ID && - strcmp(doc->root->name, tagname) == 0; -} - -/* find and return the (unique) child with a given DAV: tagname */ -dav_xml_elem *dav_find_child(const dav_xml_elem *elem, const char *tagname) -{ - dav_xml_elem *child = elem->first_child; - - for (; child; child = child->next) - if (child->ns == DAV_NS_DAV_ID && !strcmp(child->name, tagname)) - return child; - return NULL; -} - - -/* how many characters for the given integer? */ -#define DAV_NS_LEN(ns) ((ns) < 10 ? 1 : (ns) < 100 ? 2 : (ns) < 1000 ? 3 : \ - (ns) < 10000 ? 4 : (ns) < 100000 ? 5 : \ - (ns) < 1000000 ? 6 : (ns) < 10000000 ? 7 : \ - (ns) < 100000000 ? 8 : (ns) < 1000000000 ? 9 : 10) - -static int dav_text_size(const dav_text *t) -{ - int size = 0; - - for (; t; t = t->next) - size += strlen(t->text); - return size; -} - -static size_t dav_elem_size(const dav_xml_elem *elem, int style, - array_header *namespaces, int *ns_map) -{ - size_t size; - - if (style == DAV_X2T_FULL || style == DAV_X2T_FULL_NS_LANG) { - const dav_xml_attr *attr; - - size = 0; - - if (style == DAV_X2T_FULL_NS_LANG) { - int i; - - /* - ** The outer element will contain xmlns:ns%d="%s" attributes - ** and an xml:lang attribute, if applicable. - */ - - for (i = namespaces->nelts; i--;) { - /* compute size of: ' xmlns:ns%d="%s"' */ - size += (9 + DAV_NS_LEN(i) + 2 + - strlen(DAV_GET_URI_ITEM(namespaces, i)) + 1); - } - - if (elem->lang != NULL) { - /* compute size of: ' xml:lang="%s"' */ - size += 11 + strlen(elem->lang) + 1; - } - } - - if (elem->ns == DAV_NS_NONE) { - /* compute size of: <%s> */ - size += 1 + strlen(elem->name) + 1; - } - else { - int ns = ns_map ? ns_map[elem->ns] : elem->ns; - - /* compute size of: */ - size += 3 + DAV_NS_LEN(ns) + 1 + strlen(elem->name) + 1; - } - - if (DAV_ELEM_IS_EMPTY(elem)) { - /* insert a closing "/" */ - size += 1; - } - else { - /* - * two of above plus "/": - * ... - * OR <%s> ... - */ - size = 2 * size + 1; - } - - for (attr = elem->attr; attr; attr = attr->next) { - if (attr->ns == DAV_NS_NONE) { - /* compute size of: ' %s="%s"' */ - size += 1 + strlen(attr->name) + 2 + strlen(attr->value) + 1; - } - else { - /* compute size of: ' ns%d:%s="%s"' */ - size += 3 + DAV_NS_LEN(attr->ns) + 1 + strlen(attr->name) + 2 + strlen(attr->value) + 1; - } - } - - /* - ** If the element has an xml:lang value that is *different* from - ** its parent, then add the thing in: ' xml:lang="%s"'. - ** - ** NOTE: we take advantage of the pointer equality established by - ** the parsing for "inheriting" the xml:lang values from parents. - */ - if (elem->lang != NULL && - (elem->parent == NULL || elem->lang != elem->parent->lang)) { - size += 11 + strlen(elem->lang) + 1; - } - } - else if (style == DAV_X2T_LANG_INNER) { - /* - * This style prepends the xml:lang value plus a null terminator. - * If a lang value is not present, then we insert a null term. - */ - size = elem->lang ? strlen(elem->lang) + 1 : 1; - } - else - size = 0; - - size += dav_text_size(elem->first_cdata.first); - - for (elem = elem->first_child; elem; elem = elem->next) { - /* the size of the child element plus the CDATA that follows it */ - size += (dav_elem_size(elem, DAV_X2T_FULL, NULL, ns_map) + - dav_text_size(elem->following_cdata.first)); - } - - return size; -} - -static char *dav_write_text(char *s, const dav_text *t) -{ - for (; t; t = t->next) { - size_t len = strlen(t->text); - memcpy(s, t->text, len); - s += len; - } - return s; -} - -static char *dav_write_elem(char *s, const dav_xml_elem *elem, int style, - array_header *namespaces, int *ns_map) -{ - const dav_xml_elem *child; - size_t len; - int ns; - - if (style == DAV_X2T_FULL || style == DAV_X2T_FULL_NS_LANG) { - int empty = DAV_ELEM_IS_EMPTY(elem); - const dav_xml_attr *attr; - - if (elem->ns == DAV_NS_NONE) { - len = sprintf(s, "<%s", elem->name); - } - else { - ns = ns_map ? ns_map[elem->ns] : elem->ns; - len = sprintf(s, "name); - } - s += len; - - for (attr = elem->attr; attr; attr = attr->next) { - if (attr->ns == DAV_NS_NONE) - len = sprintf(s, " %s=\"%s\"", attr->name, attr->value); - else - len = sprintf(s, " ns%d:%s=\"%s\"", attr->ns, attr->name, attr->value); - s += len; - } - - /* add the xml:lang value if necessary */ - if (elem->lang != NULL && - (style == DAV_X2T_FULL_NS_LANG || - elem->parent == NULL || - elem->lang != elem->parent->lang)) { - len = sprintf(s, " xml:lang=\"%s\"", elem->lang); - s += len; - } - - /* add namespace definitions, if required */ - if (style == DAV_X2T_FULL_NS_LANG) { - int i; - - for (i = namespaces->nelts; i--;) { - len = sprintf(s, " xmlns:ns%d=\"%s\"", i, - DAV_GET_URI_ITEM(namespaces, i)); - s += len; - } - } - - /* no more to do. close it up and go. */ - if (empty) { - *s++ = '/'; - *s++ = '>'; - return s; - } - - /* just close it */ - *s++ = '>'; - } - else if (style == DAV_X2T_LANG_INNER) { - /* prepend the xml:lang value */ - if (elem->lang != NULL) { - len = strlen(elem->lang); - memcpy(s, elem->lang, len); - s += len; - } - *s++ = '\0'; - } - - s = dav_write_text(s, elem->first_cdata.first); - - for (child = elem->first_child; child; child = child->next) { - s = dav_write_elem(s, child, DAV_X2T_FULL, NULL, ns_map); - s = dav_write_text(s, child->following_cdata.first); - } - - if (style == DAV_X2T_FULL || style == DAV_X2T_FULL_NS_LANG) { - if (elem->ns == DAV_NS_NONE) { - len = sprintf(s, "", elem->name); - } - else { - ns = ns_map ? ns_map[elem->ns] : elem->ns; - len = sprintf(s, "", ns, elem->name); - } - s += len; - } - - return s; -} - -/* convert an element to a text string */ -void dav_xml2text(pool * p, - const dav_xml_elem *elem, - int style, - array_header *namespaces, - int *ns_map, - const char **pbuf, - size_t *psize) -{ - /* get the exact size, plus a null terminator */ - size_t size = dav_elem_size(elem, style, namespaces, ns_map) + 1; - char *s = ap_palloc(p, size); - - (void) dav_write_elem(s, elem, style, namespaces, ns_map); - s[size - 1] = '\0'; - - *pbuf = s; - if (psize) - *psize = size; -} - -const char *dav_empty_elem(pool * p, const dav_xml_elem *elem) -{ - if (elem->ns == DAV_NS_NONE) { - /* - * The prefix (xml...) is already within the prop name, or - * the element simply has no prefix. - */ - return ap_psprintf(p, "<%s/>" DEBUG_CR, elem->name); - } - - return ap_psprintf(p, "" DEBUG_CR, elem->ns, elem->name); -} - -/* -** dav_quote_string: quote an XML string -** -** Replace '<', '>', and '&' with '<', '>', and '&'. -** If quotes is true, then replace '"' with '"'. -** -** quotes is typically set to true for XML strings that will occur within -** double quotes -- attribute values. -*/ -const char * dav_quote_string(pool *p, const char *s, int quotes) -{ - const char *scan; - int len = 0; - int extra = 0; - char *qstr; - char *qscan; - char c; - - for (scan = s; (c = *scan) != '\0'; ++scan, ++len) { - if (c == '<' || c == '>') - extra += 3; /* < or > */ - else if (c == '&') - extra += 4; /* & */ - else if (quotes && c == '"') - extra += 5; /* " */ - } - - /* nothing to do? */ - if (extra == 0) - return s; - - qstr = ap_palloc(p, len + extra + 1); - for (scan = s, qscan = qstr; (c = *scan) != '\0'; ++scan) { - if (c == '<') { - *qscan++ = '&'; - *qscan++ = 'l'; - *qscan++ = 't'; - *qscan++ = ';'; - } - else if (c == '>') { - *qscan++ = '&'; - *qscan++ = 'g'; - *qscan++ = 't'; - *qscan++ = ';'; - } - else if (c == '&') { - *qscan++ = '&'; - *qscan++ = 'a'; - *qscan++ = 'm'; - *qscan++ = 'p'; - *qscan++ = ';'; - } - else if (quotes && c == '"') { - *qscan++ = '&'; - *qscan++ = 'q'; - *qscan++ = 'u'; - *qscan++ = 'o'; - *qscan++ = 't'; - *qscan++ = ';'; - } - else { - *qscan++ = c; - } - } - - *qscan = '\0'; - return qstr; -} - -void dav_quote_xml_elem(pool *p, dav_xml_elem *elem) -{ - dav_text *scan_txt; - dav_xml_attr *scan_attr; - dav_xml_elem *scan_elem; - - /* convert the element's text */ - for (scan_txt = elem->first_cdata.first; - scan_txt != NULL; - scan_txt = scan_txt->next) { - scan_txt->text = dav_quote_string(p, scan_txt->text, 0); - } - for (scan_txt = elem->following_cdata.first; - scan_txt != NULL; - scan_txt = scan_txt->next) { - scan_txt->text = dav_quote_string(p, scan_txt->text, 0); - } - - /* convert the attribute values */ - for (scan_attr = elem->attr; - scan_attr != NULL; - scan_attr = scan_attr->next) { - scan_attr->value = dav_quote_string(p, scan_attr->value, 1); - } - - /* convert the child elements */ - for (scan_elem = elem->first_child; - scan_elem != NULL; - scan_elem = scan_elem->next) { - dav_quote_xml_elem(p, scan_elem); - } -} - -/* --------------------------------------------------------------- -** -** Timeout header processing -** -*/ - -/* dav_get_timeout: If the Timeout: header exists, return a time_t - * when this lock is expected to expire. Otherwise, return - * a time_t of DAV_TIMEOUT_INFINITE. - * - * It's unclear if DAV clients are required to understand - * Seconds-xxx and Infinity time values. We assume that they do. - * In addition, for now, that's all we understand, too. - */ -time_t dav_get_timeout(request_rec *r) -{ - time_t now, expires = DAV_TIMEOUT_INFINITE; - - const char *timeout_const = ap_table_get(r->headers_in, "Timeout"); - const char *timeout = ap_pstrdup(r->pool, timeout_const), *val; - - if (timeout == NULL) - return DAV_TIMEOUT_INFINITE; - - /* Use the first thing we understand, or infinity if - * we don't understand anything. - */ - - while ((val = ap_getword_white(r->pool, &timeout)) && strlen(val)) { - if (!strncmp(val, "Infinite", 8)) { - return DAV_TIMEOUT_INFINITE; - } - - if (!strncmp(val, "Second-", 7)) { - val += 7; - /* ### We need to handle overflow better: - * ### timeout will be <= 2^32 - 1 - */ - expires = atol(val); - now = time(NULL); - return now + expires; - } - } - - return DAV_TIMEOUT_INFINITE; -} - -/* --------------------------------------------------------------- -** -** If Header processing -** -*/ - -/* add_if_resource returns a new if_header, linking it to next_ih. - */ -static dav_if_header *dav_add_if_resource(pool *p, dav_if_header *next_ih, - const char *uri, size_t uri_len) -{ - dav_if_header *ih; - - if ((ih = ap_pcalloc(p, sizeof(*ih))) == NULL) - return NULL; - - ih->uri = uri; - ih->uri_len = uri_len; - ih->next = next_ih; - - return ih; -} - -/* add_if_state adds a condition to an if_header. - */ -static dav_error * dav_add_if_state(pool *p, dav_if_header *ih, - const char *state_token, - dav_if_state_type t, int condition, - const dav_hooks_locks *locks_hooks) -{ - dav_if_state_list *new_sl; - - new_sl = ap_pcalloc(p, sizeof(*new_sl)); - - new_sl->condition = condition; - new_sl->type = t; - - if (t == dav_if_opaquelock) { - dav_error *err; - - if ((err = (*locks_hooks->parse_locktoken)(p, state_token, - &new_sl->locktoken)) != NULL) { - /* ### maybe add a higher-level description */ - return err; - } - } - else - new_sl->etag = state_token; - - new_sl->next = ih->state; - ih->state = new_sl; - - return NULL; -} - -/* fetch_next_token returns the substring from str+1 - * to the next occurence of char term, or \0, whichever - * occurs first. Leading whitespace is ignored. - */ -static char *dav_fetch_next_token(char **str, char term) -{ - char *sp; - char *token; - - token = *str + 1; - - while (*token && (*token == ' ' || *token == '\t')) - token++; - - if ((sp = strchr(token, term)) == NULL) - return NULL; - - *sp = '\0'; - *str = sp; - return token; -} - -/* dav_process_if_header: - * - * If NULL (no error) is returned, then **if_header points to the - * "If" productions structure (or NULL if "If" is not present). - * - * ### this part is bogus: - * If an error is encountered, the error is logged. Parent should - * return err->status. - */ -static dav_error * dav_process_if_header(request_rec *r, dav_if_header **p_ih) -{ - dav_error *err; - char *str; - char *list; - const char *state_token; - const char *uri = NULL; /* scope of current production; NULL=no-tag */ - size_t uri_len; - dav_if_header *ih = NULL; - uri_components parsed_uri; - const dav_hooks_locks *locks_hooks = DAV_GET_HOOKS_LOCKS(r); - enum {no_tagged, tagged, unknown} list_type = unknown; - int condition; - - *p_ih = NULL; - - if ((str = ap_pstrdup(r->pool, ap_table_get(r->headers_in, "If"))) == NULL) - return NULL; - - while (*str) { - switch(*str) { - case '<': - /* Tagged-list production - following states apply to this uri */ - if (list_type == no_tagged - || ((uri = dav_fetch_next_token(&str, '>')) == NULL)) { - return dav_new_error(r->pool, HTTP_BAD_REQUEST, - DAV_ERR_IF_TAGGED, - "Invalid If-header: unclosed \"<\" or " - "unexpected tagged-list production."); - } - - /* 2518 specifies this must be an absolute URI; just take the - * relative part for later comparison against r->uri */ - if (ap_parse_uri_components(r->pool, uri, &parsed_uri) != HTTP_OK) { - return dav_new_error(r->pool, HTTP_BAD_REQUEST, - DAV_ERR_IF_TAGGED, - "Invalid URI in tagged If-header."); - } - /* note that parsed_uri.path is allocated; we can trash it */ - - /* clean up the URI a bit */ - ap_getparents(parsed_uri.path); - uri_len = strlen(parsed_uri.path); - if (uri_len > 1 && parsed_uri.path[uri_len - 1] == '/') - parsed_uri.path[--uri_len] = '\0'; - - uri = parsed_uri.path; - list_type = tagged; - break; - - case '(': - /* List production */ - - /* If a uri has not been encountered, this is a No-Tagged-List */ - if (list_type == unknown) - list_type = no_tagged; - - if ((list = dav_fetch_next_token(&str, ')')) == NULL) { - return dav_new_error(r->pool, HTTP_BAD_REQUEST, - DAV_ERR_IF_UNCLOSED_PAREN, - "Invalid If-header: unclosed \"(\"."); - } - - if ((ih = dav_add_if_resource(r->pool, ih, uri, uri_len)) == NULL) { - /* ### dav_add_if_resource() should return an error for us! */ - return dav_new_error(r->pool, HTTP_BAD_REQUEST, - DAV_ERR_IF_PARSE, - "Internal server error parsing \"If:\" " - "header."); - } - - condition = DAV_IF_COND_NORMAL; - - while (*list) { - /* List is the entire production (in a uri scope) */ - - switch (*list) { - case '<': - if ((state_token = dav_fetch_next_token(&list, '>')) == NULL) { - /* ### add a description to this error */ - return dav_new_error(r->pool, HTTP_BAD_REQUEST, - DAV_ERR_IF_PARSE, NULL); - } - - if ((err = dav_add_if_state(r->pool, ih, state_token, dav_if_opaquelock, - condition, locks_hooks)) != NULL) { - /* ### maybe add a higher level description */ - return err; - } - condition = DAV_IF_COND_NORMAL; - break; - - case '[': - if ((state_token = dav_fetch_next_token(&list, ']')) == NULL) { - /* ### add a description to this error */ - return dav_new_error(r->pool, HTTP_BAD_REQUEST, - DAV_ERR_IF_PARSE, NULL); - } - - if ((err = dav_add_if_state(r->pool, ih, state_token, dav_if_etag, - condition, locks_hooks)) != NULL) { - /* ### maybe add a higher level description */ - return err; - } - condition = DAV_IF_COND_NORMAL; - break; - - case 'N': - if (list[1] == 'o' && list[2] == 't') { - if (condition != DAV_IF_COND_NORMAL) { - return dav_new_error(r->pool, HTTP_BAD_REQUEST, - DAV_ERR_IF_MULTIPLE_NOT, - "Invalid \"If:\" header: " - "Multiple \"not\" entries " - "for the same state."); - } - condition = DAV_IF_COND_NOT; - } - list += 2; - break; - - case ' ': - case '\t': - break; - - default: - return dav_new_error(r->pool, HTTP_BAD_REQUEST, - DAV_ERR_IF_UNK_CHAR, - ap_psprintf(r->pool, - "Invalid \"If:\" " - "header: Unexpected " - "character encountered " - "(0x%02x, '%c').", - *list, *list)); - } - - list++; - } - break; - - case ' ': - case '\t': - break; - - default: - return dav_new_error(r->pool, HTTP_BAD_REQUEST, - DAV_ERR_IF_UNK_CHAR, - ap_psprintf(r->pool, - "Invalid \"If:\" header: " - "Unexpected character " - "encountered (0x%02x, '%c').", - *str, *str)); - } - - str++; - } - - *p_ih = ih; - return NULL; -} - -static int dav_find_submitted_locktoken(const dav_if_header *if_header, - const dav_lock *lock_list, - const dav_hooks_locks *locks_hooks) -{ - for (; if_header != NULL; if_header = if_header->next) { - const dav_if_state_list *state_list; - - for (state_list = if_header->state; - state_list != NULL; - state_list = state_list->next) { - - if (state_list->type == dav_if_opaquelock) { - const dav_lock *lock; - - /* given state_list->locktoken, match it */ - - /* - ** The resource will have one or more lock tokens. We only - ** need to match one of them against any token in the - ** If: header. - ** - ** One token case: It is an exclusive or shared lock. Either - ** way, we must find it. - ** - ** N token case: They are shared locks. By policy, we need - ** to match only one. The resource's other - ** tokens may belong to somebody else (so we - ** shouldn't see them in the If: header anyway) - */ - for (lock = lock_list; lock != NULL; lock = lock->next) { - - if (!(*locks_hooks->compare_locktoken)(state_list->locktoken, lock->locktoken)) { - return 1; - } - } - } - } - } - - return 0; -} - -/* dav_validate_resource_state: - * Returns NULL if path/uri meets if-header and lock requirements - */ -static dav_error * dav_validate_resource_state(pool *p, - const dav_resource *resource, - dav_lockdb *lockdb, - const dav_if_header *if_header, - int flags, - dav_buffer *pbuf, - request_rec *r) -{ - dav_error *err; - const char *uri; - const char *etag; - const dav_hooks_locks *locks_hooks = (lockdb ? lockdb->hooks : NULL); - const dav_if_header *ifhdr_scan; - dav_if_state_list *state_list; - dav_lock *lock_list; - dav_lock *lock; - int num_matched; - int num_that_apply; - int seen_locktoken; - size_t uri_len; - const char *reason = NULL; - - /* DBG1("validate: <%s>", resource->uri); */ - - /* - ** The resource will have one of three states: - ** - ** 1) No locks. We have no special requirements that the user supply - ** specific locktokens. One of the state lists must match, and - ** we're done. - ** - ** 2) One exclusive lock. The locktoken must appear *anywhere* in the - ** If: header. Of course, asserting the token in a "Not" term will - ** quickly fail that state list :-). If the locktoken appears in - ** one of the state lists *and* one state list matches, then we're - ** done. - ** - ** 3) One or more shared locks. One of the locktokens must appear - ** *anywhere* in the If: header. If one of the locktokens appears, - ** and we match one state list, then we are done. - ** - ** The variable determines whether we have seen one - ** of this resource's locktokens in the If: header. - */ - - /* - ** If this is a new lock request, will contain the requested - ** lock scope. Three rules apply: - ** - ** 1) Do not require a (shared) locktoken to be seen (when we are - ** applying another shared lock) - ** 2) If the scope is exclusive and we see any locks, fail. - ** 3) If the scope is shared and we see an exclusive lock, fail. - */ - - if (lockdb == NULL) { - /* we're in State 1. no locks. */ - lock_list = NULL; - } - else { - /* - ** ### hrm... we don't need to have these fully - ** ### resolved since we're only looking at the - ** ### locktokens... - ** - ** ### use get_locks w/ calltype=PARTIAL - */ - if ((err = dav_lock_query(lockdb, resource, &lock_list)) != NULL) { - return dav_push_error(p, - HTTP_INTERNAL_SERVER_ERROR, 0, - "The locks could not be queried for " - "verification against a possible \"If:\" " - "header.", - err); - } - - /* lock_list now determines whether we're in State 1, 2, or 3. */ - } - - /* - ** For a new, exclusive lock: if any locks exist, fail. - ** For a new, shared lock: if an exclusive lock exists, fail. - ** else, do not require a token to be seen. - */ - if (flags & DAV_LOCKSCOPE_EXCLUSIVE) { - if (lock_list != NULL) { - return dav_new_error(p, HTTP_LOCKED, 0, - "Existing lock(s) on the requested resource " - "prevent an exclusive lock."); - } - - /* - ** There are no locks, so we can pretend that we've already met - ** any requirement to find the resource's locks in an If: header. - */ - seen_locktoken = 1; - } - else if (flags & DAV_LOCKSCOPE_SHARED) { - /* - ** Strictly speaking, we don't need this loop. Either the first - ** (and only) lock will be EXCLUSIVE, or none of them will be. - */ - for (lock = lock_list; lock != NULL; lock = lock->next) { - if (lock->scope == DAV_LOCKSCOPE_EXCLUSIVE) { - return dav_new_error(p, HTTP_LOCKED, 0, - "The requested resource is already " - "locked exclusively."); - } - } - - /* - ** The locks on the resource (if any) are all shared. Set the - ** flag to indicate that we do not need to find - ** the locks in an If: header. - */ - seen_locktoken = 1; - } - else { - /* - ** For methods other than LOCK: - ** - ** If we have no locks, then can be set to true -- - ** pretending that we've already met the requirement of seeing one - ** of the resource's locks in the If: header. - ** - ** Otherwise, it must be cleared and we'll look for one. - */ - seen_locktoken = (lock_list == NULL); - } - - /* - ** If there is no If: header, then we can shortcut some logic: - ** - ** 1) if we do not need to find a locktoken in the (non-existent) If: - ** header, then we are successful. - ** - ** 2) if we must find a locktoken in the (non-existent) If: header, then - ** we fail. - */ - if (if_header == NULL) { - if (seen_locktoken) - return NULL; - - return dav_new_error(p, HTTP_LOCKED, 0, - "This resource is locked and an \"If:\" header " - "was not supplied to allow access to the " - "resource."); - } - /* the If: header is present */ - - /* - ** If a dummy header is present (because of a Lock-Token: header), then - ** we are required to find that token in this resource's set of locks. - ** If we have no locks, then we immediately fail. - ** - ** This is a 400 (Bad Request) since they should only submit a locktoken - ** that actually exists. - ** - ** Don't issue this response if we're talking about the parent resource. - ** It is okay for that resource to NOT have this locktoken. - ** (in fact, it certainly will not: a dummy_header only occurs for the - ** UNLOCK method, the parent is checked only for locknull resources, - ** and the parent certainly does not have the (locknull's) locktoken) - */ - if (lock_list == NULL && if_header->dummy_header) { - if (flags & DAV_VALIDATE_IS_PARENT) - return NULL; - return dav_new_error(p, HTTP_BAD_REQUEST, 0, - "The locktoken specified in the \"Lock-Token:\" " - "header is invalid because this resource has no " - "outstanding locks."); - } - - /* - ** Prepare the input URI. We want the URI to never have a trailing slash. - ** - ** When URIs are placed into the dav_if_header structure, they are - ** guaranteed to never have a trailing slash. If the URIs are equivalent, - ** then it doesn't matter if they both lack a trailing slash -- they're - ** still equivalent. - ** - ** Note: we could also ensure that a trailing slash is present on both - ** URIs, but the majority of URIs provided to us via a resource walk - ** will not contain that trailing slash. - */ - uri = resource->uri; - uri_len = strlen(uri); - if (uri[uri_len - 1] == '/') { - dav_set_bufsize(p, pbuf, uri_len); - memcpy(pbuf->buf, uri, uri_len); - pbuf->buf[--uri_len] = '\0'; - uri = pbuf->buf; - } - - /* get the resource's etag; we may need it during the checks */ - etag = (*resource->hooks->getetag)(resource); - - /* how many state_lists apply to this URI? */ - num_that_apply = 0; - - /* If there are if-headers, fail if this resource - * does not match at least one state_list. - */ - for (ifhdr_scan = if_header; - ifhdr_scan != NULL; - ifhdr_scan = ifhdr_scan->next) { - - /* DBG2("uri=<%s> if_uri=<%s>", uri, ifhdr_scan->uri ? ifhdr_scan->uri : "(no uri)"); */ - - if (ifhdr_scan->uri != NULL - && (uri_len != ifhdr_scan->uri_len - || memcmp(uri, ifhdr_scan->uri, uri_len) != 0)) { - /* - ** A tagged-list's URI doesn't match this resource's URI. - ** Skip to the next state_list to see if it will match. - */ - continue; - } - - /* this state_list applies to this resource */ - - /* - ** ### only one state_list should ever apply! a no-tag, or a tagged - ** ### where S9.4.2 states only one can match. - ** - ** ### revamp this code to loop thru ifhdr_scan until we find the - ** ### matching state_list. process it. stop. - */ - ++num_that_apply; - - /* To succeed, resource must match *all* of the states - * specified in the state_list. - */ - for (state_list = ifhdr_scan->state; - state_list != NULL; - state_list = state_list->next) { - - switch(state_list->type) { - case dav_if_etag: - { - int mismatch = strcmp(state_list->etag, etag); - - if (state_list->condition == DAV_IF_COND_NORMAL && mismatch) { - /* - ** The specified entity-tag does not match the - ** entity-tag on the resource. This state_list is - ** not going to match. Bust outta here. - */ - reason = - "an entity-tag was specified, but the resource's " - "actual ETag does not match."; - goto state_list_failed; - } - else if (state_list->condition == DAV_IF_COND_NOT - && !mismatch) { - /* - ** The specified entity-tag DOES match the - ** entity-tag on the resource. This state_list is - ** not going to match. Bust outta here. - */ - reason = - "an entity-tag was specified using the \"Not\" form, " - "but the resource's actual ETag matches the provided " - "entity-tag."; - goto state_list_failed; - } - break; - } - - case dav_if_opaquelock: - if (lockdb == NULL) { - if (state_list->condition == DAV_IF_COND_NOT) { - /* the locktoken is definitely not there! (success) */ - continue; - } - - /* condition == DAV_IF_COND_NORMAL */ - - /* - ** If no lockdb is provided, then validation fails for - ** this state_list (NORMAL means we were supposed to - ** find the token, which we obviously cannot do without - ** a lock database). - ** - ** Go and try the next state list. - */ - reason = - "a State-token was supplied, but a lock database " - "is not available for to provide the required lock."; - goto state_list_failed; - } - - /* Resource validation 'fails' if: - * ANY of the lock->locktokens match - * a NOT state_list->locktoken, - * OR - * NONE of the lock->locktokens match - * a NORMAL state_list->locktoken. - */ - num_matched = 0; - for (lock = lock_list; lock != NULL; lock = lock->next) { - - /* - DBG2("compare: rsrc=%s ifhdr=%s", - (*locks_hooks->format_locktoken)(p, lock->locktoken), - (*locks_hooks->format_locktoken)(p, state_list->locktoken)); - */ - - /* nothing to do if the locktokens do not match. */ - if ((*locks_hooks->compare_locktoken)(state_list->locktoken, lock->locktoken)) { - continue; - } - - /* - ** We have now matched up one of the resource's locktokens - ** to a locktoken in a State-token in the If: header. - ** Note this fact, so that we can pass the overall - ** requirement of seeing at least one of the resource's - ** locktokens. - */ - seen_locktoken = 1; - - if (state_list->condition == DAV_IF_COND_NOT) { - /* - ** This state requires that the specified locktoken - ** is NOT present on the resource. But we just found - ** it. There is no way this state-list can now - ** succeed, so go try another one. - */ - reason = - "a State-token was supplied, which used a " - "\"Not\" condition. The State-token was found " - "in the locks on this resource"; - goto state_list_failed; - } - - /* condition == DAV_IF_COND_NORMAL */ - - /* Validate auth_user: If an authenticated user created - ** the lock, only the same user may submit that locktoken - ** to manipulate a resource. - */ - if (lock->auth_user && - (!r->connection->user || - strcmp(lock->auth_user, r->connection->user))) { - const char *errmsg; - - errmsg = ap_pstrcat(p, "User \"", - r->connection->user, - "\" submitted a locktoken created " - "by user \"", - lock->auth_user, "\".", NULL); - return dav_new_error(p, HTTP_UNAUTHORIZED, 0, errmsg); - } - - /* - ** We just matched a specified State-Token to one of the - ** resource's locktokens. - ** - ** Break out of the lock scan -- we only needed to find - ** one match (actually, there shouldn't be any other - ** matches in the lock list). - */ - num_matched = 1; - break; - } - - if (num_matched == 0 - && state_list->condition == DAV_IF_COND_NORMAL) { - /* - ** We had a NORMAL state, meaning that we should have - ** found the State-Token within the locks on this - ** resource. We didn't, so this state_list must fail. - */ - reason = - "a State-token was supplied, but it was not found " - "in the locks on this resource."; - goto state_list_failed; - } - - break; - - } /* switch */ - } /* foreach ( state_list ) */ - - /* - ** We've checked every state in this state_list and none of them - ** have failed. Since all of them succeeded, then we have a matching - ** state list and we may be done. - ** - ** The next requirement is that we have seen one of the resource's - ** locktokens (if any). If we have, then we can just exit. If we - ** haven't, then we need to keep looking. - */ - if (seen_locktoken) { - /* woo hoo! */ - return NULL; - } - - /* - ** Haven't seen one. Let's break out of the search and just look - ** for a matching locktoken. - */ - break; - - /* - ** This label is used when we detect that a state_list is not - ** going to match this resource. We bust out and try the next - ** state_list. - */ - state_list_failed: - ; - - } /* foreach ( ifhdr_scan ) */ - - /* - ** The above loop exits for one of two reasons: - ** 1) a state_list matched and seen_locktoken is false. - ** 2) all if_header structures were scanned, without (1) occurring - */ - - if (ifhdr_scan == NULL) { - /* - ** We finished the loop without finding any matching state lists. - */ - - /* - ** If none of the state_lists apply to this resource, then we - ** may have succeeded. Note that this scenario implies a - ** tagged-list with no matching state_lists. If the If: header - ** was a no-tag-list, then it would have applied to this resource. - ** - ** S9.4.2 states that when no state_lists apply, then the header - ** should be ignored. - ** - ** If we saw one of the resource's locktokens, then we're done. - ** If we did not see a locktoken, then we fail. - */ - if (num_that_apply == 0) { - if (seen_locktoken) - return NULL; - - /* - ** We may have aborted the scan before seeing the locktoken. - ** Rescan the If: header to see if we can find the locktoken - ** somewhere. - */ - if (dav_find_submitted_locktoken(if_header, lock_list, - locks_hooks)) { - /* - ** We found a match! We're set... none of the If: header - ** assertions apply (implicit success), and the If: header - ** specified the locktoken somewhere. We're done. - */ - return NULL; - } - - return dav_new_error(p, HTTP_LOCKED, 0 /* error_id */, - "This resource is locked and the \"If:\" " - "header did not specify one of the " - "locktokens for this resource's lock(s)."); - } - /* else: one or more state_lists were applicable, but failed. */ - - /* - ** If the dummy_header did not match, then they specified an - ** incorrect token in the Lock-Token header. Forget whether the - ** If: statement matched or not... we'll tell them about the - ** bad Lock-Token first. That is considered a 400 (Bad Request). - */ - if (if_header->dummy_header) { - return dav_new_error(p, HTTP_BAD_REQUEST, 0, - "The locktoken specified in the " - "\"Lock-Token:\" header did not specify one " - "of this resource's locktoken(s)."); - } - - if (reason == NULL) { - return dav_new_error(p, HTTP_PRECONDITION_FAILED, 0, - "The preconditions specified by the \"If:\" " - "header did not match this resource."); - } - - return dav_new_error(p, HTTP_PRECONDITION_FAILED, 0, - ap_psprintf(p, - "The precondition(s) specified by " - "the \"If:\" header did not match " - "this resource. At least one " - "failure is because: %s", reason)); - } - - /* assert seen_locktoken == 0 */ - - /* - ** ifhdr_scan != NULL implies we found a matching state_list. - ** - ** Since we're still here, it also means that we have not yet found - ** one the resource's locktokens in the If: header. - ** - ** Scan all the if_headers and states looking for one of this - ** resource's locktokens. Note that we need to go back and scan them - ** all -- we may have aborted a scan with a failure before we saw a - ** matching token. - ** - ** Note that seen_locktoken == 0 implies lock_list != NULL which implies - ** locks_hooks != NULL. - */ - if (dav_find_submitted_locktoken(if_header, lock_list, locks_hooks)) { - /* - ** We found a match! We're set... we have a matching state list, - ** and the If: header specified the locktoken somewhere. We're done. - */ - return NULL; - } - - /* - ** We had a matching state list, but the user agent did not specify one - ** of this resource's locktokens. Tell them so. - ** - ** Note that we need to special-case the message on whether a "dummy" - ** header exists. If it exists, yet we didn't see a needed locktoken, - ** then that implies the dummy header (Lock-Token header) did NOT - ** specify one of this resource's locktokens. (this implies something - ** in the real If: header matched) - ** - ** We want to note the 400 (Bad Request) in favor of a 423 (Locked). - */ - if (if_header->dummy_header) { - return dav_new_error(p, HTTP_BAD_REQUEST, 0, - "The locktoken specified in the " - "\"Lock-Token:\" header did not specify one " - "of this resource's locktoken(s)."); - } - - return dav_new_error(p, HTTP_LOCKED, 1 /* error_id */, - "This resource is locked and the \"If:\" header " - "did not specify one of the " - "locktokens for this resource's lock(s)."); -} - -/* dav_validate_walker: Walker callback function to validate resource state */ -static dav_error * dav_validate_walker(dav_walker_ctx *ctx, int calltype) -{ - dav_error *err; - - if ((err = dav_validate_resource_state(ctx->pool, ctx->resource, - ctx->lockdb, - ctx->if_header, ctx->flags, - &ctx->work_buf, ctx->r)) == NULL) { - /* There was no error, so just bug out. */ - return NULL; - } - - /* - ** If we have a serious server error, or if the request itself failed, - ** then just return error (not a multistatus). - */ - if (ap_is_HTTP_SERVER_ERROR(err->status) - || (*ctx->resource->hooks->is_same_resource)(ctx->resource, - ctx->root)) { - /* ### maybe push a higher-level description? */ - return err; - } - - /* associate the error with the current URI */ - dav_add_response(ctx, ctx->uri.buf, err->status, NULL); - - return NULL; -} - -/* -** dav_validate_request: Validate if-headers (and check for locks) on: -** (1) r->filename @ depth; -** (2) Parent of r->filename if check_parent == 1 -** -** The check of parent should be done when it is necessary to verify that -** the parent collection will accept a new member (ie current resource -** state is null). -** -** Return OK on successful validation. -** On error, return appropriate HTTP_* code, and log error. If a multi-stat -** error is necessary, response will point to it, else NULL. -*/ -dav_error * dav_validate_request(request_rec *r, dav_resource *resource, - int depth, dav_locktoken *locktoken, - dav_response **response, int flags, - dav_lockdb *lockdb) -{ - dav_error *err; - int result; - dav_if_header *if_header; - int lock_db_opened_locally = 0; - const dav_hooks_locks *locks_hooks = DAV_GET_HOOKS_LOCKS(r); - const dav_hooks_repository *repos_hooks = resource->hooks; - dav_buffer work_buf = { 0 }; - dav_response *new_response; - -#if DAV_DEBUG - if (depth && response == NULL) { - /* - ** ### bleck. we can't return errors for other URIs unless we have - ** ### a "response" ptr. - */ - return dav_new_error(r->pool, HTTP_INTERNAL_SERVER_ERROR, 0, - "DESIGN ERROR: dav_validate_request called " - "with depth>0, but no response ptr."); - } -#endif - - if (response != NULL) - *response = NULL; - - /* Do the standard checks for conditional requests using - * If-..-Since, If-Match etc */ - if ((result = ap_meets_conditions(r)) != OK) { - /* ### fix this up... how? */ - return dav_new_error(r->pool, result, 0, NULL); - } - - /* always parse (and later process) the If: header */ - if ((err = dav_process_if_header(r, &if_header)) != NULL) { - /* ### maybe add higher-level description */ - return err; - } - - /* If a locktoken was specified, create a dummy if_header with which - * to validate resources. In the interim, figure out why DAV uses - * locktokens in an if-header without a Lock-Token header to refresh - * locks, but a Lock-Token header without an if-header to remove them. - */ - if (locktoken != NULL) { - dav_if_header *ifhdr_new; - - ifhdr_new = ap_pcalloc(r->pool, sizeof(*ifhdr_new)); - ifhdr_new->uri = resource->uri; - ifhdr_new->uri_len = strlen(resource->uri); - ifhdr_new->dummy_header = 1; - - ifhdr_new->state = ap_pcalloc(r->pool, sizeof(*ifhdr_new->state)); - ifhdr_new->state->type = dav_if_opaquelock; - ifhdr_new->state->condition = DAV_IF_COND_NORMAL; - ifhdr_new->state->locktoken = locktoken; - - ifhdr_new->next = if_header; - if_header = ifhdr_new; - } - - /* - ** If necessary, open the lock database (read-only, lazily); - ** the validation process may need to retrieve or update lock info. - ** Otherwise, assume provided lockdb is valid and opened rw. - */ - if (lockdb == NULL) { - if (locks_hooks != NULL) { - if ((err = (*locks_hooks->open_lockdb)(r, 0, 0, &lockdb)) != NULL) { - /* ### maybe insert higher-level comment */ - return err; - } - lock_db_opened_locally = 1; - } - else { - return dav_new_error(r->pool, HTTP_INTERNAL_SERVER_ERROR, 0, - "Resource validation failed because no " - "lock hooks were found."); - } - } - - /* (1) Validate the specified resource, at the specified depth */ - if (resource->exists && depth > 0) { - dav_walker_ctx ctx = { 0 }; - - ctx.walk_type = DAV_WALKTYPE_ALL; - ctx.postfix = 0; - ctx.func = dav_validate_walker; - ctx.pool = r->pool; - ctx.if_header = if_header; - ctx.r = r; - ctx.flags = flags; - ctx.resource = resource; - - if (lockdb != NULL) { - ctx.lockdb = lockdb; - ctx.walk_type |= DAV_WALKTYPE_LOCKNULL; - } - - dav_buffer_init(r->pool, &ctx.uri, resource->uri); - - err = (*repos_hooks->walk)(&ctx, DAV_INFINITY); - if (err == NULL) { - *response = ctx.response; - } - /* else: implies a 5xx status code occurred. */ - } - else { - err = dav_validate_resource_state(r->pool, resource, lockdb, - if_header, flags, &work_buf, r); - } - - /* (2) Validate the parent resource if requested */ - if (err == NULL && (flags & DAV_VALIDATE_PARENT)) { - dav_resource *parent_resource = (*repos_hooks->get_parent_resource)(resource); - - if (parent_resource == NULL) { - err = dav_new_error(r->pool, HTTP_FORBIDDEN, 0, - "Cannot access parent of repository root."); - } - else { - err = dav_validate_resource_state(r->pool, parent_resource, lockdb, - if_header, - flags | DAV_VALIDATE_IS_PARENT, - &work_buf, r); - - /* - ** This error occurred on the parent resource. This implies that - ** we have to create a multistatus response (to report the error - ** against a URI other than the Request-URI). "Convert" this error - ** into a multistatus response. - */ - if (err != NULL) { - new_response = ap_pcalloc(r->pool, sizeof(*new_response)); - - new_response->href = parent_resource->uri; - new_response->status = err->status; - new_response->desc = - "A validation error has occurred on the parent resource, " - "preventing the operation on the resource specified by " - "the Request-URI."; - if (err->desc != NULL) { - new_response->desc = ap_pstrcat(r->pool, - new_response->desc, - " The error was: ", - err->desc, NULL); - } - - /* assert: DAV_VALIDATE_PARENT implies response != NULL */ - new_response->next = *response; - *response = new_response; - - err = NULL; - } - } - } - - if (lock_db_opened_locally) - (*locks_hooks->close_lockdb)(lockdb); - - /* - ** If we don't have a (serious) error, and we have multistatus responses, - ** then we need to construct an "error". This error will be the overall - ** status returned, and the multistatus responses will go into its body. - ** - ** For certain methods, the overall error will be a 424. The default is - ** to construct a standard 207 response. - */ - if (err == NULL && response != NULL && *response != NULL) { - dav_text *propstat = NULL; - - if ((flags & DAV_VALIDATE_USE_424) != 0) { - /* manufacture a 424 error to hold the multistatus response(s) */ - return dav_new_error(r->pool, HTTP_FAILED_DEPENDENCY, 0, - "An error occurred on another resource, " - "preventing the requested operation on " - "this resource."); - } - - /* - ** Whatever caused the error, the Request-URI should have a 424 - ** associated with it since we cannot complete the method. - ** - ** For a LOCK operation, insert an empty DAV:lockdiscovery property. - ** For other methods, return a simple 424. - */ - if ((flags & DAV_VALIDATE_ADD_LD) != 0) { - propstat = ap_pcalloc(r->pool, sizeof(*propstat)); - propstat->text = - "" DEBUG_CR - "" DEBUG_CR - "HTTP/1.1 424 Failed Dependency" DEBUG_CR - "" DEBUG_CR; - } - - /* create the 424 response */ - new_response = ap_pcalloc(r->pool, sizeof(*new_response)); - new_response->href = resource->uri; - new_response->status = HTTP_FAILED_DEPENDENCY; - new_response->propresult.propstats = propstat; - new_response->desc = - "An error occurred on another resource, preventing the " - "requested operation on this resource."; - - new_response->next = *response; - *response = new_response; - - /* manufacture a 207 error for the multistatus response(s) */ - return dav_new_error(r->pool, HTTP_MULTI_STATUS, 0, - "Error(s) occurred on resources during the " - "validation process."); - } - - return err; -} - -/* dav_get_locktoken_list: - * - * Sets ltl to a locktoken_list of all positive locktokens in header, - * else NULL if no If-header, or no positive locktokens. - */ -dav_error * dav_get_locktoken_list(request_rec *r, dav_locktoken_list **ltl) -{ - dav_error *err; - dav_if_header *if_header; - dav_if_state_list *if_state; - dav_locktoken_list *lock_token = NULL; - - *ltl = NULL; - - if ((err = dav_process_if_header(r, &if_header)) != NULL) { - /* ### add a higher-level description? */ - return err; - } - - while (if_header != NULL) { - if_state = if_header->state; /* Begining of the if_state linked list */ - while (if_state != NULL) { - if (if_state->condition == DAV_IF_COND_NORMAL - && if_state->type == dav_if_opaquelock) { - lock_token = ap_pcalloc(r->pool, sizeof(dav_locktoken_list)); - lock_token->locktoken = if_state->locktoken; - lock_token->next = *ltl; - *ltl = lock_token; - } - if_state = if_state->next; - } - if_header = if_header->next; - } - if (*ltl == NULL) { - /* No nodes added */ - return dav_new_error(r->pool, HTTP_BAD_REQUEST, DAV_ERR_IF_ABSENT, - "No locktokens were specified in the \"If:\" " - "header, so the refresh could not be performed."); - } - - return NULL; -} - -/* dav_get_target_selector: - * - * Returns any Target-Selector header in a request - * (used by versioning clients) - */ -const char *dav_get_target_selector(request_rec *r) -{ - return ap_table_get(r->headers_in, "Target-Selector"); -} - -/* Ensure that a resource is writable. If there is no versioning - * provider, then this is essentially a no-op. Versioning repositories - * require explicit resource creation and checkout before they can - * be written to. If a new resource is to be created, or an existing - * resource deleted, the parent collection must be checked out as well. - * - * Set the parent_only flag to only make the parent collection writable. - * Otherwise, both parent and child are made writable as needed. If the - * child does not exist, then a new versioned resource is created and - * checked out. - * - * The parent_resource and parent_was_writable arguments are optional - * (i.e. they may be NULL). If parent_only is set, then the - * resource_existed and resource_was_writable arguments are ignored. - * - * The previous states of the resources are returned, so they can be - * restored after the operation completes (see - * dav_revert_resource_writability()) - */ -dav_error *dav_ensure_resource_writable(request_rec *r, - dav_resource *resource, - int parent_only, - dav_resource **parent_resource, - int *resource_existed, - int *resource_was_writable, - int *parent_was_writable) -{ - const dav_hooks_vsn *vsn_hooks = DAV_GET_HOOKS_VSN(r); - dav_resource *parent = NULL; - const char *body; - int auto_version; - dav_error *err; - - if (parent_resource != NULL) - *parent_resource = NULL; - - if (!parent_only) { - *resource_existed = resource->exists; - *resource_was_writable = 0; - } - - if (parent_was_writable != NULL) - *parent_was_writable = 0; - - /* if a Target-Selector header is present, then the client knows about - * versioning, so it should not be relying on implicit versioning - */ - auto_version = (dav_get_target_selector(r) == NULL); - - /* check parent resource if requested or if resource must be created */ - if (!resource->exists || parent_only) { - parent = (*resource->hooks->get_parent_resource)(resource); - if (parent == NULL || !parent->exists) { - body = ap_psprintf(r->pool, - "Missing one or more intermediate collections. " - "Cannot create resource %s.", - ap_escape_html(r->pool, resource->uri)); - return dav_new_error(r->pool, HTTP_CONFLICT, 0, body); - } - - if (parent_resource != NULL) - *parent_resource = parent; - - /* if parent not versioned, assume child can be created */ - if (!parent->versioned) { - if (!parent_only) - *resource_was_writable = 1; - - if (parent_was_writable != NULL) - *parent_was_writable = 1; - return NULL; - } - - /* if no versioning provider, something is terribly wrong */ - if (vsn_hooks == NULL) { - return dav_new_error(r->pool, HTTP_INTERNAL_SERVER_ERROR, 0, - "INTERNAL ERROR: " - "versioned resource with no versioning " - "provider?"); - } - - /* remember whether parent was already writable */ - if (parent_was_writable != NULL) - *parent_was_writable = parent->working; - - /* parent must be checked out */ - if (!parent->working) { - if ((err = (*vsn_hooks->checkout)(parent)) != NULL) { - body = ap_psprintf(r->pool, - "Unable to checkout parent collection. " - "Cannot create resource %s.", - ap_escape_html(r->pool, resource->uri)); - return dav_push_error(r->pool, HTTP_CONFLICT, 0, body, err); - } - } - - /* if not just checking parent, create new child resource */ - if (!parent_only) { - if ((err = (*vsn_hooks->mkresource)(resource)) != NULL) { - body = ap_psprintf(r->pool, - "Unable to create versioned resource %s.", - ap_escape_html(r->pool, resource->uri)); - return dav_push_error(r->pool, HTTP_CONFLICT, 0, body, err); - } - } - } - else { - /* resource exists: if not versioned, then assume it is writable */ - if (!resource->versioned) { - *resource_was_writable = 1; - return NULL; - } - - *resource_was_writable = resource->working; - } - - /* if not just checking parent, make sure child resource is checked out */ - if (!parent_only && !resource->working) { - if ((err = (*vsn_hooks->checkout)(resource)) != NULL) { - body = ap_psprintf(r->pool, - "Unable to checkout resource %s.", - ap_escape_html(r->pool, resource->uri)); - return dav_push_error(r->pool, HTTP_CONFLICT, 0, body, err); - } - } - - return NULL; -} - -/* Revert the writability of resources back to what they were - * before they were modified. If undo == 0, then the resource - * modifications are maintained (i.e. they are checked in). - * If undo != 0, then resource modifications are discarded - * (i.e. they are unchecked out). - * - * The resource and parent_resource arguments are optional - * (i.e. they may be NULL). - */ -dav_error *dav_revert_resource_writability(request_rec *r, - dav_resource *resource, - dav_resource *parent_resource, - int undo, - int resource_existed, - int resource_was_writable, - int parent_was_writable) -{ - const dav_hooks_vsn *vsn_hooks = DAV_GET_HOOKS_VSN(r); - const char *body; - dav_error *err; - - if (resource != NULL) { - if (!resource_was_writable - && resource->versioned && resource->working) { - - if (undo) - err = (*vsn_hooks->uncheckout)(resource); - else - err = (*vsn_hooks->checkin)(resource); - - if (err != NULL) { - body = ap_psprintf(r->pool, - "Unable to %s resource %s.", - undo ? "uncheckout" : "checkin", - ap_escape_html(r->pool, resource->uri)); - return dav_push_error(r->pool, HTTP_INTERNAL_SERVER_ERROR, 0, - body, err); - } - } - - if (undo && !resource_existed && resource->exists) { - dav_response *response; - - /* ### should we do anything with the response? */ - if ((err = (*resource->hooks->remove_resource)(resource, - &response)) != NULL) { - body = ap_psprintf(r->pool, - "Unable to undo creation of resource %s.", - ap_escape_html(r->pool, resource->uri)); - return dav_push_error(r->pool, HTTP_INTERNAL_SERVER_ERROR, 0, - body, err); - } - } - } - - if (parent_resource != NULL && !parent_was_writable - && parent_resource->versioned && parent_resource->working) { - - if (undo) - err = (*vsn_hooks->uncheckout)(parent_resource); - else - err = (*vsn_hooks->checkin)(parent_resource); - - if (err != NULL) { - body = ap_psprintf(r->pool, - "Unable to %s parent collection of %s.", - undo ? "uncheckout" : "checkin", - ap_escape_html(r->pool, resource->uri)); - return dav_push_error(r->pool, HTTP_INTERNAL_SERVER_ERROR, 0, - body, err); - } - } - - return NULL; -} - -/* return the URI's (existing) index, or insert it and return a new index */ -int dav_insert_uri(array_header *uri_array, const char *uri) -{ - int i; - const char **pelt; - - for (i = uri_array->nelts; i--;) { - if (strcmp(uri, DAV_GET_URI_ITEM(uri_array, i)) == 0) - return i; - } - - pelt = ap_push_array(uri_array); - *pelt = uri; /* assume uri is const or in a pool */ - return uri_array->nelts - 1; -} diff --git a/modules/dav/main/util_lock.c b/modules/dav/main/util_lock.c deleted file mode 100644 index a3441bf53f10e6bcb6ce30e1d200d630c4661145..0000000000000000000000000000000000000000 --- a/modules/dav/main/util_lock.c +++ /dev/null @@ -1,764 +0,0 @@ -/* -** Copyright (C) 1998-2000 Greg Stein. All Rights Reserved. -** -** By using this file, you agree to the terms and conditions set forth in -** the LICENSE.html file which can be found at the top level of the mod_dav -** distribution or at http://www.webdav.org/mod_dav/license-1.html. -** -** Contact information: -** Greg Stein, PO Box 760, Palo Alto, CA, 94302 -** gstein@lyra.org, http://www.webdav.org/mod_dav/ -*/ - -/* -** DAV repository-independent lock functions -** -** Written 06/99 by Keith Wannamaker, wannamak@us.ibm.com -** -** Modified 08/99 by John Vasta, vasta@rational.com, to move filesystem-based -** implementation to dav_fs_lock.c -*/ - -#include "mod_dav.h" -#include "http_log.h" -#include "http_config.h" -#include "http_protocol.h" -#include "http_core.h" -#include "memory.h" - - -/* --------------------------------------------------------------- -** -** Property-related lock functions -** -*/ - -/* -** dav_lock_get_activelock: Returns a containing -** an activelock element for every item in the lock_discovery tree -*/ -const char *dav_lock_get_activelock(request_rec *r, dav_lock *lock, - dav_buffer *pbuf) -{ - dav_lock *lock_scan; - const dav_hooks_locks *hooks = DAV_GET_HOOKS_LOCKS(r); - int count = 0; - dav_buffer work_buf = { 0 }; - pool *p = r->pool; - - /* If no locks or no lock provider, there are no locks */ - if (lock == NULL || hooks == NULL) { - /* - ** Since resourcediscovery is defined with (activelock)*, - ** shouldn't be necessary for an empty lock. - */ - return ""; - } - - /* - ** Note: it could be interesting to sum the lengths of the owners - ** and locktokens during this loop. However, the buffer - ** mechanism provides some rough padding so that we don't - ** really need to have an exact size. Further, constructing - ** locktoken strings could be relatively expensive. - */ - for (lock_scan = lock; lock_scan != NULL; lock_scan = lock_scan->next) - count++; - - /* if a buffer was not provided, then use an internal buffer */ - if (pbuf == NULL) - pbuf = &work_buf; - - /* reset the length before we start appending stuff */ - pbuf->cur_len = 0; - - /* prep the buffer with a "good" size */ - dav_check_bufsize(p, pbuf, count * 300); - - for (; lock != NULL; lock = lock->next) { - char tmp[100]; - -#if DAV_DEBUG - if (lock->rectype == DAV_LOCKREC_INDIRECT_PARTIAL) { - /* ### crap. design error */ - dav_buffer_append(p, pbuf, - "DESIGN ERROR: attempted to product an " - "activelock element from a partial, indirect " - "lock record. Creating an XML parsing error " - "to ease detection of this situation: <"); - } -#endif - - dav_buffer_append(p, pbuf, "" DEBUG_CR ""); - switch (lock->type) { - case DAV_LOCKTYPE_WRITE: - dav_buffer_append(p, pbuf, ""); - break; - default: - /* ### internal error. log something? */ - break; - } - dav_buffer_append(p, pbuf, "" DEBUG_CR ""); - switch (lock->scope) { - case DAV_LOCKSCOPE_EXCLUSIVE: - dav_buffer_append(p, pbuf, ""); - break; - case DAV_LOCKSCOPE_SHARED: - dav_buffer_append(p, pbuf, ""); - break; - default: - /* ### internal error. log something? */ - break; - } - dav_buffer_append(p, pbuf, "" DEBUG_CR); - sprintf(tmp, "%s" DEBUG_CR, - lock->depth == DAV_INFINITY ? "infinity" : "0"); - dav_buffer_append(p, pbuf, tmp); - - if (lock->owner) { - /* - ** This contains a complete, self-contained element, - ** with namespace declarations and xml:lang handling. Just drop - ** it in. - */ - dav_buffer_append(p, pbuf, lock->owner); - } - - dav_buffer_append(p, pbuf, ""); - if (lock->timeout == DAV_TIMEOUT_INFINITE) { - dav_buffer_append(p, pbuf, "Infinite"); - } - else { - time_t now = time(NULL); - sprintf(tmp, "Second-%lu", lock->timeout - now); - dav_buffer_append(p, pbuf, tmp); - } - - dav_buffer_append(p, pbuf, - "" DEBUG_CR - "" DEBUG_CR - ""); - dav_buffer_append(p, pbuf, - (*hooks->format_locktoken)(p, lock->locktoken)); - dav_buffer_append(p, pbuf, - "" DEBUG_CR - "" DEBUG_CR - "" DEBUG_CR); - } - - return pbuf->buf; -} - -/* -** dav_lock_parse_lockinfo: Validates the given xml_doc to contain a -** lockinfo XML element, then populates a dav_lock structure -** with its contents. -*/ -dav_error * dav_lock_parse_lockinfo(request_rec *r, - const dav_resource *resource, - dav_lockdb *lockdb, - const dav_xml_doc *doc, - dav_lock **lock_request) -{ - const dav_hooks_locks *hooks = DAV_GET_HOOKS_LOCKS(r); - pool *p = r->pool; - dav_error *err; - dav_xml_elem *child; - dav_lock *lock; - - if (!dav_validate_root(doc, "lockinfo")) { - return dav_new_error(p, HTTP_BAD_REQUEST, 0, - "The request body contains an unexpected " - "XML root element."); - } - - if ((err = (*hooks->create_lock)(lockdb, resource, &lock)) != NULL) { - return dav_push_error(p, err->status, 0, - "Could not parse the lockinfo due to an " - "internal problem creating a lock structure.", - err); - } - - lock->depth = dav_get_depth(r, DAV_INFINITY); - if (lock->depth == -1) { - return dav_new_error(p, HTTP_BAD_REQUEST, 0, - "An invalid Depth header was specified."); - } - lock->timeout = dav_get_timeout(r); - - /* Parse elements in the XML body */ - for (child = doc->root->first_child; child; child = child->next) { - if (strcmp(child->name, "locktype") == 0 - && child->first_child - && lock->type == DAV_LOCKTYPE_UNKNOWN) { - if (strcmp(child->first_child->name, "write") == 0) { - lock->type = DAV_LOCKTYPE_WRITE; - continue; - } - } - if (strcmp(child->name, "lockscope") == 0 - && child->first_child - && lock->scope == DAV_LOCKSCOPE_UNKNOWN) { - if (strcmp(child->first_child->name, "exclusive") == 0) - lock->scope = DAV_LOCKSCOPE_EXCLUSIVE; - else if (strcmp(child->first_child->name, "shared") == 0) - lock->scope = DAV_LOCKSCOPE_SHARED; - if (lock->scope != DAV_LOCKSCOPE_UNKNOWN) - continue; - } - - if (strcmp(child->name, "owner") == 0 && lock->owner == NULL) { - const char *text; - - /* quote all the values in the element */ - dav_quote_xml_elem(p, child); - - /* - ** Store a full element with namespace definitions - ** and an xml:lang definition, if applicable. - */ - dav_xml2text(p, child, DAV_X2T_FULL_NS_LANG, doc->namespaces, NULL, - &text, NULL); - lock->owner = text; - - continue; - } - - return dav_new_error(p, HTTP_PRECONDITION_FAILED, 0, - ap_psprintf(p, - "The server cannot satisfy the " - "LOCK request due to an unknown XML " - "element (\"%s\") within the " - "DAV:lockinfo element.", - child->name)); - } - - *lock_request = lock; - return NULL; -} - -/* --------------------------------------------------------------- -** -** General lock functions -** -*/ - -/* dav_lock_walker: Walker callback function to record indirect locks */ -static dav_error * dav_lock_walker(dav_walker_ctx *ctx, int calltype) -{ - dav_error *err; - - /* We don't want to set indirects on the target */ - if ((*ctx->resource->hooks->is_same_resource)(ctx->resource, ctx->root)) - return NULL; - - if ((err = (*ctx->lockdb->hooks->append_locks)(ctx->lockdb, ctx->resource, - 1, - ctx->lock)) != NULL) { - if (ap_is_HTTP_SERVER_ERROR(err->status)) { - /* ### add a higher-level description? */ - return err; - } - - /* add to the multistatus response */ - dav_add_response(ctx, ctx->resource->uri, err->status, NULL); - - /* - ** ### actually, this is probably wrong: we want to fail the whole - ** ### LOCK process if something goes bad. maybe the caller should - ** ### do a dav_unlock() (e.g. a rollback) if any errors occurred. - */ - } - - return NULL; -} - -/* -** dav_add_lock: Add a direct lock for resource, and indirect locks for -** all children, bounded by depth. -** ### assume request only contains one lock -*/ -dav_error * dav_add_lock(request_rec *r, const dav_resource *resource, - dav_lockdb *lockdb, dav_lock *lock, - dav_response **response) -{ - const dav_hooks_locks *hooks = DAV_GET_HOOKS_LOCKS(r); - dav_error *err; - int depth = lock->depth; - - *response = NULL; - - /* Requested lock can be: - * Depth: 0 for null resource, existing resource, or existing collection - * Depth: Inf for existing collection - */ - - /* - ** 2518 9.2 says to ignore depth if target is not a collection (it has - ** no internal children); pretend the client gave the correct depth. - */ - if (!resource->collection) { - depth = 0; - } - - /* In all cases, first add direct entry in lockdb */ - - /* - ** Append the new (direct) lock to the resource's existing locks. - ** - ** Note: this also handles locknull resources - */ - if ((err = (*hooks->append_locks)(lockdb, resource, 0, lock)) != NULL) { - /* ### maybe add a higher-level description */ - return err; - } - - if (depth > 0) { - /* Walk existing collection and set indirect locks */ - dav_walker_ctx ctx = { 0 }; - - ctx.walk_type = DAV_WALKTYPE_ALL | DAV_WALKTYPE_AUTH; - ctx.postfix = 0; - ctx.func = dav_lock_walker; - ctx.pool = r->pool; - ctx.r = r; - ctx.resource = resource; - ctx.lockdb = lockdb; - ctx.lock = lock; - - dav_buffer_init(r->pool, &ctx.uri, resource->uri); - - err = (*resource->hooks->walk)(&ctx, DAV_INFINITY); - if (err != NULL) { - /* implies a 5xx status code occurred. screw the multistatus */ - return err; - } - - if (ctx.response != NULL) { - /* manufacture a 207 error for the multistatus response */ - *response = ctx.response; - return dav_new_error(r->pool, HTTP_MULTI_STATUS, 0, - "Error(s) occurred on resources during the " - "addition of a depth lock."); - } - } - - return NULL; -} - -/* -** dav_lock_query: Opens the lock database. Returns a linked list of -** dav_lock structures for all direct locks on path. -*/ -dav_error * dav_lock_query(dav_lockdb *lockdb, const dav_resource *resource, - dav_lock **locks) -{ - /* If no lock database, return empty result */ - if (lockdb == NULL) { - *locks = NULL; - return NULL; - } - - /* ### insert a higher-level description? */ - return (*lockdb->hooks->get_locks)(lockdb, resource, - DAV_GETLOCKS_RESOLVED, - locks); -} - -/* dav_unlock_walker: Walker callback function to remove indirect locks */ -static dav_error * dav_unlock_walker(dav_walker_ctx *ctx, int calltype) -{ - dav_error *err; - - if ((err = (*ctx->lockdb->hooks->remove_lock)(ctx->lockdb, ctx->resource, - ctx->locktoken)) != NULL) { - /* ### should we stop or return a multistatus? looks like STOP */ - /* ### add a higher-level description? */ - return err; - } - - return NULL; -} - -/* -** dav_get_direct_resource: -** -** Find a lock on the specified resource, then return the resource the -** lock was applied to (in other words, given a (possibly) indirect lock, -** return the direct lock's corresponding resource). -** -** If the lock is an indirect lock, this usually means traversing up the -** namespace [repository] hierarchy. Note that some lock providers may be -** able to return this information with a traversal. -*/ -static dav_error * dav_get_direct_resource(pool *p, - dav_lockdb *lockdb, - const dav_locktoken *locktoken, - const dav_resource *resource, - const dav_resource **direct_resource) -{ - if (lockdb->hooks->lookup_resource != NULL) { - return (*lockdb->hooks->lookup_resource)(lockdb, locktoken, - resource, direct_resource); - } - - *direct_resource = NULL; - - /* Find the top of this lock- - * If r->filename's direct locks include locktoken, use r->filename. - * If r->filename's indirect locks include locktoken, retry r->filename/.. - * Else fail. - */ - while (resource != NULL) { - dav_error *err; - dav_lock *lock; - - /* - ** Find the lock specified by on . If it is - ** an indirect lock, then partial results are okay. We're just - ** trying to find the thing and know whether it is a direct or - ** an indirect lock. - */ - if ((err = (*lockdb->hooks->find_lock)(lockdb, resource, locktoken, - 1, &lock)) != NULL) { - /* ### add a higher-level desc? */ - return err; - } - - /* not found! that's an error. */ - if (lock == NULL) { - return dav_new_error(p, HTTP_BAD_REQUEST, 0, - "The specified locktoken does not correspond " - "to an existing lock on this resource."); - } - - if (lock->rectype == DAV_LOCKREC_DIRECT) { - /* we found the direct lock. return this resource. */ - - *direct_resource = resource; - return NULL; - } - - /* the lock was indirect. move up a level in the URL namespace */ - resource = (*resource->hooks->get_parent_resource)(resource); - } - - return dav_new_error(p, HTTP_INTERNAL_SERVER_ERROR, 0, - "The lock database is corrupt. A direct lock could " - "not be found for the corresponding indirect lock " - "on this resource."); -} - -/* -** dav_unlock: Removes all direct and indirect locks for r->filename, -** with given locktoken. If locktoken == null_locktoken, all locks -** are removed. If r->filename represents an indirect lock, -** we must unlock the appropriate direct lock. -** Returns OK or appropriate HTTP_* response and logs any errors. -** -** ### We've already crawled the tree to ensure everything was locked -** by us; there should be no need to incorporate a rollback. -*/ -int dav_unlock(request_rec *r, const dav_resource *resource, - const dav_locktoken *locktoken) -{ - int result; - dav_lockdb *lockdb; - const dav_resource *lock_resource = resource; - const dav_hooks_locks *hooks = DAV_GET_HOOKS_LOCKS(r); - const dav_hooks_repository *repos_hooks = resource->hooks; - dav_error *err; - - /* If no locks provider, we shouldn't have been called */ - if (hooks == NULL) { - /* ### map result to something nice; log an error */ - return HTTP_INTERNAL_SERVER_ERROR; - } - - /* 2518 requires the entire lock to be removed if resource/locktoken - * point to an indirect lock. We need resource of the _direct_ - * lock in order to walk down the tree and remove the locks. So, - * If locktoken != null_locktoken, - * Walk up the resource hierarchy until we see a direct lock. - * Or, we could get the direct lock's db/key, pick out the URL - * and do a subrequest. I think walking up is faster and will work - * all the time. - * Else - * Just start removing all locks at and below resource. - */ - - if ((err = (*hooks->open_lockdb)(r, 0, 1, &lockdb)) != NULL) { - /* ### return err! maybe add a higher-level desc */ - /* ### map result to something nice; log an error */ - return HTTP_INTERNAL_SERVER_ERROR; - } - - if (locktoken != NULL - && (err = dav_get_direct_resource(r->pool, lockdb, - locktoken, resource, - &lock_resource)) != NULL) { - /* ### add a higher-level desc? */ - /* ### should return err! */ - return err->status; - } - - /* At this point, lock_resource/locktoken refers to a direct lock (key), ie - * the root of a depth > 0 lock, or locktoken is null. - */ - if ((err = (*hooks->remove_lock)(lockdb, lock_resource, - locktoken)) != NULL) { - /* ### add a higher-level desc? */ - /* ### return err! */ - return HTTP_INTERNAL_SERVER_ERROR; - } - - if (lock_resource->collection) { - dav_walker_ctx ctx = { 0 }; - - ctx.walk_type = DAV_WALKTYPE_ALL | DAV_WALKTYPE_LOCKNULL; - ctx.postfix = 0; - ctx.func = dav_unlock_walker; - ctx.pool = r->pool; - ctx.resource = lock_resource; - ctx.r = r; - ctx.lockdb = lockdb; - ctx.locktoken = locktoken; - - dav_buffer_init(r->pool, &ctx.uri, lock_resource->uri); - - err = (*repos_hooks->walk)(&ctx, DAV_INFINITY); - - /* ### fix this! */ - result = err == NULL ? OK : err->status; - } - else - result = OK; - - (*hooks->close_lockdb)(lockdb); - - return result; -} - -/* dav_inherit_walker: Walker callback function to inherit locks */ -static dav_error * dav_inherit_walker(dav_walker_ctx *ctx, int calltype) -{ - if (ctx->skip_root - && (*ctx->resource->hooks->is_same_resource)(ctx->resource, - ctx->root)) { - return NULL; - } - - /* ### maybe add a higher-level desc */ - return (*ctx->lockdb->hooks->append_locks)(ctx->lockdb, ctx->resource, 1, - ctx->lock); -} - -/* -** dav_inherit_locks: When a resource or collection is added to a collection, -** locks on the collection should be inherited to the resource/collection. -** (MOVE, MKCOL, etc) Here we propagate any direct or indirect locks from -** parent of resource to resource and below. -*/ -static dav_error * dav_inherit_locks(request_rec *r, dav_lockdb *lockdb, - const dav_resource *resource, - int use_parent) -{ - dav_error *err; - const dav_resource *which_resource; - dav_lock *locks; - dav_lock *scan; - dav_lock *prev; - dav_walker_ctx ctx = { 0 }; - const dav_hooks_repository *repos_hooks = resource->hooks; - - if (use_parent) { - which_resource = (*repos_hooks->get_parent_resource)(resource); - if (which_resource == NULL) { - /* ### map result to something nice; log an error */ - return dav_new_error(r->pool, HTTP_INTERNAL_SERVER_ERROR, 0, - "Could not fetch parent resource. Unable to " - "inherit locks from the parent and apply " - "them to this resource."); - } - } - else { - which_resource = resource; - } - - if ((err = (*lockdb->hooks->get_locks)(lockdb, which_resource, - DAV_GETLOCKS_PARTIAL, - &locks)) != NULL) { - /* ### maybe add a higher-level desc */ - return err; - } - - if (locks == NULL) { - /* No locks to propagate, just return */ - return NULL; - } - - /* - ** (1) Copy all indirect locks from our parent; - ** (2) Create indirect locks for the depth infinity, direct locks - ** in our parent. - ** - ** The append_locks call in the walker callback will do the indirect - ** conversion, but we need to remove any direct locks that are NOT - ** depth "infinity". - */ - for (scan = locks, prev = NULL; - scan != NULL; - prev = scan, scan = scan->next) { - - if (scan->rectype == DAV_LOCKREC_DIRECT - && scan->depth != DAV_INFINITY) { - - if (prev == NULL) - locks = scan->next; - else - prev->next = scan->next; - } - } - - /* has all our new locks. Walk down and propagate them. */ - - ctx.walk_type = DAV_WALKTYPE_ALL | DAV_WALKTYPE_LOCKNULL; - ctx.postfix = 0; - ctx.func = dav_inherit_walker; - ctx.pool = r->pool; - ctx.resource = resource; - ctx.r = r; - ctx.lockdb = lockdb; - ctx.lock = locks; - ctx.skip_root = !use_parent; - - dav_buffer_init(r->pool, &ctx.uri, resource->uri); - - return (*repos_hooks->walk)(&ctx, DAV_INFINITY); -} - -/* --------------------------------------------------------------- -** -** Functions dealing with lock-null resources -** -*/ - -/* -** dav_get_resource_state: Returns the state of the resource -** r->filename: DAV_RESOURCE_NULL, DAV_RESOURCE_LOCK_NULL, -** or DAV_RESOURCE_EXIST. -** -** Returns DAV_RESOURCE_ERROR if an error occurs. -*/ -int dav_get_resource_state(request_rec *r, const dav_resource *resource) -{ - const dav_hooks_locks *hooks = DAV_GET_HOOKS_LOCKS(r); - - if (resource->exists) - return DAV_RESOURCE_EXISTS; - - if (hooks != NULL) { - dav_error *err; - dav_lockdb *lockdb; - int locks_present; - - /* - ** A locknull resource has the form: - ** - ** known-dir "/" locknull-file - ** - ** It would be nice to look into to verify this form, - ** but it does not have enough information for us. Instead, we - ** can look at the path_info. If the form does not match, then - ** there is no way we could have a locknull resource -- it must - ** be a plain, null resource. - ** - ** Apache sets r->filename to known-dir/unknown-file and r->path_info - ** to "" for the "proper" case. If anything is in path_info, then - ** it can't be a locknull resource. - ** - ** ### I bet this path_info hack doesn't work for repositories. - ** ### Need input from repository implementors! What kind of - ** ### restructure do we need? New provider APIs? - */ - if (r->path_info != NULL && *r->path_info != '\0') { - return DAV_RESOURCE_NULL; - } - - if ((err = (*hooks->open_lockdb)(r, 1, 1, &lockdb)) == NULL) { - /* note that we might see some expired locks... *shrug* */ - err = (*hooks->has_locks)(lockdb, resource, &locks_present); - (*hooks->close_lockdb)(lockdb); - } - - if (err != NULL) { - /* ### don't log an error. return err. add higher-level desc. */ - - ap_log_rerror(APLOG_MARK, APLOG_ERR | APLOG_NOERRNO, r, - "Failed to query lock-null status for %s", - r->filename); - - return DAV_RESOURCE_ERROR; - } - - if (locks_present) - return DAV_RESOURCE_LOCK_NULL; - } - - return DAV_RESOURCE_NULL; -} - -dav_error * dav_notify_created(request_rec *r, - dav_lockdb *lockdb, - const dav_resource *resource, - int resource_state, - int depth) -{ - dav_error *err; - - if (resource_state == DAV_RESOURCE_LOCK_NULL) { - - /* - ** The resource is no longer a locknull resource. This will remove - ** the special marker. - ** - ** Note that a locknull resource has already inherited all of the - ** locks from the parent. We do not need to call dav_inherit_locks. - ** - ** NOTE: some lock providers record locks for locknull resources using - ** a different key than for regular resources. this will shift - ** the lock information between the two key types. - */ - (void)(*lockdb->hooks->remove_locknull_state)(lockdb, resource); - - /* - ** There are resources under this one, which are new. We must - ** propagate the locks down to the new resources. - */ - if (depth > 0 && - (err = dav_inherit_locks(r, lockdb, resource, 0)) != NULL) { - /* ### add a higher level desc? */ - return err; - } - } - else if (resource_state == DAV_RESOURCE_NULL) { - - /* ### should pass depth to dav_inherit_locks so that it can - ** ### optimize for the depth==0 case. - */ - - /* this resource should inherit locks from its parent */ - if ((err = dav_inherit_locks(r, lockdb, resource, 1)) != NULL) { - - err = dav_push_error(r->pool, err->status, 0, - "The resource was created successfully, but " - "there was a problem inheriting locks from " - "the parent resource.", - err); - return err; - } - } - /* else the resource already exists and its locks are correct. */ - - return NULL; -} diff --git a/modules/echo/.cvsignore b/modules/echo/.cvsignore deleted file mode 100644 index f2f7a70d2c9528e7ef84cf1b3bf9ff721fa08b08..0000000000000000000000000000000000000000 --- a/modules/echo/.cvsignore +++ /dev/null @@ -1,10 +0,0 @@ -.deps -.libs -*.la -modules.mk -Makefile -*.lo -*.slo -*.so -*.dll -*.def diff --git a/modules/echo/.indent.pro b/modules/echo/.indent.pro deleted file mode 100644 index a9fbe9f9a1f2e6e7bcc54171c215bdacd44171ba..0000000000000000000000000000000000000000 --- a/modules/echo/.indent.pro +++ /dev/null @@ -1,54 +0,0 @@ --i4 -npsl -di0 -br -nce -d0 -cli0 -npcs -nfc1 --TBUFF --TFILE --TTRANS --TUINT4 --T_trans --Tallow_options_t --Tapache_sfio --Tarray_header --Tbool_int --Tbuf_area --Tbuff_struct --Tbuffy --Tcmd_how --Tcmd_parms --Tcommand_rec --Tcommand_struct --Tconn_rec --Tcore_dir_config --Tcore_server_config --Tdir_maker_func --Tevent --Tglobals_s --Thandler_func --Thandler_rec --Tjoblist_s --Tlisten_rec --Tmerger_func --Tmode_t --Tmodule --Tmodule_struct --Tmutex --Tn_long --Tother_child_rec --Toverrides_t --Tparent_score --Tpid_t --Tpiped_log --Tpool --Trequest_rec --Trequire_line --Trlim_t --Tscoreboard --Tsemaphore --Tserver_addr_rec --Tserver_rec --Tserver_rec_chain --Tshort_score --Ttable --Ttable_entry --Tthread --Tu_wide_int --Tvtime_t --Twide_int diff --git a/modules/echo/Makefile.in b/modules/echo/Makefile.in deleted file mode 100644 index 167b343d0db75f7876a55cef1681570eba813202..0000000000000000000000000000000000000000 --- a/modules/echo/Makefile.in +++ /dev/null @@ -1,3 +0,0 @@ - -include $(top_srcdir)/build/special.mk - diff --git a/modules/echo/NWGNUmakefile b/modules/echo/NWGNUmakefile deleted file mode 100644 index afc37342846530e0f449fb0f9a21050cd66efb9d..0000000000000000000000000000000000000000 --- a/modules/echo/NWGNUmakefile +++ /dev/null @@ -1,261 +0,0 @@ -# -# Declare the sub-directories to be built here -# - -SUBDIRS = \ - $(EOLIST) - -# -# Get the 'head' of the build environment. This includes default targets and -# paths to tools -# - -include $(AP_WORK)\build\NWGNUhead.inc - -# -# build this level's files - -# -# Make sure all needed macro's are defined -# - -# -# These directories will be at the beginning of the include list, followed by -# INCDIRS -# -XINCDIRS += \ - $(AP_WORK)/include \ - $(NWOS) \ - $(AP_WORK)/modules/arch/netware \ - $(AP_WORK)/srclib/apr/include \ - $(AP_WORK)/srclib/apr-util/include \ - $(AP_WORK)/srclib/apr \ - $(EOLIST) - -# -# These flags will come after CFLAGS -# -XCFLAGS += \ - -prefix pre_nw.h \ - $(EOLIST) - -# -# These defines will come after DEFINES -# -XDEFINES += \ - $(EOLIST) - -# -# These flags will be added to the link.opt file -# -XLFLAGS += \ - $(EOLIST) - -# -# These values will be appended to the correct variables based on the value of -# RELEASE -# -ifeq "$(RELEASE)" "debug" -XINCDIRS += \ - $(EOLIST) - -XCFLAGS += \ - $(EOLIST) - -XDEFINES += \ - $(EOLIST) - -XLFLAGS += \ - $(EOLIST) -endif - -ifeq "$(RELEASE)" "noopt" -XINCDIRS += \ - $(EOLIST) - -XCFLAGS += \ - $(EOLIST) - -XDEFINES += \ - $(EOLIST) - -XLFLAGS += \ - $(EOLIST) -endif - -ifeq "$(RELEASE)" "release" -XINCDIRS += \ - $(EOLIST) - -XCFLAGS += \ - $(EOLIST) - -XDEFINES += \ - $(EOLIST) - -XLFLAGS += \ - $(EOLIST) -endif - -# -# These are used by the link target if an NLM is being generated -# This is used by the link 'name' directive to name the nlm. If left blank -# TARGET_nlm (see below) will be used. -# -NLM_NAME = echo - -# -# This is used by the link '-desc ' directive. -# If left blank, NLM_NAME will be used. -# -NLM_DESCRIPTION = Echo Module - -# -# This is used by the '-threadname' directive. If left blank, -# NLM_NAME Thread will be used. -# -NLM_THREAD_NAME = Echo Module - -# -# If this is specified, it will override VERSION value in -# $(AP_WORK)\build\NWGNUenvironment.inc -# -NLM_VERSION = - -# -# If this is specified, it will override the default of 64K -# -NLM_STACK_SIZE = 8192 - - -# -# If this is specified it will be used by the link '-entry' directive -# -NLM_ENTRY_SYM = _LibCPrelude - -# -# If this is specified it will be used by the link '-exit' directive -# -NLM_EXIT_SYM = _LibCPostlude - -# -# If this is specified it will be used by the link '-check' directive -# -NLM_CHECK_SYM = - -# -# If these are specified it will be used by the link '-flags' directive -# -NLM_FLAGS = AUTOUNLOAD, PSEUDOPREEMPTION - -# -# If this is specified it will be linked in with the XDCData option in the def -# file instead of the default of $(NWOS)/apache.xdc. XDCData can be disabled -# by setting APACHE_UNIPROC in the environment -# -XDCDATA = - -# -# If there is an NLM target, put it here -# -TARGET_nlm = \ - $(OBJDIR)/echo.nlm \ - $(EOLIST) - -# -# If there is an LIB target, put it here -# -TARGET_lib = \ - $(EOLIST) - -# -# These are the OBJ files needed to create the NLM target above. -# Paths must all use the '/' character -# -FILES_nlm_objs = \ - $(OBJDIR)/mod_echo.o \ - $(EOLIST) - -# -# These are the LIB files needed to create the NLM target above. -# These will be added as a library command in the link.opt file. -# -FILES_nlm_libs = \ - libcpre.o \ - $(EOLIST) - -# -# These are the modules that the above NLM target depends on to load. -# These will be added as a module command in the link.opt file. -# -FILES_nlm_modules = \ - aprlib \ - libc \ - $(EOLIST) - -# -# If the nlm has a msg file, put it's path here -# -FILE_nlm_msg = - -# -# If the nlm has a hlp file put it's path here -# -FILE_nlm_hlp = - -# -# If this is specified, it will override $(NWOS)\copyright.txt. -# -FILE_nlm_copyright = - -# -# Any additional imports go here -# -FILES_nlm_Ximports = \ - @$(APR)/aprlib.imp \ - @$(NWOS)/httpd.imp \ - @libc.imp \ - $(EOLIST) - -# -# Any symbols exported to here -# -FILES_nlm_exports = \ - echo_module \ - $(EOLIST) - -# -# These are the OBJ files needed to create the LIB target above. -# Paths must all use the '/' character -# -FILES_lib_objs = \ - $(EOLIST) - -# -# implement targets and dependancies (leave this section alone) -# - -libs :: $(OBJDIR) $(TARGET_lib) - -nlms :: libs $(TARGET_nlm) - -# -# Updated this target to create necessary directories and copy files to the -# correct place. (See $(AP_WORK)\build\NWGNUhead.inc for examples) -# -install :: nlms FORCE - copy $(OBJDIR)\*.nlm $(INSTALL)\Apache2\modules\*.* - -# -# Any specialized rules here -# - -# -# Include the 'tail' makefile that has targets that depend on variables defined -# in this makefile -# - -include $(AP_WORK)\build\NWGNUtail.inc - - - diff --git a/modules/echo/config.m4 b/modules/echo/config.m4 deleted file mode 100644 index 822b0bdfb2c7bd93fa8027d242a50af7d9999ce1..0000000000000000000000000000000000000000 --- a/modules/echo/config.m4 +++ /dev/null @@ -1,18 +0,0 @@ -dnl modules enabled in this directory by default - -dnl AC_DEFUN(modulename, modulestructname, defaultonoroff, configmacros) -dnl XXX - Need to allow --enable-module to fail if optional config fails - -AC_DEFUN(APACHE_CHECK_STANDARD_MODULE, [ - APACHE_MODULE([$1],[$2],,[$3],[$4],[$5]) -]) - -APACHE_MODPATH_INIT(echo) - -APACHE_CHECK_STANDARD_MODULE(echo, ECHO server, , no) - -LTFLAGS="$LTFLAGS -export-dynamic" - -APACHE_MODPATH_FINISH - -APACHE_SUBST(STANDARD_LIBS) diff --git a/modules/echo/mod_echo.c b/modules/echo/mod_echo.c deleted file mode 100644 index 210cfa708d49bc7f9aa18d42249c070195bd951a..0000000000000000000000000000000000000000 --- a/modules/echo/mod_echo.c +++ /dev/null @@ -1,82 +0,0 @@ -#include "httpd.h" -#include "http_config.h" -#include "http_connection.h" - -API_VAR_EXPORT module echo_module; - -typedef struct - { - int bEnabled; - } EchoConfig; - -static void *create_echo_server_config(pool *p,server_rec *s) - { - EchoConfig *pConfig=ap_pcalloc(p,sizeof *pConfig); - - pConfig->bEnabled=0; - - return pConfig; - } - -static const char *echo_on(cmd_parms *cmd, void *dummy, char *arg) - { - EchoConfig *pConfig=ap_get_module_config(cmd->server->module_config, - &echo_module); - pConfig->bEnabled=1; - - return NULL; - } - -static int process_echo_connection(conn_rec *c) - { - char buf[1024]; - EchoConfig *pConfig=ap_get_module_config(c->base_server->module_config, - &echo_module); - - if(!pConfig->bEnabled) - return DECLINED; - - for( ; ; ) - { - int w; - int r=ap_bread(c->client,buf,sizeof buf); - if(r <= 0) - break; - w=ap_bwrite(c->client,buf,r); - if(w != r) - break; - ap_bflush(c->client); - } - return OK; - } - -static const command_rec echo_cmds[] = { -{ "ProtocolEcho", echo_on, NULL, RSRC_CONF, RAW_ARGS, - "Run an echo server on this host" }, -{ NULL } -}; - -static void register_hooks() - { - ap_hook_process_connection(process_echo_connection,NULL,NULL,HOOK_MIDDLE); - } - -API_VAR_EXPORT module echo_module = { - STANDARD20_MODULE_STUFF, - NULL, /* pre_command_line */ - NULL, /* pre_config */ - NULL, /* post_config */ - NULL, /* open_logs */ - NULL, /* child_init */ - NULL, /* create per-directory config structure */ - NULL, /* merge per-directory config structures */ - create_echo_server_config, /* create per-server config structure */ - NULL, /* merge per-server config structures */ - echo_cmds, /* command table */ - NULL, /* handlers */ - NULL, /* check auth */ - NULL, /* check access */ - NULL, /* type_checker */ - NULL, /* pre-run fixups */ - register_hooks /* register hooks */ -}; diff --git a/modules/experimental/.cvsignore b/modules/experimental/.cvsignore deleted file mode 100644 index 8b4c6e3da420bce04859c68624df9b0c5e693224..0000000000000000000000000000000000000000 --- a/modules/experimental/.cvsignore +++ /dev/null @@ -1,3 +0,0 @@ -Makefile -*.lo -*.so diff --git a/modules/experimental/.indent.pro b/modules/experimental/.indent.pro deleted file mode 100644 index a9fbe9f9a1f2e6e7bcc54171c215bdacd44171ba..0000000000000000000000000000000000000000 --- a/modules/experimental/.indent.pro +++ /dev/null @@ -1,54 +0,0 @@ --i4 -npsl -di0 -br -nce -d0 -cli0 -npcs -nfc1 --TBUFF --TFILE --TTRANS --TUINT4 --T_trans --Tallow_options_t --Tapache_sfio --Tarray_header --Tbool_int --Tbuf_area --Tbuff_struct --Tbuffy --Tcmd_how --Tcmd_parms --Tcommand_rec --Tcommand_struct --Tconn_rec --Tcore_dir_config --Tcore_server_config --Tdir_maker_func --Tevent --Tglobals_s --Thandler_func --Thandler_rec --Tjoblist_s --Tlisten_rec --Tmerger_func --Tmode_t --Tmodule --Tmodule_struct --Tmutex --Tn_long --Tother_child_rec --Toverrides_t --Tparent_score --Tpid_t --Tpiped_log --Tpool --Trequest_rec --Trequire_line --Trlim_t --Tscoreboard --Tsemaphore --Tserver_addr_rec --Tserver_rec --Tserver_rec_chain --Tshort_score --Ttable --Ttable_entry --Tthread --Tu_wide_int --Tvtime_t --Twide_int diff --git a/modules/experimental/Makefile.in b/modules/experimental/Makefile.in deleted file mode 100644 index 7c5c149d852ad309f0cd958ac3e84c3cb5b72dc9..0000000000000000000000000000000000000000 --- a/modules/experimental/Makefile.in +++ /dev/null @@ -1,3 +0,0 @@ -# a modules Makefile has no explicit targets -- they will be defined by -# whatever modules are enabled. just grab special.mk to deal with this. -include $(top_srcdir)/build/special.mk diff --git a/modules/experimental/README b/modules/experimental/README deleted file mode 100644 index 77abc097c00741312541a250c0cf058aac28235c..0000000000000000000000000000000000000000 --- a/modules/experimental/README +++ /dev/null @@ -1,53 +0,0 @@ -README for Apache 1.2 Example Module -[April, 1997] - -The files in the src/modules/example directory under the Apache -distribution directory tree are provided as an example to those that -wish to write modules that use the Apache API. - -The main file is mod_example.c, which illustrates all the different -callback mechanisms and call syntaces. By no means does an add-on -module need to include routines for all of the callbacks - quite the -contrary! - -The example module is an actual working module. If you link it into -your server, enable the "example-handler" handler for a location, and then -browse to that location, you will see a display of some of the tracing -the example module did as the various callbacks were made. - -To include the example module in your server, follow the steps below: - - 1. Uncomment the "Module example_module" line near the bottom of - the src/Configuration file. If there isn't one, add it; it - should look like this: - - Module example_module modules/example/mod_example.o - - 2. Run the src/Configure script ("cd src; ./Configure"). This will - build the Makefile for the server itself, and update the - src/modules/Makefile for any additional modules you have - requested from beneath that subdirectory. - - 3. Make the server (run "make" in the src directory). - -To add another module of your own: - - A. mkdir src/modules/mymodule - B. cp src/modules/example/* src/modules/mymodule - C. Modify the files in the new directory - D. Follow steps [1] through [3] above, with appropriate changes. - -To activate the example module, include a block similar to the -following in your srm.conf file: - - - SetHandler example-handler - - -As an alternative, you can put the following into a .htaccess file and -then request the file "test.example" from that location: - - AddHandler example-handler .example - -After reloading/restarting your server, you should be able to browse -to this location and see the brief display mentioned earlier. diff --git a/modules/experimental/cache_storage.c b/modules/experimental/cache_storage.c deleted file mode 100644 index 050628dad1e2b8d1c9e34c78aaf30b8ab3304ca7..0000000000000000000000000000000000000000 --- a/modules/experimental/cache_storage.c +++ /dev/null @@ -1,276 +0,0 @@ -/* ==================================================================== - * The Apache Software License, Version 1.1 - * - * Copyright (c) 2000-2001 The Apache Software Foundation. All rights - * reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in - * the documentation and/or other materials provided with the - * distribution. - * - * 3. The end-user documentation included with the redistribution, - * if any, must include the following acknowledgment: - * "This product includes software developed by the - * Apache Software Foundation (http://www.apache.org/)." - * Alternately, this acknowledgment may appear in the software itself, - * if and wherever such third-party acknowledgments normally appear. - * - * 4. The names "Apache" and "Apache Software Foundation" must - * not be used to endorse or promote products derived from this - * software without prior written permission. For written - * permission, please contact apache@apache.org. - * - * 5. Products derived from this software may not be called "Apache", - * nor may "Apache" appear in their name, without prior written - * permission of the Apache Software Foundation. - * - * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED - * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES - * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR - * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF - * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND - * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, - * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT - * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * ==================================================================== - * - * This software consists of voluntary contributions made by many - * individuals on behalf of the Apache Software Foundation. For more - * information on the Apache Software Foundation, please see - * . - * - * Portions of this software are based upon public domain software - * originally written at the National Center for Supercomputing Applications, - * University of Illinois, Urbana-Champaign. - */ - -#define CORE_PRIVATE - -#include "mod_cache.h" - -APR_HOOK_STRUCT( - APR_HOOK_LINK(remove_url) - APR_HOOK_LINK(create_entity) - APR_HOOK_LINK(open_entity) -) - -module AP_MODULE_DECLARE_DATA tcache_module; - -/* -------------------------------------------------------------- */ - -/* - * delete all URL entities from the cache - * - */ -int cache_remove_url(request_rec *r, const char *types, char *url) -{ - const char *next = types; - const char *type; - - /* for each specified cache type, delete the URL */ - while ((type = ap_cache_tokstr(r->pool, next, &next))) { - cache_run_remove_url(type, url); - } - return OK; -} - - -/* - * create a new URL entity in the cache - * - * It is possible to store more than once entity per URL. This - * function will always create a new entity, regardless of whether - * other entities already exist for the same URL. - * - * The size of the entity is provided so that a cache module can - * decide whether or not it wants to cache this particular entity. - * If the size is unknown, a size of -1 should be set. - */ -int cache_create_entity(request_rec *r, const char *types, char *url, apr_size_t size) -{ - cache_handle *h; - const char *next = types; - const char *type; - apr_status_t rv; - cache_request_rec *cache = (cache_request_rec *) ap_get_module_config(r->request_config, - &tcache_module); - - /* for each specified cache type, delete the URL */ - while (next) { - type = ap_cache_tokstr(r->pool, next, &next); - switch (rv = cache_run_create_entity(&h, type, url, size)) { - case OK: { - cache->handle = h; - return OK; - } - case DECLINED: { - continue; - } - default: { - return rv; - } - } - } - return DECLINED; -} - -/* - * remove a specific URL entity from the cache - * - * The specific entity referenced by the cache_handle is removed - * from the cache, and the cache_handle is closed. - */ -int cache_remove_entity(request_rec *r, const char *types, cache_handle *h) -{ - const char *next = types; - const char *type; - - while (next) { - type = ap_cache_tokstr(r->pool, next, &next); - } - return 1; -} - -/* - * select a specific URL entity in the cache - * - * It is possible to store more than one entity per URL. Content - * negotiation is used to select an entity. Once an entity is - * selected, details of it are stored in the per request - * config to save time when serving the request later. - * - * This function returns OK if successful, DECLINED if no - * cached entity fits the bill. - */ -int cache_select_url(request_rec *r, const char *types, char *url) -{ - cache_handle *h; - const char *next = types; - const char *type; - apr_status_t rv; - cache_request_rec *cache = (cache_request_rec *) ap_get_module_config(r->request_config, - &tcache_module); - - /* go through the cache types till we get a match */ - while (next) { - type = ap_cache_tokstr(r->pool, next, &next); - switch ((rv = cache_run_open_entity(&h, type, url))) { - case OK: { - /* cool bananas! */ - cache->handle = h; -/*** loop through returned entities */ -/*** do freshness calculation here */ - cache->fresh = 1; -/*** do content negotiation here */ - return OK; - } - case DECLINED: { - /* try again with next cache type */ - continue; - } - default: { - /* oo-er! an error */ - return rv; - } - } - } - return DECLINED; -} - -apr_status_t cache_write_entity_headers(cache_handle *h, request_rec *r, cache_info *info, - apr_table_t *headers_in, apr_table_t *headers_out) -{ - const char *ct; - - ct = ap_table_get(r->headers_out, "Content-Type"); - info->content_type = ct; - h->write_headers(h, r, info); - return APR_SUCCESS; -} -apr_status_t cache_write_entity_body(cache_handle *h, apr_bucket_brigade *b) -{ - apr_status_t rv = APR_SUCCESS; - if (h->write_body(h, b) != OK) { - } - return rv; -} - -apr_status_t cache_read_entity_headers(cache_handle *h, request_rec *r, - apr_table_t **headers) -{ - cache_info *info; - - /* Be careful to not modify info. */ - h->read_headers(h, r, &info); - - /* Build the header table from info in the info struct */ - *headers = apr_table_make(r->pool, 15); - /* Content-Length */ - if (info->len) - apr_table_set(*headers, "Content-Length", apr_psprintf(r->pool, "%lu", info->len)); - - /* Last-Modified */ - if (info->lastmod) { - } - /* Expires */ - if (info->expire) { - } - if (info->content_type) { - r->content_type = apr_pstrdup(r->pool, info->content_type); - } - /* Date */ - - return APR_SUCCESS; -} -apr_status_t cache_read_entity_body(cache_handle *h, apr_bucket_brigade *b) -{ - h->read_body(h, b); - return APR_SUCCESS; -} - -APR_IMPLEMENT_EXTERNAL_HOOK_RUN_FIRST(cache, CACHE, int, create_entity, - (cache_handle **hp, const char *type, - char *url, apr_size_t len),(hp,type,url,len),DECLINED) -APR_IMPLEMENT_EXTERNAL_HOOK_RUN_FIRST(cache, CACHE, int, open_entity, - (cache_handle **hp, const char *type, - char *url),(hp,type,url),DECLINED) -APR_IMPLEMENT_EXTERNAL_HOOK_RUN_ALL(cache, CACHE, int, remove_url, - (const char *type, char *url),(type,url),OK,DECLINED) -#if 0 -/* BillS doesn't think these should be hooks. - * All functions which accept a cache_handle * argument should use - * function pointers in the cache_handle. Leave them here for now as - * points for discussion... - */ - -APR_IMPLEMENT_EXTERNAL_HOOK_RUN_FIRST(cache, CACHE, int, remove_entity, - (cache_handle *h),(h),DECLINED) - -APR_IMPLEMENT_EXTERNAL_HOOK_RUN_FIRST(cache, CACHE, int, read_entity_headers, - (cache_handle *h, request_rec *r, - apr_table_t **headers), - (h,info,headers_in,headers_out),DECLINED) -APR_IMPLEMENT_EXTERNAL_HOOK_RUN_FIRST(cache, CACHE, int, read_entity_body, - (cache_handle *h, - apr_bucket_brigade *out),(h,out),DECLINED) -APR_IMPLEMENT_EXTERNAL_HOOK_RUN_FIRST(cache, CACHE, int, write_entity_headers, - (cache_handle *h, cache_info *info, - apr_table_t *headers_in, - apr_table_t *headers_out), - (h,info,headers_in,headers_out),DECLINED) -APR_IMPLEMENT_EXTERNAL_HOOK_RUN_FIRST(cache, CACHE, int, write_entity_body, - (cache_handle *h, - apr_bucket_brigade *in),(h,in),DECLINED) -#endif diff --git a/modules/experimental/cache_util.c b/modules/experimental/cache_util.c deleted file mode 100644 index cc37aa972c6d8383aa52ab66d4df17e14fdc0401..0000000000000000000000000000000000000000 --- a/modules/experimental/cache_util.c +++ /dev/null @@ -1,206 +0,0 @@ -/* ==================================================================== - * The Apache Software License, Version 1.1 - * - * Copyright (c) 2000-2001 The Apache Software Foundation. All rights - * reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in - * the documentation and/or other materials provided with the - * distribution. - * - * 3. The end-user documentation included with the redistribution, - * if any, must include the following acknowledgment: - * "This product includes software developed by the - * Apache Software Foundation (http://www.apache.org/)." - * Alternately, this acknowledgment may appear in the software itself, - * if and wherever such third-party acknowledgments normally appear. - * - * 4. The names "Apache" and "Apache Software Foundation" must - * not be used to endorse or promote products derived from this - * software without prior written permission. For written - * permission, please contact apache@apache.org. - * - * 5. Products derived from this software may not be called "Apache", - * nor may "Apache" appear in their name, without prior written - * permission of the Apache Software Foundation. - * - * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED - * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES - * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR - * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF - * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND - * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, - * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT - * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * ==================================================================== - * - * This software consists of voluntary contributions made by many - * individuals on behalf of the Apache Software Foundation. For more - * information on the Apache Software Foundation, please see - * . - * - * Portions of this software are based upon public domain software - * originally written at the National Center for Supercomputing Applications, - * University of Illinois, Urbana-Champaign. - */ - -#define CORE_PRIVATE - -#include "mod_cache.h" - - - -/* -------------------------------------------------------------- */ - -/* return true if the request is conditional */ -int ap_cache_request_is_conditional(request_rec *r) -{ - if (apr_table_get(r->headers_in, "If-Match") || - apr_table_get(r->headers_in, "If-None-Match") || - apr_table_get(r->headers_in, "If-Modified-Since") || - apr_table_get(r->headers_in, "If-Unmodified-Since")) { - - return 1; - } - return 0; -} - - -/* remove other filters from filter stack */ -void ap_cache_reset_output_filters(request_rec *r) -{ - ap_filter_t *f = r->output_filters; - - while (f) { - if (!strcasecmp(f->frec->name, "CORE") || - !strcasecmp(f->frec->name, "CONTENT_LENGTH") || - !strcasecmp(f->frec->name, "HTTP_HEADER")) { - f = f->next; - continue; - } - else { - ap_remove_output_filter(f); - f = f->next; - } - } -} - -const char *ap_cache_get_cachetype(request_rec *r, cache_server_conf *conf, const char *url) -{ - const char *type = NULL; - int i; - - /* loop through all the cacheenable entries */ - for (i = 0; i < conf->cacheenable->nelts; i++) { - struct cache_enable *ent = (struct cache_enable *) conf->cacheenable->elts; - const char *thisurl = ent[i].url; - const char *thistype = ent[i].type; - if ((thisurl) && !strncasecmp(thisurl, url, strlen(thisurl))) { - if (!type) { - type = thistype; - } - else { - type = apr_pstrcat(r->pool, type, ",", thistype, NULL); - } - } - } - - /* then loop through all the cachedisable entries */ - for (i = 0; i < conf->cachedisable->nelts; i++) { - struct cache_disable *ent = (struct cache_disable *) conf->cachedisable->elts; - const char *thisurl = ent[i].url; - if ((thisurl) && !strncasecmp(thisurl, url, strlen(thisurl))) { - type = NULL; - } - } - - return type; -} - -/* - * list is a comma-separated list of case-insensitive tokens, with - * optional whitespace around the tokens. - * The return returns 1 if the token val is found in the list, or 0 - * otherwise. - */ -int ap_cache_liststr(const char *list, const char *key, char **val) -{ - int len, i; - char *p; - char valbuf[HUGE_STRING_LEN]; - valbuf[sizeof(valbuf)-1] = 0; /* safety terminating zero */ - - len = strlen(key); - - while (list != NULL) { - p = strchr((char *) list, ','); - if (p != NULL) { - i = p - list; - do - p++; - while (ap_isspace(*p)); - } - else - i = strlen(list); - - while (i > 0 && ap_isspace(list[i - 1])) - i--; - if (i == len && strncasecmp(list, key, len) == 0) { - if (val) { - p = strchr((char *) list, ','); - while (ap_isspace(*list)) { - list++; - } - if ('=' == list[0]) - list++; - while (ap_isspace(*list)) { - list++; - } - strncpy(valbuf, list, MIN(p-list, sizeof(valbuf)-1)); - *val = valbuf; - } - return 1; - } - list = p; - } - return 0; -} - -/* return each comma separated token, one at a time */ -const char *ap_cache_tokstr(apr_pool_t *p, const char *list, const char **str) -{ - apr_off_t len, i; - const char *s; - - s = ap_strchr_c(list, ','); - if (s != NULL) { - i = s - list; - do - s++; - while (apr_isspace(*s)); - } - else - i = strlen(list); - - while (i > 0 && apr_isspace(list[i - 1])) - i--; - - *str = s; - if (len) - return apr_pstrndup(p, list, len); - else - return NULL; - -} diff --git a/modules/experimental/config.m4 b/modules/experimental/config.m4 deleted file mode 100644 index 665fc5db742878a2eec59b024188d648cca74521..0000000000000000000000000000000000000000 --- a/modules/experimental/config.m4 +++ /dev/null @@ -1,7 +0,0 @@ - -APACHE_MODPATH_INIT(experimental) - -APACHE_MODULE(mmap_static, memory mapped file caching, , , no) -APACHE_MODULE(charset_lite, character set translation, , , no) - -APACHE_MODPATH_FINISH diff --git a/modules/experimental/mod_auth_ldap.c b/modules/experimental/mod_auth_ldap.c deleted file mode 100644 index 6be891cf172de13e15b2e06bde187515eff87d71..0000000000000000000000000000000000000000 --- a/modules/experimental/mod_auth_ldap.c +++ /dev/null @@ -1,862 +0,0 @@ -/* ==================================================================== - * The Apache Software License, Version 1.1 - * - * Copyright (c) 2000-2001 The Apache Software Foundation. All rights - * reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in - * the documentation and/or other materials provided with the - * distribution. - * - * 3. The end-user documentation included with the redistribution, - * if any, must include the following acknowledgment: - * "This product includes software developed by the - * Apache Software Foundation (http://www.apache.org/)." - * Alternately, this acknowledgment may appear in the software itself, - * if and wherever such third-party acknowledgments normally appear. - * - * 4. The names "Apache" and "Apache Software Foundation" must - * not be used to endorse or promote products derived from this - * software without prior written permission. For written - * permission, please contact apache@apache.org. - * - * 5. Products derived from this software may not be called "Apache", - * nor may "Apache" appear in their name, without prior written - * permission of the Apache Software Foundation. - * - * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED - * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES - * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR - * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF - * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND - * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, - * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT - * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * ==================================================================== - * - * This software consists of voluntary contributions made by many - * individuals on behalf of the Apache Software Foundation. For more - * information on the Apache Software Foundation, please see - * . - */ - -/* - * mod_auth_ldap.c: LDAP authentication module - * - * Original code from auth_ldap module for Apache v1.3: - * Copyright 1998, 1999 Enbridge Pipelines Inc. - * Copyright 1999-2001 Dave Carrigan - */ - -#include -#include - -#include "ap_config.h" -#if APR_HAVE_UNISTD_H -/* for getpid() */ -#include -#endif -#include - -#include "httpd.h" -#include "http_config.h" -#include "http_core.h" -#include "http_log.h" -#include "http_protocol.h" -#include "http_request.h" -#include "util_ldap.h" - -/* per directory configuration */ -typedef struct { - apr_pool_t *pool; /* Pool that this config is allocated from */ - apr_lock_t *lock; /* Lock for this config */ - int auth_authoritative; /* Is this auth method the one and only? */ - int enabled; /* Is auth_ldap enabled in this directory? */ - - /* These parameters are all derived from the AuthLDAPURL directive */ - char *url; /* String representation of the URL */ - - char *host; /* Name of the LDAP server (or space separated list) */ - int port; /* Port of the LDAP server */ - char *basedn; /* Base DN to do all searches from */ - char *attribute; /* Attribute to search for */ - char **attributes; /* Array of all the attributes to return */ - int scope; /* Scope of the search */ - char *filter; /* Filter to further limit the search */ - deref_options deref; /* how to handle alias dereferening */ - char *binddn; /* DN to bind to server (can be NULL) */ - char *bindpw; /* Password to bind to server (can be NULL) */ - - int frontpage_hack; /* Hack for frontpage support */ - int user_is_dn; /* If true, connection->user is DN instead of userid */ - int compare_dn_on_server; /* If true, will use server to do DN compare */ - - int have_ldap_url; /* Set if we have found an LDAP url */ - - apr_array_header_t *groupattr; /* List of Group attributes */ - int group_attrib_is_dn; /* If true, the group attribute is the DN, otherwise, - it's the exact string passed by the HTTP client */ - - int netscapessl; /* True if Netscape SSL is enabled */ - int starttls; /* True if StartTLS is enabled */ -} mod_auth_ldap_config_t; - -typedef struct mod_auth_ldap_request_t { - char *dn; /* The saved dn from a successful search */ - char *user; /* The username provided by the client */ -} mod_auth_ldap_request_t; - -/* maximum group elements supported */ -#define GROUPATTR_MAX_ELTS 10 - -struct mod_auth_ldap_groupattr_entry_t { - char *name; -}; - -module AP_MODULE_DECLARE_DATA auth_ldap_module; - -/* function prototypes */ -void mod_auth_ldap_build_filter(char *filtbuf, - request_rec *r, - mod_auth_ldap_config_t *sec); -int mod_auth_ldap_check_user_id(request_rec *r); -int mod_auth_ldap_auth_checker(request_rec *r); -void *mod_auth_ldap_create_dir_config(apr_pool_t *p, char *d); - -/* ---------------------------------------- */ - - -/* - * Build the search filter, or at least as much of the search filter that - * will fit in the buffer. We don't worry about the buffer not being able - * to hold the entire filter. If the buffer wasn't big enough to hold the - * filter, ldap_search_s will complain, but the only situation where this - * is likely to happen is if the client sent a really, really long - * username, most likely as part of an attack. - * - * The search filter consists of the filter provided with the URL, - * combined with a filter made up of the attribute provided with the URL, - * and the actual username passed by the HTTP client. For example, assume - * that the LDAP URL is - * - * ldap://ldap.airius.com/ou=People, o=Airius?uid??(posixid=*) - * - * Further, assume that the userid passed by the client was `userj'. The - * search filter will be (&(posixid=*)(uid=userj)). - */ -#define FILTER_LENGTH MAX_STRING_LEN -void mod_auth_ldap_build_filter(char *filtbuf, - request_rec *r, - mod_auth_ldap_config_t *sec) -{ - char *p, *q, *filtbuf_end; - /* - * Create the first part of the filter, which consists of the - * config-supplied portions. - */ - apr_snprintf(filtbuf, FILTER_LENGTH, "(&(%s)(%s=", sec->filter, sec->attribute); - - /* - * Now add the client-supplied username to the filter, ensuring that any - * LDAP filter metachars are escaped. - */ - filtbuf_end = filtbuf + FILTER_LENGTH - 1; - for (p = r->user, q=filtbuf + strlen(filtbuf); - *p && q < filtbuf_end; *q++ = *p++) { - if (strchr("*()\\", *p) != NULL) { - *q++ = '\\'; - if (q >= filtbuf_end) { - break; - } - } - } - *q = '\0'; - - /* - * Append the closing parens of the filter, unless doing so would - * overrun the buffer. - */ - if (q + 2 <= filtbuf_end) - strcat(filtbuf, "))"); -} - - -/* - * Authentication Phase - * -------------------- - * - * This phase authenticates the credentials the user has sent with - * the request (ie the username and password are checked). This is done - * by making an attempt to bind to the LDAP server using this user's - * DN and the supplied password. - * - */ -int mod_auth_ldap_check_user_id(request_rec *r) -{ - const char **vals = NULL; - char filtbuf[FILTER_LENGTH]; - mod_auth_ldap_config_t *sec = - (mod_auth_ldap_config_t *)ap_get_module_config(r->per_dir_config, &auth_ldap_module); - - util_ldap_connection_t *ldc = NULL; - const char *sent_pw; - int result = 0; - const char *dn = NULL; - - mod_auth_ldap_request_t *req = - (mod_auth_ldap_request_t *)apr_pcalloc(r->pool, sizeof(mod_auth_ldap_request_t)); - ap_set_module_config(r->request_config, &auth_ldap_module, req); - - if (!sec->enabled) { - return DECLINED; - } - - /* - * Basic sanity checks before any LDAP operations even happen. - */ - if (!sec->have_ldap_url) { - return DECLINED; - } - - /* There is a good AuthLDAPURL, right? */ - if (sec->host) { - ldc = util_ldap_connection_find(r, sec->host, sec->port, - sec->binddn, sec->bindpw, sec->deref, - sec->netscapessl, sec->starttls); - } - else { - ap_log_rerror(APLOG_MARK, APLOG_WARNING|APLOG_NOERRNO, 0, r, - "[%d] auth_ldap authenticate: no sec->host - weird...?", getpid()); - return sec->auth_authoritative? HTTP_UNAUTHORIZED : DECLINED; - } - - ap_log_rerror(APLOG_MARK, APLOG_DEBUG|APLOG_NOERRNO, 0, r, - "[%d] auth_ldap authenticate: using URL %s", getpid(), sec->url); - - /* Get the password that the client sent */ - if ((result = ap_get_basic_auth_pw(r, &sent_pw))) { - ap_log_rerror(APLOG_MARK, APLOG_DEBUG|APLOG_NOERRNO, 0, r, - "[%d] auth_ldap authenticate: " - "ap_get_basic_auth_pw() returns %d", getpid(), result); - util_ldap_connection_close(ldc); - return result; - } - - /* build the username filter */ - mod_auth_ldap_build_filter(filtbuf, r, sec); - - /* do the user search */ - result = util_ldap_cache_checkuserid(r, ldc, sec->url, sec->basedn, sec->scope, - sec->attributes, filtbuf, sent_pw, &dn, &vals); - util_ldap_connection_close(ldc); - - if (result != LDAP_SUCCESS) { - ap_log_rerror(APLOG_MARK, APLOG_WARNING|APLOG_NOERRNO, 0, r, - "[%d] auth_ldap authenticate: " - "user %s authentication failed; URI %s [%s][%s]", - getpid(), r->user, r->uri, ldc->reason, ldap_err2string(result)); - if (LDAP_INVALID_CREDENTIALS == result) { - ap_note_basic_auth_failure(r); - return HTTP_UNAUTHORIZED; - } - else { - return sec->auth_authoritative? HTTP_UNAUTHORIZED: DECLINED; - } - } - - /* mark the user and DN */ - req->dn = apr_pstrdup(r->pool, dn); - req->user = r->user; - if (sec->user_is_dn) { - r->user = req->dn; - } - - /* add environment variables */ - if (sec->attributes && vals) { - apr_table_t *e = r->subprocess_env; - int i = 0; - while (sec->attributes[i]) { - char *str = apr_pstrcat(r->pool, "AUTHENTICATE_", sec->attributes[i], NULL); - int j = 13; - while (str[j]) { - if (str[j] >= 'a' && str[j] <= 'z') { - str[j] = str[j] - ('a' - 'A'); - } - j++; - } - apr_table_setn(e, str, vals[i]); - i++; - } - } - - ap_log_rerror(APLOG_MARK, APLOG_DEBUG|APLOG_NOERRNO, 0, r, - "[%d] auth_ldap authenticate: accepting %s", getpid(), r->user); - - return OK; -} - - -/* - * Authorisation Phase - * ------------------- - * - * After checking whether the username and password are correct, we need - * to check whether that user is authorised to view this resource. The - * require directive is used to do this: - * - * require valid-user Any authenticated is allowed in. - * require user This particular user is allowed in. - * require group The user must be a member of this group - * in order to be allowed in. - * require dn The user must have the following DN in the - * LDAP tree to be let in. - * - */ -int mod_auth_ldap_auth_checker(request_rec *r) -{ - int result = 0; - mod_auth_ldap_request_t *req = - (mod_auth_ldap_request_t *)ap_get_module_config(r->request_config, - &auth_ldap_module); - mod_auth_ldap_config_t *sec = - (mod_auth_ldap_config_t *)ap_get_module_config(r->per_dir_config, - &auth_ldap_module); - - util_ldap_connection_t *ldc = NULL; - int m = r->method_number; - - const apr_array_header_t *reqs_arr = ap_requires(r); - require_line *reqs = reqs_arr ? (require_line *)reqs_arr->elts : NULL; - - register int x; - const char *t; - char *w; - int method_restricted = 0; - - if (!sec->enabled) { - return DECLINED; - } - - if (!sec->have_ldap_url) { - return DECLINED; - } - - if (sec->host) { - ldc = util_ldap_connection_find(r, sec->host, sec->port, - sec->binddn, sec->bindpw, sec->deref, - sec->netscapessl, sec->starttls); - } - else { - ap_log_rerror(APLOG_MARK, APLOG_WARNING|APLOG_NOERRNO, 0, r, - "[%d] auth_ldap authorise: no sec->host - weird...?", getpid()); - return sec->auth_authoritative? HTTP_UNAUTHORIZED : DECLINED; - } - - /* - * If there are no elements in the group attribute array, the default should be - * member and uniquemember; populate the array now. - */ - if (sec->groupattr->nelts == 0) { - struct mod_auth_ldap_groupattr_entry_t *grp; - apr_lock_acquire(sec->lock); - grp = apr_array_push(sec->groupattr); - grp->name = "member"; - grp = apr_array_push(sec->groupattr); - grp->name = "uniquemember"; - apr_lock_release(sec->lock); - } - - if (!reqs_arr) { - ap_log_rerror(APLOG_MARK, APLOG_DEBUG|APLOG_NOERRNO, 0, r, - "[%d] auth_ldap authorise: no requirements array", getpid()); - return sec->auth_authoritative? HTTP_UNAUTHORIZED : DECLINED; - } - - /* Loop through the requirements array until there's no elements - * left, or something causes a return from inside the loop */ - for(x=0; x < reqs_arr->nelts; x++) { - if (! (reqs[x].method_mask & (1 << m))) { - continue; - } - method_restricted = 1; - - t = reqs[x].requirement; - w = ap_getword(r->pool, &t, ' '); - - if (strcmp(w, "valid-user") == 0) { - /* - * Valid user will always be true if we authenticated with ldap, - * but when using front page, valid user should only be true if - * he exists in the frontpage password file. This hack will get - * auth_ldap to look up the user in the the pw file to really be - * sure that he's valid. Naturally, it requires mod_auth to be - * compiled in, but if mod_auth wasn't in there, then the need - * for this hack wouldn't exist anyway. - */ - if (sec->frontpage_hack) { - ap_log_rerror(APLOG_MARK, APLOG_DEBUG|APLOG_NOERRNO, 0, r, - "[%d] auth_ldap authorise: " - "deferring authorisation to mod_auth (FP Hack)", - getpid()); - return OK; - } - else { - ap_log_rerror(APLOG_MARK, APLOG_DEBUG|APLOG_NOERRNO, 0, r, - "[%d] auth_ldap authorise: " - "successful authorisation because user " - "is valid-user", getpid()); - return OK; - } - } - else if (strcmp(w, "user") == 0) { - if (req->dn == NULL || strlen(req->dn) == 0) { - ap_log_rerror(APLOG_MARK, APLOG_DEBUG|APLOG_NOERRNO, 0, r, - "[%d] auth_ldap authorise: " - "require user: user's DN has not been defined; failing authorisation", - getpid()); - return sec->auth_authoritative? HTTP_UNAUTHORIZED : DECLINED; - } - /* - * First do a whole-line compare, in case it's something like - * require user Babs Jensen - */ - result = util_ldap_cache_compare(r, ldc, sec->url, req->dn, sec->attribute, t); - switch(result) { - case LDAP_COMPARE_TRUE: { - ap_log_rerror(APLOG_MARK, APLOG_DEBUG|APLOG_NOERRNO, 0, r, - "[%d] auth_ldap authorise: " - "require user: authorisation successful", getpid()); - return OK; - } - default: { - ap_log_rerror(APLOG_MARK, APLOG_DEBUG|APLOG_NOERRNO, 0, r, - "[%d] auth_ldap authorise: require user: " - "authorisation failed [%s][%s]", getpid(), - ldc->reason, ldap_err2string(result)); - } - } - /* - * Now break apart the line and compare each word on it - */ - while (t[0]) { - w = ap_getword_conf(r->pool, &t); - result = util_ldap_cache_compare(r, ldc, sec->url, req->dn, sec->attribute, w); - switch(result) { - case LDAP_COMPARE_TRUE: { - ap_log_rerror(APLOG_MARK, APLOG_DEBUG|APLOG_NOERRNO, 0, r, - "[%d] auth_ldap authorise: " - "require user: authorisation successful", getpid()); - return OK; - } - default: { - ap_log_rerror(APLOG_MARK, APLOG_DEBUG|APLOG_NOERRNO, 0, r, - "[%d] auth_ldap authorise: " - "require user: authorisation failed [%s][%s]", - getpid(), ldc->reason, ldap_err2string(result)); - } - } - } - } - else if (strcmp(w, "dn") == 0) { - if (req->dn == NULL || strlen(req->dn) == 0) { - ap_log_rerror(APLOG_MARK, APLOG_DEBUG|APLOG_NOERRNO, 0, r, - "[%d] auth_ldap authorise: " - "require dn: user's DN has not been defined; failing authorisation", - getpid()); - return sec->auth_authoritative? HTTP_UNAUTHORIZED : DECLINED; - } - - result = util_ldap_cache_comparedn(r, ldc, sec->url, req->dn, t, sec->compare_dn_on_server); - switch(result) { - case LDAP_COMPARE_TRUE: { - ap_log_rerror(APLOG_MARK, APLOG_DEBUG|APLOG_NOERRNO, 0, r, - "[%d] auth_ldap authorise: " - "require dn: authorisation successful", getpid()); - return OK; - } - default: { - ap_log_rerror(APLOG_MARK, APLOG_DEBUG|APLOG_NOERRNO, 0, r, - "[%d] auth_ldap authorise: " - "require dn: LDAP error [%s][%s]", - getpid(), ldc->reason, ldap_err2string(result)); - } - } - } - else if (strcmp(w, "group") == 0) { - struct mod_auth_ldap_groupattr_entry_t *ent = (struct mod_auth_ldap_groupattr_entry_t *) sec->groupattr->elts; - int i; - - if (sec->group_attrib_is_dn) { - if (req->dn == NULL || strlen(req->dn) == 0) { - ap_log_rerror(APLOG_MARK, APLOG_DEBUG|APLOG_NOERRNO, 0, r, - "[%d] auth_ldap authorise: require group: user's DN has not been defined; failing authorisation", - getpid()); - return sec->auth_authoritative? HTTP_UNAUTHORIZED : DECLINED; - } - } - else { - if (req->user == NULL || strlen(req->user) == 0) { - /* We weren't called in the authentication phase, so we didn't have a - * chance to set the user field. Do so now. */ - req->user = r->user; - } - } - - ap_log_rerror(APLOG_MARK, APLOG_DEBUG|APLOG_NOERRNO, 0, r, - "[%d] auth_ldap authorise: require group: testing for group membership in `%s'", - getpid(), t); - - for (i = 0; i < sec->groupattr->nelts; i++) { - ap_log_rerror(APLOG_MARK, APLOG_DEBUG|APLOG_NOERRNO, 0, r, - "[%d] auth_ldap authorise: require group: testing for %s: %s (%s)", getpid(), - ent[i].name, sec->group_attrib_is_dn ? req->dn : req->user, t); - - result = util_ldap_cache_compare(r, ldc, sec->url, t, ent[i].name, - sec->group_attrib_is_dn ? req->dn : req->user); - switch(result) { - case LDAP_COMPARE_TRUE: { - ap_log_rerror(APLOG_MARK, APLOG_DEBUG|APLOG_NOERRNO, 0, r, - "[%d] auth_ldap authorise: require group: " - "authorisation successful (attribute %s) [%s][%s]", - getpid(), ent[i].name, ldc->reason, ldap_err2string(result)); - return OK; - } - default: { - ap_log_rerror(APLOG_MARK, APLOG_DEBUG|APLOG_NOERRNO, 0, r, - "[%d] auth_ldap authorise: require group: " - "authorisation failed [%s][%s]", - getpid(), ldc->reason, ldap_err2string(result)); - } - } - } - } - } - - if (!method_restricted) { - ap_log_rerror(APLOG_MARK, APLOG_DEBUG|APLOG_NOERRNO, 0, r, - "[%d] auth_ldap authorise: agreeing because non-restricted", - getpid()); - return OK; - } - - if (!sec->auth_authoritative) { - ap_log_rerror(APLOG_MARK, APLOG_DEBUG|APLOG_NOERRNO, 0, r, - "[%d] auth_ldap authorise: declining to authorise", getpid()); - return DECLINED; - } - - ap_log_rerror(APLOG_MARK, APLOG_DEBUG|APLOG_NOERRNO, 0, r, - "[%d] auth_ldap authorise: authorisation denied", getpid()); - ap_note_basic_auth_failure (r); - - return HTTP_UNAUTHORIZED; -} - - -/* ---------------------------------------- */ -/* config directives */ - - -void *mod_auth_ldap_create_dir_config(apr_pool_t *p, char *d) -{ - mod_auth_ldap_config_t *sec = - (mod_auth_ldap_config_t *)apr_pcalloc(p, sizeof(mod_auth_ldap_config_t)); - - sec->pool = p; - apr_lock_create(&sec->lock, APR_MUTEX, APR_INTRAPROCESS, NULL, p); - sec->auth_authoritative = 1; - sec->enabled = 1; - sec->groupattr = apr_array_make(p, GROUPATTR_MAX_ELTS, - sizeof(struct mod_auth_ldap_groupattr_entry_t)); - - sec->have_ldap_url = 0; - sec->url = ""; - sec->host = NULL; - sec->binddn = NULL; - sec->bindpw = NULL; - sec->deref = always; - sec->group_attrib_is_dn = 1; - - sec->frontpage_hack = 0; - sec->netscapessl = 0; - sec->starttls = 0; - - sec->user_is_dn = 0; - sec->compare_dn_on_server = 0; - - return sec; -} - -/* - * Use the ldap url parsing routines to break up the ldap url into - * host and port. - */ -static const char *mod_auth_ldap_parse_url(cmd_parms *cmd, - void *config, - const char *url) -{ - int result; - LDAPURLDesc *urld; - - mod_auth_ldap_config_t *sec = config; - - ap_log_error(APLOG_MARK, APLOG_DEBUG|APLOG_NOERRNO, 0, - cmd->server, "[%d] auth_ldap url parse: `%s'", - getpid(), url); - - result = ldap_url_parse(url, &(urld)); - if (result != LDAP_SUCCESS) { - switch (result) { - case LDAP_URL_ERR_NOTLDAP: - return "LDAP URL does not begin with ldap://"; - case LDAP_URL_ERR_NODN: - return "LDAP URL does not have a DN"; - case LDAP_URL_ERR_BADSCOPE: - return "LDAP URL has an invalid scope"; - case LDAP_URL_ERR_MEM: - return "Out of memory parsing LDAP URL"; - default: - return "Could not parse LDAP URL"; - } - } - sec->url = apr_pstrdup(cmd->pool, url); - - ap_log_error(APLOG_MARK, APLOG_DEBUG|APLOG_NOERRNO, 0, - cmd->server, "[%d] auth_ldap url parse: Host: %s", getpid(), urld->lud_host); - ap_log_error(APLOG_MARK, APLOG_DEBUG|APLOG_NOERRNO, 0, - cmd->server, "[%d] auth_ldap url parse: Port: %d", getpid(), urld->lud_port); - ap_log_error(APLOG_MARK, APLOG_DEBUG|APLOG_NOERRNO, 0, - cmd->server, "[%d] auth_ldap url parse: DN: %s", getpid(), urld->lud_dn); - ap_log_error(APLOG_MARK, APLOG_DEBUG|APLOG_NOERRNO, 0, - cmd->server, "[%d] auth_ldap url parse: attrib: %s", getpid(), urld->lud_attrs? urld->lud_attrs[0] : "(null)"); - ap_log_error(APLOG_MARK, APLOG_DEBUG|APLOG_NOERRNO, 0, - cmd->server, "[%d] auth_ldap url parse: scope: %s", getpid(), - (urld->lud_scope == LDAP_SCOPE_SUBTREE? "subtree" : - urld->lud_scope == LDAP_SCOPE_BASE? "base" : - urld->lud_scope == LDAP_SCOPE_ONELEVEL? "onelevel" : "unknown")); - ap_log_error(APLOG_MARK, APLOG_DEBUG|APLOG_NOERRNO, 0, - cmd->server, "[%d] auth_ldap url parse: filter: %s", getpid(), urld->lud_filter); - - /* Set all the values, or at least some sane defaults */ - if (sec->host) { - char *p = apr_palloc(cmd->pool, strlen(sec->host) + strlen(urld->lud_host) + 2); - strcpy(p, urld->lud_host); - strcat(p, " "); - strcat(p, sec->host); - sec->host = p; - } - else { - sec->host = urld->lud_host? apr_pstrdup(cmd->pool, urld->lud_host) : "localhost"; - } - sec->basedn = urld->lud_dn? apr_pstrdup(cmd->pool, urld->lud_dn) : ""; - if (urld->lud_attrs && urld->lud_attrs[0]) { - int i = 1; - while (urld->lud_attrs[i]) { - i++; - } - sec->attributes = apr_pcalloc(cmd->pool, sizeof(char *) * (i+1)); - i = 0; - while (urld->lud_attrs[i]) { - sec->attributes[i] = apr_pstrdup(cmd->pool, urld->lud_attrs[i]); - i++; - } - sec->attribute = sec->attributes[0]; - } - else { - sec->attribute = "uid"; - } - - sec->scope = urld->lud_scope == LDAP_SCOPE_ONELEVEL ? - LDAP_SCOPE_ONELEVEL : LDAP_SCOPE_SUBTREE; - - if (urld->lud_filter) { - if (urld->lud_filter[0] == '(') { - /* - * Get rid of the surrounding parens; later on when generating the - * filter, they'll be put back. - */ - sec->filter = apr_pstrdup(cmd->pool, urld->lud_filter+1); - sec->filter[strlen(sec->filter)-1] = '\0'; - } - else { - sec->filter = apr_pstrdup(cmd->pool, urld->lud_filter); - } - } - else { - sec->filter = "objectclass=*"; - } - if (strncmp(url, "ldaps", 5) == 0) { - ap_log_error(APLOG_MARK, APLOG_DEBUG|APLOG_NOERRNO, 0, - cmd->server, "[%d] auth_ldap parse url: requesting secure LDAP", getpid()); -#ifdef APU_HAS_LDAP_STARTTLS - sec->port = urld->lud_port? urld->lud_port : LDAPS_PORT; - sec->starttls = 1; -#else -#ifdef APU_HAS_LDAP_NETSCAPE_SSL - sec->port = urld->lud_port? urld->lud_port : LDAPS_PORT; - sec->netscapessl = 1; -#else - return "Secure LDAP (ldaps://) not supported. Rebuild APR-Util"; -#endif -#endif - } - else { - ap_log_error(APLOG_MARK, APLOG_DEBUG|APLOG_NOERRNO, 0, - cmd->server, "[%d] auth_ldap parse url: not requesting secure LDAP", getpid()); - sec->netscapessl = 0; - sec->starttls = 0; - sec->port = urld->lud_port? urld->lud_port : LDAP_PORT; - } - - sec->have_ldap_url = 1; - ldap_free_urldesc(urld); - return NULL; -} - -static const char *mod_auth_ldap_set_deref(cmd_parms *cmd, void *config, const char *arg) -{ - mod_auth_ldap_config_t *sec = config; - - if (strcmp(arg, "never") == 0 || strcasecmp(arg, "off") == 0) { - sec->deref = never; - } - else if (strcmp(arg, "searching") == 0) { - sec->deref = searching; - } - else if (strcmp(arg, "finding") == 0) { - sec->deref = finding; - } - else if (strcmp(arg, "always") == 0 || strcasecmp(arg, "on") == 0) { - sec->deref = always; - } - else { - return "Unrecognized value for AuthLDAPAliasDereference directive"; - } - return NULL; -} - -static const char *mod_auth_ldap_add_group_attribute(cmd_parms *cmd, void *config, const char *arg) -{ - struct mod_auth_ldap_groupattr_entry_t *new; - - mod_auth_ldap_config_t *sec = config; - - if (sec->groupattr->nelts > GROUPATTR_MAX_ELTS) - return "Too many AuthLDAPGroupAttribute directives"; - - new = apr_array_push(sec->groupattr); - new->name = apr_pstrdup(cmd->pool, arg); - - return NULL; -} - -command_rec mod_auth_ldap_cmds[] = { - AP_INIT_TAKE1("AuthLDAPURL", mod_auth_ldap_parse_url, NULL, OR_AUTHCFG, - "URL to define LDAP connection. This should be an RFC 2255 complaint\n" - "URL of the form ldap://host[:port]/basedn[?attrib[?scope[?filter]]].\n" - "
      \n" - "
    • Host is the name of the LDAP server. Use a space separated list of hosts \n" - "to specify redundant servers.\n" - "
    • Port is optional, and specifies the port to connect to.\n" - "
    • basedn specifies the base DN to start searches from\n" - "
    • Attrib specifies what attribute to search for in the directory. If not " - "provided, it defaults to uid.\n" - "
    • Scope is the scope of the search, and can be either sub or " - "one. If not provided, the default is sub.\n" - "
    • Filter is a filter to use in the search. If not provided, " - "defaults to (objectClass=*).\n" - "
    \n" - "Searches are performed using the attribute and the filter combined. " - "For example, assume that the\n" - "LDAP URL is ldap://ldap.airius.com/ou=People, o=Airius?uid?sub?(posixid=*). " - "Searches will\n" - "be done using the filter (&((posixid=*))(uid=username)), " - "where username\n" - "is the user name passed by the HTTP client. The search will be a subtree " - "search on the branch ou=People, o=Airius."), - - AP_INIT_TAKE1("AuthLDAPBindDN", ap_set_string_slot, - (void *)APR_XtOffsetOf(mod_auth_ldap_config_t, binddn), OR_AUTHCFG, - "DN to use to bind to LDAP server. If not provided, will do an anonymous bind."), - - AP_INIT_TAKE1("AuthLDAPBindPassword", ap_set_string_slot, - (void *)APR_XtOffsetOf(mod_auth_ldap_config_t, bindpw), OR_AUTHCFG, - "Password to use to bind to LDAP server. If not provided, will do an anonymous bind."), - - AP_INIT_FLAG("AuthLDAPRemoteUserIsDN", ap_set_flag_slot, - (void *)APR_XtOffsetOf(mod_auth_ldap_config_t, user_is_dn), OR_AUTHCFG, - "Set to 'on' to set the REMOTE_USER environment variable to be the full " - "DN of the remote user. By default, this is set to off, meaning that " - "the REMOTE_USER variable will contain whatever value the remote user sent."), - - AP_INIT_FLAG("AuthLDAPAuthoritative", ap_set_flag_slot, - (void *)APR_XtOffsetOf(mod_auth_ldap_config_t, auth_authoritative), OR_AUTHCFG, - "Set to 'off' to allow access control to be passed along to lower modules if " - "the UserID and/or group is not known to this module"), - - AP_INIT_FLAG("AuthLDAPCompareDNOnServer", ap_set_flag_slot, - (void *)APR_XtOffsetOf(mod_auth_ldap_config_t, compare_dn_on_server), OR_AUTHCFG, - "Set to 'on' to force auth_ldap to do DN compares (for the \"require dn\" " - "directive) using the server, and set it 'off' to do the compares locally " - "(at the expense of possible false matches). See the documentation for " - "a complete description of this option."), - - AP_INIT_ITERATE("AuthLDAPGroupAttribute", mod_auth_ldap_add_group_attribute, NULL, OR_AUTHCFG, - "A list of attributes used to define group membership - defaults to " - "member and uniquemember"), - - AP_INIT_FLAG("AuthLDAPGroupAttributeIsDN", ap_set_flag_slot, - (void *)APR_XtOffsetOf(mod_auth_ldap_config_t, group_attrib_is_dn), OR_AUTHCFG, - "If set to 'on', auth_ldap uses the DN that is retrieved from the server for" - "subsequent group comparisons. If set to 'off', auth_ldap uses the string" - "provided by the client directly. Defaults to 'on'."), - - AP_INIT_TAKE1("AuthLDAPDereferenceAliases", mod_auth_ldap_set_deref, NULL, OR_AUTHCFG, - "Determines how aliases are handled during a search. Can bo one of the" - "values \"never\", \"searching\", \"finding\", or \"always\". " - "Defaults to always."), - - AP_INIT_FLAG("AuthLDAPEnabled", ap_set_flag_slot, - (void *)APR_XtOffsetOf(mod_auth_ldap_config_t, enabled), OR_AUTHCFG, - "Set to off to disable auth_ldap, even if it's been enabled in a higher tree"), - - AP_INIT_FLAG("AuthLDAPFrontPageHack", ap_set_flag_slot, - (void *)APR_XtOffsetOf(mod_auth_ldap_config_t, frontpage_hack), OR_AUTHCFG, - "Set to 'on' to support Microsoft FrontPage"), - -#ifdef APU_HAS_LDAP_STARTTLS - AP_INIT_FLAG("AuthLDAPStartTLS", ap_set_flag_slot, - (void *)APR_XtOffsetOf(mod_auth_ldap_config_t, starttls), OR_AUTHCFG, - "Set to 'on' to start TLS after connecting to the LDAP server."), -#endif /* APU_HAS_LDAP_STARTTLS */ - - {NULL} -}; - -static void mod_auth_ldap_register_hooks(apr_pool_t *p) -{ - ap_hook_check_user_id(mod_auth_ldap_check_user_id, NULL, NULL, APR_HOOK_MIDDLE); - ap_hook_auth_checker(mod_auth_ldap_auth_checker, NULL, NULL, APR_HOOK_MIDDLE); -} - -module auth_ldap_module = { - STANDARD20_MODULE_STUFF, - mod_auth_ldap_create_dir_config, /* dir config creater */ - NULL, /* dir merger --- default is to override */ - NULL, /* server config */ - NULL, /* merge server config */ - mod_auth_ldap_cmds, /* command table */ - mod_auth_ldap_register_hooks, /* set up request processing hooks */ -}; diff --git a/modules/experimental/mod_auth_ldap.def b/modules/experimental/mod_auth_ldap.def deleted file mode 100644 index 599636fb4918f3cb39fe05ae762ae691a9e801ab..0000000000000000000000000000000000000000 --- a/modules/experimental/mod_auth_ldap.def +++ /dev/null @@ -1,6 +0,0 @@ -IMPORT util_ldap_connection_find -IMPORT util_ldap_connection_close -IMPORT util_ldap_cache_checkuserid -IMPORT util_ldap_cache_compare -IMPORT util_ldap_cache_comparedn -EXPORT auth_ldap_module diff --git a/modules/experimental/mod_cache.c b/modules/experimental/mod_cache.c deleted file mode 100644 index 003156dc26f9f379dcac07966f1da3b4599dc687..0000000000000000000000000000000000000000 --- a/modules/experimental/mod_cache.c +++ /dev/null @@ -1,130 +0,0 @@ -/* ==================================================================== - * The Apache Software License, Version 1.1 - * - * Copyright (c) 2000 The Apache Software Foundation. All rights - * reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in - * the documentation and/or other materials provided with the - * distribution. - * - * 3. The end-user documentation included with the redistribution, - * if any, must include the following acknowledgment: - * "This product includes software developed by the - * Apache Software Foundation (http://www.apache.org/)." - * Alternately, this acknowledgment may appear in the software itself, - * if and wherever such third-party acknowledgments normally appear. - * - * 4. The names "Apache" and "Apache Software Foundation" must - * not be used to endorse or promote products derived from this - * software without prior written permission. For written - * permission, please contact apache@apache.org. - * - * 5. Products derived from this software may not be called "Apache", - * nor may "Apache" appear in their name, without prior written - * permission of the Apache Software Foundation. - * - * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED - * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES - * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR - * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF - * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND - * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, - * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT - * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * ==================================================================== - * - * This software consists of voluntary contributions made by many - * individuals on behalf of the Apache Software Foundation. For more - * information on the Apache Software Foundation, please see - * . - * - * Portions of this software are based upon public domain software - * originally written at the National Center for Supercomputing Applications, - * University of Illinois, Urbana-Champaign. - */ - -#include "apr_strings.h" -#include "ap_config.h" -#include "util_filter.h" -#include "httpd.h" -#include "http_config.h" -#include "http_request.h" -#include "http_core.h" -#include "http_protocol.h" -#include "http_log.h" -#include "http_main.h" -#include "util_script.h" -#include "http_core.h" -#include "mod_cache.h" -#include "ap_hooks.h" - -module MODULE_VAR_EXPORT cache_module; - -AP_HOOK_STRUCT( - AP_HOOK_LINK(serve_cache) - AP_HOOK_LINK(store_cache) -) - -AP_IMPLEMENT_HOOK_RUN_FIRST(int,serve_cache,(request_rec *r),(r),DECLINED) -AP_IMPLEMENT_HOOK_RUN_FIRST(int,store_cache,(request_rec *r, ap_bucket_brigade *bb, void **cf), - (r, bb, cf),DECLINED) - -static int cache_handler(request_rec *r) -{ - /* I am sure there is common error checking that belongs in this function, - * but I'm not sure what it is. - */ - return ap_run_serve_cache(r); -} - -typedef struct cache_struct { - void *cf; -} cache_struct; - -static int cache_filter(ap_filter_t *f, ap_bucket_brigade *bb) -{ - cache_struct *ctx = f->ctx; - - if (ctx == NULL) { - f->ctx = ctx = apr_pcalloc(f->r->pool, sizeof(*ctx)); - } - - ap_run_store_cache(f->r, bb, &ctx->cf); - ap_pass_brigade(f->next, bb); - return APR_SUCCESS; -} - -static void cache_register_hook(void) -{ - ap_register_output_filter("CACHE", cache_filter, AP_FTYPE_HTTP_HEADER); -} - -static const handler_rec cache_handlers[] = -{ - {"*/*", cache_handler}, - {NULL} -}; - -module MODULE_VAR_EXPORT cache_module = { - STANDARD20_MODULE_STUFF, - NULL, /* create per-directory config structure */ - NULL, /* merge per-directory config structures */ - NULL, /* create per-server config structure */ - NULL, /* merge per-server config structures */ - NULL, /* command apr_table_t */ - cache_handlers, /* handlers */ - cache_register_hook /* register hooks */ -}; diff --git a/modules/experimental/mod_cache.dsp b/modules/experimental/mod_cache.dsp deleted file mode 100644 index f62455d62dd449882d5245cd8dce98da9624eb53..0000000000000000000000000000000000000000 --- a/modules/experimental/mod_cache.dsp +++ /dev/null @@ -1,123 +0,0 @@ -# Microsoft Developer Studio Project File - Name="mod_cache" - Package Owner=<4> -# Microsoft Developer Studio Generated Build File, Format Version 6.00 -# ** DO NOT EDIT ** - -# TARGTYPE "Win32 (x86) Dynamic-Link Library" 0x0102 - -CFG=mod_cache - Win32 Debug -!MESSAGE This is not a valid makefile. To build this project using NMAKE, -!MESSAGE use the Export Makefile command and run -!MESSAGE -!MESSAGE NMAKE /f "mod_cache.mak". -!MESSAGE -!MESSAGE You can specify a configuration when running NMAKE -!MESSAGE by defining the macro CFG on the command line. For example: -!MESSAGE -!MESSAGE NMAKE /f "mod_cache.mak" CFG="mod_cache - Win32 Debug" -!MESSAGE -!MESSAGE Possible choices for configuration are: -!MESSAGE -!MESSAGE "mod_cache - Win32 Release" (based on "Win32 (x86) Dynamic-Link Library") -!MESSAGE "mod_cache - Win32 Debug" (based on "Win32 (x86) Dynamic-Link Library") -!MESSAGE - -# Begin Project -# PROP AllowPerConfigDependencies 0 -# PROP Scc_ProjName "" -# PROP Scc_LocalPath "" -CPP=cl.exe -MTL=midl.exe -RSC=rc.exe - -!IF "$(CFG)" == "mod_cache - Win32 Release" - -# PROP BASE Use_MFC 0 -# PROP BASE Use_Debug_Libraries 0 -# PROP BASE Output_Dir "Release" -# PROP BASE Intermediate_Dir "Release" -# PROP BASE Target_Dir "" -# PROP Use_MFC 0 -# PROP Use_Debug_Libraries 0 -# PROP Output_Dir "Release" -# PROP Intermediate_Dir "Release" -# PROP Ignore_Export_Lib 0 -# PROP Target_Dir "" -# ADD BASE CPP /nologo /MT /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "MOD_CACHE_EXPORTS" /YX /FD /c -# ADD CPP /nologo /MT /W3 /GX /O2 /I "../../srclib/apr-util/include" /I "../../srclib/apr/include" /I "../../include" /I "../../os/win32" /D "NDEBUG" /D "WIN32" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "CACHE_DECLARE_EXPORT" /D "MOD_CACHE_EXPORTS" /YX /FD /c -# ADD BASE MTL /nologo /D "NDEBUG" /mktyplib203 /win32 -# ADD MTL /nologo /D "NDEBUG" /mktyplib203 /win32 -# ADD BASE RSC /l 0x409 /d "NDEBUG" -# ADD RSC /l 0x409 /d "NDEBUG" -BSC32=bscmake.exe -# ADD BASE BSC32 /nologo -# ADD BSC32 /nologo -LINK32=link.exe -# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /machine:I386 -# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /machine:I386 /out:"Release/mod_cache.so" - -!ELSEIF "$(CFG)" == "mod_cache - Win32 Debug" - -# PROP BASE Use_MFC 0 -# PROP BASE Use_Debug_Libraries 1 -# PROP BASE Output_Dir "Debug" -# PROP BASE Intermediate_Dir "Debug" -# PROP BASE Target_Dir "" -# PROP Use_MFC 0 -# PROP Use_Debug_Libraries 1 -# PROP Output_Dir "Debug" -# PROP Intermediate_Dir "Debug" -# PROP Ignore_Export_Lib 0 -# PROP Target_Dir "" -# ADD BASE CPP /nologo /MTd /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "MOD_CACHE_EXPORTS" /YX /FD /GZ /c -# ADD CPP /nologo /MTd /W3 /Gm /GX /ZI /Od /I "../../srclib/apr-util/include" /I "../../srclib/apr/include" /I "../../include" /I "../../os/win32" /D "_DEBUG" /D "WIN32" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "CACHE_DECLARE_EXPORT" /D "MOD_CACHE_EXPORTS" /YX /FD /GZ /c -# ADD BASE MTL /nologo /D "_DEBUG" /mktyplib203 /win32 -# ADD MTL /nologo /D "_DEBUG" /mktyplib203 /win32 -# ADD BASE RSC /l 0x409 /d "_DEBUG" -# ADD RSC /l 0x409 /d "_DEBUG" -BSC32=bscmake.exe -# ADD BASE BSC32 /nologo -# ADD BSC32 /nologo -LINK32=link.exe -# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /debug /machine:I386 /pdbtype:sept -# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /debug /machine:I386 /out:"Debug/mod_cache.so" /pdbtype:sept - -!ENDIF - -# Begin Target - -# Name "mod_cache - Win32 Release" -# Name "mod_cache - Win32 Debug" -# Begin Group "Source Files" - -# PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat" -# Begin Source File - -SOURCE=.\cache_storage.c -# End Source File -# Begin Source File - -SOURCE=.\cache_util.c -# End Source File -# Begin Source File - -SOURCE=.\mod_cache.c -# End Source File -# Begin Source File - -SOURCE=.\mod_mem_cache.c -# End Source File -# End Group -# Begin Group "Header Files" - -# PROP Default_Filter "h;hpp;hxx;hm;inl" -# Begin Source File - -SOURCE=.\mod_cache.h -# End Source File -# End Group -# Begin Group "Resource Files" - -# PROP Default_Filter "ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe" -# End Group -# End Target -# End Project diff --git a/modules/experimental/mod_cache.h b/modules/experimental/mod_cache.h deleted file mode 100644 index 81a4d37512e2873b91505c972c78f54e801dd9e9..0000000000000000000000000000000000000000 --- a/modules/experimental/mod_cache.h +++ /dev/null @@ -1,67 +0,0 @@ -/* ==================================================================== - * The Apache Software License, Version 1.1 - * - * Copyright (c) 2000 The Apache Software Foundation. All rights - * reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in - * the documentation and/or other materials provided with the - * distribution. - * - * 3. The end-user documentation included with the redistribution, - * if any, must include the following acknowledgment: - * "This product includes software developed by the - * Apache Software Foundation (http://www.apache.org/)." - * Alternately, this acknowledgment may appear in the software itself, - * if and wherever such third-party acknowledgments normally appear. - * - * 4. The names "Apache" and "Apache Software Foundation" must - * not be used to endorse or promote products derived from this - * software without prior written permission. For written - * permission, please contact apache@apache.org. - * - * 5. Products derived from this software may not be called "Apache", - * nor may "Apache" appear in their name, without prior written - * permission of the Apache Software Foundation. - * - * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED - * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES - * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR - * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF - * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND - * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, - * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT - * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * ==================================================================== - * - * This software consists of voluntary contributions made by many - * individuals on behalf of the Apache Software Foundation. For more - * information on the Apache Software Foundation, please see - * . - * - * Portions of this software are based upon public domain software - * originally written at the National Center for Supercomputing Applications, - * University of Illinois, Urbana-Champaign. - */ - -#include "ap_buckets.h" -#include "ap_hooks.h" -#include "httpd.h" - -typedef struct cache_funcs cache_funcs; - -AP_DECLARE_HOOK(int,serve_cache,(request_rec *r)); -AP_DECLARE_HOOK(int,store_cache,(request_rec *r, ap_bucket_brigade *bb, void **cf)); - diff --git a/modules/experimental/mod_case_filter.c b/modules/experimental/mod_case_filter.c deleted file mode 100644 index b035594b71145b17e3ccea7134141c2897fd4996..0000000000000000000000000000000000000000 --- a/modules/experimental/mod_case_filter.c +++ /dev/null @@ -1,113 +0,0 @@ -// Ben messing around... - -#include "httpd.h" -#include "http_config.h" -#include "apr_general.h" -#include "util_filter.h" -#include "ap_buckets.h" -#include "http_request.h" - -static const char s_szCaseFilterName[]="CaseFilter"; -module case_filter_module; - -typedef struct - { - int bEnabled; - } CaseFilterConfig; - -static void *CaseFilterCreateServerConfig(apr_pool_t *p,server_rec *s) - { - CaseFilterConfig *pConfig=apr_pcalloc(p,sizeof *pConfig); - - pConfig->bEnabled=0; - - return pConfig; - } - -static void CaseFilterInsertFilter(request_rec *r) - { - CaseFilterConfig *pConfig=ap_get_module_config(r->server->module_config, - &case_filter_module); - - if(!pConfig->bEnabled) - return; - - ap_add_output_filter(s_szCaseFilterName,NULL,r,r->connection); - } - -static apr_status_t CaseFilterOutFilter(ap_filter_t *f, - ap_bucket_brigade *pbbIn) - { - ap_bucket *pbktIn; - ap_bucket_brigade *pbbOut; - - // XXX: is this the most appropriate pool? - pbbOut=ap_brigade_create(f->r->pool); - AP_BRIGADE_FOREACH(pbktIn,pbbIn) - { - const char *data; - apr_size_t len; - char *buf; - apr_size_t n; - ap_bucket *pbktOut; - - if(AP_BUCKET_IS_EOS(pbktIn)) - { - // XXX: why can't I reuse pbktIn??? - ap_bucket *pbktEOS=ap_bucket_create_eos(); - AP_BRIGADE_INSERT_TAIL(pbbOut,pbktEOS); - break; - } - - // read - ap_bucket_read(pbktIn,&data,&len,1); - - // write - buf=apr_palloc(f->r->pool,len); - for(n=0 ; n < len ; ++n) - buf[n]=toupper(data[n]); - - // XXX: should we use a heap bucket instead? Or a transient (in - // which case we need a separate brigade for each bucket)? - pbktOut=ap_bucket_create_pool(buf,len,f->r->pool); - AP_BRIGADE_INSERT_TAIL(pbbOut,pbktOut); - } - - // XXX: is there any advantage to passing a brigade for each bucket? - return ap_pass_brigade(f->next,pbbOut); - } - -static const char *CaseFilterEnable(cmd_parms *cmd, void *dummy, int arg) - { - CaseFilterConfig *pConfig=ap_get_module_config(cmd->server->module_config, - &case_filter_module); - pConfig->bEnabled=arg; - - return NULL; - } - -static const command_rec CaseFilterCmds[] = - { - AP_INIT_FLAG("CaseFilter", CaseFilterEnable, NULL, RSRC_CONF, - "Run a case filter on this host"), - { NULL } - }; - -static void CaseFilterRegisterHooks(void) - { - ap_hook_insert_filter(CaseFilterInsertFilter,NULL,NULL,AP_HOOK_MIDDLE); - ap_register_output_filter(s_szCaseFilterName,CaseFilterOutFilter, - AP_FTYPE_CONTENT); - } - -module case_filter_module = -{ - STANDARD20_MODULE_STUFF, - NULL, - NULL, - CaseFilterCreateServerConfig, - NULL, - CaseFilterCmds, - NULL, - CaseFilterRegisterHooks -}; diff --git a/modules/experimental/mod_case_filter_in.c b/modules/experimental/mod_case_filter_in.c deleted file mode 100644 index e4ab97feab4d727595847884a8d40bde288210a5..0000000000000000000000000000000000000000 --- a/modules/experimental/mod_case_filter_in.c +++ /dev/null @@ -1,131 +0,0 @@ -// Ben messing around some more... - -#include "httpd.h" -#include "http_config.h" -#include "apr_general.h" -#include "util_filter.h" -#include "apr_buckets.h" -#include "http_request.h" - -#include - -static const char s_szCaseFilterName[]="CaseFilter"; -module case_filter_in_module; - -typedef struct -{ - int bEnabled; -} CaseFilterInConfig; - -typedef struct -{ - apr_bucket_brigade *pbbTmp; -} CaseFilterInContext; - -static void *CaseFilterInCreateServerConfig(apr_pool_t *p,server_rec *s) -{ - CaseFilterInConfig *pConfig=apr_pcalloc(p,sizeof *pConfig); - - pConfig->bEnabled=0; - - return pConfig; -} - -static void CaseFilterInInsertFilter(request_rec *r) -{ - CaseFilterInConfig *pConfig=ap_get_module_config(r->server->module_config, - &case_filter_in_module); - CaseFilterInContext *pCtx; - - if(!pConfig->bEnabled) - return; - - pCtx=apr_palloc(r->pool,sizeof *pCtx); - pCtx->pbbTmp=apr_brigade_create(r->pool); - ap_add_input_filter(s_szCaseFilterName,pCtx,r,NULL); -} - -static apr_status_t CaseFilterInFilter(ap_filter_t *f, - apr_bucket_brigade *pbbOut, - ap_input_mode_t eMode,apr_size_t nBytes) -{ - CaseFilterInContext *pCtx=f->ctx; - apr_status_t ret; - - ap_assert(APR_BRIGADE_EMPTY(pCtx->pbbTmp)); - - ret=ap_get_brigade(f->next,pCtx->pbbTmp,eMode,nBytes); - if(eMode == AP_MODE_PEEK || ret != APR_SUCCESS) - return ret; - - while(!APR_BRIGADE_EMPTY(pCtx->pbbTmp)) { - apr_bucket *pbktIn=APR_BRIGADE_FIRST(pCtx->pbbTmp); - apr_bucket *pbktOut; - const char *data; - apr_size_t len; - char *buf; - int n; - - // It is tempting to do this... - //APR_BUCKET_REMOVE(pB); - //APR_BRIGADE_INSERT_TAIL(pbbOut,pB); - // and change the case of the bucket data, but that would be wrong - // for a file or socket buffer, for example... - - if(APR_BUCKET_IS_EOS(pbktIn)) { - APR_BUCKET_REMOVE(pbktIn); - APR_BRIGADE_INSERT_TAIL(pbbOut,pbktIn); - break; - } - - ret=apr_bucket_read(pbktIn,&data,&len,eMode); - if(ret != APR_SUCCESS) - return ret; - - buf=malloc(len); - for(n=0 ; n < len ; ++n) - buf[n]=toupper(data[n]); - - pbktOut=apr_bucket_heap_create(buf,len,0,NULL); - APR_BRIGADE_INSERT_TAIL(pbbOut,pbktOut); - apr_bucket_delete(pbktIn); - } - - return APR_SUCCESS; -} - - -static const char *CaseFilterEnable(cmd_parms *cmd, void *dummy, int arg) - { - CaseFilterInConfig *pConfig - =ap_get_module_config(cmd->server->module_config,&case_filter_in_module); - pConfig->bEnabled=arg; - - return NULL; - } - -static const command_rec CaseFilterInCmds[] = - { - AP_INIT_FLAG("CaseFilterIn", CaseFilterEnable, NULL, RSRC_CONF, - "Run an input case filter on this host"), - { NULL } - }; - - -static void CaseFilterInRegisterHooks(apr_pool_t *p) - { - ap_hook_insert_filter(CaseFilterInInsertFilter,NULL,NULL,APR_HOOK_MIDDLE); - ap_register_input_filter(s_szCaseFilterName,CaseFilterInFilter, - AP_FTYPE_CONTENT); - } - -module case_filter_in_module = -{ - STANDARD20_MODULE_STUFF, - NULL, - NULL, - CaseFilterInCreateServerConfig, - NULL, - CaseFilterInCmds, - CaseFilterInRegisterHooks -}; diff --git a/modules/experimental/mod_charset_lite.c b/modules/experimental/mod_charset_lite.c deleted file mode 100644 index 03eb6d69390a04aba243e5f239a3e1ca2d63b9f5..0000000000000000000000000000000000000000 --- a/modules/experimental/mod_charset_lite.c +++ /dev/null @@ -1,296 +0,0 @@ -/* ==================================================================== - * The Apache Software License, Version 1.1 - * - * Copyright (c) 2000 The Apache Software Foundation. All rights - * reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in - * the documentation and/or other materials provided with the - * distribution. - * - * 3. The end-user documentation included with the redistribution, - * if any, must include the following acknowledgment: - * "This product includes software developed by the - * Apache Software Foundation (http://www.apache.org/)." - * Alternately, this acknowledgment may appear in the software itself, - * if and wherever such third-party acknowledgments normally appear. - * - * 4. The names "Apache" and "Apache Software Foundation" must - * not be used to endorse or promote products derived from this - * software without prior written permission. For written - * permission, please contact apache@apache.org. - * - * 5. Products derived from this software may not be called "Apache", - * nor may "Apache" appear in their name, without prior written - * permission of the Apache Software Foundation. - * - * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED - * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES - * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR - * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF - * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND - * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, - * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT - * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * ==================================================================== - * - * This software consists of voluntary contributions made by many - * individuals on behalf of the Apache Software Foundation. For more - * information on the Apache Software Foundation, please see - * . - * - * Portions of this software are based upon public domain software - * originally written at the National Center for Supercomputing Applications, - * University of Illinois, Urbana-Champaign. - */ - -/* - * simple hokey charset recoding configuration module - * - * See mod_ebcdic and mod_charset for more thought-out examples. This - * one is just so Jeff can learn how a module works and experiment with - * basic character set recoding configuration. - * - * !!!This is an extremely cheap ripoff of mod_charset.c from Russian Apache!!! - */ - -#include -#include - -#include "httpd.h" -#include "http_config.h" -#include "http_core.h" -#include "http_log.h" -#include "http_main.h" -#include "http_protocol.h" -#include "http_request.h" -#include "util_charset.h" - -#ifndef APACHE_XLATE -#error mod_charset_lite cannot work without APACHE_XLATE enabled -#endif - -typedef struct charset_dir_t { - enum {NO_DEBUG = 1, DEBUG} debug; /* whether or not verbose logging is enabled; 0 - means uninitialized */ - const char *charset_source; /* source encoding */ - const char *charset_default; /* how to ship on wire */ -} charset_dir_t; - -module charset_lite_module; - -static void *create_charset_dir_conf(ap_pool_t *p,char *dummy) -{ - return ap_pcalloc(p,sizeof(charset_dir_t)); -} - -static void *merge_charset_dir_conf(ap_pool_t *p, void *basev, void *overridesv) -{ - charset_dir_t *a = (charset_dir_t *)ap_pcalloc (p, sizeof(charset_dir_t)); - charset_dir_t *base = (charset_dir_t *)basev, - *over = (charset_dir_t *)overridesv; - - /* If it is defined in the current container, use it. Otherwise, use the one - * from the enclosing container. - */ - - a->debug = - over->debug ? over->debug : base->debug; - a->charset_default = - over->charset_default ? over->charset_default : base->charset_default; - a->charset_source = - over->charset_source ? over->charset_source : base->charset_source; - return a; -} - -/* CharsetSourceEnc charset - */ -static const char *add_charset_source(cmd_parms *cmd, charset_dir_t *dc, - char *name) -{ - dc->charset_source = name; - return NULL; -} - -/* CharsetDefault charset - */ -static const char *add_charset_default(cmd_parms *cmd, charset_dir_t *dc, - char *name) -{ - dc->charset_default = name; - return NULL; -} - -/* CharsetDefault charset - */ -static const char *add_charset_debug(cmd_parms *cmd, charset_dir_t *dc, int arg) -{ - if (arg) { - dc->debug = DEBUG; - } - else { - dc->debug = NO_DEBUG; - } - - return NULL; -} - -/* find_code_page() is a fixup hook that decides if translation should be - * enabled - */ -static int find_code_page(request_rec *r) -{ - charset_dir_t *dc = ap_get_module_config(r->per_dir_config, &charset_lite_module); - ap_status_t rv; - ap_xlate_t *xlate; - const char *mime_type; - int debug = dc->debug == DEBUG; - - mime_type = r->content_type ? r->content_type : ap_default_type(r); - - if (debug) { - ap_log_error(APLOG_MARK,APLOG_DEBUG|APLOG_NOERRNO, 0, r->server, - "Entering handler, URI: %s FILENAME: %s ARGS: %s PATH_INFO: %s " - "MIMETYPE: %s FLAGS: %d SUBREQ: %s, REDIR: %s, PROXY: %s", - r->uri, r->filename, r->args, r->path_info, mime_type, - r->rrx ? 1 : 0, - r->main?"YES":"NO",r->prev?"YES":"NO", - r->proxyreq ? "YES" : "NO"); - } - - /* catch proxy requests */ - if (r->proxyreq) return DECLINED; - /* mod_rewrite indicators */ - if (!strncmp(r->filename, "redirect:", 9)) return DECLINED; - if (!strncmp(r->filename, "gone:", 5)) return DECLINED; - if (!strncmp(r->filename, "passthrough:", 12)) return DECLINED; - if (!strncmp(r->filename, "forbidden:", 10)) return DECLINED; - - /* If we don't have a full directory configuration, bail out. - */ - if (!dc->charset_source || !dc->charset_default) { - if (debug) { - ap_log_error(APLOG_MARK, APLOG_DEBUG|APLOG_NOERRNO, 0, r->server, - "incomplete configuration: src %s, dst %s", - dc->charset_source ? dc->charset_source : "unspecified", - dc->charset_default ? dc->charset_default : "unspecified"); - } - return DECLINED; - } - - /* If this is a subrequest, bail out. We don't want to be setting up - * translation just because something like mod_autoindex wants to find the - * mime type for directory objects. - * (I won't swear that there aren't cases where we need to process - * subrequests :) ). - */ - if (r->main) { - if (debug) { - ap_log_error(APLOG_MARK, APLOG_DEBUG|APLOG_NOERRNO, 0, r->server, - "skipping subrequest"); - } - return DECLINED; - } - - /* If mime type isn't text or message, bail out. - */ - if (strncasecmp(mime_type, "text/", 5) && - strncasecmp(mime_type, "message/", 8)) { - if (debug) { - ap_log_error(APLOG_MARK, APLOG_DEBUG|APLOG_NOERRNO, 0, r->server, - "mime type is %s; no translation selected", - mime_type); - } - return DECLINED; - } - - if (debug) { - ap_log_error(APLOG_MARK, APLOG_DEBUG|APLOG_NOERRNO, 0, r->server, - "dc: %X charset_source: %s charset_default: %s", - (unsigned)dc, - dc && dc->charset_source ? dc->charset_source : "(none)", - dc && dc->charset_default ? dc->charset_default : "(none)"); - } - - rv = ap_xlate_open(&xlate, dc->charset_default, dc->charset_source, r->pool); - if (rv != APR_SUCCESS) { - ap_log_error(APLOG_MARK, APLOG_ERR, rv, r->server, - "can't open translation %s->%s, error %d\n", - dc->charset_source, dc->charset_default, rv); - return HTTP_INTERNAL_SERVER_ERROR; - } - rv = ap_set_content_xlate(r, 1, xlate); - if (rv != APR_SUCCESS) { - ap_log_error(APLOG_MARK, APLOG_ERR, rv, r->server, - "can't set content translation, error %d\n", rv); - return HTTP_INTERNAL_SERVER_ERROR; - } - - rv = ap_bsetopt(r->connection->client, BO_WXLATE, &r->rrx->to_net); - if (rv != APR_SUCCESS) { - ap_log_error(APLOG_MARK, APLOG_ERR, rv, r->server, - "can't set translation; BO_WXLATE->%d\n", rv); - return HTTP_INTERNAL_SERVER_ERROR; - } - - return DECLINED; -} - -static const command_rec cmds[] = -{ - { - "CharsetSourceEnc", - add_charset_source, - NULL, - OR_FILEINFO, - TAKE1, - "source (html,cgi,ssi) file charset" - }, - { - "CharsetDefault", - add_charset_default, - NULL, - OR_FILEINFO, - TAKE1, - "name of default charset" - }, - { - "CharsetDebug", - add_charset_debug, - NULL, - OR_FILEINFO, - FLAG, - "mod_charset_lite debug flag" - }, - {NULL} -}; - -static void register_hooks(void) -{ - ap_hook_fixups(find_code_page, NULL, NULL, AP_HOOK_MIDDLE); -} - -module charset_lite_module = -{ - STANDARD20_MODULE_STUFF, - create_charset_dir_conf, - merge_charset_dir_conf, - NULL, - NULL, - cmds, - NULL, - register_hooks, -}; - diff --git a/modules/experimental/mod_charset_lite.exp b/modules/experimental/mod_charset_lite.exp deleted file mode 100644 index 3f0bf14b4a13c40f2d796e8f20273135029379fb..0000000000000000000000000000000000000000 --- a/modules/experimental/mod_charset_lite.exp +++ /dev/null @@ -1 +0,0 @@ -charset_lite_module diff --git a/modules/experimental/mod_disk_cache.c b/modules/experimental/mod_disk_cache.c deleted file mode 100644 index f0c916530e828e99ee10caeac6628110784ca9a8..0000000000000000000000000000000000000000 --- a/modules/experimental/mod_disk_cache.c +++ /dev/null @@ -1,171 +0,0 @@ -/* ==================================================================== - * The Apache Software License, Version 1.1 - * - * Copyright (c) 2000 The Apache Software Foundation. All rights - * reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in - * the documentation and/or other materials provided with the - * distribution. - * - * 3. The end-user documentation included with the redistribution, - * if any, must include the following acknowledgment: - * "This product includes software developed by the - * Apache Software Foundation (http://www.apache.org/)." - * Alternately, this acknowledgment may appear in the software itself, - * if and wherever such third-party acknowledgments normally appear. - * - * 4. The names "Apache" and "Apache Software Foundation" must - * not be used to endorse or promote products derived from this - * software without prior written permission. For written - * permission, please contact apache@apache.org. - * - * 5. Products derived from this software may not be called "Apache", - * nor may "Apache" appear in their name, without prior written - * permission of the Apache Software Foundation. - * - * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED - * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES - * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR - * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF - * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND - * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, - * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT - * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * ==================================================================== - * - * This software consists of voluntary contributions made by many - * individuals on behalf of the Apache Software Foundation. For more - * information on the Apache Software Foundation, please see - * . - * - * Portions of this software are based upon public domain software - * originally written at the National Center for Supercomputing Applications, - * University of Illinois, Urbana-Champaign. - */ - -#include "mod_cache.h" -#include "apr_file_io.h" -#include "apr_strings.h" -#include "http_config.h" -#include "http_log.h" -#include "util_filter.h" - -module MODULE_VAR_EXPORT disk_cache_module; - -static int disk_serve(request_rec *r) -{ - ap_bucket *e; - ap_bucket_brigade *bb = ap_brigade_create(r->pool); - const char *filename; - apr_file_t *fd = NULL; - apr_status_t rv; - ap_filter_t *f; - char str[256]; - apr_off_t offset = 0; - - filename = ap_server_root_relative(r->pool, - apr_pstrcat(r->pool, "proxy", r->uri, NULL)); - if ((rv = apr_open(&fd, filename, APR_READ, - APR_UREAD, r->connection->pool)) != APR_SUCCESS) { - return DECLINED; - } - - /* skip the cached headers. */ - do { - apr_fgets(str, 256, fd); - offset += strlen(str); - } while (strcmp(str, CRLF)); - - /* If we are serving from the cache, we don't want to try to cache it - * again. - */ - for ((f = r->output_filters); (f = f->next);) { - if (!strcmp(f->frec->name, "CACHE")) { - ap_remove_output_filter(f); - } - } - - e = ap_bucket_create_file(fd, offset, r->finfo.size); - - AP_BRIGADE_INSERT_HEAD(bb, e); - e = ap_bucket_create_eos(); - AP_BRIGADE_INSERT_TAIL(bb, e); - - ap_pass_brigade(r->output_filters, bb); - return OK; -} - -typedef struct cache_struct { - const char *filename; - apr_file_t *fd; - int state; -} cache_struct; - -static int disk_cache(request_rec *r, ap_bucket_brigade *bb, void **cf) -{ - cache_struct *ctx = *cf; - ap_bucket *e; - - if (ctx == NULL) { - *cf = ctx = apr_pcalloc(r->pool, sizeof(*ctx)); - } - if (ctx->filename == NULL) { - apr_status_t rv; - apr_make_dir(ap_server_root_relative(r->pool, "proxy"), APR_UREAD | APR_UWRITE | APR_UEXECUTE | APR_GREAD | APR_GWRITE, r->pool); - - /* currently, we are using the uri as the cache key. This is - * probably wrong, but it is much better than a hard-coded filename. - */ - ctx->filename = ap_server_root_relative(r->pool, - apr_pstrcat(r->pool, "proxy", r->uri, NULL)); - if ((rv = apr_open(&ctx->fd, ctx->filename, - APR_WRITE | APR_CREATE | APR_TRUNCATE | APR_BUFFERED, - APR_UREAD | APR_UWRITE, r->pool)) != APR_SUCCESS) { - ap_log_rerror(APLOG_MARK, APLOG_ERR, rv, r, - "Could not create cache file"); - *cf = NULL; - return DECLINED; - } - } - AP_BRIGADE_FOREACH(e, bb) { - const char *str; - apr_ssize_t length; - - ap_bucket_read(e, &str, &length, 0); - apr_write(ctx->fd, str, &length); - } - if (AP_BUCKET_IS_EOS(AP_BRIGADE_LAST(bb))) { - apr_close(ctx->fd); - } - return OK; -} - -static void disk_cache_register_hook(void) -{ - ap_hook_store_cache(disk_cache, NULL, NULL, AP_HOOK_MIDDLE); - ap_hook_serve_cache(disk_serve, NULL, NULL, AP_HOOK_MIDDLE); -} - -module MODULE_VAR_EXPORT disk_cache_module = { - STANDARD20_MODULE_STUFF, - NULL, /* create per-directory config structure */ - NULL, /* merge per-directory config structures */ - NULL, /* create per-server config structure */ - NULL, /* merge per-server config structures */ - NULL, /* command apr_table_t */ - NULL, /* handlers */ - disk_cache_register_hook /* register hooks */ -}; diff --git a/modules/experimental/mod_disk_cache.dsp b/modules/experimental/mod_disk_cache.dsp deleted file mode 100644 index c008ffc1ff4fafd77c45e4c61d031d67aeef15c5..0000000000000000000000000000000000000000 --- a/modules/experimental/mod_disk_cache.dsp +++ /dev/null @@ -1,110 +0,0 @@ -# Microsoft Developer Studio Project File - Name="mod_disk_cache" - Package Owner=<4> -# Microsoft Developer Studio Generated Build File, Format Version 6.00 -# ** DO NOT EDIT ** - -# TARGTYPE "Win32 (x86) Dynamic-Link Library" 0x0102 - -CFG=mod_disk_cache - Win32 Debug -!MESSAGE This is not a valid makefile. To build this project using NMAKE, -!MESSAGE use the Export Makefile command and run -!MESSAGE -!MESSAGE NMAKE /f "mod_disk_cache.mak". -!MESSAGE -!MESSAGE You can specify a configuration when running NMAKE -!MESSAGE by defining the macro CFG on the command line. For example: -!MESSAGE -!MESSAGE NMAKE /f "mod_disk_cache.mak" CFG="mod_disk_cache - Win32 Debug" -!MESSAGE -!MESSAGE Possible choices for configuration are: -!MESSAGE -!MESSAGE "mod_disk_cache - Win32 Release" (based on "Win32 (x86) Dynamic-Link Library") -!MESSAGE "mod_disk_cache - Win32 Debug" (based on "Win32 (x86) Dynamic-Link Library") -!MESSAGE - -# Begin Project -# PROP AllowPerConfigDependencies 0 -# PROP Scc_ProjName "" -# PROP Scc_LocalPath "" -CPP=cl.exe -MTL=midl.exe -RSC=rc.exe - -!IF "$(CFG)" == "mod_disk_cache - Win32 Release" - -# PROP BASE Use_MFC 0 -# PROP BASE Use_Debug_Libraries 0 -# PROP BASE Output_Dir "Release" -# PROP BASE Intermediate_Dir "Release" -# PROP BASE Target_Dir "" -# PROP Use_MFC 0 -# PROP Use_Debug_Libraries 0 -# PROP Output_Dir "Release" -# PROP Intermediate_Dir "Release" -# PROP Target_Dir "" -# ADD BASE CPP /nologo /MT /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "MOD_DISK_CACHE_EXPORTS" /YX /FD /c -# ADD CPP /nologo /MT /W3 /GX /O2 /I "../../srclib/apr-util/include" /I "../../srclib/apr/include" /I "../../include" /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "MOD_DISK_CACHE_EXPORTS" /YX /FD /c -# ADD BASE MTL /nologo /D "NDEBUG" /mktyplib203 /win32 -# ADD MTL /nologo /D "NDEBUG" /mktyplib203 /win32 -# ADD BASE RSC /l 0x409 /d "NDEBUG" -# ADD RSC /l 0x409 /d "NDEBUG" -BSC32=bscmake.exe -# ADD BASE BSC32 /nologo -# ADD BSC32 /nologo -LINK32=link.exe -# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /machine:I386 -# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /machine:I386 - -!ELSEIF "$(CFG)" == "mod_disk_cache - Win32 Debug" - -# PROP BASE Use_MFC 0 -# PROP BASE Use_Debug_Libraries 1 -# PROP BASE Output_Dir "Debug" -# PROP BASE Intermediate_Dir "Debug" -# PROP BASE Target_Dir "" -# PROP Use_MFC 0 -# PROP Use_Debug_Libraries 1 -# PROP Output_Dir "Debug" -# PROP Intermediate_Dir "Debug" -# PROP Ignore_Export_Lib 0 -# PROP Target_Dir "" -# ADD BASE CPP /nologo /MTd /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "MOD_DISK_CACHE_EXPORTS" /YX /FD /GZ /c -# ADD CPP /nologo /MTd /W3 /Gm /GX /ZI /Od /I "../../srclib/apr-util/include" /I "../../srclib/apr/include" /I "../../include" /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "MOD_DISK_CACHE_EXPORTS" /YX /FD /GZ /c -# ADD BASE MTL /nologo /D "_DEBUG" /mktyplib203 /win32 -# ADD MTL /nologo /D "_DEBUG" /mktyplib203 /win32 -# ADD BASE RSC /l 0x409 /d "_DEBUG" -# ADD RSC /l 0x409 /d "_DEBUG" -BSC32=bscmake.exe -# ADD BASE BSC32 /nologo -# ADD BSC32 /nologo -LINK32=link.exe -# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /debug /machine:I386 /pdbtype:sept -# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /debug /machine:I386 /pdbtype:sept - -!ENDIF - -# Begin Target - -# Name "mod_disk_cache - Win32 Release" -# Name "mod_disk_cache - Win32 Debug" -# Begin Group "Source Files" - -# PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat" -# Begin Source File - -SOURCE=.\mod_disk_cache.c -# End Source File -# End Group -# Begin Group "Header Files" - -# PROP Default_Filter "h;hpp;hxx;hm;inl" -# Begin Source File - -SOURCE=.\mod_cache.h -# End Source File -# End Group -# Begin Group "Resource Files" - -# PROP Default_Filter "ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe" -# End Group -# End Target -# End Project diff --git a/modules/experimental/mod_example.c b/modules/experimental/mod_example.c deleted file mode 100644 index 68a6b06fe3acbdd78d81721b7554081f01dc13d1..0000000000000000000000000000000000000000 --- a/modules/experimental/mod_example.c +++ /dev/null @@ -1,1149 +0,0 @@ -/* ==================================================================== - * Copyright (c) 1995-1999 The Apache Group. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in - * the documentation and/or other materials provided with the - * distribution. - * - * 3. All advertising materials mentioning features or use of this - * software must display the following acknowledgment: - * "This product includes software developed by the Apache Group - * for use in the Apache HTTP server project (http://www.apache.org/)." - * - * 4. The names "Apache Server" and "Apache Group" must not be used to - * endorse or promote products derived from this software without - * prior written permission. For written permission, please contact - * apache@apache.org. - * - * 5. Products derived from this software may not be called "Apache" - * nor may "Apache" appear in their names without prior written - * permission of the Apache Group. - * - * 6. Redistributions of any form whatsoever must retain the following - * acknowledgment: - * "This product includes software developed by the Apache Group - * for use in the Apache HTTP server project (http://www.apache.org/)." - * - * THIS SOFTWARE IS PROVIDED BY THE APACHE GROUP ``AS IS'' AND ANY - * EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR - * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE APACHE GROUP OR - * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT - * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, - * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED - * OF THE POSSIBILITY OF SUCH DAMAGE. - * ==================================================================== - * - * This software consists of voluntary contributions made by many - * individuals on behalf of the Apache Group and was originally based - * on public domain software written at the National Center for - * Supercomputing Applications, University of Illinois, Urbana-Champaign. - * For more information on the Apache Group and the Apache HTTP server - * project, please see . - * - */ - -/* - * Apache example module. Provide demonstrations of how modules do things. - * - */ - -#include "httpd.h" -#include "http_config.h" -#include "http_core.h" -#include "http_log.h" -#include "http_main.h" -#include "http_protocol.h" -#include "util_script.h" - -#include - -/*--------------------------------------------------------------------------*/ -/* */ -/* Data declarations. */ -/* */ -/* Here are the static cells and structure declarations private to our */ -/* module. */ -/* */ -/*--------------------------------------------------------------------------*/ - -/* - * Sample configuration record. Used for both per-directory and per-server - * configuration data. - * - * It's perfectly reasonable to have two different structures for the two - * different environments. The same command handlers will be called for - * both, though, so the handlers need to be able to tell them apart. One - * possibility is for both structures to start with an int which is zero for - * one and 1 for the other. - * - * Note that while the per-directory and per-server configuration records are - * available to most of the module handlers, they should be treated as - * READ-ONLY by all except the command and merge handlers. Sometimes handlers - * are handed a record that applies to the current location by implication or - * inheritance, and modifying it will change the rules for other locations. - */ -typedef struct excfg { - int cmode; /* Environment to which record applies (directory, - * server, or combination). - */ -#define CONFIG_MODE_SERVER 1 -#define CONFIG_MODE_DIRECTORY 2 -#define CONFIG_MODE_COMBO 3 /* Shouldn't ever happen. */ - int local; /* Boolean: "Example" directive declared here? */ - int congenital; /* Boolean: did we inherit an "Example"? */ - char *trace; /* Pointer to trace string. */ - char *loc; /* Location to which this record applies. */ -} excfg; - -/* - * Let's set up a module-local static cell to point to the accreting callback - * trace. As each API callback is made to us, we'll tack on the particulars - * to whatever we've already recorded. To avoid massive memory bloat as - * directories are walked again and again, we record the routine/environment - * the first time (non-request context only), and ignore subsequent calls for - * the same routine/environment. - */ -static const char *trace = NULL; -static table *static_calls_made = NULL; - -/* - * To avoid leaking memory from pools other than the per-request one, we - * allocate a module-private pool, and then use a sub-pool of that which gets - * freed each time we modify the trace. That way previous layers of trace - * data don't get lost. - */ -static pool *example_pool = NULL; -static pool *example_subpool = NULL; - -/* - * Declare ourselves so the configuration routines can find and know us. - * We'll fill it in at the end of the module. - */ -module example_module; - -/*--------------------------------------------------------------------------*/ -/* */ -/* The following pseudo-prototype declarations illustrate the parameters */ -/* passed to command handlers for the different types of directive */ -/* syntax. If an argument was specified in the directive definition */ -/* (look for "command_rec" below), it's available to the command handler */ -/* via the (void *) info field in the cmd_parms argument passed to the */ -/* handler (cmd->info for the examples below). */ -/* */ -/*--------------------------------------------------------------------------*/ - -/* - * Command handler for a NO_ARGS directive. - * - * static const char *handle_NO_ARGS(cmd_parms *cmd, void *mconfig); - */ - -/* - * Command handler for a RAW_ARGS directive. The "args" argument is the text - * of the commandline following the directive itself. - * - * static const char *handle_RAW_ARGS(cmd_parms *cmd, void *mconfig, - * const char *args); - */ - -/* - * Command handler for a FLAG directive. The single parameter is passed in - * "bool", which is either zero or not for Off or On respectively. - * - * static const char *handle_FLAG(cmd_parms *cmd, void *mconfig, int bool); - */ - -/* - * Command handler for a TAKE1 directive. The single parameter is passed in - * "word1". - * - * static const char *handle_TAKE1(cmd_parms *cmd, void *mconfig, - * char *word1); - */ - -/* - * Command handler for a TAKE2 directive. TAKE2 commands must always have - * exactly two arguments. - * - * static const char *handle_TAKE2(cmd_parms *cmd, void *mconfig, - * char *word1, char *word2); - */ - -/* - * Command handler for a TAKE3 directive. Like TAKE2, these must have exactly - * three arguments, or the parser complains and doesn't bother calling us. - * - * static const char *handle_TAKE3(cmd_parms *cmd, void *mconfig, - * char *word1, char *word2, char *word3); - */ - -/* - * Command handler for a TAKE12 directive. These can take either one or two - * arguments. - * - word2 is a NULL pointer if no second argument was specified. - * - * static const char *handle_TAKE12(cmd_parms *cmd, void *mconfig, - * char *word1, char *word2); - */ - -/* - * Command handler for a TAKE123 directive. A TAKE123 directive can be given, - * as might be expected, one, two, or three arguments. - * - word2 is a NULL pointer if no second argument was specified. - * - word3 is a NULL pointer if no third argument was specified. - * - * static const char *handle_TAKE123(cmd_parms *cmd, void *mconfig, - * char *word1, char *word2, char *word3); - */ - -/* - * Command handler for a TAKE13 directive. Either one or three arguments are - * permitted - no two-parameters-only syntax is allowed. - * - word2 and word3 are NULL pointers if only one argument was specified. - * - * static const char *handle_TAKE13(cmd_parms *cmd, void *mconfig, - * char *word1, char *word2, char *word3); - */ - -/* - * Command handler for a TAKE23 directive. At least two and as many as three - * arguments must be specified. - * - word3 is a NULL pointer if no third argument was specified. - * - * static const char *handle_TAKE23(cmd_parms *cmd, void *mconfig, - * char *word1, char *word2, char *word3); - */ - -/* - * Command handler for a ITERATE directive. - * - Handler is called once for each of n arguments given to the directive. - * - word1 points to each argument in turn. - * - * static const char *handle_ITERATE(cmd_parms *cmd, void *mconfig, - * char *word1); - */ - -/* - * Command handler for a ITERATE2 directive. - * - Handler is called once for each of the second and subsequent arguments - * given to the directive. - * - word1 is the same for each call for a particular directive instance (the - * first argument). - * - word2 points to each of the second and subsequent arguments in turn. - * - * static const char *handle_ITERATE2(cmd_parms *cmd, void *mconfig, - * char *word1, char *word2); - */ - -/*--------------------------------------------------------------------------*/ -/* */ -/* These routines are strictly internal to this module, and support its */ -/* operation. They are not referenced by any external portion of the */ -/* server. */ -/* */ -/*--------------------------------------------------------------------------*/ - -/* - * Locate our directory configuration record for the current request. - */ -static excfg *our_dconfig(request_rec *r) -{ - - return (excfg *) ap_get_module_config(r->per_dir_config, &example_module); -} - -#if 0 -/* - * Locate our server configuration record for the specified server. - */ -static excfg *our_sconfig(server_rec *s) -{ - - return (excfg *) ap_get_module_config(s->module_config, &example_module); -} - -/* - * Likewise for our configuration record for the specified request. - */ -static excfg *our_rconfig(request_rec *r) -{ - - return (excfg *) ap_get_module_config(r->request_config, &example_module); -} -#endif - -/* - * This routine sets up some module-wide cells if they haven't been already. - */ -static void setup_module_cells() -{ - /* - * If we haven't already allocated our module-private pool, do so now. - */ - if (example_pool == NULL) { - example_pool = ap_make_sub_pool(NULL); - }; - /* - * Likewise for the table of routine/environment pairs we visit outside of - * request context. - */ - if (static_calls_made == NULL) { - static_calls_made = ap_make_table(example_pool, 16); - }; -} - -/* - * This routine is used to add a trace of a callback to the list. We're - * passed the server record (if available), the request record (if available), - * a pointer to our private configuration record (if available) for the - * environment to which the callback is supposed to apply, and some text. We - * turn this into a textual representation and add it to the tail of the list. - * The list can be displayed by the example_handler() routine. - * - * If the call occurs within a request context (i.e., we're passed a request - * record), we put the trace into the request pool and attach it to the - * request via the notes mechanism. Otherwise, the trace gets added - * to the static (non-request-specific) list. - * - * Note that the r->notes table is only for storing strings; if you need to - * maintain per-request data of any other type, you need to use another - * mechanism. - */ - -#define TRACE_NOTE "example-trace" - -static void trace_add(server_rec *s, request_rec *r, excfg *mconfig, - const char *note) -{ - - const char *sofar; - char *addon; - char *where; - pool *p; - const char *trace_copy; - - /* - * Make sure our pools and tables are set up - we need 'em. - */ - setup_module_cells(); - /* - * Now, if we're in request-context, we use the request pool. - */ - if (r != NULL) { - p = r->pool; - if ((trace_copy = ap_table_get(r->notes, TRACE_NOTE)) == NULL) { - trace_copy = ""; - } - } - else { - /* - * We're not in request context, so the trace gets attached to our - * module-wide pool. We do the create/destroy every time we're called - * in non-request context; this avoids leaking memory in some of - * the subsequent calls that allocate memory only once (such as the - * key formation below). - * - * Make a new sub-pool and copy any existing trace to it. Point the - * trace cell at the copied value. - */ - p = ap_make_sub_pool(example_pool); - if (trace != NULL) { - trace = ap_pstrdup(p, trace); - } - /* - * Now, if we have a sub-pool from before, nuke it and replace with - * the one we just allocated. - */ - if (example_subpool != NULL) { - ap_destroy_pool(example_subpool); - } - example_subpool = p; - trace_copy = trace; - } - /* - * If we weren't passed a configuration record, we can't figure out to - * what location this call applies. This only happens for co-routines - * that don't operate in a particular directory or server context. If we - * got a valid record, extract the location (directory or server) to which - * it applies. - */ - where = (mconfig != NULL) ? mconfig->loc : "nowhere"; - where = (where != NULL) ? where : ""; - /* - * Now, if we're not in request context, see if we've been called with - * this particular combination before. The table is allocated in the - * module's private pool, which doesn't get destroyed. - */ - if (r == NULL) { - char *key; - - key = ap_pstrcat(p, note, ":", where, NULL); - if (ap_table_get(static_calls_made, key) != NULL) { - /* - * Been here, done this. - */ - return; - } - else { - /* - * First time for this combination of routine and environment - - * log it so we don't do it again. - */ - ap_table_set(static_calls_made, key, "been here"); - } - } - addon = ap_pstrcat(p, "
  • \n", "
    \n", "
    ", - note, "\n", "
    \n", "
    [", - where, "]\n", "
    \n", "
    \n", - "
  • \n", NULL); - sofar = (trace_copy == NULL) ? "" : trace_copy; - trace_copy = ap_pstrcat(p, sofar, addon, NULL); - if (r != NULL) { - ap_table_set(r->notes, TRACE_NOTE, trace_copy); - } - else { - trace = trace_copy; - } - /* - * You *could* change the following if you wanted to see the calling - * sequence reported in the server's error_log, but beware - almost all of - * these co-routines are called for every single request, and the impact - * on the size (and readability) of the error_log is considerable. - */ -#define EXAMPLE_LOG_EACH 0 - if (EXAMPLE_LOG_EACH && (s != NULL)) { - ap_log_error(APLOG_MARK, APLOG_DEBUG, s, "mod_example: %s", note); - } -} - -/*--------------------------------------------------------------------------*/ -/* We prototyped the various syntax for command handlers (routines that */ -/* are called when the configuration parser detects a directive declared */ -/* by our module) earlier. Now we actually declare a "real" routine that */ -/* will be invoked by the parser when our "real" directive is */ -/* encountered. */ -/* */ -/* If a command handler encounters a problem processing the directive, it */ -/* signals this fact by returning a non-NULL pointer to a string */ -/* describing the problem. */ -/* */ -/* The magic return value DECLINE_CMD is used to deal with directives */ -/* that might be declared by multiple modules. If the command handler */ -/* returns NULL, the directive was processed; if it returns DECLINE_CMD, */ -/* the next module (if any) that declares the directive is given a chance */ -/* at it. If it returns any other value, it's treated as the text of an */ -/* error message. */ -/*--------------------------------------------------------------------------*/ -/* - * Command handler for the NO_ARGS "Example" directive. All we do is mark the - * call in the trace log, and flag the applicability of the directive to the - * current location in that location's configuration record. - */ -static const char *cmd_example(cmd_parms *cmd, void *mconfig) -{ - - excfg *cfg = (excfg *) mconfig; - - /* - * "Example Wuz Here" - */ - cfg->local = 1; - trace_add(cmd->server, NULL, cfg, "cmd_example()"); - return NULL; -} - -/*--------------------------------------------------------------------------*/ -/* */ -/* Now we declare our content handlers, which are invoked when the server */ -/* encounters a document which our module is supposed to have a chance to */ -/* see. (See mod_mime's SetHandler and AddHandler directives, and the */ -/* mod_info and mod_status examples, for more details.) */ -/* */ -/* Since content handlers are dumping data directly into the connexion */ -/* (using the r*() routines, such as rputs() and rprintf()) without */ -/* intervention by other parts of the server, they need to make */ -/* sure any accumulated HTTP headers are sent first. This is done by */ -/* calling send_http_header(). Otherwise, no header will be sent at all, */ -/* and the output sent to the client will actually be HTTP-uncompliant. */ -/*--------------------------------------------------------------------------*/ -/* - * Sample content handler. All this does is display the call list that has - * been built up so far. - * - * The return value instructs the caller concerning what happened and what to - * do next: - * OK ("we did our thing") - * DECLINED ("this isn't something with which we want to get involved") - * HTTP_mumble ("an error status should be reported") - */ -static int example_handler(request_rec *r) -{ - - excfg *dcfg; - - dcfg = our_dconfig(r); - trace_add(r->server, r, dcfg, "example_handler()"); - /* - * We're about to start sending content, so we need to force the HTTP - * headers to be sent at this point. Otherwise, no headers will be sent - * at all. We can set any we like first, of course. **NOTE** Here's - * where you set the "Content-type" header, and you do so by putting it in - * r->content_type, *not* r->headers_out("Content-type"). If you don't - * set it, it will be filled in with the server's default type (typically - * "text/plain"). You *must* also ensure that r->content_type is lower - * case. - * - * We also need to start a timer so the server can know if the connexion - * is broken. - */ - r->content_type = "text/html"; - ap_soft_timeout("send example call trace", r); - ap_send_http_header(r); - /* - * If we're only supposed to send header information (HEAD request), we're - * already there. - */ - if (r->header_only) { - ap_kill_timeout(r); - return OK; - } - - /* - * Now send our actual output. Since we tagged this as being - * "text/html", we need to embed any HTML. - */ - ap_rputs(DOCTYPE_HTML_3_2, r); - ap_rputs("\n", r); - ap_rputs(" \n", r); - ap_rputs(" mod_example Module Content-Handler Output\n", r); - ap_rputs(" \n", r); - ap_rputs(" \n", r); - ap_rputs(" \n", r); - ap_rputs("

    mod_example Module Content-Handler Output\n", r); - ap_rputs("

    \n", r); - ap_rputs("

    \n", r); - ap_rprintf(r, " Apache HTTP Server version: \"%s\"\n", - ap_get_server_version()); - ap_rputs("
    \n", r); - ap_rprintf(r, " Server built: \"%s\"\n", ap_get_server_built()); - ap_rputs("

    \n", r);; - ap_rputs("

    \n", r); - ap_rputs(" The format for the callback trace is:\n", r); - ap_rputs("

    \n", r); - ap_rputs("
    \n", r); - ap_rputs("
    n.<routine-name>", r); - ap_rputs("(<routine-data>)\n", r); - ap_rputs("
    \n", r); - ap_rputs("
    [<applies-to>]\n", r); - ap_rputs("
    \n", r); - ap_rputs("
    \n", r); - ap_rputs("

    \n", r); - ap_rputs(" The <routine-data> is supplied by\n", r); - ap_rputs(" the routine when it requests the trace,\n", r); - ap_rputs(" and the <applies-to> is extracted\n", r); - ap_rputs(" from the configuration record at the time of the trace.\n", r); - ap_rputs(" SVR() indicates a server environment\n", r); - ap_rputs(" (blank means the main or default server, otherwise it's\n", r); - ap_rputs(" the name of the VirtualHost); DIR()\n", r); - ap_rputs(" indicates a location in the URL or filesystem\n", r); - ap_rputs(" namespace.\n", r); - ap_rputs("

    \n", r); - ap_rprintf(r, "

    Static callbacks so far:

    \n
      \n%s
    \n", - trace); - ap_rputs("

    Request-specific callbacks so far:

    \n", r); - ap_rprintf(r, "
      \n%s
    \n", ap_table_get(r->notes, TRACE_NOTE)); - ap_rputs("

    Environment for this call:

    \n", r); - ap_rputs("
      \n", r); - ap_rprintf(r, "
    • Applies-to: %s\n
    • \n", dcfg->loc); - ap_rprintf(r, "
    • \"Example\" directive declared here: %s\n
    • \n", - (dcfg->local ? "YES" : "NO")); - ap_rprintf(r, "
    • \"Example\" inherited: %s\n
    • \n", - (dcfg->congenital ? "YES" : "NO")); - ap_rputs("
    \n", r); - ap_rputs(" \n", r); - ap_rputs("\n", r); - /* - * We're all done, so cancel the timeout we set. Since this is probably - * the end of the request we *could* assume this would be done during - * post-processing - but it's possible that another handler might be - * called and inherit our outstanding timer. Not good; to each its own. - */ - ap_kill_timeout(r); - /* - * We did what we wanted to do, so tell the rest of the server we - * succeeded. - */ - return OK; -} - -/*--------------------------------------------------------------------------*/ -/* */ -/* Now let's declare routines for each of the callback phase in order. */ -/* (That's the order in which they're listed in the callback list, *not */ -/* the order in which the server calls them! See the command_rec */ -/* declaration near the bottom of this file.) Note that these may be */ -/* called for situations that don't relate primarily to our function - in */ -/* other words, the fixup handler shouldn't assume that the request has */ -/* to do with "example" stuff. */ -/* */ -/* With the exception of the content handler, all of our routines will be */ -/* called for each request, unless an earlier handler from another module */ -/* aborted the sequence. */ -/* */ -/* Handlers that are declared as "int" can return the following: */ -/* */ -/* OK Handler accepted the request and did its thing with it. */ -/* DECLINED Handler took no action. */ -/* HTTP_mumble Handler looked at request and found it wanting. */ -/* */ -/* What the server does after calling a module handler depends upon the */ -/* handler's return value. In all cases, if the handler returns */ -/* DECLINED, the server will continue to the next module with an handler */ -/* for the current phase. However, if the handler return a non-OK, */ -/* non-DECLINED status, the server aborts the request right there. If */ -/* the handler returns OK, the server's next action is phase-specific; */ -/* see the individual handler comments below for details. */ -/* */ -/*--------------------------------------------------------------------------*/ -/* - * This function is called during server initialisation. Any information - * that needs to be recorded must be in static cells, since there's no - * configuration record. - * - * There is no return value. - */ - -/* - * All our module-initialiser does is add its trace to the log. - */ -static void example_init(server_rec *s, pool *p) -{ - - char *note; - char *sname = s->server_hostname; - - /* - * Set up any module cells that ought to be initialised. - */ - setup_module_cells(); - /* - * The arbitrary text we add to our trace entry indicates for which server - * we're being called. - */ - sname = (sname != NULL) ? sname : ""; - note = ap_pstrcat(p, "example_init(", sname, ")", NULL); - trace_add(s, NULL, NULL, note); -} - -/* - * This function is called during server initialisation when an heavy-weight - * process (such as a child) is being initialised. As with the - * module-initialisation function, any information that needs to be recorded - * must be in static cells, since there's no configuration record. - * - * There is no return value. - */ - -/* - * All our process-initialiser does is add its trace to the log. - */ -static void example_child_init(server_rec *s, pool *p) -{ - - char *note; - char *sname = s->server_hostname; - - /* - * Set up any module cells that ought to be initialised. - */ - setup_module_cells(); - /* - * The arbitrary text we add to our trace entry indicates for which server - * we're being called. - */ - sname = (sname != NULL) ? sname : ""; - note = ap_pstrcat(p, "example_child_init(", sname, ")", NULL); - trace_add(s, NULL, NULL, note); -} - -/* - * This function is called when an heavy-weight process (such as a child) is - * being run down or destroyed. As with the child-initialisation function, - * any information that needs to be recorded must be in static cells, since - * there's no configuration record. - * - * There is no return value. - */ - -/* - * All our process-death routine does is add its trace to the log. - */ -static void example_child_exit(server_rec *s, pool *p) -{ - - char *note; - char *sname = s->server_hostname; - - /* - * The arbitrary text we add to our trace entry indicates for which server - * we're being called. - */ - sname = (sname != NULL) ? sname : ""; - note = ap_pstrcat(p, "example_child_exit(", sname, ")", NULL); - trace_add(s, NULL, NULL, note); -} - -/* - * This function gets called to create up a per-directory configuration - * record. This will be called for the "default" server environment, and for - * each directory for which the parser finds any of our directives applicable. - * If a directory doesn't have any of our directives involved (i.e., they - * aren't in the .htaccess file, or a , , or related - * block), this routine will *not* be called - the configuration for the - * closest ancestor is used. - * - * The return value is a pointer to the created module-specific - * structure. - */ -static void *example_create_dir_config(pool *p, char *dirspec) -{ - - excfg *cfg; - char *dname = dirspec; - - /* - * Allocate the space for our record from the pool supplied. - */ - cfg = (excfg *) ap_pcalloc(p, sizeof(excfg)); - /* - * Now fill in the defaults. If there are any `parent' configuration - * records, they'll get merged as part of a separate callback. - */ - cfg->local = 0; - cfg->congenital = 0; - cfg->cmode = CONFIG_MODE_DIRECTORY; - /* - * Finally, add our trace to the callback list. - */ - dname = (dname != NULL) ? dname : ""; - cfg->loc = ap_pstrcat(p, "DIR(", dname, ")", NULL); - trace_add(NULL, NULL, cfg, "example_create_dir_config()"); - return (void *) cfg; -} - -/* - * This function gets called to merge two per-directory configuration - * records. This is typically done to cope with things like .htaccess files - * or directives for directories that are beneath one for which a - * configuration record was already created. The routine has the - * responsibility of creating a new record and merging the contents of the - * other two into it appropriately. If the module doesn't declare a merge - * routine, the record for the closest ancestor location (that has one) is - * used exclusively. - * - * The routine MUST NOT modify any of its arguments! - * - * The return value is a pointer to the created module-specific structure - * containing the merged values. - */ -static void *example_merge_dir_config(pool *p, void *parent_conf, - void *newloc_conf) -{ - - excfg *merged_config = (excfg *) ap_pcalloc(p, sizeof(excfg)); - excfg *pconf = (excfg *) parent_conf; - excfg *nconf = (excfg *) newloc_conf; - char *note; - - /* - * Some things get copied directly from the more-specific record, rather - * than getting merged. - */ - merged_config->local = nconf->local; - merged_config->loc = ap_pstrdup(p, nconf->loc); - /* - * Others, like the setting of the `congenital' flag, get ORed in. The - * setting of that particular flag, for instance, is TRUE if it was ever - * true anywhere in the upstream configuration. - */ - merged_config->congenital = (pconf->congenital | pconf->local); - /* - * If we're merging records for two different types of environment (server - * and directory), mark the new record appropriately. Otherwise, inherit - * the current value. - */ - merged_config->cmode = - (pconf->cmode == nconf->cmode) ? pconf->cmode : CONFIG_MODE_COMBO; - /* - * Now just record our being called in the trace list. Include the - * locations we were asked to merge. - */ - note = ap_pstrcat(p, "example_merge_dir_config(\"", pconf->loc, "\",\"", - nconf->loc, "\")", NULL); - trace_add(NULL, NULL, merged_config, note); - return (void *) merged_config; -} - -/* - * This function gets called to create a per-server configuration - * record. It will always be called for the "default" server. - * - * The return value is a pointer to the created module-specific - * structure. - */ -static void *example_create_server_config(pool *p, server_rec *s) -{ - - excfg *cfg; - char *sname = s->server_hostname; - - /* - * As with the example_create_dir_config() reoutine, we allocate and fill - * in an empty record. - */ - cfg = (excfg *) ap_pcalloc(p, sizeof(excfg)); - cfg->local = 0; - cfg->congenital = 0; - cfg->cmode = CONFIG_MODE_SERVER; - /* - * Note that we were called in the trace list. - */ - sname = (sname != NULL) ? sname : ""; - cfg->loc = ap_pstrcat(p, "SVR(", sname, ")", NULL); - trace_add(s, NULL, cfg, "example_create_server_config()"); - return (void *) cfg; -} - -/* - * This function gets called to merge two per-server configuration - * records. This is typically done to cope with things like virtual hosts and - * the default server configuration The routine has the responsibility of - * creating a new record and merging the contents of the other two into it - * appropriately. If the module doesn't declare a merge routine, the more - * specific existing record is used exclusively. - * - * The routine MUST NOT modify any of its arguments! - * - * The return value is a pointer to the created module-specific structure - * containing the merged values. - */ -static void *example_merge_server_config(pool *p, void *server1_conf, - void *server2_conf) -{ - - excfg *merged_config = (excfg *) ap_pcalloc(p, sizeof(excfg)); - excfg *s1conf = (excfg *) server1_conf; - excfg *s2conf = (excfg *) server2_conf; - char *note; - - /* - * Our inheritance rules are our own, and part of our module's semantics. - * Basically, just note whence we came. - */ - merged_config->cmode = - (s1conf->cmode == s2conf->cmode) ? s1conf->cmode : CONFIG_MODE_COMBO; - merged_config->local = s2conf->local; - merged_config->congenital = (s1conf->congenital | s1conf->local); - merged_config->loc = ap_pstrdup(p, s2conf->loc); - /* - * Trace our call, including what we were asked to merge. - */ - note = ap_pstrcat(p, "example_merge_server_config(\"", s1conf->loc, "\",\"", - s2conf->loc, "\")", NULL); - trace_add(NULL, NULL, merged_config, note); - return (void *) merged_config; -} - -/* - * This routine is called after the request has been read but before any other - * phases have been processed. This allows us to make decisions based upon - * the input header fields. - * - * The return value is OK, DECLINED, or HTTP_mumble. If we return OK, no - * further modules are called for this phase. - */ -static int example_post_read_request(request_rec *r) -{ - - excfg *cfg; - - cfg = our_dconfig(r); - /* - * We don't actually *do* anything here, except note the fact that we were - * called. - */ - trace_add(r->server, r, cfg, "example_post_read_request()"); - return DECLINED; -} - -/* - * This routine gives our module an opportunity to translate the URI into an - * actual filename. If we don't do anything special, the server's default - * rules (Alias directives and the like) will continue to be followed. - * - * The return value is OK, DECLINED, or HTTP_mumble. If we return OK, no - * further modules are called for this phase. - */ -static int example_translate_handler(request_rec *r) -{ - - excfg *cfg; - - cfg = our_dconfig(r); - /* - * We don't actually *do* anything here, except note the fact that we were - * called. - */ - trace_add(r->server, r, cfg, "example_translate_handler()"); - return DECLINED; -} - -/* - * This routine is called to check the authentication information sent with - * the request (such as looking up the user in a database and verifying that - * the [encrypted] password sent matches the one in the database). - * - * The return value is OK, DECLINED, or some HTTP_mumble error (typically - * HTTP_UNAUTHORIZED). If we return OK, no other modules are given a chance - * at the request during this phase. - */ -static int example_check_user_id(request_rec *r) -{ - - excfg *cfg; - - cfg = our_dconfig(r); - /* - * Don't do anything except log the call. - */ - trace_add(r->server, r, cfg, "example_check_user_id()"); - return DECLINED; -} - -/* - * This routine is called to check to see if the resource being requested - * requires authorisation. - * - * The return value is OK, DECLINED, or HTTP_mumble. If we return OK, no - * other modules are called during this phase. - * - * If *all* modules return DECLINED, the request is aborted with a server - * error. - */ -static int example_auth_checker(request_rec *r) -{ - - excfg *cfg; - - cfg = our_dconfig(r); - /* - * Log the call and return OK, or access will be denied (even though we - * didn't actually do anything). - */ - trace_add(r->server, r, cfg, "example_auth_checker()"); - return DECLINED; -} - -/* - * This routine is called to check for any module-specific restrictions placed - * upon the requested resource. (See the mod_access module for an example.) - * - * The return value is OK, DECLINED, or HTTP_mumble. All modules with an - * handler for this phase are called regardless of whether their predecessors - * return OK or DECLINED. The first one to return any other status, however, - * will abort the sequence (and the request) as usual. - */ -static int example_access_checker(request_rec *r) -{ - - excfg *cfg; - - cfg = our_dconfig(r); - trace_add(r->server, r, cfg, "example_access_checker()"); - return DECLINED; -} - -/* - * This routine is called to determine and/or set the various document type - * information bits, like Content-type (via r->content_type), language, et - * cetera. - * - * The return value is OK, DECLINED, or HTTP_mumble. If we return OK, no - * further modules are given a chance at the request for this phase. - */ -static int example_type_checker(request_rec *r) -{ - - excfg *cfg; - - cfg = our_dconfig(r); - /* - * Log the call, but don't do anything else - and report truthfully that - * we didn't do anything. - */ - trace_add(r->server, r, cfg, "example_type_checker()"); - return DECLINED; -} - -/* - * This routine is called to perform any module-specific fixing of header - * fields, et cetera. It is invoked just before any content-handler. - * - * The return value is OK, DECLINED, or HTTP_mumble. If we return OK, the - * server will still call any remaining modules with an handler for this - * phase. - */ -static int example_fixer_upper(request_rec *r) -{ - - excfg *cfg; - - cfg = our_dconfig(r); - /* - * Log the call and exit. - */ - trace_add(r->server, r, cfg, "example_fixer_upper()"); - return OK; -} - -/* - * This routine is called to perform any module-specific logging activities - * over and above the normal server things. - * - * The return value is OK, DECLINED, or HTTP_mumble. If we return OK, any - * remaining modules with an handler for this phase will still be called. - */ -static int example_logger(request_rec *r) -{ - - excfg *cfg; - - cfg = our_dconfig(r); - trace_add(r->server, r, cfg, "example_logger()"); - return DECLINED; -} - -/* - * This routine is called to give the module a chance to look at the request - * headers and take any appropriate specific actions early in the processing - * sequence. - * - * The return value is OK, DECLINED, or HTTP_mumble. If we return OK, any - * remaining modules with handlers for this phase will still be called. - */ -static int example_header_parser(request_rec *r) -{ - - excfg *cfg; - - cfg = our_dconfig(r); - trace_add(r->server, r, cfg, "example_header_parser()"); - return DECLINED; -} - -/*--------------------------------------------------------------------------*/ -/* */ -/* All of the routines have been declared now. Here's the list of */ -/* directives specific to our module, and information about where they */ -/* may appear and how the command parser should pass them to us for */ -/* processing. Note that care must be taken to ensure that there are NO */ -/* collisions of directive names between modules. */ -/* */ -/*--------------------------------------------------------------------------*/ -/* - * List of directives specific to our module. - */ -static const command_rec example_cmds[] = -{ - { - "Example", /* directive name */ - cmd_example, /* config action routine */ - NULL, /* argument to include in call */ - OR_OPTIONS, /* where available */ - NO_ARGS, /* arguments */ - "Example directive - no arguments" - /* directive description */ - }, - {NULL} -}; - -/*--------------------------------------------------------------------------*/ -/* */ -/* Now the list of content handlers available from this module. */ -/* */ -/*--------------------------------------------------------------------------*/ -/* - * List of content handlers our module supplies. Each handler is defined by - * two parts: a name by which it can be referenced (such as by - * {Add,Set}Handler), and the actual routine name. The list is terminated by - * a NULL block, since it can be of variable length. - * - * Note that content-handlers are invoked on a most-specific to least-specific - * basis; that is, a handler that is declared for "text/plain" will be - * invoked before one that was declared for "text / *". Note also that - * if a content-handler returns anything except DECLINED, no other - * content-handlers will be called. - */ -static const handler_rec example_handlers[] = -{ - {"example-handler", example_handler}, - {NULL} -}; - -/*--------------------------------------------------------------------------*/ -/* */ -/* Finally, the list of callback routines and data structures that */ -/* provide the hooks into our module from the other parts of the server. */ -/* */ -/*--------------------------------------------------------------------------*/ -/* - * Module definition for configuration. If a particular callback is not - * needed, replace its routine name below with the word NULL. - * - * The number in brackets indicates the order in which the routine is called - * during request processing. Note that not all routines are necessarily - * called (such as if a resource doesn't have access restrictions). - */ -module example_module = -{ - STANDARD_MODULE_STUFF, - example_init, /* module initializer */ - example_create_dir_config, /* per-directory config creator */ - example_merge_dir_config, /* dir config merger */ - example_create_server_config, /* server config creator */ - example_merge_server_config, /* server config merger */ - example_cmds, /* command table */ - example_handlers, /* [7] list of handlers */ - example_translate_handler, /* [2] filename-to-URI translation */ - example_check_user_id, /* [5] check/validate user_id */ - example_auth_checker, /* [6] check user_id is valid *here* */ - example_access_checker, /* [4] check access by host address */ - example_type_checker, /* [7] MIME type checker/setter */ - example_fixer_upper, /* [8] fixups */ - example_logger, /* [10] logger */ -#if MODULE_MAGIC_NUMBER >= 19970103 - example_header_parser, /* [3] header parser */ -#endif -#if MODULE_MAGIC_NUMBER >= 19970719 - example_child_init, /* process initializer */ -#endif -#if MODULE_MAGIC_NUMBER >= 19970728 - example_child_exit, /* process exit/cleanup */ -#endif -#if MODULE_MAGIC_NUMBER >= 19970902 - example_post_read_request /* [1] post read_request handling */ -#endif -}; diff --git a/modules/experimental/mod_mem_cache.c b/modules/experimental/mod_mem_cache.c deleted file mode 100644 index 2d2781a1a22124ecb596f4d600d981fc1246bf4e..0000000000000000000000000000000000000000 --- a/modules/experimental/mod_mem_cache.c +++ /dev/null @@ -1,509 +0,0 @@ -/* ==================================================================== - * The Apache Software License, Version 1.1 - * - * Copyright (c) 2000-2001 The Apache Software Foundation. All rights - * reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in - * the documentation and/or other materials provided with the - * distribution. - * - * 3. The end-user documentation included with the redistribution, - * if any, must include the following acknowledgment: - * "This product includes software developed by the - * Apache Software Foundation (http://www.apache.org/)." - * Alternately, this acknowledgment may appear in the software itself, - * if and wherever such third-party acknowledgments normally appear. - * - * 4. The names "Apache" and "Apache Software Foundation" must - * not be used to endorse or promote products derived from this - * software without prior written permission. For written - * permission, please contact apache@apache.org. - * - * 5. Products derived from this software may not be called "Apache", - * nor may "Apache" appear in their name, without prior written - * permission of the Apache Software Foundation. - * - * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED - * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES - * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR - * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF - * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND - * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, - * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT - * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * ==================================================================== - * - * This software consists of voluntary contributions made by many - * individuals on behalf of the Apache Software Foundation. For more - * information on the Apache Software Foundation, please see - * . - * - * Portions of this software are based upon public domain software - * originally written at the National Center for Supercomputing Applications, - * University of Illinois, Urbana-Champaign. - */ - -#define CORE_PRIVATE - -#include "mod_cache.h" -#define MAX_CACHE 5000 -module AP_MODULE_DECLARE_DATA mem_cache_module; - -/* - * XXX - * This cache uses apr_hash functions which leak storage when something is removed - * from the cache. This can be fixed in the apr_hash functions by making them use - * malloc/free rather than pools to manage their storage requirements. - */ - -/* - * XXX Introduce a type field that identifies whether the cache obj - * references malloc'ed or mmap storage or a file descriptor - */ -typedef enum { - CACHE_TYPE_FILE = 1, - CACHE_TYPE_MALLOC, - CACHE_TYPE_MMAP -} cache_type_e; - -typedef struct { - cache_type_e type; - char *key; - void *m; - apr_size_t m_len; - cache_info info; - int complete; -} cache_object_t; - -typedef struct { - apr_lock_t *lock; - apr_hash_t *cacheht; - int space; - apr_time_t maxexpire; - apr_time_t defaultexpire; -} mem_cache_conf; -static mem_cache_conf *sconf; - -#define DEFAULT_CACHE_SPACE 100*1024 -#define CACHEFILE_LEN 20 - -/* Forward declarations */ -static int remove_entity(cache_handle *h); -static int write_headers(cache_handle *h, request_rec *r, cache_info *i); -static int write_body(cache_handle *h, apr_bucket_brigade *b); -static int read_headers(cache_handle *h, request_rec *r, cache_info **info); -static int read_body(cache_handle *h, apr_bucket_brigade *bb); - -static void cleanup_cache_object(cache_object_t *obj) -{ - /* The cache object has been removed from the cache. Now clean - * it up, freeing any storage, closing file descriptors, etc. - */ - /* XXX - - * The action of freeing a cache entry is asynchronous with the rest of - * the operation of the cache. Frees can be driven by garbage collection, - * the result of some command or an HTTP request. It is okay to remove - * an entry from the cache at anytime but we need a mechanism to keep - * us from cleaning up the cache entry out from under other threads - * that may still be referencing it. - * - * Bill thinks that we need a special purpose reference counted - * bucket (or three). When an entry is removed from the cache, the - * bucket for that entry is marked for cleanup. A bucket marked for - * cleanup is freed by the last routine referencing the bucket, - * either during brigade destroy or this routine. - */ - - /* - * Ref count decrementing and checking needs to be atomic - - obj->ref_count--; - if (obj->ref_count) { - defer_cleanup (let the brigade cleanup free the bucket) - } - else { - free the bucket - } - */ - - if (obj->info.content_type) - free(obj->info.content_type); - if (obj->key) - free(obj->key); - if (obj->m) - free(obj->m); - - free(obj); -} - -static apr_status_t cleanup_cache_mem(void *sconfv) -{ - cache_object_t *obj; - apr_hash_index_t *hi; - mem_cache_conf *co = (mem_cache_conf*) sconfv; - - if (!co) { - return APR_SUCCESS; - } - - /* Iterate over the frag hash table and clean up each entry */ - /* XXX need to lock the hash */ - for (hi = apr_hash_first(NULL, co->cacheht); hi; hi=apr_hash_next(hi)) { - apr_hash_this(hi, NULL, NULL, (void **)&obj); - if (obj) - cleanup_cache_object(obj); - } - return APR_SUCCESS; -} -static void *create_cache_config(apr_pool_t *p, server_rec *s) -{ - sconf = apr_pcalloc(p, sizeof(mem_cache_conf)); - sconf->space = DEFAULT_CACHE_SPACE; -#if 0 - sconf->maxexpire = DEFAULT_CACHE_MAXEXPIRE; - sconf->defaultexpire = DEFAULT_CACHE_EXPIRE; -#endif - - apr_lock_create(&sconf->lock, APR_MUTEX, APR_INTRAPROCESS, "foo", p); - sconf->cacheht = apr_hash_make(p); - apr_pool_cleanup_register(p, NULL, cleanup_cache_mem, apr_pool_cleanup_null); - - return sconf; -} - -static int create_entity(cache_handle **hp, const char *type, char *key, apr_size_t len) -{ - apr_status_t rv; - cache_object_t *obj; - cache_handle *h; - - /* Create the cache handle and begin populating it. - */ - if (strcasecmp(type, "mem")) { - return DECLINED; - } - - /* Check len to see if it is withing acceptable bounds - * XXX max cache check should be configurable variable. - */ - if (len < 0 || len > MAX_CACHE) { - return DECLINED; - } - /* Check total cache size and number of entries. Are they within the - * configured limits? If not, kick off garbage collection thread. - */ - - /* Allocate the cache_handle and set up call back functions specific to - * this cache handler. - */ - h = malloc(sizeof(cache_handle)); - *hp = h; - if (!h) { - /* handle the error */ - return DECLINED; - } - h->read_body = &read_body; - h->read_headers = &read_headers; - h->write_body = &write_body; - h->write_headers = &write_headers; - - /* Allocate and initialize the cache object. The cache object is - * unique to this implementation. - */ - obj = malloc(sizeof(*obj)); - if (!obj) { - /* Handle ther error */ - free(h); - return DECLINED; - } - - obj->key = malloc(strlen(key)); - if (!obj->key) { - /* XXX Uuugh, there has got to be a better way to manage memory. - */ - free(h); - free(obj); - return DECLINED; - } - obj->m_len = len; /* One of these len fields can go */ - obj->info.len = len; - strcpy(obj->key, key); - h->cache_obj = (void *) obj; - - /* Mark the cache object as incomplete and put it into the cache */ - obj->complete = 0; - - /* XXX Need a way to insert into the cache w/o sch coarse grained locking */ - apr_lock_acquire(sconf->lock); - apr_hash_set(sconf->cacheht, obj->key, strlen(obj->key), obj); - apr_lock_release(sconf->lock); -} - -static int open_entity(cache_handle **hp, const char *type, char *key) -{ - cache_object_t *obj; - cache_handle *h; - - /* Look up entity keyed to 'url' */ - if (strcasecmp(type, "mem")) { - return DECLINED; - } - apr_lock_acquire(sconf->lock); - obj = (cache_object_t *) apr_hash_get(sconf->cacheht, key, APR_HASH_KEY_STRING); - apr_lock_release(sconf->lock); - - if (!obj || !(obj->complete)) { - return DECLINED; - } - - /* Allocate the cache_handle and initialize it */ - h = malloc(sizeof(cache_handle)); - *hp = h; - if (!h) { - /* handle the error */ - return DECLINED; - } - h->read_body = &read_body; - h->read_headers = &read_headers; - h->write_body = &write_body; - h->write_headers = &write_headers; - h->cache_obj = obj; - if (!obj || !(obj->complete)) { - return DECLINED; - } - return OK; -} - -static int remove_entity(cache_handle *h) -{ - cache_object_t *obj = (cache_object_t *) h->cache_obj; - - apr_lock_acquire(sconf->lock); - apr_hash_set(sconf->cacheht, obj->key, strlen(obj->key), NULL); - apr_lock_release(sconf->lock); - - cleanup_cache_object(obj); - - /* Reinit the cache_handle fields? */ - h->cache_obj = NULL; - - /* The caller should free the cache_handle ? */ - free(h); -} - -/* Define request processing hook handlers */ -static int remove_url(const char *type, char *key) -{ - cache_object_t *obj; - - if (strcasecmp(type, "mem")) { - return DECLINED; - } - - /* WIBNIF - * apr_hash_set(..,..,..,NULL) returned pointer to the object just removed. - * That way, we could free the object w/o doing another call to an - * apr_hash function. - */ - - /* First, find the object in the cache */ - apr_lock_acquire(sconf->lock); - obj = (cache_object_t *) apr_hash_get(sconf->cacheht, key, APR_HASH_KEY_STRING); - apr_lock_release(sconf->lock); - - if (!obj) { - return DECLINED; - } - - /* Found it. Now take it out of the cache and free it. */ - apr_lock_acquire(sconf->lock); - apr_hash_set(sconf->cacheht, obj->key, strlen(obj->key), NULL); - apr_lock_release(sconf->lock); - - cleanup_cache_object(obj); - - return OK; -} - -static int read_headers(cache_handle *h, request_rec *r, cache_info **info) -{ - cache_object_t *obj = (cache_object_t*) h->cache_obj; - - *info = &(obj->info); - - return OK; -} - -static int read_body(cache_handle *h, apr_bucket_brigade *bb) -{ - apr_bucket *b; - cache_object_t *obj = h->cache_obj; - - b = apr_bucket_immortal_create(obj->m, obj->m_len); - APR_BRIGADE_INSERT_TAIL(bb, b); - b = apr_bucket_eos_create(); - APR_BRIGADE_INSERT_TAIL(bb, b); - - return OK; -} - -static int write_headers(cache_handle *h, request_rec *r, cache_info *info) -{ - apr_size_t len; - cache_object_t *obj = (cache_object_t*) h->cache_obj; - if (info->date) { - obj->info.date = info->date; - } - if (info->lastmod) { - obj->info.lastmod = info->lastmod; - } - if (info->expire) { - obj->info.expire = info->expire; - } - if (info->content_type) { - obj->info.content_type = (char*) malloc(strlen(info->content_type)); - if (obj->info.content_type) - strcpy(obj->info.content_type, info->content_type); - } - - return OK; -} - -static int write_body(cache_handle *h, apr_bucket_brigade *b) -{ - apr_status_t rv; - apr_size_t idx = 0; - cache_object_t *obj = (cache_object_t *) h->cache_obj; - apr_read_type_e eblock = APR_BLOCK_READ; - apr_bucket *e; - - /* XXX mmap, malloc or file? - * Enable this decision to be configured.... - */ - char *m = malloc(obj->m_len); - obj->m = m; - if (!m) { - /* Cleanup cache entry and return */ - } - obj->type = CACHE_TYPE_MALLOC; - - /* Iterate accross the brigade and populate the cache storage */ - /* XXX doesn't handle multiple brigades */ - APR_BRIGADE_FOREACH(e, b) { - const char *s; - apr_size_t len; - - rv = apr_bucket_read(e, &s, &len, eblock); - if (rv != APR_SUCCESS) { - /* Big problem! Cleanup cache entry and return */ - } - /* XXX Check for overflow */ - if (len ) { - memcpy(m, s, len); - m+=len; - } - } - - /* XXX - Check for EOS before setting obj->complete - * Open for business. This entry can be served from the cache - */ - obj->complete = 1; - return OK; -} - -static const char -*set_cache_size(cmd_parms *parms, char *struct_ptr, char *arg) -{ - int val; - - if (sscanf(arg, "%d", &val) != 1) - return "CacheSize value must be an integer (kBytes)"; - sconf->space = val; - return NULL; -} -#if 0 -static const char -*set_cache_factor(cmd_parms *parms, void *dummy, char *arg) -{ - double val; - - if (sscanf(arg, "%lg", &val) != 1) - return "CacheLastModifiedFactor value must be a float"; - sconf->lmfactor = val; - - return NULL; -} -#endif -#if 0 -static const char -*set_cache_maxex(cmd_parms *parms, void *dummy, char *arg) -{ - mem_cache_conf *pc = ap_get_module_config(parms->server->module_config, &mem_cache_module); - double val; - - if (sscanf(arg, "%lg", &val) != 1) - return "CacheMaxExpire value must be a float"; - sconf->maxexpire = (apr_time_t) (val * MSEC_ONE_HR); - return NULL; -} -#endif -#if 0 -static const char -*set_cache_defex(cmd_parms *parms, void *dummy, char *arg) -{ - mem_cache_conf *pc = ap_get_module_config(parms->server->module_config, &mem_cache_module); - double val; - - if (sscanf(arg, "%lg", &val) != 1) - return "CacheDefaultExpire value must be a float"; - pc->defaultexpire = (apr_time_t) (val * MSEC_ONE_HR); - return NULL; -} -#endif -static const command_rec cache_cmds[] = -{ - /* XXX - * What config directives does this module need? - * Should this module manage expire policy for its entries? - * Certainly cache limits like max number of entries, - * max entry size, and max size of the cache should - * be managed by this module. - */ - AP_INIT_TAKE1("CacheSizeMem", set_cache_size, NULL, RSRC_CONF, - "The maximum disk space used by the cache in Kb"), - {NULL} -}; - -static void register_hooks(apr_pool_t *p) -{ - /* cache initializer */ -/* cache_hook_cache_init(cache_init, NULL, NULL, AP_HOOK_FIRST); */ - cache_hook_create_entity(create_entity, NULL, NULL, APR_HOOK_MIDDLE); - cache_hook_open_entity(open_entity, NULL, NULL, APR_HOOK_MIDDLE); - cache_hook_remove_url(remove_url, NULL, NULL, APR_HOOK_MIDDLE); -} - -module AP_MODULE_DECLARE_DATA mem_cache_module = -{ - STANDARD20_MODULE_STUFF, - NULL, /* create per-directory config structure */ - NULL, /* merge per-directory config structures */ - create_cache_config, /* create per-server config structure */ - NULL, /* merge per-server config structures */ - cache_cmds, /* command apr_table_t */ - register_hooks -}; - diff --git a/modules/experimental/mod_mem_cache.dsp b/modules/experimental/mod_mem_cache.dsp deleted file mode 100644 index bbc9129134b55f713f2af53f09d4345e16b16a1c..0000000000000000000000000000000000000000 --- a/modules/experimental/mod_mem_cache.dsp +++ /dev/null @@ -1,111 +0,0 @@ -# Microsoft Developer Studio Project File - Name="mod_mem_cache" - Package Owner=<4> -# Microsoft Developer Studio Generated Build File, Format Version 6.00 -# ** DO NOT EDIT ** - -# TARGTYPE "Win32 (x86) Dynamic-Link Library" 0x0102 - -CFG=mod_mem_cache - Win32 Debug -!MESSAGE This is not a valid makefile. To build this project using NMAKE, -!MESSAGE use the Export Makefile command and run -!MESSAGE -!MESSAGE NMAKE /f "mod_mem_cache.mak". -!MESSAGE -!MESSAGE You can specify a configuration when running NMAKE -!MESSAGE by defining the macro CFG on the command line. For example: -!MESSAGE -!MESSAGE NMAKE /f "mod_mem_cache.mak" CFG="mod_mem_cache - Win32 Debug" -!MESSAGE -!MESSAGE Possible choices for configuration are: -!MESSAGE -!MESSAGE "mod_mem_cache - Win32 Release" (based on "Win32 (x86) Dynamic-Link Library") -!MESSAGE "mod_mem_cache - Win32 Debug" (based on "Win32 (x86) Dynamic-Link Library") -!MESSAGE - -# Begin Project -# PROP AllowPerConfigDependencies 0 -# PROP Scc_ProjName "" -# PROP Scc_LocalPath "" -CPP=cl.exe -MTL=midl.exe -RSC=rc.exe - -!IF "$(CFG)" == "mod_mem_cache - Win32 Release" - -# PROP BASE Use_MFC 0 -# PROP BASE Use_Debug_Libraries 0 -# PROP BASE Output_Dir "Release" -# PROP BASE Intermediate_Dir "Release" -# PROP BASE Target_Dir "" -# PROP Use_MFC 0 -# PROP Use_Debug_Libraries 0 -# PROP Output_Dir "Release" -# PROP Intermediate_Dir "Release" -# PROP Ignore_Export_Lib 0 -# PROP Target_Dir "" -# ADD BASE CPP /nologo /MT /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "mod_mem_cache_EXPORTS" /YX /FD /c -# ADD CPP /nologo /MT /W3 /GX /O2 /I "../../srclib/apr-util/include" /I "../../srclib/apr/include" /I "../../include" /I "../../os/win32" /D "NDEBUG" /D "WIN32" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /YX /FD /c -# ADD BASE MTL /nologo /D "NDEBUG" /mktyplib203 /win32 -# ADD MTL /nologo /D "NDEBUG" /mktyplib203 /win32 -# ADD BASE RSC /l 0x409 /d "NDEBUG" -# ADD RSC /l 0x409 /d "NDEBUG" -BSC32=bscmake.exe -# ADD BASE BSC32 /nologo -# ADD BSC32 /nologo -LINK32=link.exe -# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /machine:I386 -# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /machine:I386 /out:"Release/mod_mem_cache.so" - -!ELSEIF "$(CFG)" == "mod_mem_cache - Win32 Debug" - -# PROP BASE Use_MFC 0 -# PROP BASE Use_Debug_Libraries 1 -# PROP BASE Output_Dir "Debug" -# PROP BASE Intermediate_Dir "Debug" -# PROP BASE Target_Dir "" -# PROP Use_MFC 0 -# PROP Use_Debug_Libraries 1 -# PROP Output_Dir "Debug" -# PROP Intermediate_Dir "Debug" -# PROP Ignore_Export_Lib 0 -# PROP Target_Dir "" -# ADD BASE CPP /nologo /MTd /W3 /Gm /GX /Zi /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "mod_mem_cache_EXPORTS" /YX /FD /GZ /c -# ADD CPP /nologo /MTd /W3 /Gm /GX /Zi /Od /I "../../srclib/apr-util/include" /I "../../srclib/apr/include" /I "../../include" /I "../../os/win32" /D "_DEBUG" /D "WIN32" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /YX /FD /GZ /c -# ADD BASE MTL /nologo /D "_DEBUG" /mktyplib203 /win32 -# ADD MTL /nologo /D "_DEBUG" /mktyplib203 /win32 -# ADD BASE RSC /l 0x409 /d "_DEBUG" -# ADD RSC /l 0x409 /d "_DEBUG" -BSC32=bscmake.exe -# ADD BASE BSC32 /nologo -# ADD BSC32 /nologo -LINK32=link.exe -# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /debug /machine:I386 /pdbtype:sept -# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /debug /machine:I386 /out:"Debug/mod_mem_cache.so" /pdbtype:sept - -!ENDIF - -# Begin Target - -# Name "mod_mem_cache - Win32 Release" -# Name "mod_mem_cache - Win32 Debug" -# Begin Group "Source Files" - -# PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat" -# Begin Source File - -SOURCE=.\mod_mem_cache.c -# End Source File -# End Group -# Begin Group "Header Files" - -# PROP Default_Filter "h;hpp;hxx;hm;inl" -# Begin Source File - -SOURCE=.\mod_cache.h -# End Source File -# End Group -# Begin Group "Resource Files" - -# PROP Default_Filter "ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe" -# End Group -# End Target -# End Project diff --git a/modules/experimental/util_ldap.c b/modules/experimental/util_ldap.c deleted file mode 100644 index 4e9ca0e501557b4a1dd411f71a746fdbb2995598..0000000000000000000000000000000000000000 --- a/modules/experimental/util_ldap.c +++ /dev/null @@ -1,1105 +0,0 @@ -/* ==================================================================== - * The Apache Software License, Version 1.1 - * - * Copyright (c) 2000-2001 The Apache Software Foundation. All rights - * reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in - * the documentation and/or other materials provided with the - * distribution. - * - * 3. The end-user documentation included with the redistribution, - * if any, must include the following acknowledgment: - * "This product includes software developed by the - * Apache Software Foundation (http://www.apache.org/)." - * Alternately, this acknowledgment may appear in the software itself, - * if and wherever such third-party acknowledgments normally appear. - * - * 4. The names "Apache" and "Apache Software Foundation" must - * not be used to endorse or promote products derived from this - * software without prior written permission. For written - * permission, please contact apache@apache.org. - * - * 5. Products derived from this software may not be called "Apache", - * nor may "Apache" appear in their name, without prior written - * permission of the Apache Software Foundation. - * - * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED - * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES - * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR - * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF - * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND - * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, - * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT - * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * ==================================================================== - * - * This software consists of voluntary contributions made by many - * individuals on behalf of the Apache Software Foundation. For more - * information on the Apache Software Foundation, please see - * . - */ - -/* - * util_ldap.c: LDAP things - * - * Original code from auth_ldap module for Apache v1.3: - * Copyright 1998, 1999 Enbridge Pipelines Inc. - * Copyright 1999-2001 Dave Carrigan - */ - -#include - -#ifdef APU_HAS_LDAP - -#include -#include - -#include "ap_config.h" -#include "httpd.h" -#include "http_config.h" -#include "http_core.h" -#include "http_log.h" -#include "http_protocol.h" -#include "http_request.h" -#include "util_ldap.h" -#include "util_ldap_cache.h" - -#if APR_HAVE_UNISTD_H -#include -#endif - -module AP_MODULE_DECLARE_DATA ldap_module; - -int util_ldap_handler(request_rec *r); -void *util_ldap_create_config(apr_pool_t *p, server_rec *s); - - -/* - * Some definitions to help between various versions of apache. - */ - -#ifndef DOCTYPE_HTML_2_0 -#define DOCTYPE_HTML_2_0 "\n" -#endif - -#ifndef DOCTYPE_HTML_3_2 -#define DOCTYPE_HTML_3_2 "\n" -#endif - -#ifndef DOCTYPE_HTML_4_0S -#define DOCTYPE_HTML_4_0S "\n" -#endif - -#ifndef DOCTYPE_HTML_4_0T -#define DOCTYPE_HTML_4_0T "\n" -#endif - -#ifndef DOCTYPE_HTML_4_0F -#define DOCTYPE_HTML_4_0F "\n" -#endif - -/* - * Status Handler - * -------------- - * - * This handler generates a status page about the current performance of - * the LDAP cache. It is enabled as follows: - * - * - * SetHandler ldap-status - * - * - */ -int util_ldap_handler(request_rec *r) -{ - - r->allowed |= (1 << M_GET); - if (r->method_number != M_GET) - return DECLINED; - - if (strcmp(r->handler, "ldap-status")) { - return DECLINED; - } - - r->content_type = "text/html"; - if (r->header_only) - return OK; - - ap_rputs(DOCTYPE_HTML_3_2 - "LDAP Cache Information\n", r); - ap_rputs("

    LDAP Cache Information

    \n", r); - - ap_rputs("

    \n" - "\n" - "\n" - "" - "" - "" - "" - "" - "" - "" - "\n", r - ); - - ap_rputs(util_ald_cache_display(r->pool), r); - - ap_rputs("
    Cache NameEntriesAvg. Chain Len.HitsIns/RemPurgesAvg Purge Time
    \n

    \n", r); - - return OK; -} - -/* ------------------------------------------------------------------ */ - - -/* - * Closes an LDAP connection by unlocking it. The next time - * util_ldap_connection_find() is called this connection will be - * available for reuse. - */ -void util_ldap_connection_close(util_ldap_connection_t *ldc) -{ - - /* - * QUESTION: - * - * Is it safe leaving bound connections floating around between the - * different modules? Keeping the user bound is a performance boost, - * but it is also a potential security problem - maybe. - * - * For now we unbind the user when we finish with a connection, but - * we don't have to... - */ - - /* mark our connection as available for reuse */ - apr_lock_release(ldc->lock); - -} - - -/* - * Destroys an LDAP connection by unbinding. This function is registered - * with the pool cleanup function - causing the LDAP connections to be - * shut down cleanly on graceful restart. - */ -apr_status_t util_ldap_connection_destroy(void *param) -{ - util_ldap_connection_t *ldc = param; - - /* unbinding from the LDAP server */ - if (ldc->ldap) { - ldap_unbind_s(ldc->ldap); - ldc->bound = 0; - ldc->ldap = NULL; - } - - /* release the lock we were using */ - apr_lock_release(ldc->lock); - - return APR_SUCCESS; -} - - -/* - * Connect to the LDAP server and binds. Does not connect if already - * connected (i.e. ldc->ldap is non-NULL.) Does not bind if already bound. - * - * Returns LDAP_SUCCESS on success; and an error code on failure - */ -int util_ldap_connection_open(util_ldap_connection_t *ldc) -{ - int result = 0; - int failures = 0; - - -start_over: - if (failures++ > 10) { - /* too many failures - leave */ - return result; - } - - if (!ldc->ldap) { - ldc->bound = 0; - - /* opening connection to LDAP server */ - if ((ldc->ldap = ldap_init(ldc->host, ldc->port)) == NULL) { - /* couldn't connect */ - ldc->reason = "ldap_init() failed"; - return -1; - } - - /* add the cleanup to the pool */ - apr_pool_cleanup_register(ldc->pool, ldc, - util_ldap_connection_destroy, - apr_pool_cleanup_null); - - /* Set the alias dereferencing option */ -#if LDAP_VERSION_MAX == 2 - ldc->ldap->ld_deref = ldc->deref; -#else - result = ldap_set_option(ldc->ldap, LDAP_OPT_DEREF, &(ldc->deref)); - if (result != LDAP_SUCCESS) { - /* setting LDAP dereference option failed */ - /* we ignore this error */ - } -#endif /* LDAP_VERSION_MAX */ - -#ifdef APU_HAS_LDAP_NETSCAPE_SSL - if (ldc->netscapessl) { - if (!ldc->certdb) { - /* secure LDAP requested, but no CA cert defined */ - ldc->reason = "secure LDAP requested, but no CA cert defined"; - return -1; - } else { - result = ldapssl_install_routines(ldc->ldap); - if (result != LDAP_SUCCESS) { - /* SSL initialisation failed */ - ldc->reason = "ldapssl_install_routines() failed"; - return result; - } - result = ldap_set_option(ldc->ldap, LDAP_OPT_SSL, LDAP_OPT_ON); - if (result != LDAP_SUCCESS) { - /* SSL option failed */ - ldc->reason = "ldap_set_option() failed trying to set LDAP_OPT_SSL"; - return result; - } - } - } -#endif /* APU_HAS_LDAP_NETSCAPE_SSL */ - -#ifdef APU_HAS_LDAP_STARTTLS - if (ldc->starttls) { - int version = LDAP_VERSION3; - - /* Also we have to set the connection to use protocol version 3, - * since we're using TLS. */ - if ((result = ldap_set_option(ldc->ldap, LDAP_OPT_PROTOCOL_VERSION, - &version)) != LDAP_SUCCESS) { - /* setting LDAP version failed - ignore error */ - } - - /* - * In util_ldap_connection_find, we compare ldc->withtls to - * sec->starttls to see if we have a cache match. On the off - * chance that apache's config processing rotines set starttls to - * some other true value besides 1, we set it to 1 here to ensure - * that the comparison succeeds. - */ - ldc->starttls = 1; - - result = ldap_start_tls_s(ldc->ldap, NULL, NULL); - if (result != LDAP_SUCCESS) { - /* start TLS failed */ - ldc->withtls = 0; - ldc->reason = "ldap_start_tls_s() failed"; - return result; - } - ldc->withtls = 1; - } else { - ldc->withtls = 0; - } -#endif /* APU_HAS_LDAP_STARTTLS */ - } - - /* - * At this point the LDAP connection is guaranteed alive. If bound says - * that we're bound already, we can just return. - */ - if (ldc->bound) { - ldc->reason = "LDAP connection open successful (already bound)"; - return LDAP_SUCCESS; - } - - /* - * Now bind with the username/password provided by the - * configuration. It will be an anonymous bind if no u/p was - * provided. - */ - if ((result = ldap_simple_bind_s(ldc->ldap, ldc->binddn, ldc->bindpw)) - == LDAP_SERVER_DOWN) { - /* couldn't connect - try again */ - ldc->reason = "ldap_simple_bind_s() failed with server down"; - goto start_over; - } - - if (result != LDAP_SUCCESS) { - /* LDAP fatal error occured */ - ldc->reason = "ldap_simple_bind_s() failed"; - return result; - } - - /* note how we are bound */ - ldc->bound = 1; - - ldc->reason = "LDAP connection open successful"; - return LDAP_SUCCESS; -} - - -/* - * Find an existing ldap connection struct that matches the - * provided ldap connection parameters. - * - * If not found in the cache, a new ldc structure will be allocated from st->pool - * and returned to the caller. If found in the cache, a pointer to the existing - * ldc structure will be returned. - */ -util_ldap_connection_t *util_ldap_connection_find(request_rec *r, const char *host, int port, - const char *binddn, const char *bindpw, deref_options deref, - int netscapessl, int starttls) -{ - struct util_ldap_connection_t *l, *p; /* To traverse the linked list */ - - util_ldap_state_t *st = - (util_ldap_state_t *)ap_get_module_config(r->server->module_config, - &ldap_module); - - - /* mutex lock this function */ - if (!st->mutex) { - apr_lock_create(&st->mutex, APR_MUTEX, APR_INTRAPROCESS, NULL, st->pool); - } - apr_lock_acquire(st->mutex); - - /* Search for an exact connection match in the list that is not - * being used. - */ - for (l=st->connections,p=NULL; l; l=l->next) { - if ( (APR_SUCCESS == apr_lock_tryacquire(l->lock)) - && l->port == port - && strcmp(l->host, host) == 0 - && ( (!l->binddn && !binddn) || (l->binddn && binddn && !strcmp(l->binddn, binddn)) ) - && ( (!l->bindpw && !bindpw) || (l->bindpw && bindpw && !strcmp(l->bindpw, bindpw)) ) - && l->deref == deref -#ifdef APU_HAS_LDAP_NETSCAPE_SSL - && l->netscapessl == netscapessl -#endif -#ifdef APU_HAS_LDAP_STARTTLS - && l->withtls == starttls -#endif - ) - break; - p = l; - } - - /* If nothing found, search again, but we don't care about the - * binddn and bindpw this time. - */ - if (!l) { - for (l=st->connections,p=NULL; l; l=l->next) { - if ( (APR_SUCCESS == apr_lock_tryacquire(l->lock)) - && l->port == port - && strcmp(l->host, host) == 0 - && l->deref == deref -#ifdef APU_HAS_LDAP_NETSCAPE_SSL - && l->netscapessl == netscapessl -#endif -#ifdef APU_HAS_LDAP_STARTTLS - && l->withtls == starttls -#endif - ) { - /* the bind credentials have changed */ - l->bound = 0; - l->binddn = apr_pstrdup(st->pool, binddn); - l->bindpw = apr_pstrdup(st->pool, bindpw); - break; - } - p = l; - } - } - -/* artificially disable cache */ -//l = NULL; - - /* If no connection what found after the second search, we - * must create one. - */ - if (!l) { - - /* - * Add the new connection entry to the linked list. Note that we - * don't actually establish an LDAP connection yet; that happens - * the first time authentication is requested. - */ - /* create the details to the pool in st */ - l = apr_pcalloc(st->pool, sizeof(util_ldap_connection_t)); - apr_lock_create(&l->lock, APR_MUTEX, APR_INTRAPROCESS, NULL, st->pool); - apr_lock_acquire(l->lock); - l->pool = st->pool; - l->bound = 0; - l->host = apr_pstrdup(st->pool, host); - l->port = port; - l->deref = deref; - l->binddn = apr_pstrdup(st->pool, binddn); - l->bindpw = apr_pstrdup(st->pool, bindpw); - l->netscapessl = netscapessl; - l->starttls = starttls; - l->withtls = 0; - - if (p) { - p->next = l; - } - else { - st->connections = l; - } - } - - apr_lock_release(st->mutex); - return l; -} - -/* ------------------------------------------------------------------ */ - -/* - * Compares two DNs to see if they're equal. The only way to do this correctly is to - * search for the dn and then do ldap_get_dn() on the result. This should match the - * initial dn, since it would have been also retrieved with ldap_get_dn(). This is - * expensive, so if the configuration value compare_dn_on_server is - * false, just does an ordinary strcmp. - * - * The lock for the ldap cache should already be acquired. - */ -int util_ldap_cache_comparedn(request_rec *r, util_ldap_connection_t *ldc, - const char *url, const char *dn, const char *reqdn, - int compare_dn_on_server) -{ - int result = 0; - util_url_node_t *curl; - util_url_node_t curnode; - util_dn_compare_node_t *node; - util_dn_compare_node_t newnode; - int failures = 0; - LDAPMessage *res, *entry; - char *searchdn; - - util_ldap_state_t *st = - (util_ldap_state_t *)ap_get_module_config(r->server->module_config, - &ldap_module); - - - /* read lock this function */ - if (!util_ldap_cache_lock) { - apr_lock_create(&util_ldap_cache_lock, APR_READWRITE, APR_INTRAPROCESS, NULL, st->pool); - } - - /* get cache entry (or create one) */ - apr_lock_acquire_rw(util_ldap_cache_lock, APR_WRITER); - curnode.url = url; - curl = util_ald_cache_fetch(util_ldap_cache, &curnode); - if (curl == NULL) { - curl = util_ald_create_caches(st, url); - } - apr_lock_release(util_ldap_cache_lock); - - /* a simple compare? */ - if (!compare_dn_on_server) { - /* unlock this read lock */ - if (strcmp(dn, reqdn)) { - ldc->reason = "DN Comparison FALSE (direct strcmp())"; - return LDAP_COMPARE_FALSE; - } - else { - ldc->reason = "DN Comparison TRUE (direct strcmp())"; - return LDAP_COMPARE_TRUE; - } - } - - /* no - it's a server side compare */ - apr_lock_acquire_rw(util_ldap_cache_lock, APR_READER); - - /* is it in the compare cache? */ - newnode.reqdn = (char *)reqdn; - node = util_ald_cache_fetch(curl->dn_compare_cache, &newnode); - if (node != NULL) { - /* If it's in the cache, it's good */ - /* unlock this read lock */ - apr_lock_release(util_ldap_cache_lock); - ldc->reason = "DN Comparison TRUE (cached)"; - return LDAP_COMPARE_TRUE; - } - - /* unlock this read lock */ - apr_lock_release(util_ldap_cache_lock); - -start_over: - if (failures++ > 10) { - /* too many failures */ - return result; - } - - /* make a server connection */ - if (LDAP_SUCCESS != (result = util_ldap_connection_open(ldc))) { - /* connect to server failed */ - return result; - } - - /* search for reqdn */ - if ((result = ldap_search_ext_s(ldc->ldap, const_cast(reqdn), LDAP_SCOPE_BASE, - "(objectclass=*)", NULL, 1, - NULL, NULL, NULL, -1, &res)) == LDAP_SERVER_DOWN) { - util_ldap_connection_close(ldc); - ldc->reason = "DN Comparison ldap_search_ext_s() failed with server down"; - goto start_over; - } - if (result != LDAP_SUCCESS) { - /* search for reqdn failed - no match */ - ldc->reason = "DN Comparison ldap_search_ext_s() failed"; - return result; - } - - entry = ldap_first_entry(ldc->ldap, res); - searchdn = ldap_get_dn(ldc->ldap, entry); - - ldap_msgfree(res); - if (strcmp(dn, searchdn) != 0) { - /* compare unsuccessful */ - ldc->reason = "DN Comparison FALSE (checked on server)"; - result = LDAP_COMPARE_FALSE; - } - else { - /* compare successful - add to the compare cache */ - apr_lock_acquire_rw(util_ldap_cache_lock, APR_READER); - newnode.reqdn = (char *)reqdn; - newnode.dn = (char *)dn; - util_ald_cache_insert(curl->dn_compare_cache, &newnode); - apr_lock_release(util_ldap_cache_lock); - ldc->reason = "DN Comparison TRUE (checked on server)"; - result = LDAP_COMPARE_TRUE; - } - ldap_memfree(searchdn); - return result; - -} - -/* - * Does an generic ldap_compare operation. It accepts a cache that it will use - * to lookup the compare in the cache. We cache two kinds of compares - * (require group compares) and (require user compares). Each compare has a different - * cache node: require group includes the DN; require user does not because the - * require user cache is owned by the - * - */ -int util_ldap_cache_compare(request_rec *r, util_ldap_connection_t *ldc, - const char *url, const char *dn, - const char *attrib, const char *value) -{ - int result = 0; - util_url_node_t *curl; - util_url_node_t curnode; - util_compare_node_t *compare_nodep; - util_compare_node_t the_compare_node; - apr_time_t curtime; - int failures = 0; - - util_ldap_state_t *st = - (util_ldap_state_t *)ap_get_module_config(r->server->module_config, - &ldap_module); - - - /* read lock this function */ - if (!util_ldap_cache_lock) { - apr_lock_create(&util_ldap_cache_lock, APR_READWRITE, APR_INTRAPROCESS, NULL, st->pool); - } - - /* get cache entry (or create one) */ - apr_lock_acquire_rw(util_ldap_cache_lock, APR_WRITER); - curnode.url = url; - curl = util_ald_cache_fetch(util_ldap_cache, &curnode); - if (curl == NULL) { - curl = util_ald_create_caches(st, url); - } - apr_lock_release(util_ldap_cache_lock); - - /* make a comparison to the cache */ - apr_lock_acquire_rw(util_ldap_cache_lock, APR_READER); - curtime = apr_time_now(); - - the_compare_node.dn = (char *)dn; - the_compare_node.attrib = (char *)attrib; - the_compare_node.value = (char *)value; - the_compare_node.result = 0; - - compare_nodep = util_ald_cache_fetch(curl->compare_cache, &the_compare_node); - - if (compare_nodep != NULL) { - /* found it... */ - if (curtime - compare_nodep->lastcompare > st->compare_cache_ttl) { - /* ...but it is too old */ - util_ald_cache_remove(curl->compare_cache, compare_nodep); - } - else { - /* ...and it is good */ - /* unlock this read lock */ - apr_lock_release(util_ldap_cache_lock); - if (LDAP_COMPARE_TRUE == compare_nodep->result) { - ldc->reason = "Comparison true (cached)"; - return compare_nodep->result; - } - else if (LDAP_COMPARE_FALSE == compare_nodep->result) { - ldc->reason = "Comparison false (cached)"; - return compare_nodep->result; - } - else if (LDAP_NO_SUCH_ATTRIBUTE == compare_nodep->result) { - ldc->reason = "Comparison no such attribute (cached)"; - return compare_nodep->result; - } - else { - ldc->reason = "Comparison undefined (cached)"; - return compare_nodep->result; - } - } - } - /* unlock this read lock */ - apr_lock_release(util_ldap_cache_lock); - - -start_over: - if (failures++ > 10) { - /* too many failures */ - return result; - } - if (LDAP_SUCCESS != (result = util_ldap_connection_open(ldc))) { - /* connect failed */ - return result; - } - - if ((result = ldap_compare_s(ldc->ldap, const_cast(dn), - const_cast(attrib), const_cast(value))) - == LDAP_SERVER_DOWN) { - /* connection failed - try again */ - util_ldap_connection_close(ldc); - ldc->reason = "ldap_compare_s() failed with server down"; - goto start_over; - } - - ldc->reason = "Comparison complete"; - if ((LDAP_COMPARE_TRUE == result) || - (LDAP_COMPARE_FALSE == result) || - (LDAP_NO_SUCH_ATTRIBUTE == result)) { - /* compare completed; caching result */ - apr_lock_acquire_rw(util_ldap_cache_lock, APR_WRITER); - the_compare_node.lastcompare = curtime; - the_compare_node.result = result; - util_ald_cache_insert(curl->compare_cache, &the_compare_node); - apr_lock_release(util_ldap_cache_lock); - if (LDAP_COMPARE_TRUE == result) { - ldc->reason = "Comparison true (adding to cache)"; - return LDAP_COMPARE_TRUE; - } - else if (LDAP_COMPARE_FALSE == result) { - ldc->reason = "Comparison false (adding to cache)"; - return LDAP_COMPARE_FALSE; - } - else { - ldc->reason = "Comparison no such attribute (adding to cache)"; - return LDAP_NO_SUCH_ATTRIBUTE; - } - } - return result; -} - -int util_ldap_cache_checkuserid(request_rec *r, util_ldap_connection_t *ldc, - const char *url, const char *basedn, int scope, char **attrs, - const char *filter, const char *bindpw, const char **binddn, - const char ***retvals) -{ - const char **vals = NULL; - int result = 0; - LDAPMessage *res, *entry; - char *dn; - int count; - int failures = 0; - util_url_node_t *curl; /* Cached URL node */ - util_url_node_t curnode; - util_search_node_t *search_nodep; /* Cached search node */ - util_search_node_t the_search_node; - apr_time_t curtime; - - util_ldap_state_t *st = - (util_ldap_state_t *)ap_get_module_config(r->server->module_config, - &ldap_module); - - /* read lock this function */ - if (!util_ldap_cache_lock) { - apr_lock_create(&util_ldap_cache_lock, APR_READWRITE, APR_INTRAPROCESS, NULL, st->pool); - } - - /* Get the cache node for this url */ - apr_lock_acquire_rw(util_ldap_cache_lock, APR_WRITER); - curnode.url = url; - curl = (util_url_node_t *)util_ald_cache_fetch(util_ldap_cache, &curnode); - if (curl == NULL) { - curl = util_ald_create_caches(st, url); - } - apr_lock_release(util_ldap_cache_lock); - - apr_lock_acquire_rw(util_ldap_cache_lock, APR_READER); - the_search_node.username = filter; - search_nodep = util_ald_cache_fetch(curl->search_cache, &the_search_node); - if (search_nodep != NULL && search_nodep->bindpw) { - - /* found entry in search cache... */ - curtime = apr_time_now(); - - /* - * Remove this item from the cache if its expired, or if the - * sent password doesn't match the storepassword. - */ - if ((curtime - search_nodep->lastbind) > st->search_cache_ttl) { - /* ...but entry is too old */ - util_ald_cache_remove(curl->search_cache, search_nodep); - } - else if (strcmp(search_nodep->bindpw, bindpw) != 0) { - /* ...but cached password doesn't match sent password */ - util_ald_cache_remove(curl->search_cache, search_nodep); - } - else { - /* ...and entry is valid */ - *binddn = search_nodep->dn; - *retvals = search_nodep->vals; - apr_lock_release(util_ldap_cache_lock); - ldc->reason = "Authentication successful (cached)"; - return LDAP_SUCCESS; - } - } - /* unlock this read lock */ - apr_lock_release(util_ldap_cache_lock); - - - /* - * At this point, there is no valid cached search, so lets do the search. - */ - - /* - * If any LDAP operation fails due to LDAP_SERVER_DOWN, control returns here. - */ -start_over: - if (failures++ > 10) { - return result; - } - if (LDAP_SUCCESS != (result = util_ldap_connection_open(ldc))) { - return result; - } - - /* try do the search */ - if ((result = ldap_search_ext_s(ldc->ldap, - basedn, scope, - filter, attrs, 0, - NULL, NULL, NULL, -1, &res)) == LDAP_SERVER_DOWN) { - ldc->reason = "ldap_search_ext_s() for user failed with server down"; - goto start_over; - } - - /* if there is an error (including LDAP_NO_SUCH_OBJECT) return now */ - if (result != LDAP_SUCCESS) { - ldc->reason = "ldap_search_ext_s() for user failed"; - return result; - } - - /* - * We should have found exactly one entry; to find a different - * number is an error. - */ - count = ldap_count_entries(ldc->ldap, res); - if (count != 1) { - ldap_msgfree(res); - ldc->reason = "User is not unique (search found two or more matches)"; - return LDAP_NO_SUCH_OBJECT; - } - - entry = ldap_first_entry(ldc->ldap, res); - - /* Grab the dn, copy it into the pool, and free it again */ - dn = ldap_get_dn(ldc->ldap, entry); - *binddn = apr_pstrdup(st->pool, dn); - ldap_memfree(dn); - - /* - * A bind to the server with an empty password always succeeds, so - * we check to ensure that the password is not empty. This implies - * that users who actually do have empty passwords will never be - * able to authenticate with this module. I don't see this as a big - * problem. - */ - if (strlen(bindpw) <= 0) { - ldap_msgfree(res); - ldc->reason = "Empty password not allowed"; - return LDAP_INVALID_CREDENTIALS; - } - - /* - * Attempt to bind with the retrieved dn and the password. If the bind - * fails, it means that the password is wrong (the dn obviously - * exists, since we just retrieved it) - */ - if ((result = - ldap_simple_bind_s(ldc->ldap, *binddn, bindpw)) == - LDAP_SERVER_DOWN) { - ldc->reason = "ldap_simple_bind_s() to check user credentials failed with server down"; - goto start_over; - } - - /* failure? if so - return */ - if (result != LDAP_SUCCESS) { - ldc->reason = "ldap_simple_bind_s() to check user credentials failed"; - return result; - } - - /* - * Get values for the provided attributes. - */ - if (attrs) { - int k = 0; - int i = 0; - while (attrs[k++]); - vals = apr_pcalloc(r->pool, sizeof(char *) * (k+1)); - while (attrs[i]) { - char **values; - int j = 0; - char *str = NULL; - /* get values */ - values = ldap_get_values(ldc->ldap, entry, attrs[i]); - while (values && values[j]) { - str = str ? apr_pstrcat(r->pool, str, "; ", values[j], NULL) : apr_pstrdup(r->pool, values[j]); - j++; - } - vals[i] = str; - i++; - } - *retvals = vals; - } - - /* - * Add the new username to the search cache. - */ - apr_lock_acquire_rw(util_ldap_cache_lock, APR_WRITER); - the_search_node.username = filter; - the_search_node.dn = *binddn; - the_search_node.bindpw = bindpw; - the_search_node.lastbind = apr_time_now(); - the_search_node.vals = vals; - util_ald_cache_insert(curl->search_cache, &the_search_node); - ldap_msgfree(res); - apr_lock_release(util_ldap_cache_lock); - - ldc->reason = "Authentication successful"; - return LDAP_SUCCESS; -} - -#endif /* APU_HAS_LDAP */ - - - -/* ---------------------------------------- */ -/* config directives */ - - -static const char *util_ldap_set_cache_bytes(cmd_parms *cmd, void *dummy, const char *bytes) -{ - util_ldap_state_t *st = - (util_ldap_state_t *)ap_get_module_config(cmd->server->module_config, - &ldap_module); - - st->cache_bytes = atol(bytes); - - ap_log_error(APLOG_MARK, APLOG_DEBUG|APLOG_NOERRNO, 0, cmd->server, - "[%d] ldap cache: Setting shared memory cache size to %d bytes.", - getpid(), st->cache_bytes); - - return NULL; -} - -static const char *util_ldap_set_cache_ttl(cmd_parms *cmd, void *dummy, const char *ttl) -{ - util_ldap_state_t *st = - (util_ldap_state_t *)ap_get_module_config(cmd->server->module_config, - &ldap_module); - - st->search_cache_ttl = atol(ttl) * 1000000; - - ap_log_error(APLOG_MARK, APLOG_DEBUG|APLOG_NOERRNO, 0, cmd->server, - "[%d] ldap cache: Setting cache TTL to %ld microseconds.", - getpid(), st->search_cache_ttl); - - return NULL; -} - -static const char *util_ldap_set_cache_entries(cmd_parms *cmd, void *dummy, const char *size) -{ - util_ldap_state_t *st = - (util_ldap_state_t *)ap_get_module_config(cmd->server->module_config, - &ldap_module); - - - st->search_cache_size = atol(size); - if (st->search_cache_size < 0) { - st->search_cache_size = 0; - } - - ap_log_error(APLOG_MARK, APLOG_DEBUG|APLOG_NOERRNO, 0, cmd->server, - "[%d] ldap cache: Setting search cache size to %ld entries.", - getpid(), st->search_cache_size); - - return NULL; -} - -static const char *util_ldap_set_opcache_ttl(cmd_parms *cmd, void *dummy, const char *ttl) -{ - util_ldap_state_t *st = - (util_ldap_state_t *)ap_get_module_config(cmd->server->module_config, - &ldap_module); - - st->compare_cache_ttl = atol(ttl) * 1000000; - - ap_log_error(APLOG_MARK, APLOG_DEBUG|APLOG_NOERRNO, 0, cmd->server, - "[%d] ldap cache: Setting operation cache TTL to %ld microseconds.", - getpid(), st->compare_cache_ttl); - - return NULL; -} - -static const char *util_ldap_set_opcache_entries(cmd_parms *cmd, void *dummy, const char *size) -{ - util_ldap_state_t *st = - (util_ldap_state_t *)ap_get_module_config(cmd->server->module_config, - &ldap_module); - - st->compare_cache_size = atol(size); - if (st->compare_cache_size < 0) { - st->compare_cache_size = 0; - } - - ap_log_error(APLOG_MARK, APLOG_DEBUG|APLOG_NOERRNO, 0, cmd->server, - "[%d] ldap cache: Setting operation cache size to %ld entries.", - getpid(), st->compare_cache_size); - - return NULL; -} - -#ifdef APU_HAS_LDAPSSL_CLIENT_INIT -static const char *util_ldap_set_certdbpath(cmd_parms *cmd, void *dummy, const char *path) -{ - util_ldap_state_t *st = - (util_ldap_state_t *)ap_get_module_config(cmd->server->module_config, - &ldap_module); - - ap_log_error(APLOG_MARK, APLOG_DEBUG|APLOG_NOERRNO, 0, cmd->server, - "[%d] ldap cache: Setting LDAP SSL client certificate dbpath to %s.", - getpid(), path); - - st->have_certdb = 1; - if (ldapssl_client_init(path, NULL) != 0) { - return "Could not initialize SSL client"; - } - else { - return NULL; - } -} -#endif - -void *util_ldap_create_config(apr_pool_t *p, server_rec *s) -{ - util_ldap_state_t *st = - (util_ldap_state_t *)apr_pcalloc(p, sizeof(util_ldap_state_t)); - - st->pool = p; - - st->cache_bytes = 100000; - st->search_cache_ttl = 600000000; - st->search_cache_size = 1024; - st->compare_cache_ttl = 600000000; - st->compare_cache_size = 1024; - - st->connections = NULL; -#ifdef APU_HAS_LDAP_NETSCAPE_SSL - st->have_certdb = 0; -#endif - - return st; -} - -static void util_ldap_init_module(apr_pool_t *pool, server_rec *s) -{ - util_ldap_state_t *st = - (util_ldap_state_t *)ap_get_module_config(s->module_config, - &ldap_module); - - apr_status_t result = util_ldap_cache_init(pool, st->cache_bytes); - char buf[MAX_STRING_LEN]; - - apr_strerror(result, buf, sizeof(buf)); - ap_log_error(APLOG_MARK, APLOG_DEBUG|APLOG_NOERRNO, result, s, - "[%d] ldap cache init: %s", - getpid(), buf); -} - - -command_rec util_ldap_cmds[] = { - AP_INIT_TAKE1("LDAPSharedCacheSize", util_ldap_set_cache_bytes, NULL, RSRC_CONF, - "Sets the size of the shared memory cache in bytes. " - "Zero means disable the shared memory cache. Defaults to 100KB."), - - AP_INIT_TAKE1("LDAPCacheEntries", util_ldap_set_cache_entries, NULL, RSRC_CONF, - "Sets the maximum number of entries that are possible in the LDAP " - "search cache. " - "Zero means no limit; -1 disables the cache. Defaults to 1024 entries."), - - AP_INIT_TAKE1("LDAPCacheTTL", util_ldap_set_cache_ttl, NULL, RSRC_CONF, - "Sets the maximum time (in seconds) that an item can be cached in the LDAP " - "search cache. Zero means no limit. Defaults to 600 seconds (10 minutes)."), - - AP_INIT_TAKE1("LDAPOpCacheEntries", util_ldap_set_opcache_entries, NULL, RSRC_CONF, - "Sets the maximum number of entries that are possible in the LDAP " - "compare cache. " - "Zero means no limit; -1 disables the cache. Defaults to 1024 entries."), - - AP_INIT_TAKE1("LDAPOpCacheTTL", util_ldap_set_opcache_ttl, NULL, RSRC_CONF, - "Sets the maximum time (in seconds) that an item is cached in the LDAP " - "operation cache. Zero means no limit. Defaults to 600 seconds (10 minutes)."), - -#ifdef APU_HAS_LDAPSSL_CLIENT_INIT - AP_INIT_TAKE1("LDAPCertDBPath", util_ldap_set_certdbpath, NULL, RSRC_CONF, - "Specifies the file containing Certificate Authority certificates " - "for validating secure LDAP server certificates. This file must be the " - "cert7.db database used by Netscape Communicator"), -#endif - - {NULL} -}; - -static void util_ldap_register_hooks(apr_pool_t *p) -{ - ap_hook_child_init(util_ldap_init_module, NULL, NULL, APR_HOOK_MIDDLE); - ap_hook_handler(util_ldap_handler, NULL, NULL, APR_HOOK_MIDDLE); -} - -module ldap_module = { - STANDARD20_MODULE_STUFF, - NULL, /* dir config creater */ - NULL, /* dir merger --- default is to override */ - util_ldap_create_config, /* server config */ - NULL, /* merge server config */ - util_ldap_cmds, /* command table */ - util_ldap_register_hooks, /* set up request processing hooks */ -}; diff --git a/modules/experimental/util_ldap.def b/modules/experimental/util_ldap.def deleted file mode 100644 index d1fac89b354f38adb32e2e6ec90534b504857df0..0000000000000000000000000000000000000000 --- a/modules/experimental/util_ldap.def +++ /dev/null @@ -1,6 +0,0 @@ -EXPORT ldap_module -EXPORT util_ldap_connection_find -EXPORT util_ldap_connection_close -EXPORT util_ldap_cache_checkuserid -EXPORT util_ldap_cache_compare -EXPORT util_ldap_cache_comparedn diff --git a/modules/experimental/util_ldap_cache.c b/modules/experimental/util_ldap_cache.c deleted file mode 100644 index 9d9844ddd6c118a813204b51283f7b62aeac655f..0000000000000000000000000000000000000000 --- a/modules/experimental/util_ldap_cache.c +++ /dev/null @@ -1,309 +0,0 @@ -/* ==================================================================== - * The Apache Software License, Version 1.1 - * - * Copyright (c) 2000-2001 The Apache Software Foundation. All rights - * reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in - * the documentation and/or other materials provided with the - * distribution. - * - * 3. The end-user documentation included with the redistribution, - * if any, must include the following acknowledgment: - * "This product includes software developed by the - * Apache Software Foundation (http://www.apache.org/)." - * Alternately, this acknowledgment may appear in the software itself, - * if and wherever such third-party acknowledgments normally appear. - * - * 4. The names "Apache" and "Apache Software Foundation" must - * not be used to endorse or promote products derived from this - * software without prior written permission. For written - * permission, please contact apache@apache.org. - * - * 5. Products derived from this software may not be called "Apache", - * nor may "Apache" appear in their name, without prior written - * permission of the Apache Software Foundation. - * - * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED - * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES - * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR - * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF - * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND - * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, - * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT - * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * ==================================================================== - * - * This software consists of voluntary contributions made by many - * individuals on behalf of the Apache Software Foundation. For more - * information on the Apache Software Foundation, please see - * . - */ - -/* - * util_ldap_cache.c: LDAP cache things - * - * Original code from auth_ldap module for Apache v1.3: - * Copyright 1998, 1999 Enbridge Pipelines Inc. - * Copyright 1999-2001 Dave Carrigan - */ - -#include -#include "util_ldap.h" -#include "util_ldap_cache.h" - -#ifdef APU_HAS_LDAP - - - - -/* ------------------------------------------------------------------ */ - -unsigned long util_ldap_url_node_hash(void *n) -{ - util_url_node_t *node = (util_url_node_t *)n; - return util_ald_hash_string(1, node->url); -} - -int util_ldap_url_node_compare(void *a, void *b) -{ - util_url_node_t *na = (util_url_node_t *)a; - util_url_node_t *nb = (util_url_node_t *)b; - - return(strcmp(na->url, nb->url) == 0); -} - -void *util_ldap_url_node_copy(void *c) -{ - util_url_node_t *n = (util_url_node_t *)c; - util_url_node_t *node = (util_url_node_t *)util_ald_alloc(sizeof(util_url_node_t)); - - if (node) { - if (!(node->url = util_ald_strdup(n->url))) { - util_ald_free(node->url); - return NULL; - } - node->search_cache = n->search_cache; - node->compare_cache = n->compare_cache; - node->dn_compare_cache = n->dn_compare_cache; - return node; - } - else { - return NULL; - } -} - -void util_ldap_url_node_free(void *n) -{ - util_url_node_t *node = (util_url_node_t *)n; - - util_ald_free(node->url); - util_ald_destroy_cache(node->search_cache); - util_ald_destroy_cache(node->compare_cache); - util_ald_destroy_cache(node->dn_compare_cache); - util_ald_free(node); -} - -/* ------------------------------------------------------------------ */ - -/* Cache functions for search nodes */ -unsigned long util_ldap_search_node_hash(void *n) -{ - util_search_node_t *node = (util_search_node_t *)n; - return util_ald_hash_string(1, ((util_search_node_t *)(node))->username); -} - -int util_ldap_search_node_compare(void *a, void *b) -{ - return(strcmp(((util_search_node_t *)a)->username, - ((util_search_node_t *)b)->username) == 0); -} - -void *util_ldap_search_node_copy(void *c) -{ - util_search_node_t *node = (util_search_node_t *)c; - util_search_node_t *newnode = util_ald_alloc(sizeof(util_search_node_t)); - - /* safety check */ - if (newnode) { - - /* copy vals */ - if (node->vals) { - int k = 0; - int i = 0; - while (node->vals[k++]); - if (!(newnode->vals = util_ald_alloc(sizeof(char *) * (k+1)))) { - util_ldap_search_node_free(newnode); - return NULL; - } - while (node->vals[i]) { - if (!(newnode->vals[i] = util_ald_strdup(node->vals[i]))) { - util_ldap_search_node_free(newnode); - return NULL; - } - i++; - } - } - else { - newnode->vals = NULL; - } - if (!(newnode->username = util_ald_strdup(node->username)) || - !(newnode->dn = util_ald_strdup(node->dn)) || - !(newnode->bindpw = util_ald_strdup(node->bindpw)) ) { - util_ldap_search_node_free(newnode); - return NULL; - } - newnode->lastbind = node->lastbind; - - } - return (void *)newnode; -} - -void util_ldap_search_node_free(void *n) -{ - int i = 0; - util_search_node_t *node = (util_search_node_t *)n; - if (node->vals) { - while (node->vals[i]) { - util_ald_free(node->vals[i++]); - } - util_ald_free(node->vals); - } - util_ald_free(node->username); - util_ald_free(node->dn); - util_ald_free(node->bindpw); - util_ald_free(node); -} - -/* ------------------------------------------------------------------ */ - -unsigned long util_ldap_compare_node_hash(void *n) -{ - util_compare_node_t *node = (util_compare_node_t *)n; - return util_ald_hash_string(3, node->dn, node->attrib, node->value); -} - -int util_ldap_compare_node_compare(void *a, void *b) -{ - util_compare_node_t *na = (util_compare_node_t *)a; - util_compare_node_t *nb = (util_compare_node_t *)b; - return (strcmp(na->dn, nb->dn) == 0 && - strcmp(na->attrib, nb->attrib) == 0 && - strcmp(na->value, nb->value) == 0); -} - -void *util_ldap_compare_node_copy(void *c) -{ - util_compare_node_t *n = (util_compare_node_t *)c; - util_compare_node_t *node = (util_compare_node_t *)util_ald_alloc(sizeof(util_compare_node_t)); - - if (node) { - if (!(node->dn = util_ald_strdup(n->dn)) || - !(node->attrib = util_ald_strdup(n->attrib)) || - !(node->value = util_ald_strdup(n->value))) { - util_ldap_compare_node_free(node); - return NULL; - } - node->lastcompare = n->lastcompare; - node->result = n->result; - return node; - } - else { - return NULL; - } -} - -void util_ldap_compare_node_free(void *n) -{ - util_compare_node_t *node = (util_compare_node_t *)n; - util_ald_free(node->dn); - util_ald_free(node->attrib); - util_ald_free(node->value); - util_ald_free(node); -} - -/* ------------------------------------------------------------------ */ - -unsigned long util_ldap_dn_compare_node_hash(void *n) -{ - return util_ald_hash_string(1, ((util_dn_compare_node_t *)n)->reqdn); -} - -int util_ldap_dn_compare_node_compare(void *a, void *b) -{ - return (strcmp(((util_dn_compare_node_t *)a)->reqdn, - ((util_dn_compare_node_t *)b)->reqdn) == 0); -} - -void *util_ldap_dn_compare_node_copy(void *c) -{ - util_dn_compare_node_t *n = (util_dn_compare_node_t *)c; - util_dn_compare_node_t *node = (util_dn_compare_node_t *)util_ald_alloc(sizeof(util_dn_compare_node_t)); - if (node) { - if (!(node->reqdn = util_ald_strdup(n->reqdn)) || - !(node->dn = util_ald_strdup(n->dn))) { - util_ldap_dn_compare_node_free(node); - return NULL; - } - return node; - } - else { - return NULL; - } -} - -void util_ldap_dn_compare_node_free(void *n) -{ - util_dn_compare_node_t *node = (util_dn_compare_node_t *)n; - util_ald_free(node->reqdn); - util_ald_free(node->dn); - util_ald_free(node); -} - - -/* ------------------------------------------------------------------ */ -apr_status_t util_ldap_cache_child_kill(void *data); -apr_status_t util_ldap_cache_module_kill(void *data); - -apr_status_t util_ldap_cache_module_kill(void *data) -{ -#if APR_HAS_SHARED_MEMORY - if (util_ldap_shm != NULL) { - apr_status_t result = apr_shm_destroy(util_ldap_shm); - util_ldap_shm = NULL; - return result; - } -#endif - return APR_SUCCESS; -} - -apr_status_t util_ldap_cache_init(apr_pool_t *pool, apr_size_t reqsize) -{ - apr_status_t result = APR_SUCCESS; - apr_pool_cleanup_register(pool, NULL, util_ldap_cache_module_kill, apr_pool_cleanup_null); - -#if APR_HAS_SHARED_MEMORY - result = apr_shm_init(&util_ldap_shm, reqsize, "/tmp/ldap_cache", pool); -#endif - util_ldap_cache = util_ald_create_cache(50, - util_ldap_url_node_hash, - util_ldap_url_node_compare, - util_ldap_url_node_copy, - util_ldap_url_node_free); - return result; -} - - -#endif /* APU_HAS_LDAP */ diff --git a/modules/experimental/util_ldap_cache.h b/modules/experimental/util_ldap_cache.h deleted file mode 100644 index 18790eb8544fc349225a601f8c932a8e056a58ca..0000000000000000000000000000000000000000 --- a/modules/experimental/util_ldap_cache.h +++ /dev/null @@ -1,214 +0,0 @@ -/* ==================================================================== - * The Apache Software License, Version 1.1 - * - * Copyright (c) 2000-2001 The Apache Software Foundation. All rights - * reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in - * the documentation and/or other materials provided with the - * distribution. - * - * 3. The end-user documentation included with the redistribution, - * if any, must include the following acknowledgment: - * "This product includes software developed by the - * Apache Software Foundation (http://www.apache.org/)." - * Alternately, this acknowledgment may appear in the software itself, - * if and wherever such third-party acknowledgments normally appear. - * - * 4. The names "Apache" and "Apache Software Foundation" must - * not be used to endorse or promote products derived from this - * software without prior written permission. For written - * permission, please contact apache@apache.org. - * - * 5. Products derived from this software may not be called "Apache", - * nor may "Apache" appear in their name, without prior written - * permission of the Apache Software Foundation. - * - * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED - * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES - * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR - * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF - * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND - * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, - * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT - * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * ==================================================================== - * - * This software consists of voluntary contributions made by many - * individuals on behalf of the Apache Software Foundation. For more - * information on the Apache Software Foundation, please see - * . - */ - - -#ifndef APU_LDAP_CACHE_H -#define APU_LDAP_CACHE_H - -/* - * This switches LDAP support on or off. - */ - -/* this whole thing disappears if LDAP is not enabled */ -#ifdef APU_HAS_LDAP - - -/* - * LDAP Cache Manager - */ - -#include - -typedef struct util_cache_node_t { - void *payload; /* Pointer to the payload */ - time_t add_time; /* Time node was added to cache */ - struct util_cache_node_t *next; -} util_cache_node_t; - -typedef struct util_ald_cache_t { - unsigned long size; /* Size of cache array */ - unsigned long maxentries; /* Maximum number of cache entries */ - unsigned long numentries; /* Current number of cache entries */ - unsigned long fullmark; /* Used to keep track of when cache becomes 3/4 full */ - time_t marktime; /* Time that the cache became 3/4 full */ - unsigned long (*hash)(void *); /* Func to hash the payload */ - int (*compare)(void *, void *); /* Func to compare two payloads */ - void * (*copy)(void *); /* Func to alloc mem and copy payload to new mem */ - void (*free)(void *); /* Func to free mem used by the payload */ - util_cache_node_t **nodes; - - unsigned long numpurges; /* No. of times the cache has been purged */ - double avg_purgetime; /* Average time to purge the cache */ - time_t last_purge; /* Time of the last purge */ - unsigned long npurged; /* Number of elements purged in last purge. This is not - obvious: it won't be 3/4 the size of the cache if - there were a lot of expired entries. */ - - unsigned long fetches; /* Number of fetches */ - unsigned long hits; /* Number of cache hits */ - unsigned long inserts; /* Number of inserts */ - unsigned long removes; /* Number of removes */ -} util_ald_cache_t; - -#if APR_HAS_SHARED_MEMORY -apr_shmem_t *util_ldap_shm; -#endif -util_ald_cache_t *util_ldap_cache; -apr_lock_t *util_ldap_cache_lock; - -#ifndef WIN32 -#define ALD_MM_FILE_MODE ( S_IRUSR|S_IWUSR ) -#else -#define ALD_MM_FILE_MODE ( _S_IREAD|_S_IWRITE ) -#endif - - -/* - * LDAP Cache - */ - -/* - * Maintain a cache of LDAP URLs that the server handles. Each node in - * the cache contains the search cache for that URL, and a compare cache - * for the URL. The compare cash is populated when doing require group - * compares. - */ -typedef struct util_url_node_t { - const char *url; - util_ald_cache_t *search_cache; - util_ald_cache_t *compare_cache; - util_ald_cache_t *dn_compare_cache; -} util_url_node_t; - -/* - * We cache every successful search and bind operation, using the username - * as the key. Each node in the cache contains the returned DN, plus the - * password used to bind. - */ -typedef struct util_search_node_t { - const char *username; /* Cache key */ - const char *dn; /* DN returned from search */ - const char *bindpw; /* The most recently used bind password; - NULL if the bind failed */ - apr_time_t lastbind; /* Time of last successful bind */ - const char **vals; /* Values of queried attributes */ -} util_search_node_t; - -/* - * We cache every successful compare operation, using the DN, attrib, and - * value as the key. - */ -typedef struct util_compare_node_t { - const char *dn; /* DN, attrib and value combine to be the key */ - const char *attrib; - const char *value; - apr_time_t lastcompare; - int result; -} util_compare_node_t; - -/* - * We cache every successful compare dn operation, using the dn in the require - * statement and the dn fetched based on the client-provided username. - */ -typedef struct util_dn_compare_node_t { - const char *reqdn; /* The DN in the require dn statement */ - const char *dn; /* The DN found in the search */ -} util_dn_compare_node_t; - - -/* - * Function prototypes for LDAP cache - */ - -/* util_ldap_cache.c */ -unsigned long util_ldap_url_node_hash(void *n); -int util_ldap_url_node_compare(void *a, void *b); -void *util_ldap_url_node_copy(void *c); -void util_ldap_url_node_free(void *n); -unsigned long util_ldap_search_node_hash(void *n); -int util_ldap_search_node_compare(void *a, void *b); -void *util_ldap_search_node_copy(void *c); -void util_ldap_search_node_free(void *n); -unsigned long util_ldap_compare_node_hash(void *n); -int util_ldap_compare_node_compare(void *a, void *b); -void *util_ldap_compare_node_copy(void *c); -void util_ldap_compare_node_free(void *n); -unsigned long util_ldap_dn_compare_node_hash(void *n); -int util_ldap_dn_compare_node_compare(void *a, void *b); -void *util_ldap_dn_compare_node_copy(void *c); -void util_ldap_dn_compare_node_free(void *n); - - -/* util_ldap_cache_mgr.c */ - -void util_ald_free(const void *ptr); -void *util_ald_alloc(unsigned long size); -const char *util_ald_strdup(const char *s); -unsigned long util_ald_hash_string(int nstr, ...); -void util_ald_cache_purge(util_ald_cache_t *cache); -util_url_node_t *util_ald_create_caches(util_ldap_state_t *s, const char *url); -util_ald_cache_t *util_ald_create_cache(unsigned long maxentries, - unsigned long (*hashfunc)(void *), - int (*comparefunc)(void *, void *), - void * (*copyfunc)(void *), - void (*freefunc)(void *)); -void util_ald_destroy_cache(util_ald_cache_t *cache); -void *util_ald_cache_fetch(util_ald_cache_t *cache, void *payload); -void util_ald_cache_insert(util_ald_cache_t *cache, void *payload); -void util_ald_cache_remove(util_ald_cache_t *cache, void *payload); -char *util_ald_cache_display_stats(apr_pool_t *p, util_ald_cache_t *cache, - char *name); - -#endif /* APU_HAS_LDAP */ -#endif /* APU_LDAP_CACHE_H */ diff --git a/modules/experimental/util_ldap_cache_mgr.c b/modules/experimental/util_ldap_cache_mgr.c deleted file mode 100644 index 49eece895820ca5772942a741e8acdf1789f3869..0000000000000000000000000000000000000000 --- a/modules/experimental/util_ldap_cache_mgr.c +++ /dev/null @@ -1,537 +0,0 @@ -/* ==================================================================== - * The Apache Software License, Version 1.1 - * - * Copyright (c) 2000-2001 The Apache Software Foundation. All rights - * reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in - * the documentation and/or other materials provided with the - * distribution. - * - * 3. The end-user documentation included with the redistribution, - * if any, must include the following acknowledgment: - * "This product includes software developed by the - * Apache Software Foundation (http://www.apache.org/)." - * Alternately, this acknowledgment may appear in the software itself, - * if and wherever such third-party acknowledgments normally appear. - * - * 4. The names "Apache" and "Apache Software Foundation" must - * not be used to endorse or promote products derived from this - * software without prior written permission. For written - * permission, please contact apache@apache.org. - * - * 5. Products derived from this software may not be called "Apache", - * nor may "Apache" appear in their name, without prior written - * permission of the Apache Software Foundation. - * - * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED - * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES - * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR - * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF - * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND - * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, - * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT - * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * ==================================================================== - * - * This software consists of voluntary contributions made by many - * individuals on behalf of the Apache Software Foundation. For more - * information on the Apache Software Foundation, please see - * . - */ - -/* - * util_ldap_cache_mgr.c: LDAP cache manager things - * - * Original code from auth_ldap module for Apache v1.3: - * Copyright 1998, 1999 Enbridge Pipelines Inc. - * Copyright 1999-2001 Dave Carrigan - */ - -#include -#include "util_ldap.h" -#include "util_ldap_cache.h" -#include - -#ifdef APU_HAS_LDAP - -/* only here until strdup is gone */ -#include - -/* here till malloc is gone */ -#include - -static const int primes[] = -{ - 11, - 19, - 37, - 73, - 109, - 163, - 251, - 367, - 557, - 823, - 1237, - 1861, - 2777, - 4177, - 6247, - 9371, - 14057, - 21089, - 31627, - 47431, - 71143, - 106721, - 160073, - 240101, - 360163, - 540217, - 810343, - 1215497, - 1823231, - 2734867, - 4102283, - 6153409, - 9230113, - 13845163, - 0 -}; - -void util_ald_free(const void *ptr) -{ -#if APR_HAS_SHARED_MEMORY - if (util_ldap_shm) { - if (ptr) - apr_shm_free(util_ldap_shm, (void *)ptr); - } else { - if (ptr) - free((void *)ptr); - } -#else - if (ptr) - free((void *)ptr); -#endif -} - -void *util_ald_alloc(unsigned long size) -{ - if (0 == size) - return NULL; -#if APR_HAS_SHARED_MEMORY - if (util_ldap_shm) { - return (void *)apr_shm_calloc(util_ldap_shm, size); - } else { - return (void *)calloc(sizeof(char), size); - } -#else - return (void *)calloc(sizeof(char), size); -#endif -} - -const char *util_ald_strdup(const char *s) -{ -#if APR_HAS_SHARED_MEMORY - if (util_ldap_shm) { - char *buf = apr_shm_malloc(util_ldap_shm, strlen(s)+1); - if (buf) { - strcpy(buf, s); - return buf; - } - else { - return NULL; - } - } else { - return strdup(s); - } -#else - return strdup(s); -#endif -} - - -/* - * Computes the hash on a set of strings. The first argument is the number - * of strings to hash, the rest of the args are strings. - * Algorithm taken from glibc. - */ -unsigned long util_ald_hash_string(int nstr, ...) -{ - int i; - va_list args; - unsigned long h=0, g; - char *str, *p; - - va_start(args, nstr); - for (i=0; i < nstr; ++i) { - str = va_arg(args, char *); - for (p = str; *p; ++p) { - h = ( h << 4 ) + *p; - if ( ( g = h & 0xf0000000 ) ) { - h = h ^ (g >> 24); - h = h ^ g; - } - } - } - va_end(args); - - return h; -} - - -/* - Purges a cache that has gotten full. We keep track of the time that we - added the entry that made the cache 3/4 full, then delete all entries - that were added before that time. It's pretty simplistic, but time to - purge is only O(n), which is more important. -*/ -void util_ald_cache_purge(util_ald_cache_t *cache) -{ - int i; - util_cache_node_t *p, *q; - apr_time_t t; - - if (!cache) - return; - - cache->last_purge = apr_time_now(); - cache->npurged = 0; - cache->numpurges++; - - for (i=0; i < cache->size; ++i) { - p = cache->nodes[i]; - while (p != NULL) { - if (p->add_time < cache->marktime) { - q = p->next; - (*cache->free)(p->payload); - util_ald_free(p); - cache->numentries--; - cache->npurged++; - p = q; - } - else { - p = p->next; - } - } - } - - t = apr_time_now(); - cache->avg_purgetime = - ((t - cache->last_purge) + (cache->avg_purgetime * (cache->numpurges-1))) / - cache->numpurges; -} - - -/* - * create caches - */ -util_url_node_t *util_ald_create_caches(util_ldap_state_t *st, const char *url) -{ - util_url_node_t *curl = NULL; - util_ald_cache_t *search_cache; - util_ald_cache_t *compare_cache; - util_ald_cache_t *dn_compare_cache; - - /* create the three caches */ - search_cache = util_ald_create_cache(st->search_cache_size, - util_ldap_search_node_hash, - util_ldap_search_node_compare, - util_ldap_search_node_copy, - util_ldap_search_node_free); - compare_cache = util_ald_create_cache(st->compare_cache_size, - util_ldap_compare_node_hash, - util_ldap_compare_node_compare, - util_ldap_compare_node_copy, - util_ldap_compare_node_free); - dn_compare_cache = util_ald_create_cache(st->compare_cache_size, - util_ldap_dn_compare_node_hash, - util_ldap_dn_compare_node_compare, - util_ldap_dn_compare_node_copy, - util_ldap_dn_compare_node_free); - - /* check that all the caches initialised successfully */ - if (search_cache && compare_cache && dn_compare_cache) { - - curl = (util_url_node_t *)apr_pcalloc(st->pool, sizeof(util_url_node_t)); - curl->url = url; - curl->search_cache = search_cache; - curl->compare_cache = compare_cache; - curl->dn_compare_cache = dn_compare_cache; - - util_ald_cache_insert(util_ldap_cache, curl); - - } - - return curl; -} - - -util_ald_cache_t *util_ald_create_cache(unsigned long maxentries, - unsigned long (*hashfunc)(void *), - int (*comparefunc)(void *, void *), - void * (*copyfunc)(void *), - void (*freefunc)(void *)) -{ - util_ald_cache_t *cache; - int i; - - if (maxentries <= 0) - return NULL; - - cache = (util_ald_cache_t *)util_ald_alloc(sizeof(util_ald_cache_t)); - if (!cache) - return NULL; - - cache->maxentries = maxentries; - cache->numentries = 0; - cache->size = maxentries / 3; - if (cache->size < 64) cache->size = 64; - for (i = 0; primes[i] && primes[i] < cache->size; ++i) ; - cache->size = primes[i]? primes[i] : primes[i-1]; - - cache->nodes = (util_cache_node_t **)util_ald_alloc(cache->size * sizeof(util_cache_node_t *)); - if (!cache->nodes) { - util_ald_free(cache); - return NULL; - } - - for (i=0; i < cache->size; ++i) - cache->nodes[i] = NULL; - - cache->hash = hashfunc; - cache->compare = comparefunc; - cache->copy = copyfunc; - cache->free = freefunc; - - cache->fullmark = cache->maxentries / 4 * 3; - cache->marktime = 0; - cache->avg_purgetime = 0.0; - cache->numpurges = 0; - cache->last_purge = 0; - cache->npurged = 0; - - cache->fetches = 0; - cache->hits = 0; - cache->inserts = 0; - cache->removes = 0; - - return cache; -} - -void util_ald_destroy_cache(util_ald_cache_t *cache) -{ - int i; - util_cache_node_t *p, *q; - - if (cache == NULL) - return; - - for (i = 0; i < cache->size; ++i) { - p = cache->nodes[i]; - q = NULL; - while (p != NULL) { - q = p->next; - (*cache->free)(p->payload); - util_ald_free(p); - p = q; - } - } - util_ald_free(cache->nodes); -} - -void *util_ald_cache_fetch(util_ald_cache_t *cache, void *payload) -{ - int hashval; - util_cache_node_t *p; - - if (cache == NULL) - return NULL; - - cache->fetches++; - - hashval = (*cache->hash)(payload) % cache->size; - for (p = cache->nodes[hashval]; - p && !(*cache->compare)(p->payload, payload); - p = p->next) ; - - if (p != NULL) { - cache->hits++; - return p->payload; - } - else { - return NULL; - } -} - -/* - * Insert an item into the cache. - * *** Does not catch duplicates!!! *** - */ -void util_ald_cache_insert(util_ald_cache_t *cache, void *payload) -{ - int hashval; - util_cache_node_t *node; - - if (cache == NULL || payload == NULL) - return; - - cache->inserts++; - hashval = (*cache->hash)(payload) % cache->size; - node = (util_cache_node_t *)util_ald_alloc(sizeof(util_cache_node_t)); - node->add_time = apr_time_now(); - node->payload = (*cache->copy)(payload); - node->next = cache->nodes[hashval]; - cache->nodes[hashval] = node; - if (++cache->numentries == cache->fullmark) - cache->marktime=apr_time_now(); - if (cache->numentries >= cache->maxentries) - util_ald_cache_purge(cache); -} - -void util_ald_cache_remove(util_ald_cache_t *cache, void *payload) -{ - int hashval; - util_cache_node_t *p, *q; - - if (cache == NULL) - return; - - cache->removes++; - hashval = (*cache->hash)(payload) % cache->size; - for (p = cache->nodes[hashval], q=NULL; - p && !(*cache->compare)(p->payload, payload); - p = p->next) { - q = p; - } - - /* If p is null, it means that we couldn't find the node, so just return */ - if (p == NULL) - return; - - if (q == NULL) { - /* We found the node, and it's the first in the list */ - cache->nodes[hashval] = p->next; - } - else { - /* We found the node and it's not the first in the list */ - q->next = p->next; - } - (*cache->free)(p->payload); - util_ald_free(p); - cache->numentries--; -} - -char *util_ald_cache_display_stats(apr_pool_t *p, util_ald_cache_t *cache, char *name) -{ - int i; - int totchainlen = 0; - int nchains = 0; - double chainlen; - util_cache_node_t *n; - char *buf; - - if (cache == NULL) { - return ""; - } - - for (i=0; i < cache->size; ++i) { - if (cache->nodes[i] != NULL) { - nchains++; - for (n = cache->nodes[i]; n != NULL; n = n->next) - totchainlen++; - } - } - chainlen = nchains? (double)totchainlen / (double)nchains : 0; - - buf = apr_psprintf(p, - "
    %s%lu (%.0f%% full)%.1f%lu/%lu%.0f%%%lu/%lu%lu%s(none)%.2g
    Cache has not been enabled/initialised.
    \n\n", r); -#else - ap_rputs("

    \n\n

    SrvPIDAccM\nSSReqConnChildSlotClientVHostRequest
    \n\n", r); -#endif - } - - for (i = 0; i < HARD_SERVER_LIMIT; ++i) { - score_record = ap_scoreboard_image->servers[i]; - ps_record = ap_scoreboard_image->parent[i]; - vhost = score_record.vhostrec; - if (ps_record.generation != ap_my_generation) { - vhost = NULL; - } - -#if defined(NO_GETTIMEOFDAY) -#ifndef NO_TIMES - if (score_record.start_time == (clock_t) 0) -#endif /* NO_TIMES */ - req_time = 0L; -#ifndef NO_TIMES - else { - req_time = score_record.stop_time - score_record.start_time; - req_time = (req_time * 1000) / (int) tick; - } -#endif /* NO_TIMES */ -#else - if (score_record.start_time.tv_sec == 0L && - score_record.start_time.tv_usec == 0L) - req_time = 0L; - else - req_time = - ((score_record.stop_time.tv_sec - score_record.start_time.tv_sec) * 1000) + - ((score_record.stop_time.tv_usec - score_record.start_time.tv_usec) / 1000); -#endif - if (req_time < 0L) - req_time = 0L; - - lres = score_record.access_count; - my_lres = score_record.my_access_count; - conn_lres = score_record.conn_count; - bytes = score_record.bytes_served; - my_bytes = score_record.my_bytes_served; - conn_bytes = score_record.conn_bytes; - if (lres != 0 || (score_record.status != SERVER_READY - && score_record.status != SERVER_DEAD)) { - if (!short_report) { - if (no_table_report) { - if (score_record.status == SERVER_DEAD) - ap_rprintf(r, - "Server %d-%d (-): %d|%lu|%lu [", - i, (int) ps_record.generation, (int) conn_lres, - my_lres, lres); - else - ap_rprintf(r, - "Server %d-%d (%d): %d|%lu|%lu [", - i, (int) ps_record.generation, - (int) ps_record.pid, - (int) conn_lres, my_lres, lres); - - switch (score_record.status) { - case SERVER_READY: - ap_rputs("Ready", r); - break; - case SERVER_STARTING: - ap_rputs("Starting", r); - break; - case SERVER_BUSY_READ: - ap_rputs("Read", r); - break; - case SERVER_BUSY_WRITE: - ap_rputs("Write", r); - break; - case SERVER_BUSY_KEEPALIVE: - ap_rputs("Keepalive", r); - break; - case SERVER_BUSY_LOG: - ap_rputs("Logging", r); - break; - case SERVER_BUSY_DNS: - ap_rputs("DNS lookup", r); - break; - case SERVER_DEAD: - ap_rputs("Dead", r); - break; - case SERVER_GRACEFUL: - ap_rputs("Graceful", r); - break; - default: - ap_rputs("?STATE?", r); - break; - } -#ifdef NO_TIMES - /* Allow for OS/2 not having CPU stats */ - ap_rprintf(r, "]\n %.0f %ld (", -#else - - ap_rprintf(r, "] u%g s%g cu%g cs%g\n %.0f %ld (", - score_record.times.tms_utime / tick, - score_record.times.tms_stime / tick, - score_record.times.tms_cutime / tick, - score_record.times.tms_cstime / tick, -#endif -#ifdef OPTIMIZE_TIMEOUTS - difftime(nowtime, ps_record.last_rtime), -#else - difftime(nowtime, score_record.last_used), -#endif - (long) req_time); - format_byte_out(r, conn_bytes); - ap_rputs("|", r); - format_byte_out(r, my_bytes); - ap_rputs("|", r); - format_byte_out(r, bytes); - ap_rputs(")\n", r); - ap_rprintf(r, " %s {%s}[%s]
    \n\n", - score_record.client, - ap_escape_html(r->pool, score_record.request), - vhost ? vhost->server_hostname : "(unavailable)"); - } - else { /* !no_table_report */ - if (score_record.status == SERVER_DEAD) - ap_rprintf(r, - "\n\n"); - else - ap_rprintf(r, - "\n\n", - score_record.client, - vhost ? vhost->server_hostname : "(unavailable)", - ap_escape_html(r->pool, score_record.request)); - } /* no_table_report */ - } /* !short_report */ - } /* if () */ - } /* for () */ - - if (!(short_report || no_table_report)) { -#ifdef NO_TIMES - ap_rputs("
    SrvPIDAccMCPU\nSSReqConnChildSlotClientVHostRequest
    %d-%d-%d/%lu/%lu", - i, (int) ps_record.generation, - (int) conn_lres, my_lres, lres); - else - ap_rprintf(r, - "
    %d-%d%d%d/%lu/%lu", - i, (int) ps_record.generation, - (int) ps_record.pid, (int) conn_lres, - my_lres, lres); - - switch (score_record.status) { - case SERVER_READY: - ap_rputs("_", r); - break; - case SERVER_STARTING: - ap_rputs("S", r); - break; - case SERVER_BUSY_READ: - ap_rputs("R", r); - break; - case SERVER_BUSY_WRITE: - ap_rputs("W", r); - break; - case SERVER_BUSY_KEEPALIVE: - ap_rputs("K", r); - break; - case SERVER_BUSY_LOG: - ap_rputs("L", r); - break; - case SERVER_BUSY_DNS: - ap_rputs("D", r); - break; - case SERVER_DEAD: - ap_rputs(".", r); - break; - case SERVER_GRACEFUL: - ap_rputs("G", r); - break; - default: - ap_rputs("?", r); - break; - } -#ifdef NO_TIMES - /* Allow for OS/2 not having CPU stats */ - ap_rprintf(r, "\n%.0f%ld", -#else - ap_rprintf(r, "\n%.2f%.0f%ld", - (score_record.times.tms_utime + - score_record.times.tms_stime + - score_record.times.tms_cutime + - score_record.times.tms_cstime) / tick, -#endif -#ifdef OPTIMIZE_TIMEOUTS - difftime(nowtime, ps_record.last_rtime), -#else - difftime(nowtime, score_record.last_used), -#endif - (long) req_time); - ap_rprintf(r, "%-1.1f%-2.2f%-2.2f\n", - (float) conn_bytes / KBYTE, (float) my_bytes / MBYTE, - (float) bytes / MBYTE); - if (score_record.status == SERVER_BUSY_READ) - ap_rprintf(r, - "??..reading..
    %s%s%s
    \n \ -
    \ -\n \ -
    SrvChild Server number - generation\n \ -
    PIDOS process ID\n \ -
    AccNumber of accesses this connection / this child / this slot\n \ -
    MMode of operation\n \ -
    SSSeconds since beginning of most recent request\n \ -
    ReqMilliseconds required to process most recent request\n \ -
    ConnKilobytes transferred this connection\n \ -
    ChildMegabytes transferred this child\n \ -
    SlotTotal megabytes transferred this slot\n \ -
    \n", r); -#else - ap_rputs("\n \ -
    \ -\n \ -
    SrvChild Server number - generation\n \ -
    PIDOS process ID\n \ -
    AccNumber of accesses this connection / this child / this slot\n \ -
    MMode of operation\n \ -
    CPUCPU usage, number of seconds\n \ -
    SSSeconds since beginning of most recent request\n \ -
    ReqMilliseconds required to process most recent request\n \ -
    ConnKilobytes transferred this connection\n \ -
    ChildMegabytes transferred this child\n \ -
    SlotTotal megabytes transferred this slot\n \ -
    \n", r); -#endif - } - - } else { - - ap_rputs("
    To obtain a full report with current status information ", r); - ap_rputs("you need to use the ExtendedStatus On directive. \n", r); - - } - - if (!short_report) { - ap_rputs(ap_psignature("
    \n",r), r); - ap_rputs("\n", r); - } - - ap_kill_timeout(r); - return 0; -} - - -static void status_init(server_rec *s, pool *p) -{ - status_flags[SERVER_DEAD] = '.'; /* We don't want to assume these are in */ - status_flags[SERVER_READY] = '_'; /* any particular order in scoreboard.h */ - status_flags[SERVER_STARTING] = 'S'; - status_flags[SERVER_BUSY_READ] = 'R'; - status_flags[SERVER_BUSY_WRITE] = 'W'; - status_flags[SERVER_BUSY_KEEPALIVE] = 'K'; - status_flags[SERVER_BUSY_LOG] = 'L'; - status_flags[SERVER_BUSY_DNS] = 'D'; - status_flags[SERVER_GRACEFUL] = 'G'; -} - -static const handler_rec status_handlers[] = -{ - {STATUS_MAGIC_TYPE, status_handler}, - {"server-status", status_handler}, - {NULL} -}; - -module MODULE_VAR_EXPORT status_module = -{ - STANDARD_MODULE_STUFF, - status_init, /* initializer */ - NULL, /* dir config creater */ - NULL, /* dir merger --- default is to override */ - NULL, /* server config */ - NULL, /* merge server config */ - status_module_cmds, /* command table */ - status_handlers, /* handlers */ - NULL, /* filename translation */ - NULL, /* check_user_id */ - NULL, /* check auth */ - NULL, /* check access */ - NULL, /* type_checker */ - NULL, /* fixups */ - NULL, /* logger */ - NULL, /* header parser */ - NULL, /* child_init */ - NULL, /* child_exit */ - NULL /* post read-request */ -}; diff --git a/modules/generators/mod_status.dsp b/modules/generators/mod_status.dsp deleted file mode 100644 index 8bc9271959b0c4b8a462fe0cb3f5c210a7648458..0000000000000000000000000000000000000000 --- a/modules/generators/mod_status.dsp +++ /dev/null @@ -1,113 +0,0 @@ -# Microsoft Developer Studio Project File - Name="ApacheModuleStatus" - Package Owner=<4> -# Microsoft Developer Studio Generated Build File, Format Version 5.00 -# ** DO NOT EDIT ** - -# TARGTYPE "Win32 (x86) Dynamic-Link Library" 0x0102 - -CFG=ApacheModuleStatus - Win32 Release -!MESSAGE This is not a valid makefile. To build this project using NMAKE, -!MESSAGE use the Export Makefile command and run -!MESSAGE -!MESSAGE NMAKE /f "ApacheModuleStatus.mak". -!MESSAGE -!MESSAGE You can specify a configuration when running NMAKE -!MESSAGE by defining the macro CFG on the command line. For example: -!MESSAGE -!MESSAGE NMAKE /f "ApacheModuleStatus.mak"\ - CFG="ApacheModuleStatus - Win32 Release" -!MESSAGE -!MESSAGE Possible choices for configuration are: -!MESSAGE -!MESSAGE "ApacheModuleStatus - Win32 Release" (based on\ - "Win32 (x86) Dynamic-Link Library") -!MESSAGE "ApacheModuleStatus - Win32 Debug" (based on\ - "Win32 (x86) Dynamic-Link Library") -!MESSAGE - -# Begin Project -# PROP Scc_ProjName "" -# PROP Scc_LocalPath "" -CPP=cl.exe -MTL=midl.exe -RSC=rc.exe - -!IF "$(CFG)" == "ApacheModuleStatus - Win32 Release" - -# PROP BASE Use_MFC 0 -# PROP BASE Use_Debug_Libraries 0 -# PROP BASE Output_Dir ".\Release" -# PROP BASE Intermediate_Dir ".\Release" -# PROP BASE Target_Dir "" -# PROP Use_MFC 0 -# PROP Use_Debug_Libraries 0 -# PROP Output_Dir ".\ApacheModuleStatusR" -# PROP Intermediate_Dir ".\ApacheModuleStatusR" -# PROP Ignore_Export_Lib 0 -# PROP Target_Dir "" -# ADD BASE CPP /nologo /MT /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /YX /c -# ADD CPP /nologo /MD /W3 /GX /O2 /I "..\..\include" /D "NDEBUG" /D "WIN32" /D "_WINDOWS" /D "SHARED_MODULE" /YX /FD /c -# ADD BASE MTL /nologo /D "NDEBUG" /win32 -# ADD MTL /nologo /D "NDEBUG" /mktyplib203 /win32 -# ADD BASE RSC /l 0x809 /d "NDEBUG" -# ADD RSC /l 0x809 /d "NDEBUG" -BSC32=bscmake.exe -# ADD BASE BSC32 /nologo -# ADD BSC32 /nologo -LINK32=link.exe -# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:windows /dll /machine:I386 -# ADD LINK32 ..\..\CoreR\ApacheCore.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib /nologo /subsystem:windows /dll /machine:I386 - -!ELSEIF "$(CFG)" == "ApacheModuleStatus - Win32 Debug" - -# PROP BASE Use_MFC 0 -# PROP BASE Use_Debug_Libraries 1 -# PROP BASE Output_Dir ".\Debug" -# PROP BASE Intermediate_Dir ".\Debug" -# PROP BASE Target_Dir "" -# PROP Use_MFC 0 -# PROP Use_Debug_Libraries 1 -# PROP Output_Dir ".\ApacheModuleStatusD" -# PROP Intermediate_Dir ".\ApacheModuleStatusD" -# PROP Ignore_Export_Lib 0 -# PROP Target_Dir "" -# ADD BASE CPP /nologo /MTd /W3 /Gm /GX /Zi /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /YX /c -# ADD CPP /nologo /MDd /W3 /Gm /GX /Zi /Od /I "..\..\include" /D "_DEBUG" /D "WIN32" /D "_WINDOWS" /D "SHARED_MODULE" /YX /FD /c -# ADD BASE MTL /nologo /D "_DEBUG" /win32 -# ADD MTL /nologo /D "_DEBUG" /mktyplib203 /win32 -# ADD BASE RSC /l 0x809 /d "_DEBUG" -# ADD RSC /l 0x809 /d "_DEBUG" -BSC32=bscmake.exe -# ADD BASE BSC32 /nologo -# ADD BSC32 /nologo -LINK32=link.exe -# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:windows /dll /debug /machine:I386 -# ADD LINK32 ..\..\CoreD\ApacheCore.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib /nologo /subsystem:windows /dll /debug /machine:I386 - -!ENDIF - -# Begin Target - -# Name "ApacheModuleStatus - Win32 Release" -# Name "ApacheModuleStatus - Win32 Debug" -# Begin Group "Source Files" - -# PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;hpj;bat;for;f90" -# Begin Source File - -SOURCE=..\..\modules\standard\mod_status.c -# End Source File -# End Group -# Begin Group "Header Files" - -# PROP Default_Filter "h;hpp;hxx;hm;inl;fi;fd" -# Begin Source File - -SOURCE=.\readdir.h -# End Source File -# End Group -# Begin Group "Resource Files" - -# PROP Default_Filter "ico;cur;bmp;dlg;rc2;rct;bin;cnt;rtf;gif;jpg;jpeg;jpe" -# End Group -# End Target -# End Project diff --git a/modules/generators/mod_status.exp b/modules/generators/mod_status.exp deleted file mode 100644 index 5438093686c49e786c41beddbd0298a5057a3d3a..0000000000000000000000000000000000000000 --- a/modules/generators/mod_status.exp +++ /dev/null @@ -1 +0,0 @@ -status_module diff --git a/modules/generators/mod_suexec.c b/modules/generators/mod_suexec.c deleted file mode 100644 index bf3a70feb67ef5f6b6fb9174942a0c635ae9f7d5..0000000000000000000000000000000000000000 --- a/modules/generators/mod_suexec.c +++ /dev/null @@ -1,160 +0,0 @@ -/* ==================================================================== - * The Apache Software License, Version 1.1 - * - * Copyright (c) 2000 The Apache Software Foundation. All rights - * reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in - * the documentation and/or other materials provided with the - * distribution. - * - * 3. The end-user documentation included with the redistribution, - * if any, must include the following acknowledgment: - * "This product includes software developed by the - * Apache Software Foundation (http://www.apache.org/)." - * Alternately, this acknowledgment may appear in the software itself, - * if and wherever such third-party acknowledgments normally appear. - * - * 4. The names "Apache" and "Apache Software Foundation" must - * not be used to endorse or promote products derived from this - * software without prior written permission. For written - * permission, please contact apache@apache.org. - * - * 5. Products derived from this software may not be called "Apache", - * nor may "Apache" appear in their name, without prior written - * permission of the Apache Software Foundation. - * - * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED - * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES - * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR - * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF - * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND - * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, - * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT - * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * ==================================================================== - * - * This software consists of voluntary contributions made by many - * individuals on behalf of the Apache Software Foundation. For more - * information on the Apache Software Foundation, please see - * . - * - * Portions of this software are based upon public domain software - * originally written at the National Center for Supercomputing Applications, - * University of Illinois, Urbana-Champaign. - */ - -#include "httpd.h" -#include "http_config.h" -#include "http_core.h" -#include "http_request.h" -#include "apr_strings.h" -#include "suexec.h" -#include "unixd.h" - -module MODULE_VAR_EXPORT suexec_module; - -typedef struct { - ap_unix_identity_t ugid; - int active; -} suexec_config_t; - -/* - * Create a configuration specific to this module for a server or directory - * location, and fill it with the default settings. - */ -static void *mkconfig(apr_pool_t *p) -{ - suexec_config_t *cfg = apr_palloc(p, sizeof(suexec_config_t)); - - cfg->active = 0; - return cfg; -} - -/* - * Respond to a callback to create configuration record for a server or - * vhost environment. - */ -static void *create_mconfig_for_server(apr_pool_t *p, server_rec *s) -{ - return mkconfig(p); -} - -/* - * Respond to a callback to create a config record for a specific directory. - */ -static void *create_mconfig_for_directory(apr_pool_t *p, char *dir) -{ - return mkconfig(p); -} - -static const char *set_suexec_ugid(cmd_parms *cmd, void *mconfig, - char *uid, char *gid) -{ - suexec_config_t *cfg = (suexec_config_t *) mconfig; - const char *err = ap_check_cmd_context(cmd, NOT_IN_DIR_LOC_FILE|NOT_IN_LIMIT); - - if (err != NULL) { - return err; - } - if (unixd_config.suexec_enabled) { - cfg->ugid.uid = ap_uname2id(uid); - cfg->ugid.gid = ap_gname2id(gid); - cfg->active = 1; - } - else { - fprintf(stderr, - "Warning: SuexecUserGroup directive requires SUEXEC wrapper.\n"); - } - return NULL; -} - -static ap_unix_identity_t *get_suexec_id_doer(const request_rec *r) -{ - suexec_config_t *cfg = - (suexec_config_t *) ap_get_module_config(r->per_dir_config, &suexec_module); - - return cfg->active ? &cfg->ugid : NULL; -} - -/* - * Define the directives specific to this module. This structure is referenced - * later by the 'module' structure. - */ -static const command_rec suexec_cmds[] = -{ - /* XXX - Another important reason not to allow this in .htaccess is that - * the ap_[ug]name2id() is not thread-safe */ - AP_INIT_TAKE2("SuexecUserGroup", set_suexec_ugid, NULL, RSRC_CONF, - "User and group for spawned processes"), - { NULL } -}; - -static void suexec_hooks(void) -{ - ap_hook_get_suexec_identity(get_suexec_id_doer,NULL,NULL,AP_HOOK_MIDDLE); -} - -module MODULE_VAR_EXPORT suexec_module = -{ - STANDARD20_MODULE_STUFF, - create_mconfig_for_directory, /* create per-dir config */ - NULL, /* merge per-dir config */ - create_mconfig_for_server, /* server config */ - NULL, /* merge server config */ - suexec_cmds, /* command table */ - NULL, /* handlers */ - suexec_hooks /* register hooks */ -}; diff --git a/modules/generators/mod_suexec.h b/modules/generators/mod_suexec.h deleted file mode 100644 index e8b13ac7f2577293f72f592e45738d314c79eb1a..0000000000000000000000000000000000000000 --- a/modules/generators/mod_suexec.h +++ /dev/null @@ -1,64 +0,0 @@ -/* ==================================================================== - * The Apache Software License, Version 1.1 - * - * Copyright (c) 2000 The Apache Software Foundation. All rights - * reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in - * the documentation and/or other materials provided with the - * distribution. - * - * 3. The end-user documentation included with the redistribution, - * if any, must include the following acknowledgment: - * "This product includes software developed by the - * Apache Software Foundation (http://www.apache.org/)." - * Alternately, this acknowledgment may appear in the software itself, - * if and wherever such third-party acknowledgments normally appear. - * - * 4. The names "Apache" and "Apache Software Foundation" must - * not be used to endorse or promote products derived from this - * software without prior written permission. For written - * permission, please contact apache@apache.org. - * - * 5. Products derived from this software may not be called "Apache", - * nor may "Apache" appear in their name, without prior written - * permission of the Apache Software Foundation. - * - * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED - * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES - * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR - * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF - * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND - * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, - * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT - * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * ==================================================================== - * - * This software consists of voluntary contributions made by many - * individuals on behalf of the Apache Software Foundation. For more - * information on the Apache Software Foundation, please see - * . - * - * Portions of this software are based upon public domain software - * originally written at the National Center for Supercomputing Applications, - * University of Illinois, Urbana-Champaign. - */ -#include "unixd.h" - -typedef struct { - ap_unix_identity_t ugid; - int active; -} suexec_config_t; - diff --git a/modules/http/.cvsignore b/modules/http/.cvsignore deleted file mode 100644 index f2f7a70d2c9528e7ef84cf1b3bf9ff721fa08b08..0000000000000000000000000000000000000000 --- a/modules/http/.cvsignore +++ /dev/null @@ -1,10 +0,0 @@ -.deps -.libs -*.la -modules.mk -Makefile -*.lo -*.slo -*.so -*.dll -*.def diff --git a/modules/http/.indent.pro b/modules/http/.indent.pro deleted file mode 100644 index a9fbe9f9a1f2e6e7bcc54171c215bdacd44171ba..0000000000000000000000000000000000000000 --- a/modules/http/.indent.pro +++ /dev/null @@ -1,54 +0,0 @@ --i4 -npsl -di0 -br -nce -d0 -cli0 -npcs -nfc1 --TBUFF --TFILE --TTRANS --TUINT4 --T_trans --Tallow_options_t --Tapache_sfio --Tarray_header --Tbool_int --Tbuf_area --Tbuff_struct --Tbuffy --Tcmd_how --Tcmd_parms --Tcommand_rec --Tcommand_struct --Tconn_rec --Tcore_dir_config --Tcore_server_config --Tdir_maker_func --Tevent --Tglobals_s --Thandler_func --Thandler_rec --Tjoblist_s --Tlisten_rec --Tmerger_func --Tmode_t --Tmodule --Tmodule_struct --Tmutex --Tn_long --Tother_child_rec --Toverrides_t --Tparent_score --Tpid_t --Tpiped_log --Tpool --Trequest_rec --Trequire_line --Trlim_t --Tscoreboard --Tsemaphore --Tserver_addr_rec --Tserver_rec --Tserver_rec_chain --Tshort_score --Ttable --Ttable_entry --Tthread --Tu_wide_int --Tvtime_t --Twide_int diff --git a/modules/http/Makefile.in b/modules/http/Makefile.in deleted file mode 100644 index 167b343d0db75f7876a55cef1681570eba813202..0000000000000000000000000000000000000000 --- a/modules/http/Makefile.in +++ /dev/null @@ -1,3 +0,0 @@ - -include $(top_srcdir)/build/special.mk - diff --git a/modules/http/config2.m4 b/modules/http/config2.m4 deleted file mode 100644 index 5fec30cc47a30e6d86120773a429025887f56fe4..0000000000000000000000000000000000000000 --- a/modules/http/config2.m4 +++ /dev/null @@ -1,10 +0,0 @@ -dnl modules enabled in this directory by default - -APACHE_MODPATH_INIT(http) - -http_objects="http_core.lo http_protocol.lo http_request.lo" - -APACHE_MODULE(http, HTTP protocol handling, $http_objects, , yes) -APACHE_MODULE(mime, mapping of file-extension to MIME, , , yes) - -APACHE_MODPATH_FINISH diff --git a/modules/http/http_core.c b/modules/http/http_core.c deleted file mode 100644 index e02d32ec5f45e44afe47929de88915f8c70b8131..0000000000000000000000000000000000000000 --- a/modules/http/http_core.c +++ /dev/null @@ -1,3214 +0,0 @@ -/* ==================================================================== - * Copyright (c) 1995-1999 The Apache Group. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in - * the documentation and/or other materials provided with the - * distribution. - * - * 3. All advertising materials mentioning features or use of this - * software must display the following acknowledgment: - * "This product includes software developed by the Apache Group - * for use in the Apache HTTP server project (http://www.apache.org/)." - * - * 4. The names "Apache Server" and "Apache Group" must not be used to - * endorse or promote products derived from this software without - * prior written permission. For written permission, please contact - * apache@apache.org. - * - * 5. Products derived from this software may not be called "Apache" - * nor may "Apache" appear in their names without prior written - * permission of the Apache Group. - * - * 6. Redistributions of any form whatsoever must retain the following - * acknowledgment: - * "This product includes software developed by the Apache Group - * for use in the Apache HTTP server project (http://www.apache.org/)." - * - * THIS SOFTWARE IS PROVIDED BY THE APACHE GROUP ``AS IS'' AND ANY - * EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR - * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE APACHE GROUP OR - * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT - * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, - * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED - * OF THE POSSIBILITY OF SUCH DAMAGE. - * ==================================================================== - * - * This software consists of voluntary contributions made by many - * individuals on behalf of the Apache Group and was originally based - * on public domain software written at the National Center for - * Supercomputing Applications, University of Illinois, Urbana-Champaign. - * For more information on the Apache Group and the Apache HTTP server - * project, please see . - * - */ - -#define CORE_PRIVATE -#include "httpd.h" -#include "http_config.h" -#include "http_core.h" -#include "http_protocol.h" /* For index_of_response(). Grump. */ -#include "http_request.h" -#include "http_conf_globals.h" -#include "http_vhost.h" -#include "http_main.h" /* For the default_handler below... */ -#include "http_log.h" -#include "rfc1413.h" -#include "util_md5.h" -#include "scoreboard.h" -#include "fnmatch.h" - -#ifdef USE_MMAP_FILES -#include - -/* mmap support for static files based on ideas from John Heidemann's - * patch against 1.0.5. See - * . - */ - -/* Files have to be at least this big before they're mmap()d. This is to deal - * with systems where the expense of doing an mmap() and an munmap() outweighs - * the benefit for small files. It shouldn't be set lower than 1. - */ -#ifndef MMAP_THRESHOLD -#ifdef SUNOS4 -#define MMAP_THRESHOLD (8*1024) -#else -#define MMAP_THRESHOLD 1 -#endif -#endif -#endif -#ifndef MMAP_LIMIT -#define MMAP_LIMIT (4*1024*1024) -#endif - -/* Server core module... This module provides support for really basic - * server operations, including options and commands which control the - * operation of other modules. Consider this the bureaucracy module. - * - * The core module also defines handlers, etc., do handle just enough - * to allow a server with the core module ONLY to actually serve documents - * (though it slaps DefaultType on all of 'em); this was useful in testing, - * but may not be worth preserving. - * - * This file could almost be mod_core.c, except for the stuff which affects - * the http_conf_globals. - */ - -static void *create_core_dir_config(pool *a, char *dir) -{ - core_dir_config *conf; - - conf = (core_dir_config *)ap_pcalloc(a, sizeof(core_dir_config)); - if (!dir || dir[strlen(dir) - 1] == '/') { - conf->d = dir; - } - else if (strncmp(dir, "proxy:", 6) == 0) { - conf->d = ap_pstrdup(a, dir); - } - else { - conf->d = ap_pstrcat(a, dir, "/", NULL); - } - conf->d_is_fnmatch = conf->d ? (ap_is_fnmatch(conf->d) != 0) : 0; - conf->d_components = conf->d ? ap_count_dirs(conf->d) : 0; - - conf->opts = dir ? OPT_UNSET : OPT_UNSET|OPT_ALL; - conf->opts_add = conf->opts_remove = OPT_NONE; - conf->override = dir ? OR_UNSET : OR_UNSET|OR_ALL; - - conf->content_md5 = 2; - - conf->use_canonical_name = USE_CANONICAL_NAME_UNSET; - - conf->hostname_lookups = HOSTNAME_LOOKUP_UNSET; - conf->do_rfc1413 = DEFAULT_RFC1413 | 2; /* set bit 1 to indicate default */ - conf->satisfy = SATISFY_NOSPEC; - -#ifdef RLIMIT_CPU - conf->limit_cpu = NULL; -#endif -#if defined(RLIMIT_DATA) || defined(RLIMIT_VMEM) || defined(RLIMIT_AS) - conf->limit_mem = NULL; -#endif -#ifdef RLIMIT_NPROC - conf->limit_nproc = NULL; -#endif - - conf->limit_req_body = 0; - conf->sec = ap_make_array(a, 2, sizeof(void *)); -#ifdef WIN32 - conf->script_interpreter_source = INTERPRETER_SOURCE_UNSET; -#endif - - conf->server_signature = srv_sig_unset; - - return (void *)conf; -} - -static void *merge_core_dir_configs(pool *a, void *basev, void *newv) -{ - core_dir_config *base = (core_dir_config *)basev; - core_dir_config *new = (core_dir_config *)newv; - core_dir_config *conf; - int i; - - conf = (core_dir_config *)ap_palloc(a, sizeof(core_dir_config)); - memcpy((char *)conf, (const char *)base, sizeof(core_dir_config)); - if (base->response_code_strings) { - conf->response_code_strings = - ap_palloc(a, sizeof(*conf->response_code_strings) - * RESPONSE_CODES); - memcpy(conf->response_code_strings, base->response_code_strings, - sizeof(*conf->response_code_strings) * RESPONSE_CODES); - } - - conf->d = new->d; - conf->d_is_fnmatch = new->d_is_fnmatch; - conf->d_components = new->d_components; - conf->r = new->r; - - if (new->opts & OPT_UNSET) { - /* there was no explicit setting of new->opts, so we merge - * preserve the invariant (opts_add & opts_remove) == 0 - */ - conf->opts_add = (conf->opts_add & ~new->opts_remove) | new->opts_add; - conf->opts_remove = (conf->opts_remove & ~new->opts_add) - | new->opts_remove; - conf->opts = (conf->opts & ~conf->opts_remove) | conf->opts_add; - if ((base->opts & OPT_INCNOEXEC) && (new->opts & OPT_INCLUDES)) { - conf->opts = (conf->opts & ~OPT_INCNOEXEC) | OPT_INCLUDES; - } - } - else { - /* otherwise we just copy, because an explicit opts setting - * overrides all earlier +/- modifiers - */ - conf->opts = new->opts; - conf->opts_add = new->opts_add; - conf->opts_remove = new->opts_remove; - } - - if (!(new->override & OR_UNSET)) { - conf->override = new->override; - } - if (new->ap_default_type) { - conf->ap_default_type = new->ap_default_type; - } - - if (new->ap_auth_type) { - conf->ap_auth_type = new->ap_auth_type; - } - if (new->ap_auth_name) { - conf->ap_auth_name = new->ap_auth_name; - } - if (new->ap_requires) { - conf->ap_requires = new->ap_requires; - } - - if (new->response_code_strings) { - if (conf->response_code_strings == NULL) { - conf->response_code_strings = ap_palloc(a, - sizeof(*conf->response_code_strings) * RESPONSE_CODES); - memcpy(conf->response_code_strings, new->response_code_strings, - sizeof(*conf->response_code_strings) * RESPONSE_CODES); - } - else { - for (i = 0; i < RESPONSE_CODES; ++i) { - if (new->response_code_strings[i] != NULL) { - conf->response_code_strings[i] - = new->response_code_strings[i]; - } - } - } - } - if (new->hostname_lookups != HOSTNAME_LOOKUP_UNSET) { - conf->hostname_lookups = new->hostname_lookups; - } - if ((new->do_rfc1413 & 2) == 0) { - conf->do_rfc1413 = new->do_rfc1413; - } - if ((new->content_md5 & 2) == 0) { - conf->content_md5 = new->content_md5; - } - if (new->use_canonical_name != USE_CANONICAL_NAME_UNSET) { - conf->use_canonical_name = new->use_canonical_name; - } - -#ifdef RLIMIT_CPU - if (new->limit_cpu) { - conf->limit_cpu = new->limit_cpu; - } -#endif -#if defined(RLIMIT_DATA) || defined(RLIMIT_VMEM) || defined(RLIMIT_AS) - if (new->limit_mem) { - conf->limit_mem = new->limit_mem; - } -#endif -#ifdef RLIMIT_NPROC - if (new->limit_nproc) { - conf->limit_nproc = new->limit_nproc; - } -#endif - - if (new->limit_req_body) { - conf->limit_req_body = new->limit_req_body; - } - conf->sec = ap_append_arrays(a, base->sec, new->sec); - - if (new->satisfy != SATISFY_NOSPEC) { - conf->satisfy = new->satisfy; - } - -#ifdef WIN32 - if (new->script_interpreter_source != INTERPRETER_SOURCE_UNSET) { - conf->script_interpreter_source = new->script_interpreter_source; - } -#endif - - if (new->server_signature != srv_sig_unset) { - conf->server_signature = new->server_signature; - } - - return (void*)conf; -} - -static void *create_core_server_config(pool *a, server_rec *s) -{ - core_server_config *conf; - int is_virtual = s->is_virtual; - - conf = (core_server_config *)ap_pcalloc(a, sizeof(core_server_config)); -#ifdef GPROF - conf->gprof_dir = NULL; -#endif - conf->access_name = is_virtual ? NULL : DEFAULT_ACCESS_FNAME; - conf->ap_document_root = is_virtual ? NULL : DOCUMENT_LOCATION; - conf->sec = ap_make_array(a, 40, sizeof(void *)); - conf->sec_url = ap_make_array(a, 40, sizeof(void *)); - - return (void *)conf; -} - -static void *merge_core_server_configs(pool *p, void *basev, void *virtv) -{ - core_server_config *base = (core_server_config *)basev; - core_server_config *virt = (core_server_config *)virtv; - core_server_config *conf; - - conf = (core_server_config *)ap_pcalloc(p, sizeof(core_server_config)); - *conf = *virt; - if (!conf->access_name) { - conf->access_name = base->access_name; - } - if (!conf->ap_document_root) { - conf->ap_document_root = base->ap_document_root; - } - conf->sec = ap_append_arrays(p, base->sec, virt->sec); - conf->sec_url = ap_append_arrays(p, base->sec_url, virt->sec_url); - - return conf; -} - -/* Add per-directory configuration entry (for section); - * these are part of the core server config. - */ - -CORE_EXPORT(void) ap_add_per_dir_conf(server_rec *s, void *dir_config) -{ - core_server_config *sconf = ap_get_module_config(s->module_config, - &core_module); - void **new_space = (void **)ap_push_array(sconf->sec); - - *new_space = dir_config; -} - -CORE_EXPORT(void) ap_add_per_url_conf(server_rec *s, void *url_config) -{ - core_server_config *sconf = ap_get_module_config(s->module_config, - &core_module); - void **new_space = (void **)ap_push_array(sconf->sec_url); - - *new_space = url_config; -} - -CORE_EXPORT(void) ap_add_file_conf(core_dir_config *conf, void *url_config) -{ - void **new_space = (void **)ap_push_array(conf->sec); - - *new_space = url_config; -} - -/* core_reorder_directories reorders the directory sections such that the - * 1-component sections come first, then the 2-component, and so on, finally - * followed by the "special" sections. A section is "special" if it's a regex, - * or if it doesn't start with / -- consider proxy: matching. All movements - * are in-order to preserve the ordering of the sections from the config files. - * See directory_walk(). - */ - -#ifdef HAVE_DRIVE_LETTERS -#define IS_SPECIAL(entry_core) \ - ((entry_core)->r != NULL \ - || ((entry_core)->d[0] != '/' && (entry_core)->d[1] != ':')) -#else -#define IS_SPECIAL(entry_core) \ - ((entry_core)->r != NULL || (entry_core)->d[0] != '/') -#endif - -/* We need to do a stable sort, qsort isn't stable. So to make it stable - * we'll be maintaining the original index into the list, and using it - * as the minor key during sorting. The major key is the number of - * components (where a "special" section has infinite components). - */ -struct reorder_sort_rec { - void *elt; - int orig_index; -}; - -static int reorder_sorter(const void *va, const void *vb) -{ - const struct reorder_sort_rec *a = va; - const struct reorder_sort_rec *b = vb; - core_dir_config *core_a; - core_dir_config *core_b; - - core_a = (core_dir_config *)ap_get_module_config(a->elt, &core_module); - core_b = (core_dir_config *)ap_get_module_config(b->elt, &core_module); - if (IS_SPECIAL(core_a)) { - if (!IS_SPECIAL(core_b)) { - return 1; - } - } - else if (IS_SPECIAL(core_b)) { - return -1; - } - else { - /* we know they're both not special */ - if (core_a->d_components < core_b->d_components) { - return -1; - } - else if (core_a->d_components > core_b->d_components) { - return 1; - } - } - /* Either they're both special, or they're both not special and have the - * same number of components. In any event, we now have to compare - * the minor key. */ - return a->orig_index - b->orig_index; -} - -void ap_core_reorder_directories(pool *p, server_rec *s) -{ - core_server_config *sconf; - array_header *sec; - struct reorder_sort_rec *sortbin; - int nelts; - void **elts; - int i; - pool *tmp; - - sconf = ap_get_module_config(s->module_config, &core_module); - sec = sconf->sec; - nelts = sec->nelts; - elts = (void **)sec->elts; - - /* we have to allocate tmp space to do a stable sort */ - tmp = ap_make_sub_pool(p); - sortbin = ap_palloc(tmp, sec->nelts * sizeof(*sortbin)); - for (i = 0; i < nelts; ++i) { - sortbin[i].orig_index = i; - sortbin[i].elt = elts[i]; - } - - qsort(sortbin, nelts, sizeof(*sortbin), reorder_sorter); - - /* and now copy back to the original array */ - for (i = 0; i < nelts; ++i) { - elts[i] = sortbin[i].elt; - } - - ap_destroy_pool(tmp); -} - -/***************************************************************** - * - * There are some elements of the core config structures in which - * other modules have a legitimate interest (this is ugly, but necessary - * to preserve NCSA back-compatibility). So, we have a bunch of accessors - * here... - */ - -API_EXPORT(int) ap_allow_options(request_rec *r) -{ - core_dir_config *conf = - (core_dir_config *)ap_get_module_config(r->per_dir_config, &core_module); - - return conf->opts; -} - -API_EXPORT(int) ap_allow_overrides(request_rec *r) -{ - core_dir_config *conf; - conf = (core_dir_config *)ap_get_module_config(r->per_dir_config, - &core_module); - - return conf->override; -} - -API_EXPORT(const char *) ap_auth_type(request_rec *r) -{ - core_dir_config *conf; - - conf = (core_dir_config *)ap_get_module_config(r->per_dir_config, - &core_module); - return conf->ap_auth_type; -} - -API_EXPORT(const char *) ap_auth_name(request_rec *r) -{ - core_dir_config *conf; - - conf = (core_dir_config *)ap_get_module_config(r->per_dir_config, - &core_module); - return conf->ap_auth_name; -} - -API_EXPORT(const char *) ap_default_type(request_rec *r) -{ - core_dir_config *conf; - - conf = (core_dir_config *)ap_get_module_config(r->per_dir_config, - &core_module); - return conf->ap_default_type - ? conf->ap_default_type - : DEFAULT_CONTENT_TYPE; -} - -API_EXPORT(const char *) ap_document_root(request_rec *r) /* Don't use this! */ -{ - core_server_config *conf; - - conf = (core_server_config *)ap_get_module_config(r->server->module_config, - &core_module); - return conf->ap_document_root; -} - -API_EXPORT(const array_header *) ap_requires(request_rec *r) -{ - core_dir_config *conf; - - conf = (core_dir_config *)ap_get_module_config(r->per_dir_config, - &core_module); - return conf->ap_requires; -} - -API_EXPORT(int) ap_satisfies(request_rec *r) -{ - core_dir_config *conf; - - conf = (core_dir_config *)ap_get_module_config(r->per_dir_config, - &core_module); - - return conf->satisfy; -} - -/* Should probably just get rid of this... the only code that cares is - * part of the core anyway (and in fact, it isn't publicised to other - * modules). - */ - -char *ap_response_code_string(request_rec *r, int error_index) -{ - core_dir_config *conf; - - conf = (core_dir_config *)ap_get_module_config(r->per_dir_config, - &core_module); - - if (conf->response_code_strings == NULL) { - return NULL; - } - return conf->response_code_strings[error_index]; -} - - -/* Code from Harald Hanche-Olsen */ -static ap_inline void do_double_reverse (conn_rec *conn) -{ - struct hostent *hptr; - - if (conn->double_reverse) { - /* already done */ - return; - } - if (conn->remote_host == NULL || conn->remote_host[0] == '\0') { - /* single reverse failed, so don't bother */ - conn->double_reverse = -1; - return; - } - hptr = gethostbyname(conn->remote_host); - if (hptr) { - char **haddr; - - for (haddr = hptr->h_addr_list; *haddr; haddr++) { - if (((struct in_addr *)(*haddr))->s_addr - == conn->remote_addr.sin_addr.s_addr) { - conn->double_reverse = 1; - return; - } - } - } - conn->double_reverse = -1; -} - -API_EXPORT(const char *) ap_get_remote_host(conn_rec *conn, void *dir_config, - int type) -{ - struct in_addr *iaddr; - struct hostent *hptr; - int hostname_lookups; - int old_stat = SERVER_DEAD; /* we shouldn't ever be in this state */ - - /* If we haven't checked the host name, and we want to */ - if (dir_config) { - hostname_lookups = - ((core_dir_config *)ap_get_module_config(dir_config, &core_module)) - ->hostname_lookups; - if (hostname_lookups == HOSTNAME_LOOKUP_UNSET) { - hostname_lookups = HOSTNAME_LOOKUP_OFF; - } - } - else { - /* the default */ - hostname_lookups = HOSTNAME_LOOKUP_OFF; - } - - if (type != REMOTE_NOLOOKUP - && conn->remote_host == NULL - && (type == REMOTE_DOUBLE_REV - || hostname_lookups != HOSTNAME_LOOKUP_OFF)) { - old_stat = ap_update_child_status(conn->child_num, SERVER_BUSY_DNS, - (request_rec*)NULL); - iaddr = &(conn->remote_addr.sin_addr); - hptr = gethostbyaddr((char *)iaddr, sizeof(struct in_addr), AF_INET); - if (hptr != NULL) { - conn->remote_host = ap_pstrdup(conn->pool, (void *)hptr->h_name); - ap_str_tolower(conn->remote_host); - - if (hostname_lookups == HOSTNAME_LOOKUP_DOUBLE) { - do_double_reverse(conn); - if (conn->double_reverse != 1) { - conn->remote_host = NULL; - } - } - } - /* if failed, set it to the NULL string to indicate error */ - if (conn->remote_host == NULL) { - conn->remote_host = ""; - } - } - if (type == REMOTE_DOUBLE_REV) { - do_double_reverse(conn); - if (conn->double_reverse == -1) { - return NULL; - } - } - if (old_stat != SERVER_DEAD) { - (void)ap_update_child_status(conn->child_num, old_stat, - (request_rec*)NULL); - } - -/* - * Return the desired information; either the remote DNS name, if found, - * or either NULL (if the hostname was requested) or the IP address - * (if any identifier was requested). - */ - if (conn->remote_host != NULL && conn->remote_host[0] != '\0') { - return conn->remote_host; - } - else { - if (type == REMOTE_HOST || type == REMOTE_DOUBLE_REV) { - return NULL; - } - else { - return conn->remote_ip; - } - } -} - -API_EXPORT(const char *) ap_get_remote_logname(request_rec *r) -{ - core_dir_config *dir_conf; - - if (r->connection->remote_logname != NULL) { - return r->connection->remote_logname; - } - -/* If we haven't checked the identity, and we want to */ - dir_conf = (core_dir_config *)ap_get_module_config(r->per_dir_config, - &core_module); - - if (dir_conf->do_rfc1413 & 1) { - return ap_rfc1413(r->connection, r->server); - } - else { - return NULL; - } -} - -/* There are two options regarding what the "name" of a server is. The - * "canonical" name as defined by ServerName and Port, or the "client's - * name" as supplied by a possible Host: header or full URI. We never - * trust the port passed in the client's headers, we always use the - * port of the actual socket. - * - * The DNS option to UseCanonicalName causes this routine to do a - * reverse lookup on the local IP address of the connectiona and use - * that for the ServerName. This makes its value more reliable while - * at the same time allowing Demon's magic virtual hosting to work. - * The assumption is that DNS lookups are sufficiently quick... - * -- fanf 1998-10-03 - */ -API_EXPORT(const char *) ap_get_server_name(request_rec *r) -{ - conn_rec *conn = r->connection; - core_dir_config *d; - - d = (core_dir_config *)ap_get_module_config(r->per_dir_config, - &core_module); - - if (d->use_canonical_name == USE_CANONICAL_NAME_OFF) { - return r->hostname ? r->hostname : r->server->server_hostname; - } - if (d->use_canonical_name == USE_CANONICAL_NAME_DNS) { - if (conn->local_host == NULL) { - struct in_addr *iaddr; - struct hostent *hptr; - int old_stat; - old_stat = ap_update_child_status(conn->child_num, - SERVER_BUSY_DNS, r); - iaddr = &(conn->local_addr.sin_addr); - hptr = gethostbyaddr((char *)iaddr, sizeof(struct in_addr), - AF_INET); - if (hptr != NULL) { - conn->local_host = ap_pstrdup(conn->pool, - (void *)hptr->h_name); - ap_str_tolower(conn->local_host); - } - else { - conn->local_host = ap_pstrdup(conn->pool, - r->server->server_hostname); - } - (void) ap_update_child_status(conn->child_num, old_stat, r); - } - return conn->local_host; - } - /* default */ - return r->server->server_hostname; -} - -API_EXPORT(unsigned) ap_get_server_port(const request_rec *r) -{ - unsigned port; - core_dir_config *d = - (core_dir_config *)ap_get_module_config(r->per_dir_config, &core_module); - - port = r->server->port ? r->server->port : ap_default_port(r); - - if (d->use_canonical_name == USE_CANONICAL_NAME_OFF - || d->use_canonical_name == USE_CANONICAL_NAME_DNS) { - return r->hostname ? ntohs(r->connection->local_addr.sin_port) - : port; - } - /* default */ - return port; -} - -API_EXPORT(char *) ap_construct_url(pool *p, const char *uri, - request_rec *r) -{ - unsigned port = ap_get_server_port(r); - const char *host = ap_get_server_name(r); - - if (ap_is_default_port(port, r)) { - return ap_pstrcat(p, ap_http_method(r), "://", host, uri, NULL); - } - return ap_psprintf(p, "%s://%s:%u%s", ap_http_method(r), host, port, uri); -} - -API_EXPORT(unsigned long) ap_get_limit_req_body(const request_rec *r) -{ - core_dir_config *d = - (core_dir_config *)ap_get_module_config(r->per_dir_config, &core_module); - - return d->limit_req_body; -} - -#ifdef WIN32 -static char* get_interpreter_from_win32_registry(pool *p, const char* ext) -{ - char extension_path[] = "SOFTWARE\\Classes\\"; - char executable_path[] = "\\SHELL\\OPEN\\COMMAND"; - - HKEY hkeyOpen; - DWORD type; - int size; - int result; - char *keyName; - char *buffer; - char *s; - - if (!ext) - return NULL; - /* - * Future optimization: - * When the registry is successfully searched, store the interpreter - * string in a table to make subsequent look-ups faster - */ - - /* Open the key associated with the script extension */ - keyName = ap_pstrcat(p, extension_path, ext, NULL); - - result = RegOpenKeyEx(HKEY_LOCAL_MACHINE, keyName, 0, KEY_QUERY_VALUE, - &hkeyOpen); - - if (result != ERROR_SUCCESS) - return NULL; - - /* Read to NULL buffer to find value size */ - size = 0; - result = RegQueryValueEx(hkeyOpen, "", NULL, &type, NULL, &size); - - if (result == ERROR_SUCCESS) { - buffer = ap_palloc(p, size); - result = RegQueryValueEx(hkeyOpen, "", NULL, &type, buffer, &size); - } - - RegCloseKey(hkeyOpen); - - if (result != ERROR_SUCCESS) - return NULL; - - /* Open the key associated with the interpreter path */ - keyName = ap_pstrcat(p, extension_path, buffer, executable_path, NULL); - - result = RegOpenKeyEx(HKEY_LOCAL_MACHINE, keyName, 0, KEY_QUERY_VALUE, - &hkeyOpen); - - if (result != ERROR_SUCCESS) - return NULL; - - /* Read to NULL buffer to find value size */ - size = 0; - result = RegQueryValueEx(hkeyOpen, "", 0, &type, NULL, &size); - - if (result == ERROR_SUCCESS) { - buffer = ap_palloc(p, size); - result = RegQueryValueEx(hkeyOpen, "", 0, &type, buffer, &size); - } - - RegCloseKey(hkeyOpen); - - if (result != ERROR_SUCCESS) - return NULL; - - /* - * The canonical way shell command entries are entered in the Win32 - * registry is as follows: - * shell [options] "%1" - * where - * shell - full path name to interpreter or shell to run. - * E.g., c:\usr\local\ntreskit\perl\bin\perl.exe - * options - optional switches - * E.g., \C - * "%1" - Place holder for file to run the shell against. - * Typically quoted. - * - * If we find a %1 or a quoted %1, lop it off. - */ - if (buffer && *buffer) { - if ((s = strstr(buffer, "\"%1"))) - *s = '\0'; - else if ((s = strstr(buffer, "%1"))) - *s = '\0'; - } - - return buffer; -} - -API_EXPORT (file_type_e) ap_get_win32_interpreter(const request_rec *r, - char** interpreter ) -{ - HANDLE hFile; - DWORD nBytesRead; - BOOLEAN bResult; - char buffer[1024]; - core_dir_config *d; - int i; - file_type_e fileType = eFileTypeUNKNOWN; - char *ext = NULL; - char *exename = NULL; - - d = (core_dir_config *)ap_get_module_config(r->per_dir_config, - &core_module); - - /* Find the file extension */ - exename = strrchr(r->filename, '/'); - if (!exename) { - exename = strrchr(r->filename, '\\'); - } - if (!exename) { - exename = r->filename; - } - else { - exename++; - } - ext = strrchr(exename, '.'); - - if (ext && (!strcasecmp(ext,".bat") || !strcasecmp(ext,".cmd"))) { - return eFileTypeEXE32; - } - - /* If the file has an extension and it is not .com and not .exe and - * we've been instructed to search the registry, then do it! - */ - if (ext && strcasecmp(ext,".exe") && strcasecmp(ext,".com") && - d->script_interpreter_source == INTERPRETER_SOURCE_REGISTRY) { - /* Check the registry */ - *interpreter = get_interpreter_from_win32_registry(r->pool, ext); - if (*interpreter) - return eFileTypeSCRIPT; - else { - ap_log_error(APLOG_MARK, APLOG_NOERRNO|APLOG_INFO, r->server, - "ScriptInterpreterSource config directive set to \"registry\".\n\t" - "Registry was searched but interpreter not found. Trying the shebang line."); - } - } - - /* Need to peek into the file figure out what it really is... */ - hFile = CreateFile(r->filename, GENERIC_READ, FILE_SHARE_READ, NULL, - OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL); - if (hFile == INVALID_HANDLE_VALUE) { - return eFileTypeUNKNOWN; - } - bResult = ReadFile(hFile, (void*) &buffer, sizeof(buffer) - 1, - &nBytesRead, NULL); - if (!bResult || (nBytesRead == 0)) { - ap_log_rerror(APLOG_MARK, APLOG_ERR, r, - "ReadFile(%s) failed", r->filename); - CloseHandle(hFile); - return eFileTypeUNKNOWN; - } - CloseHandle(hFile); - buffer[nBytesRead] = '\0'; - - /* Script or executable, that is the question... */ - if ((buffer[0] == '#') && (buffer[1] == '!')) { - /* Assuming file is a script since it starts with a shebang */ - fileType = eFileTypeSCRIPT; - for (i = 2; i < sizeof(buffer); i++) { - if ((buffer[i] == '\r') - || (buffer[i] == '\n')) { - break; - } - } - buffer[i] = '\0'; - for (i = 2; buffer[i] == ' ' ; ++i) - ; - *interpreter = ap_pstrdup(r->pool, buffer + i ); - } - else { - /* Not a script, is it an executable? */ - IMAGE_DOS_HEADER *hdr = (IMAGE_DOS_HEADER*)buffer; - if ((nBytesRead >= sizeof(IMAGE_DOS_HEADER)) && (hdr->e_magic == IMAGE_DOS_SIGNATURE)) { - if (hdr->e_lfarlc < 0x40) - fileType = eFileTypeEXE16; - else - fileType = eFileTypeEXE32; - } - else - fileType = eFileTypeUNKNOWN; - } - - return fileType; -} -#endif - -/***************************************************************** - * - * Commands... this module handles almost all of the NCSA httpd.conf - * commands, but most of the old srm.conf is in the the modules. - */ - -static const char end_directory_section[] = ""; -static const char end_directorymatch_section[] = ""; -static const char end_location_section[] = ""; -static const char end_locationmatch_section[] = ""; -static const char end_files_section[] = ""; -static const char end_filesmatch_section[] = ""; -static const char end_virtualhost_section[] = ""; -static const char end_ifmodule_section[] = ""; -static const char end_ifdefine_section[] = ""; - - -API_EXPORT(const char *) ap_check_cmd_context(cmd_parms *cmd, - unsigned forbidden) -{ - const char *gt = (cmd->cmd->name[0] == '<' - && cmd->cmd->name[strlen(cmd->cmd->name)-1] != '>') - ? ">" : ""; - - if ((forbidden & NOT_IN_VIRTUALHOST) && cmd->server->is_virtual) { - return ap_pstrcat(cmd->pool, cmd->cmd->name, gt, - " cannot occur within section", NULL); - } - - if ((forbidden & NOT_IN_LIMIT) && cmd->limited != -1) { - return ap_pstrcat(cmd->pool, cmd->cmd->name, gt, - " cannot occur within section", NULL); - } - - if ((forbidden & NOT_IN_DIR_LOC_FILE) == NOT_IN_DIR_LOC_FILE - && cmd->path != NULL) { - return ap_pstrcat(cmd->pool, cmd->cmd->name, gt, - " cannot occur within " - "section", NULL); - } - - if (((forbidden & NOT_IN_DIRECTORY) - && (cmd->end_token == end_directory_section - || cmd->end_token == end_directorymatch_section)) - || ((forbidden & NOT_IN_LOCATION) - && (cmd->end_token == end_location_section - || cmd->end_token == end_locationmatch_section)) - || ((forbidden & NOT_IN_FILES) - && (cmd->end_token == end_files_section - || cmd->end_token == end_filesmatch_section))) { - return ap_pstrcat(cmd->pool, cmd->cmd->name, gt, - " cannot occur within <", cmd->end_token+2, - " section", NULL); - } - - return NULL; -} - -static const char *set_access_name(cmd_parms *cmd, void *dummy, char *arg) -{ - void *sconf = cmd->server->module_config; - core_server_config *conf = ap_get_module_config(sconf, &core_module); - - const char *err = ap_check_cmd_context(cmd, - NOT_IN_DIR_LOC_FILE|NOT_IN_LIMIT); - if (err != NULL) { - return err; - } - - conf->access_name = ap_pstrdup(cmd->pool, arg); - return NULL; -} - -#ifdef GPROF -static const char *set_gprof_dir(cmd_parms *cmd, void *dummy, char *arg) -{ - void *sconf = cmd->server->module_config; - core_server_config *conf = ap_get_module_config(sconf, &core_module); - - const char *err = ap_check_cmd_context(cmd, - NOT_IN_DIR_LOC_FILE|NOT_IN_LIMIT); - if (err != NULL) { - return err; - } - - conf->gprof_dir = ap_pstrdup(cmd->pool, arg); - return NULL; -} -#endif /*GPROF*/ - -static const char *set_document_root(cmd_parms *cmd, void *dummy, char *arg) -{ - void *sconf = cmd->server->module_config; - core_server_config *conf = ap_get_module_config(sconf, &core_module); - - const char *err = ap_check_cmd_context(cmd, - NOT_IN_DIR_LOC_FILE|NOT_IN_LIMIT); - if (err != NULL) { - return err; - } - - arg = ap_os_canonical_filename(cmd->pool, arg); - if (ap_configtestonly && ap_docrootcheck && !ap_is_directory(arg)) { - if (cmd->server->is_virtual) { - fprintf(stderr, "Warning: DocumentRoot [%s] does not exist\n", - arg); - } - else { - return "DocumentRoot must be a directory"; - } - } - - conf->ap_document_root = arg; - return NULL; -} - -API_EXPORT(void) ap_custom_response(request_rec *r, int status, char *string) -{ - core_dir_config *conf = - ap_get_module_config(r->per_dir_config, &core_module); - int idx; - - if(conf->response_code_strings == NULL) { - conf->response_code_strings = - ap_pcalloc(r->pool, - sizeof(*conf->response_code_strings) * - RESPONSE_CODES); - } - - idx = ap_index_of_response(status); - - conf->response_code_strings[idx] = - ((ap_is_url(string) || (*string == '/')) && (*string != '"')) ? - ap_pstrdup(r->pool, string) : ap_pstrcat(r->pool, "\"", string, NULL); -} - -static const char *set_error_document(cmd_parms *cmd, core_dir_config *conf, - char *line) -{ - int error_number, index_number, idx500; - char *w; - - const char *err = ap_check_cmd_context(cmd, NOT_IN_LIMIT); - if (err != NULL) { - return err; - } - - /* 1st parameter should be a 3 digit number, which we recognize; - * convert it into an array index - */ - - w = ap_getword_conf_nc(cmd->pool, &line); - error_number = atoi(w); - - idx500 = ap_index_of_response(HTTP_INTERNAL_SERVER_ERROR); - - if (error_number == HTTP_INTERNAL_SERVER_ERROR) { - index_number = idx500; - } - else if ((index_number = ap_index_of_response(error_number)) == idx500) { - return ap_pstrcat(cmd->pool, "Unsupported HTTP response code ", - w, NULL); - } - - /* The entry should be ignored if it is a full URL for a 401 error */ - - if (error_number == 401 && - line[0] != '/' && line[0] != '"') { /* Ignore it... */ - ap_log_error(APLOG_MARK, APLOG_NOERRNO|APLOG_NOTICE, cmd->server, - "cannot use a full URL in a 401 ErrorDocument " - "directive --- ignoring!"); - } - else { /* Store it... */ - if (conf->response_code_strings == NULL) { - conf->response_code_strings = - ap_pcalloc(cmd->pool, - sizeof(*conf->response_code_strings) * RESPONSE_CODES); - } - conf->response_code_strings[index_number] = ap_pstrdup(cmd->pool, line); - } - - return NULL; -} - -/* access.conf commands... - * - * The *only* thing that can appear in access.conf at top level is a - * section. NB we need to have a way to cut the srm_command_loop - * invoked by dirsection (i.e., ) short when is seen. - * We do that by returning an error, which dirsection itself recognizes and - * discards as harmless. Cheesy, but it works. - */ - -static const char *set_override(cmd_parms *cmd, core_dir_config *d, - const char *l) -{ - char *w; - - const char *err = ap_check_cmd_context(cmd, NOT_IN_LIMIT); - if (err != NULL) { - return err; - } - - d->override = OR_NONE; - while (l[0]) { - w = ap_getword_conf(cmd->pool, &l); - if (!strcasecmp(w, "Limit")) { - d->override |= OR_LIMIT; - } - else if (!strcasecmp(w, "Options")) { - d->override |= OR_OPTIONS; - } - else if (!strcasecmp(w, "FileInfo")) { - d->override |= OR_FILEINFO; - } - else if (!strcasecmp(w, "AuthConfig")) { - d->override |= OR_AUTHCFG; - } - else if (!strcasecmp(w, "Indexes")) { - d->override |= OR_INDEXES; - } - else if (!strcasecmp(w, "None")) { - d->override = OR_NONE; - } - else if (!strcasecmp(w, "All")) { - d->override = OR_ALL; - } - else { - return ap_pstrcat(cmd->pool, "Illegal override option ", w, NULL); - } - d->override &= ~OR_UNSET; - } - - return NULL; -} - -static const char *set_options(cmd_parms *cmd, core_dir_config *d, - const char *l) -{ - allow_options_t opt; - int first = 1; - char action; - - while (l[0]) { - char *w = ap_getword_conf(cmd->pool, &l); - action = '\0'; - - if (*w == '+' || *w == '-') { - action = *(w++); - } - else if (first) { - d->opts = OPT_NONE; - first = 0; - } - - if (!strcasecmp(w, "Indexes")) { - opt = OPT_INDEXES; - } - else if (!strcasecmp(w, "Includes")) { - opt = OPT_INCLUDES; - } - else if (!strcasecmp(w, "IncludesNOEXEC")) { - opt = (OPT_INCLUDES | OPT_INCNOEXEC); - } - else if (!strcasecmp(w, "FollowSymLinks")) { - opt = OPT_SYM_LINKS; - } - else if (!strcasecmp(w, "SymLinksIfOwnerMatch")) { - opt = OPT_SYM_OWNER; - } - else if (!strcasecmp(w, "execCGI")) { - opt = OPT_EXECCGI; - } - else if (!strcasecmp(w, "MultiViews")) { - opt = OPT_MULTI; - } - else if (!strcasecmp(w, "RunScripts")) { /* AI backcompat. Yuck */ - opt = OPT_MULTI|OPT_EXECCGI; - } - else if (!strcasecmp(w, "None")) { - opt = OPT_NONE; - } - else if (!strcasecmp(w, "All")) { - opt = OPT_ALL; - } - else { - return ap_pstrcat(cmd->pool, "Illegal option ", w, NULL); - } - - /* we ensure the invariant (d->opts_add & d->opts_remove) == 0 */ - if (action == '-') { - d->opts_remove |= opt; - d->opts_add &= ~opt; - d->opts &= ~opt; - } - else if (action == '+') { - d->opts_add |= opt; - d->opts_remove &= ~opt; - d->opts |= opt; - } - else { - d->opts |= opt; - } - } - - return NULL; -} - -static const char *satisfy(cmd_parms *cmd, core_dir_config *c, char *arg) -{ - if (!strcasecmp(arg, "all")) { - c->satisfy = SATISFY_ALL; - } - else if (!strcasecmp(arg, "any")) { - c->satisfy = SATISFY_ANY; - } - else { - return "Satisfy either 'any' or 'all'."; - } - return NULL; -} - -static const char *require(cmd_parms *cmd, core_dir_config *c, char *arg) -{ - require_line *r; - - if (!c->ap_requires) { - c->ap_requires = ap_make_array(cmd->pool, 2, sizeof(require_line)); - } - r = (require_line *)ap_push_array(c->ap_requires); - r->requirement = ap_pstrdup(cmd->pool, arg); - r->method_mask = cmd->limited; - return NULL; -} - -CORE_EXPORT_NONSTD(const char *) ap_limit_section(cmd_parms *cmd, void *dummy, - const char *arg) -{ - const char *limited_methods = ap_getword(cmd->pool, &arg, '>'); - void *tog = cmd->cmd->cmd_data; - int limited = 0; - - const char *err = ap_check_cmd_context(cmd, NOT_IN_LIMIT); - if (err != NULL) { - return err; - } - - /* XXX: NB: Currently, we have no way of checking - * whether or sections are closed properly. - * (If we would add a srm_command_loop() here we might...) - */ - - while (limited_methods[0]) { - char *method = ap_getword_conf(cmd->pool, &limited_methods); - int methnum = ap_method_number_of(method); - - if (methnum == M_TRACE && !tog) { - return "TRACE cannot be controlled by "; - } - else if (methnum == M_INVALID) { - return ap_pstrcat(cmd->pool, "unknown method \"", method, - "\" in " : ">", NULL); - } - else { - limited |= (1 << methnum); - } - } - - /* Killing two features with one function, - * if (tog == NULL) , else - */ - cmd->limited = tog ? ~limited : limited; - return NULL; -} - -static const char *endlimit_section(cmd_parms *cmd, void *dummy, void *dummy2) -{ - void *tog = cmd->cmd->cmd_data; - - if (cmd->limited == -1) { - return tog ? " unexpected" : " unexpected"; - } - - cmd->limited = -1; - return NULL; -} - -/* - * When a section is not closed properly when end-of-file is reached, - * then an error message should be printed: - */ -static const char *missing_endsection(cmd_parms *cmd, int nest) -{ - if (nest < 2) { - return ap_psprintf(cmd->pool, "Missing %s directive at end-of-file", - cmd->end_token); - } - return ap_psprintf(cmd->pool, "%d missing %s directives at end-of-file", - nest, cmd->end_token); -} - -/* We use this in and , to ensure that - * people don't get bitten by wrong-cased regex matches - */ - -#ifdef WIN32 -#define USE_ICASE REG_ICASE -#else -#define USE_ICASE 0 -#endif - -static const char *end_nested_section(cmd_parms *cmd, void *dummy) -{ - if (cmd->end_token == NULL) { - return ap_pstrcat(cmd->pool, cmd->cmd->name, - " without matching <", cmd->cmd->name + 2, - " section", NULL); - } - /* - * This '!=' may look weird on a string comparison, but it's correct -- - * it's been set up so that checking for two pointers to the same datum - * is valid here. And faster. - */ - if (cmd->cmd->name != cmd->end_token) { - return ap_pstrcat(cmd->pool, "Expected ", cmd->end_token, " but saw ", - cmd->cmd->name, NULL); - } - return cmd->end_token; -} - -/* - * Report a missing-'>' syntax error. - */ -static char *unclosed_directive(cmd_parms *cmd) -{ - return ap_pstrcat(cmd->pool, cmd->cmd->name, - "> directive missing closing '>'", NULL); -} - -static const char *dirsection(cmd_parms *cmd, void *dummy, const char *arg) -{ - const char *errmsg; - char *endp = strrchr(arg, '>'); - int old_overrides = cmd->override; - char *old_path = cmd->path; - core_dir_config *conf; - void *new_dir_conf = ap_create_per_dir_config(cmd->pool); - regex_t *r = NULL; - const char *old_end_token; - const command_rec *thiscmd = cmd->cmd; - - const char *err = ap_check_cmd_context(cmd, - NOT_IN_DIR_LOC_FILE|NOT_IN_LIMIT); - if (err != NULL) { - return err; - } - - if (endp == NULL) { - return unclosed_directive(cmd); - } - - *endp = '\0'; - - cmd->path = ap_getword_conf(cmd->pool, &arg); - cmd->override = OR_ALL|ACCESS_CONF; - - if (thiscmd->cmd_data) { /* */ - r = ap_pregcomp(cmd->pool, cmd->path, REG_EXTENDED|USE_ICASE); - } - else if (!strcmp(cmd->path, "~")) { - cmd->path = ap_getword_conf(cmd->pool, &arg); - r = ap_pregcomp(cmd->pool, cmd->path, REG_EXTENDED|USE_ICASE); - } - else { - /* Ensure that the pathname is canonical */ - cmd->path = ap_os_canonical_filename(cmd->pool, cmd->path); - } - - old_end_token = cmd->end_token; - cmd->end_token = thiscmd->cmd_data ? end_directorymatch_section : end_directory_section; - errmsg = ap_srm_command_loop(cmd, new_dir_conf); - if (errmsg == NULL) { - errmsg = missing_endsection(cmd, 1); - } - cmd->end_token = old_end_token; - if (errmsg != (thiscmd->cmd_data - ? end_directorymatch_section - : end_directory_section)) { - return errmsg; - } - - conf = (core_dir_config *)ap_get_module_config(new_dir_conf, &core_module); - conf->r = r; - - ap_add_per_dir_conf(cmd->server, new_dir_conf); - - if (*arg != '\0') { - return ap_pstrcat(cmd->pool, "Multiple ", thiscmd->name, - "> arguments not (yet) supported.", NULL); - } - - cmd->path = old_path; - cmd->override = old_overrides; - - return NULL; -} - -static const char *urlsection(cmd_parms *cmd, void *dummy, const char *arg) -{ - const char *errmsg; - char *endp = strrchr(arg, '>'); - int old_overrides = cmd->override; - char *old_path = cmd->path; - core_dir_config *conf; - regex_t *r = NULL; - const char *old_end_token; - const command_rec *thiscmd = cmd->cmd; - - void *new_url_conf = ap_create_per_dir_config(cmd->pool); - - const char *err = ap_check_cmd_context(cmd, - NOT_IN_DIR_LOC_FILE|NOT_IN_LIMIT); - if (err != NULL) { - return err; - } - - if (endp == NULL) { - return unclosed_directive(cmd); - } - - *endp = '\0'; - - cmd->path = ap_getword_conf(cmd->pool, &arg); - cmd->override = OR_ALL|ACCESS_CONF; - - if (thiscmd->cmd_data) { /* */ - r = ap_pregcomp(cmd->pool, cmd->path, REG_EXTENDED); - } - else if (!strcmp(cmd->path, "~")) { - cmd->path = ap_getword_conf(cmd->pool, &arg); - r = ap_pregcomp(cmd->pool, cmd->path, REG_EXTENDED); - } - - old_end_token = cmd->end_token; - cmd->end_token = thiscmd->cmd_data ? end_locationmatch_section - : end_location_section; - errmsg = ap_srm_command_loop(cmd, new_url_conf); - if (errmsg == NULL) { - errmsg = missing_endsection(cmd, 1); - } - cmd->end_token = old_end_token; - if (errmsg != (thiscmd->cmd_data - ? end_locationmatch_section - : end_location_section)) { - return errmsg; - } - - conf = (core_dir_config *)ap_get_module_config(new_url_conf, &core_module); - conf->d = ap_pstrdup(cmd->pool, cmd->path); /* No mangling, please */ - conf->d_is_fnmatch = ap_is_fnmatch(conf->d) != 0; - conf->r = r; - - ap_add_per_url_conf(cmd->server, new_url_conf); - - if (*arg != '\0') { - return ap_pstrcat(cmd->pool, "Multiple ", thiscmd->name, - "> arguments not (yet) supported.", NULL); - } - - cmd->path = old_path; - cmd->override = old_overrides; - - return NULL; -} - -static const char *filesection(cmd_parms *cmd, core_dir_config *c, - const char *arg) -{ - const char *errmsg; - char *endp = strrchr(arg, '>'); - int old_overrides = cmd->override; - char *old_path = cmd->path; - core_dir_config *conf; - regex_t *r = NULL; - const char *old_end_token; - const command_rec *thiscmd = cmd->cmd; - - void *new_file_conf = ap_create_per_dir_config(cmd->pool); - - const char *err = ap_check_cmd_context(cmd, NOT_IN_LIMIT|NOT_IN_LOCATION); - if (err != NULL) { - return err; - } - - if (endp == NULL) { - return unclosed_directive(cmd); - } - - *endp = '\0'; - - cmd->path = ap_getword_conf(cmd->pool, &arg); - /* Only if not an .htaccess file */ - if (!old_path) { - cmd->override = OR_ALL|ACCESS_CONF; - } - - if (thiscmd->cmd_data) { /* */ - r = ap_pregcomp(cmd->pool, cmd->path, REG_EXTENDED|USE_ICASE); - } - else if (!strcmp(cmd->path, "~")) { - cmd->path = ap_getword_conf(cmd->pool, &arg); - r = ap_pregcomp(cmd->pool, cmd->path, REG_EXTENDED|USE_ICASE); - } - else { - /* Ensure that the pathname is canonical */ - cmd->path = ap_os_canonical_filename(cmd->pool, cmd->path); - } - - old_end_token = cmd->end_token; - cmd->end_token = thiscmd->cmd_data ? end_filesmatch_section : end_files_section; - errmsg = ap_srm_command_loop(cmd, new_file_conf); - if (errmsg == NULL) { - errmsg = missing_endsection(cmd, 1); - } - cmd->end_token = old_end_token; - if (errmsg != (thiscmd->cmd_data - ? end_filesmatch_section - : end_files_section)) { - return errmsg; - } - - conf = (core_dir_config *)ap_get_module_config(new_file_conf, - &core_module); - conf->d = cmd->path; - conf->d_is_fnmatch = ap_is_fnmatch(conf->d) != 0; - conf->r = r; - - ap_add_file_conf(c, new_file_conf); - - if (*arg != '\0') { - return ap_pstrcat(cmd->pool, "Multiple ", thiscmd->name, - "> arguments not (yet) supported.", NULL); - } - - cmd->path = old_path; - cmd->override = old_overrides; - - return NULL; -} - -/* XXX: NB: Currently, we have no way of checking - * whether sections are closed properly. - * Extra (redundant, unpaired) directives are - * simply silently ignored. - */ -static const char *end_ifmod(cmd_parms *cmd, void *dummy) -{ - return NULL; -} - -static const char *start_ifmod(cmd_parms *cmd, void *dummy, char *arg) -{ - char *endp = strrchr(arg, '>'); - char l[MAX_STRING_LEN]; - int not = (arg[0] == '!'); - module *found; - int nest = 1; - - if (endp == NULL) { - return unclosed_directive(cmd); - } - - *endp = '\0'; - - if (not) { - arg++; - } - - found = ap_find_linked_module(arg); - - if ((!not && found) || (not && !found)) { - return NULL; - } - - while (nest && !(ap_cfg_getline(l, MAX_STRING_LEN, cmd->config_file))) { - if (!strncasecmp(l, "")) { - nest--; - } - } - - if (nest) { - cmd->end_token = end_ifmodule_section; - return missing_endsection(cmd, nest); - } - return NULL; -} - -API_EXPORT(int) ap_exists_config_define(char *name) -{ - char **defines; - int i; - - defines = (char **)ap_server_config_defines->elts; - for (i = 0; i < ap_server_config_defines->nelts; i++) { - if (strcmp(defines[i], name) == 0) { - return 1; - } - } - return 0; -} - -static const char *end_ifdefine(cmd_parms *cmd, void *dummy) -{ - return NULL; -} - -static const char *start_ifdefine(cmd_parms *cmd, void *dummy, char *arg) -{ - char *endp; - char l[MAX_STRING_LEN]; - int defined; - int not = 0; - int nest = 1; - - endp = strrchr(arg, '>'); - if (endp == NULL) { - return unclosed_directive(cmd); - } - - *endp = '\0'; - - if (arg[0] == '!') { - not = 1; - arg++; - } - - defined = ap_exists_config_define(arg); - - if ((!not && defined) || (not && !defined)) { - return NULL; - } - - while (nest && !(ap_cfg_getline(l, MAX_STRING_LEN, cmd->config_file))) { - if (!strncasecmp(l, "")) { - nest--; - } - } - if (nest) { - cmd->end_token = end_ifdefine_section; - return missing_endsection(cmd, nest); - } - return NULL; -} - -/* httpd.conf commands... beginning with the business */ - -static const char *virtualhost_section(cmd_parms *cmd, void *dummy, char *arg) -{ - server_rec *main_server = cmd->server, *s; - const char *errmsg; - char *endp = strrchr(arg, '>'); - pool *p = cmd->pool, *ptemp = cmd->temp_pool; - const char *old_end_token; - - const char *err = ap_check_cmd_context(cmd, GLOBAL_ONLY); - if (err != NULL) { - return err; - } - - if (endp == NULL) { - return unclosed_directive(cmd); - } - - *endp = '\0'; - - /* FIXME: There's another feature waiting to happen here -- since you - can now put multiple addresses/names on a single - you might want to use it to group common definitions and then - define other "subhosts" with their individual differences. But - personally I'd rather just do it with a macro preprocessor. -djg */ - if (main_server->is_virtual) { - return " doesn't nest!"; - } - - errmsg = ap_init_virtual_host(p, arg, main_server, &s); - if (errmsg) { - return errmsg; - } - - s->next = main_server->next; - main_server->next = s; - - s->defn_name = cmd->config_file->name; - s->defn_line_number = cmd->config_file->line_number; - - old_end_token = cmd->end_token; - cmd->end_token = end_virtualhost_section; - cmd->server = s; - errmsg = ap_srm_command_loop(cmd, s->lookup_defaults); - cmd->server = main_server; - if (errmsg == NULL) { - errmsg = missing_endsection(cmd, 1); - } - cmd->end_token = old_end_token; - - if (s->srm_confname) { - ap_process_resource_config(s, s->srm_confname, p, ptemp); - } - - if (s->access_confname) { - ap_process_resource_config(s, s->access_confname, p, ptemp); - } - - if (errmsg == end_virtualhost_section) { - return NULL; - } - return errmsg; -} - -static const char *set_server_alias(cmd_parms *cmd, void *dummy, - const char *arg) -{ - if (!cmd->server->names) { - return "ServerAlias only used in "; - } - while (*arg) { - char **item, *name = ap_getword_conf(cmd->pool, &arg); - if (ap_is_matchexp(name)) { - item = (char **)ap_push_array(cmd->server->wild_names); - } - else { - item = (char **)ap_push_array(cmd->server->names); - } - *item = name; - } - return NULL; -} - -static const char *add_module_command(cmd_parms *cmd, void *dummy, char *arg) -{ - const char *err = ap_check_cmd_context(cmd, GLOBAL_ONLY); - if (err != NULL) { - return err; - } - - if (!ap_add_named_module(arg)) { - return ap_pstrcat(cmd->pool, "Cannot add module via name '", arg, - "': not in list of loaded modules", NULL); - } - return NULL; -} - -static const char *clear_module_list_command(cmd_parms *cmd, void *dummy) -{ - const char *err = ap_check_cmd_context(cmd, GLOBAL_ONLY); - if (err != NULL) { - return err; - } - - ap_clear_module_list(); - return NULL; -} - -static const char *set_server_string_slot(cmd_parms *cmd, void *dummy, - char *arg) -{ - /* This one's pretty generic... */ - - int offset = (int)(long)cmd->info; - char *struct_ptr = (char *)cmd->server; - - const char *err = ap_check_cmd_context(cmd, - NOT_IN_DIR_LOC_FILE|NOT_IN_LIMIT); - if (err != NULL) { - return err; - } - - *(char **)(struct_ptr + offset) = arg; - return NULL; -} - -static const char *server_type(cmd_parms *cmd, void *dummy, char *arg) -{ - const char *err = ap_check_cmd_context(cmd, GLOBAL_ONLY); - if (err != NULL) { - return err; - } - - if (!strcasecmp(arg, "inetd")) { - ap_standalone = 0; - } - else if (!strcasecmp(arg, "standalone")) { - ap_standalone = 1; - } - else { - return "ServerType must be either 'inetd' or 'standalone'"; - } - - return NULL; -} - -static const char *server_port(cmd_parms *cmd, void *dummy, char *arg) -{ - const char *err = ap_check_cmd_context(cmd, NOT_IN_DIR_LOC_FILE|NOT_IN_LIMIT); - int port; - - if (err != NULL) { - return err; - } - port = atoi(arg); - if (port <= 0 || port >= 65536) { /* 65536 == 1<<16 */ - return ap_pstrcat(cmd->temp_pool, "The port number \"", arg, - "\" is outside the appropriate range " - "(i.e., 1..65535).", NULL); - } - cmd->server->port = port; - return NULL; -} - -static const char *set_signature_flag(cmd_parms *cmd, core_dir_config *d, - char *arg) -{ - const char *err = ap_check_cmd_context(cmd, NOT_IN_LIMIT); - if (err != NULL) { - return err; - } - - if (strcasecmp(arg, "On") == 0) { - d->server_signature = srv_sig_on; - } - else if (strcasecmp(arg, "Off") == 0) { - d->server_signature = srv_sig_off; - } - else if (strcasecmp(arg, "EMail") == 0) { - d->server_signature = srv_sig_withmail; - } - else { - return "ServerSignature: use one of: off | on | email"; - } - return NULL; -} - -static const char *set_send_buffer_size(cmd_parms *cmd, void *dummy, char *arg) -{ - int s = atoi(arg); - const char *err = ap_check_cmd_context(cmd, GLOBAL_ONLY); - if (err != NULL) { - return err; - } - - if (s < 512 && s != 0) { - return "SendBufferSize must be >= 512 bytes, or 0 for system default."; - } - cmd->server->send_buffer_size = s; - return NULL; -} - -static const char *set_user(cmd_parms *cmd, void *dummy, char *arg) -{ -#ifdef WIN32 - ap_log_error(APLOG_MARK, APLOG_NOERRNO|APLOG_NOTICE, cmd->server, - "User directive has no affect on Win32"); - cmd->server->server_uid = ap_user_id = 1; -#else - const char *err = ap_check_cmd_context(cmd, NOT_IN_DIR_LOC_FILE|NOT_IN_LIMIT); - if (err != NULL) { - return err; - } - - if (!cmd->server->is_virtual) { - ap_user_name = arg; - cmd->server->server_uid = ap_user_id = ap_uname2id(arg); - } - else { - if (ap_suexec_enabled) { - cmd->server->server_uid = ap_uname2id(arg); - } - else { - cmd->server->server_uid = ap_user_id; - fprintf(stderr, - "Warning: User directive in " - "requires SUEXEC wrapper.\n"); - } - } -#if !defined (BIG_SECURITY_HOLE) && !defined (OS2) - if (cmd->server->server_uid == 0) { - fprintf(stderr, - "Error:\tApache has not been designed to serve pages while\n" - "\trunning as root. There are known race conditions that\n" - "\twill allow any local user to read any file on the system.\n" - "\tIf you still desire to serve pages as root then\n" - "\tadd -DBIG_SECURITY_HOLE to the EXTRA_CFLAGS line in your\n" - "\tsrc/Configuration file and rebuild the server. It is\n" - "\tstrongly suggested that you instead modify the User\n" - "\tdirective in your httpd.conf file to list a non-root\n" - "\tuser.\n"); - exit (1); - } -#endif -#endif /* WIN32 */ - - return NULL; -} - -static const char *set_group(cmd_parms *cmd, void *dummy, char *arg) -{ - const char *err = ap_check_cmd_context(cmd, NOT_IN_DIR_LOC_FILE|NOT_IN_LIMIT); - if (err != NULL) { - return err; - } - - if (!cmd->server->is_virtual) { - cmd->server->server_gid = ap_group_id = ap_gname2id(arg); - } - else { - if (ap_suexec_enabled) { - cmd->server->server_gid = ap_gname2id(arg); - } - else { - cmd->server->server_gid = ap_group_id; - fprintf(stderr, - "Warning: Group directive in requires " - "SUEXEC wrapper.\n"); - } - } - - return NULL; -} - -static const char *set_server_root(cmd_parms *cmd, void *dummy, char *arg) -{ - const char *err = ap_check_cmd_context(cmd, GLOBAL_ONLY); - - if (err != NULL) { - return err; - } - - arg = ap_os_canonical_filename(cmd->pool, arg); - - if (!ap_is_directory(arg)) { - return "ServerRoot must be a valid directory"; - } - ap_cpystrn(ap_server_root, arg, - sizeof(ap_server_root)); - return NULL; -} - -static const char *set_timeout(cmd_parms *cmd, void *dummy, char *arg) -{ - const char *err = ap_check_cmd_context(cmd, NOT_IN_DIR_LOC_FILE|NOT_IN_LIMIT); - if (err != NULL) { - return err; - } - - cmd->server->timeout = atoi(arg); - return NULL; -} - -static const char *set_keep_alive_timeout(cmd_parms *cmd, void *dummy, - char *arg) -{ - const char *err = ap_check_cmd_context(cmd, NOT_IN_DIR_LOC_FILE|NOT_IN_LIMIT); - if (err != NULL) { - return err; - } - - cmd->server->keep_alive_timeout = atoi(arg); - return NULL; -} - -static const char *set_keep_alive(cmd_parms *cmd, void *dummy, char *arg) -{ - const char *err = ap_check_cmd_context(cmd, NOT_IN_DIR_LOC_FILE|NOT_IN_LIMIT); - if (err != NULL) { - return err; - } - - /* We've changed it to On/Off, but used to use numbers - * so we accept anything but "Off" or "0" as "On" - */ - if (!strcasecmp(arg, "off") || !strcmp(arg, "0")) { - cmd->server->keep_alive = 0; - } - else { - cmd->server->keep_alive = 1; - } - return NULL; -} - -static const char *set_keep_alive_max(cmd_parms *cmd, void *dummy, char *arg) -{ - const char *err = ap_check_cmd_context(cmd, NOT_IN_DIR_LOC_FILE|NOT_IN_LIMIT); - if (err != NULL) { - return err; - } - - cmd->server->keep_alive_max = atoi(arg); - return NULL; -} - -static const char *set_pidfile(cmd_parms *cmd, void *dummy, char *arg) -{ - const char *err = ap_check_cmd_context(cmd, GLOBAL_ONLY); - if (err != NULL) { - return err; - } - - if (cmd->server->is_virtual) { - return "PidFile directive not allowed in "; - } - ap_pid_fname = arg; - return NULL; -} - -static const char *set_scoreboard(cmd_parms *cmd, void *dummy, char *arg) -{ - const char *err = ap_check_cmd_context(cmd, GLOBAL_ONLY); - if (err != NULL) { - return err; - } - - ap_scoreboard_fname = arg; - return NULL; -} - -static const char *set_lockfile(cmd_parms *cmd, void *dummy, char *arg) -{ - const char *err = ap_check_cmd_context(cmd, GLOBAL_ONLY); - if (err != NULL) { - return err; - } - - ap_lock_fname = arg; - return NULL; -} - -static const char *set_idcheck(cmd_parms *cmd, core_dir_config *d, int arg) -{ - const char *err = ap_check_cmd_context(cmd, NOT_IN_LIMIT); - if (err != NULL) { - return err; - } - - d->do_rfc1413 = arg != 0; - return NULL; -} - -static const char *set_hostname_lookups(cmd_parms *cmd, core_dir_config *d, - char *arg) -{ - const char *err = ap_check_cmd_context(cmd, NOT_IN_LIMIT); - if (err != NULL) { - return err; - } - - if (!strcasecmp(arg, "on")) { - d->hostname_lookups = HOSTNAME_LOOKUP_ON; - } - else if (!strcasecmp(arg, "off")) { - d->hostname_lookups = HOSTNAME_LOOKUP_OFF; - } - else if (!strcasecmp(arg, "double")) { - d->hostname_lookups = HOSTNAME_LOOKUP_DOUBLE; - } - else { - return "parameter must be 'on', 'off', or 'double'"; - } - return NULL; -} - -static const char *set_serverpath(cmd_parms *cmd, void *dummy, char *arg) -{ - const char *err = ap_check_cmd_context(cmd, NOT_IN_DIR_LOC_FILE|NOT_IN_LIMIT); - if (err != NULL) { - return err; - } - - cmd->server->path = arg; - cmd->server->pathlen = strlen(arg); - return NULL; -} - -static const char *set_content_md5(cmd_parms *cmd, core_dir_config *d, int arg) -{ - const char *err = ap_check_cmd_context(cmd, NOT_IN_LIMIT); - if (err != NULL) { - return err; - } - - d->content_md5 = arg != 0; - return NULL; -} - -static const char *set_use_canonical_name(cmd_parms *cmd, core_dir_config *d, - char *arg) -{ - const char *err = ap_check_cmd_context(cmd, NOT_IN_LIMIT); - if (err != NULL) { - return err; - } - - if (strcasecmp(arg, "on") == 0) { - d->use_canonical_name = USE_CANONICAL_NAME_ON; - } - else if (strcasecmp(arg, "off") == 0) { - d->use_canonical_name = USE_CANONICAL_NAME_OFF; - } - else if (strcasecmp(arg, "dns") == 0) { - d->use_canonical_name = USE_CANONICAL_NAME_DNS; - } - else { - return "parameter must be 'on', 'off', or 'dns'"; - } - return NULL; -} - -static const char *set_daemons_to_start(cmd_parms *cmd, void *dummy, char *arg) -{ -#ifdef WIN32 - fprintf(stderr, "WARNING: StartServers has no effect on Win32\n"); -#else - const char *err = ap_check_cmd_context(cmd, GLOBAL_ONLY); - if (err != NULL) { - return err; - } - - ap_daemons_to_start = atoi(arg); -#endif - return NULL; -} - -static const char *set_min_free_servers(cmd_parms *cmd, void *dummy, char *arg) -{ - const char *err = ap_check_cmd_context(cmd, GLOBAL_ONLY); - if (err != NULL) { - return err; - } - - ap_daemons_min_free = atoi(arg); - if (ap_daemons_min_free <= 0) { - fprintf(stderr, "WARNING: detected MinSpareServers set to non-positive.\n"); - fprintf(stderr, "Resetting to 1 to avoid almost certain Apache failure.\n"); - fprintf(stderr, "Please read the documentation.\n"); - ap_daemons_min_free = 1; - } - - return NULL; -} - -static const char *set_max_free_servers(cmd_parms *cmd, void *dummy, char *arg) -{ - const char *err = ap_check_cmd_context(cmd, GLOBAL_ONLY); - if (err != NULL) { - return err; - } - - ap_daemons_max_free = atoi(arg); - return NULL; -} - -static const char *set_server_limit (cmd_parms *cmd, void *dummy, char *arg) -{ - const char *err = ap_check_cmd_context(cmd, GLOBAL_ONLY); - if (err != NULL) { - return err; - } - - ap_daemons_limit = atoi(arg); - if (ap_daemons_limit > HARD_SERVER_LIMIT) { - fprintf(stderr, "WARNING: MaxClients of %d exceeds compile time limit " - "of %d servers,\n", ap_daemons_limit, HARD_SERVER_LIMIT); - fprintf(stderr, " lowering MaxClients to %d. To increase, please " - "see the\n", HARD_SERVER_LIMIT); - fprintf(stderr, " HARD_SERVER_LIMIT define in src/include/httpd.h.\n"); - ap_daemons_limit = HARD_SERVER_LIMIT; - } - else if (ap_daemons_limit < 1) { - fprintf(stderr, "WARNING: Require MaxClients > 0, setting to 1\n"); - ap_daemons_limit = 1; - } - return NULL; -} - -static const char *set_max_requests(cmd_parms *cmd, void *dummy, char *arg) -{ - const char *err = ap_check_cmd_context(cmd, GLOBAL_ONLY); - if (err != NULL) { - return err; - } - - ap_max_requests_per_child = atoi(arg); - return NULL; -} - -static const char *set_threads(cmd_parms *cmd, void *dummy, char *arg) { - const char *err = ap_check_cmd_context(cmd, GLOBAL_ONLY); - if (err != NULL) { - return err; - } - - ap_threads_per_child = atoi(arg); - if (ap_threads_per_child > HARD_SERVER_LIMIT) { - fprintf(stderr, "WARNING: ThreadsPerChild of %d exceeds compile time limit " - "of %d threads,\n", ap_threads_per_child, HARD_SERVER_LIMIT); - fprintf(stderr, " lowering ThreadsPerChild to %d. To increase, please " - "see the\n", HARD_SERVER_LIMIT); - fprintf(stderr, " HARD_SERVER_LIMIT define in src/include/httpd.h.\n"); - ap_threads_per_child = HARD_SERVER_LIMIT; - } - else if (ap_threads_per_child < 1) { - fprintf(stderr, "WARNING: Require ThreadsPerChild > 0, setting to 1\n"); - ap_threads_per_child = 1; - } - - return NULL; -} - -static const char *set_excess_requests(cmd_parms *cmd, void *dummy, char *arg) -{ - const char *err = ap_check_cmd_context(cmd, GLOBAL_ONLY); - if (err != NULL) { - return err; - } - - ap_excess_requests_per_child = atoi(arg); - return NULL; -} - - -#if defined(RLIMIT_CPU) || defined(RLIMIT_DATA) || defined(RLIMIT_VMEM) || defined(RLIMIT_NPROC) || defined(RLIMIT_AS) -static void set_rlimit(cmd_parms *cmd, struct rlimit **plimit, const char *arg, - const char * arg2, int type) -{ - char *str; - struct rlimit *limit; - /* If your platform doesn't define rlim_t then typedef it in ap_config.h */ - rlim_t cur = 0; - rlim_t max = 0; - - *plimit = (struct rlimit *)ap_pcalloc(cmd->pool, sizeof(**plimit)); - limit = *plimit; - if ((getrlimit(type, limit)) != 0) { - *plimit = NULL; - ap_log_error(APLOG_MARK, APLOG_ERR, cmd->server, - "%s: getrlimit failed", cmd->cmd->name); - return; - } - - if ((str = ap_getword_conf(cmd->pool, &arg))) { - if (!strcasecmp(str, "max")) { - cur = limit->rlim_max; - } - else { - cur = atol(str); - } - } - else { - ap_log_error(APLOG_MARK, APLOG_NOERRNO|APLOG_ERR, cmd->server, - "Invalid parameters for %s", cmd->cmd->name); - return; - } - - if (arg2 && (str = ap_getword_conf(cmd->pool, &arg2))) { - max = atol(str); - } - - /* if we aren't running as root, cannot increase max */ - if (geteuid()) { - limit->rlim_cur = cur; - if (max) { - ap_log_error(APLOG_MARK, APLOG_NOERRNO|APLOG_ERR, cmd->server, - "Must be uid 0 to raise maximum %s", cmd->cmd->name); - } - } - else { - if (cur) { - limit->rlim_cur = cur; - } - if (max) { - limit->rlim_max = max; - } - } -} -#endif - -#if !defined (RLIMIT_CPU) || !(defined (RLIMIT_DATA) || defined (RLIMIT_VMEM) || defined(RLIMIT_AS)) || !defined (RLIMIT_NPROC) -static const char *no_set_limit(cmd_parms *cmd, core_dir_config *conf, - char *arg, char *arg2) -{ - ap_log_error(APLOG_MARK, APLOG_NOERRNO|APLOG_ERR, cmd->server, - "%s not supported on this platform", cmd->cmd->name); - return NULL; -} -#endif - -#ifdef RLIMIT_CPU -static const char *set_limit_cpu(cmd_parms *cmd, core_dir_config *conf, - char *arg, char *arg2) -{ - set_rlimit(cmd, &conf->limit_cpu, arg, arg2, RLIMIT_CPU); - return NULL; -} -#endif - -#if defined (RLIMIT_DATA) || defined (RLIMIT_VMEM) || defined(RLIMIT_AS) -static const char *set_limit_mem(cmd_parms *cmd, core_dir_config *conf, - char *arg, char * arg2) -{ -#if defined(RLIMIT_AS) - set_rlimit(cmd, &conf->limit_mem, arg, arg2 ,RLIMIT_AS); -#elif defined(RLIMIT_DATA) - set_rlimit(cmd, &conf->limit_mem, arg, arg2, RLIMIT_DATA); -#elif defined(RLIMIT_VMEM) - set_rlimit(cmd, &conf->limit_mem, arg, arg2, RLIMIT_VMEM); -#endif - return NULL; -} -#endif - -#ifdef RLIMIT_NPROC -static const char *set_limit_nproc(cmd_parms *cmd, core_dir_config *conf, - char *arg, char * arg2) -{ - set_rlimit(cmd, &conf->limit_nproc, arg, arg2, RLIMIT_NPROC); - return NULL; -} -#endif - -static const char *set_bind_address(cmd_parms *cmd, void *dummy, char *arg) -{ - const char *err = ap_check_cmd_context(cmd, GLOBAL_ONLY); - if (err != NULL) { - return err; - } - - ap_bind_address.s_addr = ap_get_virthost_addr(arg, NULL); - return NULL; -} - -static const char *set_listener(cmd_parms *cmd, void *dummy, char *ips) -{ - listen_rec *new; - char *ports; - unsigned short port; - - const char *err = ap_check_cmd_context(cmd, GLOBAL_ONLY); - if (err != NULL) { - return err; - } - - ports = strchr(ips, ':'); - if (ports != NULL) { - if (ports == ips) { - return "Missing IP address"; - } - else if (ports[1] == '\0') { - return "Address must end in :"; - } - *(ports++) = '\0'; - } - else { - ports = ips; - } - - new=ap_pcalloc(cmd->pool, sizeof(listen_rec)); - new->local_addr.sin_family = AF_INET; - if (ports == ips) { /* no address */ - new->local_addr.sin_addr.s_addr = htonl(INADDR_ANY); - } - else { - new->local_addr.sin_addr.s_addr = ap_get_virthost_addr(ips, NULL); - } - port = atoi(ports); - if (!port) { - return "Port must be numeric"; - } - new->local_addr.sin_port = htons(port); - new->fd = -1; - new->used = 0; - new->next = ap_listeners; - ap_listeners = new; - return NULL; -} - -static const char *set_listenbacklog(cmd_parms *cmd, void *dummy, char *arg) -{ - int b; - - const char *err = ap_check_cmd_context(cmd, GLOBAL_ONLY); - if (err != NULL) { - return err; - } - - b = atoi(arg); - if (b < 1) { - return "ListenBacklog must be > 0"; - } - ap_listenbacklog = b; - return NULL; -} - -static const char *set_coredumpdir (cmd_parms *cmd, void *dummy, char *arg) -{ - struct stat finfo; - const char *err = ap_check_cmd_context(cmd, GLOBAL_ONLY); - if (err != NULL) { - return err; - } - - arg = ap_server_root_relative(cmd->pool, arg); - if ((stat(arg, &finfo) == -1) || !S_ISDIR(finfo.st_mode)) { - return ap_pstrcat(cmd->pool, "CoreDumpDirectory ", arg, - " does not exist or is not a directory", NULL); - } - ap_cpystrn(ap_coredump_dir, arg, sizeof(ap_coredump_dir)); - return NULL; -} - -static const char *include_config (cmd_parms *cmd, void *dummy, char *name) -{ - name = ap_server_root_relative(cmd->pool, name); - - ap_process_resource_config(cmd->server, name, cmd->pool, cmd->temp_pool); - - return NULL; -} - -static const char *set_loglevel(cmd_parms *cmd, void *dummy, const char *arg) -{ - char *str; - - const char *err = ap_check_cmd_context(cmd, - NOT_IN_DIR_LOC_FILE|NOT_IN_LIMIT); - if (err != NULL) { - return err; - } - - if ((str = ap_getword_conf(cmd->pool, &arg))) { - if (!strcasecmp(str, "emerg")) { - cmd->server->loglevel = APLOG_EMERG; - } - else if (!strcasecmp(str, "alert")) { - cmd->server->loglevel = APLOG_ALERT; - } - else if (!strcasecmp(str, "crit")) { - cmd->server->loglevel = APLOG_CRIT; - } - else if (!strcasecmp(str, "error")) { - cmd->server->loglevel = APLOG_ERR; - } - else if (!strcasecmp(str, "warn")) { - cmd->server->loglevel = APLOG_WARNING; - } - else if (!strcasecmp(str, "notice")) { - cmd->server->loglevel = APLOG_NOTICE; - } - else if (!strcasecmp(str, "info")) { - cmd->server->loglevel = APLOG_INFO; - } - else if (!strcasecmp(str, "debug")) { - cmd->server->loglevel = APLOG_DEBUG; - } - else { - return "LogLevel requires level keyword: one of " - "emerg/alert/crit/error/warn/notice/info/debug"; - } - } - else { - return "LogLevel requires level keyword"; - } - - return NULL; -} - -API_EXPORT(const char *) ap_psignature(const char *prefix, request_rec *r) -{ - char sport[20]; - core_dir_config *conf; - - conf = (core_dir_config *)ap_get_module_config(r->per_dir_config, - &core_module); - if ((conf->server_signature == srv_sig_off) - || (conf->server_signature == srv_sig_unset)) { - return ""; - } - - ap_snprintf(sport, sizeof sport, "%u", (unsigned) ap_get_server_port(r)); - - if (conf->server_signature == srv_sig_withmail) { - return ap_pstrcat(r->pool, prefix, "
    " SERVER_BASEVERSION - " Server at server->server_admin, "\">", - ap_get_server_name(r), " Port ", sport, - "
    \n", NULL); - } - return ap_pstrcat(r->pool, prefix, "
    " SERVER_BASEVERSION - " Server at ", ap_get_server_name(r), " Port ", sport, - "
    \n", NULL); -} - -/* - * Load an authorisation realm into our location configuration, applying the - * usual rules that apply to realms. - */ -static const char *set_authname(cmd_parms *cmd, void *mconfig, char *word1) -{ - core_dir_config *aconfig = (core_dir_config *)mconfig; - - aconfig->ap_auth_name = ap_escape_quotes(cmd->pool, word1); - return NULL; -} - -#ifdef _OSD_POSIX /* BS2000 Logon Passwd file */ -static const char *set_bs2000_account(cmd_parms *cmd, void *dummy, char *name) -{ - const char *err = ap_check_cmd_context(cmd, GLOBAL_ONLY); - if (err != NULL) { - return err; - } - - return os_set_account(cmd->pool, name); -} -#endif /*_OSD_POSIX*/ - -/* - * Handle a request to include the server's OS platform in the Server - * response header field (the ServerTokens directive). Unfortunately - * this requires a new global in order to communicate the setting back to - * http_main so it can insert the information in the right place in the - * string. - */ - -static const char *set_serv_tokens(cmd_parms *cmd, void *dummy, char *arg) -{ - const char *err = ap_check_cmd_context(cmd, GLOBAL_ONLY); - if (err != NULL) { - return err; - } - - if (!strcasecmp(arg, "OS")) { - ap_server_tokens = SrvTk_OS; - } - else if (!strcasecmp(arg, "Min") || !strcasecmp(arg, "Minimal")) { - ap_server_tokens = SrvTk_MIN; - } - else { - ap_server_tokens = SrvTk_FULL; - } - return NULL; -} - -static const char *set_limit_req_line(cmd_parms *cmd, void *dummy, char *arg) -{ - const char *err = ap_check_cmd_context(cmd, - NOT_IN_DIR_LOC_FILE|NOT_IN_LIMIT); - int lim; - - if (err != NULL) { - return err; - } - lim = atoi(arg); - if (lim < 0) { - return ap_pstrcat(cmd->temp_pool, "LimitRequestLine \"", arg, - "\" must be a non-negative integer", NULL); - } - if (lim > DEFAULT_LIMIT_REQUEST_LINE) { - return ap_psprintf(cmd->temp_pool, "LimitRequestLine \"%s\" " - "must not exceed the precompiled maximum of %d", - arg, DEFAULT_LIMIT_REQUEST_LINE); - } - cmd->server->limit_req_line = lim; - return NULL; -} - -static const char *set_limit_req_fieldsize(cmd_parms *cmd, void *dummy, - char *arg) -{ - const char *err = ap_check_cmd_context(cmd, - NOT_IN_DIR_LOC_FILE|NOT_IN_LIMIT); - int lim; - - if (err != NULL) { - return err; - } - lim = atoi(arg); - if (lim < 0) { - return ap_pstrcat(cmd->temp_pool, "LimitRequestFieldsize \"", arg, - "\" must be a non-negative integer (0 = no limit)", - NULL); - } - if (lim > DEFAULT_LIMIT_REQUEST_FIELDSIZE) { - return ap_psprintf(cmd->temp_pool, "LimitRequestFieldsize \"%s\" " - "must not exceed the precompiled maximum of %d", - arg, DEFAULT_LIMIT_REQUEST_FIELDSIZE); - } - cmd->server->limit_req_fieldsize = lim; - return NULL; -} - -static const char *set_limit_req_fields(cmd_parms *cmd, void *dummy, char *arg) -{ - const char *err = ap_check_cmd_context(cmd, - NOT_IN_DIR_LOC_FILE|NOT_IN_LIMIT); - int lim; - - if (err != NULL) { - return err; - } - lim = atoi(arg); - if (lim < 0) { - return ap_pstrcat(cmd->temp_pool, "LimitRequestFields \"", arg, - "\" must be a non-negative integer (0 = no limit)", - NULL); - } - cmd->server->limit_req_fields = lim; - return NULL; -} - -static const char *set_limit_req_body(cmd_parms *cmd, core_dir_config *conf, - char *arg) -{ - const char *err = ap_check_cmd_context(cmd, NOT_IN_LIMIT); - if (err != NULL) { - return err; - } - - /* WTF: If strtoul is not portable, then write a replacement. - * Instead we have an idiotic define in httpd.h that prevents - * it from being used even when it is available. Sheesh. - */ - conf->limit_req_body = (unsigned long)strtol(arg, (char **)NULL, 10); - return NULL; -} - -#ifdef WIN32 -static const char *set_interpreter_source(cmd_parms *cmd, core_dir_config *d, - char *arg) -{ - if (!strcasecmp(arg, "registry")) { - d->script_interpreter_source = INTERPRETER_SOURCE_REGISTRY; - } else if (!strcasecmp(arg, "script")) { - d->script_interpreter_source = INTERPRETER_SOURCE_SHEBANG; - } else { - d->script_interpreter_source = INTERPRETER_SOURCE_SHEBANG; - } - return NULL; -} -#endif - -/* Note --- ErrorDocument will now work from .htaccess files. - * The AllowOverride of Fileinfo allows webmasters to turn it off - */ - -static const command_rec core_cmds[] = { - -/* Old access config file commands */ - -{ "" }, -{ "" }, -{ "" }, -{ "" }, -{ "", endlimit_section, NULL, OR_ALL, NO_ARGS, - "Marks end of " }, -{ "", endlimit_section, (void*)1, OR_ALL, NO_ARGS, - "Marks end of " }, -{ "" }, -{ "" }, -{ "" }, -{ "" }, -{ "" }, -{ "AuthType", ap_set_string_slot, - (void*)XtOffsetOf(core_dir_config, ap_auth_type), OR_AUTHCFG, TAKE1, - "An HTTP authorization type (e.g., \"Basic\")" }, -{ "AuthName", set_authname, NULL, OR_AUTHCFG, TAKE1, - "The authentication realm (e.g. \"Members Only\")" }, -{ "Require", require, NULL, OR_AUTHCFG, RAW_ARGS, - "Selects which authenticated users or groups may access a protected space" }, -{ "Satisfy", satisfy, NULL, OR_AUTHCFG, TAKE1, - "access policy if both allow and require used ('all' or 'any')" }, -#ifdef GPROF -{ "GprofDir", set_gprof_dir, NULL, RSRC_CONF, TAKE1, - "Directory to plop gmon.out files" }, -#endif - -/* Old resource config file commands */ - -{ "AccessFileName", set_access_name, NULL, RSRC_CONF, RAW_ARGS, - "Name(s) of per-directory config files (default: .htaccess)" }, -{ "DocumentRoot", set_document_root, NULL, RSRC_CONF, TAKE1, - "Root directory of the document tree" }, -{ "ErrorDocument", set_error_document, NULL, OR_FILEINFO, RAW_ARGS, - "Change responses for HTTP errors" }, -{ "AllowOverride", set_override, NULL, ACCESS_CONF, RAW_ARGS, - "Controls what groups of directives can be configured by per-directory " - "config files" }, -{ "Options", set_options, NULL, OR_OPTIONS, RAW_ARGS, - "Set a number of attributes for a given directory" }, -{ "DefaultType", ap_set_string_slot, - (void*)XtOffsetOf (core_dir_config, ap_default_type), - OR_FILEINFO, TAKE1, "the default MIME type for untypable files" }, - -/* Old server config file commands */ - -{ "ServerType", server_type, NULL, RSRC_CONF, TAKE1, - "'inetd' or 'standalone'"}, -{ "Port", server_port, NULL, RSRC_CONF, TAKE1, "A TCP port number"}, -{ "HostnameLookups", set_hostname_lookups, NULL, ACCESS_CONF|RSRC_CONF, TAKE1, - "\"on\" to enable, \"off\" to disable reverse DNS lookups, or \"double\" to " - "enable double-reverse DNS lookups" }, -{ "User", set_user, NULL, RSRC_CONF, TAKE1, - "Effective user id for this server"}, -{ "Group", set_group, NULL, RSRC_CONF, TAKE1, - "Effective group id for this server"}, -{ "ServerAdmin", set_server_string_slot, - (void *)XtOffsetOf (server_rec, server_admin), RSRC_CONF, TAKE1, - "The email address of the server administrator" }, -{ "ServerName", set_server_string_slot, - (void *)XtOffsetOf (server_rec, server_hostname), RSRC_CONF, TAKE1, - "The hostname of the server" }, -{ "ServerSignature", set_signature_flag, NULL, OR_ALL, TAKE1, - "En-/disable server signature (on|off|email)" }, -{ "ServerRoot", set_server_root, NULL, RSRC_CONF, TAKE1, - "Common directory of server-related files (logs, confs, etc.)" }, -{ "ErrorLog", set_server_string_slot, - (void *)XtOffsetOf (server_rec, error_fname), RSRC_CONF, TAKE1, - "The filename of the error log" }, -{ "PidFile", set_pidfile, NULL, RSRC_CONF, TAKE1, - "A file for logging the server process ID"}, -{ "ScoreBoardFile", set_scoreboard, NULL, RSRC_CONF, TAKE1, - "A file for Apache to maintain runtime process management information"}, -{ "LockFile", set_lockfile, NULL, RSRC_CONF, TAKE1, - "The lockfile used when Apache needs to lock the accept() call"}, -{ "AccessConfig", set_server_string_slot, - (void *)XtOffsetOf (server_rec, access_confname), RSRC_CONF, TAKE1, - "The filename of the access config file" }, -{ "ResourceConfig", set_server_string_slot, - (void *)XtOffsetOf (server_rec, srm_confname), RSRC_CONF, TAKE1, - "The filename of the resource config file" }, -{ "ServerAlias", set_server_alias, NULL, RSRC_CONF, RAW_ARGS, - "A name or names alternately used to access the server" }, -{ "ServerPath", set_serverpath, NULL, RSRC_CONF, TAKE1, - "The pathname the server can be reached at" }, -{ "Timeout", set_timeout, NULL, RSRC_CONF, TAKE1, "Timeout duration (sec)" }, -{ "KeepAliveTimeout", set_keep_alive_timeout, NULL, RSRC_CONF, TAKE1, - "Keep-Alive timeout duration (sec)"}, -{ "MaxKeepAliveRequests", set_keep_alive_max, NULL, RSRC_CONF, TAKE1, - "Maximum number of Keep-Alive requests per connection, or 0 for infinite" }, -{ "KeepAlive", set_keep_alive, NULL, RSRC_CONF, TAKE1, - "Whether persistent connections should be On or Off" }, -{ "IdentityCheck", set_idcheck, NULL, RSRC_CONF|ACCESS_CONF, FLAG, - "Enable identd (RFC 1413) user lookups - SLOW" }, -{ "ContentDigest", set_content_md5, NULL, OR_OPTIONS, - FLAG, "whether or not to send a Content-MD5 header with each request" }, -{ "UseCanonicalName", set_use_canonical_name, NULL, - RSRC_CONF, TAKE1, - "How to work out the ServerName : Port when constructing URLs" }, -{ "StartServers", set_daemons_to_start, NULL, RSRC_CONF, TAKE1, - "Number of child processes launched at server startup" }, -{ "MinSpareServers", set_min_free_servers, NULL, RSRC_CONF, TAKE1, - "Minimum number of idle children, to handle request spikes" }, -{ "MaxSpareServers", set_max_free_servers, NULL, RSRC_CONF, TAKE1, - "Maximum number of idle children" }, -{ "MaxServers", set_max_free_servers, NULL, RSRC_CONF, TAKE1, - "Deprecated equivalent to MaxSpareServers" }, -{ "ServersSafetyLimit", set_server_limit, NULL, RSRC_CONF, TAKE1, - "Deprecated equivalent to MaxClients" }, -{ "MaxClients", set_server_limit, NULL, RSRC_CONF, TAKE1, - "Maximum number of children alive at the same time" }, -{ "MaxRequestsPerChild", set_max_requests, NULL, RSRC_CONF, TAKE1, - "Maximum number of requests a particular child serves before dying." }, -{ "RLimitCPU", -#ifdef RLIMIT_CPU - set_limit_cpu, (void*)XtOffsetOf(core_dir_config, limit_cpu), -#else - no_set_limit, NULL, -#endif - OR_ALL, TAKE12, "Soft/hard limits for max CPU usage in seconds" }, -{ "RLimitMEM", -#if defined (RLIMIT_DATA) || defined (RLIMIT_VMEM) || defined (RLIMIT_AS) - set_limit_mem, (void*)XtOffsetOf(core_dir_config, limit_mem), -#else - no_set_limit, NULL, -#endif - OR_ALL, TAKE12, "Soft/hard limits for max memory usage per process" }, -{ "RLimitNPROC", -#ifdef RLIMIT_NPROC - set_limit_nproc, (void*)XtOffsetOf(core_dir_config, limit_nproc), -#else - no_set_limit, NULL, -#endif - OR_ALL, TAKE12, "soft/hard limits for max number of processes per uid" }, -{ "BindAddress", set_bind_address, NULL, RSRC_CONF, TAKE1, - "'*', a numeric IP address, or the name of a host with a unique IP address"}, -{ "Listen", set_listener, NULL, RSRC_CONF, TAKE1, - "A port number or a numeric IP address and a port number"}, -{ "SendBufferSize", set_send_buffer_size, NULL, RSRC_CONF, TAKE1, - "Send buffer size in bytes"}, -{ "AddModule", add_module_command, NULL, RSRC_CONF, ITERATE, - "The name of a module" }, -{ "ClearModuleList", clear_module_list_command, NULL, RSRC_CONF, NO_ARGS, - NULL }, -{ "ThreadsPerChild", set_threads, NULL, RSRC_CONF, TAKE1, - "Number of threads a child creates" }, -{ "ExcessRequestsPerChild", set_excess_requests, NULL, RSRC_CONF, TAKE1, - "Maximum number of requests a particular child serves after it is ready " - "to die." }, -{ "ListenBacklog", set_listenbacklog, NULL, RSRC_CONF, TAKE1, - "Maximum length of the queue of pending connections, as used by listen(2)" }, -{ "CoreDumpDirectory", set_coredumpdir, NULL, RSRC_CONF, TAKE1, - "The location of the directory Apache changes to before dumping core" }, -{ "Include", include_config, NULL, (RSRC_CONF | ACCESS_CONF), TAKE1, - "Name of the config file to be included" }, -{ "LogLevel", set_loglevel, NULL, RSRC_CONF, TAKE1, - "Level of verbosity in error logging" }, -{ "NameVirtualHost", ap_set_name_virtual_host, NULL, RSRC_CONF, TAKE1, - "A numeric IP address:port, or the name of a host" }, -#ifdef _OSD_POSIX -{ "BS2000Account", set_bs2000_account, NULL, RSRC_CONF, TAKE1, - "Name of server User's bs2000 logon account name" }, -#endif -#ifdef WIN32 -{ "ScriptInterpreterSource", set_interpreter_source, NULL, OR_FILEINFO, TAKE1, - "Where to find interpreter to run Win32 scripts (Registry or script shebang line)" }, -#endif -{ "ServerTokens", set_serv_tokens, NULL, RSRC_CONF, TAKE1, - "Determine tokens displayed in the Server: header - Min(imal), OS or Full" }, -{ "LimitRequestLine", set_limit_req_line, NULL, RSRC_CONF, TAKE1, - "Limit on maximum size of an HTTP request line"}, -{ "LimitRequestFieldsize", set_limit_req_fieldsize, NULL, RSRC_CONF, TAKE1, - "Limit on maximum size of an HTTP request header field"}, -{ "LimitRequestFields", set_limit_req_fields, NULL, RSRC_CONF, TAKE1, - "Limit (0 = unlimited) on max number of header fields in a request message"}, -{ "LimitRequestBody", set_limit_req_body, - (void*)XtOffsetOf(core_dir_config, limit_req_body), - OR_ALL, TAKE1, - "Limit (in bytes) on maximum size of request message body" }, -{ NULL } -}; - -/***************************************************************** - * - * Core handlers for various phases of server operation... - */ - -static int core_translate(request_rec *r) -{ - void *sconf = r->server->module_config; - core_server_config *conf = ap_get_module_config(sconf, &core_module); - - if (r->proxyreq) { - return HTTP_FORBIDDEN; - } - if ((r->uri[0] != '/') && strcmp(r->uri, "*")) { - ap_log_rerror(APLOG_MARK, APLOG_NOERRNO|APLOG_ERR, r, - "Invalid URI in request %s", r->the_request); - return BAD_REQUEST; - } - - if (r->server->path - && !strncmp(r->uri, r->server->path, r->server->pathlen) - && (r->server->path[r->server->pathlen - 1] == '/' - || r->uri[r->server->pathlen] == '/' - || r->uri[r->server->pathlen] == '\0')) { - r->filename = ap_pstrcat(r->pool, conf->ap_document_root, - (r->uri + r->server->pathlen), NULL); - } - else { - /* - * Make sure that we do not mess up the translation by adding two - * /'s in a row. This happens under windows when the document - * root ends with a / - */ - if ((conf->ap_document_root[strlen(conf->ap_document_root)-1] == '/') - && (*(r->uri) == '/')) { - r->filename = ap_pstrcat(r->pool, conf->ap_document_root, r->uri+1, - NULL); - } - else { - r->filename = ap_pstrcat(r->pool, conf->ap_document_root, r->uri, - NULL); - } - } - - return OK; -} - -static int do_nothing(request_rec *r) { return OK; } - -#ifdef USE_MMAP_FILES -struct mmap_rec { - void *mm; - size_t length; -}; - -static void mmap_cleanup(void *mmv) -{ - struct mmap_rec *mmd = mmv; - - if (munmap(mmd->mm, mmd->length) == -1) { - ap_log_error(APLOG_MARK, APLOG_ERR, NULL, - "Failed to munmap memory of length %ld at 0x%lx", - (long) mmd->length, (long) mmd->mm); - } -} -#endif - -/* - * Default handler for MIME types without other handlers. Only GET - * and OPTIONS at this point... anyone who wants to write a generic - * handler for PUT or POST is free to do so, but it seems unwise to provide - * any defaults yet... So, for now, we assume that this will always be - * the last handler called and return 405 or 501. - */ - -static int default_handler(request_rec *r) -{ - core_dir_config *d = - (core_dir_config *)ap_get_module_config(r->per_dir_config, &core_module); - int rangestatus, errstatus; - FILE *f; -#ifdef USE_MMAP_FILES - caddr_t mm; -#endif -#ifdef CHARSET_EBCDIC - int convert_flag; -#endif - - /* This handler has no use for a request body (yet), but we still - * need to read and discard it if the client sent one. - */ - if ((errstatus = ap_discard_request_body(r)) != OK) { - return errstatus; - } - - r->allowed |= (1 << M_GET) | (1 << M_OPTIONS); - - if (r->method_number == M_INVALID) { - ap_log_rerror(APLOG_MARK, APLOG_NOERRNO|APLOG_ERR, r, - "Invalid method in request %s", r->the_request); - return NOT_IMPLEMENTED; - } - if (r->method_number == M_OPTIONS) { - return ap_send_http_options(r); - } - if (r->method_number == M_PUT) { - return METHOD_NOT_ALLOWED; - } - - if (r->finfo.st_mode == 0 || (r->path_info && *r->path_info)) { - char *emsg; - - emsg = "File does not exist: "; - if (r->path_info == NULL) { - emsg = ap_pstrcat(r->pool, emsg, r->filename, NULL); - } - else { - emsg = ap_pstrcat(r->pool, emsg, r->filename, r->path_info, NULL); - } - ap_log_rerror(APLOG_MARK, APLOG_ERR|APLOG_NOERRNO, r, "%s", emsg); - return HTTP_NOT_FOUND; - } - if (r->method_number != M_GET) { - return METHOD_NOT_ALLOWED; - } - -#if defined(OS2) || defined(WIN32) - /* Need binary mode for OS/2 */ - f = ap_pfopen(r->pool, r->filename, "rb"); -#else - f = ap_pfopen(r->pool, r->filename, "r"); -#endif - - if (f == NULL) { - ap_log_rerror(APLOG_MARK, APLOG_ERR, r, - "file permissions deny server access: %s", r->filename); - return FORBIDDEN; - } - - ap_update_mtime(r, r->finfo.st_mtime); - ap_set_last_modified(r); - ap_set_etag(r); - ap_table_setn(r->headers_out, "Accept-Ranges", "bytes"); - if (((errstatus = ap_meets_conditions(r)) != OK) - || (errstatus = ap_set_content_length(r, r->finfo.st_size))) { - return errstatus; - } - -#ifdef USE_MMAP_FILES - ap_block_alarms(); - if ((r->finfo.st_size >= MMAP_THRESHOLD) - && (r->finfo.st_size < MMAP_LIMIT) - && (!r->header_only || (d->content_md5 & 1))) { - /* we need to protect ourselves in case we die while we've got the - * file mmapped */ - mm = mmap(NULL, r->finfo.st_size, PROT_READ, MAP_PRIVATE, - fileno(f), 0); - if (mm == (caddr_t)-1) { - ap_log_rerror(APLOG_MARK, APLOG_CRIT, r, - "default_handler: mmap failed: %s", r->filename); - } - } - else { - mm = (caddr_t)-1; - } - - if (mm == (caddr_t)-1) { - ap_unblock_alarms(); -#endif - -#ifdef CHARSET_EBCDIC - /* To make serving of "raw ASCII text" files easy (they serve faster - * since they don't have to be converted from EBCDIC), a new - * "magic" type prefix was invented: text/x-ascii-{plain,html,...} - * If we detect one of these content types here, we simply correct - * the type to the real text/{plain,html,...} type. Otherwise, we - * set a flag that translation is required later on. - */ - convert_flag = ap_checkconv(r); - if (d->content_md5 & 1) { - ap_table_setn(r->headers_out, "Content-MD5", - ap_md5digest(r->pool, f, convert_flag)); - } -#else - if (d->content_md5 & 1) { - ap_table_setn(r->headers_out, "Content-MD5", - ap_md5digest(r->pool, f)); - } -#endif /* CHARSET_EBCDIC */ - - rangestatus = ap_set_byterange(r); - - ap_send_http_header(r); - - if (!r->header_only) { - if (!rangestatus) { - ap_send_fd(f, r); - } - else { - long offset, length; - while (ap_each_byterange(r, &offset, &length)) { - /* - * Non zero returns are more portable than checking - * for a return of -1. - */ - if (fseek(f, offset, SEEK_SET)) { - ap_log_error(APLOG_MARK, APLOG_ERR, r->server, - "Failed to fseek for byterange (%ld, %ld)", - offset, length); - } - else { - ap_send_fd_length(f, r, length); - } - } - } - } - -#ifdef USE_MMAP_FILES - } - else { - struct mmap_rec *mmd; - - mmd = ap_palloc(r->pool, sizeof(*mmd)); - mmd->mm = mm; - mmd->length = r->finfo.st_size; - ap_register_cleanup(r->pool, (void *)mmd, mmap_cleanup, mmap_cleanup); - ap_unblock_alarms(); - - if (d->content_md5 & 1) { - AP_MD5_CTX context; - - ap_MD5Init(&context); - ap_MD5Update(&context, (void *)mm, (unsigned int)r->finfo.st_size); - ap_table_setn(r->headers_out, "Content-MD5", - ap_md5contextTo64(r->pool, &context)); - } - - rangestatus = ap_set_byterange(r); - ap_send_http_header(r); - - if (!r->header_only) { - if (!rangestatus) { - ap_send_mmap(mm, r, 0, r->finfo.st_size); - } - else { - long offset, length; - while (ap_each_byterange(r, &offset, &length)) { - ap_send_mmap(mm, r, offset, length); - } - } - } - } -#endif - - ap_pfclose(r->pool, f); - return OK; -} - -static const handler_rec core_handlers[] = { -{ "*/*", default_handler }, -{ "default-handler", default_handler }, -{ NULL, NULL } -}; - -API_VAR_EXPORT module core_module = { - STANDARD_MODULE_STUFF, - NULL, /* initializer */ - create_core_dir_config, /* create per-directory config structure */ - merge_core_dir_configs, /* merge per-directory config structures */ - create_core_server_config, /* create per-server config structure */ - merge_core_server_configs, /* merge per-server config structures */ - core_cmds, /* command table */ - core_handlers, /* handlers */ - core_translate, /* translate_handler */ - NULL, /* check_user_id */ - NULL, /* check auth */ - do_nothing, /* check access */ - do_nothing, /* type_checker */ - NULL, /* pre-run fixups */ - NULL, /* logger */ - NULL, /* header parser */ - NULL, /* child_init */ - NULL, /* child_exit */ - NULL /* post_read_request */ -}; diff --git a/modules/http/http_protocol.c b/modules/http/http_protocol.c deleted file mode 100644 index 31779312c65daa6d66e0212a4710d5f774ec5bba..0000000000000000000000000000000000000000 --- a/modules/http/http_protocol.c +++ /dev/null @@ -1,2763 +0,0 @@ -/* ==================================================================== - * Copyright (c) 1995-1999 The Apache Group. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in - * the documentation and/or other materials provided with the - * distribution. - * - * 3. All advertising materials mentioning features or use of this - * software must display the following acknowledgment: - * "This product includes software developed by the Apache Group - * for use in the Apache HTTP server project (http://www.apache.org/)." - * - * 4. The names "Apache Server" and "Apache Group" must not be used to - * endorse or promote products derived from this software without - * prior written permission. For written permission, please contact - * apache@apache.org. - * - * 5. Products derived from this software may not be called "Apache" - * nor may "Apache" appear in their names without prior written - * permission of the Apache Group. - * - * 6. Redistributions of any form whatsoever must retain the following - * acknowledgment: - * "This product includes software developed by the Apache Group - * for use in the Apache HTTP server project (http://www.apache.org/)." - * - * THIS SOFTWARE IS PROVIDED BY THE APACHE GROUP ``AS IS'' AND ANY - * EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR - * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE APACHE GROUP OR - * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT - * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, - * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED - * OF THE POSSIBILITY OF SUCH DAMAGE. - * ==================================================================== - * - * This software consists of voluntary contributions made by many - * individuals on behalf of the Apache Group and was originally based - * on public domain software written at the National Center for - * Supercomputing Applications, University of Illinois, Urbana-Champaign. - * For more information on the Apache Group and the Apache HTTP server - * project, please see . - * - */ - -/* - * http_protocol.c --- routines which directly communicate with the client. - * - * Code originally by Rob McCool; much redone by Robert S. Thau - * and the Apache Group. - */ - -#define CORE_PRIVATE -#include "httpd.h" -#include "http_config.h" -#include "http_core.h" -#include "http_protocol.h" -#include "http_main.h" -#include "http_request.h" -#include "http_vhost.h" -#include "http_log.h" /* For errors detected in basic auth common - * support code... */ -#include "util_date.h" /* For parseHTTPdate and BAD_DATE */ -#include -#include "http_conf_globals.h" - -#define SET_BYTES_SENT(r) \ - do { if (r->sent_bodyct) \ - ap_bgetopt (r->connection->client, BO_BYTECT, &r->bytes_sent); \ - } while (0) - - -static int parse_byterange(char *range, long clength, long *start, long *end) -{ - char *dash = strchr(range, '-'); - - if (!dash) - return 0; - - if ((dash == range)) { - /* In the form "-5" */ - *start = clength - atol(dash + 1); - *end = clength - 1; - } - else { - *dash = '\0'; - dash++; - *start = atol(range); - if (*dash) - *end = atol(dash); - else /* "5-" */ - *end = clength - 1; - } - - if (*start < 0) - *start = 0; - - if (*end >= clength) - *end = clength - 1; - - if (*start > *end) - return 0; - - return (*start > 0 || *end < clength - 1); -} - -static int internal_byterange(int, long *, request_rec *, const char **, long *, - long *); - -API_EXPORT(int) ap_set_byterange(request_rec *r) -{ - const char *range, *if_range, *match; - long range_start, range_end; - - if (!r->clength || r->assbackwards) - return 0; - - /* Check for Range request-header (HTTP/1.1) or Request-Range for - * backwards-compatibility with second-draft Luotonen/Franks - * byte-ranges (e.g. Netscape Navigator 2-3). - * - * We support this form, with Request-Range, and (farther down) we - * send multipart/x-byteranges instead of multipart/byteranges for - * Request-Range based requests to work around a bug in Netscape - * Navigator 2-3 and MSIE 3. - */ - - if (!(range = ap_table_get(r->headers_in, "Range"))) - range = ap_table_get(r->headers_in, "Request-Range"); - - if (!range || strncasecmp(range, "bytes=", 6)) { - return 0; - } - - /* Check the If-Range header for Etag or Date. - * Note that this check will return false (as required) if either - * of the two etags are weak. - */ - if ((if_range = ap_table_get(r->headers_in, "If-Range"))) { - if (if_range[0] == '"') { - if (!(match = ap_table_get(r->headers_out, "Etag")) || - (strcmp(if_range, match) != 0)) - return 0; - } - else if (!(match = ap_table_get(r->headers_out, "Last-Modified")) || - (strcmp(if_range, match) != 0)) - return 0; - } - - if (!strchr(range, ',')) { - /* A single range */ - if (!parse_byterange(ap_pstrdup(r->pool, range + 6), r->clength, - &range_start, &range_end)) - return 0; - - r->byterange = 1; - - ap_table_setn(r->headers_out, "Content-Range", - ap_psprintf(r->pool, "bytes %ld-%ld/%ld", - range_start, range_end, r->clength)); - ap_table_setn(r->headers_out, "Content-Length", - ap_psprintf(r->pool, "%ld", range_end - range_start + 1)); - } - else { - /* a multiple range */ - const char *r_range = ap_pstrdup(r->pool, range + 6); - long tlength = 0; - - r->byterange = 2; - r->boundary = ap_psprintf(r->pool, "%lx%lx", - r->request_time, (long) getpid()); - while (internal_byterange(0, &tlength, r, &r_range, NULL, NULL)); - ap_table_setn(r->headers_out, "Content-Length", - ap_psprintf(r->pool, "%ld", tlength)); - } - - r->status = PARTIAL_CONTENT; - r->range = range + 6; - - return 1; -} - -API_EXPORT(int) ap_each_byterange(request_rec *r, long *offset, long *length) -{ - return internal_byterange(1, NULL, r, &r->range, offset, length); -} - -/* If this function is called with realreq=1, it will spit out - * the correct headers for a byterange chunk, and set offset and - * length to the positions they should be. - * - * If it is called with realreq=0, it will add to tlength the length - * it *would* have used with realreq=1. - * - * Either case will return 1 if it should be called again, and 0 - * when done. - */ -static int internal_byterange(int realreq, long *tlength, request_rec *r, - const char **r_range, long *offset, long *length) -{ - long range_start, range_end; - char *range; - - if (!**r_range) { - if (r->byterange > 1) { - if (realreq) - ap_rvputs(r, "\015\012--", r->boundary, "--\015\012", NULL); - else - *tlength += 4 + strlen(r->boundary) + 4; - } - return 0; - } - - range = ap_getword(r->pool, r_range, ','); - if (!parse_byterange(range, r->clength, &range_start, &range_end)) - /* Skip this one */ - return internal_byterange(realreq, tlength, r, r_range, offset, - length); - - if (r->byterange > 1) { - const char *ct = r->content_type ? r->content_type : ap_default_type(r); - char ts[MAX_STRING_LEN]; - - ap_snprintf(ts, sizeof(ts), "%ld-%ld/%ld", range_start, range_end, - r->clength); - if (realreq) - ap_rvputs(r, "\015\012--", r->boundary, "\015\012Content-type: ", - ct, "\015\012Content-range: bytes ", ts, "\015\012\015\012", - NULL); - else - *tlength += 4 + strlen(r->boundary) + 16 + strlen(ct) + 23 + - strlen(ts) + 4; - } - - if (realreq) { - *offset = range_start; - *length = range_end - range_start + 1; - } - else { - *tlength += range_end - range_start + 1; - } - return 1; -} - -API_EXPORT(int) ap_set_content_length(request_rec *r, long clength) -{ - r->clength = clength; - ap_table_setn(r->headers_out, "Content-Length", ap_psprintf(r->pool, "%ld", clength)); - return 0; -} - -API_EXPORT(int) ap_set_keepalive(request_rec *r) -{ - int ka_sent = 0; - int wimpy = ap_find_token(r->pool, - ap_table_get(r->headers_out, "Connection"), "close"); - const char *conn = ap_table_get(r->headers_in, "Connection"); - - /* The following convoluted conditional determines whether or not - * the current connection should remain persistent after this response - * (a.k.a. HTTP Keep-Alive) and whether or not the output message - * body should use the HTTP/1.1 chunked transfer-coding. In English, - * - * IF we have not marked this connection as errored; - * and the response body has a defined length due to the status code - * being 304 or 204, the request method being HEAD, already - * having defined Content-Length or Transfer-Encoding: chunked, or - * the request version being HTTP/1.1 and thus capable of being set - * as chunked [we know the (r->chunked = 1) side-effect is ugly]; - * and the server configuration enables keep-alive; - * and the server configuration has a reasonable inter-request timeout; - * and there is no maximum # requests or the max hasn't been reached; - * and the response status does not require a close; - * and the response generator has not already indicated close; - * and the client did not request non-persistence (Connection: close); - * and we haven't been configured to ignore the buggy twit - * or they're a buggy twit coming through a HTTP/1.1 proxy - * and the client is requesting an HTTP/1.0-style keep-alive - * or the client claims to be HTTP/1.1 compliant (perhaps a proxy); - * THEN we can be persistent, which requires more headers be output. - * - * Note that the condition evaluation order is extremely important. - */ - if ((r->connection->keepalive != -1) && - ((r->status == HTTP_NOT_MODIFIED) || - (r->status == HTTP_NO_CONTENT) || - r->header_only || - ap_table_get(r->headers_out, "Content-Length") || - ap_find_last_token(r->pool, - ap_table_get(r->headers_out, "Transfer-Encoding"), - "chunked") || - ((r->proto_num >= HTTP_VERSION(1,1)) && - (r->chunked = 1))) && /* THIS CODE IS CORRECT, see comment above. */ - r->server->keep_alive && - (r->server->keep_alive_timeout > 0) && - ((r->server->keep_alive_max == 0) || - (r->server->keep_alive_max > r->connection->keepalives)) && - !ap_status_drops_connection(r->status) && - !wimpy && - !ap_find_token(r->pool, conn, "close") && - (!ap_table_get(r->subprocess_env, "nokeepalive") || - ap_table_get(r->headers_in, "Via")) && - ((ka_sent = ap_find_token(r->pool, conn, "keep-alive")) || - (r->proto_num >= HTTP_VERSION(1,1))) - ) { - int left = r->server->keep_alive_max - r->connection->keepalives; - - r->connection->keepalive = 1; - r->connection->keepalives++; - - /* If they sent a Keep-Alive token, send one back */ - if (ka_sent) { - if (r->server->keep_alive_max) - ap_table_setn(r->headers_out, "Keep-Alive", - ap_psprintf(r->pool, "timeout=%d, max=%d", - r->server->keep_alive_timeout, left)); - else - ap_table_setn(r->headers_out, "Keep-Alive", - ap_psprintf(r->pool, "timeout=%d", - r->server->keep_alive_timeout)); - ap_table_mergen(r->headers_out, "Connection", "Keep-Alive"); - } - - return 1; - } - - /* Otherwise, we need to indicate that we will be closing this - * connection immediately after the current response. - * - * We only really need to send "close" to HTTP/1.1 clients, but we - * always send it anyway, because a broken proxy may identify itself - * as HTTP/1.0, but pass our request along with our HTTP/1.1 tag - * to a HTTP/1.1 client. Better safe than sorry. - */ - if (!wimpy) - ap_table_mergen(r->headers_out, "Connection", "close"); - - r->connection->keepalive = 0; - - return 0; -} - -/* - * Return the latest rational time from a request/mtime (modification time) - * pair. We return the mtime unless it's in the future, in which case we - * return the current time. We use the request time as a reference in order - * to limit the number of calls to time(). We don't check for futurosity - * unless the mtime is at least as new as the reference. - */ -API_EXPORT(time_t) ap_rationalize_mtime(request_rec *r, time_t mtime) -{ - time_t now; - - /* For all static responses, it's almost certain that the file was - * last modified before the beginning of the request. So there's - * no reason to call time(NULL) again. But if the response has been - * created on demand, then it might be newer than the time the request - * started. In this event we really have to call time(NULL) again - * so that we can give the clients the most accurate Last-Modified. If we - * were given a time in the future, we return the current time - the - * Last-Modified can't be in the future. - */ - now = (mtime < r->request_time) ? r->request_time : time(NULL); - return (mtime > now) ? now : mtime; -} - -API_EXPORT(int) ap_meets_conditions(request_rec *r) -{ - const char *etag = ap_table_get(r->headers_out, "ETag"); - const char *if_match, *if_modified_since, *if_unmodified, *if_nonematch; - time_t mtime; - - /* Check for conditional requests --- note that we only want to do - * this if we are successful so far and we are not processing a - * subrequest or an ErrorDocument. - * - * The order of the checks is important, since ETag checks are supposed - * to be more accurate than checks relative to the modification time. - * However, not all documents are guaranteed to *have* ETags, and some - * might have Last-Modified values w/o ETags, so this gets a little - * complicated. - */ - - if (!ap_is_HTTP_SUCCESS(r->status) || r->no_local_copy) { - return OK; - } - - mtime = (r->mtime != 0) ? r->mtime : time(NULL); - - /* If an If-Match request-header field was given - * AND the field value is not "*" (meaning match anything) - * AND if our strong ETag does not match any entity tag in that field, - * respond with a status of 412 (Precondition Failed). - */ - if ((if_match = ap_table_get(r->headers_in, "If-Match")) != NULL) { - if (if_match[0] != '*' && - (etag == NULL || etag[0] == 'W' || - !ap_find_list_item(r->pool, if_match, etag))) { - return HTTP_PRECONDITION_FAILED; - } - } - else { - /* Else if a valid If-Unmodified-Since request-header field was given - * AND the requested resource has been modified since the time - * specified in this field, then the server MUST - * respond with a status of 412 (Precondition Failed). - */ - if_unmodified = ap_table_get(r->headers_in, "If-Unmodified-Since"); - if (if_unmodified != NULL) { - time_t ius = ap_parseHTTPdate(if_unmodified); - - if ((ius != BAD_DATE) && (mtime > ius)) { - return HTTP_PRECONDITION_FAILED; - } - } - } - - /* If an If-None-Match request-header field was given - * AND the field value is "*" (meaning match anything) - * OR our ETag matches any of the entity tags in that field, fail. - * - * If the request method was GET or HEAD, failure means the server - * SHOULD respond with a 304 (Not Modified) response. - * For all other request methods, failure means the server MUST - * respond with a status of 412 (Precondition Failed). - * - * GET or HEAD allow weak etag comparison, all other methods require - * strong comparison. We can only use weak if it's not a range request. - */ - if_nonematch = ap_table_get(r->headers_in, "If-None-Match"); - if (if_nonematch != NULL) { - if (r->method_number == M_GET) { - if (if_nonematch[0] == '*') - return HTTP_NOT_MODIFIED; - if (etag != NULL) { - if (ap_table_get(r->headers_in, "Range")) { - if (etag[0] != 'W' && - ap_find_list_item(r->pool, if_nonematch, etag)) { - return HTTP_NOT_MODIFIED; - } - } - else if (strstr(if_nonematch, etag)) { - return HTTP_NOT_MODIFIED; - } - } - } - else if (if_nonematch[0] == '*' || - (etag != NULL && - ap_find_list_item(r->pool, if_nonematch, etag))) { - return HTTP_PRECONDITION_FAILED; - } - } - /* Else if a valid If-Modified-Since request-header field was given - * AND it is a GET or HEAD request - * AND the requested resource has not been modified since the time - * specified in this field, then the server MUST - * respond with a status of 304 (Not Modified). - * A date later than the server's current request time is invalid. - */ - else if ((r->method_number == M_GET) - && ((if_modified_since = - ap_table_get(r->headers_in, "If-Modified-Since")) != NULL)) { - time_t ims = ap_parseHTTPdate(if_modified_since); - - if ((ims >= mtime) && (ims <= r->request_time)) { - return HTTP_NOT_MODIFIED; - } - } - return OK; -} - -/* - * Construct an entity tag (ETag) from resource information. If it's a real - * file, build in some of the file characteristics. If the modification time - * is newer than (request-time minus 1 second), mark the ETag as weak - it - * could be modified again in as short an interval. We rationalize the - * modification time we're given to keep it from being in the future. - */ -API_EXPORT(char *) ap_make_etag(request_rec *r, int force_weak) -{ - char *etag; - char *weak; - - /* - * Make an ETag header out of various pieces of information. We use - * the last-modified date and, if we have a real file, the - * length and inode number - note that this doesn't have to match - * the content-length (i.e. includes), it just has to be unique - * for the file. - * - * If the request was made within a second of the last-modified date, - * we send a weak tag instead of a strong one, since it could - * be modified again later in the second, and the validation - * would be incorrect. - */ - - weak = ((r->request_time - r->mtime > 1) && !force_weak) ? "" : "W/"; - - if (r->finfo.st_mode != 0) { - etag = ap_psprintf(r->pool, - "%s\"%lx-%lx-%lx\"", weak, - (unsigned long) r->finfo.st_ino, - (unsigned long) r->finfo.st_size, - (unsigned long) r->mtime); - } - else { - etag = ap_psprintf(r->pool, "%s\"%lx\"", weak, - (unsigned long) r->mtime); - } - - return etag; -} - -API_EXPORT(void) ap_set_etag(request_rec *r) -{ - char *etag; - char *variant_etag, *vlv; - int vlv_weak; - - if (!r->vlist_validator) { - etag = ap_make_etag(r, 0); - } - else { - /* If we have a variant list validator (vlv) due to the - * response being negotiated, then we create a structured - * entity tag which merges the variant etag with the variant - * list validator (vlv). This merging makes revalidation - * somewhat safer, ensures that caches which can deal with - * Vary will (eventually) be updated if the set of variants is - * changed, and is also a protocol requirement for transparent - * content negotiation. - */ - - /* if the variant list validator is weak, we make the whole - * structured etag weak. If we would not, then clients could - * have problems merging range responses if we have different - * variants with the same non-globally-unique strong etag. - */ - - vlv = r->vlist_validator; - vlv_weak = (vlv[0] == 'W'); - - variant_etag = ap_make_etag(r, vlv_weak); - - /* merge variant_etag and vlv into a structured etag */ - - variant_etag[strlen(variant_etag) - 1] = '\0'; - if (vlv_weak) - vlv += 3; - else - vlv++; - etag = ap_pstrcat(r->pool, variant_etag, ";", vlv, NULL); - } - - ap_table_setn(r->headers_out, "ETag", etag); -} - -/* - * This function sets the Last-Modified output header field to the value - * of the mtime field in the request structure - rationalized to keep it from - * being in the future. - */ -API_EXPORT(void) ap_set_last_modified(request_rec *r) -{ - time_t mod_time = ap_rationalize_mtime(r, r->mtime); - - ap_table_setn(r->headers_out, "Last-Modified", - ap_gm_timestr_822(r->pool, mod_time)); -} - -/* Get the method number associated with the given string, assumed to - * contain an HTTP method. Returns M_INVALID if not recognized. - * - * This is the first step toward placing method names in a configurable - * list. Hopefully it (and other routines) can eventually be moved to - * something like a mod_http_methods.c, complete with config stuff. - */ -API_EXPORT(int) ap_method_number_of(const char *method) -{ - switch (*method) { - case 'H': - if (strcmp(method, "HEAD") == 0) - return M_GET; /* see header_only in request_rec */ - break; - case 'G': - if (strcmp(method, "GET") == 0) - return M_GET; - break; - case 'P': - if (strcmp(method, "POST") == 0) - return M_POST; - if (strcmp(method, "PUT") == 0) - return M_PUT; - if (strcmp(method, "PATCH") == 0) - return M_PATCH; - if (strcmp(method, "PROPFIND") == 0) - return M_PROPFIND; - if (strcmp(method, "PROPPATCH") == 0) - return M_PROPPATCH; - break; - case 'D': - if (strcmp(method, "DELETE") == 0) - return M_DELETE; - break; - case 'C': - if (strcmp(method, "CONNECT") == 0) - return M_CONNECT; - if (strcmp(method, "COPY") == 0) - return M_COPY; - break; - case 'M': - if (strcmp(method, "MKCOL") == 0) - return M_MKCOL; - if (strcmp(method, "MOVE") == 0) - return M_MOVE; - break; - case 'O': - if (strcmp(method, "OPTIONS") == 0) - return M_OPTIONS; - break; - case 'T': - if (strcmp(method, "TRACE") == 0) - return M_TRACE; - break; - case 'L': - if (strcmp(method, "LOCK") == 0) - return M_LOCK; - break; - case 'U': - if (strcmp(method, "UNLOCK") == 0) - return M_UNLOCK; - break; - } - return M_INVALID; -} - -/* Get a line of protocol input, including any continuation lines - * caused by MIME folding (or broken clients) if fold != 0, and place it - * in the buffer s, of size n bytes, without the ending newline. - * - * Returns -1 on error, or the length of s. - * - * Note: Because bgets uses 1 char for newline and 1 char for NUL, - * the most we can get is (n - 2) actual characters if it - * was ended by a newline, or (n - 1) characters if the line - * length exceeded (n - 1). So, if the result == (n - 1), - * then the actual input line exceeded the buffer length, - * and it would be a good idea for the caller to puke 400 or 414. - */ -static int getline(char *s, int n, BUFF *in, int fold) -{ - char *pos, next; - int retval; - int total = 0; - - pos = s; - - do { - retval = ap_bgets(pos, n, in); /* retval == -1 if error, 0 if EOF */ - - if (retval <= 0) - return ((retval < 0) && (total == 0)) ? -1 : total; - - /* retval is the number of characters read, not including NUL */ - - n -= retval; /* Keep track of how much of s is full */ - pos += (retval - 1); /* and where s ends */ - total += retval; /* and how long s has become */ - - if (*pos == '\n') { /* Did we get a full line of input? */ - /* - * Trim any extra trailing spaces or tabs except for the first - * space or tab at the beginning of a blank string. This makes - * it much easier to check field values for exact matches, and - * saves memory as well. Terminate string at end of line. - */ - while (pos > (s + 1) && (*(pos - 1) == ' ' || *(pos - 1) == '\t')) { - --pos; /* trim extra trailing spaces or tabs */ - --total; /* but not one at the beginning of line */ - ++n; - } - *pos = '\0'; - --total; - ++n; - } - else - return total; /* if not, input line exceeded buffer size */ - - /* Continue appending if line folding is desired and - * the last line was not empty and we have room in the buffer and - * the next line begins with a continuation character. - */ - } while (fold && (retval != 1) && (n > 1) - && (ap_blookc(&next, in) == 1) - && ((next == ' ') || (next == '\t'))); - - return total; -} - -/* parse_uri: break apart the uri - * Side Effects: - * - sets r->args to rest after '?' (or NULL if no '?') - * - sets r->uri to request uri (without r->args part) - * - sets r->hostname (if not set already) from request (scheme://host:port) - */ -CORE_EXPORT(void) ap_parse_uri(request_rec *r, const char *uri) -{ - int status = HTTP_OK; - - r->unparsed_uri = ap_pstrdup(r->pool, uri); - - if (r->method_number == M_CONNECT) { - status = ap_parse_hostinfo_components(r->pool, uri, &r->parsed_uri); - } else { - /* Simple syntax Errors in URLs are trapped by parse_uri_components(). */ - status = ap_parse_uri_components(r->pool, uri, &r->parsed_uri); - } - - if (ap_is_HTTP_SUCCESS(status)) { - /* if it has a scheme we may need to do absoluteURI vhost stuff */ - if (r->parsed_uri.scheme - && !strcasecmp(r->parsed_uri.scheme, ap_http_method(r))) { - r->hostname = r->parsed_uri.hostname; - } else if (r->method_number == M_CONNECT) { - r->hostname = r->parsed_uri.hostname; - } - r->args = r->parsed_uri.query; - r->uri = r->parsed_uri.path ? r->parsed_uri.path - : ap_pstrdup(r->pool, "/"); -#if defined(OS2) || defined(WIN32) - /* Handle path translations for OS/2 and plug security hole. - * This will prevent "http://www.wherever.com/..\..\/" from - * returning a directory for the root drive. - */ - { - char *x; - - for (x = r->uri; (x = strchr(x, '\\')) != NULL; ) - *x = '/'; - } -#endif /* OS2 || WIN32 */ - } - else { - r->args = NULL; - r->hostname = NULL; - r->status = status; /* set error status */ - r->uri = ap_pstrdup(r->pool, uri); - } -} - -static int read_request_line(request_rec *r) -{ - char l[DEFAULT_LIMIT_REQUEST_LINE + 2]; /* getline's two extra for \n\0 */ - const char *ll = l; - const char *uri; - conn_rec *conn = r->connection; - int major = 1, minor = 0; /* Assume HTTP/1.0 if non-"HTTP" protocol */ - int len; - - /* Read past empty lines until we get a real request line, - * a read error, the connection closes (EOF), or we timeout. - * - * We skip empty lines because browsers have to tack a CRLF on to the end - * of POSTs to support old CERN webservers. But note that we may not - * have flushed any previous response completely to the client yet. - * We delay the flush as long as possible so that we can improve - * performance for clients that are pipelining requests. If a request - * is pipelined then we won't block during the (implicit) read() below. - * If the requests aren't pipelined, then the client is still waiting - * for the final buffer flush from us, and we will block in the implicit - * read(). B_SAFEREAD ensures that the BUFF layer flushes if it will - * have to block during a read. - */ - ap_bsetflag(conn->client, B_SAFEREAD, 1); - while ((len = getline(l, sizeof(l), conn->client, 0)) <= 0) { - if ((len < 0) || ap_bgetflag(conn->client, B_EOF)) { - ap_bsetflag(conn->client, B_SAFEREAD, 0); - /* this is a hack to make sure that request time is set, - * it's not perfect, but it's better than nothing - */ - r->request_time = time(0); - return 0; - } - } - /* we've probably got something to do, ignore graceful restart requests */ -#ifdef SIGUSR1 - signal(SIGUSR1, SIG_IGN); -#endif - - ap_bsetflag(conn->client, B_SAFEREAD, 0); - - r->request_time = time(NULL); - r->the_request = ap_pstrdup(r->pool, l); - r->method = ap_getword_white(r->pool, &ll); - uri = ap_getword_white(r->pool, &ll); - - /* Provide quick information about the request method as soon as known */ - - r->method_number = ap_method_number_of(r->method); - if (r->method_number == M_GET && r->method[0] == 'H') { - r->header_only = 1; - } - - ap_parse_uri(r, uri); - - /* getline returns (size of max buffer - 1) if it fills up the - * buffer before finding the end-of-line. This is only going to - * happen if it exceeds the configured limit for a request-line. - */ - if (len > r->server->limit_req_line) { - r->status = HTTP_REQUEST_URI_TOO_LARGE; - r->proto_num = HTTP_VERSION(1,0); - r->protocol = ap_pstrdup(r->pool, "HTTP/1.0"); - return 0; - } - - r->assbackwards = (ll[0] == '\0'); - r->protocol = ap_pstrdup(r->pool, ll[0] ? ll : "HTTP/0.9"); - - if (2 == sscanf(r->protocol, "HTTP/%u.%u", &major, &minor) - && minor < HTTP_VERSION(1,0)) /* don't allow HTTP/0.1000 */ - r->proto_num = HTTP_VERSION(major, minor); - else - r->proto_num = HTTP_VERSION(1,0); - - return 1; -} - -static void get_mime_headers(request_rec *r) -{ - char field[DEFAULT_LIMIT_REQUEST_FIELDSIZE + 2]; /* getline's two extra */ - conn_rec *c = r->connection; - char *value; - char *copy; - int len; - unsigned int fields_read = 0; - table *tmp_headers; - - /* We'll use ap_overlap_tables later to merge these into r->headers_in. */ - tmp_headers = ap_make_table(r->pool, 50); - - /* - * Read header lines until we get the empty separator line, a read error, - * the connection closes (EOF), reach the server limit, or we timeout. - */ - while ((len = getline(field, sizeof(field), c->client, 1)) > 0) { - - if (r->server->limit_req_fields && - (++fields_read > r->server->limit_req_fields)) { - r->status = HTTP_BAD_REQUEST; - ap_table_setn(r->notes, "error-notes", - "The number of request header fields exceeds " - "this server's limit.

    \n"); - return; - } - /* getline returns (size of max buffer - 1) if it fills up the - * buffer before finding the end-of-line. This is only going to - * happen if it exceeds the configured limit for a field size. - */ - if (len > r->server->limit_req_fieldsize) { - r->status = HTTP_BAD_REQUEST; - ap_table_setn(r->notes, "error-notes", ap_pstrcat(r->pool, - "Size of a request header field exceeds server limit.

    \n" - "

    \n", field, "
    \n", NULL)); - return; - } - copy = ap_palloc(r->pool, len + 1); - memcpy(copy, field, len + 1); - - if (!(value = strchr(copy, ':'))) { /* Find the colon separator */ - r->status = HTTP_BAD_REQUEST; /* or abort the bad request */ - ap_table_setn(r->notes, "error-notes", ap_pstrcat(r->pool, - "Request header field is missing colon separator.

    \n" - "

    \n", copy, "
    \n", NULL)); - return; - } - - *value = '\0'; - ++value; - while (*value == ' ' || *value == '\t') - ++value; /* Skip to start of value */ - - ap_table_addn(tmp_headers, copy, value); - } - - ap_overlap_tables(r->headers_in, tmp_headers, AP_OVERLAP_TABLES_MERGE); -} - -request_rec *ap_read_request(conn_rec *conn) -{ - request_rec *r; - pool *p; - const char *expect; - int access_status; - - p = ap_make_sub_pool(conn->pool); - r = ap_pcalloc(p, sizeof(request_rec)); - r->pool = p; - r->connection = conn; - conn->server = conn->base_server; - r->server = conn->server; - - conn->keptalive = conn->keepalive == 1; - conn->keepalive = 0; - - conn->user = NULL; - conn->ap_auth_type = NULL; - - r->headers_in = ap_make_table(r->pool, 50); - r->subprocess_env = ap_make_table(r->pool, 50); - r->headers_out = ap_make_table(r->pool, 12); - r->err_headers_out = ap_make_table(r->pool, 5); - r->notes = ap_make_table(r->pool, 5); - - r->request_config = ap_create_request_config(r->pool); - r->per_dir_config = r->server->lookup_defaults; - - r->sent_bodyct = 0; /* bytect isn't for body */ - - r->read_length = 0; - r->read_body = REQUEST_NO_BODY; - - r->status = HTTP_REQUEST_TIME_OUT; /* Until we get a request */ - r->the_request = NULL; - -#ifdef CHARSET_EBCDIC - ap_bsetflag(r->connection->client, B_ASCII2EBCDIC|B_EBCDIC2ASCII, 1); -#endif - - /* Get the request... */ - - ap_keepalive_timeout("read request line", r); - if (!read_request_line(r)) { - ap_kill_timeout(r); - if (r->status == HTTP_REQUEST_URI_TOO_LARGE) { - - ap_log_rerror(APLOG_MARK, APLOG_NOERRNO|APLOG_ERR, r, - "request failed: URI too long"); - ap_send_error_response(r, 0); - ap_log_transaction(r); - return r; - } - return NULL; - } - if (!r->assbackwards) { - ap_hard_timeout("read request headers", r); - get_mime_headers(r); - ap_kill_timeout(r); - if (r->status != HTTP_REQUEST_TIME_OUT) { - ap_log_rerror(APLOG_MARK, APLOG_NOERRNO|APLOG_ERR, r, - "request failed: error reading the headers"); - ap_send_error_response(r, 0); - ap_log_transaction(r); - return r; - } - } - else { - ap_kill_timeout(r); - - if (r->header_only) { - /* - * Client asked for headers only with HTTP/0.9, which doesn't send - * headers! Have to dink things just to make sure the error message - * comes through... - */ - ap_log_rerror(APLOG_MARK, APLOG_NOERRNO|APLOG_ERR, r, - "client sent invalid HTTP/0.9 request: HEAD %s", - r->uri); - r->header_only = 0; - r->status = HTTP_BAD_REQUEST; - ap_send_error_response(r, 0); - ap_log_transaction(r); - return r; - } - } - - r->status = HTTP_OK; /* Until further notice. */ - - /* update what we think the virtual host is based on the headers we've - * now read - */ - ap_update_vhost_from_headers(r); - - /* we may have switched to another server */ - r->per_dir_config = r->server->lookup_defaults; - - conn->keptalive = 0; /* We now have a request to play with */ - - if ((!r->hostname && (r->proto_num >= HTTP_VERSION(1,1))) || - ((r->proto_num == HTTP_VERSION(1,1)) && - !ap_table_get(r->headers_in, "Host"))) { - /* - * Client sent us an HTTP/1.1 or later request without telling us the - * hostname, either with a full URL or a Host: header. We therefore - * need to (as per the 1.1 spec) send an error. As a special case, - * HTTP/1.1 mentions twice (S9, S14.23) that a request MUST contain - * a Host: header, and the server MUST respond with 400 if it doesn't. - */ - r->status = HTTP_BAD_REQUEST; - ap_log_rerror(APLOG_MARK, APLOG_NOERRNO|APLOG_ERR, r, - "client sent HTTP/1.1 request without hostname " - "(see RFC2068 section 9, and 14.23): %s", r->uri); - ap_send_error_response(r, 0); - ap_log_transaction(r); - return r; - } - if (((expect = ap_table_get(r->headers_in, "Expect")) != NULL) && - (expect[0] != '\0')) { - /* - * The Expect header field was added to HTTP/1.1 after RFC 2068 - * as a means to signal when a 100 response is desired and, - * unfortunately, to signal a poor man's mandatory extension that - * the server must understand or return 417 Expectation Failed. - */ - if (strcasecmp(expect, "100-continue") == 0) { - r->expecting_100 = 1; - } - else { - r->status = HTTP_EXPECTATION_FAILED; - ap_log_rerror(APLOG_MARK, APLOG_NOERRNO|APLOG_INFO, r, - "client sent an unrecognized expectation value of " - "Expect: %s", expect); - ap_send_error_response(r, 0); - (void) ap_discard_request_body(r); - ap_log_transaction(r); - return r; - } - } - - if ((access_status = ap_run_post_read_request(r))) { - ap_die(access_status, r); - ap_log_transaction(r); - return NULL; - } - - return r; -} - -/* - * A couple of other functions which initialize some of the fields of - * a request structure, as appropriate for adjuncts of one kind or another - * to a request in progress. Best here, rather than elsewhere, since - * *someone* has to set the protocol-specific fields... - */ - -void ap_set_sub_req_protocol(request_rec *rnew, const request_rec *r) -{ - rnew->the_request = r->the_request; /* Keep original request-line */ - - rnew->assbackwards = 1; /* Don't send headers from this. */ - rnew->no_local_copy = 1; /* Don't try to send USE_LOCAL_COPY for a - * fragment. */ - rnew->method = "GET"; - rnew->method_number = M_GET; - rnew->protocol = "INCLUDED"; - - rnew->status = HTTP_OK; - - rnew->headers_in = r->headers_in; - rnew->subprocess_env = ap_copy_table(rnew->pool, r->subprocess_env); - rnew->headers_out = ap_make_table(rnew->pool, 5); - rnew->err_headers_out = ap_make_table(rnew->pool, 5); - rnew->notes = ap_make_table(rnew->pool, 5); - - rnew->expecting_100 = r->expecting_100; - rnew->read_length = r->read_length; - rnew->read_body = REQUEST_NO_BODY; - - rnew->main = (request_rec *) r; -} - -void ap_finalize_sub_req_protocol(request_rec *sub) -{ - SET_BYTES_SENT(sub->main); -} - -/* - * Support for the Basic authentication protocol, and a bit for Digest. - */ - -API_EXPORT(void) ap_note_auth_failure(request_rec *r) -{ - if (!strcasecmp(ap_auth_type(r), "Basic")) - ap_note_basic_auth_failure(r); - else if (!strcasecmp(ap_auth_type(r), "Digest")) - ap_note_digest_auth_failure(r); -} - -API_EXPORT(void) ap_note_basic_auth_failure(request_rec *r) -{ - if (strcasecmp(ap_auth_type(r), "Basic")) - ap_note_auth_failure(r); - else - ap_table_setn(r->err_headers_out, - r->proxyreq ? "Proxy-Authenticate" : "WWW-Authenticate", - ap_pstrcat(r->pool, "Basic realm=\"", ap_auth_name(r), "\"", - NULL)); -} - -API_EXPORT(void) ap_note_digest_auth_failure(request_rec *r) -{ - ap_table_setn(r->err_headers_out, - r->proxyreq ? "Proxy-Authenticate" : "WWW-Authenticate", - ap_psprintf(r->pool, "Digest realm=\"%s\", nonce=\"%lu\"", - ap_auth_name(r), r->request_time)); -} - -API_EXPORT(int) ap_get_basic_auth_pw(request_rec *r, const char **pw) -{ - const char *auth_line = ap_table_get(r->headers_in, - r->proxyreq ? "Proxy-Authorization" - : "Authorization"); - const char *t; - - if (!(t = ap_auth_type(r)) || strcasecmp(t, "Basic")) - return DECLINED; - - if (!ap_auth_name(r)) { - ap_log_rerror(APLOG_MARK, APLOG_NOERRNO|APLOG_ERR, - r, "need AuthName: %s", r->uri); - return SERVER_ERROR; - } - - if (!auth_line) { - ap_note_basic_auth_failure(r); - return AUTH_REQUIRED; - } - - if (strcasecmp(ap_getword(r->pool, &auth_line, ' '), "Basic")) { - /* Client tried to authenticate using wrong auth scheme */ - ap_log_rerror(APLOG_MARK, APLOG_NOERRNO|APLOG_ERR, r, - "client used wrong authentication scheme: %s", r->uri); - ap_note_basic_auth_failure(r); - return AUTH_REQUIRED; - } - - /* CHARSET_EBCDIC Issue's here ?!? Compare with 32/9 instead - * as we are operating on an octed stream ? - */ - while (*auth_line== ' ' || *auth_line== '\t') - auth_line++; - - t = ap_pbase64decode(r->pool, auth_line); - /* Note that this allocation has to be made from r->connection->pool - * because it has the lifetime of the connection. The other allocations - * are temporary and can be tossed away any time. - */ - r->connection->user = ap_getword_nulls (r->connection->pool, &t, ':'); - r->connection->ap_auth_type = "Basic"; - - *pw = t; - - return OK; -} - -/* New Apache routine to map status codes into array indicies - * e.g. 100 -> 0, 101 -> 1, 200 -> 2 ... - * The number of status lines must equal the value of RESPONSE_CODES (httpd.h) - * and must be listed in order. - */ - -#ifdef UTS21 -/* The second const triggers an assembler bug on UTS 2.1. - * Another workaround is to move some code out of this file into another, - * but this is easier. Dave Dykstra, 3/31/99 - */ -static const char * status_lines[RESPONSE_CODES] = -#else -static const char * const status_lines[RESPONSE_CODES] = -#endif -{ - "100 Continue", - "101 Switching Protocols", - "102 Processing", -#define LEVEL_200 3 - "200 OK", - "201 Created", - "202 Accepted", - "203 Non-Authoritative Information", - "204 No Content", - "205 Reset Content", - "206 Partial Content", - "207 Multi-Status", -#define LEVEL_300 11 - "300 Multiple Choices", - "301 Moved Permanently", - "302 Found", - "303 See Other", - "304 Not Modified", - "305 Use Proxy", - "306 unused", - "307 Temporary Redirect", -#define LEVEL_400 19 - "400 Bad Request", - "401 Authorization Required", - "402 Payment Required", - "403 Forbidden", - "404 Not Found", - "405 Method Not Allowed", - "406 Not Acceptable", - "407 Proxy Authentication Required", - "408 Request Time-out", - "409 Conflict", - "410 Gone", - "411 Length Required", - "412 Precondition Failed", - "413 Request Entity Too Large", - "414 Request-URI Too Large", - "415 Unsupported Media Type", - "416 Requested Range Not Satisfiable", - "417 Expectation Failed", - "418 unused", - "419 unused", - "420 unused", - "421 unused", - "422 Unprocessable Entity", - "423 Locked", - "424 Failed Dependency", -#define LEVEL_500 44 - "500 Internal Server Error", - "501 Method Not Implemented", - "502 Bad Gateway", - "503 Service Temporarily Unavailable", - "504 Gateway Time-out", - "505 HTTP Version Not Supported", - "506 Variant Also Negotiates", - "507 Insufficient Storage", - "508 unused", - "509 unused", - "510 Not Extended" -}; - -/* The index is found by its offset from the x00 code of each level. - * Although this is fast, it will need to be replaced if some nutcase - * decides to define a high-numbered code before the lower numbers. - * If that sad event occurs, replace the code below with a linear search - * from status_lines[shortcut[i]] to status_lines[shortcut[i+1]-1]; - */ -API_EXPORT(int) ap_index_of_response(int status) -{ - static int shortcut[6] = {0, LEVEL_200, LEVEL_300, LEVEL_400, - LEVEL_500, RESPONSE_CODES}; - int i, pos; - - if (status < 100) /* Below 100 is illegal for HTTP status */ - return LEVEL_500; - - for (i = 0; i < 5; i++) { - status -= 100; - if (status < 100) { - pos = (status + shortcut[i]); - if (pos < shortcut[i + 1]) - return pos; - else - return LEVEL_500; /* status unknown (falls in gap) */ - } - } - return LEVEL_500; /* 600 or above is also illegal */ -} - -/* Send a single HTTP header field to the client. Note that this function - * is used in calls to table_do(), so their interfaces are co-dependent. - * In other words, don't change this one without checking table_do in alloc.c. - * It returns true unless there was a write error of some kind. - */ -API_EXPORT_NONSTD(int) ap_send_header_field(request_rec *r, - const char *fieldname, const char *fieldval) -{ - return (0 < ap_rvputs(r, fieldname, ": ", fieldval, "\015\012", NULL)); -} - -API_EXPORT(void) ap_basic_http_header(request_rec *r) -{ - char *protocol; -#ifdef CHARSET_EBCDIC - int convert = ap_bgetflag(r->connection->client, B_EBCDIC2ASCII); -#endif /*CHARSET_EBCDIC*/ - - if (r->assbackwards) - return; - - if (!r->status_line) - r->status_line = status_lines[ap_index_of_response(r->status)]; - - /* mod_proxy is only HTTP/1.0, so avoid sending HTTP/1.1 error response; - * kluge around broken browsers when indicated by force-response-1.0 - */ - if (r->proxyreq - || (r->proto_num == HTTP_VERSION(1,0) - && ap_table_get(r->subprocess_env, "force-response-1.0"))) { - - protocol = "HTTP/1.0"; - r->connection->keepalive = -1; - } - else - protocol = SERVER_PROTOCOL; - -#ifdef CHARSET_EBCDIC - ap_bsetflag(r->connection->client, B_EBCDIC2ASCII, 1); -#endif /*CHARSET_EBCDIC*/ - - /* Output the HTTP/1.x Status-Line and the Date and Server fields */ - - ap_rvputs(r, protocol, " ", r->status_line, "\015\012", NULL); - - ap_send_header_field(r, "Date", ap_gm_timestr_822(r->pool, r->request_time)); - ap_send_header_field(r, "Server", ap_get_server_version()); - - ap_table_unset(r->headers_out, "Date"); /* Avoid bogosity */ - ap_table_unset(r->headers_out, "Server"); -#ifdef CHARSET_EBCDIC - if (!convert) - ap_bsetflag(r->connection->client, B_EBCDIC2ASCII, convert); -#endif /*CHARSET_EBCDIC*/ -} - -/* Navigator versions 2.x, 3.x and 4.0 betas up to and including 4.0b2 - * have a header parsing bug. If the terminating \r\n occur starting - * at offset 256, 257 or 258 of output then it will not properly parse - * the headers. Curiously it doesn't exhibit this problem at 512, 513. - * We are guessing that this is because their initial read of a new request - * uses a 256 byte buffer, and subsequent reads use a larger buffer. - * So the problem might exist at different offsets as well. - * - * This should also work on keepalive connections assuming they use the - * same small buffer for the first read of each new request. - * - * At any rate, we check the bytes written so far and, if we are about to - * tickle the bug, we instead insert a bogus padding header. Since the bug - * manifests as a broken image in Navigator, users blame the server. :( - * It is more expensive to check the User-Agent than it is to just add the - * bytes, so we haven't used the BrowserMatch feature here. - */ -static void terminate_header(BUFF *client) -{ - long int bs; - - ap_bgetopt(client, BO_BYTECT, &bs); - if (bs >= 255 && bs <= 257) - ap_bputs("X-Pad: avoid browser bug\015\012", client); - - ap_bputs("\015\012", client); /* Send the terminating empty line */ -} - -/* Build the Allow field-value from the request handler method mask. - * Note that we always allow TRACE, since it is handled below. - */ -static char *make_allow(request_rec *r) -{ - return 2 + ap_pstrcat(r->pool, - (r->allowed & (1 << M_GET)) ? ", GET, HEAD" : "", - (r->allowed & (1 << M_POST)) ? ", POST" : "", - (r->allowed & (1 << M_PUT)) ? ", PUT" : "", - (r->allowed & (1 << M_DELETE)) ? ", DELETE" : "", - (r->allowed & (1 << M_CONNECT)) ? ", CONNECT" : "", - (r->allowed & (1 << M_OPTIONS)) ? ", OPTIONS" : "", - (r->allowed & (1 << M_PATCH)) ? ", PATCH" : "", - (r->allowed & (1 << M_PROPFIND)) ? ", PROPFIND" : "", - (r->allowed & (1 << M_PROPPATCH)) ? ", PROPPATCH" : "", - (r->allowed & (1 << M_MKCOL)) ? ", MKCOL" : "", - (r->allowed & (1 << M_COPY)) ? ", COPY" : "", - (r->allowed & (1 << M_MOVE)) ? ", MOVE" : "", - (r->allowed & (1 << M_LOCK)) ? ", LOCK" : "", - (r->allowed & (1 << M_UNLOCK)) ? ", UNLOCK" : "", - ", TRACE", - NULL); -} - -API_EXPORT(int) ap_send_http_trace(request_rec *r) -{ - int rv; - - /* Get the original request */ - while (r->prev) - r = r->prev; - - if ((rv = ap_setup_client_block(r, REQUEST_NO_BODY))) - return rv; - - ap_hard_timeout("send TRACE", r); - - r->content_type = "message/http"; - ap_send_http_header(r); - - /* Now we recreate the request, and echo it back */ - - ap_rvputs(r, r->the_request, "\015\012", NULL); - - ap_table_do((int (*) (void *, const char *, const char *)) - ap_send_header_field, (void *) r, r->headers_in, NULL); - ap_rputs("\015\012", r); - - ap_kill_timeout(r); - return OK; -} - -int ap_send_http_options(request_rec *r) -{ - const long int zero = 0L; - - if (r->assbackwards) - return DECLINED; - - ap_hard_timeout("send OPTIONS", r); - - ap_basic_http_header(r); - - ap_table_setn(r->headers_out, "Content-Length", "0"); - ap_table_setn(r->headers_out, "Allow", make_allow(r)); - ap_set_keepalive(r); - - ap_table_do((int (*) (void *, const char *, const char *)) ap_send_header_field, - (void *) r, r->headers_out, NULL); - - terminate_header(r->connection->client); - - ap_kill_timeout(r); - ap_bsetopt(r->connection->client, BO_BYTECT, &zero); - - return OK; -} - -/* - * Here we try to be compatible with clients that want multipart/x-byteranges - * instead of multipart/byteranges (also see above), as per HTTP/1.1. We - * look for the Request-Range header (e.g. Netscape 2 and 3) as an indication - * that the browser supports an older protocol. We also check User-Agent - * for Microsoft Internet Explorer 3, which needs this as well. - */ -static int use_range_x(request_rec *r) -{ - const char *ua; - return (ap_table_get(r->headers_in, "Request-Range") || - ((ua = ap_table_get(r->headers_in, "User-Agent")) - && strstr(ua, "MSIE 3"))); -} - -/* This routine is called by ap_table_do and merges all instances of - * the passed field values into a single array that will be further - * processed by some later routine. Originally intended to help split - * and recombine multiple Vary fields, though it is generic to any field - * consisting of comma/space-separated tokens. - */ -static int uniq_field_values(void *d, const char *key, const char *val) -{ - array_header *values; - char *start; - char *e; - char **strpp; - int i; - - values = (array_header *)d; - - e = ap_pstrdup(values->pool, val); - - do { - /* Find a non-empty fieldname */ - - while (*e == ',' || ap_isspace(*e)) { - ++e; - } - if (*e == '\0') { - break; - } - start = e; - while (*e != '\0' && *e != ',' && !ap_isspace(*e)) { - ++e; - } - if (*e != '\0') { - *e++ = '\0'; - } - - /* Now add it to values if it isn't already represented. - * Could be replaced by a ap_array_strcasecmp() if we had one. - */ - for (i = 0, strpp = (char **) values->elts; i < values->nelts; - ++i, ++strpp) { - if (*strpp && strcasecmp(*strpp, start) == 0) { - break; - } - } - if (i == values->nelts) { /* if not found */ - *(char **)ap_push_array(values) = start; - } - } while (*e != '\0'); - - return 1; -} - -/* - * Since some clients choke violently on multiple Vary fields, or - * Vary fields with duplicate tokens, combine any multiples and remove - * any duplicates. - */ -static void fixup_vary(request_rec *r) -{ - array_header *varies; - - varies = ap_make_array(r->pool, 5, sizeof(char *)); - - /* Extract all Vary fields from the headers_out, separate each into - * its comma-separated fieldname values, and then add them to varies - * if not already present in the array. - */ - ap_table_do((int (*)(void *, const char *, const char *))uniq_field_values, - (void *) varies, r->headers_out, "Vary", NULL); - - /* If we found any, replace old Vary fields with unique-ified value */ - - if (varies->nelts > 0) { - ap_table_setn(r->headers_out, "Vary", - ap_array_pstrcat(r->pool, varies, ',')); - } -} - -API_EXPORT(void) ap_send_http_header(request_rec *r) -{ - int i; - const long int zero = 0L; -#ifdef CHARSET_EBCDIC - int convert = ap_bgetflag(r->connection->client, B_EBCDIC2ASCII); -#endif /*CHARSET_EBCDIC*/ - - if (r->assbackwards) { - if (!r->main) - ap_bsetopt(r->connection->client, BO_BYTECT, &zero); - r->sent_bodyct = 1; - return; - } - - /* - * Now that we are ready to send a response, we need to combine the two - * header field tables into a single table. If we don't do this, our - * later attempts to set or unset a given fieldname might be bypassed. - */ - if (!ap_is_empty_table(r->err_headers_out)) - r->headers_out = ap_overlay_tables(r->pool, r->err_headers_out, - r->headers_out); - - /* - * Remove the 'Vary' header field if the client can't handle it. - * Since this will have nasty effects on HTTP/1.1 caches, force - * the response into HTTP/1.0 mode. - */ - if (ap_table_get(r->subprocess_env, "force-no-vary") != NULL) { - ap_table_unset(r->headers_out, "Vary"); - r->proto_num = HTTP_VERSION(1,0); - ap_table_set(r->subprocess_env, "force-response-1.0", "1"); - } - else { - fixup_vary(r); - } - - ap_hard_timeout("send headers", r); - - ap_basic_http_header(r); - -#ifdef CHARSET_EBCDIC - ap_bsetflag(r->connection->client, B_EBCDIC2ASCII, 1); -#endif /*CHARSET_EBCDIC*/ - - ap_set_keepalive(r); - - if (r->chunked) { - ap_table_mergen(r->headers_out, "Transfer-Encoding", "chunked"); - ap_table_unset(r->headers_out, "Content-Length"); - } - - if (r->byterange > 1) - ap_table_setn(r->headers_out, "Content-Type", - ap_pstrcat(r->pool, "multipart", use_range_x(r) ? "/x-" : "/", - "byteranges; boundary=", r->boundary, NULL)); - else if (r->content_type) - ap_table_setn(r->headers_out, "Content-Type", r->content_type); - else - ap_table_setn(r->headers_out, "Content-Type", ap_default_type(r)); - - if (r->content_encoding) - ap_table_setn(r->headers_out, "Content-Encoding", r->content_encoding); - - if (r->content_languages && r->content_languages->nelts) { - for (i = 0; i < r->content_languages->nelts; ++i) { - ap_table_mergen(r->headers_out, "Content-Language", - ((char **) (r->content_languages->elts))[i]); - } - } - else if (r->content_language) - ap_table_setn(r->headers_out, "Content-Language", r->content_language); - - /* - * Control cachability for non-cachable responses if not already set by - * some other part of the server configuration. - */ - if (r->no_cache && !ap_table_get(r->headers_out, "Expires")) - ap_table_addn(r->headers_out, "Expires", - ap_gm_timestr_822(r->pool, r->request_time)); - - /* Send the entire table of header fields, terminated by an empty line. */ - - ap_table_do((int (*) (void *, const char *, const char *)) ap_send_header_field, - (void *) r, r->headers_out, NULL); - - terminate_header(r->connection->client); - - ap_kill_timeout(r); - - ap_bsetopt(r->connection->client, BO_BYTECT, &zero); - r->sent_bodyct = 1; /* Whatever follows is real body stuff... */ - - /* Set buffer flags for the body */ - if (r->chunked) - ap_bsetflag(r->connection->client, B_CHUNK, 1); -#ifdef CHARSET_EBCDIC - if (!convert) - ap_bsetflag(r->connection->client, B_EBCDIC2ASCII, convert); -#endif /*CHARSET_EBCDIC*/ -} - -/* finalize_request_protocol is called at completion of sending the - * response. It's sole purpose is to send the terminating protocol - * information for any wrappers around the response message body - * (i.e., transfer encodings). It should have been named finalize_response. - */ -API_EXPORT(void) ap_finalize_request_protocol(request_rec *r) -{ - if (r->chunked && !r->connection->aborted) { - /* - * Turn off chunked encoding --- we can only do this once. - */ - r->chunked = 0; - ap_bsetflag(r->connection->client, B_CHUNK, 0); - - ap_soft_timeout("send ending chunk", r); - ap_rputs("0\015\012", r); - /* If we had footer "headers", we'd send them now */ - ap_rputs("\015\012", r); - ap_kill_timeout(r); - } -} - -/* Here we deal with getting the request message body from the client. - * Whether or not the request contains a body is signaled by the presence - * of a non-zero Content-Length or by a Transfer-Encoding: chunked. - * - * Note that this is more complicated than it was in Apache 1.1 and prior - * versions, because chunked support means that the module does less. - * - * The proper procedure is this: - * - * 1. Call setup_client_block() near the beginning of the request - * handler. This will set up all the necessary properties, and will - * return either OK, or an error code. If the latter, the module should - * return that error code. The second parameter selects the policy to - * apply if the request message indicates a body, and how a chunked - * transfer-coding should be interpreted. Choose one of - * - * REQUEST_NO_BODY Send 413 error if message has any body - * REQUEST_CHUNKED_ERROR Send 411 error if body without Content-Length - * REQUEST_CHUNKED_DECHUNK If chunked, remove the chunks for me. - * REQUEST_CHUNKED_PASS Pass the chunks to me without removal. - * - * In order to use the last two options, the caller MUST provide a buffer - * large enough to hold a chunk-size line, including any extensions. - * - * 2. When you are ready to read a body (if any), call should_client_block(). - * This will tell the module whether or not to read input. If it is 0, - * the module should assume that there is no message body to read. - * This step also sends a 100 Continue response to HTTP/1.1 clients, - * so should not be called until the module is *definitely* ready to - * read content. (otherwise, the point of the 100 response is defeated). - * Never call this function more than once. - * - * 3. Finally, call get_client_block in a loop. Pass it a buffer and its size. - * It will put data into the buffer (not necessarily a full buffer), and - * return the length of the input block. When it is done reading, it will - * return 0 if EOF, or -1 if there was an error. - * If an error occurs on input, we force an end to keepalive. - */ - -API_EXPORT(int) ap_setup_client_block(request_rec *r, int read_policy) -{ - const char *tenc = ap_table_get(r->headers_in, "Transfer-Encoding"); - const char *lenp = ap_table_get(r->headers_in, "Content-Length"); - unsigned long max_body; - - r->read_body = read_policy; - r->read_chunked = 0; - r->remaining = 0; - - if (tenc) { - if (strcasecmp(tenc, "chunked")) { - ap_log_rerror(APLOG_MARK, APLOG_NOERRNO|APLOG_ERR, r, - "Unknown Transfer-Encoding %s", tenc); - return HTTP_NOT_IMPLEMENTED; - } - if (r->read_body == REQUEST_CHUNKED_ERROR) { - ap_log_rerror(APLOG_MARK, APLOG_NOERRNO|APLOG_ERR, r, - "chunked Transfer-Encoding forbidden: %s", r->uri); - return (lenp) ? HTTP_BAD_REQUEST : HTTP_LENGTH_REQUIRED; - } - - r->read_chunked = 1; - } - else if (lenp) { - const char *pos = lenp; - - while (ap_isdigit(*pos) || ap_isspace(*pos)) - ++pos; - if (*pos != '\0') { - ap_log_rerror(APLOG_MARK, APLOG_NOERRNO|APLOG_ERR, r, - "Invalid Content-Length %s", lenp); - return HTTP_BAD_REQUEST; - } - - r->remaining = atol(lenp); - } - - if ((r->read_body == REQUEST_NO_BODY) && - (r->read_chunked || (r->remaining > 0))) { - ap_log_rerror(APLOG_MARK, APLOG_NOERRNO|APLOG_ERR, r, - "%s with body is not allowed for %s", r->method, r->uri); - return HTTP_REQUEST_ENTITY_TOO_LARGE; - } - - max_body = ap_get_limit_req_body(r); - if (max_body && (r->remaining > max_body)) { - ap_log_rerror(APLOG_MARK, APLOG_NOERRNO|APLOG_ERR, r, - "Request content-length of %s is larger than the configured " - "limit of %lu", lenp, max_body); - return HTTP_REQUEST_ENTITY_TOO_LARGE; - } - - return OK; -} - -API_EXPORT(int) ap_should_client_block(request_rec *r) -{ - /* First check if we have already read the request body */ - - if (r->read_length || (!r->read_chunked && (r->remaining <= 0))) - return 0; - - if (r->expecting_100 && r->proto_num >= HTTP_VERSION(1,1)) { - /* sending 100 Continue interim response */ - ap_rvputs(r, SERVER_PROTOCOL, " ", status_lines[0], "\015\012\015\012", - NULL); - ap_rflush(r); - } - - return 1; -} - -static long get_chunk_size(char *b) -{ - long chunksize = 0; - - while (ap_isxdigit(*b)) { - int xvalue = 0; - - if (*b >= '0' && *b <= '9') - xvalue = *b - '0'; - else if (*b >= 'A' && *b <= 'F') - xvalue = *b - 'A' + 0xa; - else if (*b >= 'a' && *b <= 'f') - xvalue = *b - 'a' + 0xa; - - chunksize = (chunksize << 4) | xvalue; - ++b; - } - - return chunksize; -} - -/* get_client_block is called in a loop to get the request message body. - * This is quite simple if the client includes a content-length - * (the normal case), but gets messy if the body is chunked. Note that - * r->remaining is used to maintain state across calls and that - * r->read_length is the total number of bytes given to the caller - * across all invocations. It is messy because we have to be careful not - * to read past the data provided by the client, since these reads block. - * Returns 0 on End-of-body, -1 on error or premature chunk end. - * - * Reading the chunked encoding requires a buffer size large enough to - * hold a chunk-size line, including any extensions. For now, we'll leave - * that to the caller, at least until we can come up with a better solution. - */ -API_EXPORT(long) ap_get_client_block(request_rec *r, char *buffer, int bufsiz) -{ - int c; - long len_read, len_to_read; - long chunk_start = 0; - unsigned long max_body; - - if (!r->read_chunked) { /* Content-length read */ - len_to_read = (r->remaining > bufsiz) ? bufsiz : r->remaining; - len_read = ap_bread(r->connection->client, buffer, len_to_read); - if (len_read <= 0) { - if (len_read < 0) - r->connection->keepalive = -1; - return len_read; - } - r->read_length += len_read; - r->remaining -= len_read; - return len_read; - } - - /* - * Handle chunked reading Note: we are careful to shorten the input - * bufsiz so that there will always be enough space for us to add a CRLF - * (if necessary). - */ - if (r->read_body == REQUEST_CHUNKED_PASS) - bufsiz -= 2; - if (bufsiz <= 0) - return -1; /* Cannot read chunked with a small buffer */ - - /* Check to see if we have already read too much request data. - * For efficiency reasons, we only check this at the top of each - * caller read pass, since the limit exists just to stop infinite - * length requests and nobody cares if it goes over by one buffer. - */ - max_body = ap_get_limit_req_body(r); - if (max_body && (r->read_length > max_body)) { - ap_log_rerror(APLOG_MARK, APLOG_NOERRNO|APLOG_ERR, r, - "Chunked request body is larger than the configured limit of %lu", - max_body); - r->connection->keepalive = -1; - return -1; - } - - if (r->remaining == 0) { /* Start of new chunk */ - - chunk_start = getline(buffer, bufsiz, r->connection->client, 0); - if ((chunk_start <= 0) || (chunk_start >= (bufsiz - 1)) - || !ap_isxdigit(*buffer)) { - r->connection->keepalive = -1; - return -1; - } - - len_to_read = get_chunk_size(buffer); - - if (len_to_read == 0) { /* Last chunk indicated, get footers */ - if (r->read_body == REQUEST_CHUNKED_DECHUNK) { - get_mime_headers(r); - ap_snprintf(buffer, bufsiz, "%ld", r->read_length); - ap_table_unset(r->headers_in, "Transfer-Encoding"); - ap_table_setn(r->headers_in, "Content-Length", - ap_pstrdup(r->pool, buffer)); - return 0; - } - r->remaining = -1; /* Indicate footers in-progress */ - } - else { - r->remaining = len_to_read; - } - if (r->read_body == REQUEST_CHUNKED_PASS) { - buffer[chunk_start++] = CR; /* Restore chunk-size line end */ - buffer[chunk_start++] = LF; - buffer += chunk_start; /* and pass line on to caller */ - bufsiz -= chunk_start; - } - else { - /* REQUEST_CHUNKED_DECHUNK -- do not include the length of the - * header in the return value - */ - chunk_start = 0; - } - } - /* When REQUEST_CHUNKED_PASS, we are */ - if (r->remaining == -1) { /* reading footers until empty line */ - len_read = chunk_start; - - while ((bufsiz > 1) && ((len_read = - getline(buffer, bufsiz, r->connection->client, 1)) > 0)) { - - if (len_read != (bufsiz - 1)) { - buffer[len_read++] = CR; /* Restore footer line end */ - buffer[len_read++] = LF; - } - chunk_start += len_read; - buffer += len_read; - bufsiz -= len_read; - } - if (len_read < 0) { - r->connection->keepalive = -1; - return -1; - } - - if (len_read == 0) { /* Indicates an empty line */ - buffer[0] = CR; - buffer[1] = LF; - chunk_start += 2; - r->remaining = -2; - } - r->read_length += chunk_start; - return chunk_start; - } - /* When REQUEST_CHUNKED_PASS, we */ - if (r->remaining == -2) { /* finished footers when last called */ - r->remaining = 0; /* so now we must signal EOF */ - return 0; - } - - /* Otherwise, we are in the midst of reading a chunk of data */ - - len_to_read = (r->remaining > bufsiz) ? bufsiz : r->remaining; - - len_read = ap_bread(r->connection->client, buffer, len_to_read); - if (len_read <= 0) { - r->connection->keepalive = -1; - return -1; - } - - r->remaining -= len_read; - - if (r->remaining == 0) { /* End of chunk, get trailing CRLF */ - if ((c = ap_bgetc(r->connection->client)) == CR) { - c = ap_bgetc(r->connection->client); - } - if (c != LF) { - r->connection->keepalive = -1; - return -1; - } - if (r->read_body == REQUEST_CHUNKED_PASS) { - buffer[len_read++] = CR; - buffer[len_read++] = LF; - } - } - r->read_length += (chunk_start + len_read); - - return (chunk_start + len_read); -} - -/* In HTTP/1.1, any method can have a body. However, most GET handlers - * wouldn't know what to do with a request body if they received one. - * This helper routine tests for and reads any message body in the request, - * simply discarding whatever it receives. We need to do this because - * failing to read the request body would cause it to be interpreted - * as the next request on a persistent connection. - * - * Since we return an error status if the request is malformed, this - * routine should be called at the beginning of a no-body handler, e.g., - * - * if ((retval = ap_discard_request_body(r)) != OK) - * return retval; - */ -API_EXPORT(int) ap_discard_request_body(request_rec *r) -{ - int rv; - - if ((rv = ap_setup_client_block(r, REQUEST_CHUNKED_PASS))) - return rv; - - /* In order to avoid sending 100 Continue when we already know the - * final response status, and yet not kill the connection if there is - * no request body to be read, we need to duplicate the test from - * ap_should_client_block() here negated rather than call it directly. - */ - if ((r->read_length == 0) && (r->read_chunked || (r->remaining > 0))) { - char dumpbuf[HUGE_STRING_LEN]; - - if (r->expecting_100) { - r->connection->keepalive = -1; - return OK; - } - ap_hard_timeout("reading request body", r); - while ((rv = ap_get_client_block(r, dumpbuf, HUGE_STRING_LEN)) > 0) - continue; - ap_kill_timeout(r); - - if (rv < 0) - return HTTP_BAD_REQUEST; - } - return OK; -} - -/* - * Send the body of a response to the client. - */ -API_EXPORT(long) ap_send_fd(FILE *f, request_rec *r) -{ - return ap_send_fd_length(f, r, -1); -} - -API_EXPORT(long) ap_send_fd_length(FILE *f, request_rec *r, long length) -{ - char buf[IOBUFSIZE]; - long total_bytes_sent = 0; - register int n, w, o, len; - - if (length == 0) - return 0; - - ap_soft_timeout("send body", r); - - while (!r->connection->aborted) { - if ((length > 0) && (total_bytes_sent + IOBUFSIZE) > length) - len = length - total_bytes_sent; - else - len = IOBUFSIZE; - - while ((n = fread(buf, sizeof(char), len, f)) < 1 - && ferror(f) && errno == EINTR && !r->connection->aborted) - continue; - - if (n < 1) { - break; - } - o = 0; - - while (n && !r->connection->aborted) { - w = ap_bwrite(r->connection->client, &buf[o], n); - if (w > 0) { - ap_reset_timeout(r); /* reset timeout after successful write */ - total_bytes_sent += w; - n -= w; - o += w; - } - else if (w < 0) { - if (!r->connection->aborted) { - ap_log_rerror(APLOG_MARK, APLOG_INFO, r, - "client stopped connection before send body completed"); - ap_bsetflag(r->connection->client, B_EOUT, 1); - r->connection->aborted = 1; - } - break; - } - } - } - - ap_kill_timeout(r); - SET_BYTES_SENT(r); - return total_bytes_sent; -} - -/* - * Send the body of a response to the client. - */ -API_EXPORT(long) ap_send_fb(BUFF *fb, request_rec *r) -{ - return ap_send_fb_length(fb, r, -1); -} - -API_EXPORT(long) ap_send_fb_length(BUFF *fb, request_rec *r, long length) -{ - char buf[IOBUFSIZE]; - long total_bytes_sent = 0; - register int n, w, o, len, fd; - fd_set fds; - - if (length == 0) - return 0; - - /* Make fb unbuffered and non-blocking */ - ap_bsetflag(fb, B_RD, 0); -#ifndef TPF - ap_bnonblock(fb, B_RD); -#endif - fd = ap_bfileno(fb, B_RD); -#ifdef CHECK_FD_SETSIZE - if (fd >= FD_SETSIZE) { - ap_log_error(APLOG_MARK, APLOG_NOERRNO|APLOG_WARNING, NULL, - "send body: filedescriptor (%u) larger than FD_SETSIZE (%u) " - "found, you probably need to rebuild Apache with a " - "larger FD_SETSIZE", fd, FD_SETSIZE); - return 0; - } -#endif - - ap_soft_timeout("send body", r); - - FD_ZERO(&fds); - while (!r->connection->aborted) { -#ifdef NDELAY_PIPE_RETURNS_ZERO - /* Contributed by dwd@bell-labs.com for UTS 2.1.2, where the fcntl */ - /* O_NDELAY flag causes read to return 0 when there's nothing */ - /* available when reading from a pipe. That makes it tricky */ - /* to detect end-of-file :-(. This stupid bug is even documented */ - /* in the read(2) man page where it says that everything but */ - /* pipes return -1 and EAGAIN. That makes it a feature, right? */ - int afterselect = 0; -#endif - if ((length > 0) && (total_bytes_sent + IOBUFSIZE) > length) - len = length - total_bytes_sent; - else - len = IOBUFSIZE; - - do { - n = ap_bread(fb, buf, len); -#ifdef NDELAY_PIPE_RETURNS_ZERO - if ((n > 0) || (n == 0 && afterselect)) - break; -#else - if (n >= 0) - break; -#endif - if (r->connection->aborted) - break; - if (n < 0 && errno != EAGAIN) - break; - - /* we need to block, so flush the output first */ - if (ap_bflush(r->connection->client) < 0) { - ap_log_rerror(APLOG_MARK, APLOG_INFO, r, - "client stopped connection before send body completed"); - ap_bsetflag(r->connection->client, B_EOUT, 1); - r->connection->aborted = 1; - break; - } - FD_SET(fd, &fds); - /* - * we don't care what select says, we might as well loop back - * around and try another read - */ - ap_select(fd + 1, &fds, NULL, NULL, NULL); -#ifdef NDELAY_PIPE_RETURNS_ZERO - afterselect = 1; -#endif - } while (!r->connection->aborted); - - if (n < 1 || r->connection->aborted) { - break; - } - o = 0; - - while (n && !r->connection->aborted) { - w = ap_bwrite(r->connection->client, &buf[o], n); - if (w > 0) { - ap_reset_timeout(r); /* reset timeout after successful write */ - total_bytes_sent += w; - n -= w; - o += w; - } - else if (w < 0) { - if (!r->connection->aborted) { - ap_log_rerror(APLOG_MARK, APLOG_INFO, r, - "client stopped connection before send body completed"); - ap_bsetflag(r->connection->client, B_EOUT, 1); - r->connection->aborted = 1; - } - break; - } - } - } - - ap_kill_timeout(r); - SET_BYTES_SENT(r); - return total_bytes_sent; -} - - - -/* The code writes MMAP_SEGMENT_SIZE bytes at a time. This is due to Apache's - * timeout model, which is a timeout per-write rather than a time for the - * entire transaction to complete. Essentially this should be small enough - * so that in one Timeout period, your slowest clients should be reasonably - * able to receive this many bytes. - * - * To take advantage of zero-copy TCP under Solaris 2.6 this should be a - * multiple of 16k. (And you need a SunATM2.0 network card.) - */ -#ifndef MMAP_SEGMENT_SIZE -#define MMAP_SEGMENT_SIZE 32768 -#endif - -/* send data from an in-memory buffer */ -API_EXPORT(size_t) ap_send_mmap(void *mm, request_rec *r, size_t offset, - size_t length) -{ - size_t total_bytes_sent = 0; - int n, w; - - if (length == 0) - return 0; - - ap_soft_timeout("send mmap", r); - - length += offset; - while (!r->connection->aborted && offset < length) { - if (length - offset > MMAP_SEGMENT_SIZE) { - n = MMAP_SEGMENT_SIZE; - } - else { - n = length - offset; - } - - while (n && !r->connection->aborted) { - w = ap_bwrite(r->connection->client, (char *) mm + offset, n); - if (w > 0) { - ap_reset_timeout(r); /* reset timeout after successful write */ - total_bytes_sent += w; - n -= w; - offset += w; - } - else if (w < 0) { - if (!r->connection->aborted) { - ap_log_rerror(APLOG_MARK, APLOG_INFO, r, - "client stopped connection before send mmap completed"); - ap_bsetflag(r->connection->client, B_EOUT, 1); - r->connection->aborted = 1; - } - break; - } - } - } - - ap_kill_timeout(r); - SET_BYTES_SENT(r); - return total_bytes_sent; -} - -API_EXPORT(int) ap_rputc(int c, request_rec *r) -{ - if (r->connection->aborted) - return EOF; - - if (ap_bputc(c, r->connection->client) < 0) { - if (!r->connection->aborted) { - ap_log_rerror(APLOG_MARK, APLOG_INFO, r, - "client stopped connection before rputc completed"); - ap_bsetflag(r->connection->client, B_EOUT, 1); - r->connection->aborted = 1; - } - return EOF; - } - SET_BYTES_SENT(r); - return c; -} - -API_EXPORT(int) ap_rputs(const char *str, request_rec *r) -{ - int rcode; - - if (r->connection->aborted) - return EOF; - - rcode = ap_bputs(str, r->connection->client); - if (rcode < 0) { - if (!r->connection->aborted) { - ap_log_rerror(APLOG_MARK, APLOG_INFO, r, - "client stopped connection before rputs completed"); - ap_bsetflag(r->connection->client, B_EOUT, 1); - r->connection->aborted = 1; - } - return EOF; - } - SET_BYTES_SENT(r); - return rcode; -} - -API_EXPORT(int) ap_rwrite(const void *buf, int nbyte, request_rec *r) -{ - int n; - - if (r->connection->aborted) - return -1; - - n = ap_bwrite(r->connection->client, buf, nbyte); - if (n < 0) { - if (!r->connection->aborted) { - ap_log_rerror(APLOG_MARK, APLOG_INFO, r, - "client stopped connection before rwrite completed"); - ap_bsetflag(r->connection->client, B_EOUT, 1); - r->connection->aborted = 1; - } - return -1; - } - SET_BYTES_SENT(r); - return n; -} - -API_EXPORT(int) ap_vrprintf(request_rec *r, const char *fmt, va_list ap) -{ - int n; - - if (r->connection->aborted) - return -1; - - n = ap_vbprintf(r->connection->client, fmt, ap); - - if (n < 0) { - if (!r->connection->aborted) { - ap_log_rerror(APLOG_MARK, APLOG_INFO, r, - "client stopped connection before vrprintf completed"); - ap_bsetflag(r->connection->client, B_EOUT, 1); - r->connection->aborted = 1; - } - return -1; - } - SET_BYTES_SENT(r); - return n; -} - -API_EXPORT(int) ap_rprintf(request_rec *r, const char *fmt,...) -{ - va_list vlist; - int n; - - if (r->connection->aborted) - return -1; - - va_start(vlist, fmt); - n = ap_vbprintf(r->connection->client, fmt, vlist); - va_end(vlist); - - if (n < 0) { - if (!r->connection->aborted) { - ap_log_rerror(APLOG_MARK, APLOG_INFO, r, - "client stopped connection before rprintf completed"); - ap_bsetflag(r->connection->client, B_EOUT, 1); - r->connection->aborted = 1; - } - return -1; - } - SET_BYTES_SENT(r); - return n; -} - -API_EXPORT_NONSTD(int) ap_rvputs(request_rec *r,...) -{ - va_list args; - int i, j, k; - const char *x; - BUFF *fb = r->connection->client; - - if (r->connection->aborted) - return EOF; - - va_start(args, r); - for (k = 0;;) { - x = va_arg(args, const char *); - if (x == NULL) - break; - j = strlen(x); - i = ap_bwrite(fb, x, j); - if (i != j) { - va_end(args); - if (!r->connection->aborted) { - ap_log_rerror(APLOG_MARK, APLOG_INFO, r, - "client stopped connection before rvputs completed"); - ap_bsetflag(r->connection->client, B_EOUT, 1); - r->connection->aborted = 1; - } - return EOF; - } - k += i; - } - va_end(args); - - SET_BYTES_SENT(r); - return k; -} - -API_EXPORT(int) ap_rflush(request_rec *r) -{ - if (ap_bflush(r->connection->client) < 0) { - if (!r->connection->aborted) { - ap_log_rerror(APLOG_MARK, APLOG_INFO, r, - "client stopped connection before rflush completed"); - ap_bsetflag(r->connection->client, B_EOUT, 1); - r->connection->aborted = 1; - } - return EOF; - } - return 0; -} - -/* We should have named this send_canned_response, since it is used for any - * response that can be generated by the server from the request record. - * This includes all 204 (no content), 3xx (redirect), 4xx (client error), - * and 5xx (server error) messages that have not been redirected to another - * handler via the ErrorDocument feature. - */ -void ap_send_error_response(request_rec *r, int recursive_error) -{ - int status = r->status; - int idx = ap_index_of_response(status); - char *custom_response; - const char *location = ap_table_get(r->headers_out, "Location"); - - /* - * It's possible that the Location field might be in r->err_headers_out - * instead of r->headers_out; use the latter if possible, else the - * former. - */ - if (location == NULL) { - location = ap_table_get(r->err_headers_out, "Location"); - } - /* We need to special-case the handling of 204 and 304 responses, - * since they have specific HTTP requirements and do not include a - * message body. Note that being assbackwards here is not an option. - */ - if (status == HTTP_NOT_MODIFIED) { - if (!ap_is_empty_table(r->err_headers_out)) - r->headers_out = ap_overlay_tables(r->pool, r->err_headers_out, - r->headers_out); - ap_hard_timeout("send 304", r); - - ap_basic_http_header(r); - ap_set_keepalive(r); - - ap_table_do((int (*)(void *, const char *, const char *)) ap_send_header_field, - (void *) r, r->headers_out, - "Connection", - "Keep-Alive", - "ETag", - "Content-Location", - "Expires", - "Cache-Control", - "Vary", - "Warning", - "WWW-Authenticate", - "Proxy-Authenticate", - NULL); - - terminate_header(r->connection->client); - - ap_kill_timeout(r); - return; - } - - if (status == HTTP_NO_CONTENT) { - ap_send_http_header(r); - ap_finalize_request_protocol(r); - return; - } - - if (!r->assbackwards) { - table *tmp = r->headers_out; - - /* For all HTTP/1.x responses for which we generate the message, - * we need to avoid inheriting the "normal status" header fields - * that may have been set by the request handler before the - * error or redirect, except for Location on external redirects. - */ - r->headers_out = r->err_headers_out; - r->err_headers_out = tmp; - ap_clear_table(r->err_headers_out); - - if (ap_is_HTTP_REDIRECT(status) || (status == HTTP_CREATED)) { - if ((location != NULL) && *location) { - ap_table_setn(r->headers_out, "Location", location); - } - else { - location = ""; /* avoids coredump when printing, below */ - } - } - - r->content_language = NULL; - r->content_languages = NULL; - r->content_encoding = NULL; - r->clength = 0; - r->content_type = "text/html"; - - if ((status == METHOD_NOT_ALLOWED) || (status == NOT_IMPLEMENTED)) - ap_table_setn(r->headers_out, "Allow", make_allow(r)); - - ap_send_http_header(r); - - if (r->header_only) { - ap_finalize_request_protocol(r); - ap_rflush(r); - return; - } - } - - ap_hard_timeout("send error body", r); - - if ((custom_response = ap_response_code_string(r, idx))) { - /* - * We have a custom response output. This should only be - * a text-string to write back. But if the ErrorDocument - * was a local redirect and the requested resource failed - * for any reason, the custom_response will still hold the - * redirect URL. We don't really want to output this URL - * as a text message, so first check the custom response - * string to ensure that it is a text-string (using the - * same test used in ap_die(), i.e. does it start with a "). - * If it doesn't, we've got a recursive error, so find - * the original error and output that as well. - */ - if (custom_response[0] == '\"') { - ap_rputs(custom_response + 1, r); - ap_kill_timeout(r); - ap_finalize_request_protocol(r); - ap_rflush(r); - return; - } - /* - * Redirect failed, so get back the original error - */ - while (r->prev && (r->prev->status != HTTP_OK)) - r = r->prev; - } - { - const char *title = status_lines[idx]; - const char *h1; - const char *error_notes; - - /* Accept a status_line set by a module, but only if it begins - * with the 3 digit status code - */ - if (r->status_line != NULL - && strlen(r->status_line) > 4 /* long enough */ - && ap_isdigit(r->status_line[0]) - && ap_isdigit(r->status_line[1]) - && ap_isdigit(r->status_line[2]) - && ap_isspace(r->status_line[3]) - && ap_isalnum(r->status_line[4])) { - title = r->status_line; - } - - /* folks decided they didn't want the error code in the H1 text */ - h1 = &title[4]; - - ap_rvputs(r, - DOCTYPE_HTML_2_0 - "\n", title, - "\n\n

    ", h1, "

    \n", - NULL); - - switch (status) { - case HTTP_MOVED_PERMANENTLY: - case HTTP_MOVED_TEMPORARILY: - case HTTP_TEMPORARY_REDIRECT: - ap_rvputs(r, "The document has moved pool, location), "\">here.

    \n", - NULL); - break; - case HTTP_SEE_OTHER: - ap_rvputs(r, "The answer to your request is located pool, location), "\">here.

    \n", - NULL); - break; - case HTTP_USE_PROXY: - ap_rvputs(r, "This resource is only accessible " - "through the proxy\n", - ap_escape_html(r->pool, location), - "
    \nYou will need to ", - "configure your client to use that proxy.

    \n", NULL); - break; - case HTTP_PROXY_AUTHENTICATION_REQUIRED: - case AUTH_REQUIRED: - ap_rputs("This server could not verify that you\n" - "are authorized to access the document\n" - "requested. Either you supplied the wrong\n" - "credentials (e.g., bad password), or your\n" - "browser doesn't understand how to supply\n" - "the credentials required.

    \n", r); - break; - case BAD_REQUEST: - ap_rputs("Your browser sent a request that " - "this server could not understand.

    \n", r); - if ((error_notes = ap_table_get(r->notes, "error-notes")) != NULL) { - ap_rvputs(r, error_notes, "

    \n", NULL); - } - break; - case HTTP_FORBIDDEN: - ap_rvputs(r, "You don't have permission to access ", - ap_escape_html(r->pool, r->uri), - "\non this server.

    \n", NULL); - break; - case NOT_FOUND: - ap_rvputs(r, "The requested URL ", - ap_escape_html(r->pool, r->uri), - " was not found on this server.

    \n", NULL); - break; - case METHOD_NOT_ALLOWED: - ap_rvputs(r, "The requested method ", r->method, - " is not allowed " - "for the URL ", ap_escape_html(r->pool, r->uri), - ".

    \n", NULL); - break; - case NOT_ACCEPTABLE: - ap_rvputs(r, - "An appropriate representation of the " - "requested resource ", - ap_escape_html(r->pool, r->uri), - " could not be found on this server.

    \n", NULL); - /* fall through */ - case MULTIPLE_CHOICES: - { - const char *list; - if ((list = ap_table_get(r->notes, "variant-list"))) - ap_rputs(list, r); - } - break; - case LENGTH_REQUIRED: - ap_rvputs(r, "A request of the requested method ", r->method, - " requires a valid Content-length.

    \n", NULL); - if ((error_notes = ap_table_get(r->notes, "error-notes")) != NULL) { - ap_rvputs(r, error_notes, "

    \n", NULL); - } - break; - case PRECONDITION_FAILED: - ap_rvputs(r, "The precondition on the request for the URL ", - ap_escape_html(r->pool, r->uri), - " evaluated to false.

    \n", NULL); - break; - case HTTP_NOT_IMPLEMENTED: - ap_rvputs(r, ap_escape_html(r->pool, r->method), " to ", - ap_escape_html(r->pool, r->uri), - " not supported.

    \n", NULL); - if ((error_notes = ap_table_get(r->notes, "error-notes")) != NULL) { - ap_rvputs(r, error_notes, "

    \n", NULL); - } - break; - case BAD_GATEWAY: - ap_rputs("The proxy server received an invalid\015\012" - "response from an upstream server.

    \015\012", r); - if ((error_notes = ap_table_get(r->notes, "error-notes")) != NULL) { - ap_rvputs(r, error_notes, "

    \n", NULL); - } - break; - case VARIANT_ALSO_VARIES: - ap_rvputs(r, "A variant for the requested resource\n

    \n",
    -		      ap_escape_html(r->pool, r->uri),
    -		      "\n
    \nis itself a negotiable resource. " - "This indicates a configuration error.

    \n", NULL); - break; - case HTTP_REQUEST_TIME_OUT: - ap_rputs("I'm tired of waiting for your request.\n", r); - break; - case HTTP_GONE: - ap_rvputs(r, "The requested resource
    ", - ap_escape_html(r->pool, r->uri), - "
    \nis no longer available on this server ", - "and there is no forwarding address.\n", - "Please remove all references to this resource.\n", - NULL); - break; - case HTTP_REQUEST_ENTITY_TOO_LARGE: - ap_rvputs(r, "The requested resource
    ", - ap_escape_html(r->pool, r->uri), "
    \n", - "does not allow request data with ", r->method, - " requests, or the amount of data provided in\n", - "the request exceeds the capacity limit.\n", NULL); - break; - case HTTP_REQUEST_URI_TOO_LARGE: - ap_rputs("The requested URL's length exceeds the capacity\n" - "limit for this server.

    \n", r); - if ((error_notes = ap_table_get(r->notes, "error-notes")) != NULL) { - ap_rvputs(r, error_notes, "

    \n", NULL); - } - break; - case HTTP_UNSUPPORTED_MEDIA_TYPE: - ap_rputs("The supplied request data is not in a format\n" - "acceptable for processing by this resource.\n", r); - break; - case HTTP_RANGE_NOT_SATISFIABLE: - ap_rputs("None of the range-specifier values in the Range\n" - "request-header field overlap the current extent\n" - "of the selected resource.\n", r); - break; - case HTTP_EXPECTATION_FAILED: - ap_rvputs(r, "The expectation given in the Expect request-header" - "\nfield could not be met by this server.

    \n" - "The client sent

    \n    Expect: ",
    -	              ap_table_get(r->headers_in, "Expect"), "\n
    \n" - "but we only allow the 100-continue expectation.\n", - NULL); - break; - case HTTP_UNPROCESSABLE_ENTITY: - ap_rputs("The server understands the media type of the\n" - "request entity, but was unable to process the\n" - "contained instructions.\n", r); - break; - case HTTP_LOCKED: - ap_rputs("The requested resource is currently locked.\n" - "The lock must be released or proper identification\n" - "given before the method can be applied.\n", r); - break; - case HTTP_FAILED_DEPENDENCY: - ap_rputs("The method could not be performed on the resource\n" - "because the requested action depended on another\n" - "action and that other action failed.\n", r); - break; - case HTTP_INSUFFICIENT_STORAGE: - ap_rputs("The method could not be performed on the resource\n" - "because the server is unable to store the\n" - "representation needed to successfully complete the\n" - "request. There is insufficient free space left in\n" - "your storage allocation.\n", r); - break; - case HTTP_SERVICE_UNAVAILABLE: - ap_rputs("The server is temporarily unable to service your\n" - "request due to maintenance downtime or capacity\n" - "problems. Please try again later.\n", r); - break; - case HTTP_GATEWAY_TIME_OUT: - ap_rputs("The proxy server did not receive a timely response\n" - "from the upstream server.\n", r); - break; - case HTTP_NOT_EXTENDED: - ap_rputs("A mandatory extension policy in the request is not\n" - "accepted by the server for this resource.\n", r); - break; - default: /* HTTP_INTERNAL_SERVER_ERROR */ - /* - * This comparison to expose error-notes could be modified to - * use a configuration directive and export based on that - * directive. For now "*" is used to designate an error-notes - * that is totally safe for any user to see (ie lacks paths, - * database passwords, etc.) - */ - if (((error_notes = ap_table_get(r->notes, "error-notes")) != NULL) - && (h1 = ap_table_get(r->notes, "verbose-error-to")) != NULL - && (strcmp(h1, "*") == 0)) { - ap_rvputs(r, error_notes, "

    \n", NULL); - } - else { - ap_rvputs(r, "The server encountered an internal error or\n" - "misconfiguration and was unable to complete\n" - "your request.

    \n" - "Please contact the server administrator,\n ", - ap_escape_html(r->pool, r->server->server_admin), - " and inform them of the time the error occurred,\n" - "and anything you might have done that may have\n" - "caused the error.

    \n" - "More information about this error may be available\n" - "in the server error log.

    \n", NULL); - } - /* - * It would be nice to give the user the information they need to - * fix the problem directly since many users don't have access to - * the error_log (think University sites) even though they can easily - * get this error by misconfiguring an htaccess file. However, the - * error notes tend to include the real file pathname in this case, - * which some people consider to be a breach of privacy. Until we - * can figure out a way to remove the pathname, leave this commented. - * - * if ((error_notes = ap_table_get(r->notes, "error-notes")) != NULL) { - * ap_rvputs(r, error_notes, "

    \n", NULL); - * } - */ - break; - } - - if (recursive_error) { - ap_rvputs(r, "

    Additionally, a ", - status_lines[ap_index_of_response(recursive_error)], - "\nerror was encountered while trying to use an " - "ErrorDocument to handle the request.\n", NULL); - } - ap_rputs(ap_psignature("


    \n", r), r); - ap_rputs("\n", r); - } - ap_kill_timeout(r); - ap_finalize_request_protocol(r); - ap_rflush(r); -} diff --git a/modules/http/http_request.c b/modules/http/http_request.c deleted file mode 100644 index bc4d45f60f839e908a9918c9577e7327aee407b1..0000000000000000000000000000000000000000 --- a/modules/http/http_request.c +++ /dev/null @@ -1,1374 +0,0 @@ -/* ==================================================================== - * Copyright (c) 1995-1999 The Apache Group. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in - * the documentation and/or other materials provided with the - * distribution. - * - * 3. All advertising materials mentioning features or use of this - * software must display the following acknowledgment: - * "This product includes software developed by the Apache Group - * for use in the Apache HTTP server project (http://www.apache.org/)." - * - * 4. The names "Apache Server" and "Apache Group" must not be used to - * endorse or promote products derived from this software without - * prior written permission. For written permission, please contact - * apache@apache.org. - * - * 5. Products derived from this software may not be called "Apache" - * nor may "Apache" appear in their names without prior written - * permission of the Apache Group. - * - * 6. Redistributions of any form whatsoever must retain the following - * acknowledgment: - * "This product includes software developed by the Apache Group - * for use in the Apache HTTP server project (http://www.apache.org/)." - * - * THIS SOFTWARE IS PROVIDED BY THE APACHE GROUP ``AS IS'' AND ANY - * EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR - * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE APACHE GROUP OR - * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT - * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, - * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED - * OF THE POSSIBILITY OF SUCH DAMAGE. - * ==================================================================== - * - * This software consists of voluntary contributions made by many - * individuals on behalf of the Apache Group and was originally based - * on public domain software written at the National Center for - * Supercomputing Applications, University of Illinois, Urbana-Champaign. - * For more information on the Apache Group and the Apache HTTP server - * project, please see . - * - */ - -/* - * http_request.c: functions to get and process requests - * - * Rob McCool 3/21/93 - * - * Thoroughly revamped by rst for Apache. NB this file reads - * best from the bottom up. - * - */ - -#define CORE_PRIVATE -#include "httpd.h" -#include "http_config.h" -#include "http_request.h" -#include "http_core.h" -#include "http_protocol.h" -#include "http_conf_globals.h" /* for ap_extended_status */ -#include "http_log.h" -#include "http_main.h" -#include "scoreboard.h" -#include "fnmatch.h" - -/***************************************************************** - * - * Getting and checking directory configuration. Also checks the - * FollowSymlinks and FollowSymOwner stuff, since this is really the - * only place that can happen (barring a new mid_dir_walk callout). - * - * We can't do it as an access_checker module function which gets - * called with the final per_dir_config, since we could have a directory - * with FollowSymLinks disabled, which contains a symlink to another - * with a .htaccess file which turns FollowSymLinks back on --- and - * access in such a case must be denied. So, whatever it is that - * checks FollowSymLinks needs to know the state of the options as - * they change, all the way down. - */ - -/* - * We don't want people able to serve up pipes, or unix sockets, or other - * scary things. Note that symlink tests are performed later. - */ -static int check_safe_file(request_rec *r) -{ - if (r->finfo.st_mode == 0 /* doesn't exist */ - || S_ISDIR(r->finfo.st_mode) - || S_ISREG(r->finfo.st_mode) - || S_ISLNK(r->finfo.st_mode)) { - return OK; - } - ap_log_rerror(APLOG_MARK, APLOG_NOERRNO|APLOG_ERR, r, - "object is not a file, directory or symlink: %s", - r->filename); - return HTTP_FORBIDDEN; -} - - -static int check_symlinks(char *d, int opts) -{ -#if defined(OS2) || defined(WIN32) - /* OS/2 doesn't have symlinks */ - return OK; -#else - struct stat lfi, fi; - char *lastp; - int res; - - if (opts & OPT_SYM_LINKS) - return OK; - - /* - * Strip trailing '/', if any, off what we're checking; trailing slashes - * make some systems follow symlinks to directories even in lstat(). - * After we've done the lstat, put it back. Also, don't bother checking - * '/' at all... - * - * Note that we don't have to worry about multiple slashes here because of - * no2slash() below... - */ - - lastp = d + strlen(d) - 1; - if (lastp == d) - return OK; /* Root directory, '/' */ - - if (*lastp == '/') - *lastp = '\0'; - else - lastp = NULL; - - res = lstat(d, &lfi); - - if (lastp) - *lastp = '/'; - - /* - * Note that we don't reject accesses to nonexistent files (multiviews or - * the like may cons up a way to run the transaction anyway)... - */ - - if (!(res >= 0) || !S_ISLNK(lfi.st_mode)) - return OK; - - /* OK, it's a symlink. May still be OK with OPT_SYM_OWNER */ - - if (!(opts & OPT_SYM_OWNER)) - return HTTP_FORBIDDEN; - - if (stat(d, &fi) < 0) - return HTTP_FORBIDDEN; - - return (fi.st_uid == lfi.st_uid) ? OK : HTTP_FORBIDDEN; - -#endif -} - -/* Dealing with the file system to get PATH_INFO - */ -static int get_path_info(request_rec *r) -{ - char *cp; - char *path = r->filename; - char *end = &path[strlen(path)]; - char *last_cp = NULL; - int rv; -#ifdef HAVE_DRIVE_LETTERS - char bStripSlash=1; -#endif - - if (r->finfo.st_mode) { - /* assume path_info already set */ - return OK; - } - -#ifdef HAVE_DRIVE_LETTERS - /* If the directory is x:\, then we don't want to strip - * the trailing slash since x: is not a valid directory. - */ - if (strlen(path) == 3 && path[1] == ':' && path[2] == '/') - bStripSlash = 0; - - - /* If UNC name == //machine/share/, do not - * advance over the trailing slash. Any other - * UNC name is OK to strip the slash. - */ - cp = end; - if (strlen(path) > 2 && path[0] == '/' && path[1] == '/' && - path[2] != '/' && cp[-1] == '/') { - char *p; - int iCount=0; - p = path; - while (p = strchr(p,'/')) { - p++; - iCount++; - } - - if (iCount == 4) - bStripSlash = 0; - } - - if (bStripSlash) -#endif - /* Advance over trailing slashes ... NOT part of filename - * if file is not a UNC name (Win32 only). - */ - for (cp = end; cp > path && cp[-1] == '/'; --cp) - continue; - - - while (cp > path) { - - /* See if the pathname ending here exists... */ - - *cp = '\0'; - - /* We must not stat() filenames that may cause os-specific system - * problems, such as "/file/aux" on DOS-abused filesystems. - * So pretend that they do not exist by returning an ENOENT error. - * This will force us to drop that part of the path and keep - * looking back for a "real" file that exists, while still allowing - * the "invalid" path parts within the PATH_INFO. - */ - if (!ap_os_is_filename_valid(path)) { - errno = ENOENT; - rv = -1; - } - else { - errno = 0; - rv = stat(path, &r->finfo); - } - - if (cp != end) - *cp = '/'; - - if (!rv) { - - /* - * Aha! Found something. If it was a directory, we will search - * contents of that directory for a multi_match, so the PATH_INFO - * argument starts with the component after that. - */ - - if (S_ISDIR(r->finfo.st_mode) && last_cp) { - r->finfo.st_mode = 0; /* No such file... */ - cp = last_cp; - } - - r->path_info = ap_pstrdup(r->pool, cp); - *cp = '\0'; - return OK; - } - /* must set this to zero, some stat()s may have corrupted it - * even if they returned an error. - */ - r->finfo.st_mode = 0; -#if defined(ENOENT) && defined(ENOTDIR) - if (errno == ENOENT || errno == ENOTDIR) { - last_cp = cp; - - while (--cp > path && *cp != '/') - continue; - - while (cp > path && cp[-1] == '/') - --cp; - } - else { -#if defined(EACCES) - if (errno != EACCES) -#endif - ap_log_rerror(APLOG_MARK, APLOG_ERR, r, - "access to %s failed", r->uri); - return HTTP_FORBIDDEN; - } -#else -#error ENOENT || ENOTDIR not defined; please see the -#error comments at this line in the source for a workaround. - /* - * If ENOENT || ENOTDIR is not defined in one of the your OS's - * include files, Apache does not know how to check to see why the - * stat() of the index file failed; there are cases where it can fail - * even though the file exists. This means that it is possible for - * someone to get a directory listing of a directory even though - * there is an index (eg. index.html) file in it. If you do not have - * a problem with this, delete the above #error lines and start the - * compile again. If you need to do this, please submit a bug report - * from http://www.apache.org/bug_report.html letting us know that - * you needed to do this. Please be sure to include the operating - * system you are using. - */ - last_cp = cp; - - while (--cp > path && *cp != '/') - continue; - - while (cp > path && cp[-1] == '/') - --cp; -#endif /* ENOENT && ENOTDIR */ - } - return OK; -} - -static int directory_walk(request_rec *r) -{ - core_server_config *sconf = ap_get_module_config(r->server->module_config, - &core_module); - void *per_dir_defaults = r->server->lookup_defaults; - void **sec = (void **) sconf->sec->elts; - int num_sec = sconf->sec->nelts; - char *test_filename; - char *test_dirname; - int res; - unsigned i, num_dirs, iStart; - int j, test_filename_len; - - /* - * Are we dealing with a file? If not, we can (hopefuly) safely assume we - * have a handler that doesn't require one, but for safety's sake, and so - * we have something find_types() can get something out of, fake one. But - * don't run through the directory entries. - */ - - if (r->filename == NULL) { - r->filename = ap_pstrdup(r->pool, r->uri); - r->finfo.st_mode = 0; /* Not really a file... */ - r->per_dir_config = per_dir_defaults; - - return OK; - } - - /* - * Go down the directory hierarchy. Where we have to check for symlinks, - * do so. Where a .htaccess file has permission to override anything, - * try to find one. If either of these things fails, we could poke - * around, see why, and adjust the lookup_rec accordingly --- this might - * save us a call to get_path_info (with the attendant stat()s); however, - * for the moment, that's not worth the trouble. - * - * Fake filenames (i.e. proxy:) only match Directory sections. - */ - - if (!ap_os_is_path_absolute(r->filename)) - { - void *this_conf, *entry_config; - core_dir_config *entry_core; - char *entry_dir; - - for (j = 0; j < num_sec; ++j) { - - entry_config = sec[j]; - - entry_core = (core_dir_config *) - ap_get_module_config(entry_config, &core_module); - entry_dir = entry_core->d; - - this_conf = NULL; - if (entry_core->r) { - if (!ap_regexec(entry_core->r, r->filename, 0, NULL, 0)) - this_conf = entry_config; - } - else if (entry_core->d_is_fnmatch) { - if (!ap_fnmatch(entry_dir, r->filename, 0)) - this_conf = entry_config; - } - else if (!strncmp(r->filename, entry_dir, strlen(entry_dir))) - this_conf = entry_config; - - if (this_conf) - per_dir_defaults = ap_merge_per_dir_configs(r->pool, - per_dir_defaults, - this_conf); - } - - r->per_dir_config = per_dir_defaults; - - return OK; - } - - r->filename = ap_os_case_canonical_filename(r->pool, r->filename); - - res = get_path_info(r); - if (res != OK) { - return res; - } - - r->filename = ap_os_canonical_filename(r->pool, r->filename); - - test_filename = ap_pstrdup(r->pool, r->filename); - - ap_no2slash(test_filename); - num_dirs = ap_count_dirs(test_filename); - - if (!ap_os_is_filename_valid(r->filename)) { - ap_log_rerror(APLOG_MARK, APLOG_NOERRNO|APLOG_ERR, r, - "Filename is not valid: %s", r->filename); - return HTTP_FORBIDDEN; - } - - if ((res = check_safe_file(r))) { - return res; - } - - test_filename_len = strlen(test_filename); - if (test_filename[test_filename_len - 1] == '/') - --num_dirs; - - if (S_ISDIR(r->finfo.st_mode)) - ++num_dirs; - - /* - * We will use test_dirname as scratch space while we build directory - * names during the walk. Profiling shows directory_walk to be a busy - * function so we try to avoid allocating lots of extra memory here. - * We need 2 extra bytes, one for trailing \0 and one because - * make_dirstr_prefix will add potentially one extra /. - */ - test_dirname = ap_palloc(r->pool, test_filename_len + 2); - - iStart = 1; -#ifdef WIN32 - /* If the name is a UNC name, then do not walk through the - * machine and share name (e.g. \\machine\share\) - */ - if (num_dirs > 3 && test_filename[0] == '/' && test_filename[1] == '/') - iStart = 4; -#endif - - /* j keeps track of which section we're on, see core_reorder_directories */ - j = 0; - for (i = iStart; i <= num_dirs; ++i) { - int overrides_here; - core_dir_config *core_dir = (core_dir_config *) - ap_get_module_config(per_dir_defaults, &core_module); - - /* - * XXX: this could be made faster by only copying the next component - * rather than copying the entire thing all over. - */ - ap_make_dirstr_prefix(test_dirname, test_filename, i); - - /* - * Do symlink checks first, because they are done with the - * permissions appropriate to the *parent* directory... - */ - - if ((res = check_symlinks(test_dirname, core_dir->opts))) { - ap_log_rerror(APLOG_MARK, APLOG_NOERRNO|APLOG_ERR, r, - "Symbolic link not allowed: %s", test_dirname); - return res; - } - - /* - * Begin *this* level by looking for matching sections - * from access.conf. - */ - - for (; j < num_sec; ++j) { - void *entry_config = sec[j]; - core_dir_config *entry_core; - char *entry_dir; - void *this_conf; - - entry_core = (core_dir_config *) - ap_get_module_config(entry_config, &core_module); - entry_dir = entry_core->d; - - if (entry_core->r - || !ap_os_is_path_absolute(entry_dir) - || entry_core->d_components > i) - break; - - this_conf = NULL; - if (entry_core->d_is_fnmatch) { - if (!ap_fnmatch(entry_dir, test_dirname, FNM_PATHNAME)) { - this_conf = entry_config; - } - } - else if (!strcmp(test_dirname, entry_dir)) - this_conf = entry_config; - - if (this_conf) { - per_dir_defaults = ap_merge_per_dir_configs(r->pool, - per_dir_defaults, - this_conf); - core_dir = (core_dir_config *) - ap_get_module_config(per_dir_defaults, &core_module); - } - } - overrides_here = core_dir->override; - - /* If .htaccess files are enabled, check for one. */ - - if (overrides_here) { - void *htaccess_conf = NULL; - - res = ap_parse_htaccess(&htaccess_conf, r, overrides_here, - ap_pstrdup(r->pool, test_dirname), - sconf->access_name); - if (res) - return res; - - if (htaccess_conf) { - per_dir_defaults = ap_merge_per_dir_configs(r->pool, - per_dir_defaults, - htaccess_conf); - r->per_dir_config = per_dir_defaults; - } - } - } - - /* - * There's two types of IS_SPECIAL sections (see http_core.c), and we've - * already handled the proxy:-style stuff. Now we'll deal with the - * regexes. - */ - for (; j < num_sec; ++j) { - void *entry_config = sec[j]; - core_dir_config *entry_core; - - entry_core = (core_dir_config *) - ap_get_module_config(entry_config, &core_module); - - if (entry_core->r) { - if (!ap_regexec(entry_core->r, test_dirname, 0, NULL, REG_NOTEOL)) { - per_dir_defaults = - ap_merge_per_dir_configs(r->pool, per_dir_defaults, - entry_config); - } - } - } - r->per_dir_config = per_dir_defaults; - - /* - * Symlink permissions are determined by the parent. If the request is - * for a directory then applying the symlink test here would use the - * permissions of the directory as opposed to its parent. Consider a - * symlink pointing to a dir with a .htaccess disallowing symlinks. If - * you access /symlink (or /symlink/) you would get a 403 without this - * S_ISDIR test. But if you accessed /symlink/index.html, for example, - * you would *not* get the 403. - */ - if (!S_ISDIR(r->finfo.st_mode) - && (res = check_symlinks(r->filename, ap_allow_options(r)))) { - ap_log_rerror(APLOG_MARK, APLOG_NOERRNO|APLOG_ERR, r, - "Symbolic link not allowed: %s", r->filename); - return res; - } - return OK; /* Can only "fail" if access denied by the - * symlink goop. */ -} - -static int location_walk(request_rec *r) -{ - core_server_config *sconf = ap_get_module_config(r->server->module_config, - &core_module); - void *per_dir_defaults = r->per_dir_config; - void **url = (void **) sconf->sec_url->elts; - int len, num_url = sconf->sec_url->nelts; - char *test_location; - void *this_conf, *entry_config; - core_dir_config *entry_core; - char *entry_url; - int j; - - if (!num_url) { - return OK; - } - - /* Location and LocationMatch differ on their behaviour w.r.t. multiple - * slashes. Location matches multiple slashes with a single slash, - * LocationMatch doesn't. An exception, for backwards brokenness is - * absoluteURIs... in which case neither match multiple slashes. - */ - if (r->uri[0] != '/') { - test_location = r->uri; - } - else { - test_location = ap_pstrdup(r->pool, r->uri); - ap_no2slash(test_location); - } - - /* Go through the location entries, and check for matches. */ - - /* we apply the directive sections in some order; - * should really try them with the most general first. - */ - for (j = 0; j < num_url; ++j) { - - entry_config = url[j]; - - entry_core = (core_dir_config *) - ap_get_module_config(entry_config, &core_module); - entry_url = entry_core->d; - - len = strlen(entry_url); - - this_conf = NULL; - - if (entry_core->r) { - if (!ap_regexec(entry_core->r, r->uri, 0, NULL, 0)) - this_conf = entry_config; - } - else if (entry_core->d_is_fnmatch) { - if (!ap_fnmatch(entry_url, test_location, FNM_PATHNAME)) { - this_conf = entry_config; - } - } - else if (!strncmp(test_location, entry_url, len) && - (entry_url[len - 1] == '/' || - test_location[len] == '/' || test_location[len] == '\0')) - this_conf = entry_config; - - if (this_conf) - per_dir_defaults = ap_merge_per_dir_configs(r->pool, - per_dir_defaults, this_conf); - } - r->per_dir_config = per_dir_defaults; - - return OK; -} - -static int file_walk(request_rec *r) -{ - core_dir_config *conf = ap_get_module_config(r->per_dir_config, &core_module); - void *per_dir_defaults = r->per_dir_config; - void **file = (void **) conf->sec->elts; - int num_files = conf->sec->nelts; - char *test_file; - - /* get the basename */ - test_file = strrchr(r->filename, '/'); - if (test_file == NULL) { - test_file = r->filename; - } - else { - ++test_file; - } - - /* Go through the file entries, and check for matches. */ - - if (num_files) { - void *this_conf, *entry_config; - core_dir_config *entry_core; - char *entry_file; - int j; - - /* we apply the directive sections in some order; - * should really try them with the most general first. - */ - for (j = 0; j < num_files; ++j) { - - entry_config = file[j]; - - entry_core = (core_dir_config *) - ap_get_module_config(entry_config, &core_module); - entry_file = entry_core->d; - - this_conf = NULL; - - if (entry_core->r) { - if (!ap_regexec(entry_core->r, test_file, 0, NULL, 0)) - this_conf = entry_config; - } - else if (entry_core->d_is_fnmatch) { - if (!ap_fnmatch(entry_file, test_file, FNM_PATHNAME)) { - this_conf = entry_config; - } - } - else if (!strcmp(test_file, entry_file)) { - this_conf = entry_config; - } - - if (this_conf) - per_dir_defaults = ap_merge_per_dir_configs(r->pool, - per_dir_defaults, - this_conf); - } - r->per_dir_config = per_dir_defaults; - } - return OK; -} - -/***************************************************************** - * - * The sub_request mechanism. - * - * Fns to look up a relative URI from, e.g., a map file or SSI document. - * These do all access checks, etc., but don't actually run the transaction - * ... use run_sub_req below for that. Also, be sure to use destroy_sub_req - * as appropriate if you're likely to be creating more than a few of these. - * (An early Apache version didn't destroy the sub_reqs used in directory - * indexing. The result, when indexing a directory with 800-odd files in - * it, was massively excessive storage allocation). - * - * Note more manipulation of protocol-specific vars in the request - * structure... - */ - -static request_rec *make_sub_request(const request_rec *r) -{ - pool *rrp = ap_make_sub_pool(r->pool); - request_rec *rr = ap_pcalloc(rrp, sizeof(request_rec)); - - rr->pool = rrp; - return rr; -} - -API_EXPORT(request_rec *) ap_sub_req_method_uri(const char *method, - const char *new_file, - const request_rec *r) -{ - request_rec *rnew; - int res; - char *udir; - - rnew = make_sub_request(r); - rnew->hostname = r->hostname; - rnew->request_time = r->request_time; - rnew->connection = r->connection; - rnew->server = r->server; - rnew->request_config = ap_create_request_config(rnew->pool); - rnew->htaccess = r->htaccess; - rnew->per_dir_config = r->server->lookup_defaults; - - ap_set_sub_req_protocol(rnew, r); - - /* would be nicer to pass "method" to ap_set_sub_req_protocol */ - rnew->method = method; - rnew->method_number = ap_method_number_of(method); - - if (new_file[0] == '/') - ap_parse_uri(rnew, new_file); - else { - udir = ap_make_dirstr_parent(rnew->pool, r->uri); - udir = ap_escape_uri(rnew->pool, udir); /* re-escape it */ - ap_parse_uri(rnew, ap_make_full_path(rnew->pool, udir, new_file)); - } - - res = ap_unescape_url(rnew->uri); - if (res) { - rnew->status = res; - return rnew; - } - - ap_getparents(rnew->uri); - - if ((res = location_walk(rnew))) { - rnew->status = res; - return rnew; - } - - res = ap_translate_name(rnew); - if (res) { - rnew->status = res; - return rnew; - } - - /* - * We could be clever at this point, and avoid calling directory_walk, - * etc. However, we'd need to test that the old and new filenames contain - * the same directory components, so it would require duplicating the - * start of translate_name. Instead we rely on the cache of .htaccess - * results. - * - * NB: directory_walk() clears the per_dir_config, so we don't inherit - * from location_walk() above - */ - - if ((res = directory_walk(rnew)) - || (res = file_walk(rnew)) - || (res = location_walk(rnew)) - || ((ap_satisfies(rnew) == SATISFY_ALL - || ap_satisfies(rnew) == SATISFY_NOSPEC) - ? ((res = ap_check_access(rnew)) - || (ap_some_auth_required(rnew) - && ((res = ap_check_user_id(rnew)) - || (res = ap_check_auth(rnew))))) - : ((res = ap_check_access(rnew)) - && (!ap_some_auth_required(rnew) - || ((res = ap_check_user_id(rnew)) - || (res = ap_check_auth(rnew))))) - ) - || (res = ap_find_types(rnew)) - || (res = ap_run_fixups(rnew)) - ) { - rnew->status = res; - } - return rnew; -} - -API_EXPORT(request_rec *) ap_sub_req_lookup_uri(const char *new_file, - const request_rec *r) -{ - return ap_sub_req_method_uri("GET", new_file, r); -} - -API_EXPORT(request_rec *) ap_sub_req_lookup_file(const char *new_file, - const request_rec *r) -{ - request_rec *rnew; - int res; - char *fdir; - - rnew = make_sub_request(r); - rnew->hostname = r->hostname; - rnew->request_time = r->request_time; - rnew->connection = r->connection; - rnew->server = r->server; - rnew->request_config = ap_create_request_config(rnew->pool); - rnew->htaccess = r->htaccess; - - ap_set_sub_req_protocol(rnew, r); - fdir = ap_make_dirstr_parent(rnew->pool, r->filename); - - /* - * Check for a special case... if there are no '/' characters in new_file - * at all, then we are looking at a relative lookup in the same - * directory. That means we won't have to redo directory_walk, and we may - * not even have to redo access checks. - */ - - if (strchr(new_file, '/') == NULL) { - char *udir = ap_make_dirstr_parent(rnew->pool, r->uri); - - rnew->uri = ap_make_full_path(rnew->pool, udir, new_file); - rnew->filename = ap_make_full_path(rnew->pool, fdir, new_file); - ap_parse_uri(rnew, rnew->uri); /* fill in parsed_uri values */ - if (stat(rnew->filename, &rnew->finfo) < 0) { - rnew->finfo.st_mode = 0; - } - - if ((res = check_safe_file(rnew))) { - rnew->status = res; - return rnew; - } - - rnew->per_dir_config = r->per_dir_config; - - /* - * no matter what, if it's a subdirectory, we need to re-run - * directory_walk - */ - if (S_ISDIR(rnew->finfo.st_mode)) { - res = directory_walk(rnew); - if (!res) { - res = file_walk(rnew); - } - } - else { - if ((res = check_symlinks(rnew->filename, ap_allow_options(rnew)))) { - ap_log_rerror(APLOG_MARK, APLOG_NOERRNO|APLOG_ERR, rnew, - "Symbolic link not allowed: %s", rnew->filename); - rnew->status = res; - return rnew; - } - /* - * do a file_walk, if it doesn't change the per_dir_config then - * we know that we don't have to redo all the access checks - */ - if ((res = file_walk(rnew))) { - rnew->status = res; - return rnew; - } - if (rnew->per_dir_config == r->per_dir_config) { - if ((res = ap_find_types(rnew)) || (res = ap_run_fixups(rnew))) { - rnew->status = res; - } - return rnew; - } - } - } - else { - /* XXX: @@@: What should be done with the parsed_uri values? */ - ap_parse_uri(rnew, new_file); /* fill in parsed_uri values */ - /* - * XXX: this should be set properly like it is in the same-dir case - * but it's actually sometimes to impossible to do it... because the - * file may not have a uri associated with it -djg - */ - rnew->uri = "INTERNALLY GENERATED file-relative req"; - rnew->filename = ((ap_os_is_path_absolute(new_file)) ? - ap_pstrdup(rnew->pool, new_file) : - ap_make_full_path(rnew->pool, fdir, new_file)); - rnew->per_dir_config = r->server->lookup_defaults; - res = directory_walk(rnew); - if (!res) { - res = file_walk(rnew); - } - } - - if (res - || ((ap_satisfies(rnew) == SATISFY_ALL - || ap_satisfies(rnew) == SATISFY_NOSPEC) - ? ((res = ap_check_access(rnew)) - || (ap_some_auth_required(rnew) - && ((res = ap_check_user_id(rnew)) - || (res = ap_check_auth(rnew))))) - : ((res = ap_check_access(rnew)) - && (!ap_some_auth_required(rnew) - || ((res = ap_check_user_id(rnew)) - || (res = ap_check_auth(rnew))))) - ) - || (res = ap_find_types(rnew)) - || (res = ap_run_fixups(rnew)) - ) { - rnew->status = res; - } - return rnew; -} - -API_EXPORT(int) ap_run_sub_req(request_rec *r) -{ -#ifndef CHARSET_EBCDIC - int retval = ap_invoke_handler(r); -#else /*CHARSET_EBCDIC*/ - /* Save the EBCDIC conversion setting of the caller across subrequests */ - int convert = ap_bgetflag(r->connection->client, B_EBCDIC2ASCII); - int retval = ap_invoke_handler(r); - ap_bsetflag(r->connection->client, B_EBCDIC2ASCII, convert); -#endif /*CHARSET_EBCDIC*/ - ap_finalize_sub_req_protocol(r); - return retval; -} - -API_EXPORT(void) ap_destroy_sub_req(request_rec *r) -{ - /* Reclaim the space */ - ap_destroy_pool(r->pool); -} - -/***************************************************************** - * - * Mainline request processing... - */ - -API_EXPORT(void) ap_die(int type, request_rec *r) -{ - int error_index = ap_index_of_response(type); - char *custom_response = ap_response_code_string(r, error_index); - int recursive_error = 0; - - if (type == DONE) { - ap_finalize_request_protocol(r); - return; - } - - /* - * The following takes care of Apache redirects to custom response URLs - * Note that if we are already dealing with the response to some other - * error condition, we just report on the original error, and give up on - * any attempt to handle the other thing "intelligently"... - */ - - if (r->status != HTTP_OK) { - recursive_error = type; - - while (r->prev && (r->prev->status != HTTP_OK)) - r = r->prev; /* Get back to original error */ - - type = r->status; - custom_response = NULL; /* Do NOT retry the custom thing! */ - } - - r->status = type; - - /* - * This test is done here so that none of the auth modules needs to know - * about proxy authentication. They treat it like normal auth, and then - * we tweak the status. - */ - if (r->status == AUTH_REQUIRED && r->proxyreq) { - r->status = HTTP_PROXY_AUTHENTICATION_REQUIRED; - } - - /* - * If we want to keep the connection, be sure that the request body - * (if any) has been read. - */ - if ((r->status != HTTP_NOT_MODIFIED) && (r->status != HTTP_NO_CONTENT) - && !ap_status_drops_connection(r->status) - && r->connection && (r->connection->keepalive != -1)) { - - (void) ap_discard_request_body(r); - } - - /* - * Two types of custom redirects --- plain text, and URLs. Plain text has - * a leading '"', so the URL code, here, is triggered on its absence - */ - - if (custom_response && custom_response[0] != '"') { - - if (ap_is_url(custom_response)) { - /* - * The URL isn't local, so lets drop through the rest of this - * apache code, and continue with the usual REDIRECT handler. - * But note that the client will ultimately see the wrong - * status... - */ - r->status = REDIRECT; - ap_table_setn(r->headers_out, "Location", custom_response); - } - else if (custom_response[0] == '/') { - const char *error_notes; - r->no_local_copy = 1; /* Do NOT send USE_LOCAL_COPY for - * error documents! */ - /* - * This redirect needs to be a GET no matter what the original - * method was. - */ - ap_table_setn(r->subprocess_env, "REQUEST_METHOD", r->method); - - /* - * Provide a special method for modules to communicate - * more informative (than the plain canned) messages to us. - * Propagate them to ErrorDocuments via the ERROR_NOTES variable: - */ - if ((error_notes = ap_table_get(r->notes, "error-notes")) != NULL) { - ap_table_setn(r->subprocess_env, "ERROR_NOTES", error_notes); - } - r->method = ap_pstrdup(r->pool, "GET"); - r->method_number = M_GET; - ap_internal_redirect(custom_response, r); - return; - } - else { - /* - * Dumb user has given us a bad url to redirect to --- fake up - * dying with a recursive server error... - */ - recursive_error = SERVER_ERROR; - ap_log_rerror(APLOG_MARK, APLOG_NOERRNO|APLOG_ERR, r, - "Invalid error redirection directive: %s", - custom_response); - } - } - ap_send_error_response(r, recursive_error); -} - -static void decl_die(int status, char *phase, request_rec *r) -{ - if (status == DECLINED) { - ap_log_rerror(APLOG_MARK, APLOG_NOERRNO|APLOG_CRIT, r, - "configuration error: couldn't %s: %s", phase, r->uri); - ap_die(SERVER_ERROR, r); - } - else - ap_die(status, r); -} - -API_EXPORT(int) ap_some_auth_required(request_rec *r) -{ - /* Is there a require line configured for the type of *this* req? */ - - const array_header *reqs_arr = ap_requires(r); - require_line *reqs; - int i; - - if (!reqs_arr) - return 0; - - reqs = (require_line *) reqs_arr->elts; - - for (i = 0; i < reqs_arr->nelts; ++i) - if (reqs[i].method_mask & (1 << r->method_number)) - return 1; - - return 0; -} - -static void process_request_internal(request_rec *r) -{ - int access_status; - - /* Ignore embedded %2F's in path for proxy requests */ - if (!r->proxyreq && r->parsed_uri.path) { - access_status = ap_unescape_url(r->parsed_uri.path); - if (access_status) { - ap_die(access_status, r); - return; - } - } - - ap_getparents(r->uri); /* OK --- shrinking transformations... */ - - if ((access_status = location_walk(r))) { - ap_die(access_status, r); - return; - } - - if ((access_status = ap_translate_name(r))) { - decl_die(access_status, "translate", r); - return; - } - - if (!r->proxyreq) { - /* - * We don't want TRACE to run through the normal handler set, we - * handle it specially. - */ - if (r->method_number == M_TRACE) { - if ((access_status = ap_send_http_trace(r))) - ap_die(access_status, r); - else - ap_finalize_request_protocol(r); - return; - } - } - - if (r->proto_num > HTTP_VERSION(1,0) && ap_table_get(r->subprocess_env, "downgrade-1.0")) { - r->proto_num = HTTP_VERSION(1,0); - } - - /* - * NB: directory_walk() clears the per_dir_config, so we don't inherit - * from location_walk() above - */ - - if ((access_status = directory_walk(r))) { - ap_die(access_status, r); - return; - } - - if ((access_status = file_walk(r))) { - ap_die(access_status, r); - return; - } - - if ((access_status = location_walk(r))) { - ap_die(access_status, r); - return; - } - - if ((access_status = ap_header_parse(r))) { - ap_die(access_status, r); - return; - } - - switch (ap_satisfies(r)) { - case SATISFY_ALL: - case SATISFY_NOSPEC: - if ((access_status = ap_check_access(r)) != 0) { - decl_die(access_status, "check access", r); - return; - } - if (ap_some_auth_required(r)) { - if (((access_status = ap_check_user_id(r)) != 0) || !ap_auth_type(r)) { - decl_die(access_status, ap_auth_type(r) - ? "check user. No user file?" - : "perform authentication. AuthType not set!", r); - return; - } - if (((access_status = ap_check_auth(r)) != 0) || !ap_auth_type(r)) { - decl_die(access_status, ap_auth_type(r) - ? "check access. No groups file?" - : "perform authentication. AuthType not set!", r); - return; - } - } - break; - case SATISFY_ANY: - if (((access_status = ap_check_access(r)) != 0) || !ap_auth_type(r)) { - if (!ap_some_auth_required(r)) { - decl_die(access_status, ap_auth_type(r) - ? "check access" - : "perform authentication. AuthType not set!", r); - return; - } - if (((access_status = ap_check_user_id(r)) != 0) || !ap_auth_type(r)) { - decl_die(access_status, ap_auth_type(r) - ? "check user. No user file?" - : "perform authentication. AuthType not set!", r); - return; - } - if (((access_status = ap_check_auth(r)) != 0) || !ap_auth_type(r)) { - decl_die(access_status, ap_auth_type(r) - ? "check access. No groups file?" - : "perform authentication. AuthType not set!", r); - return; - } - } - break; - } - - if (! (r->proxyreq - && r->parsed_uri.scheme != NULL - && strcmp(r->parsed_uri.scheme, "http") == 0) ) { - if ((access_status = ap_find_types(r)) != 0) { - decl_die(access_status, "find types", r); - return; - } - } - - if ((access_status = ap_run_fixups(r)) != 0) { - ap_die(access_status, r); - return; - } - - if ((access_status = ap_invoke_handler(r)) != 0) { - ap_die(access_status, r); - return; - } - - /* Take care of little things that need to happen when we're done */ - ap_finalize_request_protocol(r); -} - -void ap_process_request(request_rec *r) -{ - int old_stat; - - if (ap_extended_status) - ap_time_process_request(r->connection->child_num, START_PREQUEST); - - process_request_internal(r); - - old_stat = ap_update_child_status(r->connection->child_num, - SERVER_BUSY_LOG, r); - - /* - * We want to flush the last packet if this isn't a pipelining connection - * *before* we start into logging. Suppose that the logging causes a DNS - * lookup to occur, which may have a high latency. If we hold off on - * this packet, then it'll appear like the link is stalled when really - * it's the application that's stalled. - */ - ap_bhalfduplex(r->connection->client); - ap_log_transaction(r); - - (void) ap_update_child_status(r->connection->child_num, old_stat, r); - if (ap_extended_status) - ap_time_process_request(r->connection->child_num, STOP_PREQUEST); -} - -static table *rename_original_env(pool *p, table *t) -{ - array_header *env_arr = ap_table_elts(t); - table_entry *elts = (table_entry *) env_arr->elts; - table *new = ap_make_table(p, env_arr->nalloc); - int i; - - for (i = 0; i < env_arr->nelts; ++i) { - if (!elts[i].key) - continue; - ap_table_setn(new, ap_pstrcat(p, "REDIRECT_", elts[i].key, NULL), - elts[i].val); - } - - return new; -} - -static request_rec *internal_internal_redirect(const char *new_uri, request_rec *r) -{ - int access_status; - request_rec *new = (request_rec *) ap_pcalloc(r->pool, sizeof(request_rec)); - - new->connection = r->connection; - new->server = r->server; - new->pool = r->pool; - - /* - * A whole lot of this really ought to be shared with http_protocol.c... - * another missing cleanup. It's particularly inappropriate to be - * setting header_only, etc., here. - */ - - new->method = r->method; - new->method_number = r->method_number; - ap_parse_uri(new, new_uri); - new->request_config = ap_create_request_config(r->pool); - new->per_dir_config = r->server->lookup_defaults; - - new->prev = r; - r->next = new; - - /* Inherit the rest of the protocol info... */ - - new->the_request = r->the_request; - - new->allowed = r->allowed; - - new->status = r->status; - new->assbackwards = r->assbackwards; - new->header_only = r->header_only; - new->protocol = r->protocol; - new->proto_num = r->proto_num; - new->hostname = r->hostname; - new->request_time = r->request_time; - new->main = r->main; - - new->headers_in = r->headers_in; - new->headers_out = ap_make_table(r->pool, 12); - new->err_headers_out = r->err_headers_out; - new->subprocess_env = rename_original_env(r->pool, r->subprocess_env); - new->notes = ap_make_table(r->pool, 5); - - new->htaccess = r->htaccess; - new->no_cache = r->no_cache; - new->expecting_100 = r->expecting_100; - new->no_local_copy = r->no_local_copy; - new->read_length = r->read_length; /* We can only read it once */ - new->vlist_validator = r->vlist_validator; - - ap_table_setn(new->subprocess_env, "REDIRECT_STATUS", - ap_psprintf(r->pool, "%d", r->status)); - - /* - * XXX: hmm. This is because mod_setenvif and mod_unique_id really need - * to do their thing on internal redirects as well. Perhaps this is a - * misnamed function. - */ - if ((access_status = ap_run_post_read_request(new))) { - ap_die(access_status, new); - return NULL; - } - - return new; -} - -API_EXPORT(void) ap_internal_redirect(const char *new_uri, request_rec *r) -{ - request_rec *new = internal_internal_redirect(new_uri, r); - process_request_internal(new); -} - -/* This function is designed for things like actions or CGI scripts, when - * using AddHandler, and you want to preserve the content type across - * an internal redirect. - */ -API_EXPORT(void) ap_internal_redirect_handler(const char *new_uri, request_rec *r) -{ - request_rec *new = internal_internal_redirect(new_uri, r); - if (r->handler) - new->content_type = r->content_type; - process_request_internal(new); -} - -/* - * Is it the initial main request, which we only get *once* per HTTP request? - */ -API_EXPORT(int) ap_is_initial_req(request_rec *r) -{ - return - (r->main == NULL) /* otherwise, this is a sub-request */ - && - (r->prev == NULL); /* otherwise, this is an internal redirect */ -} - -/* - * Function to set the r->mtime field to the specified value if it's later - * than what's already there. - */ -API_EXPORT(time_t) ap_update_mtime(request_rec *r, time_t dependency_mtime) -{ - if (r->mtime < dependency_mtime) { - r->mtime = dependency_mtime; - } - return r->mtime; -} diff --git a/modules/http/mod_core.h b/modules/http/mod_core.h deleted file mode 100644 index 91c35e081b54f8d76cdf51e3fca81cb8bb087704..0000000000000000000000000000000000000000 --- a/modules/http/mod_core.h +++ /dev/null @@ -1,92 +0,0 @@ -/* ==================================================================== - * The Apache Software License, Version 1.1 - * - * Copyright (c) 2000 The Apache Software Foundation. All rights - * reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in - * the documentation and/or other materials provided with the - * distribution. - * - * 3. The end-user documentation included with the redistribution, - * if any, must include the following acknowledgment: - * "This product includes software developed by the - * Apache Software Foundation (http://www.apache.org/)." - * Alternately, this acknowledgment may appear in the software itself, - * if and wherever such third-party acknowledgments normally appear. - * - * 4. The names "Apache" and "Apache Software Foundation" must - * not be used to endorse or promote products derived from this - * software without prior written permission. For written - * permission, please contact apache@apache.org. - * - * 5. Products derived from this software may not be called "Apache", - * nor may "Apache" appear in their name, without prior written - * permission of the Apache Software Foundation. - * - * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED - * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES - * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR - * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF - * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND - * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, - * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT - * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * ==================================================================== - * - * This software consists of voluntary contributions made by many - * individuals on behalf of the Apache Software Foundation. For more - * information on the Apache Software Foundation, please see - * . - */ - -#ifndef MOD_CORE_H -#define MOD_CORE_H - -#include "apr.h" -#include "apr_buckets.h" - -#include "httpd.h" -#include "util_filter.h" - - -#ifdef __cplusplus -extern "C" { -#endif - -/** - * @package mod_core private header file - */ - -/* - * These (output) filters are internal to the mod_core operation. - */ -AP_CORE_DECLARE_NONSTD(apr_status_t) ap_byterange_filter(ap_filter_t *f, apr_bucket_brigade *b); -AP_CORE_DECLARE_NONSTD(apr_status_t) ap_http_header_filter(ap_filter_t *f, apr_bucket_brigade *b); -AP_CORE_DECLARE_NONSTD(apr_status_t) ap_content_length_filter(ap_filter_t *, - apr_bucket_brigade *); -AP_CORE_DECLARE_NONSTD(apr_status_t) ap_old_write_filter(ap_filter_t *f, apr_bucket_brigade *b); - -/* - * These (input) filters are internal to the mod_core operation. - */ -apr_status_t ap_http_filter(ap_filter_t *f, apr_bucket_brigade *b, ap_input_mode_t mode); -apr_status_t ap_dechunk_filter(ap_filter_t *f, apr_bucket_brigade *b, ap_input_mode_t mode); - -#ifdef __cplusplus -} -#endif - -#endif /* !MOD_CORE_H */ diff --git a/modules/http/mod_mime.c b/modules/http/mod_mime.c deleted file mode 100644 index f27356bfdd3a8f6ee26ce5ce44621ffe2e94c475..0000000000000000000000000000000000000000 --- a/modules/http/mod_mime.c +++ /dev/null @@ -1,402 +0,0 @@ -/* ==================================================================== - * Copyright (c) 1995-1999 The Apache Group. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in - * the documentation and/or other materials provided with the - * distribution. - * - * 3. All advertising materials mentioning features or use of this - * software must display the following acknowledgment: - * "This product includes software developed by the Apache Group - * for use in the Apache HTTP server project (http://www.apache.org/)." - * - * 4. The names "Apache Server" and "Apache Group" must not be used to - * endorse or promote products derived from this software without - * prior written permission. For written permission, please contact - * apache@apache.org. - * - * 5. Products derived from this software may not be called "Apache" - * nor may "Apache" appear in their names without prior written - * permission of the Apache Group. - * - * 6. Redistributions of any form whatsoever must retain the following - * acknowledgment: - * "This product includes software developed by the Apache Group - * for use in the Apache HTTP server project (http://www.apache.org/)." - * - * THIS SOFTWARE IS PROVIDED BY THE APACHE GROUP ``AS IS'' AND ANY - * EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR - * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE APACHE GROUP OR - * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT - * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, - * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED - * OF THE POSSIBILITY OF SUCH DAMAGE. - * ==================================================================== - * - * This software consists of voluntary contributions made by many - * individuals on behalf of the Apache Group and was originally based - * on public domain software written at the National Center for - * Supercomputing Applications, University of Illinois, Urbana-Champaign. - * For more information on the Apache Group and the Apache HTTP server - * project, please see . - * - */ - -/* - * http_mime.c: Sends/gets MIME headers for requests - * - * Rob McCool - * - */ - -#define MIME_PRIVATE - -#include "httpd.h" -#include "http_config.h" -#include "http_log.h" - -typedef struct handlers_info { - char *name; -} handlers_info; - -typedef struct { - table *forced_types; /* Additional AddTyped stuff */ - table *encoding_types; /* Added with AddEncoding... */ - table *language_types; /* Added with AddLanguage... */ - table *handlers; /* Added with AddHandler... */ - array_header *handlers_remove; /* List of handlers to remove */ - - char *type; /* Type forced with ForceType */ - char *handler; /* Handler forced with SetHandler */ - char *default_language; /* Language if no AddLanguage ext found */ -} mime_dir_config; - -module MODULE_VAR_EXPORT mime_module; - -static void *create_mime_dir_config(pool *p, char *dummy) -{ - mime_dir_config *new = - (mime_dir_config *) ap_palloc(p, sizeof(mime_dir_config)); - - new->forced_types = ap_make_table(p, 4); - new->encoding_types = ap_make_table(p, 4); - new->language_types = ap_make_table(p, 4); - new->handlers = ap_make_table(p, 4); - new->handlers_remove = ap_make_array(p, 4, sizeof(handlers_info)); - - new->type = NULL; - new->handler = NULL; - new->default_language = NULL; - - return new; -} - -static void *merge_mime_dir_configs(pool *p, void *basev, void *addv) -{ - mime_dir_config *base = (mime_dir_config *) basev; - mime_dir_config *add = (mime_dir_config *) addv; - mime_dir_config *new = - (mime_dir_config *) ap_palloc(p, sizeof(mime_dir_config)); - int i; - handlers_info *hand; - - hand = (handlers_info *) add->handlers_remove->elts; - for (i = 0; i < add->handlers_remove->nelts; i++) { - ap_table_unset(base->handlers, hand[i].name); - } - - new->forced_types = ap_overlay_tables(p, add->forced_types, - base->forced_types); - new->encoding_types = ap_overlay_tables(p, add->encoding_types, - base->encoding_types); - new->language_types = ap_overlay_tables(p, add->language_types, - base->language_types); - new->handlers = ap_overlay_tables(p, add->handlers, - base->handlers); - - new->type = add->type ? add->type : base->type; - new->handler = add->handler ? add->handler : base->handler; - new->default_language = add->default_language ? - add->default_language : base->default_language; - - return new; -} - -static const char *add_type(cmd_parms *cmd, mime_dir_config * m, char *ct, - char *ext) -{ - if (*ext == '.') - ++ext; - ap_str_tolower(ct); - ap_table_setn(m->forced_types, ext, ct); - return NULL; -} - -static const char *add_encoding(cmd_parms *cmd, mime_dir_config * m, char *enc, - char *ext) -{ - if (*ext == '.') - ++ext; - ap_str_tolower(enc); - ap_table_setn(m->encoding_types, ext, enc); - return NULL; -} - -static const char *add_language(cmd_parms *cmd, mime_dir_config * m, char *lang, - char *ext) -{ - if (*ext == '.') - ++ext; - ap_str_tolower(lang); - ap_table_setn(m->language_types, ext, lang); - return NULL; -} - -static const char *add_handler(cmd_parms *cmd, mime_dir_config * m, char *hdlr, - char *ext) -{ - if (*ext == '.') - ++ext; - ap_str_tolower(hdlr); - ap_table_setn(m->handlers, ext, hdlr); - return NULL; -} - -/* - * Note handler names that should be un-added for this location. This - * will keep the association from being inherited, as well, but not - * from being re-added at a subordinate level. - */ -static const char *remove_handler(cmd_parms *cmd, void *m, char *ext) -{ - mime_dir_config *mcfg = (mime_dir_config *) m; - handlers_info *hand; - - if (*ext == '.') { - ++ext; - } - hand = (handlers_info *) ap_push_array(mcfg->handlers_remove); - hand->name = ap_pstrdup(cmd->pool, ext); - return NULL; -} - -/* The sole bit of server configuration that the MIME module has is - * the name of its config file, so... - */ - -static const char *set_types_config(cmd_parms *cmd, void *dummy, char *arg) -{ - ap_set_module_config(cmd->server->module_config, &mime_module, arg); - return NULL; -} - -static const command_rec mime_cmds[] = -{ - {"AddType", add_type, NULL, OR_FILEINFO, ITERATE2, - "a mime type followed by one or more file extensions"}, - {"AddEncoding", add_encoding, NULL, OR_FILEINFO, ITERATE2, - "an encoding (e.g., gzip), followed by one or more file extensions"}, - {"AddLanguage", add_language, NULL, OR_FILEINFO, ITERATE2, - "a language (e.g., fr), followed by one or more file extensions"}, - {"AddHandler", add_handler, NULL, OR_FILEINFO, ITERATE2, - "a handler name followed by one or more file extensions"}, - {"ForceType", ap_set_string_slot_lower, - (void *)XtOffsetOf(mime_dir_config, type), OR_FILEINFO, TAKE1, - "a media type"}, - {"RemoveHandler", remove_handler, NULL, OR_FILEINFO, ITERATE, - "one or more file extensions"}, - {"SetHandler", ap_set_string_slot_lower, - (void *)XtOffsetOf(mime_dir_config, handler), OR_FILEINFO, TAKE1, - "a handler name"}, - {"TypesConfig", set_types_config, NULL, RSRC_CONF, TAKE1, - "the MIME types config file"}, - {"DefaultLanguage", ap_set_string_slot, - (void*)XtOffsetOf(mime_dir_config, default_language), OR_FILEINFO, TAKE1, - "language to use for documents with no other language file extension" }, - {NULL} -}; - -/* Hash table --- only one of these per daemon; virtual hosts can - * get private versions through AddType... - */ - -#define MIME_HASHSIZE (32) -#define hash(i) (ap_tolower(i) % MIME_HASHSIZE) - -static table *hash_buckets[MIME_HASHSIZE]; - -static void init_mime(server_rec *s, pool *p) -{ - configfile_t *f; - char l[MAX_STRING_LEN]; - int x; - char *types_confname = ap_get_module_config(s->module_config, &mime_module); - - if (!types_confname) - types_confname = TYPES_CONFIG_FILE; - - types_confname = ap_server_root_relative(p, types_confname); - - if (!(f = ap_pcfg_openfile(p, types_confname))) { - ap_log_error(APLOG_MARK, APLOG_ERR, s, - "could not open mime types log file %s.", types_confname); - exit(1); - } - - for (x = 0; x < MIME_HASHSIZE; x++) - hash_buckets[x] = ap_make_table(p, 10); - - while (!(ap_cfg_getline(l, MAX_STRING_LEN, f))) { - const char *ll = l, *ct; - - if (l[0] == '#') - continue; - ct = ap_getword_conf(p, &ll); - - while (ll[0]) { - char *ext = ap_getword_conf(p, &ll); - ap_str_tolower(ext); /* ??? */ - ap_table_setn(hash_buckets[hash(ext[0])], ext, ct); - } - } - ap_cfg_closefile(f); -} - -static int find_ct(request_rec *r) -{ - const char *fn = strrchr(r->filename, '/'); - mime_dir_config *conf = - (mime_dir_config *) ap_get_module_config(r->per_dir_config, &mime_module); - char *ext; - const char *orighandler = r->handler; - const char *type; - - if (S_ISDIR(r->finfo.st_mode)) { - r->content_type = DIR_MAGIC_TYPE; - return OK; - } - - /* TM -- FIXME - * if r->filename does not contain a '/', the following passes a null - * pointer to getword, causing a SEGV .. - */ - - if (fn == NULL) - fn = r->filename; - - /* Parse filename extensions, which can be in any order */ - while ((ext = ap_getword(r->pool, &fn, '.')) && *ext) { - int found = 0; - - /* Check for Content-Type */ - if ((type = ap_table_get(conf->forced_types, ext)) - || (type = ap_table_get(hash_buckets[hash(*ext)], ext))) { - r->content_type = type; - found = 1; - } - - /* Check for Content-Language */ - if ((type = ap_table_get(conf->language_types, ext))) { - const char **new; - - r->content_language = type; /* back compat. only */ - if (!r->content_languages) - r->content_languages = ap_make_array(r->pool, 2, sizeof(char *)); - new = (const char **) ap_push_array(r->content_languages); - *new = type; - found = 1; - } - - /* Check for Content-Encoding */ - if ((type = ap_table_get(conf->encoding_types, ext))) { - if (!r->content_encoding) - r->content_encoding = type; - else - r->content_encoding = ap_pstrcat(r->pool, r->content_encoding, - ", ", type, NULL); - found = 1; - } - - /* Check for a special handler, but not for proxy request */ - if ((type = ap_table_get(conf->handlers, ext)) && !r->proxyreq) { - r->handler = type; - found = 1; - } - - /* This is to deal with cases such as foo.gif.bak, which we want - * to not have a type. So if we find an unknown extension, we - * zap the type/language/encoding and reset the handler - */ - - if (!found) { - r->content_type = NULL; - r->content_language = NULL; - r->content_languages = NULL; - r->content_encoding = NULL; - r->handler = orighandler; - } - - } - - /* Set default language, if none was specified by the extensions - * and we have a DefaultLanguage setting in force - */ - - if (!r->content_languages && conf->default_language) { - const char **new; - - r->content_language = conf->default_language; /* back compat. only */ - if (!r->content_languages) - r->content_languages = ap_make_array(r->pool, 2, sizeof(char *)); - new = (const char **) ap_push_array(r->content_languages); - *new = conf->default_language; - } - - /* Check for overrides with ForceType/SetHandler */ - - if (conf->type && strcmp(conf->type, "none")) - r->content_type = conf->type; - if (conf->handler && strcmp(conf->handler, "none")) - r->handler = conf->handler; - - if (!r->content_type) - return DECLINED; - - return OK; -} - -module MODULE_VAR_EXPORT mime_module = -{ - STANDARD_MODULE_STUFF, - init_mime, /* initializer */ - create_mime_dir_config, /* dir config creator */ - merge_mime_dir_configs, /* dir config merger */ - NULL, /* server config */ - NULL, /* merge server config */ - mime_cmds, /* command table */ - NULL, /* handlers */ - NULL, /* filename translation */ - NULL, /* check_user_id */ - NULL, /* check auth */ - NULL, /* check access */ - find_ct, /* type_checker */ - NULL, /* fixups */ - NULL, /* logger */ - NULL, /* header parser */ - NULL, /* child_init */ - NULL, /* child_exit */ - NULL /* post read-request */ -}; diff --git a/modules/http/mod_mime.dsp b/modules/http/mod_mime.dsp deleted file mode 100644 index 4af27fb68fa5834b0568d6ec613c128248507d68..0000000000000000000000000000000000000000 --- a/modules/http/mod_mime.dsp +++ /dev/null @@ -1,128 +0,0 @@ -# Microsoft Developer Studio Project File - Name="mod_mime" - Package Owner=<4> -# Microsoft Developer Studio Generated Build File, Format Version 6.00 -# ** DO NOT EDIT ** - -# TARGTYPE "Win32 (x86) Dynamic-Link Library" 0x0102 - -CFG=mod_mime - Win32 Release -!MESSAGE This is not a valid makefile. To build this project using NMAKE, -!MESSAGE use the Export Makefile command and run -!MESSAGE -!MESSAGE NMAKE /f "mod_mime.mak". -!MESSAGE -!MESSAGE You can specify a configuration when running NMAKE -!MESSAGE by defining the macro CFG on the command line. For example: -!MESSAGE -!MESSAGE NMAKE /f "mod_mime.mak" CFG="mod_mime - Win32 Release" -!MESSAGE -!MESSAGE Possible choices for configuration are: -!MESSAGE -!MESSAGE "mod_mime - Win32 Release" (based on "Win32 (x86) Dynamic-Link Library") -!MESSAGE "mod_mime - Win32 Debug" (based on "Win32 (x86) Dynamic-Link Library") -!MESSAGE - -# Begin Project -# PROP AllowPerConfigDependencies 0 -# PROP Scc_ProjName "" -# PROP Scc_LocalPath "" -CPP=cl.exe -MTL=midl.exe -RSC=rc.exe - -!IF "$(CFG)" == "mod_mime - Win32 Release" - -# PROP BASE Use_MFC 0 -# PROP BASE Use_Debug_Libraries 0 -# PROP BASE Output_Dir "Release" -# PROP BASE Intermediate_Dir "Release" -# PROP BASE Target_Dir "" -# PROP Use_MFC 0 -# PROP Use_Debug_Libraries 0 -# PROP Output_Dir "Release" -# PROP Intermediate_Dir "Release" -# PROP Ignore_Export_Lib 0 -# PROP Target_Dir "" -# ADD BASE CPP /nologo /MD /W3 /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /FD /c -# ADD CPP /nologo /MD /W3 /O2 /I "../../include" /I "../../srclib/apr/include" /I "../../srclib/apr-util/include" /D "NDEBUG" /D "WIN32" /D "_WINDOWS" /Fd"Release\mod_mime" /FD /c -# ADD BASE MTL /nologo /D "NDEBUG" /win32 -# ADD MTL /nologo /D "NDEBUG" /mktyplib203 /win32 -# ADD BASE RSC /l 0x409 /d "NDEBUG" -# ADD RSC /l 0x409 /d "NDEBUG" -BSC32=bscmake.exe -# ADD BASE BSC32 /nologo -# ADD BSC32 /nologo -LINK32=link.exe -# ADD BASE LINK32 kernel32.lib /nologo /subsystem:windows /dll /map /machine:I386 /out:"Release/mod_mime.so" /base:@..\..\os\win32\BaseAddr.ref,mod_mime -# ADD LINK32 kernel32.lib /nologo /subsystem:windows /dll /map /machine:I386 /out:"Release/mod_mime.so" /base:@..\..\os\win32\BaseAddr.ref,mod_mime - -!ELSEIF "$(CFG)" == "mod_mime - Win32 Debug" - -# PROP BASE Use_MFC 0 -# PROP BASE Use_Debug_Libraries 1 -# PROP BASE Output_Dir "Debug" -# PROP BASE Intermediate_Dir "Debug" -# PROP BASE Target_Dir "" -# PROP Use_MFC 0 -# PROP Use_Debug_Libraries 1 -# PROP Output_Dir "Debug" -# PROP Intermediate_Dir "Debug" -# PROP Ignore_Export_Lib 0 -# PROP Target_Dir "" -# ADD BASE CPP /nologo /MDd /W3 /GX /Zi /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /FD /c -# ADD CPP /nologo /MDd /W3 /GX /Zi /Od /I "../../include" /I "../../srclib/apr/include" /I "../../srclib/apr-util/include" /D "_DEBUG" /D "WIN32" /D "_WINDOWS" /Fd"Debug\mod_mime" /FD /c -# ADD BASE MTL /nologo /D "_DEBUG" /win32 -# ADD MTL /nologo /D "_DEBUG" /mktyplib203 /win32 -# ADD BASE RSC /l 0x409 /d "_DEBUG" -# ADD RSC /l 0x409 /d "_DEBUG" -BSC32=bscmake.exe -# ADD BASE BSC32 /nologo -# ADD BSC32 /nologo -LINK32=link.exe -# ADD BASE LINK32 kernel32.lib /nologo /subsystem:windows /dll /incremental:no /map /debug /machine:I386 /out:"Debug/mod_mime.so" /base:@..\..\os\win32\BaseAddr.ref,mod_mime -# ADD LINK32 kernel32.lib /nologo /subsystem:windows /dll /incremental:no /map /debug /machine:I386 /out:"Debug/mod_mime.so" /base:@..\..\os\win32\BaseAddr.ref,mod_mime - -!ENDIF - -# Begin Target - -# Name "mod_mime - Win32 Release" -# Name "mod_mime - Win32 Debug" -# Begin Source File - -SOURCE=.\mod_mime.c -# End Source File -# Begin Source File - -SOURCE=.\mod_mime.rc -# End Source File -# Begin Source File - -SOURCE=..\..\build\win32\win32ver.awk - -!IF "$(CFG)" == "mod_mime - Win32 Release" - -# PROP Ignore_Default_Tool 1 -# Begin Custom Build - Creating Version Resource -InputPath=..\..\build\win32\win32ver.awk - -".\mod_mime.rc" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)" - awk -f ../../build/win32/win32ver.awk mod_mime "mime_module for Apache" ../../include/ap_release.h > .\mod_mime.rc - -# End Custom Build - -!ELSEIF "$(CFG)" == "mod_mime - Win32 Debug" - -# PROP Ignore_Default_Tool 1 -# Begin Custom Build - Creating Version Resource -InputPath=..\..\build\win32\win32ver.awk - -".\mod_mime.rc" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)" - awk -f ../../build/win32/win32ver.awk mod_mime "mime_module for Apache" ../../include/ap_release.h > .\mod_mime.rc - -# End Custom Build - -!ENDIF - -# End Source File -# End Target -# End Project diff --git a/modules/http/mod_mime.exp b/modules/http/mod_mime.exp deleted file mode 100644 index f2e38dbddadd786ccc9bc04150dd065847e25f28..0000000000000000000000000000000000000000 --- a/modules/http/mod_mime.exp +++ /dev/null @@ -1 +0,0 @@ -mime_module diff --git a/modules/loggers/.cvsignore b/modules/loggers/.cvsignore deleted file mode 100644 index f2f7a70d2c9528e7ef84cf1b3bf9ff721fa08b08..0000000000000000000000000000000000000000 --- a/modules/loggers/.cvsignore +++ /dev/null @@ -1,10 +0,0 @@ -.deps -.libs -*.la -modules.mk -Makefile -*.lo -*.slo -*.so -*.dll -*.def diff --git a/modules/loggers/.indent.pro b/modules/loggers/.indent.pro deleted file mode 100644 index a9fbe9f9a1f2e6e7bcc54171c215bdacd44171ba..0000000000000000000000000000000000000000 --- a/modules/loggers/.indent.pro +++ /dev/null @@ -1,54 +0,0 @@ --i4 -npsl -di0 -br -nce -d0 -cli0 -npcs -nfc1 --TBUFF --TFILE --TTRANS --TUINT4 --T_trans --Tallow_options_t --Tapache_sfio --Tarray_header --Tbool_int --Tbuf_area --Tbuff_struct --Tbuffy --Tcmd_how --Tcmd_parms --Tcommand_rec --Tcommand_struct --Tconn_rec --Tcore_dir_config --Tcore_server_config --Tdir_maker_func --Tevent --Tglobals_s --Thandler_func --Thandler_rec --Tjoblist_s --Tlisten_rec --Tmerger_func --Tmode_t --Tmodule --Tmodule_struct --Tmutex --Tn_long --Tother_child_rec --Toverrides_t --Tparent_score --Tpid_t --Tpiped_log --Tpool --Trequest_rec --Trequire_line --Trlim_t --Tscoreboard --Tsemaphore --Tserver_addr_rec --Tserver_rec --Tserver_rec_chain --Tshort_score --Ttable --Ttable_entry --Tthread --Tu_wide_int --Tvtime_t --Twide_int diff --git a/modules/loggers/Makefile.in b/modules/loggers/Makefile.in deleted file mode 100644 index 167b343d0db75f7876a55cef1681570eba813202..0000000000000000000000000000000000000000 --- a/modules/loggers/Makefile.in +++ /dev/null @@ -1,3 +0,0 @@ - -include $(top_srcdir)/build/special.mk - diff --git a/modules/loggers/config.m4 b/modules/loggers/config.m4 deleted file mode 100644 index b205d4da2dbd09c56ef389f6c4b255f0a9266aa5..0000000000000000000000000000000000000000 --- a/modules/loggers/config.m4 +++ /dev/null @@ -1,10 +0,0 @@ -dnl modules enabled in this directory by default -APACHE_MODPATH_INIT(standard) - -dnl APACHE_MODULE(vhost_alias,blabla) - -APACHE_MODULE(log_config, logging configuration, , config_log, yes) - -APACHE_MODPATH_FINISH - -APACHE_SUBST(STANDARD_LIBS) diff --git a/modules/loggers/mod_log_config.c b/modules/loggers/mod_log_config.c deleted file mode 100644 index fcdebcc4f95f7138f45fc9126657d6208c0d6388..0000000000000000000000000000000000000000 --- a/modules/loggers/mod_log_config.c +++ /dev/null @@ -1,1137 +0,0 @@ -/* ==================================================================== - * Copyright (c) 1995-1999 The Apache Group. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in - * the documentation and/or other materials provided with the - * distribution. - * - * 3. All advertising materials mentioning features or use of this - * software must display the following acknowledgment: - * "This product includes software developed by the Apache Group - * for use in the Apache HTTP server project (http://www.apache.org/)." - * - * 4. The names "Apache Server" and "Apache Group" must not be used to - * endorse or promote products derived from this software without - * prior written permission. For written permission, please contact - * apache@apache.org. - * - * 5. Products derived from this software may not be called "Apache" - * nor may "Apache" appear in their names without prior written - * permission of the Apache Group. - * - * 6. Redistributions of any form whatsoever must retain the following - * acknowledgment: - * "This product includes software developed by the Apache Group - * for use in the Apache HTTP server project (http://www.apache.org/)." - * - * THIS SOFTWARE IS PROVIDED BY THE APACHE GROUP ``AS IS'' AND ANY - * EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR - * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE APACHE GROUP OR - * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT - * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, - * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED - * OF THE POSSIBILITY OF SUCH DAMAGE. - * ==================================================================== - * - * This software consists of voluntary contributions made by many - * individuals on behalf of the Apache Group and was originally based - * on public domain software written at the National Center for - * Supercomputing Applications, University of Illinois, Urbana-Champaign. - * For more information on the Apache Group and the Apache HTTP server - * project, please see . - * - */ - -/* - * Modified by djm@va.pubnix.com: - * If no TransferLog is given explicitly, decline to log. - * - * This is module implements the TransferLog directive (same as the - * common log module), and additional directives, LogFormat and CustomLog. - * - * - * Syntax: - * - * TransferLog fn Logs transfers to fn in standard log format, unless - * a custom format is set with LogFormat - * LogFormat format Set a log format from TransferLog files - * CustomLog fn format - * Log to file fn with format given by the format - * argument - * - * CookieLog fn For backwards compatability with old Cookie - * logging module - now deprecated. - * - * There can be any number of TransferLog and CustomLog - * commands. Each request will be logged to _ALL_ the - * named files, in the appropriate format. - * - * If no TransferLog or CustomLog directive appears in a VirtualHost, - * the request will be logged to the log file(s) defined outside - * the virtual host section. If a TransferLog or CustomLog directive - * appears in the VirtualHost section, the log files defined outside - * the VirtualHost will _not_ be used. This makes this module compatable - * with the CLF and config log modules, where the use of TransferLog - * inside the VirtualHost section overrides its use outside. - * - * Examples: - * - * TransferLog logs/access_log - * - * LogFormat "... custom format ..." - * TransferLog log/virtual_only - * CustomLog log/virtual_useragents "%t %{user-agent}i" - * - * - * This will log using CLF to access_log any requests handled by the - * main server, while any requests to the virtual host will be logged - * with the "... custom format..." to virtual_only _AND_ using - * the custom user-agent log to virtual_useragents. - * - * Note that the NCSA referer and user-agent logs are easily added with - * CustomLog: - * CustomLog logs/referer "%{referer}i -> %U" - * CustomLog logs/agent "%{user-agent}i" - * - * RefererIgnore functionality can be obtained with conditional - * logging (SetEnvIf and CustomLog ... env=!VAR). - * - * But using this method allows much easier modification of the - * log format, e.g. to log hosts along with UA: - * CustomLog logs/referer "%{referer}i %U %h" - * - * The argument to LogFormat and CustomLog is a string, which can include - * literal characters copied into the log files, and '%' directives as - * follows: - * - * %...b: bytes sent, excluding HTTP headers. - * %...{FOOBAR}e: The contents of the environment variable FOOBAR - * %...f: filename - * %...h: remote host - * %...a: remote IP-address - * %...A: local IP-address - * %...{Foobar}i: The contents of Foobar: header line(s) in the request - * sent to the client. - * %...l: remote logname (from identd, if supplied) - * %...{Foobar}n: The contents of note "Foobar" from another module. - * %...{Foobar}o: The contents of Foobar: header line(s) in the reply. - * %...p: the port the request was served to - * %...P: the process ID of the child that serviced the request. - * %...r: first line of request - * %...s: status. For requests that got internally redirected, this - * is status of the *original* request --- %...>s for the last. - * %...t: time, in common log format time format - * %...{format}t: The time, in the form given by format, which should - * be in strftime(3) format. - * %...T: the time taken to serve the request, in seconds. - * %...u: remote user (from auth; may be bogus if return status (%s) is 401) - * %...U: the URL path requested. - * %...v: the configured name of the server (i.e. which virtual host?) - * %...V: the server name according to the UseCanonicalName setting - * - * The '...' can be nothing at all (e.g. "%h %u %r %s %b"), or it can - * indicate conditions for inclusion of the item (which will cause it - * to be replaced with '-' if the condition is not met). Note that - * there is no escaping performed on the strings from %r, %...i and - * %...o; some with long memories may remember that I thought this was - * a bad idea, once upon a time, and I'm still not comfortable with - * it, but it is difficult to see how to "do the right thing" with all - * of '%..i', unless we URL-escape everything and break with CLF. - * - * The forms of condition are a list of HTTP status codes, which may - * or may not be preceded by '!'. Thus, '%400,501{User-agent}i' logs - * User-agent: on 400 errors and 501 errors (Bad Request, Not - * Implemented) only; '%!200,304,302{Referer}i' logs Referer: on all - * requests which did *not* return some sort of normal status. - * - * The default LogFormat reproduces CLF; see below. - * - * The way this is supposed to work with virtual hosts is as follows: - * a virtual host can have its own LogFormat, or its own TransferLog. - * If it doesn't have its own LogFormat, it inherits from the main - * server. If it doesn't have its own TransferLog, it writes to the - * same descriptor (meaning the same process for "| ..."). - * - * --- rst */ - -#define DEFAULT_LOG_FORMAT "%h %l %u %t \"%r\" %>s %b" - -#include "httpd.h" -#include "http_config.h" -#include "http_core.h" /* For REMOTE_NAME */ -#include "http_log.h" -#include - -module MODULE_VAR_EXPORT config_log_module; - -static int xfer_flags = (O_WRONLY | O_APPEND | O_CREAT); -#if defined(OS2) || defined(WIN32) -/* OS/2 dosen't support users and groups */ -static mode_t xfer_mode = (S_IREAD | S_IWRITE); -#else -static mode_t xfer_mode = (S_IRUSR | S_IWUSR | S_IRGRP | S_IROTH); -#endif - -/* POSIX.1 defines PIPE_BUF as the maximum number of bytes that is - * guaranteed to be atomic when writing a pipe. And PIPE_BUF >= 512 - * is guaranteed. So we'll just guess 512 in the event the system - * doesn't have this. Now, for file writes there is actually no limit, - * the entire write is atomic. Whether all systems implement this - * correctly is another question entirely ... so we'll just use PIPE_BUF - * because it's probably a good guess as to what is implemented correctly - * everywhere. - */ -#ifdef PIPE_BUF -#define LOG_BUFSIZE PIPE_BUF -#else -#define LOG_BUFSIZE (512) -#endif - -/* - * multi_log_state is our per-(virtual)-server configuration. We store - * an array of the logs we are going to use, each of type config_log_state. - * If a default log format is given by LogFormat, store in default_format - * (backward compat. with mod_log_config). We also store for each virtual - * server a pointer to the logs specified for the main server, so that if this - * vhost has no logs defined, we can use the main server's logs instead. - * - * So, for the main server, config_logs contains a list of the log files - * and server_config_logs in empty. For a vhost, server_config_logs - * points to the same array as config_logs in the main server, and - * config_logs points to the array of logs defined inside this vhost, - * which might be empty. - */ - -typedef struct { - char *default_format_string; - array_header *default_format; - array_header *config_logs; - array_header *server_config_logs; - table *formats; -} multi_log_state; - -/* - * config_log_state holds the status of a single log file. fname might - * be NULL, which means this module does no logging for this - * request. format might be NULL, in which case the default_format - * from the multi_log_state should be used, or if that is NULL as - * well, use the CLF. log_fd is -1 before the log file is opened and - * set to a valid fd after it is opened. - */ - -typedef struct { - char *fname; - char *format_string; - array_header *format; - int log_fd; - char *condition_var; -#ifdef BUFFERED_LOGS - int outcnt; - char outbuf[LOG_BUFSIZE]; -#endif -} config_log_state; - -/* - * Format items... - * Note that many of these could have ap_sprintfs replaced with static buffers. - */ - -typedef const char *(*item_key_func) (request_rec *, char *); - -typedef struct { - item_key_func func; - char *arg; - int condition_sense; - int want_orig; - array_header *conditions; -} log_format_item; - -static char *format_integer(pool *p, int i) -{ - return ap_psprintf(p, "%d", i); -} - -static char *pfmt(pool *p, int i) -{ - if (i <= 0) { - return "-"; - } - else { - return format_integer(p, i); - } -} - -static const char *constant_item(request_rec *dummy, char *stuff) -{ - return stuff; -} - -static const char *log_remote_host(request_rec *r, char *a) -{ - return ap_get_remote_host(r->connection, r->per_dir_config, - REMOTE_NAME); -} - -static const char *log_remote_address(request_rec *r, char *a) -{ - return r->connection->remote_ip; -} - -static const char *log_local_address(request_rec *r, char *a) -{ - return r->connection->local_ip; -} - -static const char *log_remote_logname(request_rec *r, char *a) -{ - return ap_get_remote_logname(r); -} - -static const char *log_remote_user(request_rec *r, char *a) -{ - char *rvalue = r->connection->user; - - if (rvalue == NULL) { - rvalue = "-"; - } - else if (strlen(rvalue) == 0) { - rvalue = "\"\""; - } - return rvalue; -} - -static const char *log_request_line(request_rec *r, char *a) -{ - /* NOTE: If the original request contained a password, we - * re-write the request line here to contain XXXXXX instead: - * (note the truncation before the protocol string for HTTP/0.9 requests) - * (note also that r->the_request contains the unmodified request) - */ - return (r->parsed_uri.password) ? ap_pstrcat(r->pool, r->method, " ", - ap_unparse_uri_components(r->pool, &r->parsed_uri, 0), - r->assbackwards ? NULL : " ", r->protocol, NULL) - : r->the_request; -} - -static const char *log_request_file(request_rec *r, char *a) -{ - return r->filename; -} -static const char *log_request_uri(request_rec *r, char *a) -{ - return r->uri; -} -static const char *log_status(request_rec *r, char *a) -{ - return pfmt(r->pool, r->status); -} - -static const char *log_bytes_sent(request_rec *r, char *a) -{ - if (!r->sent_bodyct) { - return "-"; - } - else { - long int bs; - ap_bgetopt(r->connection->client, BO_BYTECT, &bs); - return ap_psprintf(r->pool, "%ld", bs); - } -} - -static const char *log_header_in(request_rec *r, char *a) -{ - return ap_table_get(r->headers_in, a); -} - -static const char *log_header_out(request_rec *r, char *a) -{ - const char *cp = ap_table_get(r->headers_out, a); - if (!strcasecmp(a, "Content-type") && r->content_type) { - cp = r->content_type; - } - if (cp) { - return cp; - } - return ap_table_get(r->err_headers_out, a); -} - -static const char *log_note(request_rec *r, char *a) -{ - return ap_table_get(r->notes, a); -} -static const char *log_env_var(request_rec *r, char *a) -{ - return ap_table_get(r->subprocess_env, a); -} - -static const char *log_request_time(request_rec *r, char *a) -{ - int timz; - struct tm *t; - char tstr[MAX_STRING_LEN]; - - t = ap_get_gmtoff(&timz); - - if (a && *a) { /* Custom format */ - strftime(tstr, MAX_STRING_LEN, a, t); - } - else { /* CLF format */ - char sign = (timz < 0 ? '-' : '+'); - - if (timz < 0) { - timz = -timz; - } - ap_snprintf(tstr, sizeof(tstr), "[%02d/%s/%d:%02d:%02d:%02d %c%.2d%.2d]", - t->tm_mday, ap_month_snames[t->tm_mon], t->tm_year+1900, - t->tm_hour, t->tm_min, t->tm_sec, - sign, timz / 60, timz % 60); - } - - return ap_pstrdup(r->pool, tstr); -} - -static const char *log_request_duration(request_rec *r, char *a) -{ - return ap_psprintf(r->pool, "%ld", time(NULL) - r->request_time); -} - -/* These next two routines use the canonical name:port so that log - * parsers don't need to duplicate all the vhost parsing crud. - */ -static const char *log_virtual_host(request_rec *r, char *a) -{ - return r->server->server_hostname; -} - -static const char *log_server_port(request_rec *r, char *a) -{ - return ap_psprintf(r->pool, "%u", - r->server->port ? r->server->port : ap_default_port(r)); -} - -/* This respects the setting of UseCanonicalName so that - * the dynamic mass virtual hosting trick works better. - */ -static const char *log_server_name(request_rec *r, char *a) -{ - return ap_get_server_name(r); -} - -static const char *log_child_pid(request_rec *r, char *a) -{ - return ap_psprintf(r->pool, "%ld", (long) getpid()); -} - -/***************************************************************** - * - * Parsing the log format string - */ - -static struct log_item_list { - char ch; - item_key_func func; - int want_orig_default; -} log_item_keys[] = { - - { - 'h', log_remote_host, 0 - }, - { - 'a', log_remote_address, 0 - }, - { - 'A', log_local_address, 0 - }, - { - 'l', log_remote_logname, 0 - }, - { - 'u', log_remote_user, 0 - }, - { - 't', log_request_time, 0 - }, - { - 'T', log_request_duration, 1 - }, - { - 'r', log_request_line, 1 - }, - { - 'f', log_request_file, 0 - }, - { - 'U', log_request_uri, 1 - }, - { - 's', log_status, 1 - }, - { - 'b', log_bytes_sent, 0 - }, - { - 'i', log_header_in, 0 - }, - { - 'o', log_header_out, 0 - }, - { - 'n', log_note, 0 - }, - { - 'e', log_env_var, 0 - }, - { - 'V', log_server_name, 0 - }, - { - 'v', log_virtual_host, 0 - }, - { - 'p', log_server_port, 0 - }, - { - 'P', log_child_pid, 0 - }, - { - '\0' - } -}; - -static struct log_item_list *find_log_func(char k) -{ - int i; - - for (i = 0; log_item_keys[i].ch; ++i) - if (k == log_item_keys[i].ch) { - return &log_item_keys[i]; - } - - return NULL; -} - -static char *parse_log_misc_string(pool *p, log_format_item *it, - const char **sa) -{ - const char *s; - char *d; - - it->func = constant_item; - it->conditions = NULL; - - s = *sa; - while (*s && *s != '%') { - s++; - } - /* - * This might allocate a few chars extra if there's a backslash - * escape in the format string. - */ - it->arg = ap_palloc(p, s - *sa + 1); - - d = it->arg; - s = *sa; - while (*s && *s != '%') { - if (*s != '\\') { - *d++ = *s++; - } - else { - s++; - switch (*s) { - case '\\': - *d++ = '\\'; - s++; - break; - case 'n': - *d++ = '\n'; - s++; - break; - case 't': - *d++ = '\t'; - s++; - break; - default: - /* copy verbatim */ - *d++ = '\\'; - /* - * Allow the loop to deal with this *s in the normal - * fashion so that it handles end of string etc. - * properly. - */ - break; - } - } - } - *d = '\0'; - - *sa = s; - return NULL; -} - -static char *parse_log_item(pool *p, log_format_item *it, const char **sa) -{ - const char *s = *sa; - - if (*s != '%') { - return parse_log_misc_string(p, it, sa); - } - - ++s; - it->condition_sense = 0; - it->conditions = NULL; - it->want_orig = -1; - it->arg = ""; /* For safety's sake... */ - - while (*s) { - int i; - struct log_item_list *l; - - switch (*s) { - case '!': - ++s; - it->condition_sense = !it->condition_sense; - break; - - case '<': - ++s; - it->want_orig = 1; - break; - - case '>': - ++s; - it->want_orig = 0; - break; - - case ',': - ++s; - break; - - case '{': - ++s; - it->arg = ap_getword(p, &s, '}'); - break; - - case '0': - case '1': - case '2': - case '3': - case '4': - case '5': - case '6': - case '7': - case '8': - case '9': - i = *s - '0'; - while (ap_isdigit(*++s)) { - i = i * 10 + (*s) - '0'; - } - if (!it->conditions) { - it->conditions = ap_make_array(p, 4, sizeof(int)); - } - *(int *) ap_push_array(it->conditions) = i; - break; - - default: - l = find_log_func(*s++); - if (!l) { - char dummy[2]; - - dummy[0] = s[-1]; - dummy[1] = '\0'; - return ap_pstrcat(p, "Unrecognized LogFormat directive %", - dummy, NULL); - } - it->func = l->func; - if (it->want_orig == -1) { - it->want_orig = l->want_orig_default; - } - *sa = s; - return NULL; - } - } - - return "Ran off end of LogFormat parsing args to some directive"; -} - -static array_header *parse_log_string(pool *p, const char *s, const char **err) -{ - array_header *a = ap_make_array(p, 30, sizeof(log_format_item)); - char *res; - - while (*s) { - if ((res = parse_log_item(p, (log_format_item *) ap_push_array(a), &s))) { - *err = res; - return NULL; - } - } - - s = "\n"; - parse_log_item(p, (log_format_item *) ap_push_array(a), &s); - return a; -} - -/***************************************************************** - * - * Actually logging. - */ - -static const char *process_item(request_rec *r, request_rec *orig, - log_format_item *item) -{ - const char *cp; - - /* First, see if we need to process this thing at all... */ - - if (item->conditions && item->conditions->nelts != 0) { - int i; - int *conds = (int *) item->conditions->elts; - int in_list = 0; - - for (i = 0; i < item->conditions->nelts; ++i) { - if (r->status == conds[i]) { - in_list = 1; - break; - } - } - - if ((item->condition_sense && in_list) - || (!item->condition_sense && !in_list)) { - return "-"; - } - } - - /* We do. Do it... */ - - cp = (*item->func) (item->want_orig ? orig : r, item->arg); - return cp ? cp : "-"; -} - -#ifdef BUFFERED_LOGS -static void flush_log(config_log_state *cls) -{ - if (cls->outcnt && cls->log_fd != -1) { - write(cls->log_fd, cls->outbuf, cls->outcnt); - cls->outcnt = 0; - } -} -#endif - -static int config_log_transaction(request_rec *r, config_log_state *cls, - array_header *default_format) -{ - log_format_item *items; - char *str, *s; - const char **strs; - int *strl; - request_rec *orig; - int i; - int len = 0; - array_header *format; - char *envar; - - if (cls->fname == NULL) { - return DECLINED; - } - - /* - * See if we've got any conditional envariable-controlled logging decisions - * to make. - */ - if (cls->condition_var != NULL) { - envar = cls->condition_var; - if (*envar != '!') { - if (ap_table_get(r->subprocess_env, envar) == NULL) { - return DECLINED; - } - } - else { - if (ap_table_get(r->subprocess_env, &envar[1]) != NULL) { - return DECLINED; - } - } - } - - format = cls->format ? cls->format : default_format; - - strs = ap_palloc(r->pool, sizeof(char *) * (format->nelts)); - strl = ap_palloc(r->pool, sizeof(int) * (format->nelts)); - items = (log_format_item *) format->elts; - - orig = r; - while (orig->prev) { - orig = orig->prev; - } - while (r->next) { - r = r->next; - } - - for (i = 0; i < format->nelts; ++i) { - strs[i] = process_item(r, orig, &items[i]); - } - - for (i = 0; i < format->nelts; ++i) { - len += strl[i] = strlen(strs[i]); - } - -#ifdef BUFFERED_LOGS - if (len + cls->outcnt > LOG_BUFSIZE) { - flush_log(cls); - } - if (len >= LOG_BUFSIZE) { - str = ap_palloc(r->pool, len + 1); - for (i = 0, s = str; i < format->nelts; ++i) { - memcpy(s, strs[i], strl[i]); - s += strl[i]; - } - write(cls->log_fd, str, len); - } - else { - for (i = 0, s = &cls->outbuf[cls->outcnt]; i < format->nelts; ++i) { - memcpy(s, strs[i], strl[i]); - s += strl[i]; - } - cls->outcnt += len; - } -#else - str = ap_palloc(r->pool, len + 1); - - for (i = 0, s = str; i < format->nelts; ++i) { - memcpy(s, strs[i], strl[i]); - s += strl[i]; - } - - write(cls->log_fd, str, len); -#endif - - return OK; -} - -static int multi_log_transaction(request_rec *r) -{ - multi_log_state *mls = ap_get_module_config(r->server->module_config, - &config_log_module); - config_log_state *clsarray; - int i; - - /* - * Log this transaction.. - */ - if (mls->config_logs->nelts) { - clsarray = (config_log_state *) mls->config_logs->elts; - for (i = 0; i < mls->config_logs->nelts; ++i) { - config_log_state *cls = &clsarray[i]; - - config_log_transaction(r, cls, mls->default_format); - } - } - else if (mls->server_config_logs) { - clsarray = (config_log_state *) mls->server_config_logs->elts; - for (i = 0; i < mls->server_config_logs->nelts; ++i) { - config_log_state *cls = &clsarray[i]; - - config_log_transaction(r, cls, mls->default_format); - } - } - - return OK; -} - -/***************************************************************** - * - * Module glue... - */ - -static void *make_config_log_state(pool *p, server_rec *s) -{ - multi_log_state *mls; - - mls = (multi_log_state *) ap_palloc(p, sizeof(multi_log_state)); - mls->config_logs = ap_make_array(p, 1, sizeof(config_log_state)); - mls->default_format_string = NULL; - mls->default_format = NULL; - mls->server_config_logs = NULL; - mls->formats = ap_make_table(p, 4); - ap_table_setn(mls->formats, "CLF", DEFAULT_LOG_FORMAT); - - return mls; -} - -/* - * Use the merger to simply add a pointer from the vhost log state - * to the log of logs specified for the non-vhost configuration. Make sure - * vhosts inherit any globally-defined format names. - */ - -static void *merge_config_log_state(pool *p, void *basev, void *addv) -{ - multi_log_state *base = (multi_log_state *) basev; - multi_log_state *add = (multi_log_state *) addv; - - add->server_config_logs = base->config_logs; - if (!add->default_format) { - add->default_format_string = base->default_format_string; - add->default_format = base->default_format; - } - add->formats = ap_overlay_tables(p, base->formats, add->formats); - - return add; -} - -/* - * Set the default logfile format, or define a nickname for a format string. - */ -static const char *log_format(cmd_parms *cmd, void *dummy, char *fmt, - char *name) -{ - const char *err_string = NULL; - multi_log_state *mls = ap_get_module_config(cmd->server->module_config, - &config_log_module); - - /* - * If we were given two arguments, the second is a name to be given to the - * format. This syntax just defines the nickname - it doesn't actually - * make the format the default. - */ - if (name != NULL) { - parse_log_string(cmd->pool, fmt, &err_string); - if (err_string == NULL) { - ap_table_setn(mls->formats, name, fmt); - } - } - else { - mls->default_format_string = fmt; - mls->default_format = parse_log_string(cmd->pool, fmt, &err_string); - } - return err_string; -} - - -static const char *add_custom_log(cmd_parms *cmd, void *dummy, char *fn, - char *fmt, char *envclause) -{ - const char *err_string = NULL; - multi_log_state *mls = ap_get_module_config(cmd->server->module_config, - &config_log_module); - config_log_state *cls; - - cls = (config_log_state *) ap_push_array(mls->config_logs); - cls->condition_var = NULL; - if (envclause != NULL) { - if (strncasecmp(envclause, "env=", 4) != 0) { - return "error in condition clause"; - } - if ((envclause[4] == '\0') - || ((envclause[4] == '!') && (envclause[5] == '\0'))) { - return "missing environment variable name"; - } - cls->condition_var = ap_pstrdup(cmd->pool, &envclause[4]); - } - - cls->fname = fn; - cls->format_string = fmt; - if (fmt == NULL) { - cls->format = NULL; - } - else { - cls->format = parse_log_string(cmd->pool, fmt, &err_string); - } - cls->log_fd = -1; - - return err_string; -} - -static const char *set_transfer_log(cmd_parms *cmd, void *dummy, char *fn) -{ - return add_custom_log(cmd, dummy, fn, NULL, NULL); -} - -static const char *set_cookie_log(cmd_parms *cmd, void *dummy, char *fn) -{ - return add_custom_log(cmd, dummy, fn, "%{Cookie}n \"%r\" %t", NULL); -} - -static const command_rec config_log_cmds[] = -{ - {"CustomLog", add_custom_log, NULL, RSRC_CONF, TAKE23, - "a file name, a custom log format string or format name, " - "and an optional \"env=\" clause (see docs)"}, - {"TransferLog", set_transfer_log, NULL, RSRC_CONF, TAKE1, - "the filename of the access log"}, - {"LogFormat", log_format, NULL, RSRC_CONF, TAKE12, - "a log format string (see docs) and an optional format name"}, - {"CookieLog", set_cookie_log, NULL, RSRC_CONF, TAKE1, - "the filename of the cookie log"}, - {NULL} -}; - -static config_log_state *open_config_log(server_rec *s, pool *p, - config_log_state *cls, - array_header *default_format) -{ - if (cls->log_fd > 0) { - return cls; /* virtual config shared w/main server */ - } - - if (cls->fname == NULL) { - return cls; /* Leave it NULL to decline. */ - } - - if (*cls->fname == '|') { - piped_log *pl; - - pl = ap_open_piped_log(p, cls->fname + 1); - if (pl == NULL) { - exit(1); - } - cls->log_fd = ap_piped_log_write_fd(pl); - } - else { - char *fname = ap_server_root_relative(p, cls->fname); - if ((cls->log_fd = ap_popenf(p, fname, xfer_flags, xfer_mode)) < 0) { - ap_log_error(APLOG_MARK, APLOG_ERR, s, - "could not open transfer log file %s.", fname); - exit(1); - } - } -#ifdef BUFFERED_LOGS - cls->outcnt = 0; -#endif - - return cls; -} - -static config_log_state *open_multi_logs(server_rec *s, pool *p) -{ - int i; - multi_log_state *mls = ap_get_module_config(s->module_config, - &config_log_module); - config_log_state *clsarray; - const char *dummy; - const char *format; - - if (mls->default_format_string) { - format = ap_table_get(mls->formats, mls->default_format_string); - if (format) { - mls->default_format = parse_log_string(p, format, &dummy); - } - } - - if (!mls->default_format) { - mls->default_format = parse_log_string(p, DEFAULT_LOG_FORMAT, &dummy); - } - - if (mls->config_logs->nelts) { - clsarray = (config_log_state *) mls->config_logs->elts; - for (i = 0; i < mls->config_logs->nelts; ++i) { - config_log_state *cls = &clsarray[i]; - - if (cls->format_string) { - format = ap_table_get(mls->formats, cls->format_string); - if (format) { - cls->format = parse_log_string(p, format, &dummy); - } - } - - cls = open_config_log(s, p, cls, mls->default_format); - } - } - else if (mls->server_config_logs) { - clsarray = (config_log_state *) mls->server_config_logs->elts; - for (i = 0; i < mls->server_config_logs->nelts; ++i) { - config_log_state *cls = &clsarray[i]; - - if (cls->format_string) { - format = ap_table_get(mls->formats, cls->format_string); - if (format) { - cls->format = parse_log_string(p, format, &dummy); - } - } - - cls = open_config_log(s, p, cls, mls->default_format); - } - } - - return NULL; -} - -static void init_config_log(server_rec *s, pool *p) -{ - /* First, do "physical" server, which gets default log fd and format - * for the virtual servers, if they don't override... - */ - - open_multi_logs(s, p); - - /* Then, virtual servers */ - - for (s = s->next; s; s = s->next) { - open_multi_logs(s, p); - } -} - -#ifdef BUFFERED_LOGS -static void flush_all_logs(server_rec *s, pool *p) -{ - multi_log_state *mls; - array_header *log_list; - config_log_state *clsarray; - int i; - - for (; s; s = s->next) { - mls = ap_get_module_config(s->module_config, &config_log_module); - log_list = NULL; - if (mls->config_logs->nelts) { - log_list = mls->config_logs; - } - else if (mls->server_config_logs) { - log_list = mls->server_config_logs; - } - if (log_list) { - clsarray = (config_log_state *) log_list->elts; - for (i = 0; i < log_list->nelts; ++i) { - flush_log(&clsarray[i]); - } - } - } -} -#endif - -module MODULE_VAR_EXPORT config_log_module = -{ - STANDARD_MODULE_STUFF, - init_config_log, /* initializer */ - NULL, /* create per-dir config */ - NULL, /* merge per-dir config */ - make_config_log_state, /* server config */ - merge_config_log_state, /* merge server config */ - config_log_cmds, /* command table */ - NULL, /* handlers */ - NULL, /* filename translation */ - NULL, /* check_user_id */ - NULL, /* check auth */ - NULL, /* check access */ - NULL, /* type_checker */ - NULL, /* fixups */ - multi_log_transaction, /* logger */ - NULL, /* header parser */ - NULL, /* child_init */ -#ifdef BUFFERED_LOGS - flush_all_logs, /* child_exit */ -#else - NULL, -#endif - NULL /* post read-request */ -}; diff --git a/modules/loggers/mod_log_config.dsp b/modules/loggers/mod_log_config.dsp deleted file mode 100644 index e043dabec9d8810f20ead0c490b1938aebfc5e0e..0000000000000000000000000000000000000000 --- a/modules/loggers/mod_log_config.dsp +++ /dev/null @@ -1,128 +0,0 @@ -# Microsoft Developer Studio Project File - Name="mod_log_config" - Package Owner=<4> -# Microsoft Developer Studio Generated Build File, Format Version 6.00 -# ** DO NOT EDIT ** - -# TARGTYPE "Win32 (x86) Dynamic-Link Library" 0x0102 - -CFG=mod_log_config - Win32 Release -!MESSAGE This is not a valid makefile. To build this project using NMAKE, -!MESSAGE use the Export Makefile command and run -!MESSAGE -!MESSAGE NMAKE /f "mod_log_config.mak". -!MESSAGE -!MESSAGE You can specify a configuration when running NMAKE -!MESSAGE by defining the macro CFG on the command line. For example: -!MESSAGE -!MESSAGE NMAKE /f "mod_log_config.mak" CFG="mod_log_config - Win32 Release" -!MESSAGE -!MESSAGE Possible choices for configuration are: -!MESSAGE -!MESSAGE "mod_log_config - Win32 Release" (based on "Win32 (x86) Dynamic-Link Library") -!MESSAGE "mod_log_config - Win32 Debug" (based on "Win32 (x86) Dynamic-Link Library") -!MESSAGE - -# Begin Project -# PROP AllowPerConfigDependencies 0 -# PROP Scc_ProjName "" -# PROP Scc_LocalPath "" -CPP=cl.exe -MTL=midl.exe -RSC=rc.exe - -!IF "$(CFG)" == "mod_log_config - Win32 Release" - -# PROP BASE Use_MFC 0 -# PROP BASE Use_Debug_Libraries 0 -# PROP BASE Output_Dir "Release" -# PROP BASE Intermediate_Dir "Release" -# PROP BASE Target_Dir "" -# PROP Use_MFC 0 -# PROP Use_Debug_Libraries 0 -# PROP Output_Dir "Release" -# PROP Intermediate_Dir "Release" -# PROP Ignore_Export_Lib 0 -# PROP Target_Dir "" -# ADD BASE CPP /nologo /MD /W3 /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /FD /c -# ADD CPP /nologo /MD /W3 /O2 /I "../../include" /I "../../srclib/apr/include" /I "../../srclib/apr-util/include" /D "NDEBUG" /D "WIN32" /D "_WINDOWS" /Fd"Release\mod_log_config" /FD /c -# ADD BASE MTL /nologo /D "NDEBUG" /win32 -# ADD MTL /nologo /D "NDEBUG" /mktyplib203 /win32 -# ADD BASE RSC /l 0x409 /d "NDEBUG" -# ADD RSC /l 0x409 /d "NDEBUG" -BSC32=bscmake.exe -# ADD BASE BSC32 /nologo -# ADD BSC32 /nologo -LINK32=link.exe -# ADD BASE LINK32 kernel32.lib /nologo /subsystem:windows /dll /map /machine:I386 /out:"Release/mod_log_config.so" /base:@..\..\os\win32\BaseAddr.ref,mod_log_config -# ADD LINK32 kernel32.lib /nologo /subsystem:windows /dll /map /machine:I386 /out:"Release/mod_log_config.so" /base:@..\..\os\win32\BaseAddr.ref,mod_log_config - -!ELSEIF "$(CFG)" == "mod_log_config - Win32 Debug" - -# PROP BASE Use_MFC 0 -# PROP BASE Use_Debug_Libraries 1 -# PROP BASE Output_Dir "Debug" -# PROP BASE Intermediate_Dir "Debug" -# PROP BASE Target_Dir "" -# PROP Use_MFC 0 -# PROP Use_Debug_Libraries 1 -# PROP Output_Dir "Debug" -# PROP Intermediate_Dir "Debug" -# PROP Ignore_Export_Lib 0 -# PROP Target_Dir "" -# ADD BASE CPP /nologo /MDd /W3 /GX /Zi /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /FD /c -# ADD CPP /nologo /MDd /W3 /GX /Zi /Od /I "../../include" /I "../../srclib/apr/include" /I "../../srclib/apr-util/include" /D "_DEBUG" /D "WIN32" /D "_WINDOWS" /Fd"Debug\mod_log_config" /FD /c -# ADD BASE MTL /nologo /D "_DEBUG" /win32 -# ADD MTL /nologo /D "_DEBUG" /mktyplib203 /win32 -# ADD BASE RSC /l 0x409 /d "_DEBUG" -# ADD RSC /l 0x409 /d "_DEBUG" -BSC32=bscmake.exe -# ADD BASE BSC32 /nologo -# ADD BSC32 /nologo -LINK32=link.exe -# ADD BASE LINK32 kernel32.lib /nologo /subsystem:windows /dll /incremental:no /map /debug /machine:I386 /out:"Debug/mod_log_config.so" /base:@..\..\os\win32\BaseAddr.ref,mod_log_config -# ADD LINK32 kernel32.lib /nologo /subsystem:windows /dll /incremental:no /map /debug /machine:I386 /out:"Debug/mod_log_config.so" /base:@..\..\os\win32\BaseAddr.ref,mod_log_config - -!ENDIF - -# Begin Target - -# Name "mod_log_config - Win32 Release" -# Name "mod_log_config - Win32 Debug" -# Begin Source File - -SOURCE=.\mod_log_config.c -# End Source File -# Begin Source File - -SOURCE=.\mod_log_config.rc -# End Source File -# Begin Source File - -SOURCE=..\..\build\win32\win32ver.awk - -!IF "$(CFG)" == "mod_log_config - Win32 Release" - -# PROP Ignore_Default_Tool 1 -# Begin Custom Build - Creating Version Resource -InputPath=..\..\build\win32\win32ver.awk - -".\mod_log_config.rc" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)" - awk -f ../../build/win32/win32ver.awk mod_log_config "log_config_module for Apache" ../../include/ap_release.h > .\mod_log_config.rc - -# End Custom Build - -!ELSEIF "$(CFG)" == "mod_log_config - Win32 Debug" - -# PROP Ignore_Default_Tool 1 -# Begin Custom Build - Creating Version Resource -InputPath=..\..\build\win32\win32ver.awk - -".\mod_log_config.rc" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)" - awk -f ../../build/win32/win32ver.awk mod_log_config "log_config_module for Apache" ../../include/ap_release.h > .\mod_log_config.rc - -# End Custom Build - -!ENDIF - -# End Source File -# End Target -# End Project diff --git a/modules/loggers/mod_log_config.exp b/modules/loggers/mod_log_config.exp deleted file mode 100644 index 01b926f4bb04f8cdaba7751648cf8835f437fdde..0000000000000000000000000000000000000000 --- a/modules/loggers/mod_log_config.exp +++ /dev/null @@ -1 +0,0 @@ -config_log_module diff --git a/modules/loggers/mod_log_config.h b/modules/loggers/mod_log_config.h deleted file mode 100644 index d30409f80412678e63c2978d20b2fcfa3b8140ad..0000000000000000000000000000000000000000 --- a/modules/loggers/mod_log_config.h +++ /dev/null @@ -1,75 +0,0 @@ -/* ==================================================================== - * The Apache Software License, Version 1.1 - * - * Copyright (c) 2000-2001 The Apache Software Foundation. All rights - * reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in - * the documentation and/or other materials provided with the - * distribution. - * - * 3. The end-user documentation included with the redistribution, - * if any, must include the following acknowledgment: - * "This product includes software developed by the - * Apache Software Foundation (http://www.apache.org/)." - * Alternately, this acknowledgment may appear in the software itself, - * if and wherever such third-party acknowledgments normally appear. - * - * 4. The names "Apache" and "Apache Software Foundation" must - * not be used to endorse or promote products derived from this - * software without prior written permission. For written - * permission, please contact apache@apache.org. - * - * 5. Products derived from this software may not be called "Apache", - * nor may "Apache" appear in their name, without prior written - * permission of the Apache Software Foundation. - * - * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED - * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES - * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR - * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF - * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND - * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, - * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT - * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * ==================================================================== - * - * This software consists of voluntary contributions made by many - * individuals on behalf of the Apache Software Foundation. For more - * information on the Apache Software Foundation, please see - * . - * - * Portions of this software are based upon public domain software - * originally written at the National Center for Supercomputing Applications, - * University of Illinois, Urbana-Champaign. - */ - -#include "apr_optional.h" -#include "httpd.h" - -#ifndef _MOD_LOG_CONFIG_H -#define _MOD_LOG_CONFIG_H 1 - -typedef const char *ap_log_handler_fn_t(request_rec *r, char *a); - -typedef struct ap_log_handler { - ap_log_handler_fn_t *func; - int want_orig_default; -} ap_log_handler; - -APR_DECLARE_OPTIONAL_FN(void, ap_register_log_handler, - (apr_pool_t *p, char *tag, ap_log_handler_fn_t *func, int def)); - -#endif /* MOD_LOG_CONFIG */ diff --git a/modules/mappers/.cvsignore b/modules/mappers/.cvsignore deleted file mode 100644 index f2f7a70d2c9528e7ef84cf1b3bf9ff721fa08b08..0000000000000000000000000000000000000000 --- a/modules/mappers/.cvsignore +++ /dev/null @@ -1,10 +0,0 @@ -.deps -.libs -*.la -modules.mk -Makefile -*.lo -*.slo -*.so -*.dll -*.def diff --git a/modules/mappers/.indent.pro b/modules/mappers/.indent.pro deleted file mode 100644 index a9fbe9f9a1f2e6e7bcc54171c215bdacd44171ba..0000000000000000000000000000000000000000 --- a/modules/mappers/.indent.pro +++ /dev/null @@ -1,54 +0,0 @@ --i4 -npsl -di0 -br -nce -d0 -cli0 -npcs -nfc1 --TBUFF --TFILE --TTRANS --TUINT4 --T_trans --Tallow_options_t --Tapache_sfio --Tarray_header --Tbool_int --Tbuf_area --Tbuff_struct --Tbuffy --Tcmd_how --Tcmd_parms --Tcommand_rec --Tcommand_struct --Tconn_rec --Tcore_dir_config --Tcore_server_config --Tdir_maker_func --Tevent --Tglobals_s --Thandler_func --Thandler_rec --Tjoblist_s --Tlisten_rec --Tmerger_func --Tmode_t --Tmodule --Tmodule_struct --Tmutex --Tn_long --Tother_child_rec --Toverrides_t --Tparent_score --Tpid_t --Tpiped_log --Tpool --Trequest_rec --Trequire_line --Trlim_t --Tscoreboard --Tsemaphore --Tserver_addr_rec --Tserver_rec --Tserver_rec_chain --Tshort_score --Ttable --Ttable_entry --Tthread --Tu_wide_int --Tvtime_t --Twide_int diff --git a/modules/mappers/Makefile.in b/modules/mappers/Makefile.in deleted file mode 100644 index 167b343d0db75f7876a55cef1681570eba813202..0000000000000000000000000000000000000000 --- a/modules/mappers/Makefile.in +++ /dev/null @@ -1,3 +0,0 @@ - -include $(top_srcdir)/build/special.mk - diff --git a/modules/mappers/NWGNUmakefile b/modules/mappers/NWGNUmakefile deleted file mode 100644 index 62c9624d97b86be3280cd110bd3fb660e7d06b06..0000000000000000000000000000000000000000 --- a/modules/mappers/NWGNUmakefile +++ /dev/null @@ -1,247 +0,0 @@ -# -# Declare the sub-directories to be built here -# - -SUBDIRS = \ - $(EOLIST) - -# -# Get the 'head' of the build environment. This includes default targets and -# paths to tools -# - -include $(AP_WORK)\build\NWGNUhead.inc - -# -# build this level's files - -# -# Make sure all needed macro's are defined -# - -# -# These directories will be at the beginning of the include list, followed by -# INCDIRS -# -XINCDIRS += \ - $(EOLIST) - -# -# These flags will come after CFLAGS -# -XCFLAGS += \ - $(EOLIST) - -# -# These defines will come after DEFINES -# -XDEFINES += \ - $(EOLIST) - -# -# These flags will be added to the link.opt file -# -XLFLAGS += \ - $(EOLIST) - -# -# These values will be appended to the correct variables based on the value of -# RELEASE -# -ifeq "$(RELEASE)" "debug" -XINCDIRS += \ - $(EOLIST) - -XCFLAGS += \ - $(EOLIST) - -XDEFINES += \ - $(EOLIST) - -XLFLAGS += \ - $(EOLIST) -endif - -ifeq "$(RELEASE)" "noopt" -XINCDIRS += \ - $(EOLIST) - -XCFLAGS += \ - $(EOLIST) - -XDEFINES += \ - $(EOLIST) - -XLFLAGS += \ - $(EOLIST) -endif - -ifeq "$(RELEASE)" "release" -XINCDIRS += \ - $(EOLIST) - -XCFLAGS += \ - $(EOLIST) - -XDEFINES += \ - $(EOLIST) - -XLFLAGS += \ - $(EOLIST) -endif - -# -# These are used by the link target if an NLM is being generated -# This is used by the link 'name' directive to name the nlm. If left blank -# TARGET_nlm (see below) will be used. -# -NLM_NAME = - -# -# This is used by the link '-desc ' directive. -# If left blank, NLM_NAME will be used. -# -NLM_DESCRIPTION = - -# -# This is used by the '-threadname' directive. If left blank, -# NLM_NAME Thread will be used. -# -NLM_THREAD_NAME = - -# -# If this is specified, it will override VERSION value in -# $(AP_WORK)\build\NWGNUenvironment.inc -# -NLM_VERSION = - -# -# If this is specified, it will override the default of 64K -# -NLM_STACK_SIZE = - - -# -# If this is specified it will be used by the link '-entry' directive -# -NLM_ENTRY_SYM = - -# -# If this is specified it will be used by the link '-exit' directive -# -NLM_EXIT_SYM = - -# -# If this is specified it will be used by the link '-check' directive -# -NLM_CHECK_SYM = - -# -# If these are specified it will be used by the link '-flags' directive -# -NLM_FLAGS = - -# -# If this is specified it will be linked in with the XDCData option in the def -# file instead of the default of $(NWOS)/apache.xdc. XDCData can be disabled -# by setting APACHE_UNIPROC in the environment -# -XDCDATA = - -# -# If there is an NLM target, put it here -# -TARGET_nlm = \ - $(OBJDIR)/rewrite.nlm \ - $(OBJDIR)/speling.nlm \ - $(OBJDIR)/vhost.nlm \ - $(EOLIST) - -# -# If there is an LIB target, put it here -# -TARGET_lib = \ - $(EOLIST) - -# -# These are the OBJ files needed to create the NLM target above. -# Paths must all use the '/' character -# -FILES_nlm_objs = \ - $(EOLIST) - -# -# These are the LIB files needed to create the NLM target above. -# These will be added as a library command in the link.opt file. -# -FILES_nlm_libs = \ - $(EOLIST) - -# -# These are the modules that the above NLM target depends on to load. -# These will be added as a module command in the link.opt file. -# -FILES_nlm_modules = \ - $(EOLIST) - -# -# If the nlm has a msg file, put it's path here -# -FILE_nlm_msg = - -# -# If the nlm has a hlp file put it's path here -# -FILE_nlm_hlp = - -# -# If this is specified, it will override $(NWOS)\copyright.txt. -# -FILE_nlm_copyright = - -# -# Any additional imports go here -# -FILES_nlm_Ximports = \ - $(EOLIST) - -# -# Any symbols exported to here -# -FILES_nlm_exports = \ - $(EOLIST) - -# -# These are the OBJ files needed to create the LIB target above. -# Paths must all use the '/' character -# -FILES_lib_objs = \ - $(EOLIST) - -# -# implement targets and dependancies (leave this section alone) -# - -libs :: $(OBJDIR) $(TARGET_lib) - -nlms :: libs $(TARGET_nlm) - -# -# Updated this target to create necessary directories and copy files to the -# correct place. (See $(AP_WORK)\build\NWGNUhead.inc for examples) -# -install :: nlms FORCE - copy $(OBJDIR)\*.nlm $(INSTALL)\Apache2\modules\*.* - -# -# Any specialized rules here -# - -# -# Include the 'tail' makefile that has targets that depend on variables defined -# in this makefile -# - -include $(AP_WORK)\build\NWGNUtail.inc - - diff --git a/modules/mappers/NWGNUrewrite b/modules/mappers/NWGNUrewrite deleted file mode 100644 index 9e8b21f9601ce99822ccf4c2f78b87a98877e52d..0000000000000000000000000000000000000000 --- a/modules/mappers/NWGNUrewrite +++ /dev/null @@ -1,249 +0,0 @@ -# -# Make sure all needed macro's are defined -# - -# -# Get the 'head' of the build environment if necessary. This includes default -# targets and paths to tools -# - -ifndef EnvironmentDefined -include $(AP_WORK)\build\NWGNUhead.inc -endif - -# -# These directories will be at the beginning of the include list, followed by -# INCDIRS -# -XINCDIRS += \ - $(AP_WORK)/include \ - $(NWOS) \ - $(AP_WORK)/modules/arch/netware \ - $(AP_WORK)/srclib/apr/include \ - $(AP_WORK)/srclib/apr-util/include \ - $(AP_WORK)/srclib/apr \ - $(EOLIST) - -# -# These flags will come after CFLAGS -# -XCFLAGS += \ - $(EOLIST) - -# -# These defines will come after DEFINES -# -XDEFINES += \ - $(EOLIST) - -# -# These flags will be added to the link.opt file -# -XLFLAGS += \ - $(EOLIST) - -# -# These values will be appended to the correct variables based on the value of -# RELEASE -# -ifeq "$(RELEASE)" "debug" -XINCDIRS += \ - $(EOLIST) - -XCFLAGS += \ - $(EOLIST) - -XDEFINES += \ - $(EOLIST) - -XLFLAGS += \ - $(EOLIST) -endif - -ifeq "$(RELEASE)" "noopt" -XINCDIRS += \ - $(EOLIST) - -XCFLAGS += \ - $(EOLIST) - -XDEFINES += \ - $(EOLIST) - -XLFLAGS += \ - $(EOLIST) -endif - -ifeq "$(RELEASE)" "release" -XINCDIRS += \ - $(EOLIST) - -XCFLAGS += \ - $(EOLIST) - -XDEFINES += \ - $(EOLIST) - -XLFLAGS += \ - $(EOLIST) -endif - -# -# These are used by the link target if an NLM is being generated -# This is used by the link 'name' directive to name the nlm. If left blank -# TARGET_nlm (see below) will be used. -# -NLM_NAME = rewrite - -# -# This is used by the link '-desc ' directive. -# If left blank, NLM_NAME will be used. -# -NLM_DESCRIPTION = Rewrite Module - -# -# This is used by the '-threadname' directive. If left blank, -# NLM_NAME Thread will be used. -# -NLM_THREAD_NAME = Rewrite Module - -# -# If this is specified, it will override VERSION value in -# $(AP_WORK)\build\NWGNUenvironment.inc -# -NLM_VERSION = - -# -# If this is specified, it will override the default of 64K -# -NLM_STACK_SIZE = 8192 - - -# -# If this is specified it will be used by the link '-entry' directive -# -NLM_ENTRY_SYM = _LibCPrelude - -# -# If this is specified it will be used by the link '-exit' directive -# -NLM_EXIT_SYM = _LibCPostlude - -# -# If this is specified it will be used by the link '-check' directive -# -NLM_CHECK_SYM = - -# -# If these are specified it will be used by the link '-flags' directive -# -NLM_FLAGS = AUTOUNLOAD, PSEUDOPREEMPTION - -# -# If this is specified it will be linked in with the XDCData option in the def -# file instead of the default of $(NWOS)/apache.xdc. XDCData can be disabled -# by setting APACHE_UNIPROC in the environment -# -XDCDATA = - -# -# If there is an NLM target, put it here -# -TARGET_nlm = \ - $(OBJDIR)/rewrite.nlm \ - $(EOLIST) - -# -# If there is an LIB target, put it here -# -TARGET_lib = \ - $(EOLIST) - -# -# These are the OBJ files needed to create the NLM target above. -# Paths must all use the '/' character -# -FILES_nlm_objs = \ - $(OBJDIR)/mod_rewrite.o \ - $(EOLIST) - -# -# These are the LIB files needed to create the NLM target above. -# These will be added as a library command in the link.opt file. -# -FILES_nlm_libs = \ - libcpre.o \ - $(EOLIST) - -# -# These are the modules that the above NLM target depends on to load. -# These will be added as a module command in the link.opt file. -# -FILES_nlm_modules = \ - aprlib \ - libc \ - $(EOLIST) - -# -# If the nlm has a msg file, put it's path here -# -FILE_nlm_msg = - -# -# If the nlm has a hlp file put it's path here -# -FILE_nlm_hlp = - -# -# If this is specified, it will override $(NWOS)\copyright.txt. -# -FILE_nlm_copyright = - -# -# Any additional imports go here -# -FILES_nlm_Ximports = \ - @$(APR)/aprlib.imp \ - @$(NWOS)/httpd.imp \ - @libc.imp \ - $(EOLIST) - -# -# Any symbols exported to here -# -FILES_nlm_exports = \ - rewrite_module \ - $(EOLIST) - -# -# These are the OBJ files needed to create the LIB target above. -# Paths must all use the '/' character -# -FILES_lib_objs = \ - $(EOLIST) - -# -# implement targets and dependancies (leave this section alone) -# - -libs :: $(OBJDIR) $(TARGET_lib) - -nlms :: libs $(TARGET_nlm) - -# -# Updated this target to create necessary directories and copy files to the -# correct place. (See $(AP_WORK)\build\NWGNUhead.inc for examples) -# -install :: nlms FORCE - -# -# Any specialized rules here -# - -# -# Include the 'tail' makefile that has targets that depend on variables defined -# in this makefile -# - -include $(AP_WORK)\build\NWGNUtail.inc - diff --git a/modules/mappers/NWGNUspeling b/modules/mappers/NWGNUspeling deleted file mode 100644 index fdd42631cfa0ee10ca68038a84c8808c69dfaca5..0000000000000000000000000000000000000000 --- a/modules/mappers/NWGNUspeling +++ /dev/null @@ -1,249 +0,0 @@ -# -# Make sure all needed macro's are defined -# - -# -# Get the 'head' of the build environment if necessary. This includes default -# targets and paths to tools -# - -ifndef EnvironmentDefined -include $(AP_WORK)\build\NWGNUhead.inc -endif - -# -# These directories will be at the beginning of the include list, followed by -# INCDIRS -# -XINCDIRS += \ - $(AP_WORK)/include \ - $(NWOS) \ - $(AP_WORK)/modules/arch/netware \ - $(AP_WORK)/srclib/apr/include \ - $(AP_WORK)/srclib/apr-util/include \ - $(AP_WORK)/srclib/apr \ - $(EOLIST) - -# -# These flags will come after CFLAGS -# -XCFLAGS += \ - $(EOLIST) - -# -# These defines will come after DEFINES -# -XDEFINES += \ - $(EOLIST) - -# -# These flags will be added to the link.opt file -# -XLFLAGS += \ - $(EOLIST) - -# -# These values will be appended to the correct variables based on the value of -# RELEASE -# -ifeq "$(RELEASE)" "debug" -XINCDIRS += \ - $(EOLIST) - -XCFLAGS += \ - $(EOLIST) - -XDEFINES += \ - $(EOLIST) - -XLFLAGS += \ - $(EOLIST) -endif - -ifeq "$(RELEASE)" "noopt" -XINCDIRS += \ - $(EOLIST) - -XCFLAGS += \ - $(EOLIST) - -XDEFINES += \ - $(EOLIST) - -XLFLAGS += \ - $(EOLIST) -endif - -ifeq "$(RELEASE)" "release" -XINCDIRS += \ - $(EOLIST) - -XCFLAGS += \ - $(EOLIST) - -XDEFINES += \ - $(EOLIST) - -XLFLAGS += \ - $(EOLIST) -endif - -# -# These are used by the link target if an NLM is being generated -# This is used by the link 'name' directive to name the nlm. If left blank -# TARGET_nlm (see below) will be used. -# -NLM_NAME = speling - -# -# This is used by the link '-desc ' directive. -# If left blank, NLM_NAME will be used. -# -NLM_DESCRIPTION = Speling Module - -# -# This is used by the '-threadname' directive. If left blank, -# NLM_NAME Thread will be used. -# -NLM_THREAD_NAME = Speling Module - -# -# If this is specified, it will override VERSION value in -# $(AP_WORK)\build\NWGNUenvironment.inc -# -NLM_VERSION = - -# -# If this is specified, it will override the default of 64K -# -NLM_STACK_SIZE = 8192 - - -# -# If this is specified it will be used by the link '-entry' directive -# -NLM_ENTRY_SYM = _LibCPrelude - -# -# If this is specified it will be used by the link '-exit' directive -# -NLM_EXIT_SYM = _LibCPostlude - -# -# If this is specified it will be used by the link '-check' directive -# -NLM_CHECK_SYM = - -# -# If these are specified it will be used by the link '-flags' directive -# -NLM_FLAGS = AUTOUNLOAD, PSEUDOPREEMPTION - -# -# If this is specified it will be linked in with the XDCData option in the def -# file instead of the default of $(NWOS)/apache.xdc. XDCData can be disabled -# by setting APACHE_UNIPROC in the environment -# -XDCDATA = - -# -# If there is an NLM target, put it here -# -TARGET_nlm = \ - $(OBJDIR)/speling.nlm \ - $(EOLIST) - -# -# If there is an LIB target, put it here -# -TARGET_lib = \ - $(EOLIST) - -# -# These are the OBJ files needed to create the NLM target above. -# Paths must all use the '/' character -# -FILES_nlm_objs = \ - $(OBJDIR)/mod_speling.o \ - $(EOLIST) - -# -# These are the LIB files needed to create the NLM target above. -# These will be added as a library command in the link.opt file. -# -FILES_nlm_libs = \ - libcpre.o \ - $(EOLIST) - -# -# These are the modules that the above NLM target depends on to load. -# These will be added as a module command in the link.opt file. -# -FILES_nlm_modules = \ - aprlib \ - libc \ - $(EOLIST) - -# -# If the nlm has a msg file, put it's path here -# -FILE_nlm_msg = - -# -# If the nlm has a hlp file put it's path here -# -FILE_nlm_hlp = - -# -# If this is specified, it will override $(NWOS)\copyright.txt. -# -FILE_nlm_copyright = - -# -# Any additional imports go here -# -FILES_nlm_Ximports = \ - @$(APR)/aprlib.imp \ - @$(NWOS)/httpd.imp \ - @libc.imp \ - $(EOLIST) - -# -# Any symbols exported to here -# -FILES_nlm_exports = \ - speling_module \ - $(EOLIST) - -# -# These are the OBJ files needed to create the LIB target above. -# Paths must all use the '/' character -# -FILES_lib_objs = \ - $(EOLIST) - -# -# implement targets and dependancies (leave this section alone) -# - -libs :: $(OBJDIR) $(TARGET_lib) - -nlms :: libs $(TARGET_nlm) - -# -# Updated this target to create necessary directories and copy files to the -# correct place. (See $(AP_WORK)\build\NWGNUhead.inc for examples) -# -install :: nlms FORCE - -# -# Any specialized rules here -# - -# -# Include the 'tail' makefile that has targets that depend on variables defined -# in this makefile -# - -include $(AP_WORK)\build\NWGNUtail.inc - diff --git a/modules/mappers/NWGNUvhost b/modules/mappers/NWGNUvhost deleted file mode 100644 index a2ee7789bb858cdd227da250ddd6b95284f90dec..0000000000000000000000000000000000000000 --- a/modules/mappers/NWGNUvhost +++ /dev/null @@ -1,249 +0,0 @@ -# -# Make sure all needed macro's are defined -# - -# -# Get the 'head' of the build environment if necessary. This includes default -# targets and paths to tools -# - -ifndef EnvironmentDefined -include $(AP_WORK)\build\NWGNUhead.inc -endif - -# -# These directories will be at the beginning of the include list, followed by -# INCDIRS -# -XINCDIRS += \ - $(AP_WORK)/include \ - $(NWOS) \ - $(AP_WORK)/modules/arch/netware \ - $(AP_WORK)/srclib/apr/include \ - $(AP_WORK)/srclib/apr-util/include \ - $(AP_WORK)/srclib/apr \ - $(EOLIST) - -# -# These flags will come after CFLAGS -# -XCFLAGS += \ - $(EOLIST) - -# -# These defines will come after DEFINES -# -XDEFINES += \ - $(EOLIST) - -# -# These flags will be added to the link.opt file -# -XLFLAGS += \ - $(EOLIST) - -# -# These values will be appended to the correct variables based on the value of -# RELEASE -# -ifeq "$(RELEASE)" "debug" -XINCDIRS += \ - $(EOLIST) - -XCFLAGS += \ - $(EOLIST) - -XDEFINES += \ - $(EOLIST) - -XLFLAGS += \ - $(EOLIST) -endif - -ifeq "$(RELEASE)" "noopt" -XINCDIRS += \ - $(EOLIST) - -XCFLAGS += \ - $(EOLIST) - -XDEFINES += \ - $(EOLIST) - -XLFLAGS += \ - $(EOLIST) -endif - -ifeq "$(RELEASE)" "release" -XINCDIRS += \ - $(EOLIST) - -XCFLAGS += \ - $(EOLIST) - -XDEFINES += \ - $(EOLIST) - -XLFLAGS += \ - $(EOLIST) -endif - -# -# These are used by the link target if an NLM is being generated -# This is used by the link 'name' directive to name the nlm. If left blank -# TARGET_nlm (see below) will be used. -# -NLM_NAME = vhost - -# -# This is used by the link '-desc ' directive. -# If left blank, NLM_NAME will be used. -# -NLM_DESCRIPTION = Vhost Alias Module - -# -# This is used by the '-threadname' directive. If left blank, -# NLM_NAME Thread will be used. -# -NLM_THREAD_NAME = Vhost Alias Module - -# -# If this is specified, it will override VERSION value in -# $(AP_WORK)\build\NWGNUenvironment.inc -# -NLM_VERSION = - -# -# If this is specified, it will override the default of 64K -# -NLM_STACK_SIZE = 8192 - - -# -# If this is specified it will be used by the link '-entry' directive -# -NLM_ENTRY_SYM = _LibCPrelude - -# -# If this is specified it will be used by the link '-exit' directive -# -NLM_EXIT_SYM = _LibCPostlude - -# -# If this is specified it will be used by the link '-check' directive -# -NLM_CHECK_SYM = - -# -# If these are specified it will be used by the link '-flags' directive -# -NLM_FLAGS = AUTOUNLOAD, PSEUDOPREEMPTION - -# -# If this is specified it will be linked in with the XDCData option in the def -# file instead of the default of $(NWOS)/apache.xdc. XDCData can be disabled -# by setting APACHE_UNIPROC in the environment -# -XDCDATA = - -# -# If there is an NLM target, put it here -# -TARGET_nlm = \ - $(OBJDIR)/vhost.nlm \ - $(EOLIST) - -# -# If there is an LIB target, put it here -# -TARGET_lib = \ - $(EOLIST) - -# -# These are the OBJ files needed to create the NLM target above. -# Paths must all use the '/' character -# -FILES_nlm_objs = \ - $(OBJDIR)/mod_vhost_alias.o \ - $(EOLIST) - -# -# These are the LIB files needed to create the NLM target above. -# These will be added as a library command in the link.opt file. -# -FILES_nlm_libs = \ - libcpre.o \ - $(EOLIST) - -# -# These are the modules that the above NLM target depends on to load. -# These will be added as a module command in the link.opt file. -# -FILES_nlm_modules = \ - aprlib \ - libc \ - $(EOLIST) - -# -# If the nlm has a msg file, put it's path here -# -FILE_nlm_msg = - -# -# If the nlm has a hlp file put it's path here -# -FILE_nlm_hlp = - -# -# If this is specified, it will override $(NWOS)\copyright.txt. -# -FILE_nlm_copyright = - -# -# Any additional imports go here -# -FILES_nlm_Ximports = \ - @$(APR)/aprlib.imp \ - @$(NWOS)/httpd.imp \ - @libc.imp \ - $(EOLIST) - -# -# Any symbols exported to here -# -FILES_nlm_exports = \ - vhost_alias_module \ - $(EOLIST) - -# -# These are the OBJ files needed to create the LIB target above. -# Paths must all use the '/' character -# -FILES_lib_objs = \ - $(EOLIST) - -# -# implement targets and dependancies (leave this section alone) -# - -libs :: $(OBJDIR) $(TARGET_lib) - -nlms :: libs $(TARGET_nlm) - -# -# Updated this target to create necessary directories and copy files to the -# correct place. (See $(AP_WORK)\build\NWGNUhead.inc for examples) -# -install :: nlms FORCE - -# -# Any specialized rules here -# - -# -# Include the 'tail' makefile that has targets that depend on variables defined -# in this makefile -# - -include $(AP_WORK)\build\NWGNUtail.inc - diff --git a/modules/mappers/config9.m4 b/modules/mappers/config9.m4 deleted file mode 100644 index e60dfd7e4f62a2ce452e20fde7c5e86a4d30c286..0000000000000000000000000000000000000000 --- a/modules/mappers/config9.m4 +++ /dev/null @@ -1,33 +0,0 @@ -dnl modules enabled in this directory by default - -dnl APACHE_MODULE(name, helptext[, objects[, structname[, default[, config]]]]) - -APACHE_MODPATH_INIT(mappers) - -APACHE_MODULE(vhost_alias, mass hosting module) -APACHE_MODULE(negotiation, content negoatiation, , , yes) -APACHE_MODULE(dir, directory request handling, , , yes) -APACHE_MODULE(imap, internal imagemaps, , , yes) -APACHE_MODULE(actions, Action triggering on requests, , , yes) -APACHE_MODULE(speling, correct common URL misspellings) -APACHE_MODULE(userdir, mapping of user requests, , , yes) -APACHE_MODULE(alias, translation of requests, , , yes) - -APACHE_MODULE(rewrite, regex URL translation, , , most, [ - EXTRA_CFLAGS="$EXTRA_CFLAGS -DNO_DBM_REWRITEMAP" -]) - -dnl ### this isn't going to work quite right because of ordering issues -dnl ### among the config.m4 files. it is possible that a *later* module -dnl ### is marked as shared (thus setting sharedobjs), so we won't see -dnl ### it here. we need to shift *this* config.m4 to be "last" or we -dnl ### need to find a different way to set up this default and module spec. -if test "$sharedobjs" = "yes"; then - APACHE_MODULE(so, DSO capability, , , yes) -else - APACHE_MODULE(so, DSO capability, , , no) -fi -dnl ### why save the cache? -AC_CACHE_SAVE - -APACHE_MODPATH_FINISH diff --git a/modules/mappers/mod_actions.c b/modules/mappers/mod_actions.c deleted file mode 100644 index 5906ee4c43a83ae67c27a462b7261acf2f23744a..0000000000000000000000000000000000000000 --- a/modules/mappers/mod_actions.c +++ /dev/null @@ -1,232 +0,0 @@ -/* ==================================================================== - * Copyright (c) 1995-1999 The Apache Group. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in - * the documentation and/or other materials provided with the - * distribution. - * - * 3. All advertising materials mentioning features or use of this - * software must display the following acknowledgment: - * "This product includes software developed by the Apache Group - * for use in the Apache HTTP server project (http://www.apache.org/)." - * - * 4. The names "Apache Server" and "Apache Group" must not be used to - * endorse or promote products derived from this software without - * prior written permission. For written permission, please contact - * apache@apache.org. - * - * 5. Products derived from this software may not be called "Apache" - * nor may "Apache" appear in their names without prior written - * permission of the Apache Group. - * - * 6. Redistributions of any form whatsoever must retain the following - * acknowledgment: - * "This product includes software developed by the Apache Group - * for use in the Apache HTTP server project (http://www.apache.org/)." - * - * THIS SOFTWARE IS PROVIDED BY THE APACHE GROUP ``AS IS'' AND ANY - * EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR - * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE APACHE GROUP OR - * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT - * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, - * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED - * OF THE POSSIBILITY OF SUCH DAMAGE. - * ==================================================================== - * - * This software consists of voluntary contributions made by many - * individuals on behalf of the Apache Group and was originally based - * on public domain software written at the National Center for - * Supercomputing Applications, University of Illinois, Urbana-Champaign. - * For more information on the Apache Group and the Apache HTTP server - * project, please see . - * - */ - -/* - * mod_actions.c: executes scripts based on MIME type or HTTP method - * - * by Alexei Kosut; based on mod_cgi.c, mod_mime.c and mod_includes.c, - * adapted by rst from original NCSA code by Rob McCool - * - * Usage instructions: - * - * Action mime/type /cgi-bin/script - * - * will activate /cgi-bin/script when a file of content type mime/type is - * requested. It sends the URL and file path of the requested document using - * the standard CGI PATH_INFO and PATH_TRANSLATED environment variables. - * - * Script PUT /cgi-bin/script - * - * will activate /cgi-bin/script when a request is received with the - * HTTP method "PUT". The available method names are defined in httpd.h. - * If the method is GET, the script will only be activated if the requested - * URI includes query information (stuff after a ?-mark). - */ - -#include "httpd.h" -#include "http_config.h" -#include "http_request.h" -#include "http_core.h" -#include "http_protocol.h" -#include "http_main.h" -#include "http_log.h" -#include "util_script.h" - -typedef struct { - table *action_types; /* Added with Action... */ - char *scripted[METHODS]; /* Added with Script... */ -} action_dir_config; - -module action_module; - -static void *create_action_dir_config(pool *p, char *dummy) -{ - action_dir_config *new = - (action_dir_config *) ap_palloc(p, sizeof(action_dir_config)); - - new->action_types = ap_make_table(p, 4); - memset(new->scripted, 0, sizeof(new->scripted)); - - return new; -} - -static void *merge_action_dir_configs(pool *p, void *basev, void *addv) -{ - action_dir_config *base = (action_dir_config *) basev; - action_dir_config *add = (action_dir_config *) addv; - action_dir_config *new = (action_dir_config *) ap_palloc(p, - sizeof(action_dir_config)); - int i; - - new->action_types = ap_overlay_tables(p, add->action_types, - base->action_types); - - for (i = 0; i < METHODS; ++i) { - new->scripted[i] = add->scripted[i] ? add->scripted[i] - : base->scripted[i]; - } - return new; -} - -static const char *add_action(cmd_parms *cmd, action_dir_config * m, char *type, - char *script) -{ - ap_table_setn(m->action_types, type, script); - return NULL; -} - -static const char *set_script(cmd_parms *cmd, action_dir_config * m, - char *method, char *script) -{ - int methnum; - - methnum = ap_method_number_of(method); - if (methnum == M_TRACE) - return "TRACE not allowed for Script"; - else if (methnum == M_INVALID) - return "Unknown method type for Script"; - else - m->scripted[methnum] = script; - - return NULL; -} - -static const command_rec action_cmds[] = -{ - {"Action", add_action, NULL, OR_FILEINFO, TAKE2, - "a media type followed by a script name"}, - {"Script", set_script, NULL, ACCESS_CONF | RSRC_CONF, TAKE2, - "a method followed by a script name"}, - {NULL} -}; - -static int action_handler(request_rec *r) -{ - action_dir_config *conf = (action_dir_config *) - ap_get_module_config(r->per_dir_config, &action_module); - const char *t, *action = r->handler ? r->handler : r->content_type; - const char *script; - int i; - - /* Set allowed stuff */ - for (i = 0; i < METHODS; ++i) { - if (conf->scripted[i]) - r->allowed |= (1 << i); - } - - /* First, check for the method-handling scripts */ - if (r->method_number == M_GET) { - if (r->args) - script = conf->scripted[M_GET]; - else - script = NULL; - } - else { - script = conf->scripted[r->method_number]; - } - - /* Check for looping, which can happen if the CGI script isn't */ - if (script && r->prev && r->prev->prev) - return DECLINED; - - /* Second, check for actions (which override the method scripts) */ - if ((t = ap_table_get(conf->action_types, - action ? action : ap_default_type(r)))) { - script = t; - if (r->finfo.st_mode == 0) { - ap_log_rerror(APLOG_MARK, APLOG_NOERRNO|APLOG_ERR, r, - "File does not exist: %s", r->filename); - return NOT_FOUND; - } - } - - if (script == NULL) - return DECLINED; - - ap_internal_redirect_handler(ap_pstrcat(r->pool, script, ap_escape_uri(r->pool, - r->uri), r->args ? "?" : NULL, r->args, NULL), r); - return OK; -} - -static const handler_rec action_handlers[] = -{ - {"*/*", action_handler}, - {NULL} -}; - -module action_module = -{ - STANDARD_MODULE_STUFF, - NULL, /* initializer */ - create_action_dir_config, /* dir config creater */ - merge_action_dir_configs, /* dir merger --- default is to override */ - NULL, /* server config */ - NULL, /* merge server config */ - action_cmds, /* command table */ - action_handlers, /* handlers */ - NULL, /* filename translation */ - NULL, /* check_user_id */ - NULL, /* check auth */ - NULL, /* check access */ - NULL, /* type_checker */ - NULL, /* fixups */ - NULL, /* logger */ - NULL, /* header parser */ - NULL, /* child_init */ - NULL, /* child_exit */ - NULL /* post read-request */ -}; diff --git a/modules/mappers/mod_actions.dsp b/modules/mappers/mod_actions.dsp deleted file mode 100644 index 39fed166dbb940f25a523d45633e33ae3285fa55..0000000000000000000000000000000000000000 --- a/modules/mappers/mod_actions.dsp +++ /dev/null @@ -1,128 +0,0 @@ -# Microsoft Developer Studio Project File - Name="mod_actions" - Package Owner=<4> -# Microsoft Developer Studio Generated Build File, Format Version 6.00 -# ** DO NOT EDIT ** - -# TARGTYPE "Win32 (x86) Dynamic-Link Library" 0x0102 - -CFG=mod_actions - Win32 Release -!MESSAGE This is not a valid makefile. To build this project using NMAKE, -!MESSAGE use the Export Makefile command and run -!MESSAGE -!MESSAGE NMAKE /f "mod_actions.mak". -!MESSAGE -!MESSAGE You can specify a configuration when running NMAKE -!MESSAGE by defining the macro CFG on the command line. For example: -!MESSAGE -!MESSAGE NMAKE /f "mod_actions.mak" CFG="mod_actions - Win32 Release" -!MESSAGE -!MESSAGE Possible choices for configuration are: -!MESSAGE -!MESSAGE "mod_actions - Win32 Release" (based on "Win32 (x86) Dynamic-Link Library") -!MESSAGE "mod_actions - Win32 Debug" (based on "Win32 (x86) Dynamic-Link Library") -!MESSAGE - -# Begin Project -# PROP AllowPerConfigDependencies 0 -# PROP Scc_ProjName "" -# PROP Scc_LocalPath "" -CPP=cl.exe -MTL=midl.exe -RSC=rc.exe - -!IF "$(CFG)" == "mod_actions - Win32 Release" - -# PROP BASE Use_MFC 0 -# PROP BASE Use_Debug_Libraries 0 -# PROP BASE Output_Dir "Release" -# PROP BASE Intermediate_Dir "Release" -# PROP BASE Target_Dir "" -# PROP Use_MFC 0 -# PROP Use_Debug_Libraries 0 -# PROP Output_Dir "Release" -# PROP Intermediate_Dir "Release" -# PROP Ignore_Export_Lib 0 -# PROP Target_Dir "" -# ADD BASE CPP /nologo /MD /W3 /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /FD /c -# ADD CPP /nologo /MD /W3 /O2 /I "../../include" /I "../../srclib/apr/include" /I "../../srclib/apr-util/include" /D "NDEBUG" /D "WIN32" /D "_WINDOWS" /Fd"Release\mod_actions" /FD /c -# ADD BASE MTL /nologo /D "NDEBUG" /win32 -# ADD MTL /nologo /D "NDEBUG" /mktyplib203 /win32 -# ADD BASE RSC /l 0x409 /d "NDEBUG" -# ADD RSC /l 0x409 /d "NDEBUG" -BSC32=bscmake.exe -# ADD BASE BSC32 /nologo -# ADD BSC32 /nologo -LINK32=link.exe -# ADD BASE LINK32 kernel32.lib /nologo /subsystem:windows /dll /map /machine:I386 /out:"Release/mod_actions.so" /base:@..\..\os\win32\BaseAddr.ref,mod_actions -# ADD LINK32 kernel32.lib /nologo /subsystem:windows /dll /map /machine:I386 /out:"Release/mod_actions.so" /base:@..\..\os\win32\BaseAddr.ref,mod_actions - -!ELSEIF "$(CFG)" == "mod_actions - Win32 Debug" - -# PROP BASE Use_MFC 0 -# PROP BASE Use_Debug_Libraries 1 -# PROP BASE Output_Dir "Debug" -# PROP BASE Intermediate_Dir "Debug" -# PROP BASE Target_Dir "" -# PROP Use_MFC 0 -# PROP Use_Debug_Libraries 1 -# PROP Output_Dir "Debug" -# PROP Intermediate_Dir "Debug" -# PROP Ignore_Export_Lib 0 -# PROP Target_Dir "" -# ADD BASE CPP /nologo /MDd /W3 /GX /Zi /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /FD /c -# ADD CPP /nologo /MDd /W3 /GX /Zi /Od /I "../../include" /I "../../srclib/apr/include" /I "../../srclib/apr-util/include" /D "_DEBUG" /D "WIN32" /D "_WINDOWS" /Fd"Debug\mod_actions" /FD /c -# ADD BASE MTL /nologo /D "_DEBUG" /win32 -# ADD MTL /nologo /D "_DEBUG" /mktyplib203 /win32 -# ADD BASE RSC /l 0x409 /d "_DEBUG" -# ADD RSC /l 0x409 /d "_DEBUG" -BSC32=bscmake.exe -# ADD BASE BSC32 /nologo -# ADD BSC32 /nologo -LINK32=link.exe -# ADD BASE LINK32 kernel32.lib /nologo /subsystem:windows /dll /incremental:no /map /debug /machine:I386 /out:"Debug/mod_actions.so" /base:@..\..\os\win32\BaseAddr.ref,mod_actions -# ADD LINK32 kernel32.lib /nologo /subsystem:windows /dll /incremental:no /map /debug /machine:I386 /out:"Debug/mod_actions.so" /base:@..\..\os\win32\BaseAddr.ref,mod_actions - -!ENDIF - -# Begin Target - -# Name "mod_actions - Win32 Release" -# Name "mod_actions - Win32 Debug" -# Begin Source File - -SOURCE=.\mod_actions.c -# End Source File -# Begin Source File - -SOURCE=.\mod_actions.rc -# End Source File -# Begin Source File - -SOURCE=..\..\build\win32\win32ver.awk - -!IF "$(CFG)" == "mod_actions - Win32 Release" - -# PROP Ignore_Default_Tool 1 -# Begin Custom Build - Creating Version Resource -InputPath=..\..\build\win32\win32ver.awk - -".\mod_actions.rc" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)" - awk -f ../../build/win32/win32ver.awk mod_actions "actions_module for Apache" ../../include/ap_release.h > .\mod_actions.rc - -# End Custom Build - -!ELSEIF "$(CFG)" == "mod_actions - Win32 Debug" - -# PROP Ignore_Default_Tool 1 -# Begin Custom Build - Creating Version Resource -InputPath=..\..\build\win32\win32ver.awk - -".\mod_actions.rc" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)" - awk -f ../../build/win32/win32ver.awk mod_actions "actions_module for Apache" ../../include/ap_release.h > .\mod_actions.rc - -# End Custom Build - -!ENDIF - -# End Source File -# End Target -# End Project diff --git a/modules/mappers/mod_actions.exp b/modules/mappers/mod_actions.exp deleted file mode 100644 index 815dff29a8c2e77da1d5538c11075f7938ce3218..0000000000000000000000000000000000000000 --- a/modules/mappers/mod_actions.exp +++ /dev/null @@ -1 +0,0 @@ -action_module diff --git a/modules/mappers/mod_alias.c b/modules/mappers/mod_alias.c deleted file mode 100644 index f92d982d23367b09f157edcf9593116c0bf17538..0000000000000000000000000000000000000000 --- a/modules/mappers/mod_alias.c +++ /dev/null @@ -1,418 +0,0 @@ -/* ==================================================================== - * Copyright (c) 1995-1999 The Apache Group. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in - * the documentation and/or other materials provided with the - * distribution. - * - * 3. All advertising materials mentioning features or use of this - * software must display the following acknowledgment: - * "This product includes software developed by the Apache Group - * for use in the Apache HTTP server project (http://www.apache.org/)." - * - * 4. The names "Apache Server" and "Apache Group" must not be used to - * endorse or promote products derived from this software without - * prior written permission. For written permission, please contact - * apache@apache.org. - * - * 5. Products derived from this software may not be called "Apache" - * nor may "Apache" appear in their names without prior written - * permission of the Apache Group. - * - * 6. Redistributions of any form whatsoever must retain the following - * acknowledgment: - * "This product includes software developed by the Apache Group - * for use in the Apache HTTP server project (http://www.apache.org/)." - * - * THIS SOFTWARE IS PROVIDED BY THE APACHE GROUP ``AS IS'' AND ANY - * EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR - * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE APACHE GROUP OR - * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT - * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, - * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED - * OF THE POSSIBILITY OF SUCH DAMAGE. - * ==================================================================== - * - * This software consists of voluntary contributions made by many - * individuals on behalf of the Apache Group and was originally based - * on public domain software written at the National Center for - * Supercomputing Applications, University of Illinois, Urbana-Champaign. - * For more information on the Apache Group and the Apache HTTP server - * project, please see . - * - */ - -/* - * http_alias.c: Stuff for dealing with directory aliases - * - * Original by Rob McCool, rewritten in succession by David Robinson - * and rst. - * - */ - -#include "httpd.h" -#include "http_config.h" - -typedef struct { - char *real; - char *fake; - char *handler; - regex_t *regexp; - int redir_status; /* 301, 302, 303, 410, etc */ -} alias_entry; - -typedef struct { - array_header *aliases; - array_header *redirects; -} alias_server_conf; - -typedef struct { - array_header *redirects; -} alias_dir_conf; - -module MODULE_VAR_EXPORT alias_module; - -static void *create_alias_config(pool *p, server_rec *s) -{ - alias_server_conf *a = - (alias_server_conf *) ap_pcalloc(p, sizeof(alias_server_conf)); - - a->aliases = ap_make_array(p, 20, sizeof(alias_entry)); - a->redirects = ap_make_array(p, 20, sizeof(alias_entry)); - return a; -} - -static void *create_alias_dir_config(pool *p, char *d) -{ - alias_dir_conf *a = - (alias_dir_conf *) ap_pcalloc(p, sizeof(alias_dir_conf)); - a->redirects = ap_make_array(p, 2, sizeof(alias_entry)); - return a; -} - -static void *merge_alias_config(pool *p, void *basev, void *overridesv) -{ - alias_server_conf *a = - (alias_server_conf *) ap_pcalloc(p, sizeof(alias_server_conf)); - alias_server_conf *base = (alias_server_conf *) basev, *overrides = (alias_server_conf *) overridesv; - - a->aliases = ap_append_arrays(p, overrides->aliases, base->aliases); - a->redirects = ap_append_arrays(p, overrides->redirects, base->redirects); - return a; -} - -static void *merge_alias_dir_config(pool *p, void *basev, void *overridesv) -{ - alias_dir_conf *a = - (alias_dir_conf *) ap_pcalloc(p, sizeof(alias_dir_conf)); - alias_dir_conf *base = (alias_dir_conf *) basev, *overrides = (alias_dir_conf *) overridesv; - a->redirects = ap_append_arrays(p, overrides->redirects, base->redirects); - return a; -} - -static const char *add_alias_internal(cmd_parms *cmd, void *dummy, char *f, char *r, - int use_regex) -{ - server_rec *s = cmd->server; - alias_server_conf *conf = - (alias_server_conf *) ap_get_module_config(s->module_config, &alias_module); - alias_entry *new = ap_push_array(conf->aliases); - - /* XX r can NOT be relative to DocumentRoot here... compat bug. */ - - if (use_regex) { - new->regexp = ap_pregcomp(cmd->pool, f, REG_EXTENDED); - if (new->regexp == NULL) - return "Regular expression could not be compiled."; - } - - new->fake = f; - new->real = r; - new->handler = cmd->info; - - return NULL; -} - -static const char *add_alias(cmd_parms *cmd, void *dummy, char *f, char *r) -{ - return add_alias_internal(cmd, dummy, f, r, 0); -} - -static const char *add_alias_regex(cmd_parms *cmd, void *dummy, char *f, char *r) -{ - return add_alias_internal(cmd, dummy, f, r, 1); -} - -static const char *add_redirect_internal(cmd_parms *cmd, alias_dir_conf * dirconf, - char *arg1, char *arg2, char *arg3, - int use_regex) -{ - alias_entry *new; - server_rec *s = cmd->server; - alias_server_conf *serverconf = - (alias_server_conf *) ap_get_module_config(s->module_config, &alias_module); - int status = (int) (long) cmd->info; - regex_t *r = NULL; - char *f = arg2; - char *url = arg3; - - if (!strcasecmp(arg1, "gone")) - status = HTTP_GONE; - else if (!strcasecmp(arg1, "permanent")) - status = HTTP_MOVED_PERMANENTLY; - else if (!strcasecmp(arg1, "temp")) - status = HTTP_MOVED_TEMPORARILY; - else if (!strcasecmp(arg1, "seeother")) - status = HTTP_SEE_OTHER; - else if (ap_isdigit(*arg1)) - status = atoi(arg1); - else { - f = arg1; - url = arg2; - } - - if (use_regex) { - r = ap_pregcomp(cmd->pool, f, REG_EXTENDED); - if (r == NULL) - return "Regular expression could not be compiled."; - } - - if (ap_is_HTTP_REDIRECT(status)) { - if (!url) - return "URL to redirect to is missing"; - if (!use_regex && !ap_is_url(url)) - return "Redirect to non-URL"; - } - else { - if (url) - return "Redirect URL not valid for this status"; - } - - if (cmd->path) - new = ap_push_array(dirconf->redirects); - else - new = ap_push_array(serverconf->redirects); - - new->fake = f; - new->real = url; - new->regexp = r; - new->redir_status = status; - return NULL; -} - -static const char *add_redirect(cmd_parms *cmd, alias_dir_conf * dirconf, char *arg1, - char *arg2, char *arg3) -{ - return add_redirect_internal(cmd, dirconf, arg1, arg2, arg3, 0); -} - -static const char *add_redirect_regex(cmd_parms *cmd, alias_dir_conf * dirconf, - char *arg1, char *arg2, char *arg3) -{ - return add_redirect_internal(cmd, dirconf, arg1, arg2, arg3, 1); -} - -static const command_rec alias_cmds[] = -{ - {"Alias", add_alias, NULL, RSRC_CONF, TAKE2, - "a fakename and a realname"}, - {"ScriptAlias", add_alias, "cgi-script", RSRC_CONF, TAKE2, - "a fakename and a realname"}, - {"Redirect", add_redirect, (void *) HTTP_MOVED_TEMPORARILY, - OR_FILEINFO, TAKE23, - "an optional status, then document to be redirected and destination URL"}, - {"AliasMatch", add_alias_regex, NULL, RSRC_CONF, TAKE2, - "a regular expression and a filename"}, - {"ScriptAliasMatch", add_alias_regex, "cgi-script", RSRC_CONF, TAKE2, - "a regular expression and a filename"}, - {"RedirectMatch", add_redirect_regex, (void *) HTTP_MOVED_TEMPORARILY, - OR_FILEINFO, TAKE23, - "an optional status, then a regular expression and destination URL"}, - {"RedirectTemp", add_redirect, (void *) HTTP_MOVED_TEMPORARILY, - OR_FILEINFO, TAKE2, - "a document to be redirected, then the destination URL"}, - {"RedirectPermanent", add_redirect, (void *) HTTP_MOVED_PERMANENTLY, - OR_FILEINFO, TAKE2, - "a document to be redirected, then the destination URL"}, - {NULL} -}; - -static int alias_matches(const char *uri, const char *alias_fakename) -{ - const char *end_fakename = alias_fakename + strlen(alias_fakename); - const char *aliasp = alias_fakename, *urip = uri; - - while (aliasp < end_fakename) { - if (*aliasp == '/') { - /* any number of '/' in the alias matches any number in - * the supplied URI, but there must be at least one... - */ - if (*urip != '/') - return 0; - - while (*aliasp == '/') - ++aliasp; - while (*urip == '/') - ++urip; - } - else { - /* Other characters are compared literally */ - if (*urip++ != *aliasp++) - return 0; - } - } - - /* Check last alias path component matched all the way */ - - if (aliasp[-1] != '/' && *urip != '\0' && *urip != '/') - return 0; - - /* Return number of characters from URI which matched (may be - * greater than length of alias, since we may have matched - * doubled slashes) - */ - - return urip - uri; -} - -static char *try_alias_list(request_rec *r, array_header *aliases, int doesc, int *status) -{ - alias_entry *entries = (alias_entry *) aliases->elts; - regmatch_t regm[10]; - char *found = NULL; - int i; - - for (i = 0; i < aliases->nelts; ++i) { - alias_entry *p = &entries[i]; - int l; - - if (p->regexp) { - if (!ap_regexec(p->regexp, r->uri, p->regexp->re_nsub + 1, regm, 0)) { - if (p->real) { - found = ap_pregsub(r->pool, p->real, r->uri, - p->regexp->re_nsub + 1, regm); - if (found && doesc) { - found = ap_escape_uri(r->pool, found); - } - } - else { - /* need something non-null */ - found = ap_pstrdup(r->pool, ""); - } - } - } - else { - l = alias_matches(r->uri, p->fake); - - if (l > 0) { - if (doesc) { - char *escurl; - escurl = ap_os_escape_path(r->pool, r->uri + l, 1); - - found = ap_pstrcat(r->pool, p->real, escurl, NULL); - } - else - found = ap_pstrcat(r->pool, p->real, r->uri + l, NULL); - } - } - - if (found) { - if (p->handler) { /* Set handler, and leave a note for mod_cgi */ - r->handler = p->handler; - ap_table_setn(r->notes, "alias-forced-type", r->handler); - } - - *status = p->redir_status; - - return found; - } - - } - - return NULL; -} - -static int translate_alias_redir(request_rec *r) -{ - void *sconf = r->server->module_config; - alias_server_conf *serverconf = - (alias_server_conf *) ap_get_module_config(sconf, &alias_module); - char *ret; - int status; - - if (r->uri[0] != '/' && r->uri[0] != '\0') - return DECLINED; - - if ((ret = try_alias_list(r, serverconf->redirects, 1, &status)) != NULL) { - if (ap_is_HTTP_REDIRECT(status)) { - /* include QUERY_STRING if any */ - if (r->args) { - ret = ap_pstrcat(r->pool, ret, "?", r->args, NULL); - } - ap_table_setn(r->headers_out, "Location", ret); - } - return status; - } - - if ((ret = try_alias_list(r, serverconf->aliases, 0, &status)) != NULL) { - r->filename = ret; - return OK; - } - - return DECLINED; -} - -static int fixup_redir(request_rec *r) -{ - void *dconf = r->per_dir_config; - alias_dir_conf *dirconf = - (alias_dir_conf *) ap_get_module_config(dconf, &alias_module); - char *ret; - int status; - - /* It may have changed since last time, so try again */ - - if ((ret = try_alias_list(r, dirconf->redirects, 1, &status)) != NULL) { - if (ap_is_HTTP_REDIRECT(status)) - ap_table_setn(r->headers_out, "Location", ret); - return status; - } - - return DECLINED; -} - -module MODULE_VAR_EXPORT alias_module = -{ - STANDARD_MODULE_STUFF, - NULL, /* initializer */ - create_alias_dir_config, /* dir config creater */ - merge_alias_dir_config, /* dir merger --- default is to override */ - create_alias_config, /* server config */ - merge_alias_config, /* merge server configs */ - alias_cmds, /* command table */ - NULL, /* handlers */ - translate_alias_redir, /* filename translation */ - NULL, /* check_user_id */ - NULL, /* check auth */ - NULL, /* check access */ - NULL, /* type_checker */ - fixup_redir, /* fixups */ - NULL, /* logger */ - NULL, /* header parser */ - NULL, /* child_init */ - NULL, /* child_exit */ - NULL /* post read-request */ -}; diff --git a/modules/mappers/mod_alias.dsp b/modules/mappers/mod_alias.dsp deleted file mode 100644 index d09c7affec49a18f9da08ed3f9478f6c262ff788..0000000000000000000000000000000000000000 --- a/modules/mappers/mod_alias.dsp +++ /dev/null @@ -1,128 +0,0 @@ -# Microsoft Developer Studio Project File - Name="mod_alias" - Package Owner=<4> -# Microsoft Developer Studio Generated Build File, Format Version 6.00 -# ** DO NOT EDIT ** - -# TARGTYPE "Win32 (x86) Dynamic-Link Library" 0x0102 - -CFG=mod_alias - Win32 Release -!MESSAGE This is not a valid makefile. To build this project using NMAKE, -!MESSAGE use the Export Makefile command and run -!MESSAGE -!MESSAGE NMAKE /f "mod_alias.mak". -!MESSAGE -!MESSAGE You can specify a configuration when running NMAKE -!MESSAGE by defining the macro CFG on the command line. For example: -!MESSAGE -!MESSAGE NMAKE /f "mod_alias.mak" CFG="mod_alias - Win32 Release" -!MESSAGE -!MESSAGE Possible choices for configuration are: -!MESSAGE -!MESSAGE "mod_alias - Win32 Release" (based on "Win32 (x86) Dynamic-Link Library") -!MESSAGE "mod_alias - Win32 Debug" (based on "Win32 (x86) Dynamic-Link Library") -!MESSAGE - -# Begin Project -# PROP AllowPerConfigDependencies 0 -# PROP Scc_ProjName "" -# PROP Scc_LocalPath "" -CPP=cl.exe -MTL=midl.exe -RSC=rc.exe - -!IF "$(CFG)" == "mod_alias - Win32 Release" - -# PROP BASE Use_MFC 0 -# PROP BASE Use_Debug_Libraries 0 -# PROP BASE Output_Dir "Release" -# PROP BASE Intermediate_Dir "Release" -# PROP BASE Target_Dir "" -# PROP Use_MFC 0 -# PROP Use_Debug_Libraries 0 -# PROP Output_Dir "Release" -# PROP Intermediate_Dir "Release" -# PROP Ignore_Export_Lib 0 -# PROP Target_Dir "" -# ADD BASE CPP /nologo /MD /W3 /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /FD /c -# ADD CPP /nologo /MD /W3 /O2 /I "../../include" /I "../../srclib/apr/include" /I "../../srclib/apr-util/include" /D "NDEBUG" /D "WIN32" /D "_WINDOWS" /Fd"Release\mod_alias" /FD /c -# ADD BASE MTL /nologo /D "NDEBUG" /win32 -# ADD MTL /nologo /D "NDEBUG" /mktyplib203 /win32 -# ADD BASE RSC /l 0x409 /d "NDEBUG" -# ADD RSC /l 0x409 /d "NDEBUG" -BSC32=bscmake.exe -# ADD BASE BSC32 /nologo -# ADD BSC32 /nologo -LINK32=link.exe -# ADD BASE LINK32 kernel32.lib /nologo /subsystem:windows /dll /map /machine:I386 /out:"Release/mod_alias.so" /base:@..\..\os\win32\BaseAddr.ref,mod_alias -# ADD LINK32 kernel32.lib /nologo /subsystem:windows /dll /map /machine:I386 /out:"Release/mod_alias.so" /base:@..\..\os\win32\BaseAddr.ref,mod_alias - -!ELSEIF "$(CFG)" == "mod_alias - Win32 Debug" - -# PROP BASE Use_MFC 0 -# PROP BASE Use_Debug_Libraries 1 -# PROP BASE Output_Dir "Debug" -# PROP BASE Intermediate_Dir "Debug" -# PROP BASE Target_Dir "" -# PROP Use_MFC 0 -# PROP Use_Debug_Libraries 1 -# PROP Output_Dir "Debug" -# PROP Intermediate_Dir "Debug" -# PROP Ignore_Export_Lib 0 -# PROP Target_Dir "" -# ADD BASE CPP /nologo /MDd /W3 /GX /Zi /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /FD /c -# ADD CPP /nologo /MDd /W3 /GX /Zi /Od /I "../../include" /I "../../srclib/apr/include" /I "../../srclib/apr-util/include" /D "_DEBUG" /D "WIN32" /D "_WINDOWS" /Fd"Debug\mod_alias" /FD /c -# ADD BASE MTL /nologo /D "_DEBUG" /win32 -# ADD MTL /nologo /D "_DEBUG" /mktyplib203 /win32 -# ADD BASE RSC /l 0x409 /d "_DEBUG" -# ADD RSC /l 0x409 /d "_DEBUG" -BSC32=bscmake.exe -# ADD BASE BSC32 /nologo -# ADD BSC32 /nologo -LINK32=link.exe -# ADD BASE LINK32 kernel32.lib /nologo /subsystem:windows /dll /incremental:no /map /debug /machine:I386 /out:"Debug/mod_alias.so" /base:@..\..\os\win32\BaseAddr.ref,mod_alias -# ADD LINK32 kernel32.lib /nologo /subsystem:windows /dll /incremental:no /map /debug /machine:I386 /out:"Debug/mod_alias.so" /base:@..\..\os\win32\BaseAddr.ref,mod_alias - -!ENDIF - -# Begin Target - -# Name "mod_alias - Win32 Release" -# Name "mod_alias - Win32 Debug" -# Begin Source File - -SOURCE=.\mod_alias.c -# End Source File -# Begin Source File - -SOURCE=.\mod_alias.rc -# End Source File -# Begin Source File - -SOURCE=..\..\build\win32\win32ver.awk - -!IF "$(CFG)" == "mod_alias - Win32 Release" - -# PROP Ignore_Default_Tool 1 -# Begin Custom Build - Creating Version Resource -InputPath=..\..\build\win32\win32ver.awk - -".\mod_alias.rc" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)" - awk -f ../../build/win32/win32ver.awk mod_alias "alias_module for Apache" ../../include/ap_release.h > .\mod_alias.rc - -# End Custom Build - -!ELSEIF "$(CFG)" == "mod_alias - Win32 Debug" - -# PROP Ignore_Default_Tool 1 -# Begin Custom Build - Creating Version Resource -InputPath=..\..\build\win32\win32ver.awk - -".\mod_alias.rc" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)" - awk -f ../../build/win32/win32ver.awk mod_alias "alias_module for Apache" ../../include/ap_release.h > .\mod_alias.rc - -# End Custom Build - -!ENDIF - -# End Source File -# End Target -# End Project diff --git a/modules/mappers/mod_alias.exp b/modules/mappers/mod_alias.exp deleted file mode 100644 index ac386ec3faaecbba99ab35935e1452b3709a3c18..0000000000000000000000000000000000000000 --- a/modules/mappers/mod_alias.exp +++ /dev/null @@ -1 +0,0 @@ -alias_module diff --git a/modules/mappers/mod_dir.c b/modules/mappers/mod_dir.c deleted file mode 100644 index a32b390a88b2f8511ee75b385df671b0978c1165..0000000000000000000000000000000000000000 --- a/modules/mappers/mod_dir.c +++ /dev/null @@ -1,246 +0,0 @@ -/* ==================================================================== - * Copyright (c) 1995-1999 The Apache Group. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in - * the documentation and/or other materials provided with the - * distribution. - * - * 3. All advertising materials mentioning features or use of this - * software must display the following acknowledgment: - * "This product includes software developed by the Apache Group - * for use in the Apache HTTP server project (http://www.apache.org/)." - * - * 4. The names "Apache Server" and "Apache Group" must not be used to - * endorse or promote products derived from this software without - * prior written permission. For written permission, please contact - * apache@apache.org. - * - * 5. Products derived from this software may not be called "Apache" - * nor may "Apache" appear in their names without prior written - * permission of the Apache Group. - * - * 6. Redistributions of any form whatsoever must retain the following - * acknowledgment: - * "This product includes software developed by the Apache Group - * for use in the Apache HTTP server project (http://www.apache.org/)." - * - * THIS SOFTWARE IS PROVIDED BY THE APACHE GROUP ``AS IS'' AND ANY - * EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR - * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE APACHE GROUP OR - * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT - * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, - * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED - * OF THE POSSIBILITY OF SUCH DAMAGE. - * ==================================================================== - * - * This software consists of voluntary contributions made by many - * individuals on behalf of the Apache Group and was originally based - * on public domain software written at the National Center for - * Supercomputing Applications, University of Illinois, Urbana-Champaign. - * For more information on the Apache Group and the Apache HTTP server - * project, please see . - * - */ - -/* - * mod_dir.c: handle default index files, and trailing-/ redirects - */ - -#include "httpd.h" -#include "http_config.h" -#include "http_core.h" -#include "http_request.h" -#include "http_protocol.h" -#include "http_log.h" -#include "http_main.h" -#include "util_script.h" - -module MODULE_VAR_EXPORT dir_module; - -typedef struct dir_config_struct { - array_header *index_names; -} dir_config_rec; - -#define DIR_CMD_PERMS OR_INDEXES - -static const char *add_index(cmd_parms *cmd, void *dummy, char *arg) -{ - dir_config_rec *d = dummy; - - if (!d->index_names) { - d->index_names = ap_make_array(cmd->pool, 2, sizeof(char *)); - } - *(char **)ap_push_array(d->index_names) = arg; - return NULL; -} - -static const command_rec dir_cmds[] = -{ - {"DirectoryIndex", add_index, NULL, - DIR_CMD_PERMS, ITERATE, - "a list of file names"}, - {NULL} -}; - -static void *create_dir_config(pool *p, char *dummy) -{ - dir_config_rec *new = - (dir_config_rec *) ap_pcalloc(p, sizeof(dir_config_rec)); - - new->index_names = NULL; - return (void *) new; -} - -static void *merge_dir_configs(pool *p, void *basev, void *addv) -{ - dir_config_rec *new = (dir_config_rec *) ap_pcalloc(p, sizeof(dir_config_rec)); - dir_config_rec *base = (dir_config_rec *) basev; - dir_config_rec *add = (dir_config_rec *) addv; - - new->index_names = add->index_names ? add->index_names : base->index_names; - return new; -} - -static int handle_dir(request_rec *r) -{ - dir_config_rec *d = - (dir_config_rec *) ap_get_module_config(r->per_dir_config, - &dir_module); - char *dummy_ptr[1]; - char **names_ptr; - int num_names; - int error_notfound = 0; - - if (r->uri[0] == '\0' || r->uri[strlen(r->uri) - 1] != '/') { - char *ifile; - if (r->args != NULL) - ifile = ap_pstrcat(r->pool, ap_escape_uri(r->pool, r->uri), - "/", "?", r->args, NULL); - else - ifile = ap_pstrcat(r->pool, ap_escape_uri(r->pool, r->uri), - "/", NULL); - - ap_table_setn(r->headers_out, "Location", - ap_construct_url(r->pool, ifile, r)); - return HTTP_MOVED_PERMANENTLY; - } - - /* KLUDGE --- make the sub_req lookups happen in the right directory. - * Fixing this in the sub_req_lookup functions themselves is difficult, - * and would probably break virtual includes... - */ - - if (r->filename[strlen(r->filename) - 1] != '/') { - r->filename = ap_pstrcat(r->pool, r->filename, "/", NULL); - } - - if (d->index_names) { - names_ptr = (char **)d->index_names->elts; - num_names = d->index_names->nelts; - } - else { - dummy_ptr[0] = DEFAULT_INDEX; - names_ptr = dummy_ptr; - num_names = 1; - } - - for (; num_names; ++names_ptr, --num_names) { - char *name_ptr = *names_ptr; - request_rec *rr = ap_sub_req_lookup_uri(name_ptr, r); - - if (rr->status == HTTP_OK && S_ISREG(rr->finfo.st_mode)) { - char *new_uri = ap_escape_uri(r->pool, rr->uri); - - if (rr->args != NULL) - new_uri = ap_pstrcat(r->pool, new_uri, "?", rr->args, NULL); - else if (r->args != NULL) - new_uri = ap_pstrcat(r->pool, new_uri, "?", r->args, NULL); - - ap_destroy_sub_req(rr); - ap_internal_redirect(new_uri, r); - return OK; - } - - /* If the request returned a redirect, propagate it to the client */ - - if (ap_is_HTTP_REDIRECT(rr->status) || - (rr->status == HTTP_NOT_ACCEPTABLE && num_names == 1)) { - - ap_pool_join(r->pool, rr->pool); - error_notfound = rr->status; - r->notes = ap_overlay_tables(r->pool, r->notes, rr->notes); - r->headers_out = ap_overlay_tables(r->pool, r->headers_out, - rr->headers_out); - r->err_headers_out = ap_overlay_tables(r->pool, r->err_headers_out, - rr->err_headers_out); - return error_notfound; - } - - /* If the request returned something other than 404 (or 200), - * it means the module encountered some sort of problem. To be - * secure, we should return the error, rather than create - * along a (possibly unsafe) directory index. - * - * So we store the error, and if none of the listed files - * exist, we return the last error response we got, instead - * of a directory listing. - */ - if (rr->status && rr->status != HTTP_NOT_FOUND && rr->status != HTTP_OK) - error_notfound = rr->status; - - ap_destroy_sub_req(rr); - } - - if (error_notfound) - return error_notfound; - - if (r->method_number != M_GET) - return DECLINED; - - /* nothing for us to do, pass on through */ - - return DECLINED; -} - - -static const handler_rec dir_handlers[] = -{ - {DIR_MAGIC_TYPE, handle_dir}, - {NULL} -}; - -module MODULE_VAR_EXPORT dir_module = -{ - STANDARD_MODULE_STUFF, - NULL, /* initializer */ - create_dir_config, /* dir config creater */ - merge_dir_configs, /* dir merger --- default is to override */ - NULL, /* server config */ - NULL, /* merge server config */ - dir_cmds, /* command table */ - dir_handlers, /* handlers */ - NULL, /* filename translation */ - NULL, /* check_user_id */ - NULL, /* check auth */ - NULL, /* check access */ - NULL, /* type_checker */ - NULL, /* fixups */ - NULL, /* logger */ - NULL, /* header parser */ - NULL, /* child_init */ - NULL, /* child_exit */ - NULL /* post read-request */ -}; diff --git a/modules/mappers/mod_dir.dsp b/modules/mappers/mod_dir.dsp deleted file mode 100644 index aad198e8817fd8f14e088fcc21376e41713c401d..0000000000000000000000000000000000000000 --- a/modules/mappers/mod_dir.dsp +++ /dev/null @@ -1,128 +0,0 @@ -# Microsoft Developer Studio Project File - Name="mod_dir" - Package Owner=<4> -# Microsoft Developer Studio Generated Build File, Format Version 6.00 -# ** DO NOT EDIT ** - -# TARGTYPE "Win32 (x86) Dynamic-Link Library" 0x0102 - -CFG=mod_dir - Win32 Release -!MESSAGE This is not a valid makefile. To build this project using NMAKE, -!MESSAGE use the Export Makefile command and run -!MESSAGE -!MESSAGE NMAKE /f "mod_dir.mak". -!MESSAGE -!MESSAGE You can specify a configuration when running NMAKE -!MESSAGE by defining the macro CFG on the command line. For example: -!MESSAGE -!MESSAGE NMAKE /f "mod_dir.mak" CFG="mod_dir - Win32 Release" -!MESSAGE -!MESSAGE Possible choices for configuration are: -!MESSAGE -!MESSAGE "mod_dir - Win32 Release" (based on "Win32 (x86) Dynamic-Link Library") -!MESSAGE "mod_dir - Win32 Debug" (based on "Win32 (x86) Dynamic-Link Library") -!MESSAGE - -# Begin Project -# PROP AllowPerConfigDependencies 0 -# PROP Scc_ProjName "" -# PROP Scc_LocalPath "" -CPP=cl.exe -MTL=midl.exe -RSC=rc.exe - -!IF "$(CFG)" == "mod_dir - Win32 Release" - -# PROP BASE Use_MFC 0 -# PROP BASE Use_Debug_Libraries 0 -# PROP BASE Output_Dir "Release" -# PROP BASE Intermediate_Dir "Release" -# PROP BASE Target_Dir "" -# PROP Use_MFC 0 -# PROP Use_Debug_Libraries 0 -# PROP Output_Dir "Release" -# PROP Intermediate_Dir "Release" -# PROP Ignore_Export_Lib 0 -# PROP Target_Dir "" -# ADD BASE CPP /nologo /MD /W3 /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /FD /c -# ADD CPP /nologo /MD /W3 /O2 /I "../../include" /I "../../srclib/apr/include" /I "../../srclib/apr-util/include" /D "NDEBUG" /D "WIN32" /D "_WINDOWS" /Fd"Release\mod_dir" /FD /c -# ADD BASE MTL /nologo /D "NDEBUG" /win32 -# ADD MTL /nologo /D "NDEBUG" /mktyplib203 /win32 -# ADD BASE RSC /l 0x409 /d "NDEBUG" -# ADD RSC /l 0x409 /d "NDEBUG" -BSC32=bscmake.exe -# ADD BASE BSC32 /nologo -# ADD BSC32 /nologo -LINK32=link.exe -# ADD BASE LINK32 kernel32.lib /nologo /subsystem:windows /dll /map /machine:I386 /out:"Release/mod_dir.so" /base:@..\..\os\win32\BaseAddr.ref,mod_dir -# ADD LINK32 kernel32.lib /nologo /subsystem:windows /dll /map /machine:I386 /out:"Release/mod_dir.so" /base:@..\..\os\win32\BaseAddr.ref,mod_dir - -!ELSEIF "$(CFG)" == "mod_dir - Win32 Debug" - -# PROP BASE Use_MFC 0 -# PROP BASE Use_Debug_Libraries 1 -# PROP BASE Output_Dir "Debug" -# PROP BASE Intermediate_Dir "Debug" -# PROP BASE Target_Dir "" -# PROP Use_MFC 0 -# PROP Use_Debug_Libraries 1 -# PROP Output_Dir "Debug" -# PROP Intermediate_Dir "Debug" -# PROP Ignore_Export_Lib 0 -# PROP Target_Dir "" -# ADD BASE CPP /nologo /MDd /W3 /GX /Zi /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /FD /c -# ADD CPP /nologo /MDd /W3 /GX /Zi /Od /I "../../include" /I "../../srclib/apr/include" /I "../../srclib/apr-util/include" /D "_DEBUG" /D "WIN32" /D "_WINDOWS" /Fd"Debug\mod_dir" /FD /c -# ADD BASE MTL /nologo /D "_DEBUG" /win32 -# ADD MTL /nologo /D "_DEBUG" /mktyplib203 /win32 -# ADD BASE RSC /l 0x409 /d "_DEBUG" -# ADD RSC /l 0x409 /d "_DEBUG" -BSC32=bscmake.exe -# ADD BASE BSC32 /nologo -# ADD BSC32 /nologo -LINK32=link.exe -# ADD BASE LINK32 kernel32.lib /nologo /subsystem:windows /dll /incremental:no /map /debug /machine:I386 /out:"Debug/mod_dir.so" /base:@..\..\os\win32\BaseAddr.ref,mod_dir -# ADD LINK32 kernel32.lib /nologo /subsystem:windows /dll /incremental:no /map /debug /machine:I386 /out:"Debug/mod_dir.so" /base:@..\..\os\win32\BaseAddr.ref,mod_dir - -!ENDIF - -# Begin Target - -# Name "mod_dir - Win32 Release" -# Name "mod_dir - Win32 Debug" -# Begin Source File - -SOURCE=.\mod_dir.c -# End Source File -# Begin Source File - -SOURCE=.\mod_dir.rc -# End Source File -# Begin Source File - -SOURCE=..\..\build\win32\win32ver.awk - -!IF "$(CFG)" == "mod_dir - Win32 Release" - -# PROP Ignore_Default_Tool 1 -# Begin Custom Build - Creating Version Resource -InputPath=..\..\build\win32\win32ver.awk - -".\mod_dir.rc" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)" - awk -f ../../build/win32/win32ver.awk mod_dir "dir_module for Apache" ../../include/ap_release.h > .\mod_dir.rc - -# End Custom Build - -!ELSEIF "$(CFG)" == "mod_dir - Win32 Debug" - -# PROP Ignore_Default_Tool 1 -# Begin Custom Build - Creating Version Resource -InputPath=..\..\build\win32\win32ver.awk - -".\mod_dir.rc" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)" - awk -f ../../build/win32/win32ver.awk mod_dir "dir_module for Apache" ../../include/ap_release.h > .\mod_dir.rc - -# End Custom Build - -!ENDIF - -# End Source File -# End Target -# End Project diff --git a/modules/mappers/mod_dir.exp b/modules/mappers/mod_dir.exp deleted file mode 100644 index 5fbf77299198ab118af432f2319387355be34a1f..0000000000000000000000000000000000000000 --- a/modules/mappers/mod_dir.exp +++ /dev/null @@ -1 +0,0 @@ -dir_module diff --git a/modules/mappers/mod_imap.c b/modules/mappers/mod_imap.c deleted file mode 100644 index c5152e71e4081e2aa42bfa8e5e58b79eede77bea..0000000000000000000000000000000000000000 --- a/modules/mappers/mod_imap.c +++ /dev/null @@ -1,919 +0,0 @@ -/* ==================================================================== - * Copyright (c) 1995-1999 The Apache Group. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in - * the documentation and/or other materials provided with the - * distribution. - * - * 3. All advertising materials mentioning features or use of this - * software must display the following acknowledgment: - * "This product includes software developed by the Apache Group - * for use in the Apache HTTP server project (http://www.apache.org/)." - * - * 4. The names "Apache Server" and "Apache Group" must not be used to - * endorse or promote products derived from this software without - * prior written permission. For written permission, please contact - * apache@apache.org. - * - * 5. Products derived from this software may not be called "Apache" - * nor may "Apache" appear in their names without prior written - * permission of the Apache Group. - * - * 6. Redistributions of any form whatsoever must retain the following - * acknowledgment: - * "This product includes software developed by the Apache Group - * for use in the Apache HTTP server project (http://www.apache.org/)." - * - * THIS SOFTWARE IS PROVIDED BY THE APACHE GROUP ``AS IS'' AND ANY - * EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR - * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE APACHE GROUP OR - * IT'S CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT - * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, - * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED - * OF THE POSSIBILITY OF SUCH DAMAGE. - * ==================================================================== - * - * This software consists of voluntary contributions made by many - * individuals on behalf of the Apache Group and was originally based - * on public domain software written at the National Center for - * Supercomputing Applications, University of Illinois, Urbana-Champaign. - * For more information on the Apache Group and the Apache HTTP server - * project, please see . - * - */ - -/* - * This imagemap module started as a port of the original imagemap.c - * written by Rob McCool (11/13/93 robm@ncsa.uiuc.edu). - * This version includes the mapping algorithms found in version 1.3 - * of imagemap.c. - * - * Contributors to this code include: - * - * Kevin Hughes, kevinh@pulua.hcc.hawaii.edu - * - * Eric Haines, erich@eye.com - * "macmartinized" polygon code copyright 1992 by Eric Haines, erich@eye.com - * - * Randy Terbush, randy@zyzzyva.com - * port to Apache module format, "base_uri" and support for relative URLs - * - * James H. Cloos, Jr., cloos@jhcloos.com - * Added point datatype, using code in NCSA's version 1.8 imagemap.c - * program, as distributed with version 1.4.1 of their server. - * The point code is originally added by Craig Milo Rogers, Rogers@ISI.Edu - * - * Nathan Kurz, nate@tripod.com - * Rewrite/reorganization. New handling of default, base and relative URLs. - * New Configuration directives: - * ImapMenu {none, formatted, semiformatted, unformatted} - * ImapDefault {error, nocontent, referer, menu, URL} - * ImapBase {map, referer, URL} - * Support for creating non-graphical menu added. (backwards compatible): - * Old: directive URL [x,y ...] - * New: directive URL "Menu text" [x,y ...] - * or: directive URL x,y ... "Menu text" - * Map format and menu concept courtesy Joshua Bell, jsbell@acs.ucalgary.ca. - * - * Mark Cox, mark@ukweb.com, Allow relative URLs even when no base specified - */ - -#include "httpd.h" -#include "http_config.h" -#include "http_request.h" -#include "http_core.h" -#include "http_protocol.h" -#include "http_main.h" -#include "http_log.h" -#include "util_script.h" - -#define IMAP_MAGIC_TYPE "application/x-httpd-imap" -#define MAXVERTS 100 -#define X 0 -#define Y 1 - -#define IMAP_MENU_DEFAULT "formatted" -#define IMAP_DEFAULT_DEFAULT "nocontent" -#define IMAP_BASE_DEFAULT "map" - -#ifdef SUNOS4 -double strtod(); /* SunOS needed this */ -#endif - -module MODULE_VAR_EXPORT imap_module; - -typedef struct { - char *imap_menu; - char *imap_default; - char *imap_base; -} imap_conf_rec; - -static void *create_imap_dir_config(pool *p, char *dummy) -{ - imap_conf_rec *icr = - (imap_conf_rec *) ap_palloc(p, sizeof(imap_conf_rec)); - - icr->imap_menu = NULL; - icr->imap_default = NULL; - icr->imap_base = NULL; - - return icr; -} - -static void *merge_imap_dir_configs(pool *p, void *basev, void *addv) -{ - imap_conf_rec *new = (imap_conf_rec *) ap_pcalloc(p, sizeof(imap_conf_rec)); - imap_conf_rec *base = (imap_conf_rec *) basev; - imap_conf_rec *add = (imap_conf_rec *) addv; - - new->imap_menu = add->imap_menu ? add->imap_menu : base->imap_menu; - new->imap_default = add->imap_default ? add->imap_default - : base->imap_default; - new->imap_base = add->imap_base ? add->imap_base : base->imap_base; - - return new; -} - - -static const command_rec imap_cmds[] = -{ - {"ImapMenu", ap_set_string_slot, - (void *) XtOffsetOf(imap_conf_rec, imap_menu), OR_INDEXES, TAKE1, - "the type of menu generated: none, formatted, semiformatted, unformatted"}, - {"ImapDefault", ap_set_string_slot, - (void *) XtOffsetOf(imap_conf_rec, imap_default), OR_INDEXES, TAKE1, - "the action taken if no match: error, nocontent, referer, menu, URL"}, - {"ImapBase", ap_set_string_slot, - (void *) XtOffsetOf(imap_conf_rec, imap_base), OR_INDEXES, TAKE1, - "the base for all URL's: map, referer, URL (or start of)"}, - {NULL} -}; - -static int pointinrect(const double point[2], double coords[MAXVERTS][2]) -{ - double max[2], min[2]; - if (coords[0][X] > coords[1][X]) { - max[0] = coords[0][X]; - min[0] = coords[1][X]; - } - else { - max[0] = coords[1][X]; - min[0] = coords[0][X]; - } - - if (coords[0][Y] > coords[1][Y]) { - max[1] = coords[0][Y]; - min[1] = coords[1][Y]; - } - else { - max[1] = coords[1][Y]; - min[1] = coords[0][Y]; - } - - return ((point[X] >= min[0] && point[X] <= max[0]) && - (point[Y] >= min[1] && point[Y] <= max[1])); -} - -static int pointincircle(const double point[2], double coords[MAXVERTS][2]) -{ - double radius1, radius2; - - radius1 = ((coords[0][Y] - coords[1][Y]) * (coords[0][Y] - coords[1][Y])) - + ((coords[0][X] - coords[1][X]) * (coords[0][X] - coords[1][X])); - - radius2 = ((coords[0][Y] - point[Y]) * (coords[0][Y] - point[Y])) - + ((coords[0][X] - point[X]) * (coords[0][X] - point[X])); - - return (radius2 <= radius1); -} - -#define fmin(a,b) (((a)>(b))?(b):(a)) -#define fmax(a,b) (((a)>(b))?(a):(b)) - -static int pointinpoly(const double point[2], double pgon[MAXVERTS][2]) -{ - int i, numverts, crossings = 0; - double x = point[X], y = point[Y]; - - for (numverts = 0; pgon[numverts][X] != -1 && numverts < MAXVERTS; - numverts++) { - /* just counting the vertexes */ - } - - for (i = 0; i < numverts; i++) { - double x1=pgon[i][X]; - double y1=pgon[i][Y]; - double x2=pgon[(i + 1) % numverts][X]; - double y2=pgon[(i + 1) % numverts][Y]; - double d=(y - y1) * (x2 - x1) - (x - x1) * (y2 - y1); - - if ((y1 >= y) != (y2 >= y)) { - crossings +=y2 - y1 >= 0 ? d >= 0 : d <= 0; - } - if (!d && fmin(x1,x2) <= x && x <= fmax(x1,x2) - && fmin(y1,y2) <= y && y <= fmax(y1,y2)) { - return 1; - } - } - return crossings & 0x01; -} - - -static int is_closer(const double point[2], double coords[MAXVERTS][2], - double *closest) -{ - double dist_squared = ((point[X] - coords[0][X]) - * (point[X] - coords[0][X])) - + ((point[Y] - coords[0][Y]) - * (point[Y] - coords[0][Y])); - - if (point[X] < 0 || point[Y] < 0) { - return (0); /* don't mess around with negative coordinates */ - } - - if (*closest < 0 || dist_squared < *closest) { - *closest = dist_squared; - return (1); /* if this is the first point or is the closest yet - set 'closest' equal to this distance^2 */ - } - - return (0); /* if it's not the first or closest */ - -} - -static double get_x_coord(const char *args) -{ - char *endptr; /* we want it non-null */ - double x_coord = -1; /* -1 is returned if no coordinate is given */ - - if (args == NULL) { - return (-1); /* in case we aren't passed anything */ - } - - while (*args && !ap_isdigit(*args) && *args != ',') { - args++; /* jump to the first digit, but not past - a comma or end */ - } - - x_coord = strtod(args, &endptr); - - if (endptr > args) { /* if a conversion was made */ - return (x_coord); - } - - return (-1); /* else if no conversion was made, - or if no args was given */ -} - -static double get_y_coord(const char *args) -{ - char *endptr; /* we want it non-null */ - char *start_of_y = NULL; - double y_coord = -1; /* -1 is returned on error */ - - if (args == NULL) { - return (-1); /* in case we aren't passed anything */ - } - - start_of_y = strchr(args, ','); /* the comma */ - - if (start_of_y) { - - start_of_y++; /* start looking at the character after - the comma */ - - while (*start_of_y && !ap_isdigit(*start_of_y)) { - start_of_y++; /* jump to the first digit, but not - past the end */ - } - - y_coord = strtod(start_of_y, &endptr); - - if (endptr > start_of_y) { - return (y_coord); - } - } - - return (-1); /* if no conversion was made, or - no comma was found in args */ -} - - -/* See if string has a "quoted part", and if so set *quoted_part to - * the first character of the quoted part, then hammer a \0 onto the - * trailing quote, and set *string to point at the first character - * past the second quote. - * - * Otherwise set *quoted_part to NULL, and leave *string alone. - */ -static void read_quoted(char **string, char **quoted_part) -{ - char *strp = *string; - - /* assume there's no quoted part */ - *quoted_part = NULL; - - while (ap_isspace(*strp)) { - strp++; /* go along string until non-whitespace */ - } - - if (*strp == '"') { /* if that character is a double quote */ - strp++; /* step over it */ - *quoted_part = strp; /* note where the quoted part begins */ - - while (*strp && *strp != '"') { - ++strp; /* skip the quoted portion */ - } - - *strp = '\0'; /* end the string with a NUL */ - - strp++; /* step over the last double quote */ - *string = strp; - } -} - -/* - * returns the mapped URL or NULL. - */ -static char *imap_url(request_rec *r, const char *base, const char *value) -{ -/* translates a value into a URL. */ - int slen, clen; - char *string_pos = NULL; - const char *string_pos_const = NULL; - char *directory = NULL; - const char *referer = NULL; - char *my_base; - - if (!strcasecmp(value, "map") || !strcasecmp(value, "menu")) { - return ap_construct_url(r->pool, r->uri, r); - } - - if (!strcasecmp(value, "nocontent") || !strcasecmp(value, "error")) { - return ap_pstrdup(r->pool, value); /* these are handled elsewhere, - so just copy them */ - } - - if (!strcasecmp(value, "referer")) { - referer = ap_table_get(r->headers_in, "Referer"); - if (referer && *referer) { - return ap_pstrdup(r->pool, referer); - } - else { - /* XXX: This used to do *value = '\0'; ... which is totally bogus - * because it hammers the passed in value, which can be a string - * constant, or part of a config, or whatever. Total garbage. - * This works around that without changing the rest of this - * code much - */ - value = ""; /* if 'referer' but no referring page, - null the value */ - } - } - - string_pos_const = value; - while (ap_isalpha(*string_pos_const)) { - string_pos_const++; /* go along the URL from the map - until a non-letter */ - } - if (*string_pos_const == ':') { - /* if letters and then a colon (like http:) */ - /* it's an absolute URL, so use it! */ - return ap_pstrdup(r->pool, value); - } - - if (!base || !*base) { - if (value && *value) { - return ap_pstrdup(r->pool, value); /* no base: use what is given */ - } - /* no base, no value: pick a simple default */ - return ap_construct_url(r->pool, "/", r); - } - - /* must be a relative URL to be combined with base */ - if (strchr(base, '/') == NULL && (!strncmp(value, "../", 3) - || !strcmp(value, ".."))) { - ap_log_rerror(APLOG_MARK, APLOG_NOERRNO|APLOG_ERR, r, - "invalid base directive in map file: %s", r->uri); - return NULL; - } - my_base = ap_pstrdup(r->pool, base); - string_pos = my_base; - while (*string_pos) { - if (*string_pos == '/' && *(string_pos + 1) == '/') { - string_pos += 2; /* if there are two slashes, jump over them */ - continue; - } - if (*string_pos == '/') { /* the first single slash */ - if (value[0] == '/') { - *string_pos = '\0'; - } /* if the URL from the map starts from root, - end the base URL string at the first single - slash */ - else { - directory = string_pos; /* save the start of - the directory portion */ - - string_pos = strrchr(string_pos, '/'); /* now reuse - string_pos */ - string_pos++; /* step over that last slash */ - *string_pos = '\0'; - } /* but if the map url is relative, leave the - slash on the base (if there is one) */ - break; - } - string_pos++; /* until we get to the end of my_base without - finding a slash by itself */ - } - - while (!strncmp(value, "../", 3) || !strcmp(value, "..")) { - - if (directory && (slen = strlen(directory))) { - - /* for each '..', knock a directory off the end - by ending the string right at the last slash. - But only consider the directory portion: don't eat - into the server name. And only try if a directory - portion was found */ - - clen = slen - 1; - - while ((slen - clen) == 1) { - - if ((string_pos = strrchr(directory, '/'))) { - *string_pos = '\0'; - } - clen = strlen(directory); - if (clen == 0) { - break; - } - } - - value += 2; /* jump over the '..' that we found in the - value */ - } - else if (directory) { - ap_log_rerror(APLOG_MARK, APLOG_NOERRNO|APLOG_ERR, r, - "invalid directory name in map file: %s", r->uri); - return NULL; - } - - if (!strncmp(value, "/../", 4) || !strcmp(value, "/..")) { - value++; /* step over the '/' if there are more '..' - to do. This way, we leave the starting - '/' on value after the last '..', but get - rid of it otherwise */ - } - - } /* by this point, value does not start - with '..' */ - - if (value && *value) { - return ap_pstrcat(r->pool, my_base, value, NULL); - } - return my_base; -} - -static int imap_reply(request_rec *r, char *redirect) -{ - if (!strcasecmp(redirect, "error")) { - return SERVER_ERROR; /* they actually requested an error! */ - } - if (!strcasecmp(redirect, "nocontent")) { - return HTTP_NO_CONTENT; /* tell the client to keep the page it has */ - } - if (redirect && *redirect) { - ap_table_setn(r->headers_out, "Location", redirect); - return REDIRECT; /* must be a URL, so redirect to it */ - } - return SERVER_ERROR; -} - -static void menu_header(request_rec *r, char *menu) -{ - r->content_type = "text/html"; - ap_send_http_header(r); - ap_hard_timeout("send menu", r); /* killed in menu_footer */ - - ap_rvputs(r, DOCTYPE_HTML_3_2, "\nMenu for ", r->uri, - "\n\n", NULL); - - if (!strcasecmp(menu, "formatted")) { - ap_rvputs(r, "

    Menu for ", r->uri, "

    \n
    \n\n", NULL); - } - - return; -} - -static void menu_blank(request_rec *r, char *menu) -{ - if (!strcasecmp(menu, "formatted")) { - ap_rputs("\n", r); - } - if (!strcasecmp(menu, "semiformatted")) { - ap_rputs("
    \n", r); - } - if (!strcasecmp(menu, "unformatted")) { - ap_rputs("\n", r); - } - return; -} - -static void menu_comment(request_rec *r, char *menu, char *comment) -{ - if (!strcasecmp(menu, "formatted")) { - ap_rputs("\n", r); /* print just a newline if 'formatted' */ - } - if (!strcasecmp(menu, "semiformatted") && *comment) { - ap_rvputs(r, comment, "\n", NULL); - } - if (!strcasecmp(menu, "unformatted") && *comment) { - ap_rvputs(r, comment, "\n", NULL); - } - return; /* comments are ignored in the - 'formatted' form */ -} - -static void menu_default(request_rec *r, char *menu, char *href, char *text) -{ - if (!strcasecmp(href, "error") || !strcasecmp(href, "nocontent")) { - return; /* don't print such lines, these aren't - really href's */ - } - if (!strcasecmp(menu, "formatted")) { - ap_rvputs(r, "
    (Default) ", text,
    -               "
    \n", NULL); - } - if (!strcasecmp(menu, "semiformatted")) { - ap_rvputs(r, "
    (Default) ", text,
    -               "
    \n", NULL); - } - if (!strcasecmp(menu, "unformatted")) { - ap_rvputs(r, "", text, "", NULL); - } - return; -} - -static void menu_directive(request_rec *r, char *menu, char *href, char *text) -{ - if (!strcasecmp(href, "error") || !strcasecmp(href, "nocontent")) { - return; /* don't print such lines, as this isn't - really an href */ - } - if (!strcasecmp(menu, "formatted")) { - ap_rvputs(r, "
              ", text,
    -               "
    \n", NULL); - } - if (!strcasecmp(menu, "semiformatted")) { - ap_rvputs(r, "
              ", text,
    -               "
    \n", NULL); - } - if (!strcasecmp(menu, "unformatted")) { - ap_rvputs(r, "", text, "", NULL); - } - return; -} - -static void menu_footer(request_rec *r) -{ - ap_rputs("\n\n\n\n", r); /* finish the menu */ - ap_kill_timeout(r); -} - -static int imap_handler(request_rec *r) -{ - char input[MAX_STRING_LEN]; - char *directive; - char *value; - char *href_text; - char *base; - char *redirect; - char *mapdflt; - char *closest = NULL; - double closest_yet = -1; - - double testpoint[2]; - double pointarray[MAXVERTS + 1][2]; - int vertex; - - char *string_pos; - int showmenu = 0; - - imap_conf_rec *icr = ap_get_module_config(r->per_dir_config, &imap_module); - - char *imap_menu = icr->imap_menu ? icr->imap_menu : IMAP_MENU_DEFAULT; - char *imap_default = icr->imap_default - ? icr->imap_default : IMAP_DEFAULT_DEFAULT; - char *imap_base = icr->imap_base ? icr->imap_base : IMAP_BASE_DEFAULT; - - configfile_t *imap; - - if (r->method_number != M_GET) { - return DECLINED; - } - - imap = ap_pcfg_openfile(r->pool, r->filename); - - if (!imap) { - return NOT_FOUND; - } - - base = imap_url(r, NULL, imap_base); /* set base according - to default */ - if (!base) { - return HTTP_INTERNAL_SERVER_ERROR; - } - mapdflt = imap_url(r, NULL, imap_default); /* and default to - global default */ - if (!mapdflt) { - return HTTP_INTERNAL_SERVER_ERROR; - } - - testpoint[X] = get_x_coord(r->args); - testpoint[Y] = get_y_coord(r->args); - - if ((testpoint[X] == -1 || testpoint[Y] == -1) || - (testpoint[X] == 0 && testpoint[Y] == 0)) { - /* if either is -1 or if both are zero (new Lynx) */ - /* we don't have valid coordinates */ - testpoint[X] = -1; - testpoint[Y] = -1; - if (strncasecmp(imap_menu, "none", 2)) { - showmenu = 1; /* show the menu _unless_ ImapMenu is - 'none' or 'no' */ - } - } - - if (showmenu) { /* send start of imagemap menu if - we're going to */ - menu_header(r, imap_menu); - } - - while (!ap_cfg_getline(input, sizeof(input), imap)) { - if (!input[0]) { - if (showmenu) { - menu_blank(r, imap_menu); - } - continue; - } - - if (input[0] == '#') { - if (showmenu) { - menu_comment(r, imap_menu, input + 1); - } - continue; - } /* blank lines and comments are ignored - if we aren't printing a menu */ - - /* find the first two space delimited fields, recall that - * ap_cfg_getline has removed leading/trailing whitespace. - * - * note that we're tokenizing as we go... if we were to use the - * ap_getword() class of functions we would end up allocating extra - * memory for every line of the map file - */ - string_pos = input; - if (!*string_pos) { /* need at least two fields */ - goto need_2_fields; - } - - directive = string_pos; - while (*string_pos && !ap_isspace(*string_pos)) { /* past directive */ - ++string_pos; - } - if (!*string_pos) { /* need at least two fields */ - goto need_2_fields; - } - *string_pos++ = '\0'; - - if (!*string_pos) { /* need at least two fields */ - goto need_2_fields; - } - while(*string_pos && ap_isspace(*string_pos)) { /* past whitespace */ - ++string_pos; - } - - value = string_pos; - while (*string_pos && !ap_isspace(*string_pos)) { /* past value */ - ++string_pos; - } - if (ap_isspace(*string_pos)) { - *string_pos++ = '\0'; - } - else { - /* end of input, don't advance past it */ - *string_pos = '\0'; - } - - if (!strncasecmp(directive, "base", 4)) { /* base, base_uri */ - base = imap_url(r, NULL, value); - if (!base) { - goto menu_bail; - } - continue; /* base is never printed to a menu */ - } - - read_quoted(&string_pos, &href_text); - - if (!strcasecmp(directive, "default")) { /* default */ - mapdflt = imap_url(r, NULL, value); - if (!mapdflt) { - goto menu_bail; - } - if (showmenu) { /* print the default if there's a menu */ - redirect = imap_url(r, base, mapdflt); - if (!redirect) { - goto menu_bail; - } - menu_default(r, imap_menu, redirect, - href_text ? href_text : mapdflt); - } - continue; - } - - vertex = 0; - while (vertex < MAXVERTS && - sscanf(string_pos, "%lf%*[, ]%lf", - &pointarray[vertex][X], &pointarray[vertex][Y]) == 2) { - /* Now skip what we just read... we can't use ANSIism %n */ - while (ap_isspace(*string_pos)) { /* past whitespace */ - string_pos++; - } - while (ap_isdigit(*string_pos)) { /* and the 1st number */ - string_pos++; - } - string_pos++; /* skip the ',' */ - while (ap_isspace(*string_pos)) { /* past any more whitespace */ - string_pos++; - } - while (ap_isdigit(*string_pos)) { /* 2nd number */ - string_pos++; - } - vertex++; - } /* so long as there are more vertices to - read, and we have room, read them in. - We start where we left off of the last - sscanf, not at the beginning. */ - - pointarray[vertex][X] = -1; /* signals the end of vertices */ - - if (showmenu) { - if (!href_text) { - read_quoted(&string_pos, &href_text); /* href text could - be here instead */ - } - redirect = imap_url(r, base, value); - if (!redirect) { - goto menu_bail; - } - menu_directive(r, imap_menu, redirect, - href_text ? href_text : value); - continue; - } - /* note that we don't make it past here if we are making a menu */ - - if (testpoint[X] == -1 || pointarray[0][X] == -1) { - continue; /* don't try the following tests if testpoints - are invalid, or if there are no - coordinates */ - } - - if (!strcasecmp(directive, "poly")) { /* poly */ - - if (pointinpoly(testpoint, pointarray)) { - ap_cfg_closefile(imap); - redirect = imap_url(r, base, value); - if (!redirect) { - return HTTP_INTERNAL_SERVER_ERROR; - } - return (imap_reply(r, redirect)); - } - continue; - } - - if (!strcasecmp(directive, "circle")) { /* circle */ - - if (pointincircle(testpoint, pointarray)) { - ap_cfg_closefile(imap); - redirect = imap_url(r, base, value); - if (!redirect) { - return HTTP_INTERNAL_SERVER_ERROR; - } - return (imap_reply(r, redirect)); - } - continue; - } - - if (!strcasecmp(directive, "rect")) { /* rect */ - - if (pointinrect(testpoint, pointarray)) { - ap_cfg_closefile(imap); - redirect = imap_url(r, base, value); - if (!redirect) { - return HTTP_INTERNAL_SERVER_ERROR; - } - return (imap_reply(r, redirect)); - } - continue; - } - - if (!strcasecmp(directive, "point")) { /* point */ - - if (is_closer(testpoint, pointarray, &closest_yet)) { - closest = ap_pstrdup(r->pool, value); - } - - continue; - } /* move on to next line whether it's - closest or not */ - - } /* nothing matched, so we get another line! */ - - ap_cfg_closefile(imap); /* we are done with the map file; close it */ - - if (showmenu) { - menu_footer(r); /* finish the menu and we are done */ - return OK; - } - - if (closest) { /* if a 'point' directive has been seen */ - redirect = imap_url(r, base, closest); - if (!redirect) { - return HTTP_INTERNAL_SERVER_ERROR; - } - return (imap_reply(r, redirect)); - } - - if (mapdflt) { /* a default should be defined, even if - only 'nocontent' */ - redirect = imap_url(r, base, mapdflt); - if (!redirect) { - return HTTP_INTERNAL_SERVER_ERROR; - } - return (imap_reply(r, redirect)); - } - - return HTTP_INTERNAL_SERVER_ERROR; /* If we make it this far, - we failed. They lose! */ - -need_2_fields: - ap_log_rerror(APLOG_MARK, APLOG_NOERRNO|APLOG_ERR, r, - "map file %s, line %d syntax error: requires at " - "least two fields", r->uri, imap->line_number); - /* fall through */ -menu_bail: - ap_cfg_closefile(imap); - if (showmenu) { - /* There's not much else we can do ... we've already sent the headers - * to the client. - */ - ap_rputs("\n\n[an internal server error occured]\n", r); - menu_footer(r); - return OK; - } - return HTTP_INTERNAL_SERVER_ERROR; -} - - -static const handler_rec imap_handlers[] = -{ - {IMAP_MAGIC_TYPE, imap_handler}, - {"imap-file", imap_handler}, - {NULL} -}; - -module MODULE_VAR_EXPORT imap_module = -{ - STANDARD_MODULE_STUFF, - NULL, /* initializer */ - create_imap_dir_config, /* dir config creater */ - merge_imap_dir_configs, /* dir merger --- default is to override */ - NULL, /* server config */ - NULL, /* merge server config */ - imap_cmds, /* command table */ - imap_handlers, /* handlers */ - NULL, /* filename translation */ - NULL, /* check_user_id */ - NULL, /* check auth */ - NULL, /* check access */ - NULL, /* type_checker */ - NULL, /* fixups */ - NULL, /* logger */ - NULL, /* header parser */ - NULL, /* child_init */ - NULL, /* child_exit */ - NULL /* post read-request */ -}; diff --git a/modules/mappers/mod_imap.dsp b/modules/mappers/mod_imap.dsp deleted file mode 100644 index 94570696f62067fb7204af66376187f63fc76935..0000000000000000000000000000000000000000 --- a/modules/mappers/mod_imap.dsp +++ /dev/null @@ -1,128 +0,0 @@ -# Microsoft Developer Studio Project File - Name="mod_imap" - Package Owner=<4> -# Microsoft Developer Studio Generated Build File, Format Version 6.00 -# ** DO NOT EDIT ** - -# TARGTYPE "Win32 (x86) Dynamic-Link Library" 0x0102 - -CFG=mod_imap - Win32 Release -!MESSAGE This is not a valid makefile. To build this project using NMAKE, -!MESSAGE use the Export Makefile command and run -!MESSAGE -!MESSAGE NMAKE /f "mod_imap.mak". -!MESSAGE -!MESSAGE You can specify a configuration when running NMAKE -!MESSAGE by defining the macro CFG on the command line. For example: -!MESSAGE -!MESSAGE NMAKE /f "mod_imap.mak" CFG="mod_imap - Win32 Release" -!MESSAGE -!MESSAGE Possible choices for configuration are: -!MESSAGE -!MESSAGE "mod_imap - Win32 Release" (based on "Win32 (x86) Dynamic-Link Library") -!MESSAGE "mod_imap - Win32 Debug" (based on "Win32 (x86) Dynamic-Link Library") -!MESSAGE - -# Begin Project -# PROP AllowPerConfigDependencies 0 -# PROP Scc_ProjName "" -# PROP Scc_LocalPath "" -CPP=cl.exe -MTL=midl.exe -RSC=rc.exe - -!IF "$(CFG)" == "mod_imap - Win32 Release" - -# PROP BASE Use_MFC 0 -# PROP BASE Use_Debug_Libraries 0 -# PROP BASE Output_Dir "Release" -# PROP BASE Intermediate_Dir "Release" -# PROP BASE Target_Dir "" -# PROP Use_MFC 0 -# PROP Use_Debug_Libraries 0 -# PROP Output_Dir "Release" -# PROP Intermediate_Dir "Release" -# PROP Ignore_Export_Lib 0 -# PROP Target_Dir "" -# ADD BASE CPP /nologo /MD /W3 /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /FD /c -# ADD CPP /nologo /MD /W3 /O2 /I "../../include" /I "../../srclib/apr/include" /I "../../srclib/apr-util/include" /D "NDEBUG" /D "WIN32" /D "_WINDOWS" /Fd"Release\mod_imap" /FD /c -# ADD BASE MTL /nologo /D "NDEBUG" /win32 -# ADD MTL /nologo /D "NDEBUG" /mktyplib203 /win32 -# ADD BASE RSC /l 0x409 /d "NDEBUG" -# ADD RSC /l 0x409 /d "NDEBUG" -BSC32=bscmake.exe -# ADD BASE BSC32 /nologo -# ADD BSC32 /nologo -LINK32=link.exe -# ADD BASE LINK32 kernel32.lib /nologo /subsystem:windows /dll /map /machine:I386 /out:"Release/mod_imap.so" /base:@..\..\os\win32\BaseAddr.ref,mod_imap -# ADD LINK32 kernel32.lib /nologo /subsystem:windows /dll /map /machine:I386 /out:"Release/mod_imap.so" /base:@..\..\os\win32\BaseAddr.ref,mod_imap - -!ELSEIF "$(CFG)" == "mod_imap - Win32 Debug" - -# PROP BASE Use_MFC 0 -# PROP BASE Use_Debug_Libraries 1 -# PROP BASE Output_Dir "Debug" -# PROP BASE Intermediate_Dir "Debug" -# PROP BASE Target_Dir "" -# PROP Use_MFC 0 -# PROP Use_Debug_Libraries 1 -# PROP Output_Dir "Debug" -# PROP Intermediate_Dir "Debug" -# PROP Ignore_Export_Lib 0 -# PROP Target_Dir "" -# ADD BASE CPP /nologo /MDd /W3 /GX /Zi /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /FD /c -# ADD CPP /nologo /MDd /W3 /GX /Zi /Od /I "../../include" /I "../../srclib/apr/include" /I "../../srclib/apr-util/include" /D "_DEBUG" /D "WIN32" /D "_WINDOWS" /Fd"Debug\mod_imap" /FD /c -# ADD BASE MTL /nologo /D "_DEBUG" /win32 -# ADD MTL /nologo /D "_DEBUG" /mktyplib203 /win32 -# ADD BASE RSC /l 0x409 /d "_DEBUG" -# ADD RSC /l 0x409 /d "_DEBUG" -BSC32=bscmake.exe -# ADD BASE BSC32 /nologo -# ADD BSC32 /nologo -LINK32=link.exe -# ADD BASE LINK32 kernel32.lib /nologo /subsystem:windows /dll /incremental:no /map /debug /machine:I386 /out:"Debug/mod_imap.so" /base:@..\..\os\win32\BaseAddr.ref,mod_imap -# ADD LINK32 kernel32.lib /nologo /subsystem:windows /dll /incremental:no /map /debug /machine:I386 /out:"Debug/mod_imap.so" /base:@..\..\os\win32\BaseAddr.ref,mod_imap - -!ENDIF - -# Begin Target - -# Name "mod_imap - Win32 Release" -# Name "mod_imap - Win32 Debug" -# Begin Source File - -SOURCE=.\mod_imap.c -# End Source File -# Begin Source File - -SOURCE=.\mod_imap.rc -# End Source File -# Begin Source File - -SOURCE=..\..\build\win32\win32ver.awk - -!IF "$(CFG)" == "mod_imap - Win32 Release" - -# PROP Ignore_Default_Tool 1 -# Begin Custom Build - Creating Version Resource -InputPath=..\..\build\win32\win32ver.awk - -".\mod_imap.rc" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)" - awk -f ../../build/win32/win32ver.awk mod_imap "imap_module for Apache" ../../include/ap_release.h > .\mod_imap.rc - -# End Custom Build - -!ELSEIF "$(CFG)" == "mod_imap - Win32 Debug" - -# PROP Ignore_Default_Tool 1 -# Begin Custom Build - Creating Version Resource -InputPath=..\..\build\win32\win32ver.awk - -".\mod_imap.rc" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)" - awk -f ../../build/win32/win32ver.awk mod_imap "imap_module for Apache" ../../include/ap_release.h > .\mod_imap.rc - -# End Custom Build - -!ENDIF - -# End Source File -# End Target -# End Project diff --git a/modules/mappers/mod_imap.exp b/modules/mappers/mod_imap.exp deleted file mode 100644 index 1e0e0b83d09f937c03f9597005cffab17cef92a2..0000000000000000000000000000000000000000 --- a/modules/mappers/mod_imap.exp +++ /dev/null @@ -1 +0,0 @@ -imap_module diff --git a/modules/mappers/mod_negotiation.c b/modules/mappers/mod_negotiation.c deleted file mode 100644 index 5f7411260c2d029cd3df629e8ba3f31dfd53bf5f..0000000000000000000000000000000000000000 --- a/modules/mappers/mod_negotiation.c +++ /dev/null @@ -1,2748 +0,0 @@ -/* ==================================================================== - * Copyright (c) 1995-1999 The Apache Group. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in - * the documentation and/or other materials provided with the - * distribution. - * - * 3. All advertising materials mentioning features or use of this - * software must display the following acknowledgment: - * "This product includes software developed by the Apache Group - * for use in the Apache HTTP server project (http://www.apache.org/)." - * - * 4. The names "Apache Server" and "Apache Group" must not be used to - * endorse or promote products derived from this software without - * prior written permission. For written permission, please contact - * apache@apache.org. - * - * 5. Products derived from this software may not be called "Apache" - * nor may "Apache" appear in their names without prior written - * permission of the Apache Group. - * - * 6. Redistributions of any form whatsoever must retain the following - * acknowledgment: - * "This product includes software developed by the Apache Group - * for use in the Apache HTTP server project (http://www.apache.org/)." - * - * THIS SOFTWARE IS PROVIDED BY THE APACHE GROUP ``AS IS'' AND ANY - * EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR - * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE APACHE GROUP OR - * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT - * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, - * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED - * OF THE POSSIBILITY OF SUCH DAMAGE. - * ==================================================================== - * - * This software consists of voluntary contributions made by many - * individuals on behalf of the Apache Group and was originally based - * on public domain software written at the National Center for - * Supercomputing Applications, University of Illinois, Urbana-Champaign. - * For more information on the Apache Group and the Apache HTTP server - * project, please see . - * - */ - -/* - * mod_negotiation.c: keeps track of MIME types the client is willing to - * accept, and contains code to handle type arbitration. - * - * rst - */ - -#include "httpd.h" -#include "http_config.h" -#include "http_request.h" -#include "http_protocol.h" -#include "http_core.h" -#include "http_log.h" -#include "util_script.h" - -/* Commands --- configuring document caching on a per (virtual?) - * server basis... - */ - -typedef struct { - array_header *language_priority; -} neg_dir_config; - -module MODULE_VAR_EXPORT negotiation_module; - -static void *create_neg_dir_config(pool *p, char *dummy) -{ - neg_dir_config *new = (neg_dir_config *) ap_palloc(p, sizeof(neg_dir_config)); - - new->language_priority = ap_make_array(p, 4, sizeof(char *)); - return new; -} - -static void *merge_neg_dir_configs(pool *p, void *basev, void *addv) -{ - neg_dir_config *base = (neg_dir_config *) basev; - neg_dir_config *add = (neg_dir_config *) addv; - neg_dir_config *new = (neg_dir_config *) ap_palloc(p, sizeof(neg_dir_config)); - - /* give priority to the config in the subdirectory */ - new->language_priority = ap_append_arrays(p, add->language_priority, - base->language_priority); - return new; -} - -static const char *set_language_priority(cmd_parms *cmd, void *n, char *lang) -{ - array_header *arr = ((neg_dir_config *) n)->language_priority; - char **langp = (char **) ap_push_array(arr); - - *langp = lang; - return NULL; -} - -static const char *cache_negotiated_docs(cmd_parms *cmd, void *dummy, - char *dummy2) -{ - void *server_conf = cmd->server->module_config; - - ap_set_module_config(server_conf, &negotiation_module, "Cache"); - return NULL; -} - -static int do_cache_negotiated_docs(server_rec *s) -{ - return (ap_get_module_config(s->module_config, &negotiation_module) != NULL); -} - -static const command_rec negotiation_cmds[] = -{ - {"CacheNegotiatedDocs", cache_negotiated_docs, NULL, RSRC_CONF, NO_ARGS, - "no arguments (either present or absent)"}, - {"LanguagePriority", set_language_priority, NULL, OR_FILEINFO, ITERATE, - "space-delimited list of MIME language abbreviations"}, - {NULL} -}; - -/* - * Record of available info on a media type specified by the client - * (we also use 'em for encodings and languages) - */ - -typedef struct accept_rec { - char *name; /* MUST be lowercase */ - float quality; - float level; - char *charset; /* for content-type only */ -} accept_rec; - -/* - * Record of available info on a particular variant - * - * Note that a few of these fields are updated by the actual negotiation - * code. These are: - * - * level_matched --- initialized to zero. Set to the value of level - * if the client actually accepts this media type at that - * level (and *not* if it got in on a wildcard). See level_cmp - * below. - * mime_stars -- initialized to zero. Set to the number of stars - * present in the best matching Accept header element. - * 1 for star/star, 2 for type/star and 3 for - * type/subtype. - * - * definite -- initialized to 1. Set to 0 if there is a match which - * makes the variant non-definite according to the rules - * in rfc2296. - */ - -typedef struct var_rec { - request_rec *sub_req; /* May be NULL (is, for map files) */ - char *mime_type; /* MUST be lowercase */ - char *file_name; - const char *content_encoding; - array_header *content_languages; /* list of languages for this variant */ - char *content_charset; - char *description; - - /* The next five items give the quality values for the dimensions - * of negotiation for this variant. They are obtained from the - * appropriate header lines, except for source_quality, which - * is obtained from the variant itself (the 'qs' parameter value - * from the variant's mime-type). Apart from source_quality, - * these values are set when we find the quality for each variant - * (see best_match()). source_quality is set from the 'qs' parameter - * of the variant description or mime type: see set_mime_fields(). - */ - float lang_quality; /* quality of this variant's language */ - float encoding_quality; /* ditto encoding */ - float charset_quality; /* ditto charset */ - float mime_type_quality; /* ditto media type */ - float source_quality; /* source quality for this variant */ - - /* Now some special values */ - float level; /* Auxiliary to content-type... */ - float bytes; /* content length, if known */ - int lang_index; /* pre HTTP/1.1 language priority stuff */ - int is_pseudo_html; /* text/html, *or* the INCLUDES_MAGIC_TYPEs */ - - /* Above are all written-once properties of the variant. The - * three fields below are changed during negotiation: - */ - - float level_matched; - int mime_stars; - int definite; -} var_rec; - -/* Something to carry around the state of negotiation (and to keep - * all of this thread-safe)... - */ - -typedef struct { - pool *pool; - request_rec *r; - char *dir_name; - int accept_q; /* 1 if an Accept item has a q= param */ - float default_lang_quality; /* fiddle lang q for variants with no lang */ - - /* the array pointers below are NULL if the corresponding accept - * headers are not present - */ - array_header *accepts; /* accept_recs */ - array_header *accept_encodings; /* accept_recs */ - array_header *accept_charsets; /* accept_recs */ - array_header *accept_langs; /* accept_recs */ - - array_header *avail_vars; /* available variants */ - - int count_multiviews_variants; /* number of variants found on disk */ - - int is_transparent; /* 1 if this resource is trans. negotiable */ - - int dont_fiddle_headers; /* 1 if we may not fiddle with accept hdrs */ - int ua_supports_trans; /* 1 if ua supports trans negotiation */ - int send_alternates; /* 1 if we want to send an Alternates header */ - int may_choose; /* 1 if we may choose a variant for the client */ - int use_rvsa; /* 1 if we must use RVSA/1.0 negotiation algo */ -} negotiation_state; - -/* A few functions to manipulate var_recs. - * Cleaning out the fields... - */ - -static void clean_var_rec(var_rec *mime_info) -{ - mime_info->sub_req = NULL; - mime_info->mime_type = ""; - mime_info->file_name = ""; - mime_info->content_encoding = NULL; - mime_info->content_languages = NULL; - mime_info->content_charset = ""; - mime_info->description = ""; - - mime_info->is_pseudo_html = 0; - mime_info->level = 0.0f; - mime_info->level_matched = 0.0f; - mime_info->bytes = 0.0f; - mime_info->lang_index = -1; - mime_info->mime_stars = 0; - mime_info->definite = 1; - - mime_info->charset_quality = 1.0f; - mime_info->encoding_quality = 1.0f; - mime_info->lang_quality = 1.0f; - mime_info->mime_type_quality = 1.0f; - mime_info->source_quality = 0.0f; -} - -/* Initializing the relevant fields of a variant record from the - * accept_info read out of its content-type, one way or another. - */ - -static void set_mime_fields(var_rec *var, accept_rec *mime_info) -{ - var->mime_type = mime_info->name; - var->source_quality = mime_info->quality; - var->level = mime_info->level; - var->content_charset = mime_info->charset; - - var->is_pseudo_html = (!strcmp(var->mime_type, "text/html") - || !strcmp(var->mime_type, INCLUDES_MAGIC_TYPE) - || !strcmp(var->mime_type, INCLUDES_MAGIC_TYPE3)); -} - -/* Create a variant list validator in r using info from vlistr. */ - -static void set_vlist_validator(request_rec *r, request_rec *vlistr) -{ - /* Calculating the variant list validator is similar to - * calculating an etag for the source of the variant list - * information, so we use ap_make_etag(). Note that this - * validator can be 'weak' in extreme case. - */ - - ap_update_mtime (vlistr, vlistr->finfo.st_mtime); - r->vlist_validator = ap_make_etag(vlistr, 0); - - /* ap_set_etag will later take r->vlist_validator into account - * when creating the etag header - */ -} - - -/***************************************************************** - * - * Parsing (lists of) media types and their parameters, as seen in - * HTTPD header lines and elsewhere. - */ - -/* - * Get a single mime type entry --- one media type and parameters; - * enter the values we recognize into the argument accept_rec - */ - -static const char *get_entry(pool *p, accept_rec *result, - const char *accept_line) -{ - result->quality = 1.0f; - result->level = 0.0f; - result->charset = ""; - - /* - * Note that this handles what I gather is the "old format", - * - * Accept: text/html text/plain moo/zot - * - * without any compatibility kludges --- if the token after the - * MIME type begins with a semicolon, we know we're looking at parms, - * otherwise, we know we aren't. (So why all the pissing and moaning - * in the CERN server code? I must be missing something). - */ - - result->name = ap_get_token(p, &accept_line, 0); - ap_str_tolower(result->name); /* You want case-insensitive, - * you'll *get* case-insensitive. - */ - - /* KLUDGE!!! Default HTML to level 2.0 unless the browser - * *explicitly* says something else. - */ - - if (!strcmp(result->name, "text/html") && (result->level == 0.0)) { - result->level = 2.0f; - } - else if (!strcmp(result->name, INCLUDES_MAGIC_TYPE)) { - result->level = 2.0f; - } - else if (!strcmp(result->name, INCLUDES_MAGIC_TYPE3)) { - result->level = 3.0f; - } - - while (*accept_line == ';') { - /* Parameters ... */ - - char *parm; - char *cp; - char *end; - - ++accept_line; - parm = ap_get_token(p, &accept_line, 1); - - /* Look for 'var = value' --- and make sure the var is in lcase. */ - - for (cp = parm; (*cp && !ap_isspace(*cp) && *cp != '='); ++cp) { - *cp = ap_tolower(*cp); - } - - if (!*cp) { - continue; /* No '='; just ignore it. */ - } - - *cp++ = '\0'; /* Delimit var */ - while (*cp && (ap_isspace(*cp) || *cp == '=')) { - ++cp; - } - - if (*cp == '"') { - ++cp; - for (end = cp; - (*end && *end != '\n' && *end != '\r' && *end != '\"'); - end++); - } - else { - for (end = cp; (*end && !ap_isspace(*end)); end++); - } - if (*end) { - *end = '\0'; /* strip ending quote or return */ - } - ap_str_tolower(cp); - - if (parm[0] == 'q' - && (parm[1] == '\0' || (parm[1] == 's' && parm[2] == '\0'))) { - result->quality = atof(cp); - } - else if (parm[0] == 'l' && !strcmp(&parm[1], "evel")) { - result->level = atof(cp); - } - else if (!strcmp(parm, "charset")) { - result->charset = cp; - } - } - - if (*accept_line == ',') { - ++accept_line; - } - - return accept_line; -} - -/***************************************************************** - * - * Dealing with header lines ... - * - * Accept, Accept-Charset, Accept-Language and Accept-Encoding - * are handled by do_header_line() - they all have the same - * basic structure of a list of items of the format - * name; q=N; charset=TEXT - * - * where charset is only valid in Accept. - */ - -static array_header *do_header_line(pool *p, const char *accept_line) -{ - array_header *accept_recs; - - if (!accept_line) { - return NULL; - } - - accept_recs = ap_make_array(p, 40, sizeof(accept_rec)); - - while (*accept_line) { - accept_rec *new = (accept_rec *) ap_push_array(accept_recs); - accept_line = get_entry(p, new, accept_line); - } - - return accept_recs; -} - -/* Given the text of the Content-Languages: line from the var map file, - * return an array containing the languages of this variant - */ - -static array_header *do_languages_line(pool *p, const char **lang_line) -{ - array_header *lang_recs = ap_make_array(p, 2, sizeof(char *)); - - if (!lang_line) { - return lang_recs; - } - - while (**lang_line) { - char **new = (char **) ap_push_array(lang_recs); - *new = ap_get_token(p, lang_line, 0); - ap_str_tolower(*new); - if (**lang_line == ',' || **lang_line == ';') { - ++(*lang_line); - } - } - - return lang_recs; -} - -/***************************************************************** - * - * Handling header lines from clients... - */ - -static negotiation_state *parse_accept_headers(request_rec *r) -{ - negotiation_state *new = - (negotiation_state *) ap_pcalloc(r->pool, sizeof(negotiation_state)); - accept_rec *elts; - table *hdrs = r->headers_in; - int i; - - new->pool = r->pool; - new->r = r; - new->dir_name = ap_make_dirstr_parent(r->pool, r->filename); - - new->accepts = do_header_line(r->pool, ap_table_get(hdrs, "Accept")); - - /* calculate new->accept_q value */ - if (new->accepts) { - elts = (accept_rec *) new->accepts->elts; - - for (i = 0; i < new->accepts->nelts; ++i) { - if (elts[i].quality < 1.0) { - new->accept_q = 1; - } - } - } - - new->accept_encodings = - do_header_line(r->pool, ap_table_get(hdrs, "Accept-Encoding")); - new->accept_langs = - do_header_line(r->pool, ap_table_get(hdrs, "Accept-Language")); - new->accept_charsets = - do_header_line(r->pool, ap_table_get(hdrs, "Accept-Charset")); - - new->avail_vars = ap_make_array(r->pool, 40, sizeof(var_rec)); - - return new; -} - - -static void parse_negotiate_header(request_rec *r, negotiation_state *neg) -{ - const char *negotiate = ap_table_get(r->headers_in, "Negotiate"); - char *tok; - - /* First, default to no TCN, no Alternates, and the original Apache - * negotiation algorithm with fiddles for broken browser configs. - * - * To save network bandwidth, we do not configure to send an - * Alternates header to the user agent by default. User - * agents that want an Alternates header for agent-driven - * negotiation will have to request it by sending an - * appropriate Negotiate header. - */ - neg->ua_supports_trans = 0; - neg->send_alternates = 0; - neg->may_choose = 1; - neg->use_rvsa = 0; - neg->dont_fiddle_headers = 0; - - if (!negotiate) - return; - - if (strcmp(negotiate, "trans") == 0) { - /* Lynx 2.7 and 2.8 send 'negotiate: trans' even though they - * do not support transparent content negotiation, so for Lynx we - * ignore the negotiate header when its contents are exactly "trans". - * If future versions of Lynx ever need to say 'negotiate: trans', - * they can send the equivalent 'negotiate: trans, trans' instead - * to avoid triggering the workaround below. - */ - const char *ua = ap_table_get(r->headers_in, "User-Agent"); - - if (ua && (strncmp(ua, "Lynx", 4) == 0)) - return; - } - - neg->may_choose = 0; /* An empty Negotiate would require 300 response */ - - while ((tok = ap_get_list_item(neg->pool, &negotiate)) != NULL) { - - if (strcmp(tok, "trans") == 0 || - strcmp(tok, "vlist") == 0 || - strcmp(tok, "guess-small") == 0 || - ap_isdigit(tok[0]) || - strcmp(tok, "*") == 0) { - - /* The user agent supports transparent negotiation */ - neg->ua_supports_trans = 1; - - /* Send-alternates could be configurable, but note - * that it must be 1 if we have 'vlist' in the - * negotiate header. - */ - neg->send_alternates = 1; - - if (strcmp(tok, "1.0") == 0) { - /* we may use the RVSA/1.0 algorithm, configure for it */ - neg->may_choose = 1; - neg->use_rvsa = 1; - neg->dont_fiddle_headers = 1; - } - else if (tok[0] == '*') { - /* we may use any variant selection algorithm, configure - * to use the Apache algorithm - */ - neg->may_choose = 1; - - /* We disable header fiddles on the assumption that a - * client sending Negotiate knows how to send correct - * headers which don't need fiddling. - */ - neg->dont_fiddle_headers = 1; - } - } - } - -#ifdef NEG_DEBUG - fprintf(stderr, "dont_fiddle_headers=%d use_rvsa=%d ua_supports_trans=%d " - "send_alternates=%d, may_choose=%d\n", - neg->dont_fiddle_headers, neg->use_rvsa, - neg->ua_supports_trans, neg->send_alternates, neg->may_choose); -#endif - -} - -/* Sometimes clients will give us no Accept info at all; this routine sets - * up the standard default for that case, and also arranges for us to be - * willing to run a CGI script if we find one. (In fact, we set up to - * dramatically prefer CGI scripts in cases where that's appropriate, - * e.g., POST or when URI includes query args or extra path info). - */ -static void maybe_add_default_accepts(negotiation_state *neg, - int prefer_scripts) -{ - accept_rec *new_accept; - - if (!neg->accepts) { - neg->accepts = ap_make_array(neg->pool, 4, sizeof(accept_rec)); - - new_accept = (accept_rec *) ap_push_array(neg->accepts); - - new_accept->name = "*/*"; - new_accept->quality = 1.0f; - new_accept->level = 0.0f; - } - - new_accept = (accept_rec *) ap_push_array(neg->accepts); - - new_accept->name = CGI_MAGIC_TYPE; - if (neg->use_rvsa) { - new_accept->quality = 0; - } - else { - new_accept->quality = prefer_scripts ? 2.0f : 0.001f; - } - new_accept->level = 0.0f; -} - -/***************************************************************** - * - * Parsing type-map files, in Roy's meta/http format augmented with - * #-comments. - */ - -/* Reading RFC822-style header lines, ignoring #-comments and - * handling continuations. - */ - -enum header_state { - header_eof, header_seen, header_sep -}; - -static enum header_state get_header_line(char *buffer, int len, FILE *map) -{ - char *buf_end = buffer + len; - char *cp; - int c; - - /* Get a noncommented line */ - - do { - if (fgets(buffer, MAX_STRING_LEN, map) == NULL) { - return header_eof; - } - } while (buffer[0] == '#'); - - /* If blank, just return it --- this ends information on this variant */ - - for (cp = buffer; (*cp && ap_isspace(*cp)); ++cp) { - continue; - } - - if (*cp == '\0') { - return header_sep; - } - - /* If non-blank, go looking for header lines, but note that we still - * have to treat comments specially... - */ - - cp += strlen(cp); - - while ((c = getc(map)) != EOF) { - if (c == '#') { - /* Comment line */ - while ((c = getc(map)) != EOF && c != '\n') { - continue; - } - } - else if (ap_isspace(c)) { - /* Leading whitespace. POSSIBLE continuation line - * Also, possibly blank --- if so, we ungetc() the final newline - * so that we will pick up the blank line the next time 'round. - */ - - while (c != EOF && c != '\n' && ap_isspace(c)) { - c = getc(map); - } - - ungetc(c, map); - - if (c == '\n') { - return header_seen; /* Blank line */ - } - - /* Continuation */ - - while (cp < buf_end - 2 && (c = getc(map)) != EOF && c != '\n') { - *cp++ = c; - } - - *cp++ = '\n'; - *cp = '\0'; - } - else { - - /* Line beginning with something other than whitespace */ - - ungetc(c, map); - return header_seen; - } - } - - return header_seen; -} - -/* Stripping out RFC822 comments */ - -static void strip_paren_comments(char *hdr) -{ - /* Hmmm... is this correct? In Roy's latest draft, (comments) can nest! */ - /* Nope, it isn't correct. Fails to handle backslash escape as well. */ - - while (*hdr) { - if (*hdr == '"') { - hdr = strchr(hdr, '"'); - if (hdr == NULL) { - return; - } - ++hdr; - } - else if (*hdr == '(') { - while (*hdr && *hdr != ')') { - *hdr++ = ' '; - } - - if (*hdr) { - *hdr++ = ' '; - } - } - else { - ++hdr; - } - } -} - -/* Getting to a header body from the header */ - -static char *lcase_header_name_return_body(char *header, request_rec *r) -{ - char *cp = header; - - for ( ; *cp && *cp != ':' ; ++cp) { - *cp = ap_tolower(*cp); - } - - if (!*cp) { - ap_log_rerror(APLOG_MARK, APLOG_NOERRNO|APLOG_ERR, r, - "Syntax error in type map --- no ':': %s", r->filename); - return NULL; - } - - do { - ++cp; - } while (*cp && ap_isspace(*cp)); - - if (!*cp) { - ap_log_rerror(APLOG_MARK, APLOG_NOERRNO|APLOG_ERR, r, - "Syntax error in type map --- no header body: %s", - r->filename); - return NULL; - } - - return cp; -} - -static int read_type_map(negotiation_state *neg, request_rec *rr) -{ - request_rec *r = neg->r; - FILE *map; - char buffer[MAX_STRING_LEN]; - enum header_state hstate; - struct var_rec mime_info; - int has_content; - - /* We are not using multiviews */ - neg->count_multiviews_variants = 0; - - map = ap_pfopen(neg->pool, rr->filename, "r"); - if (map == NULL) { - ap_log_rerror(APLOG_MARK, APLOG_ERR, r, - "cannot access type map file: %s", rr->filename); - return HTTP_FORBIDDEN; - } - - clean_var_rec(&mime_info); - has_content = 0; - - do { - hstate = get_header_line(buffer, MAX_STRING_LEN, map); - - if (hstate == header_seen) { - char *body1 = lcase_header_name_return_body(buffer, neg->r); - const char *body; - - if (body1 == NULL) { - return SERVER_ERROR; - } - - strip_paren_comments(body1); - body = body1; - - if (!strncmp(buffer, "uri:", 4)) { - mime_info.file_name = ap_get_token(neg->pool, &body, 0); - } - else if (!strncmp(buffer, "content-type:", 13)) { - struct accept_rec accept_info; - - get_entry(neg->pool, &accept_info, body); - set_mime_fields(&mime_info, &accept_info); - has_content = 1; - } - else if (!strncmp(buffer, "content-length:", 15)) { - mime_info.bytes = atof(body); - has_content = 1; - } - else if (!strncmp(buffer, "content-language:", 17)) { - mime_info.content_languages = do_languages_line(neg->pool, - &body); - has_content = 1; - } - else if (!strncmp(buffer, "content-encoding:", 17)) { - mime_info.content_encoding = ap_get_token(neg->pool, &body, 0); - has_content = 1; - } - else if (!strncmp(buffer, "description:", 12)) { - char *desc = ap_pstrdup(neg->pool, body); - char *cp; - - for (cp = desc; *cp; ++cp) { - if (*cp=='\n') *cp=' '; - } - if (cp>desc) *(cp-1)=0; - mime_info.description = desc; - } - } - else { - if (*mime_info.file_name && has_content) { - void *new_var = ap_push_array(neg->avail_vars); - - memcpy(new_var, (void *) &mime_info, sizeof(var_rec)); - } - - clean_var_rec(&mime_info); - has_content = 0; - } - } while (hstate != header_eof); - - ap_pfclose(neg->pool, map); - - set_vlist_validator(r, rr); - - return OK; -} - - -/* Sort function used by read_types_multi. */ -static int variantsortf(var_rec *a, var_rec *b) { - - /* First key is the source quality, sort in descending order. */ - - /* XXX: note that we currently implement no method of setting the - * source quality for multiviews variants, so we are always comparing - * 1.0 to 1.0 for now - */ - if (a->source_quality < b->source_quality) - return 1; - if (a->source_quality > b->source_quality) - return -1; - - /* Second key is the variant name */ - return strcmp(a->file_name, b->file_name); -} - -/***************************************************************** - * - * Same as read_type_map, except we use a filtered directory listing - * as the map... - */ - -static int read_types_multi(negotiation_state *neg) -{ - request_rec *r = neg->r; - - char *filp; - int prefix_len; - DIR *dirp; - struct DIR_TYPE *dir_entry; - struct var_rec mime_info; - struct accept_rec accept_info; - void *new_var; - - clean_var_rec(&mime_info); - - if (!(filp = strrchr(r->filename, '/'))) { - return DECLINED; /* Weird... */ - } - - if (strncmp(r->filename, "proxy:", 6) == 0) { - return DECLINED; - } - - ++filp; - prefix_len = strlen(filp); - - dirp = ap_popendir(neg->pool, neg->dir_name); - - if (dirp == NULL) { - ap_log_rerror(APLOG_MARK, APLOG_ERR, r, - "cannot read directory for multi: %s", neg->dir_name); - return HTTP_FORBIDDEN; - } - - while ((dir_entry = readdir(dirp))) { - request_rec *sub_req; - - /* Do we have a match? */ - - if (strncmp(dir_entry->d_name, filp, prefix_len)) { - continue; - } - if (dir_entry->d_name[prefix_len] != '.') { - continue; - } - - /* Yep. See if it's something which we have access to, and - * which has a known type and encoding (as opposed to something - * which we'll be slapping default_type on later). - */ - - sub_req = ap_sub_req_lookup_file(dir_entry->d_name, r); - - /* If it has a handler, we'll pretend it's a CGI script, - * since that's a good indication of the sort of thing it - * might be doing. - */ - if (sub_req->handler && !sub_req->content_type) { - sub_req->content_type = CGI_MAGIC_TYPE; - } - - if (sub_req->status != HTTP_OK || !sub_req->content_type) { - ap_destroy_sub_req(sub_req); - continue; - } - - /* If it's a map file, we use that instead of the map - * we're building... - */ - - if (((sub_req->content_type) && - !strcmp(sub_req->content_type, MAP_FILE_MAGIC_TYPE)) || - ((sub_req->handler) && - !strcmp(sub_req->handler, "type-map"))) { - - ap_pclosedir(neg->pool, dirp); - neg->avail_vars->nelts = 0; - if (sub_req->status != HTTP_OK) { - return sub_req->status; - } - return read_type_map(neg, sub_req); - } - - /* Have reasonable variant --- gather notes. */ - - mime_info.sub_req = sub_req; - mime_info.file_name = ap_pstrdup(neg->pool, dir_entry->d_name); - if (sub_req->content_encoding) { - mime_info.content_encoding = sub_req->content_encoding; - } - if (sub_req->content_languages) { - mime_info.content_languages = sub_req->content_languages; - } - - get_entry(neg->pool, &accept_info, sub_req->content_type); - set_mime_fields(&mime_info, &accept_info); - - new_var = ap_push_array(neg->avail_vars); - memcpy(new_var, (void *) &mime_info, sizeof(var_rec)); - - neg->count_multiviews_variants++; - - clean_var_rec(&mime_info); - } - - ap_pclosedir(neg->pool, dirp); - - set_vlist_validator(r, r); - - /* Sort the variants into a canonical order. The negotiation - * result sometimes depends on the order of the variants. By - * sorting the variants into a canonical order, rather than using - * the order in which readdir() happens to return them, we ensure - * that the negotiation result will be consistent over filesystem - * backup/restores and over all mirror sites. - */ - - qsort((void *) neg->avail_vars->elts, neg->avail_vars->nelts, - sizeof(var_rec), (int (*)(const void *, const void *)) variantsortf); - - return OK; -} - - -/***************************************************************** - * And now for the code you've been waiting for... actually - * finding a match to the client's requirements. - */ - -/* Matching MIME types ... the star/star and foo/star commenting conventions - * are implemented here. (You know what I mean by star/star, but just - * try mentioning those three characters in a C comment). Using strcmp() - * is legit, because everything has already been smashed to lowercase. - * - * Note also that if we get an exact match on the media type, we update - * level_matched for use in level_cmp below... - * - * We also give a value for mime_stars, which is used later. It should - * be 1 for star/star, 2 for type/star and 3 for type/subtype. - */ - -static int mime_match(accept_rec *accept_r, var_rec *avail) -{ - char *accept_type = accept_r->name; - char *avail_type = avail->mime_type; - int len = strlen(accept_type); - - if (accept_type[0] == '*') { /* Anything matches star/star */ - if (avail->mime_stars < 1) { - avail->mime_stars = 1; - } - return 1; - } - else if ((accept_type[len - 1] == '*') && - !strncmp(accept_type, avail_type, len - 2)) { - if (avail->mime_stars < 2) { - avail->mime_stars = 2; - } - return 1; - } - else if (!strcmp(accept_type, avail_type) - || (!strcmp(accept_type, "text/html") - && (!strcmp(avail_type, INCLUDES_MAGIC_TYPE) - || !strcmp(avail_type, INCLUDES_MAGIC_TYPE3)))) { - if (accept_r->level >= avail->level) { - avail->level_matched = avail->level; - avail->mime_stars = 3; - return 1; - } - } - - return OK; -} - -/* This code implements a piece of the tie-breaking algorithm between - * variants of equal quality. This piece is the treatment of variants - * of the same base media type, but different levels. What we want to - * return is the variant at the highest level that the client explicitly - * claimed to accept. - * - * If all the variants available are at a higher level than that, or if - * the client didn't say anything specific about this media type at all - * and these variants just got in on a wildcard, we prefer the lowest - * level, on grounds that that's the one that the client is least likely - * to choke on. - * - * (This is all motivated by treatment of levels in HTML --- we only - * want to give level 3 to browsers that explicitly ask for it; browsers - * that don't, including HTTP/0.9 browsers that only get the implicit - * "Accept: * / *" [space added to avoid confusing cpp --- no, that - * syntax doesn't really work] should get HTML2 if available). - * - * (Note that this code only comes into play when we are choosing among - * variants of equal quality, where the draft standard gives us a fair - * bit of leeway about what to do. It ain't specified by the standard; - * rather, it is a choice made by this server about what to do in cases - * where the standard does not specify a unique course of action). - */ - -static int level_cmp(var_rec *var1, var_rec *var2) -{ - /* Levels are only comparable between matching media types */ - - if (var1->is_pseudo_html && !var2->is_pseudo_html) { - return 0; - } - - if (!var1->is_pseudo_html && strcmp(var1->mime_type, var2->mime_type)) { - return 0; - } - /* The result of the above if statements is that, if we get to - * here, both variants have the same mime_type or both are - * pseudo-html. - */ - - /* Take highest level that matched, if either did match. */ - - if (var1->level_matched > var2->level_matched) { - return 1; - } - if (var1->level_matched < var2->level_matched) { - return -1; - } - - /* Neither matched. Take lowest level, if there's a difference. */ - - if (var1->level < var2->level) { - return 1; - } - if (var1->level > var2->level) { - return -1; - } - - /* Tied */ - - return 0; -} - -/* Finding languages. The main entry point is set_language_quality() - * which is called for each variant. It sets two elements in the - * variant record: - * language_quality - the 'q' value of the 'best' matching language - * from Accept-Language: header (HTTP/1.1) - * lang_index - Pre HTTP/1.1 language priority, using - * position of language on the Accept-Language: - * header, if present, else LanguagePriority - * directive order. - * - * When we do the variant checking for best variant, we use language - * quality first, and if a tie, language_index next (this only applies - * when _not_ using the RVSA/1.0 algorithm). If using the RVSA/1.0 - * algorithm, lang_index is never used. - * - * set_language_quality() calls find_lang_index() and find_default_index() - * to set lang_index. - */ - -static int find_lang_index(array_header *accept_langs, char *lang) -{ - accept_rec *accs; - int i; - - if (!lang || !accept_langs) { - return -1; - } - - accs = (accept_rec *) accept_langs->elts; - - for (i = 0; i < accept_langs->nelts; ++i) { - if (!strncmp(lang, accs[i].name, strlen(accs[i].name))) { - return i; - } - } - - return -1; -} - -/* This function returns the priority of a given language - * according to LanguagePriority. It is used in case of a tie - * between several languages. - */ - -static int find_default_index(neg_dir_config *conf, char *lang) -{ - array_header *arr; - int nelts; - char **elts; - int i; - - if (!lang) { - return -1; - } - - arr = conf->language_priority; - nelts = arr->nelts; - elts = (char **) arr->elts; - - for (i = 0; i < nelts; ++i) { - if (!strcasecmp(elts[i], lang)) { - return i; - } - } - - return -1; -} - -/* set_default_lang_quality() sets the quality we apply to variants - * which have no language assigned to them. If none of the variants - * have a language, we are not negotiating on language, so all are - * acceptable, and we set the default q value to 1.0. However if - * some of the variants have languages, we set this default to 0.001. - * The value of this default will be applied to all variants with - * no explicit language -- which will have the effect of making them - * acceptable, but only if no variants with an explicit language - * are acceptable. The default q value set here is assigned to variants - * with no language type in set_language_quality(). - * - * Note that if using the RVSA/1.0 algorithm, we don't use this - * fiddle. - */ - -static void set_default_lang_quality(negotiation_state *neg) -{ - var_rec *avail_recs = (var_rec *) neg->avail_vars->elts; - int j; - - if (!neg->dont_fiddle_headers) { - for (j = 0; j < neg->avail_vars->nelts; ++j) { - var_rec *variant = &avail_recs[j]; - if (variant->content_languages && - variant->content_languages->nelts) { - neg->default_lang_quality = 0.001f; - return; - } - } - } - - neg->default_lang_quality = 1.0f; -} - -/* Set the language_quality value in the variant record. Also - * assigns lang_index for back-compat. - * - * To find the language_quality value, we look for the 'q' value - * of the 'best' matching language on the Accept-Language - * header. The 'best' match is the language on Accept-Language - * header which matches the language of this variant either fully, - * or as far as the prefix marker (-). If two or more languages - * match, use the longest string from the Accept-Language header - * (see HTTP/1.1 [14.4]) - * - * When a variant has multiple languages, we find the 'best' - * match for each variant language tag as above, then select the - * one with the highest q value. Because both the accept-header - * and variant can have multiple languages, we now have a hairy - * loop-within-a-loop here. - * - * If the variant has no language and we have no Accept-Language - * items, leave the quality at 1.0 and return. - * - * If the variant has no language, we use the default as set by - * set_default_lang_quality() (1.0 if we are not negotiating on - * language, 0.001 if we are). - * - * Following the setting of the language quality, we drop through to - * set the old 'lang_index'. This is set based on either the order - * of the languages on the Accept-Language header, or the - * order on the LanguagePriority directive. This is only used - * in the negotiation if the language qualities tie. - */ - -static void set_language_quality(negotiation_state *neg, var_rec *variant) -{ - char *firstlang; - int idx; - - if (!variant->content_languages || !variant->content_languages->nelts) { - /* This variant has no content-language, so use the default - * quality factor for variants with no content-language - * (previously set by set_default_lang_quality()). - * Leave the factor alone (it remains at 1.0) when we may not fiddle - * with the headers. - */ - if (!neg->dont_fiddle_headers) { - variant->lang_quality = neg->default_lang_quality; - } - if (!neg->accept_langs) { - return; /* no accept-language header */ - } - - } - else { - /* Variant has one (or more) languages. Look for the best - * match. We do this by going through each language on the - * variant description looking for a match on the - * Accept-Language header. The best match is the longest - * matching language on the header. The final result is the - * best q value from all the languages on the variant - * description. - */ - - if (!neg->accept_langs) { - /* no accept-language header makes the variant indefinite */ - variant->definite = 0; - } - else { /* There is an accept-language with 0 or more items */ - accept_rec *accs = (accept_rec *) neg->accept_langs->elts; - accept_rec *best = NULL, *star = NULL; - accept_rec *bestthistag; - char *lang, *p; - float fiddle_q = 0.0f; - int any_match_on_star = 0; - int i, j, alen, longest_lang_range_len; - - for (j = 0; j < variant->content_languages->nelts; ++j) { - p = NULL; - bestthistag = NULL; - longest_lang_range_len = 0; - alen = 0; - - /* lang is the variant's language-tag, which is the one - * we are allowed to use the prefix of in HTTP/1.1 - */ - lang = ((char **) (variant->content_languages->elts))[j]; - - /* now find the best (i.e. longest) matching - * Accept-Language header language. We put the best match - * for this tag in bestthistag. We cannot update the - * overall best (based on q value) because the best match - * for this tag is the longest language item on the accept - * header, not necessarily the highest q. - */ - for (i = 0; i < neg->accept_langs->nelts; ++i) { - if (!strcmp(accs[i].name, "*")) { - if (!star) { - star = &accs[i]; - } - continue; - } - /* Find language. We match if either the variant - * language tag exactly matches the language range - * from the accept header, or a prefix of the variant - * language tag up to a '-' character matches the - * whole of the language range in the Accept-Language - * header. Note that HTTP/1.x allows any number of - * '-' characters in a tag or range, currently only - * tags with zero or one '-' characters are defined - * for general use (see rfc1766). - * - * We only use language range in the Accept-Language - * header the best match for the variant language tag - * if it is longer than the previous best match. - */ - - alen = strlen(accs[i].name); - - if ((strlen(lang) >= alen) && - !strncmp(lang, accs[i].name, alen) && - ((lang[alen] == 0) || (lang[alen] == '-')) ) { - - if (alen > longest_lang_range_len) { - longest_lang_range_len = alen; - bestthistag = &accs[i]; - } - } - - if (!bestthistag && !neg->dont_fiddle_headers) { - /* The next bit is a fiddle. Some browsers might - * be configured to send more specific language - * ranges than desirable. For example, an - * Accept-Language of en-US should never match - * variants with languages en or en-GB. But US - * English speakers might pick en-US as their - * language choice. So this fiddle checks if the - * language range has a prefix, and if so, it - * matches variants which match that prefix with a - * priority of 0.001. So a request for en-US would - * match variants of types en and en-GB, but at - * much lower priority than matches of en-US - * directly, or of any other language listed on - * the Accept-Language header. Note that this - * fiddle does not handle multi-level prefixes. - */ - if ((p = strchr(accs[i].name, '-'))) { - int plen = p - accs[i].name; - - if (!strncmp(lang, accs[i].name, plen)) { - fiddle_q = 0.001f; - } - } - } - } - /* Finished looking at Accept-Language headers, the best - * (longest) match is in bestthistag, or NULL if no match - */ - if (!best || - (bestthistag && bestthistag->quality > best->quality)) { - best = bestthistag; - } - - /* See if the tag matches on a * in the Accept-Language - * header. If so, record this fact for later use - */ - if (!bestthistag && star) { - any_match_on_star = 1; - } - } - - /* If one of the language tags of the variant matched on *, we - * need to see if its q is better than that of any non-* match - * on any other tag of the variant. If so the * match takes - * precedence and the overall match is not definite. - */ - if ( any_match_on_star && - ((best && star->quality > best->quality) || - (!best)) ) { - best = star; - variant->definite = 0; - } - - variant->lang_quality = best ? best->quality : fiddle_q; - } - } - - /* Now set the old lang_index field. Since this is old - * stuff anyway, don't bother with handling multiple languages - * per variant, just use the first one assigned to it - */ - idx = 0; - if (variant->content_languages && variant->content_languages->nelts) { - firstlang = ((char **) variant->content_languages->elts)[0]; - } - else { - firstlang = ""; - } - if (!neg->accept_langs) { /* Client doesn't care */ - idx = find_default_index((neg_dir_config *) ap_get_module_config( - neg->r->per_dir_config, &negotiation_module), - firstlang); - } - else { /* Client has Accept-Language */ - idx = find_lang_index(neg->accept_langs, firstlang); - } - variant->lang_index = idx; - - return; -} - -/* Determining the content length --- if the map didn't tell us, - * we have to do a stat() and remember for next time. - * - * Grump. For Apache, even the first stat here may well be - * redundant (for multiviews) with a stat() done by the sub_req - * machinery. At some point, that ought to be fixed. - */ - -static float find_content_length(negotiation_state *neg, var_rec *variant) -{ - struct stat statb; - - if (variant->bytes == 0) { - char *fullname = ap_make_full_path(neg->pool, neg->dir_name, - variant->file_name); - - if (stat(fullname, &statb) >= 0) { - /* Note, precision may be lost */ - variant->bytes = (float) statb.st_size; - } - } - - return variant->bytes; -} - -/* For a given variant, find the best matching Accept: header - * and assign the Accept: header's quality value to the - * mime_type_quality field of the variant, for later use in - * determining the best matching variant. - */ - -static void set_accept_quality(negotiation_state *neg, var_rec *variant) -{ - int i; - accept_rec *accept_recs; - float q = 0.0f; - int q_definite = 1; - - /* if no Accept: header, leave quality alone (will - * remain at the default value of 1) - * - * XXX: This if is currently never true because of the effect of - * maybe_add_default_accepts(). - */ - if (!neg->accepts) { - if (variant->mime_type && *variant->mime_type) - variant->definite = 0; - return; - } - - accept_recs = (accept_rec *) neg->accepts->elts; - - /* - * Go through each of the ranges on the Accept: header, - * looking for the 'best' match with this variant's - * content-type. We use the best match's quality - * value (from the Accept: header) for this variant's - * mime_type_quality field. - * - * The best match is determined like this: - * type/type is better than type/ * is better than * / * - * if match is type/type, use the level mime param if available - */ - for (i = 0; i < neg->accepts->nelts; ++i) { - - accept_rec *type = &accept_recs[i]; - int prev_mime_stars; - - prev_mime_stars = variant->mime_stars; - - if (!mime_match(type, variant)) { - continue; /* didn't match the content type at all */ - } - else { - /* did match - see if there were less or more stars than - * in previous match - */ - if (prev_mime_stars == variant->mime_stars) { - continue; /* more stars => not as good a match */ - } - } - - /* If we are allowed to mess with the q-values - * and have no explicit q= parameters in the accept header, - * make wildcards very low, so we have a low chance - * of ending up with them if there's something better. - */ - - if (!neg->dont_fiddle_headers && !neg->accept_q && - variant->mime_stars == 1) { - q = 0.01f; - } - else if (!neg->dont_fiddle_headers && !neg->accept_q && - variant->mime_stars == 2) { - q = 0.02f; - } - else { - q = type->quality; - } - - q_definite = (variant->mime_stars == 3); - } - variant->mime_type_quality = q; - variant->definite = variant->definite && q_definite; - -} - -/* For a given variant, find the 'q' value of the charset given - * on the Accept-Charset line. If no charsets are listed, - * assume value of '1'. - */ -static void set_charset_quality(negotiation_state *neg, var_rec *variant) -{ - int i; - accept_rec *accept_recs; - char *charset = variant->content_charset; - accept_rec *star = NULL; - - /* if no Accept-Charset: header, leave quality alone (will - * remain at the default value of 1) - */ - if (!neg->accept_charsets) { - if (charset && *charset) - variant->definite = 0; - return; - } - - accept_recs = (accept_rec *) neg->accept_charsets->elts; - - if (charset == NULL || !*charset) { - /* Charset of variant not known */ - - /* if not a text / * type, leave quality alone */ - if (!(!strncmp(variant->mime_type, "text/", 5) - || !strcmp(variant->mime_type, INCLUDES_MAGIC_TYPE) - || !strcmp(variant->mime_type, INCLUDES_MAGIC_TYPE3) - )) - return; - - /* Don't go guessing if we are in strict header mode, - * e.g. when running the rvsa, as any guess won't be reflected - * in the variant list or content-location headers. - */ - if (neg->dont_fiddle_headers) - return; - - charset = "iso-8859-1"; /* The default charset for HTTP text types */ - } - - /* - * Go through each of the items on the Accept-Charset header, - * looking for a match with this variant's charset. If none - * match, charset is unacceptable, so set quality to 0. - */ - for (i = 0; i < neg->accept_charsets->nelts; ++i) { - - accept_rec *type = &accept_recs[i]; - - if (!strcmp(type->name, charset)) { - variant->charset_quality = type->quality; - return; - } - else if (strcmp(type->name, "*") == 0) { - star = type; - } - } - /* No explicit match */ - if (star) { - variant->charset_quality = star->quality; - variant->definite = 0; - return; - } - /* If this variant is in charset iso-8859-1, the default is 1.0 */ - if (strcmp(charset, "iso-8859-1") == 0) { - variant->charset_quality = 1.0f; - } - else { - variant->charset_quality = 0.0f; - } -} - - -/* is_identity_encoding is included for back-compat, but does anyone - * use 7bit, 8bin or binary in their var files?? - */ - -static int is_identity_encoding(const char *enc) -{ - return (!enc || !enc[0] || !strcmp(enc, "7bit") || !strcmp(enc, "8bit") - || !strcmp(enc, "binary")); -} - -/* - * set_encoding_quality determines whether the encoding for a particular - * variant is acceptable for the user-agent. - * - * The rules for encoding are that if the user-agent does not supply - * any Accept-Encoding header, then all encodings are allowed but a - * variant with no encoding should be preferred. - * If there is an empty Accept-Encoding header, then no encodings are - * acceptable. If there is a non-empty Accept-Encoding header, then - * any of the listed encodings are acceptable, as well as no encoding - * unless the "identity" encoding is specifically excluded. - */ -static void set_encoding_quality(negotiation_state *neg, var_rec *variant) -{ - accept_rec *accept_recs; - const char *enc = variant->content_encoding; - accept_rec *star = NULL; - float value_if_not_found = 0.0f; - int i; - - if (!neg->accept_encodings) { - /* We had no Accept-Encoding header, assume that all - * encodings are acceptable with a low quality, - * but we prefer no encoding if available. - */ - if (!enc || is_identity_encoding(enc)) - variant->encoding_quality = 1.0f; - else - variant->encoding_quality = 0.5f; - - return; - } - - if (!enc || is_identity_encoding(enc)) { - enc = "identity"; - value_if_not_found = 0.0001f; - } - - accept_recs = (accept_rec *) neg->accept_encodings->elts; - - /* Go through each of the encodings on the Accept-Encoding: header, - * looking for a match with our encoding. x- prefixes are ignored. - */ - if (enc[0] == 'x' && enc[1] == '-') { - enc += 2; - } - for (i = 0; i < neg->accept_encodings->nelts; ++i) { - - char *name = accept_recs[i].name; - - if (name[0] == 'x' && name[1] == '-') { - name += 2; - } - - if (!strcmp(name, enc)) { - variant->encoding_quality = accept_recs[i].quality; - return; - } - - if (strcmp(name, "*") == 0) { - star = &accept_recs[i]; - } - - } - /* No explicit match */ - if (star) { - variant->encoding_quality = star->quality; - return; - } - - /* Encoding not found on Accept-Encoding: header, so it is - * _not_ acceptable unless it is the identity (no encoding) - */ - variant->encoding_quality = value_if_not_found; -} - -/************************************************************* - * Possible results of the variant selection algorithm - */ -enum algorithm_results { - alg_choice = 1, /* choose variant */ - alg_list /* list variants */ -}; - -/* Below is the 'best_match' function. It returns an int, which has - * one of the two values alg_choice or alg_list, which give the result - * of the variant selection algorithm. alg_list means that no best - * variant was found by the algorithm, alg_choice means that a best - * variant was found and should be returned. The list/choice - * terminology comes from TCN (rfc2295), but is used in a more generic - * way here. The best variant is returned in *pbest. best_match has - * two possible algorithms for determining the best variant: the - * RVSA/1.0 algorithm (from RFC2296), and the standard Apache - * algorithm. These are split out into separate functions - * (is_variant_better_rvsa() and is_variant_better()). Selection of - * one is through the neg->use_rvsa flag. - * - * The call to best_match also creates full information, including - * language, charset, etc quality for _every_ variant. This is needed - * for generating a correct Vary header, and can be used for the - * Alternates header, the human-readable list responses and 406 errors. - */ - -/* Firstly, the RVSA/1.0 (HTTP Remote Variant Selection Algorithm - * v1.0) from rfc2296. This is the algorithm that goes together with - * transparent content negotiation (TCN). - */ -static int is_variant_better_rvsa(negotiation_state *neg, var_rec *variant, - var_rec *best, float *p_bestq) -{ - float bestq = *p_bestq, q; - - /* TCN does not cover negotiation on content-encoding. For now, - * we ignore the encoding unless it was explicitly excluded. - */ - if (variant->encoding_quality == 0.0f) - return 0; - - q = variant->mime_type_quality * - variant->source_quality * - variant->charset_quality * - variant->lang_quality; - - /* RFC 2296 calls for the result to be rounded to 5 decimal places, - * but we don't do that because it serves no useful purpose other - * than to ensure that a remote algorithm operates on the same - * precision as ours. That is silly, since what we obviously want - * is for the algorithm to operate on the best available precision - * regardless of who runs it. Since the above calculation may - * result in significant variance at 1e-12, rounding would be bogus. - */ - -#ifdef NEG_DEBUG - fprintf(stderr, "Variant: file=%s type=%s lang=%s sourceq=%1.3f " - "mimeq=%1.3f langq=%1.3f charq=%1.3f encq=%1.3f " - "q=%1.5f definite=%d\n", - (variant->file_name ? variant->file_name : ""), - (variant->mime_type ? variant->mime_type : ""), - (variant->content_languages - ? ap_array_pstrcat(neg->pool, variant->content_languages, ',') - : ""), - variant->source_quality, - variant->mime_type_quality, - variant->lang_quality, - variant->charset_quality, - variant->encoding_quality, - q, - variant->definite); -#endif - - if (q <= 0.0f) { - return 0; - } - if (q > bestq) { - *p_bestq = q; - return 1; - } - if (q == bestq) { - /* If the best variant's encoding is of lesser quality than - * this variant, then we prefer this variant - */ - if (variant->encoding_quality > best->encoding_quality) { - *p_bestq = q; - return 1; - } - } - return 0; -} - -/* Negotiation algorithm as used by previous versions of Apache - * (just about). - */ - -static int is_variant_better(negotiation_state *neg, var_rec *variant, - var_rec *best, float *p_bestq) -{ - float bestq = *p_bestq, q; - int levcmp; - - /* For non-transparent negotiation, server can choose how - * to handle the negotiation. We'll use the following in - * order: content-type, language, content-type level, charset, - * content encoding, content length. - * - * For each check, we have three possible outcomes: - * This variant is worse than current best: return 0 - * This variant is better than the current best: - * assign this variant's q to *p_bestq, and return 1 - * This variant is just as desirable as the current best: - * drop through to the next test. - * - * This code is written in this long-winded way to allow future - * customisation, either by the addition of additional - * checks, or to allow the order of the checks to be determined - * by configuration options (e.g. we might prefer to check - * language quality _before_ content type). - */ - - /* First though, eliminate this variant if it is not - * acceptable by type, charset, encoding or language. - */ - -#ifdef NEG_DEBUG - fprintf(stderr, "Variant: file=%s type=%s lang=%s sourceq=%1.3f " - "mimeq=%1.3f langq=%1.3f langidx=%d charq=%1.3f encq=%1.3f \n", - (variant->file_name ? variant->file_name : ""), - (variant->mime_type ? variant->mime_type : ""), - (variant->content_languages - ? ap_array_pstrcat(neg->pool, variant->content_languages, ',') - : ""), - variant->source_quality, - variant->mime_type_quality, - variant->lang_quality, - variant->lang_index, - variant->charset_quality, - variant->encoding_quality); -#endif - - if (variant->encoding_quality == 0.0f || - variant->lang_quality == 0.0f || - variant->source_quality == 0.0f || - variant->charset_quality == 0.0f || - variant->mime_type_quality == 0.0f) { - return 0; /* don't consider unacceptables */ - } - - q = variant->mime_type_quality * variant->source_quality; - if (q == 0.0 || q < bestq) { - return 0; - } - if (q > bestq || !best) { - *p_bestq = q; - return 1; - } - - /* language */ - if (variant->lang_quality < best->lang_quality) { - return 0; - } - if (variant->lang_quality > best->lang_quality) { - *p_bestq = q; - return 1; - } - - /* if language qualities were equal, try the LanguagePriority stuff */ - if (best->lang_index != -1 && - (variant->lang_index == -1 || variant->lang_index > best->lang_index)) { - return 0; - } - if (variant->lang_index != -1 && - (best->lang_index == -1 || variant->lang_index < best->lang_index)) { - *p_bestq = q; - return 1; - } - - /* content-type level (sometimes used with text/html, though we - * support it on other types too) - */ - levcmp = level_cmp(variant, best); - if (levcmp == -1) { - return 0; - } - if (levcmp == 1) { - *p_bestq = q; - return 1; - } - - /* charset */ - if (variant->charset_quality < best->charset_quality) { - return 0; - } - /* If the best variant's charset is ISO-8859-1 and this variant has - * the same charset quality, then we prefer this variant - */ - - if (variant->charset_quality > best->charset_quality || - ((variant->content_charset != NULL && - *variant->content_charset != '\0' && - strcmp(variant->content_charset, "iso-8859-1") != 0) && - (best->content_charset == NULL || - *best->content_charset == '\0' || - strcmp(best->content_charset, "iso-8859-1") == 0))) { - *p_bestq = q; - return 1; - } - - /* Prefer the highest value for encoding_quality. - */ - if (variant->encoding_quality < best->encoding_quality) { - return 0; - } - if (variant->encoding_quality > best->encoding_quality) { - *p_bestq = q; - return 1; - } - - /* content length if all else equal */ - if (find_content_length(neg, variant) >= find_content_length(neg, best)) { - return 0; - } - - /* ok, to get here means every thing turned out equal, except - * we have a shorter content length, so use this variant - */ - *p_bestq = q; - return 1; -} - -static int best_match(negotiation_state *neg, var_rec **pbest) -{ - int j; - var_rec *best = NULL; - float bestq = 0.0f; - enum algorithm_results algorithm_result; - - var_rec *avail_recs = (var_rec *) neg->avail_vars->elts; - - set_default_lang_quality(neg); - - /* - * Find the 'best' variant - */ - - for (j = 0; j < neg->avail_vars->nelts; ++j) { - var_rec *variant = &avail_recs[j]; - - /* Find all the relevant 'quality' values from the - * Accept... headers, and store in the variant. This also - * prepares for sending an Alternates header etc so we need to - * do it even if we do not actually plan to find a best - * variant. - */ - set_accept_quality(neg, variant); - set_language_quality(neg, variant); - set_encoding_quality(neg, variant); - set_charset_quality(neg, variant); - - /* Only do variant selection if we may actually choose a - * variant for the client - */ - if (neg->may_choose) { - - /* Now find out if this variant is better than the current - * best, either using the RVSA/1.0 algorithm, or Apache's - * internal server-driven algorithm. Presumably other - * server-driven algorithms are possible, and could be - * implemented here. - */ - - if (neg->use_rvsa) { - if (is_variant_better_rvsa(neg, variant, best, &bestq)) { - best = variant; - } - } - else { - if (is_variant_better(neg, variant, best, &bestq)) { - best = variant; - } - } - } - } - - /* We now either have a best variant, or no best variant */ - - if (neg->use_rvsa) { - /* calculate result for RVSA/1.0 algorithm: - * only a choice response if the best variant has q>0 - * and is definite - */ - algorithm_result = (best && best->definite) && (bestq > 0) ? - alg_choice : alg_list; - } - else { - /* calculate result for Apache negotiation algorithm */ - algorithm_result = bestq > 0 ? alg_choice : alg_list; - } - - /* Returning a choice response with a non-neighboring variant is a - * protocol security error in TCN (see rfc2295). We do *not* - * verify here that the variant and URI are neighbors, even though - * we may return alg_choice. We depend on the environment (the - * caller) to only declare the resource transparently negotiable if - * all variants are neighbors. - */ - *pbest = best; - return algorithm_result; -} - -/* Sets response headers for a negotiated response. - * neg->is_transparent determines whether a transparently negotiated - * response or a plain `server driven negotiation' response is - * created. Applicable headers are Alternates, Vary, and TCN. - * - * The Vary header we create is sometimes longer than is required for - * the correct caching of negotiated results by HTTP/1.1 caches. For - * example if we have 3 variants x.html, x.ps.en and x.ps.nl, and if - * the Accept: header assigns a 0 quality to .ps, then the results of - * the two server-side negotiation algorithms we currently implement - * will never depend on Accept-Language so we could return `Vary: - * negotiate, accept' instead of the longer 'Vary: negotiate, accept, - * accept-language' which the code below will return. A routine for - * computing the exact minimal Vary header would be a huge pain to code - * and maintain though, especially because we need to take all possible - * twiddles in the server-side negotiation algorithms into account. - */ -static void set_neg_headers(request_rec *r, negotiation_state *neg, - int alg_result) -{ - table *hdrs; - var_rec *avail_recs = (var_rec *) neg->avail_vars->elts; - const char *sample_type = NULL; - const char *sample_language = NULL; - const char *sample_encoding = NULL; - const char *sample_charset = NULL; - char *lang; - char *qstr; - char *lenstr; - long len; - array_header *arr; - int max_vlist_array = (neg->avail_vars->nelts * 21); - int first_variant = 1; - int vary_by_type = 0; - int vary_by_language = 0; - int vary_by_charset = 0; - int vary_by_encoding = 0; - int j; - - /* In order to avoid O(n^2) memory copies in building Alternates, - * we preallocate a table with the maximum substrings possible, - * fill it with the variant list, and then concatenate the entire array. - * Note that if you change the number of substrings pushed, you also - * need to change the calculation of max_vlist_array above. - */ - if (neg->send_alternates && neg->avail_vars->nelts) - arr = ap_make_array(r->pool, max_vlist_array, sizeof(char *)); - else - arr = NULL; - - /* Put headers into err_headers_out, since send_http_header() - * outputs both headers_out and err_headers_out. - */ - hdrs = r->err_headers_out; - - for (j = 0; j < neg->avail_vars->nelts; ++j) { - var_rec *variant = &avail_recs[j]; - - if (variant->content_languages && variant->content_languages->nelts) { - lang = ap_array_pstrcat(r->pool, variant->content_languages, ','); - } - else { - lang = NULL; - } - - /* Calculate Vary by looking for any difference between variants */ - - if (first_variant) { - sample_type = variant->mime_type; - sample_charset = variant->content_charset; - sample_language = lang; - sample_encoding = variant->content_encoding; - } - else { - if (!vary_by_type && - strcmp(sample_type ? sample_type : "", - variant->mime_type ? variant->mime_type : "")) { - vary_by_type = 1; - } - if (!vary_by_charset && - strcmp(sample_charset ? sample_charset : "", - variant->content_charset ? - variant->content_charset : "")) { - vary_by_charset = 1; - } - if (!vary_by_language && - strcmp(sample_language ? sample_language : "", - lang ? lang : "")) { - vary_by_language = 1; - } - if (!vary_by_encoding && - strcmp(sample_encoding ? sample_encoding : "", - variant->content_encoding ? - variant->content_encoding : "")) { - vary_by_encoding = 1; - } - } - first_variant = 0; - - if (!neg->send_alternates) - continue; - - /* Generate the string components for this Alternates entry */ - - *((const char **) ap_push_array(arr)) = "{\""; - *((const char **) ap_push_array(arr)) = variant->file_name; - *((const char **) ap_push_array(arr)) = "\" "; - - qstr = (char *) ap_palloc(r->pool, 6); - ap_snprintf(qstr, 6, "%1.3f", variant->source_quality); - - /* Strip trailing zeros (saves those valuable network bytes) */ - if (qstr[4] == '0') { - qstr[4] = '\0'; - if (qstr[3] == '0') { - qstr[3] = '\0'; - if (qstr[2] == '0') { - qstr[1] = '\0'; - } - } - } - *((const char **) ap_push_array(arr)) = qstr; - - if (variant->mime_type && *variant->mime_type) { - *((const char **) ap_push_array(arr)) = " {type "; - *((const char **) ap_push_array(arr)) = variant->mime_type; - *((const char **) ap_push_array(arr)) = "}"; - } - if (variant->content_charset && *variant->content_charset) { - *((const char **) ap_push_array(arr)) = " {charset "; - *((const char **) ap_push_array(arr)) = variant->content_charset; - *((const char **) ap_push_array(arr)) = "}"; - } - if (lang) { - *((const char **) ap_push_array(arr)) = " {language "; - *((const char **) ap_push_array(arr)) = lang; - *((const char **) ap_push_array(arr)) = "}"; - } - if (variant->content_encoding && *variant->content_encoding) { - /* Strictly speaking, this is non-standard, but so is TCN */ - - *((const char **) ap_push_array(arr)) = " {encoding "; - *((const char **) ap_push_array(arr)) = variant->content_encoding; - *((const char **) ap_push_array(arr)) = "}"; - } - - /* Note that the Alternates specification (in rfc2295) does - * not require that we include {length x}, so we could omit it - * if determining the length is too expensive. We currently - * always include it though. 22 bytes is enough for 2^64. - * - * If the variant is a CGI script, find_content_length would - * return the length of the script, not the output it - * produces, so we check for the presence of a handler and if - * there is one we don't add a length. - * - * XXX: TODO: This check does not detect a CGI script if we - * get the variant from a type map. This needs to be fixed - * (without breaking things if the type map specifies a - * content-length, which currently leads to the correct result). - */ - if (!(variant->sub_req && variant->sub_req->handler) - && (len = find_content_length(neg, variant)) != 0) { - - lenstr = (char *) ap_palloc(r->pool, 22); - ap_snprintf(lenstr, 22, "%ld", len); - *((const char **) ap_push_array(arr)) = " {length "; - *((const char **) ap_push_array(arr)) = lenstr; - *((const char **) ap_push_array(arr)) = "}"; - } - - *((const char **) ap_push_array(arr)) = "}"; - *((const char **) ap_push_array(arr)) = ", "; /* trimmed below */ - } - - if (neg->send_alternates && neg->avail_vars->nelts) { - arr->nelts--; /* remove last comma */ - ap_table_mergen(hdrs, "Alternates", - ap_array_pstrcat(r->pool, arr, '\0')); - } - - if (neg->is_transparent || vary_by_type || vary_by_language || - vary_by_language || vary_by_charset || vary_by_encoding) { - - ap_table_mergen(hdrs, "Vary", 2 + ap_pstrcat(r->pool, - neg->is_transparent ? ", negotiate" : "", - vary_by_type ? ", accept" : "", - vary_by_language ? ", accept-language" : "", - vary_by_charset ? ", accept-charset" : "", - vary_by_encoding ? ", accept-encoding" : "", NULL)); - } - - if (neg->is_transparent) { /* Create TCN response header */ - ap_table_setn(hdrs, "TCN", - alg_result == alg_list ? "list" : "choice"); - } -} - -/********************************************************************** - * - * Return an HTML list of variants. This is output as part of the - * choice response or 406 status body. - */ - -static char *make_variant_list(request_rec *r, negotiation_state *neg) -{ - array_header *arr; - int i; - int max_vlist_array = (neg->avail_vars->nelts * 15) + 2; - - /* In order to avoid O(n^2) memory copies in building the list, - * we preallocate a table with the maximum substrings possible, - * fill it with the variant list, and then concatenate the entire array. - */ - arr = ap_make_array(r->pool, max_vlist_array, sizeof(char *)); - - *((const char **) ap_push_array(arr)) = "Available variants:\n
      \n"; - - for (i = 0; i < neg->avail_vars->nelts; ++i) { - var_rec *variant = &((var_rec *) neg->avail_vars->elts)[i]; - char *filename = variant->file_name ? variant->file_name : ""; - array_header *languages = variant->content_languages; - char *description = variant->description ? variant->description : ""; - - /* The format isn't very neat, and it would be nice to make - * the tags human readable (eg replace 'language en' with 'English'). - * Note that if you change the number of substrings pushed, you also - * need to change the calculation of max_vlist_array above. - */ - *((const char **) ap_push_array(arr)) = "
    • "; - *((const char **) ap_push_array(arr)) = filename; - *((const char **) ap_push_array(arr)) = " "; - *((const char **) ap_push_array(arr)) = description; - - if (variant->mime_type && *variant->mime_type) { - *((const char **) ap_push_array(arr)) = ", type "; - *((const char **) ap_push_array(arr)) = variant->mime_type; - } - if (languages && languages->nelts) { - *((const char **) ap_push_array(arr)) = ", language "; - *((const char **) ap_push_array(arr)) = ap_array_pstrcat(r->pool, - languages, ','); - } - if (variant->content_charset && *variant->content_charset) { - *((const char **) ap_push_array(arr)) = ", charset "; - *((const char **) ap_push_array(arr)) = variant->content_charset; - } - if (variant->content_encoding) { - *((const char **) ap_push_array(arr)) = ", encoding "; - *((const char **) ap_push_array(arr)) = variant->content_encoding; - } - *((const char **) ap_push_array(arr)) = "\n"; - } - *((const char **) ap_push_array(arr)) = "
    \n"; - - return ap_array_pstrcat(r->pool, arr, '\0'); -} - -static void store_variant_list(request_rec *r, negotiation_state *neg) -{ - if (r->main == NULL) { - ap_table_setn(r->notes, "variant-list", make_variant_list(r, neg)); - } - else { - ap_table_setn(r->main->notes, "variant-list", - make_variant_list(r->main, neg)); - } -} - -/* Called if we got a "Choice" response from the variant selection algorithm. - * It checks the result of the chosen variant to see if it - * is itself negotiated (if so, return error VARIANT_ALSO_VARIES). - * Otherwise, add the appropriate headers to the current response. - */ - -static int setup_choice_response(request_rec *r, negotiation_state *neg, - var_rec *variant) -{ - request_rec *sub_req; - const char *sub_vary; - - if (!variant->sub_req) { - int status; - - sub_req = ap_sub_req_lookup_file(variant->file_name, r); - status = sub_req->status; - - if (status != HTTP_OK && - !ap_table_get(sub_req->err_headers_out, "TCN")) { - ap_destroy_sub_req(sub_req); - return status; - } - variant->sub_req = sub_req; - } - else { - sub_req = variant->sub_req; - } - - /* The variant selection algorithm told us to return a "Choice" - * response. This is the normal variant response, with - * some extra headers. First, ensure that the chosen - * variant did or will not itself engage in transparent negotiation. - * If not, set the appropriate headers, and fall through to - * the normal variant handling - */ - - /* This catches the error that a transparent type map selects a - * transparent multiviews resource as the best variant. - * - * XXX: We do not signal an error if a transparent type map - * selects a _non_transparent multiviews resource as the best - * variant, because we can generate a legal negotiation response - * in this case. In this case, the vlist_validator of the - * nontransparent subrequest will be lost however. This could - * lead to cases in which a change in the set of variants or the - * negotiation algorithm of the nontransparent resource is never - * propagated up to a HTTP/1.1 cache which interprets Vary. To be - * completely on the safe side we should return VARIANT_ALSO_VARIES - * for this type of recursive negotiation too. - */ - if (neg->is_transparent && - ap_table_get(sub_req->err_headers_out, "TCN")) { - return VARIANT_ALSO_VARIES; - } - - /* This catches the error that a transparent type map recursively - * selects, as the best variant, another type map which itself - * causes transparent negotiation to be done. - * - * XXX: Actually, we catch this error by catching all cases of - * type map recursion. There are some borderline recursive type - * map arrangements which would not produce transparent - * negotiation protocol errors or lack of cache propagation - * problems, but such arrangements are very hard to detect at this - * point in the control flow, so we do not bother to single them - * out. - * - * Recursive type maps imply a recursive arrangement of negotiated - * resources which is visible to outside clients, and this is not - * supported by the transparent negotiation caching protocols, so - * if we are to have generic support for recursive type maps, we - * have to create some configuration setting which makes all type - * maps non-transparent when recursion is enabled. Also, if we - * want recursive type map support which ensures propagation of - * type map changes into HTTP/1.1 caches that handle Vary, we - * would have to extend the current mechanism for generating - * variant list validators. - */ - if (sub_req->handler && strcmp(sub_req->handler, "type-map") == 0) { - return VARIANT_ALSO_VARIES; - } - - /* This adds an appropriate Variant-Vary header if the subrequest - * is a multiviews resource. - * - * XXX: TODO: Note that this does _not_ handle any Vary header - * returned by a CGI if sub_req is a CGI script, because we don't - * see that Vary header yet at this point in the control flow. - * This won't cause any cache consistency problems _unless_ the - * CGI script also returns a Cache-Control header marking the - * response as cachable. This needs to be fixed, also there are - * problems if a CGI returns an Etag header which also need to be - * fixed. - */ - if ((sub_vary = ap_table_get(sub_req->err_headers_out, "Vary")) != NULL) { - ap_table_setn(r->err_headers_out, "Variant-Vary", sub_vary); - - /* Move the subreq Vary header into the main request to - * prevent having two Vary headers in the response, which - * would be legal but strange. - */ - ap_table_setn(r->err_headers_out, "Vary", sub_vary); - ap_table_unset(sub_req->err_headers_out, "Vary"); - } - - ap_table_setn(r->err_headers_out, "Content-Location", - ap_pstrdup(r->pool, variant->file_name)); - - set_neg_headers(r, neg, alg_choice); /* add Alternates and Vary */ - - /* Still to do by caller: add Expires */ - - return 0; -} - -/**************************************************************** - * - * Executive... - */ - -static int do_negotiation(request_rec *r, negotiation_state *neg, - var_rec **bestp, int prefer_scripts) -{ - var_rec *avail_recs = (var_rec *) neg->avail_vars->elts; - int alg_result; /* result of variant selection algorithm */ - int res; - int j; - - /* Decide if resource is transparently negotiable */ - - /* GET or HEAD? (HEAD has same method number as GET) */ - if (r->method_number == M_GET) { - - /* maybe this should be configurable, see also the comment - * about recursive type maps in setup_choice_response() - */ - neg->is_transparent = 1; - - /* We can't be transparent if we are a map file in the middle - * of the request URI. - */ - if (r->path_info && *r->path_info) - neg->is_transparent = 0; - - for (j = 0; j < neg->avail_vars->nelts; ++j) { - var_rec *variant = &avail_recs[j]; - - /* We can't be transparent, because of internal - * assumptions in best_match(), if there is a - * non-neighboring variant. We can have a non-neighboring - * variant when processing a type map. - */ - if (strchr(variant->file_name, '/')) - neg->is_transparent = 0; - } - } - - if (neg->is_transparent) { - parse_negotiate_header(r, neg); - } - else { /* configure negotiation on non-transparent resource */ - neg->may_choose = 1; - } - - maybe_add_default_accepts(neg, prefer_scripts); - - alg_result = best_match(neg, bestp); - - /* alg_result is one of - * alg_choice: a best variant is chosen - * alg_list: no best variant is chosen - */ - - if (alg_result == alg_list) { - /* send a list response or NOT_ACCEPTABLE error response */ - - neg->send_alternates = 1; /* always include Alternates header */ - set_neg_headers(r, neg, alg_result); - store_variant_list(r, neg); - - if (neg->is_transparent && neg->ua_supports_trans) { - /* XXX todo: expires? cachability? */ - - /* Some HTTP/1.0 clients are known to choke when they get - * a 300 (multiple choices) response without a Location - * header. However the 300 code response we are are about - * to generate will only reach 1.0 clients which support - * transparent negotiation, and they should be OK. The - * response should never reach older 1.0 clients, even if - * we have CacheNegotiatedDocs enabled, because no 1.0 - * proxy cache (we know of) will cache and return 300 - * responses (they certainly won't if they conform to the - * HTTP/1.0 specification). - */ - return MULTIPLE_CHOICES; - } - - if (!*bestp) { - ap_log_rerror(APLOG_MARK, APLOG_NOERRNO|APLOG_ERR, r, - "no acceptable variant: %s", r->filename); - return NOT_ACCEPTABLE; - } - } - - /* Variant selection chose a variant */ - - /* XXX todo: merge the two cases in the if statement below */ - if (neg->is_transparent) { - - if ((res = setup_choice_response(r, neg, *bestp)) != 0) { - return res; /* return if error */ - } - } - else { - set_neg_headers(r, neg, alg_result); - } - - /* Make sure caching works - Vary should handle HTTP/1.1, but for - * HTTP/1.0, we can't allow caching at all. - */ - - /* XXX: Note that we only set r->no_cache to 1, which causes - * Expires: to be added, when responding to a HTTP/1.0 - * client. If we return the response to a 1.1 client, we do not - * add Expires , because doing so would degrade 1.1 cache - * performance by preventing re-use of the response without prior - * revalidation. On the other hand, if the 1.1 client is a proxy - * which was itself contacted by a 1.0 client, or a proxy cache - * which can be contacted later by 1.0 clients, then we currently - * rely on this 1.1 proxy to add the Expires: when it - * forwards the response. - * - * XXX: TODO: Find out if the 1.1 spec requires proxies and - * tunnels to add Expires: when forwarding the response to - * 1.0 clients. I (kh) recall it is rather vague on this point. - * Testing actual 1.1 proxy implementations would also be nice. If - * Expires: is not added by proxies then we need to always - * include Expires: ourselves to ensure correct caching, but - * this would degrade HTTP/1.1 cache efficiency unless we also add - * Cache-Control: max-age=N, which we currently don't. - * - * Roy: No, we are not going to screw over HTTP future just to - * ensure that people who can't be bothered to upgrade their - * clients will always receive perfect server-side negotiation. - * Hell, those clients are sending bogus accept headers anyway. - * - * Manual setting of cache-control/expires always overrides this - * automated kluge, on purpose. - */ - - if ((!do_cache_negotiated_docs(r->server) - && (r->proto_num < HTTP_VERSION(1,1))) - && neg->count_multiviews_variants != 1) { - r->no_cache = 1; - } - - return OK; -} - -static int handle_map_file(request_rec *r) -{ - negotiation_state *neg = parse_accept_headers(r); - var_rec *best; - int res; - - char *udir; - - if ((res = read_type_map(neg, r))) { - return res; - } - - res = do_negotiation(r, neg, &best, 0); - if (res != 0) return res; - - if (r->path_info && *r->path_info) { - r->uri[ap_find_path_info(r->uri, r->path_info)] = '\0'; - } - udir = ap_make_dirstr_parent(r->pool, r->uri); - udir = ap_escape_uri(r->pool, udir); - ap_internal_redirect(ap_pstrcat(r->pool, udir, best->file_name, - r->path_info, NULL), r); - return OK; -} - -static int handle_multi(request_rec *r) -{ - negotiation_state *neg; - var_rec *best, *avail_recs; - request_rec *sub_req; - int res; - int j; - - if (r->finfo.st_mode != 0 || !(ap_allow_options(r) & OPT_MULTI)) { - return DECLINED; - } - - neg = parse_accept_headers(r); - - if ((res = read_types_multi(neg))) { - return_from_multi: - /* free all allocated memory from subrequests */ - avail_recs = (var_rec *) neg->avail_vars->elts; - for (j = 0; j < neg->avail_vars->nelts; ++j) { - var_rec *variant = &avail_recs[j]; - if (variant->sub_req) { - ap_destroy_sub_req(variant->sub_req); - } - } - return res; - } - if (neg->avail_vars->nelts == 0) { - return DECLINED; - } - - res = do_negotiation(r, neg, &best, - (r->method_number != M_GET) || r->args || - (r->path_info && *r->path_info)); - if (res != 0) - goto return_from_multi; - - if (!(sub_req = best->sub_req)) { - /* We got this out of a map file, so we don't actually have - * a sub_req structure yet. Get one now. - */ - - sub_req = ap_sub_req_lookup_file(best->file_name, r); - if (sub_req->status != HTTP_OK) { - res = sub_req->status; - ap_destroy_sub_req(sub_req); - goto return_from_multi; - } - } - - /* BLECH --- don't multi-resolve non-ordinary files */ - - if (!S_ISREG(sub_req->finfo.st_mode)) { - res = NOT_FOUND; - goto return_from_multi; - } - - /* Otherwise, use it. */ - - /* now do a "fast redirect" ... promote the sub_req into the main req */ - /* We need to tell POOL_DEBUG that we're guaranteeing that sub_req->pool - * will exist as long as r->pool. Otherwise we run into troubles because - * some values in this request will be allocated in r->pool, and others in - * sub_req->pool. - */ - ap_pool_join(r->pool, sub_req->pool); - r->mtime = 0; /* reset etag info for subrequest */ - r->filename = sub_req->filename; - r->handler = sub_req->handler; - r->content_type = sub_req->content_type; - r->content_encoding = sub_req->content_encoding; - r->content_languages = sub_req->content_languages; - r->content_language = sub_req->content_language; - r->finfo = sub_req->finfo; - r->per_dir_config = sub_req->per_dir_config; - /* copy output headers from subrequest, but leave negotiation headers */ - r->notes = ap_overlay_tables(r->pool, sub_req->notes, r->notes); - r->headers_out = ap_overlay_tables(r->pool, sub_req->headers_out, - r->headers_out); - r->err_headers_out = ap_overlay_tables(r->pool, sub_req->err_headers_out, - r->err_headers_out); - r->subprocess_env = ap_overlay_tables(r->pool, sub_req->subprocess_env, - r->subprocess_env); - avail_recs = (var_rec *) neg->avail_vars->elts; - for (j = 0; j < neg->avail_vars->nelts; ++j) { - var_rec *variant = &avail_recs[j]; - if (variant != best && variant->sub_req) { - ap_destroy_sub_req(variant->sub_req); - } - } - return OK; -} - -/********************************************************************** - * There is a problem with content-encoding, as some clients send and - * expect an x- token (e.g. x-gzip) while others expect the plain token - * (i.e. gzip). To try and deal with this as best as possible we do - * the following: if the client sent an Accept-Encoding header and it - * contains a plain token corresponding to the content encoding of the - * response, then set content encoding using the plain token. Else if - * the A-E header contains the x- token use the x- token in the C-E - * header. Else don't do anything. - * - * Note that if no A-E header was sent, or it does not contain a token - * compatible with the final content encoding, then the token in the - * C-E header will be whatever was specified in the AddEncoding - * directive. - */ -static int fix_encoding(request_rec *r) -{ - const char *enc = r->content_encoding; - char *x_enc = NULL; - array_header *accept_encodings; - accept_rec *accept_recs; - int i; - - if (!enc || !*enc) { - return DECLINED; - } - - if (enc[0] == 'x' && enc[1] == '-') { - enc += 2; - } - - if ((accept_encodings = do_header_line(r->pool, - ap_table_get(r->headers_in, "Accept-Encoding"))) == NULL) { - return DECLINED; - } - - accept_recs = (accept_rec *) accept_encodings->elts; - - for (i = 0; i < accept_encodings->nelts; ++i) { - char *name = accept_recs[i].name; - - if (!strcmp(name, enc)) { - r->content_encoding = name; - return OK; - } - - if (name[0] == 'x' && name[1] == '-' && !strcmp(name+2, enc)) { - x_enc = name; - } - } - - if (x_enc) { - r->content_encoding = x_enc; - return OK; - } - - return DECLINED; -} - -static const handler_rec negotiation_handlers[] = -{ - {MAP_FILE_MAGIC_TYPE, handle_map_file}, - {"type-map", handle_map_file}, - {NULL} -}; - -module MODULE_VAR_EXPORT negotiation_module = -{ - STANDARD_MODULE_STUFF, - NULL, /* initializer */ - create_neg_dir_config, /* dir config creator */ - merge_neg_dir_configs, /* dir merger --- default is to override */ - NULL, /* server config */ - NULL, /* merge server config */ - negotiation_cmds, /* command table */ - negotiation_handlers, /* handlers */ - NULL, /* filename translation */ - NULL, /* check_user_id */ - NULL, /* check auth */ - NULL, /* check access */ - handle_multi, /* type_checker */ - fix_encoding, /* fixups */ - NULL, /* logger */ - NULL, /* header parser */ - NULL, /* child_init */ - NULL, /* child_exit */ - NULL /* post read-request */ -}; diff --git a/modules/mappers/mod_negotiation.dsp b/modules/mappers/mod_negotiation.dsp deleted file mode 100644 index fd264fb1deac150beb0517f1cd25c47d45a992af..0000000000000000000000000000000000000000 --- a/modules/mappers/mod_negotiation.dsp +++ /dev/null @@ -1,128 +0,0 @@ -# Microsoft Developer Studio Project File - Name="mod_negotiation" - Package Owner=<4> -# Microsoft Developer Studio Generated Build File, Format Version 6.00 -# ** DO NOT EDIT ** - -# TARGTYPE "Win32 (x86) Dynamic-Link Library" 0x0102 - -CFG=mod_negotiation - Win32 Release -!MESSAGE This is not a valid makefile. To build this project using NMAKE, -!MESSAGE use the Export Makefile command and run -!MESSAGE -!MESSAGE NMAKE /f "mod_negotiation.mak". -!MESSAGE -!MESSAGE You can specify a configuration when running NMAKE -!MESSAGE by defining the macro CFG on the command line. For example: -!MESSAGE -!MESSAGE NMAKE /f "mod_negotiation.mak" CFG="mod_negotiation - Win32 Release" -!MESSAGE -!MESSAGE Possible choices for configuration are: -!MESSAGE -!MESSAGE "mod_negotiation - Win32 Release" (based on "Win32 (x86) Dynamic-Link Library") -!MESSAGE "mod_negotiation - Win32 Debug" (based on "Win32 (x86) Dynamic-Link Library") -!MESSAGE - -# Begin Project -# PROP AllowPerConfigDependencies 0 -# PROP Scc_ProjName "" -# PROP Scc_LocalPath "" -CPP=cl.exe -MTL=midl.exe -RSC=rc.exe - -!IF "$(CFG)" == "mod_negotiation - Win32 Release" - -# PROP BASE Use_MFC 0 -# PROP BASE Use_Debug_Libraries 0 -# PROP BASE Output_Dir "Release" -# PROP BASE Intermediate_Dir "Release" -# PROP BASE Target_Dir "" -# PROP Use_MFC 0 -# PROP Use_Debug_Libraries 0 -# PROP Output_Dir "Release" -# PROP Intermediate_Dir "Release" -# PROP Ignore_Export_Lib 0 -# PROP Target_Dir "" -# ADD BASE CPP /nologo /MD /W3 /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /FD /c -# ADD CPP /nologo /MD /W3 /O2 /I "../../include" /I "../../srclib/apr/include" /I "../../srclib/apr-util/include" /D "NDEBUG" /D "WIN32" /D "_WINDOWS" /Fd"Release\mod_negotiation" /FD /c -# ADD BASE MTL /nologo /D "NDEBUG" /win32 -# ADD MTL /nologo /D "NDEBUG" /mktyplib203 /win32 -# ADD BASE RSC /l 0x409 /d "NDEBUG" -# ADD RSC /l 0x409 /d "NDEBUG" -BSC32=bscmake.exe -# ADD BASE BSC32 /nologo -# ADD BSC32 /nologo -LINK32=link.exe -# ADD BASE LINK32 kernel32.lib /nologo /subsystem:windows /dll /map /machine:I386 /out:"Release/mod_negotiation.so" /base:@..\..\os\win32\BaseAddr.ref,mod_negotiation -# ADD LINK32 kernel32.lib /nologo /subsystem:windows /dll /map /machine:I386 /out:"Release/mod_negotiation.so" /base:@..\..\os\win32\BaseAddr.ref,mod_negotiation - -!ELSEIF "$(CFG)" == "mod_negotiation - Win32 Debug" - -# PROP BASE Use_MFC 0 -# PROP BASE Use_Debug_Libraries 1 -# PROP BASE Output_Dir "Debug" -# PROP BASE Intermediate_Dir "Debug" -# PROP BASE Target_Dir "" -# PROP Use_MFC 0 -# PROP Use_Debug_Libraries 1 -# PROP Output_Dir "Debug" -# PROP Intermediate_Dir "Debug" -# PROP Ignore_Export_Lib 0 -# PROP Target_Dir "" -# ADD BASE CPP /nologo /MDd /W3 /GX /Zi /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /FD /c -# ADD CPP /nologo /MDd /W3 /GX /Zi /Od /I "../../include" /I "../../srclib/apr/include" /I "../../srclib/apr-util/include" /D "_DEBUG" /D "WIN32" /D "_WINDOWS" /Fd"Debug\mod_negotiation" /FD /c -# ADD BASE MTL /nologo /D "_DEBUG" /win32 -# ADD MTL /nologo /D "_DEBUG" /mktyplib203 /win32 -# ADD BASE RSC /l 0x409 /d "_DEBUG" -# ADD RSC /l 0x409 /d "_DEBUG" -BSC32=bscmake.exe -# ADD BASE BSC32 /nologo -# ADD BSC32 /nologo -LINK32=link.exe -# ADD BASE LINK32 kernel32.lib /nologo /subsystem:windows /dll /incremental:no /map /debug /machine:I386 /out:"Debug/mod_negotiation.so" /base:@..\..\os\win32\BaseAddr.ref,mod_negotiation -# ADD LINK32 kernel32.lib /nologo /subsystem:windows /dll /incremental:no /map /debug /machine:I386 /out:"Debug/mod_negotiation.so" /base:@..\..\os\win32\BaseAddr.ref,mod_negotiation - -!ENDIF - -# Begin Target - -# Name "mod_negotiation - Win32 Release" -# Name "mod_negotiation - Win32 Debug" -# Begin Source File - -SOURCE=.\mod_negotiation.c -# End Source File -# Begin Source File - -SOURCE=.\mod_negotiation.rc -# End Source File -# Begin Source File - -SOURCE=..\..\build\win32\win32ver.awk - -!IF "$(CFG)" == "mod_negotiation - Win32 Release" - -# PROP Ignore_Default_Tool 1 -# Begin Custom Build - Creating Version Resource -InputPath=..\..\build\win32\win32ver.awk - -".\mod_negotiation.rc" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)" - awk -f ../../build/win32/win32ver.awk mod_negotiation "negotiation_module for Apache" ../../include/ap_release.h > .\mod_negotiation.rc - -# End Custom Build - -!ELSEIF "$(CFG)" == "mod_negotiation - Win32 Debug" - -# PROP Ignore_Default_Tool 1 -# Begin Custom Build - Creating Version Resource -InputPath=..\..\build\win32\win32ver.awk - -".\mod_negotiation.rc" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)" - awk -f ../../build/win32/win32ver.awk mod_negotiation "negotiation_module for Apache" ../../include/ap_release.h > .\mod_negotiation.rc - -# End Custom Build - -!ENDIF - -# End Source File -# End Target -# End Project diff --git a/modules/mappers/mod_negotiation.exp b/modules/mappers/mod_negotiation.exp deleted file mode 100644 index a7c18da1de85f3b75aa34156f26dfb6ad3f0c55f..0000000000000000000000000000000000000000 --- a/modules/mappers/mod_negotiation.exp +++ /dev/null @@ -1 +0,0 @@ -negotiation_module diff --git a/modules/mappers/mod_rewrite.c b/modules/mappers/mod_rewrite.c deleted file mode 100644 index c44de0dafab434a77d4c8c7713c55119a3452f23..0000000000000000000000000000000000000000 --- a/modules/mappers/mod_rewrite.c +++ /dev/null @@ -1,4263 +0,0 @@ -/* ==================================================================== - * Copyright (c) 1996-1999 The Apache Group. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in - * the documentation and/or other materials provided with the - * distribution. - * - * 3. All advertising materials mentioning features or use of this - * software must display the following acknowledgment: - * "This product includes software developed by the Apache Group - * for use in the Apache HTTP server project (http://www.apache.org/)." - * - * 4. The names "Apache Server" and "Apache Group" must not be used to - * endorse or promote products derived from this software without - * prior written permission. For written permission, please contact - * apache@apache.org. - * - * 5. Products derived from this software may not be called "Apache" - * nor may "Apache" appear in their names without prior written - * permission of the Apache Group. - * - * 6. Redistributions of any form whatsoever must retain the following - * acknowledgment: - * "This product includes software developed by the Apache Group - * for use in the Apache HTTP server project (http://www.apache.org/)." - * - * THIS SOFTWARE IS PROVIDED BY THE APACHE GROUP ``AS IS'' AND ANY - * EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR - * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE APACHE GROUP OR - * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT - * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, - * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED - * OF THE POSSIBILITY OF SUCH DAMAGE. - * ==================================================================== - * - * This software consists of voluntary contributions made by many - * individuals on behalf of the Apache Group and was originally based - * on public domain software written at the National Center for - * Supercomputing Applications, University of Illinois, Urbana-Champaign. - * For more information on the Apache Group and the Apache HTTP server - * project, please see . - * - */ - - -/* _ _ _ -** _ __ ___ ___ __| | _ __ _____ ___ __(_) |_ ___ -** | '_ ` _ \ / _ \ / _` | | '__/ _ \ \ /\ / / '__| | __/ _ \ -** | | | | | | (_) | (_| | | | | __/\ V V /| | | | || __/ -** |_| |_| |_|\___/ \__,_|___|_| \___| \_/\_/ |_| |_|\__\___| -** |_____| -** -** URL Rewriting Module -** -** This module uses a rule-based rewriting engine (based on a -** regular-expression parser) to rewrite requested URLs on the fly. -** -** It supports an unlimited number of additional rule conditions (which can -** operate on a lot of variables, even on HTTP headers) for granular -** matching and even external database lookups (either via plain text -** tables, DBM hash files or even external processes) for advanced URL -** substitution. -** -** It operates on the full URLs (including the PATH_INFO part) both in -** per-server context (httpd.conf) and per-dir context (.htaccess) and even -** can generate QUERY_STRING parts on result. The rewriting result finally -** can lead to internal subprocessing, external request redirection or even -** to internal proxy throughput. -** -** This module was originally written in April 1996 and -** gifted exclusively to the The Apache Group in July 1997 by -** -** Ralf S. Engelschall -** rse@engelschall.com -** www.engelschall.com -*/ - - -#include "mod_rewrite.h" - -#ifndef NO_WRITEV -#include -#include -#endif - -/* -** +-------------------------------------------------------+ -** | | -** | static module configuration -** | | -** +-------------------------------------------------------+ -*/ - - -/* -** Our interface to the Apache server kernel: -** -** o Runtime logic of a request is as following: -** while(request or subrequest) -** foreach(stage #0...#9) -** foreach(module) (**) -** try to run hook -** -** o the order of modules at (**) is the inverted order as -** given in the "Configuration" file, i.e. the last module -** specified is the first one called for each hook! -** The core module is always the last! -** -** o there are two different types of result checking and -** continue processing: -** for hook #0,#1,#4,#5,#6,#8: -** hook run loop stops on first modules which gives -** back a result != DECLINED, i.e. it usually returns OK -** which says "OK, module has handled this _stage_" and for #1 -** this have not to mean "Ok, the filename is now valid". -** for hook #2,#3,#7,#9: -** all hooks are run, independend of result -** -** o at the last stage, the core module always -** - says "BAD_REQUEST" if r->filename does not begin with "/" -** - prefix URL with document_root or replaced server_root -** with document_root and sets r->filename -** - always return a "OK" independed if the file really exists -** or not! -*/ - - /* The section for the Configure script: - * MODULE-DEFINITION-START - * Name: rewrite_module - * ConfigStart - . ./helpers/find-dbm-lib - if [ "x$found_dbm" = "x1" ]; then - echo " enabling DBM support for mod_rewrite" - else - echo " disabling DBM support for mod_rewrite" - echo " (perhaps you need to add -ldbm, -lndbm or -lgdbm to EXTRA_LIBS)" - CFLAGS="$CFLAGS -DNO_DBM_REWRITEMAP" - fi - * ConfigEnd - * MODULE-DEFINITION-END - */ - - /* the table of commands we provide */ -static const command_rec command_table[] = { - { "RewriteEngine", cmd_rewriteengine, NULL, OR_FILEINFO, FLAG, - "On or Off to enable or disable (default) the whole rewriting engine" }, - { "RewriteOptions", cmd_rewriteoptions, NULL, OR_FILEINFO, ITERATE, - "List of option strings to set" }, - { "RewriteBase", cmd_rewritebase, NULL, OR_FILEINFO, TAKE1, - "the base URL of the per-directory context" }, - { "RewriteCond", cmd_rewritecond, NULL, OR_FILEINFO, RAW_ARGS, - "an input string and a to be applied regexp-pattern" }, - { "RewriteRule", cmd_rewriterule, NULL, OR_FILEINFO, RAW_ARGS, - "an URL-applied regexp-pattern and a substitution URL" }, - { "RewriteMap", cmd_rewritemap, NULL, RSRC_CONF, TAKE2, - "a mapname and a filename" }, - { "RewriteLock", cmd_rewritelock, NULL, RSRC_CONF, TAKE1, - "the filename of a lockfile used for inter-process synchronization"}, - { "RewriteLog", cmd_rewritelog, NULL, RSRC_CONF, TAKE1, - "the filename of the rewriting logfile" }, - { "RewriteLogLevel", cmd_rewriteloglevel, NULL, RSRC_CONF, TAKE1, - "the level of the rewriting logfile verbosity " - "(0=none, 1=std, .., 9=max)" }, - { NULL } -}; - - /* the table of content handlers we provide */ -static const handler_rec handler_table[] = { - { "redirect-handler", handler_redirect }, - { NULL } -}; - - /* the main config structure */ -module MODULE_VAR_EXPORT rewrite_module = { - STANDARD_MODULE_STUFF, - init_module, /* module initializer */ - config_perdir_create, /* create per-dir config structures */ - config_perdir_merge, /* merge per-dir config structures */ - config_server_create, /* create per-server config structures */ - config_server_merge, /* merge per-server config structures */ - command_table, /* table of config file commands */ - handler_table, /* [#8] MIME-typed-dispatched handlers */ - hook_uri2file, /* [#1] URI to filename translation */ - NULL, /* [#4] validate user id from request */ - NULL, /* [#5] check if the user is ok _here_ */ - NULL, /* [#3] check access by host address */ - hook_mimetype, /* [#6] determine MIME type */ - hook_fixup, /* [#7] pre-run fixups */ - NULL, /* [#9] log a transaction */ - NULL, /* [#2] header parser */ - init_child, /* child_init */ - NULL, /* child_exit */ - NULL /* [#0] post read-request */ -}; - - /* the cache */ -static cache *cachep; - - /* whether proxy module is available or not */ -static int proxy_available; - -static char *lockname; -static int lockfd = -1; - -/* -** +-------------------------------------------------------+ -** | | -** | configuration directive handling -** | | -** +-------------------------------------------------------+ -*/ - -/* -** -** per-server configuration structure handling -** -*/ - -static void *config_server_create(pool *p, server_rec *s) -{ - rewrite_server_conf *a; - - a = (rewrite_server_conf *)ap_pcalloc(p, sizeof(rewrite_server_conf)); - - a->state = ENGINE_DISABLED; - a->options = OPTION_NONE; - a->rewritelogfile = NULL; - a->rewritelogfp = -1; - a->rewriteloglevel = 0; - a->rewritemaps = ap_make_array(p, 2, sizeof(rewritemap_entry)); - a->rewriteconds = ap_make_array(p, 2, sizeof(rewritecond_entry)); - a->rewriterules = ap_make_array(p, 2, sizeof(rewriterule_entry)); - a->server = s; - - return (void *)a; -} - -static void *config_server_merge(pool *p, void *basev, void *overridesv) -{ - rewrite_server_conf *a, *base, *overrides; - - a = (rewrite_server_conf *)ap_pcalloc(p, sizeof(rewrite_server_conf)); - base = (rewrite_server_conf *)basev; - overrides = (rewrite_server_conf *)overridesv; - - a->state = overrides->state; - a->options = overrides->options; - a->server = overrides->server; - - if (a->options & OPTION_INHERIT) { - /* - * local directives override - * and anything else is inherited - */ - a->rewriteloglevel = overrides->rewriteloglevel != 0 - ? overrides->rewriteloglevel - : base->rewriteloglevel; - a->rewritelogfile = overrides->rewritelogfile != NULL - ? overrides->rewritelogfile - : base->rewritelogfile; - a->rewritelogfp = overrides->rewritelogfp != -1 - ? overrides->rewritelogfp - : base->rewritelogfp; - a->rewritemaps = ap_append_arrays(p, overrides->rewritemaps, - base->rewritemaps); - a->rewriteconds = ap_append_arrays(p, overrides->rewriteconds, - base->rewriteconds); - a->rewriterules = ap_append_arrays(p, overrides->rewriterules, - base->rewriterules); - } - else { - /* - * local directives override - * and anything else gets defaults - */ - a->rewriteloglevel = overrides->rewriteloglevel; - a->rewritelogfile = overrides->rewritelogfile; - a->rewritelogfp = overrides->rewritelogfp; - a->rewritemaps = overrides->rewritemaps; - a->rewriteconds = overrides->rewriteconds; - a->rewriterules = overrides->rewriterules; - } - - return (void *)a; -} - - -/* -** -** per-directory configuration structure handling -** -*/ - -static void *config_perdir_create(pool *p, char *path) -{ - rewrite_perdir_conf *a; - - a = (rewrite_perdir_conf *)ap_pcalloc(p, sizeof(rewrite_perdir_conf)); - - a->state = ENGINE_DISABLED; - a->options = OPTION_NONE; - a->baseurl = NULL; - a->rewriteconds = ap_make_array(p, 2, sizeof(rewritecond_entry)); - a->rewriterules = ap_make_array(p, 2, sizeof(rewriterule_entry)); - - if (path == NULL) { - a->directory = NULL; - } - else { - /* make sure it has a trailing slash */ - if (path[strlen(path)-1] == '/') { - a->directory = ap_pstrdup(p, path); - } - else { - a->directory = ap_pstrcat(p, path, "/", NULL); - } - } - - return (void *)a; -} - -static void *config_perdir_merge(pool *p, void *basev, void *overridesv) -{ - rewrite_perdir_conf *a, *base, *overrides; - - a = (rewrite_perdir_conf *)ap_pcalloc(p, - sizeof(rewrite_perdir_conf)); - base = (rewrite_perdir_conf *)basev; - overrides = (rewrite_perdir_conf *)overridesv; - - a->state = overrides->state; - a->options = overrides->options; - a->directory = overrides->directory; - a->baseurl = overrides->baseurl; - - if (a->options & OPTION_INHERIT) { - a->rewriteconds = ap_append_arrays(p, overrides->rewriteconds, - base->rewriteconds); - a->rewriterules = ap_append_arrays(p, overrides->rewriterules, - base->rewriterules); - } - else { - a->rewriteconds = overrides->rewriteconds; - a->rewriterules = overrides->rewriterules; - } - - return (void *)a; -} - - -/* -** -** the configuration commands -** -*/ - -static const char *cmd_rewriteengine(cmd_parms *cmd, - rewrite_perdir_conf *dconf, int flag) -{ - rewrite_server_conf *sconf; - - sconf = - (rewrite_server_conf *)ap_get_module_config(cmd->server->module_config, - &rewrite_module); - - if (cmd->path == NULL) { /* is server command */ - sconf->state = (flag ? ENGINE_ENABLED : ENGINE_DISABLED); - } - else /* is per-directory command */ { - dconf->state = (flag ? ENGINE_ENABLED : ENGINE_DISABLED); - } - - return NULL; -} - -static const char *cmd_rewriteoptions(cmd_parms *cmd, - rewrite_perdir_conf *dconf, char *option) -{ - rewrite_server_conf *sconf; - const char *err; - - sconf = (rewrite_server_conf *) - ap_get_module_config(cmd->server->module_config, &rewrite_module); - - if (cmd->path == NULL) { /* is server command */ - err = cmd_rewriteoptions_setoption(cmd->pool, - &(sconf->options), option); - } - else { /* is per-directory command */ - err = cmd_rewriteoptions_setoption(cmd->pool, - &(dconf->options), option); - } - - return err; -} - -static const char *cmd_rewriteoptions_setoption(pool *p, int *options, - char *name) -{ - if (strcasecmp(name, "inherit") == 0) { - *options |= OPTION_INHERIT; - } - else { - return ap_pstrcat(p, "RewriteOptions: unknown option '", - name, "'\n", NULL); - } - return NULL; -} - -static const char *cmd_rewritelog(cmd_parms *cmd, void *dconf, char *a1) -{ - rewrite_server_conf *sconf; - - sconf = (rewrite_server_conf *) - ap_get_module_config(cmd->server->module_config, &rewrite_module); - - sconf->rewritelogfile = a1; - - return NULL; -} - -static const char *cmd_rewriteloglevel(cmd_parms *cmd, void *dconf, char *a1) -{ - rewrite_server_conf *sconf; - - sconf = (rewrite_server_conf *) - ap_get_module_config(cmd->server->module_config, &rewrite_module); - - sconf->rewriteloglevel = atoi(a1); - - return NULL; -} - -static const char *cmd_rewritemap(cmd_parms *cmd, void *dconf, char *a1, - char *a2) -{ - rewrite_server_conf *sconf; - rewritemap_entry *new; - struct stat st; - - sconf = (rewrite_server_conf *) - ap_get_module_config(cmd->server->module_config, &rewrite_module); - - new = ap_push_array(sconf->rewritemaps); - - new->name = a1; - new->func = NULL; - if (strncmp(a2, "txt:", 4) == 0) { - new->type = MAPTYPE_TXT; - new->datafile = a2+4; - new->checkfile = a2+4; - } - else if (strncmp(a2, "rnd:", 4) == 0) { - new->type = MAPTYPE_RND; - new->datafile = a2+4; - new->checkfile = a2+4; - } - else if (strncmp(a2, "dbm:", 4) == 0) { -#ifndef NO_DBM_REWRITEMAP - new->type = MAPTYPE_DBM; - new->datafile = a2+4; - new->checkfile = ap_pstrcat(cmd->pool, a2+4, NDBM_FILE_SUFFIX, NULL); -#else - return ap_pstrdup(cmd->pool, "RewriteMap: cannot use NDBM mapfile, " - "because no NDBM support is compiled in"); -#endif - } - else if (strncmp(a2, "prg:", 4) == 0) { - new->type = MAPTYPE_PRG; - new->datafile = a2+4; - new->checkfile = a2+4; - } - else if (strncmp(a2, "int:", 4) == 0) { - new->type = MAPTYPE_INT; - new->datafile = NULL; - new->checkfile = NULL; - if (strcmp(a2+4, "tolower") == 0) { - new->func = rewrite_mapfunc_tolower; - } - else if (strcmp(a2+4, "toupper") == 0) { - new->func = rewrite_mapfunc_toupper; - } - else if (strcmp(a2+4, "escape") == 0) { - new->func = rewrite_mapfunc_escape; - } - else if (strcmp(a2+4, "unescape") == 0) { - new->func = rewrite_mapfunc_unescape; - } - else if (sconf->state == ENGINE_ENABLED) { - return ap_pstrcat(cmd->pool, "RewriteMap: internal map not found:", - a2+4, NULL); - } - } - else { - new->type = MAPTYPE_TXT; - new->datafile = a2; - new->checkfile = a2; - } - new->fpin = -1; - new->fpout = -1; - - if (new->checkfile && (sconf->state == ENGINE_ENABLED) - && (stat(new->checkfile, &st) == -1)) { - return ap_pstrcat(cmd->pool, - "RewriteMap: map file or program not found:", - new->checkfile, NULL); - } - - return NULL; -} - -static const char *cmd_rewritelock(cmd_parms *cmd, void *dconf, char *a1) -{ - const char *error; - - if ((error = ap_check_cmd_context(cmd, GLOBAL_ONLY)) != NULL) - return error; - - lockname = a1; - - return NULL; -} - -static const char *cmd_rewritebase(cmd_parms *cmd, rewrite_perdir_conf *dconf, - char *a1) -{ - if (cmd->path == NULL || dconf == NULL) { - return "RewriteBase: only valid in per-directory config files"; - } - if (a1[0] == '\0') { - return "RewriteBase: empty URL not allowed"; - } - if (a1[0] != '/') { - return "RewriteBase: argument is not a valid URL"; - } - - dconf->baseurl = a1; - - return NULL; -} - -static const char *cmd_rewritecond(cmd_parms *cmd, rewrite_perdir_conf *dconf, - char *str) -{ - rewrite_server_conf *sconf; - rewritecond_entry *new; - regex_t *regexp; - char *a1; - char *a2; - char *a3; - char *cp; - const char *err; - int rc; - - sconf = (rewrite_server_conf *) - ap_get_module_config(cmd->server->module_config, &rewrite_module); - - /* make a new entry in the internal temporary rewrite rule list */ - if (cmd->path == NULL) { /* is server command */ - new = ap_push_array(sconf->rewriteconds); - } - else { /* is per-directory command */ - new = ap_push_array(dconf->rewriteconds); - } - - /* parse the argument line ourself */ - if (parseargline(str, &a1, &a2, &a3)) { - return ap_pstrcat(cmd->pool, "RewriteCond: bad argument line '", str, - "'\n", NULL); - } - - /* arg1: the input string */ - new->input = ap_pstrdup(cmd->pool, a1); - - /* arg3: optional flags field - (this have to be first parsed, because we need to - know if the regex should be compiled with ICASE!) */ - new->flags = CONDFLAG_NONE; - if (a3 != NULL) { - if ((err = cmd_rewritecond_parseflagfield(cmd->pool, new, - a3)) != NULL) { - return err; - } - } - - /* arg2: the pattern - try to compile the regexp to test if is ok */ - cp = a2; - if (cp[0] == '!') { - new->flags |= CONDFLAG_NOTMATCH; - cp++; - } - - /* now be careful: Under the POSIX regex library - we can compile the pattern for case-insensitive matching, - under the old V8 library we have to do it self via a hack */ - if (new->flags & CONDFLAG_NOCASE) { - rc = ((regexp = ap_pregcomp(cmd->pool, cp, REG_EXTENDED|REG_ICASE)) - == NULL); - } - else { - rc = ((regexp = ap_pregcomp(cmd->pool, cp, REG_EXTENDED)) == NULL); - } - if (rc) { - return ap_pstrcat(cmd->pool, - "RewriteCond: cannot compile regular expression '", - a2, "'\n", NULL); - } - - new->pattern = ap_pstrdup(cmd->pool, cp); - new->regexp = regexp; - - return NULL; -} - -static const char *cmd_rewritecond_parseflagfield(pool *p, - rewritecond_entry *cfg, - char *str) -{ - char *cp; - char *cp1; - char *cp2; - char *cp3; - char *key; - char *val; - const char *err; - - if (str[0] != '[' || str[strlen(str)-1] != ']') { - return "RewriteCond: bad flag delimiters"; - } - - cp = str+1; - str[strlen(str)-1] = ','; /* for simpler parsing */ - for ( ; *cp != '\0'; ) { - /* skip whitespaces */ - for ( ; (*cp == ' ' || *cp == '\t') && *cp != '\0'; cp++) - ; - if (*cp == '\0') { - break; - } - cp1 = cp; - if ((cp2 = strchr(cp, ',')) != NULL) { - cp = cp2+1; - for ( ; (*(cp2-1) == ' ' || *(cp2-1) == '\t'); cp2--) - ; - *cp2 = '\0'; - if ((cp3 = strchr(cp1, '=')) != NULL) { - *cp3 = '\0'; - key = cp1; - val = cp3+1; - } - else { - key = cp1; - val = ""; - } - if ((err = cmd_rewritecond_setflag(p, cfg, key, val)) != NULL) { - return err; - } - } - else { - break; - } - } - - return NULL; -} - -static const char *cmd_rewritecond_setflag(pool *p, rewritecond_entry *cfg, - char *key, char *val) -{ - if ( strcasecmp(key, "nocase") == 0 - || strcasecmp(key, "NC") == 0 ) { - cfg->flags |= CONDFLAG_NOCASE; - } - else if ( strcasecmp(key, "ornext") == 0 - || strcasecmp(key, "OR") == 0 ) { - cfg->flags |= CONDFLAG_ORNEXT; - } - else { - return ap_pstrcat(p, "RewriteCond: unknown flag '", key, "'\n", NULL); - } - return NULL; -} - -static const char *cmd_rewriterule(cmd_parms *cmd, rewrite_perdir_conf *dconf, - char *str) -{ - rewrite_server_conf *sconf; - rewriterule_entry *new; - regex_t *regexp; - char *a1; - char *a2; - char *a3; - char *cp; - const char *err; - int mode; - - sconf = (rewrite_server_conf *) - ap_get_module_config(cmd->server->module_config, &rewrite_module); - - /* make a new entry in the internal rewrite rule list */ - if (cmd->path == NULL) { /* is server command */ - new = ap_push_array(sconf->rewriterules); - } - else { /* is per-directory command */ - new = ap_push_array(dconf->rewriterules); - } - - /* parse the argument line ourself */ - if (parseargline(str, &a1, &a2, &a3)) { - return ap_pstrcat(cmd->pool, "RewriteRule: bad argument line '", str, - "'\n", NULL); - } - - /* arg3: optional flags field */ - new->forced_mimetype = NULL; - new->forced_responsecode = HTTP_MOVED_TEMPORARILY; - new->flags = RULEFLAG_NONE; - new->env[0] = NULL; - new->skip = 0; - if (a3 != NULL) { - if ((err = cmd_rewriterule_parseflagfield(cmd->pool, new, - a3)) != NULL) { - return err; - } - } - - /* arg1: the pattern - * try to compile the regexp to test if is ok - */ - cp = a1; - if (cp[0] == '!') { - new->flags |= RULEFLAG_NOTMATCH; - cp++; - } - mode = REG_EXTENDED; - if (new->flags & RULEFLAG_NOCASE) { - mode |= REG_ICASE; - } - if ((regexp = ap_pregcomp(cmd->pool, cp, mode)) == NULL) { - return ap_pstrcat(cmd->pool, - "RewriteRule: cannot compile regular expression '", - a1, "'\n", NULL); - } - new->pattern = ap_pstrdup(cmd->pool, cp); - new->regexp = regexp; - - /* arg2: the output string - * replace the $ by \ which is needed by the currently - * used Regular Expression library - */ - new->output = ap_pstrdup(cmd->pool, a2); - - /* now, if the server or per-dir config holds an - * array of RewriteCond entries, we take it for us - * and clear the array - */ - if (cmd->path == NULL) { /* is server command */ - new->rewriteconds = sconf->rewriteconds; - sconf->rewriteconds = ap_make_array(cmd->pool, 2, - sizeof(rewritecond_entry)); - } - else { /* is per-directory command */ - new->rewriteconds = dconf->rewriteconds; - dconf->rewriteconds = ap_make_array(cmd->pool, 2, - sizeof(rewritecond_entry)); - } - - return NULL; -} - -static const char *cmd_rewriterule_parseflagfield(pool *p, - rewriterule_entry *cfg, - char *str) -{ - char *cp; - char *cp1; - char *cp2; - char *cp3; - char *key; - char *val; - const char *err; - - if (str[0] != '[' || str[strlen(str)-1] != ']') { - return "RewriteRule: bad flag delimiters"; - } - - cp = str+1; - str[strlen(str)-1] = ','; /* for simpler parsing */ - for ( ; *cp != '\0'; ) { - /* skip whitespaces */ - for ( ; (*cp == ' ' || *cp == '\t') && *cp != '\0'; cp++) - ; - if (*cp == '\0') { - break; - } - cp1 = cp; - if ((cp2 = strchr(cp, ',')) != NULL) { - cp = cp2+1; - for ( ; (*(cp2-1) == ' ' || *(cp2-1) == '\t'); cp2--) - ; - *cp2 = '\0'; - if ((cp3 = strchr(cp1, '=')) != NULL) { - *cp3 = '\0'; - key = cp1; - val = cp3+1; - } - else { - key = cp1; - val = ""; - } - if ((err = cmd_rewriterule_setflag(p, cfg, key, val)) != NULL) { - return err; - } - } - else { - break; - } - } - - return NULL; -} - -static const char *cmd_rewriterule_setflag(pool *p, rewriterule_entry *cfg, - char *key, char *val) -{ - int status = 0; - int i; - - if ( strcasecmp(key, "redirect") == 0 - || strcasecmp(key, "R") == 0 ) { - cfg->flags |= RULEFLAG_FORCEREDIRECT; - if (strlen(val) > 0) { - if (strcasecmp(val, "permanent") == 0) { - status = HTTP_MOVED_PERMANENTLY; - } - else if (strcasecmp(val, "temp") == 0) { - status = HTTP_MOVED_TEMPORARILY; - } - else if (strcasecmp(val, "seeother") == 0) { - status = HTTP_SEE_OTHER; - } - else if (ap_isdigit(*val)) { - status = atoi(val); - } - if (!ap_is_HTTP_REDIRECT(status)) { - return "RewriteRule: invalid HTTP response code " - "for flag 'R'"; - } - cfg->forced_responsecode = status; - } - } - else if ( strcasecmp(key, "last") == 0 - || strcasecmp(key, "L") == 0 ) { - cfg->flags |= RULEFLAG_LASTRULE; - } - else if ( strcasecmp(key, "next") == 0 - || strcasecmp(key, "N") == 0 ) { - cfg->flags |= RULEFLAG_NEWROUND; - } - else if ( strcasecmp(key, "chain") == 0 - || strcasecmp(key, "C") == 0 ) { - cfg->flags |= RULEFLAG_CHAIN; - } - else if ( strcasecmp(key, "type") == 0 - || strcasecmp(key, "T") == 0 ) { - cfg->forced_mimetype = ap_pstrdup(p, val); - ap_str_tolower(cfg->forced_mimetype); - } - else if ( strcasecmp(key, "env") == 0 - || strcasecmp(key, "E") == 0 ) { - for (i = 0; (cfg->env[i] != NULL) && (i < MAX_ENV_FLAGS); i++) - ; - if (i < MAX_ENV_FLAGS) { - cfg->env[i] = ap_pstrdup(p, val); - cfg->env[i+1] = NULL; - } - else { - return "RewriteRule: too many environment flags 'E'"; - } - } - else if ( strcasecmp(key, "nosubreq") == 0 - || strcasecmp(key, "NS") == 0 ) { - cfg->flags |= RULEFLAG_IGNOREONSUBREQ; - } - else if ( strcasecmp(key, "proxy") == 0 - || strcasecmp(key, "P") == 0 ) { - cfg->flags |= RULEFLAG_PROXY; - } - else if ( strcasecmp(key, "passthrough") == 0 - || strcasecmp(key, "PT") == 0 ) { - cfg->flags |= RULEFLAG_PASSTHROUGH; - } - else if ( strcasecmp(key, "skip") == 0 - || strcasecmp(key, "S") == 0 ) { - cfg->skip = atoi(val); - } - else if ( strcasecmp(key, "forbidden") == 0 - || strcasecmp(key, "F") == 0 ) { - cfg->flags |= RULEFLAG_FORBIDDEN; - } - else if ( strcasecmp(key, "gone") == 0 - || strcasecmp(key, "G") == 0 ) { - cfg->flags |= RULEFLAG_GONE; - } - else if ( strcasecmp(key, "qsappend") == 0 - || strcasecmp(key, "QSA") == 0 ) { - cfg->flags |= RULEFLAG_QSAPPEND; - } - else if ( strcasecmp(key, "nocase") == 0 - || strcasecmp(key, "NC") == 0 ) { - cfg->flags |= RULEFLAG_NOCASE; - } - else { - return ap_pstrcat(p, "RewriteRule: unknown flag '", key, "'\n", NULL); - } - return NULL; -} - - -/* -** -** Global Module Initialization -** [called from read_config() after all -** config commands were already called] -** -*/ - -static void init_module(server_rec *s, pool *p) -{ - /* check if proxy module is available */ - proxy_available = (ap_find_linked_module("mod_proxy.c") != NULL); - - /* create the rewriting lockfile in the parent */ - rewritelock_create(s, p); - ap_register_cleanup(p, (void *)s, rewritelock_remove, ap_null_cleanup); - - /* step through the servers and - * - open each rewriting logfile - * - open the RewriteMap prg:xxx programs - */ - for (; s; s = s->next) { - open_rewritelog(s, p); - run_rewritemap_programs(s, p); - } -} - - -/* -** -** Per-Child Module Initialization -** [called after a child process is spawned] -** -*/ - -static void init_child(server_rec *s, pool *p) -{ - /* open the rewriting lockfile */ - rewritelock_open(s, p); - - /* create the lookup cache */ - cachep = init_cache(p); -} - - -/* -** +-------------------------------------------------------+ -** | | -** | runtime hooks -** | | -** +-------------------------------------------------------+ -*/ - -/* -** -** URI-to-filename hook -** -** [used for the rewriting engine triggered by -** the per-server 'RewriteRule' directives] -** -*/ - -static int hook_uri2file(request_rec *r) -{ - void *sconf; - rewrite_server_conf *conf; - const char *var; - const char *thisserver; - char *thisport; - const char *thisurl; - char buf[512]; - char docroot[512]; - char *cp, *cp2; - const char *ccp; - struct stat finfo; - unsigned int port; - int n; - int l; - - /* - * retrieve the config structures - */ - sconf = r->server->module_config; - conf = (rewrite_server_conf *)ap_get_module_config(sconf, - &rewrite_module); - - /* - * only do something under runtime if the engine is really enabled, - * else return immediately! - */ - if (conf->state == ENGINE_DISABLED) { - return DECLINED; - } - - /* - * check for the ugly API case of a virtual host section where no - * mod_rewrite directives exists. In this situation we became no chance - * by the API to setup our default per-server config so we have to - * on-the-fly assume we have the default config. But because the default - * config has a disabled rewriting engine we are lucky because can - * just stop operating now. - */ - if (conf->server != r->server) { - return DECLINED; - } - - /* - * add the SCRIPT_URL variable to the env. this is a bit complicated - * due to the fact that apache uses subrequests and internal redirects - */ - - if (r->main == NULL) { - var = ap_pstrcat(r->pool, "REDIRECT_", ENVVAR_SCRIPT_URL, NULL); - var = ap_table_get(r->subprocess_env, var); - if (var == NULL) { - ap_table_setn(r->subprocess_env, ENVVAR_SCRIPT_URL, r->uri); - } - else { - ap_table_setn(r->subprocess_env, ENVVAR_SCRIPT_URL, var); - } - } - else { - var = ap_table_get(r->main->subprocess_env, ENVVAR_SCRIPT_URL); - ap_table_setn(r->subprocess_env, ENVVAR_SCRIPT_URL, var); - } - - /* - * create the SCRIPT_URI variable for the env - */ - - /* add the canonical URI of this URL */ - thisserver = ap_get_server_name(r); - port = ap_get_server_port(r); - if (ap_is_default_port(port, r)) { - thisport = ""; - } - else { - ap_snprintf(buf, sizeof(buf), ":%u", port); - thisport = buf; - } - thisurl = ap_table_get(r->subprocess_env, ENVVAR_SCRIPT_URL); - - /* set the variable */ - var = ap_pstrcat(r->pool, ap_http_method(r), "://", thisserver, thisport, - thisurl, NULL); - ap_table_setn(r->subprocess_env, ENVVAR_SCRIPT_URI, var); - - /* if filename was not initially set, - * we start with the requested URI - */ - if (r->filename == NULL) { - r->filename = ap_pstrdup(r->pool, r->uri); - rewritelog(r, 2, "init rewrite engine with requested uri %s", - r->filename); - } - - /* - * now apply the rules ... - */ - if (apply_rewrite_list(r, conf->rewriterules, NULL)) { - - if (strlen(r->filename) > 6 && - strncmp(r->filename, "proxy:", 6) == 0) { - /* it should be go on as an internal proxy request */ - - /* check if the proxy module is enabled, so - * we can actually use it! - */ - if (!proxy_available) { - ap_log_rerror(APLOG_MARK, APLOG_NOERRNO|APLOG_ERR, r, - "attempt to make remote request from mod_rewrite " - "without proxy enabled: %s", r->filename); - return FORBIDDEN; - } - - /* make sure the QUERY_STRING and - * PATH_INFO parts get incorporated - */ - if (r->path_info != NULL) { - r->filename = ap_pstrcat(r->pool, r->filename, - r->path_info, NULL); - } - if (r->args != NULL && - r->uri == r->unparsed_uri) { - /* see proxy_http:proxy_http_canon() */ - r->filename = ap_pstrcat(r->pool, r->filename, - "?", r->args, NULL); - } - - /* now make sure the request gets handled by the proxy handler */ - r->proxyreq = 1; - r->handler = "proxy-server"; - - rewritelog(r, 1, "go-ahead with proxy request %s [OK]", - r->filename); - return OK; - } - else if ( (strlen(r->filename) > 7 && - strncasecmp(r->filename, "http://", 7) == 0) - || (strlen(r->filename) > 8 && - strncasecmp(r->filename, "https://", 8) == 0) - || (strlen(r->filename) > 9 && - strncasecmp(r->filename, "gopher://", 9) == 0) - || (strlen(r->filename) > 6 && - strncasecmp(r->filename, "ftp://", 6) == 0) ) { - /* it was finally rewritten to a remote URL */ - - /* skip 'scheme:' */ - for (cp = r->filename; *cp != ':' && *cp != '\0'; cp++) - ; - /* skip '://' */ - cp += 3; - /* skip host part */ - for ( ; *cp != '/' && *cp != '\0'; cp++) - ; - if (*cp != '\0') { - rewritelog(r, 1, "escaping %s for redirect", r->filename); - cp2 = ap_escape_uri(r->pool, cp); - *cp = '\0'; - r->filename = ap_pstrcat(r->pool, r->filename, cp2, NULL); - } - - /* append the QUERY_STRING part */ - if (r->args != NULL) { - r->filename = ap_pstrcat(r->pool, r->filename, - "?", r->args, NULL); - } - - /* determine HTTP redirect response code */ - if (ap_is_HTTP_REDIRECT(r->status)) { - n = r->status; - r->status = HTTP_OK; /* make Apache kernel happy */ - } - else { - n = REDIRECT; - } - - /* now do the redirection */ - ap_table_setn(r->headers_out, "Location", r->filename); - rewritelog(r, 1, "redirect to %s [REDIRECT/%d]", r->filename, n); - return n; - } - else if (strlen(r->filename) > 10 && - strncmp(r->filename, "forbidden:", 10) == 0) { - /* This URLs is forced to be forbidden for the requester */ - return FORBIDDEN; - } - else if (strlen(r->filename) > 5 && - strncmp(r->filename, "gone:", 5) == 0) { - /* This URLs is forced to be gone */ - return HTTP_GONE; - } - else if (strlen(r->filename) > 12 && - strncmp(r->filename, "passthrough:", 12) == 0) { - /* - * Hack because of underpowered API: passing the current - * rewritten filename through to other URL-to-filename handlers - * just as it were the requested URL. This is to enable - * post-processing by mod_alias, etc. which always act on - * r->uri! The difference here is: We do not try to - * add the document root - */ - r->uri = ap_pstrdup(r->pool, r->filename+12); - return DECLINED; - } - else { - /* it was finally rewritten to a local path */ - - /* expand "/~user" prefix */ -#ifndef WIN32 - r->filename = expand_tildepaths(r, r->filename); -#endif - rewritelog(r, 2, "local path result: %s", r->filename); - - /* the filename has to start with a slash! */ - if (r->filename[0] != '/') { - return BAD_REQUEST; - } - - /* if there is no valid prefix, we have - * to emulate the translator from the core and - * prefix the filename with document_root - * - * NOTICE: - * We cannot leave out the prefix_stat because - * - when we always prefix with document_root - * then no absolute path can be created, e.g. via - * emulating a ScriptAlias directive, etc. - * - when we always NOT prefix with document_root - * then the files under document_root have to - * be references directly and document_root - * gets never used and will be a dummy parameter - - * this is also bad - * - * BUT: - * Under real Unix systems this is no problem, - * because we only do stat() on the first directory - * and this gets cached by the kernel for along time! - */ - n = prefix_stat(r->filename, &finfo); - if (n == 0) { - if ((ccp = ap_document_root(r)) != NULL) { - l = ap_cpystrn(docroot, ccp, sizeof(docroot)) - docroot; - - /* always NOT have a trailing slash */ - if (docroot[l-1] == '/') { - docroot[l-1] = '\0'; - } - if (r->server->path - && !strncmp(r->filename, r->server->path, - r->server->pathlen)) { - r->filename = ap_pstrcat(r->pool, docroot, - (r->filename + - r->server->pathlen), NULL); - } - else { - r->filename = ap_pstrcat(r->pool, docroot, - r->filename, NULL); - } - rewritelog(r, 2, "prefixed with document_root to %s", - r->filename); - } - } - - rewritelog(r, 1, "go-ahead with %s [OK]", r->filename); - return OK; - } - } - else { - rewritelog(r, 1, "pass through %s", r->filename); - return DECLINED; - } -} - - -/* -** -** MIME-type hook -** -** [used to support the forced-MIME-type feature] -** -*/ - -static int hook_mimetype(request_rec *r) -{ - const char *t; - - /* now check if we have to force a MIME-type */ - t = ap_table_get(r->notes, REWRITE_FORCED_MIMETYPE_NOTEVAR); - if (t == NULL) { - return DECLINED; - } - else { - rewritelog(r, 1, "force filename %s to have MIME-type '%s'", - r->filename, t); - r->content_type = t; - return OK; - } -} - - -/* -** -** Fixup hook -** -** [used for the rewriting engine triggered by -** the per-directory 'RewriteRule' directives] -** -*/ - -static int hook_fixup(request_rec *r) -{ - rewrite_perdir_conf *dconf; - char *cp; - char *cp2; - const char *ccp; - char *prefix; - int l; - int n; - char *ofilename; - - dconf = (rewrite_perdir_conf *)ap_get_module_config(r->per_dir_config, - &rewrite_module); - - /* if there is no per-dir config we return immediately */ - if (dconf == NULL) { - return DECLINED; - } - - /* we shouldn't do anything in subrequests */ - if (r->main != NULL) { - return DECLINED; - } - - /* if there are no real (i.e. no RewriteRule directives!) - per-dir config of us, we return also immediately */ - if (dconf->directory == NULL) { - return DECLINED; - } - - /* - * only do something under runtime if the engine is really enabled, - * for this directory, else return immediately! - */ - if (!(ap_allow_options(r) & (OPT_SYM_LINKS | OPT_SYM_OWNER))) { - /* FollowSymLinks is mandatory! */ - ap_log_rerror(APLOG_MARK, APLOG_NOERRNO|APLOG_ERR, r, - "Options FollowSymLinks or SymLinksIfOwnerMatch is off " - "which implies that RewriteRule directive is forbidden: " - "%s", r->filename); - return FORBIDDEN; - } - else { - /* FollowSymLinks is given, but the user can - * still turn off the rewriting engine - */ - if (dconf->state == ENGINE_DISABLED) { - return DECLINED; - } - } - - /* - * remember the current filename before rewriting for later check - * to prevent deadlooping because of internal redirects - * on final URL/filename which can be equal to the inital one. - */ - ofilename = r->filename; - - /* - * now apply the rules ... - */ - if (apply_rewrite_list(r, dconf->rewriterules, dconf->directory)) { - - if (strlen(r->filename) > 6 && - strncmp(r->filename, "proxy:", 6) == 0) { - /* it should go on as an internal proxy request */ - - /* make sure the QUERY_STRING and - * PATH_INFO parts get incorporated - * (r->path_info was already appended by the - * rewriting engine because of the per-dir context!) - */ - if (r->args != NULL - && r->uri == r->unparsed_uri) { - /* see proxy_http:proxy_http_canon() */ - r->filename = ap_pstrcat(r->pool, r->filename, - "?", r->args, NULL); - } - - /* now make sure the request gets handled by the proxy handler */ - r->proxyreq = 1; - r->handler = "proxy-server"; - - rewritelog(r, 1, "[per-dir %s] go-ahead with proxy request " - "%s [OK]", dconf->directory, r->filename); - return OK; - } - else if ( (strlen(r->filename) > 7 && - strncmp(r->filename, "http://", 7) == 0) - || (strlen(r->filename) > 8 && - strncmp(r->filename, "https://", 8) == 0) - || (strlen(r->filename) > 9 && - strncmp(r->filename, "gopher://", 9) == 0) - || (strlen(r->filename) > 6 && - strncmp(r->filename, "ftp://", 6) == 0) ) { - /* it was finally rewritten to a remote URL */ - - /* because we are in a per-dir context - * first try to replace the directory with its base-URL - * if there is a base-URL available - */ - if (dconf->baseurl != NULL) { - /* skip 'scheme:' */ - for (cp = r->filename; *cp != ':' && *cp != '\0'; cp++) - ; - /* skip '://' */ - cp += 3; - if ((cp = strchr(cp, '/')) != NULL) { - rewritelog(r, 2, - "[per-dir %s] trying to replace " - "prefix %s with %s", - dconf->directory, dconf->directory, - dconf->baseurl); - cp2 = subst_prefix_path(r, cp, dconf->directory, - dconf->baseurl); - if (strcmp(cp2, cp) != 0) { - *cp = '\0'; - r->filename = ap_pstrcat(r->pool, r->filename, - cp2, NULL); - } - } - } - - /* now prepare the redirect... */ - - /* skip 'scheme:' */ - for (cp = r->filename; *cp != ':' && *cp != '\0'; cp++) - ; - /* skip '://' */ - cp += 3; - /* skip host part */ - for ( ; *cp != '/' && *cp != '\0'; cp++) - ; - if (*cp != '\0') { - rewritelog(r, 1, "[per-dir %s] escaping %s for redirect", - dconf->directory, r->filename); - cp2 = ap_escape_uri(r->pool, cp); - *cp = '\0'; - r->filename = ap_pstrcat(r->pool, r->filename, cp2, NULL); - } - - /* append the QUERY_STRING part */ - if (r->args != NULL) { - r->filename = ap_pstrcat(r->pool, r->filename, - "?", r->args, NULL); - } - - /* determine HTTP redirect response code */ - if (ap_is_HTTP_REDIRECT(r->status)) { - n = r->status; - r->status = HTTP_OK; /* make Apache kernel happy */ - } - else { - n = REDIRECT; - } - - /* now do the redirection */ - ap_table_setn(r->headers_out, "Location", r->filename); - rewritelog(r, 1, "[per-dir %s] redirect to %s [REDIRECT/%d]", - dconf->directory, r->filename, n); - return n; - } - else if (strlen(r->filename) > 10 && - strncmp(r->filename, "forbidden:", 10) == 0) { - /* This URL is forced to be forbidden for the requester */ - return FORBIDDEN; - } - else if (strlen(r->filename) > 5 && - strncmp(r->filename, "gone:", 5) == 0) { - /* This URL is forced to be gone */ - return HTTP_GONE; - } - else { - /* it was finally rewritten to a local path */ - - /* if someone used the PASSTHROUGH flag in per-dir - * context we just ignore it. It is only useful - * in per-server context - */ - if (strlen(r->filename) > 12 && - strncmp(r->filename, "passthrough:", 12) == 0) { - r->filename = ap_pstrdup(r->pool, r->filename+12); - } - - /* the filename has to start with a slash! */ - if (r->filename[0] != '/') { - return BAD_REQUEST; - } - - /* Check for deadlooping: - * At this point we KNOW that at least one rewriting - * rule was applied, but when the resulting URL is - * the same as the initial URL, we are not allowed to - * use the following internal redirection stuff because - * this would lead to a deadloop. - */ - if (strcmp(r->filename, ofilename) == 0) { - rewritelog(r, 1, "[per-dir %s] initial URL equal rewritten " - "URL: %s [IGNORING REWRITE]", - dconf->directory, r->filename); - return OK; - } - - /* if there is a valid base-URL then substitute - * the per-dir prefix with this base-URL if the - * current filename still is inside this per-dir - * context. If not then treat the result as a - * plain URL - */ - if (dconf->baseurl != NULL) { - rewritelog(r, 2, - "[per-dir %s] trying to replace prefix %s with %s", - dconf->directory, dconf->directory, dconf->baseurl); - r->filename = subst_prefix_path(r, r->filename, - dconf->directory, - dconf->baseurl); - } - else { - /* if no explicit base-URL exists we assume - * that the directory prefix is also a valid URL - * for this webserver and only try to remove the - * document_root if it is prefix - */ - if ((ccp = ap_document_root(r)) != NULL) { - prefix = ap_pstrdup(r->pool, ccp); - /* always NOT have a trailing slash */ - l = strlen(prefix); - if (prefix[l-1] == '/') { - prefix[l-1] = '\0'; - l--; - } - if (strncmp(r->filename, prefix, l) == 0) { - rewritelog(r, 2, - "[per-dir %s] strip document_root " - "prefix: %s -> %s", - dconf->directory, r->filename, - r->filename+l); - r->filename = ap_pstrdup(r->pool, r->filename+l); - } - } - } - - /* now initiate the internal redirect */ - rewritelog(r, 1, "[per-dir %s] internal redirect with %s " - "[INTERNAL REDIRECT]", dconf->directory, r->filename); - r->filename = ap_pstrcat(r->pool, "redirect:", r->filename, NULL); - r->handler = "redirect-handler"; - return OK; - } - } - else { - rewritelog(r, 1, "[per-dir %s] pass through %s", - dconf->directory, r->filename); - return DECLINED; - } -} - - -/* -** -** Content-Handlers -** -** [used for redirect support] -** -*/ - -static int handler_redirect(request_rec *r) -{ - /* just make sure that we are really meant! */ - if (strncmp(r->filename, "redirect:", 9) != 0) { - return DECLINED; - } - - /* now do the internal redirect */ - ap_internal_redirect(ap_pstrcat(r->pool, r->filename+9, - r->args ? "?" : NULL, r->args, NULL), r); - - /* and return gracefully */ - return OK; -} - - -/* -** +-------------------------------------------------------+ -** | | -** | the rewriting engine -** | | -** +-------------------------------------------------------+ -*/ - -/* - * Apply a complete rule set, - * i.e. a list of rewrite rules - */ -static int apply_rewrite_list(request_rec *r, array_header *rewriterules, - char *perdir) -{ - rewriterule_entry *entries; - rewriterule_entry *p; - int i; - int changed; - int rc; - int s; - - /* - * Iterate over all existing rules - */ - entries = (rewriterule_entry *)rewriterules->elts; - changed = 0; - loop: - for (i = 0; i < rewriterules->nelts; i++) { - p = &entries[i]; - - /* - * Ignore this rule on subrequests if we are explicitly - * asked to do so or this is a proxy-throughput or a - * forced redirect rule. - */ - if (r->main != NULL && - (p->flags & RULEFLAG_IGNOREONSUBREQ || - p->flags & RULEFLAG_PROXY || - p->flags & RULEFLAG_FORCEREDIRECT )) { - continue; - } - - /* - * Apply the current rule. - */ - rc = apply_rewrite_rule(r, p, perdir); - if (rc) { - /* - * Indicate a change if this was not a match-only rule. - */ - if (rc != 2) { - changed = 1; - } - - /* - * Pass-Through Feature (`RewriteRule .. .. [PT]'): - * Because the Apache 1.x API is very limited we - * need this hack to pass the rewritten URL to other - * modules like mod_alias, mod_userdir, etc. - */ - if (p->flags & RULEFLAG_PASSTHROUGH) { - rewritelog(r, 2, "forcing '%s' to get passed through " - "to next API URI-to-filename handler", r->filename); - r->filename = ap_pstrcat(r->pool, "passthrough:", - r->filename, NULL); - changed = 1; - break; - } - - /* - * Rule has the "forbidden" flag set which means that - * we stop processing and indicate this to the caller. - */ - if (p->flags & RULEFLAG_FORBIDDEN) { - rewritelog(r, 2, "forcing '%s' to be forbidden", r->filename); - r->filename = ap_pstrcat(r->pool, "forbidden:", - r->filename, NULL); - changed = 1; - break; - } - - /* - * Rule has the "gone" flag set which means that - * we stop processing and indicate this to the caller. - */ - if (p->flags & RULEFLAG_GONE) { - rewritelog(r, 2, "forcing '%s' to be gone", r->filename); - r->filename = ap_pstrcat(r->pool, "gone:", r->filename, NULL); - changed = 1; - break; - } - - /* - * Stop processing also on proxy pass-through and - * last-rule and new-round flags. - */ - if (p->flags & RULEFLAG_PROXY) { - break; - } - if (p->flags & RULEFLAG_LASTRULE) { - break; - } - - /* - * On "new-round" flag we just start from the top of - * the rewriting ruleset again. - */ - if (p->flags & RULEFLAG_NEWROUND) { - goto loop; - } - - /* - * If we are forced to skip N next rules, do it now. - */ - if (p->skip > 0) { - s = p->skip; - while ( i < rewriterules->nelts - && s > 0) { - i++; - p = &entries[i]; - s--; - } - } - } - else { - /* - * If current rule is chained with next rule(s), - * skip all this next rule(s) - */ - while ( i < rewriterules->nelts - && p->flags & RULEFLAG_CHAIN) { - i++; - p = &entries[i]; - } - } - } - return changed; -} - -/* - * Apply a single(!) rewrite rule - */ -static int apply_rewrite_rule(request_rec *r, rewriterule_entry *p, - char *perdir) -{ - char *uri; - char *output; - const char *vary; - char newuri[MAX_STRING_LEN]; - char env[MAX_STRING_LEN]; - regex_t *regexp; - regmatch_t regmatch[MAX_NMATCH]; - backrefinfo *briRR = NULL; - backrefinfo *briRC = NULL; - int prefixstrip; - int failed; - array_header *rewriteconds; - rewritecond_entry *conds; - rewritecond_entry *c; - int i; - int rc; - - /* - * Initialisation - */ - uri = r->filename; - regexp = p->regexp; - output = p->output; - - /* - * Add (perhaps splitted away) PATH_INFO postfix to URL to - * make sure we really match against the complete URL. - */ - if (perdir != NULL && r->path_info != NULL && r->path_info[0] != '\0') { - rewritelog(r, 3, "[per-dir %s] add path-info postfix: %s -> %s%s", - perdir, uri, uri, r->path_info); - uri = ap_pstrcat(r->pool, uri, r->path_info, NULL); - } - - /* - * On per-directory context (.htaccess) strip the location - * prefix from the URL to make sure patterns apply only to - * the local part. Additionally indicate this special - * threatment in the logfile. - */ - prefixstrip = 0; - if (perdir != NULL) { - if ( strlen(uri) >= strlen(perdir) - && strncmp(uri, perdir, strlen(perdir)) == 0) { - rewritelog(r, 3, "[per-dir %s] strip per-dir prefix: %s -> %s", - perdir, uri, uri+strlen(perdir)); - uri = uri+strlen(perdir); - prefixstrip = 1; - } - } - - /* - * Try to match the URI against the RewriteRule pattern - * and exit immeddiately if it didn't apply. - */ - if (perdir == NULL) { - rewritelog(r, 3, "applying pattern '%s' to uri '%s'", - p->pattern, uri); - } - else { - rewritelog(r, 3, "[per-dir %s] applying pattern '%s' to uri '%s'", - perdir, p->pattern, uri); - } - rc = (ap_regexec(regexp, uri, regexp->re_nsub+1, regmatch, 0) == 0); - if (! (( rc && !(p->flags & RULEFLAG_NOTMATCH)) || - (!rc && (p->flags & RULEFLAG_NOTMATCH)) ) ) { - return 0; - } - - /* - * Else create the RewriteRule `regsubinfo' structure which - * holds the substitution information. - */ - briRR = (backrefinfo *)ap_palloc(r->pool, sizeof(backrefinfo)); - if (!rc && (p->flags & RULEFLAG_NOTMATCH)) { - /* empty info on negative patterns */ - briRR->source = ""; - briRR->nsub = 0; - } - else { - briRR->source = ap_pstrdup(r->pool, uri); - briRR->nsub = regexp->re_nsub; - memcpy((void *)(briRR->regmatch), (void *)(regmatch), - sizeof(regmatch)); - } - - /* - * Initiallally create the RewriteCond backrefinfo with - * empty backrefinfo, i.e. not subst parts - * (this one is adjusted inside apply_rewrite_cond() later!!) - */ - briRC = (backrefinfo *)ap_pcalloc(r->pool, sizeof(backrefinfo)); - briRC->source = ""; - briRC->nsub = 0; - - /* - * Ok, we already know the pattern has matched, but we now - * additionally have to check for all existing preconditions - * (RewriteCond) which have to be also true. We do this at - * this very late stage to avoid unnessesary checks which - * would slow down the rewriting engine!! - */ - rewriteconds = p->rewriteconds; - conds = (rewritecond_entry *)rewriteconds->elts; - failed = 0; - for (i = 0; i < rewriteconds->nelts; i++) { - c = &conds[i]; - rc = apply_rewrite_cond(r, c, perdir, briRR, briRC); - if (c->flags & CONDFLAG_ORNEXT) { - /* - * The "OR" case - */ - if (rc == 0) { - /* One condition is false, but another can be - * still true, so we have to continue... - */ - ap_table_unset(r->notes, VARY_KEY_THIS); - continue; - } - else { - /* One true condition is enough in "or" case, so - * skip the other conditions which are "ornext" - * chained - */ - while ( i < rewriteconds->nelts - && c->flags & CONDFLAG_ORNEXT) { - i++; - c = &conds[i]; - } - continue; - } - } - else { - /* - * The "AND" case, i.e. no "or" flag, - * so a single failure means total failure. - */ - if (rc == 0) { - failed = 1; - break; - } - } - vary = ap_table_get(r->notes, VARY_KEY_THIS); - if (vary != NULL) { - ap_table_merge(r->notes, VARY_KEY, vary); - ap_table_unset(r->notes, VARY_KEY_THIS); - } - } - /* if any condition fails the complete rule fails */ - if (failed) { - ap_table_unset(r->notes, VARY_KEY); - ap_table_unset(r->notes, VARY_KEY_THIS); - return 0; - } - - /* - * Regardless of what we do next, we've found a match. Check to see - * if any of the request header fields were involved, and add them - * to the Vary field of the response. - */ - if ((vary = ap_table_get(r->notes, VARY_KEY)) != NULL) { - ap_table_merge(r->headers_out, "Vary", vary); - ap_table_unset(r->notes, VARY_KEY); - } - - /* - * If this is a pure matching rule (`RewriteRule -') - * we stop processing and return immediately. The only thing - * we have not to forget are the environment variables - * (`RewriteRule - [E=...]') - */ - if (strcmp(output, "-") == 0) { - for (i = 0; p->env[i] != NULL; i++) { - /* 1. take the string */ - ap_cpystrn(env, p->env[i], sizeof(env)); - /* 2. expand $N (i.e. backrefs to RewriteRule pattern) */ - expand_backref_inbuffer(r->pool, env, sizeof(env), briRR, '$'); - /* 3. expand %N (i.e. backrefs to latest RewriteCond pattern) */ - expand_backref_inbuffer(r->pool, env, sizeof(env), briRC, '%'); - /* 4. expand %{...} (i.e. variables) */ - expand_variables_inbuffer(r, env, sizeof(env)); - /* 5. expand ${...} (RewriteMap lookups) */ - expand_map_lookups(r, env, sizeof(env)); - /* and add the variable to Apache's structures */ - add_env_variable(r, env); - } - if (p->forced_mimetype != NULL) { - if (perdir == NULL) { - /* In the per-server context we can force the MIME-type - * the correct way by notifying our MIME-type hook handler - * to do the job when the MIME-type API stage is reached. - */ - rewritelog(r, 2, "remember %s to have MIME-type '%s'", - r->filename, p->forced_mimetype); - ap_table_setn(r->notes, REWRITE_FORCED_MIMETYPE_NOTEVAR, - p->forced_mimetype); - } - else { - /* In per-directory context we operate in the Fixup API hook - * which is after the MIME-type hook, so our MIME-type handler - * has no chance to set r->content_type. And because we are - * in the situation where no substitution takes place no - * sub-request will happen (which could solve the - * restriction). As a workaround we do it ourself now - * immediately although this is not strictly API-conforming. - * But it's the only chance we have... - */ - rewritelog(r, 1, "[per-dir %s] force %s to have MIME-type " - "'%s'", perdir, r->filename, p->forced_mimetype); - r->content_type = p->forced_mimetype; - } - } - return 2; - } - - /* - * Ok, now we finally know all patterns have matched and - * that there is something to replace, so we create the - * substitution URL string in `newuri'. - */ - /* 1. take the output string */ - ap_cpystrn(newuri, output, sizeof(newuri)); - /* 2. expand $N (i.e. backrefs to RewriteRule pattern) */ - expand_backref_inbuffer(r->pool, newuri, sizeof(newuri), briRR, '$'); - /* 3. expand %N (i.e. backrefs to latest RewriteCond pattern) */ - expand_backref_inbuffer(r->pool, newuri, sizeof(newuri), briRC, '%'); - /* 4. expand %{...} (i.e. variables) */ - expand_variables_inbuffer(r, newuri, sizeof(newuri)); - /* 5. expand ${...} (RewriteMap lookups) */ - expand_map_lookups(r, newuri, sizeof(newuri)); - /* and log the result... */ - if (perdir == NULL) { - rewritelog(r, 2, "rewrite %s -> %s", uri, newuri); - } - else { - rewritelog(r, 2, "[per-dir %s] rewrite %s -> %s", perdir, uri, newuri); - } - - /* - * Additionally do expansion for the environment variable - * strings (`RewriteRule .. .. [E=]'). - */ - for (i = 0; p->env[i] != NULL; i++) { - /* 1. take the string */ - ap_cpystrn(env, p->env[i], sizeof(env)); - /* 2. expand $N (i.e. backrefs to RewriteRule pattern) */ - expand_backref_inbuffer(r->pool, env, sizeof(env), briRR, '$'); - /* 3. expand %N (i.e. backrefs to latest RewriteCond pattern) */ - expand_backref_inbuffer(r->pool, env, sizeof(env), briRC, '%'); - /* 4. expand %{...} (i.e. variables) */ - expand_variables_inbuffer(r, env, sizeof(env)); - /* 5. expand ${...} (RewriteMap lookups) */ - expand_map_lookups(r, env, sizeof(env)); - /* and add the variable to Apache's structures */ - add_env_variable(r, env); - } - - /* - * Now replace API's knowledge of the current URI: - * Replace r->filename with the new URI string and split out - * an on-the-fly generated QUERY_STRING part into r->args - */ - r->filename = ap_pstrdup(r->pool, newuri); - splitout_queryargs(r, p->flags & RULEFLAG_QSAPPEND); - - /* - * Again add the previously stripped per-directory location - * prefix if the new URI is not a new one for this - * location, i.e. if it's not starting with either a slash - * or a fully qualified URL scheme. - */ - i = strlen(r->filename); - if ( prefixstrip - && !( r->filename[0] == '/' - || ( (i > 7 && strncasecmp(r->filename, "http://", 7) == 0) - || (i > 8 && strncasecmp(r->filename, "https://", 8) == 0) - || (i > 9 && strncasecmp(r->filename, "gopher://", 9) == 0) - || (i > 6 && strncasecmp(r->filename, "ftp://", 6) == 0)))) { - rewritelog(r, 3, "[per-dir %s] add per-dir prefix: %s -> %s%s", - perdir, r->filename, perdir, r->filename); - r->filename = ap_pstrcat(r->pool, perdir, r->filename, NULL); - } - - /* - * If this rule is forced for proxy throughput - * (`RewriteRule ... ... [P]') then emulate mod_proxy's - * URL-to-filename handler to be sure mod_proxy is triggered - * for this URL later in the Apache API. But make sure it is - * a fully-qualified URL. (If not it is qualified with - * ourself). - */ - if (p->flags & RULEFLAG_PROXY) { - fully_qualify_uri(r); - if (perdir == NULL) { - rewritelog(r, 2, "forcing proxy-throughput with %s", r->filename); - } - else { - rewritelog(r, 2, "[per-dir %s] forcing proxy-throughput with %s", - perdir, r->filename); - } - r->filename = ap_pstrcat(r->pool, "proxy:", r->filename, NULL); - return 1; - } - - /* - * If this rule is explicitly forced for HTTP redirection - * (`RewriteRule .. .. [R]') then force an external HTTP - * redirect. But make sure it is a fully-qualified URL. (If - * not it is qualified with ourself). - */ - if (p->flags & RULEFLAG_FORCEREDIRECT) { - fully_qualify_uri(r); - if (perdir == NULL) { - rewritelog(r, 2, - "explicitly forcing redirect with %s", r->filename); - } - else { - rewritelog(r, 2, - "[per-dir %s] explicitly forcing redirect with %s", - perdir, r->filename); - } - r->status = p->forced_responsecode; - return 1; - } - - /* - * Special Rewriting Feature: Self-Reduction - * We reduce the URL by stripping a possible - * http[s]://[:] prefix, i.e. a prefix which - * corresponds to ourself. This is to simplify rewrite maps - * and to avoid recursion, etc. When this prefix is not a - * coincidence then the user has to use [R] explicitly (see - * above). - */ - reduce_uri(r); - - /* - * If this rule is still implicitly forced for HTTP - * redirection (`RewriteRule .. ://...') then - * directly force an external HTTP redirect. - */ - i = strlen(r->filename); - if ( (i > 7 && strncasecmp(r->filename, "http://", 7) == 0) - || (i > 8 && strncasecmp(r->filename, "https://", 8) == 0) - || (i > 9 && strncasecmp(r->filename, "gopher://", 9) == 0) - || (i > 6 && strncasecmp(r->filename, "ftp://", 6) == 0)) { - if (perdir == NULL) { - rewritelog(r, 2, - "implicitly forcing redirect (rc=%d) with %s", - p->forced_responsecode, r->filename); - } - else { - rewritelog(r, 2, "[per-dir %s] implicitly forcing redirect " - "(rc=%d) with %s", perdir, p->forced_responsecode, - r->filename); - } - r->status = p->forced_responsecode; - return 1; - } - - /* - * Now we are sure it is not a fully qualified URL. But - * there is still one special case left: A local rewrite in - * per-directory context, i.e. a substitution URL which does - * not start with a slash. Here we add again the initially - * stripped per-directory prefix. - */ - if (prefixstrip && r->filename[0] != '/') { - rewritelog(r, 3, "[per-dir %s] add per-dir prefix: %s -> %s%s", - perdir, r->filename, perdir, r->filename); - r->filename = ap_pstrcat(r->pool, perdir, r->filename, NULL); - } - - /* - * Finally we had to remember if a MIME-type should be - * forced for this URL (`RewriteRule .. .. [T=]') - * Later in the API processing phase this is forced by our - * MIME API-hook function. This time its no problem even for - * the per-directory context (where the MIME-type hook was - * already processed) because a sub-request happens ;-) - */ - if (p->forced_mimetype != NULL) { - ap_table_setn(r->notes, REWRITE_FORCED_MIMETYPE_NOTEVAR, - p->forced_mimetype); - if (perdir == NULL) { - rewritelog(r, 2, "remember %s to have MIME-type '%s'", - r->filename, p->forced_mimetype); - } - else { - rewritelog(r, 2, - "[per-dir %s] remember %s to have MIME-type '%s'", - perdir, r->filename, p->forced_mimetype); - } - } - - /* - * Puuhhhhhhhh... WHAT COMPLICATED STUFF ;_) - * But now we're done for this particular rule. - */ - return 1; -} - -static int apply_rewrite_cond(request_rec *r, rewritecond_entry *p, - char *perdir, backrefinfo *briRR, - backrefinfo *briRC) -{ - char input[MAX_STRING_LEN]; - struct stat sb; - request_rec *rsub; - regmatch_t regmatch[MAX_NMATCH]; - int rc; - - /* - * Construct the string we match against - */ - - /* 1. take the string */ - ap_cpystrn(input, p->input, sizeof(input)); - /* 2. expand $N (i.e. backrefs to RewriteRule pattern) */ - expand_backref_inbuffer(r->pool, input, sizeof(input), briRR, '$'); - /* 3. expand %N (i.e. backrefs to latest RewriteCond pattern) */ - expand_backref_inbuffer(r->pool, input, sizeof(input), briRC, '%'); - /* 4. expand %{...} (i.e. variables) */ - expand_variables_inbuffer(r, input, sizeof(input)); - /* 5. expand ${...} (RewriteMap lookups) */ - expand_map_lookups(r, input, sizeof(input)); - - /* - * Apply the patterns - */ - - rc = 0; - if (strcmp(p->pattern, "-f") == 0) { - if (stat(input, &sb) == 0) { - if (S_ISREG(sb.st_mode)) { - rc = 1; - } - } - } - else if (strcmp(p->pattern, "-s") == 0) { - if (stat(input, &sb) == 0) { - if (S_ISREG(sb.st_mode) && sb.st_size > 0) { - rc = 1; - } - } - } - else if (strcmp(p->pattern, "-l") == 0) { -#if !defined(OS2) && !defined(WIN32) - if (lstat(input, &sb) == 0) { - if (S_ISLNK(sb.st_mode)) { - rc = 1; - } - } -#endif - } - else if (strcmp(p->pattern, "-d") == 0) { - if (stat(input, &sb) == 0) { - if (S_ISDIR(sb.st_mode)) { - rc = 1; - } - } - } - else if (strcmp(p->pattern, "-U") == 0) { - /* avoid infinite subrequest recursion */ - if (strlen(input) > 0 /* nonempty path, and */ - && ( r->main == NULL /* - either not in a subrequest */ - || ( r->main->uri != NULL /* - or in a subrequest... */ - && r->uri != NULL /* ...and URIs aren't NULL... */ - /* ...and sub/main URIs differ */ - && strcmp(r->main->uri, r->uri) != 0) ) ) { - - /* run a URI-based subrequest */ - rsub = ap_sub_req_lookup_uri(input, r); - - /* URI exists for any result up to 3xx, redirects allowed */ - if (rsub->status < 400) - rc = 1; - - /* log it */ - rewritelog(r, 5, "RewriteCond URI (-U) check: " - "path=%s -> status=%d", input, rsub->status); - - /* cleanup by destroying the subrequest */ - ap_destroy_sub_req(rsub); - } - } - else if (strcmp(p->pattern, "-F") == 0) { - /* avoid infinite subrequest recursion */ - if (strlen(input) > 0 /* nonempty path, and */ - && ( r->main == NULL /* - either not in a subrequest */ - || ( r->main->uri != NULL /* - or in a subrequest... */ - && r->uri != NULL /* ...and URIs aren't NULL... */ - /* ...and sub/main URIs differ */ - && strcmp(r->main->uri, r->uri) != 0) ) ) { - - /* process a file-based subrequest: - * this differs from -U in that no path translation is done. - */ - rsub = ap_sub_req_lookup_file(input, r); - - /* file exists for any result up to 2xx, no redirects */ - if (rsub->status < 300 && - /* double-check that file exists since default result is 200 */ - stat(rsub->filename, &sb) == 0) { - rc = 1; - } - - /* log it */ - rewritelog(r, 5, "RewriteCond file (-F) check: path=%s " - "-> file=%s status=%d", input, rsub->filename, - rsub->status); - - /* cleanup by destroying the subrequest */ - ap_destroy_sub_req(rsub); - } - } - else if (strlen(p->pattern) > 1 && *(p->pattern) == '>') { - rc = (compare_lexicography(input, p->pattern+1) == 1 ? 1 : 0); - } - else if (strlen(p->pattern) > 1 && *(p->pattern) == '<') { - rc = (compare_lexicography(input, p->pattern+1) == -1 ? 1 : 0); - } - else if (strlen(p->pattern) > 1 && *(p->pattern) == '=') { - if (strcmp(p->pattern+1, "\"\"") == 0) { - rc = (*input == '\0'); - } - else { - rc = (strcmp(input, p->pattern+1) == 0 ? 1 : 0); - } - } - else { - /* it is really a regexp pattern, so apply it */ - rc = (ap_regexec(p->regexp, input, - p->regexp->re_nsub+1, regmatch,0) == 0); - - /* if it isn't a negated pattern and really matched - we update the passed-through regex subst info structure */ - if (rc && !(p->flags & CONDFLAG_NOTMATCH)) { - briRC->source = ap_pstrdup(r->pool, input); - briRC->nsub = p->regexp->re_nsub; - memcpy((void *)(briRC->regmatch), (void *)(regmatch), - sizeof(regmatch)); - } - } - - /* if this is a non-matching regexp, just negate the result */ - if (p->flags & CONDFLAG_NOTMATCH) { - rc = !rc; - } - - rewritelog(r, 4, "RewriteCond: input='%s' pattern='%s%s' => %s", - input, (p->flags & CONDFLAG_NOTMATCH ? "!" : ""), - p->pattern, rc ? "matched" : "not-matched"); - - /* end just return the result */ - return rc; -} - - -/* -** +-------------------------------------------------------+ -** | | -** | URL transformation functions -** | | -** +-------------------------------------------------------+ -*/ - -/* -** -** split out a QUERY_STRING part from -** the current URI string -** -*/ - -static void splitout_queryargs(request_rec *r, int qsappend) -{ - char *q; - char *olduri; - - q = strchr(r->filename, '?'); - if (q != NULL) { - olduri = ap_pstrdup(r->pool, r->filename); - *q++ = '\0'; - if (qsappend) { - r->args = ap_pstrcat(r->pool, q, "&", r->args, NULL); - } - else { - r->args = ap_pstrdup(r->pool, q); - } - if (strlen(r->args) == 0) { - r->args = NULL; - rewritelog(r, 3, "split uri=%s -> uri=%s, args=", olduri, - r->filename); - } - else { - if (r->args[strlen(r->args)-1] == '&') { - r->args[strlen(r->args)-1] = '\0'; - } - rewritelog(r, 3, "split uri=%s -> uri=%s, args=%s", olduri, - r->filename, r->args); - } - } - return; -} - - -/* -** -** strip 'http[s]://ourhost/' from URI -** -*/ - -static void reduce_uri(request_rec *r) -{ - char *cp; - unsigned short port; - char *portp; - char *hostp; - char *url; - char c; - char host[LONG_STRING_LEN]; - char buf[MAX_STRING_LEN]; - char *olduri; - int l; - - cp = ap_http_method(r); - l = strlen(cp); - if ( strlen(r->filename) > l+3 - && strncasecmp(r->filename, cp, l) == 0 - && r->filename[l] == ':' - && r->filename[l+1] == '/' - && r->filename[l+2] == '/' ) { - /* there was really a rewrite to a remote path */ - - olduri = ap_pstrdup(r->pool, r->filename); /* save for logging */ - - /* cut the hostname and port out of the URI */ - ap_cpystrn(buf, r->filename+(l+3), sizeof(buf)); - hostp = buf; - for (cp = hostp; *cp != '\0' && *cp != '/' && *cp != ':'; cp++) - ; - if (*cp == ':') { - /* set host */ - *cp++ = '\0'; - ap_cpystrn(host, hostp, sizeof(host)); - /* set port */ - portp = cp; - for (; *cp != '\0' && *cp != '/'; cp++) - ; - c = *cp; - *cp = '\0'; - port = atoi(portp); - *cp = c; - /* set remaining url */ - url = cp; - } - else if (*cp == '/') { - /* set host */ - *cp = '\0'; - ap_cpystrn(host, hostp, sizeof(host)); - *cp = '/'; - /* set port */ - port = ap_default_port(r); - /* set remaining url */ - url = cp; - } - else { - /* set host */ - ap_cpystrn(host, hostp, sizeof(host)); - /* set port */ - port = ap_default_port(r); - /* set remaining url */ - url = "/"; - } - - /* now check whether we could reduce it to a local path... */ - if (ap_matches_request_vhost(r, host, port)) { - /* this is our host, so only the URL remains */ - r->filename = ap_pstrdup(r->pool, url); - rewritelog(r, 3, "reduce %s -> %s", olduri, r->filename); - } - } - return; -} - - -/* -** -** add 'http[s]://ourhost[:ourport]/' to URI -** if URI is still not fully qualified -** -*/ - -static void fully_qualify_uri(request_rec *r) -{ - int i; - char buf[32]; - const char *thisserver; - char *thisport; - int port; - - i = strlen(r->filename); - if (!( (i > 7 && strncasecmp(r->filename, "http://", 7) == 0) - || (i > 8 && strncasecmp(r->filename, "https://", 8) == 0) - || (i > 9 && strncasecmp(r->filename, "gopher://", 9) == 0) - || (i > 6 && strncasecmp(r->filename, "ftp://", 6) == 0))) { - - thisserver = ap_get_server_name(r); - port = ap_get_server_port(r); - if (ap_is_default_port(port,r)) { - thisport = ""; - } - else { - ap_snprintf(buf, sizeof(buf), ":%u", port); - thisport = buf; - } - - if (r->filename[0] == '/') { - r->filename = ap_psprintf(r->pool, "%s://%s%s%s", - ap_http_method(r), thisserver, - thisport, r->filename); - } - else { - r->filename = ap_psprintf(r->pool, "%s://%s%s/%s", - ap_http_method(r), thisserver, - thisport, r->filename); - } - } - return; -} - - -/* -** -** Expand the %0-%9 or $0-$9 regex backreferences -** -*/ - -static void expand_backref_inbuffer(pool *p, char *buf, int nbuf, - backrefinfo *bri, char c) -{ - int i; - - if (bri->nsub < 1) { - return; - } - - if (c != '$') { - /* safe existing $N backrefs and replace N with $N backrefs */ - for (i = 0; buf[i] != '\0' && i < nbuf; i++) { - if (buf[i] == '$' && (buf[i+1] >= '0' && buf[i+1] <= '9')) { - buf[i++] = '\001'; - } - else if (buf[i] == c && (buf[i+1] >= '0' && buf[i+1] <= '9')) { - buf[i++] = '$'; - } - } - } - - /* now apply the pregsub() function */ - ap_cpystrn(buf, ap_pregsub(p, buf, bri->source, - bri->nsub+1, bri->regmatch), nbuf); - - if (c != '$') { - /* restore the original $N backrefs */ - for (i = 0; buf[i] != '\0' && i < nbuf; i++) { - if (buf[i] == '\001' && (buf[i+1] >= '0' && buf[i+1] <= '9')) { - buf[i++] = '$'; - } - } - } -} - - -/* -** -** Expand tilde-paths (/~user) through -** Unix /etc/passwd database information -** -*/ -#ifndef WIN32 -static char *expand_tildepaths(request_rec *r, char *uri) -{ - char user[LONG_STRING_LEN]; - struct passwd *pw; - char *newuri; - int i, j; - - newuri = uri; - if (uri != NULL && strlen(uri) > 2 && uri[0] == '/' && uri[1] == '~') { - /* cut out the username */ - for (j = 0, i = 2; j < sizeof(user)-1 - && uri[i] != '\0' - && uri[i] != '/' ; ) { - user[j++] = uri[i++]; - } - user[j] = '\0'; - - /* lookup username in systems passwd file */ - if ((pw = getpwnam(user)) != NULL) { - /* ok, user was found, so expand the ~user string */ - if (uri[i] != '\0') { - /* ~user/anything... has to be expanded */ - if (pw->pw_dir[strlen(pw->pw_dir)-1] == '/') { - pw->pw_dir[strlen(pw->pw_dir)-1] = '\0'; - } - newuri = ap_pstrcat(r->pool, pw->pw_dir, uri+i, NULL); - } - else { - /* only ~user has to be expanded */ - newuri = ap_pstrdup(r->pool, pw->pw_dir); - } - } - } - return newuri; -} -#endif - -/* -** -** mapfile expansion support -** i.e. expansion of MAP lookup directives -** ${:} in RewriteRule rhs -** -*/ - -#define limit_length(n) (n > LONG_STRING_LEN-1 ? LONG_STRING_LEN-1 : n) - -static void expand_map_lookups(request_rec *r, char *uri, int uri_len) -{ - char newuri[MAX_STRING_LEN]; - char *cpI; - char *cpIE; - char *cpO; - char *cpT; - char *cpT2; - char mapname[LONG_STRING_LEN]; - char mapkey[LONG_STRING_LEN]; - char defaultvalue[LONG_STRING_LEN]; - int n; - - cpI = uri; - cpIE = cpI+strlen(cpI); - cpO = newuri; - while (cpI < cpIE) { - if (cpI+6 < cpIE && strncmp(cpI, "${", 2) == 0) { - /* missing delimiter -> take it as plain text */ - if ( strchr(cpI+2, ':') == NULL - || strchr(cpI+2, '}') == NULL) { - memcpy(cpO, cpI, 2); - cpO += 2; - cpI += 2; - continue; - } - cpI += 2; - - cpT = strchr(cpI, ':'); - n = cpT-cpI; - memcpy(mapname, cpI, limit_length(n)); - mapname[limit_length(n)] = '\0'; - cpI += n+1; - - cpT2 = strchr(cpI, '|'); - cpT = strchr(cpI, '}'); - if (cpT2 != NULL && cpT2 < cpT) { - n = cpT2-cpI; - memcpy(mapkey, cpI, limit_length(n)); - mapkey[limit_length(n)] = '\0'; - cpI += n+1; - - n = cpT-cpI; - memcpy(defaultvalue, cpI, limit_length(n)); - defaultvalue[limit_length(n)] = '\0'; - cpI += n+1; - } - else { - n = cpT-cpI; - memcpy(mapkey, cpI, limit_length(n)); - mapkey[limit_length(n)] = '\0'; - cpI += n+1; - - defaultvalue[0] = '\0'; - } - - cpT = lookup_map(r, mapname, mapkey); - if (cpT != NULL) { - n = strlen(cpT); - if (cpO + n >= newuri + sizeof(newuri)) { - ap_log_rerror(APLOG_MARK, APLOG_NOERRNO|APLOG_ERR, - r, "insufficient space in " - "expand_map_lookups, aborting"); - return; - } - memcpy(cpO, cpT, n); - cpO += n; - } - else { - n = strlen(defaultvalue); - if (cpO + n >= newuri + sizeof(newuri)) { - ap_log_rerror(APLOG_MARK, APLOG_NOERRNO|APLOG_ERR, - r, "insufficient space in " - "expand_map_lookups, aborting"); - return; - } - memcpy(cpO, defaultvalue, n); - cpO += n; - } - } - else { - cpT = strstr(cpI, "${"); - if (cpT == NULL) - cpT = cpI+strlen(cpI); - n = cpT-cpI; - if (cpO + n >= newuri + sizeof(newuri)) { - ap_log_rerror(APLOG_MARK, APLOG_NOERRNO|APLOG_ERR, - r, "insufficient space in " - "expand_map_lookups, aborting"); - return; - } - memcpy(cpO, cpI, n); - cpO += n; - cpI += n; - } - } - *cpO = '\0'; - ap_cpystrn(uri, newuri, uri_len); - return; -} - -#undef limit_length - - - -/* -** +-------------------------------------------------------+ -** | | -** | DBM hashfile support -** | | -** +-------------------------------------------------------+ -*/ - - -static char *lookup_map(request_rec *r, char *name, char *key) -{ - void *sconf; - rewrite_server_conf *conf; - array_header *rewritemaps; - rewritemap_entry *entries; - rewritemap_entry *s; - char *value; - struct stat st; - int i; - - /* get map configuration */ - sconf = r->server->module_config; - conf = (rewrite_server_conf *)ap_get_module_config(sconf, - &rewrite_module); - rewritemaps = conf->rewritemaps; - - entries = (rewritemap_entry *)rewritemaps->elts; - for (i = 0; i < rewritemaps->nelts; i++) { - s = &entries[i]; - if (strcmp(s->name, name) == 0) { - if (s->type == MAPTYPE_TXT) { - if (stat(s->checkfile, &st) == -1) { - ap_log_rerror(APLOG_MARK, APLOG_ERR, r, - "mod_rewrite: can't access text RewriteMap " - "file %s", s->checkfile); - rewritelog(r, 1, "can't open RewriteMap file, " - "see error log"); - return NULL; - } - value = get_cache_string(cachep, s->name, CACHEMODE_TS, - st.st_mtime, key); - if (value == NULL) { - rewritelog(r, 6, "cache lookup FAILED, forcing new " - "map lookup"); - if ((value = - lookup_map_txtfile(r, s->datafile, key)) != NULL) { - rewritelog(r, 5, "map lookup OK: map=%s key=%s[txt] " - "-> val=%s", s->name, key, value); - set_cache_string(cachep, s->name, CACHEMODE_TS, - st.st_mtime, key, value); - return value; - } - else { - rewritelog(r, 5, "map lookup FAILED: map=%s[txt] " - "key=%s", s->name, key); - set_cache_string(cachep, s->name, CACHEMODE_TS, - st.st_mtime, key, ""); - return NULL; - } - } - else { - rewritelog(r, 5, "cache lookup OK: map=%s[txt] key=%s " - "-> val=%s", s->name, key, value); - return value[0] != '\0' ? value : NULL; - } - } - else if (s->type == MAPTYPE_DBM) { -#ifndef NO_DBM_REWRITEMAP - if (stat(s->checkfile, &st) == -1) { - ap_log_rerror(APLOG_MARK, APLOG_ERR, r, - "mod_rewrite: can't access DBM RewriteMap " - "file %s", s->checkfile); - rewritelog(r, 1, "can't open DBM RewriteMap file, " - "see error log"); - return NULL; - } - value = get_cache_string(cachep, s->name, CACHEMODE_TS, - st.st_mtime, key); - if (value == NULL) { - rewritelog(r, 6, - "cache lookup FAILED, forcing new map lookup"); - if ((value = - lookup_map_dbmfile(r, s->datafile, key)) != NULL) { - rewritelog(r, 5, "map lookup OK: map=%s[dbm] key=%s " - "-> val=%s", s->name, key, value); - set_cache_string(cachep, s->name, CACHEMODE_TS, - st.st_mtime, key, value); - return value; - } - else { - rewritelog(r, 5, "map lookup FAILED: map=%s[dbm] " - "key=%s", s->name, key); - set_cache_string(cachep, s->name, CACHEMODE_TS, - st.st_mtime, key, ""); - return NULL; - } - } - else { - rewritelog(r, 5, "cache lookup OK: map=%s[dbm] key=%s " - "-> val=%s", s->name, key, value); - return value[0] != '\0' ? value : NULL; - } -#else - return NULL; -#endif - } - else if (s->type == MAPTYPE_PRG) { - if ((value = - lookup_map_program(r, s->fpin, s->fpout, key)) != NULL) { - rewritelog(r, 5, "map lookup OK: map=%s key=%s -> val=%s", - s->name, key, value); - return value; - } - else { - rewritelog(r, 5, "map lookup FAILED: map=%s key=%s", - s->name, key); - } - } - else if (s->type == MAPTYPE_INT) { - if ((value = lookup_map_internal(r, s->func, key)) != NULL) { - rewritelog(r, 5, "map lookup OK: map=%s key=%s -> val=%s", - s->name, key, value); - return value; - } - else { - rewritelog(r, 5, "map lookup FAILED: map=%s key=%s", - s->name, key); - } - } - else if (s->type == MAPTYPE_RND) { - if (stat(s->checkfile, &st) == -1) { - ap_log_rerror(APLOG_MARK, APLOG_ERR, r, - "mod_rewrite: can't access text RewriteMap " - "file %s", s->checkfile); - rewritelog(r, 1, "can't open RewriteMap file, " - "see error log"); - return NULL; - } - value = get_cache_string(cachep, s->name, CACHEMODE_TS, - st.st_mtime, key); - if (value == NULL) { - rewritelog(r, 6, "cache lookup FAILED, forcing new " - "map lookup"); - if ((value = - lookup_map_txtfile(r, s->datafile, key)) != NULL) { - rewritelog(r, 5, "map lookup OK: map=%s key=%s[txt] " - "-> val=%s", s->name, key, value); - set_cache_string(cachep, s->name, CACHEMODE_TS, - st.st_mtime, key, value); - } - else { - rewritelog(r, 5, "map lookup FAILED: map=%s[txt] " - "key=%s", s->name, key); - set_cache_string(cachep, s->name, CACHEMODE_TS, - st.st_mtime, key, ""); - return NULL; - } - } - else { - rewritelog(r, 5, "cache lookup OK: map=%s[txt] key=%s " - "-> val=%s", s->name, key, value); - } - if (value[0] != '\0') { - value = select_random_value_part(r, value); - rewritelog(r, 5, "randomly choosen the subvalue `%s'", value); - } - else { - value = NULL; - } - return value; - } - } - } - return NULL; -} - -static char *lookup_map_txtfile(request_rec *r, char *file, char *key) -{ - FILE *fp = NULL; - char line[1024]; - char *value = NULL; - char *cpT; - size_t skip; - char *curkey; - char *curval; - - if ((fp = ap_pfopen(r->pool, file, "r")) == NULL) { - return NULL; - } - - while (fgets(line, sizeof(line), fp) != NULL) { - if (line[0] == '#') - continue; /* ignore comments */ - cpT = line; - curkey = cpT; - skip = strcspn(cpT," \t\r\n"); - if (skip == 0) - continue; /* ignore lines that start with a space, tab, CR, or LF */ - cpT += skip; - *cpT = '\0'; - if (strcmp(curkey, key) != 0) - continue; /* key does not match... */ - - /* found a matching key; now extract and return the value */ - ++cpT; - skip = strspn(cpT, " \t\r\n"); - cpT += skip; - curval = cpT; - skip = strcspn(cpT, " \t\r\n"); - if (skip == 0) - continue; /* no value... */ - cpT += skip; - *cpT = '\0'; - value = ap_pstrdup(r->pool, curval); - break; - } - ap_pfclose(r->pool, fp); - return value; -} - -#ifndef NO_DBM_REWRITEMAP -static char *lookup_map_dbmfile(request_rec *r, char *file, char *key) -{ - DBM *dbmfp = NULL; - datum dbmkey; - datum dbmval; - char *value = NULL; - char buf[MAX_STRING_LEN]; - - dbmkey.dptr = key; - dbmkey.dsize = strlen(key); - if ((dbmfp = dbm_open(file, O_RDONLY, 0666)) != NULL) { - dbmval = dbm_fetch(dbmfp, dbmkey); - if (dbmval.dptr != NULL) { - memcpy(buf, dbmval.dptr, - dbmval.dsize < sizeof(buf)-1 ? - dbmval.dsize : sizeof(buf)-1 ); - buf[dbmval.dsize] = '\0'; - value = ap_pstrdup(r->pool, buf); - } - dbm_close(dbmfp); - } - return value; -} -#endif - -static char *lookup_map_program(request_rec *r, int fpin, int fpout, char *key) -{ - char buf[LONG_STRING_LEN]; - char c; - int i; -#ifndef NO_WRITEV - struct iovec iov[2]; -#endif - - /* when `RewriteEngine off' was used in the per-server - * context then the rewritemap-programs were not spawned. - * In this case using such a map (usually in per-dir context) - * is useless because it is not available. - */ - if (fpin == -1 || fpout == -1) { - return NULL; - } - - /* take the lock */ - rewritelock_alloc(r); - - /* write out the request key */ -#ifdef NO_WRITEV - write(fpin, key, strlen(key)); - write(fpin, "\n", 1); -#else - iov[0].iov_base = key; - iov[0].iov_len = strlen(key); - iov[1].iov_base = "\n"; - iov[1].iov_len = 1; - writev(fpin, iov, 2); -#endif - - /* read in the response value */ - i = 0; - while (read(fpout, &c, 1) == 1 && (i < LONG_STRING_LEN-1)) { - if (c == '\n') { - break; - } - buf[i++] = c; - } - buf[i] = '\0'; - - /* give the lock back */ - rewritelock_free(r); - - if (strcasecmp(buf, "NULL") == 0) { - return NULL; - } - else { - return ap_pstrdup(r->pool, buf); - } -} - -static char *lookup_map_internal(request_rec *r, - char *(*func)(request_rec *, char *), - char *key) -{ - /* currently we just let the function convert - the key to a corresponding value */ - return func(r, key); -} - -static char *rewrite_mapfunc_toupper(request_rec *r, char *key) -{ - char *value, *cp; - - for (cp = value = ap_pstrdup(r->pool, key); cp != NULL && *cp != '\0'; - cp++) { - *cp = ap_toupper(*cp); - } - return value; -} - -static char *rewrite_mapfunc_tolower(request_rec *r, char *key) -{ - char *value, *cp; - - for (cp = value = ap_pstrdup(r->pool, key); cp != NULL && *cp != '\0'; - cp++) { - *cp = ap_tolower(*cp); - } - return value; -} - -static char *rewrite_mapfunc_escape(request_rec *r, char *key) -{ - char *value; - - value = ap_escape_uri(r->pool, key); - return value; -} - -static char *rewrite_mapfunc_unescape(request_rec *r, char *key) -{ - char *value; - - value = ap_pstrdup(r->pool, key); - ap_unescape_url(value); - return value; -} - -static int rewrite_rand_init_done = 0; - -static void rewrite_rand_init(void) -{ - if (!rewrite_rand_init_done) { - srand((unsigned)(getpid())); - rewrite_rand_init_done = 1; - } - return; -} - -static int rewrite_rand(int l, int h) -{ - int i; - char buf[50]; - - rewrite_rand_init(); - ap_snprintf(buf, sizeof(buf), "%.0f", - (((double)(rand()%RAND_MAX)/RAND_MAX)*(h-l))); - i = atoi(buf)+1; - if (i < l) i = l; - if (i > h) i = h; - return i; -} - -static char *select_random_value_part(request_rec *r, char *value) -{ - char *buf; - int n, i, k; - - /* count number of distinct values */ - for (n = 1, i = 0; value[i] != '\0'; i++) { - if (value[i] == '|') { - n++; - } - } - - /* when only one value we have no option to choose */ - if (n == 1) { - return value; - } - - /* else randomly select one */ - k = rewrite_rand(1, n); - - /* and grep it out */ - for (n = 1, i = 0; value[i] != '\0'; i++) { - if (n == k) { - break; - } - if (value[i] == '|') { - n++; - } - } - buf = ap_pstrdup(r->pool, &value[i]); - for (i = 0; buf[i] != '\0' && buf[i] != '|'; i++) - ; - buf[i] = '\0'; - return buf; -} - - -/* -** +-------------------------------------------------------+ -** | | -** | rewriting logfile support -** | | -** +-------------------------------------------------------+ -*/ - - -static void open_rewritelog(server_rec *s, pool *p) -{ - rewrite_server_conf *conf; - char *fname; - piped_log *pl; - int rewritelog_flags = ( O_WRONLY|O_APPEND|O_CREAT ); -#ifdef WIN32 - mode_t rewritelog_mode = ( _S_IREAD|_S_IWRITE ); -#else - mode_t rewritelog_mode = ( S_IRUSR|S_IWUSR|S_IRGRP|S_IROTH ); -#endif - - conf = ap_get_module_config(s->module_config, &rewrite_module); - - if (conf->rewritelogfile == NULL) { - return; - } - if (*(conf->rewritelogfile) == '\0') { - return; - } - if (conf->rewritelogfp > 0) { - return; /* virtual log shared w/ main server */ - } - - fname = ap_server_root_relative(p, conf->rewritelogfile); - - if (*conf->rewritelogfile == '|') { - if ((pl = ap_open_piped_log(p, conf->rewritelogfile+1)) == NULL) { - ap_log_error(APLOG_MARK, APLOG_ERR, s, - "mod_rewrite: could not open reliable pipe " - "to RewriteLog filter %s", conf->rewritelogfile+1); - exit(1); - } - conf->rewritelogfp = ap_piped_log_write_fd(pl); - } - else if (*conf->rewritelogfile != '\0') { - if ((conf->rewritelogfp = ap_popenf(p, fname, rewritelog_flags, - rewritelog_mode)) < 0) { - ap_log_error(APLOG_MARK, APLOG_ERR, s, - - "mod_rewrite: could not open RewriteLog " - "file %s", fname); - exit(1); - } - } - return; -} - -static void rewritelog(request_rec *r, int level, const char *text, ...) -{ - rewrite_server_conf *conf; - conn_rec *conn; - char *str1; - char str2[512]; - char str3[1024]; - char type[20]; - char redir[20]; - va_list ap; - int i; - request_rec *req; - char *ruser; - const char *rhost; - - va_start(ap, text); - conf = ap_get_module_config(r->server->module_config, &rewrite_module); - conn = r->connection; - - if (conf->rewritelogfp < 0) { - return; - } - if (conf->rewritelogfile == NULL) { - return; - } - if (*(conf->rewritelogfile) == '\0') { - return; - } - - if (level > conf->rewriteloglevel) { - return; - } - - if (conn->user == NULL) { - ruser = "-"; - } - else if (strlen(conn->user) != 0) { - ruser = conn->user; - } - else { - ruser = "\"\""; - } - - rhost = ap_get_remote_host(conn, r->server->module_config, - REMOTE_NOLOOKUP); - if (rhost == NULL) { - rhost = "UNKNOWN-HOST"; - } - - str1 = ap_pstrcat(r->pool, rhost, " ", - (conn->remote_logname != NULL ? - conn->remote_logname : "-"), " ", - ruser, NULL); - ap_vsnprintf(str2, sizeof(str2), text, ap); - - if (r->main == NULL) { - strcpy(type, "initial"); - } - else { - strcpy(type, "subreq"); - } - - for (i = 0, req = r; req->prev != NULL; req = req->prev) { - i++; - } - if (i == 0) { - redir[0] = '\0'; - } - else { - ap_snprintf(redir, sizeof(redir), "/redir#%d", i); - } - - ap_snprintf(str3, sizeof(str3), - "%s %s [%s/sid#%lx][rid#%lx/%s%s] (%d) %s\n", str1, - current_logtime(r), ap_get_server_name(r), - (unsigned long)(r->server), (unsigned long)r, - type, redir, level, str2); - - fd_lock(r, conf->rewritelogfp); - write(conf->rewritelogfp, str3, strlen(str3)); - fd_unlock(r, conf->rewritelogfp); - - va_end(ap); - return; -} - -static char *current_logtime(request_rec *r) -{ - int timz; - struct tm *t; - char tstr[80]; - char sign; - - t = ap_get_gmtoff(&timz); - sign = (timz < 0 ? '-' : '+'); - if (timz < 0) { - timz = -timz; - } - - strftime(tstr, 80, "[%d/%b/%Y:%H:%M:%S ", t); - ap_snprintf(tstr + strlen(tstr), 80-strlen(tstr), "%c%.2d%.2d]", - sign, timz/60, timz%60); - return ap_pstrdup(r->pool, tstr); -} - - - - -/* -** +-------------------------------------------------------+ -** | | -** | rewriting lockfile support -** | | -** +-------------------------------------------------------+ -*/ - -#ifdef WIN32 -#define REWRITELOCK_MODE ( _S_IREAD|_S_IWRITE ) -#else -#define REWRITELOCK_MODE ( S_IRUSR|S_IWUSR|S_IRGRP|S_IROTH ) -#endif - -static void rewritelock_create(server_rec *s, pool *p) -{ - rewrite_server_conf *conf; - - conf = ap_get_module_config(s->module_config, &rewrite_module); - - /* only operate if a lockfile is used */ - if (lockname == NULL || *(lockname) == '\0') { - return; - } - - /* fixup the path, especially for rewritelock_remove() */ - lockname = ap_server_root_relative(p, lockname); - - /* create the lockfile */ - unlink(lockname); - if ((lockfd = ap_popenf(p, lockname, O_WRONLY|O_CREAT, - REWRITELOCK_MODE)) < 0) { - ap_log_error(APLOG_MARK, APLOG_ERR, s, - "mod_rewrite: Parent could not create RewriteLock " - "file %s", lockname); - exit(1); - } -#if !defined(OS2) && !defined(WIN32) - /* make sure the childs have access to this file */ - if (geteuid() == 0 /* is superuser */) - chown(lockname, ap_user_id, -1 /* no gid change */); -#endif - - return; -} - -static void rewritelock_open(server_rec *s, pool *p) -{ - rewrite_server_conf *conf; - - conf = ap_get_module_config(s->module_config, &rewrite_module); - - /* only operate if a lockfile is used */ - if (lockname == NULL || *(lockname) == '\0') { - return; - } - - /* open the lockfile (once per child) to get a unique fd */ - if ((lockfd = ap_popenf(p, lockname, O_WRONLY, - REWRITELOCK_MODE)) < 0) { - ap_log_error(APLOG_MARK, APLOG_ERR, s, - "mod_rewrite: Child could not open RewriteLock " - "file %s", lockname); - exit(1); - } - return; -} - -static void rewritelock_remove(void *data) -{ - /* only operate if a lockfile is used */ - if (lockname == NULL || *(lockname) == '\0') { - return; - } - - /* remove the lockfile */ - unlink(lockname); - lockname = NULL; - lockfd = -1; -} - -static void rewritelock_alloc(request_rec *r) -{ - if (lockfd != -1) { - fd_lock(r, lockfd); - } - return; -} - -static void rewritelock_free(request_rec *r) -{ - if (lockfd != -1) { - fd_unlock(r, lockfd); - } - return; -} - - -/* -** +-------------------------------------------------------+ -** | | -** | program map support -** | | -** +-------------------------------------------------------+ -*/ - -static void run_rewritemap_programs(server_rec *s, pool *p) -{ - rewrite_server_conf *conf; - FILE *fpin; - FILE *fpout; - FILE *fperr; - array_header *rewritemaps; - rewritemap_entry *entries; - rewritemap_entry *map; - int i; - int rc; - - conf = ap_get_module_config(s->module_config, &rewrite_module); - - /* If the engine isn't turned on, - * don't even try to do anything. - */ - if (conf->state == ENGINE_DISABLED) { - return; - } - - rewritemaps = conf->rewritemaps; - entries = (rewritemap_entry *)rewritemaps->elts; - for (i = 0; i < rewritemaps->nelts; i++) { - map = &entries[i]; - if (map->type != MAPTYPE_PRG) { - continue; - } - if (map->datafile == NULL - || *(map->datafile) == '\0' - || map->fpin != -1 - || map->fpout != -1 ) { - continue; - } - fpin = NULL; - fpout = NULL; - rc = ap_spawn_child(p, rewritemap_program_child, - (void *)map->datafile, kill_after_timeout, - &fpin, &fpout, &fperr); - if (rc == 0 || fpin == NULL || fpout == NULL) { - ap_log_error(APLOG_MARK, APLOG_ERR, s, - "mod_rewrite: could not fork child for " - "RewriteMap process"); - exit(1); - } - map->fpin = fileno(fpin); - map->fpout = fileno(fpout); - map->fperr = fileno(fperr); - } - return; -} - -/* child process code */ -static int rewritemap_program_child(void *cmd, child_info *pinfo) -{ - int child_pid = 1; - - /* - * Prepare for exec - */ - ap_cleanup_for_exec(); -#ifdef SIGHUP - signal(SIGHUP, SIG_IGN); -#endif - - /* - * Exec() the child program - */ -#if defined(WIN32) - /* MS Windows */ - { - char pCommand[MAX_STRING_LEN]; - STARTUPINFO si; - PROCESS_INFORMATION pi; - - ap_snprintf(pCommand, sizeof(pCommand), "%s /C %s", SHELL_PATH, cmd); - - memset(&si, 0, sizeof(si)); - memset(&pi, 0, sizeof(pi)); - - si.cb = sizeof(si); - si.dwFlags = STARTF_USESHOWWINDOW | STARTF_USESTDHANDLES; - si.wShowWindow = SW_HIDE; - si.hStdInput = pinfo->hPipeInputRead; - si.hStdOutput = pinfo->hPipeOutputWrite; - si.hStdError = pinfo->hPipeErrorWrite; - - if (CreateProcess(NULL, pCommand, NULL, NULL, TRUE, 0, - environ, NULL, &si, &pi)) { - CloseHandle(pi.hProcess); - CloseHandle(pi.hThread); - child_pid = pi.dwProcessId; - } - } -#elif defined(OS2) - /* IBM OS/2 */ - execl(SHELL_PATH, SHELL_PATH, "/c", (char *)cmd, NULL); -#else - /* Standard Unix */ - execl(SHELL_PATH, SHELL_PATH, "-c", (char *)cmd, NULL); -#endif - return(child_pid); -} - - - - -/* -** +-------------------------------------------------------+ -** | | -** | environment variable support -** | | -** +-------------------------------------------------------+ -*/ - - -static void expand_variables_inbuffer(request_rec *r, char *buf, int buf_len) -{ - char *newbuf; - newbuf = expand_variables(r, buf); - if (strcmp(newbuf, buf) != 0) { - ap_cpystrn(buf, newbuf, buf_len); - } - return; -} - -static char *expand_variables(request_rec *r, char *str) -{ - char output[MAX_STRING_LEN]; - char input[MAX_STRING_LEN]; - char *cp; - char *cp2; - char *cp3; - int expanded; - char *outp; - char *endp; - - ap_cpystrn(input, str, sizeof(input)); - output[0] = '\0'; - outp = output; - endp = output + sizeof(output); - expanded = 0; - for (cp = input; cp < input+MAX_STRING_LEN; ) { - if ((cp2 = strstr(cp, "%{")) != NULL) { - if ((cp3 = strstr(cp2, "}")) != NULL) { - *cp2 = '\0'; - outp = ap_cpystrn(outp, cp, endp - outp); - - cp2 += 2; - *cp3 = '\0'; - outp = ap_cpystrn(outp, lookup_variable(r, cp2), endp - outp); - - cp = cp3+1; - expanded = 1; - continue; - } - } - outp = ap_cpystrn(outp, cp, endp - outp); - break; - } - return expanded ? ap_pstrdup(r->pool, output) : str; -} - -static char *lookup_variable(request_rec *r, char *var) -{ - const char *result; - char resultbuf[LONG_STRING_LEN]; - time_t tc; - struct tm *tm; - request_rec *rsub; -#ifndef WIN32 - struct passwd *pw; - struct group *gr; - struct stat finfo; -#endif - - result = NULL; - - /* HTTP headers */ - if (strcasecmp(var, "HTTP_USER_AGENT") == 0) { - result = lookup_header(r, "User-Agent"); - } - else if (strcasecmp(var, "HTTP_REFERER") == 0) { - result = lookup_header(r, "Referer"); - } - else if (strcasecmp(var, "HTTP_COOKIE") == 0) { - result = lookup_header(r, "Cookie"); - } - else if (strcasecmp(var, "HTTP_FORWARDED") == 0) { - result = lookup_header(r, "Forwarded"); - } - else if (strcasecmp(var, "HTTP_HOST") == 0) { - result = lookup_header(r, "Host"); - } - else if (strcasecmp(var, "HTTP_PROXY_CONNECTION") == 0) { - result = lookup_header(r, "Proxy-Connection"); - } - else if (strcasecmp(var, "HTTP_ACCEPT") == 0) { - result = lookup_header(r, "Accept"); - } - /* all other headers from which we are still not know about */ - else if (strlen(var) > 5 && strncasecmp(var, "HTTP:", 5) == 0) { - result = lookup_header(r, var+5); - } - - /* connection stuff */ - else if (strcasecmp(var, "REMOTE_ADDR") == 0) { - result = r->connection->remote_ip; - } - else if (strcasecmp(var, "REMOTE_HOST") == 0) { - result = (char *)ap_get_remote_host(r->connection, - r->per_dir_config, REMOTE_NAME); - } - else if (strcasecmp(var, "REMOTE_USER") == 0) { - result = r->connection->user; - } - else if (strcasecmp(var, "REMOTE_IDENT") == 0) { - result = (char *)ap_get_remote_logname(r); - } - - /* request stuff */ - else if (strcasecmp(var, "THE_REQUEST") == 0) { /* non-standard */ - result = r->the_request; - } - else if (strcasecmp(var, "REQUEST_METHOD") == 0) { - result = r->method; - } - else if (strcasecmp(var, "REQUEST_URI") == 0) { /* non-standard */ - result = r->uri; - } - else if (strcasecmp(var, "SCRIPT_FILENAME") == 0 || - strcasecmp(var, "REQUEST_FILENAME") == 0 ) { - result = r->filename; - } - else if (strcasecmp(var, "PATH_INFO") == 0) { - result = r->path_info; - } - else if (strcasecmp(var, "QUERY_STRING") == 0) { - result = r->args; - } - else if (strcasecmp(var, "AUTH_TYPE") == 0) { - result = r->connection->ap_auth_type; - } - else if (strcasecmp(var, "IS_SUBREQ") == 0) { /* non-standard */ - result = (r->main != NULL ? "true" : "false"); - } - - /* internal server stuff */ - else if (strcasecmp(var, "DOCUMENT_ROOT") == 0) { - result = ap_document_root(r); - } - else if (strcasecmp(var, "SERVER_ADMIN") == 0) { - result = r->server->server_admin; - } - else if (strcasecmp(var, "SERVER_NAME") == 0) { - result = ap_get_server_name(r); - } - else if (strcasecmp(var, "SERVER_ADDR") == 0) { /* non-standard */ - result = r->connection->local_ip; - } - else if (strcasecmp(var, "SERVER_PORT") == 0) { - ap_snprintf(resultbuf, sizeof(resultbuf), "%u", ap_get_server_port(r)); - result = resultbuf; - } - else if (strcasecmp(var, "SERVER_PROTOCOL") == 0) { - result = r->protocol; - } - else if (strcasecmp(var, "SERVER_SOFTWARE") == 0) { - result = ap_get_server_version(); - } - else if (strcasecmp(var, "API_VERSION") == 0) { /* non-standard */ - ap_snprintf(resultbuf, sizeof(resultbuf), "%d:%d", - MODULE_MAGIC_NUMBER_MAJOR, MODULE_MAGIC_NUMBER_MINOR); - result = resultbuf; - } - - /* underlaying Unix system stuff */ - else if (strcasecmp(var, "TIME_YEAR") == 0) { - tc = time(NULL); - tm = localtime(&tc); - ap_snprintf(resultbuf, sizeof(resultbuf), "%02d%02d", - (tm->tm_year / 100) + 19, tm->tm_year % 100); - result = resultbuf; - } -#define MKTIMESTR(format, tmfield) \ - tc = time(NULL); \ - tm = localtime(&tc); \ - ap_snprintf(resultbuf, sizeof(resultbuf), format, tm->tmfield); \ - result = resultbuf; - else if (strcasecmp(var, "TIME_MON") == 0) { - MKTIMESTR("%02d", tm_mon+1) - } - else if (strcasecmp(var, "TIME_DAY") == 0) { - MKTIMESTR("%02d", tm_mday) - } - else if (strcasecmp(var, "TIME_HOUR") == 0) { - MKTIMESTR("%02d", tm_hour) - } - else if (strcasecmp(var, "TIME_MIN") == 0) { - MKTIMESTR("%02d", tm_min) - } - else if (strcasecmp(var, "TIME_SEC") == 0) { - MKTIMESTR("%02d", tm_sec) - } - else if (strcasecmp(var, "TIME_WDAY") == 0) { - MKTIMESTR("%d", tm_wday) - } - else if (strcasecmp(var, "TIME") == 0) { - tc = time(NULL); - tm = localtime(&tc); - ap_snprintf(resultbuf, sizeof(resultbuf), - "%02d%02d%02d%02d%02d%02d%02d", (tm->tm_year / 100) + 19, - (tm->tm_year % 100), tm->tm_mon+1, tm->tm_mday, - tm->tm_hour, tm->tm_min, tm->tm_sec); - result = resultbuf; - rewritelog(r, 1, "RESULT='%s'", result); - } - - /* all other env-variables from the parent Apache process */ - else if (strlen(var) > 4 && strncasecmp(var, "ENV:", 4) == 0) { - /* first try the internal Apache notes structure */ - result = ap_table_get(r->notes, var+4); - /* second try the internal Apache env structure */ - if (result == NULL) { - result = ap_table_get(r->subprocess_env, var+4); - } - /* third try the external OS env */ - if (result == NULL) { - result = getenv(var+4); - } - } - -#define LOOKAHEAD(subrecfunc) \ - if ( \ - /* filename is safe to use */ \ - r->filename != NULL \ - /* - and we're either not in a subrequest */ \ - && ( r->main == NULL \ - /* - or in a subrequest where paths are non-NULL... */ \ - || ( r->main->uri != NULL && r->uri != NULL \ - /* ...and sub and main paths differ */ \ - && strcmp(r->main->uri, r->uri) != 0))) { \ - /* process a file-based subrequest */ \ - rsub = subrecfunc(r->filename, r); \ - /* now recursively lookup the variable in the sub_req */ \ - result = lookup_variable(rsub, var+5); \ - /* copy it up to our scope before we destroy sub_req's pool */ \ - result = ap_pstrdup(r->pool, result); \ - /* cleanup by destroying the subrequest */ \ - ap_destroy_sub_req(rsub); \ - /* log it */ \ - rewritelog(r, 5, "lookahead: path=%s var=%s -> val=%s", \ - r->filename, var+5, result); \ - /* return ourself to prevent re-pstrdup */ \ - return (char *)result; \ - } - - /* look-ahead for parameter through URI-based sub-request */ - else if (strlen(var) > 5 && strncasecmp(var, "LA-U:", 5) == 0) { - LOOKAHEAD(ap_sub_req_lookup_uri) - } - /* look-ahead for parameter through file-based sub-request */ - else if (strlen(var) > 5 && strncasecmp(var, "LA-F:", 5) == 0) { - LOOKAHEAD(ap_sub_req_lookup_file) - } - -#ifndef WIN32 - /* Win32 has a rather different view of file ownerships. - For now, just forget it */ - - /* file stuff */ - else if (strcasecmp(var, "SCRIPT_USER") == 0) { - result = ""; - if (r->finfo.st_mode != 0) { - if ((pw = getpwuid(r->finfo.st_uid)) != NULL) { - result = pw->pw_name; - } - } - else { - if (stat(r->filename, &finfo) == 0) { - if ((pw = getpwuid(finfo.st_uid)) != NULL) { - result = pw->pw_name; - } - } - } - } - else if (strcasecmp(var, "SCRIPT_GROUP") == 0) { - result = ""; - if (r->finfo.st_mode != 0) { - if ((gr = getgrgid(r->finfo.st_gid)) != NULL) { - result = gr->gr_name; - } - } - else { - if (stat(r->filename, &finfo) == 0) { - if ((gr = getgrgid(finfo.st_gid)) != NULL) { - result = gr->gr_name; - } - } - } - } -#endif /* ndef WIN32 */ - - if (result == NULL) { - return ap_pstrdup(r->pool, ""); - } - else { - return ap_pstrdup(r->pool, result); - } -} - -static char *lookup_header(request_rec *r, const char *name) -{ - array_header *hdrs_arr; - table_entry *hdrs; - int i; - - hdrs_arr = ap_table_elts(r->headers_in); - hdrs = (table_entry *)hdrs_arr->elts; - for (i = 0; i < hdrs_arr->nelts; ++i) { - if (hdrs[i].key == NULL) { - continue; - } - if (strcasecmp(hdrs[i].key, name) == 0) { - ap_table_merge(r->notes, VARY_KEY_THIS, name); - return hdrs[i].val; - } - } - return NULL; -} - - - - -/* -** +-------------------------------------------------------+ -** | | -** | caching support -** | | -** +-------------------------------------------------------+ -*/ - - -static cache *init_cache(pool *p) -{ - cache *c; - - c = (cache *)ap_palloc(p, sizeof(cache)); - c->pool = ap_make_sub_pool(p); - c->lists = ap_make_array(c->pool, 2, sizeof(cachelist)); - return c; -} - -static void set_cache_string(cache *c, char *res, int mode, time_t t, - char *key, char *value) -{ - cacheentry ce; - - ce.time = t; - ce.key = key; - ce.value = value; - store_cache_string(c, res, &ce); - return; -} - -static char *get_cache_string(cache *c, char *res, int mode, - time_t t, char *key) -{ - cacheentry *ce; - - ce = retrieve_cache_string(c, res, key); - if (ce == NULL) { - return NULL; - } - if (mode & CACHEMODE_TS) { - if (t != ce->time) { - return NULL; - } - } - else if (mode & CACHEMODE_TTL) { - if (t > ce->time) { - return NULL; - } - } - return ap_pstrdup(c->pool, ce->value); -} - -static int cache_tlb_hash(char *key) -{ - unsigned long n; - char *p; - - n = 0; - for (p=key; *p != '\0'; ++p) { - n = n * 53711 + 134561 + (unsigned)(*p & 0xff); - } - - return n % CACHE_TLB_ROWS; -} - -static cacheentry *cache_tlb_lookup(cachetlbentry *tlb, cacheentry *elt, - char *key) -{ - int ix = cache_tlb_hash(key); - int i; - int j; - - for (i=0; i < CACHE_TLB_COLS; ++i) { - j = tlb[ix].t[i]; - if (j < 0) - return NULL; - if (strcmp(elt[j].key, key) == 0) - return &elt[j]; - } - return NULL; -} - -static void cache_tlb_replace(cachetlbentry *tlb, cacheentry *elt, - cacheentry *e) -{ - int ix = cache_tlb_hash(e->key); - int i; - - tlb = &tlb[ix]; - - for (i=1; i < CACHE_TLB_COLS; ++i) - tlb->t[i] = tlb->t[i-1]; - - tlb->t[0] = e - elt; -} - -static void store_cache_string(cache *c, char *res, cacheentry *ce) -{ - int i; - int j; - cachelist *l; - cacheentry *e; - cachetlbentry *t; - int found_list; - - found_list = 0; - /* first try to edit an existing entry */ - for (i = 0; i < c->lists->nelts; i++) { - l = &(((cachelist *)c->lists->elts)[i]); - if (strcmp(l->resource, res) == 0) { - found_list = 1; - - e = cache_tlb_lookup((cachetlbentry *)l->tlb->elts, - (cacheentry *)l->entries->elts, ce->key); - if (e != NULL) { - e->time = ce->time; - e->value = ap_pstrdup(c->pool, ce->value); - return; - } - - for (j = 0; j < l->entries->nelts; j++) { - e = &(((cacheentry *)l->entries->elts)[j]); - if (strcmp(e->key, ce->key) == 0) { - e->time = ce->time; - e->value = ap_pstrdup(c->pool, ce->value); - cache_tlb_replace((cachetlbentry *)l->tlb->elts, - (cacheentry *)l->entries->elts, e); - return; - } - } - } - } - - /* create a needed new list */ - if (!found_list) { - l = ap_push_array(c->lists); - l->resource = ap_pstrdup(c->pool, res); - l->entries = ap_make_array(c->pool, 2, sizeof(cacheentry)); - l->tlb = ap_make_array(c->pool, CACHE_TLB_ROWS, - sizeof(cachetlbentry)); - for (i=0; itlb->elts)[i]; - for (j=0; jt[j] = -1; - } - } - - /* create the new entry */ - for (i = 0; i < c->lists->nelts; i++) { - l = &(((cachelist *)c->lists->elts)[i]); - if (strcmp(l->resource, res) == 0) { - e = ap_push_array(l->entries); - e->time = ce->time; - e->key = ap_pstrdup(c->pool, ce->key); - e->value = ap_pstrdup(c->pool, ce->value); - cache_tlb_replace((cachetlbentry *)l->tlb->elts, - (cacheentry *)l->entries->elts, e); - return; - } - } - - /* not reached, but when it is no problem... */ - return; -} - -static cacheentry *retrieve_cache_string(cache *c, char *res, char *key) -{ - int i; - int j; - cachelist *l; - cacheentry *e; - - for (i = 0; i < c->lists->nelts; i++) { - l = &(((cachelist *)c->lists->elts)[i]); - if (strcmp(l->resource, res) == 0) { - - e = cache_tlb_lookup((cachetlbentry *)l->tlb->elts, - (cacheentry *)l->entries->elts, key); - if (e != NULL) - return e; - - for (j = 0; j < l->entries->nelts; j++) { - e = &(((cacheentry *)l->entries->elts)[j]); - if (strcmp(e->key, key) == 0) { - return e; - } - } - } - } - return NULL; -} - - - - -/* -** +-------------------------------------------------------+ -** | | -** | misc functions -** | | -** +-------------------------------------------------------+ -*/ - -static char *subst_prefix_path(request_rec *r, char *input, char *match, - char *subst) -{ - char matchbuf[LONG_STRING_LEN]; - char substbuf[LONG_STRING_LEN]; - char *output; - int l; - - output = input; - - /* first create a match string which always has a trailing slash */ - l = ap_cpystrn(matchbuf, match, sizeof(matchbuf)) - matchbuf; - if (matchbuf[l-1] != '/') { - matchbuf[l] = '/'; - matchbuf[l+1] = '\0'; - l++; - } - /* now compare the prefix */ - if (strncmp(input, matchbuf, l) == 0) { - rewritelog(r, 5, "strip matching prefix: %s -> %s", output, output+l); - output = ap_pstrdup(r->pool, output+l); - - /* and now add the base-URL as replacement prefix */ - l = ap_cpystrn(substbuf, subst, sizeof(substbuf)) - substbuf; - if (substbuf[l-1] != '/') { - substbuf[l] = '/'; - substbuf[l+1] = '\0'; - l++; - } - if (output[0] == '/') { - rewritelog(r, 4, "add subst prefix: %s -> %s%s", - output, substbuf, output+1); - output = ap_pstrcat(r->pool, substbuf, output+1, NULL); - } - else { - rewritelog(r, 4, "add subst prefix: %s -> %s%s", - output, substbuf, output); - output = ap_pstrcat(r->pool, substbuf, output, NULL); - } - } - return output; -} - - -/* -** -** own command line parser which don't have the '\\' problem -** -*/ - -static int parseargline(char *str, char **a1, char **a2, char **a3) -{ - char *cp; - int isquoted; - -#define SKIP_WHITESPACE(cp) \ - for ( ; *cp == ' ' || *cp == '\t'; ) { \ - cp++; \ - }; - -#define CHECK_QUOTATION(cp,isquoted) \ - isquoted = 0; \ - if (*cp == '"') { \ - isquoted = 1; \ - cp++; \ - } - -#define DETERMINE_NEXTSTRING(cp,isquoted) \ - for ( ; *cp != '\0'; cp++) { \ - if ( (isquoted && (*cp == ' ' || *cp == '\t')) \ - || (*cp == '\\' && (*(cp+1) == ' ' || *(cp+1) == '\t'))) { \ - cp++; \ - continue; \ - } \ - if ( (!isquoted && (*cp == ' ' || *cp == '\t')) \ - || (isquoted && *cp == '"') ) { \ - break; \ - } \ - } - - cp = str; - SKIP_WHITESPACE(cp); - - /* determine first argument */ - CHECK_QUOTATION(cp, isquoted); - *a1 = cp; - DETERMINE_NEXTSTRING(cp, isquoted); - if (*cp == '\0') { - return 1; - } - *cp++ = '\0'; - - SKIP_WHITESPACE(cp); - - /* determine second argument */ - CHECK_QUOTATION(cp, isquoted); - *a2 = cp; - DETERMINE_NEXTSTRING(cp, isquoted); - if (*cp == '\0') { - *cp++ = '\0'; - *a3 = NULL; - return 0; - } - *cp++ = '\0'; - - SKIP_WHITESPACE(cp); - - /* again check if there are only two arguments */ - if (*cp == '\0') { - *cp++ = '\0'; - *a3 = NULL; - return 0; - } - - /* determine second argument */ - CHECK_QUOTATION(cp, isquoted); - *a3 = cp; - DETERMINE_NEXTSTRING(cp, isquoted); - *cp++ = '\0'; - - return 0; -} - - -static void add_env_variable(request_rec *r, char *s) -{ - char var[MAX_STRING_LEN]; - char val[MAX_STRING_LEN]; - char *cp; - int n; - - if ((cp = strchr(s, ':')) != NULL) { - n = ((cp-s) > MAX_STRING_LEN-1 ? MAX_STRING_LEN-1 : (cp-s)); - memcpy(var, s, n); - var[n] = '\0'; - ap_cpystrn(val, cp+1, sizeof(val)); - ap_table_set(r->subprocess_env, var, val); - rewritelog(r, 5, "setting env variable '%s' to '%s'", var, val); - } -} - - - -/* -** -** stat() for only the prefix of a path -** -*/ - -static int prefix_stat(const char *path, struct stat *sb) -{ - char curpath[LONG_STRING_LEN]; - char *cp; - - ap_cpystrn(curpath, path, sizeof(curpath)); - if (curpath[0] != '/') { - return 0; - } - if ((cp = strchr(curpath+1, '/')) != NULL) { - *cp = '\0'; - } - if (stat(curpath, sb) == 0) { - return 1; - } - else { - return 0; - } -} - - -/* -** -** File locking -** -*/ - -#ifdef USE_FCNTL -static struct flock lock_it; -static struct flock unlock_it; -#endif - -static void fd_lock(request_rec *r, int fd) -{ - int rc; - -#ifdef USE_FCNTL - lock_it.l_whence = SEEK_SET; /* from current point */ - lock_it.l_start = 0; /* -"- */ - lock_it.l_len = 0; /* until end of file */ - lock_it.l_type = F_WRLCK; /* set exclusive/write lock */ - lock_it.l_pid = 0; /* pid not actually interesting */ - - while ( ((rc = fcntl(fd, F_SETLKW, &lock_it)) < 0) - && (errno == EINTR) ) { - continue; - } -#endif -#ifdef USE_FLOCK - while ( ((rc = flock(fd, LOCK_EX)) < 0) - && (errno == EINTR) ) { - continue; - } -#endif -#ifdef USE_LOCKING - /* Lock the first byte, always, assume we want to append - and seek to the end afterwards */ - lseek(fd, 0, SEEK_SET); - rc = _locking(fd, _LK_LOCK, 1); - lseek(fd, 0, SEEK_END); -#endif - - if (rc < 0) { - ap_log_rerror(APLOG_MARK, APLOG_ERR, r, - "mod_rewrite: failed to lock file descriptor"); - exit(1); - } - return; -} - -static void fd_unlock(request_rec *r, int fd) -{ - int rc; - -#ifdef USE_FCNTL - unlock_it.l_whence = SEEK_SET; /* from current point */ - unlock_it.l_start = 0; /* -"- */ - unlock_it.l_len = 0; /* until end of file */ - unlock_it.l_type = F_UNLCK; /* unlock */ - unlock_it.l_pid = 0; /* pid not actually interesting */ - - rc = fcntl(fd, F_SETLKW, &unlock_it); -#endif -#ifdef USE_FLOCK - rc = flock(fd, LOCK_UN); -#endif -#ifdef USE_LOCKING - lseek(fd, 0, SEEK_SET); - rc = _locking(fd, _LK_UNLCK, 1); - lseek(fd, 0, SEEK_END); -#endif - - if (rc < 0) { - ap_log_rerror(APLOG_MARK, APLOG_ERR, r, - "mod_rewrite: failed to unlock file descriptor"); - exit(1); - } -} - -/* -** -** Lexicographic Compare -** -*/ - -static int compare_lexicography(char *cpNum1, char *cpNum2) -{ - int i; - int n1, n2; - - n1 = strlen(cpNum1); - n2 = strlen(cpNum2); - if (n1 > n2) { - return 1; - } - if (n1 < n2) { - return -1; - } - for (i = 0; i < n1; i++) { - if (cpNum1[i] > cpNum2[i]) { - return 1; - } - if (cpNum1[i] < cpNum2[i]) { - return -1; - } - } - return 0; -} - - -/*EOF*/ diff --git a/modules/mappers/mod_rewrite.dsp b/modules/mappers/mod_rewrite.dsp deleted file mode 100644 index 4a0ffd1bf68b5bfa77f7aa07bce60fd424ff8f3a..0000000000000000000000000000000000000000 --- a/modules/mappers/mod_rewrite.dsp +++ /dev/null @@ -1,117 +0,0 @@ -# Microsoft Developer Studio Project File - Name="ApacheModuleRewrite" - Package Owner=<4> -# Microsoft Developer Studio Generated Build File, Format Version 5.00 -# ** DO NOT EDIT ** - -# TARGTYPE "Win32 (x86) Dynamic-Link Library" 0x0102 - -CFG=ApacheModuleRewrite - Win32 Release -!MESSAGE This is not a valid makefile. To build this project using NMAKE, -!MESSAGE use the Export Makefile command and run -!MESSAGE -!MESSAGE NMAKE /f "ApacheModuleRewrite.mak". -!MESSAGE -!MESSAGE You can specify a configuration when running NMAKE -!MESSAGE by defining the macro CFG on the command line. For example: -!MESSAGE -!MESSAGE NMAKE /f "ApacheModuleRewrite.mak"\ - CFG="ApacheModuleRewrite - Win32 Release" -!MESSAGE -!MESSAGE Possible choices for configuration are: -!MESSAGE -!MESSAGE "ApacheModuleRewrite - Win32 Release" (based on\ - "Win32 (x86) Dynamic-Link Library") -!MESSAGE "ApacheModuleRewrite - Win32 Debug" (based on\ - "Win32 (x86) Dynamic-Link Library") -!MESSAGE - -# Begin Project -# PROP Scc_ProjName "" -# PROP Scc_LocalPath "" -CPP=cl.exe -MTL=midl.exe -RSC=rc.exe - -!IF "$(CFG)" == "ApacheModuleRewrite - Win32 Release" - -# PROP BASE Use_MFC 0 -# PROP BASE Use_Debug_Libraries 0 -# PROP BASE Output_Dir ".\Release" -# PROP BASE Intermediate_Dir ".\Release" -# PROP BASE Target_Dir "" -# PROP Use_MFC 0 -# PROP Use_Debug_Libraries 0 -# PROP Output_Dir ".\ApacheModuleRewriteR" -# PROP Intermediate_Dir ".\ApacheModuleRewriteR" -# PROP Ignore_Export_Lib 0 -# PROP Target_Dir "" -# ADD BASE CPP /nologo /MT /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /YX /c -# ADD CPP /nologo /MD /W3 /GX /O2 /I "..\..\include" /D "NDEBUG" /D "WIN32" /D "_WINDOWS" /D "NO_DBM_REWRITEMAP" /D "SHARED_MODULE" /D "WIN32_LEAN_AND_MEAN" /YX /FD /c -# ADD BASE MTL /nologo /D "NDEBUG" /win32 -# ADD MTL /nologo /D "NDEBUG" /mktyplib203 /win32 -# ADD BASE RSC /l 0x809 /d "NDEBUG" -# ADD RSC /l 0x809 /d "NDEBUG" -BSC32=bscmake.exe -# ADD BASE BSC32 /nologo -# ADD BSC32 /nologo -LINK32=link.exe -# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:windows /dll /machine:I386 -# ADD LINK32 ..\..\CoreR\ApacheCore.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ws2_32.lib /nologo /subsystem:windows /dll /machine:I386 - -!ELSEIF "$(CFG)" == "ApacheModuleRewrite - Win32 Debug" - -# PROP BASE Use_MFC 0 -# PROP BASE Use_Debug_Libraries 1 -# PROP BASE Output_Dir ".\Debug" -# PROP BASE Intermediate_Dir ".\Debug" -# PROP BASE Target_Dir "" -# PROP Use_MFC 0 -# PROP Use_Debug_Libraries 1 -# PROP Output_Dir ".\ApacheModuleRewriteD" -# PROP Intermediate_Dir ".\ApacheModuleRewriteD" -# PROP Ignore_Export_Lib 0 -# PROP Target_Dir "" -# ADD BASE CPP /nologo /MTd /W3 /Gm /GX /Zi /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /YX /c -# ADD CPP /nologo /MDd /W3 /Gm /GX /Zi /Od /I "..\..\include" /D "_DEBUG" /D "WIN32" /D "_WINDOWS" /D "NO_DBM_REWRITEMAP" /D "SHARED_MODULE" /D "WIN32_LEAN_AND_MEAN" /YX /FD /c -# ADD BASE MTL /nologo /D "_DEBUG" /win32 -# ADD MTL /nologo /D "_DEBUG" /mktyplib203 /win32 -# ADD BASE RSC /l 0x809 /d "_DEBUG" -# ADD RSC /l 0x809 /d "_DEBUG" -BSC32=bscmake.exe -# ADD BASE BSC32 /nologo -# ADD BSC32 /nologo -LINK32=link.exe -# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:windows /dll /debug /machine:I386 -# ADD LINK32 ..\..\CoreD\ApacheCore.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ws2_32.lib /nologo /subsystem:windows /dll /debug /machine:I386 - -!ENDIF - -# Begin Target - -# Name "ApacheModuleRewrite - Win32 Release" -# Name "ApacheModuleRewrite - Win32 Debug" -# Begin Group "Source Files" - -# PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;hpj;bat;for;f90" -# Begin Source File - -SOURCE=..\..\modules\standard\mod_rewrite.c -# End Source File -# Begin Source File - -SOURCE=.\passwd.c -# End Source File -# End Group -# Begin Group "Header Files" - -# PROP Default_Filter "h;hpp;hxx;hm;inl;fi;fd" -# Begin Source File - -SOURCE=.\readdir.h -# End Source File -# End Group -# Begin Group "Resource Files" - -# PROP Default_Filter "ico;cur;bmp;dlg;rc2;rct;bin;cnt;rtf;gif;jpg;jpeg;jpe" -# End Group -# End Target -# End Project diff --git a/modules/mappers/mod_rewrite.exp b/modules/mappers/mod_rewrite.exp deleted file mode 100644 index 8f2165bfe054432569153591e5e97c9be503d5a0..0000000000000000000000000000000000000000 --- a/modules/mappers/mod_rewrite.exp +++ /dev/null @@ -1 +0,0 @@ -rewrite_module diff --git a/modules/mappers/mod_rewrite.h b/modules/mappers/mod_rewrite.h deleted file mode 100644 index 22ff3375589c8c36e5183ad94efb57e7788082a0..0000000000000000000000000000000000000000 --- a/modules/mappers/mod_rewrite.h +++ /dev/null @@ -1,497 +0,0 @@ -/* ==================================================================== - * Copyright (c) 1996-1999 The Apache Group. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in - * the documentation and/or other materials provided with the - * distribution. - * - * 3. All advertising materials mentioning features or use of this - * software must display the following acknowledgment: - * "This product includes software developed by the Apache Group - * for use in the Apache HTTP server project (http://www.apache.org/)." - * - * 4. The names "Apache Server" and "Apache Group" must not be used to - * endorse or promote products derived from this software without - * prior written permission. For written permission, please contact - * apache@apache.org. - * - * 5. Products derived from this software may not be called "Apache" - * nor may "Apache" appear in their names without prior written - * permission of the Apache Group. - * - * 6. Redistributions of any form whatsoever must retain the following - * acknowledgment: - * "This product includes software developed by the Apache Group - * for use in the Apache HTTP server project (http://www.apache.org/)." - * - * THIS SOFTWARE IS PROVIDED BY THE APACHE GROUP ``AS IS'' AND ANY - * EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR - * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE APACHE GROUP OR - * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT - * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, - * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED - * OF THE POSSIBILITY OF SUCH DAMAGE. - * ==================================================================== - * - * This software consists of voluntary contributions made by many - * individuals on behalf of the Apache Group and was originally based - * on public domain software written at the National Center for - * Supercomputing Applications, University of Illinois, Urbana-Champaign. - * For more information on the Apache Group and the Apache HTTP server - * project, please see . - * - */ - - -#ifndef _MOD_REWRITE_H -#define _MOD_REWRITE_H 1 - -/* -** _ _ _ -** _ __ ___ ___ __| | _ __ _____ ___ __(_) |_ ___ -** | '_ ` _ \ / _ \ / _` | | '__/ _ \ \ /\ / / '__| | __/ _ \ -** | | | | | | (_) | (_| | | | | __/\ V V /| | | | || __/ -** |_| |_| |_|\___/ \__,_|___|_| \___| \_/\_/ |_| |_|\__\___| -** |_____| -** -** URL Rewriting Module -** -** This module uses a rule-based rewriting engine (based on a -** regular-expression parser) to rewrite requested URLs on the fly. -** -** It supports an unlimited number of additional rule conditions (which can -** operate on a lot of variables, even on HTTP headers) for granular -** matching and even external database lookups (either via plain text -** tables, DBM hash files or even external processes) for advanced URL -** substitution. -** -** It operates on the full URLs (including the PATH_INFO part) both in -** per-server context (httpd.conf) and per-dir context (.htaccess) and even -** can generate QUERY_STRING parts on result. The rewriting result finally -** can lead to internal subprocessing, external request redirection or even -** to internal proxy throughput. -** -** This module was originally written in April 1996 and -** gifted exclusively to the The Apache Group in July 1997 by -** -** Ralf S. Engelschall -** rse@engelschall.com -** www.engelschall.com -*/ - - - /* Include from the underlaying Unix system ... */ -#include -#include -#include -#include -#include -#include -#include -#include -#include - - /* Include from the Apache server ... */ -#define CORE_PRIVATE -#include "httpd.h" -#include "http_config.h" -#include "http_conf_globals.h" -#include "http_request.h" -#include "http_core.h" -#include "http_log.h" -#include "http_vhost.h" - - /* - * The key in the r->notes table wherein we store our accumulated - * Vary values, and the one used for per-condition checks in a chain. - */ -#define VARY_KEY "rewrite-Vary" -#define VARY_KEY_THIS "rewrite-Vary-this" - - /* The NDBM support: - * We support only NDBM files. - * But we have to stat the file for the mtime, - * so we also need to know the file extension - */ -#ifndef NO_DBM_REWRITEMAP -#if defined(__GLIBC__) && defined(__GLIBC_MINOR__) \ - && __GLIBC__ >= 2 && __GLIBC_MINOR__ >= 1 -#include -#else -#include -#endif -#if defined(DBM_SUFFIX) -#define NDBM_FILE_SUFFIX DBM_SUFFIX -#elif defined(__FreeBSD__) || (defined(DB_LOCK) && defined(DB_SHMEM)) -#define NDBM_FILE_SUFFIX ".db" -#else -#define NDBM_FILE_SUFFIX ".pag" -#endif -#endif - - - /* The locking support: - * Try to determine whether we should use fcntl() or flock(). - * Would be better ap_config.h could provide this... :-( - */ -#if defined(USE_FCNTL_SERIALIZED_ACCEPT) -#define USE_FCNTL 1 -#include -#endif -#if defined(USE_FLOCK_SERIALIZED_ACCEPT) -#define USE_FLOCK 1 -#include -#endif -#if !defined(USE_FCNTL) && !defined(USE_FLOCK) -#define USE_FLOCK 1 -#if !defined(MPE) && !defined(WIN32) && !defined(__TANDEM) -#include -#endif -#ifndef LOCK_UN -#undef USE_FLOCK -#define USE_FCNTL 1 -#include -#endif -#endif -#ifdef AIX -#undef USE_FLOCK -#define USE_FCNTL 1 -#include -#endif -#ifdef WIN32 -#undef USE_FCNTL -#define USE_LOCKING -#include -#endif - - -/* -** -** Some defines -** -*/ - -#define ENVVAR_SCRIPT_URL "SCRIPT_URL" -#define ENVVAR_SCRIPT_URI "SCRIPT_URI" - -#ifndef SUPPORT_DBM_REWRITEMAP -#define SUPPORT_DBM_REWRITEMAP 0 -#endif - -#define REWRITE_FORCED_MIMETYPE_NOTEVAR "rewrite-forced-mimetype" - -#define CONDFLAG_NONE 1<<0 -#define CONDFLAG_NOCASE 1<<1 -#define CONDFLAG_NOTMATCH 1<<2 -#define CONDFLAG_ORNEXT 1<<3 - -#define RULEFLAG_NONE 1<<0 -#define RULEFLAG_FORCEREDIRECT 1<<1 -#define RULEFLAG_LASTRULE 1<<2 -#define RULEFLAG_NEWROUND 1<<3 -#define RULEFLAG_CHAIN 1<<4 -#define RULEFLAG_IGNOREONSUBREQ 1<<5 -#define RULEFLAG_NOTMATCH 1<<6 -#define RULEFLAG_PROXY 1<<7 -#define RULEFLAG_PASSTHROUGH 1<<8 -#define RULEFLAG_FORBIDDEN 1<<9 -#define RULEFLAG_GONE 1<<10 -#define RULEFLAG_QSAPPEND 1<<11 -#define RULEFLAG_NOCASE 1<<12 - -#define MAPTYPE_TXT 1<<0 -#define MAPTYPE_DBM 1<<1 -#define MAPTYPE_PRG 1<<2 -#define MAPTYPE_INT 1<<3 -#define MAPTYPE_RND 1<<4 - -#define ENGINE_DISABLED 1<<0 -#define ENGINE_ENABLED 1<<1 - -#define OPTION_NONE 1<<0 -#define OPTION_INHERIT 1<<1 - -#define CACHEMODE_TS 1<<0 -#define CACHEMODE_TTL 1<<1 - -#define CACHE_TLB_ROWS 1024 -#define CACHE_TLB_COLS 4 - -#ifndef FALSE -#define FALSE 0 -#define TRUE !FALSE -#endif - -#ifndef NO -#define NO FALSE -#define YES TRUE -#endif - -#ifndef RAND_MAX -#define RAND_MAX 32767 -#endif - -#ifndef LONG_STRING_LEN -#define LONG_STRING_LEN 2048 -#endif - -#define MAX_ENV_FLAGS 15 - -#define MAX_NMATCH 10 - -/* -** -** our private data structures we handle with -** -*/ - - /* the list structures for holding the mapfile information - * and the rewrite rules - */ -typedef struct { - char *name; /* the name of the map */ - char *datafile; /* filename for map data files */ - char *checkfile; /* filename to check for map existence */ - int type; /* the type of the map */ - int fpin; /* in file pointer for program maps */ - int fpout; /* out file pointer for program maps */ - int fperr; /* err file pointer for program maps */ - char *(*func)(request_rec *, /* function pointer for internal maps */ - char *); -} rewritemap_entry; - -typedef struct { - char *input; /* Input string of RewriteCond */ - char *pattern; /* the RegExp pattern string */ - regex_t *regexp; - int flags; /* Flags which control the match */ -} rewritecond_entry; - -typedef struct { - array_header *rewriteconds; /* the corresponding RewriteCond entries */ - char *pattern; /* the RegExp pattern string */ - regex_t *regexp; /* the RegExp pattern compilation */ - char *output; /* the Substitution string */ - int flags; /* Flags which control the substitution */ - char *forced_mimetype; /* forced MIME type of substitution */ - int forced_responsecode; /* forced HTTP redirect response status */ - char *env[MAX_ENV_FLAGS+1]; /* added environment variables */ - int skip; /* number of next rules to skip */ -} rewriterule_entry; - - - /* the per-server or per-virtual-server configuration - * statically generated once on startup for every server - */ -typedef struct { - int state; /* the RewriteEngine state */ - int options; /* the RewriteOption state */ - char *rewritelogfile; /* the RewriteLog filename */ - int rewritelogfp; /* the RewriteLog open filepointer */ - int rewriteloglevel; /* the RewriteLog level of verbosity */ - array_header *rewritemaps; /* the RewriteMap entries */ - array_header *rewriteconds; /* the RewriteCond entries (temporary) */ - array_header *rewriterules; /* the RewriteRule entries */ - server_rec *server; /* the corresponding server indicator */ -} rewrite_server_conf; - - - /* the per-directory configuration - * generated on-the-fly by Apache server for current request - */ -typedef struct { - int state; /* the RewriteEngine state */ - int options; /* the RewriteOption state */ - array_header *rewriteconds; /* the RewriteCond entries (temporary) */ - array_header *rewriterules; /* the RewriteRule entries */ - char *directory; /* the directory where it applies */ - char *baseurl; /* the base-URL where it applies */ -} rewrite_perdir_conf; - - - /* the cache structures, - * a 4-way hash table with LRU functionality - */ -typedef struct cacheentry { - time_t time; - char *key; - char *value; -} cacheentry; - -typedef struct tlbentry { - int t[CACHE_TLB_COLS]; -} cachetlbentry; - -typedef struct cachelist { - char *resource; - array_header *entries; - array_header *tlb; -} cachelist; - -typedef struct cache { - pool *pool; - array_header *lists; -} cache; - - - /* the regex structure for the - * substitution of backreferences - */ -typedef struct backrefinfo { - char *source; - int nsub; - regmatch_t regmatch[10]; -} backrefinfo; - - -/* -** -** forward declarations -** -*/ - - /* config structure handling */ -static void *config_server_create(pool *p, server_rec *s); -static void *config_server_merge (pool *p, void *basev, void *overridesv); -static void *config_perdir_create(pool *p, char *path); -static void *config_perdir_merge (pool *p, void *basev, void *overridesv); - - /* config directive handling */ -static const char *cmd_rewriteengine(cmd_parms *cmd, - rewrite_perdir_conf *dconf, int flag); -static const char *cmd_rewriteoptions(cmd_parms *cmd, - rewrite_perdir_conf *dconf, - char *option); -static const char *cmd_rewriteoptions_setoption(pool *p, int *options, - char *name); -static const char *cmd_rewritelog (cmd_parms *cmd, void *dconf, char *a1); -static const char *cmd_rewriteloglevel(cmd_parms *cmd, void *dconf, char *a1); -static const char *cmd_rewritemap (cmd_parms *cmd, void *dconf, char *a1, - char *a2); -static const char *cmd_rewritelock(cmd_parms *cmd, void *dconf, char *a1); -static const char *cmd_rewritebase(cmd_parms *cmd, rewrite_perdir_conf *dconf, - char *a1); -static const char *cmd_rewritecond(cmd_parms *cmd, rewrite_perdir_conf *dconf, - char *str); -static const char *cmd_rewritecond_parseflagfield(pool *p, - rewritecond_entry *new, - char *str); -static const char *cmd_rewritecond_setflag(pool *p, rewritecond_entry *cfg, - char *key, char *val); -static const char *cmd_rewriterule(cmd_parms *cmd, rewrite_perdir_conf *dconf, - char *str); -static const char *cmd_rewriterule_parseflagfield(pool *p, - rewriterule_entry *new, - char *str); -static const char *cmd_rewriterule_setflag(pool *p, rewriterule_entry *cfg, - char *key, char *val); - - /* initialisation */ -static void init_module(server_rec *s, pool *p); -static void init_child(server_rec *s, pool *p); - - /* runtime hooks */ -static int hook_uri2file (request_rec *r); -static int hook_mimetype (request_rec *r); -static int hook_fixup (request_rec *r); -static int handler_redirect(request_rec *r); - - /* rewriting engine */ -static int apply_rewrite_list(request_rec *r, array_header *rewriterules, - char *perdir); -static int apply_rewrite_rule(request_rec *r, rewriterule_entry *p, - char *perdir); -static int apply_rewrite_cond(request_rec *r, rewritecond_entry *p, - char *perdir, backrefinfo *briRR, - backrefinfo *briRC); - - /* URI transformation function */ -static void splitout_queryargs(request_rec *r, int qsappend); -static void fully_qualify_uri(request_rec *r); -static void reduce_uri(request_rec *r); -static void expand_backref_inbuffer(pool *p, char *buf, int nbuf, - backrefinfo *bri, char c); -static char *expand_tildepaths(request_rec *r, char *uri); -static void expand_map_lookups(request_rec *r, char *uri, int uri_len); - - /* rewrite map support functions */ -static char *lookup_map(request_rec *r, char *name, char *key); -static char *lookup_map_txtfile(request_rec *r, char *file, char *key); -#ifndef NO_DBM_REWRITEMAP -static char *lookup_map_dbmfile(request_rec *r, char *file, char *key); -#endif -static char *lookup_map_program(request_rec *r, int fpin, - int fpout, char *key); -static char *lookup_map_internal(request_rec *r, - char *(*func)(request_rec *r, char *key), - char *key); -static char *rewrite_mapfunc_toupper(request_rec *r, char *key); -static char *rewrite_mapfunc_tolower(request_rec *r, char *key); -static char *rewrite_mapfunc_escape(request_rec *r, char *key); -static char *rewrite_mapfunc_unescape(request_rec *r, char *key); -static char *select_random_value_part(request_rec *r, char *value); -static void rewrite_rand_init(void); -static int rewrite_rand(int l, int h); - - /* rewriting logfile support */ -static void open_rewritelog(server_rec *s, pool *p); -static void rewritelog(request_rec *r, int level, const char *text, ...) - __attribute__((format(printf,3,4))); -static char *current_logtime(request_rec *r); - - /* rewriting lockfile support */ -static void rewritelock_create(server_rec *s, pool *p); -static void rewritelock_open(server_rec *s, pool *p); -static void rewritelock_remove(void *data); -static void rewritelock_alloc(request_rec *r); -static void rewritelock_free(request_rec *r); - - /* program map support */ -static void run_rewritemap_programs(server_rec *s, pool *p); -static int rewritemap_program_child(void *cmd, child_info *pinfo); - - /* env variable support */ -static void expand_variables_inbuffer(request_rec *r, char *buf, int buf_len); -static char *expand_variables(request_rec *r, char *str); -static char *lookup_variable(request_rec *r, char *var); -static char *lookup_header(request_rec *r, const char *name); - - /* caching functions */ -static cache *init_cache(pool *p); -static char *get_cache_string(cache *c, char *res, int mode, time_t mtime, - char *key); -static void set_cache_string(cache *c, char *res, int mode, time_t mtime, - char *key, char *value); -static cacheentry *retrieve_cache_string(cache *c, char *res, char *key); -static void store_cache_string(cache *c, char *res, cacheentry *ce); - - /* misc functions */ -static char *subst_prefix_path(request_rec *r, char *input, char *match, - char *subst); -static int parseargline(char *str, char **a1, char **a2, char **a3); -static int prefix_stat(const char *path, struct stat *sb); -static void add_env_variable(request_rec *r, char *s); - - /* File locking */ -static void fd_lock(request_rec *r, int fd); -static void fd_unlock(request_rec *r, int fd); - - /* Lexicographic Comparison */ -static int compare_lexicography(char *cpNum1, char *cpNum2); - -#endif /* _MOD_REWRITE_H */ - -/*EOF*/ diff --git a/modules/mappers/mod_so.c b/modules/mappers/mod_so.c deleted file mode 100644 index 0f0b63d37c649475c0991258480560170078c88e..0000000000000000000000000000000000000000 --- a/modules/mappers/mod_so.c +++ /dev/null @@ -1,360 +0,0 @@ -/* ==================================================================== - * Copyright (c) 1995-1999 The Apache Group. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in - * the documentation and/or other materials provided with the - * distribution. - * - * 3. All advertising materials mentioning features or use of this - * software must display the following acknowledgment: - * "This product includes software developed by the Apache Group - * for use in the Apache HTTP server project (http://www.apache.org/)." - * - * 4. The names "Apache Server" and "Apache Group" must not be used to - * endorse or promote products derived from this software without - * prior written permission. For written permission, please contact - * apache@apache.org. - * - * 5. Products derived from this software may not be called "Apache" - * nor may "Apache" appear in their names without prior written - * permission of the Apache Group. - * - * 6. Redistributions of any form whatsoever must retain the following - * acknowledgment: - * "This product includes software developed by the Apache Group - * for use in the Apache HTTP server project (http://www.apache.org/)." - * - * THIS SOFTWARE IS PROVIDED BY THE APACHE GROUP ``AS IS'' AND ANY - * EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR - * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE APACHE GROUP OR - * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT - * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, - * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED - * OF THE POSSIBILITY OF SUCH DAMAGE. - * ==================================================================== - * - * This software consists of voluntary contributions made by many - * individuals on behalf of the Apache Group and was originally based - * on public domain software written at the National Center for - * Supercomputing Applications, University of Illinois, Urbana-Champaign. - * For more information on the Apache Group and the Apache HTTP server - * project, please see . - * - */ - -/* - * This module is used to load Apache modules at runtime. This means that the - * server functionality can be extended without recompiling and even without - * taking the server down at all. Only a HUP or USR1 signal needs to be send - * to the server to reload the dynamically loaded modules. - * - * To use, you'll first need to build your module as a shared library, then - * update your configuration (httpd.conf) to get the Apache core to load the - * module at start-up. - * - * The easiest way to build a module as a shared library is to use the - * `SharedModule' command in the Configuration file, instead of `AddModule'. - * You should also change the file extension from `.o' to `.so'. So, for - * example, to build the status module as a shared library edit Configuration - * and change - * AddModule modules/standard/mod_status.o - * to - * SharedModule modules/standard/mod_status.so - * - * Run Configure and make. Now Apache's httpd binary will _not_ include - * mod_status. Instead a shared object called mod_status.so will be build, in - * the modules/standard directory. You can build most of the modules as shared - * libraries like this. - * - * To use the shared module, move the .so file(s) into an appropriate - * directory. You might like to create a directory called "modules" under you - * server root for this (e.g. /usr/local/httpd/modules). - * - * Then edit your conf/httpd.conf file, and add LoadModule lines. For - * example - * LoadModule status_module modules/mod_status.so - * - * The first argument is the module's structure name (look at the end of the - * module source to find this). The second option is the path to the module - * file, relative to the server root. Put these directives right at the top - * of your httpd.conf file. - * - * Now you can start Apache. A message will be logged at "debug" level to your - * error_log to confirm that the module(s) are loaded (use "LogLevel debug" - * directive to get these log messages). - * - * If you edit the LoadModule directives while the server is live you can get - * Apache to re-load the modules by sending it a HUP or USR1 signal as normal. - * You can use this to dynamically change the capability of your server - * without bringing it down. - * - * Because currently there is only limited built-in support in the Configure - * script for creating the shared library files (`.so'), please consult your - * vendors cc(1), ld(1) and dlopen(3) manpages to find out the appropriate - * compiler and linker flags and insert them manually into the Configuration - * file under CFLAGS_SHLIB, LDFLAGS_SHLIB and LDFLAGS_SHLIB_EXPORT. - * - * If you still have problems figuring out the flags both try the paper - * http://developer.netscape.com/library/documentation/enterprise - * /unix/svrplug.htm#1013807 - * or install a Perl 5 interpreter on your platform and then run the command - * - * $ perl -V:usedl -V:ccdlflags -V:cccdlflags -V:lddlflags - * - * This gives you what type of dynamic loading Perl 5 uses on your platform - * and which compiler and linker flags Perl 5 uses to create the shared object - * files. - * - * Another location where you can find useful hints is the `ltconfig' script - * of the GNU libtool 1.2 package. Search for your platform name inside the - * various "case" constructs. - * - */ - - -#define CORE_PRIVATE -#include "httpd.h" -#include "http_config.h" -#include "http_log.h" - -module MODULE_VAR_EXPORT so_module; - - -/* - * Server configuration to keep track of actually - * loaded modules and the corresponding module name. - */ - -typedef struct moduleinfo { - char *name; - module *modp; -} moduleinfo; - -typedef struct so_server_conf { - array_header *loaded_modules; -} so_server_conf; - -static void *so_sconf_create(pool *p, server_rec *s) -{ - so_server_conf *soc; - - soc = (so_server_conf *)ap_pcalloc(p, sizeof(so_server_conf)); - soc->loaded_modules = ap_make_array(p, DYNAMIC_MODULE_LIMIT, - sizeof(moduleinfo)); -#ifndef NO_DLOPEN - ap_os_dso_init(); -#endif - - return (void *)soc; -} - -#ifndef NO_DLOPEN - -/* - * This is the cleanup for a loaded shared object. It unloads the module. - * This is called as a cleanup function from the core. - */ - -static void unload_module(moduleinfo *modi) -{ - /* only unload if module information is still existing */ - if (modi->modp == NULL) - return; - - /* remove the module pointer from the core structure */ - ap_remove_loaded_module(modi->modp); - - /* unload the module space itself */ - ap_os_dso_unload((ap_os_dso_handle_t)modi->modp->dynamic_load_handle); - - /* destroy the module information */ - modi->modp = NULL; - modi->name = NULL; -} - -/* - * This is the cleanup routine for files loaded by - * load_file(). Unfortunately we don't keep a record of the filename - * that was loaded, so we can't report the unload for debug purposes - * or include the filename in error message. - */ - -static void unload_file(void *handle) -{ - ap_os_dso_unload((ap_os_dso_handle_t)handle); -} - -/* - * This is called for the directive LoadModule and actually loads - * a shared object file into the address space of the server process. - */ - -static const char *load_module(cmd_parms *cmd, void *dummy, - char *modname, char *filename) -{ - ap_os_dso_handle_t modhandle; - module *modp; - const char *szModuleFile=ap_server_root_relative(cmd->pool, filename); - so_server_conf *sconf; - moduleinfo *modi; - moduleinfo *modie; - int i; - - /* - * check for already existing module - * If it already exists, we have nothing to do - */ - sconf = (so_server_conf *)ap_get_module_config(cmd->server->module_config, - &so_module); - modie = (moduleinfo *)sconf->loaded_modules->elts; - for (i = 0; i < sconf->loaded_modules->nelts; i++) { - modi = &modie[i]; - if (modi->name != NULL && strcmp(modi->name, modname) == 0) - return NULL; - } - modi = ap_push_array(sconf->loaded_modules); - modi->name = modname; - - /* - * Load the file into the Apache address space - */ - if (!(modhandle = ap_os_dso_load(szModuleFile))) { - const char *my_error = ap_os_dso_error(); - return ap_pstrcat (cmd->pool, "Cannot load ", szModuleFile, - " into server: ", - my_error ? my_error : "(reason unknown)", - NULL); - } - ap_log_error(APLOG_MARK, APLOG_DEBUG|APLOG_NOERRNO, NULL, - "loaded module %s", modname); - - /* - * Retrieve the pointer to the module structure through the module name: - * First with the hidden variant (prefix `AP_') and then with the plain - * symbol name. - */ - if (!(modp = (module *)(ap_os_dso_sym(modhandle, modname)))) { - return ap_pstrcat(cmd->pool, "Can't locate API module structure `", modname, - "' in file ", szModuleFile, ": ", ap_os_dso_error(), NULL); - } - modi->modp = modp; - modp->dynamic_load_handle = (void *)modhandle; - - /* - * Make sure the found module structure is really a module structure - * - */ - if (modp->magic != MODULE_MAGIC_COOKIE) { - return ap_pstrcat(cmd->pool, "API module structure `", modname, - "' in file ", szModuleFile, " is garbled -" - " perhaps this is not an Apache module DSO?", NULL); - } - - /* - * Add this module to the Apache core structures - */ - ap_add_loaded_module(modp); - - /* - * Register a cleanup in the config pool (normally pconf). When - * we do a restart (or shutdown) this cleanup will cause the - * shared object to be unloaded. - */ - ap_register_cleanup(cmd->pool, modi, - (void (*)(void*))unload_module, ap_null_cleanup); - - /* - * Finally we need to run the configuration process for the module - */ - ap_single_module_configure(cmd->pool, cmd->server, modp); - - return NULL; -} - -/* - * This implements the LoadFile directive and loads an arbitrary - * shared object file into the adress space of the server process. - */ - -static const char *load_file(cmd_parms *cmd, void *dummy, char *filename) -{ - ap_os_dso_handle_t handle; - char *file; - - file = ap_server_root_relative(cmd->pool, filename); - - if (!(handle = ap_os_dso_load(file))) { - const char *my_error = ap_os_dso_error(); - return ap_pstrcat (cmd->pool, "Cannot load ", filename, - " into server:", - my_error ? my_error : "(reason unknown)", - NULL); - } - - ap_log_error(APLOG_MARK, APLOG_DEBUG|APLOG_NOERRNO, NULL, - "loaded file %s", filename); - - ap_register_cleanup(cmd->pool, (void *)handle, unload_file, ap_null_cleanup); - - return NULL; -} - -#else /* not NO_DLOPEN */ - -static const char *load_file(cmd_parms *cmd, void *dummy, char *filename) -{ - fprintf(stderr, "WARNING: LoadFile not supported on this platform\n"); - return NULL; -} - -static const char *load_module(cmd_parms *cmd, void *dummy, - char *modname, char *filename) -{ - fprintf(stderr, "WARNING: LoadModule not supported on this platform\n"); - return NULL; -} - -#endif /* NO_DLOPEN */ - -static const command_rec so_cmds[] = { - { "LoadModule", load_module, NULL, RSRC_CONF, TAKE2, - "a module name and the name of a shared object file to load it from"}, - { "LoadFile", load_file, NULL, RSRC_CONF, ITERATE, - "shared object file or library to load into the server at runtime"}, - { NULL } -}; - -module MODULE_VAR_EXPORT so_module = { - STANDARD_MODULE_STUFF, - NULL, /* initializer */ - NULL, /* create per-dir config */ - NULL, /* merge per-dir config */ - so_sconf_create, /* server config */ - NULL, /* merge server config */ - so_cmds, /* command table */ - NULL, /* handlers */ - NULL, /* filename translation */ - NULL, /* check_user_id */ - NULL, /* check auth */ - NULL, /* check access */ - NULL, /* type_checker */ - NULL, /* fixer_upper */ - NULL, /* logger */ - NULL, /* header parser */ - NULL, /* child_init */ - NULL, /* child_exit */ - NULL /* post read-request */ -}; diff --git a/modules/mappers/mod_speling.c b/modules/mappers/mod_speling.c deleted file mode 100644 index 067fd77c719aa2c2407d454c4a6dc51c9eaef917..0000000000000000000000000000000000000000 --- a/modules/mappers/mod_speling.c +++ /dev/null @@ -1,558 +0,0 @@ -#define WANT_BASENAME_MATCH -/* ==================================================================== - * Copyright (c) 1996-1999 The Apache Group. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in - * the documentation and/or other materials provided with the - * distribution. - * - * 3. All advertising materials mentioning features or use of this - * software must display the following acknowledgment: - * "This product includes software developed by the Apache Group - * for use in the Apache HTTP server project (http://www.apache.org/)." - * - * 4. The names "Apache Server" and "Apache Group" must not be used to - * endorse or promote products derived from this software without - * prior written permission. For written permission, please contact - * apache@apache.org. - * - * 5. Products derived from this software may not be called "Apache" - * nor may "Apache" appear in their names without prior written - * permission of the Apache Group. - * - * 6. Redistributions of any form whatsoever must retain the following - * acknowledgment: - * "This product includes software developed by the Apache Group - * for use in the Apache HTTP server project (http://www.apache.org/)." - * - * THIS SOFTWARE IS PROVIDED BY THE APACHE GROUP ``AS IS'' AND ANY - * EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR - * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE APACHE GROUP OR - * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT - * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, - * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED - * OF THE POSSIBILITY OF SUCH DAMAGE. - * ==================================================================== - * - * This software consists of voluntary contributions made by many - * individuals on behalf of the Apache Group and was originally based - * on public domain software written at the National Center for - * Supercomputing Applications, University of Illinois, Urbana-Champaign. - * For more information on the Apache Group and the Apache HTTP server - * project, please see . - * - */ - -#include "httpd.h" -#include "http_core.h" -#include "http_config.h" -#include "http_log.h" - -/* mod_speling.c - by Alexei Kosut June, 1996 - * - * This module is transparent, and simple. It attempts to correct - * misspellings of URLs that users might have entered, namely by checking - * capitalizations. If it finds a match, it sends a redirect. - * - * 08-Aug-1997 - * o Upgraded module interface to apache_1.3a2-dev API (more NULL's in - * speling_module). - * o Integrated tcsh's "spelling correction" routine which allows one - * misspelling (character insertion/omission/typo/transposition). - * Rewrote it to ignore case as well. This ought to catch the majority - * of misspelled requests. - * o Commented out the second pass where files' suffixes are stripped. - * Given the better hit rate of the first pass, this rather ugly - * (request index.html, receive index.db ?!?!) solution can be - * omitted. - * o wrote a "kind of" html page for mod_speling - * - * Activate it with "CheckSpelling On" - */ - -MODULE_VAR_EXPORT module speling_module; - -typedef struct { - int enabled; -} spconfig; - -/* - * Create a configuration specific to this module for a server or directory - * location, and fill it with the default settings. - * - * The API says that in the absence of a merge function, the record for the - * closest ancestor is used exclusively. That's what we want, so we don't - * bother to have such a function. - */ - -static void *mkconfig(pool *p) -{ - spconfig *cfg = ap_pcalloc(p, sizeof(spconfig)); - - cfg->enabled = 0; - return cfg; -} - -/* - * Respond to a callback to create configuration record for a server or - * vhost environment. - */ -static void *create_mconfig_for_server(pool *p, server_rec *s) -{ - return mkconfig(p); -} - -/* - * Respond to a callback to create a config record for a specific directory. - */ -static void *create_mconfig_for_directory(pool *p, char *dir) -{ - return mkconfig(p); -} - -/* - * Handler for the CheckSpelling directive, which is FLAG. - */ -static const char *set_speling(cmd_parms *cmd, void *mconfig, int arg) -{ - spconfig *cfg = (spconfig *) mconfig; - - cfg->enabled = arg; - return NULL; -} - -/* - * Define the directives specific to this module. This structure is referenced - * later by the 'module' structure. - */ -static const command_rec speling_cmds[] = -{ - { "CheckSpelling", set_speling, NULL, OR_OPTIONS, FLAG, - "whether or not to fix miscapitalized/misspelled requests" }, - { NULL } -}; - -typedef enum { - SP_IDENTICAL = 0, - SP_MISCAPITALIZED = 1, - SP_TRANSPOSITION = 2, - SP_MISSINGCHAR = 3, - SP_EXTRACHAR = 4, - SP_SIMPLETYPO = 5, - SP_VERYDIFFERENT = 6 -} sp_reason; - -static const char *sp_reason_str[] = -{ - "identical", - "miscapitalized", - "transposed characters", - "character missing", - "extra character", - "mistyped character", - "common basename", -}; - -typedef struct { - const char *name; - sp_reason quality; -} misspelled_file; - -/* - * spdist() is taken from Kernighan & Pike, - * _The_UNIX_Programming_Environment_ - * and adapted somewhat to correspond better to psychological reality. - * (Note the changes to the return values) - * - * According to Pollock and Zamora, CACM April 1984 (V. 27, No. 4), - * page 363, the correct order for this is: - * OMISSION = TRANSPOSITION > INSERTION > SUBSTITUTION - * thus, it was exactly backwards in the old version. -- PWP - * - * This routine was taken out of tcsh's spelling correction code - * (tcsh-6.07.04) and re-converted to apache data types ("char" type - * instead of tcsh's NLS'ed "Char"). Plus it now ignores the case - * during comparisons, so is a "approximate strcasecmp()". - * NOTE that is still allows only _one_ real "typo", - * it does NOT try to correct multiple errors. - */ - -static sp_reason spdist(const char *s, const char *t) -{ - for (; ap_tolower(*s) == ap_tolower(*t); t++, s++) { - if (*t == '\0') { - return SP_MISCAPITALIZED; /* exact match (sans case) */ - } - } - if (*s) { - if (*t) { - if (s[1] && t[1] && ap_tolower(*s) == ap_tolower(t[1]) - && ap_tolower(*t) == ap_tolower(s[1]) - && strcasecmp(s + 2, t + 2) == 0) { - return SP_TRANSPOSITION; /* transposition */ - } - if (strcasecmp(s + 1, t + 1) == 0) { - return SP_SIMPLETYPO; /* 1 char mismatch */ - } - } - if (strcasecmp(s + 1, t) == 0) { - return SP_EXTRACHAR; /* extra character */ - } - } - if (*t && strcasecmp(s, t + 1) == 0) { - return SP_MISSINGCHAR; /* missing character */ - } - return SP_VERYDIFFERENT; /* distance too large to fix. */ -} - -static int sort_by_quality(const void *left, const void *rite) -{ - return (int) (((misspelled_file *) left)->quality) - - (int) (((misspelled_file *) rite)->quality); -} - -static int check_speling(request_rec *r) -{ - spconfig *cfg; - char *good, *bad, *postgood, *url; - int filoc, dotloc, urlen, pglen; - DIR *dirp; - struct DIR_TYPE *dir_entry; - array_header *candidates = NULL; - - cfg = ap_get_module_config(r->per_dir_config, &speling_module); - if (!cfg->enabled) { - return DECLINED; - } - - /* We only want to worry about GETs */ - if (r->method_number != M_GET) { - return DECLINED; - } - - /* We've already got a file of some kind or another */ - if (r->proxyreq || (r->finfo.st_mode != 0)) { - return DECLINED; - } - - /* This is a sub request - don't mess with it */ - if (r->main) { - return DECLINED; - } - - /* - * The request should end up looking like this: - * r->uri: /correct-url/mispelling/more - * r->filename: /correct-file/mispelling r->path_info: /more - * - * So we do this in steps. First break r->filename into two pieces - */ - - filoc = ap_rind(r->filename, '/'); - /* - * Don't do anything if the request doesn't contain a slash, or - * requests "/" - */ - if (filoc == -1 || strcmp(r->uri, "/") == 0) { - return DECLINED; - } - - /* good = /correct-file */ - good = ap_pstrndup(r->pool, r->filename, filoc); - /* bad = mispelling */ - bad = ap_pstrdup(r->pool, r->filename + filoc + 1); - /* postgood = mispelling/more */ - postgood = ap_pstrcat(r->pool, bad, r->path_info, NULL); - - urlen = strlen(r->uri); - pglen = strlen(postgood); - - /* Check to see if the URL pieces add up */ - if (strcmp(postgood, r->uri + (urlen - pglen))) { - return DECLINED; - } - - /* url = /correct-url */ - url = ap_pstrndup(r->pool, r->uri, (urlen - pglen)); - - /* Now open the directory and do ourselves a check... */ - dirp = ap_popendir(r->pool, good); - if (dirp == NULL) { /* Oops, not a directory... */ - return DECLINED; - } - - candidates = ap_make_array(r->pool, 2, sizeof(misspelled_file)); - - dotloc = ap_ind(bad, '.'); - if (dotloc == -1) { - dotloc = strlen(bad); - } - - while ((dir_entry = readdir(dirp)) != NULL) { - sp_reason q; - - /* - * If we end up with a "fixed" URL which is identical to the - * requested one, we must have found a broken symlink or some such. - * Do _not_ try to redirect this, it causes a loop! - */ - if (strcmp(bad, dir_entry->d_name) == 0) { - ap_pclosedir(r->pool, dirp); - return OK; - } - /* - * miscapitalization errors are checked first (like, e.g., lower case - * file, upper case request) - */ - else if (strcasecmp(bad, dir_entry->d_name) == 0) { - misspelled_file *sp_new; - - sp_new = (misspelled_file *) ap_push_array(candidates); - sp_new->name = ap_pstrdup(r->pool, dir_entry->d_name); - sp_new->quality = SP_MISCAPITALIZED; - } - /* - * simple typing errors are checked next (like, e.g., - * missing/extra/transposed char) - */ - else if ((q = spdist(bad, dir_entry->d_name)) != SP_VERYDIFFERENT) { - misspelled_file *sp_new; - - sp_new = (misspelled_file *) ap_push_array(candidates); - sp_new->name = ap_pstrdup(r->pool, dir_entry->d_name); - sp_new->quality = q; - } - /* - * The spdist() should have found the majority of the misspelled - * requests. It is of questionable use to continue looking for - * files with the same base name, but potentially of totally wrong - * type (index.html <-> index.db). - * I would propose to not set the WANT_BASENAME_MATCH define. - * 08-Aug-1997 - * - * However, Alexei replied giving some reasons to add it anyway: - * > Oh, by the way, I remembered why having the - * > extension-stripping-and-matching stuff is a good idea: - * > - * > If you're using MultiViews, and have a file named foobar.html, - * > which you refer to as "foobar", and someone tried to access - * > "Foobar", mod_speling won't find it, because it won't find - * > anything matching that spelling. With the extension-munging, - * > it would locate "foobar.html". Not perfect, but I ran into - * > that problem when I first wrote the module. - */ - else { -#ifdef WANT_BASENAME_MATCH - /* - * Okay... we didn't find anything. Now we take out the hard-core - * power tools. There are several cases here. Someone might have - * entered a wrong extension (.htm instead of .html or vice - * versa) or the document could be negotiated. At any rate, now - * we just compare stuff before the first dot. If it matches, we - * figure we got us a match. This can result in wrong things if - * there are files of different content types but the same prefix - * (e.g. foo.gif and foo.html) This code will pick the first one - * it finds. Better than a Not Found, though. - */ - int entloc = ap_ind(dir_entry->d_name, '.'); - if (entloc == -1) { - entloc = strlen(dir_entry->d_name); - } - - if ((dotloc == entloc) - && !strncasecmp(bad, dir_entry->d_name, dotloc)) { - misspelled_file *sp_new; - - sp_new = (misspelled_file *) ap_push_array(candidates); - sp_new->name = ap_pstrdup(r->pool, dir_entry->d_name); - sp_new->quality = SP_VERYDIFFERENT; - } -#endif - } - } - ap_pclosedir(r->pool, dirp); - - if (candidates->nelts != 0) { - /* Wow... we found us a mispelling. Construct a fixed url */ - char *nuri; - const char *ref; - misspelled_file *variant = (misspelled_file *) candidates->elts; - int i; - - ref = ap_table_get(r->headers_in, "Referer"); - - qsort((void *) candidates->elts, candidates->nelts, - sizeof(misspelled_file), sort_by_quality); - - /* - * Conditions for immediate redirection: - * a) the first candidate was not found by stripping the suffix - * AND b) there exists only one candidate OR the best match is not - * ambiguous - * then return a redirection right away. - */ - if (variant[0].quality != SP_VERYDIFFERENT - && (candidates->nelts == 1 - || variant[0].quality != variant[1].quality)) { - - nuri = ap_pstrcat(r->pool, url, variant[0].name, r->path_info, - r->parsed_uri.query ? "?" : "", - r->parsed_uri.query ? r->parsed_uri.query : "", - NULL); - - ap_table_setn(r->headers_out, "Location", - ap_construct_url(r->pool, nuri, r)); - - ap_log_rerror(APLOG_MARK, APLOG_NOERRNO | APLOG_INFO, r, - ref ? "Fixed spelling: %s to %s from %s" - : "Fixed spelling: %s to %s", - r->uri, nuri, ref); - - return HTTP_MOVED_PERMANENTLY; - } - /* - * Otherwise, a "[300] Multiple Choices" list with the variants is - * returned. - */ - else { - pool *p; - table *notes; - pool *sub_pool; - array_header *t; - array_header *v; - - - if (r->main == NULL) { - p = r->pool; - notes = r->notes; - } - else { - p = r->main->pool; - notes = r->main->notes; - } - - sub_pool = ap_make_sub_pool(p); - t = ap_make_array(sub_pool, candidates->nelts * 8 + 8, - sizeof(char *)); - v = ap_make_array(sub_pool, candidates->nelts * 5, - sizeof(char *)); - - /* Generate the response text. */ - - *(const char **)ap_push_array(t) = - "The document name you requested ("; - *(const char **)ap_push_array(t) = r->uri; - *(const char **)ap_push_array(t) = - ") could not be found on this server.\n" - "However, we found documents with names similar " - "to the one you requested.

    " - "Available documents:\n

      \n"; - - for (i = 0; i < candidates->nelts; ++i) { - char *vuri; - const char *reason; - - reason = sp_reason_str[(int) (variant[i].quality)]; - /* The format isn't very neat... */ - vuri = ap_pstrcat(sub_pool, url, variant[i].name, r->path_info, - (r->parsed_uri.query != NULL) ? "?" : "", - (r->parsed_uri.query != NULL) - ? r->parsed_uri.query : "", - NULL); - *(const char **)ap_push_array(v) = "\""; - *(const char **)ap_push_array(v) = vuri; - *(const char **)ap_push_array(v) = "\";\""; - *(const char **)ap_push_array(v) = reason; - *(const char **)ap_push_array(v) = "\""; - - *(const char **)ap_push_array(t) = "
    • "; - *(const char **)ap_push_array(t) = vuri; - *(const char **)ap_push_array(t) = " ("; - *(const char **)ap_push_array(t) = reason; - *(const char **)ap_push_array(t) = ")\n"; - - /* - * when we have printed the "close matches" and there are - * more "distant matches" (matched by stripping the suffix), - * then we insert an additional separator text to suggest - * that the user LOOK CLOSELY whether these are really the - * files she wanted. - */ - if (i > 0 && i < candidates->nelts - 1 - && variant[i].quality != SP_VERYDIFFERENT - && variant[i + 1].quality == SP_VERYDIFFERENT) { - *(const char **)ap_push_array(t) = - "
    \nFurthermore, the following related " - "documents were found:\n
      \n"; - } - } - *(const char **)ap_push_array(t) = "
    \n"; - - /* If we know there was a referring page, add a note: */ - if (ref != NULL) { - *(const char **)ap_push_array(t) = - "Please consider informing the owner of the " - "referring page " - "about the broken link.\n"; - } - - - /* Pass our table to http_protocol.c (see mod_negotiation): */ - ap_table_setn(notes, "variant-list", ap_array_pstrcat(p, t, 0)); - - ap_table_mergen(r->subprocess_env, "VARIANTS", - ap_array_pstrcat(p, v, ',')); - - ap_destroy_pool(sub_pool); - - ap_log_rerror(APLOG_MARK, APLOG_NOERRNO | APLOG_INFO, r, - ref ? "Spelling fix: %s: %d candidates from %s" - : "Spelling fix: %s: %d candidates", - r->uri, candidates->nelts, ref); - - return HTTP_MULTIPLE_CHOICES; - } - } - - return OK; -} - -module MODULE_VAR_EXPORT speling_module = -{ - STANDARD_MODULE_STUFF, - NULL, /* initializer */ - create_mconfig_for_directory, /* create per-dir config */ - NULL, /* merge per-dir config */ - create_mconfig_for_server, /* server config */ - NULL, /* merge server config */ - speling_cmds, /* command table */ - NULL, /* handlers */ - NULL, /* filename translation */ - NULL, /* check_user_id */ - NULL, /* check auth */ - NULL, /* check access */ - NULL, /* type_checker */ - check_speling, /* fixups */ - NULL, /* logger */ - NULL, /* header parser */ - NULL, /* child_init */ - NULL, /* child_exit */ - NULL /* post read-request */ -}; diff --git a/modules/mappers/mod_speling.dsp b/modules/mappers/mod_speling.dsp deleted file mode 100644 index 499a72f3f722a2f2c1c4edcd6dc82e34d00f1aba..0000000000000000000000000000000000000000 --- a/modules/mappers/mod_speling.dsp +++ /dev/null @@ -1,113 +0,0 @@ -# Microsoft Developer Studio Project File - Name="ApacheModuleSpeling" - Package Owner=<4> -# Microsoft Developer Studio Generated Build File, Format Version 5.00 -# ** DO NOT EDIT ** - -# TARGTYPE "Win32 (x86) Dynamic-Link Library" 0x0102 - -CFG=ApacheModuleSpeling - Win32 Release -!MESSAGE This is not a valid makefile. To build this project using NMAKE, -!MESSAGE use the Export Makefile command and run -!MESSAGE -!MESSAGE NMAKE /f "ApacheModuleSpeling.mak". -!MESSAGE -!MESSAGE You can specify a configuration when running NMAKE -!MESSAGE by defining the macro CFG on the command line. For example: -!MESSAGE -!MESSAGE NMAKE /f "ApacheModuleSpeling.mak"\ - CFG="ApacheModuleSpeling - Win32 Release" -!MESSAGE -!MESSAGE Possible choices for configuration are: -!MESSAGE -!MESSAGE "ApacheModuleSpeling - Win32 Release" (based on\ - "Win32 (x86) Dynamic-Link Library") -!MESSAGE "ApacheModuleSpeling - Win32 Debug" (based on\ - "Win32 (x86) Dynamic-Link Library") -!MESSAGE - -# Begin Project -# PROP Scc_ProjName "" -# PROP Scc_LocalPath "" -CPP=cl.exe -MTL=midl.exe -RSC=rc.exe - -!IF "$(CFG)" == "ApacheModuleSpeling - Win32 Release" - -# PROP BASE Use_MFC 0 -# PROP BASE Use_Debug_Libraries 0 -# PROP BASE Output_Dir ".\Release" -# PROP BASE Intermediate_Dir ".\Release" -# PROP BASE Target_Dir "" -# PROP Use_MFC 0 -# PROP Use_Debug_Libraries 0 -# PROP Output_Dir ".\ApacheModuleSpelingR" -# PROP Intermediate_Dir ".\ApacheModuleSpelingR" -# PROP Ignore_Export_Lib 0 -# PROP Target_Dir "" -# ADD BASE CPP /nologo /MT /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /YX /c -# ADD CPP /nologo /MD /W3 /GX /O2 /I "..\..\include" /D "NDEBUG" /D "WIN32" /D "_WINDOWS" /D "SHARED_MODULE" /YX /FD /c -# ADD BASE MTL /nologo /D "NDEBUG" /win32 -# ADD MTL /nologo /D "NDEBUG" /mktyplib203 /win32 -# ADD BASE RSC /l 0x809 /d "NDEBUG" -# ADD RSC /l 0x809 /d "NDEBUG" -BSC32=bscmake.exe -# ADD BASE BSC32 /nologo -# ADD BSC32 /nologo -LINK32=link.exe -# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:windows /dll /machine:I386 -# ADD LINK32 ..\..\CoreR\ApacheCore.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib /nologo /subsystem:windows /dll /machine:I386 - -!ELSEIF "$(CFG)" == "ApacheModuleSpeling - Win32 Debug" - -# PROP BASE Use_MFC 0 -# PROP BASE Use_Debug_Libraries 1 -# PROP BASE Output_Dir ".\Debug" -# PROP BASE Intermediate_Dir ".\Debug" -# PROP BASE Target_Dir "" -# PROP Use_MFC 0 -# PROP Use_Debug_Libraries 1 -# PROP Output_Dir ".\ApacheModuleSpelingD" -# PROP Intermediate_Dir ".\ApacheModuleSpelingD" -# PROP Ignore_Export_Lib 0 -# PROP Target_Dir "" -# ADD BASE CPP /nologo /MTd /W3 /Gm /GX /Zi /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /YX /c -# ADD CPP /nologo /MDd /W3 /Gm /GX /Zi /Od /I "..\..\include" /D "_DEBUG" /D "WIN32" /D "_WINDOWS" /D "SHARED_MODULE" /YX /FD /c -# ADD BASE MTL /nologo /D "_DEBUG" /win32 -# ADD MTL /nologo /D "_DEBUG" /mktyplib203 /win32 -# ADD BASE RSC /l 0x809 /d "_DEBUG" -# ADD RSC /l 0x809 /d "_DEBUG" -BSC32=bscmake.exe -# ADD BASE BSC32 /nologo -# ADD BSC32 /nologo -LINK32=link.exe -# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:windows /dll /debug /machine:I386 -# ADD LINK32 ..\..\CoreD\ApacheCore.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib /nologo /subsystem:windows /dll /debug /machine:I386 - -!ENDIF - -# Begin Target - -# Name "ApacheModuleSpeling - Win32 Release" -# Name "ApacheModuleSpeling - Win32 Debug" -# Begin Group "Source Files" - -# PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;hpj;bat;for;f90" -# Begin Source File - -SOURCE=..\..\modules\standard\mod_speling.c -# End Source File -# End Group -# Begin Group "Header Files" - -# PROP Default_Filter "h;hpp;hxx;hm;inl;fi;fd" -# Begin Source File - -SOURCE=.\readdir.h -# End Source File -# End Group -# Begin Group "Resource Files" - -# PROP Default_Filter "ico;cur;bmp;dlg;rc2;rct;bin;cnt;rtf;gif;jpg;jpeg;jpe" -# End Group -# End Target -# End Project diff --git a/modules/mappers/mod_speling.exp b/modules/mappers/mod_speling.exp deleted file mode 100644 index a6ee8b503406c9a82a58630014352e0e5e635354..0000000000000000000000000000000000000000 --- a/modules/mappers/mod_speling.exp +++ /dev/null @@ -1 +0,0 @@ -speling_module diff --git a/modules/mappers/mod_userdir.c b/modules/mappers/mod_userdir.c deleted file mode 100644 index 5c0e26d27535e81e9a096cb12c1050e6e2e18ba2..0000000000000000000000000000000000000000 --- a/modules/mappers/mod_userdir.c +++ /dev/null @@ -1,349 +0,0 @@ -/* ==================================================================== - * Copyright (c) 1995-1999 The Apache Group. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in - * the documentation and/or other materials provided with the - * distribution. - * - * 3. All advertising materials mentioning features or use of this - * software must display the following acknowledgment: - * "This product includes software developed by the Apache Group - * for use in the Apache HTTP server project (http://www.apache.org/)." - * - * 4. The names "Apache Server" and "Apache Group" must not be used to - * endorse or promote products derived from this software without - * prior written permission. For written permission, please contact - * apache@apache.org. - * - * 5. Products derived from this software may not be called "Apache" - * nor may "Apache" appear in their names without prior written - * permission of the Apache Group. - * - * 6. Redistributions of any form whatsoever must retain the following - * acknowledgment: - * "This product includes software developed by the Apache Group - * for use in the Apache HTTP server project (http://www.apache.org/)." - * - * THIS SOFTWARE IS PROVIDED BY THE APACHE GROUP ``AS IS'' AND ANY - * EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR - * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE APACHE GROUP OR - * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT - * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, - * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED - * OF THE POSSIBILITY OF SUCH DAMAGE. - * ==================================================================== - * - * This software consists of voluntary contributions made by many - * individuals on behalf of the Apache Group and was originally based - * on public domain software written at the National Center for - * Supercomputing Applications, University of Illinois, Urbana-Champaign. - * For more information on the Apache Group and the Apache HTTP server - * project, please see . - * - */ - -/* - * mod_userdir... implement the UserDir command. Broken away from the - * Alias stuff for a couple of good and not-so-good reasons: - * - * 1) It shows a real minimal working example of how to do something like - * this. - * 2) I know people who are actually interested in changing this *particular* - * aspect of server functionality without changing the rest of it. That's - * what this whole modular arrangement is supposed to be good at... - * - * Modified by Alexei Kosut to support the following constructs - * (server running at www.foo.com, request for /~bar/one/two.html) - * - * UserDir public_html -> ~bar/public_html/one/two.html - * UserDir /usr/web -> /usr/web/bar/one/two.html - * UserDir /home/ * /www -> /home/bar/www/one/two.html - * NOTE: theses ^ ^ space only added allow it to work in a comment, ignore - * UserDir http://x/users -> (302) http://x/users/bar/one/two.html - * UserDir http://x/ * /y -> (302) http://x/bar/y/one/two.html - * NOTE: here also ^ ^ - * - * In addition, you can use multiple entries, to specify alternate - * user directories (a la Directory Index). For example: - * - * UserDir public_html /usr/web http://www.xyz.com/users - * - * Modified by Ken Coar to provide for the following: - * - * UserDir disable[d] username ... - * UserDir enable[d] username ... - * - * If "disabled" has no other arguments, *all* ~ references are - * disabled, except those explicitly turned on with the "enabled" keyword. - */ - -#include "httpd.h" -#include "http_config.h" - -module userdir_module; - -typedef struct userdir_config { - int globally_disabled; - char *userdir; - table *enabled_users; - table *disabled_users; -} userdir_config; - -/* - * Server config for this module: global disablement flag, a list of usernames - * ineligible for UserDir access, a list of those immune to global (but not - * explicit) disablement, and the replacement string for all others. - */ - -static void *create_userdir_config(pool *p, server_rec *s) -{ - userdir_config - * newcfg = (userdir_config *) ap_pcalloc(p, sizeof(userdir_config)); - - newcfg->globally_disabled = 0; - newcfg->userdir = DEFAULT_USER_DIR; - newcfg->enabled_users = ap_make_table(p, 4); - newcfg->disabled_users = ap_make_table(p, 4); - return (void *) newcfg; -} - -#define O_DEFAULT 0 -#define O_ENABLE 1 -#define O_DISABLE 2 - -static const char *set_user_dir(cmd_parms *cmd, void *dummy, char *arg) -{ - userdir_config - * s_cfg = (userdir_config *) ap_get_module_config - ( - cmd->server->module_config, - &userdir_module - ); - char *username; - const char - *usernames = arg; - char *kw = ap_getword_conf(cmd->pool, &usernames); - table *usertable; - - /* - * Let's do the comparisons once. - */ - if ((!strcasecmp(kw, "disable")) || (!strcasecmp(kw, "disabled"))) { - /* - * If there are no usernames specified, this is a global disable - we - * need do no more at this point than record the fact. - */ - if (strlen(usernames) == 0) { - s_cfg->globally_disabled = 1; - return NULL; - } - usertable = s_cfg->disabled_users; - } - else if ((!strcasecmp(kw, "enable")) || (!strcasecmp(kw, "enabled"))) { - /* - * The "disable" keyword can stand alone or take a list of names, but - * the "enable" keyword requires the list. Whinge if it doesn't have - * it. - */ - if (strlen(usernames) == 0) { - return "UserDir \"enable\" keyword requires a list of usernames"; - } - usertable = s_cfg->enabled_users; - } - else { - /* - * If the first (only?) value isn't one of our keywords, just copy - * the string to the userdir string. - */ - s_cfg->userdir = ap_pstrdup(cmd->pool, arg); - return NULL; - } - /* - * Now we just take each word in turn from the command line and add it to - * the appropriate table. - */ - while (*usernames) { - username = ap_getword_conf(cmd->pool, &usernames); - ap_table_setn(usertable, username, kw); - } - return NULL; -} - -static const command_rec userdir_cmds[] = { - {"UserDir", set_user_dir, NULL, RSRC_CONF, RAW_ARGS, - "the public subdirectory in users' home directories, or 'disabled', or 'disabled username username...', or 'enabled username username...'"}, - {NULL} -}; - -static int translate_userdir(request_rec *r) -{ - void *server_conf = r->server->module_config; - const userdir_config *s_cfg = - (userdir_config *) ap_get_module_config(server_conf, &userdir_module); - char *name = r->uri; - const char *userdirs = s_cfg->userdir; - const char *w, *dname; - char *redirect; - char *x = NULL; - struct stat statbuf; - - /* - * If the URI doesn't match our basic pattern, we've nothing to do with - * it. - */ - if ( - (s_cfg->userdir == NULL) || - (name[0] != '/') || - (name[1] != '~') - ) { - return DECLINED; - } - - dname = name + 2; - w = ap_getword(r->pool, &dname, '/'); - - /* - * The 'dname' funny business involves backing it up to capture the '/' - * delimiting the "/~user" part from the rest of the URL, in case there - * was one (the case where there wasn't being just "GET /~user HTTP/1.0", - * for which we don't want to tack on a '/' onto the filename). - */ - - if (dname[-1] == '/') { - --dname; - } - - /* - * If there's no username, it's not for us. Ignore . and .. as well. - */ - if (w[0] == '\0' || (w[1] == '.' && (w[2] == '\0' || (w[2] == '.' && w[3] == '\0')))) { - return DECLINED; - } - /* - * Nor if there's an username but it's in the disabled list. - */ - if (ap_table_get(s_cfg->disabled_users, w) != NULL) { - return DECLINED; - } - /* - * If there's a global interdiction on UserDirs, check to see if this - * name is one of the Blessed. - */ - if ( - s_cfg->globally_disabled && - (ap_table_get(s_cfg->enabled_users, w) == NULL) - ) { - return DECLINED; - } - - /* - * Special cases all checked, onward to normal substitution processing. - */ - - while (*userdirs) { - const char *userdir = ap_getword_conf(r->pool, &userdirs); - char *filename = NULL; - - if (strchr(userdir, '*')) - x = ap_getword(r->pool, &userdir, '*'); - - if (userdir[0] == '\0' || ap_os_is_path_absolute(userdir)) { - if (x) { -#ifdef HAVE_DRIVE_LETTERS - /* - * Crummy hack. Need to figure out whether we have been - * redirected to a URL or to a file on some drive. Since I - * know of no protocols that are a single letter, if the : is - * the second character, I will assume a file was specified - */ - if (strchr(x + 2, ':')) -#else - if (strchr(x, ':')) -#endif /* WIN32 */ - { - redirect = ap_pstrcat(r->pool, x, w, userdir, dname, NULL); - ap_table_setn(r->headers_out, "Location", redirect); - return REDIRECT; - } - else - filename = ap_pstrcat(r->pool, x, w, userdir, NULL); - } - else - filename = ap_pstrcat(r->pool, userdir, "/", w, NULL); - } - else if (strchr(userdir, ':')) { - redirect = ap_pstrcat(r->pool, userdir, "/", w, dname, NULL); - ap_table_setn(r->headers_out, "Location", redirect); - return REDIRECT; - } - else { -#ifdef WIN32 - /* Need to figure out home dirs on NT */ - return DECLINED; -#else /* WIN32 */ - struct passwd *pw; - if ((pw = getpwnam(w))) { -#ifdef OS2 - /* Need to manually add user name for OS/2 */ - filename = ap_pstrcat(r->pool, pw->pw_dir, w, "/", userdir, NULL); -#else - filename = ap_pstrcat(r->pool, pw->pw_dir, "/", userdir, NULL); -#endif - } -#endif /* WIN32 */ - } - - /* - * Now see if it exists, or we're at the last entry. If we are at the - * last entry, then use the filename generated (if there is one) - * anyway, in the hope that some handler might handle it. This can be - * used, for example, to run a CGI script for the user. - */ - if (filename && (!*userdirs || stat(filename, &statbuf) != -1)) { - r->filename = ap_pstrcat(r->pool, filename, dname, NULL); - /* when statbuf contains info on r->filename we can save a syscall - * by copying it to r->finfo - */ - if (*userdirs && dname[0] == 0) - r->finfo = statbuf; - return OK; - } - } - - return DECLINED; -} - -module userdir_module = { - STANDARD_MODULE_STUFF, - NULL, /* initializer */ - NULL, /* dir config creater */ - NULL, /* dir merger --- default is to override */ - create_userdir_config, /* server config */ - NULL, /* merge server config */ - userdir_cmds, /* command table */ - NULL, /* handlers */ - translate_userdir, /* filename translation */ - NULL, /* check_user_id */ - NULL, /* check auth */ - NULL, /* check access */ - NULL, /* type_checker */ - NULL, /* fixups */ - NULL, /* logger */ - NULL, /* header parser */ - NULL, /* child_init */ - NULL, /* child_exit */ - NULL /* post read-request */ -}; diff --git a/modules/mappers/mod_userdir.dsp b/modules/mappers/mod_userdir.dsp deleted file mode 100644 index be606a955000a439a0c2c285f78500c4b3ade02a..0000000000000000000000000000000000000000 --- a/modules/mappers/mod_userdir.dsp +++ /dev/null @@ -1,128 +0,0 @@ -# Microsoft Developer Studio Project File - Name="mod_userdir" - Package Owner=<4> -# Microsoft Developer Studio Generated Build File, Format Version 6.00 -# ** DO NOT EDIT ** - -# TARGTYPE "Win32 (x86) Dynamic-Link Library" 0x0102 - -CFG=mod_userdir - Win32 Release -!MESSAGE This is not a valid makefile. To build this project using NMAKE, -!MESSAGE use the Export Makefile command and run -!MESSAGE -!MESSAGE NMAKE /f "mod_userdir.mak". -!MESSAGE -!MESSAGE You can specify a configuration when running NMAKE -!MESSAGE by defining the macro CFG on the command line. For example: -!MESSAGE -!MESSAGE NMAKE /f "mod_userdir.mak" CFG="mod_userdir - Win32 Release" -!MESSAGE -!MESSAGE Possible choices for configuration are: -!MESSAGE -!MESSAGE "mod_userdir - Win32 Release" (based on "Win32 (x86) Dynamic-Link Library") -!MESSAGE "mod_userdir - Win32 Debug" (based on "Win32 (x86) Dynamic-Link Library") -!MESSAGE - -# Begin Project -# PROP AllowPerConfigDependencies 0 -# PROP Scc_ProjName "" -# PROP Scc_LocalPath "" -CPP=cl.exe -MTL=midl.exe -RSC=rc.exe - -!IF "$(CFG)" == "mod_userdir - Win32 Release" - -# PROP BASE Use_MFC 0 -# PROP BASE Use_Debug_Libraries 0 -# PROP BASE Output_Dir "Release" -# PROP BASE Intermediate_Dir "Release" -# PROP BASE Target_Dir "" -# PROP Use_MFC 0 -# PROP Use_Debug_Libraries 0 -# PROP Output_Dir "Release" -# PROP Intermediate_Dir "Release" -# PROP Ignore_Export_Lib 0 -# PROP Target_Dir "" -# ADD BASE CPP /nologo /MD /W3 /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /FD /c -# ADD CPP /nologo /MD /W3 /O2 /I "../../include" /I "../../srclib/apr/include" /I "../../srclib/apr-util/include" /D "NDEBUG" /D "WIN32" /D "_WINDOWS" /Fd"Release\mod_userdir" /FD /c -# ADD BASE MTL /nologo /D "NDEBUG" /win32 -# ADD MTL /nologo /D "NDEBUG" /mktyplib203 /win32 -# ADD BASE RSC /l 0x409 /d "NDEBUG" -# ADD RSC /l 0x409 /d "NDEBUG" -BSC32=bscmake.exe -# ADD BASE BSC32 /nologo -# ADD BSC32 /nologo -LINK32=link.exe -# ADD BASE LINK32 kernel32.lib /nologo /subsystem:windows /dll /map /machine:I386 /out:"Release/mod_userdir.so" /base:@..\..\os\win32\BaseAddr.ref,mod_userdir -# ADD LINK32 kernel32.lib /nologo /subsystem:windows /dll /map /machine:I386 /out:"Release/mod_userdir.so" /base:@..\..\os\win32\BaseAddr.ref,mod_userdir - -!ELSEIF "$(CFG)" == "mod_userdir - Win32 Debug" - -# PROP BASE Use_MFC 0 -# PROP BASE Use_Debug_Libraries 1 -# PROP BASE Output_Dir "Debug" -# PROP BASE Intermediate_Dir "Debug" -# PROP BASE Target_Dir "" -# PROP Use_MFC 0 -# PROP Use_Debug_Libraries 1 -# PROP Output_Dir "Debug" -# PROP Intermediate_Dir "Debug" -# PROP Ignore_Export_Lib 0 -# PROP Target_Dir "" -# ADD BASE CPP /nologo /MDd /W3 /GX /Zi /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /FD /c -# ADD CPP /nologo /MDd /W3 /GX /Zi /Od /I "../../include" /I "../../srclib/apr/include" /I "../../srclib/apr-util/include" /D "_DEBUG" /D "WIN32" /D "_WINDOWS" /Fd"Debug\mod_userdir" /FD /c -# ADD BASE MTL /nologo /D "_DEBUG" /win32 -# ADD MTL /nologo /D "_DEBUG" /mktyplib203 /win32 -# ADD BASE RSC /l 0x409 /d "_DEBUG" -# ADD RSC /l 0x409 /d "_DEBUG" -BSC32=bscmake.exe -# ADD BASE BSC32 /nologo -# ADD BSC32 /nologo -LINK32=link.exe -# ADD BASE LINK32 kernel32.lib /nologo /subsystem:windows /dll /incremental:no /map /debug /machine:I386 /out:"Debug/mod_userdir.so" /base:@..\..\os\win32\BaseAddr.ref,mod_userdir -# ADD LINK32 kernel32.lib /nologo /subsystem:windows /dll /incremental:no /map /debug /machine:I386 /out:"Debug/mod_userdir.so" /base:@..\..\os\win32\BaseAddr.ref,mod_userdir - -!ENDIF - -# Begin Target - -# Name "mod_userdir - Win32 Release" -# Name "mod_userdir - Win32 Debug" -# Begin Source File - -SOURCE=.\mod_userdir.c -# End Source File -# Begin Source File - -SOURCE=.\mod_userdir.rc -# End Source File -# Begin Source File - -SOURCE=..\..\build\win32\win32ver.awk - -!IF "$(CFG)" == "mod_userdir - Win32 Release" - -# PROP Ignore_Default_Tool 1 -# Begin Custom Build - Creating Version Resource -InputPath=..\..\build\win32\win32ver.awk - -".\mod_userdir.rc" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)" - awk -f ../../build/win32/win32ver.awk mod_userdir "userdir_module for Apache" ../../include/ap_release.h > .\mod_userdir.rc - -# End Custom Build - -!ELSEIF "$(CFG)" == "mod_userdir - Win32 Debug" - -# PROP Ignore_Default_Tool 1 -# Begin Custom Build - Creating Version Resource -InputPath=..\..\build\win32\win32ver.awk - -".\mod_userdir.rc" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)" - awk -f ../../build/win32/win32ver.awk mod_userdir "userdir_module for Apache" ../../include/ap_release.h > .\mod_userdir.rc - -# End Custom Build - -!ENDIF - -# End Source File -# End Target -# End Project diff --git a/modules/mappers/mod_userdir.exp b/modules/mappers/mod_userdir.exp deleted file mode 100644 index 6b8b81d5c331ca0ce84c2126be5dd3f09f2d10e9..0000000000000000000000000000000000000000 --- a/modules/mappers/mod_userdir.exp +++ /dev/null @@ -1 +0,0 @@ -userdir_module diff --git a/modules/mappers/mod_vhost_alias.c b/modules/mappers/mod_vhost_alias.c deleted file mode 100644 index 65cc5a2ef4146a98a0c7a4605353fc241441a8b7..0000000000000000000000000000000000000000 --- a/modules/mappers/mod_vhost_alias.c +++ /dev/null @@ -1,482 +0,0 @@ -/* ==================================================================== - * Copyright (c) 1995-1999 The Apache Group. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in - * the documentation and/or other materials provided with the - * distribution. - * - * 3. All advertising materials mentioning features or use of this - * software must display the following acknowledgment: - * "This product includes software developed by the Apache Group - * for use in the Apache HTTP server project (http://www.apache.org/)." - * - * 4. The names "Apache Server" and "Apache Group" must not be used to - * endorse or promote products derived from this software without - * prior written permission. For written permission, please contact - * apache@apache.org. - * - * 5. Products derived from this software may not be called "Apache" - * nor may "Apache" appear in their names without prior written - * permission of the Apache Group. - * - * 6. Redistributions of any form whatsoever must retain the following - * acknowledgment: - * "This product includes software developed by the Apache Group - * for use in the Apache HTTP server project (http://www.apache.org/)." - * - * THIS SOFTWARE IS PROVIDED BY THE APACHE GROUP ``AS IS'' AND ANY - * EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR - * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE APACHE GROUP OR - * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT - * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, - * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED - * OF THE POSSIBILITY OF SUCH DAMAGE. - * ==================================================================== - * - * This software consists of voluntary contributions made by many - * individuals on behalf of the Apache Group and was originally based - * on public domain software written at the National Center for - * Supercomputing Applications, University of Illinois, Urbana-Champaign. - * For more information on the Apache Group and the Apache HTTP server - * project, please see . - * - */ - -/* - * mod_vhost_alias.c: support for dynamically configured mass virtual hosting - * - * Copyright (c) 1998-1999 Demon Internet Ltd. - * - * This software was submitted by Demon Internet to the Apache Group - * in May 1999. Future revisions and derivatives of this source code - * must acknowledge Demon Internet as the original contributor of - * this module. All other licensing and usage conditions are those - * of the Apache Group. - * - * Originally written by Tony Finch . - * - * Implementation ideas were taken from mod_alias.c. The overall - * concept is derived from the OVERRIDE_DOC_ROOT/OVERRIDE_CGIDIR - * patch to Apache 1.3b3 and a similar feature in Demon's thttpd, - * both written by James Grinter . - */ - -#include "httpd.h" -#include "http_config.h" -#include "http_core.h" - - -module MODULE_VAR_EXPORT vhost_alias_module; - - -/* - * basic configuration things - * we abbreviate "mod_vhost_alias" to "mva" for shorter names - */ - -typedef enum { - VHOST_ALIAS_UNSET, VHOST_ALIAS_NONE, VHOST_ALIAS_NAME, VHOST_ALIAS_IP -} mva_mode_e; - -/* - * Per-server module config record. - */ -typedef struct mva_sconf_t { - char *doc_root; - char *cgi_root; - mva_mode_e doc_root_mode; - mva_mode_e cgi_root_mode; -} mva_sconf_t; - -static void *mva_create_server_config(pool *p, server_rec *s) -{ - mva_sconf_t *conf; - - conf = (mva_sconf_t *) ap_pcalloc(p, sizeof(mva_sconf_t)); - conf->doc_root = NULL; - conf->cgi_root = NULL; - conf->doc_root_mode = VHOST_ALIAS_UNSET; - conf->cgi_root_mode = VHOST_ALIAS_UNSET; - return conf; -} - -static void *mva_merge_server_config(pool *p, void *parentv, void *childv) -{ - mva_sconf_t *parent = (mva_sconf_t *) parentv; - mva_sconf_t *child = (mva_sconf_t *) childv; - mva_sconf_t *conf; - - conf = (mva_sconf_t *) ap_pcalloc(p, sizeof(*conf)); - if (child->doc_root_mode == VHOST_ALIAS_UNSET) { - conf->doc_root_mode = parent->doc_root_mode; - conf->doc_root = parent->doc_root; - } - else { - conf->doc_root_mode = child->doc_root_mode; - conf->doc_root = child->doc_root; - } - if (child->cgi_root_mode == VHOST_ALIAS_UNSET) { - conf->cgi_root_mode = parent->cgi_root_mode; - conf->cgi_root = parent->cgi_root; - } - else { - conf->cgi_root_mode = child->cgi_root_mode; - conf->cgi_root = child->cgi_root; - } - return conf; -} - - -/* - * These are just here to tell us what vhost_alias_set should do. - * We don't put anything into them; we just use the cell addresses. - */ -static int vhost_alias_set_doc_root_ip, - vhost_alias_set_cgi_root_ip, - vhost_alias_set_doc_root_name, - vhost_alias_set_cgi_root_name; - -static const char *vhost_alias_set(cmd_parms *cmd, void *dummy, char *map) -{ - mva_sconf_t *conf; - mva_mode_e mode, *pmode; - char **pmap; - char *p; - - conf = (mva_sconf_t *) ap_get_module_config(cmd->server->module_config, - &vhost_alias_module); - /* there ought to be a better way of doing this */ - if (&vhost_alias_set_doc_root_ip == cmd->info) { - mode = VHOST_ALIAS_IP; - pmap = &conf->doc_root; - pmode = &conf->doc_root_mode; - } - else if (&vhost_alias_set_cgi_root_ip == cmd->info) { - mode = VHOST_ALIAS_IP; - pmap = &conf->cgi_root; - pmode = &conf->cgi_root_mode; - } - else if (&vhost_alias_set_doc_root_name == cmd->info) { - mode = VHOST_ALIAS_NAME; - pmap = &conf->doc_root; - pmode = &conf->doc_root_mode; - } - else if (&vhost_alias_set_cgi_root_name == cmd->info) { - mode = VHOST_ALIAS_NAME; - pmap = &conf->cgi_root; - pmode = &conf->cgi_root_mode; - } - else { - return "INTERNAL ERROR: unknown command info"; - } - - if (*map != '/') { - if (strcasecmp(map, "none")) { - return "format string must start with '/' or be 'none'"; - } - *pmap = NULL; - *pmode = VHOST_ALIAS_NONE; - return NULL; - } - - /* sanity check */ - p = map; - while (*p != '\0') { - if (*p++ != '%') { - continue; - } - /* we just found a '%' */ - if (*p == 'p' || *p == '%') { - ++p; - continue; - } - /* optional dash */ - if (*p == '-') { - ++p; - } - /* digit N */ - if (ap_isdigit(*p)) { - ++p; - } - else { - return "syntax error in format string"; - } - /* optional plus */ - if (*p == '+') { - ++p; - } - /* do we end here? */ - if (*p != '.') { - continue; - } - ++p; - /* optional dash */ - if (*p == '-') { - ++p; - } - /* digit M */ - if (ap_isdigit(*p)) { - ++p; - } - else { - return "syntax error in format string"; - } - /* optional plus */ - if (*p == '+') { - ++p; - } - } - *pmap = map; - *pmode = mode; - return NULL; -} - -static const command_rec mva_commands[] = -{ - {"VirtualScriptAlias", vhost_alias_set, &vhost_alias_set_cgi_root_name, - RSRC_CONF, TAKE1, "how to create a ScriptAlias based on the host"}, - {"VirtualDocumentRoot", vhost_alias_set, &vhost_alias_set_doc_root_name, - RSRC_CONF, TAKE1, "how to create the DocumentRoot based on the host"}, - {"VirtualScriptAliasIP", vhost_alias_set, &vhost_alias_set_cgi_root_ip, - RSRC_CONF, TAKE1, "how to create a ScriptAlias based on the host"}, - {"VirtualDocumentRootIP", vhost_alias_set, &vhost_alias_set_doc_root_ip, - RSRC_CONF, TAKE1, "how to create the DocumentRoot based on the host"}, - { NULL } -}; - - -/* - * This really wants to be a nested function - * but C is too feeble to support them. - */ -static ap_inline void vhost_alias_checkspace(request_rec *r, char *buf, - char **pdest, int size) -{ - /* XXX: what if size > HUGE_STRING_LEN? */ - if (*pdest + size > buf + HUGE_STRING_LEN) { - **pdest = '\0'; - if (r->filename) { - r->filename = ap_pstrcat(r->pool, r->filename, buf, NULL); - } - else { - r->filename = ap_pstrdup(r->pool, buf); - } - *pdest = buf; - } -} - -static void vhost_alias_interpolate(request_rec *r, const char *name, - const char *map, const char *uri) -{ - /* 0..9 9..0 */ - enum { MAXDOTS = 19 }; - const char *dots[MAXDOTS+1]; - int ndots; - - char buf[HUGE_STRING_LEN]; - char *dest, last; - - int N, M, Np, Mp, Nd, Md; - const char *start, *end; - - const char *p; - - ndots = 0; - dots[ndots++] = name-1; /* slightly naughty */ - for (p = name; *p; ++p){ - if (*p == '.' && ndots < MAXDOTS) { - dots[ndots++] = p; - } - } - dots[ndots] = p; - - r->filename = NULL; - - dest = buf; - last = '\0'; - while (*map) { - if (*map != '%') { - /* normal characters */ - vhost_alias_checkspace(r, buf, &dest, 1); - last = *dest++ = *map++; - continue; - } - /* we are in a format specifier */ - ++map; - /* can't be a slash */ - last = '\0'; - /* %% -> % */ - if (*map == '%') { - ++map; - vhost_alias_checkspace(r, buf, &dest, 1); - *dest++ = '%'; - continue; - } - /* port number */ - if (*map == 'p') { - ++map; - /* no. of decimal digits in a short plus one */ - vhost_alias_checkspace(r, buf, &dest, 7); - dest += ap_snprintf(dest, 7, "%d", ap_get_server_port(r)); - continue; - } - /* deal with %-N+.-M+ -- syntax is already checked */ - N = M = 0; /* value */ - Np = Mp = 0; /* is there a plus? */ - Nd = Md = 0; /* is there a dash? */ - if (*map == '-') ++map, Nd = 1; - N = *map++ - '0'; - if (*map == '+') ++map, Np = 1; - if (*map == '.') { - ++map; - if (*map == '-') { - ++map, Md = 1; - } - M = *map++ - '0'; - if (*map == '+') { - ++map, Mp = 1; - } - } - /* note that N and M are one-based indices, not zero-based */ - start = dots[0]+1; /* ptr to the first character */ - end = dots[ndots]; /* ptr to the character after the last one */ - if (N != 0) { - if (N > ndots) { - start = "_"; - end = start+1; - } - else if (!Nd) { - start = dots[N-1]+1; - if (!Np) { - end = dots[N]; - } - } - else { - if (!Np) { - start = dots[ndots-N]+1; - } - end = dots[ndots-N+1]; - } - } - if (M != 0) { - if (M > end - start) { - start = "_"; - end = start+1; - } - else if (!Md) { - start = start+M-1; - if (!Mp) { - end = start+1; - } - } - else { - if (!Mp) { - start = end-M; - } - end = end-M+1; - } - } - vhost_alias_checkspace(r, buf, &dest, end - start); - for (p = start; p < end; ++p) { - *dest++ = ap_tolower(*p); - } - } - *dest = '\0'; - /* no double slashes */ - if (last == '/') { - ++uri; - } - if (r->filename) { - r->filename = ap_pstrcat(r->pool, r->filename, buf, uri, NULL); - } - else { - r->filename = ap_pstrcat(r->pool, buf, uri, NULL); - } -} - -static int mva_translate(request_rec *r) -{ - mva_sconf_t *conf; - const char *name, *map, *uri; - mva_mode_e mode; - int cgi; - - conf = (mva_sconf_t *) ap_get_module_config(r->server->module_config, - &vhost_alias_module); - if (!strncmp(r->uri, "/cgi-bin/", 9)) { - mode = conf->cgi_root_mode; - map = conf->cgi_root; - uri = r->uri + 8; - /* - * can't force cgi immediately because we might not handle this - * call if the mode is wrong - */ - cgi = 1; - } - else if (r->uri[0] == '/') { - mode = conf->doc_root_mode; - map = conf->doc_root; - uri = r->uri; - cgi = 0; - } - else { - return DECLINED; - } - - if (mode == VHOST_ALIAS_NAME) { - name = ap_get_server_name(r); - } - else if (mode == VHOST_ALIAS_IP) { - name = r->connection->local_ip; - } - else { - return DECLINED; - } - - vhost_alias_interpolate(r, name, map, uri); - - if (cgi) { - /* see is_scriptaliased() in mod_cgi */ - r->handler = "cgi-script"; - ap_table_setn(r->notes, "alias-forced-type", r->handler); - } - - return OK; -} - - -module MODULE_VAR_EXPORT vhost_alias_module = -{ - STANDARD_MODULE_STUFF, - NULL, /* initializer */ - NULL, /* dir config creater */ - NULL, /* dir merger --- default is to override */ - mva_create_server_config, /* server config */ - mva_merge_server_config, /* merge server configs */ - mva_commands, /* command table */ - NULL, /* handlers */ - mva_translate, /* filename translation */ - NULL, /* check_user_id */ - NULL, /* check auth */ - NULL, /* check access */ - NULL, /* type_checker */ - NULL, /* fixups */ - NULL, /* logger */ - NULL, /* header parser */ - NULL, /* child_init */ - NULL, /* child_exit */ - NULL /* post read-request */ -}; diff --git a/modules/mappers/mod_vhost_alias.dsp b/modules/mappers/mod_vhost_alias.dsp deleted file mode 100644 index 7a892bf83d7019ac1aacbadfc8cbe9e42fa8f0be..0000000000000000000000000000000000000000 --- a/modules/mappers/mod_vhost_alias.dsp +++ /dev/null @@ -1,128 +0,0 @@ -# Microsoft Developer Studio Project File - Name="mod_vhost_alias" - Package Owner=<4> -# Microsoft Developer Studio Generated Build File, Format Version 6.00 -# ** DO NOT EDIT ** - -# TARGTYPE "Win32 (x86) Dynamic-Link Library" 0x0102 - -CFG=mod_vhost_alias - Win32 Release -!MESSAGE This is not a valid makefile. To build this project using NMAKE, -!MESSAGE use the Export Makefile command and run -!MESSAGE -!MESSAGE NMAKE /f "mod_vhost_alias.mak". -!MESSAGE -!MESSAGE You can specify a configuration when running NMAKE -!MESSAGE by defining the macro CFG on the command line. For example: -!MESSAGE -!MESSAGE NMAKE /f "mod_vhost_alias.mak" CFG="mod_vhost_alias - Win32 Release" -!MESSAGE -!MESSAGE Possible choices for configuration are: -!MESSAGE -!MESSAGE "mod_vhost_alias - Win32 Release" (based on "Win32 (x86) Dynamic-Link Library") -!MESSAGE "mod_vhost_alias - Win32 Debug" (based on "Win32 (x86) Dynamic-Link Library") -!MESSAGE - -# Begin Project -# PROP AllowPerConfigDependencies 0 -# PROP Scc_ProjName "" -# PROP Scc_LocalPath "" -CPP=cl.exe -MTL=midl.exe -RSC=rc.exe - -!IF "$(CFG)" == "mod_vhost_alias - Win32 Release" - -# PROP BASE Use_MFC 0 -# PROP BASE Use_Debug_Libraries 0 -# PROP BASE Output_Dir "Release" -# PROP BASE Intermediate_Dir "Release" -# PROP BASE Target_Dir "" -# PROP Use_MFC 0 -# PROP Use_Debug_Libraries 0 -# PROP Output_Dir "Release" -# PROP Intermediate_Dir "Release" -# PROP Ignore_Export_Lib 0 -# PROP Target_Dir "" -# ADD BASE CPP /nologo /MD /W3 /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /FD /c -# ADD CPP /nologo /MD /W3 /O2 /I "..\..\include" /I "..\..\os\win32" /I "..\..\srclib\apr\include" /I "../../srclib/apr-util/include" /D "NDEBUG" /D "WIN32" /D "_WINDOWS" /Fd"Release\mod_vhost_alias" /FD /c -# ADD BASE MTL /nologo /D "NDEBUG" /win32 -# ADD MTL /nologo /D "NDEBUG" /mktyplib203 /win32 -# ADD BASE RSC /l 0x409 /d "NDEBUG" -# ADD RSC /l 0x409 /d "NDEBUG" -BSC32=bscmake.exe -# ADD BASE BSC32 /nologo -# ADD BSC32 /nologo -LINK32=link.exe -# ADD BASE LINK32 kernel32.lib /nologo /subsystem:windows /dll /map /machine:I386 /out:"Release/mod_vhost_alias.so" /base:@..\..\os\win32\BaseAddr.ref,mod_vhost_alias -# ADD LINK32 kernel32.lib /nologo /subsystem:windows /dll /map /machine:I386 /out:"Release/mod_vhost_alias.so" /base:@..\..\os\win32\BaseAddr.ref,mod_vhost_alias - -!ELSEIF "$(CFG)" == "mod_vhost_alias - Win32 Debug" - -# PROP BASE Use_MFC 0 -# PROP BASE Use_Debug_Libraries 1 -# PROP BASE Output_Dir "Debug" -# PROP BASE Intermediate_Dir "Debug" -# PROP BASE Target_Dir "" -# PROP Use_MFC 0 -# PROP Use_Debug_Libraries 1 -# PROP Output_Dir "Debug" -# PROP Intermediate_Dir "Debug" -# PROP Ignore_Export_Lib 0 -# PROP Target_Dir "" -# ADD BASE CPP /nologo /MDd /W3 /GX /Zi /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /FD /c -# ADD CPP /nologo /MDd /W3 /GX /Zi /Od /I "..\..\include" /I "..\..\os\win32" /I "..\..\srclib\apr\include" /I "../../srclib/apr-util/include" /D "_DEBUG" /D "WIN32" /D "_WINDOWS" /Fd"Debug\mod_vhost_alias" /FD /c -# ADD BASE MTL /nologo /D "_DEBUG" /win32 -# ADD MTL /nologo /D "_DEBUG" /mktyplib203 /win32 -# ADD BASE RSC /l 0x409 /d "_DEBUG" -# ADD RSC /l 0x409 /d "_DEBUG" -BSC32=bscmake.exe -# ADD BASE BSC32 /nologo -# ADD BSC32 /nologo -LINK32=link.exe -# ADD BASE LINK32 kernel32.lib /nologo /subsystem:windows /dll /incremental:no /map /debug /machine:I386 /out:"Debug/mod_vhost_alias.so" /base:@..\..\os\win32\BaseAddr.ref,mod_vhost_alias -# ADD LINK32 kernel32.lib /nologo /subsystem:windows /dll /incremental:no /map /debug /machine:I386 /out:"Debug/mod_vhost_alias.so" /base:@..\..\os\win32\BaseAddr.ref,mod_vhost_alias - -!ENDIF - -# Begin Target - -# Name "mod_vhost_alias - Win32 Release" -# Name "mod_vhost_alias - Win32 Debug" -# Begin Source File - -SOURCE=.\mod_vhost_alias.c -# End Source File -# Begin Source File - -SOURCE=.\mod_vhost_alias.rc -# End Source File -# Begin Source File - -SOURCE=..\..\build\win32\win32ver.awk - -!IF "$(CFG)" == "mod_vhost_alias - Win32 Release" - -# PROP Ignore_Default_Tool 1 -# Begin Custom Build - Creating Version Resource -InputPath=..\..\build\win32\win32ver.awk - -".\mod_vhost_alias.rc" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)" - awk -f ../../build/win32/win32ver.awk mod_vhost_alias "vhost_alias_module for Apache" ../../include/ap_release.h > .\mod_vhost_alias.rc - -# End Custom Build - -!ELSEIF "$(CFG)" == "mod_vhost_alias - Win32 Debug" - -# PROP Ignore_Default_Tool 1 -# Begin Custom Build - Creating Version Resource -InputPath=..\..\build\win32\win32ver.awk - -".\mod_vhost_alias.rc" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)" - awk -f ../../build/win32/win32ver.awk mod_vhost_alias "vhost_alias_module for Apache" ../../include/ap_release.h > .\mod_vhost_alias.rc - -# End Custom Build - -!ENDIF - -# End Source File -# End Target -# End Project diff --git a/modules/mappers/mod_vhost_alias.exp b/modules/mappers/mod_vhost_alias.exp deleted file mode 100644 index b17666fc86fb809978febe77cbbcbf7f687429e0..0000000000000000000000000000000000000000 --- a/modules/mappers/mod_vhost_alias.exp +++ /dev/null @@ -1 +0,0 @@ -vhost_alias_module diff --git a/modules/metadata/.cvsignore b/modules/metadata/.cvsignore deleted file mode 100644 index f2f7a70d2c9528e7ef84cf1b3bf9ff721fa08b08..0000000000000000000000000000000000000000 --- a/modules/metadata/.cvsignore +++ /dev/null @@ -1,10 +0,0 @@ -.deps -.libs -*.la -modules.mk -Makefile -*.lo -*.slo -*.so -*.dll -*.def diff --git a/modules/metadata/.indent.pro b/modules/metadata/.indent.pro deleted file mode 100644 index a9fbe9f9a1f2e6e7bcc54171c215bdacd44171ba..0000000000000000000000000000000000000000 --- a/modules/metadata/.indent.pro +++ /dev/null @@ -1,54 +0,0 @@ --i4 -npsl -di0 -br -nce -d0 -cli0 -npcs -nfc1 --TBUFF --TFILE --TTRANS --TUINT4 --T_trans --Tallow_options_t --Tapache_sfio --Tarray_header --Tbool_int --Tbuf_area --Tbuff_struct --Tbuffy --Tcmd_how --Tcmd_parms --Tcommand_rec --Tcommand_struct --Tconn_rec --Tcore_dir_config --Tcore_server_config --Tdir_maker_func --Tevent --Tglobals_s --Thandler_func --Thandler_rec --Tjoblist_s --Tlisten_rec --Tmerger_func --Tmode_t --Tmodule --Tmodule_struct --Tmutex --Tn_long --Tother_child_rec --Toverrides_t --Tparent_score --Tpid_t --Tpiped_log --Tpool --Trequest_rec --Trequire_line --Trlim_t --Tscoreboard --Tsemaphore --Tserver_addr_rec --Tserver_rec --Tserver_rec_chain --Tshort_score --Ttable --Ttable_entry --Tthread --Tu_wide_int --Tvtime_t --Twide_int diff --git a/modules/metadata/Makefile.in b/modules/metadata/Makefile.in deleted file mode 100644 index 167b343d0db75f7876a55cef1681570eba813202..0000000000000000000000000000000000000000 --- a/modules/metadata/Makefile.in +++ /dev/null @@ -1,3 +0,0 @@ - -include $(top_srcdir)/build/special.mk - diff --git a/modules/metadata/NWGNUcernmeta b/modules/metadata/NWGNUcernmeta deleted file mode 100644 index abc4cab1e309f015a7995c96ec0162d4870c1a77..0000000000000000000000000000000000000000 --- a/modules/metadata/NWGNUcernmeta +++ /dev/null @@ -1,250 +0,0 @@ -# -# Make sure all needed macro's are defined -# - -# -# Get the 'head' of the build environment if necessary. This includes default -# targets and paths to tools -# - -ifndef EnvironmentDefined -include $(AP_WORK)\build\NWGNUhead.inc -endif - -# -# These directories will be at the beginning of the include list, followed by -# INCDIRS -# -XINCDIRS += \ - $(AP_WORK)/include \ - $(NWOS) \ - $(AP_WORK)/modules/arch/netware \ - $(AP_WORK)/srclib/apr/include \ - $(AP_WORK)/srclib/apr-util/include \ - $(AP_WORK)/srclib/apr \ - $(EOLIST) - -# -# These flags will come after CFLAGS -# -XCFLAGS += \ - -prefix pre_nw.h \ - $(EOLIST) - -# -# These defines will come after DEFINES -# -XDEFINES += \ - $(EOLIST) - -# -# These flags will be added to the link.opt file -# -XLFLAGS += \ - $(EOLIST) - -# -# These values will be appended to the correct variables based on the value of -# RELEASE -# -ifeq "$(RELEASE)" "debug" -XINCDIRS += \ - $(EOLIST) - -XCFLAGS += \ - $(EOLIST) - -XDEFINES += \ - $(EOLIST) - -XLFLAGS += \ - $(EOLIST) -endif - -ifeq "$(RELEASE)" "noopt" -XINCDIRS += \ - $(EOLIST) - -XCFLAGS += \ - $(EOLIST) - -XDEFINES += \ - $(EOLIST) - -XLFLAGS += \ - $(EOLIST) -endif - -ifeq "$(RELEASE)" "release" -XINCDIRS += \ - $(EOLIST) - -XCFLAGS += \ - $(EOLIST) - -XDEFINES += \ - $(EOLIST) - -XLFLAGS += \ - $(EOLIST) -endif - -# -# These are used by the link target if an NLM is being generated -# This is used by the link 'name' directive to name the nlm. If left blank -# TARGET_nlm (see below) will be used. -# -NLM_NAME = cernmeta - -# -# This is used by the link '-desc ' directive. -# If left blank, NLM_NAME will be used. -# -NLM_DESCRIPTION = CERN Meta Module - -# -# This is used by the '-threadname' directive. If left blank, -# NLM_NAME Thread will be used. -# -NLM_THREAD_NAME = CERN Meta Module - -# -# If this is specified, it will override VERSION value in -# $(AP_WORK)\build\NWGNUenvironment.inc -# -NLM_VERSION = - -# -# If this is specified, it will override the default of 64K -# -NLM_STACK_SIZE = 8192 - - -# -# If this is specified it will be used by the link '-entry' directive -# -NLM_ENTRY_SYM = _LibCPrelude - -# -# If this is specified it will be used by the link '-exit' directive -# -NLM_EXIT_SYM = _LibCPostlude - -# -# If this is specified it will be used by the link '-check' directive -# -NLM_CHECK_SYM = - -# -# If these are specified it will be used by the link '-flags' directive -# -NLM_FLAGS = AUTOUNLOAD, PSEUDOPREEMPTION - -# -# If this is specified it will be linked in with the XDCData option in the def -# file instead of the default of $(NWOS)/apache.xdc. XDCData can be disabled -# by setting APACHE_UNIPROC in the environment -# -XDCDATA = - -# -# If there is an NLM target, put it here -# -TARGET_nlm = \ - $(OBJDIR)/cernmeta.nlm \ - $(EOLIST) - -# -# If there is an LIB target, put it here -# -TARGET_lib = \ - $(EOLIST) - -# -# These are the OBJ files needed to create the NLM target above. -# Paths must all use the '/' character -# -FILES_nlm_objs = \ - $(OBJDIR)/mod_cern_meta.o \ - $(EOLIST) - -# -# These are the LIB files needed to create the NLM target above. -# These will be added as a library command in the link.opt file. -# -FILES_nlm_libs = \ - libcpre.o \ - $(EOLIST) - -# -# These are the modules that the above NLM target depends on to load. -# These will be added as a module command in the link.opt file. -# -FILES_nlm_modules = \ - aprlib \ - libc \ - $(EOLIST) - -# -# If the nlm has a msg file, put it's path here -# -FILE_nlm_msg = - -# -# If the nlm has a hlp file put it's path here -# -FILE_nlm_hlp = - -# -# If this is specified, it will override $(NWOS)\copyright.txt. -# -FILE_nlm_copyright = - -# -# Any additional imports go here -# -FILES_nlm_Ximports = \ - @$(APR)/aprlib.imp \ - @$(NWOS)/httpd.imp \ - @libc.imp \ - $(EOLIST) - -# -# Any symbols exported to here -# -FILES_nlm_exports = \ - cern_meta_module \ - $(EOLIST) - -# -# These are the OBJ files needed to create the LIB target above. -# Paths must all use the '/' character -# -FILES_lib_objs = \ - $(EOLIST) - -# -# implement targets and dependancies (leave this section alone) -# - -libs :: $(OBJDIR) $(TARGET_lib) - -nlms :: libs $(TARGET_nlm) - -# -# Updated this target to create necessary directories and copy files to the -# correct place. (See $(AP_WORK)\build\NWGNUhead.inc for examples) -# -install :: nlms FORCE - -# -# Any specialized rules here -# - -# -# Include the 'tail' makefile that has targets that depend on variables defined -# in this makefile -# - -include $(AP_WORK)\build\NWGNUtail.inc - diff --git a/modules/metadata/NWGNUexpires b/modules/metadata/NWGNUexpires deleted file mode 100644 index e55fa0dad74b5ac97c51178c368e2896517f9460..0000000000000000000000000000000000000000 --- a/modules/metadata/NWGNUexpires +++ /dev/null @@ -1,250 +0,0 @@ -# -# Make sure all needed macro's are defined -# - -# -# Get the 'head' of the build environment if necessary. This includes default -# targets and paths to tools -# - -ifndef EnvironmentDefined -include $(AP_WORK)\build\NWGNUhead.inc -endif - -# -# These directories will be at the beginning of the include list, followed by -# INCDIRS -# -XINCDIRS += \ - $(AP_WORK)/include \ - $(NWOS) \ - $(AP_WORK)/modules/arch/netware \ - $(AP_WORK)/srclib/apr/include \ - $(AP_WORK)/srclib/apr-util/include \ - $(AP_WORK)/srclib/apr \ - $(EOLIST) - -# -# These flags will come after CFLAGS -# -XCFLAGS += \ - -prefix pre_nw.h \ - $(EOLIST) - -# -# These defines will come after DEFINES -# -XDEFINES += \ - $(EOLIST) - -# -# These flags will be added to the link.opt file -# -XLFLAGS += \ - $(EOLIST) - -# -# These values will be appended to the correct variables based on the value of -# RELEASE -# -ifeq "$(RELEASE)" "debug" -XINCDIRS += \ - $(EOLIST) - -XCFLAGS += \ - $(EOLIST) - -XDEFINES += \ - $(EOLIST) - -XLFLAGS += \ - $(EOLIST) -endif - -ifeq "$(RELEASE)" "noopt" -XINCDIRS += \ - $(EOLIST) - -XCFLAGS += \ - $(EOLIST) - -XDEFINES += \ - $(EOLIST) - -XLFLAGS += \ - $(EOLIST) -endif - -ifeq "$(RELEASE)" "release" -XINCDIRS += \ - $(EOLIST) - -XCFLAGS += \ - $(EOLIST) - -XDEFINES += \ - $(EOLIST) - -XLFLAGS += \ - $(EOLIST) -endif - -# -# These are used by the link target if an NLM is being generated -# This is used by the link 'name' directive to name the nlm. If left blank -# TARGET_nlm (see below) will be used. -# -NLM_NAME = expires - -# -# This is used by the link '-desc ' directive. -# If left blank, NLM_NAME will be used. -# -NLM_DESCRIPTION = Expires Module - -# -# This is used by the '-threadname' directive. If left blank, -# NLM_NAME Thread will be used. -# -NLM_THREAD_NAME = Expires Module - -# -# If this is specified, it will override VERSION value in -# $(AP_WORK)\build\NWGNUenvironment.inc -# -NLM_VERSION = - -# -# If this is specified, it will override the default of 64K -# -NLM_STACK_SIZE = 8192 - - -# -# If this is specified it will be used by the link '-entry' directive -# -NLM_ENTRY_SYM = _LibCPrelude - -# -# If this is specified it will be used by the link '-exit' directive -# -NLM_EXIT_SYM = _LibCPostlude - -# -# If this is specified it will be used by the link '-check' directive -# -NLM_CHECK_SYM = - -# -# If these are specified it will be used by the link '-flags' directive -# -NLM_FLAGS = AUTOUNLOAD, PSEUDOPREEMPTION - -# -# If this is specified it will be linked in with the XDCData option in the def -# file instead of the default of $(NWOS)/apache.xdc. XDCData can be disabled -# by setting APACHE_UNIPROC in the environment -# -XDCDATA = - -# -# If there is an NLM target, put it here -# -TARGET_nlm = \ - $(OBJDIR)/expires.nlm \ - $(EOLIST) - -# -# If there is an LIB target, put it here -# -TARGET_lib = \ - $(EOLIST) - -# -# These are the OBJ files needed to create the NLM target above. -# Paths must all use the '/' character -# -FILES_nlm_objs = \ - $(OBJDIR)/mod_expires.o \ - $(EOLIST) - -# -# These are the LIB files needed to create the NLM target above. -# These will be added as a library command in the link.opt file. -# -FILES_nlm_libs = \ - libcpre.o \ - $(EOLIST) - -# -# These are the modules that the above NLM target depends on to load. -# These will be added as a module command in the link.opt file. -# -FILES_nlm_modules = \ - aprlib \ - libc \ - $(EOLIST) - -# -# If the nlm has a msg file, put it's path here -# -FILE_nlm_msg = - -# -# If the nlm has a hlp file put it's path here -# -FILE_nlm_hlp = - -# -# If this is specified, it will override $(NWOS)\copyright.txt. -# -FILE_nlm_copyright = - -# -# Any additional imports go here -# -FILES_nlm_Ximports = \ - @$(APR)/aprlib.imp \ - @$(NWOS)/httpd.imp \ - @libc.imp \ - $(EOLIST) - -# -# Any symbols exported to here -# -FILES_nlm_exports = \ - expires_module \ - $(EOLIST) - -# -# These are the OBJ files needed to create the LIB target above. -# Paths must all use the '/' character -# -FILES_lib_objs = \ - $(EOLIST) - -# -# implement targets and dependancies (leave this section alone) -# - -libs :: $(OBJDIR) $(TARGET_lib) - -nlms :: libs $(TARGET_nlm) - -# -# Updated this target to create necessary directories and copy files to the -# correct place. (See $(AP_WORK)\build\NWGNUhead.inc for examples) -# -install :: nlms FORCE - -# -# Any specialized rules here -# - -# -# Include the 'tail' makefile that has targets that depend on variables defined -# in this makefile -# - -include $(AP_WORK)\build\NWGNUtail.inc - diff --git a/modules/metadata/NWGNUheaders b/modules/metadata/NWGNUheaders deleted file mode 100644 index 88be58ee34800af8c77adde0a4f1e53b93bb95a8..0000000000000000000000000000000000000000 --- a/modules/metadata/NWGNUheaders +++ /dev/null @@ -1,250 +0,0 @@ -# -# Make sure all needed macro's are defined -# - -# -# Get the 'head' of the build environment if necessary. This includes default -# targets and paths to tools -# - -ifndef EnvironmentDefined -include $(AP_WORK)\build\NWGNUhead.inc -endif - -# -# These directories will be at the beginning of the include list, followed by -# INCDIRS -# -XINCDIRS += \ - $(AP_WORK)/include \ - $(NWOS) \ - $(AP_WORK)/modules/arch/netware \ - $(AP_WORK)/srclib/apr/include \ - $(AP_WORK)/srclib/apr-util/include \ - $(AP_WORK)/srclib/apr \ - $(EOLIST) - -# -# These flags will come after CFLAGS -# -XCFLAGS += \ - -prefix pre_nw.h \ - $(EOLIST) - -# -# These defines will come after DEFINES -# -XDEFINES += \ - $(EOLIST) - -# -# These flags will be added to the link.opt file -# -XLFLAGS += \ - $(EOLIST) - -# -# These values will be appended to the correct variables based on the value of -# RELEASE -# -ifeq "$(RELEASE)" "debug" -XINCDIRS += \ - $(EOLIST) - -XCFLAGS += \ - $(EOLIST) - -XDEFINES += \ - $(EOLIST) - -XLFLAGS += \ - $(EOLIST) -endif - -ifeq "$(RELEASE)" "noopt" -XINCDIRS += \ - $(EOLIST) - -XCFLAGS += \ - $(EOLIST) - -XDEFINES += \ - $(EOLIST) - -XLFLAGS += \ - $(EOLIST) -endif - -ifeq "$(RELEASE)" "release" -XINCDIRS += \ - $(EOLIST) - -XCFLAGS += \ - $(EOLIST) - -XDEFINES += \ - $(EOLIST) - -XLFLAGS += \ - $(EOLIST) -endif - -# -# These are used by the link target if an NLM is being generated -# This is used by the link 'name' directive to name the nlm. If left blank -# TARGET_nlm (see below) will be used. -# -NLM_NAME = headers - -# -# This is used by the link '-desc ' directive. -# If left blank, NLM_NAME will be used. -# -NLM_DESCRIPTION = Headers Module - -# -# This is used by the '-threadname' directive. If left blank, -# NLM_NAME Thread will be used. -# -NLM_THREAD_NAME = Headers Module - -# -# If this is specified, it will override VERSION value in -# $(AP_WORK)\build\NWGNUenvironment.inc -# -NLM_VERSION = - -# -# If this is specified, it will override the default of 64K -# -NLM_STACK_SIZE = 8192 - - -# -# If this is specified it will be used by the link '-entry' directive -# -NLM_ENTRY_SYM = _LibCPrelude - -# -# If this is specified it will be used by the link '-exit' directive -# -NLM_EXIT_SYM = _LibCPostlude - -# -# If this is specified it will be used by the link '-check' directive -# -NLM_CHECK_SYM = - -# -# If these are specified it will be used by the link '-flags' directive -# -NLM_FLAGS = AUTOUNLOAD, PSEUDOPREEMPTION - -# -# If this is specified it will be linked in with the XDCData option in the def -# file instead of the default of $(NWOS)/apache.xdc. XDCData can be disabled -# by setting APACHE_UNIPROC in the environment -# -XDCDATA = - -# -# If there is an NLM target, put it here -# -TARGET_nlm = \ - $(OBJDIR)/headers.nlm \ - $(EOLIST) - -# -# If there is an LIB target, put it here -# -TARGET_lib = \ - $(EOLIST) - -# -# These are the OBJ files needed to create the NLM target above. -# Paths must all use the '/' character -# -FILES_nlm_objs = \ - $(OBJDIR)/mod_headers.o \ - $(EOLIST) - -# -# These are the LIB files needed to create the NLM target above. -# These will be added as a library command in the link.opt file. -# -FILES_nlm_libs = \ - libcpre.o \ - $(EOLIST) - -# -# These are the modules that the above NLM target depends on to load. -# These will be added as a module command in the link.opt file. -# -FILES_nlm_modules = \ - aprlib \ - libc \ - $(EOLIST) - -# -# If the nlm has a msg file, put it's path here -# -FILE_nlm_msg = - -# -# If the nlm has a hlp file put it's path here -# -FILE_nlm_hlp = - -# -# If this is specified, it will override $(NWOS)\copyright.txt. -# -FILE_nlm_copyright = - -# -# Any additional imports go here -# -FILES_nlm_Ximports = \ - @$(APR)/aprlib.imp \ - @$(NWOS)/httpd.imp \ - @libc.imp \ - $(EOLIST) - -# -# Any symbols exported to here -# -FILES_nlm_exports = \ - headers_module \ - $(EOLIST) - -# -# These are the OBJ files needed to create the LIB target above. -# Paths must all use the '/' character -# -FILES_lib_objs = \ - $(EOLIST) - -# -# implement targets and dependancies (leave this section alone) -# - -libs :: $(OBJDIR) $(TARGET_lib) - -nlms :: libs $(TARGET_nlm) - -# -# Updated this target to create necessary directories and copy files to the -# correct place. (See $(AP_WORK)\build\NWGNUhead.inc for examples) -# -install :: nlms FORCE - -# -# Any specialized rules here -# - -# -# Include the 'tail' makefile that has targets that depend on variables defined -# in this makefile -# - -include $(AP_WORK)\build\NWGNUtail.inc - diff --git a/modules/metadata/NWGNUmakefile b/modules/metadata/NWGNUmakefile deleted file mode 100644 index c23e762a0fc1749fbb4c21ac191a2bc546aa4546..0000000000000000000000000000000000000000 --- a/modules/metadata/NWGNUmakefile +++ /dev/null @@ -1,251 +0,0 @@ -# -# Declare the sub-directories to be built here -# - -SUBDIRS = \ - $(EOLIST) - -# -# Get the 'head' of the build environment. This includes default targets and -# paths to tools -# - -include $(AP_WORK)\build\NWGNUhead.inc - -# -# build this level's files - -# -# Make sure all needed macro's are defined -# - - -# -# These directories will be at the beginning of the include list, followed by -# INCDIRS -# -XINCDIRS += \ - $(EOLIST) - -# -# These flags will come after CFLAGS -# -XCFLAGS += \ - $(EOLIST) - -# -# These defines will come after DEFINES -# -XDEFINES += \ - $(EOLIST) - -# -# These flags will be added to the link.opt file -# -XLFLAGS += \ - $(EOLIST) - -# -# These values will be appended to the correct variables based on the value of -# RELEASE -# -ifeq "$(RELEASE)" "debug" -XINCDIRS += \ - $(EOLIST) - -XCFLAGS += \ - $(EOLIST) - -XDEFINES += \ - $(EOLIST) - -XLFLAGS += \ - $(EOLIST) -endif - -ifeq "$(RELEASE)" "noopt" -XINCDIRS += \ - $(EOLIST) - -XCFLAGS += \ - $(EOLIST) - -XDEFINES += \ - $(EOLIST) - -XLFLAGS += \ - $(EOLIST) -endif - -ifeq "$(RELEASE)" "release" -XINCDIRS += \ - $(EOLIST) - -XCFLAGS += \ - $(EOLIST) - -XDEFINES += \ - $(EOLIST) - -XLFLAGS += \ - $(EOLIST) -endif - -# -# These are used by the link target if an NLM is being generated -# This is used by the link 'name' directive to name the nlm. If left blank -# TARGET_nlm (see below) will be used. -# -NLM_NAME = - -# -# This is used by the link '-desc ' directive. -# If left blank, NLM_NAME will be used. -# -NLM_DESCRIPTION = - -# -# This is used by the '-threadname' directive. If left blank, -# NLM_NAME Thread will be used. -# -NLM_THREAD_NAME = - -# -# If this is specified, it will override VERSION value in -# $(AP_WORK)\build\NWGNUenvironment.inc -# -NLM_VERSION = - -# -# If this is specified, it will override the default of 64K -# -NLM_STACK_SIZE = - - -# -# If this is specified it will be used by the link '-entry' directive -# -NLM_ENTRY_SYM = - -# -# If this is specified it will be used by the link '-exit' directive -# -NLM_EXIT_SYM = - -# -# If this is specified it will be used by the link '-check' directive -# -NLM_CHECK_SYM = - -# -# If these are specified it will be used by the link '-flags' directive -# -NLM_FLAGS = - -# -# If this is specified it will be linked in with the XDCData option in the def -# file instead of the default of $(NWOS)/apache.xdc. XDCData can be disabled -# by setting APACHE_UNIPROC in the environment -# -XDCDATA = - -# -# If there is an NLM target, put it here -# -TARGET_nlm = \ - $(OBJDIR)/cernmeta.nlm \ - $(OBJDIR)/expires.nlm \ - $(OBJDIR)/headers.nlm \ - $(OBJDIR)/mimemagi.nlm \ - $(OBJDIR)/uniqueid.nlm \ - $(OBJDIR)/usertrk.nlm \ - $(EOLIST) - -# -# If there is an LIB target, put it here -# -TARGET_lib = \ - $(EOLIST) - -# -# These are the OBJ files needed to create the NLM target above. -# Paths must all use the '/' character -# -FILES_nlm_objs = \ - $(EOLIST) - -# -# These are the LIB files needed to create the NLM target above. -# These will be added as a library command in the link.opt file. -# -FILES_nlm_libs = \ - $(EOLIST) - -# -# These are the modules that the above NLM target depends on to load. -# These will be added as a module command in the link.opt file. -# -FILES_nlm_modules = \ - $(EOLIST) - -# -# If the nlm has a msg file, put it's path here -# -FILE_nlm_msg = - -# -# If the nlm has a hlp file put it's path here -# -FILE_nlm_hlp = - -# -# If this is specified, it will override $(NWOS)\copyright.txt. -# -FILE_nlm_copyright = - -# -# Any additional imports go here -# -FILES_nlm_Ximports = \ - $(EOLIST) - -# -# Any symbols exported to here -# -FILES_nlm_exports = \ - $(EOLIST) - -# -# These are the OBJ files needed to create the LIB target above. -# Paths must all use the '/' character -# -FILES_lib_objs = \ - $(EOLIST) - -# -# implement targets and dependancies (leave this section alone) -# - -libs :: $(OBJDIR) $(TARGET_lib) - -nlms :: libs $(TARGET_nlm) - -# -# Updated this target to create necessary directories and copy files to the -# correct place. (See $(AP_WORK)\build\NWGNUhead.inc for examples) -# -install :: nlms FORCE - copy $(OBJDIR)\*.nlm $(INSTALL)\Apache2\modules\*.* - -# -# Any specialized rules here -# - -# -# Include the 'tail' makefile that has targets that depend on variables defined -# in this makefile -# - -include $(AP_WORK)\build\NWGNUtail.inc - - diff --git a/modules/metadata/NWGNUmimemagi b/modules/metadata/NWGNUmimemagi deleted file mode 100644 index 8a989e323b438a199dca0628c4df3b2da19d1e64..0000000000000000000000000000000000000000 --- a/modules/metadata/NWGNUmimemagi +++ /dev/null @@ -1,250 +0,0 @@ -# -# Make sure all needed macro's are defined -# - -# -# Get the 'head' of the build environment if necessary. This includes default -# targets and paths to tools -# - -ifndef EnvironmentDefined -include $(AP_WORK)\build\NWGNUhead.inc -endif - -# -# These directories will be at the beginning of the include list, followed by -# INCDIRS -# -XINCDIRS += \ - $(AP_WORK)/include \ - $(NWOS) \ - $(AP_WORK)/modules/arch/netware \ - $(AP_WORK)/srclib/apr/include \ - $(AP_WORK)/srclib/apr-util/include \ - $(AP_WORK)/srclib/apr \ - $(EOLIST) - -# -# These flags will come after CFLAGS -# -XCFLAGS += \ - -prefix pre_nw.h \ - $(EOLIST) - -# -# These defines will come after DEFINES -# -XDEFINES += \ - $(EOLIST) - -# -# These flags will be added to the link.opt file -# -XLFLAGS += \ - $(EOLIST) - -# -# These values will be appended to the correct variables based on the value of -# RELEASE -# -ifeq "$(RELEASE)" "debug" -XINCDIRS += \ - $(EOLIST) - -XCFLAGS += \ - $(EOLIST) - -XDEFINES += \ - $(EOLIST) - -XLFLAGS += \ - $(EOLIST) -endif - -ifeq "$(RELEASE)" "noopt" -XINCDIRS += \ - $(EOLIST) - -XCFLAGS += \ - $(EOLIST) - -XDEFINES += \ - $(EOLIST) - -XLFLAGS += \ - $(EOLIST) -endif - -ifeq "$(RELEASE)" "release" -XINCDIRS += \ - $(EOLIST) - -XCFLAGS += \ - $(EOLIST) - -XDEFINES += \ - $(EOLIST) - -XLFLAGS += \ - $(EOLIST) -endif - -# -# These are used by the link target if an NLM is being generated -# This is used by the link 'name' directive to name the nlm. If left blank -# TARGET_nlm (see below) will be used. -# -NLM_NAME = mimemagi - -# -# This is used by the link '-desc ' directive. -# If left blank, NLM_NAME will be used. -# -NLM_DESCRIPTION = CERN Meta Module - -# -# This is used by the '-threadname' directive. If left blank, -# NLM_NAME Thread will be used. -# -NLM_THREAD_NAME = CERN Meta Module - -# -# If this is specified, it will override VERSION value in -# $(AP_WORK)\build\NWGNUenvironment.inc -# -NLM_VERSION = - -# -# If this is specified, it will override the default of 64K -# -NLM_STACK_SIZE = 8192 - - -# -# If this is specified it will be used by the link '-entry' directive -# -NLM_ENTRY_SYM = _LibCPrelude - -# -# If this is specified it will be used by the link '-exit' directive -# -NLM_EXIT_SYM = _LibCPostlude - -# -# If this is specified it will be used by the link '-check' directive -# -NLM_CHECK_SYM = - -# -# If these are specified it will be used by the link '-flags' directive -# -NLM_FLAGS = AUTOUNLOAD, PSEUDOPREEMPTION - -# -# If this is specified it will be linked in with the XDCData option in the def -# file instead of the default of $(NWOS)/apache.xdc. XDCData can be disabled -# by setting APACHE_UNIPROC in the environment -# -XDCDATA = - -# -# If there is an NLM target, put it here -# -TARGET_nlm = \ - $(OBJDIR)/mimemagi.nlm \ - $(EOLIST) - -# -# If there is an LIB target, put it here -# -TARGET_lib = \ - $(EOLIST) - -# -# These are the OBJ files needed to create the NLM target above. -# Paths must all use the '/' character -# -FILES_nlm_objs = \ - $(OBJDIR)/mod_mime_magic.o \ - $(EOLIST) - -# -# These are the LIB files needed to create the NLM target above. -# These will be added as a library command in the link.opt file. -# -FILES_nlm_libs = \ - libcpre.o \ - $(EOLIST) - -# -# These are the modules that the above NLM target depends on to load. -# These will be added as a module command in the link.opt file. -# -FILES_nlm_modules = \ - aprlib \ - libc \ - $(EOLIST) - -# -# If the nlm has a msg file, put it's path here -# -FILE_nlm_msg = - -# -# If the nlm has a hlp file put it's path here -# -FILE_nlm_hlp = - -# -# If this is specified, it will override $(NWOS)\copyright.txt. -# -FILE_nlm_copyright = - -# -# Any additional imports go here -# -FILES_nlm_Ximports = \ - @$(APR)/aprlib.imp \ - @$(NWOS)/httpd.imp \ - @libc.imp \ - $(EOLIST) - -# -# Any symbols exported to here -# -FILES_nlm_exports = \ - mime_magic_module \ - $(EOLIST) - -# -# These are the OBJ files needed to create the LIB target above. -# Paths must all use the '/' character -# -FILES_lib_objs = \ - $(EOLIST) - -# -# implement targets and dependancies (leave this section alone) -# - -libs :: $(OBJDIR) $(TARGET_lib) - -nlms :: libs $(TARGET_nlm) - -# -# Updated this target to create necessary directories and copy files to the -# correct place. (See $(AP_WORK)\build\NWGNUhead.inc for examples) -# -install :: nlms FORCE - -# -# Any specialized rules here -# - -# -# Include the 'tail' makefile that has targets that depend on variables defined -# in this makefile -# - -include $(AP_WORK)\build\NWGNUtail.inc - diff --git a/modules/metadata/NWGNUuniqueid b/modules/metadata/NWGNUuniqueid deleted file mode 100644 index c7dace40df88775f2cccd9dcd8f12f641bb4b714..0000000000000000000000000000000000000000 --- a/modules/metadata/NWGNUuniqueid +++ /dev/null @@ -1,256 +0,0 @@ -# -# Make sure all needed macro's are defined -# - -# -# Get the 'head' of the build environment if necessary. This includes default -# targets and paths to tools -# - -ifndef EnvironmentDefined -include $(AP_WORK)\build\NWGNUhead.inc -endif - -# -# These directories will be at the beginning of the include list, followed by -# INCDIRS -# -XINCDIRS += \ - $(AP_WORK)/include \ - $(NWOS) \ - $(AP_WORK)/modules/arch/netware \ - $(AP_WORK)/srclib/apr/include \ - $(AP_WORK)/srclib/apr-util/include \ - $(AP_WORK)/srclib/apr \ - $(EOLIST) - -# -# These flags will come after CFLAGS -# -XCFLAGS += \ - -prefix pre_nw.h \ - $(EOLIST) - -# -# These defines will come after DEFINES -# -XDEFINES += \ - $(EOLIST) - -# -# These flags will be added to the link.opt file -# -XLFLAGS += \ - $(EOLIST) - -# -# These values will be appended to the correct variables based on the value of -# RELEASE -# -ifeq "$(RELEASE)" "debug" -XINCDIRS += \ - $(EOLIST) - -XCFLAGS += \ - $(EOLIST) - -XDEFINES += \ - $(EOLIST) - -XLFLAGS += \ - $(EOLIST) -endif - -ifeq "$(RELEASE)" "noopt" -XINCDIRS += \ - $(EOLIST) - -XCFLAGS += \ - $(EOLIST) - -XDEFINES += \ - $(EOLIST) - -XLFLAGS += \ - $(EOLIST) -endif - -ifeq "$(RELEASE)" "release" -XINCDIRS += \ - $(EOLIST) - -XCFLAGS += \ - $(EOLIST) - -XDEFINES += \ - $(EOLIST) - -XLFLAGS += \ - $(EOLIST) -endif - -# -# These are used by the link target if an NLM is being generated -# This is used by the link 'name' directive to name the nlm. If left blank -# TARGET_nlm (see below) will be used. -# -NLM_NAME = uniqueid - -# -# This is used by the link '-desc ' directive. -# If left blank, NLM_NAME will be used. -# -NLM_DESCRIPTION = Unique ID Module - -# -# This is used by the '-threadname' directive. If left blank, -# NLM_NAME Thread will be used. -# -NLM_THREAD_NAME = Unique ID Module - -# -# If this is specified, it will override VERSION value in -# $(AP_WORK)\build\NWGNUenvironment.inc -# -NLM_VERSION = - -# -# If this is specified, it will override the default of 64K -# -NLM_STACK_SIZE = 8192 - - -# -# If this is specified it will be used by the link '-entry' directive -# -NLM_ENTRY_SYM = _LibCPrelude - -# -# If this is specified it will be used by the link '-exit' directive -# -NLM_EXIT_SYM = _LibCPostlude - -# -# If this is specified it will be used by the link '-check' directive -# -NLM_CHECK_SYM = - -# -# If these are specified it will be used by the link '-flags' directive -# -NLM_FLAGS = AUTOUNLOAD, PSEUDOPREEMPTION - -# -# If this is specified it will be linked in with the XDCData option in the def -# file instead of the default of $(NWOS)/apache.xdc. XDCData can be disabled -# by setting APACHE_UNIPROC in the environment -# -XDCDATA = - -# -# If there is an NLM target, put it here -# -TARGET_nlm = \ - $(OBJDIR)/uniqueid.nlm \ - $(EOLIST) - -# -# If there is an LIB target, put it here -# -TARGET_lib = \ - $(EOLIST) - -# -# These are the OBJ files needed to create the NLM target above. -# Paths must all use the '/' character -# -FILES_nlm_objs = \ - $(OBJDIR)/mod_unique_id.o \ - $(OBJDIR)/libprews.o \ - $(EOLIST) - -# -# These are the LIB files needed to create the NLM target above. -# These will be added as a library command in the link.opt file. -# -FILES_nlm_libs = \ - libcpre.o \ - $(EOLIST) - -# -# These are the modules that the above NLM target depends on to load. -# These will be added as a module command in the link.opt file. -# -FILES_nlm_modules = \ - aprlib \ - libc \ - $(EOLIST) - -# -# If the nlm has a msg file, put it's path here -# -FILE_nlm_msg = - -# -# If the nlm has a hlp file put it's path here -# -FILE_nlm_hlp = - -# -# If this is specified, it will override $(NWOS)\copyright.txt. -# -FILE_nlm_copyright = - -# -# Any additional imports go here -# -FILES_nlm_Ximports = \ - @$(APR)/aprlib.imp \ - @$(NWOS)/httpd.imp \ - @libc.imp \ - @ws2nlm.imp \ - $(EOLIST) - -# -# Any symbols exported to here -# -FILES_nlm_exports = \ - unique_id_module \ - $(EOLIST) - -# -# These are the OBJ files needed to create the LIB target above. -# Paths must all use the '/' character -# -FILES_lib_objs = \ - $(EOLIST) - -# -# implement targets and dependancies (leave this section alone) -# - -libs :: $(OBJDIR) $(TARGET_lib) - -nlms :: libs $(TARGET_nlm) - -# -# Updated this target to create necessary directories and copy files to the -# correct place. (See $(AP_WORK)\build\NWGNUhead.inc for examples) -# -install :: nlms FORCE - -# -# Any specialized rules here -# - -$(OBJDIR)/%.o: ../arch/netware/%.c $(OBJDIR)\cc.opt - @echo compiling $< - $(CC) $< -o=$(OBJDIR)\$(@F) @$(OBJDIR)\cc.opt - -# -# Include the 'tail' makefile that has targets that depend on variables defined -# in this makefile -# - -include $(AP_WORK)\build\NWGNUtail.inc - diff --git a/modules/metadata/NWGNUusertrk b/modules/metadata/NWGNUusertrk deleted file mode 100644 index 44bcb48a8a399c91180f0d40f0e6f0700bd293a5..0000000000000000000000000000000000000000 --- a/modules/metadata/NWGNUusertrk +++ /dev/null @@ -1,250 +0,0 @@ -# -# Make sure all needed macro's are defined -# - -# -# Get the 'head' of the build environment if necessary. This includes default -# targets and paths to tools -# - -ifndef EnvironmentDefined -include $(AP_WORK)\build\NWGNUhead.inc -endif - -# -# These directories will be at the beginning of the include list, followed by -# INCDIRS -# -XINCDIRS += \ - $(AP_WORK)/include \ - $(NWOS) \ - $(AP_WORK)/modules/arch/netware \ - $(AP_WORK)/srclib/apr/include \ - $(AP_WORK)/srclib/apr-util/include \ - $(AP_WORK)/srclib/apr \ - $(EOLIST) - -# -# These flags will come after CFLAGS -# -XCFLAGS += \ - -prefix pre_nw.h \ - $(EOLIST) - -# -# These defines will come after DEFINES -# -XDEFINES += \ - $(EOLIST) - -# -# These flags will be added to the link.opt file -# -XLFLAGS += \ - $(EOLIST) - -# -# These values will be appended to the correct variables based on the value of -# RELEASE -# -ifeq "$(RELEASE)" "debug" -XINCDIRS += \ - $(EOLIST) - -XCFLAGS += \ - $(EOLIST) - -XDEFINES += \ - $(EOLIST) - -XLFLAGS += \ - $(EOLIST) -endif - -ifeq "$(RELEASE)" "noopt" -XINCDIRS += \ - $(EOLIST) - -XCFLAGS += \ - $(EOLIST) - -XDEFINES += \ - $(EOLIST) - -XLFLAGS += \ - $(EOLIST) -endif - -ifeq "$(RELEASE)" "release" -XINCDIRS += \ - $(EOLIST) - -XCFLAGS += \ - $(EOLIST) - -XDEFINES += \ - $(EOLIST) - -XLFLAGS += \ - $(EOLIST) -endif - -# -# These are used by the link target if an NLM is being generated -# This is used by the link 'name' directive to name the nlm. If left blank -# TARGET_nlm (see below) will be used. -# -NLM_NAME = usertrk - -# -# This is used by the link '-desc ' directive. -# If left blank, NLM_NAME will be used. -# -NLM_DESCRIPTION = User Track Module - -# -# This is used by the '-threadname' directive. If left blank, -# NLM_NAME Thread will be used. -# -NLM_THREAD_NAME = User Track Module - -# -# If this is specified, it will override VERSION value in -# $(AP_WORK)\build\NWGNUenvironment.inc -# -NLM_VERSION = - -# -# If this is specified, it will override the default of 64K -# -NLM_STACK_SIZE = 8192 - - -# -# If this is specified it will be used by the link '-entry' directive -# -NLM_ENTRY_SYM = _LibCPrelude - -# -# If this is specified it will be used by the link '-exit' directive -# -NLM_EXIT_SYM = _LibCPostlude - -# -# If this is specified it will be used by the link '-check' directive -# -NLM_CHECK_SYM = - -# -# If these are specified it will be used by the link '-flags' directive -# -NLM_FLAGS = AUTOUNLOAD, PSEUDOPREEMPTION - -# -# If this is specified it will be linked in with the XDCData option in the def -# file instead of the default of $(NWOS)/apache.xdc. XDCData can be disabled -# by setting APACHE_UNIPROC in the environment -# -XDCDATA = - -# -# If there is an NLM target, put it here -# -TARGET_nlm = \ - $(OBJDIR)/usertrk.nlm \ - $(EOLIST) - -# -# If there is an LIB target, put it here -# -TARGET_lib = \ - $(EOLIST) - -# -# These are the OBJ files needed to create the NLM target above. -# Paths must all use the '/' character -# -FILES_nlm_objs = \ - $(OBJDIR)/mod_usertrack.o \ - $(EOLIST) - -# -# These are the LIB files needed to create the NLM target above. -# These will be added as a library command in the link.opt file. -# -FILES_nlm_libs = \ - libcpre.o \ - $(EOLIST) - -# -# These are the modules that the above NLM target depends on to load. -# These will be added as a module command in the link.opt file. -# -FILES_nlm_modules = \ - aprlib \ - libc \ - $(EOLIST) - -# -# If the nlm has a msg file, put it's path here -# -FILE_nlm_msg = - -# -# If the nlm has a hlp file put it's path here -# -FILE_nlm_hlp = - -# -# If this is specified, it will override $(NWOS)\copyright.txt. -# -FILE_nlm_copyright = - -# -# Any additional imports go here -# -FILES_nlm_Ximports = \ - @$(APR)/aprlib.imp \ - @$(NWOS)/httpd.imp \ - @libc.imp \ - $(EOLIST) - -# -# Any symbols exported to here -# -FILES_nlm_exports = \ - usertrack_module \ - $(EOLIST) - -# -# These are the OBJ files needed to create the LIB target above. -# Paths must all use the '/' character -# -FILES_lib_objs = \ - $(EOLIST) - -# -# implement targets and dependancies (leave this section alone) -# - -libs :: $(OBJDIR) $(TARGET_lib) - -nlms :: libs $(TARGET_nlm) - -# -# Updated this target to create necessary directories and copy files to the -# correct place. (See $(AP_WORK)\build\NWGNUhead.inc for examples) -# -install :: nlms FORCE - -# -# Any specialized rules here -# - -# -# Include the 'tail' makefile that has targets that depend on variables defined -# in this makefile -# - -include $(AP_WORK)\build\NWGNUtail.inc - diff --git a/modules/metadata/config.m4 b/modules/metadata/config.m4 deleted file mode 100644 index 4e33d75e2e0b8ffd1ef0ae8c2585ea1091a61a5a..0000000000000000000000000000000000000000 --- a/modules/metadata/config.m4 +++ /dev/null @@ -1,30 +0,0 @@ -dnl modules enabled in this directory by default - -dnl AC_DEFUN(modulename, modulestructname, defaultonoroff, configmacros) -dnl XXX - Need to allow --enable-module to fail if optional config fails - -AC_DEFUN(APACHE_CHECK_METADATA_MODULE, [ - APACHE_MODULE([$1],[$2],,[$3],[$4],[$5]) -]) - -APACHE_MODPATH_INIT(metadata) - -APACHE_CHECK_METADATA_MODULE(env, clearing/setting of ENV vars, , yes) -APACHE_CHECK_METADATA_MODULE(mime_magic, automagically determining MIME type, , no) -APACHE_CHECK_METADATA_MODULE(cern_meta, CERN-type meta files, , no) -APACHE_CHECK_METADATA_MODULE(expires, Expires header control, , no) -APACHE_CHECK_METADATA_MODULE(headers, HTTP header control, , no) - -APACHE_CHECK_METADATA_MODULE(usertrack, user-session tracking, , no, [ - AC_CHECK_HEADERS(sys/times.h) - AC_CHECK_FUNCS(times) -]) - -APACHE_CHECK_METADATA_MODULE(unique_id, per-request unique ids, , no) -APACHE_CHECK_METADATA_MODULE(setenvif, basing ENV vars on headers, , yes) - -LTFLAGS="$LTFLAGS -export-dynamic" - -APACHE_MODPATH_FINISH - -APACHE_SUBST(STANDARD_LIBS) diff --git a/modules/metadata/mod_cern_meta.c b/modules/metadata/mod_cern_meta.c deleted file mode 100644 index dbc1de6cabb3e99d7a97290867e6d510e6c90255..0000000000000000000000000000000000000000 --- a/modules/metadata/mod_cern_meta.c +++ /dev/null @@ -1,395 +0,0 @@ -/* ==================================================================== - * Copyright (c) 1995-1999 The Apache Group. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in - * the documentation and/or other materials provided with the - * distribution. - * - * 3. All advertising materials mentioning features or use of this - * software must display the following acknowledgment: - * "This product includes software developed by the Apache Group - * for use in the Apache HTTP server project (http://www.apache.org/)." - * - * 4. The names "Apache Server" and "Apache Group" must not be used to - * endorse or promote products derived from this software without - * prior written permission. For written permission, please contact - * apache@apache.org. - * - * 5. Products derived from this software may not be called "Apache" - * nor may "Apache" appear in their names without prior written - * permission of the Apache Group. - * - * 6. Redistributions of any form whatsoever must retain the following - * acknowledgment: - * "This product includes software developed by the Apache Group - * for use in the Apache HTTP server project (http://www.apache.org/)." - * - * THIS SOFTWARE IS PROVIDED BY THE APACHE GROUP ``AS IS'' AND ANY - * EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR - * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE APACHE GROUP OR - * IT'S CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT - * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, - * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED - * OF THE POSSIBILITY OF SUCH DAMAGE. - * ==================================================================== - * - * This software consists of voluntary contributions made by many - * individuals on behalf of the Apache Group and was originally based - * on public domain software written at the National Center for - * Supercomputing Applications, University of Illinois, Urbana-Champaign. - * For more information on the Apache Group and the Apache HTTP server - * project, please see . - * - */ - -/* - * mod_cern_meta.c - * version 0.1.0 - * status beta - * - * Andrew Wilson 25.Jan.96 - * - * *** IMPORTANT *** - * This version of mod_cern_meta.c controls Meta File behaviour on a - * per-directory basis. Previous versions of the module defined behaviour - * on a per-server basis. The upshot is that you'll need to revisit your - * configuration files in order to make use of the new module. - * *** - * - * Emulate the CERN HTTPD Meta file semantics. Meta files are HTTP - * headers that can be output in addition to the normal range of - * headers for each file accessed. They appear rather like the Apache - * .asis files, and are able to provide a crude way of influencing - * the Expires: header, as well as providing other curiosities. - * There are many ways to manage meta information, this one was - * chosen because there is already a large number of CERN users - * who can exploit this module. It should be noted that there are probably - * more sensitive ways of managing the Expires: header specifically. - * - * The module obeys the following directives, which can appear - * in the server's .conf files and in .htaccess files. - * - * MetaFiles - * - * turns on|off meta file processing for any directory. - * Default value is off - * - * # turn on MetaFiles in this directory - * MetaFiles on - * - * MetaDir - * - * specifies the name of the directory in which Apache can find - * meta information files. The directory is usually a 'hidden' - * subdirectory of the directory that contains the file being - * accessed. eg: - * - * # .meta files are in the *same* directory as the - * # file being accessed - * MetaDir . - * - * the default is to look in a '.web' subdirectory. This is the - * same as for CERN 3.+ webservers and behaviour is the same as - * for the directive: - * - * MetaDir .web - * - * MetaSuffix - * - * specifies the file name suffix for the file containing the - * meta information. eg: - * - * # our meta files are suffixed with '.cern_meta' - * MetaSuffix .cern_meta - * - * the default is to look for files with the suffix '.meta'. This - * behaviour is the same as for the directive: - * - * MetaSuffix .meta - * - * When accessing the file - * - * DOCUMENT_ROOT/somedir/index.html - * - * this module will look for the file - * - * DOCUMENT_ROOT/somedir/.web/index.html.meta - * - * and will use its contents to generate additional MIME header - * information. - * - * For more information on the CERN Meta file semantics see: - * - * http://www.w3.org/hypertext/WWW/Daemon/User/Config/General.html#MetaDir - * - * Change-log: - * 29.Jan.96 pfopen/pfclose instead of fopen/fclose - * DECLINE when real file not found, we may be checking each - * of the index.html/index.shtml/index.htm variants and don't - * need to report missing ones as spurious errors. - * 31.Jan.96 log_error reports about a malformed .meta file, rather - * than a script error. - * 20.Jun.96 MetaFiles default off, added, so that module - * can be configured per-directory. Prior to this the module - * was running for each request anywhere on the server, naughty.. - * 29.Jun.96 All directives made per-directory. - */ - -#include "httpd.h" -#include "http_config.h" -#include -#include -#include "util_script.h" -#include "http_log.h" -#include "http_request.h" - -#define DIR_CMD_PERMS OR_INDEXES - -#define DEFAULT_METADIR ".web" -#define DEFAULT_METASUFFIX ".meta" -#define DEFAULT_METAFILES 0 - -module MODULE_VAR_EXPORT cern_meta_module; - -typedef struct { - char *metadir; - char *metasuffix; - char *metafiles; -} cern_meta_dir_config; - -static void *create_cern_meta_dir_config(pool *p, char *dummy) -{ - cern_meta_dir_config *new = - (cern_meta_dir_config *) ap_palloc(p, sizeof(cern_meta_dir_config)); - - new->metadir = NULL; - new->metasuffix = NULL; - new->metafiles = DEFAULT_METAFILES; - - return new; -} - -static void *merge_cern_meta_dir_configs(pool *p, void *basev, void *addv) -{ - cern_meta_dir_config *base = (cern_meta_dir_config *) basev; - cern_meta_dir_config *add = (cern_meta_dir_config *) addv; - cern_meta_dir_config *new = - (cern_meta_dir_config *) ap_palloc(p, sizeof(cern_meta_dir_config)); - - new->metadir = add->metadir ? add->metadir : base->metadir; - new->metasuffix = add->metasuffix ? add->metasuffix : base->metasuffix; - new->metafiles = add->metafiles; - - return new; -} - -static const char *set_metadir(cmd_parms *parms, cern_meta_dir_config * dconf, char *arg) -{ - dconf->metadir = arg; - return NULL; -} - -static const char *set_metasuffix(cmd_parms *parms, cern_meta_dir_config * dconf, char *arg) -{ - dconf->metasuffix = arg; - return NULL; -} - -static const char *set_metafiles(cmd_parms *parms, cern_meta_dir_config * dconf, char *arg) -{ - dconf->metafiles = arg; - return NULL; -} - - -static const command_rec cern_meta_cmds[] = -{ - {"MetaFiles", set_metafiles, NULL, DIR_CMD_PERMS, FLAG, - "Limited to 'on' or 'off'"}, - {"MetaDir", set_metadir, NULL, DIR_CMD_PERMS, TAKE1, - "the name of the directory containing meta files"}, - {"MetaSuffix", set_metasuffix, NULL, DIR_CMD_PERMS, TAKE1, - "the filename suffix for meta files"}, - {NULL} -}; - -/* XXX: this is very similar to ap_scan_script_header_err_core... - * are the differences deliberate, or just a result of bit rot? - */ -static int scan_meta_file(request_rec *r, FILE *f) -{ - char w[MAX_STRING_LEN]; - char *l; - int p; - table *tmp_headers; - - tmp_headers = ap_make_table(r->pool, 5); - while (fgets(w, MAX_STRING_LEN - 1, f) != NULL) { - - /* Delete terminal (CR?)LF */ - - p = strlen(w); - if (p > 0 && w[p - 1] == '\n') { - if (p > 1 && w[p - 2] == '\015') - w[p - 2] = '\0'; - else - w[p - 1] = '\0'; - } - - if (w[0] == '\0') { - return OK; - } - - /* if we see a bogus header don't ignore it. Shout and scream */ - - if (!(l = strchr(w, ':'))) { - ap_log_rerror(APLOG_MARK, APLOG_NOERRNO|APLOG_ERR, r, - "malformed header in meta file: %s", r->filename); - return SERVER_ERROR; - } - - *l++ = '\0'; - while (*l && ap_isspace(*l)) - ++l; - - if (!strcasecmp(w, "Content-type")) { - char *tmp; - /* Nuke trailing whitespace */ - - char *endp = l + strlen(l) - 1; - while (endp > l && ap_isspace(*endp)) - *endp-- = '\0'; - - tmp = ap_pstrdup(r->pool, l); - ap_content_type_tolower(tmp); - r->content_type = tmp; - } - else if (!strcasecmp(w, "Status")) { - sscanf(l, "%d", &r->status); - r->status_line = ap_pstrdup(r->pool, l); - } - else { - ap_table_set(tmp_headers, w, l); - } - } - ap_overlap_tables(r->headers_out, tmp_headers, AP_OVERLAP_TABLES_SET); - return OK; -} - -static int add_cern_meta_data(request_rec *r) -{ - char *metafilename; - char *last_slash; - char *real_file; - char *scrap_book; - FILE *f; - cern_meta_dir_config *dconf; - int rv; - request_rec *rr; - - dconf = ap_get_module_config(r->per_dir_config, &cern_meta_module); - - if (!dconf->metafiles) { - return DECLINED; - }; - - /* if ./.web/$1.meta exists then output 'asis' */ - - if (r->finfo.st_mode == 0) { - return DECLINED; - }; - - /* is this a directory? */ - if (S_ISDIR(r->finfo.st_mode) || r->uri[strlen(r->uri) - 1] == '/') { - return DECLINED; - }; - - /* what directory is this file in? */ - scrap_book = ap_pstrdup(r->pool, r->filename); - /* skip leading slash, recovered in later processing */ - scrap_book++; - last_slash = strrchr(scrap_book, '/'); - if (last_slash != NULL) { - /* skip over last slash */ - real_file = last_slash; - real_file++; - *last_slash = '\0'; - } - else { - /* no last slash, buh?! */ - ap_log_rerror(APLOG_MARK, APLOG_NOERRNO|APLOG_ERR, r, - "internal error in mod_cern_meta: %s", r->filename); - /* should really barf, but hey, let's be friends... */ - return DECLINED; - }; - - metafilename = ap_pstrcat(r->pool, "/", scrap_book, "/", - dconf->metadir ? dconf->metadir : DEFAULT_METADIR, - "/", real_file, - dconf->metasuffix ? dconf->metasuffix : DEFAULT_METASUFFIX, - NULL); - - /* XXX: it sucks to require this subrequest to complete, because this - * means people must leave their meta files accessible to the world. - * A better solution might be a "safe open" feature of pfopen to avoid - * pipes, symlinks, and crap like that. - */ - rr = ap_sub_req_lookup_file(metafilename, r); - if (rr->status != HTTP_OK) { - ap_destroy_sub_req(rr); - return DECLINED; - } - ap_destroy_sub_req(rr); - - f = ap_pfopen(r->pool, metafilename, "r"); - if (f == NULL) { - if (errno == ENOENT) { - return DECLINED; - } - ap_log_rerror(APLOG_MARK, APLOG_ERR, r, - "meta file permissions deny server access: %s", metafilename); - return FORBIDDEN; - }; - - /* read the headers in */ - rv = scan_meta_file(r, f); - ap_pfclose(r->pool, f); - - return rv; -} - -module MODULE_VAR_EXPORT cern_meta_module = -{ - STANDARD_MODULE_STUFF, - NULL, /* initializer */ - create_cern_meta_dir_config, /* dir config creater */ - merge_cern_meta_dir_configs, /* dir merger --- default is to override */ - NULL, /* server config */ - NULL, /* merge server configs */ - cern_meta_cmds, /* command table */ - NULL, /* handlers */ - NULL, /* filename translation */ - NULL, /* check_user_id */ - NULL, /* check auth */ - NULL, /* check access */ - NULL, /* type_checker */ - add_cern_meta_data, /* fixups */ - NULL, /* logger */ - NULL, /* header parser */ - NULL, /* child_init */ - NULL, /* child_exit */ - NULL /* post read-request */ -}; diff --git a/modules/metadata/mod_cern_meta.dsp b/modules/metadata/mod_cern_meta.dsp deleted file mode 100644 index 3564c0e2ef66fb569ee922dc0c842ccffa9f258e..0000000000000000000000000000000000000000 --- a/modules/metadata/mod_cern_meta.dsp +++ /dev/null @@ -1,113 +0,0 @@ -# Microsoft Developer Studio Project File - Name="ApacheModuleCERNMeta" - Package Owner=<4> -# Microsoft Developer Studio Generated Build File, Format Version 5.00 -# ** DO NOT EDIT ** - -# TARGTYPE "Win32 (x86) Dynamic-Link Library" 0x0102 - -CFG=ApacheModuleCERNMeta - Win32 Release -!MESSAGE This is not a valid makefile. To build this project using NMAKE, -!MESSAGE use the Export Makefile command and run -!MESSAGE -!MESSAGE NMAKE /f "ApacheModuleCERNMeta.mak". -!MESSAGE -!MESSAGE You can specify a configuration when running NMAKE -!MESSAGE by defining the macro CFG on the command line. For example: -!MESSAGE -!MESSAGE NMAKE /f "ApacheModuleCERNMeta.mak"\ - CFG="ApacheModuleCERNMeta - Win32 Release" -!MESSAGE -!MESSAGE Possible choices for configuration are: -!MESSAGE -!MESSAGE "ApacheModuleCERNMeta - Win32 Release" (based on\ - "Win32 (x86) Dynamic-Link Library") -!MESSAGE "ApacheModuleCERNMeta - Win32 Debug" (based on\ - "Win32 (x86) Dynamic-Link Library") -!MESSAGE - -# Begin Project -# PROP Scc_ProjName "" -# PROP Scc_LocalPath "" -CPP=cl.exe -MTL=midl.exe -RSC=rc.exe - -!IF "$(CFG)" == "ApacheModuleCERNMeta - Win32 Release" - -# PROP BASE Use_MFC 0 -# PROP BASE Use_Debug_Libraries 0 -# PROP BASE Output_Dir ".\Release" -# PROP BASE Intermediate_Dir ".\Release" -# PROP BASE Target_Dir "" -# PROP Use_MFC 0 -# PROP Use_Debug_Libraries 0 -# PROP Output_Dir ".\ApacheModuleCERNMetaR" -# PROP Intermediate_Dir ".\ApacheModuleCERNMetaR" -# PROP Ignore_Export_Lib 0 -# PROP Target_Dir "" -# ADD BASE CPP /nologo /MT /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /YX /c -# ADD CPP /nologo /MD /W3 /GX /O2 /I "..\..\include" /D "NDEBUG" /D "WIN32" /D "_WINDOWS" /D "SHARED_MODULE" /YX /FD /c -# ADD BASE MTL /nologo /D "NDEBUG" /win32 -# ADD MTL /nologo /D "NDEBUG" /mktyplib203 /win32 -# ADD BASE RSC /l 0x809 /d "NDEBUG" -# ADD RSC /l 0x809 /d "NDEBUG" -BSC32=bscmake.exe -# ADD BASE BSC32 /nologo -# ADD BSC32 /nologo -LINK32=link.exe -# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:windows /dll /machine:I386 -# ADD LINK32 ..\..\CoreR\ApacheCore.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib /nologo /subsystem:windows /dll /machine:I386 - -!ELSEIF "$(CFG)" == "ApacheModuleCERNMeta - Win32 Debug" - -# PROP BASE Use_MFC 0 -# PROP BASE Use_Debug_Libraries 1 -# PROP BASE Output_Dir ".\Debug" -# PROP BASE Intermediate_Dir ".\Debug" -# PROP BASE Target_Dir "" -# PROP Use_MFC 0 -# PROP Use_Debug_Libraries 1 -# PROP Output_Dir ".\ApacheModuleCERNMetaD" -# PROP Intermediate_Dir ".\ApacheModuleCERNMetaD" -# PROP Ignore_Export_Lib 0 -# PROP Target_Dir "" -# ADD BASE CPP /nologo /MTd /W3 /Gm /GX /Zi /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /YX /c -# ADD CPP /nologo /MDd /W3 /Gm /GX /Zi /Od /I "..\..\include" /D "_DEBUG" /D "WIN32" /D "_WINDOWS" /D "SHARED_MODULE" /YX /FD /c -# ADD BASE MTL /nologo /D "_DEBUG" /win32 -# ADD MTL /nologo /D "_DEBUG" /mktyplib203 /win32 -# ADD BASE RSC /l 0x809 /d "_DEBUG" -# ADD RSC /l 0x809 /d "_DEBUG" -BSC32=bscmake.exe -# ADD BASE BSC32 /nologo -# ADD BSC32 /nologo -LINK32=link.exe -# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:windows /dll /debug /machine:I386 -# ADD LINK32 ..\..\CoreD\ApacheCore.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib /nologo /subsystem:windows /dll /debug /machine:I386 - -!ENDIF - -# Begin Target - -# Name "ApacheModuleCERNMeta - Win32 Release" -# Name "ApacheModuleCERNMeta - Win32 Debug" -# Begin Group "Source Files" - -# PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;hpj;bat;for;f90" -# Begin Source File - -SOURCE=..\..\modules\standard\mod_cern_meta.c -# End Source File -# End Group -# Begin Group "Header Files" - -# PROP Default_Filter "h;hpp;hxx;hm;inl;fi;fd" -# Begin Source File - -SOURCE=.\readdir.h -# End Source File -# End Group -# Begin Group "Resource Files" - -# PROP Default_Filter "ico;cur;bmp;dlg;rc2;rct;bin;cnt;rtf;gif;jpg;jpeg;jpe" -# End Group -# End Target -# End Project diff --git a/modules/metadata/mod_cern_meta.exp b/modules/metadata/mod_cern_meta.exp deleted file mode 100644 index d36e2be6a8597e8d1f2d93a32646c1fc6b19a6e4..0000000000000000000000000000000000000000 --- a/modules/metadata/mod_cern_meta.exp +++ /dev/null @@ -1 +0,0 @@ -cern_meta_module diff --git a/modules/metadata/mod_env.c b/modules/metadata/mod_env.c deleted file mode 100644 index 351a48712b0f9b4b12c607ff9004878260a9340a..0000000000000000000000000000000000000000 --- a/modules/metadata/mod_env.c +++ /dev/null @@ -1,270 +0,0 @@ -/* ==================================================================== - * Copyright (c) 1995-1999 The Apache Group. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in - * the documentation and/or other materials provided with the - * distribution. - * - * 3. All advertising materials mentioning features or use of this - * software must display the following acknowledgment: - * "This product includes software developed by the Apache Group - * for use in the Apache HTTP server project (http://www.apache.org/)." - * - * 4. The names "Apache Server" and "Apache Group" must not be used to - * endorse or promote products derived from this software without - * prior written permission. For written permission, please contact - * apache@apache.org. - * - * 5. Products derived from this software may not be called "Apache" - * nor may "Apache" appear in their names without prior written - * permission of the Apache Group. - * - * 6. Redistributions of any form whatsoever must retain the following - * acknowledgment: - * "This product includes software developed by the Apache Group - * for use in the Apache HTTP server project (http://www.apache.org/)." - * - * THIS SOFTWARE IS PROVIDED BY THE APACHE GROUP ``AS IS'' AND ANY - * EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR - * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE APACHE GROUP OR - * IT'S CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT - * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, - * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED - * OF THE POSSIBILITY OF SUCH DAMAGE. - * ==================================================================== - * - * This software consists of voluntary contributions made by many - * individuals on behalf of the Apache Group and was originally based - * on public domain software written at the National Center for - * Supercomputing Applications, University of Illinois, Urbana-Champaign. - * For more information on the Apache Group and the Apache HTTP server - * project, please see . - * - */ - -/* - * mod_env.c - * version 0.0.5 - * status beta - * Pass environment variables to CGI/SSI scripts. - * - * Andrew Wilson 06.Dec.95 - * - * Change log: - * 08.Dec.95 Now allows PassEnv directive to appear more than once in - * conf files. - * 10.Dec.95 optimisation. getenv() only called at startup and used - * to build a fast-to-access table. table used to build - * per-server environment for each request. - * robustness. better able to handle errors in configuration - * files: - * 1) PassEnv directive present, but no environment variable listed - * 2) PassEnv FOO present, but $FOO not present in environment - * 3) no PassEnv directive present - * 23.Dec.95 Now allows SetEnv directive with same semantics as 'sh' setenv: - * SetEnv Var sets Var to the empty string - * SetEnv Var Val sets Var to the value Val - * Values containing whitespace should be quoted, eg: - * SetEnv Var "this is some text" - * Environment variables take their value from the last instance - * of PassEnv / SetEnv to be reached in the configuration file. - * For example, the sequence: - * PassEnv FOO - * SetEnv FOO override - * Causes FOO to take the value 'override'. - * 23.Feb.96 Added UnsetEnv directive to allow environment variables - * to be removed. - * Virtual hosts now 'inherit' parent server environment which - * they're able to overwrite with their own directives or - * selectively ignore with UnsetEnv. - * *** IMPORTANT - the way that virtual hosts inherit their *** - * *** environment variables from the default server's *** - * *** configuration has changed. You should test your *** - * *** configuration carefully before accepting this *** - * *** version of the module in a live webserver which used *** - * *** older versions of the module. *** - */ - -#include "httpd.h" -#include "http_config.h" - -typedef struct { - table *vars; - char *unsetenv; - int vars_present; -} env_dir_config_rec; - -module MODULE_VAR_EXPORT env_module; - -static void *create_env_dir_config(pool *p, char *dummy) -{ - env_dir_config_rec *new = - (env_dir_config_rec *) ap_palloc(p, sizeof(env_dir_config_rec)); - new->vars = ap_make_table(p, 50); - new->unsetenv = ""; - new->vars_present = 0; - return (void *) new; -} - -static void *merge_env_dir_configs(pool *p, void *basev, void *addv) -{ - env_dir_config_rec *base = (env_dir_config_rec *) basev; - env_dir_config_rec *add = (env_dir_config_rec *) addv; - env_dir_config_rec *new = - (env_dir_config_rec *) ap_palloc(p, sizeof(env_dir_config_rec)); - - table *new_table; - table_entry *elts; - array_header *arr; - - int i; - const char *uenv, *unset; - - /* - * new_table = copy_table( p, base->vars ); - * foreach $element ( @add->vars ) { - * table_set( new_table, $element.key, $element.val ); - * }; - * foreach $unsetenv ( @UNSETENV ) { - * table_unset( new_table, $unsetenv ); - * } - */ - - new_table = ap_copy_table(p, base->vars); - - arr = ap_table_elts(add->vars); - elts = (table_entry *)arr->elts; - - for (i = 0; i < arr->nelts; ++i) { - ap_table_setn(new_table, elts[i].key, elts[i].val); - } - - unset = add->unsetenv; - uenv = ap_getword_conf(p, &unset); - while (uenv[0] != '\0') { - ap_table_unset(new_table, uenv); - uenv = ap_getword_conf(p, &unset); - } - - new->vars = new_table; - - new->vars_present = base->vars_present || add->vars_present; - - return new; -} - -static const char *add_env_module_vars_passed(cmd_parms *cmd, - env_dir_config_rec *sconf, - const char *arg) -{ - table *vars = sconf->vars; - char *env_var; - char *name_ptr; - - while (*arg) { - name_ptr = ap_getword_conf(cmd->pool, &arg); - env_var = getenv(name_ptr); - if (env_var != NULL) { - sconf->vars_present = 1; - ap_table_setn(vars, name_ptr, ap_pstrdup(cmd->pool, env_var)); - } - } - return NULL; -} - -static const char *add_env_module_vars_set(cmd_parms *cmd, - env_dir_config_rec *sconf, - const char *arg) -{ - table *vars = sconf->vars; - char *name, *value; - - name = ap_getword_conf(cmd->pool, &arg); - value = ap_getword_conf(cmd->pool, &arg); - - /* name is mandatory, value is optional. no value means - * set the variable to an empty string - */ - - - if ((*name == '\0') || (*arg != '\0')) { - return "SetEnv takes one or two arguments. An environment variable name and an optional value to pass to CGI."; - } - - sconf->vars_present = 1; - ap_table_setn(vars, name, value); - - return NULL; -} - -static const char *add_env_module_vars_unset(cmd_parms *cmd, - env_dir_config_rec *sconf, - char *arg) -{ - sconf->unsetenv = sconf->unsetenv ? - ap_pstrcat(cmd->pool, sconf->unsetenv, " ", arg, NULL) : - arg; - return NULL; -} - -static const command_rec env_module_cmds[] = -{ - {"PassEnv", add_env_module_vars_passed, NULL, - OR_FILEINFO, RAW_ARGS, "a list of environment variables to pass to CGI."}, - {"SetEnv", add_env_module_vars_set, NULL, - OR_FILEINFO, RAW_ARGS, "an environment variable name and a value to pass to CGI."}, - {"UnsetEnv", add_env_module_vars_unset, NULL, - OR_FILEINFO, RAW_ARGS, "a list of variables to remove from the CGI environment."}, - {NULL}, -}; - -static int fixup_env_module(request_rec *r) -{ - table *e = r->subprocess_env; - env_dir_config_rec *sconf = ap_get_module_config(r->per_dir_config, - &env_module); - table *vars = sconf->vars; - - if (!sconf->vars_present) - return DECLINED; - - r->subprocess_env = ap_overlay_tables(r->pool, e, vars); - - return OK; -} - -module MODULE_VAR_EXPORT env_module = -{ - STANDARD_MODULE_STUFF, - NULL, /* initializer */ - create_env_dir_config, /* dir config creater */ - merge_env_dir_configs, /* dir merger --- default is to override */ - NULL, /* server config */ - NULL, /* merge server configs */ - env_module_cmds, /* command table */ - NULL, /* handlers */ - NULL, /* filename translation */ - NULL, /* check_user_id */ - NULL, /* check auth */ - NULL, /* check access */ - NULL, /* type_checker */ - fixup_env_module, /* fixups */ - NULL, /* logger */ - NULL, /* header parser */ - NULL, /* child_init */ - NULL, /* child_exit */ - NULL /* post read-request */ -}; diff --git a/modules/metadata/mod_env.dsp b/modules/metadata/mod_env.dsp deleted file mode 100644 index 13a4123ec1f716a479ac0fbdc8940bc2282581a9..0000000000000000000000000000000000000000 --- a/modules/metadata/mod_env.dsp +++ /dev/null @@ -1,128 +0,0 @@ -# Microsoft Developer Studio Project File - Name="mod_env" - Package Owner=<4> -# Microsoft Developer Studio Generated Build File, Format Version 6.00 -# ** DO NOT EDIT ** - -# TARGTYPE "Win32 (x86) Dynamic-Link Library" 0x0102 - -CFG=mod_env - Win32 Release -!MESSAGE This is not a valid makefile. To build this project using NMAKE, -!MESSAGE use the Export Makefile command and run -!MESSAGE -!MESSAGE NMAKE /f "mod_env.mak". -!MESSAGE -!MESSAGE You can specify a configuration when running NMAKE -!MESSAGE by defining the macro CFG on the command line. For example: -!MESSAGE -!MESSAGE NMAKE /f "mod_env.mak" CFG="mod_env - Win32 Release" -!MESSAGE -!MESSAGE Possible choices for configuration are: -!MESSAGE -!MESSAGE "mod_env - Win32 Release" (based on "Win32 (x86) Dynamic-Link Library") -!MESSAGE "mod_env - Win32 Debug" (based on "Win32 (x86) Dynamic-Link Library") -!MESSAGE - -# Begin Project -# PROP AllowPerConfigDependencies 0 -# PROP Scc_ProjName "" -# PROP Scc_LocalPath "" -CPP=cl.exe -MTL=midl.exe -RSC=rc.exe - -!IF "$(CFG)" == "mod_env - Win32 Release" - -# PROP BASE Use_MFC 0 -# PROP BASE Use_Debug_Libraries 0 -# PROP BASE Output_Dir "Release" -# PROP BASE Intermediate_Dir "Release" -# PROP BASE Target_Dir "" -# PROP Use_MFC 0 -# PROP Use_Debug_Libraries 0 -# PROP Output_Dir "Release" -# PROP Intermediate_Dir "Release" -# PROP Ignore_Export_Lib 0 -# PROP Target_Dir "" -# ADD BASE CPP /nologo /MD /W3 /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /FD /c -# ADD CPP /nologo /MD /W3 /O2 /I "../../include" /I "../../srclib/apr/include" /I "../../srclib/apr-util/include" /D "NDEBUG" /D "WIN32" /D "_WINDOWS" /Fd"Release\mod_env" /FD /c -# ADD BASE MTL /nologo /D "NDEBUG" /win32 -# ADD MTL /nologo /D "NDEBUG" /mktyplib203 /win32 -# ADD BASE RSC /l 0x409 /d "NDEBUG" -# ADD RSC /l 0x409 /d "NDEBUG" -BSC32=bscmake.exe -# ADD BASE BSC32 /nologo -# ADD BSC32 /nologo -LINK32=link.exe -# ADD BASE LINK32 kernel32.lib /nologo /subsystem:windows /dll /map /machine:I386 /out:"Release/mod_env.so" /base:@..\..\os\win32\BaseAddr.ref,mod_env -# ADD LINK32 kernel32.lib /nologo /subsystem:windows /dll /map /machine:I386 /out:"Release/mod_env.so" /base:@..\..\os\win32\BaseAddr.ref,mod_env - -!ELSEIF "$(CFG)" == "mod_env - Win32 Debug" - -# PROP BASE Use_MFC 0 -# PROP BASE Use_Debug_Libraries 1 -# PROP BASE Output_Dir "Debug" -# PROP BASE Intermediate_Dir "Debug" -# PROP BASE Target_Dir "" -# PROP Use_MFC 0 -# PROP Use_Debug_Libraries 1 -# PROP Output_Dir "Debug" -# PROP Intermediate_Dir "Debug" -# PROP Ignore_Export_Lib 0 -# PROP Target_Dir "" -# ADD BASE CPP /nologo /MDd /W3 /GX /Zi /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /FD /c -# ADD CPP /nologo /MDd /W3 /GX /Zi /Od /I "../../include" /I "../../srclib/apr/include" /I "../../srclib/apr-util/include" /D "_DEBUG" /D "WIN32" /D "_WINDOWS" /Fd"Debug\mod_env" /FD /c -# ADD BASE MTL /nologo /D "_DEBUG" /win32 -# ADD MTL /nologo /D "_DEBUG" /mktyplib203 /win32 -# ADD BASE RSC /l 0x409 /d "_DEBUG" -# ADD RSC /l 0x409 /d "_DEBUG" -BSC32=bscmake.exe -# ADD BASE BSC32 /nologo -# ADD BSC32 /nologo -LINK32=link.exe -# ADD BASE LINK32 kernel32.lib /nologo /subsystem:windows /dll /incremental:no /map /debug /machine:I386 /out:"Debug/mod_env.so" /base:@..\..\os\win32\BaseAddr.ref,mod_env -# ADD LINK32 kernel32.lib /nologo /subsystem:windows /dll /incremental:no /map /debug /machine:I386 /out:"Debug/mod_env.so" /base:@..\..\os\win32\BaseAddr.ref,mod_env - -!ENDIF - -# Begin Target - -# Name "mod_env - Win32 Release" -# Name "mod_env - Win32 Debug" -# Begin Source File - -SOURCE=.\mod_env.c -# End Source File -# Begin Source File - -SOURCE=.\mod_env.rc -# End Source File -# Begin Source File - -SOURCE=..\..\build\win32\win32ver.awk - -!IF "$(CFG)" == "mod_env - Win32 Release" - -# PROP Ignore_Default_Tool 1 -# Begin Custom Build - Creating Version Resource -InputPath=..\..\build\win32\win32ver.awk - -".\mod_env.rc" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)" - awk -f ../../build/win32/win32ver.awk mod_env "env_module for Apache" ../../include/ap_release.h > .\mod_env.rc - -# End Custom Build - -!ELSEIF "$(CFG)" == "mod_env - Win32 Debug" - -# PROP Ignore_Default_Tool 1 -# Begin Custom Build - Creating Version Resource -InputPath=..\..\build\win32\win32ver.awk - -".\mod_env.rc" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)" - awk -f ../../build/win32/win32ver.awk mod_env "env_module for Apache" ../../include/ap_release.h > .\mod_env.rc - -# End Custom Build - -!ENDIF - -# End Source File -# End Target -# End Project diff --git a/modules/metadata/mod_env.exp b/modules/metadata/mod_env.exp deleted file mode 100644 index b487bf09c8f286cccfa471f399d01ee3e7ef7b9a..0000000000000000000000000000000000000000 --- a/modules/metadata/mod_env.exp +++ /dev/null @@ -1 +0,0 @@ -env_module diff --git a/modules/metadata/mod_expires.c b/modules/metadata/mod_expires.c deleted file mode 100644 index 4fcf51a81068801e53a0653657c114ff82777dc2..0000000000000000000000000000000000000000 --- a/modules/metadata/mod_expires.c +++ /dev/null @@ -1,510 +0,0 @@ -/* ==================================================================== - * Copyright (c) 1995-1999 The Apache Group. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in - * the documentation and/or other materials provided with the - * distribution. - * - * 3. All advertising materials mentioning features or use of this - * software must display the following acknowledgment: - * "This product includes software developed by the Apache Group - * for use in the Apache HTTP server project (http://www.apache.org/)." - * - * 4. The names "Apache Server" and "Apache Group" must not be used to - * endorse or promote products derived from this software without - * prior written permission. For written permission, please contact - * apache@apache.org. - * - * 5. Products derived from this software may not be called "Apache" - * nor may "Apache" appear in their names without prior written - * permission of the Apache Group. - * - * 6. Redistributions of any form whatsoever must retain the following - * acknowledgment: - * "This product includes software developed by the Apache Group - * for use in the Apache HTTP server project (http://www.apache.org/)." - * - * THIS SOFTWARE IS PROVIDED BY THE APACHE GROUP ``AS IS'' AND ANY - * EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR - * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE APACHE GROUP OR - * IT'S CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT - * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, - * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED - * OF THE POSSIBILITY OF SUCH DAMAGE. - * ==================================================================== - * - * This software consists of voluntary contributions made by many - * individuals on behalf of the Apache Group and was originally based - * on public domain software written at the National Center for - * Supercomputing Applications, University of Illinois, Urbana-Champaign. - * For more information on the Apache Group and the Apache HTTP server - * project, please see . - * - */ - -/* - * mod_expires.c - * version 0.0.11 - * status beta - * - * Andrew Wilson 26.Jan.96 - * - * This module allows you to control the form of the Expires: header - * that Apache issues for each access. Directives can appear in - * configuration files or in .htaccess files so expiry semantics can - * be defined on a per-directory basis. - * - * DIRECTIVE SYNTAX - * - * Valid directives are: - * - * ExpiresActive on | off - * ExpiresDefault - * ExpiresByType type/encoding - * - * Valid values for are: - * - * 'M' expires header shows file modification date + - * 'A' expires header shows access time + - * - * [I'm not sure which of these is best under different - * circumstances, I guess it's for other people to explore. - * The effects may be indistinguishable for a number of cases] - * - * should be an integer value [acceptable to atoi()] - * - * There is NO space between the and . - * - * For example, a directory which contains information which changes - * frequently might contain: - * - * # reports generated by cron every hour. don't let caches - * # hold onto stale information - * ExpiresDefault M3600 - * - * Another example, our html pages can change all the time, the gifs - * tend not to change often: - * - * # pages are hot (1 week), images are cold (1 month) - * ExpiresByType text/html A604800 - * ExpiresByType image/gif A2592000 - * - * Expires can be turned on for all URLs on the server by placing the - * following directive in a conf file: - * - * ExpiresActive on - * - * ExpiresActive can also appear in .htaccess files, enabling the - * behaviour to be turned on or off for each chosen directory. - * - * # turn off Expires behaviour in this directory - * # and subdirectories - * ExpiresActive off - * - * Directives defined for a directory are valid in subdirectories - * unless explicitly overridden by new directives in the subdirectory - * .htaccess files. - * - * ALTERNATIVE DIRECTIVE SYNTAX - * - * Directives can also be defined in a more readable syntax of the form: - * - * ExpiresDefault " [plus] { }*" - * ExpiresByType type/encoding " [plus] { }*" - * - * where is one of: - * access - * now equivalent to 'access' - * modification - * - * where the 'plus' keyword is optional - * - * where should be an integer value [acceptable to atoi()] - * - * where is one of: - * years - * months - * weeks - * days - * hours - * minutes - * seconds - * - * For example, any of the following directives can be used to make - * documents expire 1 month after being accessed, by default: - * - * ExpiresDefault "access plus 1 month" - * ExpiresDefault "access plus 4 weeks" - * ExpiresDefault "access plus 30 days" - * - * The expiry time can be fine-tuned by adding several ' ' - * clauses: - * - * ExpiresByType text/html "access plus 1 month 15 days 2 hours" - * ExpiresByType image/gif "modification plus 5 hours 3 minutes" - * - * --- - * - * Change-log: - * 29.Jan.96 Hardened the add_* functions. Server will now bail out - * if bad directives are given in the conf files. - * 02.Feb.96 Returns DECLINED if not 'ExpiresActive on', giving other - * expires-aware modules a chance to play with the same - * directives. [Michael Rutman] - * 03.Feb.96 Call tzset() before localtime(). Trying to get the module - * to work properly in non GMT timezones. - * 12.Feb.96 Modified directive syntax to allow more readable commands: - * ExpiresDefault "now plus 10 days 20 seconds" - * ExpiresDefault "access plus 30 days" - * ExpiresDefault "modification plus 1 year 10 months 30 days" - * 13.Feb.96 Fix call to table_get() with NULL 2nd parameter [Rob Hartill] - * 19.Feb.96 Call gm_timestr_822() to get time formatted correctly, can't - * rely on presence of HTTP_TIME_FORMAT in Apache 1.1+. - * 21.Feb.96 This version (0.0.9) reverses assumptions made in 0.0.8 - * about star/star handlers. Reverting to 0.0.7 behaviour. - * 08.Jun.96 allows ExpiresDefault to be used with responses that use - * the DefaultType by not DECLINING, but instead skipping - * the table_get check and then looking for an ExpiresDefault. - * [Rob Hartill] - * 04.Nov.96 'const' definitions added. - * - * TODO - * add support for Cache-Control: max-age=20 from the HTTP/1.1 - * proposal (in this case, a ttl of 20 seconds) [ask roy] - * add per-file expiry and explicit expiry times - duplicates some - * of the mod_cern_meta.c functionality. eg: - * ExpiresExplicit index.html "modification plus 30 days" - * - * BUGS - * Hi, welcome to the internet. - */ - -#include -#include "httpd.h" -#include "http_config.h" -#include "http_log.h" - -typedef struct { - int active; - char *expiresdefault; - table *expiresbytype; -} expires_dir_config; - -/* from mod_dir, why is this alias used? - */ -#define DIR_CMD_PERMS OR_INDEXES - -#define ACTIVE_ON 1 -#define ACTIVE_OFF 0 -#define ACTIVE_DONTCARE 2 - -module MODULE_VAR_EXPORT expires_module; - -static void *create_dir_expires_config(pool *p, char *dummy) -{ - expires_dir_config *new = - (expires_dir_config *) ap_pcalloc(p, sizeof(expires_dir_config)); - new->active = ACTIVE_DONTCARE; - new->expiresdefault = ""; - new->expiresbytype = ap_make_table(p, 4); - return (void *) new; -} - -static const char *set_expiresactive(cmd_parms *cmd, expires_dir_config * dir_config, int arg) -{ - /* if we're here at all it's because someone explicitly - * set the active flag - */ - dir_config->active = ACTIVE_ON; - if (arg == 0) { - dir_config->active = ACTIVE_OFF; - }; - return NULL; -} - -/* check_code() parse 'code' and return NULL or an error response - * string. If we return NULL then real_code contains code converted - * to the cnnnn format. - */ -static char *check_code(pool *p, const char *code, char **real_code) -{ - char *word; - char base = 'X'; - int modifier = 0; - int num = 0; - int factor = 0; - - /* 0.0.4 compatibility? - */ - if ((code[0] == 'A') || (code[0] == 'M')) { - *real_code = (char *)code; - return NULL; - }; - - /* [plus] { }* - */ - - /* - */ - word = ap_getword_conf(p, &code); - if (!strncasecmp(word, "now", 1) || - !strncasecmp(word, "access", 1)) { - base = 'A'; - } - else if (!strncasecmp(word, "modification", 1)) { - base = 'M'; - } - else { - return ap_pstrcat(p, "bad expires code, unrecognised '", - word, "'", NULL); - }; - - /* [plus] - */ - word = ap_getword_conf(p, &code); - if (!strncasecmp(word, "plus", 1)) { - word = ap_getword_conf(p, &code); - }; - - /* { }* - */ - while (word[0]) { - /* - */ - if (ap_isdigit(word[0])) { - num = atoi(word); - } - else { - return ap_pstrcat(p, "bad expires code, numeric value expected '", - word, "'", NULL); - }; - - /* - */ - word = ap_getword_conf(p, &code); - if (word[0]) { - /* do nothing */ - } - else { - return ap_pstrcat(p, "bad expires code, missing ", NULL); - }; - - factor = 0; - if (!strncasecmp(word, "years", 1)) { - factor = 60 * 60 * 24 * 365; - } - else if (!strncasecmp(word, "months", 2)) { - factor = 60 * 60 * 24 * 30; - } - else if (!strncasecmp(word, "weeks", 1)) { - factor = 60 * 60 * 24 * 7; - } - else if (!strncasecmp(word, "days", 1)) { - factor = 60 * 60 * 24; - } - else if (!strncasecmp(word, "hours", 1)) { - factor = 60 * 60; - } - else if (!strncasecmp(word, "minutes", 2)) { - factor = 60; - } - else if (!strncasecmp(word, "seconds", 1)) { - factor = 1; - } - else { - return ap_pstrcat(p, "bad expires code, unrecognised ", - "'", word, "'", NULL); - }; - - modifier = modifier + factor * num; - - /* next - */ - word = ap_getword_conf(p, &code); - }; - - *real_code = ap_psprintf(p, "%c%d", base, modifier); - - return NULL; -} - -static const char *set_expiresbytype(cmd_parms *cmd, expires_dir_config * dir_config, char *mime, char *code) -{ - char *response, *real_code; - - if ((response = check_code(cmd->pool, code, &real_code)) == NULL) { - ap_table_setn(dir_config->expiresbytype, mime, real_code); - return NULL; - }; - return ap_pstrcat(cmd->pool, - "'ExpiresByType ", mime, " ", code, "': ", response, NULL); -} - -static const char *set_expiresdefault(cmd_parms *cmd, expires_dir_config * dir_config, char *code) -{ - char *response, *real_code; - - if ((response = check_code(cmd->pool, code, &real_code)) == NULL) { - dir_config->expiresdefault = real_code; - return NULL; - }; - return ap_pstrcat(cmd->pool, - "'ExpiresDefault ", code, "': ", response, NULL); -} - -static const command_rec expires_cmds[] = -{ - {"ExpiresActive", set_expiresactive, NULL, DIR_CMD_PERMS, FLAG, - "Limited to 'on' or 'off'"}, - {"ExpiresBytype", set_expiresbytype, NULL, DIR_CMD_PERMS, TAKE2, - "a MIME type followed by an expiry date code"}, - {"ExpiresDefault", set_expiresdefault, NULL, DIR_CMD_PERMS, TAKE1, - "an expiry date code"}, - {NULL} -}; - -static void *merge_expires_dir_configs(pool *p, void *basev, void *addv) -{ - expires_dir_config *new = (expires_dir_config *) ap_pcalloc(p, sizeof(expires_dir_config)); - expires_dir_config *base = (expires_dir_config *) basev; - expires_dir_config *add = (expires_dir_config *) addv; - - if (add->active == ACTIVE_DONTCARE) { - new->active = base->active; - } - else { - new->active = add->active; - }; - - if (add->expiresdefault != '\0') { - new->expiresdefault = add->expiresdefault; - }; - - new->expiresbytype = ap_overlay_tables(p, add->expiresbytype, - base->expiresbytype); - return new; -} - -static int add_expires(request_rec *r) -{ - expires_dir_config *conf; - char *code; - time_t base; - time_t additional; - time_t expires; - char age[20]; - - if (ap_is_HTTP_ERROR(r->status)) /* Don't add Expires headers to errors */ - return DECLINED; - - if (r->main != NULL) /* Say no to subrequests */ - return DECLINED; - - conf = (expires_dir_config *) ap_get_module_config(r->per_dir_config, &expires_module); - if (conf == NULL) { - ap_log_rerror(APLOG_MARK, APLOG_NOERRNO|APLOG_ERR, r, - "internal error: %s", r->filename); - return SERVER_ERROR; - }; - - if (conf->active != ACTIVE_ON) - return DECLINED; - - /* we perhaps could use the default_type(r) in its place but that - * may be 2nd guesing the desired configuration... calling table_get - * with a NULL key will SEGV us - * - * I still don't know *why* r->content_type would ever be NULL, this - * is possibly a result of fixups being called in many different - * places. Fixups is probably the wrong place to be doing all this - * work... Bah. - * - * Changed as of 08.Jun.96 don't DECLINE, look for an ExpiresDefault. - */ - if (r->content_type == NULL) - code = NULL; - else - code = (char *) ap_table_get(conf->expiresbytype, r->content_type); - - if (code == NULL) { - /* no expires defined for that type, is there a default? */ - code = conf->expiresdefault; - - if (code[0] == '\0') - return OK; - }; - - /* we have our code */ - - switch (code[0]) { - case 'M': - if (r->finfo.st_mode == 0) { - /* file doesn't exist on disk, so we can't do anything based on - * modification time. Note that this does _not_ log an error. - */ - return DECLINED; - } - base = r->finfo.st_mtime; - additional = atoi(&code[1]); - break; - case 'A': - /* there's been some discussion and it's possible that - * 'access time' will be stored in request structure - */ - base = r->request_time; - additional = atoi(&code[1]); - break; - default: - /* expecting the add_* routines to be case-hardened this - * is just a reminder that module is beta - */ - ap_log_rerror(APLOG_MARK, APLOG_NOERRNO|APLOG_ERR, r, - "internal error: bad expires code: %s", r->filename); - return SERVER_ERROR; - }; - - expires = base + additional; - ap_snprintf(age, sizeof(age), "max-age=%d", (int) expires - (int) r->request_time); - ap_table_setn(r->headers_out, "Cache-Control", ap_pstrdup(r->pool, age)); - tzset(); /* redundant? called implicitly by localtime, at least - * under FreeBSD - */ - ap_table_setn(r->headers_out, "Expires", ap_gm_timestr_822(r->pool, expires)); - return OK; -} - -module MODULE_VAR_EXPORT expires_module = -{ - STANDARD_MODULE_STUFF, - NULL, /* initializer */ - create_dir_expires_config, /* dir config creater */ - merge_expires_dir_configs, /* dir merger --- default is to override */ - NULL, /* server config */ - NULL, /* merge server configs */ - expires_cmds, /* command table */ - NULL, /* handlers */ - NULL, /* filename translation */ - NULL, /* check_user_id */ - NULL, /* check auth */ - NULL, /* check access */ - NULL, /* type_checker */ - add_expires, /* fixups */ - NULL, /* logger */ - NULL, /* header parser */ - NULL, /* child_init */ - NULL, /* child_exit */ - NULL /* post read-request */ -}; diff --git a/modules/metadata/mod_expires.dsp b/modules/metadata/mod_expires.dsp deleted file mode 100644 index 0b2fe902bb21f2af3497388f3742c2f6b2a3bb72..0000000000000000000000000000000000000000 --- a/modules/metadata/mod_expires.dsp +++ /dev/null @@ -1,113 +0,0 @@ -# Microsoft Developer Studio Project File - Name="ApacheModuleExpires" - Package Owner=<4> -# Microsoft Developer Studio Generated Build File, Format Version 5.00 -# ** DO NOT EDIT ** - -# TARGTYPE "Win32 (x86) Dynamic-Link Library" 0x0102 - -CFG=ApacheModuleExpires - Win32 Release -!MESSAGE This is not a valid makefile. To build this project using NMAKE, -!MESSAGE use the Export Makefile command and run -!MESSAGE -!MESSAGE NMAKE /f "ApacheModuleExpires.mak". -!MESSAGE -!MESSAGE You can specify a configuration when running NMAKE -!MESSAGE by defining the macro CFG on the command line. For example: -!MESSAGE -!MESSAGE NMAKE /f "ApacheModuleExpires.mak"\ - CFG="ApacheModuleExpires - Win32 Release" -!MESSAGE -!MESSAGE Possible choices for configuration are: -!MESSAGE -!MESSAGE "ApacheModuleExpires - Win32 Release" (based on\ - "Win32 (x86) Dynamic-Link Library") -!MESSAGE "ApacheModuleExpires - Win32 Debug" (based on\ - "Win32 (x86) Dynamic-Link Library") -!MESSAGE - -# Begin Project -# PROP Scc_ProjName "" -# PROP Scc_LocalPath "" -CPP=cl.exe -MTL=midl.exe -RSC=rc.exe - -!IF "$(CFG)" == "ApacheModuleExpires - Win32 Release" - -# PROP BASE Use_MFC 0 -# PROP BASE Use_Debug_Libraries 0 -# PROP BASE Output_Dir ".\Release" -# PROP BASE Intermediate_Dir ".\Release" -# PROP BASE Target_Dir "" -# PROP Use_MFC 0 -# PROP Use_Debug_Libraries 0 -# PROP Output_Dir ".\ApacheModuleExpiresR" -# PROP Intermediate_Dir ".\ApacheModuleExpiresR" -# PROP Ignore_Export_Lib 0 -# PROP Target_Dir "" -# ADD BASE CPP /nologo /MT /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /YX /c -# ADD CPP /nologo /MD /W3 /GX /O2 /I "..\..\include" /D "NDEBUG" /D "WIN32" /D "_WINDOWS" /D "SHARED_MODULE" /YX /FD /c -# ADD BASE MTL /nologo /D "NDEBUG" /win32 -# ADD MTL /nologo /D "NDEBUG" /mktyplib203 /win32 -# ADD BASE RSC /l 0x809 /d "NDEBUG" -# ADD RSC /l 0x809 /d "NDEBUG" -BSC32=bscmake.exe -# ADD BASE BSC32 /nologo -# ADD BSC32 /nologo -LINK32=link.exe -# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:windows /dll /machine:I386 -# ADD LINK32 ..\..\CoreR\ApacheCore.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib /nologo /subsystem:windows /dll /machine:I386 - -!ELSEIF "$(CFG)" == "ApacheModuleExpires - Win32 Debug" - -# PROP BASE Use_MFC 0 -# PROP BASE Use_Debug_Libraries 1 -# PROP BASE Output_Dir ".\Debug" -# PROP BASE Intermediate_Dir ".\Debug" -# PROP BASE Target_Dir "" -# PROP Use_MFC 0 -# PROP Use_Debug_Libraries 1 -# PROP Output_Dir ".\ApacheModuleExpiresD" -# PROP Intermediate_Dir ".\ApacheModuleExpiresD" -# PROP Ignore_Export_Lib 0 -# PROP Target_Dir "" -# ADD BASE CPP /nologo /MTd /W3 /Gm /GX /Zi /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /YX /c -# ADD CPP /nologo /MDd /W3 /Gm /GX /Zi /Od /I "..\..\include" /D "_DEBUG" /D "WIN32" /D "_WINDOWS" /D "SHARED_MODULE" /YX /FD /c -# ADD BASE MTL /nologo /D "_DEBUG" /win32 -# ADD MTL /nologo /D "_DEBUG" /mktyplib203 /win32 -# ADD BASE RSC /l 0x809 /d "_DEBUG" -# ADD RSC /l 0x809 /d "_DEBUG" -BSC32=bscmake.exe -# ADD BASE BSC32 /nologo -# ADD BSC32 /nologo -LINK32=link.exe -# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:windows /dll /debug /machine:I386 -# ADD LINK32 ..\..\CoreD\ApacheCore.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib /nologo /subsystem:windows /dll /debug /machine:I386 - -!ENDIF - -# Begin Target - -# Name "ApacheModuleExpires - Win32 Release" -# Name "ApacheModuleExpires - Win32 Debug" -# Begin Group "Source Files" - -# PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;hpj;bat;for;f90" -# Begin Source File - -SOURCE=..\..\modules\standard\mod_expires.c -# End Source File -# End Group -# Begin Group "Header Files" - -# PROP Default_Filter "h;hpp;hxx;hm;inl;fi;fd" -# Begin Source File - -SOURCE=.\readdir.h -# End Source File -# End Group -# Begin Group "Resource Files" - -# PROP Default_Filter "ico;cur;bmp;dlg;rc2;rct;bin;cnt;rtf;gif;jpg;jpeg;jpe" -# End Group -# End Target -# End Project diff --git a/modules/metadata/mod_expires.exp b/modules/metadata/mod_expires.exp deleted file mode 100644 index 863a96878e1b4c6bbdf6239cea7dcb2332ed384b..0000000000000000000000000000000000000000 --- a/modules/metadata/mod_expires.exp +++ /dev/null @@ -1 +0,0 @@ -expires_module diff --git a/modules/metadata/mod_headers.c b/modules/metadata/mod_headers.c deleted file mode 100644 index c3d50503eed812045d1d09e0a791b73a49abeb73..0000000000000000000000000000000000000000 --- a/modules/metadata/mod_headers.c +++ /dev/null @@ -1,265 +0,0 @@ -/* ==================================================================== - * Copyright (c) 1996-1999 The Apache Group. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in - * the documentation and/or other materials provided with the - * distribution. - * - * 3. All advertising materials mentioning features or use of this - * software must display the following acknowledgment: - * "This product includes software developed by the Apache Group - * for use in the Apache HTTP server project (http://www.apache.org/)." - * - * 4. The names "Apache Server" and "Apache Group" must not be used to - * endorse or promote products derived from this software without - * prior written permission. For written permission, please contact - * apache@apache.org. - * - * 5. Products derived from this software may not be called "Apache" - * nor may "Apache" appear in their names without prior written - * permission of the Apache Group. - * - * 6. Redistributions of any form whatsoever must retain the following - * acknowledgment: - * "This product includes software developed by the Apache Group - * for use in the Apache HTTP server project (http://www.apache.org/)." - * - * THIS SOFTWARE IS PROVIDED BY THE APACHE GROUP ``AS IS'' AND ANY - * EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR - * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE APACHE GROUP OR - * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT - * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, - * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED - * OF THE POSSIBILITY OF SUCH DAMAGE. - * ==================================================================== - * - * This software consists of voluntary contributions made by many - * individuals on behalf of the Apache Group and was originally based - * on public domain software written at the National Center for - * Supercomputing Applications, University of Illinois, Urbana-Champaign. - * For more information on the Apache Group and the Apache HTTP server - * project, please see . - * - */ - -/* - * mod_headers.c: Add/append/remove HTTP response headers - * Written by Paul Sutton, paul@ukweb.com, 1 Oct 1996 - * - * New directive, Header, can be used to add/replace/remove HTTP headers. - * Valid in both per-server and per-dir configurations. - * - * Syntax is: - * - * Header action header value - * - * Where action is one of: - * set - set this header, replacing any old value - * add - add this header, possible resulting in two or more - * headers with the same name - * append - append this text onto any existing header of this same - * unset - remove this header - * - * Where action is unset, the third argument (value) should not be given. - * The header name can include the colon, or not. - * - * The Header directive can only be used where allowed by the FileInfo - * override. - * - * When the request is processed, the header directives are processed in - * this order: firstly, the main server, then the virtual server handling - * this request (if any), then any sections (working downwards - * from the root dir), then an sections (working down from - * shortest URL component), the any sections. This order is - * important if any 'set' or 'unset' actions are used. For example, - * the following two directives have different effect if applied in - * the reverse order: - * - * Header append Author "John P. Doe" - * Header unset Author - * - * Examples: - * - * To set the "Author" header, use - * Header add Author "John P. Doe" - * - * To remove a header: - * Header unset Author - * - */ - -#include "httpd.h" -#include "http_config.h" - -typedef enum { - hdr_add = 'a', /* add header (could mean multiple hdrs) */ - hdr_set = 's', /* set (replace old value) */ - hdr_append = 'm', /* append (merge into any old value) */ - hdr_unset = 'u' /* unset header */ -} hdr_actions; - -typedef struct { - hdr_actions action; - char *header; - char *value; -} header_entry; - -/* - * headers_conf is our per-module configuration. This is used as both - * a per-dir and per-server config - */ -typedef struct { - array_header *headers; -} headers_conf; - -module MODULE_VAR_EXPORT headers_module; - -static void *create_headers_config(pool *p, server_rec *s) -{ - headers_conf *a = - (headers_conf *) ap_pcalloc(p, sizeof(headers_conf)); - - a->headers = ap_make_array(p, 2, sizeof(header_entry)); - return a; -} - -static void *create_headers_dir_config(pool *p, char *d) -{ - return (headers_conf *) create_headers_config(p, NULL); -} - -static void *merge_headers_config(pool *p, void *basev, void *overridesv) -{ - headers_conf *a = - (headers_conf *) ap_pcalloc(p, sizeof(headers_conf)); - headers_conf *base = (headers_conf *) basev, *overrides = (headers_conf *) overridesv; - - a->headers = ap_append_arrays(p, base->headers, overrides->headers); - - return a; -} - - -static const char *header_cmd(cmd_parms *cmd, headers_conf * dirconf, char *action, char *hdr, char *value) -{ - header_entry *new; - server_rec *s = cmd->server; - headers_conf *serverconf = - (headers_conf *) ap_get_module_config(s->module_config, &headers_module); - char *colon; - - if (cmd->path) { - new = (header_entry *) ap_push_array(dirconf->headers); - } - else { - new = (header_entry *) ap_push_array(serverconf->headers); - } - - if (!strcasecmp(action, "set")) - new->action = hdr_set; - else if (!strcasecmp(action, "add")) - new->action = hdr_add; - else if (!strcasecmp(action, "append")) - new->action = hdr_append; - else if (!strcasecmp(action, "unset")) - new->action = hdr_unset; - else - return "first argument must be add, set, append or unset."; - - if (new->action == hdr_unset) { - if (value) - return "Header unset takes two arguments"; - } - else if (!value) - return "Header requires three arguments"; - - if ((colon = strchr(hdr, ':'))) - *colon = '\0'; - - new->header = hdr; - new->value = value; - - return NULL; -} - -static const command_rec headers_cmds[] = -{ - {"Header", header_cmd, NULL, OR_FILEINFO, TAKE23, - "an action, header and value"}, - {NULL} -}; - -static void do_headers_fixup(request_rec *r, array_header *headers) -{ - int i; - - for (i = 0; i < headers->nelts; ++i) { - header_entry *hdr = &((header_entry *) (headers->elts))[i]; - switch (hdr->action) { - case hdr_add: - ap_table_addn(r->headers_out, hdr->header, hdr->value); - break; - case hdr_append: - ap_table_mergen(r->headers_out, hdr->header, hdr->value); - break; - case hdr_set: - ap_table_setn(r->headers_out, hdr->header, hdr->value); - break; - case hdr_unset: - ap_table_unset(r->headers_out, hdr->header); - break; - } - } - -} - -static int fixup_headers(request_rec *r) -{ - void *sconf = r->server->module_config; - headers_conf *serverconf = - (headers_conf *) ap_get_module_config(sconf, &headers_module); - void *dconf = r->per_dir_config; - headers_conf *dirconf = - (headers_conf *) ap_get_module_config(dconf, &headers_module); - - do_headers_fixup(r, serverconf->headers); - do_headers_fixup(r, dirconf->headers); - - return DECLINED; -} - -module MODULE_VAR_EXPORT headers_module = -{ - STANDARD_MODULE_STUFF, - NULL, /* initializer */ - create_headers_dir_config, /* dir config creater */ - merge_headers_config, /* dir merger --- default is to override */ - create_headers_config, /* server config */ - merge_headers_config, /* merge server configs */ - headers_cmds, /* command table */ - NULL, /* handlers */ - NULL, /* filename translation */ - NULL, /* check_user_id */ - NULL, /* check auth */ - NULL, /* check access */ - NULL, /* type_checker */ - fixup_headers, /* fixups */ - NULL, /* logger */ - NULL, /* header parser */ - NULL, /* child_init */ - NULL, /* child_exit */ - NULL /* post read-request */ -}; diff --git a/modules/metadata/mod_headers.dsp b/modules/metadata/mod_headers.dsp deleted file mode 100644 index 1dc76027b310b340869a1ea26b9ae86021f5bfec..0000000000000000000000000000000000000000 --- a/modules/metadata/mod_headers.dsp +++ /dev/null @@ -1,113 +0,0 @@ -# Microsoft Developer Studio Project File - Name="ApacheModuleHeaders" - Package Owner=<4> -# Microsoft Developer Studio Generated Build File, Format Version 5.00 -# ** DO NOT EDIT ** - -# TARGTYPE "Win32 (x86) Dynamic-Link Library" 0x0102 - -CFG=ApacheModuleHeaders - Win32 Release -!MESSAGE This is not a valid makefile. To build this project using NMAKE, -!MESSAGE use the Export Makefile command and run -!MESSAGE -!MESSAGE NMAKE /f "ApacheModuleHeaders.mak". -!MESSAGE -!MESSAGE You can specify a configuration when running NMAKE -!MESSAGE by defining the macro CFG on the command line. For example: -!MESSAGE -!MESSAGE NMAKE /f "ApacheModuleHeaders.mak"\ - CFG="ApacheModuleHeaders - Win32 Release" -!MESSAGE -!MESSAGE Possible choices for configuration are: -!MESSAGE -!MESSAGE "ApacheModuleHeaders - Win32 Release" (based on\ - "Win32 (x86) Dynamic-Link Library") -!MESSAGE "ApacheModuleHeaders - Win32 Debug" (based on\ - "Win32 (x86) Dynamic-Link Library") -!MESSAGE - -# Begin Project -# PROP Scc_ProjName "" -# PROP Scc_LocalPath "" -CPP=cl.exe -MTL=midl.exe -RSC=rc.exe - -!IF "$(CFG)" == "ApacheModuleHeaders - Win32 Release" - -# PROP BASE Use_MFC 0 -# PROP BASE Use_Debug_Libraries 0 -# PROP BASE Output_Dir ".\Release" -# PROP BASE Intermediate_Dir ".\Release" -# PROP BASE Target_Dir "" -# PROP Use_MFC 0 -# PROP Use_Debug_Libraries 0 -# PROP Output_Dir ".\ApacheModuleHeadersR" -# PROP Intermediate_Dir ".\ApacheModuleHeadersR" -# PROP Ignore_Export_Lib 0 -# PROP Target_Dir "" -# ADD BASE CPP /nologo /MT /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /YX /c -# ADD CPP /nologo /MD /W3 /GX /O2 /I "..\..\include" /D "NDEBUG" /D "WIN32" /D "_WINDOWS" /D "SHARED_MODULE" /YX /FD /c -# ADD BASE MTL /nologo /D "NDEBUG" /win32 -# ADD MTL /nologo /D "NDEBUG" /mktyplib203 /win32 -# ADD BASE RSC /l 0x809 /d "NDEBUG" -# ADD RSC /l 0x809 /d "NDEBUG" -BSC32=bscmake.exe -# ADD BASE BSC32 /nologo -# ADD BSC32 /nologo -LINK32=link.exe -# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:windows /dll /machine:I386 -# ADD LINK32 ..\..\CoreR\ApacheCore.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib /nologo /subsystem:windows /dll /machine:I386 - -!ELSEIF "$(CFG)" == "ApacheModuleHeaders - Win32 Debug" - -# PROP BASE Use_MFC 0 -# PROP BASE Use_Debug_Libraries 1 -# PROP BASE Output_Dir ".\Debug" -# PROP BASE Intermediate_Dir ".\Debug" -# PROP BASE Target_Dir "" -# PROP Use_MFC 0 -# PROP Use_Debug_Libraries 1 -# PROP Output_Dir ".\ApacheModuleHeadersD" -# PROP Intermediate_Dir ".\ApacheModuleHeadersD" -# PROP Ignore_Export_Lib 0 -# PROP Target_Dir "" -# ADD BASE CPP /nologo /MTd /W3 /Gm /GX /Zi /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /YX /c -# ADD CPP /nologo /MDd /W3 /Gm /GX /Zi /Od /I "..\..\include" /D "_DEBUG" /D "WIN32" /D "_WINDOWS" /D "SHARED_MODULE" /YX /FD /c -# ADD BASE MTL /nologo /D "_DEBUG" /win32 -# ADD MTL /nologo /D "_DEBUG" /mktyplib203 /win32 -# ADD BASE RSC /l 0x809 /d "_DEBUG" -# ADD RSC /l 0x809 /d "_DEBUG" -BSC32=bscmake.exe -# ADD BASE BSC32 /nologo -# ADD BSC32 /nologo -LINK32=link.exe -# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:windows /dll /debug /machine:I386 -# ADD LINK32 ..\..\CoreD\ApacheCore.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib /nologo /subsystem:windows /dll /debug /machine:I386 - -!ENDIF - -# Begin Target - -# Name "ApacheModuleHeaders - Win32 Release" -# Name "ApacheModuleHeaders - Win32 Debug" -# Begin Group "Source Files" - -# PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;hpj;bat;for;f90" -# Begin Source File - -SOURCE=..\..\modules\standard\mod_headers.c -# End Source File -# End Group -# Begin Group "Header Files" - -# PROP Default_Filter "h;hpp;hxx;hm;inl;fi;fd" -# Begin Source File - -SOURCE=.\readdir.h -# End Source File -# End Group -# Begin Group "Resource Files" - -# PROP Default_Filter "ico;cur;bmp;dlg;rc2;rct;bin;cnt;rtf;gif;jpg;jpeg;jpe" -# End Group -# End Target -# End Project diff --git a/modules/metadata/mod_headers.exp b/modules/metadata/mod_headers.exp deleted file mode 100644 index 3f3063808abc67786b2b655ff7785285d9d01334..0000000000000000000000000000000000000000 --- a/modules/metadata/mod_headers.exp +++ /dev/null @@ -1 +0,0 @@ -headers_module diff --git a/modules/metadata/mod_mime_magic.c b/modules/metadata/mod_mime_magic.c deleted file mode 100644 index 7f4d6ba6e3072f5c56b61e21af3eb895c15c60f5..0000000000000000000000000000000000000000 --- a/modules/metadata/mod_mime_magic.c +++ /dev/null @@ -1,2474 +0,0 @@ -/* ==================================================================== - * Copyright (c) 1995-1999 The Apache Group. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in - * the documentation and/or other materials provided with the - * distribution. - * - * 3. All advertising materials mentioning features or use of this - * software must display the following acknowledgment: - * "This product includes software developed by the Apache Group - * for use in the Apache HTTP server project (http://www.apache.org/)." - * - * 4. The names "Apache Server" and "Apache Group" must not be used to - * endorse or promote products derived from this software without - * prior written permission. For written permission, please contact - * apache@apache.org. - * - * 5. Products derived from this software may not be called "Apache" - * nor may "Apache" appear in their names without prior written - * permission of the Apache Group. - * - * 6. Redistributions of any form whatsoever must retain the following - * acknowledgment: - * "This product includes software developed by the Apache Group - * for use in the Apache HTTP server project (http://www.apache.org/)." - * - * THIS SOFTWARE IS PROVIDED BY THE APACHE GROUP ``AS IS'' AND ANY - * EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR - * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE APACHE GROUP OR - * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT - * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, - * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED - * OF THE POSSIBILITY OF SUCH DAMAGE. - * ==================================================================== - * - * This software consists of voluntary contributions made by many - * individuals on behalf of the Apache Group and was originally based - * on public domain software written at the National Center for - * Supercomputing Applications, University of Illinois, Urbana-Champaign. - * For more information on the Apache Group and the Apache HTTP server - * project, please see . - * - */ - -/* - * mod_mime_magic: MIME type lookup via file magic numbers - * Copyright (c) 1996-1997 Cisco Systems, Inc. - * - * This software was submitted by Cisco Systems to the Apache Group in July - * 1997. Future revisions and derivatives of this source code must - * acknowledge Cisco Systems as the original contributor of this module. - * All other licensing and usage conditions are those of the Apache Group. - * - * Some of this code is derived from the free version of the file command - * originally posted to comp.sources.unix. Copyright info for that program - * is included below as required. - * --------------------------------------------------------------------------- - * - Copyright (c) Ian F. Darwin, 1987. Written by Ian F. Darwin. - * - * This software is not subject to any license of the American Telephone and - * Telegraph Company or of the Regents of the University of California. - * - * Permission is granted to anyone to use this software for any purpose on any - * computer system, and to alter it and redistribute it freely, subject to - * the following restrictions: - * - * 1. The author is not responsible for the consequences of use of this - * software, no matter how awful, even if they arise from flaws in it. - * - * 2. The origin of this software must not be misrepresented, either by - * explicit claim or by omission. Since few users ever read sources, credits - * must appear in the documentation. - * - * 3. Altered versions must be plainly marked as such, and must not be - * misrepresented as being the original software. Since few users ever read - * sources, credits must appear in the documentation. - * - * 4. This notice may not be removed or altered. - * ------------------------------------------------------------------------- - * - * For compliance with Mr Darwin's terms: this has been very significantly - * modified from the free "file" command. - * - all-in-one file for compilation convenience when moving from one - * version of Apache to the next. - * - Memory allocation is done through the Apache API's pool structure. - * - All functions have had necessary Apache API request or server - * structures passed to them where necessary to call other Apache API - * routines. (i.e. usually for logging, files, or memory allocation in - * itself or a called function.) - * - struct magic has been converted from an array to a single-ended linked - * list because it only grows one record at a time, it's only accessed - * sequentially, and the Apache API has no equivalent of realloc(). - * - Functions have been changed to get their parameters from the server - * configuration instead of globals. (It should be reentrant now but has - * not been tested in a threaded environment.) - * - Places where it used to print results to stdout now saves them in a - * list where they're used to set the MIME type in the Apache request - * record. - * - Command-line flags have been removed since they will never be used here. - * - * Ian Kluft - * Engineering Information Framework - * Central Engineering - * Cisco Systems, Inc. - * San Jose, CA, USA - * - * Initial installation July/August 1996 - * Misc bug fixes May 1997 - * Submission to Apache Group July 1997 - * - */ - -#include "httpd.h" -#include "http_config.h" -#include "http_request.h" -#include "http_core.h" -#include "http_log.h" -#include "http_protocol.h" - -#include - - -/* - * data structures and related constants - */ - -#define MODNAME "mod_mime_magic" -#define MIME_MAGIC_DEBUG 0 - -#define MIME_BINARY_UNKNOWN "application/octet-stream" -#define MIME_TEXT_UNKNOWN "text/plain" - -#define MAXMIMESTRING 256 - -/* HOWMANY must be at least 4096 to make gzip -dcq work */ -#define HOWMANY 4096 -/* SMALL_HOWMANY limits how much work we do to figure out text files */ -#define SMALL_HOWMANY 1024 -#define MAXDESC 50 /* max leng of text description */ -#define MAXstring 64 /* max leng of "string" types */ - -struct magic { - struct magic *next; /* link to next entry */ - int lineno; /* line number from magic file */ - - short flag; -#define INDIR 1 /* if '>(...)' appears, */ -#define UNSIGNED 2 /* comparison is unsigned */ - short cont_level; /* level of ">" */ - struct { - char type; /* byte short long */ - long offset; /* offset from indirection */ - } in; - long offset; /* offset to magic number */ - unsigned char reln; /* relation (0=eq, '>'=gt, etc) */ - char type; /* int, short, long or string. */ - char vallen; /* length of string value, if any */ -#define BYTE 1 -#define SHORT 2 -#define LONG 4 -#define STRING 5 -#define DATE 6 -#define BESHORT 7 -#define BELONG 8 -#define BEDATE 9 -#define LESHORT 10 -#define LELONG 11 -#define LEDATE 12 - union VALUETYPE { - unsigned char b; - unsigned short h; - unsigned long l; - char s[MAXstring]; - unsigned char hs[2]; /* 2 bytes of a fixed-endian "short" */ - unsigned char hl[4]; /* 2 bytes of a fixed-endian "long" */ - } value; /* either number or string */ - unsigned long mask; /* mask before comparison with value */ - char nospflag; /* supress space character */ - - /* NOTE: this string is suspected of overrunning - find it! */ - char desc[MAXDESC]; /* description */ -}; - -/* - * data structures for tar file recognition - * -------------------------------------------------------------------------- - * Header file for public domain tar (tape archive) program. - * - * @(#)tar.h 1.20 86/10/29 Public Domain. Created 25 August 1985 by John - * Gilmore, ihnp4!hoptoad!gnu. - * - * Header block on tape. - * - * I'm going to use traditional DP naming conventions here. A "block" is a big - * chunk of stuff that we do I/O on. A "record" is a piece of info that we - * care about. Typically many "record"s fit into a "block". - */ -#define RECORDSIZE 512 -#define NAMSIZ 100 -#define TUNMLEN 32 -#define TGNMLEN 32 - -union record { - char charptr[RECORDSIZE]; - struct header { - char name[NAMSIZ]; - char mode[8]; - char uid[8]; - char gid[8]; - char size[12]; - char mtime[12]; - char chksum[8]; - char linkflag; - char linkname[NAMSIZ]; - char magic[8]; - char uname[TUNMLEN]; - char gname[TGNMLEN]; - char devmajor[8]; - char devminor[8]; - } header; -}; - -/* The magic field is filled with this if uname and gname are valid. */ -#define TMAGIC "ustar " /* 7 chars and a null */ - -/* - * file-function prototypes - */ -static int ascmagic(request_rec *, unsigned char *, int); -static int is_tar(unsigned char *, int); -static int softmagic(request_rec *, unsigned char *, int); -static void tryit(request_rec *, unsigned char *, int, int); -static int zmagic(request_rec *, unsigned char *, int); - -static int getvalue(server_rec *, struct magic *, char **); -static int hextoint(int); -static char *getstr(server_rec *, char *, char *, int, int *); -static int parse(server_rec *, pool *p, char *, int); - -static int match(request_rec *, unsigned char *, int); -static int mget(request_rec *, union VALUETYPE *, unsigned char *, - struct magic *, int); -static int mcheck(request_rec *, union VALUETYPE *, struct magic *); -static void mprint(request_rec *, union VALUETYPE *, struct magic *); - -static int uncompress(request_rec *, int, - unsigned char **, int); -static long from_oct(int, char *); -static int fsmagic(request_rec *r, const char *fn); - -/* - * includes for ASCII substring recognition formerly "names.h" in file - * command - * - * Original notes: names and types used by ascmagic in file(1). These tokens are - * here because they can appear anywhere in the first HOWMANY bytes, while - * tokens in /etc/magic must appear at fixed offsets into the file. Don't - * make HOWMANY too high unless you have a very fast CPU. - */ - -/* these types are used to index the table 'types': keep em in sync! */ -/* HTML inserted in first because this is a web server module now */ -#define L_HTML 0 /* HTML */ -#define L_C 1 /* first and foremost on UNIX */ -#define L_FORT 2 /* the oldest one */ -#define L_MAKE 3 /* Makefiles */ -#define L_PLI 4 /* PL/1 */ -#define L_MACH 5 /* some kinda assembler */ -#define L_ENG 6 /* English */ -#define L_PAS 7 /* Pascal */ -#define L_MAIL 8 /* Electronic mail */ -#define L_NEWS 9 /* Usenet Netnews */ - -static char *types[] = -{ - "text/html", /* HTML */ - "text/plain", /* "c program text", */ - "text/plain", /* "fortran program text", */ - "text/plain", /* "make commands text", */ - "text/plain", /* "pl/1 program text", */ - "text/plain", /* "assembler program text", */ - "text/plain", /* "English text", */ - "text/plain", /* "pascal program text", */ - "message/rfc822", /* "mail text", */ - "message/news", /* "news text", */ - "application/binary", /* "can't happen error on names.h/types", */ - 0 -}; - -static struct names { - char *name; - short type; -} names[] = { - - /* These must be sorted by eye for optimal hit rate */ - /* Add to this list only after substantial meditation */ - { - "", L_HTML - }, - { - "", L_HTML - }, - { - "", L_HTML - }, - { - "", L_HTML - }, - { - "", L_HTML - }, - { - "<TITLE>", L_HTML - }, - { - "<h1>", L_HTML - }, - { - "<H1>", L_HTML - }, - { - "<!--", L_HTML - }, - { - "<!DOCTYPE HTML", L_HTML - }, - { - "/*", L_C - }, /* must precede "The", "the", etc. */ - { - "#include", L_C - }, - { - "char", L_C - }, - { - "The", L_ENG - }, - { - "the", L_ENG - }, - { - "double", L_C - }, - { - "extern", L_C - }, - { - "float", L_C - }, - { - "real", L_C - }, - { - "struct", L_C - }, - { - "union", L_C - }, - { - "CFLAGS", L_MAKE - }, - { - "LDFLAGS", L_MAKE - }, - { - "all:", L_MAKE - }, - { - ".PRECIOUS", L_MAKE - }, - /* - * Too many files of text have these words in them. Find another way to - * recognize Fortrash. - */ -#ifdef NOTDEF - { - "subroutine", L_FORT - }, - { - "function", L_FORT - }, - { - "block", L_FORT - }, - { - "common", L_FORT - }, - { - "dimension", L_FORT - }, - { - "integer", L_FORT - }, - { - "data", L_FORT - }, -#endif /* NOTDEF */ - { - ".ascii", L_MACH - }, - { - ".asciiz", L_MACH - }, - { - ".byte", L_MACH - }, - { - ".even", L_MACH - }, - { - ".globl", L_MACH - }, - { - "clr", L_MACH - }, - { - "(input,", L_PAS - }, - { - "dcl", L_PLI - }, - { - "Received:", L_MAIL - }, - { - ">From", L_MAIL - }, - { - "Return-Path:", L_MAIL - }, - { - "Cc:", L_MAIL - }, - { - "Newsgroups:", L_NEWS - }, - { - "Path:", L_NEWS - }, - { - "Organization:", L_NEWS - }, - { - NULL, 0 - } -}; - -#define NNAMES ((sizeof(names)/sizeof(struct names)) - 1) - -/* - * Result String List (RSL) - * - * The file(1) command prints its output. Instead, we store the various - * "printed" strings in a list (allocating memory as we go) and concatenate - * them at the end when we finally know how much space they'll need. - */ - -typedef struct magic_rsl_s { - char *str; /* string, possibly a fragment */ - struct magic_rsl_s *next; /* pointer to next fragment */ -} magic_rsl; - -/* - * Apache module configuration structures - */ - -/* per-server info */ -typedef struct { - char *magicfile; /* where magic be found */ - struct magic *magic; /* head of magic config list */ - struct magic *last; -} magic_server_config_rec; - -/* per-request info */ -typedef struct { - magic_rsl *head; /* result string list */ - magic_rsl *tail; - unsigned suf_recursion; /* recursion depth in suffix check */ -} magic_req_rec; - -/* - * configuration functions - called by Apache API routines - */ - -module mime_magic_module; - -static void *create_magic_server_config(pool *p, server_rec *d) -{ - /* allocate the config - use pcalloc because it needs to be zeroed */ - return ap_pcalloc(p, sizeof(magic_server_config_rec)); -} - -static void *merge_magic_server_config(pool *p, void *basev, void *addv) -{ - magic_server_config_rec *base = (magic_server_config_rec *) basev; - magic_server_config_rec *add = (magic_server_config_rec *) addv; - magic_server_config_rec *new = (magic_server_config_rec *) - ap_palloc(p, sizeof(magic_server_config_rec)); - - new->magicfile = add->magicfile ? add->magicfile : base->magicfile; - new->magic = NULL; - new->last = NULL; - return new; -} - -static const char *set_magicfile(cmd_parms *cmd, char *d, char *arg) -{ - magic_server_config_rec *conf = (magic_server_config_rec *) - ap_get_module_config(cmd->server->module_config, - &mime_magic_module); - - if (!conf) { - return MODNAME ": server structure not allocated"; - } - conf->magicfile = arg; - return NULL; -} - -/* - * configuration file commands - exported to Apache API - */ - -static const command_rec mime_magic_cmds[] = -{ - {"MimeMagicFile", set_magicfile, NULL, RSRC_CONF, TAKE1, - "Path to MIME Magic file (in file(1) format)"}, - {NULL} -}; - -/* - * RSL (result string list) processing routines - * - * These collect strings that would have been printed in fragments by file(1) - * into a list of magic_rsl structures with the strings. When complete, - * they're concatenated together to become the MIME content and encoding - * types. - * - * return value conventions for these functions: functions which return int: - * failure = -1, other = result functions which return pointers: failure = 0, - * other = result - */ - -/* allocate a per-request structure and put it in the request record */ -static magic_req_rec *magic_set_config(request_rec *r) -{ - magic_req_rec *req_dat = (magic_req_rec *) ap_palloc(r->pool, - sizeof(magic_req_rec)); - - req_dat->head = req_dat->tail = (magic_rsl *) NULL; - ap_set_module_config(r->request_config, &mime_magic_module, req_dat); - return req_dat; -} - -/* add a string to the result string list for this request */ -/* it is the responsibility of the caller to allocate "str" */ -static int magic_rsl_add(request_rec *r, char *str) -{ - magic_req_rec *req_dat = (magic_req_rec *) - ap_get_module_config(r->request_config, &mime_magic_module); - magic_rsl *rsl; - - /* make sure we have a list to put it in */ - if (!req_dat) { - ap_log_rerror(APLOG_MARK, APLOG_NOERRNO | APLOG_ERR, r, - MODNAME ": request config should not be NULL"); - if (!(req_dat = magic_set_config(r))) { - /* failure */ - return -1; - } - } - - /* allocate the list entry */ - rsl = (magic_rsl *) ap_palloc(r->pool, sizeof(magic_rsl)); - - /* fill it */ - rsl->str = str; - rsl->next = (magic_rsl *) NULL; - - /* append to the list */ - if (req_dat->head && req_dat->tail) { - req_dat->tail->next = rsl; - req_dat->tail = rsl; - } - else { - req_dat->head = req_dat->tail = rsl; - } - - /* success */ - return 0; -} - -/* RSL hook for puts-type functions */ -static int magic_rsl_puts(request_rec *r, char *str) -{ - return magic_rsl_add(r, str); -} - -/* RSL hook for printf-type functions */ -static int magic_rsl_printf(request_rec *r, char *str,...) -{ - va_list ap; - - char buf[MAXMIMESTRING]; - - /* assemble the string into the buffer */ - va_start(ap, str); - ap_vsnprintf(buf, sizeof(buf), str, ap); - va_end(ap); - - /* add the buffer to the list */ - return magic_rsl_add(r, strdup(buf)); -} - -/* RSL hook for putchar-type functions */ -static int magic_rsl_putchar(request_rec *r, char c) -{ - char str[2]; - - /* high overhead for 1 char - just hope they don't do this much */ - str[0] = c; - str[1] = '\0'; - return magic_rsl_add(r, str); -} - -/* allocate and copy a contiguous string from a result string list */ -static char *rsl_strdup(request_rec *r, int start_frag, int start_pos, int len) -{ - char *result; /* return value */ - int cur_frag, /* current fragment number/counter */ - cur_pos, /* current position within fragment */ - res_pos; /* position in result string */ - magic_rsl *frag; /* list-traversal pointer */ - magic_req_rec *req_dat = (magic_req_rec *) - ap_get_module_config(r->request_config, &mime_magic_module); - - /* allocate the result string */ - result = (char *) ap_palloc(r->pool, len + 1); - - /* loop through and collect the string */ - res_pos = 0; - for (frag = req_dat->head, cur_frag = 0; - frag->next; - frag = frag->next, cur_frag++) { - /* loop to the first fragment */ - if (cur_frag < start_frag) - continue; - - /* loop through and collect chars */ - for (cur_pos = (cur_frag == start_frag) ? start_pos : 0; - frag->str[cur_pos]; - cur_pos++) { - if (cur_frag >= start_frag - && cur_pos >= start_pos - && res_pos <= len) { - result[res_pos++] = frag->str[cur_pos]; - if (res_pos > len) { - break; - } - } - } - } - - /* clean up and return */ - result[res_pos] = 0; -#if MIME_MAGIC_DEBUG - ap_log_rerror(APLOG_MARK, APLOG_NOERRNO | APLOG_DEBUG, r, - MODNAME ": rsl_strdup() %d chars: %s", res_pos - 1, result); -#endif - return result; -} - -/* states for the state-machine algorithm in magic_rsl_to_request() */ -typedef enum { - rsl_leading_space, rsl_type, rsl_subtype, rsl_separator, rsl_encoding -} rsl_states; - -/* process the RSL and set the MIME info in the request record */ -static int magic_rsl_to_request(request_rec *r) -{ - int cur_frag, /* current fragment number/counter */ - cur_pos, /* current position within fragment */ - type_frag, /* content type starting point: fragment */ - type_pos, /* content type starting point: position */ - type_len, /* content type length */ - encoding_frag, /* content encoding starting point: fragment */ - encoding_pos, /* content encoding starting point: position */ - encoding_len; /* content encoding length */ - - magic_rsl *frag; /* list-traversal pointer */ - rsl_states state; - - magic_req_rec *req_dat = (magic_req_rec *) - ap_get_module_config(r->request_config, &mime_magic_module); - - /* check if we have a result */ - if (!req_dat || !req_dat->head) { - /* empty - no match, we defer to other Apache modules */ - return DECLINED; - } - - /* start searching for the type and encoding */ - state = rsl_leading_space; - type_frag = type_pos = type_len = 0; - encoding_frag = encoding_pos = encoding_len = 0; - for (frag = req_dat->head, cur_frag = 0; - frag && frag->next; - frag = frag->next, cur_frag++) { - /* loop through the characters in the fragment */ - for (cur_pos = 0; frag->str[cur_pos]; cur_pos++) { - if (ap_isspace(frag->str[cur_pos])) { - /* process whitespace actions for each state */ - if (state == rsl_leading_space) { - /* eat whitespace in this state */ - continue; - } - else if (state == rsl_type) { - /* whitespace: type has no slash! */ - return DECLINED; - } - else if (state == rsl_subtype) { - /* whitespace: end of MIME type */ - state++; - continue; - } - else if (state == rsl_separator) { - /* eat whitespace in this state */ - continue; - } - else if (state == rsl_encoding) { - /* whitespace: end of MIME encoding */ - /* we're done */ - frag = req_dat->tail; - break; - } - else { - /* should not be possible */ - /* abandon malfunctioning module */ - ap_log_rerror(APLOG_MARK, APLOG_NOERRNO | APLOG_ERR, r, - MODNAME ": bad state %d (ws)", state); - return DECLINED; - } - /* NOTREACHED */ - } - else if (state == rsl_type && - frag->str[cur_pos] == '/') { - /* copy the char and go to rsl_subtype state */ - type_len++; - state++; - } - else { - /* process non-space actions for each state */ - if (state == rsl_leading_space) { - /* non-space: begin MIME type */ - state++; - type_frag = cur_frag; - type_pos = cur_pos; - type_len = 1; - continue; - } - else if (state == rsl_type || - state == rsl_subtype) { - /* non-space: adds to type */ - type_len++; - continue; - } - else if (state == rsl_separator) { - /* non-space: begin MIME encoding */ - state++; - encoding_frag = cur_frag; - encoding_pos = cur_pos; - encoding_len = 1; - continue; - } - else if (state == rsl_encoding) { - /* non-space: adds to encoding */ - encoding_len++; - continue; - } - else { - /* should not be possible */ - /* abandon malfunctioning module */ - ap_log_rerror(APLOG_MARK, APLOG_NOERRNO | APLOG_ERR, r, - MODNAME ": bad state %d (ns)", state); - return DECLINED; - } - /* NOTREACHED */ - } - /* NOTREACHED */ - } - } - - /* if we ended prior to state rsl_subtype, we had incomplete info */ - if (state != rsl_subtype && state != rsl_separator && - state != rsl_encoding) { - /* defer to other modules */ - return DECLINED; - } - - /* save the info in the request record */ - if (state == rsl_subtype || state == rsl_encoding || - state == rsl_encoding) { - char *tmp; - tmp = rsl_strdup(r, type_frag, type_pos, type_len); - /* XXX: this could be done at config time I'm sure... but I'm - * confused by all this magic_rsl stuff. -djg */ - ap_content_type_tolower(tmp); - r->content_type = tmp; - } - if (state == rsl_encoding) { - char *tmp; - tmp = rsl_strdup(r, encoding_frag, - encoding_pos, encoding_len); - /* XXX: this could be done at config time I'm sure... but I'm - * confused by all this magic_rsl stuff. -djg */ - ap_str_tolower(tmp); - r->content_encoding = tmp; - } - - /* detect memory allocation errors */ - if (!r->content_type || - (state == rsl_encoding && !r->content_encoding)) { - return HTTP_INTERNAL_SERVER_ERROR; - } - - /* success! */ - return OK; -} - -/* - * magic_process - process input file r Apache API request record - * (formerly called "process" in file command, prefix added for clarity) Opens - * the file and reads a fixed-size buffer to begin processing the contents. - */ -static int magic_process(request_rec *r) -{ - int fd = 0; - unsigned char buf[HOWMANY + 1]; /* one extra for terminating '\0' */ - int nbytes = 0; /* number of bytes read from a datafile */ - int result; - - /* - * first try judging the file based on its filesystem status - */ - switch ((result = fsmagic(r, r->filename))) { - case DONE: - magic_rsl_putchar(r, '\n'); - return OK; - case OK: - break; - default: - /* fatal error, bail out */ - return result; - } - - if ((fd = ap_popenf(r->pool, r->filename, O_RDONLY, 0)) < 0) { - /* We can't open it, but we were able to stat it. */ - ap_log_rerror(APLOG_MARK, APLOG_ERR, r, - MODNAME ": can't read `%s'", r->filename); - /* let some other handler decide what the problem is */ - return DECLINED; - } - - /* - * try looking at the first HOWMANY bytes - */ - if ((nbytes = read(fd, (char *) buf, sizeof(buf) - 1)) == -1) { - ap_log_rerror(APLOG_MARK, APLOG_ERR, r, - MODNAME ": read failed: %s", r->filename); - return HTTP_INTERNAL_SERVER_ERROR; - } - - if (nbytes == 0) - magic_rsl_puts(r, MIME_TEXT_UNKNOWN); - else { - buf[nbytes++] = '\0'; /* null-terminate it */ - tryit(r, buf, nbytes, 1); - } - - (void) ap_pclosef(r->pool, fd); - (void) magic_rsl_putchar(r, '\n'); - - return OK; -} - - -static void tryit(request_rec *r, unsigned char *buf, int nb, int checkzmagic) -{ - /* - * Try compression stuff - */ - if (checkzmagic == 1) { - if (zmagic(r, buf, nb) == 1) - return; - } - - /* - * try tests in /etc/magic (or surrogate magic file) - */ - if (softmagic(r, buf, nb) == 1) - return; - - /* - * try known keywords, check for ascii-ness too. - */ - if (ascmagic(r, buf, nb) == 1) - return; - - /* - * abandon hope, all ye who remain here - */ - magic_rsl_puts(r, MIME_BINARY_UNKNOWN); -} - -#define EATAB {while (ap_isspace((unsigned char) *l)) ++l;} - -/* - * apprentice - load configuration from the magic file r - * API request record - */ -static int apprentice(server_rec *s, pool *p) -{ - FILE *f; - char line[BUFSIZ + 1]; - int errs = 0; - int lineno; -#if MIME_MAGIC_DEBUG - int rule = 0; - struct magic *m, *prevm; -#endif - char *fname; - - magic_server_config_rec *conf = (magic_server_config_rec *) - ap_get_module_config(s->module_config, &mime_magic_module); - - fname = ap_server_root_relative(p, conf->magicfile); - f = ap_pfopen(p, fname, "r"); - if (f == NULL) { - ap_log_error(APLOG_MARK, APLOG_ERR, s, - MODNAME ": can't read magic file %s", fname); - return -1; - } - - /* set up the magic list (empty) */ - conf->magic = conf->last = NULL; - - /* parse it */ - for (lineno = 1; fgets(line, BUFSIZ, f) != NULL; lineno++) { - int ws_offset; - - /* delete newline */ - if (line[0]) { - line[strlen(line) - 1] = '\0'; - } - - /* skip leading whitespace */ - ws_offset = 0; - while (line[ws_offset] && ap_isspace(line[ws_offset])) { - ws_offset++; - } - - /* skip blank lines */ - if (line[ws_offset] == 0) { - continue; - } - - /* comment, do not parse */ - if (line[ws_offset] == '#') - continue; - -#if MIME_MAGIC_DEBUG - /* if we get here, we're going to use it so count it */ - rule++; -#endif - - /* parse it */ - if (parse(s, p, line + ws_offset, lineno) != 0) - ++errs; - } - - (void) ap_pfclose(p, f); - -#if MIME_MAGIC_DEBUG - ap_log_error(APLOG_MARK, APLOG_NOERRNO | APLOG_DEBUG, s, - MODNAME ": apprentice conf=%x file=%s m=%s m->next=%s last=%s", - conf, - conf->magicfile ? conf->magicfile : "NULL", - conf->magic ? "set" : "NULL", - (conf->magic && conf->magic->next) ? "set" : "NULL", - conf->last ? "set" : "NULL"); - ap_log_error(APLOG_MARK, APLOG_NOERRNO | APLOG_DEBUG, s, - MODNAME ": apprentice read %d lines, %d rules, %d errors", - lineno, rule, errs); -#endif - -#if MIME_MAGIC_DEBUG - prevm = 0; - ap_log_error(APLOG_MARK, APLOG_NOERRNO | APLOG_DEBUG, s, - MODNAME ": apprentice test"); - for (m = conf->magic; m; m = m->next) { - if (ap_isprint((((unsigned long) m) >> 24) & 255) && - ap_isprint((((unsigned long) m) >> 16) & 255) && - ap_isprint((((unsigned long) m) >> 8) & 255) && - ap_isprint(((unsigned long) m) & 255)) { - ap_log_error(APLOG_MARK, APLOG_NOERRNO | APLOG_DEBUG, s, - MODNAME ": apprentice: POINTER CLOBBERED! " - "m=\"%c%c%c%c\" line=%d", - (((unsigned long) m) >> 24) & 255, - (((unsigned long) m) >> 16) & 255, - (((unsigned long) m) >> 8) & 255, - ((unsigned long) m) & 255, - prevm ? prevm->lineno : -1); - break; - } - prevm = m; - } -#endif - - return (errs ? -1 : 0); -} - -/* - * extend the sign bit if the comparison is to be signed - */ -static unsigned long signextend(server_rec *s, struct magic *m, unsigned long v) -{ - if (!(m->flag & UNSIGNED)) - switch (m->type) { - /* - * Do not remove the casts below. They are vital. When later - * compared with the data, the sign extension must have happened. - */ - case BYTE: - v = (char) v; - break; - case SHORT: - case BESHORT: - case LESHORT: - v = (short) v; - break; - case DATE: - case BEDATE: - case LEDATE: - case LONG: - case BELONG: - case LELONG: - v = (long) v; - break; - case STRING: - break; - default: - ap_log_error(APLOG_MARK, APLOG_NOERRNO | APLOG_ERR, s, - MODNAME ": can't happen: m->type=%d", m->type); - return -1; - } - return v; -} - -/* - * parse one line from magic file, put into magic[index++] if valid - */ -static int parse(server_rec *serv, pool *p, char *l, int lineno) -{ - struct magic *m; - char *t, *s; - magic_server_config_rec *conf = (magic_server_config_rec *) - ap_get_module_config(serv->module_config, &mime_magic_module); - - /* allocate magic structure entry */ - m = (struct magic *) ap_pcalloc(p, sizeof(struct magic)); - - /* append to linked list */ - m->next = NULL; - if (!conf->magic || !conf->last) { - conf->magic = conf->last = m; - } - else { - conf->last->next = m; - conf->last = m; - } - - /* set values in magic structure */ - m->flag = 0; - m->cont_level = 0; - m->lineno = lineno; - - while (*l == '>') { - ++l; /* step over */ - m->cont_level++; - } - - if (m->cont_level != 0 && *l == '(') { - ++l; /* step over */ - m->flag |= INDIR; - } - - /* get offset, then skip over it */ - m->offset = (int) strtol(l, &t, 0); - if (l == t) { - ap_log_error(APLOG_MARK, APLOG_NOERRNO | APLOG_ERR, serv, - MODNAME ": offset %s invalid", l); - } - l = t; - - if (m->flag & INDIR) { - m->in.type = LONG; - m->in.offset = 0; - /* - * read [.lbs][+-]nnnnn) - */ - if (*l == '.') { - switch (*++l) { - case 'l': - m->in.type = LONG; - break; - case 's': - m->in.type = SHORT; - break; - case 'b': - m->in.type = BYTE; - break; - default: - ap_log_error(APLOG_MARK, APLOG_NOERRNO | APLOG_ERR, serv, - MODNAME ": indirect offset type %c invalid", *l); - break; - } - l++; - } - s = l; - if (*l == '+' || *l == '-') - l++; - if (ap_isdigit((unsigned char) *l)) { - m->in.offset = strtol(l, &t, 0); - if (*s == '-') - m->in.offset = -m->in.offset; - } - else - t = l; - if (*t++ != ')') { - ap_log_error(APLOG_MARK, APLOG_NOERRNO | APLOG_ERR, serv, - MODNAME ": missing ')' in indirect offset"); - } - l = t; - } - - - while (ap_isdigit((unsigned char) *l)) - ++l; - EATAB; - -#define NBYTE 4 -#define NSHORT 5 -#define NLONG 4 -#define NSTRING 6 -#define NDATE 4 -#define NBESHORT 7 -#define NBELONG 6 -#define NBEDATE 6 -#define NLESHORT 7 -#define NLELONG 6 -#define NLEDATE 6 - - if (*l == 'u') { - ++l; - m->flag |= UNSIGNED; - } - - /* get type, skip it */ - if (strncmp(l, "byte", NBYTE) == 0) { - m->type = BYTE; - l += NBYTE; - } - else if (strncmp(l, "short", NSHORT) == 0) { - m->type = SHORT; - l += NSHORT; - } - else if (strncmp(l, "long", NLONG) == 0) { - m->type = LONG; - l += NLONG; - } - else if (strncmp(l, "string", NSTRING) == 0) { - m->type = STRING; - l += NSTRING; - } - else if (strncmp(l, "date", NDATE) == 0) { - m->type = DATE; - l += NDATE; - } - else if (strncmp(l, "beshort", NBESHORT) == 0) { - m->type = BESHORT; - l += NBESHORT; - } - else if (strncmp(l, "belong", NBELONG) == 0) { - m->type = BELONG; - l += NBELONG; - } - else if (strncmp(l, "bedate", NBEDATE) == 0) { - m->type = BEDATE; - l += NBEDATE; - } - else if (strncmp(l, "leshort", NLESHORT) == 0) { - m->type = LESHORT; - l += NLESHORT; - } - else if (strncmp(l, "lelong", NLELONG) == 0) { - m->type = LELONG; - l += NLELONG; - } - else if (strncmp(l, "ledate", NLEDATE) == 0) { - m->type = LEDATE; - l += NLEDATE; - } - else { - ap_log_error(APLOG_MARK, APLOG_NOERRNO | APLOG_ERR, serv, - MODNAME ": type %s invalid", l); - return -1; - } - /* New-style anding: "0 byte&0x80 =0x80 dynamically linked" */ - if (*l == '&') { - ++l; - m->mask = signextend(serv, m, strtol(l, &l, 0)); - } - else - m->mask = ~0L; - EATAB; - - switch (*l) { - case '>': - case '<': - /* Old-style anding: "0 byte &0x80 dynamically linked" */ - case '&': - case '^': - case '=': - m->reln = *l; - ++l; - break; - case '!': - if (m->type != STRING) { - m->reln = *l; - ++l; - break; - } - /* FALL THROUGH */ - default: - if (*l == 'x' && ap_isspace((unsigned char) l[1])) { - m->reln = *l; - ++l; - goto GetDesc; /* Bill The Cat */ - } - m->reln = '='; - break; - } - EATAB; - - if (getvalue(serv, m, &l)) - return -1; - /* - * now get last part - the description - */ - GetDesc: - EATAB; - if (l[0] == '\b') { - ++l; - m->nospflag = 1; - } - else if ((l[0] == '\\') && (l[1] == 'b')) { - ++l; - ++l; - m->nospflag = 1; - } - else - m->nospflag = 0; - strncpy(m->desc, l, sizeof(m->desc) - 1); - m->desc[sizeof(m->desc) - 1] = '\0'; - -#if MIME_MAGIC_DEBUG - ap_log_error(APLOG_MARK, APLOG_NOERRNO | APLOG_DEBUG, serv, - MODNAME ": parse line=%d m=%x next=%x cont=%d desc=%s", - lineno, m, m->next, m->cont_level, m->desc); -#endif /* MIME_MAGIC_DEBUG */ - - return 0; -} - -/* - * Read a numeric value from a pointer, into the value union of a magic - * pointer, according to the magic type. Update the string pointer to point - * just after the number read. Return 0 for success, non-zero for failure. - */ -static int getvalue(server_rec *s, struct magic *m, char **p) -{ - int slen; - - if (m->type == STRING) { - *p = getstr(s, *p, m->value.s, sizeof(m->value.s), &slen); - m->vallen = slen; - } - else if (m->reln != 'x') - m->value.l = signextend(s, m, strtol(*p, p, 0)); - return 0; -} - -/* - * Convert a string containing C character escapes. Stop at an unescaped - * space or tab. Copy the converted version to "p", returning its length in - * *slen. Return updated scan pointer as function result. - */ -static char *getstr(server_rec *serv, register char *s, register char *p, - int plen, int *slen) -{ - char *origs = s, *origp = p; - char *pmax = p + plen - 1; - register int c; - register int val; - - while ((c = *s++) != '\0') { - if (ap_isspace((unsigned char) c)) - break; - if (p >= pmax) { - ap_log_error(APLOG_MARK, APLOG_NOERRNO | APLOG_ERR, serv, - MODNAME ": string too long: %s", origs); - break; - } - if (c == '\\') { - switch (c = *s++) { - - case '\0': - goto out; - - default: - *p++ = (char) c; - break; - - case 'n': - *p++ = '\n'; - break; - - case 'r': - *p++ = '\r'; - break; - - case 'b': - *p++ = '\b'; - break; - - case 't': - *p++ = '\t'; - break; - - case 'f': - *p++ = '\f'; - break; - - case 'v': - *p++ = '\v'; - break; - - /* \ and up to 3 octal digits */ - case '0': - case '1': - case '2': - case '3': - case '4': - case '5': - case '6': - case '7': - val = c - '0'; - c = *s++; /* try for 2 */ - if (c >= '0' && c <= '7') { - val = (val << 3) | (c - '0'); - c = *s++; /* try for 3 */ - if (c >= '0' && c <= '7') - val = (val << 3) | (c - '0'); - else - --s; - } - else - --s; - *p++ = (char) val; - break; - - /* \x and up to 3 hex digits */ - case 'x': - val = 'x'; /* Default if no digits */ - c = hextoint(*s++); /* Get next char */ - if (c >= 0) { - val = c; - c = hextoint(*s++); - if (c >= 0) { - val = (val << 4) + c; - c = hextoint(*s++); - if (c >= 0) { - val = (val << 4) + c; - } - else - --s; - } - else - --s; - } - else - --s; - *p++ = (char) val; - break; - } - } - else - *p++ = (char) c; - } - out: - *p = '\0'; - *slen = p - origp; - return s; -} - - -/* Single hex char to int; -1 if not a hex char. */ -static int hextoint(int c) -{ - if (ap_isdigit((unsigned char) c)) - return c - '0'; - if ((c >= 'a') && (c <= 'f')) - return c + 10 - 'a'; - if ((c >= 'A') && (c <= 'F')) - return c + 10 - 'A'; - return -1; -} - - -/* - * return DONE to indicate it's been handled - * return OK to indicate it's a regular file still needing handling - * other returns indicate a failure of some sort - */ -static int fsmagic(request_rec *r, const char *fn) -{ - switch (r->finfo.st_mode & S_IFMT) { - case S_IFDIR: - magic_rsl_puts(r, DIR_MAGIC_TYPE); - return DONE; - case S_IFCHR: - /* - * (void) magic_rsl_printf(r,"character special (%d/%d)", - * major(sb->st_rdev), minor(sb->st_rdev)); - */ - (void) magic_rsl_puts(r, MIME_BINARY_UNKNOWN); - return DONE; -#ifdef S_IFBLK - case S_IFBLK: - /* - * (void) magic_rsl_printf(r,"block special (%d/%d)", - * major(sb->st_rdev), minor(sb->st_rdev)); - */ - (void) magic_rsl_puts(r, MIME_BINARY_UNKNOWN); - return DONE; - /* TODO add code to handle V7 MUX and Blit MUX files */ -#endif -#ifdef S_IFIFO - case S_IFIFO: - /* - * magic_rsl_puts(r,"fifo (named pipe)"); - */ - (void) magic_rsl_puts(r, MIME_BINARY_UNKNOWN); - return DONE; -#endif -#ifdef S_IFLNK - case S_IFLNK: - /* We used stat(), the only possible reason for this is that the - * symlink is broken. - */ - ap_log_rerror(APLOG_MARK, APLOG_NOERRNO | APLOG_ERR, r, - MODNAME ": broken symlink (%s)", fn); - return HTTP_INTERNAL_SERVER_ERROR; -#endif -#ifdef S_IFSOCK -#ifndef __COHERENT__ - case S_IFSOCK: - magic_rsl_puts(r, MIME_BINARY_UNKNOWN); - return DONE; -#endif -#endif - case S_IFREG: - break; - default: - ap_log_rerror(APLOG_MARK, APLOG_NOERRNO | APLOG_ERR, r, - MODNAME ": invalid mode 0%o.", (unsigned int)r->finfo.st_mode); - return HTTP_INTERNAL_SERVER_ERROR; - } - - /* - * regular file, check next possibility - */ - if (r->finfo.st_size == 0) { - magic_rsl_puts(r, MIME_TEXT_UNKNOWN); - return DONE; - } - return OK; -} - -/* - * softmagic - lookup one file in database (already read from /etc/magic by - * apprentice.c). Passed the name and FILE * of one file to be typed. - */ - /* ARGSUSED1 *//* nbytes passed for regularity, maybe need later */ -static int softmagic(request_rec *r, unsigned char *buf, int nbytes) -{ - if (match(r, buf, nbytes)) - return 1; - - return 0; -} - -/* - * Go through the whole list, stopping if you find a match. Process all the - * continuations of that match before returning. - * - * We support multi-level continuations: - * - * At any time when processing a successful top-level match, there is a current - * continuation level; it represents the level of the last successfully - * matched continuation. - * - * Continuations above that level are skipped as, if we see one, it means that - * the continuation that controls them - i.e, the lower-level continuation - * preceding them - failed to match. - * - * Continuations below that level are processed as, if we see one, it means - * we've finished processing or skipping higher-level continuations under the - * control of a successful or unsuccessful lower-level continuation, and are - * now seeing the next lower-level continuation and should process it. The - * current continuation level reverts to the level of the one we're seeing. - * - * Continuations at the current level are processed as, if we see one, there's - * no lower-level continuation that may have failed. - * - * If a continuation matches, we bump the current continuation level so that - * higher-level continuations are processed. - */ -static int match(request_rec *r, unsigned char *s, int nbytes) -{ -#if MIME_MAGIC_DEBUG - int rule_counter = 0; -#endif - int cont_level = 0; - int need_separator = 0; - union VALUETYPE p; - magic_server_config_rec *conf = (magic_server_config_rec *) - ap_get_module_config(r->server->module_config, &mime_magic_module); - struct magic *m; - -#if MIME_MAGIC_DEBUG - ap_log_rerror(APLOG_MARK, APLOG_NOERRNO | APLOG_DEBUG, r, - MODNAME ": match conf=%x file=%s m=%s m->next=%s last=%s", - conf, - conf->magicfile ? conf->magicfile : "NULL", - conf->magic ? "set" : "NULL", - (conf->magic && conf->magic->next) ? "set" : "NULL", - conf->last ? "set" : "NULL"); -#endif - -#if MIME_MAGIC_DEBUG - for (m = conf->magic; m; m = m->next) { - if (ap_isprint((((unsigned long) m) >> 24) & 255) && - ap_isprint((((unsigned long) m) >> 16) & 255) && - ap_isprint((((unsigned long) m) >> 8) & 255) && - ap_isprint(((unsigned long) m) & 255)) { - ap_log_rerror(APLOG_MARK, APLOG_NOERRNO | APLOG_DEBUG, r, - MODNAME ": match: POINTER CLOBBERED! " - "m=\"%c%c%c%c\"", - (((unsigned long) m) >> 24) & 255, - (((unsigned long) m) >> 16) & 255, - (((unsigned long) m) >> 8) & 255, - ((unsigned long) m) & 255); - break; - } - } -#endif - - for (m = conf->magic; m; m = m->next) { -#if MIME_MAGIC_DEBUG - rule_counter++; - ap_log_rerror(APLOG_MARK, APLOG_NOERRNO | APLOG_DEBUG, r, - MODNAME ": line=%d desc=%s", m->lineno, m->desc); -#endif - - /* check if main entry matches */ - if (!mget(r, &p, s, m, nbytes) || - !mcheck(r, &p, m)) { - struct magic *m_cont; - - /* - * main entry didn't match, flush its continuations - */ - if (!m->next || (m->next->cont_level == 0)) { - continue; - } - - m_cont = m->next; - while (m_cont && (m_cont->cont_level != 0)) { -#if MIME_MAGIC_DEBUG - rule_counter++; - ap_log_rerror(APLOG_MARK, APLOG_NOERRNO | APLOG_DEBUG, r, - MODNAME ": line=%d mc=%x mc->next=%x cont=%d desc=%s", - m_cont->lineno, m_cont, - m_cont->next, m_cont->cont_level, - m_cont->desc); -#endif - /* - * this trick allows us to keep *m in sync when the continue - * advances the pointer - */ - m = m_cont; - m_cont = m_cont->next; - } - continue; - } - - /* if we get here, the main entry rule was a match */ - /* this will be the last run through the loop */ -#if MIME_MAGIC_DEBUG - ap_log_rerror(APLOG_MARK, APLOG_NOERRNO | APLOG_DEBUG, r, - MODNAME ": rule matched, line=%d type=%d %s", - m->lineno, m->type, - (m->type == STRING) ? m->value.s : ""); -#endif - - /* print the match */ - mprint(r, &p, m); - - /* - * If we printed something, we'll need to print a blank before we - * print something else. - */ - if (m->desc[0]) - need_separator = 1; - /* and any continuations that match */ - cont_level++; - /* - * while (m && m->next && m->next->cont_level != 0 && ( m = m->next - * )) - */ - m = m->next; - while (m && (m->cont_level != 0)) { -#if MIME_MAGIC_DEBUG - ap_log_rerror(APLOG_MARK, APLOG_NOERRNO | APLOG_DEBUG, r, - MODNAME ": match line=%d cont=%d type=%d %s", - m->lineno, m->cont_level, m->type, - (m->type == STRING) ? m->value.s : ""); -#endif - if (cont_level >= m->cont_level) { - if (cont_level > m->cont_level) { - /* - * We're at the end of the level "cont_level" - * continuations. - */ - cont_level = m->cont_level; - } - if (mget(r, &p, s, m, nbytes) && - mcheck(r, &p, m)) { - /* - * This continuation matched. Print its message, with a - * blank before it if the previous item printed and this - * item isn't empty. - */ - /* space if previous printed */ - if (need_separator - && (m->nospflag == 0) - && (m->desc[0] != '\0') - ) { - (void) magic_rsl_putchar(r, ' '); - need_separator = 0; - } - mprint(r, &p, m); - if (m->desc[0]) - need_separator = 1; - - /* - * If we see any continuations at a higher level, process - * them. - */ - cont_level++; - } - } - - /* move to next continuation record */ - m = m->next; - } -#if MIME_MAGIC_DEBUG - ap_log_rerror(APLOG_MARK, APLOG_NOERRNO | APLOG_DEBUG, r, - MODNAME ": matched after %d rules", rule_counter); -#endif - return 1; /* all through */ - } -#if MIME_MAGIC_DEBUG - ap_log_rerror(APLOG_MARK, APLOG_NOERRNO | APLOG_DEBUG, r, - MODNAME ": failed after %d rules", rule_counter); -#endif - return 0; /* no match at all */ -} - -static void mprint(request_rec *r, union VALUETYPE *p, struct magic *m) -{ - char *pp, *rt; - unsigned long v; - - switch (m->type) { - case BYTE: - v = p->b; - break; - - case SHORT: - case BESHORT: - case LESHORT: - v = p->h; - break; - - case LONG: - case BELONG: - case LELONG: - v = p->l; - break; - - case STRING: - if (m->reln == '=') { - (void) magic_rsl_printf(r, m->desc, m->value.s); - } - else { - (void) magic_rsl_printf(r, m->desc, p->s); - } - return; - - case DATE: - case BEDATE: - case LEDATE: - /* XXX: not multithread safe */ - pp = ctime((time_t *) & p->l); - if ((rt = strchr(pp, '\n')) != NULL) - *rt = '\0'; - (void) magic_rsl_printf(r, m->desc, pp); - return; - default: - ap_log_rerror(APLOG_MARK, APLOG_NOERRNO | APLOG_ERR, r, - MODNAME ": invalid m->type (%d) in mprint().", - m->type); - return; - } - - v = signextend(r->server, m, v) & m->mask; - (void) magic_rsl_printf(r, m->desc, (unsigned long) v); -} - -/* - * Convert the byte order of the data we are looking at - */ -static int mconvert(request_rec *r, union VALUETYPE *p, struct magic *m) -{ - char *rt; - - switch (m->type) { - case BYTE: - case SHORT: - case LONG: - case DATE: - return 1; - case STRING: - /* Null terminate and eat the return */ - p->s[sizeof(p->s) - 1] = '\0'; - if ((rt = strchr(p->s, '\n')) != NULL) - *rt = '\0'; - return 1; - case BESHORT: - p->h = (short) ((p->hs[0] << 8) | (p->hs[1])); - return 1; - case BELONG: - case BEDATE: - p->l = (long) - ((p->hl[0] << 24) | (p->hl[1] << 16) | (p->hl[2] << 8) | (p->hl[3])); - return 1; - case LESHORT: - p->h = (short) ((p->hs[1] << 8) | (p->hs[0])); - return 1; - case LELONG: - case LEDATE: - p->l = (long) - ((p->hl[3] << 24) | (p->hl[2] << 16) | (p->hl[1] << 8) | (p->hl[0])); - return 1; - default: - ap_log_rerror(APLOG_MARK, APLOG_NOERRNO | APLOG_ERR, r, - MODNAME ": invalid type %d in mconvert().", m->type); - return 0; - } -} - - -static int mget(request_rec *r, union VALUETYPE *p, unsigned char *s, - struct magic *m, int nbytes) -{ - long offset = m->offset; - - if (offset + sizeof(union VALUETYPE) > nbytes) - return 0; - - memcpy(p, s + offset, sizeof(union VALUETYPE)); - - if (!mconvert(r, p, m)) - return 0; - - if (m->flag & INDIR) { - - switch (m->in.type) { - case BYTE: - offset = p->b + m->in.offset; - break; - case SHORT: - offset = p->h + m->in.offset; - break; - case LONG: - offset = p->l + m->in.offset; - break; - } - - if (offset + sizeof(union VALUETYPE) > nbytes) - return 0; - - memcpy(p, s + offset, sizeof(union VALUETYPE)); - - if (!mconvert(r, p, m)) - return 0; - } - return 1; -} - -static int mcheck(request_rec *r, union VALUETYPE *p, struct magic *m) -{ - register unsigned long l = m->value.l; - register unsigned long v; - int matched; - - if ((m->value.s[0] == 'x') && (m->value.s[1] == '\0')) { - ap_log_rerror(APLOG_MARK, APLOG_NOERRNO | APLOG_ERR, r, - MODNAME ": BOINK"); - return 1; - } - - switch (m->type) { - case BYTE: - v = p->b; - break; - - case SHORT: - case BESHORT: - case LESHORT: - v = p->h; - break; - - case LONG: - case BELONG: - case LELONG: - case DATE: - case BEDATE: - case LEDATE: - v = p->l; - break; - - case STRING: - l = 0; - /* - * What we want here is: v = strncmp(m->value.s, p->s, m->vallen); - * but ignoring any nulls. bcmp doesn't give -/+/0 and isn't - * universally available anyway. - */ - v = 0; - { - register unsigned char *a = (unsigned char *) m->value.s; - register unsigned char *b = (unsigned char *) p->s; - register int len = m->vallen; - - while (--len >= 0) - if ((v = *b++ - *a++) != 0) - break; - } - break; - default: - /* bogosity, pretend that it just wasn't a match */ - ap_log_rerror(APLOG_MARK, APLOG_NOERRNO | APLOG_ERR, r, - MODNAME ": invalid type %d in mcheck().", m->type); - return 0; - } - - v = signextend(r->server, m, v) & m->mask; - - switch (m->reln) { - case 'x': -#if MIME_MAGIC_DEBUG - ap_log_rerror(APLOG_MARK, APLOG_NOERRNO | APLOG_DEBUG, r, - "%lu == *any* = 1", v); -#endif - matched = 1; - break; - - case '!': - matched = v != l; -#if MIME_MAGIC_DEBUG - ap_log_rerror(APLOG_MARK, APLOG_NOERRNO | APLOG_DEBUG, r, - "%lu != %lu = %d", v, l, matched); -#endif - break; - - case '=': - matched = v == l; -#if MIME_MAGIC_DEBUG - ap_log_rerror(APLOG_MARK, APLOG_NOERRNO | APLOG_DEBUG, r, - "%lu == %lu = %d", v, l, matched); -#endif - break; - - case '>': - if (m->flag & UNSIGNED) { - matched = v > l; -#if MIME_MAGIC_DEBUG - ap_log_rerror(APLOG_MARK, APLOG_NOERRNO | APLOG_DEBUG, r, - "%lu > %lu = %d", v, l, matched); -#endif - } - else { - matched = (long) v > (long) l; -#if MIME_MAGIC_DEBUG - ap_log_rerror(APLOG_MARK, APLOG_NOERRNO | APLOG_DEBUG, r, - "%ld > %ld = %d", v, l, matched); -#endif - } - break; - - case '<': - if (m->flag & UNSIGNED) { - matched = v < l; -#if MIME_MAGIC_DEBUG - ap_log_rerror(APLOG_MARK, APLOG_NOERRNO | APLOG_DEBUG, r, - "%lu < %lu = %d", v, l, matched); -#endif - } - else { - matched = (long) v < (long) l; -#if MIME_MAGIC_DEBUG - ap_log_rerror(APLOG_MARK, APLOG_NOERRNO | APLOG_DEBUG, r, - "%ld < %ld = %d", v, l, matched); -#endif - } - break; - - case '&': - matched = (v & l) == l; -#if MIME_MAGIC_DEBUG - ap_log_rerror(APLOG_MARK, APLOG_NOERRNO | APLOG_DEBUG, r, - "((%lx & %lx) == %lx) = %d", v, l, l, matched); -#endif - break; - - case '^': - matched = (v & l) != l; -#if MIME_MAGIC_DEBUG - ap_log_rerror(APLOG_MARK, APLOG_NOERRNO | APLOG_DEBUG, r, - "((%lx & %lx) != %lx) = %d", v, l, l, matched); -#endif - break; - - default: - /* bogosity, pretend it didn't match */ - matched = 0; - ap_log_rerror(APLOG_MARK, APLOG_NOERRNO | APLOG_ERR, r, - MODNAME ": mcheck: can't happen: invalid relation %d.", - m->reln); - break; - } - - return matched; -} - -/* an optimization over plain strcmp() */ -#define STREQ(a, b) (*(a) == *(b) && strcmp((a), (b)) == 0) - -static int ascmagic(request_rec *r, unsigned char *buf, int nbytes) -{ - int has_escapes = 0; - unsigned char *s; - char nbuf[HOWMANY + 1]; /* one extra for terminating '\0' */ - char *token; - register struct names *p; - int small_nbytes; - - /* these are easy, do them first */ - - /* - * for troff, look for . + letter + letter or .\"; this must be done to - * disambiguate tar archives' ./file and other trash from real troff - * input. - */ - if (*buf == '.') { - unsigned char *tp = buf + 1; - - while (ap_isspace(*tp)) - ++tp; /* skip leading whitespace */ - if ((ap_isalnum(*tp) || *tp == '\\') && - (ap_isalnum(*(tp + 1)) || *tp == '"')) { - magic_rsl_puts(r, "application/x-troff"); - return 1; - } - } - if ((*buf == 'c' || *buf == 'C') && ap_isspace(*(buf + 1))) { - /* Fortran */ - magic_rsl_puts(r, "text/plain"); - return 1; - } - - /* look for tokens from names.h - this is expensive!, so we'll limit - * ourselves to only SMALL_HOWMANY bytes */ - small_nbytes = (nbytes > SMALL_HOWMANY) ? SMALL_HOWMANY : nbytes; - /* make a copy of the buffer here because strtok() will destroy it */ - s = (unsigned char *) memcpy(nbuf, buf, small_nbytes); - s[small_nbytes] = '\0'; - has_escapes = (memchr(s, '\033', small_nbytes) != NULL); - /* XXX: not multithread safe */ - while ((token = strtok((char *) s, " \t\n\r\f")) != NULL) { - s = NULL; /* make strtok() keep on tokin' */ - for (p = names; p < names + NNAMES; p++) { - if (STREQ(p->name, token)) { - magic_rsl_puts(r, types[p->type]); - if (has_escapes) - magic_rsl_puts(r, " (with escape sequences)"); - return 1; - } - } - } - - switch (is_tar(buf, nbytes)) { - case 1: - /* V7 tar archive */ - magic_rsl_puts(r, "application/x-tar"); - return 1; - case 2: - /* POSIX tar archive */ - magic_rsl_puts(r, "application/x-tar"); - return 1; - } - - /* all else fails, but it is ascii... */ - if (has_escapes) { - /* text with escape sequences */ - /* we leave this open for further differentiation later */ - magic_rsl_puts(r, "text/plain"); - } - else { - /* plain text */ - magic_rsl_puts(r, "text/plain"); - } - return 1; -} - - -/* - * compress routines: zmagic() - returns 0 if not recognized, uncompresses - * and prints information if recognized uncompress(s, method, old, n, newch) - * - uncompress old into new, using method, return sizeof new - */ - -static struct { - char *magic; - int maglen; - char *argv[3]; - int silent; - char *encoding; /* MUST be lowercase */ -} compr[] = { - - /* we use gzip here rather than uncompress because we have to pass - * it a full filename -- and uncompress only considers filenames - * ending with .Z - */ - { - "\037\235", 2, { - "gzip", "-dcq", NULL - }, 0, "x-compress" - }, - { - "\037\213", 2, { - "gzip", "-dcq", NULL - }, 1, "x-gzip" - }, - /* - * XXX pcat does not work, cause I don't know how to make it read stdin, - * so we use gzip - */ - { - "\037\036", 2, { - "gzip", "-dcq", NULL - }, 0, "x-gzip" - }, -}; - -static int ncompr = sizeof(compr) / sizeof(compr[0]); - -static int zmagic(request_rec *r, unsigned char *buf, int nbytes) -{ - unsigned char *newbuf; - int newsize; - int i; - - for (i = 0; i < ncompr; i++) { - if (nbytes < compr[i].maglen) - continue; - if (memcmp(buf, compr[i].magic, compr[i].maglen) == 0) - break; - } - - if (i == ncompr) - return 0; - - if ((newsize = uncompress(r, i, &newbuf, nbytes)) > 0) { - tryit(r, newbuf, newsize, 0); - - /* set encoding type in the request record */ - r->content_encoding = compr[i].encoding; - } - return 1; -} - - -struct uncompress_parms { - request_rec *r; - int method; -}; - -static int uncompress_child(void *data, child_info *pinfo) -{ - struct uncompress_parms *parm = data; - char *new_argv[4]; - - new_argv[0] = compr[parm->method].argv[0]; - new_argv[1] = compr[parm->method].argv[1]; - new_argv[2] = parm->r->filename; - new_argv[3] = NULL; - -#if defined(WIN32) - int child_pid; -#endif - - if (compr[parm->method].silent) { - close(STDERR_FILENO); - } - -#if defined(WIN32) - child_pid = spawnvp(compr[parm->method].argv[0], - new_argv); - return (child_pid); -#else - execvp(compr[parm->method].argv[0], new_argv); - ap_log_rerror(APLOG_MARK, APLOG_ERR, parm->r, - MODNAME ": could not execute `%s'.", - compr[parm->method].argv[0]); - return -1; -#endif -} - - -static int uncompress(request_rec *r, int method, - unsigned char **newch, int n) -{ - struct uncompress_parms parm; - BUFF *bout; - pool *sub_pool; - - parm.r = r; - parm.method = method; - - /* We make a sub_pool so that we can collect our child early, otherwise - * there are cases (i.e. generating directory indicies with mod_autoindex) - * where we would end up with LOTS of zombies. - */ - sub_pool = ap_make_sub_pool(r->pool); - - if (!ap_bspawn_child(sub_pool, uncompress_child, &parm, kill_always, - NULL, &bout, NULL)) { - ap_log_rerror(APLOG_MARK, APLOG_ERR, r, - MODNAME ": couldn't spawn uncompress process: %s", r->uri); - return -1; - } - - *newch = (unsigned char *) ap_palloc(r->pool, n); - if ((n = ap_bread(bout, *newch, n)) <= 0) { - ap_destroy_pool(sub_pool); - ap_log_rerror(APLOG_MARK, APLOG_ERR, r, - MODNAME ": read failed %s", r->filename); - return -1; - } - ap_destroy_pool(sub_pool); - return n; -} - -/* - * is_tar() -- figure out whether file is a tar archive. - * - * Stolen (by author of file utility) from the public domain tar program: Public - * Domain version written 26 Aug 1985 John Gilmore (ihnp4!hoptoad!gnu). - * - * @(#)list.c 1.18 9/23/86 Public Domain - gnu $Id: mod_mime_magic.c,v 1.7 - * 1997/06/24 00:41:02 ikluft Exp ikluft $ - * - * Comments changed and some code/comments reformatted for file command by Ian - * Darwin. - */ - -#define isodigit(c) ( ((c) >= '0') && ((c) <= '7') ) - -/* - * Return 0 if the checksum is bad (i.e., probably not a tar archive), 1 for - * old UNIX tar file, 2 for Unix Std (POSIX) tar file. - */ - -static int is_tar(unsigned char *buf, int nbytes) -{ - register union record *header = (union record *) buf; - register int i; - register long sum, recsum; - register char *p; - - if (nbytes < sizeof(union record)) - return 0; - - recsum = from_oct(8, header->header.chksum); - - sum = 0; - p = header->charptr; - for (i = sizeof(union record); --i >= 0;) { - /* - * We can't use unsigned char here because of old compilers, e.g. V7. - */ - sum += 0xFF & *p++; - } - - /* Adjust checksum to count the "chksum" field as blanks. */ - for (i = sizeof(header->header.chksum); --i >= 0;) - sum -= 0xFF & header->header.chksum[i]; - sum += ' ' * sizeof header->header.chksum; - - if (sum != recsum) - return 0; /* Not a tar archive */ - - if (0 == strcmp(header->header.magic, TMAGIC)) - return 2; /* Unix Standard tar archive */ - - return 1; /* Old fashioned tar archive */ -} - - -/* - * Quick and dirty octal conversion. - * - * Result is -1 if the field is invalid (all blank, or nonoctal). - */ -static long from_oct(int digs, char *where) -{ - register long value; - - while (ap_isspace(*where)) { /* Skip spaces */ - where++; - if (--digs <= 0) - return -1; /* All blank field */ - } - value = 0; - while (digs > 0 && isodigit(*where)) { /* Scan til nonoctal */ - value = (value << 3) | (*where++ - '0'); - --digs; - } - - if (digs > 0 && *where && !ap_isspace(*where)) - return -1; /* Ended on non-space/nul */ - - return value; -} - -/* - * Check for file-revision suffix - * - * This is for an obscure document control system used on an intranet. - * The web representation of each file's revision has an @1, @2, etc - * appended with the revision number. This needs to be stripped off to - * find the file suffix, which can be recognized by sending the name back - * through a sub-request. The base file name (without the @num suffix) - * must exist because its type will be used as the result. - */ -static int revision_suffix(request_rec *r) -{ - int suffix_pos, result; - char *sub_filename; - request_rec *sub; - -#if MIME_MAGIC_DEBUG - ap_log_rerror(APLOG_MARK, APLOG_NOERRNO | APLOG_DEBUG, r, - MODNAME ": revision_suffix checking %s", r->filename); -#endif /* MIME_MAGIC_DEBUG */ - - /* check for recognized revision suffix */ - suffix_pos = strlen(r->filename) - 1; - if (!ap_isdigit(r->filename[suffix_pos])) { - return 0; - } - while (suffix_pos >= 0 && ap_isdigit(r->filename[suffix_pos])) - suffix_pos--; - if (suffix_pos < 0 || r->filename[suffix_pos] != '@') { - return 0; - } - - /* perform sub-request for the file name without the suffix */ - result = 0; - sub_filename = ap_pstrndup(r->pool, r->filename, suffix_pos); -#if MIME_MAGIC_DEBUG - ap_log_rerror(APLOG_MARK, APLOG_NOERRNO | APLOG_DEBUG, r, - MODNAME ": subrequest lookup for %s", sub_filename); -#endif /* MIME_MAGIC_DEBUG */ - sub = ap_sub_req_lookup_file(sub_filename, r); - - /* extract content type/encoding/language from sub-request */ - if (sub->content_type) { - r->content_type = ap_pstrdup(r->pool, sub->content_type); -#if MIME_MAGIC_DEBUG - ap_log_rerror(APLOG_MARK, APLOG_NOERRNO | APLOG_DEBUG, r, - MODNAME ": subrequest %s got %s", - sub_filename, r->content_type); -#endif /* MIME_MAGIC_DEBUG */ - if (sub->content_encoding) - r->content_encoding = - ap_pstrdup(r->pool, sub->content_encoding); - if (sub->content_language) - r->content_language = - ap_pstrdup(r->pool, sub->content_language); - result = 1; - } - - /* clean up */ - ap_destroy_sub_req(sub); - - return result; -} - -/* - * initialize the module - */ - -static void magic_init(server_rec *main_server, pool *p) -{ - int result; - magic_server_config_rec *conf; - magic_server_config_rec *main_conf; - server_rec *s; -#if MIME_MAGIC_DEBUG - struct magic *m, *prevm; -#endif /* MIME_MAGIC_DEBUG */ - - main_conf = ap_get_module_config(main_server->module_config, &mime_magic_module); - for (s = main_server; s; s = s->next) { - conf = ap_get_module_config(s->module_config, &mime_magic_module); - if (conf->magicfile == NULL && s != main_server) { - /* inherits from the parent */ - *conf = *main_conf; - } - else if (conf->magicfile) { - result = apprentice(s, p); - if (result == -1) - return; -#if MIME_MAGIC_DEBUG - prevm = 0; - ap_log_error(APLOG_MARK, APLOG_NOERRNO | APLOG_DEBUG, s, - MODNAME ": magic_init 1 test"); - for (m = conf->magic; m; m = m->next) { - if (ap_isprint((((unsigned long) m) >> 24) & 255) && - ap_isprint((((unsigned long) m) >> 16) & 255) && - ap_isprint((((unsigned long) m) >> 8) & 255) && - ap_isprint(((unsigned long) m) & 255)) { - ap_log_error(APLOG_MARK, APLOG_NOERRNO | APLOG_DEBUG, s, - MODNAME ": magic_init 1: POINTER CLOBBERED! " - "m=\"%c%c%c%c\" line=%d", - (((unsigned long) m) >> 24) & 255, - (((unsigned long) m) >> 16) & 255, - (((unsigned long) m) >> 8) & 255, - ((unsigned long) m) & 255, - prevm ? prevm->lineno : -1); - break; - } - prevm = m; - } -#endif - } - } -} - -/* - * Find the Content-Type from any resource this module has available - */ - -static int magic_find_ct(request_rec *r) -{ - int result; - magic_server_config_rec *conf; - - /* the file has to exist */ - if (r->finfo.st_mode == 0 || !r->filename) { - return DECLINED; - } - - /* was someone else already here? */ - if (r->content_type) { - return DECLINED; - } - - conf = ap_get_module_config(r->server->module_config, &mime_magic_module); - if (!conf || !conf->magic) { - return DECLINED; - } - - /* initialize per-request info */ - if (!magic_set_config(r)) { - return HTTP_INTERNAL_SERVER_ERROR; - } - - /* try excluding file-revision suffixes */ - if (revision_suffix(r) != 1) { - /* process it based on the file contents */ - if ((result = magic_process(r)) != OK) { - return result; - } - } - - /* if we have any results, put them in the request structure */ - return magic_rsl_to_request(r); -} - -/* - * Apache API module interface - */ - -module mime_magic_module = -{ - STANDARD_MODULE_STUFF, - magic_init, /* initializer */ - NULL, /* dir config creator */ - NULL, /* dir merger --- default is to override */ - create_magic_server_config, /* server config */ - merge_magic_server_config, /* merge server config */ - mime_magic_cmds, /* command table */ - NULL, /* handlers */ - NULL, /* filename translation */ - NULL, /* check_user_id */ - NULL, /* check auth */ - NULL, /* check access */ - magic_find_ct, /* type_checker */ - NULL, /* fixups */ - NULL, /* logger */ - NULL, /* header parser */ - NULL, /* child_init */ - NULL, /* child_exit */ - NULL /* post read-request */ -}; diff --git a/modules/metadata/mod_mime_magic.dsp b/modules/metadata/mod_mime_magic.dsp deleted file mode 100644 index f831ae4ec87e11fdc28d018299409692e947b722..0000000000000000000000000000000000000000 --- a/modules/metadata/mod_mime_magic.dsp +++ /dev/null @@ -1,128 +0,0 @@ -# Microsoft Developer Studio Project File - Name="mod_mime_magic" - Package Owner=<4> -# Microsoft Developer Studio Generated Build File, Format Version 6.00 -# ** DO NOT EDIT ** - -# TARGTYPE "Win32 (x86) Dynamic-Link Library" 0x0102 - -CFG=mod_mime_magic - Win32 Release -!MESSAGE This is not a valid makefile. To build this project using NMAKE, -!MESSAGE use the Export Makefile command and run -!MESSAGE -!MESSAGE NMAKE /f "mod_mime_magic.mak". -!MESSAGE -!MESSAGE You can specify a configuration when running NMAKE -!MESSAGE by defining the macro CFG on the command line. For example: -!MESSAGE -!MESSAGE NMAKE /f "mod_mime_magic.mak" CFG="mod_mime_magic - Win32 Release" -!MESSAGE -!MESSAGE Possible choices for configuration are: -!MESSAGE -!MESSAGE "mod_mime_magic - Win32 Release" (based on "Win32 (x86) Dynamic-Link Library") -!MESSAGE "mod_mime_magic - Win32 Debug" (based on "Win32 (x86) Dynamic-Link Library") -!MESSAGE - -# Begin Project -# PROP AllowPerConfigDependencies 0 -# PROP Scc_ProjName "" -# PROP Scc_LocalPath "" -CPP=cl.exe -MTL=midl.exe -RSC=rc.exe - -!IF "$(CFG)" == "mod_mime_magic - Win32 Release" - -# PROP BASE Use_MFC 0 -# PROP BASE Use_Debug_Libraries 0 -# PROP BASE Output_Dir "Release" -# PROP BASE Intermediate_Dir "Release" -# PROP BASE Target_Dir "" -# PROP Use_MFC 0 -# PROP Use_Debug_Libraries 0 -# PROP Output_Dir "Release" -# PROP Intermediate_Dir "Release" -# PROP Ignore_Export_Lib 0 -# PROP Target_Dir "" -# ADD BASE CPP /nologo /MD /W3 /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /FD /c -# ADD CPP /nologo /MD /W3 /O2 /I "..\..\include" /I "..\..\os\win32" /I "..\..\srclib\apr\include" /I "../../srclib/apr-util/include" /D "NDEBUG" /D "WIN32" /D "_WINDOWS" /Fd"Release\mod_mime_magic" /FD /c -# ADD BASE MTL /nologo /D "NDEBUG" /win32 -# ADD MTL /nologo /D "NDEBUG" /mktyplib203 /win32 -# ADD BASE RSC /l 0x409 /d "NDEBUG" -# ADD RSC /l 0x409 /d "NDEBUG" -BSC32=bscmake.exe -# ADD BASE BSC32 /nologo -# ADD BSC32 /nologo -LINK32=link.exe -# ADD BASE LINK32 kernel32.lib ws2_32.lib /nologo /subsystem:windows /dll /map /machine:I386 /out:"Release/mod_mime_magic.so" /base:@..\..\os\win32\BaseAddr.ref,mod_mime_magic -# ADD LINK32 kernel32.lib ws2_32.lib /nologo /subsystem:windows /dll /map /machine:I386 /out:"Release/mod_mime_magic.so" /base:@..\..\os\win32\BaseAddr.ref,mod_mime_magic - -!ELSEIF "$(CFG)" == "mod_mime_magic - Win32 Debug" - -# PROP BASE Use_MFC 0 -# PROP BASE Use_Debug_Libraries 1 -# PROP BASE Output_Dir "Debug" -# PROP BASE Intermediate_Dir "Debug" -# PROP BASE Target_Dir "" -# PROP Use_MFC 0 -# PROP Use_Debug_Libraries 1 -# PROP Output_Dir "Debug" -# PROP Intermediate_Dir "Debug" -# PROP Ignore_Export_Lib 0 -# PROP Target_Dir "" -# ADD BASE CPP /nologo /MDd /W3 /GX /Zi /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /FD /c -# ADD CPP /nologo /MDd /W3 /GX /Zi /Od /I "..\..\include" /I "..\..\os\win32" /I "..\..\srclib\apr\include" /I "../../srclib/apr-util/include" /D "_DEBUG" /D "WIN32" /D "_WINDOWS" /Fd"Debug\mod_mime_magic" /FD /c -# ADD BASE MTL /nologo /D "_DEBUG" /win32 -# ADD MTL /nologo /D "_DEBUG" /mktyplib203 /win32 -# ADD BASE RSC /l 0x409 /d "_DEBUG" -# ADD RSC /l 0x409 /d "_DEBUG" -BSC32=bscmake.exe -# ADD BASE BSC32 /nologo -# ADD BSC32 /nologo -LINK32=link.exe -# ADD BASE LINK32 kernel32.lib ws2_32.lib /nologo /subsystem:windows /dll /incremental:no /map /debug /machine:I386 /out:"Debug/mod_mime_magic.so" /base:@..\..\os\win32\BaseAddr.ref,mod_mime_magic -# ADD LINK32 kernel32.lib ws2_32.lib /nologo /subsystem:windows /dll /incremental:no /map /debug /machine:I386 /out:"Debug/mod_mime_magic.so" /base:@..\..\os\win32\BaseAddr.ref,mod_mime_magic - -!ENDIF - -# Begin Target - -# Name "mod_mime_magic - Win32 Release" -# Name "mod_mime_magic - Win32 Debug" -# Begin Source File - -SOURCE=.\mod_mime_magic.c -# End Source File -# Begin Source File - -SOURCE=.\mod_mime_magic.rc -# End Source File -# Begin Source File - -SOURCE=..\..\build\win32\win32ver.awk - -!IF "$(CFG)" == "mod_mime_magic - Win32 Release" - -# PROP Ignore_Default_Tool 1 -# Begin Custom Build - Creating Version Resource -InputPath=..\..\build\win32\win32ver.awk - -".\mod_mime_magic.rc" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)" - awk -f ../../build/win32/win32ver.awk mod_mime_magic "mime_magic_module for Apache" ../../include/ap_release.h > .\mod_mime_magic.rc - -# End Custom Build - -!ELSEIF "$(CFG)" == "mod_mime_magic - Win32 Debug" - -# PROP Ignore_Default_Tool 1 -# Begin Custom Build - Creating Version Resource -InputPath=..\..\build\win32\win32ver.awk - -".\mod_mime_magic.rc" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)" - awk -f ../../build/win32/win32ver.awk mod_mime_magic "mime_magic_module for Apache" ../../include/ap_release.h > .\mod_mime_magic.rc - -# End Custom Build - -!ENDIF - -# End Source File -# End Target -# End Project diff --git a/modules/metadata/mod_mime_magic.exp b/modules/metadata/mod_mime_magic.exp deleted file mode 100644 index 42068a4342700c8fc1f5d36ba91e898389e940c9..0000000000000000000000000000000000000000 --- a/modules/metadata/mod_mime_magic.exp +++ /dev/null @@ -1 +0,0 @@ -mime_magic_module diff --git a/modules/metadata/mod_setenvif.c b/modules/metadata/mod_setenvif.c deleted file mode 100644 index 27eef0aec94a317a4db7428008b902e1e808cfbf..0000000000000000000000000000000000000000 --- a/modules/metadata/mod_setenvif.c +++ /dev/null @@ -1,423 +0,0 @@ -/* ==================================================================== - * Copyright (c) 1996-1999 The Apache Group. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in - * the documentation and/or other materials provided with the - * distribution. - * - * 3. All advertising materials mentioning features or use of this - * software must display the following acknowledgment: - * "This product includes software developed by the Apache Group - * for use in the Apache HTTP server project (http://www.apache.org/)." - * - * 4. The names "Apache Server" and "Apache Group" must not be used to - * endorse or promote products derived from this software without - * prior written permission. For written permission, please contact - * apache@apache.org. - * - * 5. Products derived from this software may not be called "Apache" - * nor may "Apache" appear in their names without prior written - * permission of the Apache Group. - * - * 6. Redistributions of any form whatsoever must retain the following - * acknowledgment: - * "This product includes software developed by the Apache Group - * for use in the Apache HTTP server project (http://www.apache.org/)." - * - * THIS SOFTWARE IS PROVIDED BY THE APACHE GROUP ``AS IS'' AND ANY - * EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR - * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE APACHE GROUP OR - * IT'S CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT - * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, - * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED - * OF THE POSSIBILITY OF SUCH DAMAGE. - * ==================================================================== - * - * This software consists of voluntary contributions made by many - * individuals on behalf of the Apache Group and was originally based - * on public domain software written at the National Center for - * Supercomputing Applications, University of Illinois, Urbana-Champaign. - * For more information on the Apache Group and the Apache HTTP server - * project, please see <http://www.apache.org/>. - * - */ - -/* - * mod_setenvif.c - * Set environment variables based on matching request headers or - * attributes against regex strings - * - * Paul Sutton <paul@ukweb.com> 27 Oct 1996 - * Based on mod_browser by Alexei Kosut <akosut@organic.com> - */ - -/* - * Used to set environment variables based on the incoming request headers, - * or some selected other attributes of the request (e.g., the remote host - * name). - * - * Usage: - * - * SetEnvIf name regex var ... - * - * where name is either a HTTP request header name, or one of the - * special values (see below). The 'value' of the header (or the - * value of the special value from below) are compared against the - * regex argument. If this is a simple string, a simple sub-string - * match is performed. Otherwise, a request expression match is - * done. If the value matches the string or regular expression, the - * environment variables listed as var ... are set. Each var can - * be in one of three formats: var, which sets the named variable - * (the value value "1"); var=value, which sets the variable to - * the given value; or !var, which unsets the variable is it has - * been previously set. - * - * Normally the strings are compared with regard to case. To ignore - * case, use the directive SetEnvIfNoCase instead. - * - * Special values for 'name' are: - * - * remote_host Remote host name (if available) - * remote_addr Remote IP address - * remote_user Remote authenticated user (if any) - * request_method Request method (GET, POST, etc) - * request_uri Requested URI - * - * Examples: - * - * To set the enviroment variable LOCALHOST if the client is the local - * machine: - * - * SetEnvIf remote_addr 127.0.0.1 LOCALHOST - * - * To set LOCAL if the client is the local host, or within our company's - * domain (192.168.10): - * - * SetEnvIf remote_addr 192.168.10. LOCAL - * SetEnvIf remote_addr 127.0.0.1 LOCALHOST - * - * This could be written as: - * - * SetEnvIf remote_addr (127.0.0.1|192.168.10.) LOCAL - */ - -#include "httpd.h" -#include "http_config.h" -#include "http_core.h" -#include "http_log.h" - -enum special { - SPECIAL_NOT, - SPECIAL_REMOTE_ADDR, - SPECIAL_REMOTE_HOST, - SPECIAL_REMOTE_USER, - SPECIAL_REQUEST_URI, - SPECIAL_REQUEST_METHOD, - SPECIAL_REQUEST_PROTOCOL -}; -typedef struct { - char *name; /* header name */ - char *regex; /* regex to match against */ - regex_t *preg; /* compiled regex */ - table *features; /* env vars to set (or unset) */ - ENUM_BITFIELD( /* is it a "special" header ? */ - enum special, - special_type,4); - unsigned icase : 1; /* ignoring case? */ -} sei_entry; - -typedef struct { - array_header *conditionals; -} sei_cfg_rec; - -module MODULE_VAR_EXPORT setenvif_module; - -static void *create_setenvif_config(pool *p, server_rec *dummy) -{ - sei_cfg_rec *new = (sei_cfg_rec *) ap_palloc(p, sizeof(sei_cfg_rec)); - - new->conditionals = ap_make_array(p, 20, sizeof(sei_entry)); - return (void *) new; -} - -static void *merge_setenvif_config(pool *p, void *basev, void *overridesv) -{ - sei_cfg_rec *a = ap_pcalloc(p, sizeof(sei_cfg_rec)); - sei_cfg_rec *base = basev, *overrides = overridesv; - - a->conditionals = ap_append_arrays(p, base->conditionals, - overrides->conditionals); - return a; -} - -/* any non-NULL magic constant will do... used to indicate if REG_ICASE should - * be used - */ -#define ICASE_MAGIC ((void *)(&setenvif_module)) - -static const char *add_setenvif_core(cmd_parms *cmd, void *mconfig, - char *fname, const char *args) -{ - char *regex; - const char *feature; - sei_cfg_rec *sconf = ap_get_module_config(cmd->server->module_config, - &setenvif_module); - sei_entry *new, *entries = (sei_entry *) sconf->conditionals->elts; - char *var; - int i; - int beenhere = 0; - unsigned icase; - - /* get regex */ - regex = ap_getword_conf(cmd->pool, &args); - if (!*regex) { - return ap_pstrcat(cmd->pool, "Missing regular expression for ", - cmd->cmd->name, NULL); - } - - /* - * If we've already got a sei_entry with the same name we want to - * just copy the name pointer... so that later on we can compare - * two header names just by comparing the pointers. - */ - - for (i = 0; i < sconf->conditionals->nelts; ++i) { - new = &entries[i]; - if (!strcasecmp(new->name, fname)) { - fname = new->name; - break; - } - } - - /* if the last entry has an idential headername and regex then - * merge with it - */ - i = sconf->conditionals->nelts - 1; - icase = cmd->info == ICASE_MAGIC; - if (i < 0 - || entries[i].name != fname - || entries[i].icase != icase - || strcmp(entries[i].regex, regex)) { - - /* no match, create a new entry */ - - new = ap_push_array(sconf->conditionals); - new->name = fname; - new->regex = regex; - new->icase = icase; - new->preg = ap_pregcomp(cmd->pool, regex, - (REG_EXTENDED | REG_NOSUB - | (icase ? REG_ICASE : 0))); - if (new->preg == NULL) { - return ap_pstrcat(cmd->pool, cmd->cmd->name, - " regex could not be compiled.", NULL); - } - new->features = ap_make_table(cmd->pool, 2); - - if (!strcasecmp(fname, "remote_addr")) { - new->special_type = SPECIAL_REMOTE_ADDR; - } - else if (!strcasecmp(fname, "remote_host")) { - new->special_type = SPECIAL_REMOTE_HOST; - } - else if (!strcasecmp(fname, "remote_user")) { - new->special_type = SPECIAL_REMOTE_USER; - } - else if (!strcasecmp(fname, "request_uri")) { - new->special_type = SPECIAL_REQUEST_URI; - } - else if (!strcasecmp(fname, "request_method")) { - new->special_type = SPECIAL_REQUEST_METHOD; - } - else if (!strcasecmp(fname, "request_protocol")) { - new->special_type = SPECIAL_REQUEST_PROTOCOL; - } - else { - new->special_type = SPECIAL_NOT; - } - } - else { - new = &entries[i]; - } - - for ( ; ; ) { - feature = ap_getword_conf(cmd->pool, &args); - if (!*feature) { - break; - } - beenhere++; - - var = ap_getword(cmd->pool, &feature, '='); - if (*feature) { - ap_table_setn(new->features, var, feature); - } - else if (*var == '!') { - ap_table_setn(new->features, var + 1, "!"); - } - else { - ap_table_setn(new->features, var, "1"); - } - } - - if (!beenhere) { - return ap_pstrcat(cmd->pool, "Missing envariable expression for ", - cmd->cmd->name, NULL); - } - - return NULL; -} - -static const char *add_setenvif(cmd_parms *cmd, void *mconfig, - const char *args) -{ - char *fname; - - /* get header name */ - fname = ap_getword_conf(cmd->pool, &args); - if (!*fname) { - return ap_pstrcat(cmd->pool, "Missing header-field name for ", - cmd->cmd->name, NULL); - } - return add_setenvif_core(cmd, mconfig, fname, args); -} - -/* - * This routine handles the BrowserMatch* directives. It simply turns around - * and feeds them, with the appropriate embellishments, to the general-purpose - * command handler. - */ -static const char *add_browser(cmd_parms *cmd, void *mconfig, const char *args) -{ - return add_setenvif_core(cmd, mconfig, "User-Agent", args); -} - -static const command_rec setenvif_module_cmds[] = -{ - { "SetEnvIf", add_setenvif, NULL, - RSRC_CONF, RAW_ARGS, "A header-name, regex and a list of variables." }, - { "SetEnvIfNoCase", add_setenvif, ICASE_MAGIC, - RSRC_CONF, RAW_ARGS, "a header-name, regex and a list of variables." }, - { "BrowserMatch", add_browser, NULL, - RSRC_CONF, RAW_ARGS, "A browser regex and a list of variables." }, - { "BrowserMatchNoCase", add_browser, ICASE_MAGIC, - RSRC_CONF, RAW_ARGS, "A browser regex and a list of variables." }, - { NULL }, -}; - -static int match_headers(request_rec *r) -{ - server_rec *s = r->server; - sei_cfg_rec *sconf; - sei_entry *entries; - table_entry *elts; - const char *val; - int i, j; - char *last_name; - - sconf = (sei_cfg_rec *) ap_get_module_config(s->module_config, - &setenvif_module); - entries = (sei_entry *) sconf->conditionals->elts; - last_name = NULL; - val = NULL; - for (i = 0; i < sconf->conditionals->nelts; ++i) { - sei_entry *b = &entries[i]; - - /* Optimize the case where a bunch of directives in a row use the - * same header. Remember we don't need to strcmp the two header - * names because we made sure the pointers were equal during - * configuration. - */ - if (b->name != last_name) { - last_name = b->name; - switch (b->special_type) { - case SPECIAL_REMOTE_ADDR: - val = r->connection->remote_ip; - break; - case SPECIAL_REMOTE_HOST: - val = ap_get_remote_host(r->connection, r->per_dir_config, - REMOTE_NAME); - break; - case SPECIAL_REMOTE_USER: - val = r->connection->user; - break; - case SPECIAL_REQUEST_URI: - val = r->uri; - break; - case SPECIAL_REQUEST_METHOD: - val = r->method; - break; - case SPECIAL_REQUEST_PROTOCOL: - val = r->protocol; - break; - case SPECIAL_NOT: - val = ap_table_get(r->headers_in, b->name); - if (val == NULL) { - val = ap_table_get(r->subprocess_env, b->name); - } - break; - } - } - - /* - * A NULL value indicates that the header field or special entity - * wasn't present or is undefined. Represent that as an empty string - * so that REs like "^$" will work and allow envariable setting - * based on missing or empty field. - */ - if (val == NULL) { - val = ""; - } - - if (!ap_regexec(b->preg, val, 0, NULL, 0)) { - array_header *arr = ap_table_elts(b->features); - elts = (table_entry *) arr->elts; - - for (j = 0; j < arr->nelts; ++j) { - if (!strcmp(elts[j].val, "!")) { - ap_table_unset(r->subprocess_env, elts[j].key); - } - else { - ap_table_setn(r->subprocess_env, elts[j].key, elts[j].val); - } - } - } - } - - return DECLINED; -} - -module MODULE_VAR_EXPORT setenvif_module = -{ - STANDARD_MODULE_STUFF, - NULL, /* initializer */ - NULL, /* dir config creater */ - NULL, /* dir merger --- default is to override */ - create_setenvif_config, /* server config */ - merge_setenvif_config, /* merge server configs */ - setenvif_module_cmds, /* command table */ - NULL, /* handlers */ - NULL, /* filename translation */ - NULL, /* check_user_id */ - NULL, /* check auth */ - NULL, /* check access */ - NULL, /* type_checker */ - NULL, /* fixups */ - NULL, /* logger */ - NULL, /* input header parse */ - NULL, /* child (process) initialization */ - NULL, /* child (process) rundown */ - match_headers /* post_read_request */ -}; diff --git a/modules/metadata/mod_setenvif.dsp b/modules/metadata/mod_setenvif.dsp deleted file mode 100644 index 8779ec8ce833543b53a0ee3a911124681d37e27c..0000000000000000000000000000000000000000 --- a/modules/metadata/mod_setenvif.dsp +++ /dev/null @@ -1,128 +0,0 @@ -# Microsoft Developer Studio Project File - Name="mod_setenvif" - Package Owner=<4> -# Microsoft Developer Studio Generated Build File, Format Version 6.00 -# ** DO NOT EDIT ** - -# TARGTYPE "Win32 (x86) Dynamic-Link Library" 0x0102 - -CFG=mod_setenvif - Win32 Release -!MESSAGE This is not a valid makefile. To build this project using NMAKE, -!MESSAGE use the Export Makefile command and run -!MESSAGE -!MESSAGE NMAKE /f "mod_setenvif.mak". -!MESSAGE -!MESSAGE You can specify a configuration when running NMAKE -!MESSAGE by defining the macro CFG on the command line. For example: -!MESSAGE -!MESSAGE NMAKE /f "mod_setenvif.mak" CFG="mod_setenvif - Win32 Release" -!MESSAGE -!MESSAGE Possible choices for configuration are: -!MESSAGE -!MESSAGE "mod_setenvif - Win32 Release" (based on "Win32 (x86) Dynamic-Link Library") -!MESSAGE "mod_setenvif - Win32 Debug" (based on "Win32 (x86) Dynamic-Link Library") -!MESSAGE - -# Begin Project -# PROP AllowPerConfigDependencies 0 -# PROP Scc_ProjName "" -# PROP Scc_LocalPath "" -CPP=cl.exe -MTL=midl.exe -RSC=rc.exe - -!IF "$(CFG)" == "mod_setenvif - Win32 Release" - -# PROP BASE Use_MFC 0 -# PROP BASE Use_Debug_Libraries 0 -# PROP BASE Output_Dir "Release" -# PROP BASE Intermediate_Dir "Release" -# PROP BASE Target_Dir "" -# PROP Use_MFC 0 -# PROP Use_Debug_Libraries 0 -# PROP Output_Dir "Release" -# PROP Intermediate_Dir "Release" -# PROP Ignore_Export_Lib 0 -# PROP Target_Dir "" -# ADD BASE CPP /nologo /MD /W3 /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /FD /c -# ADD CPP /nologo /MD /W3 /O2 /I "../../include" /I "../../srclib/apr/include" /I "../../srclib/apr-util/include" /D "NDEBUG" /D "WIN32" /D "_WINDOWS" /Fd"Release\mod_setenvif" /FD /c -# ADD BASE MTL /nologo /D "NDEBUG" /win32 -# ADD MTL /nologo /D "NDEBUG" /mktyplib203 /win32 -# ADD BASE RSC /l 0x409 /d "NDEBUG" -# ADD RSC /l 0x409 /d "NDEBUG" -BSC32=bscmake.exe -# ADD BASE BSC32 /nologo -# ADD BSC32 /nologo -LINK32=link.exe -# ADD BASE LINK32 kernel32.lib /nologo /subsystem:windows /dll /map /machine:I386 /out:"Release/mod_setenvif.so" /base:@..\..\os\win32\BaseAddr.ref,mod_setenvif -# ADD LINK32 kernel32.lib /nologo /subsystem:windows /dll /map /machine:I386 /out:"Release/mod_setenvif.so" /base:@..\..\os\win32\BaseAddr.ref,mod_setenvif - -!ELSEIF "$(CFG)" == "mod_setenvif - Win32 Debug" - -# PROP BASE Use_MFC 0 -# PROP BASE Use_Debug_Libraries 1 -# PROP BASE Output_Dir "Debug" -# PROP BASE Intermediate_Dir "Debug" -# PROP BASE Target_Dir "" -# PROP Use_MFC 0 -# PROP Use_Debug_Libraries 1 -# PROP Output_Dir "Debug" -# PROP Intermediate_Dir "Debug" -# PROP Ignore_Export_Lib 0 -# PROP Target_Dir "" -# ADD BASE CPP /nologo /MDd /W3 /GX /Zi /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /FD /c -# ADD CPP /nologo /MDd /W3 /GX /Zi /Od /I "../../include" /I "../../srclib/apr/include" /I "../../srclib/apr-util/include" /D "_DEBUG" /D "WIN32" /D "_WINDOWS" /Fd"Debug\mod_setenvif" /FD /c -# ADD BASE MTL /nologo /D "_DEBUG" /win32 -# ADD MTL /nologo /D "_DEBUG" /mktyplib203 /win32 -# ADD BASE RSC /l 0x409 /d "_DEBUG" -# ADD RSC /l 0x409 /d "_DEBUG" -BSC32=bscmake.exe -# ADD BASE BSC32 /nologo -# ADD BSC32 /nologo -LINK32=link.exe -# ADD BASE LINK32 kernel32.lib /nologo /subsystem:windows /dll /incremental:no /map /debug /machine:I386 /out:"Debug/mod_setenvif.so" /base:@..\..\os\win32\BaseAddr.ref,mod_setenvif -# ADD LINK32 kernel32.lib /nologo /subsystem:windows /dll /incremental:no /map /debug /machine:I386 /out:"Debug/mod_setenvif.so" /base:@..\..\os\win32\BaseAddr.ref,mod_setenvif - -!ENDIF - -# Begin Target - -# Name "mod_setenvif - Win32 Release" -# Name "mod_setenvif - Win32 Debug" -# Begin Source File - -SOURCE=.\mod_setenvif.c -# End Source File -# Begin Source File - -SOURCE=.\mod_setenvif.rc -# End Source File -# Begin Source File - -SOURCE=..\..\build\win32\win32ver.awk - -!IF "$(CFG)" == "mod_setenvif - Win32 Release" - -# PROP Ignore_Default_Tool 1 -# Begin Custom Build - Creating Version Resource -InputPath=..\..\build\win32\win32ver.awk - -".\mod_setenvif.rc" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)" - awk -f ../../build/win32/win32ver.awk mod_setenvif "setenvif_module for Apache" ../../include/ap_release.h > .\mod_setenvif.rc - -# End Custom Build - -!ELSEIF "$(CFG)" == "mod_setenvif - Win32 Debug" - -# PROP Ignore_Default_Tool 1 -# Begin Custom Build - Creating Version Resource -InputPath=..\..\build\win32\win32ver.awk - -".\mod_setenvif.rc" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)" - awk -f ../../build/win32/win32ver.awk mod_setenvif "setenvif_module for Apache" ../../include/ap_release.h > .\mod_setenvif.rc - -# End Custom Build - -!ENDIF - -# End Source File -# End Target -# End Project diff --git a/modules/metadata/mod_setenvif.exp b/modules/metadata/mod_setenvif.exp deleted file mode 100644 index 4f3800e3a8a9c0bbde6bfdc7d63c2d949b8c070a..0000000000000000000000000000000000000000 --- a/modules/metadata/mod_setenvif.exp +++ /dev/null @@ -1 +0,0 @@ -setenvif_module diff --git a/modules/metadata/mod_unique_id.c b/modules/metadata/mod_unique_id.c deleted file mode 100644 index 63474ed1febadbae0225f077439a1d209d57585f..0000000000000000000000000000000000000000 --- a/modules/metadata/mod_unique_id.c +++ /dev/null @@ -1,400 +0,0 @@ -/* ==================================================================== - * Copyright (c) 1995-1999 The Apache Group. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in - * the documentation and/or other materials provided with the - * distribution. - * - * 3. All advertising materials mentioning features or use of this - * software must display the following acknowledgment: - * "This product includes software developed by the Apache Group - * for use in the Apache HTTP server project (http://www.apache.org/)." - * - * 4. The names "Apache Server" and "Apache Group" must not be used to - * endorse or promote products derived from this software without - * prior written permission. For written permission, please contact - * apache@apache.org. - * - * 5. Products derived from this software may not be called "Apache" - * nor may "Apache" appear in their names without prior written - * permission of the Apache Group. - * - * 6. Redistributions of any form whatsoever must retain the following - * acknowledgment: - * "This product includes software developed by the Apache Group - * for use in the Apache HTTP server project (http://www.apache.org/)." - * - * THIS SOFTWARE IS PROVIDED BY THE APACHE GROUP ``AS IS'' AND ANY - * EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR - * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE APACHE GROUP OR - * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT - * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, - * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED - * OF THE POSSIBILITY OF SUCH DAMAGE. - * ==================================================================== - * - * This software consists of voluntary contributions made by many - * individuals on behalf of the Apache Group and was originally based - * on public domain software written at the National Center for - * Supercomputing Applications, University of Illinois, Urbana-Champaign. - * For more information on the Apache Group and the Apache HTTP server - * project, please see <http://www.apache.org/>. - * - */ - -/* - * mod_unique_id.c: generate a unique identifier for each request - * - * Original author: Dean Gaudet <dgaudet@arctic.org> - * UUencoding modified by: Alvaro Martinez Echevarria <alvaro@lander.es> - */ - -#include "httpd.h" -#include "http_config.h" -#include "http_log.h" -#include "multithread.h" - -#ifdef MULTITHREAD -#error sorry this module does not support multithreaded servers yet -#endif - -typedef struct { - unsigned int stamp; - unsigned int in_addr; - unsigned int pid; - unsigned short counter; -} unique_id_rec; - -/* Comments: - * - * We want an identifier which is unique across all hits, everywhere. - * "everywhere" includes multiple httpd instances on the same machine, or on - * multiple machines. Essentially "everywhere" should include all possible - * httpds across all servers at a particular "site". We make some assumptions - * that if the site has a cluster of machines then their time is relatively - * synchronized. We also assume that the first address returned by a - * gethostbyname (gethostname()) is unique across all the machines at the - * "site". - * - * We also further assume that pids fit in 32-bits. If something uses more - * than 32-bits, the fix is trivial, but it requires the unrolled uuencoding - * loop to be extended. * A similar fix is needed to support multithreaded - * servers, using a pid/tid combo. - * - * Together, the in_addr and pid are assumed to absolutely uniquely identify - * this one child from all other currently running children on all servers - * (including this physical server if it is running multiple httpds) from each - * other. - * - * The stamp and counter are used to distinguish all hits for a particular - * (in_addr,pid) pair. The stamp is updated using r->request_time, - * saving cpu cycles. The counter is never reset, and is used to permit up to - * 64k requests in a single second by a single child. - * - * The 112-bits of unique_id_rec are encoded using the alphabet - * [A-Za-z0-9@-], resulting in 19 bytes of printable characters. That is then - * stuffed into the environment variable UNIQUE_ID so that it is available to - * other modules. The alphabet choice differs from normal base64 encoding - * [A-Za-z0-9+/] because + and / are special characters in URLs and we want to - * make it easy to use UNIQUE_ID in URLs. - * - * Note that UNIQUE_ID should be considered an opaque token by other - * applications. No attempt should be made to dissect its internal components. - * It is an abstraction that may change in the future as the needs of this - * module change. - * - * It is highly desirable that identifiers exist for "eternity". But future - * needs (such as much faster webservers, moving to 64-bit pids, or moving to a - * multithreaded server) may dictate a need to change the contents of - * unique_id_rec. Such a future implementation should ensure that the first - * field is still a time_t stamp. By doing that, it is possible for a site to - * have a "flag second" in which they stop all of their old-format servers, - * wait one entire second, and then start all of their new-servers. This - * procedure will ensure that the new space of identifiers is completely unique - * from the old space. (Since the first four unencoded bytes always differ.) - */ -/* - * Sun Jun 7 05:43:49 CEST 1998 -- Alvaro - * More comments: - * 1) The UUencoding prodecure is now done in a general way, avoiding the problems - * with sizes and paddings that can arise depending on the architecture. Now the - * offsets and sizes of the elements of the unique_id_rec structure are calculated - * in unique_id_global_init; and then used to duplicate the structure without the - * paddings that might exist. The multithreaded server fix should be now very easy: - * just add a new "tid" field to the unique_id_rec structure, and increase by one - * UNIQUE_ID_REC_MAX. - * 2) unique_id_rec.stamp has been changed from "time_t" to "unsigned int", because - * its size is 64bits on some platforms (linux/alpha), and this caused problems with - * htonl/ntohl. Well, this shouldn't be a problem till year 2106. - */ - -static unsigned global_in_addr; - -static APACHE_TLS unique_id_rec cur_unique_id; - -/* - * Number of elements in the structure unique_id_rec. - */ -#define UNIQUE_ID_REC_MAX 4 - -static unsigned short unique_id_rec_offset[UNIQUE_ID_REC_MAX], - unique_id_rec_size[UNIQUE_ID_REC_MAX], - unique_id_rec_total_size, - unique_id_rec_size_uu; - -static void unique_id_global_init(server_rec *s, pool *p) -{ -#ifndef MAXHOSTNAMELEN -#define MAXHOSTNAMELEN 256 -#endif - char str[MAXHOSTNAMELEN + 1]; - struct hostent *hent; -#ifndef NO_GETTIMEOFDAY - struct timeval tv; -#endif - - /* - * Calculate the sizes and offsets in cur_unique_id. - */ - unique_id_rec_offset[0] = XtOffsetOf(unique_id_rec, stamp); - unique_id_rec_size[0] = sizeof(cur_unique_id.stamp); - unique_id_rec_offset[1] = XtOffsetOf(unique_id_rec, in_addr); - unique_id_rec_size[1] = sizeof(cur_unique_id.in_addr); - unique_id_rec_offset[2] = XtOffsetOf(unique_id_rec, pid); - unique_id_rec_size[2] = sizeof(cur_unique_id.pid); - unique_id_rec_offset[3] = XtOffsetOf(unique_id_rec, counter); - unique_id_rec_size[3] = sizeof(cur_unique_id.counter); - unique_id_rec_total_size = unique_id_rec_size[0] + unique_id_rec_size[1] + - unique_id_rec_size[2] + unique_id_rec_size[3]; - - /* - * Calculate the size of the structure when encoded. - */ - unique_id_rec_size_uu = (unique_id_rec_total_size*8+5)/6; - - /* - * Now get the global in_addr. Note that it is not sufficient to use one - * of the addresses from the main_server, since those aren't as likely to - * be unique as the physical address of the machine - */ - if (gethostname(str, sizeof(str) - 1) != 0) { - ap_log_error(APLOG_MARK, APLOG_NOERRNO|APLOG_ALERT, s, - "gethostname: mod_unique_id requires the hostname of the server"); - exit(1); - } - str[sizeof(str) - 1] = '\0'; - - if ((hent = gethostbyname(str)) == NULL) { - ap_log_error(APLOG_MARK, APLOG_NOERRNO|APLOG_ALERT, s, - "mod_unique_id: unable to gethostbyname(\"%s\")", str); - exit(1); - } - - global_in_addr = ((struct in_addr *) hent->h_addr_list[0])->s_addr; - - ap_log_error(APLOG_MARK, APLOG_NOERRNO|APLOG_INFO, s, - "mod_unique_id: using ip addr %s", - inet_ntoa(*(struct in_addr *) hent->h_addr_list[0])); - - /* - * If the server is pummelled with restart requests we could possibly end - * up in a situation where we're starting again during the same second - * that has been used in previous identifiers. Avoid that situation. - * - * In truth, for this to actually happen not only would it have to restart - * in the same second, but it would have to somehow get the same pids as - * one of the other servers that was running in that second. Which would - * mean a 64k wraparound on pids ... not very likely at all. - * - * But protecting against it is relatively cheap. We just sleep into the - * next second. - */ -#ifdef NO_GETTIMEOFDAY - sleep(1); -#else - if (gettimeofday(&tv, NULL) == -1) { - sleep(1); - } - else if (tv.tv_usec) { - tv.tv_sec = 0; - tv.tv_usec = 1000000 - tv.tv_usec; - select(0, NULL, NULL, NULL, &tv); - } -#endif -} - -static void unique_id_child_init(server_rec *s, pool *p) -{ - pid_t pid; -#ifndef NO_GETTIMEOFDAY - struct timeval tv; -#endif - - /* - * Note that we use the pid because it's possible that on the same - * physical machine there are multiple servers (i.e. using Listen). But - * it's guaranteed that none of them will share the same pids between - * children. - * - * XXX: for multithread this needs to use a pid/tid combo and probably - * needs to be expanded to 32 bits - */ - pid = getpid(); - cur_unique_id.pid = pid; - - /* - * Test our assumption that the pid is 32-bits. It's possible that - * 64-bit machines will declare pid_t to be 64 bits but only use 32 - * of them. It would have been really nice to test this during - * global_init ... but oh well. - */ - if (cur_unique_id.pid != pid) { - ap_log_error(APLOG_MARK, APLOG_NOERRNO|APLOG_CRIT, s, - "oh no! pids are greater than 32-bits! I'm broken!"); - } - - cur_unique_id.in_addr = global_in_addr; - - /* - * If we use 0 as the initial counter we have a little less protection - * against restart problems, and a little less protection against a clock - * going backwards in time. - */ -#ifndef NO_GETTIMEOFDAY - if (gettimeofday(&tv, NULL) == -1) { - cur_unique_id.counter = 0; - } - else { - /* Some systems have very low variance on the low end of their - * system counter, defend against that. - */ - cur_unique_id.counter = tv.tv_usec / 10; - } -#else - cur_unique_id.counter = 0; -#endif - - /* - * We must always use network ordering for these bytes, so that - * identifiers are comparable between machines of different byte - * orderings. Note in_addr is already in network order. - */ - cur_unique_id.pid = htonl(cur_unique_id.pid); - cur_unique_id.counter = htons(cur_unique_id.counter); -} - -/* NOTE: This is *NOT* the same encoding used by base64encode ... the last two - * characters should be + and /. But those two characters have very special - * meanings in URLs, and we want to make it easy to use identifiers in - * URLs. So we replace them with @ and -. - */ -static const char uuencoder[64] = { - 'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J', 'K', 'L', 'M', - 'N', 'O', 'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W', 'X', 'Y', 'Z', - 'a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm', - 'n', 'o', 'p', 'q', 'r', 's', 't', 'u', 'v', 'w', 'x', 'y', 'z', - '0', '1', '2', '3', '4', '5', '6', '7', '8', '9', '@', '-', -}; - -static int gen_unique_id(request_rec *r) -{ - char *str; - /* - * Buffer padded with two final bytes, used to copy the unique_id_red - * structure without the internal paddings that it could have. - */ - struct { - unique_id_rec foo; - unsigned char pad[2]; - } paddedbuf; - unsigned char *x,*y; - unsigned short counter; - const char *e; - int i,j,k; - - /* copy the unique_id if this is an internal redirect (we're never - * actually called for sub requests, so we don't need to test for - * them) */ - if (r->prev && (e = ap_table_get(r->subprocess_env, "REDIRECT_UNIQUE_ID"))) { - ap_table_setn(r->subprocess_env, "UNIQUE_ID", e); - return DECLINED; - } - - cur_unique_id.stamp = htonl((unsigned int)r->request_time); - - /* we'll use a temporal buffer to avoid uuencoding the possible internal - * paddings of the original structure */ - x = (unsigned char *) &paddedbuf; - y = (unsigned char *) &cur_unique_id; - k = 0; - for (i = 0; i < UNIQUE_ID_REC_MAX; i++) { - y = ((unsigned char *) &cur_unique_id) + unique_id_rec_offset[i]; - for (j = 0; j < unique_id_rec_size[i]; j++, k++) { - x[k] = y[j]; - } - } - /* - * We reset two more bytes just in case padding is needed for the uuencoding. - */ - x[k++] = '\0'; - x[k++] = '\0'; - - /* alloc str and do the uuencoding */ - str = (char *)ap_palloc(r->pool, unique_id_rec_size_uu + 1); - k = 0; - for (i = 0; i < unique_id_rec_total_size; i += 3) { - y = x + i; - str[k++] = uuencoder[y[0] >> 2]; - str[k++] = uuencoder[((y[0] & 0x03) << 4) | ((y[1] & 0xf0) >> 4)]; - if (k == unique_id_rec_size_uu) break; - str[k++] = uuencoder[((y[1] & 0x0f) << 2) | ((y[2] & 0xc0) >> 6)]; - if (k == unique_id_rec_size_uu) break; - str[k++] = uuencoder[y[2] & 0x3f]; - } - str[k++] = '\0'; - - /* set the environment variable */ - ap_table_setn(r->subprocess_env, "UNIQUE_ID", str); - - /* and increment the identifier for the next call */ - counter = ntohs(cur_unique_id.counter) + 1; - cur_unique_id.counter = htons(counter); - - return DECLINED; -} - - -module MODULE_VAR_EXPORT unique_id_module = { - STANDARD_MODULE_STUFF, - unique_id_global_init, /* initializer */ - NULL, /* dir config creater */ - NULL, /* dir merger --- default is to override */ - NULL, /* server config */ - NULL, /* merge server configs */ - NULL, /* command table */ - NULL, /* handlers */ - NULL, /* filename translation */ - NULL, /* check_user_id */ - NULL, /* check auth */ - NULL, /* check access */ - NULL, /* type_checker */ - NULL, /* fixups */ - NULL, /* logger */ - NULL, /* header parser */ - unique_id_child_init, /* child_init */ - NULL, /* child_exit */ - gen_unique_id /* post_read_request */ -}; diff --git a/modules/metadata/mod_unique_id.dsp b/modules/metadata/mod_unique_id.dsp deleted file mode 100644 index 3045d2fc23071a3e3438cc5fccce505ee07315e0..0000000000000000000000000000000000000000 --- a/modules/metadata/mod_unique_id.dsp +++ /dev/null @@ -1,128 +0,0 @@ -# Microsoft Developer Studio Project File - Name="mod_unique_id" - Package Owner=<4> -# Microsoft Developer Studio Generated Build File, Format Version 6.00 -# ** DO NOT EDIT ** - -# TARGTYPE "Win32 (x86) Dynamic-Link Library" 0x0102 - -CFG=mod_unique_id - Win32 Release -!MESSAGE This is not a valid makefile. To build this project using NMAKE, -!MESSAGE use the Export Makefile command and run -!MESSAGE -!MESSAGE NMAKE /f "mod_unique_id.mak". -!MESSAGE -!MESSAGE You can specify a configuration when running NMAKE -!MESSAGE by defining the macro CFG on the command line. For example: -!MESSAGE -!MESSAGE NMAKE /f "mod_unique_id.mak" CFG="mod_unique_id - Win32 Release" -!MESSAGE -!MESSAGE Possible choices for configuration are: -!MESSAGE -!MESSAGE "mod_unique_id - Win32 Release" (based on "Win32 (x86) Dynamic-Link Library") -!MESSAGE "mod_unique_id - Win32 Debug" (based on "Win32 (x86) Dynamic-Link Library") -!MESSAGE - -# Begin Project -# PROP AllowPerConfigDependencies 0 -# PROP Scc_ProjName "" -# PROP Scc_LocalPath "" -CPP=cl.exe -MTL=midl.exe -RSC=rc.exe - -!IF "$(CFG)" == "mod_unique_id - Win32 Release" - -# PROP BASE Use_MFC 0 -# PROP BASE Use_Debug_Libraries 0 -# PROP BASE Output_Dir "Release" -# PROP BASE Intermediate_Dir "Release" -# PROP BASE Target_Dir "" -# PROP Use_MFC 0 -# PROP Use_Debug_Libraries 0 -# PROP Output_Dir "Release" -# PROP Intermediate_Dir "Release" -# PROP Ignore_Export_Lib 0 -# PROP Target_Dir "" -# ADD BASE CPP /nologo /MD /W3 /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /FD /c -# ADD CPP /nologo /MD /W3 /O2 /I "..\..\include" /I "..\..\os\win32" /I "..\..\srclib\apr\include" /I "../../srclib/apr-util/include" /D "NDEBUG" /D "WIN32" /D "_WINDOWS" /Fd"Release\mod_unique_id" /FD /c -# ADD BASE MTL /nologo /D "NDEBUG" /win32 -# ADD MTL /nologo /D "NDEBUG" /mktyplib203 /win32 -# ADD BASE RSC /l 0x409 /d "NDEBUG" -# ADD RSC /l 0x409 /d "NDEBUG" -BSC32=bscmake.exe -# ADD BASE BSC32 /nologo -# ADD BSC32 /nologo -LINK32=link.exe -# ADD BASE LINK32 kernel32.lib ws2_32.lib /nologo /subsystem:windows /dll /map /machine:I386 /out:"Release/mod_unique_id.so" /base:@..\..\os\win32\BaseAddr.ref,mod_unique_id -# ADD LINK32 kernel32.lib ws2_32.lib /nologo /subsystem:windows /dll /map /machine:I386 /out:"Release/mod_unique_id.so" /base:@..\..\os\win32\BaseAddr.ref,mod_unique_id - -!ELSEIF "$(CFG)" == "mod_unique_id - Win32 Debug" - -# PROP BASE Use_MFC 0 -# PROP BASE Use_Debug_Libraries 1 -# PROP BASE Output_Dir "Debug" -# PROP BASE Intermediate_Dir "Debug" -# PROP BASE Target_Dir "" -# PROP Use_MFC 0 -# PROP Use_Debug_Libraries 1 -# PROP Output_Dir "Debug" -# PROP Intermediate_Dir "Debug" -# PROP Ignore_Export_Lib 0 -# PROP Target_Dir "" -# ADD BASE CPP /nologo /MDd /W3 /GX /Zi /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /FD /c -# ADD CPP /nologo /MDd /W3 /GX /Zi /Od /I "..\..\include" /I "..\..\os\win32" /I "..\..\srclib\apr\include" /I "../../srclib/apr-util/include" /D "_DEBUG" /D "WIN32" /D "_WINDOWS" /Fd"Debug\mod_unique_id" /FD /c -# ADD BASE MTL /nologo /D "_DEBUG" /win32 -# ADD MTL /nologo /D "_DEBUG" /mktyplib203 /win32 -# ADD BASE RSC /l 0x409 /d "_DEBUG" -# ADD RSC /l 0x409 /d "_DEBUG" -BSC32=bscmake.exe -# ADD BASE BSC32 /nologo -# ADD BSC32 /nologo -LINK32=link.exe -# ADD BASE LINK32 kernel32.lib ws2_32.lib /nologo /subsystem:windows /dll /incremental:no /map /debug /machine:I386 /out:"Debug/mod_unique_id.so" /base:@..\..\os\win32\BaseAddr.ref,mod_unique_id -# ADD LINK32 kernel32.lib ws2_32.lib /nologo /subsystem:windows /dll /incremental:no /map /debug /machine:I386 /out:"Debug/mod_unique_id.so" /base:@..\..\os\win32\BaseAddr.ref,mod_unique_id - -!ENDIF - -# Begin Target - -# Name "mod_unique_id - Win32 Release" -# Name "mod_unique_id - Win32 Debug" -# Begin Source File - -SOURCE=.\mod_unique_id.c -# End Source File -# Begin Source File - -SOURCE=.\mod_unique_id.rc -# End Source File -# Begin Source File - -SOURCE=..\..\build\win32\win32ver.awk - -!IF "$(CFG)" == "mod_unique_id - Win32 Release" - -# PROP Ignore_Default_Tool 1 -# Begin Custom Build - Creating Version Resource -InputPath=..\..\build\win32\win32ver.awk - -".\mod_unique_id.rc" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)" - awk -f ../../build/win32/win32ver.awk mod_unique_id "unique_id_module for Apache" ../../include/ap_release.h > .\mod_unique_id.rc - -# End Custom Build - -!ELSEIF "$(CFG)" == "mod_unique_id - Win32 Debug" - -# PROP Ignore_Default_Tool 1 -# Begin Custom Build - Creating Version Resource -InputPath=..\..\build\win32\win32ver.awk - -".\mod_unique_id.rc" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)" - awk -f ../../build/win32/win32ver.awk mod_unique_id "unique_id_module for Apache" ../../include/ap_release.h > .\mod_unique_id.rc - -# End Custom Build - -!ENDIF - -# End Source File -# End Target -# End Project diff --git a/modules/metadata/mod_unique_id.exp b/modules/metadata/mod_unique_id.exp deleted file mode 100644 index 93000f1ee6140dc3e0e91399fd9f5057711f8895..0000000000000000000000000000000000000000 --- a/modules/metadata/mod_unique_id.exp +++ /dev/null @@ -1 +0,0 @@ -unique_id_module diff --git a/modules/metadata/mod_usertrack.c b/modules/metadata/mod_usertrack.c deleted file mode 100644 index 1b50e1599678ed8a0ed47bc35f64859ac3f24e21..0000000000000000000000000000000000000000 --- a/modules/metadata/mod_usertrack.c +++ /dev/null @@ -1,377 +0,0 @@ -/* ==================================================================== - * Copyright (c) 1995-1999 The Apache Group. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in - * the documentation and/or other materials provided with the - * distribution. - * - * 3. All advertising materials mentioning features or use of this - * software must display the following acknowledgment: - * "This product includes software developed by the Apache Group - * for use in the Apache HTTP server project (http://www.apache.org/)." - * - * 4. The names "Apache Server" and "Apache Group" must not be used to - * endorse or promote products derived from this software without - * prior written permission. For written permission, please contact - * apache@apache.org. - * - * 5. Products derived from this software may not be called "Apache" - * nor may "Apache" appear in their names without prior written - * permission of the Apache Group. - * - * 6. Redistributions of any form whatsoever must retain the following - * acknowledgment: - * "This product includes software developed by the Apache Group - * for use in the Apache HTTP server project (http://www.apache.org/)." - * - * THIS SOFTWARE IS PROVIDED BY THE APACHE GROUP ``AS IS'' AND ANY - * EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR - * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE APACHE GROUP OR - * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT - * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, - * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED - * OF THE POSSIBILITY OF SUCH DAMAGE. - * ==================================================================== - * - * This software consists of voluntary contributions made by many - * individuals on behalf of the Apache Group and was originally based - * on public domain software written at the National Center for - * Supercomputing Applications, University of Illinois, Urbana-Champaign. - * For more information on the Apache Group and the Apache HTTP server - * project, please see <http://www.apache.org/>. - * - */ - -/* User Tracking Module (Was mod_cookies.c) - * - * This Apache module is designed to track users paths through a site. - * It uses the client-side state ("Cookie") protocol developed by Netscape. - * It is known to work on Netscape browsers, Microsoft Internet - * Explorer and others currently being developed. - * - * Each time a page is requested we look to see if the browser is sending - * us a Cookie: header that we previously generated. - * - * If we don't find one then the user hasn't been to this site since - * starting their browser or their browser doesn't support cookies. So - * we generate a unique Cookie for the transaction and send it back to - * the browser (via a "Set-Cookie" header) - * Future requests from the same browser should keep the same Cookie line. - * - * By matching up all the requests with the same cookie you can - * work out exactly what path a user took through your site. To log - * the cookie use the " %{Cookie}n " directive in a custom access log; - * - * Example 1 : If you currently use the standard Log file format (CLF) - * and use the command "TransferLog somefilename", add the line - * LogFormat "%h %l %u %t \"%r\" %s %b %{Cookie}n" - * to your config file. - * - * Example 2 : If you used to use the old "CookieLog" directive, you - * can emulate it by adding the following command to your config file - * CustomLog filename "%{Cookie}n \"%r\" %t" - * - * Notes: - * 1. This code now logs the initial transaction (the one that created - * the cookie to start with). - * 2. This module has been designed to not interfere with other Cookies - * your site may be using; just avoid sending out cookies with - * the name "Apache=" or things will get confused. - * 3. If you want you can modify the Set-Cookie line so that the Cookie - * never expires. You would then get the same Cookie each time the - * user revisits your site. - * - * Mark Cox, mark@ukweb.com, 6 July 95 - * - * This file replaces mod_cookies.c - */ - -#include "httpd.h" -#include "http_config.h" -#include "http_core.h" -#if !defined(WIN32) && !defined(MPE) -#include <sys/time.h> -#endif - -module MODULE_VAR_EXPORT usertrack_module; - -typedef struct { - int always; - time_t expires; -} cookie_log_state; - -typedef struct { - int enabled; - char *cookie_name; -} cookie_dir_rec; - -/* Define this to allow post-2000 cookies. Cookies use two-digit dates, - * so it might be dicey. (Netscape does it correctly, but others may not) - */ -#define MILLENIAL_COOKIES - -/* Make Cookie: Now we have to generate something that is going to be - * pretty unique. We can base it on the pid, time, hostip */ - -#define COOKIE_NAME "Apache" - -static void make_cookie(request_rec *r) -{ - cookie_log_state *cls = ap_get_module_config(r->server->module_config, - &usertrack_module); -#if defined(NO_GETTIMEOFDAY) && !defined(NO_TIMES) - clock_t mpe_times; - struct tms mpe_tms; -#elif !defined(WIN32) - struct timeval tv; - struct timezone tz = {0, 0}; -#endif - /* 1024 == hardcoded constant */ - char cookiebuf[1024]; - char *new_cookie; - const char *rname = ap_get_remote_host(r->connection, r->per_dir_config, - REMOTE_NAME); - cookie_dir_rec *dcfg; - - dcfg = ap_get_module_config(r->per_dir_config, &usertrack_module); - -#if defined(NO_GETTIMEOFDAY) && !defined(NO_TIMES) -/* We lack gettimeofday(), so we must use time() to obtain the epoch - seconds, and then times() to obtain CPU clock ticks (milliseconds). - Combine this together to obtain a hopefully unique cookie ID. */ - - mpe_times = times(&mpe_tms); - - ap_snprintf(cookiebuf, sizeof(cookiebuf), "%s.%d%ld%ld", rname, - (int) getpid(), - (long) r->request_time, (long) mpe_tms.tms_utime); -#elif defined(WIN32) - /* - * We lack gettimeofday() and we lack times(). So we'll use a combination - * of time() and GetTickCount(), which returns milliseconds since Windows - * was started. It should be relatively unique. - */ - - ap_snprintf(cookiebuf, sizeof(cookiebuf), "%s.%d%ld%ld", rname, - (int) getpid(), - (long) r->request_time, (long) GetTickCount()); - -#else - gettimeofday(&tv, &tz); - - ap_snprintf(cookiebuf, sizeof(cookiebuf), "%s.%d%ld%d", rname, - (int) getpid(), - (long) tv.tv_sec, (int) tv.tv_usec / 1000); -#endif - - if (cls->expires) { - struct tm *tms; - time_t when = r->request_time + cls->expires; - -#ifndef MILLENIAL_COOKIES - /* - * Only two-digit date string, so we can't trust "00" or more. - * Therefore, we knock it all back to just before midnight on - * 1/1/2000 (which is 946684799) - */ - - if (when > 946684799) - when = 946684799; -#endif - tms = gmtime(&when); - - /* Cookie with date; as strftime '%a, %d-%h-%y %H:%M:%S GMT' */ - new_cookie = ap_psprintf(r->pool, - "%s=%s; path=/; expires=%s, %.2d-%s-%.2d %.2d:%.2d:%.2d GMT", - dcfg->cookie_name, cookiebuf, ap_day_snames[tms->tm_wday], - tms->tm_mday, ap_month_snames[tms->tm_mon], - tms->tm_year % 100, - tms->tm_hour, tms->tm_min, tms->tm_sec); - } - else { - new_cookie = ap_psprintf(r->pool, "%s=%s; path=/", - dcfg->cookie_name, cookiebuf); - } - - ap_table_setn(r->headers_out, "Set-Cookie", new_cookie); - ap_table_setn(r->notes, "cookie", ap_pstrdup(r->pool, cookiebuf)); /* log first time */ - return; -} - -static int spot_cookie(request_rec *r) -{ - cookie_dir_rec *dcfg = ap_get_module_config(r->per_dir_config, - &usertrack_module); - const char *cookie; - char *value; - - if (!dcfg->enabled) { - return DECLINED; - } - - if ((cookie = ap_table_get(r->headers_in, "Cookie"))) - if ((value = strstr(cookie, dcfg->cookie_name))) { - char *cookiebuf, *cookieend; - - value += strlen(dcfg->cookie_name) + 1; /* Skip over the '=' */ - cookiebuf = ap_pstrdup(r->pool, value); - cookieend = strchr(cookiebuf, ';'); - if (cookieend) - *cookieend = '\0'; /* Ignore anything after a ; */ - - /* Set the cookie in a note, for logging */ - ap_table_setn(r->notes, "cookie", cookiebuf); - - return DECLINED; /* There's already a cookie, no new one */ - } - make_cookie(r); - return OK; /* We set our cookie */ -} - -static void *make_cookie_log_state(pool *p, server_rec *s) -{ - cookie_log_state *cls = - (cookie_log_state *) ap_palloc(p, sizeof(cookie_log_state)); - - cls->expires = 0; - - return (void *) cls; -} - -static void *make_cookie_dir(pool *p, char *d) -{ - cookie_dir_rec *dcfg; - - dcfg = (cookie_dir_rec *) ap_pcalloc(p, sizeof(cookie_dir_rec)); - dcfg->cookie_name = COOKIE_NAME; - dcfg->enabled = 0; - return dcfg; -} - -static const char *set_cookie_enable(cmd_parms *cmd, void *mconfig, int arg) -{ - cookie_dir_rec *dcfg = mconfig; - - dcfg->enabled = arg; - return NULL; -} - -static const char *set_cookie_exp(cmd_parms *parms, void *dummy, const char *arg) -{ - cookie_log_state *cls = ap_get_module_config(parms->server->module_config, - &usertrack_module); - time_t factor, modifier = 0; - time_t num = 0; - char *word; - - /* The simple case first - all numbers (we assume) */ - if (ap_isdigit(arg[0]) && ap_isdigit(arg[strlen(arg) - 1])) { - cls->expires = atol(arg); - return NULL; - } - - /* - * The harder case - stolen from mod_expires - * - * CookieExpires "[plus] {<num> <type>}*" - */ - - word = ap_getword_conf(parms->pool, &arg); - if (!strncasecmp(word, "plus", 1)) { - word = ap_getword_conf(parms->pool, &arg); - }; - - /* {<num> <type>}* */ - while (word[0]) { - /* <num> */ - if (ap_isdigit(word[0])) - num = atoi(word); - else - return "bad expires code, numeric value expected."; - - /* <type> */ - word = ap_getword_conf(parms->pool, &arg); - if (!word[0]) - return "bad expires code, missing <type>"; - - factor = 0; - if (!strncasecmp(word, "years", 1)) - factor = 60 * 60 * 24 * 365; - else if (!strncasecmp(word, "months", 2)) - factor = 60 * 60 * 24 * 30; - else if (!strncasecmp(word, "weeks", 1)) - factor = 60 * 60 * 24 * 7; - else if (!strncasecmp(word, "days", 1)) - factor = 60 * 60 * 24; - else if (!strncasecmp(word, "hours", 1)) - factor = 60 * 60; - else if (!strncasecmp(word, "minutes", 2)) - factor = 60; - else if (!strncasecmp(word, "seconds", 1)) - factor = 1; - else - return "bad expires code, unrecognized type"; - - modifier = modifier + factor * num; - - /* next <num> */ - word = ap_getword_conf(parms->pool, &arg); - } - - cls->expires = modifier; - - return NULL; -} - -static const char *set_cookie_name(cmd_parms *cmd, void *mconfig, char *name) -{ - cookie_dir_rec *dcfg = (cookie_dir_rec *) mconfig; - - dcfg->cookie_name = ap_pstrdup(cmd->pool, name); - return NULL; -} - -static const command_rec cookie_log_cmds[] = { - {"CookieExpires", set_cookie_exp, NULL, RSRC_CONF, TAKE1, - "an expiry date code"}, - {"CookieTracking", set_cookie_enable, NULL, OR_FILEINFO, FLAG, - "whether or not to enable cookies"}, - {"CookieName", set_cookie_name, NULL, OR_FILEINFO, TAKE1, - "name of the tracking cookie"}, - {NULL} -}; - -module MODULE_VAR_EXPORT usertrack_module = { - STANDARD_MODULE_STUFF, - NULL, /* initializer */ - make_cookie_dir, /* dir config creater */ - NULL, /* dir merger --- default is to override */ - make_cookie_log_state, /* server config */ - NULL, /* merge server configs */ - cookie_log_cmds, /* command table */ - NULL, /* handlers */ - NULL, /* filename translation */ - NULL, /* check_user_id */ - NULL, /* check auth */ - NULL, /* check access */ - NULL, /* type_checker */ - spot_cookie, /* fixups */ - NULL, /* logger */ - NULL, /* header parser */ - NULL, /* child_init */ - NULL, /* child_exit */ - NULL /* post read-request */ -}; diff --git a/modules/metadata/mod_usertrack.dsp b/modules/metadata/mod_usertrack.dsp deleted file mode 100644 index e3aee558ce597aee8d38d09b42fb01ceee4c7cd5..0000000000000000000000000000000000000000 --- a/modules/metadata/mod_usertrack.dsp +++ /dev/null @@ -1,113 +0,0 @@ -# Microsoft Developer Studio Project File - Name="ApacheModuleUserTrack" - Package Owner=<4> -# Microsoft Developer Studio Generated Build File, Format Version 5.00 -# ** DO NOT EDIT ** - -# TARGTYPE "Win32 (x86) Dynamic-Link Library" 0x0102 - -CFG=ApacheModuleUserTrack - Win32 Release -!MESSAGE This is not a valid makefile. To build this project using NMAKE, -!MESSAGE use the Export Makefile command and run -!MESSAGE -!MESSAGE NMAKE /f "ApacheModuleUserTrack.mak". -!MESSAGE -!MESSAGE You can specify a configuration when running NMAKE -!MESSAGE by defining the macro CFG on the command line. For example: -!MESSAGE -!MESSAGE NMAKE /f "ApacheModuleUserTrack.mak"\ - CFG="ApacheModuleUserTrack - Win32 Release" -!MESSAGE -!MESSAGE Possible choices for configuration are: -!MESSAGE -!MESSAGE "ApacheModuleUserTrack - Win32 Release" (based on\ - "Win32 (x86) Dynamic-Link Library") -!MESSAGE "ApacheModuleUserTrack - Win32 Debug" (based on\ - "Win32 (x86) Dynamic-Link Library") -!MESSAGE - -# Begin Project -# PROP Scc_ProjName "" -# PROP Scc_LocalPath "" -CPP=cl.exe -MTL=midl.exe -RSC=rc.exe - -!IF "$(CFG)" == "ApacheModuleUserTrack - Win32 Release" - -# PROP BASE Use_MFC 0 -# PROP BASE Use_Debug_Libraries 0 -# PROP BASE Output_Dir ".\Release" -# PROP BASE Intermediate_Dir ".\Release" -# PROP BASE Target_Dir "" -# PROP Use_MFC 0 -# PROP Use_Debug_Libraries 0 -# PROP Output_Dir ".\ApacheModuleUserTrackR" -# PROP Intermediate_Dir ".\ApacheModuleUserTrackR" -# PROP Ignore_Export_Lib 0 -# PROP Target_Dir "" -# ADD BASE CPP /nologo /MT /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /YX /c -# ADD CPP /nologo /MD /W3 /GX /O2 /I "..\..\include" /D "NDEBUG" /D "WIN32" /D "_WINDOWS" /D "SHARED_MODULE" /YX /FD /c -# ADD BASE MTL /nologo /D "NDEBUG" /win32 -# ADD MTL /nologo /D "NDEBUG" /mktyplib203 /win32 -# ADD BASE RSC /l 0x809 /d "NDEBUG" -# ADD RSC /l 0x809 /d "NDEBUG" -BSC32=bscmake.exe -# ADD BASE BSC32 /nologo -# ADD BSC32 /nologo -LINK32=link.exe -# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:windows /dll /machine:I386 -# ADD LINK32 ..\..\CoreR\ApacheCore.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib /nologo /subsystem:windows /dll /machine:I386 - -!ELSEIF "$(CFG)" == "ApacheModuleUserTrack - Win32 Debug" - -# PROP BASE Use_MFC 0 -# PROP BASE Use_Debug_Libraries 1 -# PROP BASE Output_Dir ".\Debug" -# PROP BASE Intermediate_Dir ".\Debug" -# PROP BASE Target_Dir "" -# PROP Use_MFC 0 -# PROP Use_Debug_Libraries 1 -# PROP Output_Dir ".\ApacheModuleUserTrackD" -# PROP Intermediate_Dir ".\ApacheModuleUserTrackD" -# PROP Ignore_Export_Lib 0 -# PROP Target_Dir "" -# ADD BASE CPP /nologo /MTd /W3 /Gm /GX /Zi /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /YX /c -# ADD CPP /nologo /MDd /W3 /Gm /GX /Zi /Od /I "..\..\include" /D "_DEBUG" /D "WIN32" /D "_WINDOWS" /D "SHARED_MODULE" /YX /FD /c -# ADD BASE MTL /nologo /D "_DEBUG" /win32 -# ADD MTL /nologo /D "_DEBUG" /mktyplib203 /win32 -# ADD BASE RSC /l 0x809 /d "_DEBUG" -# ADD RSC /l 0x809 /d "_DEBUG" -BSC32=bscmake.exe -# ADD BASE BSC32 /nologo -# ADD BSC32 /nologo -LINK32=link.exe -# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:windows /dll /debug /machine:I386 -# ADD LINK32 ..\..\CoreD\ApacheCore.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib /nologo /subsystem:windows /dll /debug /machine:I386 - -!ENDIF - -# Begin Target - -# Name "ApacheModuleUserTrack - Win32 Release" -# Name "ApacheModuleUserTrack - Win32 Debug" -# Begin Group "Source Files" - -# PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;hpj;bat;for;f90" -# Begin Source File - -SOURCE=..\..\modules\standard\mod_usertrack.c -# End Source File -# End Group -# Begin Group "Header Files" - -# PROP Default_Filter "h;hpp;hxx;hm;inl;fi;fd" -# Begin Source File - -SOURCE=.\readdir.h -# End Source File -# End Group -# Begin Group "Resource Files" - -# PROP Default_Filter "ico;cur;bmp;dlg;rc2;rct;bin;cnt;rtf;gif;jpg;jpeg;jpe" -# End Group -# End Target -# End Project diff --git a/modules/metadata/mod_usertrack.exp b/modules/metadata/mod_usertrack.exp deleted file mode 100644 index 234a5f759dca5e811e23f53e1d622e5cd4535c73..0000000000000000000000000000000000000000 --- a/modules/metadata/mod_usertrack.exp +++ /dev/null @@ -1 +0,0 @@ -usertrack_module diff --git a/modules/proxy/.cvsignore b/modules/proxy/.cvsignore deleted file mode 100644 index e0eb7a9f308ccb3fe2a5e7efe9b2931530298741..0000000000000000000000000000000000000000 --- a/modules/proxy/.cvsignore +++ /dev/null @@ -1,12 +0,0 @@ -Debug -Release -ApacheModuleProxy.dsw -ApacheModuleProxy.mdp -ApacheModuleProxy.ncb -ApacheModuleProxy.opt -ApacheModuleProxy.plg -Makefile -*.lo -*.so -*.dll -*.def diff --git a/modules/proxy/.indent.pro b/modules/proxy/.indent.pro deleted file mode 100644 index 20c2d83371def522470977cf664d114a1f75204e..0000000000000000000000000000000000000000 --- a/modules/proxy/.indent.pro +++ /dev/null @@ -1,55 +0,0 @@ --i4 -npsl -di0 -br -nce -d0 -cli0 -npcs -nfc1 --TBUFF --TFILE --TTRANS --TUINT4 --T_trans --Tallow_options_t --Tapache_sfio --Tarray_header --Tbool_int --Tbuf_area --Tbuff_struct --Tbuffy --Tcmd_how --Tcmd_parms --Tcommand_rec --Tcommand_struct --Tconn_rec --Tcore_dir_config --Tcore_server_config --Tdir_maker_func --Tevent --Tglobals_s --Thandler_func --Thandler_rec --Tjoblist_s --Tlisten_rec --Tmerger_func --Tmode_t --Tmodule --Tmodule_struct --Tmutex --Tn_long --Tother_child_rec --Toverrides_t --Tparent_score --Tpid_t --Tpiped_log --Tpool --Trequest_rec --Trequire_line --Trlim_t --Tscoreboard --Tsemaphore --Tserver_addr_rec --Tserver_rec --Tserver_rec_chain --Tshort_score --Ttable --Ttable_entry --Tthread --Tu_wide_int --Tvtime_t --Twide_int --Tproxy_server_conf diff --git a/modules/proxy/CHANGES b/modules/proxy/CHANGES deleted file mode 100644 index d03f68c932bd74034ae2561c7cbdf56fe43300af..0000000000000000000000000000000000000000 --- a/modules/proxy/CHANGES +++ /dev/null @@ -1,134 +0,0 @@ - -mod_proxy changes for httpd 2.0.18-dev - - *) Reverse previous patch since the core reverted. - [Chuck Murcko <chuck@topsail.org>] - - *) Remove indirection on number of bytes to read for input filters. - [Chuck Murcko <chuck@topsail.org>] - - *) Fixed a problem with directory listing corruption in the - PROXY_DIR filter. - [Graham Leggett <minfrin@sharp.fm>] - - *) mod_proxy and the proxy submodules now build properly as DSOs. - [Graham Leggett <minfrin@sharp.fm>] - - *) Stopped the HTTP proxy from trying to read entity bodies when there - wasn't one (response was 1xx, 204, 205 or 304). - [Graham Leggett <minfrin@sharp.fm>] - - *) Made sure dates were canonicalised correctly when passed to the client - browser through the HTTP proxy. - [Graham Leggett <minfrin@sharp.fm>] - - *) Split each individual proxy protocol into separate modules. - [Graham Leggett <minfrin@sharp.fm>] - - *) Added Max-Forwards support for all request types so as to prevent - loops. - [Graham Leggett <minfrin@sharp.fm>] - - *) Fix warnings about byte count type on Darwin (connect handler). - [Chuck Murcko <chuck@topsail.org>] - - *) IPV6 EPSV support for IPV6 in FTP proxy. - [Graham Leggett <minfrin@sharp.fm>] - - *) FTP directory filter works now. - [Graham Leggett <minfrin@sharp.fm>] - - *) Fixed some thread-safety issues with the HTTP proxy in mod_proxy. - [Graham Leggett <minfrin@sharp.fm>] - - *) PASV FTP works now. - [Graham Leggett <minfrin@sharp.fm>] - - *) Reworked the line-at-a-time read from the control connection to - workaround a stray empty bucket returned by the HTTP_IN filter. - [Graham Leggett <minfrin@sharp.fm>] - - *) Stopped the CORE filter from sending off an HTTP response when a - CONNECT tunnel was closed. - [Graham Leggett <minfrin@sharp.fm>] - - *) Fixed the poll() loop in proxy_connect.c -> it works now!!! - [Graham Leggett <minfrin@sharp.fm>] - - *) Converted send_dir() to ap_proxy_send_dir_filter() in proxy_ftp.c. - [Graham Leggett <minfrin@sharp.fm>] - - *) Major rework of ap_proxy_ftp_handler() to use filters (begone foul - BUFF!!!). It compiles, but is untested, and the build environment needs - to be fixed to include proxy_ftp.c. - [Graham Leggett <minfrin@sharp.fm>] - - *) Cleanup of dead functions within proxy_util.c. - [Graham Leggett <minfrin@sharp.fm>] - - *) Reworked the storage of the client socket between keepalive connections - to fix some nasty problems with the socket lasting longer than the - memory pool it was allocated from. - [Graham Leggett <minfrin@sharp.fm>] - - *) Fixed bug where a hostname without a "." in it (such as "localhost") - would not trigger an IP address check with ProxyBlock. - [Graham Leggett <minfrin@sharp.fm>] - - *) Fixed ProxyBlock bugs with ap_proxy_http_handler() and - ap_proxy_connect_handler(). - [Graham Leggett <minfrin@sharp.fm>] - - *) Updated ap_proxy_connect_handler() to support APR, while - moving some common code between http_handler and connect_handler - to proxy_util.c. - [Graham Leggett <minfrin@sharp.fm>] - - *) Updated mod_proxy.html docs to include v2.0 configuration. - [Graham Leggett <minfrin@sharp.fm>] - - *) Fixed problem where responses without entity bodies would cause - the directly following proxy keepalive request to fail. - [Graham Leggett <minfrin@sharp.fm>] - - *) Added support for downstream keepalives in mod_proxy. - [Graham Leggett <minfrin@sharp.fm>] - - *) Changed mod_proxy ap_proxy_http_handler() to support APR properly. - [Graham Leggett <minfrin@sharp.fm>] - - *) Fix problem where incoming response headers were not being returned - to the client in mod_proxy. - [Graham Leggett <minfrin@sharp.fm>] - - *) Added X-Forwarded-For, X-Forwarded-Host and X-Forwarded-Server to - reverse proxied request headers in mod_proxy. - [Graham Leggett <minfrin@sharp.fm>] - - *) replace INADDR_NONE with APR_INADDR_NONE [Ian Holsman <IanH@cnet.com>] - - *) Fix problem with proxy configuration where globally set - configuration options were overridden inside virtual hosts. - [Graham Leggett <minfrin@sharp.fm>] - - *) Fix ProxyReceiveBufferSize where default value was left - uninitialised. - [Graham Leggett <minfrin@sharp.fm>] - - *) Some small changes: - - Ensured hop-by-hop headers were stripped as per - RFC2616 13.5.1. - - Upgraded version code to HTTP/1.1. - - Added Connection: close until Keepalives come. - - Some cosmetic fixes and commenting. - [Graham Leggett <minfrin@sharp.fm>] - -mod_proxy changes for 2.0.14 alpha - - *) removed ProxyNoCache and ProxyCacheForceCompletion config directives, - since we no longer directly cache from this module [Chuck Murcko] - - *) removed cache [Chuck Murcko] - - *) initial rerebuild for 2.0 [Chuck Murcko] - diff --git a/modules/proxy/Makefile.in b/modules/proxy/Makefile.in deleted file mode 100644 index b6a0fc991ffd29d699e4b49cb56f33fcfeab2c6f..0000000000000000000000000000000000000000 --- a/modules/proxy/Makefile.in +++ /dev/null @@ -1,5 +0,0 @@ - -LTLIBRARY_NAME = libapachemod_proxy.la -LTLIBRARY_SOURCES = mod_proxy.lo proxy_connect.lo proxy_ftp.lo proxy_http.lo proxy_util.lo - -include $(top_srcdir)/build/ltlib.mk diff --git a/modules/proxy/NWGNUmakefile b/modules/proxy/NWGNUmakefile deleted file mode 100644 index b86fab5e6735f6b2ae77dbf406c93f5c116b2f13..0000000000000000000000000000000000000000 --- a/modules/proxy/NWGNUmakefile +++ /dev/null @@ -1,271 +0,0 @@ -# -# Declare the sub-directories to be built here -# - -SUBDIRS = \ - $(EOLIST) - -# -# Get the 'head' of the build environment. This includes default targets and -# paths to tools -# - -include $(AP_WORK)\build\NWGNUhead.inc - -# -# build this level's files -# -# Make sure all needed macro's are defined -# - - -# -# These directories will be at the beginning of the include list, followed by -# INCDIRS -# -XINCDIRS += \ - $(AP_WORK)/include \ - $(NWOS) \ - $(AP_WORK)/modules/http \ - $(AP_WORK)/modules/arch/netware \ - $(AP_WORK)/srclib/apr/include \ - $(AP_WORK)/srclib/apr-util/include \ - $(AP_WORK)/srclib/apr \ - $(EOLIST) - -# -# These flags will come after CFLAGS -# -XCFLAGS += \ - -prefix pre_nw.h \ - $(EOLIST) - -# -# These defines will come after DEFINES -# -XDEFINES += \ - $(EOLIST) - -# -# These flags will be added to the link.opt file -# -XLFLAGS += \ - $(EOLIST) - -# -# These values will be appended to the correct variables based on the value of -# RELEASE -# -ifeq "$(RELEASE)" "debug" -XINCDIRS += \ - $(EOLIST) - -XCFLAGS += \ - $(EOLIST) - -XDEFINES += \ - $(EOLIST) - -XLFLAGS += \ - $(EOLIST) -endif - -ifeq "$(RELEASE)" "noopt" -XINCDIRS += \ - $(EOLIST) - -XCFLAGS += \ - $(EOLIST) - -XDEFINES += \ - $(EOLIST) - -XLFLAGS += \ - $(EOLIST) -endif - -ifeq "$(RELEASE)" "release" -XINCDIRS += \ - $(EOLIST) - -XCFLAGS += \ - $(EOLIST) - -XDEFINES += \ - $(EOLIST) - -XLFLAGS += \ - $(EOLIST) -endif - -# -# These are used by the link target if an NLM is being generated -# This is used by the link 'name' directive to name the nlm. If left blank -# TARGET_nlm (see below) will be used. -# -NLM_NAME = proxy - -# -# This is used by the link '-desc ' directive. -# If left blank, NLM_NAME will be used. -# -NLM_DESCRIPTION = Proxy Module - -# -# This is used by the '-threadname' directive. If left blank, -# NLM_NAME Thread will be used. -# -NLM_THREAD_NAME = Proxy Module - -# -# If this is specified, it will override VERSION value in -# $(AP_WORK)\build\NWGNUenvironment.inc -# -NLM_VERSION = - -# -# If this is specified, it will override the default of 64K -# -NLM_STACK_SIZE = 8192 - - -# -# If this is specified it will be used by the link '-entry' directive -# -NLM_ENTRY_SYM = _LibCPrelude - -# -# If this is specified it will be used by the link '-exit' directive -# -NLM_EXIT_SYM = _LibCPostlude - -# -# If this is specified it will be used by the link '-check' directive -# -NLM_CHECK_SYM = - -# -# If these are specified it will be used by the link '-flags' directive -# -NLM_FLAGS = AUTOUNLOAD, PSEUDOPREEMPTION - -# -# If this is specified it will be linked in with the XDCData option in the def -# file instead of the default of $(NWOS)/apache.xdc. XDCData can be disabled -# by setting APACHE_UNIPROC in the environment -# -XDCDATA = - -# -# If there is an NLM target, put it here -# -TARGET_nlm = \ - $(OBJDIR)/proxy.nlm \ - $(EOLIST) - -# -# If there is an LIB target, put it here -# -TARGET_lib = \ - $(EOLIST) - -# -# These are the OBJ files needed to create the NLM target above. -# Paths must all use the '/' character -# -FILES_nlm_objs = \ - $(OBJDIR)/mod_proxy.o \ - $(OBJDIR)/proxy_connect.o \ - $(OBJDIR)/proxy_ftp.o \ - $(OBJDIR)/proxy_http.o \ - $(OBJDIR)/proxy_util.o \ - $(OBJDIR)/libprews.o \ - $(EOLIST) - -# -# These are the LIB files needed to create the NLM target above. -# These will be added as a library command in the link.opt file. -# -FILES_nlm_libs = \ - libcpre.o \ - $(EOLIST) - -# -# These are the modules that the above NLM target depends on to load. -# These will be added as a module command in the link.opt file. -# -FILES_nlm_modules = \ - aprlib \ - libc \ - $(EOLIST) - -# -# If the nlm has a msg file, put it's path here -# -FILE_nlm_msg = - -# -# If the nlm has a hlp file put it's path here -# -FILE_nlm_hlp = - -# -# If this is specified, it will override $(NWOS)\copyright.txt. -# -FILE_nlm_copyright = - -# -# Any additional imports go here -# -FILES_nlm_Ximports = \ - @$(APR)/aprlib.imp \ - @$(NWOS)/httpd.imp \ - @libc.imp \ - @ws2nlm.imp \ - $(EOLIST) - -# -# Any symbols exported to here -# -FILES_nlm_exports = \ - proxy_module \ - $(EOLIST) - -# -# These are the OBJ files needed to create the LIB target above. -# Paths must all use the '/' character -# -FILES_lib_objs = \ - $(EOLIST) - -# -# implement targets and dependancies (leave this section alone) -# - -libs :: $(OBJDIR) $(TARGET_lib) - -nlms :: libs $(TARGET_nlm) - -# -# Updated this target to create necessary directories and copy files to the -# correct place. (See $(AP_WORK)\build\NWGNUhead.inc for examples) -# -install :: nlms FORCE - copy $(OBJDIR)\*.nlm $(INSTALL)\Apache2\modules\*.* - -# -# Any specialized rules here -# - -$(OBJDIR)/%.o: ../arch/netware/%.c $(OBJDIR)\cc.opt - @echo compiling $< - $(CC) $< -o=$(OBJDIR)\$(@F) @$(OBJDIR)\cc.opt - -# -# Include the 'tail' makefile that has targets that depend on variables defined -# in this makefile -# - -include $(AP_WORK)\build\NWGNUtail.inc - - diff --git a/modules/proxy/config.m4 b/modules/proxy/config.m4 deleted file mode 100644 index f6d5efdf71a3047f7a72f32209044beea5f90ee5..0000000000000000000000000000000000000000 --- a/modules/proxy/config.m4 +++ /dev/null @@ -1,32 +0,0 @@ -dnl modules enabled in this directory by default - -dnl AC_DEFUN(modulename, modulestructname, defaultonoroff, configmacros) -dnl XXX - Need to add help text to --enable-module flags -dnl XXX - Need to allow --enable-module to fail if optional config fails - -AC_DEFUN(APACHE_CHECK_PROXY_MODULE, [ - APACHE_MODULE($1,,,$2,$3,$4) -]) - -APACHE_MODPATH_INIT(proxy) - -APACHE_CHECK_PROXY_MODULE(proxy, , yes) - -dnl APACHE_CHECK_STANDARD_MODULE(auth_db, , no, [ -dnl AC_CHECK_HEADERS(db.h) -dnl AC_CHECK_LIB(db,main) -dnl ]) - -dnl APACHE_CHECK_STANDARD_MODULE(usertrack, , no, [ -dnl AC_CHECK_HEADERS(sys/times.h) -dnl AC_CHECK_FUNCS(times) -dnl ]) - -APACHE_MODPATH_FINISH - -if test "$sharedobjs" = "yes"; then - LIBS="$LIBS -ldl" - LTFLAGS="$LTFLAGS -export-dynamic" -fi - -APACHE_SUBST(STANDARD_LIBS) diff --git a/modules/proxy/libproxy.exp b/modules/proxy/libproxy.exp deleted file mode 100644 index a20f2378f59aae41562c8fd0853f1c990e66a883..0000000000000000000000000000000000000000 --- a/modules/proxy/libproxy.exp +++ /dev/null @@ -1 +0,0 @@ -proxy_module diff --git a/modules/proxy/mod_proxy.c b/modules/proxy/mod_proxy.c deleted file mode 100644 index 5d22d0816434d0189319fb3c85b8cde1d25b9999..0000000000000000000000000000000000000000 --- a/modules/proxy/mod_proxy.c +++ /dev/null @@ -1,898 +0,0 @@ -/* ==================================================================== - * Copyright (c) 1996-1999 The Apache Group. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in - * the documentation and/or other materials provided with the - * distribution. - * - * 3. All advertising materials mentioning features or use of this - * software must display the following acknowledgment: - * "This product includes software developed by the Apache Group - * for use in the Apache HTTP server project (http://www.apache.org/)." - * - * 4. The names "Apache Server" and "Apache Group" must not be used to - * endorse or promote products derived from this software without - * prior written permission. For written permission, please contact - * apache@apache.org. - * - * 5. Products derived from this software may not be called "Apache" - * nor may "Apache" appear in their names without prior written - * permission of the Apache Group. - * - * 6. Redistributions of any form whatsoever must retain the following - * acknowledgment: - * "This product includes software developed by the Apache Group - * for use in the Apache HTTP server project (http://www.apache.org/)." - * - * THIS SOFTWARE IS PROVIDED BY THE APACHE GROUP ``AS IS'' AND ANY - * EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR - * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE APACHE GROUP OR - * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT - * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, - * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED - * OF THE POSSIBILITY OF SUCH DAMAGE. - * ==================================================================== - * - * This software consists of voluntary contributions made by many - * individuals on behalf of the Apache Group and was originally based - * on public domain software written at the National Center for - * Supercomputing Applications, University of Illinois, Urbana-Champaign. - * For more information on the Apache Group and the Apache HTTP server - * project, please see <http://www.apache.org/>. - * - */ - -#include "mod_proxy.h" - -#define CORE_PRIVATE - -#include "http_log.h" -#include "http_vhost.h" -#include "http_request.h" - -/* Some WWW schemes and their default ports; this is basically /etc/services */ -/* This will become global when the protocol abstraction comes */ -static struct proxy_services defports[] = -{ - {"http", DEFAULT_HTTP_PORT}, - {"ftp", DEFAULT_FTP_PORT}, - {"https", DEFAULT_HTTPS_PORT}, - {"gopher", DEFAULT_GOPHER_PORT}, - {"nntp", DEFAULT_NNTP_PORT}, - {"wais", DEFAULT_WAIS_PORT}, - {"snews", DEFAULT_SNEWS_PORT}, - {"prospero", DEFAULT_PROSPERO_PORT}, - {NULL, -1} /* unknown port */ -}; - -/* - * A Web proxy module. Stages: - * - * translate_name: set filename to proxy:<URL> - * type_checker: set type to PROXY_MAGIC_TYPE if filename begins proxy: - * fix_ups: convert the URL stored in the filename to the - * canonical form. - * handler: handle proxy requests - */ - -/* -------------------------------------------------------------- */ -/* Translate the URL into a 'filename' */ - -static int alias_match(const char *uri, const char *alias_fakename) -{ - const char *end_fakename = alias_fakename + strlen(alias_fakename); - const char *aliasp = alias_fakename, *urip = uri; - - while (aliasp < end_fakename) { - if (*aliasp == '/') { - /* any number of '/' in the alias matches any number in - * the supplied URI, but there must be at least one... - */ - if (*urip != '/') - return 0; - - while (*aliasp == '/') - ++aliasp; - while (*urip == '/') - ++urip; - } - else { - /* Other characters are compared literally */ - if (*urip++ != *aliasp++) - return 0; - } - } - - /* Check last alias path component matched all the way */ - - if (aliasp[-1] != '/' && *urip != '\0' && *urip != '/') - return 0; - - /* Return number of characters from URI which matched (may be - * greater than length of alias, since we may have matched - * doubled slashes) - */ - - return urip - uri; -} - -/* Detect if an absoluteURI should be proxied or not. Note that we - * have to do this during this phase because later phases are - * "short-circuiting"... i.e. translate_names will end when the first - * module returns OK. So for example, if the request is something like: - * - * GET http://othervhost/cgi-bin/printenv HTTP/1.0 - * - * mod_alias will notice the /cgi-bin part and ScriptAlias it and - * short-circuit the proxy... just because of the ordering in the - * configuration file. - */ -static int proxy_detect(request_rec *r) -{ - void *sconf = r->server->module_config; - proxy_server_conf *conf; - - conf = (proxy_server_conf *) ap_get_module_config(sconf, &proxy_module); - - if (conf->req && r->parsed_uri.scheme) { - /* but it might be something vhosted */ - if (!(r->parsed_uri.hostname - && !strcasecmp(r->parsed_uri.scheme, ap_http_method(r)) - && ap_matches_request_vhost(r, r->parsed_uri.hostname, - r->parsed_uri.port_str ? r->parsed_uri.port : ap_default_port(r)))) { - r->proxyreq = 1; - r->uri = r->unparsed_uri; - r->filename = ap_pstrcat(r->pool, "proxy:", r->uri, NULL); - r->handler = "proxy-server"; - } - } - /* We need special treatment for CONNECT proxying: it has no scheme part */ - else if (conf->req && r->method_number == M_CONNECT - && r->parsed_uri.hostname - && r->parsed_uri.port_str) { - r->proxyreq = 1; - r->uri = r->unparsed_uri; - r->filename = ap_pstrcat(r->pool, "proxy:", r->uri, NULL); - r->handler = "proxy-server"; - } - return DECLINED; -} - -static int proxy_trans(request_rec *r) -{ - void *sconf = r->server->module_config; - proxy_server_conf *conf = - (proxy_server_conf *) ap_get_module_config(sconf, &proxy_module); - int i, len; - struct proxy_alias *ent = (struct proxy_alias *) conf->aliases->elts; - - if (r->proxyreq) { - /* someone has already set up the proxy, it was possibly ourselves - * in proxy_detect - */ - return OK; - } - - /* XXX: since r->uri has been manipulated already we're not really - * compliant with RFC1945 at this point. But this probably isn't - * an issue because this is a hybrid proxy/origin server. - */ - - for (i = 0; i < conf->aliases->nelts; i++) { - len = alias_match(r->uri, ent[i].fake); - - if (len > 0) { - r->filename = ap_pstrcat(r->pool, "proxy:", ent[i].real, - r->uri + len, NULL); - r->handler = "proxy-server"; - r->proxyreq = 1; - return OK; - } - } - return DECLINED; -} - -/* -------------------------------------------------------------- */ -/* Fixup the filename */ - -/* - * Canonicalise the URL - */ -static int proxy_fixup(request_rec *r) -{ - char *url, *p; - - if (!r->proxyreq || strncmp(r->filename, "proxy:", 6) != 0) - return DECLINED; - - url = &r->filename[6]; - -/* canonicalise each specific scheme */ - if (strncasecmp(url, "http:", 5) == 0) - return ap_proxy_http_canon(r, url + 5, "http", DEFAULT_HTTP_PORT); - else if (strncasecmp(url, "ftp:", 4) == 0) - return ap_proxy_ftp_canon(r, url + 4); - - p = strchr(url, ':'); - if (p == NULL || p == url) - return HTTP_BAD_REQUEST; - - return OK; /* otherwise; we've done the best we can */ -} - -static void proxy_init(server_rec *r, pool *p) -{ - ap_proxy_garbage_init(r, p); -} - - - -/* Send a redirection if the request contains a hostname which is not */ -/* fully qualified, i.e. doesn't have a domain name appended. Some proxy */ -/* servers like Netscape's allow this and access hosts from the local */ -/* domain in this case. I think it is better to redirect to a FQDN, since */ -/* these will later be found in the bookmarks files. */ -/* The "ProxyDomain" directive determines what domain will be appended */ -static int proxy_needsdomain(request_rec *r, const char *url, const char *domain) -{ - char *nuri; - const char *ref; - - /* We only want to worry about GETs */ - if (!r->proxyreq || r->method_number != M_GET || !r->parsed_uri.hostname) - return DECLINED; - - /* If host does contain a dot already, or it is "localhost", decline */ - if (strchr(r->parsed_uri.hostname, '.') != NULL - || strcasecmp(r->parsed_uri.hostname, "localhost") == 0) - return DECLINED; /* host name has a dot already */ - - ref = ap_table_get(r->headers_in, "Referer"); - - /* Reassemble the request, but insert the domain after the host name */ - /* Note that the domain name always starts with a dot */ - r->parsed_uri.hostname = ap_pstrcat(r->pool, r->parsed_uri.hostname, - domain, NULL); - nuri = ap_unparse_uri_components(r->pool, - &r->parsed_uri, - UNP_REVEALPASSWORD); - - ap_table_set(r->headers_out, "Location", nuri); - ap_log_rerror(APLOG_MARK, APLOG_INFO|APLOG_NOERRNO, r, - "Domain missing: %s sent to %s%s%s", r->uri, - ap_unparse_uri_components(r->pool, &r->parsed_uri, - UNP_OMITUSERINFO), - ref ? " from " : "", ref ? ref : ""); - - return HTTP_MOVED_PERMANENTLY; -} - -/* -------------------------------------------------------------- */ -/* Invoke handler */ - -static int proxy_handler(request_rec *r) -{ - char *url, *scheme, *p; - void *sconf = r->server->module_config; - proxy_server_conf *conf = - (proxy_server_conf *) ap_get_module_config(sconf, &proxy_module); - array_header *proxies = conf->proxies; - struct proxy_remote *ents = (struct proxy_remote *) proxies->elts; - int i, rc; - cache_req *cr; - int direct_connect = 0; - const char *maxfwd_str; - - if (!r->proxyreq || strncmp(r->filename, "proxy:", 6) != 0) - return DECLINED; - - if (r->method_number == M_TRACE && - (maxfwd_str = ap_table_get(r->headers_in, "Max-Forwards")) != NULL) { - int maxfwd = strtol(maxfwd_str, NULL, 10); - if (maxfwd < 1) { - int access_status; - r->proxyreq = 0; - if ((access_status = ap_send_http_trace(r))) - ap_die(access_status, r); - else - ap_finalize_request_protocol(r); - return OK; - } - ap_table_setn(r->headers_in, "Max-Forwards", - ap_psprintf(r->pool, "%d", (maxfwd > 0) ? maxfwd-1 : 0)); - } - - if ((rc = ap_setup_client_block(r, REQUEST_CHUNKED_ERROR))) - return rc; - - url = r->filename + 6; - p = strchr(url, ':'); - if (p == NULL) - return HTTP_BAD_REQUEST; - - rc = ap_proxy_cache_check(r, url, &conf->cache, &cr); - if (rc != DECLINED) - return rc; - - /* If the host doesn't have a domain name, add one and redirect. */ - if (conf->domain != NULL) { - rc = proxy_needsdomain(r, url, conf->domain); - if (ap_is_HTTP_REDIRECT(rc)) - return HTTP_MOVED_PERMANENTLY; - } - - *p = '\0'; - scheme = ap_pstrdup(r->pool, url); - *p = ':'; - - /* Check URI's destination host against NoProxy hosts */ - /* Bypass ProxyRemote server lookup if configured as NoProxy */ - /* we only know how to handle communication to a proxy via http */ - /*if (strcasecmp(scheme, "http") == 0) */ - { - int ii; - struct dirconn_entry *list = (struct dirconn_entry *) conf->dirconn->elts; - - for (direct_connect = ii = 0; ii < conf->dirconn->nelts && !direct_connect; ii++) { - direct_connect = list[ii].matcher(&list[ii], r); - } -#if DEBUGGING - ap_log_rerror(APLOG_MARK, APLOG_DEBUG|APLOG_NOERRNO, r, - (direct_connect) ? "NoProxy for %s" : "UseProxy for %s", - r->uri); -#endif - } - -/* firstly, try a proxy, unless a NoProxy directive is active */ - - if (!direct_connect) - for (i = 0; i < proxies->nelts; i++) { - p = strchr(ents[i].scheme, ':'); /* is it a partial URL? */ - if (strcmp(ents[i].scheme, "*") == 0 || - (p == NULL && strcasecmp(scheme, ents[i].scheme) == 0) || - (p != NULL && - strncasecmp(url, ents[i].scheme, strlen(ents[i].scheme)) == 0)) { - /* CONNECT is a special method that bypasses the normal - * proxy code. - */ - if (r->method_number == M_CONNECT) - rc = ap_proxy_connect_handler(r, cr, url, ents[i].hostname, - ents[i].port); -/* we only know how to handle communication to a proxy via http */ - else if (strcasecmp(ents[i].protocol, "http") == 0) - rc = ap_proxy_http_handler(r, cr, url, ents[i].hostname, - ents[i].port); - else - rc = DECLINED; - - /* an error or success */ - if (rc != DECLINED && rc != HTTP_BAD_GATEWAY) - return rc; - /* we failed to talk to the upstream proxy */ - } - } - -/* otherwise, try it direct */ -/* N.B. what if we're behind a firewall, where we must use a proxy or - * give up?? - */ - /* handle the scheme */ - if (r->method_number == M_CONNECT) - return ap_proxy_connect_handler(r, cr, url, NULL, 0); - if (strcasecmp(scheme, "http") == 0) - return ap_proxy_http_handler(r, cr, url, NULL, 0); - if (strcasecmp(scheme, "ftp") == 0) - return ap_proxy_ftp_handler(r, cr, url); - else - return HTTP_FORBIDDEN; -} - -/* -------------------------------------------------------------- */ -/* Setup configurable data */ - -static void * - create_proxy_config(pool *p, server_rec *s) -{ - proxy_server_conf *ps = ap_pcalloc(p, sizeof(proxy_server_conf)); - - ps->proxies = ap_make_array(p, 10, sizeof(struct proxy_remote)); - ps->aliases = ap_make_array(p, 10, sizeof(struct proxy_alias)); - ps->raliases = ap_make_array(p, 10, sizeof(struct proxy_alias)); - ps->noproxies = ap_make_array(p, 10, sizeof(struct noproxy_entry)); - ps->dirconn = ap_make_array(p, 10, sizeof(struct dirconn_entry)); - ps->nocaches = ap_make_array(p, 10, sizeof(struct nocache_entry)); - ps->allowed_connect_ports = ap_make_array(p, 10, sizeof(int)); - ps->domain = NULL; - ps->viaopt = via_off; /* initially backward compatible with 1.3.1 */ - ps->req = 0; - - ps->cache.root = NULL; - ps->cache.space = DEFAULT_CACHE_SPACE; - ps->cache.maxexpire = DEFAULT_CACHE_MAXEXPIRE; - ps->cache.defaultexpire = DEFAULT_CACHE_EXPIRE; - ps->cache.lmfactor = DEFAULT_CACHE_LMFACTOR; - ps->cache.gcinterval = -1; - /* at these levels, the cache can have 2^18 directories (256,000) */ - ps->cache.dirlevels = 3; - ps->cache.dirlength = 1; - ps->cache.cache_completion = DEFAULT_CACHE_COMPLETION; - - return ps; -} - -static const char * - add_proxy(cmd_parms *cmd, void *dummy, char *f, char *r) -{ - server_rec *s = cmd->server; - proxy_server_conf *conf = - (proxy_server_conf *) ap_get_module_config(s->module_config, &proxy_module); - struct proxy_remote *new; - char *p, *q; - int port; - - p = strchr(r, ':'); - if (p == NULL || p[1] != '/' || p[2] != '/' || p[3] == '\0') - return "ProxyRemote: Bad syntax for a remote proxy server"; - q = strchr(p + 3, ':'); - if (q != NULL) { - if (sscanf(q + 1, "%u", &port) != 1 || port > 65535) - return "ProxyRemote: Bad syntax for a remote proxy server (bad port number)"; - *q = '\0'; - } - else - port = -1; - *p = '\0'; - if (strchr(f, ':') == NULL) - ap_str_tolower(f); /* lowercase scheme */ - ap_str_tolower(p + 3); /* lowercase hostname */ - - if (port == -1) { - int i; - for (i = 0; defports[i].scheme != NULL; i++) - if (strcasecmp(defports[i].scheme, r) == 0) - break; - port = defports[i].port; - } - - new = ap_push_array(conf->proxies); - new->scheme = f; - new->protocol = r; - new->hostname = p + 3; - new->port = port; - return NULL; -} - -static const char * - add_pass(cmd_parms *cmd, void *dummy, char *f, char *r) -{ - server_rec *s = cmd->server; - proxy_server_conf *conf = - (proxy_server_conf *) ap_get_module_config(s->module_config, &proxy_module); - struct proxy_alias *new; - - new = ap_push_array(conf->aliases); - new->fake = f; - new->real = r; - return NULL; -} - -static const char * - add_pass_reverse(cmd_parms *cmd, void *dummy, char *f, char *r) -{ - server_rec *s = cmd->server; - proxy_server_conf *conf; - struct proxy_alias *new; - - conf = (proxy_server_conf *)ap_get_module_config(s->module_config, - &proxy_module); - new = ap_push_array(conf->raliases); - new->fake = f; - new->real = r; - return NULL; -} - -static const char * - set_proxy_exclude(cmd_parms *parms, void *dummy, char *arg) -{ - server_rec *s = parms->server; - proxy_server_conf *conf = - ap_get_module_config(s->module_config, &proxy_module); - struct noproxy_entry *new; - struct noproxy_entry *list = (struct noproxy_entry *) conf->noproxies->elts; - struct hostent hp; - int found = 0; - int i; - - /* Don't duplicate entries */ - for (i = 0; i < conf->noproxies->nelts; i++) { - if (strcasecmp(arg, list[i].name) == 0) /* ignore case for host names */ - found = 1; - } - - if (!found) { - new = ap_push_array(conf->noproxies); - new->name = arg; - /* Don't do name lookups on things that aren't dotted */ - if (strchr(arg, '.') != NULL && ap_proxy_host2addr(new->name, &hp) == NULL) - /*@@@FIXME: This copies only the first of (possibly many) IP addrs */ - memcpy(&new->addr, hp.h_addr, sizeof(struct in_addr)); - else - new->addr.s_addr = 0; - } - return NULL; -} - -/* - * Set the ports CONNECT can use - */ -static const char * - set_allowed_ports(cmd_parms *parms, void *dummy, char *arg) -{ - server_rec *s = parms->server; - proxy_server_conf *conf = - ap_get_module_config(s->module_config, &proxy_module); - int *New; - - if (!ap_isdigit(arg[0])) - return "AllowCONNECT: port number must be numeric"; - - New = ap_push_array(conf->allowed_connect_ports); - *New = atoi(arg); - return NULL; -} - -/* Similar to set_proxy_exclude(), but defining directly connected hosts, - * which should never be accessed via the configured ProxyRemote servers - */ -static const char * - set_proxy_dirconn(cmd_parms *parms, void *dummy, char *arg) -{ - server_rec *s = parms->server; - proxy_server_conf *conf = - ap_get_module_config(s->module_config, &proxy_module); - struct dirconn_entry *New; - struct dirconn_entry *list = (struct dirconn_entry *) conf->dirconn->elts; - int found = 0; - int i; - - /* Don't duplicate entries */ - for (i = 0; i < conf->dirconn->nelts; i++) { - if (strcasecmp(arg, list[i].name) == 0) - found = 1; - } - - if (!found) { - New = ap_push_array(conf->dirconn); - New->name = arg; - New->hostentry = NULL; - - if (ap_proxy_is_ipaddr(New, parms->pool)) { -#if DEBUGGING - fprintf(stderr, "Parsed addr %s\n", inet_ntoa(New->addr)); - fprintf(stderr, "Parsed mask %s\n", inet_ntoa(New->mask)); -#endif - } - else if (ap_proxy_is_domainname(New, parms->pool)) { - ap_str_tolower(New->name); -#if DEBUGGING - fprintf(stderr, "Parsed domain %s\n", New->name); -#endif - } - else if (ap_proxy_is_hostname(New, parms->pool)) { - ap_str_tolower(New->name); -#if DEBUGGING - fprintf(stderr, "Parsed host %s\n", New->name); -#endif - } - else { - ap_proxy_is_word(New, parms->pool); -#if DEBUGGING - fprintf(stderr, "Parsed word %s\n", New->name); -#endif - } - } - return NULL; -} - -static const char * - set_proxy_domain(cmd_parms *parms, void *dummy, char *arg) -{ - proxy_server_conf *psf = - ap_get_module_config(parms->server->module_config, &proxy_module); - - if (arg[0] != '.') - return "ProxyDomain: domain name must start with a dot."; - - psf->domain = arg; - return NULL; -} - -static const char * - set_proxy_req(cmd_parms *parms, void *dummy, int flag) -{ - proxy_server_conf *psf = - ap_get_module_config(parms->server->module_config, &proxy_module); - - psf->req = flag; - return NULL; -} - - -static const char * - set_cache_size(cmd_parms *parms, char *struct_ptr, char *arg) -{ - proxy_server_conf *psf = - ap_get_module_config(parms->server->module_config, &proxy_module); - int val; - - if (sscanf(arg, "%d", &val) != 1) - return "CacheSize value must be an integer (kBytes)"; - psf->cache.space = val; - return NULL; -} - -static const char * - set_cache_root(cmd_parms *parms, void *dummy, char *arg) -{ - proxy_server_conf *psf = - ap_get_module_config(parms->server->module_config, &proxy_module); - - psf->cache.root = arg; - - return NULL; -} - -static const char * - set_cache_factor(cmd_parms *parms, void *dummy, char *arg) -{ - proxy_server_conf *psf = - ap_get_module_config(parms->server->module_config, &proxy_module); - double val; - - if (sscanf(arg, "%lg", &val) != 1) - return "CacheLastModifiedFactor value must be a float"; - psf->cache.lmfactor = val; - - return NULL; -} - -static const char * - set_cache_maxex(cmd_parms *parms, void *dummy, char *arg) -{ - proxy_server_conf *psf = - ap_get_module_config(parms->server->module_config, &proxy_module); - double val; - - if (sscanf(arg, "%lg", &val) != 1) - return "CacheMaxExpire value must be a float"; - psf->cache.maxexpire = (int) (val * (double) SEC_ONE_HR); - return NULL; -} - -static const char * - set_cache_defex(cmd_parms *parms, void *dummy, char *arg) -{ - proxy_server_conf *psf = - ap_get_module_config(parms->server->module_config, &proxy_module); - double val; - - if (sscanf(arg, "%lg", &val) != 1) - return "CacheDefaultExpire value must be a float"; - psf->cache.defaultexpire = (int) (val * (double) SEC_ONE_HR); - return NULL; -} - -static const char * - set_cache_gcint(cmd_parms *parms, void *dummy, char *arg) -{ - proxy_server_conf *psf = - ap_get_module_config(parms->server->module_config, &proxy_module); - double val; - - if (sscanf(arg, "%lg", &val) != 1) - return "CacheGcInterval value must be a float"; - psf->cache.gcinterval = (int) (val * (double) SEC_ONE_HR); - return NULL; -} - -static const char * - set_cache_dirlevels(cmd_parms *parms, char *struct_ptr, char *arg) -{ - proxy_server_conf *psf = - ap_get_module_config(parms->server->module_config, &proxy_module); - int val; - - val = atoi(arg); - if (val < 1) - return "CacheDirLevels value must be an integer greater than 0"; - if (val * psf->cache.dirlength > CACHEFILE_LEN) - return "CacheDirLevels*CacheDirLength value must not be higher than 20"; - psf->cache.dirlevels = val; - return NULL; -} - -static const char * - set_cache_dirlength(cmd_parms *parms, char *struct_ptr, char *arg) -{ - proxy_server_conf *psf = - ap_get_module_config(parms->server->module_config, &proxy_module); - int val; - - val = atoi(arg); - if (val < 1) - return "CacheDirLength value must be an integer greater than 0"; - if (val * psf->cache.dirlevels > CACHEFILE_LEN) - return "CacheDirLevels*CacheDirLength value must not be higher than 20"; - psf->cache.dirlength = val; - return NULL; -} - -static const char * - set_cache_exclude(cmd_parms *parms, void *dummy, char *arg) -{ - server_rec *s = parms->server; - proxy_server_conf *conf = - ap_get_module_config(s->module_config, &proxy_module); - struct nocache_entry *new; - struct nocache_entry *list = (struct nocache_entry *) conf->nocaches->elts; - struct hostent hp; - int found = 0; - int i; - - /* Don't duplicate entries */ - for (i = 0; i < conf->nocaches->nelts; i++) { - if (strcasecmp(arg, list[i].name) == 0) /* ignore case for host names */ - found = 1; - } - - if (!found) { - new = ap_push_array(conf->nocaches); - new->name = arg; - /* Don't do name lookups on things that aren't dotted */ - if (strchr(arg, '.') != NULL && ap_proxy_host2addr(new->name, &hp) == NULL) - /*@@@FIXME: This copies only the first of (possibly many) IP addrs */ - memcpy(&new->addr, hp.h_addr, sizeof(struct in_addr)); - else - new->addr.s_addr = 0; - } - return NULL; -} - -static const char * - set_recv_buffer_size(cmd_parms *parms, void *dummy, char *arg) -{ - proxy_server_conf *psf = - ap_get_module_config(parms->server->module_config, &proxy_module); - int s = atoi(arg); - if (s < 512 && s != 0) { - return "ProxyReceiveBufferSize must be >= 512 bytes, or 0 for system default."; - } - - psf->recv_buffer_size = s; - return NULL; -} - -static const char* - set_cache_completion(cmd_parms *parms, void *dummy, char *arg) -{ - proxy_server_conf *psf = - ap_get_module_config(parms->server->module_config, &proxy_module); - int s = atoi(arg); - if (s > 100 || s < 0) { - return "CacheForceCompletion must be <= 100 percent, " - "or 0 for system default."; - } - - if (s > 0) - psf->cache.cache_completion = ((float)s / 100); - return NULL; -} - -static const char* - set_via_opt(cmd_parms *parms, void *dummy, char *arg) -{ - proxy_server_conf *psf = - ap_get_module_config(parms->server->module_config, &proxy_module); - - if (strcasecmp(arg, "Off") == 0) - psf->viaopt = via_off; - else if (strcasecmp(arg, "On") == 0) - psf->viaopt = via_on; - else if (strcasecmp(arg, "Block") == 0) - psf->viaopt = via_block; - else if (strcasecmp(arg, "Full") == 0) - psf->viaopt = via_full; - else { - return "ProxyVia must be one of: " - "off | on | full | block"; - } - - return NULL; -} - -static const handler_rec proxy_handlers[] = -{ - {"proxy-server", proxy_handler}, - {NULL} -}; - -static const command_rec proxy_cmds[] = -{ - {"ProxyRequests", set_proxy_req, NULL, RSRC_CONF, FLAG, - "on if the true proxy requests should be accepted"}, - {"ProxyRemote", add_proxy, NULL, RSRC_CONF, TAKE2, - "a scheme, partial URL or '*' and a proxy server"}, - {"ProxyPass", add_pass, NULL, RSRC_CONF, TAKE2, - "a virtual path and a URL"}, - {"ProxyPassReverse", add_pass_reverse, NULL, RSRC_CONF, TAKE2, - "a virtual path and a URL for reverse proxy behaviour"}, - {"ProxyBlock", set_proxy_exclude, NULL, RSRC_CONF, ITERATE, - "A list of names, hosts or domains to which the proxy will not connect"}, - {"ProxyReceiveBufferSize", set_recv_buffer_size, NULL, RSRC_CONF, TAKE1, - "Receive buffer size for outgoing HTTP and FTP connections in bytes"}, - {"NoProxy", set_proxy_dirconn, NULL, RSRC_CONF, ITERATE, - "A list of domains, hosts, or subnets to which the proxy will connect directly"}, - {"ProxyDomain", set_proxy_domain, NULL, RSRC_CONF, TAKE1, - "The default intranet domain name (in absence of a domain in the URL)"}, - {"AllowCONNECT", set_allowed_ports, NULL, RSRC_CONF, ITERATE, - "A list of ports which CONNECT may connect to"}, - {"CacheRoot", set_cache_root, NULL, RSRC_CONF, TAKE1, - "The directory to store cache files"}, - {"CacheSize", set_cache_size, NULL, RSRC_CONF, TAKE1, - "The maximum disk space used by the cache in Kb"}, - {"CacheMaxExpire", set_cache_maxex, NULL, RSRC_CONF, TAKE1, - "The maximum time in hours to cache a document"}, - {"CacheDefaultExpire", set_cache_defex, NULL, RSRC_CONF, TAKE1, - "The default time in hours to cache a document"}, - {"CacheLastModifiedFactor", set_cache_factor, NULL, RSRC_CONF, TAKE1, - "The factor used to estimate Expires date from LastModified date"}, - {"CacheGcInterval", set_cache_gcint, NULL, RSRC_CONF, TAKE1, - "The interval between garbage collections, in hours"}, - {"CacheDirLevels", set_cache_dirlevels, NULL, RSRC_CONF, TAKE1, - "The number of levels of subdirectories in the cache"}, - {"CacheDirLength", set_cache_dirlength, NULL, RSRC_CONF, TAKE1, - "The number of characters in subdirectory names"}, - {"NoCache", set_cache_exclude, NULL, RSRC_CONF, ITERATE, - "A list of names, hosts or domains for which caching is *not* provided"}, - {"CacheForceCompletion", set_cache_completion, NULL, RSRC_CONF, TAKE1, - "Force a http cache completion after this percentage is loaded"}, - {"ProxyVia", set_via_opt, NULL, RSRC_CONF, TAKE1, - "Configure Via: proxy header header to one of: on | off | block | full"}, - {NULL} -}; - -module MODULE_VAR_EXPORT proxy_module = -{ - STANDARD_MODULE_STUFF, - proxy_init, /* initializer */ - NULL, /* create per-directory config structure */ - NULL, /* merge per-directory config structures */ - create_proxy_config, /* create per-server config structure */ - NULL, /* merge per-server config structures */ - proxy_cmds, /* command table */ - proxy_handlers, /* handlers */ - proxy_trans, /* translate_handler */ - NULL, /* check_user_id */ - NULL, /* check auth */ - NULL, /* check access */ - NULL, /* type_checker */ - proxy_fixup, /* pre-run fixups */ - NULL, /* logger */ - NULL, /* header parser */ - NULL, /* child_init */ - NULL, /* child_exit */ - proxy_detect /* post read-request */ -}; diff --git a/modules/proxy/mod_proxy.dsp b/modules/proxy/mod_proxy.dsp deleted file mode 100644 index 6ee5cf30ddd0c12e59f80338568d6b7d052e6f61..0000000000000000000000000000000000000000 --- a/modules/proxy/mod_proxy.dsp +++ /dev/null @@ -1,133 +0,0 @@ -# Microsoft Developer Studio Project File - Name="ApacheModuleProxy" - Package Owner=<4> -# Microsoft Developer Studio Generated Build File, Format Version 5.00 -# ** DO NOT EDIT ** - -# TARGTYPE "Win32 (x86) Dynamic-Link Library" 0x0102 - -CFG=ApacheModuleProxy - Win32 Release -!MESSAGE This is not a valid makefile. To build this project using NMAKE, -!MESSAGE use the Export Makefile command and run -!MESSAGE -!MESSAGE NMAKE /f "ApacheModuleProxy.mak". -!MESSAGE -!MESSAGE You can specify a configuration when running NMAKE -!MESSAGE by defining the macro CFG on the command line. For example: -!MESSAGE -!MESSAGE NMAKE /f "ApacheModuleProxy.mak"\ - CFG="ApacheModuleProxy - Win32 Release" -!MESSAGE -!MESSAGE Possible choices for configuration are: -!MESSAGE -!MESSAGE "ApacheModuleProxy - Win32 Release" (based on\ - "Win32 (x86) Dynamic-Link Library") -!MESSAGE "ApacheModuleProxy - Win32 Debug" (based on\ - "Win32 (x86) Dynamic-Link Library") -!MESSAGE - -# Begin Project -# PROP Scc_ProjName "" -# PROP Scc_LocalPath "" -CPP=cl.exe -MTL=midl.exe -RSC=rc.exe - -!IF "$(CFG)" == "ApacheModuleProxy - Win32 Release" - -# PROP BASE Use_MFC 0 -# PROP BASE Use_Debug_Libraries 0 -# PROP BASE Output_Dir ".\ApacheMo" -# PROP BASE Intermediate_Dir ".\ApacheMo" -# PROP BASE Target_Dir "" -# PROP Use_MFC 0 -# PROP Use_Debug_Libraries 0 -# PROP Output_Dir ".\Release" -# PROP Intermediate_Dir ".\Release" -# PROP Ignore_Export_Lib 0 -# PROP Target_Dir "" -# ADD BASE CPP /nologo /MT /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /YX /c -# ADD CPP /nologo /MD /W3 /GX /O2 /I "..\..\include" /D "NDEBUG" /D "WIN32" /D "_WINDOWS" /D "SHARED_MODULE" /D "WIN32_LEAN_AND_MEAN" /YX /FD /c -# ADD BASE MTL /nologo /D "NDEBUG" /win32 -# ADD MTL /nologo /D "NDEBUG" /mktyplib203 /win32 -# ADD BASE RSC /l 0x809 /d "NDEBUG" -# ADD RSC /l 0x809 /d "NDEBUG" -BSC32=bscmake.exe -# ADD BASE BSC32 /nologo -# ADD BSC32 /nologo -LINK32=link.exe -# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:windows /dll /machine:I386 -# ADD LINK32 ..\..\CoreR\ApacheCore.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ws2_32.lib /nologo /subsystem:windows /dll /machine:I386 - -!ELSEIF "$(CFG)" == "ApacheModuleProxy - Win32 Debug" - -# PROP BASE Use_MFC 0 -# PROP BASE Use_Debug_Libraries 1 -# PROP BASE Output_Dir ".\ApacheM0" -# PROP BASE Intermediate_Dir ".\ApacheM0" -# PROP BASE Target_Dir "" -# PROP Use_MFC 0 -# PROP Use_Debug_Libraries 1 -# PROP Output_Dir ".\Debug" -# PROP Intermediate_Dir ".\Debug" -# PROP Ignore_Export_Lib 0 -# PROP Target_Dir "" -# ADD BASE CPP /nologo /MTd /W3 /Gm /GX /Zi /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /YX /c -# ADD CPP /nologo /MDd /W3 /Gm /GX /Zi /Od /I "..\..\include" /D "_DEBUG" /D "WIN32" /D "_WINDOWS" /D "SHARED_MODULE" /D "WIN32_LEAN_AND_MEAN" /YX /FD /c -# ADD BASE MTL /nologo /D "_DEBUG" /win32 -# ADD MTL /nologo /D "_DEBUG" /mktyplib203 /win32 -# ADD BASE RSC /l 0x809 /d "_DEBUG" -# ADD RSC /l 0x809 /d "_DEBUG" -BSC32=bscmake.exe -# ADD BASE BSC32 /nologo -# ADD BSC32 /nologo -LINK32=link.exe -# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:windows /dll /debug /machine:I386 -# ADD LINK32 ..\..\CoreD\ApacheCore.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ws2_32.lib /nologo /subsystem:windows /dll /debug /machine:I386 - -!ENDIF - -# Begin Target - -# Name "ApacheModuleProxy - Win32 Release" -# Name "ApacheModuleProxy - Win32 Debug" -# Begin Group "Source Files" - -# PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;hpj;bat;for;f90" -# Begin Source File - -SOURCE=.\mod_proxy.c -# End Source File -# Begin Source File - -SOURCE=.\proxy_cache.c -# End Source File -# Begin Source File - -SOURCE=.\proxy_connect.c -# End Source File -# Begin Source File - -SOURCE=.\proxy_ftp.c -# End Source File -# Begin Source File - -SOURCE=.\proxy_http.c -# End Source File -# Begin Source File - -SOURCE=.\proxy_util.c -# End Source File -# End Group -# Begin Group "Header Files" - -# PROP Default_Filter "h;hpp;hxx;hm;inl;fi;fd" -# Begin Source File - -SOURCE=.\mod_proxy.h -# End Source File -# End Group -# Begin Group "Resource Files" - -# PROP Default_Filter "ico;cur;bmp;dlg;rc2;rct;bin;cnt;rtf;gif;jpg;jpeg;jpe" -# End Group -# End Target -# End Project diff --git a/modules/proxy/mod_proxy.h b/modules/proxy/mod_proxy.h deleted file mode 100644 index 9eb3428d80c032deae758cc4f67b6666a79c2076..0000000000000000000000000000000000000000 --- a/modules/proxy/mod_proxy.h +++ /dev/null @@ -1,316 +0,0 @@ -/* ==================================================================== - * Copyright (c) 1996-1999 The Apache Group. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in - * the documentation and/or other materials provided with the - * distribution. - * - * 3. All advertising materials mentioning features or use of this - * software must display the following acknowledgment: - * "This product includes software developed by the Apache Group - * for use in the Apache HTTP server project (http://www.apache.org/)." - * - * 4. The names "Apache Server" and "Apache Group" must not be used to - * endorse or promote products derived from this software without - * prior written permission. For written permission, please contact - * apache@apache.org. - * - * 5. Products derived from this software may not be called "Apache" - * nor may "Apache" appear in their names without prior written - * permission of the Apache Group. - * - * 6. Redistributions of any form whatsoever must retain the following - * acknowledgment: - * "This product includes software developed by the Apache Group - * for use in the Apache HTTP server project (http://www.apache.org/)." - * - * THIS SOFTWARE IS PROVIDED BY THE APACHE GROUP ``AS IS'' AND ANY - * EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR - * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE APACHE GROUP OR - * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT - * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, - * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED - * OF THE POSSIBILITY OF SUCH DAMAGE. - * ==================================================================== - * - * This software consists of voluntary contributions made by many - * individuals on behalf of the Apache Group and was originally based - * on public domain software written at the National Center for - * Supercomputing Applications, University of Illinois, Urbana-Champaign. - * For more information on the Apache Group and the Apache HTTP server - * project, please see <http://www.apache.org/>. - * - */ - -#ifndef MOD_PROXY_H -#define MOD_PROXY_H - -/* - * Main include file for the Apache proxy - */ - -/* - - Note that the Explain() stuff is not yet complete. - Also note numerous FIXMEs and CHECKMEs which should be eliminated. - - If TESTING is set, then garbage collection doesn't delete ... probably a good - idea when hacking. - - This code is still experimental! - - Things to do: - - 1. Make it garbage collect in the background, not while someone is waiting for - a response! - - 2. Check the logic thoroughly. - - 3. Empty directories are only removed the next time round (but this does avoid - two passes). Consider doing them the first time round. - - Ben Laurie <ben@algroup.co.uk> 30 Mar 96 - - More things to do: - - 0. Code cleanup (ongoing) - - 1. add 230 response output for ftp now that it works - - 2. Make the ftp proxy transparent, also same with (future) gopher & wais - - 3. Use protocol handler struct a la Apache module handlers (Dirk van Gulik) - - 4. Use a cache expiry database for more efficient GC (Jeremy Wohl) - - 5. Bulletproof GC against SIGALRM - - Chuck Murcko <chuck@topsail.org> 15 April 1997 - - */ - -#define TESTING 0 -#undef EXPLAIN - -#include "httpd.h" -#include "http_config.h" -#include "http_protocol.h" - -#include "explain.h" - -extern module MODULE_VAR_EXPORT proxy_module; - - -/* for proxy_canonenc() */ -enum enctype { - enc_path, enc_search, enc_user, enc_fpath, enc_parm -}; - -#define HDR_APP (0) /* append header, for proxy_add_header() */ -#define HDR_REP (1) /* replace header, for proxy_add_header() */ - -/* number of characters in the hash */ -#define HASH_LEN (22*2) - -/* maximum 'CacheDirLevels*CacheDirLength' value */ -#define CACHEFILE_LEN 20 /* must be less than HASH_LEN/2 */ - -#ifdef CHARSET_EBCDIC -#define CRLF "\r\n" -#else /*CHARSET_EBCDIC*/ -#define CRLF "\015\012" -#endif /*CHARSET_EBCDIC*/ - - -#define SEC_ONE_DAY 86400 /* one day, in seconds */ -#define SEC_ONE_HR 3600 /* one hour, in seconds */ - -#define DEFAULT_FTP_DATA_PORT 20 -#define DEFAULT_FTP_PORT 21 -#define DEFAULT_GOPHER_PORT 70 -#define DEFAULT_NNTP_PORT 119 -#define DEFAULT_WAIS_PORT 210 -#define DEFAULT_HTTPS_PORT 443 -#define DEFAULT_SNEWS_PORT 563 -#define DEFAULT_PROSPERO_PORT 1525 /* WARNING: conflict w/Oracle */ - -/* Some WWW schemes and their default ports; this is basically /etc/services */ -struct proxy_services { - const char *scheme; - int port; -}; - -/* static information about a remote proxy */ -struct proxy_remote { - const char *scheme; /* the schemes handled by this proxy, or '*' */ - const char *protocol; /* the scheme used to talk to this proxy */ - const char *hostname; /* the hostname of this proxy */ - int port; /* the port for this proxy */ -}; - -struct proxy_alias { - char *real; - char *fake; -}; - -struct dirconn_entry { - char *name; - struct in_addr addr, mask; - struct hostent *hostentry; - int (*matcher) (struct dirconn_entry * This, request_rec *r); -}; - -struct noproxy_entry { - char *name; - struct in_addr addr; -}; - -struct nocache_entry { - char *name; - struct in_addr addr; -}; - -#define DEFAULT_CACHE_SPACE 5 -#define DEFAULT_CACHE_MAXEXPIRE SEC_ONE_DAY -#define DEFAULT_CACHE_EXPIRE SEC_ONE_HR -#define DEFAULT_CACHE_LMFACTOR (0.1) -#define DEFAULT_CACHE_COMPLETION (0.9) - -/* static information about the local cache */ -struct cache_conf { - const char *root; /* the location of the cache directory */ - off_t space; /* Maximum cache size (in 1024 bytes) */ - time_t maxexpire; /* Maximum time to keep cached files in secs */ - time_t defaultexpire; /* default time to keep cached file in secs */ - double lmfactor; /* factor for estimating expires date */ - time_t gcinterval; /* garbage collection interval, in seconds */ - int dirlevels; /* Number of levels of subdirectories */ - int dirlength; /* Length of subdirectory names */ - float cache_completion; /* Force cache completion after this point */ -}; - -typedef struct { - struct cache_conf cache; /* cache configuration */ - array_header *proxies; - array_header *aliases; - array_header *raliases; - array_header *noproxies; - array_header *dirconn; - array_header *nocaches; - array_header *allowed_connect_ports; - char *domain; /* domain name to use in absence of a domain name in the request */ - int req; /* true if proxy requests are enabled */ - enum { - via_off, - via_on, - via_block, - via_full - } viaopt; /* how to deal with proxy Via: headers */ - size_t recv_buffer_size; -} proxy_server_conf; - -struct hdr_entry { - const char *field; - const char *value; -}; - -/* caching information about a request */ -typedef struct { - request_rec *req; /* the request */ - char *url; /* the URL requested */ - char *filename; /* name of the cache file, or NULL if no cache */ - char *tempfile; /* name of the temporary file, of NULL if not caching */ - time_t ims; /* if-modified-since date of request; -1 if no header */ - BUFF *fp; /* the cache file descriptor if the file is cached - and may be returned, or NULL if the file is - not cached (or must be reloaded) */ - time_t expire; /* calculated expire date of cached entity */ - time_t lmod; /* last-modified date of cached entity */ - time_t date; /* the date the cached file was last touched */ - int version; /* update count of the file */ - off_t len; /* content length */ - char *protocol; /* Protocol, and major/minor number, e.g. HTTP/1.1 */ - int status; /* the status of the cached file */ - unsigned int written; /* total *content* bytes written to cache */ - float cache_completion; /* specific to this request */ - char *resp_line; /* the whole status like (protocol, code + message) */ - table *hdrs; /* the HTTP headers of the file */ -} cache_req; - -/* Additional information passed to the function called by ap_table_do() */ -struct tbl_do_args { - request_rec *req; - cache_req *cache; -}; - -/* Function prototypes */ - -/* proxy_cache.c */ - -void ap_proxy_cache_tidy(cache_req *c); -int ap_proxy_cache_check(request_rec *r, char *url, struct cache_conf *conf, - cache_req **cr); -int ap_proxy_cache_update(cache_req *c, table *resp_hdrs, - const int is_HTTP1, int nocache); -void ap_proxy_garbage_coll(request_rec *r); - -/* proxy_connect.c */ - -int ap_proxy_connect_handler(request_rec *r, cache_req *c, char *url, - const char *proxyhost, int proxyport); - -/* proxy_ftp.c */ - -int ap_proxy_ftp_canon(request_rec *r, char *url); -int ap_proxy_ftp_handler(request_rec *r, cache_req *c, char *url); - -/* proxy_http.c */ - -int ap_proxy_http_canon(request_rec *r, char *url, const char *scheme, - int def_port); -int ap_proxy_http_handler(request_rec *r, cache_req *c, char *url, - const char *proxyhost, int proxyport); - -/* proxy_util.c */ - -int ap_proxy_hex2c(const char *x); -void ap_proxy_c2hex(int ch, char *x); -char *ap_proxy_canonenc(pool *p, const char *x, int len, enum enctype t, - int isenc); -char *ap_proxy_canon_netloc(pool *p, char **const urlp, char **userp, - char **passwordp, char **hostp, int *port); -const char *ap_proxy_date_canon(pool *p, const char *x); -table *ap_proxy_read_headers(request_rec *r, char *buffer, int size, BUFF *f); -long int ap_proxy_send_fb(BUFF *f, request_rec *r, cache_req *c); -void ap_proxy_send_headers(request_rec *r, const char *respline, table *hdrs); -int ap_proxy_liststr(const char *list, const char *val); -void ap_proxy_hash(const char *it, char *val, int ndepth, int nlength); -int ap_proxy_hex2sec(const char *x); -void ap_proxy_sec2hex(int t, char *y); -cache_req *ap_proxy_cache_error(cache_req *r); -int ap_proxyerror(request_rec *r, int statuscode, const char *message); -const char *ap_proxy_host2addr(const char *host, struct hostent *reqhp); -int ap_proxy_is_ipaddr(struct dirconn_entry *This, pool *p); -int ap_proxy_is_domainname(struct dirconn_entry *This, pool *p); -int ap_proxy_is_hostname(struct dirconn_entry *This, pool *p); -int ap_proxy_is_word(struct dirconn_entry *This, pool *p); -int ap_proxy_doconnect(int sock, struct sockaddr_in *addr, request_rec *r); -int ap_proxy_garbage_init(server_rec *, pool *); -/* This function is called by ap_table_do() for all header lines */ -int ap_proxy_send_hdr_line(void *p, const char *key, const char *value); -unsigned ap_proxy_bputs2(const char *data, BUFF *client, cache_req *cache); - -#endif /*MOD_PROXY_H*/ diff --git a/modules/proxy/mod_proxy_connect.dsp b/modules/proxy/mod_proxy_connect.dsp deleted file mode 100644 index c6b9d5f650e2131680d58f5f1d979bbc96c3b7e4..0000000000000000000000000000000000000000 --- a/modules/proxy/mod_proxy_connect.dsp +++ /dev/null @@ -1,136 +0,0 @@ -# Microsoft Developer Studio Project File - Name="mod_proxy_connect" - Package Owner=<4> -# Microsoft Developer Studio Generated Build File, Format Version 6.00 -# ** DO NOT EDIT ** - -# TARGTYPE "Win32 (x86) Dynamic-Link Library" 0x0102 - -CFG=mod_proxy_connect - Win32 Release -!MESSAGE This is not a valid makefile. To build this project using NMAKE, -!MESSAGE use the Export Makefile command and run -!MESSAGE -!MESSAGE NMAKE /f "mod_proxy_connect.mak". -!MESSAGE -!MESSAGE You can specify a configuration when running NMAKE -!MESSAGE by defining the macro CFG on the command line. For example: -!MESSAGE -!MESSAGE NMAKE /f "mod_proxy_connect.mak" CFG="mod_proxy_connect - Win32 Release" -!MESSAGE -!MESSAGE Possible choices for configuration are: -!MESSAGE -!MESSAGE "mod_proxy_connect - Win32 Release" (based on "Win32 (x86) Dynamic-Link Library") -!MESSAGE "mod_proxy_connect - Win32 Debug" (based on "Win32 (x86) Dynamic-Link Library") -!MESSAGE - -# Begin Project -# PROP AllowPerConfigDependencies 0 -# PROP Scc_ProjName "" -# PROP Scc_LocalPath "" -CPP=cl.exe -MTL=midl.exe -RSC=rc.exe - -!IF "$(CFG)" == "mod_proxy_connect - Win32 Release" - -# PROP BASE Use_MFC 0 -# PROP BASE Use_Debug_Libraries 0 -# PROP BASE Output_Dir "Release" -# PROP BASE Intermediate_Dir "Release" -# PROP BASE Target_Dir "" -# PROP Use_MFC 0 -# PROP Use_Debug_Libraries 0 -# PROP Output_Dir "Release" -# PROP Intermediate_Dir "Release" -# PROP Ignore_Export_Lib 0 -# PROP Target_Dir "" -# ADD BASE CPP /nologo /MD /W3 /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /FD /c -# ADD CPP /nologo /MD /W3 /O2 /I "../../include" /I "../../srclib/apr/include" /I "../../srclib/apr-util/include" /D "NDEBUG" /D "WIN32" /D "_WINDOWS" /Fd"Release\mod_proxy_connect" /FD /c -# ADD BASE MTL /nologo /D "NDEBUG" /win32 -# ADD MTL /nologo /D "NDEBUG" /mktyplib203 /win32 -# ADD BASE RSC /l 0x809 /d "NDEBUG" -# ADD RSC /l 0x809 /d "NDEBUG" -BSC32=bscmake.exe -# ADD BASE BSC32 /nologo -# ADD BSC32 /nologo -LINK32=link.exe -# ADD BASE LINK32 kernel32.lib ws2_32.lib mswsock.lib /nologo /subsystem:windows /dll /map /machine:I386 /out:"Release/mod_proxy_connect.so" /base:@..\..\os\win32\BaseAddr.ref,mod_proxy_connect -# ADD LINK32 kernel32.lib ws2_32.lib mswsock.lib /nologo /subsystem:windows /dll /map /machine:I386 /out:"Release/mod_proxy_connect.so" /base:@..\..\os\win32\BaseAddr.ref,mod_proxy_connect - -!ELSEIF "$(CFG)" == "mod_proxy_connect - Win32 Debug" - -# PROP BASE Use_MFC 0 -# PROP BASE Use_Debug_Libraries 1 -# PROP BASE Output_Dir "Debug" -# PROP BASE Intermediate_Dir "Debug" -# PROP BASE Target_Dir "" -# PROP Use_MFC 0 -# PROP Use_Debug_Libraries 1 -# PROP Output_Dir "Debug" -# PROP Intermediate_Dir "Debug" -# PROP Ignore_Export_Lib 0 -# PROP Target_Dir "" -# ADD BASE CPP /nologo /MDd /W3 /GX /Zi /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /FD /c -# ADD CPP /nologo /MDd /W3 /GX /Zi /Od /I "../../include" /I "../../srclib/apr/include" /I "../../srclib/apr-util/include" /D "_DEBUG" /D "WIN32" /D "_WINDOWS" /Fd"Debug\mod_proxy_connect" /FD /c -# ADD BASE MTL /nologo /D "_DEBUG" /win32 -# ADD MTL /nologo /D "_DEBUG" /mktyplib203 /win32 -# ADD BASE RSC /l 0x809 /d "_DEBUG" -# ADD RSC /l 0x809 /d "_DEBUG" -BSC32=bscmake.exe -# ADD BASE BSC32 /nologo -# ADD BSC32 /nologo -LINK32=link.exe -# ADD BASE LINK32 kernel32.lib ws2_32.lib mswsock.lib /nologo /subsystem:windows /dll /incremental:no /map /debug /machine:I386 /out:"Debug/mod_proxy_connect.so" /base:@..\..\os\win32\BaseAddr.ref,mod_proxy_connect -# ADD LINK32 kernel32.lib ws2_32.lib mswsock.lib /nologo /subsystem:windows /dll /incremental:no /map /debug /machine:I386 /out:"Debug/mod_proxy_connect.so" /base:@..\..\os\win32\BaseAddr.ref,mod_proxy_connect - -!ENDIF - -# Begin Target - -# Name "mod_proxy_connect - Win32 Release" -# Name "mod_proxy_connect - Win32 Debug" -# Begin Group "Source Files" - -# PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;hpj;bat;for;f90" -# Begin Source File - -SOURCE=.\proxy_connect.c -# End Source File -# End Group -# Begin Group "Header Files" - -# PROP Default_Filter ".h" -# Begin Source File - -SOURCE=.\mod_proxy.h -# End Source File -# End Group -# Begin Source File - -SOURCE=..\..\build\win32\win32ver.awk - -!IF "$(CFG)" == "mod_proxy_connect - Win32 Release" - -# PROP Ignore_Default_Tool 1 -# Begin Custom Build - Creating Version Resource -InputPath=..\..\build\win32\win32ver.awk - -".\mod_proxy_connect.rc" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)" - awk -f ../../build/win32/win32ver.awk mod_proxy_connect "proxy_connect_module for Apache" ../../include/ap_release.h > .\mod_proxy_connect.rc - -# End Custom Build - -!ELSEIF "$(CFG)" == "mod_proxy_connect - Win32 Debug" - -# PROP Ignore_Default_Tool 1 -# Begin Custom Build - Creating Version Resource -InputPath=..\..\build\win32\win32ver.awk - -".\mod_proxy_connect.rc" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)" - awk -f ../../build/win32/win32ver.awk mod_proxy_connect "proxy_connect_module for Apache" ../../include/ap_release.h > .\mod_proxy_connect.rc - -# End Custom Build - -!ENDIF - -# End Source File -# End Target -# End Project diff --git a/modules/proxy/mod_proxy_ftp.dsp b/modules/proxy/mod_proxy_ftp.dsp deleted file mode 100644 index 9a232fbb4db03d265937a7f310e4c19a9123d964..0000000000000000000000000000000000000000 --- a/modules/proxy/mod_proxy_ftp.dsp +++ /dev/null @@ -1,136 +0,0 @@ -# Microsoft Developer Studio Project File - Name="mod_proxy_ftp" - Package Owner=<4> -# Microsoft Developer Studio Generated Build File, Format Version 6.00 -# ** DO NOT EDIT ** - -# TARGTYPE "Win32 (x86) Dynamic-Link Library" 0x0102 - -CFG=mod_proxy_ftp - Win32 Release -!MESSAGE This is not a valid makefile. To build this project using NMAKE, -!MESSAGE use the Export Makefile command and run -!MESSAGE -!MESSAGE NMAKE /f "mod_proxy_ftp.mak". -!MESSAGE -!MESSAGE You can specify a configuration when running NMAKE -!MESSAGE by defining the macro CFG on the command line. For example: -!MESSAGE -!MESSAGE NMAKE /f "mod_proxy_ftp.mak" CFG="mod_proxy_ftp - Win32 Release" -!MESSAGE -!MESSAGE Possible choices for configuration are: -!MESSAGE -!MESSAGE "mod_proxy_ftp - Win32 Release" (based on "Win32 (x86) Dynamic-Link Library") -!MESSAGE "mod_proxy_ftp - Win32 Debug" (based on "Win32 (x86) Dynamic-Link Library") -!MESSAGE - -# Begin Project -# PROP AllowPerConfigDependencies 0 -# PROP Scc_ProjName "" -# PROP Scc_LocalPath "" -CPP=cl.exe -MTL=midl.exe -RSC=rc.exe - -!IF "$(CFG)" == "mod_proxy_ftp - Win32 Release" - -# PROP BASE Use_MFC 0 -# PROP BASE Use_Debug_Libraries 0 -# PROP BASE Output_Dir "Release" -# PROP BASE Intermediate_Dir "Release" -# PROP BASE Target_Dir "" -# PROP Use_MFC 0 -# PROP Use_Debug_Libraries 0 -# PROP Output_Dir "Release" -# PROP Intermediate_Dir "Release" -# PROP Ignore_Export_Lib 0 -# PROP Target_Dir "" -# ADD BASE CPP /nologo /MD /W3 /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /FD /c -# ADD CPP /nologo /MD /W3 /O2 /I "../../include" /I "../../srclib/apr/include" /I "../../srclib/apr-util/include" /D "NDEBUG" /D "WIN32" /D "_WINDOWS" /Fd"Release\mod_proxy_ftp" /FD /c -# ADD BASE MTL /nologo /D "NDEBUG" /win32 -# ADD MTL /nologo /D "NDEBUG" /mktyplib203 /win32 -# ADD BASE RSC /l 0x809 /d "NDEBUG" -# ADD RSC /l 0x809 /d "NDEBUG" -BSC32=bscmake.exe -# ADD BASE BSC32 /nologo -# ADD BSC32 /nologo -LINK32=link.exe -# ADD BASE LINK32 kernel32.lib ws2_32.lib mswsock.lib /nologo /subsystem:windows /dll /map /machine:I386 /out:"Release/mod_proxy_ftp.so" /base:@..\..\os\win32\BaseAddr.ref,mod_proxy_ftp -# ADD LINK32 kernel32.lib ws2_32.lib mswsock.lib /nologo /subsystem:windows /dll /map /machine:I386 /out:"Release/mod_proxy_ftp.so" /base:@..\..\os\win32\BaseAddr.ref,mod_proxy_ftp - -!ELSEIF "$(CFG)" == "mod_proxy_ftp - Win32 Debug" - -# PROP BASE Use_MFC 0 -# PROP BASE Use_Debug_Libraries 1 -# PROP BASE Output_Dir "Debug" -# PROP BASE Intermediate_Dir "Debug" -# PROP BASE Target_Dir "" -# PROP Use_MFC 0 -# PROP Use_Debug_Libraries 1 -# PROP Output_Dir "Debug" -# PROP Intermediate_Dir "Debug" -# PROP Ignore_Export_Lib 0 -# PROP Target_Dir "" -# ADD BASE CPP /nologo /MDd /W3 /GX /Zi /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /FD /c -# ADD CPP /nologo /MDd /W3 /GX /Zi /Od /I "../../include" /I "../../srclib/apr/include" /I "../../srclib/apr-util/include" /D "_DEBUG" /D "WIN32" /D "_WINDOWS" /Fd"Debug\mod_proxy_ftp" /FD /c -# ADD BASE MTL /nologo /D "_DEBUG" /win32 -# ADD MTL /nologo /D "_DEBUG" /mktyplib203 /win32 -# ADD BASE RSC /l 0x809 /d "_DEBUG" -# ADD RSC /l 0x809 /d "_DEBUG" -BSC32=bscmake.exe -# ADD BASE BSC32 /nologo -# ADD BSC32 /nologo -LINK32=link.exe -# ADD BASE LINK32 kernel32.lib ws2_32.lib mswsock.lib /nologo /subsystem:windows /dll /incremental:no /map /debug /machine:I386 /out:"Debug/mod_proxy_ftp.so" /base:@..\..\os\win32\BaseAddr.ref,mod_proxy_ftp -# ADD LINK32 kernel32.lib ws2_32.lib mswsock.lib /nologo /subsystem:windows /dll /incremental:no /map /debug /machine:I386 /out:"Debug/mod_proxy_ftp.so" /base:@..\..\os\win32\BaseAddr.ref,mod_proxy_ftp - -!ENDIF - -# Begin Target - -# Name "mod_proxy_ftp - Win32 Release" -# Name "mod_proxy_ftp - Win32 Debug" -# Begin Group "Source Files" - -# PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;hpj;bat;for;f90" -# Begin Source File - -SOURCE=.\proxy_ftp.c -# End Source File -# End Group -# Begin Group "Header Files" - -# PROP Default_Filter ".h" -# Begin Source File - -SOURCE=.\mod_proxy.h -# End Source File -# End Group -# Begin Source File - -SOURCE=..\..\build\win32\win32ver.awk - -!IF "$(CFG)" == "mod_proxy_ftp - Win32 Release" - -# PROP Ignore_Default_Tool 1 -# Begin Custom Build - Creating Version Resource -InputPath=..\..\build\win32\win32ver.awk - -".\mod_proxy_ftp.rc" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)" - awk -f ../../build/win32/win32ver.awk mod_proxy_ftp "proxy_ftp_module for Apache" ../../include/ap_release.h > .\mod_proxy_ftp.rc - -# End Custom Build - -!ELSEIF "$(CFG)" == "mod_proxy_ftp - Win32 Debug" - -# PROP Ignore_Default_Tool 1 -# Begin Custom Build - Creating Version Resource -InputPath=..\..\build\win32\win32ver.awk - -".\mod_proxy_ftp.rc" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)" - awk -f ../../build/win32/win32ver.awk mod_proxy_ftp "proxy_ftp_module for Apache" ../../include/ap_release.h > .\mod_proxy_ftp.rc - -# End Custom Build - -!ENDIF - -# End Source File -# End Target -# End Project diff --git a/modules/proxy/mod_proxy_http.dsp b/modules/proxy/mod_proxy_http.dsp deleted file mode 100644 index 8764b548ee518b734314567f723b6b6dbab401b4..0000000000000000000000000000000000000000 --- a/modules/proxy/mod_proxy_http.dsp +++ /dev/null @@ -1,136 +0,0 @@ -# Microsoft Developer Studio Project File - Name="mod_proxy_http" - Package Owner=<4> -# Microsoft Developer Studio Generated Build File, Format Version 6.00 -# ** DO NOT EDIT ** - -# TARGTYPE "Win32 (x86) Dynamic-Link Library" 0x0102 - -CFG=mod_proxy_http - Win32 Release -!MESSAGE This is not a valid makefile. To build this project using NMAKE, -!MESSAGE use the Export Makefile command and run -!MESSAGE -!MESSAGE NMAKE /f "mod_proxy_http.mak". -!MESSAGE -!MESSAGE You can specify a configuration when running NMAKE -!MESSAGE by defining the macro CFG on the command line. For example: -!MESSAGE -!MESSAGE NMAKE /f "mod_proxy_http.mak" CFG="mod_proxy_http - Win32 Release" -!MESSAGE -!MESSAGE Possible choices for configuration are: -!MESSAGE -!MESSAGE "mod_proxy_http - Win32 Release" (based on "Win32 (x86) Dynamic-Link Library") -!MESSAGE "mod_proxy_http - Win32 Debug" (based on "Win32 (x86) Dynamic-Link Library") -!MESSAGE - -# Begin Project -# PROP AllowPerConfigDependencies 0 -# PROP Scc_ProjName "" -# PROP Scc_LocalPath "" -CPP=cl.exe -MTL=midl.exe -RSC=rc.exe - -!IF "$(CFG)" == "mod_proxy_http - Win32 Release" - -# PROP BASE Use_MFC 0 -# PROP BASE Use_Debug_Libraries 0 -# PROP BASE Output_Dir "Release" -# PROP BASE Intermediate_Dir "Release" -# PROP BASE Target_Dir "" -# PROP Use_MFC 0 -# PROP Use_Debug_Libraries 0 -# PROP Output_Dir "Release" -# PROP Intermediate_Dir "Release" -# PROP Ignore_Export_Lib 0 -# PROP Target_Dir "" -# ADD BASE CPP /nologo /MD /W3 /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /FD /c -# ADD CPP /nologo /MD /W3 /O2 /I "../../include" /I "../../srclib/apr/include" /I "../../srclib/apr-util/include" /D "NDEBUG" /D "WIN32" /D "_WINDOWS" /Fd"Release\mod_proxy_http" /FD /c -# ADD BASE MTL /nologo /D "NDEBUG" /win32 -# ADD MTL /nologo /D "NDEBUG" /mktyplib203 /win32 -# ADD BASE RSC /l 0x809 /d "NDEBUG" -# ADD RSC /l 0x809 /d "NDEBUG" -BSC32=bscmake.exe -# ADD BASE BSC32 /nologo -# ADD BSC32 /nologo -LINK32=link.exe -# ADD BASE LINK32 kernel32.lib ws2_32.lib mswsock.lib /nologo /subsystem:windows /dll /map /machine:I386 /out:"Release/mod_proxy_http.so" /base:@..\..\os\win32\BaseAddr.ref,mod_proxy_http -# ADD LINK32 kernel32.lib ws2_32.lib mswsock.lib /nologo /subsystem:windows /dll /map /machine:I386 /out:"Release/mod_proxy_http.so" /base:@..\..\os\win32\BaseAddr.ref,mod_proxy_http - -!ELSEIF "$(CFG)" == "mod_proxy_http - Win32 Debug" - -# PROP BASE Use_MFC 0 -# PROP BASE Use_Debug_Libraries 1 -# PROP BASE Output_Dir "Debug" -# PROP BASE Intermediate_Dir "Debug" -# PROP BASE Target_Dir "" -# PROP Use_MFC 0 -# PROP Use_Debug_Libraries 1 -# PROP Output_Dir "Debug" -# PROP Intermediate_Dir "Debug" -# PROP Ignore_Export_Lib 0 -# PROP Target_Dir "" -# ADD BASE CPP /nologo /MDd /W3 /GX /Zi /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /FD /c -# ADD CPP /nologo /MDd /W3 /GX /Zi /Od /I "../../include" /I "../../srclib/apr/include" /I "../../srclib/apr-util/include" /D "_DEBUG" /D "WIN32" /D "_WINDOWS" /Fd"Debug\mod_proxy_http" /FD /c -# ADD BASE MTL /nologo /D "_DEBUG" /win32 -# ADD MTL /nologo /D "_DEBUG" /mktyplib203 /win32 -# ADD BASE RSC /l 0x809 /d "_DEBUG" -# ADD RSC /l 0x809 /d "_DEBUG" -BSC32=bscmake.exe -# ADD BASE BSC32 /nologo -# ADD BSC32 /nologo -LINK32=link.exe -# ADD BASE LINK32 kernel32.lib ws2_32.lib mswsock.lib /nologo /subsystem:windows /dll /incremental:no /map /debug /machine:I386 /out:"Debug/mod_proxy_http.so" /base:@..\..\os\win32\BaseAddr.ref,mod_proxy_http -# ADD LINK32 kernel32.lib ws2_32.lib mswsock.lib /nologo /subsystem:windows /dll /incremental:no /map /debug /machine:I386 /out:"Debug/mod_proxy_http.so" /base:@..\..\os\win32\BaseAddr.ref,mod_proxy_http - -!ENDIF - -# Begin Target - -# Name "mod_proxy_http - Win32 Release" -# Name "mod_proxy_http - Win32 Debug" -# Begin Group "Source Files" - -# PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;hpj;bat;for;f90" -# Begin Source File - -SOURCE=.\proxy_http.c -# End Source File -# End Group -# Begin Group "Header Files" - -# PROP Default_Filter ".h" -# Begin Source File - -SOURCE=.\mod_proxy.h -# End Source File -# End Group -# Begin Source File - -SOURCE=..\..\build\win32\win32ver.awk - -!IF "$(CFG)" == "mod_proxy_http - Win32 Release" - -# PROP Ignore_Default_Tool 1 -# Begin Custom Build - Creating Version Resource -InputPath=..\..\build\win32\win32ver.awk - -".\mod_proxy_http.rc" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)" - awk -f ../../build/win32/win32ver.awk mod_proxy_http "proxy_http_module for Apache" ../../include/ap_release.h > .\mod_proxy_http.rc - -# End Custom Build - -!ELSEIF "$(CFG)" == "mod_proxy_http - Win32 Debug" - -# PROP Ignore_Default_Tool 1 -# Begin Custom Build - Creating Version Resource -InputPath=..\..\build\win32\win32ver.awk - -".\mod_proxy_http.rc" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)" - awk -f ../../build/win32/win32ver.awk mod_proxy_http "proxy_http_module for Apache" ../../include/ap_release.h > .\mod_proxy_http.rc - -# End Custom Build - -!ENDIF - -# End Source File -# End Target -# End Project diff --git a/modules/proxy/proxy_connect.c b/modules/proxy/proxy_connect.c deleted file mode 100644 index 82203f2c9efbfa95bb291c226d51cba5ca4beb72..0000000000000000000000000000000000000000 --- a/modules/proxy/proxy_connect.c +++ /dev/null @@ -1,288 +0,0 @@ -/* ==================================================================== - * Copyright (c) 1996-1999 The Apache Group. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in - * the documentation and/or other materials provided with the - * distribution. - * - * 3. All advertising materials mentioning features or use of this - * software must display the following acknowledgment: - * "This product includes software developed by the Apache Group - * for use in the Apache HTTP server project (http://www.apache.org/)." - * - * 4. The names "Apache Server" and "Apache Group" must not be used to - * endorse or promote products derived from this software without - * prior written permission. For written permission, please contact - * apache@apache.org. - * - * 5. Products derived from this software may not be called "Apache" - * nor may "Apache" appear in their names without prior written - * permission of the Apache Group. - * - * 6. Redistributions of any form whatsoever must retain the following - * acknowledgment: - * "This product includes software developed by the Apache Group - * for use in the Apache HTTP server project (http://www.apache.org/)." - * - * THIS SOFTWARE IS PROVIDED BY THE APACHE GROUP ``AS IS'' AND ANY - * EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR - * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE APACHE GROUP OR - * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT - * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, - * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED - * OF THE POSSIBILITY OF SUCH DAMAGE. - * ==================================================================== - * - * This software consists of voluntary contributions made by many - * individuals on behalf of the Apache Group and was originally based - * on public domain software written at the National Center for - * Supercomputing Applications, University of Illinois, Urbana-Champaign. - * For more information on the Apache Group and the Apache HTTP server - * project, please see <http://www.apache.org/>. - * - */ - -/* CONNECT method for Apache proxy */ - -#include "mod_proxy.h" -#include "http_log.h" -#include "http_main.h" - -#ifdef HAVE_BSTRING_H -#include <bstring.h> /* for IRIX, FD_SET calls bzero() */ -#endif - -DEF_Explain - -/* - * This handles Netscape CONNECT method secure proxy requests. - * A connection is opened to the specified host and data is - * passed through between the WWW site and the browser. - * - * This code is based on the INTERNET-DRAFT document - * "Tunneling SSL Through a WWW Proxy" currently at - * http://www.mcom.com/newsref/std/tunneling_ssl.html. - * - * If proxyhost and proxyport are set, we send a CONNECT to - * the specified proxy.. - * - * FIXME: this is bad, because it does its own socket I/O - * instead of using the I/O in buff.c. However, - * the I/O in buff.c blocks on reads, and because - * this function doesn't know how much data will - * be sent either way (or when) it can't use blocking - * I/O. This may be very implementation-specific - * (to Linux). Any suggestions? - * FIXME: this doesn't log the number of bytes sent, but - * that may be okay, since the data is supposed to - * be transparent. In fact, this doesn't log at all - * yet. 8^) - * FIXME: doesn't check any headers initally sent from the - * client. - * FIXME: should allow authentication, but hopefully the - * generic proxy authentication is good enough. - * FIXME: no check for r->assbackwards, whatever that is. - */ - -static int -allowed_port(proxy_server_conf *conf, int port) -{ - int i; - int *list = (int *) conf->allowed_connect_ports->elts; - - for(i = 0; i < conf->allowed_connect_ports->nelts; i++) { - if(port == list[i]) - return 1; - } - return 0; -} - - -int ap_proxy_connect_handler(request_rec *r, cache_req *c, char *url, - const char *proxyhost, int proxyport) -{ - struct sockaddr_in server; - struct in_addr destaddr; - struct hostent server_hp; - const char *host, *err; - char *p; - int port, sock; - char buffer[HUGE_STRING_LEN]; - int nbytes, i, j; - fd_set fds; - - void *sconf = r->server->module_config; - proxy_server_conf *conf = - (proxy_server_conf *) ap_get_module_config(sconf, &proxy_module); - struct noproxy_entry *npent = (struct noproxy_entry *) conf->noproxies->elts; - - memset(&server, '\0', sizeof(server)); - server.sin_family = AF_INET; - - /* Break the URL into host:port pairs */ - - host = url; - p = strchr(url, ':'); - if (p == NULL) - port = DEFAULT_HTTPS_PORT; - else { - port = atoi(p + 1); - *p = '\0'; - } - -/* check if ProxyBlock directive on this host */ - destaddr.s_addr = ap_inet_addr(host); - for (i = 0; i < conf->noproxies->nelts; i++) { - if ((npent[i].name != NULL && strstr(host, npent[i].name) != NULL) - || destaddr.s_addr == npent[i].addr.s_addr || npent[i].name[0] == '*') - return ap_proxyerror(r, HTTP_FORBIDDEN, - "Connect to remote machine blocked"); - } - - /* Check if it is an allowed port */ - if (conf->allowed_connect_ports->nelts == 0) { - /* Default setting if not overridden by AllowCONNECT */ - switch (port) { - case DEFAULT_HTTPS_PORT: - case DEFAULT_SNEWS_PORT: - break; - default: - return HTTP_FORBIDDEN; - } - } else if(!allowed_port(conf, port)) - return HTTP_FORBIDDEN; - - if (proxyhost) { - Explain2("CONNECT to remote proxy %s on port %d", proxyhost, proxyport); - } - else { - Explain2("CONNECT to %s on port %d", host, port); - } - - server.sin_port = (proxyport ? htons(proxyport) : htons(port)); - err = ap_proxy_host2addr(proxyhost ? proxyhost : host, &server_hp); - - if (err != NULL) - return ap_proxyerror(r, - proxyhost ? HTTP_BAD_GATEWAY : HTTP_INTERNAL_SERVER_ERROR, - err); - - sock = ap_psocket(r->pool, PF_INET, SOCK_STREAM, IPPROTO_TCP); - if (sock == -1) { - ap_log_rerror(APLOG_MARK, APLOG_ERR, r, - "proxy: error creating socket"); - return HTTP_INTERNAL_SERVER_ERROR; - } - -#ifdef CHECK_FD_SETSIZE - if (sock >= FD_SETSIZE) { - ap_log_error(APLOG_MARK, APLOG_NOERRNO|APLOG_WARNING, NULL, - "proxy_connect_handler: filedescriptor (%u) " - "larger than FD_SETSIZE (%u) " - "found, you probably need to rebuild Apache with a " - "larger FD_SETSIZE", sock, FD_SETSIZE); - ap_pclosesocket(r->pool, sock); - return HTTP_INTERNAL_SERVER_ERROR; - } -#endif - - j = 0; - while (server_hp.h_addr_list[j] != NULL) { - memcpy(&server.sin_addr, server_hp.h_addr_list[j], - sizeof(struct in_addr)); - i = ap_proxy_doconnect(sock, &server, r); - if (i == 0) - break; - j++; - } - if (i == -1) { - ap_pclosesocket(r->pool, sock); - return ap_proxyerror(r, HTTP_INTERNAL_SERVER_ERROR, ap_pstrcat(r->pool, - "Could not connect to remote machine:<br>", - strerror(errno), NULL)); - } - - /* If we are connecting through a remote proxy, we need to pass - * the CONNECT request on to it. - */ - if (proxyport) { - /* FIXME: We should not be calling write() directly, but we currently - * have no alternative. Error checking ignored. Also, we force - * a HTTP/1.0 request to keep things simple. - */ - Explain0("Sending the CONNECT request to the remote proxy"); - ap_snprintf(buffer, sizeof(buffer), "CONNECT %s HTTP/1.0" CRLF, - r->uri); - write(sock, buffer, strlen(buffer)); - ap_snprintf(buffer, sizeof(buffer), - "Proxy-agent: %s" CRLF CRLF, ap_get_server_version()); - write(sock, buffer, strlen(buffer)); - } - else { - Explain0("Returning 200 OK Status"); - ap_rvputs(r, "HTTP/1.0 200 Connection established" CRLF, NULL); - ap_rvputs(r, "Proxy-agent: ", ap_get_server_version(), CRLF CRLF, NULL); - ap_bflush(r->connection->client); - } - - while (1) { /* Infinite loop until error (one side closes the connection) */ - FD_ZERO(&fds); - FD_SET(sock, &fds); - FD_SET(r->connection->client->fd, &fds); - - Explain0("Going to sleep (select)"); - i = ap_select((r->connection->client->fd > sock ? - r->connection->client->fd + 1 : - sock + 1), &fds, NULL, NULL, NULL); - Explain1("Woke from select(), i=%d", i); - - if (i) { - if (FD_ISSET(sock, &fds)) { - Explain0("sock was set"); - if ((nbytes = read(sock, buffer, HUGE_STRING_LEN)) != 0) { - if (nbytes == -1) - break; - if (write(r->connection->client->fd, buffer, nbytes) == EOF) - break; - Explain1("Wrote %d bytes to client", nbytes); - } - else - break; - } - else if (FD_ISSET(r->connection->client->fd, &fds)) { - Explain0("client->fd was set"); - if ((nbytes = read(r->connection->client->fd, buffer, - HUGE_STRING_LEN)) != 0) { - if (nbytes == -1) - break; - if (write(sock, buffer, nbytes) == EOF) - break; - Explain1("Wrote %d bytes to server", nbytes); - } - else - break; - } - else - break; /* Must be done waiting */ - } - else - break; - } - - ap_pclosesocket(r->pool, sock); - - return OK; -} diff --git a/modules/proxy/proxy_ftp.c b/modules/proxy/proxy_ftp.c deleted file mode 100644 index 47ca9daf9d4b78cb0bbf35d520e23f38975e1442..0000000000000000000000000000000000000000 --- a/modules/proxy/proxy_ftp.c +++ /dev/null @@ -1,1284 +0,0 @@ -/* ==================================================================== - * Copyright (c) 1996-1999 The Apache Group. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in - * the documentation and/or other materials provided with the - * distribution. - * - * 3. All advertising materials mentioning features or use of this - * software must display the following acknowledgment: - * "This product includes software developed by the Apache Group - * for use in the Apache HTTP server project (http://www.apache.org/)." - * - * 4. The names "Apache Server" and "Apache Group" must not be used to - * endorse or promote products derived from this software without - * prior written permission. For written permission, please contact - * apache@apache.org. - * - * 5. Products derived from this software may not be called "Apache" - * nor may "Apache" appear in their names without prior written - * permission of the Apache Group. - * - * 6. Redistributions of any form whatsoever must retain the following - * acknowledgment: - * "This product includes software developed by the Apache Group - * for use in the Apache HTTP server project (http://www.apache.org/)." - * - * THIS SOFTWARE IS PROVIDED BY THE APACHE GROUP ``AS IS'' AND ANY - * EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR - * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE APACHE GROUP OR - * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT - * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, - * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED - * OF THE POSSIBILITY OF SUCH DAMAGE. - * ==================================================================== - * - * This software consists of voluntary contributions made by many - * individuals on behalf of the Apache Group and was originally based - * on public domain software written at the National Center for - * Supercomputing Applications, University of Illinois, Urbana-Champaign. - * For more information on the Apache Group and the Apache HTTP server - * project, please see <http://www.apache.org/>. - * - */ - -/* FTP routines for Apache proxy */ - -#include "mod_proxy.h" -#include "http_main.h" -#include "http_log.h" -#include "http_core.h" - -#define AUTODETECT_PWD - -DEF_Explain - -/* - * Decodes a '%' escaped string, and returns the number of characters - */ -static int decodeenc(char *x) -{ - int i, j, ch; - - if (x[0] == '\0') - return 0; /* special case for no characters */ - for (i = 0, j = 0; x[i] != '\0'; i++, j++) { -/* decode it if not already done */ - ch = x[i]; - if (ch == '%' && ap_isxdigit(x[i + 1]) && ap_isxdigit(x[i + 2])) { - ch = ap_proxy_hex2c(&x[i + 1]); - i += 2; - } - x[j] = ch; - } - x[j] = '\0'; - return j; -} - -/* - * checks an encoded ftp string for bad characters, namely, CR, LF or - * non-ascii character - */ -static int ftp_check_string(const char *x) -{ - int i, ch; - - for (i = 0; x[i] != '\0'; i++) { - ch = x[i]; - if (ch == '%' && ap_isxdigit(x[i + 1]) && ap_isxdigit(x[i + 2])) { - ch = ap_proxy_hex2c(&x[i + 1]); - i += 2; - } -#ifndef CHARSET_EBCDIC - if (ch == '\015' || ch == '\012' || (ch & 0x80)) -#else /*CHARSET_EBCDIC*/ - if (ch == '\r' || ch == '\n' || (os_toascii[ch] & 0x80)) -#endif /*CHARSET_EBCDIC*/ - return 0; - } - return 1; -} - -/* - * Canonicalise ftp URLs. - */ -int ap_proxy_ftp_canon(request_rec *r, char *url) -{ - char *user, *password, *host, *path, *parms, *strp, sport[7]; - pool *p = r->pool; - const char *err; - int port; - - port = DEFAULT_FTP_PORT; - err = ap_proxy_canon_netloc(p, &url, &user, &password, &host, &port); - if (err) - return HTTP_BAD_REQUEST; - if (user != NULL && !ftp_check_string(user)) - return HTTP_BAD_REQUEST; - if (password != NULL && !ftp_check_string(password)) - return HTTP_BAD_REQUEST; - -/* now parse path/parameters args, according to rfc1738 */ -/* N.B. if this isn't a true proxy request, then the URL path - * (but not query args) has already been decoded. - * This gives rise to the problem of a ; being decoded into the - * path. - */ - strp = strchr(url, ';'); - if (strp != NULL) { - *(strp++) = '\0'; - parms = ap_proxy_canonenc(p, strp, strlen(strp), enc_parm, r->proxyreq); - if (parms == NULL) - return HTTP_BAD_REQUEST; - } - else - parms = ""; - - path = ap_proxy_canonenc(p, url, strlen(url), enc_path, r->proxyreq); - if (path == NULL) - return HTTP_BAD_REQUEST; - if (!ftp_check_string(path)) - return HTTP_BAD_REQUEST; - - if (!r->proxyreq && r->args != NULL) { - if (strp != NULL) { - strp = ap_proxy_canonenc(p, r->args, strlen(r->args), enc_parm, 1); - if (strp == NULL) - return HTTP_BAD_REQUEST; - parms = ap_pstrcat(p, parms, "?", strp, NULL); - } - else { - strp = ap_proxy_canonenc(p, r->args, strlen(r->args), enc_fpath, 1); - if (strp == NULL) - return HTTP_BAD_REQUEST; - path = ap_pstrcat(p, path, "?", strp, NULL); - } - r->args = NULL; - } - -/* now, rebuild URL */ - - if (port != DEFAULT_FTP_PORT) - ap_snprintf(sport, sizeof(sport), ":%d", port); - else - sport[0] = '\0'; - - r->filename = ap_pstrcat(p, "proxy:ftp://", (user != NULL) ? user : "", - (password != NULL) ? ":" : "", - (password != NULL) ? password : "", - (user != NULL) ? "@" : "", host, sport, "/", path, - (parms[0] != '\0') ? ";" : "", parms, NULL); - - return OK; -} - -/* - * Returns the ftp status code; - * or -1 on I/O error, 0 on data error - */ -static int ftp_getrc(BUFF *f) -{ - int len, status; - char linebuff[100], buff[5]; - - len = ap_bgets(linebuff, sizeof linebuff, f); - if (len == -1) - return -1; -/* check format */ - if (len < 5 || !ap_isdigit(linebuff[0]) || !ap_isdigit(linebuff[1]) || - !ap_isdigit(linebuff[2]) || (linebuff[3] != ' ' && linebuff[3] != '-')) - status = 0; - else - status = 100 * linebuff[0] + 10 * linebuff[1] + linebuff[2] - 111 * '0'; - - if (linebuff[len - 1] != '\n') { - (void)ap_bskiplf(f); - } - -/* skip continuation lines */ - if (linebuff[3] == '-') { - memcpy(buff, linebuff, 3); - buff[3] = ' '; - do { - len = ap_bgets(linebuff, sizeof linebuff, f); - if (len == -1) - return -1; - if (linebuff[len - 1] != '\n') { - (void)ap_bskiplf(f); - } - } while (memcmp(linebuff, buff, 4) != 0); - } - - return status; -} - -/* - * Like ftp_getrc but returns both the ftp status code and - * remembers the response message in the supplied buffer - */ -static int ftp_getrc_msg(BUFF *f, char *msgbuf, int msglen) -{ - int len, status; - char linebuff[100], buff[5]; - char *mb = msgbuf, - *me = &msgbuf[msglen]; - - len = ap_bgets(linebuff, sizeof linebuff, f); - if (len == -1) - return -1; - if (len < 5 || !ap_isdigit(linebuff[0]) || !ap_isdigit(linebuff[1]) || - !ap_isdigit(linebuff[2]) || (linebuff[3] != ' ' && linebuff[3] != '-')) - status = 0; - else - status = 100 * linebuff[0] + 10 * linebuff[1] + linebuff[2] - 111 * '0'; - - mb = ap_cpystrn(mb, linebuff+4, me - mb); - - if (linebuff[len - 1] != '\n') - (void)ap_bskiplf(f); - - if (linebuff[3] == '-') { - memcpy(buff, linebuff, 3); - buff[3] = ' '; - do { - len = ap_bgets(linebuff, sizeof linebuff, f); - if (len == -1) - return -1; - if (linebuff[len - 1] != '\n') { - (void)ap_bskiplf(f); - } - mb = ap_cpystrn(mb, linebuff+4, me - mb); - } while (memcmp(linebuff, buff, 4) != 0); - } - return status; -} - -static long int send_dir(BUFF *f, request_rec *r, cache_req *c, char *cwd) -{ - char buf[IOBUFSIZE]; - char buf2[IOBUFSIZE]; - char *filename; - int searchidx = 0; - char *searchptr = NULL; - int firstfile = 1; - unsigned long total_bytes_sent = 0; - register int n, o, w; - conn_rec *con = r->connection; - char *dir, *path, *reldir, *site; - - /* Save "scheme://site" prefix without password */ - site = ap_unparse_uri_components(r->pool, &r->parsed_uri, UNP_OMITPASSWORD|UNP_OMITPATHINFO); - /* ... and path without query args */ - path = ap_unparse_uri_components(r->pool, &r->parsed_uri, UNP_OMITSITEPART|UNP_OMITQUERY); - (void)decodeenc(path); - - /* Copy path, strip (all except the last) trailing slashes */ - path = dir = ap_pstrcat(r->pool, path, "/", NULL); - while ((n = strlen(path)) > 1 && path[n-1] == '/' && path[n-2] == '/') - path[n-1] = '\0'; - - /* print "ftp://host/" */ - n = ap_snprintf(buf, sizeof(buf), DOCTYPE_HTML_3_2 - "<HTML><HEAD><TITLE>%s%s\n" - "\n" - "

    Directory of " - "%s/", - site, path, site, path, site); - total_bytes_sent += ap_proxy_bputs2(buf, con->client, c); - - while ((dir = strchr(dir+1, '/')) != NULL) - { - *dir = '\0'; - if ((reldir = strrchr(path+1, '/'))==NULL) - reldir = path+1; - else - ++reldir; - /* print "path/" component */ - ap_snprintf(buf, sizeof(buf), "%s/", path+1, reldir); - total_bytes_sent += ap_proxy_bputs2(buf, con->client, c); - *dir = '/'; - } - /* If the caller has determined the current directory, and it differs */ - /* from what the client requested, then show the real name */ - if (cwd == NULL || strncmp (cwd, path, strlen(cwd)) == 0) { - ap_snprintf(buf, sizeof(buf), "

    \n
    ");
    -    } else {
    -	ap_snprintf(buf, sizeof(buf), "\n(%s)\n
    ", cwd);
    -    }
    -    total_bytes_sent += ap_proxy_bputs2(buf, con->client, c);
    -
    -    while (!con->aborted) {
    -	n = ap_bgets(buf, sizeof buf, f);
    -	if (n == -1) {		/* input error */
    -	    if (c != NULL) {
    -		ap_log_rerror(APLOG_MARK, APLOG_ERR, c->req,
    -		    "proxy: error reading from %s", c->url);
    -		c = ap_proxy_cache_error(c);
    -	    }
    -	    break;
    -	}
    -	if (n == 0)
    -	    break;		/* EOF */
    -	if (buf[0] == 'l' && (filename=strstr(buf, " -> ")) != NULL) {
    -	    char *link_ptr = filename;
    -
    -	    do {
    -		filename--;
    -	    } while (filename[0] != ' ');
    -	    *(filename++) = '\0';
    -	    *(link_ptr++) = '\0';
    -	    if ((n = strlen(link_ptr)) > 1 && link_ptr[n - 1] == '\n')
    -	      link_ptr[n - 1] = '\0';
    -	    ap_snprintf(buf2, sizeof(buf2), "%s %s %s\n", buf, filename, filename, link_ptr);
    -	    ap_cpystrn(buf, buf2, sizeof(buf));
    -	    n = strlen(buf);
    -	}
    -	else if (buf[0] == 'd' || buf[0] == '-' || buf[0] == 'l' || ap_isdigit(buf[0])) {
    -	    if (ap_isdigit(buf[0])) {	/* handle DOS dir */
    -		searchptr = strchr(buf, '<');
    -		if (searchptr != NULL)
    -		    *searchptr = '[';
    -		searchptr = strchr(buf, '>');
    -		if (searchptr != NULL)
    -		    *searchptr = ']';
    -	    }
    -
    -	    filename = strrchr(buf, ' ');
    -	    *(filename++) = 0;
    -	    filename[strlen(filename) - 1] = 0;
    -
    -	    /* handle filenames with spaces in 'em */
    -	    if (!strcmp(filename, ".") || !strcmp(filename, "..") || firstfile) {
    -		firstfile = 0;
    -		searchidx = filename - buf;
    -	    }
    -	    else if (searchidx != 0 && buf[searchidx] != 0) {
    -		*(--filename) = ' ';
    -		buf[searchidx - 1] = 0;
    -		filename = &buf[searchidx];
    -	    }
    -
    -	    /* Special handling for '.' and '..' */
    -	    if (!strcmp(filename, ".") || !strcmp(filename, "..") || buf[0] == 'd') {
    -		ap_snprintf(buf2, sizeof(buf2), "%s %s\n",
    -		    buf, filename, filename);
    -	    }
    -	    else {
    -		ap_snprintf(buf2, sizeof(buf2), "%s %s\n", buf, filename, filename);
    -	    }
    -	    ap_cpystrn(buf, buf2, sizeof(buf));
    -	    n = strlen(buf);
    -	}
    -
    -	o = 0;
    -	total_bytes_sent += n;
    -
    -	if (c != NULL && c->fp && ap_bwrite(c->fp, buf, n) != n) {
    -	    ap_log_rerror(APLOG_MARK, APLOG_ERR, c->req,
    -		"proxy: error writing to %s", c->tempfile);
    -	    c = ap_proxy_cache_error(c);
    -	}
    -
    -	while (n && !r->connection->aborted) {
    -	    w = ap_bwrite(con->client, &buf[o], n);
    -	    if (w <= 0)
    -		break;
    -	    ap_reset_timeout(r);	/* reset timeout after successfule write */
    -	    n -= w;
    -	    o += w;
    -	}
    -    }
    -
    -    total_bytes_sent += ap_proxy_bputs2("

    \n", con->client, c); - total_bytes_sent += ap_proxy_bputs2(ap_psignature("", r), con->client, c); - total_bytes_sent += ap_proxy_bputs2("\n", con->client, c); - - ap_bflush(con->client); - - return total_bytes_sent; -} - -/* Common routine for failed authorization (i.e., missing or wrong password) - * to an ftp service. This causes most browsers to retry the request - * with username and password (which was presumably queried from the user) - * supplied in the Authorization: header. - * Note that we "invent" a realm name which consists of the - * ftp://user@host part of the reqest (sans password -if supplied but invalid-) - */ -static int ftp_unauthorized (request_rec *r, int log_it) -{ - r->proxyreq = 0; - /* Log failed requests if they supplied a password - * (log username/password guessing attempts) - */ - if (log_it) - ap_log_rerror(APLOG_MARK, APLOG_INFO|APLOG_NOERRNO, r, - "proxy: missing or failed auth to %s", - ap_unparse_uri_components(r->pool, - &r->parsed_uri, UNP_OMITPATHINFO)); - - ap_table_setn(r->err_headers_out, "WWW-Authenticate", - ap_pstrcat(r->pool, "Basic realm=\"", - ap_unparse_uri_components(r->pool, &r->parsed_uri, - UNP_OMITPASSWORD|UNP_OMITPATHINFO), - "\"", NULL)); - - return HTTP_UNAUTHORIZED; -} - -/* - * Handles direct access of ftp:// URLs - * Original (Non-PASV) version from - * Troy Morrison - * PASV added by Chuck - */ -int ap_proxy_ftp_handler(request_rec *r, cache_req *c, char *url) -{ - char *host, *path, *strp, *parms; - char *cwd = NULL; - char *user = NULL; -/* char *account = NULL; how to supply an account in a URL? */ - const char *password = NULL; - const char *err; - int port, i, j, len, sock, dsock, rc, nocache = 0; - int csd = 0; - struct sockaddr_in server; - struct hostent server_hp; - struct in_addr destaddr; - table *resp_hdrs; - BUFF *f; - BUFF *data = NULL; - pool *p = r->pool; - int one = 1; - const long int zero = 0L; - NET_SIZE_T clen; - struct tbl_do_args tdo; - - void *sconf = r->server->module_config; - proxy_server_conf *conf = - (proxy_server_conf *) ap_get_module_config(sconf, &proxy_module); - struct noproxy_entry *npent = (struct noproxy_entry *) conf->noproxies->elts; - struct nocache_entry *ncent = (struct nocache_entry *) conf->nocaches->elts; - -/* stuff for PASV mode */ - unsigned int presult, h0, h1, h2, h3, p0, p1; - unsigned int paddr; - unsigned short pport; - struct sockaddr_in data_addr; - int pasvmode = 0; - char pasv[64]; - char *pstr; - -/* stuff for responses */ - char resp[MAX_STRING_LEN]; - char *size = NULL; - -/* we only support GET and HEAD */ - - if (r->method_number != M_GET) - return HTTP_NOT_IMPLEMENTED; - -/* We break the URL into host, port, path-search */ - - host = r->parsed_uri.hostname; - port = (r->parsed_uri.port != 0) - ? r->parsed_uri.port - : ap_default_port_for_request(r); - path = ap_pstrdup(p, r->parsed_uri.path); - path = (path != NULL && path[0] != '\0') ? &path[1] : ""; - - /* The "Authorization:" header must be checked first. - * We allow the user to "override" the URL-coded user [ & password ] - * in the Browsers' User&Password Dialog. - * NOTE that this is only marginally more secure than having the - * password travel in plain as part of the URL, because Basic Auth - * simply uuencodes the plain text password. - * But chances are still smaller that the URL is logged regularly. - */ - if ((password = ap_table_get(r->headers_in, "Authorization")) != NULL - && strcasecmp(ap_getword(r->pool, &password, ' '), "Basic") == 0 - && (password = ap_pbase64decode(r->pool, password))[0] != ':') { - /* Note that this allocation has to be made from r->connection->pool - * because it has the lifetime of the connection. The other allocations - * are temporary and can be tossed away any time. - */ - user = ap_getword_nulls (r->connection->pool, &password, ':'); - r->connection->ap_auth_type = "Basic"; - r->connection->user = r->parsed_uri.user = user; - nocache = 1; /* This resource only accessible with username/password */ - } - else if ((user = r->parsed_uri.user) != NULL) { - user = ap_pstrdup(p, user); - decodeenc(user); - if ((password = r->parsed_uri.password) != NULL) { - char *tmp = ap_pstrdup(p, password); - decodeenc(tmp); - password = tmp; - } - nocache = 1; /* This resource only accessible with username/password */ - } - else { - user = "anonymous"; - password = "apache_proxy@"; - } - -/* check if ProxyBlock directive on this host */ - destaddr.s_addr = ap_inet_addr(host); - for (i = 0; i < conf->noproxies->nelts; i++) { - if ((npent[i].name != NULL && strstr(host, npent[i].name) != NULL) - || destaddr.s_addr == npent[i].addr.s_addr || npent[i].name[0] == '*') - return ap_proxyerror(r, HTTP_FORBIDDEN, - "Connect to remote machine blocked"); - } - - Explain2("FTP: connect to %s:%d", host, port); - - parms = strchr(path, ';'); - if (parms != NULL) - *(parms++) = '\0'; - - memset(&server, 0, sizeof(struct sockaddr_in)); - server.sin_family = AF_INET; - server.sin_port = htons(port); - err = ap_proxy_host2addr(host, &server_hp); - if (err != NULL) - return ap_proxyerror(r, HTTP_INTERNAL_SERVER_ERROR, err); - - sock = ap_psocket(p, PF_INET, SOCK_STREAM, IPPROTO_TCP); - if (sock == -1) { - ap_log_rerror(APLOG_MARK, APLOG_ERR, r, - "proxy: error creating socket"); - return HTTP_INTERNAL_SERVER_ERROR; - } - - if (conf->recv_buffer_size > 0 - && setsockopt(sock, SOL_SOCKET, SO_RCVBUF, - (const char *) &conf->recv_buffer_size, sizeof(int)) - == -1) { - ap_log_rerror(APLOG_MARK, APLOG_ERR, r, - "setsockopt(SO_RCVBUF): Failed to set ProxyReceiveBufferSize, using default"); - } - - if (setsockopt(sock, SOL_SOCKET, SO_REUSEADDR, (void *) &one, - sizeof(one)) == -1) { -#ifndef _OSD_POSIX /* BS2000 has this option "always on" */ - ap_log_rerror(APLOG_MARK, APLOG_ERR, r, - "proxy: error setting reuseaddr option: setsockopt(SO_REUSEADDR)"); - ap_pclosesocket(p, sock); - return HTTP_INTERNAL_SERVER_ERROR; -#endif /*_OSD_POSIX*/ - } - -#ifdef SINIX_D_RESOLVER_BUG - { - struct in_addr *ip_addr = (struct in_addr *) *server_hp.h_addr_list; - - for (; ip_addr->s_addr != 0; ++ip_addr) { - memcpy(&server.sin_addr, ip_addr, sizeof(struct in_addr)); - i = ap_proxy_doconnect(sock, &server, r); - if (i == 0) - break; - } - } -#else - j = 0; - while (server_hp.h_addr_list[j] != NULL) { - memcpy(&server.sin_addr, server_hp.h_addr_list[j], - sizeof(struct in_addr)); - i = ap_proxy_doconnect(sock, &server, r); - if (i == 0) - break; - j++; - } -#endif - if (i == -1) { - ap_pclosesocket(p, sock); - return ap_proxyerror(r, HTTP_BAD_GATEWAY, ap_pstrcat(r->pool, - "Could not connect to remote machine: ", - strerror(errno), NULL)); - } - - f = ap_bcreate(p, B_RDWR | B_SOCKET); - ap_bpushfd(f, sock, sock); -/* shouldn't we implement telnet control options here? */ - -#ifdef CHARSET_EBCDIC - ap_bsetflag(f, B_ASCII2EBCDIC|B_EBCDIC2ASCII, 1); -#endif /*CHARSET_EBCDIC*/ - -/* possible results: */ - /* 120 Service ready in nnn minutes. */ - /* 220 Service ready for new user. */ - /* 421 Service not available, closing control connection. */ - ap_hard_timeout("proxy ftp", r); - i = ftp_getrc_msg(f, resp, sizeof resp); - Explain1("FTP: returned status %d", i); - if (i == -1) { - ap_kill_timeout(r); - return ap_proxyerror(r, HTTP_BAD_GATEWAY, - "Error reading from remote server"); - } -#if 0 - if (i == 120) { - ap_kill_timeout(r); - /* RFC2068 states: - * 14.38 Retry-After - * - * The Retry-After response-header field can be used with a 503 (Service - * Unavailable) response to indicate how long the service is expected to - * be unavailable to the requesting client. The value of this field can - * be either an HTTP-date or an integer number of seconds (in decimal) - * after the time of the response. - * Retry-After = "Retry-After" ":" ( HTTP-date | delta-seconds ) - */ - ap_set_header("Retry-After", ap_psprintf(p, "%u", 60*wait_mins); - return ap_proxyerror(r, HTTP_SERVICE_UNAVAILABLE, resp); - } -#endif - if (i != 220) { - ap_kill_timeout(r); - return ap_proxyerror(r, HTTP_BAD_GATEWAY, resp); - } - - Explain0("FTP: connected."); - - ap_bvputs(f, "USER ", user, CRLF, NULL); - ap_bflush(f); /* capture any errors */ - Explain1("FTP: USER %s", user); - -/* possible results; 230, 331, 332, 421, 500, 501, 530 */ -/* states: 1 - error, 2 - success; 3 - send password, 4,5 fail */ - /* 230 User logged in, proceed. */ - /* 331 User name okay, need password. */ - /* 332 Need account for login. */ - /* 421 Service not available, closing control connection. */ - /* 500 Syntax error, command unrecognized. */ - /* (This may include errors such as command line too long.) */ - /* 501 Syntax error in parameters or arguments. */ - /* 530 Not logged in. */ - i = ftp_getrc(f); - Explain1("FTP: returned status %d", i); - if (i == -1) { - ap_kill_timeout(r); - return ap_proxyerror(r, HTTP_BAD_GATEWAY, - "Error reading from remote server"); - } - if (i == 530) { - ap_kill_timeout(r); - return ftp_unauthorized (r, 1); /* log it: user name guessing attempt? */ - } - if (i != 230 && i != 331) { - ap_kill_timeout(r); - return HTTP_BAD_GATEWAY; - } - - if (i == 331) { /* send password */ - if (password == NULL) { - return ftp_unauthorized (r, 0); - } - ap_bvputs(f, "PASS ", password, CRLF, NULL); - ap_bflush(f); - Explain1("FTP: PASS %s", password); -/* possible results 202, 230, 332, 421, 500, 501, 503, 530 */ - /* 230 User logged in, proceed. */ - /* 332 Need account for login. */ - /* 421 Service not available, closing control connection. */ - /* 500 Syntax error, command unrecognized. */ - /* 501 Syntax error in parameters or arguments. */ - /* 503 Bad sequence of commands. */ - /* 530 Not logged in. */ - i = ftp_getrc(f); - Explain1("FTP: returned status %d", i); - if (i == -1) { - ap_kill_timeout(r); - return ap_proxyerror(r, HTTP_BAD_GATEWAY, - "Error reading from remote server"); - } - if (i == 332) { - ap_kill_timeout(r); - return ap_proxyerror(r, HTTP_UNAUTHORIZED, - "Need account for login"); - } - /* @@@ questionable -- we might as well return a 403 Forbidden here */ - if (i == 530) { - ap_kill_timeout(r); - return ftp_unauthorized (r, 1); /* log it: passwd guessing attempt? */ - } - if (i != 230 && i != 202) { - ap_kill_timeout(r); - return HTTP_BAD_GATEWAY; - } - } - -/* set the directory (walk directory component by component): - * this is what we must do if we don't know the OS type of the remote - * machine - */ - for (;;) { - strp = strchr(path, '/'); - if (strp == NULL) - break; - *strp = '\0'; - - len = decodeenc(path); - ap_bvputs(f, "CWD ", path, CRLF, NULL); - ap_bflush(f); - Explain1("FTP: CWD %s", path); - *strp = '/'; -/* responses: 250, 421, 500, 501, 502, 530, 550 */ - /* 250 Requested file action okay, completed. */ - /* 421 Service not available, closing control connection. */ - /* 500 Syntax error, command unrecognized. */ - /* 501 Syntax error in parameters or arguments. */ - /* 502 Command not implemented. */ - /* 530 Not logged in. */ - /* 550 Requested action not taken. */ - i = ftp_getrc(f); - Explain1("FTP: returned status %d", i); - if (i == -1) { - ap_kill_timeout(r); - return ap_proxyerror(r, HTTP_BAD_GATEWAY, - "Error reading from remote server"); - } - if (i == 550) { - ap_kill_timeout(r); - return HTTP_NOT_FOUND; - } - if (i != 250) { - ap_kill_timeout(r); - return HTTP_BAD_GATEWAY; - } - - path = strp + 1; - } - - if (parms != NULL && strncmp(parms, "type=", 5) == 0) { - parms += 5; - if ((parms[0] != 'd' && parms[0] != 'a' && parms[0] != 'i') || - parms[1] != '\0') - parms = ""; - } - else - parms = ""; - - /* changed to make binary transfers the default */ - - if (parms[0] != 'a') { - /* set type to image */ - /* TM - Added \015\012 to the end of TYPE I, otherwise it hangs the - connection */ - ap_bputs("TYPE I" CRLF, f); - ap_bflush(f); - Explain0("FTP: TYPE I"); -/* responses: 200, 421, 500, 501, 504, 530 */ - /* 200 Command okay. */ - /* 421 Service not available, closing control connection. */ - /* 500 Syntax error, command unrecognized. */ - /* 501 Syntax error in parameters or arguments. */ - /* 504 Command not implemented for that parameter. */ - /* 530 Not logged in. */ - i = ftp_getrc(f); - Explain1("FTP: returned status %d", i); - if (i == -1) { - ap_kill_timeout(r); - return ap_proxyerror(r, HTTP_BAD_GATEWAY, - "Error reading from remote server"); - } - if (i != 200 && i != 504) { - ap_kill_timeout(r); - return HTTP_BAD_GATEWAY; - } -/* Allow not implemented */ - if (i == 504) - parms[0] = '\0'; - } - -/* try to set up PASV data connection first */ - dsock = ap_psocket(p, PF_INET, SOCK_STREAM, IPPROTO_TCP); - if (dsock == -1) { - ap_log_rerror(APLOG_MARK, APLOG_ERR, r, - "proxy: error creating PASV socket"); - ap_bclose(f); - ap_kill_timeout(r); - return HTTP_INTERNAL_SERVER_ERROR; - } - - if (conf->recv_buffer_size) { - if (setsockopt(dsock, SOL_SOCKET, SO_RCVBUF, - (const char *) &conf->recv_buffer_size, sizeof(int)) == -1) { - ap_log_rerror(APLOG_MARK, APLOG_ERR, r, - "setsockopt(SO_RCVBUF): Failed to set ProxyReceiveBufferSize, using default"); - } - } - - ap_bputs("PASV" CRLF, f); - ap_bflush(f); - Explain0("FTP: PASV command issued"); -/* possible results: 227, 421, 500, 501, 502, 530 */ - /* 227 Entering Passive Mode (h1,h2,h3,h4,p1,p2). */ - /* 421 Service not available, closing control connection. */ - /* 500 Syntax error, command unrecognized. */ - /* 501 Syntax error in parameters or arguments. */ - /* 502 Command not implemented. */ - /* 530 Not logged in. */ - i = ap_bgets(pasv, sizeof(pasv), f); - if (i == -1) { - ap_log_rerror(APLOG_MARK, APLOG_ERR|APLOG_NOERRNO, r, - "PASV: control connection is toast"); - ap_pclosesocket(p, dsock); - ap_bclose(f); - ap_kill_timeout(r); - return HTTP_INTERNAL_SERVER_ERROR; - } - else { - pasv[i - 1] = '\0'; - pstr = strtok(pasv, " "); /* separate result code */ - if (pstr != NULL) { - presult = atoi(pstr); - if (*(pstr + strlen(pstr) + 1) == '=') - pstr += strlen(pstr) + 2; - else - { - pstr = strtok(NULL, "("); /* separate address & port params */ - if (pstr != NULL) - pstr = strtok(NULL, ")"); - } - } - else - presult = atoi(pasv); - - Explain1("FTP: returned status %d", presult); - - if (presult == 227 && pstr != NULL && (sscanf(pstr, - "%d,%d,%d,%d,%d,%d", &h3, &h2, &h1, &h0, &p1, &p0) == 6)) { - /* pardon the parens, but it makes gcc happy */ - paddr = (((((h3 << 8) + h2) << 8) + h1) << 8) + h0; - pport = (p1 << 8) + p0; - Explain5("FTP: contacting host %d.%d.%d.%d:%d", - h3, h2, h1, h0, pport); - data_addr.sin_family = AF_INET; - data_addr.sin_addr.s_addr = htonl(paddr); - data_addr.sin_port = htons(pport); - i = ap_proxy_doconnect(dsock, &data_addr, r); - - if (i == -1) { - ap_kill_timeout(r); - return ap_proxyerror(r, HTTP_BAD_GATEWAY, - ap_pstrcat(r->pool, - "Could not connect to remote machine: ", - strerror(errno), NULL)); - } - else { - pasvmode = 1; - } - } - else - ap_pclosesocket(p, dsock); /* and try the regular way */ - } - - if (!pasvmode) { /* set up data connection */ - clen = sizeof(struct sockaddr_in); - if (getsockname(sock, (struct sockaddr *) &server, &clen) < 0) { - ap_log_rerror(APLOG_MARK, APLOG_ERR, r, - "proxy: error getting socket address"); - ap_bclose(f); - ap_kill_timeout(r); - return HTTP_INTERNAL_SERVER_ERROR; - } - - dsock = ap_psocket(p, PF_INET, SOCK_STREAM, IPPROTO_TCP); - if (dsock == -1) { - ap_log_rerror(APLOG_MARK, APLOG_ERR, r, - "proxy: error creating socket"); - ap_bclose(f); - ap_kill_timeout(r); - return HTTP_INTERNAL_SERVER_ERROR; - } - - if (setsockopt(dsock, SOL_SOCKET, SO_REUSEADDR, (void *) &one, - sizeof(one)) == -1) { -#ifndef _OSD_POSIX /* BS2000 has this option "always on" */ - ap_log_rerror(APLOG_MARK, APLOG_ERR, r, - "proxy: error setting reuseaddr option"); - ap_pclosesocket(p, dsock); - ap_bclose(f); - ap_kill_timeout(r); - return HTTP_INTERNAL_SERVER_ERROR; -#endif /*_OSD_POSIX*/ - } - - if (bind(dsock, (struct sockaddr *) &server, - sizeof(struct sockaddr_in)) == -1) { - char buff[22]; - - ap_snprintf(buff, sizeof(buff), "%s:%d", inet_ntoa(server.sin_addr), server.sin_port); - ap_log_rerror(APLOG_MARK, APLOG_ERR, r, - "proxy: error binding to ftp data socket %s", buff); - ap_bclose(f); - ap_pclosesocket(p, dsock); - return HTTP_INTERNAL_SERVER_ERROR; - } - listen(dsock, 2); /* only need a short queue */ - } - -/* set request; "path" holds last path component */ - len = decodeenc(path); - - /* TM - if len == 0 then it must be a directory (you can't RETR nothing) */ - - if (len == 0) { - parms = "d"; - } - else { - ap_bvputs(f, "SIZE ", path, CRLF, NULL); - ap_bflush(f); - Explain1("FTP: SIZE %s", path); - i = ftp_getrc_msg(f, resp, sizeof resp); - Explain2("FTP: returned status %d with response %s", i, resp); - if (i != 500) { /* Size command not recognized */ - if (i == 550) { /* Not a regular file */ - Explain0("FTP: SIZE shows this is a directory"); - parms = "d"; - ap_bvputs(f, "CWD ", path, CRLF, NULL); - ap_bflush(f); - Explain1("FTP: CWD %s", path); - i = ftp_getrc(f); - /* possible results: 250, 421, 500, 501, 502, 530, 550 */ - /* 250 Requested file action okay, completed. */ - /* 421 Service not available, closing control connection. */ - /* 500 Syntax error, command unrecognized. */ - /* 501 Syntax error in parameters or arguments. */ - /* 502 Command not implemented. */ - /* 530 Not logged in. */ - /* 550 Requested action not taken. */ - Explain1("FTP: returned status %d", i); - if (i == -1) { - ap_kill_timeout(r); - return ap_proxyerror(r, HTTP_BAD_GATEWAY, - "Error reading from remote server"); - } - if (i == 550) { - ap_kill_timeout(r); - return HTTP_NOT_FOUND; - } - if (i != 250) { - ap_kill_timeout(r); - return HTTP_BAD_GATEWAY; - } - path = ""; - len = 0; - } - else if (i == 213) { /* Size command ok */ - for (j = 0; j < sizeof resp && ap_isdigit(resp[j]); j++) - ; - resp[j] = '\0'; - if (resp[0] != '\0') - size = ap_pstrdup(p, resp); - } - } - } - -#ifdef AUTODETECT_PWD - ap_bvputs(f, "PWD", CRLF, NULL); - ap_bflush(f); - Explain0("FTP: PWD"); -/* responses: 257, 500, 501, 502, 421, 550 */ - /* 257 "" */ - /* 421 Service not available, closing control connection. */ - /* 500 Syntax error, command unrecognized. */ - /* 501 Syntax error in parameters or arguments. */ - /* 502 Command not implemented. */ - /* 550 Requested action not taken. */ - i = ftp_getrc_msg(f, resp, sizeof resp); - Explain1("FTP: PWD returned status %d", i); - if (i == -1 || i == 421) { - ap_kill_timeout(r); - return ap_proxyerror(r, HTTP_BAD_GATEWAY, - "Error reading from remote server"); - } - if (i == 550) { - ap_kill_timeout(r); - return HTTP_NOT_FOUND; - } - if (i == 257) { - const char *dirp = resp; - cwd = ap_getword_conf(r->pool, &dirp); - } -#endif /*AUTODETECT_PWD*/ - - if (parms[0] == 'd') { - if (len != 0) - ap_bvputs(f, "LIST ", path, CRLF, NULL); - else - ap_bputs("LIST -lag" CRLF, f); - Explain1("FTP: LIST %s", (len == 0 ? "" : path)); - } - else { - ap_bvputs(f, "RETR ", path, CRLF, NULL); - Explain1("FTP: RETR %s", path); - } - ap_bflush(f); -/* RETR: 110, 125, 150, 226, 250, 421, 425, 426, 450, 451, 500, 501, 530, 550 - NLST: 125, 150, 226, 250, 421, 425, 426, 450, 451, 500, 501, 502, 530 */ - /* 110 Restart marker reply. */ - /* 125 Data connection already open; transfer starting. */ - /* 150 File status okay; about to open data connection. */ - /* 226 Closing data connection. */ - /* 250 Requested file action okay, completed. */ - /* 421 Service not available, closing control connection. */ - /* 425 Can't open data connection. */ - /* 426 Connection closed; transfer aborted. */ - /* 450 Requested file action not taken. */ - /* 451 Requested action aborted. Local error in processing. */ - /* 500 Syntax error, command unrecognized. */ - /* 501 Syntax error in parameters or arguments. */ - /* 530 Not logged in. */ - /* 550 Requested action not taken. */ - rc = ftp_getrc(f); - Explain1("FTP: returned status %d", rc); - if (rc == -1) { - ap_kill_timeout(r); - return ap_proxyerror(r, HTTP_BAD_GATEWAY, - "Error reading from remote server"); - } - if (rc == 550) { - Explain0("FTP: RETR failed, trying LIST instead"); - parms = "d"; - ap_bvputs(f, "CWD ", path, CRLF, NULL); - ap_bflush(f); - Explain1("FTP: CWD %s", path); - /* possible results: 250, 421, 500, 501, 502, 530, 550 */ - /* 250 Requested file action okay, completed. */ - /* 421 Service not available, closing control connection. */ - /* 500 Syntax error, command unrecognized. */ - /* 501 Syntax error in parameters or arguments. */ - /* 502 Command not implemented. */ - /* 530 Not logged in. */ - /* 550 Requested action not taken. */ - rc = ftp_getrc(f); - Explain1("FTP: returned status %d", rc); - if (rc == -1) { - ap_kill_timeout(r); - return ap_proxyerror(r, HTTP_BAD_GATEWAY, - "Error reading from remote server"); - } - if (rc == 550) { - ap_kill_timeout(r); - return HTTP_NOT_FOUND; - } - if (rc != 250) { - ap_kill_timeout(r); - return HTTP_BAD_GATEWAY; - } - -#ifdef AUTODETECT_PWD - ap_bvputs(f, "PWD", CRLF, NULL); - ap_bflush(f); - Explain0("FTP: PWD"); -/* responses: 257, 500, 501, 502, 421, 550 */ - /* 257 "" */ - /* 421 Service not available, closing control connection. */ - /* 500 Syntax error, command unrecognized. */ - /* 501 Syntax error in parameters or arguments. */ - /* 502 Command not implemented. */ - /* 550 Requested action not taken. */ - i = ftp_getrc_msg(f, resp, sizeof resp); - Explain1("FTP: PWD returned status %d", i); - if (i == -1 || i == 421) { - ap_kill_timeout(r); - return ap_proxyerror(r, HTTP_BAD_GATEWAY, - "Error reading from remote server"); - } - if (i == 550) { - ap_kill_timeout(r); - return HTTP_NOT_FOUND; - } - if (i == 257) { - const char *dirp = resp; - cwd = ap_getword_conf(r->pool, &dirp); - } -#endif /*AUTODETECT_PWD*/ - - ap_bputs("LIST -lag" CRLF, f); - ap_bflush(f); - Explain0("FTP: LIST -lag"); - rc = ftp_getrc(f); - Explain1("FTP: returned status %d", rc); - if (rc == -1) - return ap_proxyerror(r, HTTP_BAD_GATEWAY, - "Error reading from remote server"); - } - ap_kill_timeout(r); - if (rc != 125 && rc != 150 && rc != 226 && rc != 250) - return HTTP_BAD_GATEWAY; - - r->status = HTTP_OK; - r->status_line = "200 OK"; - - resp_hdrs = ap_make_table(p, 2); - c->hdrs = resp_hdrs; - - ap_table_setn(resp_hdrs, "Date", ap_gm_timestr_822(r->pool, r->request_time)); - ap_table_setn(resp_hdrs, "Server", ap_get_server_version()); - - if (parms[0] == 'd') - ap_table_setn(resp_hdrs, "Content-Type", "text/html"); - else { - if (r->content_type != NULL) { - ap_table_setn(resp_hdrs, "Content-Type", r->content_type); - Explain1("FTP: Content-Type set to %s", r->content_type); - } - else { - ap_table_setn(resp_hdrs, "Content-Type", ap_default_type(r)); - } - if (parms[0] != 'a' && size != NULL) { - /* We "trust" the ftp server to really serve (size) bytes... */ - ap_table_set(resp_hdrs, "Content-Length", size); - Explain1("FTP: Content-Length set to %s", size); - } - } - if (r->content_encoding != NULL && r->content_encoding[0] != '\0') { - Explain1("FTP: Content-Encoding set to %s", r->content_encoding); - ap_table_setn(resp_hdrs, "Content-Encoding", r->content_encoding); - } - -/* check if NoCache directive on this host */ - for (i = 0; i < conf->nocaches->nelts; i++) { - if ((ncent[i].name != NULL && strstr(host, ncent[i].name) != NULL) - || destaddr.s_addr == ncent[i].addr.s_addr || ncent[i].name[0] == '*') - nocache = 1; - } - - i = ap_proxy_cache_update(c, resp_hdrs, 0, nocache); - - if (i != DECLINED) { - ap_pclosesocket(p, dsock); - ap_bclose(f); - return i; - } - - if (!pasvmode) { /* wait for connection */ - ap_hard_timeout("proxy ftp data connect", r); - clen = sizeof(struct sockaddr_in); - do - csd = accept(dsock, (struct sockaddr *) &server, &clen); - while (csd == -1 && errno == EINTR); - if (csd == -1) { - ap_log_rerror(APLOG_MARK, APLOG_ERR, r, - "proxy: failed to accept data connection"); - ap_pclosesocket(p, dsock); - ap_bclose(f); - ap_kill_timeout(r); - if (c != NULL) - c = ap_proxy_cache_error(c); - return HTTP_BAD_GATEWAY; - } - ap_note_cleanups_for_socket(p, csd); - data = ap_bcreate(p, B_RDWR | B_SOCKET); - ap_bpushfd(data, csd, -1); - ap_kill_timeout(r); - } - else { - data = ap_bcreate(p, B_RDWR | B_SOCKET); - ap_bpushfd(data, dsock, dsock); - } - - ap_hard_timeout("proxy receive", r); -/* send response */ -/* write status line */ - if (!r->assbackwards) - ap_rvputs(r, "HTTP/1.0 ", r->status_line, CRLF, NULL); - if (c != NULL && c->fp != NULL - && ap_bvputs(c->fp, "HTTP/1.0 ", r->status_line, CRLF, NULL) == -1) { - ap_log_rerror(APLOG_MARK, APLOG_ERR, c->req, - "proxy: error writing CRLF to %s", c->tempfile); - c = ap_proxy_cache_error(c); - } - -/* send headers */ - tdo.req = r; - tdo.cache = c; - ap_table_do(ap_proxy_send_hdr_line, &tdo, resp_hdrs, NULL); - - if (!r->assbackwards) - ap_rputs(CRLF, r); - if (c != NULL && c->fp != NULL && ap_bputs(CRLF, c->fp) == -1) { - ap_log_rerror(APLOG_MARK, APLOG_ERR, c->req, - "proxy: error writing CRLF to %s", c->tempfile); - c = ap_proxy_cache_error(c); - } - - ap_bsetopt(r->connection->client, BO_BYTECT, &zero); - r->sent_bodyct = 1; -/* send body */ - if (!r->header_only) { - if (parms[0] != 'd') { -/* we need to set this for ap_proxy_send_fb()... */ - if (c != NULL) - c->cache_completion = 0; - ap_proxy_send_fb(data, r, c); - } else - send_dir(data, r, c, cwd); - - if (rc == 125 || rc == 150) - rc = ftp_getrc(f); - - /* XXX: we checked for 125||150||226||250 above. This is redundant. */ - if (rc != 226 && rc != 250) - /* XXX: we no longer log an "error writing to c->tempfile" - should we? */ - c = ap_proxy_cache_error(c); - } - else { -/* abort the transfer */ - ap_bputs("ABOR" CRLF, f); - ap_bflush(f); - if (!pasvmode) - ap_bclose(data); - Explain0("FTP: ABOR"); -/* responses: 225, 226, 421, 500, 501, 502 */ - /* 225 Data connection open; no transfer in progress. */ - /* 226 Closing data connection. */ - /* 421 Service not available, closing control connection. */ - /* 500 Syntax error, command unrecognized. */ - /* 501 Syntax error in parameters or arguments. */ - /* 502 Command not implemented. */ - i = ftp_getrc(f); - Explain1("FTP: returned status %d", i); - } - - ap_kill_timeout(r); - ap_proxy_cache_tidy(c); - -/* finish */ - ap_bputs("QUIT" CRLF, f); - ap_bflush(f); - Explain0("FTP: QUIT"); -/* responses: 221, 500 */ - /* 221 Service closing control connection. */ - /* 500 Syntax error, command unrecognized. */ - i = ftp_getrc(f); - Explain1("FTP: QUIT: status %d", i); - - if (pasvmode) - ap_bclose(data); - ap_bclose(f); - - ap_rflush(r); /* flush before garbage collection */ - - ap_proxy_garbage_coll(r); - - return OK; -} diff --git a/modules/proxy/proxy_http.c b/modules/proxy/proxy_http.c deleted file mode 100644 index 42938062d968146a920433f1b60e459e8230d06e..0000000000000000000000000000000000000000 --- a/modules/proxy/proxy_http.c +++ /dev/null @@ -1,543 +0,0 @@ -/* ==================================================================== - * Copyright (c) 1996-1999 The Apache Group. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in - * the documentation and/or other materials provided with the - * distribution. - * - * 3. All advertising materials mentioning features or use of this - * software must display the following acknowledgment: - * "This product includes software developed by the Apache Group - * for use in the Apache HTTP server project (http://www.apache.org/)." - * - * 4. The names "Apache Server" and "Apache Group" must not be used to - * endorse or promote products derived from this software without - * prior written permission. For written permission, please contact - * apache@apache.org. - * - * 5. Products derived from this software may not be called "Apache" - * nor may "Apache" appear in their names without prior written - * permission of the Apache Group. - * - * 6. Redistributions of any form whatsoever must retain the following - * acknowledgment: - * "This product includes software developed by the Apache Group - * for use in the Apache HTTP server project (http://www.apache.org/)." - * - * THIS SOFTWARE IS PROVIDED BY THE APACHE GROUP ``AS IS'' AND ANY - * EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR - * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE APACHE GROUP OR - * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT - * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, - * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED - * OF THE POSSIBILITY OF SUCH DAMAGE. - * ==================================================================== - * - * This software consists of voluntary contributions made by many - * individuals on behalf of the Apache Group and was originally based - * on public domain software written at the National Center for - * Supercomputing Applications, University of Illinois, Urbana-Champaign. - * For more information on the Apache Group and the Apache HTTP server - * project, please see . - * - */ - -/* HTTP routines for Apache proxy */ - -#include "mod_proxy.h" -#include "http_log.h" -#include "http_main.h" -#include "http_core.h" -#include "util_date.h" - -/* - * Canonicalise http-like URLs. - * scheme is the scheme for the URL - * url is the URL starting with the first '/' - * def_port is the default port for this scheme. - */ -int ap_proxy_http_canon(request_rec *r, char *url, const char *scheme, int def_port) -{ - char *host, *path, *search, sport[7]; - const char *err; - int port; - -/* do syntatic check. - * We break the URL into host, port, path, search - */ - port = def_port; - err = ap_proxy_canon_netloc(r->pool, &url, NULL, NULL, &host, &port); - if (err) - return HTTP_BAD_REQUEST; - -/* now parse path/search args, according to rfc1738 */ -/* N.B. if this isn't a true proxy request, then the URL _path_ - * has already been decoded. True proxy requests have r->uri - * == r->unparsed_uri, and no others have that property. - */ - if (r->uri == r->unparsed_uri) { - search = strchr(url, '?'); - if (search != NULL) - *(search++) = '\0'; - } - else - search = r->args; - -/* process path */ - path = ap_proxy_canonenc(r->pool, url, strlen(url), enc_path, r->proxyreq); - if (path == NULL) - return HTTP_BAD_REQUEST; - - if (port != def_port) - ap_snprintf(sport, sizeof(sport), ":%d", port); - else - sport[0] = '\0'; - - r->filename = ap_pstrcat(r->pool, "proxy:", scheme, "://", host, sport, "/", - path, (search) ? "?" : "", (search) ? search : "", NULL); - return OK; -} - -static const char *proxy_location_reverse_map(request_rec *r, const char *url) -{ - void *sconf; - proxy_server_conf *conf; - struct proxy_alias *ent; - int i, l1, l2; - char *u; - - sconf = r->server->module_config; - conf = (proxy_server_conf *)ap_get_module_config(sconf, &proxy_module); - l1 = strlen(url); - ent = (struct proxy_alias *)conf->raliases->elts; - for (i = 0; i < conf->raliases->nelts; i++) { - l2 = strlen(ent[i].real); - if (l1 >= l2 && strncmp(ent[i].real, url, l2) == 0) { - u = ap_pstrcat(r->pool, ent[i].fake, &url[l2], NULL); - return ap_construct_url(r->pool, u, r); - } - } - return url; -} - -/* Clear all connection-based headers from the incoming headers table */ -static void clear_connection(pool *p, table *headers) -{ - const char *name; - char *next = ap_pstrdup(p, ap_table_get(headers, "Connection")); - - ap_table_unset(headers, "Proxy-Connection"); - if (!next) - return; - - while (*next) { - name = next; - while (*next && !ap_isspace(*next) && (*next != ',')) - ++next; - while (*next && (ap_isspace(*next) || (*next == ','))) { - *next = '\0'; - ++next; - } - ap_table_unset(headers, name); - } - ap_table_unset(headers, "Connection"); -} - -/* - * This handles http:// URLs, and other URLs using a remote proxy over http - * If proxyhost is NULL, then contact the server directly, otherwise - * go via the proxy. - * Note that if a proxy is used, then URLs other than http: can be accessed, - * also, if we have trouble which is clearly specific to the proxy, then - * we return DECLINED so that we can try another proxy. (Or the direct - * route.) - */ -int ap_proxy_http_handler(request_rec *r, cache_req *c, char *url, - const char *proxyhost, int proxyport) -{ - const char *strp; - char *strp2; - const char *err, *desthost; - int i, j, sock, len, backasswards; - array_header *reqhdrs_arr; - table *resp_hdrs; - table_entry *reqhdrs; - struct sockaddr_in server; - struct in_addr destaddr; - struct hostent server_hp; - BUFF *f; - char buffer[HUGE_STRING_LEN]; - char portstr[32]; - pool *p = r->pool; - const long int zero = 0L; - int destport = 0; - char *destportstr = NULL; - const char *urlptr = NULL; - const char *datestr; - struct tbl_do_args tdo; - - void *sconf = r->server->module_config; - proxy_server_conf *conf = - (proxy_server_conf *) ap_get_module_config(sconf, &proxy_module); - struct noproxy_entry *npent = (struct noproxy_entry *) conf->noproxies->elts; - struct nocache_entry *ncent = (struct nocache_entry *) conf->nocaches->elts; - int nocache = 0; - - memset(&server, '\0', sizeof(server)); - server.sin_family = AF_INET; - -/* We break the URL into host, port, path-search */ - - urlptr = strstr(url, "://"); - if (urlptr == NULL) - return HTTP_BAD_REQUEST; - urlptr += 3; - destport = DEFAULT_HTTP_PORT; - strp = strchr(urlptr, '/'); - if (strp == NULL) { - desthost = ap_pstrdup(p, urlptr); - urlptr = "/"; - } - else { - char *q = ap_palloc(p, strp - urlptr + 1); - memcpy(q, urlptr, strp - urlptr); - q[strp - urlptr] = '\0'; - urlptr = strp; - desthost = q; - } - - strp2 = strchr(desthost, ':'); - if (strp2 != NULL) { - *(strp2++) = '\0'; - if (ap_isdigit(*strp2)) { - destport = atoi(strp2); - destportstr = strp2; - } - } - -/* check if ProxyBlock directive on this host */ - destaddr.s_addr = ap_inet_addr(desthost); - for (i = 0; i < conf->noproxies->nelts; i++) { - if ((npent[i].name != NULL && strstr(desthost, npent[i].name) != NULL) - || destaddr.s_addr == npent[i].addr.s_addr || npent[i].name[0] == '*') - return ap_proxyerror(r, HTTP_FORBIDDEN, - "Connect to remote machine blocked"); - } - - if (proxyhost != NULL) { - server.sin_port = htons(proxyport); - err = ap_proxy_host2addr(proxyhost, &server_hp); - if (err != NULL) - return DECLINED; /* try another */ - } - else { - server.sin_port = htons(destport); - err = ap_proxy_host2addr(desthost, &server_hp); - if (err != NULL) - return ap_proxyerror(r, HTTP_INTERNAL_SERVER_ERROR, err); - } - - sock = ap_psocket(p, PF_INET, SOCK_STREAM, IPPROTO_TCP); - if (sock == -1) { - ap_log_rerror(APLOG_MARK, APLOG_ERR, r, - "proxy: error creating socket"); - return HTTP_INTERNAL_SERVER_ERROR; - } - - if (conf->recv_buffer_size) { - if (setsockopt(sock, SOL_SOCKET, SO_RCVBUF, - (const char *) &conf->recv_buffer_size, sizeof(int)) - == -1) { - ap_log_rerror(APLOG_MARK, APLOG_ERR, r, - "setsockopt(SO_RCVBUF): Failed to set ProxyReceiveBufferSize, using default"); - } - } - -#ifdef SINIX_D_RESOLVER_BUG - { - struct in_addr *ip_addr = (struct in_addr *) *server_hp.h_addr_list; - - for (; ip_addr->s_addr != 0; ++ip_addr) { - memcpy(&server.sin_addr, ip_addr, sizeof(struct in_addr)); - i = ap_proxy_doconnect(sock, &server, r); - if (i == 0) - break; - } - } -#else - j = 0; - while (server_hp.h_addr_list[j] != NULL) { - memcpy(&server.sin_addr, server_hp.h_addr_list[j], - sizeof(struct in_addr)); - i = ap_proxy_doconnect(sock, &server, r); - if (i == 0) - break; - j++; - } -#endif - if (i == -1) { - if (proxyhost != NULL) - return DECLINED; /* try again another way */ - else - return ap_proxyerror(r, HTTP_BAD_GATEWAY, ap_pstrcat(r->pool, - "Could not connect to remote machine: ", - strerror(errno), NULL)); - } - - clear_connection(r->pool, r->headers_in); /* Strip connection-based headers */ - - f = ap_bcreate(p, B_RDWR | B_SOCKET); - ap_bpushfd(f, sock, sock); - - ap_hard_timeout("proxy send", r); - ap_bvputs(f, r->method, " ", proxyhost ? url : urlptr, " HTTP/1.0" CRLF, - NULL); - if (destportstr != NULL && destport != DEFAULT_HTTP_PORT) - ap_bvputs(f, "Host: ", desthost, ":", destportstr, CRLF, NULL); - else - ap_bvputs(f, "Host: ", desthost, CRLF, NULL); - - if (conf->viaopt == via_block) { - /* Block all outgoing Via: headers */ - ap_table_unset(r->headers_in, "Via"); - } else if (conf->viaopt != via_off) { - /* Create a "Via:" request header entry and merge it */ - i = ap_get_server_port(r); - if (ap_is_default_port(i,r)) { - strcpy(portstr,""); - } else { - ap_snprintf(portstr, sizeof portstr, ":%d", i); - } - /* Generate outgoing Via: header with/without server comment: */ - ap_table_mergen(r->headers_in, "Via", - (conf->viaopt == via_full) - ? ap_psprintf(p, "%d.%d %s%s (%s)", - HTTP_VERSION_MAJOR(r->proto_num), - HTTP_VERSION_MINOR(r->proto_num), - ap_get_server_name(r), portstr, - SERVER_BASEVERSION) - : ap_psprintf(p, "%d.%d %s%s", - HTTP_VERSION_MAJOR(r->proto_num), - HTTP_VERSION_MINOR(r->proto_num), - ap_get_server_name(r), portstr) - ); - } - - reqhdrs_arr = ap_table_elts(r->headers_in); - reqhdrs = (table_entry *) reqhdrs_arr->elts; - for (i = 0; i < reqhdrs_arr->nelts; i++) { - if (reqhdrs[i].key == NULL || reqhdrs[i].val == NULL - /* Clear out headers not to send */ - || !strcasecmp(reqhdrs[i].key, "Host") /* Already sent */ - /* XXX: @@@ FIXME: "Proxy-Authorization" should *only* be - * suppressed if THIS server requested the authentication, - * not when a frontend proxy requested it! - */ - || !strcasecmp(reqhdrs[i].key, "Proxy-Authorization")) - continue; - ap_bvputs(f, reqhdrs[i].key, ": ", reqhdrs[i].val, CRLF, NULL); - } - - ap_bputs(CRLF, f); -/* send the request data, if any. */ - - if (ap_should_client_block(r)) { - while ((i = ap_get_client_block(r, buffer, sizeof buffer)) > 0) - ap_bwrite(f, buffer, i); - } - ap_bflush(f); - ap_kill_timeout(r); - - ap_hard_timeout("proxy receive", r); - - len = ap_bgets(buffer, sizeof buffer - 1, f); - if (len == -1) { - ap_bclose(f); - ap_kill_timeout(r); - ap_log_rerror(APLOG_MARK, APLOG_ERR, r, - "ap_bgets() - proxy receive - Error reading from remote server %s (length %d)", - proxyhost ? proxyhost : desthost, len); - return ap_proxyerror(r, HTTP_BAD_GATEWAY, - "Error reading from remote server"); - } else if (len == 0) { - ap_bclose(f); - ap_kill_timeout(r); - return ap_proxyerror(r, HTTP_BAD_GATEWAY, - "Document contains no data"); - } - -/* Is it an HTTP/1 response? This is buggy if we ever see an HTTP/1.10 */ - if (ap_checkmask(buffer, "HTTP/#.# ###*")) { - int major, minor; - if (2 != sscanf(buffer, "HTTP/%u.%u", &major, &minor)) { - major = 1; - minor = 0; - } - -/* If not an HTTP/1 message or if the status line was > 8192 bytes */ - if (buffer[5] != '1' || buffer[len - 1] != '\n') { - ap_bclose(f); - ap_kill_timeout(r); - return HTTP_BAD_GATEWAY; - } - backasswards = 0; - buffer[--len] = '\0'; - - buffer[12] = '\0'; - r->status = atoi(&buffer[9]); - buffer[12] = ' '; - r->status_line = ap_pstrdup(p, &buffer[9]); - -/* read the headers. */ -/* N.B. for HTTP/1.0 clients, we have to fold line-wrapped headers */ -/* Also, take care with headers with multiple occurences. */ - - resp_hdrs = ap_proxy_read_headers(r, buffer, HUGE_STRING_LEN, f); - if (resp_hdrs == NULL) { - ap_log_error(APLOG_MARK, APLOG_WARNING|APLOG_NOERRNO, r->server, - "proxy: Bad HTTP/%d.%d header returned by %s (%s)", - major, minor, r->uri, r->method); - resp_hdrs = ap_make_table(p, 20); - nocache = 1; /* do not cache this broken file */ - } - - if (conf->viaopt != via_off && conf->viaopt != via_block) { - /* Create a "Via:" response header entry and merge it */ - i = ap_get_server_port(r); - if (ap_is_default_port(i,r)) { - strcpy(portstr,""); - } else { - ap_snprintf(portstr, sizeof portstr, ":%d", i); - } - ap_table_mergen((table *)resp_hdrs, "Via", - (conf->viaopt == via_full) - ? ap_psprintf(p, "%d.%d %s%s (%s)", - major, minor, - ap_get_server_name(r), portstr, - SERVER_BASEVERSION) - : ap_psprintf(p, "%d.%d %s%s", - major, minor, - ap_get_server_name(r), portstr) - ); - } - - clear_connection(p, resp_hdrs); /* Strip Connection hdrs */ - } - else { -/* an http/0.9 response */ - backasswards = 1; - r->status = 200; - r->status_line = "200 OK"; - -/* no headers */ - resp_hdrs = ap_make_table(p, 20); - } - - c->hdrs = resp_hdrs; - - ap_kill_timeout(r); - -/* - * HTTP/1.0 requires us to accept 3 types of dates, but only generate - * one type - */ - if ((datestr = ap_table_get(resp_hdrs, "Date")) != NULL) - ap_table_set(resp_hdrs, "Date", ap_proxy_date_canon(p, datestr)); - if ((datestr = ap_table_get(resp_hdrs, "Last-Modified")) != NULL) - ap_table_set(resp_hdrs, "Last-Modified", ap_proxy_date_canon(p, datestr)); - if ((datestr = ap_table_get(resp_hdrs, "Expires")) != NULL) - ap_table_set(resp_hdrs, "Expires", ap_proxy_date_canon(p, datestr)); - - if ((datestr = ap_table_get(resp_hdrs, "Location")) != NULL) - ap_table_set(resp_hdrs, "Location", proxy_location_reverse_map(r, datestr)); - if ((datestr = ap_table_get(resp_hdrs, "URI")) != NULL) - ap_table_set(resp_hdrs, "URI", proxy_location_reverse_map(r, datestr)); - -/* check if NoCache directive on this host */ - for (i = 0; i < conf->nocaches->nelts; i++) { - if ((ncent[i].name != NULL && strstr(desthost, ncent[i].name) != NULL) - || destaddr.s_addr == ncent[i].addr.s_addr || ncent[i].name[0] == '*') - nocache = 1; - } - - i = ap_proxy_cache_update(c, resp_hdrs, !backasswards, nocache); - if (i != DECLINED) { - ap_bclose(f); - return i; - } - - ap_hard_timeout("proxy receive", r); - -/* write status line */ - if (!r->assbackwards) - ap_rvputs(r, "HTTP/1.0 ", r->status_line, CRLF, NULL); - if (c != NULL && c->fp != NULL && - ap_bvputs(c->fp, "HTTP/1.0 ", r->status_line, CRLF, NULL) == -1) { - ap_log_rerror(APLOG_MARK, APLOG_ERR, c->req, - "proxy: error writing status line to %s", c->tempfile); - c = ap_proxy_cache_error(c); - } - -/* send headers */ - tdo.req = r; - tdo.cache = c; - ap_table_do(ap_proxy_send_hdr_line, &tdo, resp_hdrs, NULL); - - if (!r->assbackwards) - ap_rputs(CRLF, r); - if (c != NULL && c->fp != NULL && ap_bputs(CRLF, c->fp) == -1) { - ap_log_rerror(APLOG_MARK, APLOG_ERR, c->req, - "proxy: error writing CRLF to %s", c->tempfile); - c = ap_proxy_cache_error(c); - } - - ap_bsetopt(r->connection->client, BO_BYTECT, &zero); - r->sent_bodyct = 1; -/* Is it an HTTP/0.9 respose? If so, send the extra data */ - if (backasswards) { - ap_bwrite(r->connection->client, buffer, len); - if (c != NULL && c->fp != NULL && ap_bwrite(c->fp, buffer, len) != len) { - ap_log_rerror(APLOG_MARK, APLOG_ERR, c->req, - "proxy: error writing extra data to %s", c->tempfile); - c = ap_proxy_cache_error(c); - } - } - ap_kill_timeout(r); - -#ifdef CHARSET_EBCDIC - /* What we read/write after the header should not be modified - * (i.e., the cache copy is ASCII, not EBCDIC, even for text/html) - */ - ap_bsetflag(f, B_ASCII2EBCDIC|B_EBCDIC2ASCII, 0); - ap_bsetflag(r->connection->client, B_ASCII2EBCDIC|B_EBCDIC2ASCII, 0); -#endif - -/* send body */ -/* if header only, then cache will be NULL */ -/* HTTP/1.0 tells us to read to EOF, rather than content-length bytes */ - if (!r->header_only) { -/* we need to set this for ap_proxy_send_fb()... */ - c->cache_completion = conf->cache.cache_completion; - ap_proxy_send_fb(f, r, c); - } - - ap_proxy_cache_tidy(c); - - ap_bclose(f); - - ap_proxy_garbage_coll(r); - return OK; -} diff --git a/modules/proxy/proxy_util.c b/modules/proxy/proxy_util.c deleted file mode 100644 index c1258f14995f180958397e4a89a5f39f7f7265e2..0000000000000000000000000000000000000000 --- a/modules/proxy/proxy_util.c +++ /dev/null @@ -1,1288 +0,0 @@ -/* ==================================================================== - * Copyright (c) 1996-1999 The Apache Group. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in - * the documentation and/or other materials provided with the - * distribution. - * - * 3. All advertising materials mentioning features or use of this - * software must display the following acknowledgment: - * "This product includes software developed by the Apache Group - * for use in the Apache HTTP server project (http://www.apache.org/)." - * - * 4. The names "Apache Server" and "Apache Group" must not be used to - * endorse or promote products derived from this software without - * prior written permission. For written permission, please contact - * apache@apache.org. - * - * 5. Products derived from this software may not be called "Apache" - * nor may "Apache" appear in their names without prior written - * permission of the Apache Group. - * - * 6. Redistributions of any form whatsoever must retain the following - * acknowledgment: - * "This product includes software developed by the Apache Group - * for use in the Apache HTTP server project (http://www.apache.org/)." - * - * THIS SOFTWARE IS PROVIDED BY THE APACHE GROUP ``AS IS'' AND ANY - * EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR - * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE APACHE GROUP OR - * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT - * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, - * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED - * OF THE POSSIBILITY OF SUCH DAMAGE. - * ==================================================================== - * - * This software consists of voluntary contributions made by many - * individuals on behalf of the Apache Group and was originally based - * on public domain software written at the National Center for - * Supercomputing Applications, University of Illinois, Urbana-Champaign. - * For more information on the Apache Group and the Apache HTTP server - * project, please see . - * - */ - -/* Utility routines for Apache proxy */ -#include "mod_proxy.h" -#include "http_main.h" -#include "ap_md5.h" -#include "multithread.h" -#include "http_log.h" -#include "util_uri.h" -#include "util_date.h" /* get ap_checkmask() decl. */ - -static int proxy_match_ipaddr(struct dirconn_entry *This, request_rec *r); -static int proxy_match_domainname(struct dirconn_entry *This, request_rec *r); -static int proxy_match_hostname(struct dirconn_entry *This, request_rec *r); -static int proxy_match_word(struct dirconn_entry *This, request_rec *r); - -/* already called in the knowledge that the characters are hex digits */ -int ap_proxy_hex2c(const char *x) -{ - int i, ch; - -#ifndef CHARSET_EBCDIC - ch = x[0]; - if (ap_isdigit(ch)) - i = ch - '0'; - else if (ap_isupper(ch)) - i = ch - ('A' - 10); - else - i = ch - ('a' - 10); - i <<= 4; - - ch = x[1]; - if (ap_isdigit(ch)) - i += ch - '0'; - else if (ap_isupper(ch)) - i += ch - ('A' - 10); - else - i += ch - ('a' - 10); - return i; -#else /*CHARSET_EBCDIC*/ - return (1 == sscanf(x, "%2x", &i)) ? os_toebcdic[i&0xFF] : 0; -#endif /*CHARSET_EBCDIC*/ -} - -void ap_proxy_c2hex(int ch, char *x) -{ -#ifndef CHARSET_EBCDIC - int i; - - x[0] = '%'; - i = (ch & 0xF0) >> 4; - if (i >= 10) - x[1] = ('A' - 10) + i; - else - x[1] = '0' + i; - - i = ch & 0x0F; - if (i >= 10) - x[2] = ('A' - 10) + i; - else - x[2] = '0' + i; -#else /*CHARSET_EBCDIC*/ - static const char ntoa[] = { "0123456789ABCDEF" }; - ch &= 0xFF; - x[0] = '%'; - x[1] = ntoa[(os_toascii[ch]>>4)&0x0F]; - x[2] = ntoa[os_toascii[ch]&0x0F]; - x[3] = '\0'; -#endif /*CHARSET_EBCDIC*/ -} - -/* - * canonicalise a URL-encoded string - */ - -/* - * Convert a URL-encoded string to canonical form. - * It decodes characters which need not be encoded, - * and encodes those which must be encoded, and does not touch - * those which must not be touched. - */ -char * - ap_proxy_canonenc(pool *p, const char *x, int len, enum enctype t, int isenc) -{ - int i, j, ch; - char *y; - const char *allowed; /* characters which should not be encoded */ - const char *reserved; /* characters which much not be en/de-coded */ - -/* N.B. in addition to :@&=, this allows ';' in an http path - * and '?' in an ftp path -- this may be revised - * - * Also, it makes a '+' character in a search string reserved, as - * it may be form-encoded. (Although RFC 1738 doesn't allow this - - * it only permits ; / ? : @ = & as reserved chars.) - */ - if (t == enc_path) - allowed = "$-_.+!*'(),;:@&="; - else if (t == enc_search) - allowed = "$-_.!*'(),;:@&="; - else if (t == enc_user) - allowed = "$-_.+!*'(),;@&="; - else if (t == enc_fpath) - allowed = "$-_.+!*'(),?:@&="; - else /* if (t == enc_parm) */ - allowed = "$-_.+!*'(),?/:@&="; - - if (t == enc_path) - reserved = "/"; - else if (t == enc_search) - reserved = "+"; - else - reserved = ""; - - y = ap_palloc(p, 3 * len + 1); - - for (i = 0, j = 0; i < len; i++, j++) { -/* always handle '/' first */ - ch = x[i]; - if (strchr(reserved, ch)) { - y[j] = ch; - continue; - } -/* decode it if not already done */ - if (isenc && ch == '%') { - if (!ap_isxdigit(x[i + 1]) || !ap_isxdigit(x[i + 2])) - return NULL; - ch = ap_proxy_hex2c(&x[i + 1]); - i += 2; - if (ch != 0 && strchr(reserved, ch)) { /* keep it encoded */ - ap_proxy_c2hex(ch, &y[j]); - j += 2; - continue; - } - } -/* recode it, if necessary */ - if (!ap_isalnum(ch) && !strchr(allowed, ch)) { - ap_proxy_c2hex(ch, &y[j]); - j += 2; - } - else - y[j] = ch; - } - y[j] = '\0'; - return y; -} - -/* - * Parses network-location. - * urlp on input the URL; on output the path, after the leading / - * user NULL if no user/password permitted - * password holder for password - * host holder for host - * port port number; only set if one is supplied. - * - * Returns an error string. - */ -char * - ap_proxy_canon_netloc(pool *p, char **const urlp, char **userp, - char **passwordp, char **hostp, int *port) -{ - int i; - char *strp, *host, *url = *urlp; - char *user = NULL, *password = NULL; - - if (url[0] != '/' || url[1] != '/') - return "Malformed URL"; - host = url + 2; - url = strchr(host, '/'); - if (url == NULL) - url = ""; - else - *(url++) = '\0'; /* skip seperating '/' */ - - /* find _last_ '@' since it might occur in user/password part */ - strp = strrchr(host, '@'); - - if (strp != NULL) { - *strp = '\0'; - user = host; - host = strp + 1; - -/* find password */ - strp = strchr(user, ':'); - if (strp != NULL) { - *strp = '\0'; - password = ap_proxy_canonenc(p, strp + 1, strlen(strp + 1), enc_user, 1); - if (password == NULL) - return "Bad %-escape in URL (password)"; - } - - user = ap_proxy_canonenc(p, user, strlen(user), enc_user, 1); - if (user == NULL) - return "Bad %-escape in URL (username)"; - } - if (userp != NULL) { - *userp = user; - } - if (passwordp != NULL) { - *passwordp = password; - } - - strp = strrchr(host, ':'); - if (strp != NULL) { - *(strp++) = '\0'; - - for (i = 0; strp[i] != '\0'; i++) - if (!ap_isdigit(strp[i])) - break; - - /* if (i == 0) the no port was given; keep default */ - if (strp[i] != '\0') { - return "Bad port number in URL"; - } else if (i > 0) { - *port = atoi(strp); - if (*port > 65535) - return "Port number in URL > 65535"; - } - } - ap_str_tolower(host); /* DNS names are case-insensitive */ - if (*host == '\0') - return "Missing host in URL"; -/* check hostname syntax */ - for (i = 0; host[i] != '\0'; i++) - if (!ap_isdigit(host[i]) && host[i] != '.') - break; - /* must be an IP address */ -#ifdef WIN32 - if (host[i] == '\0' && (inet_addr(host) == -1)) -#else - if (host[i] == '\0' && (ap_inet_addr(host) == -1 || inet_network(host) == -1)) -#endif - { - return "Bad IP address in URL"; - } - -/* if (strchr(host,'.') == NULL && domain != NULL) - host = pstrcat(p, host, domain, NULL); - */ - *urlp = url; - *hostp = host; - - return NULL; -} - -static const char * const lwday[7] = -{"Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday"}; - -/* - * If the date is a valid RFC 850 date or asctime() date, then it - * is converted to the RFC 1123 format, otherwise it is not modified. - * This routine is not very fast at doing conversions, as it uses - * sscanf and sprintf. However, if the date is already correctly - * formatted, then it exits very quickly. - */ -const char * - ap_proxy_date_canon(pool *p, const char *x) -{ - int wk, mday, year, hour, min, sec, mon; - char *q, month[4], zone[4], week[4]; - - q = strchr(x, ','); - /* check for RFC 850 date */ - if (q != NULL && q - x > 3 && q[1] == ' ') { - *q = '\0'; - for (wk = 0; wk < 7; wk++) - if (strcmp(x, lwday[wk]) == 0) - break; - *q = ','; - if (wk == 7) - return x; /* not a valid date */ - if (q[4] != '-' || q[8] != '-' || q[11] != ' ' || q[14] != ':' || - q[17] != ':' || strcmp(&q[20], " GMT") != 0) - return x; - if (sscanf(q + 2, "%u-%3s-%u %u:%u:%u %3s", &mday, month, &year, - &hour, &min, &sec, zone) != 7) - return x; - if (year < 70) - year += 2000; - else - year += 1900; - } - else { -/* check for acstime() date */ - if (x[3] != ' ' || x[7] != ' ' || x[10] != ' ' || x[13] != ':' || - x[16] != ':' || x[19] != ' ' || x[24] != '\0') - return x; - if (sscanf(x, "%3s %3s %u %u:%u:%u %u", week, month, &mday, &hour, - &min, &sec, &year) != 7) - return x; - for (wk = 0; wk < 7; wk++) - if (strcmp(week, ap_day_snames[wk]) == 0) - break; - if (wk == 7) - return x; - } - -/* check date */ - for (mon = 0; mon < 12; mon++) - if (strcmp(month, ap_month_snames[mon]) == 0) - break; - if (mon == 12) - return x; - - q = ap_palloc(p, 30); - ap_snprintf(q, 30, "%s, %.2d %s %d %.2d:%.2d:%.2d GMT", ap_day_snames[wk], mday, - ap_month_snames[mon], year, hour, min, sec); - return q; -} - - -/* NOTE: This routine is taken from http_protocol::getline() - * because the old code found in the proxy module was too - * difficult to understand and maintain. - */ -/* Get a line of protocol input, including any continuation lines - * caused by MIME folding (or broken clients) if fold != 0, and place it - * in the buffer s, of size n bytes, without the ending newline. - * - * Returns -1 on error, or the length of s. - * - * Note: Because bgets uses 1 char for newline and 1 char for NUL, - * the most we can get is (n - 2) actual characters if it - * was ended by a newline, or (n - 1) characters if the line - * length exceeded (n - 1). So, if the result == (n - 1), - * then the actual input line exceeded the buffer length, - * and it would be a good idea for the caller to puke 400 or 414. - */ -static int proxy_getline(char *s, int n, BUFF *in, int fold) -{ - char *pos, next; - int retval; - int total = 0; - - pos = s; - - do { - retval = ap_bgets(pos, n, in); /* retval == -1 if error, 0 if EOF */ - - if (retval <= 0) - return ((retval < 0) && (total == 0)) ? -1 : total; - - /* retval is the number of characters read, not including NUL */ - - n -= retval; /* Keep track of how much of s is full */ - pos += (retval - 1); /* and where s ends */ - total += retval; /* and how long s has become */ - - if (*pos == '\n') { /* Did we get a full line of input? */ - *pos = '\0'; - --total; - ++n; - } - else - return total; /* if not, input line exceeded buffer size */ - - /* Continue appending if line folding is desired and - * the last line was not empty and we have room in the buffer and - * the next line begins with a continuation character. - */ - } while (fold && (retval != 1) && (n > 1) - && (ap_blookc(&next, in) == 1) - && ((next == ' ') || (next == '\t'))); - - return total; -} - - -/* - * Reads headers from a buffer and returns an array of headers. - * Returns NULL on file error - * This routine tries to deal with too long lines and continuation lines. - * @@@: XXX: FIXME: currently the headers are passed thru un-merged. - * Is that okay, or should they be collapsed where possible? - */ -table *ap_proxy_read_headers(request_rec *r, char *buffer, int size, BUFF *f) -{ - table *resp_hdrs; - int len; - char *value, *end; - char field[MAX_STRING_LEN]; - - resp_hdrs = ap_make_table(r->pool, 20); - - /* - * Read header lines until we get the empty separator line, a read error, - * the connection closes (EOF), or we timeout. - */ - while ((len = proxy_getline(buffer, size, f, 1)) > 0) { - - if (!(value = strchr(buffer, ':'))) { /* Find the colon separator */ - - /* Buggy MS IIS servers sometimes return invalid headers - * (an extra "HTTP/1.0 200, OK" line sprinkled in between - * the usual MIME headers). Try to deal with it in a sensible - * way, but log the fact. - * XXX: The mask check is buggy if we ever see an HTTP/1.10 */ - - if (!ap_checkmask(buffer, "HTTP/#.# ###*")) { - /* Nope, it wasn't even an extra HTTP header. Give up. */ - return NULL; - } - - ap_log_error(APLOG_MARK, APLOG_WARNING|APLOG_NOERRNO, r->server, - "proxy: Ignoring duplicate HTTP header " - "returned by %s (%s)", r->uri, r->method); - continue; - } - - *value = '\0'; - ++value; - /* XXX: RFC2068 defines only SP and HT as whitespace, this test is - * wrong... and so are many others probably. - */ - while (ap_isspace(*value)) - ++value; /* Skip to start of value */ - - /* should strip trailing whitespace as well */ - for (end = &value[strlen(value)-1]; end > value && ap_isspace(*end); --end) - *end = '\0'; - - ap_table_add(resp_hdrs, buffer, value); - - /* the header was too long; at the least we should skip extra data */ - if (len >= size - 1) { - while ((len = proxy_getline(field, MAX_STRING_LEN, f, 1)) - >= MAX_STRING_LEN - 1) { - /* soak up the extra data */ - } - if (len == 0) /* time to exit the larger loop as well */ - break; - } - } - return resp_hdrs; -} - -long int ap_proxy_send_fb(BUFF *f, request_rec *r, cache_req *c) -{ - int ok; - char buf[IOBUFSIZE]; - long total_bytes_rcvd; - register int n, o, w; - conn_rec *con = r->connection; - int alternate_timeouts = 1; /* 1 if we alternate between soft & hard timeouts */ - - total_bytes_rcvd = 0; - if (c != NULL) - c->written = 0; - -#ifdef CHARSET_EBCDIC - /* The cache copy is ASCII, not EBCDIC, even for text/html) */ - ap_bsetflag(f, B_ASCII2EBCDIC|B_EBCDIC2ASCII, 0); - if (c != NULL && c->fp != NULL) - ap_bsetflag(c->fp, B_ASCII2EBCDIC|B_EBCDIC2ASCII, 0); - ap_bsetflag(con->client, B_ASCII2EBCDIC|B_EBCDIC2ASCII, 0); -#endif - - /* Since we are reading from one buffer and writing to another, - * it is unsafe to do a soft_timeout here, at least until the proxy - * has its own timeout handler which can set both buffers to EOUT. - */ - - ap_kill_timeout(r); - -#ifdef WIN32 - /* works fine under win32, so leave it */ - ap_hard_timeout("proxy send body", r); - alternate_timeouts = 0; -#else - /* CHECKME! Since hard_timeout won't work in unix on sends with partial - * cache completion, we have to alternate between hard_timeout - * for reads, and soft_timeout for send. This is because we need - * to get a return from ap_bwrite to be able to continue caching. - * BUT, if we *can't* continue anyway, just use hard_timeout. - * (Also, if no cache file is written, use hard timeouts) - */ - - if (c == NULL || c->len <= 0 || c->cache_completion == 1.0) { - ap_hard_timeout("proxy send body", r); - alternate_timeouts = 0; - } -#endif - - /* Loop and ap_bread() while we can successfully read and write, - * or (after the client aborted) while we can successfully - * read and finish the configured cache_completion. - */ - for (ok = 1; ok; ) { - if (alternate_timeouts) - ap_hard_timeout("proxy recv body from upstream server", r); - - /* Read block from server */ - n = ap_bread(f, buf, IOBUFSIZE); - - if (alternate_timeouts) - ap_kill_timeout(r); - else - ap_reset_timeout(r); - - if (n == -1) { /* input error */ - if (c != NULL) { - ap_log_rerror(APLOG_MARK, APLOG_ERR, c->req, - "proxy: error reading from %s", c->url); - c = ap_proxy_cache_error(c); - } - break; - } - if (n == 0) - break; /* EOF */ - o = 0; - total_bytes_rcvd += n; - - /* Write to cache first. */ - /*@@@ XXX FIXME: Assuming that writing the cache file won't time out?!!? */ - if (c != NULL && c->fp != NULL) { - if (ap_bwrite(c->fp, &buf[0], n) != n) { - ap_log_rerror(APLOG_MARK, APLOG_ERR, c->req, - "proxy: error writing to %s", c->tempfile); - c = ap_proxy_cache_error(c); - } else { - c->written += n; - } - } - - /* Write the block to the client, detect aborted transfers */ - while (!con->aborted && n > 0) { - if (alternate_timeouts) - ap_soft_timeout("proxy send body", r); - - w = ap_bwrite(con->client, &buf[o], n); - - if (alternate_timeouts) - ap_kill_timeout(r); - else - ap_reset_timeout(r); - - if (w <= 0) { - if (c != NULL && c->fp != NULL) { - /* when a send failure occurs, we need to decide - * whether to continue loading and caching the - * document, or to abort the whole thing - */ - ok = (c->len > 0) && - (c->cache_completion > 0) && - (c->len * c->cache_completion < total_bytes_rcvd); - - if (! ok) { - ap_pclosef(c->req->pool, c->fp->fd); - c->fp = NULL; - unlink(c->tempfile); - c = NULL; - } - } - con->aborted = 1; - break; - } - n -= w; - o += w; - } /* while client alive and more data to send */ - } /* loop and ap_bread while "ok" */ - - if (!con->aborted) - ap_bflush(con->client); - - ap_kill_timeout(r); - return total_bytes_rcvd; -} - -/* - * Sends response line and headers. Uses the client fd and the - * headers_out array from the passed request_rec to talk to the client - * and to properly set the headers it sends for things such as logging. - * - * A timeout should be set before calling this routine. - */ -void ap_proxy_send_headers(request_rec *r, const char *respline, table *t) -{ - int i; - BUFF *fp = r->connection->client; - table_entry *elts = (table_entry *) ap_table_elts(t)->elts; - - ap_bvputs(fp, respline, CRLF, NULL); - - for (i = 0; i < ap_table_elts(t)->nelts; ++i) { - if (elts[i].key != NULL) { - ap_bvputs(fp, elts[i].key, ": ", elts[i].val, CRLF, NULL); - ap_table_addn(r->headers_out, elts[i].key, elts[i].val); - } - } - - ap_bputs(CRLF, fp); -} - - -/* - * list is a comma-separated list of case-insensitive tokens, with - * optional whitespace around the tokens. - * The return returns 1 if the token val is found in the list, or 0 - * otherwise. - */ -int ap_proxy_liststr(const char *list, const char *val) -{ - int len, i; - const char *p; - - len = strlen(val); - - while (list != NULL) { - p = strchr(list, ','); - if (p != NULL) { - i = p - list; - do - p++; - while (ap_isspace(*p)); - } - else - i = strlen(list); - - while (i > 0 && ap_isspace(list[i - 1])) - i--; - if (i == len && strncasecmp(list, val, len) == 0) - return 1; - list = p; - } - return 0; -} - -#ifdef CASE_BLIND_FILESYSTEM - -/* - * On some platforms, the file system is NOT case sensitive. So, a == A - * need to map to smaller set of characters - */ -void ap_proxy_hash(const char *it, char *val, int ndepth, int nlength) -{ - AP_MD5_CTX context; - unsigned char digest[16]; - char tmp[26]; - int i, k, d; - unsigned int x; - static const char enc_table[32] = "abcdefghijklmnopqrstuvwxyz012345"; - - ap_MD5Init(&context); - ap_MD5Update(&context, (const unsigned char *) it, strlen(it)); - ap_MD5Final(digest, &context); - -/* encode 128 bits as 26 characters, using a modified uuencoding */ -/* the encoding is 5 bytes -> 8 characters - * i.e. 128 bits is 3 x 5 bytes + 1 byte -> 3 * 8 characters + 2 characters - */ - for (i = 0, k = 0; i < 15; i += 5) { - x = (digest[i] << 24) | (digest[i + 1] << 16) | (digest[i + 2] << 8) | digest[i + 3]; - tmp[k++] = enc_table[x >> 27]; - tmp[k++] = enc_table[(x >> 22) & 0x1f]; - tmp[k++] = enc_table[(x >> 17) & 0x1f]; - tmp[k++] = enc_table[(x >> 12) & 0x1f]; - tmp[k++] = enc_table[(x >> 7) & 0x1f]; - tmp[k++] = enc_table[(x >> 2) & 0x1f]; - x = ((x & 0x3) << 8) | digest[i + 4]; - tmp[k++] = enc_table[x >> 5]; - tmp[k++] = enc_table[x & 0x1f]; - } -/* one byte left */ - x = digest[15]; - tmp[k++] = enc_table[x >> 3]; /* use up 5 bits */ - tmp[k++] = enc_table[x & 0x7]; - /* now split into directory levels */ - - for (i = k = d = 0; d < ndepth; ++d) { - memcpy(&val[i], &tmp[k], nlength); - k += nlength; - val[i + nlength] = '/'; - i += nlength + 1; - } - memcpy(&val[i], &tmp[k], 26 - k); - val[i + 26 - k] = '\0'; -} - -#else - -void ap_proxy_hash(const char *it, char *val, int ndepth, int nlength) -{ - AP_MD5_CTX context; - unsigned char digest[16]; - char tmp[22]; - int i, k, d; - unsigned int x; -#if defined(AIX) && defined(__ps2__) - /* Believe it or not, AIX 1.x does not allow you to name a file '@', - * so hack around it in the encoding. */ - static const char enc_table[64] = - "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789_%"; -#else - static const char enc_table[64] = - "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789_@"; -#endif - - ap_MD5Init(&context); - ap_MD5Update(&context, (const unsigned char *) it, strlen(it)); - ap_MD5Final(digest, &context); - -/* encode 128 bits as 22 characters, using a modified uuencoding */ -/* the encoding is 3 bytes -> 4 characters - * i.e. 128 bits is 5 x 3 bytes + 1 byte -> 5 * 4 characters + 2 characters - */ - for (i = 0, k = 0; i < 15; i += 3) { - x = (digest[i] << 16) | (digest[i + 1] << 8) | digest[i + 2]; - tmp[k++] = enc_table[x >> 18]; - tmp[k++] = enc_table[(x >> 12) & 0x3f]; - tmp[k++] = enc_table[(x >> 6) & 0x3f]; - tmp[k++] = enc_table[x & 0x3f]; - } -/* one byte left */ - x = digest[15]; - tmp[k++] = enc_table[x >> 2]; /* use up 6 bits */ - tmp[k++] = enc_table[(x << 4) & 0x3f]; - /* now split into directory levels */ - - for (i = k = d = 0; d < ndepth; ++d) { - memcpy(&val[i], &tmp[k], nlength); - k += nlength; - val[i + nlength] = '/'; - i += nlength + 1; - } - memcpy(&val[i], &tmp[k], 22 - k); - val[i + 22 - k] = '\0'; -} - -#endif /* CASE_BLIND_FILESYSTEM */ - -/* - * Converts 8 hex digits to a time integer - */ -int ap_proxy_hex2sec(const char *x) -{ - int i, ch; - unsigned int j; - - for (i = 0, j = 0; i < 8; i++) { - ch = x[i]; - j <<= 4; - if (ap_isdigit(ch)) - j |= ch - '0'; - else if (ap_isupper(ch)) - j |= ch - ('A' - 10); - else - j |= ch - ('a' - 10); - } - if (j == 0xffffffff) - return -1; /* so that it works with 8-byte ints */ - else - return j; -} - -/* - * Converts a time integer to 8 hex digits - */ -void ap_proxy_sec2hex(int t, char *y) -{ - int i, ch; - unsigned int j = t; - - for (i = 7; i >= 0; i--) { - ch = j & 0xF; - j >>= 4; - if (ch >= 10) - y[i] = ch + ('A' - 10); - else - y[i] = ch + '0'; - } - y[8] = '\0'; -} - - -cache_req *ap_proxy_cache_error(cache_req *c) -{ - if (c != NULL) { - if (c->fp != NULL) { - ap_pclosef(c->req->pool, c->fp->fd); - c->fp = NULL; - } - if (c->tempfile) unlink(c->tempfile); - } - return NULL; -} - -int ap_proxyerror(request_rec *r, int statuscode, const char *message) -{ - ap_table_setn(r->notes, "error-notes", - ap_pstrcat(r->pool, - "The proxy server could not handle the request " - "uri, "\">", - r->method, " ", r->uri, ".

    \n" - "Reason: ", message, "", NULL)); - - /* Allow the "error-notes" string to be printed by ap_send_error_response() */ - ap_table_setn(r->notes, "verbose-error-to", ap_pstrdup(r->pool, "*")); - - r->status_line = ap_psprintf(r->pool, "%3.3u Proxy Error", statuscode); - return statuscode; -} - -/* - * This routine returns its own error message - */ -const char * - ap_proxy_host2addr(const char *host, struct hostent *reqhp) -{ - int i; - struct hostent *hp; - static APACHE_TLS struct hostent hpbuf; - static APACHE_TLS u_long ipaddr; - static APACHE_TLS char *charpbuf[2]; - - for (i = 0; host[i] != '\0'; i++) - if (!ap_isdigit(host[i]) && host[i] != '.') - break; - - if (host[i] != '\0') { - hp = gethostbyname(host); - if (hp == NULL) - return "Host not found"; - } - else { - ipaddr = ap_inet_addr(host); - hp = gethostbyaddr((char *) &ipaddr, sizeof(u_long), AF_INET); - if (hp == NULL) { - memset(&hpbuf, 0, sizeof(hpbuf)); - hpbuf.h_name = 0; - hpbuf.h_addrtype = AF_INET; - hpbuf.h_length = sizeof(u_long); - hpbuf.h_addr_list = charpbuf; - hpbuf.h_addr_list[0] = (char *) &ipaddr; - hpbuf.h_addr_list[1] = 0; - hp = &hpbuf; - } - } - *reqhp = *hp; - return NULL; -} - -static const char * - proxy_get_host_of_request(request_rec *r) -{ - char *url, *user = NULL, *password = NULL, *err, *host; - int port = -1; - - if (r->hostname != NULL) - return r->hostname; - - /* Set url to the first char after "scheme://" */ - if ((url = strchr(r->uri, ':')) == NULL - || url[1] != '/' || url[2] != '/') - return NULL; - - url = ap_pstrdup(r->pool, &url[1]); /* make it point to "//", which is what proxy_canon_netloc expects */ - - err = ap_proxy_canon_netloc(r->pool, &url, &user, &password, &host, &port); - - if (err != NULL) - ap_log_rerror(APLOG_MARK, APLOG_ERR|APLOG_NOERRNO, r, - "%s", err); - - r->hostname = host; - - return host; /* ought to return the port, too */ -} - -/* Return TRUE if addr represents an IP address (or an IP network address) */ -int ap_proxy_is_ipaddr(struct dirconn_entry *This, pool *p) -{ - const char *addr = This->name; - long ip_addr[4]; - int i, quads; - long bits; - - /* if the address is given with an explicit netmask, use that */ - /* Due to a deficiency in ap_inet_addr(), it is impossible to parse */ - /* "partial" addresses (with less than 4 quads) correctly, i.e. */ - /* 192.168.123 is parsed as 192.168.0.123, which is not what I want. */ - /* I therefore have to parse the IP address manually: */ - /*if (proxy_readmask(This->name, &This->addr.s_addr, &This->mask.s_addr) == 0) */ - /* addr and mask were set by proxy_readmask() */ - /*return 1; */ - - /* Parse IP addr manually, optionally allowing */ - /* abbreviated net addresses like 192.168. */ - - /* Iterate over up to 4 (dotted) quads. */ - for (quads = 0; quads < 4 && *addr != '\0'; ++quads) { - char *tmp; - - if (*addr == '/' && quads > 0) /* netmask starts here. */ - break; - - if (!ap_isdigit(*addr)) - return 0; /* no digit at start of quad */ - - ip_addr[quads] = strtol(addr, &tmp, 0); - - if (tmp == addr) /* expected a digit, found something else */ - return 0; - - if (ip_addr[quads] < 0 || ip_addr[quads] > 255) { - /* invalid octet */ - return 0; - } - - addr = tmp; - - if (*addr == '.' && quads != 3) - ++addr; /* after the 4th quad, a dot would be illegal */ - } - - for (This->addr.s_addr = 0, i = 0; i < quads; ++i) - This->addr.s_addr |= htonl(ip_addr[i] << (24 - 8 * i)); - - if (addr[0] == '/' && ap_isdigit(addr[1])) { /* net mask follows: */ - char *tmp; - - ++addr; - - bits = strtol(addr, &tmp, 0); - - if (tmp == addr) /* expected a digit, found something else */ - return 0; - - addr = tmp; - - if (bits < 0 || bits > 32) /* netmask must be between 0 and 32 */ - return 0; - - } - else { - /* Determine (i.e., "guess") netmask by counting the */ - /* number of trailing .0's; reduce #quads appropriately */ - /* (so that 192.168.0.0 is equivalent to 192.168.) */ - while (quads > 0 && ip_addr[quads - 1] == 0) - --quads; - - /* "IP Address should be given in dotted-quad form, optionally followed by a netmask (e.g., 192.168.111.0/24)"; */ - if (quads < 1) - return 0; - - /* every zero-byte counts as 8 zero-bits */ - bits = 8 * quads; - - if (bits != 32) /* no warning for fully qualified IP address */ - fprintf(stderr, "Warning: NetMask not supplied with IP-Addr; guessing: %s/%ld\n", - inet_ntoa(This->addr), bits); - } - - This->mask.s_addr = htonl(INADDR_NONE << (32 - bits)); - - if (*addr == '\0' && (This->addr.s_addr & ~This->mask.s_addr) != 0) { - fprintf(stderr, "Warning: NetMask and IP-Addr disagree in %s/%ld\n", - inet_ntoa(This->addr), bits); - This->addr.s_addr &= This->mask.s_addr; - fprintf(stderr, " Set to %s/%ld\n", - inet_ntoa(This->addr), bits); - } - - if (*addr == '\0') { - This->matcher = proxy_match_ipaddr; - return 1; - } - else - return (*addr == '\0'); /* okay iff we've parsed the whole string */ -} - -/* Return TRUE if addr represents an IP address (or an IP network address) */ -static int proxy_match_ipaddr(struct dirconn_entry *This, request_rec *r) -{ - int i; - int ip_addr[4]; - struct in_addr addr; - struct in_addr *ip_list; - char **ip_listptr; - const char *found; - const char *host = proxy_get_host_of_request(r); - - if (host == NULL) /* oops! */ - return 0; - - memset(&addr, '\0', sizeof addr); - memset(ip_addr, '\0', sizeof ip_addr); - - if (4 == sscanf(host, "%d.%d.%d.%d", &ip_addr[0], &ip_addr[1], &ip_addr[2], &ip_addr[3])) { - for (addr.s_addr = 0, i = 0; i < 4; ++i) - addr.s_addr |= htonl(ip_addr[i] << (24 - 8 * i)); - - if (This->addr.s_addr == (addr.s_addr & This->mask.s_addr)) { -#if DEBUGGING - fprintf(stderr, "1)IP-Match: %s[%s] <-> ", host, inet_ntoa(addr)); - fprintf(stderr, "%s/", inet_ntoa(This->addr)); - fprintf(stderr, "%s\n", inet_ntoa(This->mask)); -#endif - return 1; - } -#if DEBUGGING - else { - fprintf(stderr, "1)IP-NoMatch: %s[%s] <-> ", host, inet_ntoa(addr)); - fprintf(stderr, "%s/", inet_ntoa(This->addr)); - fprintf(stderr, "%s\n", inet_ntoa(This->mask)); - } -#endif - } - else { - struct hostent the_host; - - memset(&the_host, '\0', sizeof the_host); - found = ap_proxy_host2addr(host, &the_host); - - if (found != NULL) { -#if DEBUGGING - fprintf(stderr, "2)IP-NoMatch: hostname=%s msg=%s\n", host, found); -#endif - return 0; - } - - if (the_host.h_name != NULL) - found = the_host.h_name; - else - found = host; - - /* Try to deal with multiple IP addr's for a host */ - for (ip_listptr = the_host.h_addr_list; *ip_listptr; ++ip_listptr) { - ip_list = (struct in_addr *) *ip_listptr; - if (This->addr.s_addr == (ip_list->s_addr & This->mask.s_addr)) { -#if DEBUGGING - fprintf(stderr, "3)IP-Match: %s[%s] <-> ", found, inet_ntoa(*ip_list)); - fprintf(stderr, "%s/", inet_ntoa(This->addr)); - fprintf(stderr, "%s\n", inet_ntoa(This->mask)); -#endif - return 1; - } -#if DEBUGGING - else { - fprintf(stderr, "3)IP-NoMatch: %s[%s] <-> ", found, inet_ntoa(*ip_list)); - fprintf(stderr, "%s/", inet_ntoa(This->addr)); - fprintf(stderr, "%s\n", inet_ntoa(This->mask)); - } -#endif - } - } - - return 0; -} - -/* Return TRUE if addr represents a domain name */ -int ap_proxy_is_domainname(struct dirconn_entry *This, pool *p) -{ - char *addr = This->name; - int i; - - /* Domain name must start with a '.' */ - if (addr[0] != '.') - return 0; - - /* rfc1035 says DNS names must consist of "[-a-zA-Z0-9]" and '.' */ - for (i = 0; ap_isalnum(addr[i]) || addr[i] == '-' || addr[i] == '.'; ++i) - continue; - -#if 0 - if (addr[i] == ':') { - fprintf(stderr, "@@@@ handle optional port in proxy_is_domainname()\n"); - /* @@@@ handle optional port */ - } -#endif - - if (addr[i] != '\0') - return 0; - - /* Strip trailing dots */ - for (i = strlen(addr) - 1; i > 0 && addr[i] == '.'; --i) - addr[i] = '\0'; - - This->matcher = proxy_match_domainname; - return 1; -} - -/* Return TRUE if host "host" is in domain "domain" */ -static int proxy_match_domainname(struct dirconn_entry *This, request_rec *r) -{ - const char *host = proxy_get_host_of_request(r); - int d_len = strlen(This->name), h_len; - - if (host == NULL) /* some error was logged already */ - return 0; - - h_len = strlen(host); - - /* @@@ do this within the setup? */ - /* Ignore trailing dots in domain comparison: */ - while (d_len > 0 && This->name[d_len - 1] == '.') - --d_len; - while (h_len > 0 && host[h_len - 1] == '.') - --h_len; - return h_len > d_len - && strncasecmp(&host[h_len - d_len], This->name, d_len) == 0; -} - -/* Return TRUE if addr represents a host name */ -int ap_proxy_is_hostname(struct dirconn_entry *This, pool *p) -{ - struct hostent host; - char *addr = This->name; - int i; - - /* Host names must not start with a '.' */ - if (addr[0] == '.') - return 0; - - /* rfc1035 says DNS names must consist of "[-a-zA-Z0-9]" and '.' */ - for (i = 0; ap_isalnum(addr[i]) || addr[i] == '-' || addr[i] == '.'; ++i); - -#if 0 - if (addr[i] == ':') { - fprintf(stderr, "@@@@ handle optional port in proxy_is_hostname()\n"); - /* @@@@ handle optional port */ - } -#endif - - if (addr[i] != '\0' || ap_proxy_host2addr(addr, &host) != NULL) - return 0; - - This->hostentry = ap_pduphostent (p, &host); - - /* Strip trailing dots */ - for (i = strlen(addr) - 1; i > 0 && addr[i] == '.'; --i) - addr[i] = '\0'; - - This->matcher = proxy_match_hostname; - return 1; -} - -/* Return TRUE if host "host" is equal to host2 "host2" */ -static int proxy_match_hostname(struct dirconn_entry *This, request_rec *r) -{ - char *host = This->name; - const char *host2 = proxy_get_host_of_request(r); - int h2_len; - int h1_len; - - if (host == NULL || host2 == NULL) - return 0; /* oops! */ - - h2_len = strlen(host2); - h1_len = strlen(host); - -#if 0 - unsigned long *ip_list; - - /* Try to deal with multiple IP addr's for a host */ - for (ip_list = *This->hostentry->h_addr_list; *ip_list != 0UL; ++ip_list) - if (*ip_list == ? ? ? ? ? ? ? ? ? ? ? ? ?) - return 1; -#endif - - /* Ignore trailing dots in host2 comparison: */ - while (h2_len > 0 && host2[h2_len - 1] == '.') - --h2_len; - while (h1_len > 0 && host[h1_len - 1] == '.') - --h1_len; - return h1_len == h2_len - && strncasecmp(host, host2, h1_len) == 0; -} - -/* Return TRUE if addr is to be matched as a word */ -int ap_proxy_is_word(struct dirconn_entry *This, pool *p) -{ - This->matcher = proxy_match_word; - return 1; -} - -/* Return TRUE if string "str2" occurs literally in "str1" */ -static int proxy_match_word(struct dirconn_entry *This, request_rec *r) -{ - const char *host = proxy_get_host_of_request(r); - return host != NULL && strstr(host, This->name) != NULL; -} - -int ap_proxy_doconnect(int sock, struct sockaddr_in *addr, request_rec *r) -{ - int i; - - ap_hard_timeout("proxy connect", r); - do { - i = connect(sock, (struct sockaddr *) addr, sizeof(struct sockaddr_in)); -#ifdef WIN32 - if (i == SOCKET_ERROR) - errno = WSAGetLastError(); -#endif /* WIN32 */ - } while (i == -1 && errno == EINTR); - if (i == -1) { - ap_log_rerror(APLOG_MARK, APLOG_ERR, r, - "proxy connect to %s port %d failed", - inet_ntoa(addr->sin_addr), ntohs(addr->sin_port)); - } - ap_kill_timeout(r); - - return i; -} - -/* This function is called by ap_table_do() for all header lines */ -/* (from proxy_http.c and proxy_ftp.c) */ -/* It is passed a table_do_args struct pointer and a MIME field and value pair */ -int ap_proxy_send_hdr_line(void *p, const char *key, const char *value) -{ - struct tbl_do_args *parm = (struct tbl_do_args *)p; - - if (key == NULL || value == NULL || value[0] == '\0') - return 1; - if (!parm->req->assbackwards) - ap_rvputs(parm->req, key, ": ", value, CRLF, NULL); - if (parm->cache != NULL && parm->cache->fp != NULL && - ap_bvputs(parm->cache->fp, key, ": ", value, CRLF, NULL) == -1) { - ap_log_rerror(APLOG_MARK, APLOG_ERR, parm->cache->req, - "proxy: error writing header to %s", parm->cache->tempfile); - parm->cache = ap_proxy_cache_error(parm->cache); - } - return 1; /* tell ap_table_do() to continue calling us for more headers */ -} - -/* send a text line to one or two BUFF's; return line length */ -unsigned ap_proxy_bputs2(const char *data, BUFF *client, cache_req *cache) -{ - unsigned len = ap_bputs(data, client); - if (cache != NULL && cache->fp != NULL) - ap_bputs(data, cache->fp); - return len; -} - diff --git a/modules/ssl/.cvsignore b/modules/ssl/.cvsignore deleted file mode 100644 index 81a9a9f6289299618ea54be190ef61a5ab230e23..0000000000000000000000000000000000000000 --- a/modules/ssl/.cvsignore +++ /dev/null @@ -1,5 +0,0 @@ -Makefile -*.lo -*.o -*.a -*.lib diff --git a/modules/ssl/Makefile.in b/modules/ssl/Makefile.in deleted file mode 100644 index 2207d48f3c4e55d650cb3bf70ad9172f475de745..0000000000000000000000000000000000000000 --- a/modules/ssl/Makefile.in +++ /dev/null @@ -1,50 +0,0 @@ -## ==================================================================== -## The Apache Software License, Version 1.1 -## -## Copyright (c) 2000-2001 The Apache Software Foundation. All rights -## reserved. -## -## Redistribution and use in source and binary forms, with or without -## modification, are permitted provided that the following conditions -## are met: -## -## 1. Redistributions of source code must retain the above copyright -## notice, this list of conditions and the following disclaimer. -## -## 2. Redistributions in binary form must reproduce the above copyright -## notice, this list of conditions and the following disclaimer in -## the documentation and/or other materials provided with the -## distribution. -## -## 3. The end-user documentation included with the redistribution, -## if any, must include the following acknowledgment: -## "This product includes software developed by the -## Apache Software Foundation (http://www.apache.org/)." -## Alternately, this acknowledgment may appear in the software itself, -## if and wherever such third-party acknowledgments normally appear. -## -## 4. The names "Apache" and "Apache Software Foundation" must -## not be used to endorse or promote products derived from this -## software without prior written permission. For written -## permission, please contact apache@apache.org. -## -## 5. Products derived from this software may not be called "Apache", -## nor may "Apache" appear in their name, without prior written -## permission of the Apache Software Foundation. -## -## THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED -## WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES -## OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE -## DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR -## ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -## SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -## LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF -## USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND -## ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, -## OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT -## OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF -## SUCH DAMAGE. -## ==================================================================== - -include $(top_srcdir)/build/special.mk - diff --git a/modules/ssl/README b/modules/ssl/README deleted file mode 100644 index ca9e225bf835778695d09fdcc99ccd51bb49e0b0..0000000000000000000000000000000000000000 --- a/modules/ssl/README +++ /dev/null @@ -1,163 +0,0 @@ - _ _ - _ __ ___ ___ __| | ___ ___| | - | '_ ` _ \ / _ \ / _` | / __/ __| | - | | | | | | (_) | (_| | \__ \__ \ | ``mod_ssl combines the flexibility of - |_| |_| |_|\___/ \__,_|___|___/___/_| Apache with the security of OpenSSL.'' - |_____| - mod_ssl ``Ralf Engelschall has released an - Apache Interface to OpenSSL excellent module that integrates - http://www.modssl.org/ Apache and SSLeay.'' - Version 2.8 -- Tim J. Hudson - - SYNOPSIS - - This Apache module provides strong cryptography for the Apache 1.3 webserver - via the Secure Sockets Layer (SSL v2/v3) and Transport Layer Security (TLS - v1) protocols by the help of the SSL/TLS implementation library OpenSSL which - is based on SSLeay from Eric A. Young and Tim J. Hudson. The mod_ssl package - was created in April 1998 by Ralf S. Engelschall and was originally derived - from software developed by Ben Laurie for use in the Apache-SSL HTTP server - project. - - SOURCES - - Here is a short overview of the source files: - - Makefile.libdir ......... dummy for Apache config mechanism - Makefile.tmpl ........... Makefile template for Unix platform - Makefile.win32 .......... Makefile template for Win32 platform - libssl.module ........... stub called from the Apache config mechanism - libssl.version .......... file containing the mod_ssl version information - mod_ssl.c ............... main source file containing API structures - mod_ssl.h ............... common header file of mod_ssl - ssl_engine_compat.c ..... backward compatibility support - ssl_engine_config.c ..... module configuration handling - ssl_engine_dh.c ......... DSA/DH support - ssl_engine_ds.c ......... data structures - ssl_engine_ext.c ........ Extensions to other Apache parts - ssl_engine_init.c ....... module initialization - ssl_engine_io.c ......... I/O support - ssl_engine_kernel.c ..... SSL engine kernel - ssl_engine_log.c ........ logfile support - ssl_engine_mutex.c ...... mutual exclusion support - ssl_engine_pphrase.c .... pass-phrase handling - ssl_engine_rand.c ....... PRNG support - ssl_engine_vars.c ....... Variable Expansion support - ssl_expr.c .............. expression handling main source - ssl_expr.h .............. expression handling common header - ssl_expr_scan.c ......... expression scanner automaton (pre-generated) - ssl_expr_scan.l ......... expression scanner source - ssl_expr_parse.c ........ expression parser automaton (pre-generated) - ssl_expr_parse.h ........ expression parser header (pre-generated) - ssl_expr_parse.y ........ expression parser source - ssl_expr_eval.c ......... expression machine evaluation - ssl_scache.c ............ session cache abstraction layer - ssl_scache_dbm.c ........ session cache via DBM file - ssl_scache_shmcb.c ...... session cache via shared memory cyclic buffer - ssl_scache_shmht.c ...... session cache via shared memory hash table - ssl_util.c .............. utility functions - ssl_util_ssl.c .......... the OpenSSL companion source - ssl_util_ssl.h .......... the OpenSSL companion header - ssl_util_sdbm.c ......... the SDBM library source - ssl_util_sdbm.h ......... the SDBM library header - ssl_util_table.c ........ the hash table library source - ssl_util_table.h ........ the hash table library header - - The source files are written in clean ANSI C and pass the ``gcc -O -g - -ggdb3 -Wall -Wshadow -Wpointer-arith -Wcast-align -Wmissing-prototypes - -Wmissing-declarations -Wnested-externs -Winline'' compiler test - (assuming `gcc' is GCC 2.95.2 or newer) without any complains. When - you make changes or additions make sure the source still passes this - compiler test. - - FUNCTIONS - - Inside the source code you will be confronted with the following types of - functions which can be identified by their prefixes: - - ap_xxxx() ............... Apache API function - ssl_xxxx() .............. mod_ssl function - SSL_xxxx() .............. OpenSSL function (SSL library) - OpenSSL_xxxx() .......... OpenSSL function (SSL library) - X509_xxxx() ............. OpenSSL function (Crypto library) - PEM_xxxx() .............. OpenSSL function (Crypto library) - EVP_xxxx() .............. OpenSSL function (Crypto library) - RSA_xxxx() .............. OpenSSL function (Crypto library) - - DATA STRUCTURES - - Inside the source code you will be confronted with the following - data structures: - - ap_ctx .................. Apache EAPI Context - server_rec .............. Apache (Virtual) Server - conn_rec ................ Apache Connection - BUFF .................... Apache Connection Buffer - request_rec ............. Apache Request - SSLModConfig ............ mod_ssl (Global) Module Configuration - SSLSrvConfig ............ mod_ssl (Virtual) Server Configuration - SSLDirConfig ............ mod_ssl Directory Configuration - SSL_CTX ................. OpenSSL Context - SSL_METHOD .............. OpenSSL Protocol Method - SSL_CIPHER .............. OpenSSL Cipher - SSL_SESSION ............. OpenSSL Session - SSL ..................... OpenSSL Connection - BIO ..................... OpenSSL Connection Buffer - - For an overview how these are related and chained together have a look at the - page in README.dsov.{fig,ps}. It contains overview diagrams for those data - structures. It's designed for DIN A4 paper size, but you can easily generate - a smaller version inside XFig by specifing a magnification on the Export - panel. - - EXPERIMENTAL CODE - - Experimental code is always encapsulated as following: - - | #ifdef SSL_EXPERIMENTAL_xxxx - | ... - | #endif - - This way it is only compiled in when this define is enabled with - the APACI --enable-rule=SSL_EXPERIMENTAL option and as long as the - C pre-processor variable SSL_EXPERIMENTAL_xxxx_IGNORE is _NOT_ - defined (via CFLAGS). Or in other words: SSL_EXPERIMENTAL enables all - SSL_EXPERIMENTAL_xxxx variables, except if SSL_EXPERIMENTAL_xxxx_IGNORE - is already defined. Currently the following features are experimental: - - o SSL_EXPERIMENTAL_PERDIRCA - The ability to use SSLCACertificateFile and SSLCACertificatePath - in a per-directory context (.htaccess). This is provided by some nasty - reconfiguration hacks until OpenSSL has better support for this. It - should work on non-multithreaded platforms (all but Win32). - - o SSL_EXPERIMENTAL_PROXY - The ability to use various additional SSLProxyXXX directives in - oder to control extended client functionality in the HTTPS proxy - code. - - o SSL_EXPERIMENTAL_ENGINE - The ability to support the new forthcoming OpenSSL ENGINE stuff. - Until this development branch of OpenSSL is merged into the main - stream, you have to use openssl-engine-0.9.x.tar.gz for this. - mod_ssl automatically recognizes this OpenSSL variant and then can - activate external crypto devices through SSLCryptoDevice directive. - - VENDOR EXTENSIONS - - Inside the mod_ssl sources you can enable various EAPI vendor hooks - (`ap::mod_ssl::vendor::xxxx') by using the APACI --enable-rule=SSL_VENDOR - option. These hooks can be used to change or extend mod_ssl by a vendor - without patching the source code. Grep for `ap::mod_ssl::vendor::'. - Additionally vendors can add their own source code to files named - ssl_vendor.c, ssl_vendor_XXX.c, etc. The libssl.module script automatically - picks these up under configuration time and mod_ssl under run-time calls the - functions `void ssl_vendor_register(void)' and `void - ssl_vendor_unregister(void)' inside these objects to bootstrap them. - - An ssl_vendor.c should at least contain the following contents: - - | #include "mod_ssl.h" - | void ssl_vendor_register(void) { return; } - | void ssl_vendor_unregister(void) { return; } - diff --git a/modules/ssl/README.dsov.fig b/modules/ssl/README.dsov.fig deleted file mode 100644 index d8d03db247c0e7bde4800e256d0cb3070073cfda..0000000000000000000000000000000000000000 --- a/modules/ssl/README.dsov.fig +++ /dev/null @@ -1,346 +0,0 @@ -#FIG 3.2 -Landscape -Center -Metric -Letter -100.00 -Single --2 -1200 2 -0 32 #616561 -0 33 #b6b2b6 -0 34 #f7f3f7 -0 35 #cfcfcf -0 36 #ffffff -6 6345 2835 7155 3150 -6 6345 2970 7110 3150 -4 0 0 200 0 20 8 0.0000 4 120 585 6345 3105 "ssl_module")\001 --6 -4 0 0 200 0 20 8 0.0000 4 120 660 6345 2970 ap_ctx_get(...,\001 --6 -6 10800 2610 12240 3060 -4 0 0 200 0 20 8 0.0000 4 120 1170 10800 2745 ap_get_module_config(...\001 -4 0 0 200 0 20 8 0.0000 4 120 795 10800 2880 ->per_dir_config,\001 -4 0 0 200 0 20 8 0.0000 4 120 585 10800 3015 &ssl_module)\001 --6 -6 7920 4770 9135 4995 -2 4 0 1 35 35 200 0 20 0.000 0 0 4 0 0 5 - 9135 4995 7920 4995 7920 4770 9135 4770 9135 4995 -4 0 0 100 0 18 12 0.0000 4 180 1065 8010 4950 request_rec\001 --6 -2 1 0 1 0 34 200 0 20 0.000 0 0 -1 1 0 2 - 1 1 1.00 60.00 120.00 - 6975 3330 7425 2520 -2 1 0 1 0 34 200 0 20 0.000 0 0 -1 1 0 2 - 1 1 1.00 60.00 120.00 - 7200 4230 9450 2520 -2 1 0 1 0 34 200 0 20 0.000 0 0 -1 1 0 2 - 1 1 1.00 60.00 120.00 - 7875 4905 7200 5220 -2 1 0 1 0 34 200 0 20 0.000 0 0 -1 1 0 2 - 1 1 1.00 60.00 120.00 - 6750 5130 6750 4545 -2 1 0 1 0 34 200 0 20 0.000 0 0 -1 1 0 2 - 1 1 1.00 60.00 120.00 - 6705 5445 7155 6120 -2 1 0 1 0 34 200 0 20 0.000 0 0 -1 1 0 2 - 1 1 1.00 60.00 120.00 - 7875 4815 7200 4590 -2 1 0 1 0 34 200 0 20 0.000 0 0 -1 1 0 2 - 1 1 1.00 60.00 120.00 - 9585 2565 11475 4230 -2 1 0 1 0 34 200 0 20 0.000 0 0 -1 1 0 2 - 1 1 1.00 60.00 120.00 - 10170 5130 11835 4545 -2 1 0 1 0 34 200 0 20 0.000 0 0 -1 1 0 2 - 1 1 1.00 60.00 120.00 - 7920 6075 9855 5400 -2 1 0 1 0 34 200 0 20 0.000 0 0 -1 1 0 2 - 1 1 1.00 60.00 120.00 - 9990 5445 10935 5625 -2 1 0 1 0 34 200 0 20 0.000 0 0 -1 1 0 2 - 1 1 1.00 60.00 120.00 - 10215 5310 10935 5310 -2 1 0 1 0 34 200 0 20 0.000 0 0 -1 1 0 2 - 1 1 1.00 60.00 120.00 - 11925 4590 11925 5085 -2 1 0 1 0 34 200 0 20 0.000 0 0 -1 1 0 2 - 1 1 1.00 60.00 120.00 - 9810 5490 9810 6840 -2 1 0 1 0 34 200 0 20 0.000 0 0 -1 1 0 2 - 1 1 1.00 60.00 120.00 - 9945 5445 10935 6030 -2 1 0 1 0 34 200 0 20 0.000 0 0 -1 1 0 2 - 1 1 1.00 60.00 120.00 - 8865 4725 10800 2565 -2 1 0 3 0 34 200 0 20 0.000 0 0 -1 0 0 2 - 675 6075 5850 6075 -2 1 2 1 0 34 200 0 20 1.000 0 0 -1 1 0 2 - 1 1 1.00 60.00 120.00 - 675 6525 675 6075 -2 1 2 1 0 34 200 0 20 1.000 0 0 -1 1 0 2 - 1 0 1.00 60.00 120.00 - 5850 6075 5850 6525 -2 1 0 3 0 34 200 0 20 0.000 0 0 -1 0 0 2 - 900 5625 5625 5625 -2 1 0 3 0 34 200 0 20 0.000 0 0 -1 0 0 2 - 1125 5175 5400 5175 -2 1 0 3 0 34 200 0 20 0.000 0 0 -1 0 0 2 - 1350 4725 5175 4725 -2 1 0 3 0 34 200 0 20 0.000 0 0 -1 0 0 2 - 1575 4275 4950 4275 -2 1 0 3 0 34 200 0 20 0.000 0 0 -1 0 0 2 - 1800 3825 4725 3825 -2 1 0 3 0 34 200 0 20 0.000 0 0 -1 0 0 2 - 2025 3375 4500 3375 -2 1 0 3 0 34 200 0 20 0.000 0 0 -1 0 0 2 - 2250 2925 4275 2925 -2 1 0 3 0 34 200 0 20 0.000 0 0 -1 0 0 2 - 2475 2475 4050 2475 -2 1 0 3 0 34 200 0 20 0.000 0 0 -1 0 0 2 - 2700 2025 3825 2025 -2 1 0 3 0 34 200 0 20 0.000 0 0 -1 0 0 2 - 2925 1575 3600 1575 -2 1 2 1 0 34 200 0 20 1.000 0 0 -1 1 0 2 - 1 1 1.00 60.00 120.00 - 900 6075 900 5625 -2 1 2 1 0 34 200 0 20 1.000 0 0 -1 1 0 2 - 1 1 1.00 60.00 120.00 - 1125 6525 1125 5175 -2 1 2 1 0 34 200 0 20 1.000 0 0 -1 1 0 2 - 1 1 1.00 60.00 120.00 - 1350 5175 1350 4725 -2 1 2 1 0 34 200 0 20 1.000 0 0 -1 1 0 2 - 1 1 1.00 60.00 120.00 - 1575 4725 1575 4275 -2 1 2 1 0 34 200 0 20 1.000 0 0 -1 1 0 2 - 1 1 1.00 60.00 120.00 - 1800 6525 1800 3825 -2 1 2 1 0 34 200 0 20 1.000 0 0 -1 1 0 2 - 1 1 1.00 60.00 120.00 - 2025 3825 2025 3375 -2 1 2 1 0 34 200 0 20 1.000 0 0 -1 1 0 2 - 1 1 1.00 60.00 120.00 - 2250 3375 2250 2925 -2 1 2 1 0 34 200 0 20 1.000 0 0 -1 1 0 2 - 1 1 1.00 60.00 120.00 - 2475 2925 2475 2475 -2 1 2 1 0 34 200 0 20 1.000 0 0 -1 1 0 2 - 1 0 1.00 60.00 120.00 - 5625 5625 5625 6075 -2 1 2 1 0 34 200 0 20 1.000 0 0 -1 1 0 2 - 1 0 1.00 60.00 120.00 - 5400 5175 5400 6525 -2 1 2 1 0 34 200 0 20 1.000 0 0 -1 1 0 2 - 1 0 1.00 60.00 120.00 - 5175 4725 5175 5175 -2 1 2 1 0 34 200 0 20 1.000 0 0 -1 1 0 2 - 1 0 1.00 60.00 120.00 - 4950 4275 4950 4725 -2 1 2 1 0 34 200 0 20 1.000 0 0 -1 1 0 2 - 1 0 1.00 60.00 120.00 - 4725 3825 4725 6525 -2 1 2 1 0 34 200 0 20 1.000 0 0 -1 1 0 2 - 1 0 1.00 60.00 120.00 - 4500 3375 4500 3825 -2 1 2 1 0 34 200 0 20 1.000 0 0 -1 1 0 2 - 1 0 1.00 60.00 120.00 - 4275 2925 4275 3375 -2 1 2 1 0 34 200 0 20 1.000 0 0 -1 1 0 2 - 1 0 1.00 60.00 120.00 - 4050 2475 4050 2925 -2 1 2 1 0 34 200 0 20 1.000 0 0 -1 1 0 2 - 1 1 1.00 60.00 120.00 - 2700 6525 2700 2025 -2 1 2 1 0 34 200 0 20 1.000 0 0 -1 1 0 2 - 1 0 1.00 60.00 120.00 - 3825 2025 3825 6525 -2 1 2 1 0 34 200 0 20 1.000 0 0 -1 1 0 2 - 1 0 1.00 60.00 120.00 - 3600 1575 3600 2025 -2 1 2 1 0 34 200 0 20 1.000 0 0 -1 1 0 2 - 1 1 1.00 60.00 120.00 - 2925 2025 2925 1575 -2 1 0 4 0 0 200 0 20 0.000 0 0 -1 1 0 2 - 1 1 4.00 60.00 120.00 - 540 6525 6300 6525 -2 3 0 1 7 7 800 0 20 0.000 0 0 -1 0 0 9 - 675 6525 5850 6525 5850 6075 5625 6075 5625 5625 900 5625 - 900 6075 675 6075 675 6525 -2 3 0 1 34 34 700 0 20 0.000 0 0 -1 0 0 13 - 1125 6525 5355 6525 5400 5175 5175 5175 5175 4725 4950 4725 - 4950 4275 1575 4275 1575 4725 1350 4725 1350 5175 1125 5175 - 1125 6525 -2 3 0 1 35 35 500 0 20 0.000 0 0 -1 0 0 17 - 1800 6525 4725 6525 4725 3825 4500 3825 4500 3375 4275 3375 - 4275 2925 4050 2925 4050 2475 2475 2475 2475 2925 2250 2925 - 2250 3375 2025 3375 2025 3825 1800 3825 1800 6525 -2 3 0 1 33 33 400 0 20 0.000 0 0 -1 0 0 9 - 2700 6525 3825 6525 3825 2025 3600 2025 3600 1575 2925 1575 - 2925 2025 2700 2025 2700 6525 -2 1 0 1 0 34 200 0 20 0.000 0 0 -1 1 1 2 - 2 0 1.00 60.00 120.00 - 2 0 1.00 60.00 120.00 - 2700 6750 3825 6750 -2 1 0 1 0 34 200 0 20 0.000 0 0 -1 1 1 2 - 2 0 1.00 60.00 120.00 - 2 0 1.00 60.00 120.00 - 1125 7200 5400 7200 -2 1 0 1 0 34 200 0 20 0.000 0 0 -1 1 1 2 - 2 0 1.00 60.00 120.00 - 2 0 1.00 60.00 120.00 - 1800 6975 4725 6975 -2 1 0 1 0 34 200 0 20 0.000 0 0 -1 1 1 2 - 2 0 1.00 60.00 120.00 - 2 0 1.00 60.00 120.00 - 675 7425 5850 7425 -2 1 2 1 0 34 200 0 20 3.000 0 1 -1 0 0 2 - 675 6570 675 7650 -2 1 2 1 0 34 200 0 20 3.000 0 1 -1 0 0 2 - 1125 6570 1125 7650 -2 1 2 1 0 34 200 0 20 3.000 0 1 -1 0 0 2 - 1800 6570 1800 7650 -2 1 2 1 0 34 200 0 20 3.000 0 1 -1 0 0 2 - 2700 6570 2700 7650 -2 1 2 1 0 34 200 0 20 3.000 0 1 -1 0 0 2 - 3825 6570 3825 7650 -2 1 2 1 0 34 200 0 20 3.000 0 1 -1 0 0 2 - 4725 6570 4725 7650 -2 1 2 1 0 34 200 0 20 3.000 0 1 -1 0 0 2 - 5400 6570 5400 7650 -2 1 2 1 0 34 200 0 20 3.000 0 1 -1 0 0 2 - 5850 6570 5850 7650 -2 4 0 2 0 7 100 0 -1 0.000 0 0 20 0 0 5 - 12600 8550 450 8550 450 225 12600 225 12600 8550 -2 4 0 1 0 34 200 0 20 0.000 0 0 20 0 0 5 - 12600 1350 450 1350 450 225 12600 225 12600 1350 -2 4 0 1 35 35 200 0 20 0.000 0 0 4 0 0 5 - 10170 2475 8775 2475 8775 2250 10170 2250 10170 2475 -2 4 0 1 35 35 200 0 20 0.000 0 0 4 0 0 5 - 11925 2475 10575 2475 10575 2250 11925 2250 11925 2475 -2 4 0 1 35 35 200 0 20 0.000 0 0 4 0 0 5 - 12375 4500 11430 4500 11430 4275 12375 4275 12375 4500 -2 4 0 1 35 35 200 0 20 0.000 0 0 4 0 0 5 - 12375 5400 10980 5400 10980 5175 12375 5175 12375 5400 -2 4 0 1 35 35 200 0 20 0.000 0 0 4 0 0 5 - 10170 5400 9675 5400 9675 5175 10170 5175 10170 5400 -2 4 0 1 35 35 200 0 20 0.000 0 0 4 0 0 5 - 7875 6300 7200 6300 7200 6075 7875 6075 7875 6300 -2 4 0 1 35 35 200 0 20 0.000 0 0 4 0 0 5 - 8190 2475 6750 2475 6750 2250 8190 2250 8190 2475 -2 4 0 1 35 35 200 0 20 0.000 0 0 4 0 0 5 - 7605 3600 6300 3600 6300 3375 7605 3375 7605 3600 -2 4 0 1 35 35 200 0 20 0.000 0 0 4 0 0 5 - 7335 4500 6300 4500 6300 4275 7335 4275 7335 4500 -2 4 0 1 35 35 200 0 20 0.000 0 0 4 0 0 5 - 7200 5400 6300 5400 6300 5175 7200 5175 7200 5400 -2 1 0 6 7 7 600 0 -1 0.000 0 0 -1 0 0 2 - 9450 4500 6075 1935 -2 1 0 6 7 7 600 0 -1 0.000 0 0 4 0 0 2 - 9450 4500 12465 2205 -2 1 0 6 7 7 600 0 -1 0.000 0 0 4 0 0 2 - 9450 4500 9450 7785 -2 1 0 1 0 34 200 0 20 0.000 0 0 -1 1 0 2 - 1 1 1.00 60.00 120.00 - 9630 5310 7245 5310 -2 1 0 1 0 34 200 0 20 0.000 0 0 -1 1 0 2 - 1 1 1.00 60.00 120.00 - 11385 4365 7380 4365 -2 4 0 1 35 35 200 0 20 0.000 0 0 4 0 0 5 - 12240 5805 10980 5805 10980 5580 12240 5580 12240 5805 -2 4 0 1 35 35 200 0 20 0.000 0 0 4 0 0 5 - 12375 6210 10980 6210 10980 5985 12375 5985 12375 6210 -2 1 0 1 0 34 200 0 20 0.000 0 0 -1 1 0 2 - 1 1 1.00 60.00 120.00 - 11205 6885 9900 5445 -2 4 0 1 35 35 200 0 20 0.000 0 0 4 0 0 5 - 12285 7155 10530 7155 10530 6930 12285 6930 12285 7155 -2 4 0 1 35 35 200 0 20 0.000 0 0 4 0 0 5 - 10170 7155 9630 7155 9630 6930 10170 6930 10170 7155 -2 1 0 6 7 7 600 0 -1 0.000 0 0 4 0 0 2 - 12510 6435 9450 6435 -2 1 0 1 0 34 300 0 20 0.000 0 0 7 1 0 4 - 1 1 1.00 60.00 120.00 - 12375 4455 12510 4635 12510 6210 11970 6885 -2 1 2 1 0 34 200 0 20 1.000 0 0 -1 1 0 2 - 1 1 1.00 60.00 120.00 - 9850 5143 9175 4918 -3 1 0 1 34 34 800 0 20 0.000 0 0 0 41 - 7380 1710 6390 2115 5535 2115 6075 3015 5670 3465 6165 3915 - 5715 4410 6030 5040 6030 5310 6480 5715 6390 6255 6975 6300 - 7065 6975 7965 6750 8100 7560 8955 7290 9360 7740 9720 7560 - 10755 8145 12060 8280 12375 7650 12420 7200 12510 7065 12330 6660 - 12510 6390 12420 5940 12375 5400 12510 5220 12510 4725 12600 4275 - 12375 3645 12105 3240 12150 2745 12375 2700 12330 1980 11790 1575 - 11250 1935 10125 1485 8955 2070 7785 1620 7695 1575 - 1.000 1.000 1.000 1.000 1.000 1.000 1.000 1.000 - 1.000 1.000 1.000 1.000 1.000 1.000 1.000 1.000 - 1.000 1.000 1.000 1.000 1.000 1.000 1.000 1.000 - 1.000 1.000 1.000 1.000 1.000 1.000 1.000 1.000 - 1.000 1.000 1.000 1.000 1.000 1.000 1.000 1.000 - 1.000 -4 0 0 100 0 0 12 0.0000 4 180 1440 10575 675 Ralf S. Engelschall\001 -4 0 0 100 0 18 20 0.0000 4 270 3840 4275 675 Apache+mod_ssl+OpenSSL\001 -4 0 0 100 0 0 10 0.0000 4 135 1320 10575 855 rse@engelschall.com\001 -4 0 0 100 0 0 10 0.0000 4 135 1410 10575 1035 www.engelschall.com\001 -4 0 0 100 0 0 12 0.0000 4 135 870 900 675 Version 1.3\001 -4 0 0 100 0 0 12 0.0000 4 180 1035 900 855 12-Apr-1999\001 -4 0 0 200 0 20 8 0.0000 4 60 390 6210 4680 ->server\001 -4 0 0 200 0 20 8 0.0000 4 120 855 8280 6120 ap_ctx_get(...,"ssl")\001 -4 0 0 200 0 20 8 0.0000 4 120 1170 7740 2700 ap_get_module_config(...\001 -4 0 0 200 0 20 8 0.0000 4 120 810 7740 2835 ->module_config,\001 -4 0 0 200 0 20 8 0.0000 4 120 585 7740 2970 &ssl_module)\001 -4 0 0 100 0 18 20 0.0000 4 270 1200 9000 8100 Chaining\001 -4 0 0 100 0 18 20 0.0000 4 210 1095 2745 8100 Lifetime\001 -4 0 0 100 0 18 12 0.0000 4 180 1215 810 6255 ap_global_ctx\001 -4 0 0 100 0 18 12 0.0000 4 180 1305 990 5805 SSLModConfig\001 -4 0 0 100 0 18 12 0.0000 4 180 840 4050 4455 SSL_CTX\001 -4 0 0 100 0 18 12 0.0000 4 150 975 4455 5355 server_rec\001 -4 0 0 100 0 18 12 0.0000 4 180 1260 3870 4905 SSLSrvConfig\001 -4 0 0 100 0 18 12 0.0000 4 135 480 1845 4005 BUFF\001 -4 0 0 100 0 18 12 0.0000 4 150 810 2070 3555 conn_rec\001 -4 0 0 100 0 18 12 0.0000 4 135 345 2295 3105 BIO\001 -4 0 0 100 0 18 12 0.0000 4 135 375 2565 2655 SSL\001 -4 0 0 100 0 18 12 0.0000 4 180 1185 3645 1620 SSLDirConfig\001 -4 0 0 100 0 18 12 0.0000 4 180 1065 3915 2070 request_rec\001 -4 0 0 200 0 0 8 0.0000 4 120 1440 900 7560 Startup, Runtime, Shutdown\001 -4 0 0 200 0 0 8 0.0000 4 105 975 1350 7335 Configuration Time\001 -4 0 0 200 0 0 8 0.0000 4 90 1050 2025 7110 Connection Duration\001 -4 0 0 200 0 0 8 0.0000 4 120 885 2835 6885 Request Duration\001 -4 0 0 200 0 18 20 0.0000 4 195 90 6345 6795 t\001 -4 0 0 200 0 20 8 0.0000 4 90 345 7110 5985 ->client\001 -4 0 0 100 0 18 12 0.0000 4 180 1305 6795 2430 SSLModConfig\001 -4 0 0 100 0 18 12 0.0000 4 180 1260 8865 2430 SSLSrvConfig\001 -4 0 0 100 0 18 12 0.0000 4 180 1215 6345 3555 ap_global_ctx\001 -4 0 0 100 0 18 12 0.0000 4 150 975 6345 4455 server_rec\001 -4 0 0 100 0 18 12 0.0000 4 150 810 6345 5355 conn_rec\001 -4 0 0 100 0 18 12 0.0000 4 135 375 9720 5355 SSL\001 -4 0 0 100 0 18 12 0.0000 4 180 1185 10665 2430 SSLDirConfig\001 -4 0 0 100 0 18 12 0.0000 4 135 480 7290 6255 BUFF\001 -4 0 0 100 0 18 12 0.0000 4 180 1305 11025 5355 SSL_METHOD\001 -4 0 0 100 0 18 12 0.0000 4 180 840 11475 4455 SSL_CTX\001 -4 0 0 100 0 18 24 0.0000 4 285 4365 3915 1080 Data Structure Overview\001 -4 0 0 200 0 20 8 0.0000 4 90 615 7065 5085 ->connection\001 -4 0 0 200 0 20 8 0.0000 4 60 390 7065 4770 ->server\001 -4 0 0 200 0 20 8 0.0000 4 120 960 8010 5445 SSL_get_app_data()\001 -4 0 0 200 0 20 8 0.0000 4 120 510 10530 4050 ->pSSLCtx\001 -4 0 0 200 0 20 8 0.0000 4 120 1215 7875 4275 SSL_CTX_get_app_data()\001 -4 0 0 200 0 20 8 0.0000 4 120 1155 10305 5535 SSL_get_current_cipher()\001 -4 0 0 100 0 18 12 0.0000 4 180 1170 11025 5760 SSL_CIPHER\001 -4 0 0 100 0 18 12 0.0000 4 180 1350 10980 6165 SSL_SESSION\001 -4 0 0 200 0 20 8 0.0000 4 120 840 10440 5940 SSL_get_session()\001 -4 0 0 100 0 18 12 0.0000 4 180 1665 10575 7110 X509_STORE_CTX\001 -4 0 0 100 0 18 12 0.0000 4 135 345 9720 7110 BIO\001 -4 0 0 200 0 20 8 0.0000 4 120 840 9540 7335 SSL_get_{r,w}bio()\001 -4 0 0 100 0 18 20 0.0000 4 270 1170 8730 3465 mod_ssl\001 -4 0 0 100 0 18 20 0.0000 4 270 1050 8145 6750 Apache\001 -4 0 0 200 0 20 8 0.0000 4 120 945 10125 4680 SSL_get_SSL_CTX()\001 -4 0 0 200 0 20 8 0.0000 4 120 1170 10350 5175 SSL_get_SSL_METHOD()\001 -4 0 0 200 0 20 8 0.0000 4 90 465 11745 4770 ->method\001 -4 0 0 200 0 20 8 0.0000 4 120 1665 9945 6480 X509_STORE_CTX_get_app_data()\001 -4 0 0 200 0 20 8 0.0000 4 120 1215 10980 6705 SSL_CTX_get_cert_store()\001 -4 0 0 200 0 20 8 0.0000 4 120 1020 8280 5130 SSL_get_app_data2()\001 -4 0 0 100 0 18 20 0.0000 4 270 1290 10710 7605 OpenSSL\001 -4 0 0 100 0 18 12 0.0000 4 180 720 10710 7785 [Crypto]\001 -4 0 0 100 0 18 20 0.0000 4 270 1290 10935 3645 OpenSSL\001 -4 0 0 100 0 18 12 0.0000 4 180 495 10935 3825 [SSL]\001 diff --git a/modules/ssl/README.dsov.ps b/modules/ssl/README.dsov.ps deleted file mode 100644 index def19dbecfa746eed65efb7695e63753d4789a83..0000000000000000000000000000000000000000 --- a/modules/ssl/README.dsov.ps +++ /dev/null @@ -1,1138 +0,0 @@ -%!PS-Adobe-2.0 -%%Title: README.dsov.ps -%%Creator: fig2dev Version 3.2 Patchlevel 1 -%%CreationDate: Mon Apr 12 17:09:11 1999 -%%For: rse@en1.engelschall.com (Ralf S. Engelschall) -%%Orientation: Landscape -%%BoundingBox: 59 37 553 755 -%%Pages: 1 -%%BeginSetup -%%IncludeFeature: *PageSize Letter -%%EndSetup -%%Magnification: 0.9340 -%%EndComments -/$F2psDict 200 dict def -$F2psDict begin -$F2psDict /mtrx matrix put -/col-1 {0 setgray} bind def -/col0 {0.000 0.000 0.000 srgb} bind def -/col1 {0.000 0.000 1.000 srgb} bind def -/col2 {0.000 1.000 0.000 srgb} bind def -/col3 {0.000 1.000 1.000 srgb} bind def -/col4 {1.000 0.000 0.000 srgb} bind def -/col5 {1.000 0.000 1.000 srgb} bind def -/col6 {1.000 1.000 0.000 srgb} bind def -/col7 {1.000 1.000 1.000 srgb} bind def -/col8 {0.000 0.000 0.560 srgb} bind def -/col9 {0.000 0.000 0.690 srgb} bind def -/col10 {0.000 0.000 0.820 srgb} bind def -/col11 {0.530 0.810 1.000 srgb} bind def -/col12 {0.000 0.560 0.000 srgb} bind def -/col13 {0.000 0.690 0.000 srgb} bind def -/col14 {0.000 0.820 0.000 srgb} bind def -/col15 {0.000 0.560 0.560 srgb} bind def -/col16 {0.000 0.690 0.690 srgb} bind def -/col17 {0.000 0.820 0.820 srgb} bind def -/col18 {0.560 0.000 0.000 srgb} bind def -/col19 {0.690 0.000 0.000 srgb} bind def -/col20 {0.820 0.000 0.000 srgb} bind def -/col21 {0.560 0.000 0.560 srgb} bind def -/col22 {0.690 0.000 0.690 srgb} bind def -/col23 {0.820 0.000 0.820 srgb} bind def -/col24 {0.500 0.190 0.000 srgb} bind def -/col25 {0.630 0.250 0.000 srgb} bind def -/col26 {0.750 0.380 0.000 srgb} bind def -/col27 {1.000 0.500 0.500 srgb} bind def -/col28 {1.000 0.630 0.630 srgb} bind def -/col29 {1.000 0.750 0.750 srgb} bind def -/col30 {1.000 0.880 0.880 srgb} bind def -/col31 {1.000 0.840 0.000 srgb} bind def -/col32 {0.380 0.396 0.380 srgb} bind def -/col33 {0.714 0.698 0.714 srgb} bind def -/col34 {0.969 0.953 0.969 srgb} bind def -/col35 {0.812 0.812 0.812 srgb} bind def -/col36 {1.000 1.000 1.000 srgb} bind def - -end -save -48.0 12.0 translate - 90 rotate -1 -1 scale - -/cp {closepath} bind def -/ef {eofill} bind def -/gr {grestore} bind def -/gs {gsave} bind def -/sa {save} bind def -/rs {restore} bind def -/l {lineto} bind def -/m {moveto} bind def -/rm {rmoveto} bind def -/n {newpath} bind def -/s {stroke} bind def -/sh {show} bind def -/slc {setlinecap} bind def -/slj {setlinejoin} bind def -/slw {setlinewidth} bind def -/srgb {setrgbcolor} bind def -/rot {rotate} bind def -/sc {scale} bind def -/sd {setdash} bind def -/ff {findfont} bind def -/sf {setfont} bind def -/scf {scalefont} bind def -/sw {stringwidth} bind def -/tr {translate} bind def -/tnt {dup dup currentrgbcolor - 4 -2 roll dup 1 exch sub 3 -1 roll mul add - 4 -2 roll dup 1 exch sub 3 -1 roll mul add - 4 -2 roll dup 1 exch sub 3 -1 roll mul add srgb} - bind def -/shd {dup dup currentrgbcolor 4 -2 roll mul 4 -2 roll mul - 4 -2 roll mul srgb} bind def -/reencdict 12 dict def /ReEncode { reencdict begin -/newcodesandnames exch def /newfontname exch def /basefontname exch def -/basefontdict basefontname findfont def /newfont basefontdict maxlength dict def -basefontdict { exch dup /FID ne { dup /Encoding eq -{ exch dup length array copy newfont 3 1 roll put } -{ exch newfont 3 1 roll put } ifelse } { pop pop } ifelse } forall -newfont /FontName newfontname put newcodesandnames aload pop -128 1 255 { newfont /Encoding get exch /.notdef put } for -newcodesandnames length 2 idiv { newfont /Encoding get 3 1 roll put } repeat -newfontname newfont definefont pop end } def -/isovec [ -8#200 /grave 8#201 /acute 8#202 /circumflex 8#203 /tilde -8#204 /macron 8#205 /breve 8#206 /dotaccent 8#207 /dieresis -8#210 /ring 8#211 /cedilla 8#212 /hungarumlaut 8#213 /ogonek 8#214 /caron -8#220 /dotlessi 8#230 /oe 8#231 /OE -8#240 /space 8#241 /exclamdown 8#242 /cent 8#243 /sterling -8#244 /currency 8#245 /yen 8#246 /brokenbar 8#247 /section 8#250 /dieresis -8#251 /copyright 8#252 /ordfeminine 8#253 /guillemotleft 8#254 /logicalnot -8#255 /endash 8#256 /registered 8#257 /macron 8#260 /degree 8#261 /plusminus -8#262 /twosuperior 8#263 /threesuperior 8#264 /acute 8#265 /mu 8#266 /paragraph -8#267 /periodcentered 8#270 /cedilla 8#271 /onesuperior 8#272 /ordmasculine -8#273 /guillemotright 8#274 /onequarter 8#275 /onehalf -8#276 /threequarters 8#277 /questiondown 8#300 /Agrave 8#301 /Aacute -8#302 /Acircumflex 8#303 /Atilde 8#304 /Adieresis 8#305 /Aring -8#306 /AE 8#307 /Ccedilla 8#310 /Egrave 8#311 /Eacute -8#312 /Ecircumflex 8#313 /Edieresis 8#314 /Igrave 8#315 /Iacute -8#316 /Icircumflex 8#317 /Idieresis 8#320 /Eth 8#321 /Ntilde 8#322 /Ograve -8#323 /Oacute 8#324 /Ocircumflex 8#325 /Otilde 8#326 /Odieresis 8#327 /multiply -8#330 /Oslash 8#331 /Ugrave 8#332 /Uacute 8#333 /Ucircumflex -8#334 /Udieresis 8#335 /Yacute 8#336 /Thorn 8#337 /germandbls 8#340 /agrave -8#341 /aacute 8#342 /acircumflex 8#343 /atilde 8#344 /adieresis 8#345 /aring -8#346 /ae 8#347 /ccedilla 8#350 /egrave 8#351 /eacute -8#352 /ecircumflex 8#353 /edieresis 8#354 /igrave 8#355 /iacute -8#356 /icircumflex 8#357 /idieresis 8#360 /eth 8#361 /ntilde 8#362 /ograve -8#363 /oacute 8#364 /ocircumflex 8#365 /otilde 8#366 /odieresis 8#367 /divide -8#370 /oslash 8#371 /ugrave 8#372 /uacute 8#373 /ucircumflex -8#374 /udieresis 8#375 /yacute 8#376 /thorn 8#377 /ydieresis] def -/Times-Roman /Times-Roman-iso isovec ReEncode -/Helvetica-Bold /Helvetica-Bold-iso isovec ReEncode -/Helvetica-Narrow /Helvetica-Narrow-iso isovec ReEncode -/$F2psBegin {$F2psDict begin /$F2psEnteredState save def} def -/$F2psEnd {$F2psEnteredState restore end} def -%%EndProlog - -$F2psBegin -10 setmiterlimit -n -1000 9572 m -1000 -1000 l 13622 -1000 l 13622 9572 l cp clip - 0.05883 0.05883 sc -%%Page: 1 1 -% Polyline -7.500 slw -n 6413 2048 m 6380 2054 l 6348 2061 l 6315 2067 l 6283 2073 l 6250 2079 l - 6217 2084 l 6185 2090 l 6152 2095 l 6120 2101 l 6088 2107 l - 6057 2113 l 6027 2120 l 5998 2126 l 5970 2134 l 5943 2141 l - 5918 2149 l 5894 2158 l 5873 2167 l 5853 2177 l 5835 2187 l - 5819 2198 l 5805 2210 l 5793 2222 l 5782 2235 l 5774 2250 l - 5768 2265 l 5763 2281 l 5760 2299 l 5759 2318 l 5759 2339 l - 5761 2360 l 5764 2383 l 5768 2408 l 5774 2433 l 5780 2460 l - 5788 2488 l 5797 2516 l 5806 2546 l 5815 2575 l 5825 2606 l - 5836 2636 l 5846 2666 l 5856 2696 l 5866 2726 l 5875 2755 l - 5884 2784 l 5892 2812 l 5899 2839 l 5905 2866 l 5910 2891 l - 5915 2916 l 5918 2940 l 5919 2968 l 5920 2995 l 5919 3022 l - 5916 3048 l 5912 3075 l 5908 3101 l 5902 3127 l 5895 3153 l - 5887 3179 l 5880 3205 l 5871 3230 l 5863 3254 l 5855 3278 l - 5848 3302 l 5841 3324 l 5834 3346 l 5829 3367 l 5824 3388 l - 5821 3408 l 5819 3427 l 5819 3446 l 5820 3465 l 5823 3484 l - 5827 3503 l 5833 3522 l 5840 3542 l 5848 3562 l 5858 3582 l - 5868 3603 l 5880 3625 l 5891 3647 l 5904 3669 l 5916 3691 l - 5929 3713 l 5941 3736 l 5953 3758 l 5964 3779 l 5974 3801 l - 5983 3822 l 5991 3843 l 5997 3863 l 6002 3883 l 6006 3903 l - 6008 3923 l 6008 3942 l 6006 3962 l 6003 3983 l 5998 4004 l - 5992 4025 l 5985 4048 l 5977 4070 l 5968 4094 l 5958 4118 l - 5947 4142 l 5936 4167 l 5925 4192 l 5913 4216 l 5902 4241 l - 5892 4266 l 5882 4291 l 5872 4315 l 5864 4339 l 5857 4362 l - 5851 4386 l 5846 4409 l 5843 4433 l 5840 4456 l 5840 4480 l - 5840 4505 l 5842 4530 l 5845 4556 l 5849 4582 l 5854 4609 l - 5860 4636 l 5867 4664 l 5875 4692 l 5883 4720 l 5892 4747 l - 5901 4774 l 5910 4801 l 5920 4827 l 5929 4852 l 5938 4875 l - 5947 4898 l 5955 4920 l 5963 4941 l 5971 4961 l 5978 4980 l - 5985 5002 l 5992 5024 l 5999 5046 l 6005 5067 l 6010 5088 l - 6016 5109 l 6022 5129 l 6027 5150 l 6033 5170 l 6039 5190 l - 6045 5209 l 6052 5228 l 6059 5246 l 6067 5264 l 6075 5281 l - 6084 5298 l 6094 5315 l 6105 5333 l 6115 5347 l 6125 5361 l - 6137 5376 l 6149 5392 l 6162 5408 l 6176 5425 l 6191 5443 l - 6206 5461 l 6221 5480 l 6237 5499 l 6253 5519 l 6269 5539 l - 6284 5559 l 6299 5579 l 6313 5599 l 6327 5619 l 6340 5639 l - 6352 5659 l 6363 5679 l 6373 5698 l 6382 5718 l 6390 5738 l - 6398 5759 l 6404 5782 l 6410 5805 l 6415 5828 l 6420 5852 l - 6424 5877 l 6428 5902 l 6431 5927 l 6435 5952 l 6438 5977 l - 6442 6001 l 6446 6025 l 6450 6048 l 6455 6069 l 6461 6090 l - 6467 6109 l 6474 6127 l 6483 6143 l 6492 6159 l 6503 6173 l - 6515 6185 l 6528 6197 l 6543 6209 l 6560 6220 l 6578 6230 l - 6598 6240 l 6619 6250 l 6641 6260 l 6663 6270 l 6687 6281 l - 6710 6291 l 6733 6302 l 6757 6312 l 6779 6324 l 6801 6335 l - 6821 6348 l 6841 6361 l 6859 6374 l 6876 6389 l 6893 6405 l - 6906 6421 l 6919 6437 l 6932 6455 l 6944 6475 l 6955 6495 l - 6967 6516 l 6979 6538 l 6991 6561 l 7003 6584 l 7015 6608 l - 7027 6631 l 7040 6654 l 7053 6677 l 7067 6699 l 7081 6720 l - 7096 6739 l 7111 6758 l 7127 6774 l 7144 6789 l 7161 6803 l - 7180 6815 l 7200 6825 l 7220 6833 l 7240 6840 l 7263 6845 l - 7286 6850 l 7311 6854 l 7338 6857 l 7365 6859 l 7394 6861 l - 7424 6862 l 7454 6864 l 7485 6865 l 7516 6866 l 7547 6867 l - 7578 6868 l 7609 6870 l 7639 6872 l 7668 6875 l 7696 6879 l - 7723 6883 l 7748 6889 l 7773 6895 l 7795 6903 l 7817 6912 l - 7838 6923 l 7857 6934 l 7875 6948 l 7892 6963 l 7909 6980 l - 7926 6998 l 7941 7017 l 7957 7038 l 7972 7060 l 7987 7083 l - 8002 7106 l 8017 7130 l 8031 7154 l 8046 7178 l 8061 7202 l - 8075 7225 l 8090 7247 l 8105 7269 l 8120 7289 l 8135 7308 l - 8151 7326 l 8167 7342 l 8184 7356 l 8202 7369 l 8220 7380 l - 8239 7390 l 8260 7397 l 8282 7404 l 8305 7409 l 8330 7413 l - 8356 7416 l 8383 7418 l 8412 7420 l 8441 7420 l 8471 7419 l - 8502 7418 l 8534 7417 l 8565 7415 l 8597 7413 l 8629 7411 l - 8660 7409 l 8690 7407 l 8720 7405 l 8749 7404 l 8777 7404 l - 8804 7404 l 8830 7405 l 8856 7407 l 8880 7410 l 8906 7414 l - 8931 7420 l 8956 7427 l 8981 7435 l 9005 7444 l 9029 7455 l - 9053 7466 l 9077 7478 l 9100 7491 l 9123 7504 l 9146 7517 l - 9168 7531 l 9190 7544 l 9210 7557 l 9230 7570 l 9250 7582 l - 9268 7593 l 9286 7604 l 9304 7613 l 9320 7621 l 9336 7629 l - 9353 7635 l 9370 7641 l 9388 7645 l 9406 7648 l 9425 7650 l - 9444 7652 l 9464 7653 l 9485 7653 l 9508 7653 l 9531 7653 l - 9555 7653 l 9579 7653 l 9605 7654 l 9631 7655 l 9658 7656 l - 9685 7659 l 9713 7662 l 9742 7666 l 9771 7672 l 9801 7679 l - 9833 7688 l 9853 7694 l 9874 7700 l 9895 7708 l 9918 7716 l - 9941 7725 l 9966 7734 l 9991 7745 l 10017 7755 l 10045 7767 l - 10073 7779 l 10102 7791 l 10132 7804 l 10163 7818 l 10194 7831 l - 10227 7845 l 10259 7860 l 10293 7874 l 10326 7889 l 10360 7903 l - 10394 7918 l 10429 7932 l 10463 7947 l 10497 7961 l 10531 7974 l - 10565 7988 l 10599 8001 l 10633 8013 l 10667 8025 l 10700 8037 l - 10733 8049 l 10767 8059 l 10800 8070 l 10834 8080 l 10868 8090 l - 10902 8099 l 10937 8108 l 10973 8117 l 11009 8125 l 11045 8133 l - 11083 8141 l 11120 8148 l 11158 8155 l 11197 8161 l 11236 8167 l - 11275 8172 l 11313 8177 l 11352 8181 l 11391 8184 l 11429 8187 l - 11467 8190 l 11504 8191 l 11540 8192 l 11576 8192 l 11610 8192 l - 11644 8191 l 11676 8189 l 11707 8187 l 11738 8184 l 11767 8180 l - 11794 8176 l 11821 8171 l 11847 8165 l 11871 8159 l 11895 8153 l - 11923 8143 l 11950 8133 l 11976 8122 l 12001 8109 l 12025 8096 l - 12048 8081 l 12071 8065 l 12092 8048 l 12113 8031 l 12133 8012 l - 12153 7992 l 12171 7972 l 12188 7951 l 12205 7930 l 12220 7909 l - 12235 7887 l 12248 7865 l 12260 7843 l 12272 7822 l 12282 7800 l - 12292 7779 l 12301 7759 l 12309 7739 l 12316 7719 l 12323 7699 l - 12330 7680 l 12338 7655 l 12345 7631 l 12352 7607 l 12359 7582 l - 12365 7558 l 12371 7533 l 12377 7508 l 12382 7484 l 12388 7460 l - 12392 7436 l 12397 7414 l 12401 7391 l 12405 7370 l 12409 7350 l - 12412 7331 l 12415 7313 l 12418 7297 l 12421 7281 l 12424 7266 l - 12428 7253 l 12432 7234 l 12437 7216 l 12442 7199 l 12446 7183 l - 12451 7166 l 12456 7150 l 12460 7134 l 12463 7117 l 12466 7101 l - 12468 7086 l 12469 7070 l 12469 7054 l 12467 7037 l 12465 7020 l - 12462 7006 l 12459 6991 l 12455 6975 l 12450 6958 l 12445 6940 l - 12440 6921 l 12434 6901 l 12428 6880 l 12422 6859 l 12416 6838 l - 12411 6817 l 12406 6796 l 12401 6776 l 12397 6756 l 12394 6736 l - 12392 6718 l 12390 6700 l 12390 6683 l 12390 6665 l 12392 6649 l - 12394 6631 l 12397 6614 l 12401 6597 l 12406 6579 l 12411 6561 l - 12416 6542 l 12422 6524 l 12428 6505 l 12434 6487 l 12440 6468 l - 12445 6450 l 12450 6432 l 12455 6414 l 12459 6396 l 12462 6378 l - 12465 6360 l 12467 6343 l 12468 6326 l 12469 6308 l 12469 6289 l - 12468 6269 l 12468 6249 l 12466 6227 l 12464 6205 l 12462 6182 l - 12460 6159 l 12457 6135 l 12454 6111 l 12451 6087 l 12447 6063 l - 12444 6040 l 12441 6016 l 12437 5993 l 12434 5970 l 12431 5948 l - 12428 5925 l 12424 5902 l 12421 5879 l 12419 5855 l 12416 5831 l - 12413 5806 l 12411 5781 l 12408 5755 l 12406 5729 l 12404 5702 l - 12403 5676 l 12401 5651 l 12400 5625 l 12400 5601 l 12399 5578 l - 12399 5555 l 12400 5534 l 12401 5514 l 12402 5495 l 12403 5477 l - 12405 5460 l 12408 5440 l 12411 5421 l 12416 5402 l 12420 5384 l - 12426 5365 l 12431 5347 l 12437 5329 l 12444 5311 l 12450 5293 l - 12456 5275 l 12462 5258 l 12468 5240 l 12474 5222 l 12479 5205 l - 12483 5186 l 12488 5168 l 12490 5152 l 12493 5135 l 12496 5117 l - 12498 5099 l 12500 5079 l 12502 5058 l 12504 5036 l 12506 5014 l - 12507 4990 l 12509 4966 l 12510 4942 l 12512 4918 l 12513 4893 l - 12515 4869 l 12516 4845 l 12518 4822 l 12520 4799 l 12521 4776 l - 12523 4754 l 12525 4733 l 12527 4713 l 12529 4693 l 12531 4673 l - 12534 4653 l 12536 4632 l 12539 4610 l 12541 4588 l 12543 4566 l - 12546 4543 l 12548 4520 l 12550 4497 l 12552 4473 l 12553 4450 l - 12554 4426 l 12555 4403 l 12555 4380 l 12555 4357 l 12555 4334 l - 12554 4312 l 12552 4290 l 12550 4267 l 12548 4245 l 12545 4224 l - 12541 4203 l 12537 4181 l 12533 4159 l 12528 4136 l 12523 4112 l - 12517 4088 l 12510 4064 l 12503 4038 l 12496 4013 l 12488 3987 l - 12479 3961 l 12471 3935 l 12462 3909 l 12452 3884 l 12443 3859 l - 12434 3835 l 12424 3811 l 12415 3788 l 12405 3766 l 12396 3744 l - 12386 3723 l 12377 3702 l 12368 3683 l 12357 3661 l 12347 3640 l - 12336 3619 l 12325 3598 l 12314 3576 l 12303 3555 l 12291 3533 l - 12280 3511 l 12269 3489 l 12257 3467 l 12246 3446 l 12235 3424 l - 12225 3402 l 12215 3381 l 12206 3360 l 12197 3340 l 12189 3320 l - 12181 3301 l 12174 3281 l 12168 3262 l 12162 3244 l 12158 3225 l - 12153 3204 l 12149 3183 l 12145 3162 l 12142 3139 l 12140 3117 l - 12138 3094 l 12137 3071 l 12137 3047 l 12138 3024 l 12139 3001 l - 12141 2978 l 12143 2956 l 12146 2935 l 12150 2915 l 12154 2896 l - 12158 2879 l 12163 2862 l 12168 2847 l 12174 2833 l 12180 2820 l - 12188 2805 l 12197 2792 l 12206 2779 l 12216 2766 l 12227 2754 l - 12238 2742 l 12249 2730 l 12260 2717 l 12272 2704 l 12282 2691 l - 12292 2676 l 12302 2661 l 12310 2645 l 12318 2627 l 12324 2608 l - 12330 2588 l 12334 2571 l 12336 2553 l 12339 2534 l 12341 2513 l - 12342 2491 l 12343 2467 l 12343 2442 l 12342 2416 l 12340 2389 l - 12338 2360 l 12335 2332 l 12331 2303 l 12326 2273 l 12320 2244 l - 12314 2215 l 12307 2187 l 12299 2159 l 12290 2132 l 12280 2106 l - 12270 2081 l 12259 2056 l 12248 2033 l 12236 2011 l 12224 1990 l - 12210 1970 l 12196 1949 l 12181 1929 l 12164 1910 l 12147 1890 l - 12129 1871 l 12110 1853 l 12090 1835 l 12070 1818 l 12049 1802 l - 12027 1787 l 12005 1773 l 11983 1761 l 11961 1749 l 11939 1739 l - 11917 1730 l 11895 1722 l 11874 1716 l 11852 1710 l 11831 1707 l - 11811 1704 l 11790 1703 l 11769 1702 l 11748 1703 l 11727 1705 l - 11706 1708 l 11683 1711 l 11660 1716 l 11636 1721 l 11612 1727 l - 11587 1733 l 11560 1740 l 11534 1747 l 11506 1754 l 11479 1761 l - 11450 1768 l 11422 1774 l 11393 1780 l 11364 1786 l 11334 1791 l - 11305 1795 l 11275 1798 l 11245 1800 l 11215 1801 l 11184 1801 l - 11153 1800 l 11128 1798 l 11104 1796 l 11078 1793 l 11052 1790 l - 11025 1785 l 10997 1781 l 10968 1776 l 10939 1770 l 10908 1764 l - 10877 1758 l 10844 1751 l 10811 1744 l 10778 1737 l 10743 1730 l - 10708 1722 l 10673 1715 l 10637 1708 l 10601 1701 l 10565 1695 l - 10530 1688 l 10494 1682 l 10458 1677 l 10422 1672 l 10387 1668 l - 10352 1664 l 10318 1661 l 10284 1658 l 10250 1657 l 10216 1656 l - 10183 1655 l 10150 1656 l 10118 1658 l 10087 1660 l 10055 1663 l - 10024 1666 l 9992 1671 l 9960 1676 l 9927 1682 l 9894 1688 l - 9861 1695 l 9827 1703 l 9792 1711 l 9757 1720 l 9721 1729 l - 9685 1738 l 9649 1748 l 9613 1757 l 9576 1767 l 9539 1778 l - 9502 1788 l 9465 1798 l 9429 1807 l 9392 1817 l 9356 1826 l - 9320 1835 l 9285 1844 l 9250 1852 l 9216 1860 l 9182 1867 l - 9148 1873 l 9115 1879 l 9082 1884 l 9050 1889 l 9018 1892 l - 8987 1895 l 8955 1898 l 8919 1899 l 8883 1900 l 8847 1899 l - 8811 1898 l 8774 1896 l 8737 1893 l 8699 1889 l 8661 1884 l - 8623 1878 l 8585 1872 l 8546 1865 l 8508 1857 l 8470 1849 l - 8432 1840 l 8395 1830 l 8358 1821 l 8322 1811 l 8287 1801 l - 8254 1790 l 8221 1780 l 8189 1770 l 8159 1760 l 8130 1750 l - 8102 1740 l 8076 1730 l 8051 1721 l 8028 1712 l 8006 1703 l - 7985 1695 l 7965 1688 l 7931 1674 l 7899 1662 l 7871 1650 l - 7844 1640 l 7820 1631 l 7798 1623 l 7778 1617 l 7760 1611 l - 7743 1607 l 7728 1603 l 7715 1601 l 7702 1600 l 7691 1600 l - 7680 1601 l 7669 1603 l 7658 1605 l 7648 1607 l 7638 1610 l - 7627 1613 l 7615 1617 l 7601 1621 l 7587 1626 l 7571 1632 l - 7554 1638 l 7536 1645 l 7517 1653 l 7496 1661 l 7474 1670 l - 7452 1679 l 7428 1689 l 7403 1699 l 7378 1709 l 7352 1720 l - 7325 1731 l 7297 1743 l 7268 1755 l 7247 1763 l 7226 1772 l - 7204 1781 l 7182 1790 l 7158 1800 l 7133 1810 l 7108 1820 l - 7081 1831 l 7053 1842 l 7025 1853 l 6996 1864 l 6966 1875 l - 6935 1886 l 6904 1898 l 6873 1909 l 6841 1921 l 6809 1932 l - 6776 1943 l 6744 1954 l 6712 1964 l 6680 1974 l 6649 1984 l - 6618 1994 l 6587 2003 l 6557 2011 l 6527 2019 l 6498 2027 l - 6469 2034 l 6441 2041 l cp gs col34 1.00 shd ef gr gs col34 s gr -% Polyline -n 675 6525 m 5850 6525 l 5850 6075 l 5625 6075 l 5625 5625 l 900 5625 l - 900 6075 l 675 6075 l cp gs col7 1.00 shd ef gr gs col7 s gr -% Polyline -n 1125 6525 m 5355 6525 l 5400 5175 l 5175 5175 l 5175 4725 l 4950 4725 l - 4950 4275 l 1575 4275 l 1575 4725 l 1350 4725 l 1350 5175 l - 1125 5175 l cp gs col34 1.00 shd ef gr gs col34 s gr -% Polyline -75.000 slw -n 9450 4500 m 12465 2205 l gs col7 s gr -% Polyline -n 9450 4500 m 9450 7785 l gs col7 s gr -% Polyline -n 9450 4500 m 6075 1935 l gs col7 s gr -% Polyline -n 12510 6435 m 9450 6435 l gs col7 s gr -% Polyline -7.500 slw -n 1800 6525 m 4725 6525 l 4725 3825 l 4500 3825 l 4500 3375 l 4275 3375 l - 4275 2925 l 4050 2925 l 4050 2475 l 2475 2475 l 2475 2925 l - 2250 2925 l 2250 3375 l 2025 3375 l 2025 3825 l 1800 3825 l - cp gs col35 1.00 shd ef gr gs col35 s gr -% Polyline -n 2700 6525 m 3825 6525 l 3825 2025 l 3600 2025 l 3600 1575 l 2925 1575 l - 2925 2025 l 2700 2025 l cp gs col33 1.00 shd ef gr gs col33 s gr -% Polyline -gs clippath -12068 6810 m 11970 6885 l 12022 6773 l 11937 6878 l 11984 6915 l cp -clip -n 12375 4455 m 12510 4635 l 12510 6210 l 11970 6885 l gs col34 1.00 shd ef gr gs col0 s gr gr - -% arrowhead -n 12068 6810 m 11970 6885 l 12022 6773 l 12045 6791 l 12068 6810 l cp gs 0.00 setgray ef gr col0 s -% Polyline -gs clippath -7113 6004 m 7155 6120 l 7063 6037 l 7138 6149 l 7188 6116 l cp -clip -n 6705 5445 m 7155 6120 l gs col34 1.00 shd ef gr gs col0 s gr gr - -% arrowhead -n 7113 6004 m 7155 6120 l 7063 6037 l 7088 6020 l 7113 6004 l cp gs 0.00 setgray ef gr col0 s -% Polyline -gs clippath -7304 4656 m 7200 4590 l 7323 4599 l 7195 4557 l 7176 4614 l cp -clip -n 7875 4815 m 7200 4590 l gs col34 1.00 shd ef gr gs col0 s gr gr - -% arrowhead -n 7304 4656 m 7200 4590 l 7323 4599 l 7314 4628 l 7304 4656 l cp gs 0.00 setgray ef gr col0 s -% Polyline -gs clippath -11405 4128 m 11475 4230 l 11365 4173 l 11466 4262 l 11506 4217 l cp -clip -n 9585 2565 m 11475 4230 l gs col34 1.00 shd ef gr gs col0 s gr gr - -% arrowhead -n 11405 4128 m 11475 4230 l 11365 4173 l 11385 4151 l 11405 4128 l cp gs 0.00 setgray ef gr col0 s -% Polyline -gs clippath -11712 4556 m 11835 4545 l 11732 4613 l 11859 4568 l 11839 4512 l cp -clip -n 10170 5130 m 11835 4545 l gs col34 1.00 shd ef gr gs col0 s gr gr - -% arrowhead -n 11712 4556 m 11835 4545 l 11732 4613 l 11722 4585 l 11712 4556 l cp gs 0.00 setgray ef gr col0 s -% Polyline -gs clippath -9732 5411 m 9855 5400 l 9752 5468 l 9879 5423 l 9859 5367 l cp -clip -n 7920 6075 m 9855 5400 l gs col34 1.00 shd ef gr gs col0 s gr gr - -% arrowhead -n 9732 5411 m 9855 5400 l 9752 5468 l 9742 5440 l 9732 5411 l cp gs 0.00 setgray ef gr col0 s -% Polyline -gs clippath -10823 5573 m 10935 5625 l 10812 5632 l 10944 5657 l 10955 5598 l cp -clip -n 9990 5445 m 10935 5625 l gs col34 1.00 shd ef gr gs col0 s gr gr - -% arrowhead -n 10823 5573 m 10935 5625 l 10812 5632 l 10817 5603 l 10823 5573 l cp gs 0.00 setgray ef gr col0 s -% Polyline -gs clippath -10815 5280 m 10935 5310 l 10815 5340 l 10950 5340 l 10950 5280 l cp -clip -n 10215 5310 m 10935 5310 l gs col34 1.00 shd ef gr gs col0 s gr gr - -% arrowhead -n 10815 5280 m 10935 5310 l 10815 5340 l 10815 5310 l 10815 5280 l cp gs 0.00 setgray ef gr col0 s -% Polyline -gs clippath -11955 4965 m 11925 5085 l 11895 4965 l 11895 5100 l 11955 5100 l cp -clip -n 11925 4590 m 11925 5085 l gs col34 1.00 shd ef gr gs col0 s gr gr - -% arrowhead -n 11955 4965 m 11925 5085 l 11895 4965 l 11925 4965 l 11955 4965 l cp gs 0.00 setgray ef gr col0 s -% Polyline -gs clippath -9840 6720 m 9810 6840 l 9780 6720 l 9780 6855 l 9840 6855 l cp -clip -n 9810 5490 m 9810 6840 l gs col34 1.00 shd ef gr gs col0 s gr gr - -% arrowhead -n 9840 6720 m 9810 6840 l 9780 6720 l 9810 6720 l 9840 6720 l cp gs 0.00 setgray ef gr col0 s -% Polyline -gs clippath -10847 5943 m 10935 6030 l 10816 5995 l 10933 6063 l 10963 6012 l cp -clip -n 9945 5445 m 10935 6030 l gs col34 1.00 shd ef gr gs col0 s gr gr - -% arrowhead -n 10847 5943 m 10935 6030 l 10816 5995 l 10832 5969 l 10847 5943 l cp gs 0.00 setgray ef gr col0 s -% Polyline -gs clippath -10698 2634 m 10800 2565 l 10742 2674 l 10832 2574 l 10788 2534 l cp -clip -n 8865 4725 m 10800 2565 l gs col34 1.00 shd ef gr gs col0 s gr gr - -% arrowhead -n 10698 2634 m 10800 2565 l 10742 2674 l 10720 2654 l 10698 2634 l cp gs 0.00 setgray ef gr col0 s -% Polyline -30.000 slw -n 675 6075 m 5850 6075 l gs col34 1.00 shd ef gr gs col0 s gr -% Polyline -7.500 slw - [15 15] 15 sd -gs clippath -645 6195 m 675 6075 l 705 6195 l 705 6060 l 645 6060 l cp -clip -n 675 6525 m 675 6075 l gs col34 1.00 shd ef gr gs col0 s gr gr - [] 0 sd -% arrowhead -n 645 6195 m 675 6075 l 705 6195 l 675 6195 l 645 6195 l cp gs 0.00 setgray ef gr col0 s -% Polyline - [15 15] 15 sd -gs clippath -5880 6405 m 5850 6525 l 5820 6405 l 5820 6540 l 5880 6540 l cp -clip -n 5850 6075 m 5850 6525 l gs col34 1.00 shd ef gr gs col0 s gr gr - [] 0 sd -% arrowhead -n 5880 6405 m 5850 6525 l 5820 6405 l 5850 6405 l 5880 6405 l cp gs col7 1.00 shd ef gr col0 s -% Polyline -30.000 slw -n 900 5625 m 5625 5625 l gs col34 1.00 shd ef gr gs col0 s gr -% Polyline -n 1125 5175 m 5400 5175 l gs col34 1.00 shd ef gr gs col0 s gr -% Polyline -n 1350 4725 m 5175 4725 l gs col34 1.00 shd ef gr gs col0 s gr -% Polyline -n 1575 4275 m 4950 4275 l gs col34 1.00 shd ef gr gs col0 s gr -% Polyline -n 1800 3825 m 4725 3825 l gs col34 1.00 shd ef gr gs col0 s gr -% Polyline -n 2025 3375 m 4500 3375 l gs col34 1.00 shd ef gr gs col0 s gr -% Polyline -n 2250 2925 m 4275 2925 l gs col34 1.00 shd ef gr gs col0 s gr -% Polyline -n 2475 2475 m 4050 2475 l gs col34 1.00 shd ef gr gs col0 s gr -% Polyline -n 2700 2025 m 3825 2025 l gs col34 1.00 shd ef gr gs col0 s gr -% Polyline -n 2925 1575 m 3600 1575 l gs col34 1.00 shd ef gr gs col0 s gr -% Polyline -7.500 slw - [15 15] 15 sd -gs clippath -870 5745 m 900 5625 l 930 5745 l 930 5610 l 870 5610 l cp -clip -n 900 6075 m 900 5625 l gs col34 1.00 shd ef gr gs col0 s gr gr - [] 0 sd -% arrowhead -n 870 5745 m 900 5625 l 930 5745 l 900 5745 l 870 5745 l cp gs 0.00 setgray ef gr col0 s -% Polyline - [15 15] 15 sd -gs clippath -1095 5295 m 1125 5175 l 1155 5295 l 1155 5160 l 1095 5160 l cp -clip -n 1125 6525 m 1125 5175 l gs col34 1.00 shd ef gr gs col0 s gr gr - [] 0 sd -% arrowhead -n 1095 5295 m 1125 5175 l 1155 5295 l 1125 5295 l 1095 5295 l cp gs 0.00 setgray ef gr col0 s -% Polyline - [15 15] 15 sd -gs clippath -1320 4845 m 1350 4725 l 1380 4845 l 1380 4710 l 1320 4710 l cp -clip -n 1350 5175 m 1350 4725 l gs col34 1.00 shd ef gr gs col0 s gr gr - [] 0 sd -% arrowhead -n 1320 4845 m 1350 4725 l 1380 4845 l 1350 4845 l 1320 4845 l cp gs 0.00 setgray ef gr col0 s -% Polyline - [15 15] 15 sd -gs clippath -1545 4395 m 1575 4275 l 1605 4395 l 1605 4260 l 1545 4260 l cp -clip -n 1575 4725 m 1575 4275 l gs col34 1.00 shd ef gr gs col0 s gr gr - [] 0 sd -% arrowhead -n 1545 4395 m 1575 4275 l 1605 4395 l 1575 4395 l 1545 4395 l cp gs 0.00 setgray ef gr col0 s -% Polyline - [15 15] 15 sd -gs clippath -1770 3945 m 1800 3825 l 1830 3945 l 1830 3810 l 1770 3810 l cp -clip -n 1800 6525 m 1800 3825 l gs col34 1.00 shd ef gr gs col0 s gr gr - [] 0 sd -% arrowhead -n 1770 3945 m 1800 3825 l 1830 3945 l 1800 3945 l 1770 3945 l cp gs 0.00 setgray ef gr col0 s -% Polyline - [15 15] 15 sd -gs clippath -1995 3495 m 2025 3375 l 2055 3495 l 2055 3360 l 1995 3360 l cp -clip -n 2025 3825 m 2025 3375 l gs col34 1.00 shd ef gr gs col0 s gr gr - [] 0 sd -% arrowhead -n 1995 3495 m 2025 3375 l 2055 3495 l 2025 3495 l 1995 3495 l cp gs 0.00 setgray ef gr col0 s -% Polyline - [15 15] 15 sd -gs clippath -2220 3045 m 2250 2925 l 2280 3045 l 2280 2910 l 2220 2910 l cp -clip -n 2250 3375 m 2250 2925 l gs col34 1.00 shd ef gr gs col0 s gr gr - [] 0 sd -% arrowhead -n 2220 3045 m 2250 2925 l 2280 3045 l 2250 3045 l 2220 3045 l cp gs 0.00 setgray ef gr col0 s -% Polyline - [15 15] 15 sd -gs clippath -2445 2595 m 2475 2475 l 2505 2595 l 2505 2460 l 2445 2460 l cp -clip -n 2475 2925 m 2475 2475 l gs col34 1.00 shd ef gr gs col0 s gr gr - [] 0 sd -% arrowhead -n 2445 2595 m 2475 2475 l 2505 2595 l 2475 2595 l 2445 2595 l cp gs 0.00 setgray ef gr col0 s -% Polyline - [15 15] 15 sd -gs clippath -5655 5955 m 5625 6075 l 5595 5955 l 5595 6090 l 5655 6090 l cp -clip -n 5625 5625 m 5625 6075 l gs col34 1.00 shd ef gr gs col0 s gr gr - [] 0 sd -% arrowhead -n 5655 5955 m 5625 6075 l 5595 5955 l 5625 5955 l 5655 5955 l cp gs col7 1.00 shd ef gr col0 s -% Polyline - [15 15] 15 sd -gs clippath -5430 6405 m 5400 6525 l 5370 6405 l 5370 6540 l 5430 6540 l cp -clip -n 5400 5175 m 5400 6525 l gs col34 1.00 shd ef gr gs col0 s gr gr - [] 0 sd -% arrowhead -n 5430 6405 m 5400 6525 l 5370 6405 l 5400 6405 l 5430 6405 l cp gs col7 1.00 shd ef gr col0 s -% Polyline - [15 15] 15 sd -gs clippath -5205 5055 m 5175 5175 l 5145 5055 l 5145 5190 l 5205 5190 l cp -clip -n 5175 4725 m 5175 5175 l gs col34 1.00 shd ef gr gs col0 s gr gr - [] 0 sd -% arrowhead -n 5205 5055 m 5175 5175 l 5145 5055 l 5175 5055 l 5205 5055 l cp gs col7 1.00 shd ef gr col0 s -% Polyline - [15 15] 15 sd -gs clippath -4980 4605 m 4950 4725 l 4920 4605 l 4920 4740 l 4980 4740 l cp -clip -n 4950 4275 m 4950 4725 l gs col34 1.00 shd ef gr gs col0 s gr gr - [] 0 sd -% arrowhead -n 4980 4605 m 4950 4725 l 4920 4605 l 4950 4605 l 4980 4605 l cp gs col7 1.00 shd ef gr col0 s -% Polyline - [15 15] 15 sd -gs clippath -4755 6405 m 4725 6525 l 4695 6405 l 4695 6540 l 4755 6540 l cp -clip -n 4725 3825 m 4725 6525 l gs col34 1.00 shd ef gr gs col0 s gr gr - [] 0 sd -% arrowhead -n 4755 6405 m 4725 6525 l 4695 6405 l 4725 6405 l 4755 6405 l cp gs col7 1.00 shd ef gr col0 s -% Polyline - [15 15] 15 sd -gs clippath -4530 3705 m 4500 3825 l 4470 3705 l 4470 3840 l 4530 3840 l cp -clip -n 4500 3375 m 4500 3825 l gs col34 1.00 shd ef gr gs col0 s gr gr - [] 0 sd -% arrowhead -n 4530 3705 m 4500 3825 l 4470 3705 l 4500 3705 l 4530 3705 l cp gs col7 1.00 shd ef gr col0 s -% Polyline - [15 15] 15 sd -gs clippath -4305 3255 m 4275 3375 l 4245 3255 l 4245 3390 l 4305 3390 l cp -clip -n 4275 2925 m 4275 3375 l gs col34 1.00 shd ef gr gs col0 s gr gr - [] 0 sd -% arrowhead -n 4305 3255 m 4275 3375 l 4245 3255 l 4275 3255 l 4305 3255 l cp gs col7 1.00 shd ef gr col0 s -% Polyline - [15 15] 15 sd -gs clippath -4080 2805 m 4050 2925 l 4020 2805 l 4020 2940 l 4080 2940 l cp -clip -n 4050 2475 m 4050 2925 l gs col34 1.00 shd ef gr gs col0 s gr gr - [] 0 sd -% arrowhead -n 4080 2805 m 4050 2925 l 4020 2805 l 4050 2805 l 4080 2805 l cp gs col7 1.00 shd ef gr col0 s -% Polyline - [15 15] 15 sd -gs clippath -2670 2145 m 2700 2025 l 2730 2145 l 2730 2010 l 2670 2010 l cp -clip -n 2700 6525 m 2700 2025 l gs col34 1.00 shd ef gr gs col0 s gr gr - [] 0 sd -% arrowhead -n 2670 2145 m 2700 2025 l 2730 2145 l 2700 2145 l 2670 2145 l cp gs 0.00 setgray ef gr col0 s -% Polyline - [15 15] 15 sd -gs clippath -3855 6405 m 3825 6525 l 3795 6405 l 3795 6540 l 3855 6540 l cp -clip -n 3825 2025 m 3825 6525 l gs col34 1.00 shd ef gr gs col0 s gr gr - [] 0 sd -% arrowhead -n 3855 6405 m 3825 6525 l 3795 6405 l 3825 6405 l 3855 6405 l cp gs col7 1.00 shd ef gr col0 s -% Polyline - [15 15] 15 sd -gs clippath -3630 1905 m 3600 2025 l 3570 1905 l 3570 2040 l 3630 2040 l cp -clip -n 3600 1575 m 3600 2025 l gs col34 1.00 shd ef gr gs col0 s gr gr - [] 0 sd -% arrowhead -n 3630 1905 m 3600 2025 l 3570 1905 l 3600 1905 l 3630 1905 l cp gs col7 1.00 shd ef gr col0 s -% Polyline - [15 15] 15 sd -gs clippath -2895 1695 m 2925 1575 l 2955 1695 l 2955 1560 l 2895 1560 l cp -clip -n 2925 2025 m 2925 1575 l gs col34 1.00 shd ef gr gs col0 s gr gr - [] 0 sd -% arrowhead -n 2895 1695 m 2925 1575 l 2955 1695 l 2925 1695 l 2895 1695 l cp gs 0.00 setgray ef gr col0 s -% Polyline -45.000 slw -gs clippath -6087 6495 m 6207 6525 l 6087 6555 l 6360 6555 l 6360 6495 l cp -clip -n 540 6525 m 6300 6525 l gs 0.00 setgray ef gr gs col0 s gr gr - -% arrowhead -n 6087 6495 m 6207 6525 l 6087 6555 l 6087 6525 l 6087 6495 l cp gs 0.00 setgray ef gr col0 s -% Polyline -7.500 slw -gs clippath -3681 6720 m 3825 6750 l 3681 6780 l 3840 6780 l 3840 6720 l cp -2844 6780 m 2700 6750 l 2844 6720 l 2685 6720 l 2685 6780 l cp -clip -n 2700 6750 m 3825 6750 l gs col34 1.00 shd ef gr gs col0 s gr gr - -% arrowhead -n 2844 6780 m 2700 6750 l 2844 6720 l 2820 6750 l 2844 6780 l cp gs col7 1.00 shd ef gr col0 s -% arrowhead -n 3681 6720 m 3825 6750 l 3681 6780 l 3705 6750 l 3681 6720 l cp gs col7 1.00 shd ef gr col0 s -% Polyline -gs clippath -5256 7170 m 5400 7200 l 5256 7230 l 5415 7230 l 5415 7170 l cp -1269 7230 m 1125 7200 l 1269 7170 l 1110 7170 l 1110 7230 l cp -clip -n 1125 7200 m 5400 7200 l gs col34 1.00 shd ef gr gs col0 s gr gr - -% arrowhead -n 1269 7230 m 1125 7200 l 1269 7170 l 1245 7200 l 1269 7230 l cp gs col7 1.00 shd ef gr col0 s -% arrowhead -n 5256 7170 m 5400 7200 l 5256 7230 l 5280 7200 l 5256 7170 l cp gs col7 1.00 shd ef gr col0 s -% Polyline -gs clippath -4581 6945 m 4725 6975 l 4581 7005 l 4740 7005 l 4740 6945 l cp -1944 7005 m 1800 6975 l 1944 6945 l 1785 6945 l 1785 7005 l cp -clip -n 1800 6975 m 4725 6975 l gs col34 1.00 shd ef gr gs col0 s gr gr - -% arrowhead -n 1944 7005 m 1800 6975 l 1944 6945 l 1920 6975 l 1944 7005 l cp gs col7 1.00 shd ef gr col0 s -% arrowhead -n 4581 6945 m 4725 6975 l 4581 7005 l 4605 6975 l 4581 6945 l cp gs col7 1.00 shd ef gr col0 s -% Polyline -gs clippath -5706 7395 m 5850 7425 l 5706 7455 l 5865 7455 l 5865 7395 l cp -819 7455 m 675 7425 l 819 7395 l 660 7395 l 660 7455 l cp -clip -n 675 7425 m 5850 7425 l gs col34 1.00 shd ef gr gs col0 s gr gr - -% arrowhead -n 819 7455 m 675 7425 l 819 7395 l 795 7425 l 819 7455 l cp gs col7 1.00 shd ef gr col0 s -% arrowhead -n 5706 7395 m 5850 7425 l 5706 7455 l 5730 7425 l 5706 7395 l cp gs col7 1.00 shd ef gr col0 s -% Polyline -1 slc - [15 45] 45 sd -n 675 6570 m 675 7650 l gs col34 1.00 shd ef gr gs col0 s gr [] 0 sd -% Polyline - [15 45] 45 sd -n 1125 6570 m 1125 7650 l gs col34 1.00 shd ef gr gs col0 s gr [] 0 sd -% Polyline - [15 45] 45 sd -n 1800 6570 m 1800 7650 l gs col34 1.00 shd ef gr gs col0 s gr [] 0 sd -% Polyline - [15 45] 45 sd -n 2700 6570 m 2700 7650 l gs col34 1.00 shd ef gr gs col0 s gr [] 0 sd -% Polyline - [15 45] 45 sd -n 3825 6570 m 3825 7650 l gs col34 1.00 shd ef gr gs col0 s gr [] 0 sd -% Polyline - [15 45] 45 sd -n 4725 6570 m 4725 7650 l gs col34 1.00 shd ef gr gs col0 s gr [] 0 sd -% Polyline - [15 45] 45 sd -n 5400 6570 m 5400 7650 l gs col34 1.00 shd ef gr gs col0 s gr [] 0 sd -% Polyline - [15 45] 45 sd -n 5850 6570 m 5850 7650 l gs col34 1.00 shd ef gr gs col0 s gr [] 0 sd -% Polyline -0 slc -n 750 225 m 450 225 450 1050 300 arcto 4 {pop} repeat - 450 1350 12300 1350 300 arcto 4 {pop} repeat - 12600 1350 12600 525 300 arcto 4 {pop} repeat - 12600 225 750 225 300 arcto 4 {pop} repeat - cp gs col34 1.00 shd ef gr gs col0 s gr -% Polyline -n 8835 2250 m 8775 2250 8775 2415 60 arcto 4 {pop} repeat - 8775 2475 10110 2475 60 arcto 4 {pop} repeat - 10170 2475 10170 2310 60 arcto 4 {pop} repeat - 10170 2250 8835 2250 60 arcto 4 {pop} repeat - cp gs col35 1.00 shd ef gr gs col35 s gr -% Polyline -n 10635 2250 m 10575 2250 10575 2415 60 arcto 4 {pop} repeat - 10575 2475 11865 2475 60 arcto 4 {pop} repeat - 11925 2475 11925 2310 60 arcto 4 {pop} repeat - 11925 2250 10635 2250 60 arcto 4 {pop} repeat - cp gs col35 1.00 shd ef gr gs col35 s gr -% Polyline -n 11490 4275 m 11430 4275 11430 4440 60 arcto 4 {pop} repeat - 11430 4500 12315 4500 60 arcto 4 {pop} repeat - 12375 4500 12375 4335 60 arcto 4 {pop} repeat - 12375 4275 11490 4275 60 arcto 4 {pop} repeat - cp gs col35 1.00 shd ef gr gs col35 s gr -% Polyline -n 11040 5175 m 10980 5175 10980 5340 60 arcto 4 {pop} repeat - 10980 5400 12315 5400 60 arcto 4 {pop} repeat - 12375 5400 12375 5235 60 arcto 4 {pop} repeat - 12375 5175 11040 5175 60 arcto 4 {pop} repeat - cp gs col35 1.00 shd ef gr gs col35 s gr -% Polyline -n 9735 5175 m 9675 5175 9675 5340 60 arcto 4 {pop} repeat - 9675 5400 10110 5400 60 arcto 4 {pop} repeat - 10170 5400 10170 5235 60 arcto 4 {pop} repeat - 10170 5175 9735 5175 60 arcto 4 {pop} repeat - cp gs col35 1.00 shd ef gr gs col35 s gr -% Polyline -n 7260 6075 m 7200 6075 7200 6240 60 arcto 4 {pop} repeat - 7200 6300 7815 6300 60 arcto 4 {pop} repeat - 7875 6300 7875 6135 60 arcto 4 {pop} repeat - 7875 6075 7260 6075 60 arcto 4 {pop} repeat - cp gs col35 1.00 shd ef gr gs col35 s gr -% Polyline -n 6810 2250 m 6750 2250 6750 2415 60 arcto 4 {pop} repeat - 6750 2475 8130 2475 60 arcto 4 {pop} repeat - 8190 2475 8190 2310 60 arcto 4 {pop} repeat - 8190 2250 6810 2250 60 arcto 4 {pop} repeat - cp gs col35 1.00 shd ef gr gs col35 s gr -% Polyline -n 6360 3375 m 6300 3375 6300 3540 60 arcto 4 {pop} repeat - 6300 3600 7545 3600 60 arcto 4 {pop} repeat - 7605 3600 7605 3435 60 arcto 4 {pop} repeat - 7605 3375 6360 3375 60 arcto 4 {pop} repeat - cp gs col35 1.00 shd ef gr gs col35 s gr -% Polyline -n 6360 4275 m 6300 4275 6300 4440 60 arcto 4 {pop} repeat - 6300 4500 7275 4500 60 arcto 4 {pop} repeat - 7335 4500 7335 4335 60 arcto 4 {pop} repeat - 7335 4275 6360 4275 60 arcto 4 {pop} repeat - cp gs col35 1.00 shd ef gr gs col35 s gr -% Polyline -n 6360 5175 m 6300 5175 6300 5340 60 arcto 4 {pop} repeat - 6300 5400 7140 5400 60 arcto 4 {pop} repeat - 7200 5400 7200 5235 60 arcto 4 {pop} repeat - 7200 5175 6360 5175 60 arcto 4 {pop} repeat - cp gs col35 1.00 shd ef gr gs col35 s gr -% Polyline -gs clippath -7365 5340 m 7245 5310 l 7365 5280 l 7230 5280 l 7230 5340 l cp -clip -n 9630 5310 m 7245 5310 l gs col34 1.00 shd ef gr gs col0 s gr gr - -% arrowhead -n 7365 5340 m 7245 5310 l 7365 5280 l 7365 5310 l 7365 5340 l cp gs 0.00 setgray ef gr col0 s -% Polyline -gs clippath -7500 4395 m 7380 4365 l 7500 4335 l 7365 4335 l 7365 4395 l cp -clip -n 11385 4365 m 7380 4365 l gs col34 1.00 shd ef gr gs col0 s gr gr - -% arrowhead -n 7500 4395 m 7380 4365 l 7500 4335 l 7500 4365 l 7500 4395 l cp gs 0.00 setgray ef gr col0 s -% Polyline -n 11040 5580 m 10980 5580 10980 5745 60 arcto 4 {pop} repeat - 10980 5805 12180 5805 60 arcto 4 {pop} repeat - 12240 5805 12240 5640 60 arcto 4 {pop} repeat - 12240 5580 11040 5580 60 arcto 4 {pop} repeat - cp gs col35 1.00 shd ef gr gs col35 s gr -% Polyline -n 11040 5985 m 10980 5985 10980 6150 60 arcto 4 {pop} repeat - 10980 6210 12315 6210 60 arcto 4 {pop} repeat - 12375 6210 12375 6045 60 arcto 4 {pop} repeat - 12375 5985 11040 5985 60 arcto 4 {pop} repeat - cp gs col35 1.00 shd ef gr gs col35 s gr -% Polyline -gs clippath -9958 5554 m 9900 5445 l 10003 5514 l 9912 5414 l 9868 5454 l cp -clip -n 11205 6885 m 9900 5445 l gs col34 1.00 shd ef gr gs col0 s gr gr - -% arrowhead -n 9958 5554 m 9900 5445 l 10003 5514 l 9981 5534 l 9958 5554 l cp gs 0.00 setgray ef gr col0 s -% Polyline -n 10590 6930 m 10530 6930 10530 7095 60 arcto 4 {pop} repeat - 10530 7155 12225 7155 60 arcto 4 {pop} repeat - 12285 7155 12285 6990 60 arcto 4 {pop} repeat - 12285 6930 10590 6930 60 arcto 4 {pop} repeat - cp gs col35 1.00 shd ef gr gs col35 s gr -% Polyline -n 9690 6930 m 9630 6930 9630 7095 60 arcto 4 {pop} repeat - 9630 7155 10110 7155 60 arcto 4 {pop} repeat - 10170 7155 10170 6990 60 arcto 4 {pop} repeat - 10170 6930 9690 6930 60 arcto 4 {pop} repeat - cp gs col35 1.00 shd ef gr gs col35 s gr -/Times-Roman-iso ff 120.00 scf sf -900 7560 m -gs 1 -1 sc (Startup, Runtime, Shutdown) col0 sh gr -/Helvetica-Narrow-iso ff 120.00 scf sf -6345 2970 m -gs 1 -1 sc (ap_ctx_get\(...,) col0 sh gr -/Helvetica-Narrow-iso ff 120.00 scf sf -10800 2745 m -gs 1 -1 sc (ap_get_module_config\(...) col0 sh gr -/Helvetica-Narrow-iso ff 120.00 scf sf -10800 2880 m -gs 1 -1 sc (->per_dir_config,) col0 sh gr -/Helvetica-Narrow-iso ff 120.00 scf sf -10800 3015 m -gs 1 -1 sc (&ssl_module\)) col0 sh gr -% Polyline -n 7980 4770 m 7920 4770 7920 4935 60 arcto 4 {pop} repeat - 7920 4995 9075 4995 60 arcto 4 {pop} repeat - 9135 4995 9135 4830 60 arcto 4 {pop} repeat - 9135 4770 7980 4770 60 arcto 4 {pop} repeat - cp gs col35 1.00 shd ef gr gs col35 s gr -% Polyline -gs clippath -7340 2610 m 7425 2520 l 7393 2639 l 7459 2521 l 7406 2492 l cp -clip -n 6975 3330 m 7425 2520 l gs col34 1.00 shd ef gr gs col0 s gr gr - -% arrowhead -n 7340 2610 m 7425 2520 l 7393 2639 l 7367 2625 l 7340 2610 l cp gs 0.00 setgray ef gr col0 s -% Polyline -gs clippath -9336 2569 m 9450 2520 l 9373 2616 l 9480 2535 l 9444 2487 l cp -clip -n 7200 4230 m 9450 2520 l gs col34 1.00 shd ef gr gs col0 s gr gr - -% arrowhead -n 9336 2569 m 9450 2520 l 9373 2616 l 9354 2593 l 9336 2569 l cp gs 0.00 setgray ef gr col0 s -% Polyline -gs clippath -7321 5196 m 7200 5220 l 7296 5142 l 7174 5199 l 7199 5254 l cp -clip -n 7875 4905 m 7200 5220 l gs col34 1.00 shd ef gr gs col0 s gr gr - -% arrowhead -n 7321 5196 m 7200 5220 l 7296 5142 l 7309 5169 l 7321 5196 l cp gs 0.00 setgray ef gr col0 s -% Polyline -gs clippath -6720 4665 m 6750 4545 l 6780 4665 l 6780 4530 l 6720 4530 l cp -clip -n 6750 5130 m 6750 4545 l gs col34 1.00 shd ef gr gs col0 s gr gr - -% arrowhead -n 6720 4665 m 6750 4545 l 6780 4665 l 6750 4665 l 6720 4665 l cp gs 0.00 setgray ef gr col0 s -% Polyline - [15 15] 15 sd -gs clippath -9279 4984 m 9175 4918 l 9298 4927 l 9170 4885 l 9151 4942 l cp -clip -n 9850 5143 m 9175 4918 l gs col34 1.00 shd ef gr gs col0 s gr gr - [] 0 sd -% arrowhead -n 9279 4984 m 9175 4918 l 9298 4927 l 9289 4956 l 9279 4984 l cp gs 0.00 setgray ef gr col0 s -/Helvetica-Narrow-iso ff 120.00 scf sf -6210 4680 m -gs 1 -1 sc (->server) col0 sh gr -/Helvetica-Narrow-iso ff 120.00 scf sf -8280 6120 m -gs 1 -1 sc (ap_ctx_get\(...,"ssl"\)) col0 sh gr -/Helvetica-Narrow-iso ff 120.00 scf sf -7740 2700 m -gs 1 -1 sc (ap_get_module_config\(...) col0 sh gr -/Helvetica-Narrow-iso ff 120.00 scf sf -7740 2835 m -gs 1 -1 sc (->module_config,) col0 sh gr -/Helvetica-Narrow-iso ff 120.00 scf sf -7740 2970 m -gs 1 -1 sc (&ssl_module\)) col0 sh gr -/Helvetica-Narrow-iso ff 120.00 scf sf -6345 3105 m -gs 1 -1 sc ("ssl_module"\)) col0 sh gr -/Times-Roman-iso ff 120.00 scf sf -1350 7335 m -gs 1 -1 sc (Configuration Time) col0 sh gr -/Times-Roman-iso ff 120.00 scf sf -2025 7110 m -gs 1 -1 sc (Connection Duration) col0 sh gr -/Times-Roman-iso ff 120.00 scf sf -2835 6885 m -gs 1 -1 sc (Request Duration) col0 sh gr -/Helvetica-Bold-iso ff 300.00 scf sf -6345 6795 m -gs 1 -1 sc (t) col0 sh gr -/Helvetica-Narrow-iso ff 120.00 scf sf -7110 5985 m -gs 1 -1 sc (->client) col0 sh gr -/Helvetica-Narrow-iso ff 120.00 scf sf -7065 5085 m -gs 1 -1 sc (->connection) col0 sh gr -/Helvetica-Narrow-iso ff 120.00 scf sf -7065 4770 m -gs 1 -1 sc (->server) col0 sh gr -/Helvetica-Narrow-iso ff 120.00 scf sf -8010 5445 m -gs 1 -1 sc (SSL_get_app_data\(\)) col0 sh gr -/Helvetica-Narrow-iso ff 120.00 scf sf -10530 4050 m -gs 1 -1 sc (->pSSLCtx) col0 sh gr -/Helvetica-Narrow-iso ff 120.00 scf sf -7875 4275 m -gs 1 -1 sc (SSL_CTX_get_app_data\(\)) col0 sh gr -/Helvetica-Narrow-iso ff 120.00 scf sf -10305 5535 m -gs 1 -1 sc (SSL_get_current_cipher\(\)) col0 sh gr -/Helvetica-Narrow-iso ff 120.00 scf sf -10440 5940 m -gs 1 -1 sc (SSL_get_session\(\)) col0 sh gr -/Helvetica-Narrow-iso ff 120.00 scf sf -9540 7335 m -gs 1 -1 sc (SSL_get_{r,w}bio\(\)) col0 sh gr -/Helvetica-Narrow-iso ff 120.00 scf sf -10125 4680 m -gs 1 -1 sc (SSL_get_SSL_CTX\(\)) col0 sh gr -/Helvetica-Narrow-iso ff 120.00 scf sf -10350 5175 m -gs 1 -1 sc (SSL_get_SSL_METHOD\(\)) col0 sh gr -/Helvetica-Narrow-iso ff 120.00 scf sf -11745 4770 m -gs 1 -1 sc (->method) col0 sh gr -/Helvetica-Narrow-iso ff 120.00 scf sf -9945 6480 m -gs 1 -1 sc (X509_STORE_CTX_get_app_data\(\)) col0 sh gr -/Helvetica-Narrow-iso ff 120.00 scf sf -10980 6705 m -gs 1 -1 sc (SSL_CTX_get_cert_store\(\)) col0 sh gr -/Helvetica-Narrow-iso ff 120.00 scf sf -8280 5130 m -gs 1 -1 sc (SSL_get_app_data2\(\)) col0 sh gr -/Helvetica-Bold-iso ff 180.00 scf sf -3645 1620 m -gs 1 -1 sc (SSLDirConfig) col0 sh gr -/Helvetica-Bold-iso ff 300.00 scf sf -10935 3645 m -gs 1 -1 sc (OpenSSL) col0 sh gr -/Helvetica-Bold-iso ff 180.00 scf sf -10935 3825 m -gs 1 -1 sc ([SSL]) col0 sh gr -/Helvetica-Bold-iso ff 180.00 scf sf -11025 5760 m -gs 1 -1 sc (SSL_CIPHER) col0 sh gr -/Helvetica-Bold-iso ff 180.00 scf sf -10980 6165 m -gs 1 -1 sc (SSL_SESSION) col0 sh gr -/Helvetica-Bold-iso ff 300.00 scf sf -10710 7605 m -gs 1 -1 sc (OpenSSL) col0 sh gr -/Helvetica-Bold-iso ff 180.00 scf sf -10575 7110 m -gs 1 -1 sc (X509_STORE_CTX) col0 sh gr -/Helvetica-Bold-iso ff 180.00 scf sf -6795 2430 m -gs 1 -1 sc (SSLModConfig) col0 sh gr -/Helvetica-Bold-iso ff 180.00 scf sf -8865 2430 m -gs 1 -1 sc (SSLSrvConfig) col0 sh gr -/Helvetica-Bold-iso ff 180.00 scf sf -6345 3555 m -gs 1 -1 sc (ap_global_ctx) col0 sh gr -/Helvetica-Bold-iso ff 180.00 scf sf -6345 4455 m -gs 1 -1 sc (server_rec) col0 sh gr -/Helvetica-Bold-iso ff 180.00 scf sf -6345 5355 m -gs 1 -1 sc (conn_rec) col0 sh gr -/Helvetica-Bold-iso ff 180.00 scf sf -9720 5355 m -gs 1 -1 sc (SSL) col0 sh gr -/Helvetica-Bold-iso ff 180.00 scf sf -10665 2430 m -gs 1 -1 sc (SSLDirConfig) col0 sh gr -/Helvetica-Bold-iso ff 180.00 scf sf -7290 6255 m -gs 1 -1 sc (BUFF) col0 sh gr -/Helvetica-Bold-iso ff 180.00 scf sf -11025 5355 m -gs 1 -1 sc (SSL_METHOD) col0 sh gr -% Polyline -15.000 slw -n 750 225 m 450 225 450 8250 300 arcto 4 {pop} repeat - 450 8550 12300 8550 300 arcto 4 {pop} repeat - 12600 8550 12600 525 300 arcto 4 {pop} repeat - 12600 225 750 225 300 arcto 4 {pop} repeat - cp gs col0 s gr -/Helvetica-Bold-iso ff 180.00 scf sf -11475 4455 m -gs 1 -1 sc (SSL_CTX) col0 sh gr -/Helvetica-Bold-iso ff 180.00 scf sf -8010 4950 m -gs 1 -1 sc (request_rec) col0 sh gr -/Times-Roman-iso ff 180.00 scf sf -10575 675 m -gs 1 -1 sc (Ralf S. Engelschall) col0 sh gr -/Helvetica-Bold-iso ff 300.00 scf sf -4275 675 m -gs 1 -1 sc (Apache+mod_ssl+OpenSSL) col0 sh gr -/Times-Roman-iso ff 150.00 scf sf -10575 855 m -gs 1 -1 sc (rse@engelschall.com) col0 sh gr -/Times-Roman-iso ff 150.00 scf sf -10575 1035 m -gs 1 -1 sc (www.engelschall.com) col0 sh gr -/Times-Roman-iso ff 180.00 scf sf -900 675 m -gs 1 -1 sc (Version 1.3) col0 sh gr -/Times-Roman-iso ff 180.00 scf sf -900 855 m -gs 1 -1 sc (12-Apr-1999) col0 sh gr -/Helvetica-Bold-iso ff 360.00 scf sf -3915 1080 m -gs 1 -1 sc (Data Structure Overview) col0 sh gr -/Helvetica-Bold-iso ff 180.00 scf sf -9720 7110 m -gs 1 -1 sc (BIO) col0 sh gr -/Helvetica-Bold-iso ff 180.00 scf sf -10710 7785 m -gs 1 -1 sc ([Crypto]) col0 sh gr -/Helvetica-Bold-iso ff 300.00 scf sf -8730 3465 m -gs 1 -1 sc (mod_ssl) col0 sh gr -/Helvetica-Bold-iso ff 300.00 scf sf -8145 6750 m -gs 1 -1 sc (Apache) col0 sh gr -/Helvetica-Bold-iso ff 300.00 scf sf -9000 8100 m -gs 1 -1 sc (Chaining) col0 sh gr -/Helvetica-Bold-iso ff 300.00 scf sf -2745 8100 m -gs 1 -1 sc (Lifetime) col0 sh gr -/Helvetica-Bold-iso ff 180.00 scf sf -810 6255 m -gs 1 -1 sc (ap_global_ctx) col0 sh gr -/Helvetica-Bold-iso ff 180.00 scf sf -990 5805 m -gs 1 -1 sc (SSLModConfig) col0 sh gr -/Helvetica-Bold-iso ff 180.00 scf sf -4050 4455 m -gs 1 -1 sc (SSL_CTX) col0 sh gr -/Helvetica-Bold-iso ff 180.00 scf sf -4455 5355 m -gs 1 -1 sc (server_rec) col0 sh gr -/Helvetica-Bold-iso ff 180.00 scf sf -3870 4905 m -gs 1 -1 sc (SSLSrvConfig) col0 sh gr -/Helvetica-Bold-iso ff 180.00 scf sf -1845 4005 m -gs 1 -1 sc (BUFF) col0 sh gr -/Helvetica-Bold-iso ff 180.00 scf sf -2070 3555 m -gs 1 -1 sc (conn_rec) col0 sh gr -/Helvetica-Bold-iso ff 180.00 scf sf -2295 3105 m -gs 1 -1 sc (BIO) col0 sh gr -/Helvetica-Bold-iso ff 180.00 scf sf -2565 2655 m -gs 1 -1 sc (SSL) col0 sh gr -/Helvetica-Bold-iso ff 180.00 scf sf -3915 2070 m -gs 1 -1 sc (request_rec) col0 sh gr -$F2psEnd -rs -showpage diff --git a/modules/ssl/config.m4 b/modules/ssl/config.m4 deleted file mode 100644 index 4eeefd7b797ce63f1b17858a1f6381b72c4f74be..0000000000000000000000000000000000000000 --- a/modules/ssl/config.m4 +++ /dev/null @@ -1,160 +0,0 @@ -dnl ## ==================================================================== -dnl ## The Apache Software License, Version 1.1 -dnl ## -dnl ## Copyright (c) 2000-2001 The Apache Software Foundation. All rights -dnl ## reserved. -dnl ## -dnl ## Redistribution and use in source and binary forms, with or without -dnl ## modification, are permitted provided that the following conditions -dnl ## are met: -dnl ## -dnl ## 1. Redistributions of source code must retain the above copyright -dnl ## notice, this list of conditions and the following disclaimer. -dnl ## -dnl ## 2. Redistributions in binary form must reproduce the above copyright -dnl ## notice, this list of conditions and the following disclaimer in -dnl ## the documentation and/or other materials provided with the -dnl ## distribution. -dnl ## -dnl ## 3. The end-user documentation included with the redistribution, -dnl ## if any, must include the following acknowledgment: -dnl ## "This product includes software developed by the -dnl ## Apache Software Foundation (http://www.apache.org/)." -dnl ## Alternately, this acknowledgment may appear in the software itself, -dnl ## if and wherever such third-party acknowledgments normally appear. -dnl ## -dnl ## 4. The names "Apache" and "Apache Software Foundation" must -dnl ## not be used to endorse or promote products derived from this -dnl ## software without prior written permission. For written -dnl ## permission, please contact apache@apache.org. -dnl ## -dnl ## 5. Products derived from this software may not be called "Apache", -dnl ## nor may "Apache" appear in their name, without prior written -dnl ## permission of the Apache Software Foundation. -dnl ## -dnl ## THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED -dnl ## WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES -dnl ## OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE -dnl ## DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR -dnl ## ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -dnl ## SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -dnl ## LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF -dnl ## USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND -dnl ## ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, -dnl ## OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT -dnl ## OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF -dnl ## SUCH DAMAGE. -dnl ## ==================================================================== - -dnl # start of module specific part -APACHE_MODPATH_INIT(ssl) - -dnl # list of module object files -ssl_objs="mod_ssl.lo" -ssl_objs="$ssl_objs ssl_engine_config.lo" - -dnl # hook module into the Autoconf mechanism (--enable-ssl option) -APACHE_MODULE(ssl, [SSL/TLS support (mod_ssl)], $ssl_objs, , no, [ - - dnl # hook into Autoconf mechanism (--with-ssl[=DIR] option) - AC_MSG_CHECKING(for SSL/TLS toolkit base) - ssltk_base="SYSTEM" - AC_ARG_WITH(ssl, [ --with-ssl[=DIR] SSL/TLS toolkit (OpenSSL)], [ - if test ".$withval" != .yes -a ".$withval" != .; then - ssltk_base="$withval" - if test ! -d $ssltk_base; then - AC_MSG_ERROR([invalid SSL/TLS toolkit base directory $ssltk_base]) - fi - fi - ]) - AC_MSG_RESULT($ssltk_base) - - dnl # determine SSL/TLS toolkit frontend (openssl binary) - AC_MSG_CHECKING(for SSL/TLS toolkit frontend) - ssltk_frontend="" - if test ".$ssltk_base" = .SYSTEM; then - for p in . `echo $PATH | sed -e 's/:/ /g'`; do - if test -f "$p/openssl"; then - ssltk_frontend="$p/openssl" - break - fi - done - if test ".$ssltk_frontend" = .; then - AC_MSG_ERROR(['openssl' not found in $PATH]) - fi - else - if test -f "$ssltk_base/bin/openssl"; then - ssltk_frontend="$ssltk_base/bin/openssl" - else - AC_MSG_ERROR(['openssl' not found in $ssltk_base/bin/]) - fi - fi - AC_MSG_RESULT($ssltk_frontend) - - dnl # determine SSL/TLS toolkit version - AC_MSG_CHECKING(for SSL/TLS toolkit version) - ssltk_version="`$ssltk_frontend version`" - case "$ssltk_version" in - *0.9.[[6789]]* ) ;; - * ) AC_MSG_ERROR([SSL/TLS toolkit version $ssltk_version not supported]) ;; - esac - AC_MSG_RESULT($ssltk_version) - - dnl # determine SSL/TLS toolkit include directory - AC_MSG_CHECKING(for SSL/TLS toolkit includes) - ssltk_incdir="" - if test ".$ssltk_base" = .SYSTEM; then - for p in . /usr/include /usr/include/ssl/ /usr/local/include /usr/local/include/ssl; do - if test -f "$p/openssl/ssl.h"; then - ssltk_incdir="$p" - break - fi - done - if test ".$ssltk_incdir" = .; then - AC_MSG_ERROR([OpenSSL headers not found]) - fi - else - if test -f "$ssltk_base/include/openssl/ssl.h"; then - ssltk_incdir="$ssltk_base/include" - else - AC_MSG_ERROR([OpenSSL headers not found under $ssltk_base]) - fi - fi - AC_MSG_RESULT($ssltk_incdir) - - dnl # determine SSL/TLS toolkit library directory - AC_MSG_CHECKING(for SSL/TLS toolkit libraries) - ssltk_libdir="" - if test ".$ssltk_base" = .SYSTEM; then - for p in . /lib /usr/lib /usr/local/lib; do - if test -f "$p/libssl.a" -o -f "$p/libssl.so"; then - ssltk_libdir="$p" - break - fi - done - if test ".$ssltk_libdir" = .; then - AC_MSG_ERROR([OpenSSL libraries not found]) - fi - else - if test -f "$ssltk_base/libssl.a" -o -f "$ssltk_base/libssl.so"; then - ssltk_libdir="$ssltk_base" - elif test -f "$ssltk_base/lib/libssl.a" -o -f "$ssltk_base/lib/libssl.so"; then - ssltk_libdir="$ssltk_base/lib" - else - AC_MSG_ERROR([OpenSSL libraries not found under $ssltk_base]) - fi - fi - AC_MSG_RESULT($ssltk_libdir) - - dnl # annotate the Apache build environment with determined information - if test ".$ssltk_incdir" != "./usr/include"; then - INCLUDES="$INCLUDES -I$ssltk_incdir" - fi - if test ".$ssltk_libdir" != "./usr/lib"; then - LIBS="$LIBS -L$ssltk_libdir -lssl -lcrypto" - fi -]) - -dnl # end of module specific part -APACHE_MODPATH_FINISH - diff --git a/modules/ssl/mod_ssl.c b/modules/ssl/mod_ssl.c deleted file mode 100644 index 2d1b5e1b0aa2baaba9203668ea3d64dc8c1a6e03..0000000000000000000000000000000000000000 --- a/modules/ssl/mod_ssl.c +++ /dev/null @@ -1,248 +0,0 @@ -/* _ _ -** _ __ ___ ___ __| | ___ ___| | mod_ssl -** | '_ ` _ \ / _ \ / _` | / __/ __| | Apache Interface to OpenSSL -** | | | | | | (_) | (_| | \__ \__ \ | www.modssl.org -** |_| |_| |_|\___/ \__,_|___|___/___/_| ftp.modssl.org -** |_____| -** mod_ssl.c -** Apache API interface structures -*/ - -/* ==================================================================== - * Copyright (c) 1998-2001 Ralf S. Engelschall. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following - * disclaimer in the documentation and/or other materials - * provided with the distribution. - * - * 3. All advertising materials mentioning features or use of this - * software must display the following acknowledgment: - * "This product includes software developed by - * Ralf S. Engelschall for use in the - * mod_ssl project (http://www.modssl.org/)." - * - * 4. The names "mod_ssl" must not be used to endorse or promote - * products derived from this software without prior written - * permission. For written permission, please contact - * rse@engelschall.com. - * - * 5. Products derived from this software may not be called "mod_ssl" - * nor may "mod_ssl" appear in their names without prior - * written permission of Ralf S. Engelschall. - * - * 6. Redistributions of any form whatsoever must retain the following - * acknowledgment: - * "This product includes software developed by - * Ralf S. Engelschall for use in the - * mod_ssl project (http://www.modssl.org/)." - * - * THIS SOFTWARE IS PROVIDED BY RALF S. ENGELSCHALL ``AS IS'' AND ANY - * EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR - * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL RALF S. ENGELSCHALL OR - * HIS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT - * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, - * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED - * OF THE POSSIBILITY OF SUCH DAMAGE. - * ==================================================================== - */ - /* ``I'll be surprised if - others think that what you - are doing is honourable.'' - -- Ben Laurie, Apache-SSL author */ -#include "mod_ssl.h" - -/* _________________________________________________________________ -** -** Apache API glue structures -** _________________________________________________________________ -*/ - -/* - * identify the module to SCCS `what' and RCS `ident' commands - */ -static char const sccsid[] = "@(#) mod_ssl/" MOD_SSL_VERSION " >"; -static char const rcsid[] = "$Id: mod_ssl.c,v 1.1 2001/05/04 21:54:42 rse Exp $"; - -/* - * the table of configuration directives we provide - */ -static command_rec ssl_config_cmds[] = { - /* - * Global (main-server) context configuration directives - */ - AP_SRV_CMD(Mutex, TAKE1, - "SSL lock for handling internal mutual exclusions " - "(`none', `file:/path/to/file')") - AP_SRV_CMD(PassPhraseDialog, TAKE1, - "SSL dialog mechanism for the pass phrase query " - "(`builtin', `exec:/path/to/program')") - AP_SRV_CMD(SessionCache, TAKE1, - "SSL Session Cache storage " - "(`none', `dbm:/path/to/file')") -#ifdef SSL_EXPERIMENTAL_ENGINE - AP_SRV_CMD(CryptoDevice, TAKE1, - "SSL external Crypto Device usage " - "(`builtin', `...')") -#endif - AP_SRV_CMD(RandomSeed, TAKE23, - "SSL Pseudo Random Number Generator (PRNG) seeding source " - "(`startup|connect builtin|file:/path|exec:/path [bytes]')") - - /* - * Per-server context configuration directives - */ - AP_SRV_CMD(Engine, FLAG, - "SSL switch for the protocol engine " - "(`on', `off')") - AP_ALL_CMD(CipherSuite, TAKE1, - "Colon-delimited list of permitted SSL Ciphers " - "(`XXX:...:XXX' - see manual)") - AP_SRV_CMD(CertificateFile, TAKE1, - "SSL Server Certificate file " - "(`/path/to/file' - PEM or DER encoded)") - AP_SRV_CMD(CertificateKeyFile, TAKE1, - "SSL Server Private Key file " - "(`/path/to/file' - PEM or DER encoded)") - AP_SRV_CMD(CertificateChainFile, TAKE1, - "SSL Server CA Certificate Chain file " - "(`/path/to/file' - PEM encoded)") -#ifdef SSL_EXPERIMENTAL_PERDIRCA - AP_ALL_CMD(CACertificatePath, TAKE1, - "SSL CA Certificate path " - "(`/path/to/dir' - contains PEM encoded files)") - AP_ALL_CMD(CACertificateFile, TAKE1, - "SSL CA Certificate file " - "(`/path/to/file' - PEM encoded)") -#else - AP_SRV_CMD(CACertificatePath, TAKE1, - "SSL CA Certificate path " - "(`/path/to/dir' - contains PEM encoded files)") - AP_SRV_CMD(CACertificateFile, TAKE1, - "SSL CA Certificate file " - "(`/path/to/file' - PEM encoded)") -#endif - AP_SRV_CMD(CARevocationPath, TAKE1, - "SSL CA Certificate Revocation List (CRL) path " - "(`/path/to/dir' - contains PEM encoded files)") - AP_SRV_CMD(CARevocationFile, TAKE1, - "SSL CA Certificate Revocation List (CRL) file " - "(`/path/to/file' - PEM encoded)") - AP_ALL_CMD(VerifyClient, TAKE1, - "SSL Client verify type " - "(`none', `optional', `require', `optional_no_ca')") - AP_ALL_CMD(VerifyDepth, TAKE1, - "SSL Client verify depth " - "(`N' - number of intermediate certificates)") - AP_SRV_CMD(SessionCacheTimeout, TAKE1, - "SSL Session Cache object lifetime " - "(`N' - number of seconds)") - AP_SRV_CMD(Log, TAKE1, - "SSL logfile for SSL-related messages " - "(`/path/to/file', `|/path/to/program')") - AP_SRV_CMD(LogLevel, TAKE1, - "SSL logfile verbosity level " - "(`none', `error', `warn', `info', `debug')") - AP_SRV_CMD(Protocol, RAW_ARGS, - "Enable or disable various SSL protocols" - "(`[+-][SSLv2|SSLv3|TLSv1] ...' - see manual)") - -#ifdef SSL_EXPERIMENTAL_PROXY - /* - * Proxy configuration for remote SSL connections - */ - AP_SRV_CMD(ProxyProtocol, RAW_ARGS, - "SSL Proxy: enable or disable SSL protocol flavors " - "(`[+-][SSLv2|SSLv3|TLSv1] ...' - see manual)") - AP_SRV_CMD(ProxyCipherSuite, TAKE1, - "SSL Proxy: colon-delimited list of permitted SSL ciphers " - "(`XXX:...:XXX' - see manual)") - AP_SRV_CMD(ProxyVerify, FLAG, - "SSL Proxy: whether to verify the remote certificate " - "(`on' or `off')") - AP_SRV_CMD(ProxyVerifyDepth, TAKE1, - "SSL Proxy: maximum certificate verification depth " - "(`N' - number of intermediate certificates)") - AP_SRV_CMD(ProxyCACertificateFile, TAKE1, - "SSL Proxy: file containing server certificates " - "(`/path/to/file' - PEM encoded certificates)") - AP_SRV_CMD(ProxyCACertificatePath, TAKE1, - "SSL Proxy: directory containing server certificates " - "(`/path/to/dir' - contains PEM encoded certificates)") - AP_SRV_CMD(ProxyMachineCertificateFile, TAKE1, - "SSL Proxy: file containing client certificates " - "(`/path/to/file' - PEM encoded certificates)") - AP_SRV_CMD(ProxyMachineCertificatePath, TAKE1, - "SSL Proxy: directory containing client certificates " - "(`/path/to/dir' - contains PEM encoded certificates)") -#endif - - /* - * Per-directory context configuration directives - */ - AP_DIR_CMD(Options, OPTIONS, RAW_ARGS, - "Set one of more options to configure the SSL engine" - "(`[+-]option[=value] ...' - see manual)") - AP_DIR_CMD(RequireSSL, AUTHCFG, NO_ARGS, - "Require the SSL protocol for the per-directory context " - "(no arguments)") - AP_DIR_CMD(Require, AUTHCFG, RAW_ARGS, - "Require a boolean expresion to evaluate to true for granting access" - "(arbitrary complex boolean expression - see manual)") - - AP_END_CMD -}; - -static const handler_rec ssl_config_handler[] = { - { "mod_ssl:content-handler", ssl_hook_Handler }, - { NULL, NULL } -}; - -/* - * the main Apache API config structure - */ -module MODULE_VAR_EXPORT ssl_module = { - STANDARD_MODULE_STUFF, - - /* Standard API (always present) */ - - ssl_init_Module, /* module initializer */ - ssl_config_perdir_create, /* create per-dir config structures */ - ssl_config_perdir_merge, /* merge per-dir config structures */ - ssl_config_server_create, /* create per-server config structures */ - ssl_config_server_merge, /* merge per-server config structures */ - ssl_config_cmds, /* table of config file commands */ - ssl_config_handler, /* [#8] MIME-typed-dispatched handlers */ - ssl_hook_Translate, /* [#1] URI to filename translation */ - ssl_hook_Auth, /* [#4] validate user id from request */ - ssl_hook_UserCheck, /* [#5] check if the user is ok _here_ */ - ssl_hook_Access, /* [#3] check access by host address */ - NULL, /* [#6] determine MIME type */ - ssl_hook_Fixup, /* [#7] pre-run fixups */ - NULL, /* [#9] log a transaction */ - NULL, /* [#2] header parser */ - ssl_init_Child, /* child_init */ - NULL, /* child_exit */ - ssl_hook_ReadReq, /* [#0] post read-request */ - - /* Extended API (forced to be enabled with mod_ssl) */ - - ssl_hook_AddModule, /* after modules was added to core */ - ssl_hook_RemoveModule, /* before module is removed from core */ - ssl_hook_RewriteCommand, /* configuration command rewriting */ - ssl_hook_NewConnection, /* socket connection open */ - ssl_hook_CloseConnection /* socket connection close */ -}; - diff --git a/modules/ssl/mod_ssl.dsp b/modules/ssl/mod_ssl.dsp deleted file mode 100644 index c1f46dfb83685c0a0b35564d49507224ac201c67..0000000000000000000000000000000000000000 --- a/modules/ssl/mod_ssl.dsp +++ /dev/null @@ -1,217 +0,0 @@ -# Microsoft Developer Studio Project File - Name="mod_ssl" - Package Owner=<4> -# Microsoft Developer Studio Generated Build File, Format Version 6.00 -# ** DO NOT EDIT ** - -# TARGTYPE "Win32 (x86) Dynamic-Link Library" 0x0102 - -CFG=mod_ssl - Win32 Release -!MESSAGE This is not a valid makefile. To build this project using NMAKE, -!MESSAGE use the Export Makefile command and run -!MESSAGE -!MESSAGE NMAKE /f "mod_ssl.mak". -!MESSAGE -!MESSAGE You can specify a configuration when running NMAKE -!MESSAGE by defining the macro CFG on the command line. For example: -!MESSAGE -!MESSAGE NMAKE /f "mod_ssl.mak" CFG="mod_ssl - Win32 Release" -!MESSAGE -!MESSAGE Possible choices for configuration are: -!MESSAGE -!MESSAGE "mod_ssl - Win32 Release" (based on "Win32 (x86) Dynamic-Link Library") -!MESSAGE "mod_ssl - Win32 Debug" (based on "Win32 (x86) Dynamic-Link Library") -!MESSAGE - -# Begin Project -# PROP AllowPerConfigDependencies 0 -# PROP Scc_ProjName "" -# PROP Scc_LocalPath "" -CPP=cl.exe -MTL=midl.exe -RSC=rc.exe - -!IF "$(CFG)" == "mod_ssl - Win32 Release" - -# PROP BASE Use_MFC 0 -# PROP BASE Use_Debug_Libraries 0 -# PROP BASE Output_Dir "Release" -# PROP BASE Intermediate_Dir "Release" -# PROP BASE Target_Dir "" -# PROP Use_MFC 0 -# PROP Use_Debug_Libraries 0 -# PROP Output_Dir "Release" -# PROP Intermediate_Dir "Release" -# PROP Ignore_Export_Lib 0 -# PROP Target_Dir "" -# ADD BASE CPP /nologo /MD /W3 /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /FD /c -# ADD CPP /nologo /MD /W3 /O2 /I "..\..\include" /I "..\..\os\win32" /I "..\..\server\mpm\winnt" /I "..\..\srclib\apr\include" /I "../../srclib/apr-util/include" /I "..\..\srclib\openssl\inc32" /D "NDEBUG" /D "WIN32" /D "_WINDOWS" /Fd"Release\mod_ssl" /FD /c -# ADD BASE MTL /nologo /D "NDEBUG" /win32 -# ADD MTL /nologo /D "NDEBUG" /mktyplib203 /win32 -# ADD BASE RSC /l 0x809 /d "NDEBUG" -# ADD RSC /l 0x809 /d "NDEBUG" -BSC32=bscmake.exe -# ADD BASE BSC32 /nologo -# ADD BSC32 /nologo -LINK32=link.exe -# ADD BASE LINK32 kernel32.lib /nologo /subsystem:windows /dll /incremental:no /map /out:"Release/mod_ssl.so" /machine:I386 /base:@..\..\os\win32\BaseAddr.ref,mod_ssl -# ADD LINK32 kernel32.lib ssleay32.lib libeay32.lib /nologo /libpath:"..\..\srclib\openssl\out32dll" /subsystem:windows /dll /incremental:no /map /out:"Release/mod_ssl.so" /machine:I386 /base:@..\..\os\win32\BaseAddr.ref,mod_ssl - -!ELSEIF "$(CFG)" == "mod_ssl - Win32 Debug" - -# PROP BASE Use_MFC 0 -# PROP BASE Use_Debug_Libraries 1 -# PROP BASE Output_Dir "Debug" -# PROP BASE Intermediate_Dir "Debug" -# PROP BASE Target_Dir "" -# PROP Use_MFC 0 -# PROP Use_Debug_Libraries 1 -# PROP Output_Dir "Debug" -# PROP Intermediate_Dir "Debug" -# PROP Ignore_Export_Lib 0 -# PROP Target_Dir "" -# ADD BASE CPP /nologo /MDd /W3 /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /FD /c -# ADD CPP /nologo /MDd /W3 /GX /ZI /Od /I "..\..\include" /I "..\..\os\win32" /I "..\..\server\mpm\winnt" /I "..\..\srclib\apr\include" /I "..\..\srclib\apr-util\include" /I "..\..\srclib\openssl\inc32" /D "_DEBUG" /D "WIN32" /D "_WINDOWS" /Fd"Debug\mod_ssl" /FD /c -# ADD BASE MTL /nologo /D "_DEBUG" /win32 -# ADD MTL /nologo /D "_DEBUG" /mktyplib203 /win32 -# ADD BASE RSC /l 0x809 /d "_DEBUG" -# ADD RSC /l 0x809 /d "_DEBUG" -BSC32=bscmake.exe -# ADD BASE BSC32 /nologo -# ADD BSC32 /nologo -LINK32=link.exe -# ADD BASE LINK32 kernel32.lib /nologo /subsystem:windows /dll /incremental:no /map /debug /out:"Debug/mod_ssl.so" /machine:I386 /base:@..\..\os\win32\BaseAddr.ref,mod_ssl -# ADD LINK32 kernel32.lib ssleay32.lib libeay32.lib /nologo /libpath:"..\..\srclib\openssl\out32dll" /subsystem:windows /dll /incremental:no /map /debug /out:"Debug/mod_ssl.so" /machine:I386 /base:@..\..\os\win32\BaseAddr.ref,mod_ssl - -!ENDIF - -# Begin Target - -# Name "mod_ssl - Win32 Release" -# Name "mod_ssl - Win32 Debug" -# Begin Group "Source Files" - -# PROP Default_Filter "*.c" -# Begin Source File - -SOURCE=.\mod_ssl.c -# End Source File -# Begin Source File - -SOURCE=.\ssl_engine_config.c -# End Source File -# Begin Source File - -SOURCE=.\ssl_engine_dh.c -# End Source File -# Begin Source File - -SOURCE=.\ssl_engine_ds.c -# End Source File -# Begin Source File - -SOURCE=.\ssl_engine_ext.c -# End Source File -# Begin Source File - -SOURCE=.\ssl_engine_init.c -# End Source File -# Begin Source File - -SOURCE=.\ssl_engine_io.c -# End Source File -# Begin Source File - -SOURCE=.\ssl_engine_kernel.c -# End Source File -# Begin Source File - -SOURCE=.\ssl_engine_log.c -# End Source File -# Begin Source File - -SOURCE=.\ssl_engine_mutex.c -# End Source File -# Begin Source File - -SOURCE=.\ssl_engine_pphrase.c -# End Source File -# Begin Source File - -SOURCE=.\ssl_engine_rand.c -# End Source File -# Begin Source File - -SOURCE=.\ssl_engine_vars.c -# End Source File -# Begin Source File - -SOURCE=.\ssl_expr.c -# End Source File -# Begin Source File - -SOURCE=.\ssl_expr_eval.c -# End Source File -# Begin Source File - -SOURCE=.\ssl_expr_parse.c -# PROP Exclude_From_Build 1 -# End Source File -# Begin Source File - -SOURCE=.\ssl_expr_scan.c -# PROP Exclude_From_Build 1 -# End Source File -# Begin Source File - -SOURCE=.\ssl_scache.c -# End Source File -# Begin Source File - -SOURCE=.\ssl_scache_dbm.c -# End Source File -# Begin Source File - -SOURCE=.\ssl_scache_shmcb.c -# End Source File -# Begin Source File - -SOURCE=.\ssl_scache_shmht.c -# End Source File -# Begin Source File - -SOURCE=.\ssl_util.c -# End Source File -# Begin Source File - -SOURCE=.\ssl_util_ssl.c -# End Source File -# Begin Source File - -SOURCE=.\ssl_util_table.c -# End Source File -# End Group -# Begin Group "Header Files" - -# PROP Default_Filter "*.h" -# Begin Source File - -SOURCE=.\mod_ssl.h -# End Source File -# Begin Source File - -SOURCE=.\ssl_expr.h -# End Source File -# Begin Source File - -SOURCE=.\ssl_expr_parse.h -# End Source File -# Begin Source File - -SOURCE=.\ssl_util_ssl.h -# End Source File -# Begin Source File - -SOURCE=.\ssl_util_table.h -# End Source File -# End Group -# End Target -# End Project diff --git a/modules/ssl/mod_ssl.h b/modules/ssl/mod_ssl.h deleted file mode 100644 index 8731ef9de4800082f8b948443ddf2ebb03193123..0000000000000000000000000000000000000000 --- a/modules/ssl/mod_ssl.h +++ /dev/null @@ -1,854 +0,0 @@ -/* _ _ -** _ __ ___ ___ __| | ___ ___| | mod_ssl -** | '_ ` _ \ / _ \ / _` | / __/ __| | Apache Interface to OpenSSL -** | | | | | | (_) | (_| | \__ \__ \ | www.modssl.org -** |_| |_| |_|\___/ \__,_|___|___/___/_| ftp.modssl.org -** |_____| -** mod_ssl.h -** Global header -*/ - -/* ==================================================================== - * Copyright (c) 1998-2001 Ralf S. Engelschall. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following - * disclaimer in the documentation and/or other materials - * provided with the distribution. - * - * 3. All advertising materials mentioning features or use of this - * software must display the following acknowledgment: - * "This product includes software developed by - * Ralf S. Engelschall for use in the - * mod_ssl project (http://www.modssl.org/)." - * - * 4. The names "mod_ssl" must not be used to endorse or promote - * products derived from this software without prior written - * permission. For written permission, please contact - * rse@engelschall.com. - * - * 5. Products derived from this software may not be called "mod_ssl" - * nor may "mod_ssl" appear in their names without prior - * written permission of Ralf S. Engelschall. - * - * 6. Redistributions of any form whatsoever must retain the following - * acknowledgment: - * "This product includes software developed by - * Ralf S. Engelschall for use in the - * mod_ssl project (http://www.modssl.org/)." - * - * THIS SOFTWARE IS PROVIDED BY RALF S. ENGELSCHALL ``AS IS'' AND ANY - * EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR - * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL RALF S. ENGELSCHALL OR - * HIS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT - * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, - * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED - * OF THE POSSIBILITY OF SUCH DAMAGE. - * ==================================================================== - */ - /* ``The Apache Group: a collection - of talented individuals who are - trying to perfect the art of - never finishing something.'' - -- Rob Hartill */ -#ifndef MOD_SSL_H -#define MOD_SSL_H 1 - -/* - * Check whether Extended API (EAPI) is enabled - */ -#ifndef EAPI -#error "mod_ssl requires Extended API (EAPI)" -#endif - -/* - * Optionally enable the experimental stuff, but allow the user to - * override the decision which experimental parts are included by using - * CFLAGS="-DSSL_EXPERIMENTAL_xxxx_IGNORE". - */ -#ifdef SSL_EXPERIMENTAL -#ifndef SSL_EXPERIMENTAL_PERDIRCA_IGNORE -#define SSL_EXPERIMENTAL_PERDIRCA -#endif -#ifndef SSL_EXPERIMENTAL_PROXY_IGNORE -#define SSL_EXPERIMENTAL_PROXY -#endif -#ifdef SSL_ENGINE -#ifndef SSL_EXPERIMENTAL_ENGINE_IGNORE -#define SSL_EXPERIMENTAL_ENGINE -#endif -#endif -#endif /* SSL_EXPERIMENTAL */ - -/* - * Power up our brain... - */ - -/* OS headers */ -#include -#include -#include -#include -#include -#include -#include -#ifndef WIN32 -#include -#endif -#ifdef WIN32 -#include -#include -#endif - -/* OpenSSL headers */ -#include -#include -#include -#include -#include -#include -#include -#include -#ifdef SSL_EXPERIMENTAL_ENGINE -#include -#endif - -/* Apache headers */ -#define CORE_PRIVATE -#include "ap_config.h" -#include "httpd.h" -#include "http_config.h" -#include "http_conf_globals.h" -#include "http_protocol.h" -#include "http_request.h" -#include "http_main.h" -#include "http_core.h" -#include "http_log.h" -#include "scoreboard.h" -#include "util_md5.h" -#include "fnmatch.h" -#undef CORE_PRIVATE - -/* mod_ssl headers */ -#include "ssl_expr.h" -#include "ssl_util_ssl.h" -#include "ssl_util_table.h" - -/* - * Provide reasonable default for some defines - */ -#ifndef FALSE -#define FALSE (0) -#endif -#ifndef TRUE -#define TRUE (!FALSE) -#endif -#ifndef PFALSE -#define PFALSE ((void *)FALSE) -#endif -#ifndef PTRUE -#define PTRUE ((void *)TRUE) -#endif -#ifndef UNSET -#define UNSET (-1) -#endif -#ifndef NUL -#define NUL '\0' -#endif -#ifndef RAND_MAX -#include -#define RAND_MAX INT_MAX -#endif - -/* - * Provide reasonable defines for some types - */ -#ifndef BOOL -#define BOOL unsigned int -#endif -#ifndef UCHAR -#define UCHAR unsigned char -#endif - -/* - * Provide useful shorthands - */ -#define strEQ(s1,s2) (strcmp(s1,s2) == 0) -#define strNE(s1,s2) (strcmp(s1,s2) != 0) -#define strEQn(s1,s2,n) (strncmp(s1,s2,n) == 0) -#define strNEn(s1,s2,n) (strncmp(s1,s2,n) != 0) - -#define strcEQ(s1,s2) (strcasecmp(s1,s2) == 0) -#define strcNE(s1,s2) (strcasecmp(s1,s2) != 0) -#define strcEQn(s1,s2,n) (strncasecmp(s1,s2,n) == 0) -#define strcNEn(s1,s2,n) (strncasecmp(s1,s2,n) != 0) - -#define strIsEmpty(s) (s == NULL || s[0] == NUL) - -#define cfgMerge(el,unset) new->el = add->el == unset ? base->el : add->el -#define cfgMergeArray(el) new->el = ap_append_arrays(p, add->el, base->el) -#define cfgMergeTable(el) new->el = ap_overlay_tables(p, add->el, base->el) -#define cfgMergeCtx(el) new->el = ap_ctx_overlay(p, add->el, base->el) -#define cfgMergeString(el) cfgMerge(el, NULL) -#define cfgMergeBool(el) cfgMerge(el, UNSET) -#define cfgMergeInt(el) cfgMerge(el, UNSET) - -#define myModConfig() (SSLModConfigRec *)ap_ctx_get(ap_global_ctx, "ssl_module") -#define mySrvConfig(srv) (SSLSrvConfigRec *)ap_get_module_config(srv->module_config, &ssl_module) -#define myDirConfig(req) (SSLDirConfigRec *)ap_get_module_config(req->per_dir_config, &ssl_module) - -#define myCtxVarSet(mc,num,val) mc->rCtx.pV##num = val -#define myCtxVarGet(mc,num,type) (type)(mc->rCtx.pV##num) - -#define AP_ALL_CMD(name, args, desc) \ - { "SSL"#name, ssl_cmd_SSL##name, NULL, RSRC_CONF|OR_AUTHCFG, args, desc }, -#define AP_SRV_CMD(name, args, desc) \ - { "SSL"#name, ssl_cmd_SSL##name, NULL, RSRC_CONF, args, desc }, -#define AP_DIR_CMD(name, type, args, desc) \ - { "SSL"#name, ssl_cmd_SSL##name, NULL, OR_##type, args, desc }, -#define AP_END_CMD \ - { NULL } - -/* - * SSL Logging - */ -#define SSL_LOG_NONE (1<<0) -#define SSL_LOG_ERROR (1<<1) -#define SSL_LOG_WARN (1<<2) -#define SSL_LOG_INFO (1<<3) -#define SSL_LOG_TRACE (1<<4) -#define SSL_LOG_DEBUG (1<<5) -#define SSL_LOG_MASK (SSL_LOG_ERROR|SSL_LOG_WARN|SSL_LOG_INFO|SSL_LOG_TRACE|SSL_LOG_DEBUG) - -#define SSL_ADD_NONE (1<<8) -#define SSL_ADD_ERRNO (1<<9) -#define SSL_ADD_SSLERR (1<<10) -#define SSL_NO_TIMESTAMP (1<<11) -#define SSL_NO_LEVELID (1<<12) -#define SSL_NO_NEWLINE (1<<13) - -/* - * Defaults for the configuration - */ -#ifndef SSL_SESSION_CACHE_TIMEOUT -#define SSL_SESSION_CACHE_TIMEOUT 300 -#endif - -/* - * Support for file locking: Try to determine whether we should use fcntl() or - * flock(). Would be better ap_config.h could provide this... :-( - */ -#if defined(USE_FCNTL_SERIALIZED_ACCEPT) -#define SSL_USE_FCNTL 1 -#include -#endif -#if defined(USE_FLOCK_SERIALIZED_ACCEPT) -#define SSL_USE_FLOCK 1 -#include -#endif -#if !defined(SSL_USE_FCNTL) && !defined(SSL_USE_FLOCK) -#define SSL_USE_FLOCK 1 -#if !defined(MPE) && !defined(WIN32) -#include -#endif -#ifndef LOCK_UN -#undef SSL_USE_FLOCK -#define SSL_USE_FCNTL 1 -#include -#endif -#endif -#ifdef AIX -#undef SSL_USE_FLOCK -#define SSL_USE_FCNTL 1 -#include -#endif - -/* - * Support for Mutex - */ -#ifndef WIN32 -#define SSL_MUTEX_LOCK_MODE ( S_IRUSR|S_IWUSR ) -#else -#define SSL_MUTEX_LOCK_MODE (_S_IREAD|_S_IWRITE ) -#endif -#if defined(USE_SYSVSEM_SERIALIZED_ACCEPT) ||\ - (defined(__FreeBSD__) && defined(__FreeBSD_version) &&\ - __FreeBSD_version >= 300000) ||\ - (defined(LINUX) && defined(__GLIBC__) && defined(__GLIBC_MINOR__) &&\ - LINUX >= 2 && __GLIBC__ >= 2 && __GLIBC_MINOR__ >= 1) ||\ - defined(SOLARIS2) || defined(__hpux) ||\ - (defined (__digital__) && defined (__unix__)) -#define SSL_CAN_USE_SEM -#define SSL_HAVE_IPCSEM -#include -#include -#include -/* - * Some platforms have a `union semun' pre-defined but Single Unix - * Specification (SUSv2) says in semctl(2): `If required, it is of - * type union semun, which the application program must explicitly - * declare'. So we define it always ourself to avoid problems (but under - * a different name to avoid a namespace clash). - */ -union ssl_ipc_semun { - long val; - struct semid_ds *buf; - unsigned short int *array; -}; -#endif -#ifdef WIN32 -#define SSL_CAN_USE_SEM -#define SSL_HAVE_W32SEM -#include "multithread.h" -#include -#endif - -/* - * Support for MM library - */ -#ifndef WIN32 -#define SSL_MM_FILE_MODE ( S_IRUSR|S_IWUSR ) -#else -#define SSL_MM_FILE_MODE ( _S_IREAD|_S_IWRITE ) -#endif - -/* - * Support for DBM library - */ -#ifndef WIN32 -#define SSL_DBM_FILE_MODE ( S_IRUSR|S_IWUSR ) -#else -#define SSL_USE_SDBM -#define SSL_DBM_FILE_MODE ( _S_IREAD|_S_IWRITE ) -#endif - -#ifdef SSL_USE_SDBM -#include "ssl_util_sdbm.h" -#define ssl_dbm_open sdbm_open -#define ssl_dbm_close sdbm_close -#define ssl_dbm_store sdbm_store -#define ssl_dbm_fetch sdbm_fetch -#define ssl_dbm_delete sdbm_delete -#define ssl_dbm_firstkey sdbm_firstkey -#define ssl_dbm_nextkey sdbm_nextkey -#define SSL_DBM_FILE_SUFFIX_DIR ".dir" -#define SSL_DBM_FILE_SUFFIX_PAG ".pag" -#else /* !SSL_USE_SDBM */ -#if defined(__GLIBC__) && defined(__GLIBC_MINOR__) \ - && __GLIBC__ >= 2 && __GLIBC_MINOR__ >= 1 -#include -#else -#include -#endif -#define ssl_dbm_open dbm_open -#define ssl_dbm_close dbm_close -#define ssl_dbm_store dbm_store -#define ssl_dbm_fetch dbm_fetch -#define ssl_dbm_delete dbm_delete -#define ssl_dbm_firstkey dbm_firstkey -#define ssl_dbm_nextkey dbm_nextkey -#if !defined(SSL_DBM_FILE_SUFFIX_DIR) && !defined(SSL_DBM_FILE_SUFFIX_PAG) -#if defined(DBM_SUFFIX) -#define SSL_DBM_FILE_SUFFIX_DIR DBM_SUFFIX -#define SSL_DBM_FILE_SUFFIX_PAG DBM_SUFFIX -#elif defined(__FreeBSD__) || (defined(DB_LOCK) && defined(DB_SHMEM)) -#define SSL_DBM_FILE_SUFFIX_DIR ".db" -#define SSL_DBM_FILE_SUFFIX_PAG ".db" -#else -#define SSL_DBM_FILE_SUFFIX_DIR ".dir" -#define SSL_DBM_FILE_SUFFIX_PAG ".pag" -#endif -#endif -#endif /* !SSL_USE_SDBM */ - -/* - * Check for OpenSSL version - */ -#if SSL_LIBRARY_VERSION < 0x00903100 -#error "mod_ssl requires OpenSSL 0.9.3 or higher" -#endif - -/* - * The own data structures - */ -typedef struct { - pool *pPool; - pool *pSubPool; - array_header *aData; -} ssl_ds_array; - -typedef struct { - pool *pPool; - pool *pSubPool; - array_header *aKey; - array_header *aData; -} ssl_ds_table; - -/* - * Define the certificate algorithm types - */ - -typedef int ssl_algo_t; - -#define SSL_ALGO_UNKNOWN (0) -#define SSL_ALGO_RSA (1<<0) -#define SSL_ALGO_DSA (1<<1) -#define SSL_ALGO_ALL (SSL_ALGO_RSA|SSL_ALGO_DSA) - -#define SSL_AIDX_RSA (0) -#define SSL_AIDX_DSA (1) -#define SSL_AIDX_MAX (2) - -/* - * Define IDs for the temporary RSA keys and DH params - */ - -#define SSL_TKP_GEN (0) -#define SSL_TKP_ALLOC (1) -#define SSL_TKP_FREE (2) - -#define SSL_TKPIDX_RSA512 (0) -#define SSL_TKPIDX_RSA1024 (1) -#define SSL_TKPIDX_DH512 (2) -#define SSL_TKPIDX_DH1024 (3) -#define SSL_TKPIDX_MAX (4) - -/* - * Define the SSL options - */ -#define SSL_OPT_NONE (0) -#define SSL_OPT_RELSET (1<<0) -#define SSL_OPT_STDENVVARS (1<<1) -#define SSL_OPT_COMPATENVVARS (1<<2) -#define SSL_OPT_EXPORTCERTDATA (1<<3) -#define SSL_OPT_FAKEBASICAUTH (1<<4) -#define SSL_OPT_STRICTREQUIRE (1<<5) -#define SSL_OPT_OPTRENEGOTIATE (1<<6) -#define SSL_OPT_ALL (SSL_OPT_STDENVVARS|SSL_OPT_COMPATENVVAR|SSL_OPT_EXPORTCERTDATA|SSL_OPT_FAKEBASICAUTH|SSL_OPT_STRICTREQUIRE|SSL_OPT_OPTRENEGOTIATE) -typedef int ssl_opt_t; - -/* - * Define the SSL Protocol options - */ -#define SSL_PROTOCOL_NONE (0) -#define SSL_PROTOCOL_SSLV2 (1<<0) -#define SSL_PROTOCOL_SSLV3 (1<<1) -#define SSL_PROTOCOL_TLSV1 (1<<2) -#define SSL_PROTOCOL_ALL (SSL_PROTOCOL_SSLV2|SSL_PROTOCOL_SSLV3|SSL_PROTOCOL_TLSV1) -typedef int ssl_proto_t; - -/* - * Define the SSL verify levels - */ -typedef enum { - SSL_CVERIFY_UNSET = UNSET, - SSL_CVERIFY_NONE = 0, - SSL_CVERIFY_OPTIONAL = 1, - SSL_CVERIFY_REQUIRE = 2, - SSL_CVERIFY_OPTIONAL_NO_CA = 3 -} ssl_verify_t; - -/* - * Define the SSL pass phrase dialog types - */ -typedef enum { - SSL_PPTYPE_UNSET = UNSET, - SSL_PPTYPE_BUILTIN = 0, - SSL_PPTYPE_FILTER = 1 -} ssl_pphrase_t; - -/* - * Define the Path Checking modes - */ -#define SSL_PCM_EXISTS 1 -#define SSL_PCM_ISREG 2 -#define SSL_PCM_ISDIR 4 -#define SSL_PCM_ISNONZERO 8 -typedef unsigned int ssl_pathcheck_t; - -/* - * Define the SSL session cache modes and structures - */ -typedef enum { - SSL_SCMODE_UNSET = UNSET, - SSL_SCMODE_NONE = 0, - SSL_SCMODE_DBM = 1, - SSL_SCMODE_SHMHT = 2, - SSL_SCMODE_SHMCB = 3 -} ssl_scmode_t; - -/* - * Define the SSL mutex modes - */ -typedef enum { - SSL_MUTEXMODE_UNSET = UNSET, - SSL_MUTEXMODE_NONE = 0, - SSL_MUTEXMODE_FILE = 1, - SSL_MUTEXMODE_SEM = 2 -} ssl_mutexmode_t; - -/* - * Define the SSL requirement structure - */ -typedef struct { - char *cpExpr; - ssl_expr *mpExpr; -} ssl_require_t; - -/* - * Define the SSL random number generator seeding source - */ -typedef enum { - SSL_RSCTX_STARTUP = 1, - SSL_RSCTX_CONNECT = 2 -} ssl_rsctx_t; -typedef enum { - SSL_RSSRC_BUILTIN = 1, - SSL_RSSRC_FILE = 2, - SSL_RSSRC_EXEC = 3 -#if SSL_LIBRARY_VERSION >= 0x00905100 - ,SSL_RSSRC_EGD = 4 -#endif -} ssl_rssrc_t; -typedef struct { - ssl_rsctx_t nCtx; - ssl_rssrc_t nSrc; - char *cpPath; - int nBytes; -} ssl_randseed_t; - -/* - * Define the structure of an ASN.1 anything - */ -typedef struct { - long int nData; - unsigned char *cpData; -} ssl_asn1_t; - -/* - * Define the mod_ssl per-module configuration structure - * (i.e. the global configuration for each httpd process) - */ - -typedef struct { - pool *pPool; - BOOL bFixed; - int nInitCount; - int nSessionCacheMode; - char *szSessionCacheDataFile; - int nSessionCacheDataSize; - AP_MM *pSessionCacheDataMM; - table_t *tSessionCacheDataTable; - ssl_mutexmode_t nMutexMode; - char *szMutexFile; - int nMutexFD; - int nMutexSEMID; - array_header *aRandSeed; - ssl_ds_table *tTmpKeys; - void *pTmpKeys[SSL_TKPIDX_MAX]; - ssl_ds_table *tPublicCert; - ssl_ds_table *tPrivateKey; -#ifdef SSL_EXPERIMENTAL_ENGINE - char *szCryptoDevice; -#endif - struct { - void *pV1, *pV2, *pV3, *pV4, *pV5, *pV6, *pV7, *pV8, *pV9, *pV10; - } rCtx; -#ifdef SSL_VENDOR - ap_ctx *ctx; -#endif -} SSLModConfigRec; - -/* - * Define the mod_ssl per-server configuration structure - * (i.e. the configuration for the main server - * and all contexts) - */ -typedef struct { - BOOL bEnabled; - char *szPublicCertFile[SSL_AIDX_MAX]; - char *szPrivateKeyFile[SSL_AIDX_MAX]; - char *szCertificateChain; - char *szCACertificatePath; - char *szCACertificateFile; - char *szLogFile; - char *szCipherSuite; - FILE *fileLogFile; - int nLogLevel; - int nVerifyDepth; - ssl_verify_t nVerifyClient; - X509 *pPublicCert[SSL_AIDX_MAX]; - EVP_PKEY *pPrivateKey[SSL_AIDX_MAX]; - SSL_CTX *pSSLCtx; - int nSessionCacheTimeout; - int nPassPhraseDialogType; - char *szPassPhraseDialogPath; - ssl_proto_t nProtocol; - char *szCARevocationPath; - char *szCARevocationFile; - X509_STORE *pRevocationStore; -#ifdef SSL_EXPERIMENTAL_PROXY - /* Configuration details for proxy operation */ - ssl_proto_t nProxyProtocol; - int bProxyVerify; - int nProxyVerifyDepth; - char *szProxyCACertificatePath; - char *szProxyCACertificateFile; - char *szProxyClientCertificateFile; - char *szProxyClientCertificatePath; - char *szProxyCipherSuite; - SSL_CTX *pSSLProxyCtx; - STACK_OF(X509_INFO) *skProxyClientCerts; -#endif -#ifdef SSL_VENDOR - ap_ctx *ctx; -#endif -} SSLSrvConfigRec; - -/* - * Define the mod_ssl per-directory configuration structure - * (i.e. the local configuration for all - * and .htaccess contexts) - */ -typedef struct { - BOOL bSSLRequired; - array_header *aRequirement; - ssl_opt_t nOptions; - ssl_opt_t nOptionsAdd; - ssl_opt_t nOptionsDel; - char *szCipherSuite; - ssl_verify_t nVerifyClient; - int nVerifyDepth; -#ifdef SSL_EXPERIMENTAL_PERDIRCA - char *szCACertificatePath; - char *szCACertificateFile; -#endif -#ifdef SSL_VENDOR - ap_ctx *ctx; -#endif -} SSLDirConfigRec; - -/* - * function prototypes - */ - -/* API glue structures */ -extern module MODULE_VAR_EXPORT ssl_module; - -/* configuration handling */ -void ssl_config_global_create(void); -void ssl_config_global_fix(void); -BOOL ssl_config_global_isfixed(void); -void *ssl_config_server_create(pool *, server_rec *); -void *ssl_config_server_merge(pool *, void *, void *); -void *ssl_config_perdir_create(pool *, char *); -void *ssl_config_perdir_merge(pool *, void *, void *); -const char *ssl_cmd_SSLMutex(cmd_parms *, char *, char *); -const char *ssl_cmd_SSLPassPhraseDialog(cmd_parms *, char *, char *); -const char *ssl_cmd_SSLCryptoDevice(cmd_parms *, char *, char *); -const char *ssl_cmd_SSLRandomSeed(cmd_parms *, char *, char *, char *, char *); -const char *ssl_cmd_SSLEngine(cmd_parms *, char *, int); -const char *ssl_cmd_SSLCipherSuite(cmd_parms *, SSLDirConfigRec *, char *); -const char *ssl_cmd_SSLCertificateFile(cmd_parms *, char *, char *); -const char *ssl_cmd_SSLCertificateKeyFile(cmd_parms *, char *, char *); -const char *ssl_cmd_SSLCertificateChainFile(cmd_parms *, char *, char *); -const char *ssl_cmd_SSLCACertificatePath(cmd_parms *, SSLDirConfigRec *, char *); -const char *ssl_cmd_SSLCACertificateFile(cmd_parms *, SSLDirConfigRec *, char *); -const char *ssl_cmd_SSLCARevocationPath(cmd_parms *, SSLDirConfigRec *, char *); -const char *ssl_cmd_SSLCARevocationFile(cmd_parms *, SSLDirConfigRec *, char *); -const char *ssl_cmd_SSLVerifyClient(cmd_parms *, SSLDirConfigRec *, char *); -const char *ssl_cmd_SSLVerifyDepth(cmd_parms *, SSLDirConfigRec *, char *); -const char *ssl_cmd_SSLSessionCache(cmd_parms *, char *, char *); -const char *ssl_cmd_SSLSessionCacheTimeout(cmd_parms *, char *, char *); -const char *ssl_cmd_SSLLog(cmd_parms *, char *, char *); -const char *ssl_cmd_SSLLogLevel(cmd_parms *, char *, char *); -const char *ssl_cmd_SSLProtocol(cmd_parms *, char *, const char *); -const char *ssl_cmd_SSLOptions(cmd_parms *, SSLDirConfigRec *, const char *); -const char *ssl_cmd_SSLRequireSSL(cmd_parms *, SSLDirConfigRec *, char *); -const char *ssl_cmd_SSLRequire(cmd_parms *, SSLDirConfigRec *, char *); -#ifdef SSL_EXPERIMENTAL_PROXY -const char *ssl_cmd_SSLProxyProtocol(cmd_parms *, char *, const char *); -const char *ssl_cmd_SSLProxyCipherSuite(cmd_parms *, char *, char *); -const char *ssl_cmd_SSLProxyVerify(cmd_parms *, char *, int); -const char *ssl_cmd_SSLProxyVerifyDepth(cmd_parms *, char *, char *); -const char *ssl_cmd_SSLProxyCACertificatePath(cmd_parms *, char *, char *); -const char *ssl_cmd_SSLProxyCACertificateFile(cmd_parms *, char *, char *); -const char *ssl_cmd_SSLProxyMachineCertificatePath(cmd_parms *, char *, char *); -const char *ssl_cmd_SSLProxyMachineCertificateFile(cmd_parms *, char *, char *); -#endif - -/* module initialization */ -void ssl_init_Module(server_rec *, pool *); -void ssl_init_SSLLibrary(void); -void ssl_init_Engine(server_rec *, pool *); -void ssl_init_TmpKeysHandle(int, server_rec *, pool *); -void ssl_init_ConfigureServer(server_rec *, pool *, SSLSrvConfigRec *); -void ssl_init_CheckServers(server_rec *, pool *); -STACK_OF(X509_NAME) - *ssl_init_FindCAList(server_rec *, pool *, char *, char *); -void ssl_init_Child(server_rec *, pool *); -void ssl_init_ChildKill(void *); -void ssl_init_ModuleKill(void *); - -/* Apache API hooks */ -void ssl_hook_AddModule(module *); -void ssl_hook_RemoveModule(module *); -char *ssl_hook_RewriteCommand(cmd_parms *, void *, const char *); -void ssl_hook_NewConnection(conn_rec *); -void ssl_hook_TimeoutConnection(int); -void ssl_hook_CloseConnection(conn_rec *); -int ssl_hook_Translate(request_rec *); -int ssl_hook_Auth(request_rec *); -int ssl_hook_UserCheck(request_rec *); -int ssl_hook_Access(request_rec *); -int ssl_hook_Fixup(request_rec *); -int ssl_hook_ReadReq(request_rec *); -int ssl_hook_Handler(request_rec *); - -/* OpenSSL callbacks */ -RSA *ssl_callback_TmpRSA(SSL *, int, int); -DH *ssl_callback_TmpDH(SSL *, int, int); -int ssl_callback_SSLVerify(int, X509_STORE_CTX *); -int ssl_callback_SSLVerify_CRL(int, X509_STORE_CTX *, server_rec *); -int ssl_callback_NewSessionCacheEntry(SSL *, SSL_SESSION *); -SSL_SESSION *ssl_callback_GetSessionCacheEntry(SSL *, unsigned char *, int, int *); -void ssl_callback_DelSessionCacheEntry(SSL_CTX *, SSL_SESSION *); -void ssl_callback_LogTracingState(SSL *, int, int); - -/* Session Cache Support */ -void ssl_scache_init(server_rec *, pool *); -void ssl_scache_kill(server_rec *); -BOOL ssl_scache_store(server_rec *, UCHAR *, int, time_t, SSL_SESSION *); -SSL_SESSION *ssl_scache_retrieve(server_rec *, UCHAR *, int); -void ssl_scache_remove(server_rec *, UCHAR *, int); -void ssl_scache_expire(server_rec *); -void ssl_scache_status(server_rec *, pool *, void (*)(char *, void *), void *); -char *ssl_scache_id2sz(UCHAR *, int); -void ssl_scache_dbm_init(server_rec *, pool *); -void ssl_scache_dbm_kill(server_rec *); -BOOL ssl_scache_dbm_store(server_rec *, UCHAR *, int, time_t, SSL_SESSION *); -SSL_SESSION *ssl_scache_dbm_retrieve(server_rec *, UCHAR *, int); -void ssl_scache_dbm_remove(server_rec *, UCHAR *, int); -void ssl_scache_dbm_expire(server_rec *); -void ssl_scache_dbm_status(server_rec *, pool *, void (*)(char *, void *), void *); -void ssl_scache_shmht_init(server_rec *, pool *); -void ssl_scache_shmht_kill(server_rec *); -BOOL ssl_scache_shmht_store(server_rec *, UCHAR *, int, time_t, SSL_SESSION *); -SSL_SESSION *ssl_scache_shmht_retrieve(server_rec *, UCHAR *, int); -void ssl_scache_shmht_remove(server_rec *, UCHAR *, int); -void ssl_scache_shmht_expire(server_rec *); -void ssl_scache_shmht_status(server_rec *, pool *, void (*)(char *, void *), void *); -void ssl_scache_shmcb_init(server_rec *, pool *); -void ssl_scache_shmcb_kill(server_rec *); -BOOL ssl_scache_shmcb_store(server_rec *, UCHAR *, int, time_t, SSL_SESSION *); -SSL_SESSION *ssl_scache_shmcb_retrieve(server_rec *, UCHAR *, int); -void ssl_scache_shmcb_remove(server_rec *, UCHAR *, int); -void ssl_scache_shmcb_expire(server_rec *); -void ssl_scache_shmcb_status(server_rec *, pool *, void (*)(char *, void *), void *); - -/* Pass Phrase Support */ -void ssl_pphrase_Handle(server_rec *, pool *); -int ssl_pphrase_Handle_CB(char *, int, int); - -/* Diffie-Hellman Parameter Support */ -DH *ssl_dh_GetTmpParam(int); -DH *ssl_dh_GetParamFromFile(char *); - -/* Data Structures */ -ssl_ds_array *ssl_ds_array_make(pool *, int); -BOOL ssl_ds_array_isempty(ssl_ds_array *); -void *ssl_ds_array_push(ssl_ds_array *); -void *ssl_ds_array_get(ssl_ds_array *, int); -void ssl_ds_array_wipeout(ssl_ds_array *); -void ssl_ds_array_kill(ssl_ds_array *); -ssl_ds_table *ssl_ds_table_make(pool *, int); -BOOL ssl_ds_table_isempty(ssl_ds_table *); -void *ssl_ds_table_push(ssl_ds_table *, char *); -void *ssl_ds_table_get(ssl_ds_table *, char *); -void ssl_ds_table_wipeout(ssl_ds_table *); -void ssl_ds_table_kill(ssl_ds_table *); - -/* Mutex Support */ -void ssl_mutex_init(server_rec *, pool *); -void ssl_mutex_reinit(server_rec *, pool *); -void ssl_mutex_on(server_rec *); -void ssl_mutex_off(server_rec *); -void ssl_mutex_kill(server_rec *s); -void ssl_mutex_file_create(server_rec *, pool *); -void ssl_mutex_file_open(server_rec *, pool *); -void ssl_mutex_file_remove(void *); -BOOL ssl_mutex_file_acquire(void); -BOOL ssl_mutex_file_release(void); -void ssl_mutex_sem_create(server_rec *, pool *); -void ssl_mutex_sem_open(server_rec *, pool *); -void ssl_mutex_sem_remove(void *); -BOOL ssl_mutex_sem_acquire(void); -BOOL ssl_mutex_sem_release(void); - -/* Logfile Support */ -void ssl_log_open(server_rec *, server_rec *, pool *); -BOOL ssl_log_applies(server_rec *, int); -void ssl_log(server_rec *, int, const char *, ...); -void ssl_die(void); - -/* Variables */ -void ssl_var_register(void); -void ssl_var_unregister(void); -char *ssl_var_lookup(pool *, server_rec *, conn_rec *, request_rec *, char *); - -/* I/O */ -void ssl_io_register(void); -void ssl_io_unregister(void); -long ssl_io_data_cb(BIO *, int, const char *, int, long, long); -#ifndef SSL_CONSERVATIVE -void ssl_io_suck(request_rec *, SSL *); -#endif - -/* PRNG */ -int ssl_rand_seed(server_rec *, pool *, ssl_rsctx_t, char *); - -/* Extensions */ -void ssl_ext_register(void); -void ssl_ext_unregister(void); - -/* Compatibility */ -#ifdef SSL_COMPAT -char *ssl_compat_directive(server_rec *, pool *, const char *); -void ssl_compat_variables(request_rec *); -#endif - -/* Utility Functions */ -char *ssl_util_server_root_relative(pool *, char *, char *); -char *ssl_util_vhostid(pool *, server_rec *); -void ssl_util_strupper(char *); -void ssl_util_uuencode(char *, const char *, BOOL); -void ssl_util_uuencode_binary(unsigned char *, const unsigned char *, int, BOOL); -FILE *ssl_util_ppopen(server_rec *, pool *, char *); -int ssl_util_ppopen_child(void *, child_info *); -void ssl_util_ppclose(server_rec *, pool *, FILE *); -char *ssl_util_readfilter(server_rec *, pool *, char *); -BOOL ssl_util_path_check(ssl_pathcheck_t, char *); -ssl_algo_t ssl_util_algotypeof(X509 *, EVP_PKEY *); -char *ssl_util_algotypestr(ssl_algo_t); -char *ssl_util_ptxtsub(pool *, const char *, const char *, char *); -void ssl_util_thread_setup(void); - -/* Vendor extension support */ -#if defined(SSL_VENDOR) && defined(SSL_VENDOR_OBJS) -void ssl_vendor_register(void); -void ssl_vendor_unregister(void); -#endif - -#endif /* MOD_SSL_H */ diff --git a/modules/ssl/ssl_engine_config.c b/modules/ssl/ssl_engine_config.c deleted file mode 100644 index c47340b2232c18a9539fb88c58fb821449168540..0000000000000000000000000000000000000000 --- a/modules/ssl/ssl_engine_config.c +++ /dev/null @@ -1,1093 +0,0 @@ -/* _ _ -** _ __ ___ ___ __| | ___ ___| | mod_ssl -** | '_ ` _ \ / _ \ / _` | / __/ __| | Apache Interface to OpenSSL -** | | | | | | (_) | (_| | \__ \__ \ | www.modssl.org -** |_| |_| |_|\___/ \__,_|___|___/___/_| ftp.modssl.org -** |_____| -** ssl_engine_config.c -** Apache Configuration Directives -*/ - -/* ==================================================================== - * Copyright (c) 1998-2001 Ralf S. Engelschall. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following - * disclaimer in the documentation and/or other materials - * provided with the distribution. - * - * 3. All advertising materials mentioning features or use of this - * software must display the following acknowledgment: - * "This product includes software developed by - * Ralf S. Engelschall for use in the - * mod_ssl project (http://www.modssl.org/)." - * - * 4. The names "mod_ssl" must not be used to endorse or promote - * products derived from this software without prior written - * permission. For written permission, please contact - * rse@engelschall.com. - * - * 5. Products derived from this software may not be called "mod_ssl" - * nor may "mod_ssl" appear in their names without prior - * written permission of Ralf S. Engelschall. - * - * 6. Redistributions of any form whatsoever must retain the following - * acknowledgment: - * "This product includes software developed by - * Ralf S. Engelschall for use in the - * mod_ssl project (http://www.modssl.org/)." - * - * THIS SOFTWARE IS PROVIDED BY RALF S. ENGELSCHALL ``AS IS'' AND ANY - * EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR - * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL RALF S. ENGELSCHALL OR - * HIS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT - * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, - * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED - * OF THE POSSIBILITY OF SUCH DAMAGE. - * ==================================================================== - */ - - /* ``Damned if you do, - damned if you don't.'' - -- Unknown */ -#include "mod_ssl.h" - - -/* _________________________________________________________________ -** -** Support for Global Configuration -** _________________________________________________________________ -*/ - -void ssl_hook_AddModule(module *m) -{ - if (m == &ssl_module) { - /* - * Announce us for the configuration files - */ - ap_add_config_define("MOD_SSL"); - - /* - * Link ourself into the Apache kernel - */ - ssl_var_register(); - ssl_ext_register(); - ssl_io_register(); -#if defined(SSL_VENDOR) && defined(SSL_VENDOR_OBJS) - ssl_vendor_register(); -#endif - } - return; -} - -void ssl_hook_RemoveModule(module *m) -{ - if (m == &ssl_module) { - /* - * Unlink ourself from the Apache kernel - */ - ssl_var_unregister(); - ssl_ext_unregister(); - ssl_io_unregister(); -#if defined(SSL_VENDOR) && defined(SSL_VENDOR_OBJS) - ssl_vendor_unregister(); -#endif - } - return; -} - -void ssl_config_global_create(void) -{ - pool *pPool; - SSLModConfigRec *mc; - - mc = ap_ctx_get(ap_global_ctx, "ssl_module"); - if (mc == NULL) { - /* - * allocate an own subpool which survives server restarts - */ - pPool = ap_make_sub_pool(NULL); - mc = (SSLModConfigRec *)ap_palloc(pPool, sizeof(SSLModConfigRec)); - mc->pPool = pPool; - mc->bFixed = FALSE; - - /* - * initialize per-module configuration - */ - mc->nInitCount = 0; - mc->nSessionCacheMode = SSL_SCMODE_UNSET; - mc->szSessionCacheDataFile = NULL; - mc->nSessionCacheDataSize = 0; - mc->pSessionCacheDataMM = NULL; - mc->tSessionCacheDataTable = NULL; - mc->nMutexMode = SSL_MUTEXMODE_UNSET; - mc->szMutexFile = NULL; - mc->nMutexFD = -1; - mc->nMutexSEMID = -1; - mc->aRandSeed = ap_make_array(pPool, 4, sizeof(ssl_randseed_t)); - mc->tPrivateKey = ssl_ds_table_make(pPool, sizeof(ssl_asn1_t)); - mc->tPublicCert = ssl_ds_table_make(pPool, sizeof(ssl_asn1_t)); - mc->tTmpKeys = ssl_ds_table_make(pPool, sizeof(ssl_asn1_t)); -#ifdef SSL_EXPERIMENTAL_ENGINE - mc->szCryptoDevice = NULL; -#endif - - (void)memset(mc->pTmpKeys, 0, SSL_TKPIDX_MAX*sizeof(void *)); - -#ifdef SSL_VENDOR - mc->ctx = ap_ctx_new(pPool); - ap_hook_use("ap::mod_ssl::vendor::config_global_create", - AP_HOOK_SIG2(void,ptr), AP_HOOK_MODE_ALL, mc); -#endif - - /* - * And push it into Apache's global context - */ - ap_ctx_set(ap_global_ctx, "ssl_module", mc); - } - return; -} - -void ssl_config_global_fix(void) -{ - SSLModConfigRec *mc = myModConfig(); - mc->bFixed = TRUE; - return; -} - -BOOL ssl_config_global_isfixed(void) -{ - SSLModConfigRec *mc = myModConfig(); - return (mc->bFixed); -} - - -/* _________________________________________________________________ -** -** Configuration handling -** _________________________________________________________________ -*/ - -/* - * Create per-server SSL configuration - */ -void *ssl_config_server_create(pool *p, server_rec *s) -{ - SSLSrvConfigRec *sc; - - ssl_config_global_create(); - - sc = ap_palloc(p, sizeof(SSLSrvConfigRec)); - sc->bEnabled = UNSET; - sc->szCACertificatePath = NULL; - sc->szCACertificateFile = NULL; - sc->szCertificateChain = NULL; - sc->szLogFile = NULL; - sc->szCipherSuite = NULL; - sc->nLogLevel = SSL_LOG_NONE; - sc->nVerifyDepth = UNSET; - sc->nVerifyClient = SSL_CVERIFY_UNSET; - sc->nSessionCacheTimeout = UNSET; - sc->nPassPhraseDialogType = SSL_PPTYPE_UNSET; - sc->szPassPhraseDialogPath = NULL; - sc->nProtocol = SSL_PROTOCOL_ALL; - sc->fileLogFile = NULL; - sc->pSSLCtx = NULL; - sc->szCARevocationPath = NULL; - sc->szCARevocationFile = NULL; - sc->pRevocationStore = NULL; - -#ifdef SSL_EXPERIMENTAL_PROXY - sc->nProxyVerifyDepth = UNSET; - sc->szProxyCACertificatePath = NULL; - sc->szProxyCACertificateFile = NULL; - sc->szProxyClientCertificateFile = NULL; - sc->szProxyClientCertificatePath = NULL; - sc->szProxyCipherSuite = NULL; - sc->nProxyProtocol = SSL_PROTOCOL_ALL & ~SSL_PROTOCOL_TLSV1; - sc->bProxyVerify = UNSET; - sc->pSSLProxyCtx = NULL; -#endif - - (void)memset(sc->szPublicCertFile, 0, SSL_AIDX_MAX*sizeof(char *)); - (void)memset(sc->szPrivateKeyFile, 0, SSL_AIDX_MAX*sizeof(char *)); - (void)memset(sc->pPublicCert, 0, SSL_AIDX_MAX*sizeof(X509 *)); - (void)memset(sc->pPrivateKey, 0, SSL_AIDX_MAX*sizeof(EVP_PKEY *)); - -#ifdef SSL_VENDOR - sc->ctx = ap_ctx_new(p); - ap_hook_use("ap::mod_ssl::vendor::config_server_create", - AP_HOOK_SIG4(void,ptr,ptr,ptr), AP_HOOK_MODE_ALL, - p, s, sc); -#endif - - return sc; -} - -/* - * Merge per-server SSL configurations - */ -void *ssl_config_server_merge(pool *p, void *basev, void *addv) -{ - SSLSrvConfigRec *base = (SSLSrvConfigRec *)basev; - SSLSrvConfigRec *add = (SSLSrvConfigRec *)addv; - SSLSrvConfigRec *new = (SSLSrvConfigRec *)ap_palloc(p, sizeof(SSLSrvConfigRec)); - int i; - - cfgMergeBool(bEnabled); - cfgMergeString(szCACertificatePath); - cfgMergeString(szCACertificateFile); - cfgMergeString(szCertificateChain); - cfgMergeString(szLogFile); - cfgMergeString(szCipherSuite); - cfgMerge(nLogLevel, SSL_LOG_NONE); - cfgMergeInt(nVerifyDepth); - cfgMerge(nVerifyClient, SSL_CVERIFY_UNSET); - cfgMergeInt(nSessionCacheTimeout); - cfgMerge(nPassPhraseDialogType, SSL_PPTYPE_UNSET); - cfgMergeString(szPassPhraseDialogPath); - cfgMerge(nProtocol, SSL_PROTOCOL_ALL); - cfgMerge(fileLogFile, NULL); - cfgMerge(pSSLCtx, NULL); - cfgMerge(szCARevocationPath, NULL); - cfgMerge(szCARevocationFile, NULL); - cfgMerge(pRevocationStore, NULL); - - for (i = 0; i < SSL_AIDX_MAX; i++) { - cfgMergeString(szPublicCertFile[i]); - cfgMergeString(szPrivateKeyFile[i]); - cfgMerge(pPublicCert[i], NULL); - cfgMerge(pPrivateKey[i], NULL); - } - -#ifdef SSL_VENDOR - cfgMergeCtx(ctx); - ap_hook_use("ap::mod_ssl::vendor::config_server_merge", - AP_HOOK_SIG5(void,ptr,ptr,ptr,ptr), AP_HOOK_MODE_ALL, - p, base, add, new); -#endif - -#ifdef SSL_EXPERIMENTAL_PROXY - cfgMergeInt(nProxyVerifyDepth); - cfgMergeString(szProxyCACertificatePath); - cfgMergeString(szProxyCACertificateFile); - cfgMergeString(szProxyClientCertificateFile); - cfgMergeString(szProxyClientCertificatePath); - cfgMergeString(szProxyCipherSuite); - cfgMerge(nProxyProtocol, (SSL_PROTOCOL_ALL & ~SSL_PROTOCOL_TLSV1)); - cfgMergeBool(bProxyVerify); - cfgMerge(pSSLProxyCtx, NULL); -#endif - - return new; -} - -/* - * Create per-directory SSL configuration - */ -void *ssl_config_perdir_create(pool *p, char *dir) -{ - SSLDirConfigRec *dc = ap_palloc(p, sizeof(SSLDirConfigRec)); - - dc->bSSLRequired = FALSE; - dc->aRequirement = ap_make_array(p, 4, sizeof(ssl_require_t)); - dc->nOptions = SSL_OPT_NONE|SSL_OPT_RELSET; - dc->nOptionsAdd = SSL_OPT_NONE; - dc->nOptionsDel = SSL_OPT_NONE; - - dc->szCipherSuite = NULL; - dc->nVerifyClient = SSL_CVERIFY_UNSET; - dc->nVerifyDepth = UNSET; -#ifdef SSL_EXPERIMENTAL_PERDIRCA - dc->szCACertificatePath = NULL; - dc->szCACertificateFile = NULL; -#endif - -#ifdef SSL_VENDOR - dc->ctx = ap_ctx_new(p); - ap_hook_use("ap::mod_ssl::vendor::config_perdir_create", - AP_HOOK_SIG4(void,ptr,ptr,ptr), AP_HOOK_MODE_ALL, - p, dir, dc); -#endif - - return dc; -} - -/* - * Merge per-directory SSL configurations - */ -void *ssl_config_perdir_merge(pool *p, void *basev, void *addv) -{ - SSLDirConfigRec *base = (SSLDirConfigRec *)basev; - SSLDirConfigRec *add = (SSLDirConfigRec *)addv; - SSLDirConfigRec *new = (SSLDirConfigRec *)ap_palloc(p, - sizeof(SSLDirConfigRec)); - - cfgMerge(bSSLRequired, FALSE); - cfgMergeArray(aRequirement); - - if (add->nOptions & SSL_OPT_RELSET) { - new->nOptionsAdd = (base->nOptionsAdd & ~(add->nOptionsDel)) | add->nOptionsAdd; - new->nOptionsDel = (base->nOptionsDel & ~(add->nOptionsAdd)) | add->nOptionsDel; - new->nOptions = (base->nOptions & ~(new->nOptionsDel)) | new->nOptionsAdd; - } - else { - new->nOptions = add->nOptions; - new->nOptionsAdd = add->nOptionsAdd; - new->nOptionsDel = add->nOptionsDel; - } - - cfgMergeString(szCipherSuite); - cfgMerge(nVerifyClient, SSL_CVERIFY_UNSET); - cfgMergeInt(nVerifyDepth); -#ifdef SSL_EXPERIMENTAL_PERDIRCA - cfgMergeString(szCACertificatePath); - cfgMergeString(szCACertificateFile); -#endif - -#ifdef SSL_VENDOR - cfgMergeCtx(ctx); - ap_hook_use("ap::mod_ssl::vendor::config_perdir_merge", - AP_HOOK_SIG5(void,ptr,ptr,ptr,ptr), AP_HOOK_MODE_ALL, - p, base, add, new); -#endif - - return new; -} - -/* - * Directive Rewriting - */ - -char *ssl_hook_RewriteCommand(cmd_parms *cmd, void *config, const char *cmd_line) -{ -#ifdef SSL_COMPAT - return ssl_compat_directive(cmd->server, cmd->pool, cmd_line); -#else - return NULL; -#endif -} - -/* - * Configuration functions for particular directives - */ - -const char *ssl_cmd_SSLMutex( - cmd_parms *cmd, char *struct_ptr, char *arg) -{ - const char *err; - SSLModConfigRec *mc = myModConfig(); - - if ((err = ap_check_cmd_context(cmd, GLOBAL_ONLY)) != NULL) - return err; - if (ssl_config_global_isfixed()) - return NULL; - if (strcEQ(arg, "none")) { - mc->nMutexMode = SSL_MUTEXMODE_NONE; - } - else if (strlen(arg) > 5 && strcEQn(arg, "file:", 5)) { -#ifndef WIN32 - mc->nMutexMode = SSL_MUTEXMODE_FILE; - mc->szMutexFile = ap_psprintf(mc->pPool, "%s.%lu", - ssl_util_server_root_relative(cmd->pool, "mutex", arg+5), - (unsigned long)getpid()); -#else - return "SSLMutex: Lockfiles not available on this platform"; -#endif - } - else if (strcEQ(arg, "sem")) { -#ifdef SSL_CAN_USE_SEM - mc->nMutexMode = SSL_MUTEXMODE_SEM; -#else - return "SSLMutex: Semaphores not available on this platform"; -#endif - } - else - return "SSLMutex: Invalid argument"; - return NULL; -} - -const char *ssl_cmd_SSLPassPhraseDialog( - cmd_parms *cmd, char *struct_ptr, char *arg) -{ - SSLSrvConfigRec *sc = mySrvConfig(cmd->server); - const char *err; - - if ((err = ap_check_cmd_context(cmd, GLOBAL_ONLY)) != NULL) - return err; - if (strcEQ(arg, "builtin")) { - sc->nPassPhraseDialogType = SSL_PPTYPE_BUILTIN; - sc->szPassPhraseDialogPath = NULL; - } - else if (strlen(arg) > 5 && strEQn(arg, "exec:", 5)) { - sc->nPassPhraseDialogType = SSL_PPTYPE_FILTER; - sc->szPassPhraseDialogPath = ssl_util_server_root_relative(cmd->pool, "dialog", arg+5); - if (!ssl_util_path_check(SSL_PCM_EXISTS, sc->szPassPhraseDialogPath)) - return ap_pstrcat(cmd->pool, "SSLPassPhraseDialog: file '", - sc->szPassPhraseDialogPath, "' not exists", NULL); - } - else - return "SSLPassPhraseDialog: Invalid argument"; - return NULL; -} - -#ifdef SSL_EXPERIMENTAL_ENGINE -const char *ssl_cmd_SSLCryptoDevice( - cmd_parms *cmd, char *struct_ptr, char *arg) -{ - SSLModConfigRec *mc = myModConfig(); - const char *err; - ENGINE *e; -#if SSL_LIBRARY_VERSION >= 0x00907000 - static int loaded_engines = FALSE; - - /* early loading to make sure the engines are already - available for ENGINE_by_id() above... */ - if (!loaded_engines) { - ENGINE_load_builtin_engines(); - loaded_engines = TRUE; - } -#endif - if ((err = ap_check_cmd_context(cmd, GLOBAL_ONLY)) != NULL) - return err; - if (strcEQ(arg, "builtin")) { - mc->szCryptoDevice = NULL; - } - else if ((e = ENGINE_by_id(arg)) != NULL) { - mc->szCryptoDevice = arg; - ENGINE_free(e); - } - else - return "SSLCryptoDevice: Invalid argument"; - return NULL; -} -#endif - -const char *ssl_cmd_SSLRandomSeed( - cmd_parms *cmd, char *struct_ptr, char *arg1, char *arg2, char *arg3) -{ - SSLModConfigRec *mc = myModConfig(); - const char *err; - ssl_randseed_t *pRS; - - if ((err = ap_check_cmd_context(cmd, GLOBAL_ONLY)) != NULL) - return err; - if (ssl_config_global_isfixed()) - return NULL; - pRS = ap_push_array(mc->aRandSeed); - if (strcEQ(arg1, "startup")) - pRS->nCtx = SSL_RSCTX_STARTUP; - else if (strcEQ(arg1, "connect")) - pRS->nCtx = SSL_RSCTX_CONNECT; - else - return ap_pstrcat(cmd->pool, "SSLRandomSeed: " - "invalid context: `", arg1, "'"); - if (strlen(arg2) > 5 && strEQn(arg2, "file:", 5)) { - pRS->nSrc = SSL_RSSRC_FILE; - pRS->cpPath = ap_pstrdup(mc->pPool, ssl_util_server_root_relative(cmd->pool, "random", arg2+5)); - } - else if (strlen(arg2) > 5 && strEQn(arg2, "exec:", 5)) { - pRS->nSrc = SSL_RSSRC_EXEC; - pRS->cpPath = ap_pstrdup(mc->pPool, ssl_util_server_root_relative(cmd->pool, "random", arg2+5)); - } -#if SSL_LIBRARY_VERSION >= 0x00905100 - else if (strlen(arg2) > 4 && strEQn(arg2, "egd:", 4)) { - pRS->nSrc = SSL_RSSRC_EGD; - pRS->cpPath = ap_pstrdup(mc->pPool, ssl_util_server_root_relative(cmd->pool, "random", arg2+4)); - } -#endif - else if (strcEQ(arg2, "builtin")) { - pRS->nSrc = SSL_RSSRC_BUILTIN; - pRS->cpPath = NULL; - } - else { - pRS->nSrc = SSL_RSSRC_FILE; - pRS->cpPath = ap_pstrdup(mc->pPool, ssl_util_server_root_relative(cmd->pool, "random", arg2)); - } - if (pRS->nSrc != SSL_RSSRC_BUILTIN) - if (!ssl_util_path_check(SSL_PCM_EXISTS, pRS->cpPath)) - return ap_pstrcat(cmd->pool, "SSLRandomSeed: source path '", - pRS->cpPath, "' not exists", NULL); - if (arg3 == NULL) - pRS->nBytes = 0; /* read whole file */ - else { - if (pRS->nSrc == SSL_RSSRC_BUILTIN) - return "SSLRandomSeed: byte specification not " - "allowed for builtin seed source"; - pRS->nBytes = atoi(arg3); - if (pRS->nBytes < 0) - return "SSLRandomSeed: invalid number of bytes specified"; - } - return NULL; -} - -const char *ssl_cmd_SSLEngine( - cmd_parms *cmd, char *struct_ptr, int flag) -{ - SSLSrvConfigRec *sc = mySrvConfig(cmd->server); - - sc->bEnabled = (flag ? TRUE : FALSE); - return NULL; -} - -const char *ssl_cmd_SSLCipherSuite( - cmd_parms *cmd, SSLDirConfigRec *dc, char *arg) -{ - SSLSrvConfigRec *sc = mySrvConfig(cmd->server); - - if (cmd->path == NULL || dc == NULL) - sc->szCipherSuite = arg; - else - dc->szCipherSuite = arg; - return NULL; -} - -const char *ssl_cmd_SSLCertificateFile( - cmd_parms *cmd, char *struct_ptr, char *arg) -{ - SSLSrvConfigRec *sc = mySrvConfig(cmd->server); - char *cpPath; - int i; - - cpPath = ssl_util_server_root_relative(cmd->pool, "certkey", arg); - if (!ssl_util_path_check(SSL_PCM_EXISTS|SSL_PCM_ISREG|SSL_PCM_ISNONZERO, cpPath)) - return ap_pstrcat(cmd->pool, "SSLCertificateFile: file '", - cpPath, "' not exists or empty", NULL); - for (i = 0; i < SSL_AIDX_MAX && sc->szPublicCertFile[i] != NULL; i++) - ; - if (i == SSL_AIDX_MAX) - return ap_psprintf(cmd->pool, "SSLCertificateFile: only up to %d " - "different certificates per virtual host allowed", - SSL_AIDX_MAX); - sc->szPublicCertFile[i] = cpPath; - return NULL; -} - -const char *ssl_cmd_SSLCertificateKeyFile( - cmd_parms *cmd, char *struct_ptr, char *arg) -{ - SSLSrvConfigRec *sc = mySrvConfig(cmd->server); - char *cpPath; - int i; - - cpPath = ssl_util_server_root_relative(cmd->pool, "certkey", arg); - if (!ssl_util_path_check(SSL_PCM_EXISTS|SSL_PCM_ISREG|SSL_PCM_ISNONZERO, cpPath)) - return ap_pstrcat(cmd->pool, "SSLCertificateKeyFile: file '", - cpPath, "' not exists or empty", NULL); - for (i = 0; i < SSL_AIDX_MAX && sc->szPrivateKeyFile[i] != NULL; i++) - ; - if (i == SSL_AIDX_MAX) - return ap_psprintf(cmd->pool, "SSLCertificateKeyFile: only up to %d " - "different private keys per virtual host allowed", - SSL_AIDX_MAX); - sc->szPrivateKeyFile[i] = cpPath; - return NULL; -} - -const char *ssl_cmd_SSLCertificateChainFile( - cmd_parms *cmd, char *struct_ptr, char *arg) -{ - SSLSrvConfigRec *sc = mySrvConfig(cmd->server); - char *cpPath; - - cpPath = ssl_util_server_root_relative(cmd->pool, "certkey", arg); - if (!ssl_util_path_check(SSL_PCM_EXISTS|SSL_PCM_ISREG|SSL_PCM_ISNONZERO, cpPath)) - return ap_pstrcat(cmd->pool, "SSLCertificateChainFile: file '", - cpPath, "' not exists or empty", NULL); - sc->szCertificateChain = cpPath; - return NULL; -} - -const char *ssl_cmd_SSLCACertificatePath( - cmd_parms *cmd, SSLDirConfigRec *dc, char *arg) -{ - SSLSrvConfigRec *sc = mySrvConfig(cmd->server); - char *cpPath; - - cpPath = ssl_util_server_root_relative(cmd->pool, "certkey", arg); - if (!ssl_util_path_check(SSL_PCM_EXISTS|SSL_PCM_ISDIR, cpPath)) - return ap_pstrcat(cmd->pool, "SSLCACertificatePath: directory '", - cpPath, "' not exists", NULL); -#ifdef SSL_EXPERIMENTAL_PERDIRCA - if (cmd->path == NULL || dc == NULL) - sc->szCACertificatePath = cpPath; - else - dc->szCACertificatePath = cpPath; -#else - sc->szCACertificatePath = cpPath; -#endif - return NULL; -} - -const char *ssl_cmd_SSLCACertificateFile( - cmd_parms *cmd, SSLDirConfigRec *dc, char *arg) -{ - SSLSrvConfigRec *sc = mySrvConfig(cmd->server); - char *cpPath; - - cpPath = ssl_util_server_root_relative(cmd->pool, "certkey", arg); - if (!ssl_util_path_check(SSL_PCM_EXISTS|SSL_PCM_ISREG|SSL_PCM_ISNONZERO, cpPath)) - return ap_pstrcat(cmd->pool, "SSLCACertificateFile: file '", - cpPath, "' not exists or empty", NULL); -#ifdef SSL_EXPERIMENTAL_PERDIRCA - if (cmd->path == NULL || dc == NULL) - sc->szCACertificateFile = cpPath; - else - dc->szCACertificateFile = cpPath; -#else - sc->szCACertificateFile = cpPath; -#endif - return NULL; -} - -const char *ssl_cmd_SSLCARevocationPath( - cmd_parms *cmd, SSLDirConfigRec *dc, char *arg) -{ - SSLSrvConfigRec *sc = mySrvConfig(cmd->server); - char *cpPath; - - cpPath = ssl_util_server_root_relative(cmd->pool, "certkey", arg); - if (!ssl_util_path_check(SSL_PCM_EXISTS|SSL_PCM_ISDIR, cpPath)) - return ap_pstrcat(cmd->pool, "SSLCARecocationPath: directory '", - cpPath, "' not exists", NULL); - sc->szCARevocationPath = cpPath; - return NULL; -} - -const char *ssl_cmd_SSLCARevocationFile( - cmd_parms *cmd, SSLDirConfigRec *dc, char *arg) -{ - SSLSrvConfigRec *sc = mySrvConfig(cmd->server); - char *cpPath; - - cpPath = ssl_util_server_root_relative(cmd->pool, "certkey", arg); - if (!ssl_util_path_check(SSL_PCM_EXISTS|SSL_PCM_ISREG|SSL_PCM_ISNONZERO, cpPath)) - return ap_pstrcat(cmd->pool, "SSLCARevocationFile: file '", - cpPath, "' not exists or empty", NULL); - sc->szCARevocationFile = cpPath; - return NULL; -} - -const char *ssl_cmd_SSLVerifyClient( - cmd_parms *cmd, SSLDirConfigRec *dc, char *level) -{ - SSLSrvConfigRec *sc = mySrvConfig(cmd->server); - ssl_verify_t id; - - if (strEQ(level, "0") || strcEQ(level, "none")) - id = SSL_CVERIFY_NONE; - else if (strEQ(level, "1") || strcEQ(level, "optional")) - id = SSL_CVERIFY_OPTIONAL; - else if (strEQ(level, "2") || strcEQ(level, "require")) - id = SSL_CVERIFY_REQUIRE; - else if (strEQ(level, "3") || strcEQ(level, "optional_no_ca")) - id = SSL_CVERIFY_OPTIONAL_NO_CA; - else - return "SSLVerifyClient: Invalid argument"; - if (cmd->path == NULL || dc == NULL) - sc->nVerifyClient = id; - else - dc->nVerifyClient = id; - return NULL; -} - -const char *ssl_cmd_SSLVerifyDepth( - cmd_parms *cmd, SSLDirConfigRec *dc, char *arg) -{ - SSLSrvConfigRec *sc = mySrvConfig(cmd->server); - int d; - - d = atoi(arg); - if (d < 0) - return "SSLVerifyDepth: Invalid argument"; - if (cmd->path == NULL || dc == NULL) - sc->nVerifyDepth = d; - else - dc->nVerifyDepth = d; - return NULL; -} - -const char *ssl_cmd_SSLSessionCache( - cmd_parms *cmd, char *struct_ptr, char *arg) -{ - const char *err; - SSLModConfigRec *mc = myModConfig(); - char *cp, *cp2; - int maxsize; - - if ((err = ap_check_cmd_context(cmd, GLOBAL_ONLY)) != NULL) - return err; - if (ssl_config_global_isfixed()) - return NULL; - if (strcEQ(arg, "none")) { - mc->nSessionCacheMode = SSL_SCMODE_NONE; - mc->szSessionCacheDataFile = NULL; - } - else if (strlen(arg) > 4 && strcEQn(arg, "dbm:", 4)) { - mc->nSessionCacheMode = SSL_SCMODE_DBM; - mc->szSessionCacheDataFile = ap_pstrdup(mc->pPool, - ssl_util_server_root_relative(cmd->pool, "scache", arg+4)); - } - else if ( (strlen(arg) > 4 && strcEQn(arg, "shm:", 4)) - || (strlen(arg) > 6 && strcEQn(arg, "shmht:", 6))) { - if (!ap_mm_useable()) - return "SSLSessionCache: shared memory cache not useable on this platform"; - mc->nSessionCacheMode = SSL_SCMODE_SHMHT; - cp = strchr(arg, ':'); - mc->szSessionCacheDataFile = ap_pstrdup(mc->pPool, - ssl_util_server_root_relative(cmd->pool, "scache", cp+1)); - mc->tSessionCacheDataTable = NULL; - mc->nSessionCacheDataSize = 1024*512; /* 512KB */ - if ((cp = strchr(mc->szSessionCacheDataFile, '(')) != NULL) { - *cp++ = NUL; - if ((cp2 = strchr(cp, ')')) == NULL) - return "SSLSessionCache: Invalid argument: no closing parenthesis"; - *cp2 = NUL; - mc->nSessionCacheDataSize = atoi(cp); - if (mc->nSessionCacheDataSize <= 8192) - return "SSLSessionCache: Invalid argument: size has to be >= 8192 bytes"; - maxsize = ap_mm_core_maxsegsize(); - if (mc->nSessionCacheDataSize >= maxsize) - return ap_psprintf(cmd->pool, "SSLSessionCache: Invalid argument: " - "size has to be < %d bytes on this platform", maxsize); - } - } - else if (strlen(arg) > 6 && strcEQn(arg, "shmcb:", 6)) { - if (!ap_mm_useable()) - return "SSLSessionCache: shared memory cache not useable on this platform"; - mc->nSessionCacheMode = SSL_SCMODE_SHMCB; - mc->szSessionCacheDataFile = ap_pstrdup(mc->pPool, - ap_server_root_relative(cmd->pool, arg+6)); - mc->tSessionCacheDataTable = NULL; - mc->nSessionCacheDataSize = 1024*512; /* 512KB */ - if ((cp = strchr(mc->szSessionCacheDataFile, '(')) != NULL) { - *cp++ = NUL; - if ((cp2 = strchr(cp, ')')) == NULL) - return "SSLSessionCache: Invalid argument: no closing parenthesis"; - *cp2 = NUL; - mc->nSessionCacheDataSize = atoi(cp); - if (mc->nSessionCacheDataSize <= 8192) - return "SSLSessionCache: Invalid argument: size has to be >= 8192 bytes"; - maxsize = ap_mm_core_maxsegsize(); - if (mc->nSessionCacheDataSize >= maxsize) - return ap_psprintf(cmd->pool, "SSLSessionCache: Invalid argument: " - "size has to be < %d bytes on this platform", maxsize); - } - } - else -#ifdef SSL_VENDOR - if (!ap_hook_use("ap::mod_ssl::vendor::cmd_sslsessioncache", - AP_HOOK_SIG4(void,ptr,ptr,ptr), AP_HOOK_MODE_ALL, - cmd, arg, mc)) -#endif - return "SSLSessionCache: Invalid argument"; - return NULL; -} - -const char *ssl_cmd_SSLSessionCacheTimeout( - cmd_parms *cmd, char *struct_ptr, char *arg) -{ - SSLSrvConfigRec *sc = mySrvConfig(cmd->server); - - sc->nSessionCacheTimeout = atoi(arg); - if (sc->nSessionCacheTimeout < 0) - return "SSLSessionCacheTimeout: Invalid argument"; - return NULL; -} - -const char *ssl_cmd_SSLLog( - cmd_parms *cmd, char *struct_ptr, char *arg) -{ - SSLSrvConfigRec *sc = mySrvConfig(cmd->server); - const char *err; - - if ((err = ap_check_cmd_context(cmd, NOT_IN_LIMIT|NOT_IN_DIRECTORY - |NOT_IN_LOCATION|NOT_IN_FILES )) != NULL) - return err; - sc->szLogFile = arg; - return NULL; -} - -const char *ssl_cmd_SSLLogLevel( - cmd_parms *cmd, char *struct_ptr, char *level) -{ - SSLSrvConfigRec *sc = mySrvConfig(cmd->server); - const char *err; - - if ((err = ap_check_cmd_context(cmd, NOT_IN_LIMIT|NOT_IN_DIRECTORY - |NOT_IN_LOCATION|NOT_IN_FILES )) != NULL) - return err; - if (strcEQ(level, "none")) - sc->nLogLevel = SSL_LOG_NONE; - else if (strcEQ(level, "error")) - sc->nLogLevel = SSL_LOG_ERROR; - else if (strcEQ(level, "warn")) - sc->nLogLevel = SSL_LOG_WARN; - else if (strcEQ(level, "info")) - sc->nLogLevel = SSL_LOG_INFO; - else if (strcEQ(level, "trace")) - sc->nLogLevel = SSL_LOG_TRACE; - else if (strcEQ(level, "debug")) - sc->nLogLevel = SSL_LOG_DEBUG; - else - return "SSLLogLevel: Invalid argument"; - return NULL; -} - -const char *ssl_cmd_SSLOptions( - cmd_parms *cmd, SSLDirConfigRec *dc, const char *cpLine) -{ - ssl_opt_t opt; - int first; - char action; - char *w; - - first = TRUE; - while (cpLine[0] != NUL) { - w = ap_getword_conf(cmd->pool, &cpLine); - action = NUL; - - if (*w == '+' || *w == '-') { - action = *(w++); - } - else if (first) { - dc->nOptions = SSL_OPT_NONE; - first = FALSE; - } - - if (strcEQ(w, "StdEnvVars")) - opt = SSL_OPT_STDENVVARS; - else if (strcEQ(w, "CompatEnvVars")) - opt = SSL_OPT_COMPATENVVARS; - else if (strcEQ(w, "ExportCertData")) - opt = SSL_OPT_EXPORTCERTDATA; - else if (strcEQ(w, "FakeBasicAuth")) - opt = SSL_OPT_FAKEBASICAUTH; - else if (strcEQ(w, "StrictRequire")) - opt = SSL_OPT_STRICTREQUIRE; - else if (strcEQ(w, "OptRenegotiate")) - opt = SSL_OPT_OPTRENEGOTIATE; - else - return ap_pstrcat(cmd->pool, "SSLOptions: Illegal option '", w, "'", NULL); - - if (action == '-') { - dc->nOptionsAdd &= ~opt; - dc->nOptionsDel |= opt; - dc->nOptions &= ~opt; - } - else if (action == '+') { - dc->nOptionsAdd |= opt; - dc->nOptionsDel &= ~opt; - dc->nOptions |= opt; - } - else { - dc->nOptions = opt; - dc->nOptionsAdd = opt; - dc->nOptionsDel = SSL_OPT_NONE; - } - } - return NULL; -} - -const char *ssl_cmd_SSLRequireSSL( - cmd_parms *cmd, SSLDirConfigRec *dc, char *cipher) -{ - dc->bSSLRequired = TRUE; - return NULL; -} - -const char *ssl_cmd_SSLRequire( - cmd_parms *cmd, SSLDirConfigRec *dc, char *cpExpr) -{ - ssl_expr *mpExpr; - ssl_require_t *pReqRec; - - if ((mpExpr = ssl_expr_comp(cmd->pool, cpExpr)) == NULL) - return ap_pstrcat(cmd->pool, "SSLRequire: ", ssl_expr_get_error(), NULL); - pReqRec = ap_push_array(dc->aRequirement); - pReqRec->cpExpr = ap_pstrdup(cmd->pool, cpExpr); - pReqRec->mpExpr = mpExpr; - return NULL; -} - -const char *ssl_cmd_SSLProtocol( - cmd_parms *cmd, char *struct_ptr, const char *opt) -{ - SSLSrvConfigRec *sc; - ssl_proto_t options, thisopt; - char action; - char *w; - - sc = mySrvConfig(cmd->server); - options = SSL_PROTOCOL_NONE; - while (opt[0] != NUL) { - w = ap_getword_conf(cmd->pool, &opt); - - action = NUL; - if (*w == '+' || *w == '-') - action = *(w++); - - if (strcEQ(w, "SSLv2")) - thisopt = SSL_PROTOCOL_SSLV2; - else if (strcEQ(w, "SSLv3")) - thisopt = SSL_PROTOCOL_SSLV3; - else if (strcEQ(w, "TLSv1")) - thisopt = SSL_PROTOCOL_TLSV1; - else if (strcEQ(w, "all")) - thisopt = SSL_PROTOCOL_ALL; - else - return ap_pstrcat(cmd->pool, "SSLProtocol: Illegal protocol '", w, "'", NULL); - - if (action == '-') - options &= ~thisopt; - else if (action == '+') - options |= thisopt; - else - options = thisopt; - } - sc->nProtocol = options; - return NULL; -} - -#ifdef SSL_EXPERIMENTAL_PROXY - -const char *ssl_cmd_SSLProxyProtocol( - cmd_parms *cmd, char *struct_ptr, const char *opt) -{ - SSLSrvConfigRec *sc; - ssl_proto_t options, thisopt; - char action; - char *w; - - sc = mySrvConfig(cmd->server); - options = SSL_PROTOCOL_NONE; - while (opt[0] != NUL) { - w = ap_getword_conf(cmd->pool, &opt); - - action = NUL; - if (*w == '+' || *w == '-') - action = *(w++); - - if (strcEQ(w, "SSLv2")) - thisopt = SSL_PROTOCOL_SSLV2; - else if (strcEQ(w, "SSLv3")) - thisopt = SSL_PROTOCOL_SSLV3; - else if (strcEQ(w, "TLSv1")) - thisopt = SSL_PROTOCOL_TLSV1; - else if (strcEQ(w, "all")) - thisopt = SSL_PROTOCOL_ALL; - else - return ap_pstrcat(cmd->pool, "SSLProxyProtocol: " - "Illegal protocol '", w, "'", NULL); - if (action == '-') - options &= ~thisopt; - else if (action == '+') - options |= thisopt; - else - options = thisopt; - } - sc->nProxyProtocol = options; - return NULL; -} - -const char *ssl_cmd_SSLProxyCipherSuite( - cmd_parms *cmd, char *struct_ptr, char *arg) -{ - SSLSrvConfigRec *sc = mySrvConfig(cmd->server); - - sc->szProxyCipherSuite = arg; - return NULL; -} - -const char *ssl_cmd_SSLProxyVerify( - cmd_parms *cmd, char *struct_ptr, int flag) -{ - SSLSrvConfigRec *sc = mySrvConfig(cmd->server); - - sc->bProxyVerify = (flag ? TRUE : FALSE); - return NULL; -} - -const char *ssl_cmd_SSLProxyVerifyDepth( - cmd_parms *cmd, char *struct_ptr, char *arg) -{ - SSLSrvConfigRec *sc = mySrvConfig(cmd->server); - int d; - - d = atoi(arg); - if (d < 0) - return "SSLProxyVerifyDepth: Invalid argument"; - sc->nProxyVerifyDepth = d; - return NULL; -} - -const char *ssl_cmd_SSLProxyCACertificateFile( - cmd_parms *cmd, char *struct_ptr, char *arg) -{ - SSLSrvConfigRec *sc = mySrvConfig(cmd->server); - char *cpPath; - - cpPath = ssl_util_server_root_relative(cmd->pool, "certkey", arg); - if (!ssl_util_path_check(SSL_PCM_EXISTS|SSL_PCM_ISREG|SSL_PCM_ISNONZERO, cpPath)) - return ap_pstrcat(cmd->pool, "SSLProxyCACertificateFile: file '", - cpPath, "' not exists or empty", NULL); - sc->szProxyCACertificateFile = cpPath; - return NULL; -} - -const char *ssl_cmd_SSLProxyCACertificatePath( - cmd_parms *cmd, char *struct_ptr, char *arg) -{ - SSLSrvConfigRec *sc = mySrvConfig(cmd->server); - char *cpPath; - - cpPath = ssl_util_server_root_relative(cmd->pool, "certkey", arg); - if (!ssl_util_path_check(SSL_PCM_EXISTS|SSL_PCM_ISDIR, cpPath)) - return ap_pstrcat(cmd->pool, "SSLProxyCACertificatePath: directory '", - cpPath, "' does not exists", NULL); - sc->szProxyCACertificatePath = cpPath; - return NULL; -} - -const char *ssl_cmd_SSLProxyMachineCertificateFile( - cmd_parms *cmd, char *struct_ptr, char *arg) -{ - SSLSrvConfigRec *sc = mySrvConfig(cmd->server); - char *cpPath; - - cpPath = ssl_util_server_root_relative(cmd->pool, "certkey", arg); - if (!ssl_util_path_check(SSL_PCM_EXISTS|SSL_PCM_ISREG|SSL_PCM_ISNONZERO, cpPath)) - return ap_pstrcat(cmd->pool, "SSLProxyMachineCertFile: file '", - cpPath, "' not exists or empty", NULL); - sc->szProxyClientCertificateFile = cpPath; - return NULL; -} - -const char *ssl_cmd_SSLProxyMachineCertificatePath( - cmd_parms *cmd, char *struct_ptr, char *arg) -{ - SSLSrvConfigRec *sc = mySrvConfig(cmd->server); - char *cpPath; - - cpPath = ssl_util_server_root_relative(cmd->pool, "certkey", arg); - if (!ssl_util_path_check(SSL_PCM_EXISTS|SSL_PCM_ISDIR, cpPath)) - return ap_pstrcat(cmd->pool, "SSLProxyMachineCertPath: directory '", - cpPath, "' does not exists", NULL); - sc->szProxyClientCertificatePath = cpPath; - return NULL; -} - -#endif /* SSL_EXPERIMENTAL_PROXY */ - diff --git a/modules/ssl/ssl_engine_dh.c b/modules/ssl/ssl_engine_dh.c deleted file mode 100644 index 84f49e6657183c7beeb7c4bbd60da7db5db0254e..0000000000000000000000000000000000000000 --- a/modules/ssl/ssl_engine_dh.c +++ /dev/null @@ -1,255 +0,0 @@ -#if 0 -=pod -#endif -/* _ _ -** _ __ ___ ___ __| | ___ ___| | mod_ssl -** | '_ ` _ \ / _ \ / _` | / __/ __| | Apache Interface to OpenSSL -** | | | | | | (_) | (_| | \__ \__ \ | www.modssl.org -** |_| |_| |_|\___/ \__,_|___|___/___/_| ftp.modssl.org -** |_____| -** ssl_engine_dh.c -** Diffie-Hellman Built-in Temporary Parameters -*/ - -/* ==================================================================== - * Copyright (c) 1998-2001 Ralf S. Engelschall. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following - * disclaimer in the documentation and/or other materials - * provided with the distribution. - * - * 3. All advertising materials mentioning features or use of this - * software must display the following acknowledgment: - * "This product includes software developed by - * Ralf S. Engelschall for use in the - * mod_ssl project (http://www.modssl.org/)." - * - * 4. The names "mod_ssl" must not be used to endorse or promote - * products derived from this software without prior written - * permission. For written permission, please contact - * rse@engelschall.com. - * - * 5. Products derived from this software may not be called "mod_ssl" - * nor may "mod_ssl" appear in their names without prior - * written permission of Ralf S. Engelschall. - * - * 6. Redistributions of any form whatsoever must retain the following - * acknowledgment: - * "This product includes software developed by - * Ralf S. Engelschall for use in the - * mod_ssl project (http://www.modssl.org/)." - * - * THIS SOFTWARE IS PROVIDED BY RALF S. ENGELSCHALL ``AS IS'' AND ANY - * EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR - * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL RALF S. ENGELSCHALL OR - * HIS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT - * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, - * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED - * OF THE POSSIBILITY OF SUCH DAMAGE. - * ==================================================================== - */ - -#include "mod_ssl.h" - -/* ----BEGIN GENERATED SECTION-------- */ - -/* -** Diffie-Hellman-Parameters: (512 bit) -** prime: -** 00:d4:bc:d5:24:06:f6:9b:35:99:4b:88:de:5d:b8: -** 96:82:c8:15:7f:62:d8:f3:36:33:ee:57:72:f1:1f: -** 05:ab:22:d6:b5:14:5b:9f:24:1e:5a:cc:31:ff:09: -** 0a:4b:c7:11:48:97:6f:76:79:50:94:e7:1e:79:03: -** 52:9f:5a:82:4b -** generator: 2 (0x2) -** Diffie-Hellman-Parameters: (1024 bit) -** prime: -** 00:e6:96:9d:3d:49:5b:e3:2c:7c:f1:80:c3:bd:d4: -** 79:8e:91:b7:81:82:51:bb:05:5e:2a:20:64:90:4a: -** 79:a7:70:fa:15:a2:59:cb:d5:23:a6:a6:ef:09:c4: -** 30:48:d5:a2:2f:97:1f:3c:20:12:9b:48:00:0e:6e: -** dd:06:1c:bc:05:3e:37:1d:79:4e:53:27:df:61:1e: -** bb:be:1b:ac:9b:5c:60:44:cf:02:3d:76:e0:5e:ea: -** 9b:ad:99:1b:13:a6:3c:97:4e:9e:f1:83:9e:b5:db: -** 12:51:36:f7:26:2e:56:a8:87:15:38:df:d8:23:c6: -** 50:50:85:e2:1f:0d:d5:c8:6b -** generator: 2 (0x2) -*/ - -static unsigned char dh512_p[] = -{ - 0xD4, 0xBC, 0xD5, 0x24, 0x06, 0xF6, 0x9B, 0x35, 0x99, 0x4B, 0x88, 0xDE, - 0x5D, 0xB8, 0x96, 0x82, 0xC8, 0x15, 0x7F, 0x62, 0xD8, 0xF3, 0x36, 0x33, - 0xEE, 0x57, 0x72, 0xF1, 0x1F, 0x05, 0xAB, 0x22, 0xD6, 0xB5, 0x14, 0x5B, - 0x9F, 0x24, 0x1E, 0x5A, 0xCC, 0x31, 0xFF, 0x09, 0x0A, 0x4B, 0xC7, 0x11, - 0x48, 0x97, 0x6F, 0x76, 0x79, 0x50, 0x94, 0xE7, 0x1E, 0x79, 0x03, 0x52, - 0x9F, 0x5A, 0x82, 0x4B, -}; -static unsigned char dh512_g[] = -{ - 0x02, -}; - -static DH *get_dh512() -{ - DH *dh; - - if ((dh = DH_new()) == NULL) - return (NULL); - dh->p = BN_bin2bn(dh512_p, sizeof(dh512_p), NULL); - dh->g = BN_bin2bn(dh512_g, sizeof(dh512_g), NULL); - if ((dh->p == NULL) || (dh->g == NULL)) - return (NULL); - return (dh); -} -static unsigned char dh1024_p[] = -{ - 0xE6, 0x96, 0x9D, 0x3D, 0x49, 0x5B, 0xE3, 0x2C, 0x7C, 0xF1, 0x80, 0xC3, - 0xBD, 0xD4, 0x79, 0x8E, 0x91, 0xB7, 0x81, 0x82, 0x51, 0xBB, 0x05, 0x5E, - 0x2A, 0x20, 0x64, 0x90, 0x4A, 0x79, 0xA7, 0x70, 0xFA, 0x15, 0xA2, 0x59, - 0xCB, 0xD5, 0x23, 0xA6, 0xA6, 0xEF, 0x09, 0xC4, 0x30, 0x48, 0xD5, 0xA2, - 0x2F, 0x97, 0x1F, 0x3C, 0x20, 0x12, 0x9B, 0x48, 0x00, 0x0E, 0x6E, 0xDD, - 0x06, 0x1C, 0xBC, 0x05, 0x3E, 0x37, 0x1D, 0x79, 0x4E, 0x53, 0x27, 0xDF, - 0x61, 0x1E, 0xBB, 0xBE, 0x1B, 0xAC, 0x9B, 0x5C, 0x60, 0x44, 0xCF, 0x02, - 0x3D, 0x76, 0xE0, 0x5E, 0xEA, 0x9B, 0xAD, 0x99, 0x1B, 0x13, 0xA6, 0x3C, - 0x97, 0x4E, 0x9E, 0xF1, 0x83, 0x9E, 0xB5, 0xDB, 0x12, 0x51, 0x36, 0xF7, - 0x26, 0x2E, 0x56, 0xA8, 0x87, 0x15, 0x38, 0xDF, 0xD8, 0x23, 0xC6, 0x50, - 0x50, 0x85, 0xE2, 0x1F, 0x0D, 0xD5, 0xC8, 0x6B, -}; -static unsigned char dh1024_g[] = -{ - 0x02, -}; - -static DH *get_dh1024() -{ - DH *dh; - - if ((dh = DH_new()) == NULL) - return (NULL); - dh->p = BN_bin2bn(dh1024_p, sizeof(dh1024_p), NULL); - dh->g = BN_bin2bn(dh1024_g, sizeof(dh1024_g), NULL); - if ((dh->p == NULL) || (dh->g == NULL)) - return (NULL); - return (dh); -} -/* ----END GENERATED SECTION---------- */ - -DH *ssl_dh_GetTmpParam(int nKeyLen) -{ - DH *dh; - - if (nKeyLen == 512) - dh = get_dh512(); - else if (nKeyLen == 1024) - dh = get_dh1024(); - else - dh = get_dh1024(); - return dh; -} - -DH *ssl_dh_GetParamFromFile(char *file) -{ - DH *dh = NULL; - BIO *bio; - - if ((bio = BIO_new_file(file, "r")) == NULL) - return NULL; -#if SSL_LIBRARY_VERSION < 0x00904000 - dh = PEM_read_bio_DHparams(bio, NULL, NULL); -#else - dh = PEM_read_bio_DHparams(bio, NULL, NULL, NULL); -#endif - BIO_free(bio); - return (dh); -} - -/* -=cut -## -## Embedded Perl script for generating the temporary DH parameters -## - -require 5.003; -use strict; - -# configuration -my $file = $0; -my $begin = '----BEGIN GENERATED SECTION--------'; -my $end = '----END GENERATED SECTION----------'; - -# read ourself and keep a backup -open(FP, "<$file") || die; -my $source = ''; -$source .= $_ while (); -close(FP); -open(FP, ">$file.bak") || die; -print FP $source; -close(FP); - -# generate the DH parameters -print "1. Generate 512 and 1024 bit Diffie-Hellman parameters (p, g)\n"; -my $rand = ''; -foreach $file (qw(/var/log/messages /var/adm/messages - /kernel /vmunix /vmlinuz /etc/hosts /etc/resolv.conf)) { - if (-f $file) { - $rand = $file if ($rand eq ''); - $rand .= ":$file" if ($rand ne ''); - } -} -$rand = "-rand $rand" if ($rand ne ''); -system("openssl gendh $rand -out dh512.pem 512"); -system("openssl gendh $rand -out dh1024.pem 1024"); - -# generate DH param info -my $dhinfo = ''; -open(FP, "openssl dh -noout -text -in dh512.pem |") || die; -$dhinfo .= $_ while (); -close(FP); -open(FP, "openssl dh -noout -text -in dh1024.pem |") || die; -$dhinfo .= $_ while (); -close(FP); -$dhinfo =~ s|^|** |mg; -$dhinfo = "\n\/\*\n$dhinfo\*\/\n\n"; - -# generate C source from DH params -my $dhsource = ''; -open(FP, "openssl dh -noout -C -in dh512.pem | indent | expand -8 |") || die; -$dhsource .= $_ while (); -close(FP); -open(FP, "openssl dh -noout -C -in dh1024.pem | indent | expand -8 |") || die; -$dhsource .= $_ while (); -close(FP); -$dhsource =~ s|(DH\s+\*get_dh)|static $1|sg; - -# generate output -my $o = $dhinfo . $dhsource; - -# insert the generated code at the target location -$source =~ s|(\/\* $begin.+?\n).*\n(.*?\/\* $end)|$1$o$2|s; - -# and update the source on disk -print "Updating file `$file'\n"; -open(FP, ">$file") || die; -print FP $source; -close(FP); - -# cleanup -unlink("dh512.pem"); -unlink("dh1024.pem"); - -=pod -*/ diff --git a/modules/ssl/ssl_engine_init.c b/modules/ssl/ssl_engine_init.c deleted file mode 100644 index 6a27c4af4d9e9e6c19e3b4242fe216d97971a57a..0000000000000000000000000000000000000000 --- a/modules/ssl/ssl_engine_init.c +++ /dev/null @@ -1,1090 +0,0 @@ -/* _ _ -** _ __ ___ ___ __| | ___ ___| | mod_ssl -** | '_ ` _ \ / _ \ / _` | / __/ __| | Apache Interface to OpenSSL -** | | | | | | (_) | (_| | \__ \__ \ | www.modssl.org -** |_| |_| |_|\___/ \__,_|___|___/___/_| ftp.modssl.org -** |_____| -** ssl_engine_init.c -** Initialization of Servers -*/ - -/* ==================================================================== - * Copyright (c) 1998-2001 Ralf S. Engelschall. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following - * disclaimer in the documentation and/or other materials - * provided with the distribution. - * - * 3. All advertising materials mentioning features or use of this - * software must display the following acknowledgment: - * "This product includes software developed by - * Ralf S. Engelschall for use in the - * mod_ssl project (http://www.modssl.org/)." - * - * 4. The names "mod_ssl" must not be used to endorse or promote - * products derived from this software without prior written - * permission. For written permission, please contact - * rse@engelschall.com. - * - * 5. Products derived from this software may not be called "mod_ssl" - * nor may "mod_ssl" appear in their names without prior - * written permission of Ralf S. Engelschall. - * - * 6. Redistributions of any form whatsoever must retain the following - * acknowledgment: - * "This product includes software developed by - * Ralf S. Engelschall for use in the - * mod_ssl project (http://www.modssl.org/)." - * - * THIS SOFTWARE IS PROVIDED BY RALF S. ENGELSCHALL ``AS IS'' AND ANY - * EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR - * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL RALF S. ENGELSCHALL OR - * HIS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT - * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, - * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED - * OF THE POSSIBILITY OF SUCH DAMAGE. - * ==================================================================== - */ - -/* ==================================================================== - * Copyright (c) 1995-1999 Ben Laurie. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in - * the documentation and/or other materials provided with the - * distribution. - * - * 3. All advertising materials mentioning features or use of this - * software must display the following acknowledgment: - * "This product includes software developed by Ben Laurie - * for use in the Apache-SSL HTTP server project." - * - * 4. The name "Apache-SSL Server" must not be used to - * endorse or promote products derived from this software without - * prior written permission. - * - * 5. Redistributions of any form whatsoever must retain the following - * acknowledgment: - * "This product includes software developed by Ben Laurie - * for use in the Apache-SSL HTTP server project." - * - * THIS SOFTWARE IS PROVIDED BY BEN LAURIE ``AS IS'' AND ANY - * EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR - * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL BEN LAURIE OR - * HIS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT - * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, - * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED - * OF THE POSSIBILITY OF SUCH DAMAGE. - * ==================================================================== - */ - /* ``Recursive, adj.; - see Recursive.'' - -- Unknown */ -#include "mod_ssl.h" - - -/* _________________________________________________________________ -** -** Module Initialization -** _________________________________________________________________ -*/ - -/* - * Per-module initialization - */ -void ssl_init_Module(server_rec *s, pool *p) -{ - SSLModConfigRec *mc = myModConfig(); - SSLSrvConfigRec *sc; - server_rec *s2; - char *cp; - - mc->nInitCount++; - - /* - * Let us cleanup on restarts and exists - */ - ap_register_cleanup(p, s, ssl_init_ModuleKill, ssl_init_ChildKill); - - /* - * Any init round fixes the global config - */ - ssl_config_global_create(); /* just to avoid problems */ - ssl_config_global_fix(); - - /* - * try to fix the configuration and open the dedicated SSL - * logfile as early as possible - */ - for (s2 = s; s2 != NULL; s2 = s2->next) { - sc = mySrvConfig(s2); - - /* Fix up stuff that may not have been set */ - if (sc->bEnabled == UNSET) - sc->bEnabled = FALSE; - if (sc->nVerifyClient == SSL_CVERIFY_UNSET) - sc->nVerifyClient = SSL_CVERIFY_NONE; - if (sc->nVerifyDepth == UNSET) - sc->nVerifyDepth = 1; -#ifdef SSL_EXPERIMENTAL_PROXY - if (sc->nProxyVerifyDepth == UNSET) - sc->nProxyVerifyDepth = 1; -#endif - if (sc->nSessionCacheTimeout == UNSET) - sc->nSessionCacheTimeout = SSL_SESSION_CACHE_TIMEOUT; - if (sc->nPassPhraseDialogType == SSL_PPTYPE_UNSET) - sc->nPassPhraseDialogType = SSL_PPTYPE_BUILTIN; - - /* Open the dedicated SSL logfile */ - ssl_log_open(s, s2, p); - } - - /* - * Identification - */ - if (mc->nInitCount == 1) { - ssl_log(s, SSL_LOG_INFO, "Server: %s, Interface: %s, Library: %s", - SERVER_BASEVERSION, - ssl_var_lookup(p, NULL, NULL, NULL, "SSL_VERSION_INTERFACE"), - ssl_var_lookup(p, NULL, NULL, NULL, "SSL_VERSION_LIBRARY")); -#ifdef WIN32 - ssl_log(s, SSL_LOG_WARN, "You are using mod_ssl under Win32. " - "This combination is *NOT* officially supported. " - "Use it at your own risk!"); -#endif - } - - /* - * Initialization round information - */ - if (mc->nInitCount == 1) - ssl_log(s, SSL_LOG_INFO, "Init: 1st startup round (still not detached)"); - else if (mc->nInitCount == 2) - ssl_log(s, SSL_LOG_INFO, "Init: 2nd startup round (already detached)"); - else - ssl_log(s, SSL_LOG_INFO, "Init: %d%s restart round (already detached)", - mc->nInitCount-2, (mc->nInitCount-2) == 1 ? "st" : "nd"); - -#ifdef SSL_VENDOR - ap_hook_use("ap::mod_ssl::vendor::init_module", - AP_HOOK_SIG3(void,ptr,ptr), AP_HOOK_ALL, s, p); -#endif - - /* - * The initialization phase inside the Apache API is totally bogus. - * We actually have three non-trivial problems: - * - * 1. Under Unix the API does a 2-round initialization of modules while - * under Win32 it doesn't. This means we have to make sure that at - * least the pass phrase dialog doesn't occur twice. We overcome this - * problem by using a counter (mc->nInitCount) which has to - * survive the init rounds. - * - * 2. Between the first and the second round Apache detaches from - * the terminal under Unix. This means that our pass phrase dialog - * _has_ to be done in the first round and _cannot_ be done in the - * second round. - * - * 3. When Dynamic Shared Object (DSO) mechanism is used under Unix the - * module segment (code & data) gets unloaded and re-loaded between - * the first and the second round. This means no global data survives - * between first and the second init round. We overcome this by using - * an entry ("ssl_module") inside the ap_global_ctx. - * - * The situation as a table: - * - * Unix/static Unix/DSO Win32 Action Required - * (-DSHARED_MODULE) (-DWIN32) - * ----------- ----------------- --------- ----------------------------------- - * - load module - - - * init init init SSL library init, Pass Phrase Dialog - * detach detach - - - * - reload module - - - * init init - SSL library init, mod_ssl init - * - * Ok, now try to solve this totally ugly situation... - */ - -#ifdef SHARED_MODULE - ssl_log(s, SSL_LOG_INFO, "Init: %snitializing %s library", - mc->nInitCount == 1 ? "I" : "Rei", SSL_LIBRARY_NAME); - ssl_init_SSLLibrary(); -#else - if (mc->nInitCount <= 2) { - ssl_log(s, SSL_LOG_INFO, "Init: %snitializing %s library", - mc->nInitCount == 1 ? "I" : "Rei", SSL_LIBRARY_NAME); - ssl_init_SSLLibrary(); - } -#endif - if (mc->nInitCount == 1) { - ssl_pphrase_Handle(s, p); - ssl_init_TmpKeysHandle(SSL_TKP_GEN, s, p); -#ifndef WIN32 - return; -#endif - } - - /* - * SSL external crypto device ("engine") support - */ -#ifdef SSL_EXPERIMENTAL_ENGINE - ssl_init_Engine(s, p); -#endif - - /* - * Warn the user that he should use the session cache. - * But we can operate without it, of course. - */ - if (mc->nSessionCacheMode == SSL_SCMODE_UNSET) { - ssl_log(s, SSL_LOG_WARN, - "Init: Session Cache is not configured [hint: SSLSessionCache]"); - mc->nSessionCacheMode = SSL_SCMODE_NONE; - } - - /* - * initialize the mutex handling and session caching - */ - ssl_mutex_init(s, p); - ssl_scache_init(s, p); - - /* - * Seed the Pseudo Random Number Generator (PRNG) - */ - ssl_rand_seed(s, p, SSL_RSCTX_STARTUP, "Init: "); - - /* - * allocate the temporary RSA keys and DH params - */ - ssl_init_TmpKeysHandle(SSL_TKP_ALLOC, s, p); - - /* - * initialize servers - */ - ssl_log(s, SSL_LOG_INFO, "Init: Initializing (virtual) servers for SSL"); - for (s2 = s; s2 != NULL; s2 = s2->next) { - sc = mySrvConfig(s2); - /* - * Either now skip this server when SSL is disabled for - * it or give out some information about what we're - * configuring. - */ - if (!sc->bEnabled) - continue; - ssl_log(s2, SSL_LOG_INFO, - "Init: Configuring server %s for SSL protocol", - ssl_util_vhostid(p, s2)); - - /* - * Read the server certificate and key - */ - ssl_init_ConfigureServer(s2, p, sc); - } - - /* - * Configuration consistency checks - */ - ssl_init_CheckServers(s, p); - - /* - * Announce mod_ssl and SSL library in HTTP Server field - * as ``mod_ssl/X.X.X OpenSSL/X.X.X'' - */ - if ((cp = ssl_var_lookup(p, NULL, NULL, NULL, "SSL_VERSION_PRODUCT")) != NULL && cp[0] != NUL) - ap_add_version_component(cp); - ap_add_version_component(ssl_var_lookup(p, NULL, NULL, NULL, "SSL_VERSION_INTERFACE")); - ap_add_version_component(ssl_var_lookup(p, NULL, NULL, NULL, "SSL_VERSION_LIBRARY")); - - return; -} - -/* - * Initialize SSL library (also already needed for the pass phrase dialog) - */ -void ssl_init_SSLLibrary(void) -{ -#ifdef WIN32 - CRYPTO_malloc_init(); -#endif - SSL_load_error_strings(); - SSL_library_init(); - ssl_util_thread_setup(); - X509V3_add_standard_extensions(); - return; -} - -/* - * Support for external a Crypto Device ("engine"), usually - * a hardware accellerator card for crypto operations. - */ -#ifdef SSL_EXPERIMENTAL_ENGINE -void ssl_init_Engine(server_rec *s, pool *p) -{ - SSLModConfigRec *mc = myModConfig(); - ENGINE *e; - - if (mc->szCryptoDevice != NULL) { - if ((e = ENGINE_by_id(mc->szCryptoDevice)) == NULL) { - ssl_log(s, SSL_LOG_ERROR, "Init: Failed to load Crypto Device API `%s'", - mc->szCryptoDevice); - ssl_die(); - } - if (strEQ(mc->szCryptoDevice, "chil")) - ENGINE_ctrl(e, ENGINE_CTRL_CHIL_SET_FORKCHECK, 1, 0, 0); - if (!ENGINE_set_default(e, ENGINE_METHOD_ALL)) { - ssl_log(s, SSL_LOG_ERROR, "Init: Failed to enable Crypto Device API `%s'", - mc->szCryptoDevice); - ssl_die(); - } - ENGINE_free(e); - } - return; -} -#endif - -/* - * Handle the Temporary RSA Keys and DH Params - */ -void ssl_init_TmpKeysHandle(int action, server_rec *s, pool *p) -{ - SSLModConfigRec *mc = myModConfig(); - ssl_asn1_t *asn1; - unsigned char *ucp; - RSA *rsa; - DH *dh; - - /* Generate Keys and Params */ - if (action == SSL_TKP_GEN) { - - /* seed PRNG */ - ssl_rand_seed(s, p, SSL_RSCTX_STARTUP, "Init: "); - - /* generate 512 bit RSA key */ - ssl_log(s, SSL_LOG_INFO, "Init: Generating temporary RSA private keys (512/1024 bits)"); - if ((rsa = RSA_generate_key(512, RSA_F4, NULL, NULL)) == NULL) { - ssl_log(s, SSL_LOG_ERROR|SSL_ADD_SSLERR, - "Init: Failed to generate temporary 512 bit RSA private key"); - ssl_die(); - } - asn1 = (ssl_asn1_t *)ssl_ds_table_push(mc->tTmpKeys, "RSA:512"); - asn1->nData = i2d_RSAPrivateKey(rsa, NULL); - asn1->cpData = ap_palloc(mc->pPool, asn1->nData); - ucp = asn1->cpData; i2d_RSAPrivateKey(rsa, &ucp); /* 2nd arg increments */ - RSA_free(rsa); - - /* generate 1024 bit RSA key */ - if ((rsa = RSA_generate_key(1024, RSA_F4, NULL, NULL)) == NULL) { - ssl_log(s, SSL_LOG_ERROR|SSL_ADD_SSLERR, - "Init: Failed to generate temporary 1024 bit RSA private key"); - ssl_die(); - } - asn1 = (ssl_asn1_t *)ssl_ds_table_push(mc->tTmpKeys, "RSA:1024"); - asn1->nData = i2d_RSAPrivateKey(rsa, NULL); - asn1->cpData = ap_palloc(mc->pPool, asn1->nData); - ucp = asn1->cpData; i2d_RSAPrivateKey(rsa, &ucp); /* 2nd arg increments */ - RSA_free(rsa); - - ssl_log(s, SSL_LOG_INFO, "Init: Configuring temporary DH parameters (512/1024 bits)"); - - /* import 512 bit DH param */ - if ((dh = ssl_dh_GetTmpParam(512)) == NULL) { - ssl_log(s, SSL_LOG_ERROR, "Init: Failed to import temporary 512 bit DH parameters"); - ssl_die(); - } - asn1 = (ssl_asn1_t *)ssl_ds_table_push(mc->tTmpKeys, "DH:512"); - asn1->nData = i2d_DHparams(dh, NULL); - asn1->cpData = ap_palloc(mc->pPool, asn1->nData); - ucp = asn1->cpData; i2d_DHparams(dh, &ucp); /* 2nd arg increments */ - /* no need to free dh, it's static */ - - /* import 1024 bit DH param */ - if ((dh = ssl_dh_GetTmpParam(1024)) == NULL) { - ssl_log(s, SSL_LOG_ERROR, "Init: Failed to import temporary 1024 bit DH parameters"); - ssl_die(); - } - asn1 = (ssl_asn1_t *)ssl_ds_table_push(mc->tTmpKeys, "DH:1024"); - asn1->nData = i2d_DHparams(dh, NULL); - asn1->cpData = ap_palloc(mc->pPool, asn1->nData); - ucp = asn1->cpData; i2d_DHparams(dh, &ucp); /* 2nd arg increments */ - /* no need to free dh, it's static */ - } - - /* Allocate Keys and Params */ - else if (action == SSL_TKP_ALLOC) { - - ssl_log(s, SSL_LOG_INFO, "Init: Configuring temporary RSA private keys (512/1024 bits)"); - - /* allocate 512 bit RSA key */ - if ((asn1 = (ssl_asn1_t *)ssl_ds_table_get(mc->tTmpKeys, "RSA:512")) != NULL) { - ucp = asn1->cpData; - if ((mc->pTmpKeys[SSL_TKPIDX_RSA512] = -#if SSL_LIBRARY_VERSION >= 0x00907000 - (void *)d2i_RSAPrivateKey(NULL, (const unsigned char **)&ucp, asn1->nData)) == NULL) { -#else - (void *)d2i_RSAPrivateKey(NULL, &ucp, asn1->nData)) == NULL) { -#endif - ssl_log(s, SSL_LOG_ERROR, "Init: Failed to load temporary 512 bit RSA private key"); - ssl_die(); - } - } - - /* allocate 1024 bit RSA key */ - if ((asn1 = (ssl_asn1_t *)ssl_ds_table_get(mc->tTmpKeys, "RSA:1024")) != NULL) { - ucp = asn1->cpData; - if ((mc->pTmpKeys[SSL_TKPIDX_RSA1024] = -#if SSL_LIBRARY_VERSION >= 0x00907000 - (void *)d2i_RSAPrivateKey(NULL, (const unsigned char **)&ucp, asn1->nData)) == NULL) { -#else - (void *)d2i_RSAPrivateKey(NULL, &ucp, asn1->nData)) == NULL) { -#endif - ssl_log(s, SSL_LOG_ERROR, "Init: Failed to load temporary 1024 bit RSA private key"); - ssl_die(); - } - } - - ssl_log(s, SSL_LOG_INFO, "Init: Configuring temporary DH parameters (512/1024 bits)"); - - /* allocate 512 bit DH param */ - if ((asn1 = (ssl_asn1_t *)ssl_ds_table_get(mc->tTmpKeys, "DH:512")) != NULL) { - ucp = asn1->cpData; - if ((mc->pTmpKeys[SSL_TKPIDX_DH512] = -#if SSL_LIBRARY_VERSION >= 0x00907000 - (void *)d2i_DHparams(NULL, (const unsigned char **)&ucp, asn1->nData)) == NULL) { -#else - (void *)d2i_DHparams(NULL, &ucp, asn1->nData)) == NULL) { -#endif - ssl_log(s, SSL_LOG_ERROR, "Init: Failed to load temporary 512 bit DH parameters"); - ssl_die(); - } - } - - /* allocate 1024 bit DH param */ - if ((asn1 = (ssl_asn1_t *)ssl_ds_table_get(mc->tTmpKeys, "DH:1024")) != NULL) { - ucp = asn1->cpData; - if ((mc->pTmpKeys[SSL_TKPIDX_DH1024] = -#if SSL_LIBRARY_VERSION >= 0x00907000 - (void *)d2i_DHparams(NULL, (const unsigned char **)&ucp, asn1->nData)) == NULL) { -#else - (void *)d2i_DHparams(NULL, &ucp, asn1->nData)) == NULL) { -#endif - ssl_log(s, SSL_LOG_ERROR, "Init: Failed to load temporary 1024 bit DH parameters"); - ssl_die(); - } - } - } - - /* Free Keys and Params */ - else if (action == SSL_TKP_FREE) { - if (mc->pTmpKeys[SSL_TKPIDX_RSA512] != NULL) { - RSA_free((RSA *)mc->pTmpKeys[SSL_TKPIDX_RSA512]); - mc->pTmpKeys[SSL_TKPIDX_RSA512] = NULL; - } - if (mc->pTmpKeys[SSL_TKPIDX_RSA1024] != NULL) { - RSA_free((RSA *)mc->pTmpKeys[SSL_TKPIDX_RSA1024]); - mc->pTmpKeys[SSL_TKPIDX_RSA1024] = NULL; - } - if (mc->pTmpKeys[SSL_TKPIDX_DH512] != NULL) { - DH_free((DH *)mc->pTmpKeys[SSL_TKPIDX_DH512]); - mc->pTmpKeys[SSL_TKPIDX_DH512] = NULL; - } - if (mc->pTmpKeys[SSL_TKPIDX_DH1024] != NULL) { - DH_free((DH *)mc->pTmpKeys[SSL_TKPIDX_DH1024]); - mc->pTmpKeys[SSL_TKPIDX_DH1024] = NULL; - } - } - return; -} - -/* - * Configure a particular server - */ -void ssl_init_ConfigureServer(server_rec *s, pool *p, SSLSrvConfigRec *sc) -{ - SSLModConfigRec *mc = myModConfig(); - int nVerify; - char *cpVHostID; - EVP_PKEY *pKey; - SSL_CTX *ctx; - STACK_OF(X509_NAME) *skCAList; - ssl_asn1_t *asn1; - unsigned char *ucp; - char *cp; - BOOL ok; - BOOL bSkipFirst; - int isca, pathlen; - int i, n; - - /* - * Create the server host:port string because we need it a lot - */ - cpVHostID = ssl_util_vhostid(p, s); - - /* - * Now check for important parameters and the - * possibility that the user forgot to set them. - */ - if (sc->szPublicCertFile[0] == NULL) { - ssl_log(s, SSL_LOG_ERROR, - "Init: (%s) No SSL Certificate set [hint: SSLCertificateFile]", - cpVHostID); - ssl_die(); - } - - /* - * Check for problematic re-initializations - */ - if (sc->pPublicCert[SSL_AIDX_RSA] != NULL || - sc->pPublicCert[SSL_AIDX_DSA] != NULL ) { - ssl_log(s, SSL_LOG_ERROR, - "Init: (%s) Illegal attempt to re-initialise SSL for server " - "(theoretically shouldn't happen!)", cpVHostID); - ssl_die(); - } - - /* - * Create the new per-server SSL context - */ - if (sc->nProtocol == SSL_PROTOCOL_NONE) { - ssl_log(s, SSL_LOG_ERROR, - "Init: (%s) No SSL protocols available [hint: SSLProtocol]", - cpVHostID); - ssl_die(); - } - cp = ap_pstrcat(p, (sc->nProtocol & SSL_PROTOCOL_SSLV2 ? "SSLv2, " : ""), - (sc->nProtocol & SSL_PROTOCOL_SSLV3 ? "SSLv3, " : ""), - (sc->nProtocol & SSL_PROTOCOL_TLSV1 ? "TLSv1, " : ""), NULL); - cp[strlen(cp)-2] = NUL; - ssl_log(s, SSL_LOG_TRACE, - "Init: (%s) Creating new SSL context (protocols: %s)", cpVHostID, cp); - if (sc->nProtocol == SSL_PROTOCOL_SSLV2) - ctx = SSL_CTX_new(SSLv2_server_method()); /* only SSLv2 is left */ - else - ctx = SSL_CTX_new(SSLv23_server_method()); /* be more flexible */ - SSL_CTX_set_options(ctx, SSL_OP_ALL); - if (!(sc->nProtocol & SSL_PROTOCOL_SSLV2)) - SSL_CTX_set_options(ctx, SSL_OP_NO_SSLv2); - if (!(sc->nProtocol & SSL_PROTOCOL_SSLV3)) - SSL_CTX_set_options(ctx, SSL_OP_NO_SSLv3); - if (!(sc->nProtocol & SSL_PROTOCOL_TLSV1)) - SSL_CTX_set_options(ctx, SSL_OP_NO_TLSv1); - SSL_CTX_set_app_data(ctx, s); - sc->pSSLCtx = ctx; - - /* - * Configure additional context ingredients - */ - SSL_CTX_set_options(ctx, SSL_OP_SINGLE_DH_USE); - if (mc->nSessionCacheMode == SSL_SCMODE_NONE) - SSL_CTX_set_session_cache_mode(ctx, SSL_SESS_CACHE_OFF); - else - SSL_CTX_set_session_cache_mode(ctx, SSL_SESS_CACHE_SERVER); - - /* - * Configure callbacks for SSL context - */ - nVerify = SSL_VERIFY_NONE; - if (sc->nVerifyClient == SSL_CVERIFY_REQUIRE) - nVerify |= SSL_VERIFY_PEER|SSL_VERIFY_FAIL_IF_NO_PEER_CERT; - if ( (sc->nVerifyClient == SSL_CVERIFY_OPTIONAL) - || (sc->nVerifyClient == SSL_CVERIFY_OPTIONAL_NO_CA) ) - nVerify |= SSL_VERIFY_PEER; - SSL_CTX_set_verify(ctx, nVerify, ssl_callback_SSLVerify); - SSL_CTX_sess_set_new_cb(ctx, ssl_callback_NewSessionCacheEntry); - SSL_CTX_sess_set_get_cb(ctx, ssl_callback_GetSessionCacheEntry); - SSL_CTX_sess_set_remove_cb(ctx, ssl_callback_DelSessionCacheEntry); - SSL_CTX_set_tmp_rsa_callback(ctx, ssl_callback_TmpRSA); - SSL_CTX_set_tmp_dh_callback(ctx, ssl_callback_TmpDH); - SSL_CTX_set_info_callback(ctx, ssl_callback_LogTracingState); - - /* - * Configure SSL Cipher Suite - */ - if (sc->szCipherSuite != NULL) { - ssl_log(s, SSL_LOG_TRACE, - "Init: (%s) Configuring permitted SSL ciphers [%s]", - cpVHostID, sc->szCipherSuite); - if (!SSL_CTX_set_cipher_list(ctx, sc->szCipherSuite)) { - ssl_log(s, SSL_LOG_ERROR|SSL_ADD_SSLERR, - "Init: (%s) Unable to configure permitted SSL ciphers", - cpVHostID); - ssl_die(); - } - } - - /* - * Configure Client Authentication details - */ - if (sc->szCACertificateFile != NULL || sc->szCACertificatePath != NULL) { - ssl_log(s, SSL_LOG_TRACE, - "Init: (%s) Configuring client authentication", cpVHostID); - if (!SSL_CTX_load_verify_locations(ctx, - sc->szCACertificateFile, - sc->szCACertificatePath)) { - ssl_log(s, SSL_LOG_ERROR|SSL_ADD_SSLERR, - "Init: (%s) Unable to configure verify locations " - "for client authentication", cpVHostID); - ssl_die(); - } - if ((skCAList = ssl_init_FindCAList(s, p, sc->szCACertificateFile, - sc->szCACertificatePath)) == NULL) { - ssl_log(s, SSL_LOG_ERROR, - "Init: (%s) Unable to determine list of available " - "CA certificates for client authentication", cpVHostID); - ssl_die(); - } - SSL_CTX_set_client_CA_list(sc->pSSLCtx, skCAList); - } - - /* - * Configure Certificate Revocation List (CRL) Details - */ - if (sc->szCARevocationFile != NULL || sc->szCARevocationPath != NULL) { - ssl_log(s, SSL_LOG_TRACE, - "Init: (%s) Configuring certificate revocation facility", cpVHostID); - if ((sc->pRevocationStore = - SSL_X509_STORE_create(sc->szCARevocationFile, - sc->szCARevocationPath)) == NULL) { - ssl_log(s, SSL_LOG_ERROR|SSL_ADD_SSLERR, - "Init: (%s) Unable to configure X.509 CRL storage " - "for certificate revocation", cpVHostID); - ssl_die(); - } - } - - /* - * Give a warning when no CAs were configured but client authentication - * should take place. This cannot work. - */ - if (sc->nVerifyClient == SSL_CVERIFY_REQUIRE) { - skCAList = SSL_CTX_get_client_CA_list(ctx); - if (sk_X509_NAME_num(skCAList) == 0) - ssl_log(s, SSL_LOG_WARN, - "Init: Ops, you want to request client authentication, " - "but no CAs are known for verification!? " - "[Hint: SSLCACertificate*]"); - } - - /* - * Configure server certificate(s) - */ - ok = FALSE; - cp = ap_psprintf(p, "%s:RSA", cpVHostID); - if ((asn1 = (ssl_asn1_t *)ssl_ds_table_get(mc->tPublicCert, cp)) != NULL) { - ssl_log(s, SSL_LOG_TRACE, - "Init: (%s) Configuring RSA server certificate", cpVHostID); - ucp = asn1->cpData; - if ((sc->pPublicCert[SSL_AIDX_RSA] = d2i_X509(NULL, &ucp, asn1->nData)) == NULL) { - ssl_log(s, SSL_LOG_ERROR|SSL_ADD_SSLERR, - "Init: (%s) Unable to import RSA server certificate", - cpVHostID); - ssl_die(); - } - if (SSL_CTX_use_certificate(ctx, sc->pPublicCert[SSL_AIDX_RSA]) <= 0) { - ssl_log(s, SSL_LOG_ERROR|SSL_ADD_SSLERR, - "Init: (%s) Unable to configure RSA server certificate", - cpVHostID); - ssl_die(); - } - ok = TRUE; - } - cp = ap_psprintf(p, "%s:DSA", cpVHostID); - if ((asn1 = (ssl_asn1_t *)ssl_ds_table_get(mc->tPublicCert, cp)) != NULL) { - ssl_log(s, SSL_LOG_TRACE, - "Init: (%s) Configuring DSA server certificate", cpVHostID); - ucp = asn1->cpData; - if ((sc->pPublicCert[SSL_AIDX_DSA] = d2i_X509(NULL, &ucp, asn1->nData)) == NULL) { - ssl_log(s, SSL_LOG_ERROR|SSL_ADD_SSLERR, - "Init: (%s) Unable to import DSA server certificate", - cpVHostID); - ssl_die(); - } - if (SSL_CTX_use_certificate(ctx, sc->pPublicCert[SSL_AIDX_DSA]) <= 0) { - ssl_log(s, SSL_LOG_ERROR|SSL_ADD_SSLERR, - "Init: (%s) Unable to configure DSA server certificate", - cpVHostID); - ssl_die(); - } - ok = TRUE; - } - if (!ok) { - ssl_log(s, SSL_LOG_ERROR, - "Init: (%s) Ops, no RSA or DSA server certificate found?!", cpVHostID); - ssl_log(s, SSL_LOG_ERROR, - "Init: (%s) You have to perform a *full* server restart when you added or removed a certificate and/or key file", cpVHostID); - ssl_die(); - } - - /* - * Some information about the certificate(s) - */ - for (i = 0; i < SSL_AIDX_MAX; i++) { - if (sc->pPublicCert[i] != NULL) { - if (SSL_X509_isSGC(sc->pPublicCert[i])) { - ssl_log(s, SSL_LOG_INFO, - "Init: (%s) %s server certificate enables " - "Server Gated Cryptography (SGC)", - cpVHostID, (i == SSL_AIDX_RSA ? "RSA" : "DSA")); - } - if (SSL_X509_getBC(sc->pPublicCert[i], &isca, &pathlen)) { - if (isca) - ssl_log(s, SSL_LOG_WARN, - "Init: (%s) %s server certificate is a CA certificate " - "(BasicConstraints: CA == TRUE !?)", - cpVHostID, (i == SSL_AIDX_RSA ? "RSA" : "DSA")); - if (pathlen > 0) - ssl_log(s, SSL_LOG_WARN, - "Init: (%s) %s server certificate is not a leaf certificate " - "(BasicConstraints: pathlen == %d > 0 !?)", - cpVHostID, (i == SSL_AIDX_RSA ? "RSA" : "DSA"), pathlen); - } - if (SSL_X509_getCN(p, sc->pPublicCert[i], &cp)) { - if (ap_is_fnmatch(cp) && - !ap_fnmatch(cp, s->server_hostname, FNM_PERIOD|FNM_CASE_BLIND)) { - ssl_log(s, SSL_LOG_WARN, - "Init: (%s) %s server certificate wildcard CommonName (CN) `%s' " - "does NOT match server name!?", cpVHostID, - (i == SSL_AIDX_RSA ? "RSA" : "DSA"), cp); - } - else if (strNE(s->server_hostname, cp)) { - ssl_log(s, SSL_LOG_WARN, - "Init: (%s) %s server certificate CommonName (CN) `%s' " - "does NOT match server name!?", cpVHostID, - (i == SSL_AIDX_RSA ? "RSA" : "DSA"), cp); - } - } - } - } - - /* - * Configure server private key(s) - */ - ok = FALSE; - cp = ap_psprintf(p, "%s:RSA", cpVHostID); - if ((asn1 = (ssl_asn1_t *)ssl_ds_table_get(mc->tPrivateKey, cp)) != NULL) { - ssl_log(s, SSL_LOG_TRACE, - "Init: (%s) Configuring RSA server private key", cpVHostID); - ucp = asn1->cpData; - if ((sc->pPrivateKey[SSL_AIDX_RSA] = - d2i_PrivateKey(EVP_PKEY_RSA, NULL, &ucp, asn1->nData)) == NULL) { - ssl_log(s, SSL_LOG_ERROR|SSL_ADD_SSLERR, - "Init: (%s) Unable to import RSA server private key", - cpVHostID); - ssl_die(); - } - if (SSL_CTX_use_PrivateKey(ctx, sc->pPrivateKey[SSL_AIDX_RSA]) <= 0) { - ssl_log(s, SSL_LOG_ERROR|SSL_ADD_SSLERR, - "Init: (%s) Unable to configure RSA server private key", - cpVHostID); - ssl_die(); - } - ok = TRUE; - } - cp = ap_psprintf(p, "%s:DSA", cpVHostID); - if ((asn1 = (ssl_asn1_t *)ssl_ds_table_get(mc->tPrivateKey, cp)) != NULL) { - ssl_log(s, SSL_LOG_TRACE, - "Init: (%s) Configuring DSA server private key", cpVHostID); - ucp = asn1->cpData; - if ((sc->pPrivateKey[SSL_AIDX_DSA] = - d2i_PrivateKey(EVP_PKEY_DSA, NULL, &ucp, asn1->nData)) == NULL) { - ssl_log(s, SSL_LOG_ERROR|SSL_ADD_SSLERR, - "Init: (%s) Unable to import DSA server private key", - cpVHostID); - ssl_die(); - } - if (SSL_CTX_use_PrivateKey(ctx, sc->pPrivateKey[SSL_AIDX_DSA]) <= 0) { - ssl_log(s, SSL_LOG_ERROR|SSL_ADD_SSLERR, - "Init: (%s) Unable to configure DSA server private key", - cpVHostID); - ssl_die(); - } - ok = TRUE; - } - if (!ok) { - ssl_log(s, SSL_LOG_ERROR, - "Init: (%s) Ops, no RSA or DSA server private key found?!", cpVHostID); - ssl_die(); - } - - /* - * Optionally copy DSA parameters for certificate from private key - * (see http://www.psy.uq.edu.au/~ftp/Crypto/ssleay/TODO.html) - */ - if ( sc->pPublicCert[SSL_AIDX_DSA] != NULL - && sc->pPrivateKey[SSL_AIDX_DSA] != NULL) { - pKey = X509_get_pubkey(sc->pPublicCert[SSL_AIDX_DSA]); - if ( pKey != NULL - && EVP_PKEY_type(pKey->type) == EVP_PKEY_DSA - && EVP_PKEY_missing_parameters(pKey)) - EVP_PKEY_copy_parameters(pKey, sc->pPrivateKey[SSL_AIDX_DSA]); - } - - /* - * Optionally configure extra server certificate chain certificates. - * This is usually done by OpenSSL automatically when one of the - * server cert issuers are found under SSLCACertificatePath or in - * SSLCACertificateFile. But because these are intended for client - * authentication it can conflict. For instance when you use a - * Global ID server certificate you've to send out the intermediate - * CA certificate, too. When you would just configure this with - * SSLCACertificateFile and also use client authentication mod_ssl - * would accept all clients also issued by this CA. Obviously this - * isn't what we want in this situation. So this feature here exists - * to allow one to explicity configure CA certificates which are - * used only for the server certificate chain. - */ - if (sc->szCertificateChain != NULL) { - bSkipFirst = FALSE; - for (i = 0; i < SSL_AIDX_MAX && sc->szPublicCertFile[i] != NULL; i++) { - if (strEQ(sc->szPublicCertFile[i], sc->szCertificateChain)) { - bSkipFirst = TRUE; - break; - } - } - if ((n = SSL_CTX_use_certificate_chain(ctx, sc->szCertificateChain, - bSkipFirst, NULL)) < 0) { - ssl_log(s, SSL_LOG_ERROR, - "Init: (%s) Failed to configure CA certificate chain!", cpVHostID); - ssl_die(); - } - ssl_log(s, SSL_LOG_TRACE, "Init: (%s) Configuring " - "server certificate chain (%d CA certificate%s)", cpVHostID, - n, n == 1 ? "" : "s"); - } - -#ifdef SSL_VENDOR - ap_hook_use("ap::mod_ssl::vendor::configure_server", - AP_HOOK_SIG4(void,ptr,ptr,ptr), AP_HOOK_ALL, - s, p, sc); -#endif - - return; -} - -void ssl_init_CheckServers(server_rec *sm, pool *p) -{ - server_rec *s; - server_rec **ps; - SSLSrvConfigRec *sc; - ssl_ds_table *t; - pool *sp; - char *key; - BOOL bConflict; - - /* - * Give out warnings when a server has HTTPS configured - * for the HTTP port or vice versa - */ - for (s = sm; s != NULL; s = s->next) { - sc = mySrvConfig(s); - if (sc->bEnabled && s->port == DEFAULT_HTTP_PORT) - ssl_log(sm, SSL_LOG_WARN, - "Init: (%s) You configured HTTPS(%d) on the standard HTTP(%d) port!", - ssl_util_vhostid(p, s), DEFAULT_HTTPS_PORT, DEFAULT_HTTP_PORT); - if (!sc->bEnabled && s->port == DEFAULT_HTTPS_PORT) - ssl_log(sm, SSL_LOG_WARN, - "Init: (%s) You configured HTTP(%d) on the standard HTTPS(%d) port!", - ssl_util_vhostid(p, s), DEFAULT_HTTP_PORT, DEFAULT_HTTPS_PORT); - } - - /* - * Give out warnings when more than one SSL-aware virtual server uses the - * same IP:port. This doesn't work because mod_ssl then will always use - * just the certificate/keys of one virtual host (which one cannot be said - * easily - but that doesn't matter here). - */ - sp = ap_make_sub_pool(p); - t = ssl_ds_table_make(sp, sizeof(server_rec *)); - bConflict = FALSE; - for (s = sm; s != NULL; s = s->next) { - sc = mySrvConfig(s); - if (!sc->bEnabled) - continue; - key = ap_psprintf(sp, "%pA:%u", &s->addrs->host_addr, s->addrs->host_port); - ps = ssl_ds_table_get(t, key); - if (ps != NULL) { - ssl_log(sm, SSL_LOG_WARN, - "Init: SSL server IP/port conflict: %s (%s:%d) vs. %s (%s:%d)", - ssl_util_vhostid(p, s), - (s->defn_name != NULL ? s->defn_name : "unknown"), - s->defn_line_number, - ssl_util_vhostid(p, *ps), - ((*ps)->defn_name != NULL ? (*ps)->defn_name : "unknown"), - (*ps)->defn_line_number); - bConflict = TRUE; - continue; - } - ps = ssl_ds_table_push(t, key); - *ps = s; - } - ssl_ds_table_kill(t); - ap_destroy_pool(sp); - if (bConflict) - ssl_log(sm, SSL_LOG_WARN, - "Init: You should not use name-based virtual hosts in conjunction with SSL!!"); - - return; -} - -static int ssl_init_FindCAList_X509NameCmp(X509_NAME **a, X509_NAME **b) -{ - return(X509_NAME_cmp(*a, *b)); -} - -STACK_OF(X509_NAME) *ssl_init_FindCAList(server_rec *s, pool *pp, char *cpCAfile, char *cpCApath) -{ - STACK_OF(X509_NAME) *skCAList; - STACK_OF(X509_NAME) *sk; - DIR *dir; - struct DIR_TYPE *direntry; - char *cp; - pool *p; - int n; - - /* - * Use a subpool so we don't bloat up the server pool which - * is remains in memory for the complete operation time of - * the server. - */ - p = ap_make_sub_pool(pp); - - /* - * Start with a empty stack/list where new - * entries get added in sorted order. - */ - skCAList = sk_X509_NAME_new(ssl_init_FindCAList_X509NameCmp); - - /* - * Process CA certificate bundle file - */ - if (cpCAfile != NULL) { - sk = SSL_load_client_CA_file(cpCAfile); - for(n = 0; sk != NULL && n < sk_X509_NAME_num(sk); n++) { - ssl_log(s, SSL_LOG_TRACE, - "CA certificate: %s", - X509_NAME_oneline(sk_X509_NAME_value(sk, n), NULL, 0)); - if (sk_X509_NAME_find(skCAList, sk_X509_NAME_value(sk, n)) < 0) - sk_X509_NAME_push(skCAList, sk_X509_NAME_value(sk, n)); - } - } - - /* - * Process CA certificate path files - */ - if (cpCApath != NULL) { - dir = ap_popendir(p, cpCApath); - while ((direntry = readdir(dir)) != NULL) { - cp = ap_pstrcat(p, cpCApath, "/", direntry->d_name, NULL); - sk = SSL_load_client_CA_file(cp); - for(n = 0; sk != NULL && n < sk_X509_NAME_num(sk); n++) { - ssl_log(s, SSL_LOG_TRACE, - "CA certificate: %s", - X509_NAME_oneline(sk_X509_NAME_value(sk, n), NULL, 0)); - if (sk_X509_NAME_find(skCAList, sk_X509_NAME_value(sk, n)) < 0) - sk_X509_NAME_push(skCAList, sk_X509_NAME_value(sk, n)); - } - } - ap_pclosedir(p, dir); - } - - /* - * Cleanup - */ - sk_X509_NAME_set_cmp_func(skCAList, NULL); - ap_destroy_pool(p); - - return skCAList; -} - -void ssl_init_Child(server_rec *s, pool *p) -{ - /* open the mutex lockfile */ - ssl_mutex_reinit(s, p); - return; -} - -void ssl_init_ChildKill(void *data) -{ - /* currently nothing to do */ - return; -} - -void ssl_init_ModuleKill(void *data) -{ - SSLSrvConfigRec *sc; - server_rec *s = (server_rec *)data; - - /* - * Drop the session cache and mutex - */ - ssl_scache_kill(s); - ssl_mutex_kill(s); - - /* - * Destroy the temporary keys and params - */ - ssl_init_TmpKeysHandle(SSL_TKP_FREE, s, NULL); - - /* - * Free the non-pool allocated structures - * in the per-server configurations - */ - for (; s != NULL; s = s->next) { - sc = mySrvConfig(s); - if (sc->pPublicCert[SSL_AIDX_RSA] != NULL) { - X509_free(sc->pPublicCert[SSL_AIDX_RSA]); - sc->pPublicCert[SSL_AIDX_RSA] = NULL; - } - if (sc->pPublicCert[SSL_AIDX_DSA] != NULL) { - X509_free(sc->pPublicCert[SSL_AIDX_DSA]); - sc->pPublicCert[SSL_AIDX_DSA] = NULL; - } - if (sc->pPrivateKey[SSL_AIDX_RSA] != NULL) { - EVP_PKEY_free(sc->pPrivateKey[SSL_AIDX_RSA]); - sc->pPrivateKey[SSL_AIDX_RSA] = NULL; - } - if (sc->pPrivateKey[SSL_AIDX_DSA] != NULL) { - EVP_PKEY_free(sc->pPrivateKey[SSL_AIDX_DSA]); - sc->pPrivateKey[SSL_AIDX_DSA] = NULL; - } - if (sc->pSSLCtx != NULL) { - SSL_CTX_free(sc->pSSLCtx); - sc->pSSLCtx = NULL; - } - } - - /* - * Try to kill the internals of the SSL library. - */ -#ifdef SHARED_MODULE - ERR_free_strings(); - ERR_remove_state(0); - EVP_cleanup(); -#endif - - return; -} - diff --git a/modules/ssl/ssl_engine_io.c b/modules/ssl/ssl_engine_io.c deleted file mode 100644 index 4ba1574ca8839cc5b9d331892a32d4541134b02d..0000000000000000000000000000000000000000 --- a/modules/ssl/ssl_engine_io.c +++ /dev/null @@ -1,728 +0,0 @@ -/* _ _ -** _ __ ___ ___ __| | ___ ___| | mod_ssl -** | '_ ` _ \ / _ \ / _` | / __/ __| | Apache Interface to OpenSSL -** | | | | | | (_) | (_| | \__ \__ \ | www.modssl.org -** |_| |_| |_|\___/ \__,_|___|___/___/_| ftp.modssl.org -** |_____| -** ssl_engine_io.c -** I/O Functions -*/ - -/* ==================================================================== - * Copyright (c) 1998-2001 Ralf S. Engelschall. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following - * disclaimer in the documentation and/or other materials - * provided with the distribution. - * - * 3. All advertising materials mentioning features or use of this - * software must display the following acknowledgment: - * "This product includes software developed by - * Ralf S. Engelschall for use in the - * mod_ssl project (http://www.modssl.org/)." - * - * 4. The names "mod_ssl" must not be used to endorse or promote - * products derived from this software without prior written - * permission. For written permission, please contact - * rse@engelschall.com. - * - * 5. Products derived from this software may not be called "mod_ssl" - * nor may "mod_ssl" appear in their names without prior - * written permission of Ralf S. Engelschall. - * - * 6. Redistributions of any form whatsoever must retain the following - * acknowledgment: - * "This product includes software developed by - * Ralf S. Engelschall for use in the - * mod_ssl project (http://www.modssl.org/)." - * - * THIS SOFTWARE IS PROVIDED BY RALF S. ENGELSCHALL ``AS IS'' AND ANY - * EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR - * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL RALF S. ENGELSCHALL OR - * HIS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT - * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, - * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED - * OF THE POSSIBILITY OF SUCH DAMAGE. - * ==================================================================== - */ - /* ``MY HACK: This universe. - Just one little problem: - core keeps dumping.'' - -- Unknown */ -#include "mod_ssl.h" - -/* _________________________________________________________________ -** -** I/O Request Body Sucking and Re-Injection -** _________________________________________________________________ -*/ - -#ifndef SSL_CONSERVATIVE - -/* - * Background: - * - * 1. When the client sends a HTTP/HTTPS request, Apache's core code - * reads only the request line ("METHOD /path HTTP/x.y") and the - * attached MIME headers ("Foo: bar") up to the terminating line ("CR - * LF"). An attached request body (for instance the data of a POST - * method) is _NOT_ read. Instead it is read by mod_cgi's content - * handler and directly passed to the CGI script. - * - * 2. mod_ssl supports per-directory re-configuration of SSL parameters. - * This is implemented by performing an SSL renegotiation of the - * re-configured parameters after the request is read, but before the - * response is sent. In more detail: the renegotiation happens after the - * request line and MIME headers were read, but _before_ the attached - * request body is read. The reason simply is that in the HTTP protocol - * usually there is no acknowledgment step between the headers and the - * body (there is the 100-continue feature and the chunking facility - * only), so Apache has no API hook for this step. - * - * 3. the problem now occurs when the client sends a POST request for - * URL /foo via HTTPS the server and the server has SSL parameters - * re-configured on a per-URL basis for /foo. Then mod_ssl has to - * perform an SSL renegotiation after the request was read and before - * the response is sent. But the problem is the pending POST body data - * in the receive buffer of SSL (which Apache still has not read - it's - * pending until mod_cgi sucks it in). When mod_ssl now tries to perform - * the renegotiation the pending data leads to an I/O error. - * - * Solution Idea: - * - * There are only two solutions: Either to simply state that POST - * requests to URLs with SSL re-configurations are not allowed, or to - * renegotiate really after the _complete_ request (i.e. including - * the POST body) was read. Obviously the latter would be preferred, - * but it cannot be done easily inside Apache, because as already - * mentioned, there is no API step between the body reading and the body - * processing. And even when we mod_ssl would hook directly into the - * loop of mod_cgi, we wouldn't solve the problem for other handlers, of - * course. So the only general solution is to suck in the pending data - * of the request body from the OpenSSL BIO into the Apache BUFF. Then - * the renegotiation can be done and after this step Apache can proceed - * processing the request as before. - * - * Solution Implementation: - * - * We cannot simply suck in the data via an SSL_read-based loop because of - * HTTP chunking. Instead we _have_ to use the Apache API for this step which - * is aware of HTTP chunking. So the trick is to suck in the pending request - * data via the Apache API (which uses Apache's BUFF code and in the - * background mod_ssl's I/O glue code) and re-inject it later into the Apache - * BUFF code again. This way the data flows twice through the Apache BUFF, of - * course. But this way the solution doesn't depend on any Apache specifics - * and is fully transparent to Apache modules. - */ - -struct ssl_io_suck_st { - BOOL active; - char *bufptr; - int buflen; - char *pendptr; - int pendlen; -}; - -/* prepare request_rec structure for input sucking */ -static void ssl_io_suck_start(request_rec *r) -{ - struct ssl_io_suck_st *ss; - - ss = ap_ctx_get(r->ctx, "ssl::io::suck"); - if (ss == NULL) { - ss = ap_palloc(r->pool, sizeof(struct ssl_io_suck_st)); - ap_ctx_set(r->ctx, "ssl::io::suck", ss); - ss->buflen = 8192; - ss->bufptr = ap_palloc(r->pool, ss->buflen); - } - ss->pendptr = ss->bufptr; - ss->pendlen = 0; - ss->active = FALSE; - return; -} - -/* record a sucked input chunk */ -static void ssl_io_suck_record(request_rec *r, char *buf, int len) -{ - struct ssl_io_suck_st *ss; - - if ((ss = ap_ctx_get(r->ctx, "ssl::io::suck")) == NULL) - return; - if (((ss->bufptr + ss->buflen) - (ss->pendptr + ss->pendlen)) < len) { - /* "expand" buffer: actually we cannot really expand the buffer - here, because Apache's pool system doesn't support expanding chunks - of memory. Instead we have to either reuse processed data or - allocate a new chunk of memory in advance if we really need more - memory. */ - int newlen; - char *newptr; - - if (( (ss->pendptr - ss->bufptr) - + ((ss->bufptr + ss->buflen) - (ss->pendptr + ss->pendlen)) ) >= len) { - /* make memory available by reusing already processed data */ - memmove(ss->bufptr, ss->pendptr, ss->pendlen); - ss->pendptr = ss->bufptr; - } - else { - /* too bad, we have to allocate a new larger buffer */ - newlen = (ss->buflen * 2) + len; - newptr = ap_palloc(r->pool, newlen); - ss->bufptr = newptr; - ss->buflen = newlen; - memcpy(ss->bufptr, ss->pendptr, ss->pendlen); - ss->pendptr = ss->bufptr; - } - } - memcpy(ss->pendptr+ss->pendlen, buf, len); - ss->pendlen += len; - return; -} - -/* finish request_rec after input sucking */ -static void ssl_io_suck_end(request_rec *r) -{ - struct ssl_io_suck_st *ss; - - if ((ss = ap_ctx_get(r->ctx, "ssl::io::suck")) == NULL) - return; - ss->active = TRUE; - r->read_body = REQUEST_NO_BODY; - r->read_length = 0; - r->read_chunked = 0; - r->remaining = 0; - ap_bsetflag(r->connection->client, B_CHUNK, 0); - return; -} - -void ssl_io_suck(request_rec *r, SSL *ssl) -{ - int rc; - int len; - char *buf; - int buflen; - char c; - int sucked; - - if ((rc = ap_setup_client_block(r, REQUEST_CHUNKED_DECHUNK)) == OK) { - if (ap_should_client_block(r)) { - - /* read client request block through Apache API */ - buflen = HUGE_STRING_LEN; - buf = ap_palloc(r->pool, buflen); - ap_hard_timeout("SSL I/O request body pre-sucking", r); - sucked = 0; - ssl_io_suck_start(r); - while ((len = ap_get_client_block(r, buf, buflen)) > 0) { - ssl_io_suck_record(r, buf, len); - sucked += len; - } - ssl_io_suck_end(r); - ap_kill_timeout(r); - - /* suck trailing data (usually CR LF) which - is still in the Apache BUFF layer */ - while (ap_bpeekc(r->connection->client) != EOF) { - c = ap_bgetc(r->connection->client); - ssl_io_suck_record(r, &c, 1); - sucked++; - } - - ssl_log(r->server, SSL_LOG_TRACE, - "I/O: sucked %d bytes of input data from SSL/TLS I/O layer " - "for delayed injection into Apache I/O layer", sucked); - } - } - return; -} - -/* the SSL_read replacement routine which knows about the suck buffer */ -static int ssl_io_suck_read(SSL *ssl, char *buf, int len) -{ - ap_ctx *actx; - struct ssl_io_suck_st *ss; - request_rec *r = NULL; - int rv; - - actx = (ap_ctx *)SSL_get_app_data2(ssl); - if (actx != NULL) - r = (request_rec *)ap_ctx_get(actx, "ssl::request_rec"); - - rv = -1; - if (r != NULL) { - ss = ap_ctx_get(r->ctx, "ssl::io::suck"); - if (ss != NULL) { - if (ss->active && ss->pendlen > 0) { - /* ok, there is pre-sucked data */ - len = (ss->pendlen > len ? len : ss->pendlen); - memcpy(buf, ss->pendptr, len); - ss->pendptr += len; - ss->pendlen -= len; - ssl_log(r->server, SSL_LOG_TRACE, - "I/O: injecting %d bytes of pre-sucked data " - "into Apache I/O layer", len); - rv = len; - } - } - } - if (rv == -1) - rv = SSL_read(ssl, buf, len); - return rv; -} - -/* override SSL_read in the following code... */ -#define SSL_read ssl_io_suck_read - -#endif /* !SSL_CONSERVATIVE */ - -/* _________________________________________________________________ -** -** I/O Hooks -** _________________________________________________________________ -*/ - -#ifndef NO_WRITEV -#include -#include -#endif - -static int ssl_io_hook_read(BUFF *fb, char *buf, int len); -static int ssl_io_hook_write(BUFF *fb, char *buf, int len); -#ifndef NO_WRITEV -static int ssl_io_hook_writev(BUFF *fb, const struct iovec *iov, int iovcnt); -#endif -#ifdef WIN32 -static int ssl_io_hook_recvwithtimeout(BUFF *fb, char *buf, int len); -static int ssl_io_hook_sendwithtimeout(BUFF *fb, const char *buf, int len); -#endif /* WIN32 */ - -void ssl_io_register(void) -{ - ap_hook_register("ap::buff::read", ssl_io_hook_read, AP_HOOK_NOCTX); - ap_hook_register("ap::buff::write", ssl_io_hook_write, AP_HOOK_NOCTX); -#ifndef NO_WRITEV - ap_hook_register("ap::buff::writev", ssl_io_hook_writev, AP_HOOK_NOCTX); -#endif -#ifdef WIN32 - ap_hook_register("ap::buff::recvwithtimeout", - ssl_io_hook_recvwithtimeout, AP_HOOK_NOCTX); - ap_hook_register("ap::buff::sendwithtimeout", - ssl_io_hook_sendwithtimeout, AP_HOOK_NOCTX); -#endif - return; -} - -void ssl_io_unregister(void) -{ - ap_hook_unregister("ap::buff::read", ssl_io_hook_read); - ap_hook_unregister("ap::buff::write", ssl_io_hook_write); -#ifndef NO_WRITEV - ap_hook_unregister("ap::buff::writev", ssl_io_hook_writev); -#endif -#ifdef WIN32 - ap_hook_unregister("ap::buff::recvwithtimeout", ssl_io_hook_recvwithtimeout); - ap_hook_unregister("ap::buff::sendwithtimeout", ssl_io_hook_sendwithtimeout); -#endif - return; -} - -static int ssl_io_hook_read(BUFF *fb, char *buf, int len) -{ - SSL *ssl; - conn_rec *c; - int rc; - - if ((ssl = ap_ctx_get(fb->ctx, "ssl")) != NULL) { - rc = SSL_read(ssl, buf, len); - /* - * Simulate an EINTR in case OpenSSL wants to read more. - * (This is usually the case when the client forces an SSL - * renegotation which is handled implicitly by OpenSSL.) - */ - if (rc < 0 && SSL_get_error(ssl, rc) == SSL_ERROR_WANT_READ) - errno = EINTR; - /* - * Log SSL errors - */ - if (rc < 0 && SSL_get_error(ssl, rc) == SSL_ERROR_SSL) { - c = (conn_rec *)SSL_get_app_data(ssl); - ssl_log(c->server, SSL_LOG_ERROR|SSL_ADD_SSLERR, - "SSL error on reading data"); - } - /* - * read(2) returns only the generic error number -1 - */ - if (rc < 0) - rc = -1; - } - else - rc = read(fb->fd_in, buf, len); - return rc; -} - -static int ssl_io_hook_write(BUFF *fb, char *buf, int len) -{ - SSL *ssl; - conn_rec *c; - int rc; - - if ((ssl = ap_ctx_get(fb->ctx, "ssl")) != NULL) { - rc = SSL_write(ssl, buf, len); - /* - * Simulate an EINTR in case OpenSSL wants to write more. - */ - if (rc < 0 && SSL_get_error(ssl, rc) == SSL_ERROR_WANT_WRITE) - errno = EINTR; - /* - * Log SSL errors - */ - if (rc < 0 && SSL_get_error(ssl, rc) == SSL_ERROR_SSL) { - c = (conn_rec *)SSL_get_app_data(ssl); - ssl_log(c->server, SSL_LOG_ERROR|SSL_ADD_SSLERR, - "SSL error on writing data"); - } - /* - * write(2) returns only the generic error number -1 - */ - if (rc < 0) - rc = -1; - } - else - rc = write(fb->fd, buf, len); - return rc; -} - -#ifndef NO_WRITEV -/* the prototype for our own SSL_writev() */ -static int SSL_writev(SSL *, const struct iovec *, int); - -static int ssl_io_hook_writev(BUFF *fb, const struct iovec *iov, int iovcnt) -{ - SSL *ssl; - conn_rec *c; - int rc; - - if ((ssl = ap_ctx_get(fb->ctx, "ssl")) != NULL) { - rc = SSL_writev(ssl, iov, iovcnt); - /* - * Simulate an EINTR in case OpenSSL wants to write more. - */ - if (rc < 0 && SSL_get_error(ssl, rc) == SSL_ERROR_WANT_WRITE) - errno = EINTR; - /* - * Log SSL errors - */ - if (rc < 0 && SSL_get_error(ssl, rc) == SSL_ERROR_SSL) { - c = (conn_rec *)SSL_get_app_data(ssl); - ssl_log(c->server, SSL_LOG_ERROR|SSL_ADD_SSLERR, - "SSL error on writing data"); - } - /* - * writev(2) returns only the generic error number -1 - */ - if (rc < 0) - rc = -1; - } - else - rc = writev(fb->fd, iov, iovcnt); - return rc; -} -#endif - -#ifdef WIN32 - -/* these two functions are exported from buff.c under WIN32 */ -API_EXPORT(int) sendwithtimeout(int sock, const char *buf, int len, int flags); -API_EXPORT(int) recvwithtimeout(int sock, char *buf, int len, int flags); - -/* and the prototypes for our SSL_xxx variants */ -static int SSL_sendwithtimeout(BUFF *fb, const char *buf, int len); -static int SSL_recvwithtimeout(BUFF *fb, char *buf, int len); - -static int ssl_io_hook_recvwithtimeout(BUFF *fb, char *buf, int len) -{ - SSL *ssl; - int rc; - - if ((ssl = ap_ctx_get(fb->ctx, "ssl")) != NULL) - rc = SSL_recvwithtimeout(fb, buf, len); - else - rc = recvwithtimeout(fb->fd, buf, len, 0); - return rc; -} - -static int ssl_io_hook_sendwithtimeout(BUFF *fb, const char *buf, int len) -{ - SSL *ssl; - int rc; - - if ((ssl = ap_ctx_get(fb->ctx, "ssl")) != NULL) - rc = SSL_sendwithtimeout(fb, buf, len); - else - rc = sendwithtimeout(fb->fd, buf, len, 0); - return rc; -} - -#endif /* WIN32 */ - -/* _________________________________________________________________ -** -** Special Functions for OpenSSL -** _________________________________________________________________ -*/ - -#ifdef WIN32 - -static int SSL_sendwithtimeout(BUFF *fb, const char *buf, int len) -{ - int iostate = 1; - fd_set fdset; - struct timeval tv; - int err = WSAEWOULDBLOCK; - int rv; - int retry; - int sock = fb->fd; - SSL *ssl; - - ssl = ap_ctx_get(fb->ctx, "ssl"); - - if (!(tv.tv_sec = ap_check_alarm())) - return (SSL_write(ssl, (char*)buf, len)); - - rv = ioctlsocket(sock, FIONBIO, &iostate); - iostate = 0; - if (rv) { - err = WSAGetLastError(); - ap_assert(0); - } - rv = SSL_write(ssl, (char*)buf, len); - if (rv <= 0) { - if (BIO_sock_should_retry(rv)) { - do { - retry = 0; - FD_ZERO(&fdset); - FD_SET((unsigned int)sock, &fdset); - tv.tv_usec = 0; - rv = select(FD_SETSIZE, NULL, &fdset, NULL, &tv); - if (rv == SOCKET_ERROR) - err = WSAGetLastError(); - else if (rv == 0) { - ioctlsocket(sock, FIONBIO, &iostate); - if(ap_check_alarm() < 0) { - WSASetLastError(EINTR); /* Simulate an alarm() */ - return (SOCKET_ERROR); - } - } - else { - rv = SSL_write(ssl, (char*)buf, len); - if (BIO_sock_should_retry(rv)) { - ap_log_error(APLOG_MARK,APLOG_DEBUG, NULL, - "select claimed we could write, " - "but in fact we couldn't. " - "This is a bug in Windows."); - retry = 1; - Sleep(100); - } - } - } while(retry); - } - } - ioctlsocket(sock, FIONBIO, &iostate); - if (rv == SOCKET_ERROR) - WSASetLastError(err); - return (rv); -} - -static int SSL_recvwithtimeout(BUFF *fb, char *buf, int len) -{ - int iostate = 1; - fd_set fdset; - struct timeval tv; - int err = WSAEWOULDBLOCK; - int rv; - int sock = fb->fd_in; - SSL *ssl; - int retry; - - ssl = ap_ctx_get(fb->ctx, "ssl"); - - if (!(tv.tv_sec = ap_check_alarm())) - return (SSL_read(ssl, buf, len)); - - rv = ioctlsocket(sock, FIONBIO, &iostate); - iostate = 0; - ap_assert(!rv); - rv = SSL_read(ssl, buf, len); - if (rv <= 0) { - if (BIO_sock_should_retry(rv)) { - do { - retry = 0; - FD_ZERO(&fdset); - FD_SET((unsigned int)sock, &fdset); - tv.tv_usec = 0; - rv = select(FD_SETSIZE, &fdset, NULL, NULL, &tv); - if (rv == SOCKET_ERROR) - err = WSAGetLastError(); - else if (rv == 0) { - ioctlsocket(sock, FIONBIO, &iostate); - ap_check_alarm(); - WSASetLastError(WSAEWOULDBLOCK); - return (SOCKET_ERROR); - } - else { - rv = SSL_read(ssl, buf, len); - if (rv == SOCKET_ERROR) { - if (BIO_sock_should_retry(rv)) { - ap_log_error(APLOG_MARK,APLOG_DEBUG, NULL, - "select claimed we could read, " - "but in fact we couldn't. " - "This is a bug in Windows."); - retry = 1; - Sleep(100); - } - else { - err = WSAGetLastError(); - } - } - } - } while(retry); - } - } - ioctlsocket(sock, FIONBIO, &iostate); - if (rv == SOCKET_ERROR) - WSASetLastError(err); - return (rv); -} - -#endif /*WIN32*/ - -/* - * There is no SSL_writev() provided by OpenSSL. The reason is mainly because - * OpenSSL has to fragment the data itself again for the SSL record layer, so a - * writev() like interface makes not much sense. What we do is to emulate it - * to at least being able to use the write() like interface. But keep in mind - * that the network I/O performance is not write() like, of course. - */ -#ifndef NO_WRITEV -static int SSL_writev(SSL *ssl, const struct iovec *iov, int iovcnt) -{ - int i; - int n; - int rc; - - rc = 0; - for (i = 0; i < iovcnt; i++) { - if ((n = SSL_write(ssl, iov[i].iov_base, iov[i].iov_len)) == -1) { - rc = -1; - break; - } - rc += n; - } - return rc; -} -#endif - -/* _________________________________________________________________ -** -** I/O Data Debugging -** _________________________________________________________________ -*/ - -#define DUMP_WIDTH 16 - -static void ssl_io_data_dump(server_rec *srvr, const char *s, long len) -{ - char buf[256]; - char tmp[64]; - int i, j, rows, trunc; - unsigned char ch; - - trunc = 0; - for(; (len > 0) && ((s[len-1] == ' ') || (s[len-1] == '\0')); len--) - trunc++; - rows = (len / DUMP_WIDTH); - if ((rows * DUMP_WIDTH) < len) - rows++; - ssl_log(srvr, SSL_LOG_DEBUG|SSL_NO_TIMESTAMP|SSL_NO_LEVELID, - "+-------------------------------------------------------------------------+"); - for(i = 0 ; i< rows; i++) { - ap_snprintf(tmp, sizeof(tmp), "| %04x: ", i * DUMP_WIDTH); - ap_cpystrn(buf, tmp, sizeof(buf)); - for (j = 0; j < DUMP_WIDTH; j++) { - if (((i * DUMP_WIDTH) + j) >= len) - ap_cpystrn(buf+strlen(buf), " ", sizeof(buf)-strlen(buf)); - else { - ch = ((unsigned char)*((char *)(s) + i * DUMP_WIDTH + j)) & 0xff; - ap_snprintf(tmp, sizeof(tmp), "%02x%c", ch , j==7 ? '-' : ' '); - ap_cpystrn(buf+strlen(buf), tmp, sizeof(buf)-strlen(buf)); - } - } - ap_cpystrn(buf+strlen(buf), " ", sizeof(buf)-strlen(buf)); - for (j = 0; j < DUMP_WIDTH; j++) { - if (((i * DUMP_WIDTH) + j) >= len) - ap_cpystrn(buf+strlen(buf), " ", sizeof(buf)-strlen(buf)); - else { - ch = ((unsigned char)*((char *)(s) + i * DUMP_WIDTH + j)) & 0xff; - ap_snprintf(tmp, sizeof(tmp), "%c", ((ch >= ' ') && (ch <= '~')) ? ch : '.'); - ap_cpystrn(buf+strlen(buf), tmp, sizeof(buf)-strlen(buf)); - } - } - ap_cpystrn(buf+strlen(buf), " |", sizeof(buf)-strlen(buf)); - ssl_log(srvr, SSL_LOG_DEBUG|SSL_NO_TIMESTAMP|SSL_NO_LEVELID, "%s", buf); - } - if (trunc > 0) - ssl_log(srvr, SSL_LOG_DEBUG|SSL_NO_TIMESTAMP|SSL_NO_LEVELID, - "| %04x - ", len + trunc); - ssl_log(srvr, SSL_LOG_DEBUG|SSL_NO_TIMESTAMP|SSL_NO_LEVELID, - "+-------------------------------------------------------------------------+"); - return; -} - -long ssl_io_data_cb(BIO *bio, int cmd, const char *argp, int argi, long argl, long rc) -{ - SSL *ssl; - conn_rec *c; - server_rec *s; - - if ((ssl = (SSL *)BIO_get_callback_arg(bio)) == NULL) - return rc; - if ((c = (conn_rec *)SSL_get_app_data(ssl)) == NULL) - return rc; - s = c->server; - - if ( cmd == (BIO_CB_WRITE|BIO_CB_RETURN) - || cmd == (BIO_CB_READ |BIO_CB_RETURN) ) { - if (rc >= 0) { - ssl_log(s, SSL_LOG_DEBUG, - "%s: %s %ld/%d bytes %s BIO#%08X [mem: %08lX] %s", - SSL_LIBRARY_NAME, - (cmd == (BIO_CB_WRITE|BIO_CB_RETURN) ? "write" : "read"), - rc, argi, (cmd == (BIO_CB_WRITE|BIO_CB_RETURN) ? "to" : "from"), - bio, argp, - (argp != NULL ? "(BIO dump follows)" : "(Ops, no memory buffer?)")); - if (argp != NULL) - ssl_io_data_dump(s, argp, rc); - } - else { - ssl_log(s, SSL_LOG_DEBUG, - "%s: I/O error, %d bytes expected to %s on BIO#%08X [mem: %08lX]", - SSL_LIBRARY_NAME, argi, - (cmd == (BIO_CB_WRITE|BIO_CB_RETURN) ? "write" : "read"), - bio, argp); - } - } - return rc; -} - diff --git a/modules/ssl/ssl_engine_kernel.c b/modules/ssl/ssl_engine_kernel.c deleted file mode 100644 index ca1b3f0a55c6a3f7560362b76f748cf5501edf18..0000000000000000000000000000000000000000 --- a/modules/ssl/ssl_engine_kernel.c +++ /dev/null @@ -1,1905 +0,0 @@ -/* _ _ -** _ __ ___ ___ __| | ___ ___| | mod_ssl -** | '_ ` _ \ / _ \ / _` | / __/ __| | Apache Interface to OpenSSL -** | | | | | | (_) | (_| | \__ \__ \ | www.modssl.org -** |_| |_| |_|\___/ \__,_|___|___/___/_| ftp.modssl.org -** |_____| -** ssl_engine_kernel.c -** The SSL engine kernel -*/ - -/* ==================================================================== - * Copyright (c) 1998-2001 Ralf S. Engelschall. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following - * disclaimer in the documentation and/or other materials - * provided with the distribution. - * - * 3. All advertising materials mentioning features or use of this - * software must display the following acknowledgment: - * "This product includes software developed by - * Ralf S. Engelschall for use in the - * mod_ssl project (http://www.modssl.org/)." - * - * 4. The names "mod_ssl" must not be used to endorse or promote - * products derived from this software without prior written - * permission. For written permission, please contact - * rse@engelschall.com. - * - * 5. Products derived from this software may not be called "mod_ssl" - * nor may "mod_ssl" appear in their names without prior - * written permission of Ralf S. Engelschall. - * - * 6. Redistributions of any form whatsoever must retain the following - * acknowledgment: - * "This product includes software developed by - * Ralf S. Engelschall for use in the - * mod_ssl project (http://www.modssl.org/)." - * - * THIS SOFTWARE IS PROVIDED BY RALF S. ENGELSCHALL ``AS IS'' AND ANY - * EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR - * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL RALF S. ENGELSCHALL OR - * HIS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT - * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, - * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED - * OF THE POSSIBILITY OF SUCH DAMAGE. - * ==================================================================== - */ - -/* ==================================================================== - * Copyright (c) 1995-1999 Ben Laurie. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in - * the documentation and/or other materials provided with the - * distribution. - * - * 3. All advertising materials mentioning features or use of this - * software must display the following acknowledgment: - * "This product includes software developed by Ben Laurie - * for use in the Apache-SSL HTTP server project." - * - * 4. The name "Apache-SSL Server" must not be used to - * endorse or promote products derived from this software without - * prior written permission. - * - * 5. Redistributions of any form whatsoever must retain the following - * acknowledgment: - * "This product includes software developed by Ben Laurie - * for use in the Apache-SSL HTTP server project." - * - * THIS SOFTWARE IS PROVIDED BY BEN LAURIE ``AS IS'' AND ANY - * EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR - * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL BEN LAURIE OR - * HIS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT - * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, - * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED - * OF THE POSSIBILITY OF SUCH DAMAGE. - * ==================================================================== - */ - /* ``It took me fifteen years to discover - I had no talent for programming, but - I couldn't give it up because by that - time I was too famous.'' - -- Unknown */ -#include "mod_ssl.h" - - -/* _________________________________________________________________ -** -** SSL Engine Kernel -** _________________________________________________________________ -*/ - -/* - * Connect Handler: - * Connect SSL to the accepted socket - * - * Usually we would need an Apache API hook which is triggered right after - * the socket is accepted for handling a new request. But Apache 1.3 doesn't - * provide such a hook, so we have to patch http_main.c and call this - * function directly. - */ -void ssl_hook_NewConnection(conn_rec *conn) -{ - server_rec *srvr; - BUFF *fb; - SSLSrvConfigRec *sc; - ap_ctx *apctx; - SSL *ssl; - char *cp; - char *cpVHostID; - char *cpVHostMD5; - X509 *xs; - int rc; - - /* - * Get context - */ - srvr = conn->server; - fb = conn->client; - sc = mySrvConfig(srvr); - - /* - * Create SSL context - */ - ap_ctx_set(fb->ctx, "ssl", NULL); - - /* - * Immediately stop processing if SSL - * is disabled for this connection - */ - if (sc == NULL || !sc->bEnabled) - return; - - /* - * Remember the connection information for - * later access inside callback functions - */ - cpVHostID = ssl_util_vhostid(conn->pool, srvr); - ssl_log(srvr, SSL_LOG_INFO, "Connection to child %d established " - "(server %s, client %s)", conn->child_num, cpVHostID, - conn->remote_ip != NULL ? conn->remote_ip : "unknown"); - - /* - * Seed the Pseudo Random Number Generator (PRNG) - */ - ssl_rand_seed(srvr, conn->pool, SSL_RSCTX_CONNECT, ""); - - /* - * Create a new SSL connection with the configured server SSL context and - * attach this to the socket. Additionally we register this attachment - * so we can detach later. - */ - if ((ssl = SSL_new(sc->pSSLCtx)) == NULL) { - ssl_log(conn->server, SSL_LOG_ERROR|SSL_ADD_SSLERR, - "Unable to create a new SSL connection from the SSL context"); - ap_ctx_set(fb->ctx, "ssl", NULL); - ap_bsetflag(fb, B_EOF|B_EOUT, 1); - conn->aborted = 1; - return; - } - SSL_clear(ssl); - cpVHostMD5 = ap_md5(conn->pool, (unsigned char *)cpVHostID); - if (!SSL_set_session_id_context(ssl, (unsigned char *)cpVHostMD5, strlen(cpVHostMD5))) { - ssl_log(conn->server, SSL_LOG_ERROR|SSL_ADD_SSLERR, - "Unable to set session id context to `%s'", cpVHostMD5); - ap_ctx_set(fb->ctx, "ssl", NULL); - ap_bsetflag(fb, B_EOF|B_EOUT, 1); - conn->aborted = 1; - return; - } - SSL_set_app_data(ssl, conn); - apctx = ap_ctx_new(conn->pool); - ap_ctx_set(apctx, "ssl::request_rec", NULL); - ap_ctx_set(apctx, "ssl::verify::depth", AP_CTX_NUM2PTR(0)); - SSL_set_app_data2(ssl, apctx); - SSL_set_fd(ssl, fb->fd); - ap_ctx_set(fb->ctx, "ssl", ssl); - - /* - * Configure callbacks for SSL connection - */ - SSL_set_tmp_rsa_callback(ssl, ssl_callback_TmpRSA); - SSL_set_tmp_dh_callback(ssl, ssl_callback_TmpDH); - if (sc->nLogLevel >= SSL_LOG_DEBUG) { - BIO_set_callback(SSL_get_rbio(ssl), ssl_io_data_cb); - BIO_set_callback_arg(SSL_get_rbio(ssl), ssl); - } - - /* - * Predefine some client verification results - */ - ap_ctx_set(fb->ctx, "ssl::client::dn", NULL); - ap_ctx_set(fb->ctx, "ssl::verify::error", NULL); - ap_ctx_set(fb->ctx, "ssl::verify::info", NULL); - SSL_set_verify_result(ssl, X509_V_OK); - - /* - * We have to manage a I/O timeout ourself, because Apache - * does it the first time when reading the request, but we're - * working some time before this happens. - */ - ap_ctx_set(ap_global_ctx, "ssl::handshake::timeout", (void *)FALSE); - ap_set_callback_and_alarm(ssl_hook_TimeoutConnection, srvr->timeout); - - /* - * Now enter the SSL Handshake Phase - */ - while (!SSL_is_init_finished(ssl)) { - - if ((rc = SSL_accept(ssl)) <= 0) { - - if (SSL_get_error(ssl, rc) == SSL_ERROR_ZERO_RETURN) { - /* - * The case where the connection was closed before any data - * was transferred. That's not a real error and can occur - * sporadically with some clients. - */ - ssl_log(srvr, SSL_LOG_INFO, - "SSL handshake stopped: connection was closed"); - SSL_set_shutdown(ssl, SSL_RECEIVED_SHUTDOWN); - SSL_smart_shutdown(ssl); - SSL_free(ssl); - ap_ctx_set(fb->ctx, "ssl", NULL); - ap_bsetflag(fb, B_EOF|B_EOUT, 1); - conn->aborted = 1; - return; - } - else if (ERR_GET_REASON(ERR_peek_error()) == SSL_R_HTTP_REQUEST) { - /* - * The case where OpenSSL has recognized a HTTP request: - * This means the client speaks plain HTTP on our HTTPS - * port. Hmmmm... At least for this error we can be more friendly - * and try to provide him with a HTML error page. We have only one - * problem: OpenSSL has already read some bytes from the HTTP - * request. So we have to skip the request line manually and - * instead provide a faked one in order to continue the internal - * Apache processing. - * - */ - char ca[2]; - int rv; - - /* log the situation */ - ssl_log(srvr, SSL_LOG_ERROR|SSL_ADD_SSLERR, - "SSL handshake failed: HTTP spoken on HTTPS port; " - "trying to send HTML error page"); - - /* first: skip the remaining bytes of the request line */ - do { - do { - rv = read(fb->fd, ca, 1); - } while (rv == -1 && errno == EINTR); - } while (rv > 0 && ca[0] != '\012' /*LF*/); - - /* second: fake the request line */ - fb->inbase = ap_palloc(fb->pool, fb->bufsiz); - ap_cpystrn((char *)fb->inbase, "GET /mod_ssl:error:HTTP-request HTTP/1.0\r\n", - fb->bufsiz); - fb->inptr = fb->inbase; - fb->incnt = strlen((char *)fb->inptr); - - /* third: kick away the SSL stuff */ - SSL_set_shutdown(ssl, SSL_SENT_SHUTDOWN|SSL_RECEIVED_SHUTDOWN); - SSL_smart_shutdown(ssl); - SSL_free(ssl); - ap_ctx_set(fb->ctx, "ssl", NULL); - - /* finally: let Apache go on with processing */ - return; - } - else if (ap_ctx_get(ap_global_ctx, "ssl::handshake::timeout") == (void *)TRUE) { - ssl_log(srvr, SSL_LOG_ERROR, - "SSL handshake timed out (client %s, server %s)", - conn->remote_ip != NULL ? conn->remote_ip : "unknown", cpVHostID); - SSL_set_shutdown(ssl, SSL_RECEIVED_SHUTDOWN); - SSL_smart_shutdown(ssl); - SSL_free(ssl); - ap_ctx_set(fb->ctx, "ssl", NULL); - ap_bsetflag(fb, B_EOF|B_EOUT, 1); - conn->aborted = 1; - return; - } - else if (SSL_get_error(ssl, rc) == SSL_ERROR_SYSCALL) { - if (errno == EINTR) - continue; - if (errno > 0) - ssl_log(srvr, SSL_LOG_ERROR|SSL_ADD_SSLERR|SSL_ADD_ERRNO, - "SSL handshake interrupted by system " - "[Hint: Stop button pressed in browser?!]"); - else - ssl_log(srvr, SSL_LOG_INFO|SSL_ADD_SSLERR|SSL_ADD_ERRNO, - "Spurious SSL handshake interrupt" - "[Hint: Usually just one of those OpenSSL confusions!?]"); - SSL_set_shutdown(ssl, SSL_RECEIVED_SHUTDOWN); - SSL_smart_shutdown(ssl); - SSL_free(ssl); - ap_ctx_set(fb->ctx, "ssl", NULL); - ap_bsetflag(fb, B_EOF|B_EOUT, 1); - conn->aborted = 1; - return; - } - else { - /* - * Ok, anything else is a fatal error - */ - ssl_log(srvr, SSL_LOG_ERROR|SSL_ADD_SSLERR|SSL_ADD_ERRNO, - "SSL handshake failed (server %s, client %s)", cpVHostID, - conn->remote_ip != NULL ? conn->remote_ip : "unknown"); - - /* - * try to gracefully shutdown the connection: - * - send an own shutdown message (be gracefully) - * - don't wait for peer's shutdown message (deadloop) - * - kick away the SSL stuff immediately - * - block the socket, so Apache cannot operate any more - */ - SSL_set_shutdown(ssl, SSL_RECEIVED_SHUTDOWN); - SSL_smart_shutdown(ssl); - SSL_free(ssl); - ap_ctx_set(fb->ctx, "ssl", NULL); - ap_bsetflag(fb, B_EOF|B_EOUT, 1); - conn->aborted = 1; - return; - } - } - - /* - * Check for failed client authentication - */ - if ( SSL_get_verify_result(ssl) != X509_V_OK - || ap_ctx_get(fb->ctx, "ssl::verify::error") != NULL) { - cp = (char *)ap_ctx_get(fb->ctx, "ssl::verify::error"); - ssl_log(srvr, SSL_LOG_ERROR|SSL_ADD_SSLERR, - "SSL client authentication failed: %s", - cp != NULL ? cp : "unknown reason"); - SSL_set_shutdown(ssl, SSL_RECEIVED_SHUTDOWN); - SSL_smart_shutdown(ssl); - SSL_free(ssl); - ap_ctx_set(fb->ctx, "ssl", NULL); - ap_bsetflag(fb, B_EOF|B_EOUT, 1); - conn->aborted = 1; - return; - } - - /* - * Remember the peer certificate's DN - */ - if ((xs = SSL_get_peer_certificate(ssl)) != NULL) { - cp = X509_NAME_oneline(X509_get_subject_name(xs), NULL, 0); - ap_ctx_set(fb->ctx, "ssl::client::dn", ap_pstrdup(conn->pool, cp)); - free(cp); - } - - /* - * Make really sure that when a peer certificate - * is required we really got one... (be paranoid) - */ - if ( sc->nVerifyClient == SSL_CVERIFY_REQUIRE - && ap_ctx_get(fb->ctx, "ssl::client::dn") == NULL) { - ssl_log(srvr, SSL_LOG_ERROR, - "No acceptable peer certificate available"); - SSL_set_shutdown(ssl, SSL_RECEIVED_SHUTDOWN); - SSL_smart_shutdown(ssl); - SSL_free(ssl); - ap_ctx_set(fb->ctx, "ssl", NULL); - ap_bsetflag(fb, B_EOF|B_EOUT, 1); - conn->aborted = 1; - return; - } - } - - /* - * Remove the timeout handling - */ - ap_set_callback_and_alarm(NULL, 0); - ap_ctx_set(ap_global_ctx, "ssl::handshake::timeout", (void *)FALSE); - - /* - * Improve I/O throughput by using - * OpenSSL's read-ahead functionality - * (don't used under Win32, because - * there we use select()) - */ -#ifndef WIN32 - SSL_set_read_ahead(ssl, TRUE); -#endif - -#ifdef SSL_VENDOR - /* Allow vendors to do more things on connection time... */ - ap_hook_use("ap::mod_ssl::vendor::new_connection", - AP_HOOK_SIG2(void,ptr), AP_HOOK_ALL, conn); -#endif - - return; -} - -/* - * Signal handler function for the SSL handshake phase - */ -void ssl_hook_TimeoutConnection(int sig) -{ - /* we just set a flag for the handshake processing loop */ - ap_ctx_set(ap_global_ctx, "ssl::handshake::timeout", (void *)TRUE); - return; -} - -/* - * Close the SSL part of the socket connection - * (called immediately _before_ the socket is closed) - */ -void ssl_hook_CloseConnection(conn_rec *conn) -{ - SSL *ssl; - char *cpType; - - ssl = ap_ctx_get(conn->client->ctx, "ssl"); - if (ssl == NULL) - return; - - /* - * First make sure that no more data is pending in Apache's BUFF, - * because when it's (implicitly) flushed later by the ap_bclose() - * calls of Apache it would lead to an I/O error in the browser due - * to the fact that the SSL layer was already removed by us. - */ - ap_bflush(conn->client); - - /* - * Now close the SSL layer of the connection. We've to take - * the TLSv1 standard into account here: - * - * | 7.2.1. Closure alerts - * | - * | The client and the server must share knowledge that the connection is - * | ending in order to avoid a truncation attack. Either party may - * | initiate the exchange of closing messages. - * | - * | close_notify - * | This message notifies the recipient that the sender will not send - * | any more messages on this connection. The session becomes - * | unresumable if any connection is terminated without proper - * | close_notify messages with level equal to warning. - * | - * | Either party may initiate a close by sending a close_notify alert. - * | Any data received after a closure alert is ignored. - * | - * | Each party is required to send a close_notify alert before closing - * | the write side of the connection. It is required that the other party - * | respond with a close_notify alert of its own and close down the - * | connection immediately, discarding any pending writes. It is not - * | required for the initiator of the close to wait for the responding - * | close_notify alert before closing the read side of the connection. - * - * This means we've to send a close notify message, but haven't to wait - * for the close notify of the client. Actually we cannot wait for the - * close notify of the client because some clients (including Netscape - * 4.x) don't send one, so we would hang. - */ - - /* - * exchange close notify messages, but allow the user - * to force the type of handshake via SetEnvIf directive - */ - if (ap_ctx_get(conn->client->ctx, "ssl::flag::unclean-shutdown") == PTRUE) { - /* perform no close notify handshake at all - (violates the SSL/TLS standard!) */ - SSL_set_shutdown(ssl, SSL_SENT_SHUTDOWN|SSL_RECEIVED_SHUTDOWN); - cpType = "unclean"; - } - else if (ap_ctx_get(conn->client->ctx, "ssl::flag::accurate-shutdown") == PTRUE) { - /* send close notify and wait for clients close notify - (standard compliant, but usually causes connection hangs) */ - SSL_set_shutdown(ssl, 0); - cpType = "accurate"; - } - else { - /* send close notify, but don't wait for clients close notify - (standard compliant and safe, so it's the DEFAULT!) */ - SSL_set_shutdown(ssl, SSL_RECEIVED_SHUTDOWN); - cpType = "standard"; - } - SSL_smart_shutdown(ssl); - - /* deallocate the SSL connection */ - SSL_free(ssl); - ap_ctx_set(conn->client->ctx, "ssl", NULL); - - /* and finally log the fact that we've closed the connection */ - ssl_log(conn->server, SSL_LOG_INFO, - "Connection to child %d closed with %s shutdown (server %s, client %s)", - conn->child_num, cpType, ssl_util_vhostid(conn->pool, conn->server), - conn->remote_ip != NULL ? conn->remote_ip : "unknown"); - return; -} - -/* - * Post Read Request Handler - */ -int ssl_hook_ReadReq(request_rec *r) -{ - SSL *ssl; - ap_ctx *apctx; - - /* - * Get the SSL connection structure and perform the - * delayed interlinking from SSL back to request_rec - */ - ssl = ap_ctx_get(r->connection->client->ctx, "ssl"); - if (ssl != NULL) { - apctx = SSL_get_app_data2(ssl); - ap_ctx_set(apctx, "ssl::request_rec", r); - } - - /* - * Force the mod_ssl content handler when URL indicates this - */ - if (strEQn(r->uri, "/mod_ssl:", 9)) - r->handler = "mod_ssl:content-handler"; - if (ssl != NULL) { - ap_ctx_set(r->ctx, "ap::http::method", "https"); - ap_ctx_set(r->ctx, "ap::default::port", "443"); - } - else { - ap_ctx_set(r->ctx, "ap::http::method", NULL); - ap_ctx_set(r->ctx, "ap::default::port", NULL); - } - return DECLINED; -} - -/* - * URL Translation Handler - */ -int ssl_hook_Translate(request_rec *r) -{ - if (ap_ctx_get(r->connection->client->ctx, "ssl") == NULL) - return DECLINED; - - /* - * Log information about incoming HTTPS requests - */ - if (ap_is_initial_req(r)) - ssl_log(r->server, SSL_LOG_INFO, - "%s HTTPS request received for child %d (server %s)", - r->connection->keepalives <= 0 ? - "Initial (No.1)" : - ap_psprintf(r->pool, "Subsequent (No.%d)", - r->connection->keepalives+1), - r->connection->child_num, - ssl_util_vhostid(r->pool, r->server)); - - /* - * Move SetEnvIf information from request_rec to conn_rec/BUFF - * to allow the close connection handler to use them. - */ - if (ap_table_get(r->subprocess_env, "ssl-unclean-shutdown") != NULL) - ap_ctx_set(r->connection->client->ctx, "ssl::flag::unclean-shutdown", PTRUE); - else - ap_ctx_set(r->connection->client->ctx, "ssl::flag::unclean-shutdown", PFALSE); - if (ap_table_get(r->subprocess_env, "ssl-accurate-shutdown") != NULL) - ap_ctx_set(r->connection->client->ctx, "ssl::flag::accurate-shutdown", PTRUE); - else - ap_ctx_set(r->connection->client->ctx, "ssl::flag::accurate-shutdown", PFALSE); - - return DECLINED; -} - -/* - * Content Handler - */ -int ssl_hook_Handler(request_rec *r) -{ - int port; - char *thisport; - char *thisurl; - - if (strNEn(r->uri, "/mod_ssl:", 9)) - return DECLINED; - - if (strEQ(r->uri, "/mod_ssl:error:HTTP-request")) { - thisport = ""; - port = ap_get_server_port(r); - if (!ap_is_default_port(port, r)) - thisport = ap_psprintf(r->pool, ":%u", port); - thisurl = ap_psprintf(r->pool, "https://%s%s/", - ap_get_server_name(r), thisport); - - ap_table_setn(r->notes, "error-notes", ap_psprintf(r->pool, - "Reason: You're speaking plain HTTP to an SSL-enabled server port.
    \n" - "Instead use the HTTPS scheme to access this URL, please.
    \n" - "

    Hint: %s
    ", - thisurl, thisurl)); - } - - return HTTP_BAD_REQUEST; -} - -/* - * Access Handler - */ -int ssl_hook_Access(request_rec *r) -{ - SSLDirConfigRec *dc; - SSLSrvConfigRec *sc; - SSL *ssl; - SSL_CTX *ctx = NULL; - array_header *apRequirement; - ssl_require_t *pRequirements; - ssl_require_t *pRequirement; - char *cp; - int ok; - int i; - BOOL renegotiate; - BOOL renegotiate_quick; -#ifdef SSL_EXPERIMENTAL_PERDIRCA - BOOL reconfigured_locations; - STACK_OF(X509_NAME) *skCAList; - char *cpCAPath; - char *cpCAFile; -#endif - X509 *cert; - STACK_OF(X509) *certstack; - X509_STORE *certstore; - X509_STORE_CTX certstorectx; - int depth; - STACK_OF(SSL_CIPHER) *skCipherOld; - STACK_OF(SSL_CIPHER) *skCipher; - SSL_CIPHER *pCipher; - ap_ctx *apctx; - int nVerifyOld; - int nVerify; - int n; - void *vp; - int rc; - - dc = myDirConfig(r); - sc = mySrvConfig(r->server); - ssl = ap_ctx_get(r->connection->client->ctx, "ssl"); - if (ssl != NULL) - ctx = SSL_get_SSL_CTX(ssl); - - /* - * Support for SSLRequireSSL directive - */ - if (dc->bSSLRequired && ssl == NULL) { - ap_log_reason("SSL connection required", r->filename, r); - /* remember forbidden access for strict require option */ - ap_table_setn(r->notes, "ssl-access-forbidden", (void *)1); - return FORBIDDEN; - } - - /* - * Check to see if SSL protocol is on - */ - if (!sc->bEnabled) - return DECLINED; - if (ssl == NULL) - return DECLINED; - - /* - * Support for per-directory reconfigured SSL connection parameters. - * - * This is implemented by forcing an SSL renegotiation with the - * reconfigured parameter suite. But Apache's internal API processing - * makes our life very hard here, because when internal sub-requests occur - * we nevertheless should avoid multiple unnecessary SSL handshakes (they - * require extra network I/O and especially time to perform). - * - * But the optimization for filtering out the unnecessary handshakes isn't - * obvious and trivial. Especially because while Apache is in its - * sub-request processing the client could force additional handshakes, - * too. And these take place perhaps without our notice. So the only - * possibility is to explicitly _ask_ OpenSSL whether the renegotiation - * has to be performed or not. It has to performed when some parameters - * which were previously known (by us) are not those we've now - * reconfigured (as known by OpenSSL) or (in optimized way) at least when - * the reconfigured parameter suite is stronger (more restrictions) than - * the currently active one. - */ - renegotiate = FALSE; - renegotiate_quick = FALSE; -#ifdef SSL_EXPERIMENTAL_PERDIRCA - reconfigured_locations = FALSE; -#endif - - /* - * Override of SSLCipherSuite - * - * We provide two options here: - * - * o The paranoid and default approach where we force a renegotiation when - * the cipher suite changed in _any_ way (which is straight-forward but - * often forces renegotiations too often and is perhaps not what the - * user actually wanted). - * - * o The optimized and still secure way where we force a renegotiation - * only if the currently active cipher is no longer contained in the - * reconfigured/new cipher suite. Any other changes are not important - * because it's the servers choice to select a cipher from the ones the - * client supports. So as long as the current cipher is still in the new - * cipher suite we're happy. Because we can assume we would have - * selected it again even when other (better) ciphers exists now in the - * new cipher suite. This approach is fine because the user explicitly - * has to enable this via ``SSLOptions +OptRenegotiate''. So we do no - * implicit optimizations. - */ - if (dc->szCipherSuite != NULL) { - /* remember old state */ - pCipher = NULL; - skCipherOld = NULL; - if (dc->nOptions & SSL_OPT_OPTRENEGOTIATE) - pCipher = SSL_get_current_cipher(ssl); - else { - skCipherOld = SSL_get_ciphers(ssl); - if (skCipherOld != NULL) - skCipherOld = sk_SSL_CIPHER_dup(skCipherOld); - } - /* configure new state */ - if (!SSL_set_cipher_list(ssl, dc->szCipherSuite)) { - ssl_log(r->server, SSL_LOG_WARN|SSL_ADD_SSLERR, - "Unable to reconfigure (per-directory) permitted SSL ciphers"); - if (skCipherOld != NULL) - sk_SSL_CIPHER_free(skCipherOld); - return FORBIDDEN; - } - /* determine whether a renegotiation has to be forced */ - skCipher = SSL_get_ciphers(ssl); - if (dc->nOptions & SSL_OPT_OPTRENEGOTIATE) { - /* optimized way */ - if ((pCipher == NULL && skCipher != NULL) || - (pCipher != NULL && skCipher == NULL) ) - renegotiate = TRUE; - else if (pCipher != NULL && skCipher != NULL - && sk_SSL_CIPHER_find(skCipher, pCipher) < 0) { - renegotiate = TRUE; - } - } - else { - /* paranoid way */ - if ((skCipherOld == NULL && skCipher != NULL) || - (skCipherOld != NULL && skCipher == NULL) ) - renegotiate = TRUE; - else if (skCipherOld != NULL && skCipher != NULL) { - for (n = 0; !renegotiate && n < sk_SSL_CIPHER_num(skCipher); n++) { - if (sk_SSL_CIPHER_find(skCipherOld, sk_SSL_CIPHER_value(skCipher, n)) < 0) - renegotiate = TRUE; - } - for (n = 0; !renegotiate && n < sk_SSL_CIPHER_num(skCipherOld); n++) { - if (sk_SSL_CIPHER_find(skCipher, sk_SSL_CIPHER_value(skCipherOld, n)) < 0) - renegotiate = TRUE; - } - } - } - /* cleanup */ - if (skCipherOld != NULL) - sk_SSL_CIPHER_free(skCipherOld); - /* tracing */ - if (renegotiate) - ssl_log(r->server, SSL_LOG_TRACE, - "Reconfigured cipher suite will force renegotiation"); - } - - /* - * override of SSLVerifyDepth - * - * The depth checks are handled by us manually inside the verify callback - * function and not by OpenSSL internally (and our function is aware of - * both the per-server and per-directory contexts). So we cannot ask - * OpenSSL about the currently verify depth. Instead we remember it in our - * ap_ctx attached to the SSL* of OpenSSL. We've to force the - * renegotiation if the reconfigured/new verify depth is less than the - * currently active/remembered verify depth (because this means more - * restriction on the certificate chain). - */ - if (dc->nVerifyDepth != UNSET) { - apctx = SSL_get_app_data2(ssl); - if ((vp = ap_ctx_get(apctx, "ssl::verify::depth")) != NULL) - n = (int)AP_CTX_PTR2NUM(vp); - else - n = sc->nVerifyDepth; - ap_ctx_set(apctx, "ssl::verify::depth", - AP_CTX_NUM2PTR(dc->nVerifyDepth)); - /* determine whether a renegotiation has to be forced */ - if (dc->nVerifyDepth < n) { - renegotiate = TRUE; - ssl_log(r->server, SSL_LOG_TRACE, - "Reduced client verification depth will force renegotiation"); - } - } - - /* - * override of SSLVerifyClient - * - * We force a renegotiation if the reconfigured/new verify type is - * stronger than the currently active verify type. - * - * The order is: none << optional_no_ca << optional << require - * - * Additionally the following optimization is possible here: When the - * currently active verify type is "none" but a client certificate is - * already known/present, it's enough to manually force a client - * verification but at least skip the I/O-intensive renegotation - * handshake. - */ - if (dc->nVerifyClient != SSL_CVERIFY_UNSET) { - /* remember old state */ - nVerifyOld = SSL_get_verify_mode(ssl); - /* configure new state */ - nVerify = SSL_VERIFY_NONE; - if (dc->nVerifyClient == SSL_CVERIFY_REQUIRE) - nVerify |= SSL_VERIFY_PEER|SSL_VERIFY_FAIL_IF_NO_PEER_CERT; - if ( (dc->nVerifyClient == SSL_CVERIFY_OPTIONAL) - || (dc->nVerifyClient == SSL_CVERIFY_OPTIONAL_NO_CA) ) - nVerify |= SSL_VERIFY_PEER; - SSL_set_verify(ssl, nVerify, ssl_callback_SSLVerify); - SSL_set_verify_result(ssl, X509_V_OK); - /* determine whether we've to force a renegotiation */ - if (nVerify != nVerifyOld) { - if ( ( (nVerifyOld == SSL_VERIFY_NONE) - && (nVerify != SSL_VERIFY_NONE)) - || ( !(nVerifyOld & SSL_VERIFY_PEER) - && (nVerify & SSL_VERIFY_PEER)) - || ( !(nVerifyOld & (SSL_VERIFY_PEER|SSL_VERIFY_FAIL_IF_NO_PEER_CERT)) - && (nVerify & (SSL_VERIFY_PEER|SSL_VERIFY_FAIL_IF_NO_PEER_CERT)))) { - renegotiate = TRUE; - /* optimization */ - if ( dc->nOptions & SSL_OPT_OPTRENEGOTIATE - && nVerifyOld == SSL_VERIFY_NONE - && SSL_get_peer_certificate(ssl) != NULL) - renegotiate_quick = TRUE; - ssl_log(r->server, SSL_LOG_TRACE, - "Changed client verification type will force %srenegotiation", - renegotiate_quick ? "quick " : ""); - } - } - } - - /* - * override SSLCACertificateFile & SSLCACertificatePath - * This is tagged experimental because it has to use an ugly kludge: We - * have to change the locations inside the SSL_CTX* (per-server global) - * instead inside SSL* (per-connection local) and reconfigure it to the - * old values later. That's problematic at least for the threaded process - * model of Apache under Win32 or when an error occurs. But unless - * OpenSSL provides a SSL_load_verify_locations() function we've no other - * chance to provide this functionality... - */ -#ifdef SSL_EXPERIMENTAL_PERDIRCA - if ( ( dc->szCACertificateFile != NULL - && ( sc->szCACertificateFile == NULL - || ( sc->szCACertificateFile != NULL - && strNE(dc->szCACertificateFile, sc->szCACertificateFile)))) - || ( dc->szCACertificatePath != NULL - && ( sc->szCACertificatePath == NULL - || ( sc->szCACertificatePath != NULL - && strNE(dc->szCACertificatePath, sc->szCACertificatePath)))) ) { - cpCAFile = dc->szCACertificateFile != NULL ? - dc->szCACertificateFile : sc->szCACertificateFile; - cpCAPath = dc->szCACertificatePath != NULL ? - dc->szCACertificatePath : sc->szCACertificatePath; - /* - FIXME: This should be... - if (!SSL_load_verify_locations(ssl, cpCAFile, cpCAPath)) { - ...but OpenSSL still doesn't provide this! - */ - if (!SSL_CTX_load_verify_locations(ctx, cpCAFile, cpCAPath)) { - ssl_log(r->server, SSL_LOG_ERROR|SSL_ADD_SSLERR, - "Unable to reconfigure verify locations " - "for client authentication"); - return FORBIDDEN; - } - if ((skCAList = ssl_init_FindCAList(r->server, r->pool, - cpCAFile, cpCAPath)) == NULL) { - ssl_log(r->server, SSL_LOG_ERROR, - "Unable to determine list of available " - "CA certificates for client authentication"); - return FORBIDDEN; - } - SSL_set_client_CA_list(ssl, skCAList); - renegotiate = TRUE; - reconfigured_locations = TRUE; - ssl_log(r->server, SSL_LOG_TRACE, - "Changed client verification locations will force renegotiation"); - } -#endif /* SSL_EXPERIMENTAL_PERDIRCA */ - -#ifdef SSL_CONSERVATIVE - /* - * SSL renegotiations in conjunction with HTTP - * requests using the POST method are not supported. - */ - if (renegotiate && r->method_number == M_POST) { - ssl_log(r->server, SSL_LOG_ERROR, - "SSL Re-negotiation in conjunction with POST method not supported!"); - ssl_log(r->server, SSL_LOG_INFO, - "You have to compile without -DSSL_CONSERVATIVE to enabled support for this."); - return METHOD_NOT_ALLOWED; - } -#endif /* SSL_CONSERVATIVE */ - - /* - * now do the renegotiation if anything was actually reconfigured - */ - if (renegotiate) { - /* - * Now we force the SSL renegotation by sending the Hello Request - * message to the client. Here we have to do a workaround: Actually - * OpenSSL returns immediately after sending the Hello Request (the - * intent AFAIK is because the SSL/TLS protocol says it's not a must - * that the client replies to a Hello Request). But because we insist - * on a reply (anything else is an error for us) we have to go to the - * ACCEPT state manually. Using SSL_set_accept_state() doesn't work - * here because it resets too much of the connection. So we set the - * state explicitly and continue the handshake manually. - */ - ssl_log(r->server, SSL_LOG_INFO, "Requesting connection re-negotiation"); - if (renegotiate_quick) { - /* perform just a manual re-verification of the peer */ - ssl_log(r->server, SSL_LOG_TRACE, - "Performing quick renegotiation: just re-verifying the peer"); - certstore = SSL_CTX_get_cert_store(ctx); - if (certstore == NULL) { - ssl_log(r->server, SSL_LOG_ERROR, "Cannot find certificate storage"); - return FORBIDDEN; - } - certstack = SSL_get_peer_cert_chain(ssl); - if (certstack == NULL || sk_X509_num(certstack) == 0) { - ssl_log(r->server, SSL_LOG_ERROR, "Cannot find peer certificate chain"); - return FORBIDDEN; - } - cert = sk_X509_value(certstack, 0); - X509_STORE_CTX_init(&certstorectx, certstore, cert, certstack); - depth = SSL_get_verify_depth(ssl); - if (depth >= 0) - X509_STORE_CTX_set_depth(&certstorectx, depth); - X509_STORE_CTX_set_ex_data(&certstorectx, - SSL_get_ex_data_X509_STORE_CTX_idx(), (char *)ssl); - if (!X509_verify_cert(&certstorectx)) - ssl_log(r->server, SSL_LOG_ERROR|SSL_ADD_SSLERR, - "Re-negotiation verification step failed"); - SSL_set_verify_result(ssl, certstorectx.error); - X509_STORE_CTX_cleanup(&certstorectx); - } - else { - /* do a full renegotiation */ - ssl_log(r->server, SSL_LOG_TRACE, - "Performing full renegotiation: complete handshake protocol"); - if (r->main != NULL) - SSL_set_session_id_context(ssl, (unsigned char *)&(r->main), sizeof(r->main)); - else - SSL_set_session_id_context(ssl, (unsigned char *)&r, sizeof(r)); -#ifndef SSL_CONSERVATIVE - ssl_io_suck(r, ssl); -#endif - SSL_renegotiate(ssl); - SSL_do_handshake(ssl); - if (SSL_get_state(ssl) != SSL_ST_OK) { - ssl_log(r->server, SSL_LOG_ERROR, "Re-negotiation request failed"); - return FORBIDDEN; - } - ssl_log(r->server, SSL_LOG_INFO, "Awaiting re-negotiation handshake"); - SSL_set_state(ssl, SSL_ST_ACCEPT); - SSL_do_handshake(ssl); - if (SSL_get_state(ssl) != SSL_ST_OK) { - ssl_log(r->server, SSL_LOG_ERROR, - "Re-negotiation handshake failed: Not accepted by client!?"); - return FORBIDDEN; - } - } - - /* - * Remember the peer certificate's DN - */ - if ((cert = SSL_get_peer_certificate(ssl)) != NULL) { - cp = X509_NAME_oneline(X509_get_subject_name(cert), NULL, 0); - ap_ctx_set(r->connection->client->ctx, "ssl::client::dn", - ap_pstrdup(r->connection->pool, cp)); - free(cp); - } - - /* - * Finally check for acceptable renegotiation results - */ - if (dc->nVerifyClient != SSL_CVERIFY_NONE) { - if ( dc->nVerifyClient == SSL_CVERIFY_REQUIRE - && SSL_get_verify_result(ssl) != X509_V_OK ) { - ssl_log(r->server, SSL_LOG_ERROR, - "Re-negotiation handshake failed: Client verification failed"); - return FORBIDDEN; - } - if ( dc->nVerifyClient == SSL_CVERIFY_REQUIRE - && SSL_get_peer_certificate(ssl) == NULL ) { - ssl_log(r->server, SSL_LOG_ERROR, - "Re-negotiation handshake failed: Client certificate missing"); - return FORBIDDEN; - } - } - } - - /* - * Under old OpenSSL we had to change the X509_STORE inside the - * SSL_CTX instead inside the SSL structure, so we have to reconfigure it - * to the old values. This should be changed with forthcoming OpenSSL - * versions when better functionality is avaiable. - */ -#ifdef SSL_EXPERIMENTAL_PERDIRCA - if (renegotiate && reconfigured_locations) { - if (!SSL_CTX_load_verify_locations(ctx, - sc->szCACertificateFile, sc->szCACertificatePath)) { - ssl_log(r->server, SSL_LOG_ERROR|SSL_ADD_SSLERR, - "Unable to reconfigure verify locations " - "to per-server configuration parameters"); - return FORBIDDEN; - } - } -#endif /* SSL_EXPERIMENTAL_PERDIRCA */ - - /* - * Check SSLRequire boolean expressions - */ - apRequirement = dc->aRequirement; - pRequirements = (ssl_require_t *)apRequirement->elts; - for (i = 0; i < apRequirement->nelts; i++) { - pRequirement = &pRequirements[i]; - ok = ssl_expr_exec(r, pRequirement->mpExpr); - if (ok < 0) { - cp = ap_psprintf(r->pool, "Failed to execute SSL requirement expression: %s", - ssl_expr_get_error()); - ap_log_reason(cp, r->filename, r); - /* remember forbidden access for strict require option */ - ap_table_setn(r->notes, "ssl-access-forbidden", (void *)1); - return FORBIDDEN; - } - if (ok != 1) { - ssl_log(r->server, SSL_LOG_INFO, - "Access to %s denied for %s (requirement expression not fulfilled)", - r->filename, r->connection->remote_ip); - ssl_log(r->server, SSL_LOG_INFO, - "Failed expression: %s", pRequirement->cpExpr); - ap_log_reason("SSL requirement expression not fulfilled " - "(see SSL logfile for more details)", r->filename, r); - /* remember forbidden access for strict require option */ - ap_table_setn(r->notes, "ssl-access-forbidden", (void *)1); - return FORBIDDEN; - } - } - - /* - * Else access is granted from our point of view (except vendor - * handlers override). But we have to return DECLINED here instead - * of OK, because mod_auth and other modules still might want to - * deny access. - */ - rc = DECLINED; -#ifdef SSL_VENDOR - ap_hook_use("ap::mod_ssl::vendor::access_handler", - AP_HOOK_SIG2(int,ptr), AP_HOOK_DECLINE(DECLINED), - &rc, r); -#endif - return rc; -} - -/* - * Auth Handler: - * Fake a Basic authentication from the X509 client certificate. - * - * This must be run fairly early on to prevent a real authentication from - * occuring, in particular it must be run before anything else that - * authenticates a user. This means that the Module statement for this - * module should be LAST in the Configuration file. - */ -int ssl_hook_Auth(request_rec *r) -{ - SSLSrvConfigRec *sc = mySrvConfig(r->server); - SSLDirConfigRec *dc = myDirConfig(r); - char b1[MAX_STRING_LEN], b2[MAX_STRING_LEN]; - char *clientdn; - const char *cpAL; - const char *cpUN; - const char *cpPW; - - /* - * Additionally forbid access (again) - * when strict require option is used. - */ - if ( (dc->nOptions & SSL_OPT_STRICTREQUIRE) - && (ap_table_get(r->notes, "ssl-access-forbidden") != NULL)) - return FORBIDDEN; - - /* - * Make sure the user is not able to fake the client certificate - * based authentication by just entering an X.509 Subject DN - * ("/XX=YYY/XX=YYY/..") as the username and "password" as the - * password. - */ - if ((cpAL = ap_table_get(r->headers_in, "Authorization")) != NULL) { - if (strcEQ(ap_getword(r->pool, &cpAL, ' '), "Basic")) { - while (*cpAL == ' ' || *cpAL == '\t') - cpAL++; - cpAL = ap_pbase64decode(r->pool, cpAL); - cpUN = ap_getword_nulls(r->pool, &cpAL, ':'); - cpPW = cpAL; - if (cpUN[0] == '/' && strEQ(cpPW, "password")) - return FORBIDDEN; - } - } - - /* - * We decline operation in various situations... - */ - if (!sc->bEnabled) - return DECLINED; - if (ap_ctx_get(r->connection->client->ctx, "ssl") == NULL) - return DECLINED; - if (!(dc->nOptions & SSL_OPT_FAKEBASICAUTH)) - return DECLINED; - if (r->connection->user) - return DECLINED; - if ((clientdn = (char *)ap_ctx_get(r->connection->client->ctx, "ssl::client::dn")) == NULL) - return DECLINED; - - /* - * Fake a password - which one would be immaterial, as, it seems, an empty - * password in the users file would match ALL incoming passwords, if only - * we were using the standard crypt library routine. Unfortunately, OpenSSL - * "fixes" a "bug" in crypt and thus prevents blank passwords from - * working. (IMHO what they really fix is a bug in the users of the code - * - failing to program correctly for shadow passwords). We need, - * therefore, to provide a password. This password can be matched by - * adding the string "xxj31ZMTZzkVA" as the password in the user file. - * This is just the crypted variant of the word "password" ;-) - */ - ap_snprintf(b1, sizeof(b1), "%s:password", clientdn); - ssl_util_uuencode(b2, b1, FALSE); - ap_snprintf(b1, sizeof(b1), "Basic %s", b2); - ap_table_set(r->headers_in, "Authorization", b1); - ssl_log(r->server, SSL_LOG_INFO, - "Faking HTTP Basic Auth header: \"Authorization: %s\"", b1); - - return DECLINED; -} - -int ssl_hook_UserCheck(request_rec *r) -{ - SSLDirConfigRec *dc = myDirConfig(r); - - /* - * Additionally forbid access (again) - * when strict require option is used. - */ - if ( (dc->nOptions & SSL_OPT_STRICTREQUIRE) - && (ap_table_get(r->notes, "ssl-access-forbidden") != NULL)) - return FORBIDDEN; - - return DECLINED; -} - -/* - * Fixup Handler - */ - -static const char *ssl_hook_Fixup_vars[] = { - "SSL_VERSION_INTERFACE", - "SSL_VERSION_LIBRARY", - "SSL_PROTOCOL", - "SSL_CIPHER", - "SSL_CIPHER_EXPORT", - "SSL_CIPHER_USEKEYSIZE", - "SSL_CIPHER_ALGKEYSIZE", - "SSL_CLIENT_VERIFY", - "SSL_CLIENT_M_VERSION", - "SSL_CLIENT_M_SERIAL", - "SSL_CLIENT_V_START", - "SSL_CLIENT_V_END", - "SSL_CLIENT_S_DN", - "SSL_CLIENT_S_DN_C", - "SSL_CLIENT_S_DN_ST", - "SSL_CLIENT_S_DN_L", - "SSL_CLIENT_S_DN_O", - "SSL_CLIENT_S_DN_OU", - "SSL_CLIENT_S_DN_CN", - "SSL_CLIENT_S_DN_T", - "SSL_CLIENT_S_DN_I", - "SSL_CLIENT_S_DN_G", - "SSL_CLIENT_S_DN_S", - "SSL_CLIENT_S_DN_D", - "SSL_CLIENT_S_DN_UID", - "SSL_CLIENT_S_DN_Email", - "SSL_CLIENT_I_DN", - "SSL_CLIENT_I_DN_C", - "SSL_CLIENT_I_DN_ST", - "SSL_CLIENT_I_DN_L", - "SSL_CLIENT_I_DN_O", - "SSL_CLIENT_I_DN_OU", - "SSL_CLIENT_I_DN_CN", - "SSL_CLIENT_I_DN_T", - "SSL_CLIENT_I_DN_I", - "SSL_CLIENT_I_DN_G", - "SSL_CLIENT_I_DN_S", - "SSL_CLIENT_I_DN_D", - "SSL_CLIENT_I_DN_UID", - "SSL_CLIENT_I_DN_Email", - "SSL_CLIENT_A_KEY", - "SSL_CLIENT_A_SIG", - "SSL_SERVER_M_VERSION", - "SSL_SERVER_M_SERIAL", - "SSL_SERVER_V_START", - "SSL_SERVER_V_END", - "SSL_SERVER_S_DN", - "SSL_SERVER_S_DN_C", - "SSL_SERVER_S_DN_ST", - "SSL_SERVER_S_DN_L", - "SSL_SERVER_S_DN_O", - "SSL_SERVER_S_DN_OU", - "SSL_SERVER_S_DN_CN", - "SSL_SERVER_S_DN_T", - "SSL_SERVER_S_DN_I", - "SSL_SERVER_S_DN_G", - "SSL_SERVER_S_DN_S", - "SSL_SERVER_S_DN_D", - "SSL_SERVER_S_DN_UID", - "SSL_SERVER_S_DN_Email", - "SSL_SERVER_I_DN", - "SSL_SERVER_I_DN_C", - "SSL_SERVER_I_DN_ST", - "SSL_SERVER_I_DN_L", - "SSL_SERVER_I_DN_O", - "SSL_SERVER_I_DN_OU", - "SSL_SERVER_I_DN_CN", - "SSL_SERVER_I_DN_T", - "SSL_SERVER_I_DN_I", - "SSL_SERVER_I_DN_G", - "SSL_SERVER_I_DN_S", - "SSL_SERVER_I_DN_D", - "SSL_SERVER_I_DN_UID", - "SSL_SERVER_I_DN_Email", - "SSL_SERVER_A_KEY", - "SSL_SERVER_A_SIG", - "SSL_SESSION_ID", - NULL -}; - -int ssl_hook_Fixup(request_rec *r) -{ - SSLSrvConfigRec *sc = mySrvConfig(r->server); - SSLDirConfigRec *dc = myDirConfig(r); - table *e = r->subprocess_env; - char *var; - char *val; - STACK_OF(X509) *sk; - SSL *ssl; - int i; - - /* - * Check to see if SSL is on - */ - if (!sc->bEnabled) - return DECLINED; - if ((ssl = ap_ctx_get(r->connection->client->ctx, "ssl")) == NULL) - return DECLINED; - - /* - * Annotate the SSI/CGI environment with standard SSL information - */ - /* the always present HTTPS (=HTTP over SSL) flag! */ - ap_table_set(e, "HTTPS", "on"); - /* standard SSL environment variables */ - if (dc->nOptions & SSL_OPT_STDENVVARS) { - for (i = 0; ssl_hook_Fixup_vars[i] != NULL; i++) { - var = (char *)ssl_hook_Fixup_vars[i]; - val = ssl_var_lookup(r->pool, r->server, r->connection, r, var); - if (!strIsEmpty(val)) - ap_table_set(e, var, val); - } - } - - /* - * On-demand bloat up the SSI/CGI environment with certificate data - */ - if (dc->nOptions & SSL_OPT_EXPORTCERTDATA) { - val = ssl_var_lookup(r->pool, r->server, r->connection, r, "SSL_SERVER_CERT"); - ap_table_set(e, "SSL_SERVER_CERT", val); - val = ssl_var_lookup(r->pool, r->server, r->connection, r, "SSL_CLIENT_CERT"); - ap_table_set(e, "SSL_CLIENT_CERT", val); - if ((sk = SSL_get_peer_cert_chain(ssl)) != NULL) { - for (i = 0; i < sk_X509_num(sk); i++) { - var = ap_psprintf(r->pool, "SSL_CLIENT_CERT_CHAIN_%d", i); - val = ssl_var_lookup(r->pool, r->server, r->connection, r, var); - if (val != NULL) - ap_table_set(e, var, val); - } - } - } - - /* - * On-demand bloat up the SSI/CGI environment with compat variables - */ -#ifdef SSL_COMPAT - if (dc->nOptions & SSL_OPT_COMPATENVVARS) - ssl_compat_variables(r); -#endif - - return DECLINED; -} - -/* _________________________________________________________________ -** -** OpenSSL Callback Functions -** _________________________________________________________________ -*/ - -/* - * Handle out temporary RSA private keys on demand - * - * The background of this as the TLSv1 standard explains it: - * - * | D.1. Temporary RSA keys - * | - * | US Export restrictions limit RSA keys used for encryption to 512 - * | bits, but do not place any limit on lengths of RSA keys used for - * | signing operations. Certificates often need to be larger than 512 - * | bits, since 512-bit RSA keys are not secure enough for high-value - * | transactions or for applications requiring long-term security. Some - * | certificates are also designated signing-only, in which case they - * | cannot be used for key exchange. - * | - * | When the public key in the certificate cannot be used for encryption, - * | the server signs a temporary RSA key, which is then exchanged. In - * | exportable applications, the temporary RSA key should be the maximum - * | allowable length (i.e., 512 bits). Because 512-bit RSA keys are - * | relatively insecure, they should be changed often. For typical - * | electronic commerce applications, it is suggested that keys be - * | changed daily or every 500 transactions, and more often if possible. - * | Note that while it is acceptable to use the same temporary key for - * | multiple transactions, it must be signed each time it is used. - * | - * | RSA key generation is a time-consuming process. In many cases, a - * | low-priority process can be assigned the task of key generation. - * | Whenever a new key is completed, the existing temporary key can be - * | replaced with the new one. - * - * So we generated 512 and 1024 bit temporary keys on startup - * which we now just handle out on demand.... - */ -RSA *ssl_callback_TmpRSA(SSL *pSSL, int nExport, int nKeyLen) -{ - SSLModConfigRec *mc = myModConfig(); - RSA *rsa; - - rsa = NULL; - if (nExport) { - /* It's because an export cipher is used */ - if (nKeyLen == 512) - rsa = (RSA *)mc->pTmpKeys[SSL_TKPIDX_RSA512]; - else if (nKeyLen == 1024) - rsa = (RSA *)mc->pTmpKeys[SSL_TKPIDX_RSA1024]; - else - /* it's too expensive to generate on-the-fly, so keep 1024bit */ - rsa = (RSA *)mc->pTmpKeys[SSL_TKPIDX_RSA1024]; - } - else { - /* It's because a sign-only certificate situation exists */ - rsa = (RSA *)mc->pTmpKeys[SSL_TKPIDX_RSA1024]; - } - return rsa; -} - -/* - * Handle out the already generated DH parameters... - */ -DH *ssl_callback_TmpDH(SSL *pSSL, int nExport, int nKeyLen) -{ - SSLModConfigRec *mc = myModConfig(); - DH *dh; - - dh = NULL; - if (nExport) { - /* It's because an export cipher is used */ - if (nKeyLen == 512) - dh = (DH *)mc->pTmpKeys[SSL_TKPIDX_DH512]; - else if (nKeyLen == 1024) - dh = (DH *)mc->pTmpKeys[SSL_TKPIDX_DH1024]; - else - /* it's too expensive to generate on-the-fly, so keep 1024bit */ - dh = (DH *)mc->pTmpKeys[SSL_TKPIDX_DH1024]; - } - else { - /* It's because a sign-only certificate situation exists */ - dh = (DH *)mc->pTmpKeys[SSL_TKPIDX_DH1024]; - } - return dh; -} - -/* - * This OpenSSL callback function is called when OpenSSL - * does client authentication and verifies the certificate chain. - */ -int ssl_callback_SSLVerify(int ok, X509_STORE_CTX *ctx) -{ - SSL *ssl; - conn_rec *conn; - server_rec *s; - request_rec *r; - SSLSrvConfigRec *sc; - SSLDirConfigRec *dc; - ap_ctx *actx; - X509 *xs; - int errnum; - int errdepth; - char *cp; - char *cp2; - int depth; - int verify; - - /* - * Get Apache context back through OpenSSL context - */ - ssl = (SSL *)X509_STORE_CTX_get_app_data(ctx); - conn = (conn_rec *)SSL_get_app_data(ssl); - actx = (ap_ctx *)SSL_get_app_data2(ssl); - r = (request_rec *)ap_ctx_get(actx, "ssl::request_rec"); - s = conn->server; - sc = mySrvConfig(s); - dc = (r != NULL ? myDirConfig(r) : NULL); - - /* - * Get verify ingredients - */ - xs = X509_STORE_CTX_get_current_cert(ctx); - errnum = X509_STORE_CTX_get_error(ctx); - errdepth = X509_STORE_CTX_get_error_depth(ctx); - - /* - * Log verification information - */ - cp = X509_NAME_oneline(X509_get_subject_name(xs), NULL, 0); - cp2 = X509_NAME_oneline(X509_get_issuer_name(xs), NULL, 0); - ssl_log(s, SSL_LOG_TRACE, - "Certificate Verification: depth: %d, subject: %s, issuer: %s", - errdepth, cp != NULL ? cp : "-unknown-", - cp2 != NULL ? cp2 : "-unknown"); - if (cp) - free(cp); - if (cp2) - free(cp2); - - /* - * Check for optionally acceptable non-verifiable issuer situation - */ - if (dc != NULL && dc->nVerifyClient != SSL_CVERIFY_UNSET) - verify = dc->nVerifyClient; - else - verify = sc->nVerifyClient; - if ( ( errnum == X509_V_ERR_DEPTH_ZERO_SELF_SIGNED_CERT - || errnum == X509_V_ERR_SELF_SIGNED_CERT_IN_CHAIN - || errnum == X509_V_ERR_UNABLE_TO_GET_ISSUER_CERT_LOCALLY -#if SSL_LIBRARY_VERSION >= 0x00905000 - || errnum == X509_V_ERR_CERT_UNTRUSTED -#endif - || errnum == X509_V_ERR_UNABLE_TO_VERIFY_LEAF_SIGNATURE ) - && verify == SSL_CVERIFY_OPTIONAL_NO_CA ) { - ssl_log(s, SSL_LOG_TRACE, - "Certificate Verification: Verifiable Issuer is configured as " - "optional, therefore we're accepting the certificate"); - ap_ctx_set(conn->client->ctx, "ssl::verify::info", "GENEROUS"); - ok = TRUE; - } - - /* - * Additionally perform CRL-based revocation checks - */ - if (ok) { - ok = ssl_callback_SSLVerify_CRL(ok, ctx, s); - if (!ok) - errnum = X509_STORE_CTX_get_error(ctx); - } - - /* - * If we already know it's not ok, log the real reason - */ - if (!ok) { - ssl_log(s, SSL_LOG_ERROR, "Certificate Verification: Error (%d): %s", - errnum, X509_verify_cert_error_string(errnum)); - ap_ctx_set(conn->client->ctx, "ssl::client::dn", NULL); - ap_ctx_set(conn->client->ctx, "ssl::verify::error", - (void *)X509_verify_cert_error_string(errnum)); - } - - /* - * Finally check the depth of the certificate verification - */ - if (dc != NULL && dc->nVerifyDepth != UNSET) - depth = dc->nVerifyDepth; - else - depth = sc->nVerifyDepth; - if (errdepth > depth) { - ssl_log(s, SSL_LOG_ERROR, - "Certificate Verification: Certificate Chain too long " - "(chain has %d certificates, but maximum allowed are only %d)", - errdepth, depth); - ap_ctx_set(conn->client->ctx, "ssl::verify::error", - (void *)X509_verify_cert_error_string(X509_V_ERR_CERT_CHAIN_TOO_LONG)); - ok = FALSE; - } - - /* - * And finally signal OpenSSL the (perhaps changed) state - */ - return (ok); -} - -int ssl_callback_SSLVerify_CRL( - int ok, X509_STORE_CTX *ctx, server_rec *s) -{ - SSLSrvConfigRec *sc; - X509_OBJECT obj; - X509_NAME *subject; - X509_NAME *issuer; - X509 *xs; - X509_CRL *crl; - X509_REVOKED *revoked; - long serial; - BIO *bio; - int i, n, rc; - char *cp; - char *cp2; - - /* - * Unless a revocation store for CRLs was created we - * cannot do any CRL-based verification, of course. - */ - sc = mySrvConfig(s); - if (sc->pRevocationStore == NULL) - return ok; - - /* - * Determine certificate ingredients in advance - */ - xs = X509_STORE_CTX_get_current_cert(ctx); - subject = X509_get_subject_name(xs); - issuer = X509_get_issuer_name(xs); - - /* - * OpenSSL provides the general mechanism to deal with CRLs but does not - * use them automatically when verifying certificates, so we do it - * explicitly here. We will check the CRL for the currently checked - * certificate, if there is such a CRL in the store. - * - * We come through this procedure for each certificate in the certificate - * chain, starting with the root-CA's certificate. At each step we've to - * both verify the signature on the CRL (to make sure it's a valid CRL) - * and it's revocation list (to make sure the current certificate isn't - * revoked). But because to check the signature on the CRL we need the - * public key of the issuing CA certificate (which was already processed - * one round before), we've a little problem. But we can both solve it and - * at the same time optimize the processing by using the following - * verification scheme (idea and code snippets borrowed from the GLOBUS - * project): - * - * 1. We'll check the signature of a CRL in each step when we find a CRL - * through the _subject_ name of the current certificate. This CRL - * itself will be needed the first time in the next round, of course. - * But we do the signature processing one round before this where the - * public key of the CA is available. - * - * 2. We'll check the revocation list of a CRL in each step when - * we find a CRL through the _issuer_ name of the current certificate. - * This CRLs signature was then already verified one round before. - * - * This verification scheme allows a CA to revoke its own certificate as - * well, of course. - */ - - /* - * Try to retrieve a CRL corresponding to the _subject_ of - * the current certificate in order to verify it's integrity. - */ - memset((char *)&obj, 0, sizeof(obj)); - rc = SSL_X509_STORE_lookup(sc->pRevocationStore, X509_LU_CRL, subject, &obj); - crl = obj.data.crl; - if (rc > 0 && crl != NULL) { - /* - * Log information about CRL - * (A little bit complicated because of ASN.1 and BIOs...) - */ - if (ssl_log_applies(s, SSL_LOG_TRACE)) { - bio = BIO_new(BIO_s_mem()); - BIO_printf(bio, "lastUpdate: "); - ASN1_UTCTIME_print(bio, X509_CRL_get_lastUpdate(crl)); - BIO_printf(bio, ", nextUpdate: "); - ASN1_UTCTIME_print(bio, X509_CRL_get_nextUpdate(crl)); - n = BIO_pending(bio); - cp = malloc(n+1); - n = BIO_read(bio, cp, n); - cp[n] = NUL; - BIO_free(bio); - cp2 = X509_NAME_oneline(subject, NULL, 0); - ssl_log(s, SSL_LOG_TRACE, "CA CRL: Issuer: %s, %s", cp2, cp); - free(cp2); - free(cp); - } - - /* - * Verify the signature on this CRL - */ - if (X509_CRL_verify(crl, X509_get_pubkey(xs)) <= 0) { - ssl_log(s, SSL_LOG_WARN, "Invalid signature on CRL"); - X509_STORE_CTX_set_error(ctx, X509_V_ERR_CRL_SIGNATURE_FAILURE); - X509_OBJECT_free_contents(&obj); - return FALSE; - } - - /* - * Check date of CRL to make sure it's not expired - */ - i = X509_cmp_current_time(X509_CRL_get_nextUpdate(crl)); - if (i == 0) { - ssl_log(s, SSL_LOG_WARN, "Found CRL has invalid nextUpdate field"); - X509_STORE_CTX_set_error(ctx, X509_V_ERR_ERROR_IN_CRL_NEXT_UPDATE_FIELD); - X509_OBJECT_free_contents(&obj); - return FALSE; - } - if (i < 0) { - ssl_log(s, SSL_LOG_WARN, - "Found CRL is expired - " - "revoking all certificates until you get updated CRL"); - X509_STORE_CTX_set_error(ctx, X509_V_ERR_CRL_HAS_EXPIRED); - X509_OBJECT_free_contents(&obj); - return FALSE; - } - X509_OBJECT_free_contents(&obj); - } - - /* - * Try to retrieve a CRL corresponding to the _issuer_ of - * the current certificate in order to check for revocation. - */ - memset((char *)&obj, 0, sizeof(obj)); - rc = SSL_X509_STORE_lookup(sc->pRevocationStore, X509_LU_CRL, issuer, &obj); - crl = obj.data.crl; - if (rc > 0 && crl != NULL) { - /* - * Check if the current certificate is revoked by this CRL - */ -#if SSL_LIBRARY_VERSION < 0x00904000 - n = sk_num(X509_CRL_get_REVOKED(crl)); -#else - n = sk_X509_REVOKED_num(X509_CRL_get_REVOKED(crl)); -#endif - for (i = 0; i < n; i++) { -#if SSL_LIBRARY_VERSION < 0x00904000 - revoked = (X509_REVOKED *)sk_value(X509_CRL_get_REVOKED(crl), i); -#else - revoked = sk_X509_REVOKED_value(X509_CRL_get_REVOKED(crl), i); -#endif - if (ASN1_INTEGER_cmp(revoked->serialNumber, X509_get_serialNumber(xs)) == 0) { - - serial = ASN1_INTEGER_get(revoked->serialNumber); - cp = X509_NAME_oneline(issuer, NULL, 0); - ssl_log(s, SSL_LOG_INFO, - "Certificate with serial %ld (0x%lX) " - "revoked per CRL from issuer %s", - serial, serial, cp); - free(cp); - - X509_STORE_CTX_set_error(ctx, X509_V_ERR_CERT_REVOKED); - X509_OBJECT_free_contents(&obj); - return FALSE; - } - } - X509_OBJECT_free_contents(&obj); - } - return ok; -} - -/* - * This callback function is executed by OpenSSL whenever a new SSL_SESSION is - * added to the internal OpenSSL session cache. We use this hook to spread the - * SSL_SESSION also to the inter-process disk-cache to make share it with our - * other Apache pre-forked server processes. - */ -int ssl_callback_NewSessionCacheEntry(SSL *ssl, SSL_SESSION *pNew) -{ - conn_rec *conn; - server_rec *s; - SSLSrvConfigRec *sc; - long t; - BOOL rc; - - /* - * Get Apache context back through OpenSSL context - */ - conn = (conn_rec *)SSL_get_app_data(ssl); - s = conn->server; - sc = mySrvConfig(s); - - /* - * Set the timeout also for the internal OpenSSL cache, because this way - * our inter-process cache is consulted only when it's really necessary. - */ - t = sc->nSessionCacheTimeout; - SSL_set_timeout(pNew, t); - - /* - * Store the SSL_SESSION in the inter-process cache with the - * same expire time, so it expires automatically there, too. - */ - t = (SSL_get_time(pNew) + sc->nSessionCacheTimeout); - rc = ssl_scache_store(s, pNew->session_id, pNew->session_id_length, t, pNew); - - /* - * Log this cache operation - */ - ssl_log(s, SSL_LOG_TRACE, "Inter-Process Session Cache: " - "request=SET status=%s id=%s timeout=%ds (session caching)", - rc == TRUE ? "OK" : "BAD", - SSL_SESSION_id2sz(pNew->session_id, pNew->session_id_length), - t-time(NULL)); - - /* - * return 0 which means to OpenSSL that the pNew is still - * valid and was not freed by us with SSL_SESSION_free(). - */ - return 0; -} - -/* - * This callback function is executed by OpenSSL whenever a - * SSL_SESSION is looked up in the internal OpenSSL cache and it - * was not found. We use this to lookup the SSL_SESSION in the - * inter-process disk-cache where it was perhaps stored by one - * of our other Apache pre-forked server processes. - */ -SSL_SESSION *ssl_callback_GetSessionCacheEntry( - SSL *ssl, unsigned char *id, int idlen, int *pCopy) -{ - conn_rec *conn; - server_rec *s; - SSL_SESSION *pSession; - - /* - * Get Apache context back through OpenSSL context - */ - conn = (conn_rec *)SSL_get_app_data(ssl); - s = conn->server; - - /* - * Try to retrieve the SSL_SESSION from the inter-process cache - */ - pSession = ssl_scache_retrieve(s, id, idlen); - - /* - * Log this cache operation - */ - if (pSession != NULL) - ssl_log(s, SSL_LOG_TRACE, "Inter-Process Session Cache: " - "request=GET status=FOUND id=%s (session reuse)", - SSL_SESSION_id2sz(id, idlen)); - else - ssl_log(s, SSL_LOG_TRACE, "Inter-Process Session Cache: " - "request=GET status=MISSED id=%s (session renewal)", - SSL_SESSION_id2sz(id, idlen)); - - /* - * Return NULL or the retrieved SSL_SESSION. But indicate (by - * setting pCopy to 0) that the reference count on the - * SSL_SESSION should not be incremented by the SSL library, - * because we will no longer hold a reference to it ourself. - */ - *pCopy = 0; - return pSession; -} - -/* - * This callback function is executed by OpenSSL whenever a - * SSL_SESSION is removed from the the internal OpenSSL cache. - * We use this to remove the SSL_SESSION in the inter-process - * disk-cache, too. - */ -void ssl_callback_DelSessionCacheEntry( - SSL_CTX *ctx, SSL_SESSION *pSession) -{ - server_rec *s; - - /* - * Get Apache context back through OpenSSL context - */ - s = (server_rec *)SSL_CTX_get_app_data(ctx); - if (s == NULL) /* on server shutdown Apache is already gone */ - return; - - /* - * Remove the SSL_SESSION from the inter-process cache - */ - ssl_scache_remove(s, pSession->session_id, pSession->session_id_length); - - /* - * Log this cache operation - */ - ssl_log(s, SSL_LOG_TRACE, "Inter-Process Session Cache: " - "request=REM status=OK id=%s (session dead)", - SSL_SESSION_id2sz(pSession->session_id, - pSession->session_id_length)); - - return; -} - -/* - * This callback function is executed while OpenSSL processes the - * SSL handshake and does SSL record layer stuff. We use it to - * trace OpenSSL's processing in out SSL logfile. - */ -void ssl_callback_LogTracingState(SSL *ssl, int where, int rc) -{ - conn_rec *c; - server_rec *s; - SSLSrvConfigRec *sc; - char *str; - - /* - * find corresponding server - */ - if ((c = (conn_rec *)SSL_get_app_data(ssl)) == NULL) - return; - s = c->server; - if ((sc = mySrvConfig(s)) == NULL) - return; - - /* - * create the various trace messages - */ - if (sc->nLogLevel >= SSL_LOG_TRACE) { - if (where & SSL_CB_HANDSHAKE_START) - ssl_log(s, SSL_LOG_TRACE, "%s: Handshake: start", SSL_LIBRARY_NAME); - else if (where & SSL_CB_HANDSHAKE_DONE) - ssl_log(s, SSL_LOG_TRACE, "%s: Handshake: done", SSL_LIBRARY_NAME); - else if (where & SSL_CB_LOOP) - ssl_log(s, SSL_LOG_TRACE, "%s: Loop: %s", - SSL_LIBRARY_NAME, SSL_state_string_long(ssl)); - else if (where & SSL_CB_READ) - ssl_log(s, SSL_LOG_TRACE, "%s: Read: %s", - SSL_LIBRARY_NAME, SSL_state_string_long(ssl)); - else if (where & SSL_CB_WRITE) - ssl_log(s, SSL_LOG_TRACE, "%s: Write: %s", - SSL_LIBRARY_NAME, SSL_state_string_long(ssl)); - else if (where & SSL_CB_ALERT) { - str = (where & SSL_CB_READ) ? "read" : "write"; - ssl_log(s, SSL_LOG_TRACE, "%s: Alert: %s:%s:%s\n", - SSL_LIBRARY_NAME, str, - SSL_alert_type_string_long(rc), - SSL_alert_desc_string_long(rc)); - } - else if (where & SSL_CB_EXIT) { - if (rc == 0) - ssl_log(s, SSL_LOG_TRACE, "%s: Exit: failed in %s", - SSL_LIBRARY_NAME, SSL_state_string_long(ssl)); - else if (rc < 0) - ssl_log(s, SSL_LOG_TRACE, "%s: Exit: error in %s", - SSL_LIBRARY_NAME, SSL_state_string_long(ssl)); - } - } - - /* - * Because SSL renegotations can happen at any time (not only after - * SSL_accept()), the best way to log the current connection details is - * right after a finished handshake. - */ - if (where & SSL_CB_HANDSHAKE_DONE) { - ssl_log(s, SSL_LOG_INFO, - "Connection: Client IP: %s, Protocol: %s, Cipher: %s (%s/%s bits)", - ssl_var_lookup(NULL, s, c, NULL, "REMOTE_ADDR"), - ssl_var_lookup(NULL, s, c, NULL, "SSL_PROTOCOL"), - ssl_var_lookup(NULL, s, c, NULL, "SSL_CIPHER"), - ssl_var_lookup(NULL, s, c, NULL, "SSL_CIPHER_USEKEYSIZE"), - ssl_var_lookup(NULL, s, c, NULL, "SSL_CIPHER_ALGKEYSIZE")); - } - - return; -} - diff --git a/modules/ssl/ssl_engine_log.c b/modules/ssl/ssl_engine_log.c deleted file mode 100644 index 0e1c53a852dbfe3f5d51d3acb17ad0a500e55969..0000000000000000000000000000000000000000 --- a/modules/ssl/ssl_engine_log.c +++ /dev/null @@ -1,326 +0,0 @@ -/* _ _ -** _ __ ___ ___ __| | ___ ___| | mod_ssl -** | '_ ` _ \ / _ \ / _` | / __/ __| | Apache Interface to OpenSSL -** | | | | | | (_) | (_| | \__ \__ \ | www.modssl.org -** |_| |_| |_|\___/ \__,_|___|___/___/_| ftp.modssl.org -** |_____| -** ssl_engine_log.c -** Logging Facility -*/ - -/* ==================================================================== - * Copyright (c) 1998-2001 Ralf S. Engelschall. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following - * disclaimer in the documentation and/or other materials - * provided with the distribution. - * - * 3. All advertising materials mentioning features or use of this - * software must display the following acknowledgment: - * "This product includes software developed by - * Ralf S. Engelschall for use in the - * mod_ssl project (http://www.modssl.org/)." - * - * 4. The names "mod_ssl" must not be used to endorse or promote - * products derived from this software without prior written - * permission. For written permission, please contact - * rse@engelschall.com. - * - * 5. Products derived from this software may not be called "mod_ssl" - * nor may "mod_ssl" appear in their names without prior - * written permission of Ralf S. Engelschall. - * - * 6. Redistributions of any form whatsoever must retain the following - * acknowledgment: - * "This product includes software developed by - * Ralf S. Engelschall for use in the - * mod_ssl project (http://www.modssl.org/)." - * - * THIS SOFTWARE IS PROVIDED BY RALF S. ENGELSCHALL ``AS IS'' AND ANY - * EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR - * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL RALF S. ENGELSCHALL OR - * HIS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT - * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, - * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED - * OF THE POSSIBILITY OF SUCH DAMAGE. - * ==================================================================== - */ - /* ``The difference between a computer - industry job and open-source software - hacking is about 30 hours a week.'' - -- Ralf S. Engelschall */ -#include "mod_ssl.h" - - -/* _________________________________________________________________ -** -** Logfile Support -** _________________________________________________________________ -*/ - -/* - * Open the SSL logfile - */ -void ssl_log_open(server_rec *s_main, server_rec *s, pool *p) -{ - char *szLogFile; - SSLSrvConfigRec *sc_main = mySrvConfig(s_main); - SSLSrvConfigRec *sc = mySrvConfig(s); - piped_log *pl; - - /* - * Short-circuit for inherited logfiles in order to save - * filedescriptors in mass-vhost situation. Be careful, this works - * fine because the close happens implicitly by the pool facility. - */ - if ( s != s_main - && sc_main->fileLogFile != NULL - && ( (sc->szLogFile == NULL) - || ( sc->szLogFile != NULL - && sc_main->szLogFile != NULL - && strEQ(sc->szLogFile, sc_main->szLogFile)))) { - sc->fileLogFile = sc_main->fileLogFile; - } - else if (sc->szLogFile != NULL) { - if (strEQ(sc->szLogFile, "/dev/null")) - return; - else if (sc->szLogFile[0] == '|') { - szLogFile = ssl_util_server_root_relative(p, "log", sc->szLogFile+1); - if ((pl = ap_open_piped_log(p, szLogFile)) == NULL) { - ssl_log(s, SSL_LOG_ERROR|SSL_ADD_ERRNO, - "Cannot open reliable pipe to SSL logfile filter %s", szLogFile); - ssl_die(); - } - sc->fileLogFile = ap_pfdopen(p, ap_piped_log_write_fd(pl), "a"); - setbuf(sc->fileLogFile, NULL); - } - else { - szLogFile = ssl_util_server_root_relative(p, "log", sc->szLogFile); - if ((sc->fileLogFile = ap_pfopen(p, szLogFile, "a")) == NULL) { - ssl_log(s, SSL_LOG_ERROR|SSL_ADD_ERRNO, - "Cannot open SSL logfile %s", szLogFile); - ssl_die(); - } - setbuf(sc->fileLogFile, NULL); - } - } - return; -} - -static struct { - int nLevel; - char *szLevel; -} ssl_log_level2string[] = { - { SSL_LOG_ERROR, "error" }, - { SSL_LOG_WARN, "warn" }, - { SSL_LOG_INFO, "info" }, - { SSL_LOG_TRACE, "trace" }, - { SSL_LOG_DEBUG, "debug" }, - { 0, NULL } -}; - -static struct { - char *cpPattern; - char *cpAnnotation; -} ssl_log_annotate[] = { - { "*envelope*bad*decrypt*", "wrong pass phrase!?" }, - { "*CLIENT_HELLO*unknown*protocol*", "speaking not SSL to HTTPS port!?" }, - { "*CLIENT_HELLO*http*request*", "speaking HTTP to HTTPS port!?" }, - { "*SSL3_READ_BYTES:sslv3*alert*bad*certificate*", "Subject CN in certificate not server name or identical to CA!?" }, - { "*self signed certificate in certificate chain*", "Client certificate signed by CA not known to server?" }, - { "*peer did not return a certificate*", "No CAs known to server for verification?" }, - { "*no shared cipher*", "Too restrictive SSLCipherSuite or using DSA server certificate?" }, - { "*no start line*", "Bad file contents or format - or even just a forgotten SSLCertificateKeyFile?" }, - { "*bad password read*", "You entered an incorrect pass phrase!?" }, - { "*bad mac decode*", "Browser still remembered details of a re-created server certificate?" }, - { NULL, NULL } -}; - -static char *ssl_log_annotation(char *error) -{ - char *errstr; - int i; - - errstr = NULL; - for (i = 0; ssl_log_annotate[i].cpPattern != NULL; i++) { - if (ap_strcmp_match(error, ssl_log_annotate[i].cpPattern) == 0) { - errstr = ssl_log_annotate[i].cpAnnotation; - break; - } - } - return errstr; -} - -BOOL ssl_log_applies(server_rec *s, int level) -{ - SSLSrvConfigRec *sc; - - sc = mySrvConfig(s); - if ( sc->fileLogFile == NULL - && !(level & SSL_LOG_ERROR)) - return FALSE; - if ( level > sc->nLogLevel - && !(level & SSL_LOG_ERROR)) - return FALSE; - return TRUE; -} - -void ssl_log(server_rec *s, int level, const char *msg, ...) -{ - char tstr[80]; - char lstr[20]; - char vstr[1024]; - char str[1024]; - char nstr[2]; - int timz; - struct tm *t; - va_list ap; - int add; - int i; - char *astr; - int safe_errno; - unsigned long e; - SSLSrvConfigRec *sc; - char *cpE; - char *cpA; - - /* initialization */ - va_start(ap, msg); - safe_errno = errno; - sc = mySrvConfig(s); - - /* strip out additional flags */ - add = (level & ~SSL_LOG_MASK); - level = (level & SSL_LOG_MASK); - - /* reduce flags when not reasonable in context */ - if (add & SSL_ADD_ERRNO && errno == 0) - add &= ~SSL_ADD_ERRNO; - if (add & SSL_ADD_SSLERR && ERR_peek_error() == 0) - add &= ~SSL_ADD_SSLERR; - - /* we log only levels below, except for errors */ - if ( sc->fileLogFile == NULL - && !(level & SSL_LOG_ERROR)) - return; - if ( level > sc->nLogLevel - && !(level & SSL_LOG_ERROR)) - return; - - /* determine the time entry string */ - if (add & SSL_NO_TIMESTAMP) - tstr[0] = NUL; - else { - t = ap_get_gmtoff(&timz); - strftime(tstr, 80, "[%d/%b/%Y %H:%M:%S", t); - i = strlen(tstr); - ap_snprintf(tstr+i, 80-i, " %05d] ", (unsigned int)getpid()); - } - - /* determine whether newline should be written */ - if (add & SSL_NO_NEWLINE) - nstr[0] = NUL; - else { - nstr[0] = '\n'; - nstr[1] = NUL; - } - - /* determine level name */ - lstr[0] = NUL; - if (!(add & SSL_NO_LEVELID)) { - for (i = 0; ssl_log_level2string[i].nLevel != 0; i++) { - if (ssl_log_level2string[i].nLevel == level) { - ap_snprintf(lstr, sizeof(lstr), "[%s]", ssl_log_level2string[i].szLevel); - break; - } - } - for (i = strlen(lstr); i <= 7; i++) - lstr[i] = ' '; - lstr[i] = NUL; - } - - /* create custom message */ - ap_vsnprintf(vstr, sizeof(vstr), msg, ap); - - /* write out SSLog message */ - if ((add & SSL_ADD_ERRNO) && (add & SSL_ADD_SSLERR)) - astr = " (System and " SSL_LIBRARY_NAME " library errors follow)"; - else if (add & SSL_ADD_ERRNO) - astr = " (System error follows)"; - else if (add & SSL_ADD_SSLERR) - astr = " (" SSL_LIBRARY_NAME " library error follows)"; - else - astr = ""; - if (level <= sc->nLogLevel && sc->fileLogFile != NULL) { - ap_snprintf(str, sizeof(str), "%s%s%s%s%s", tstr, lstr, vstr, astr, nstr); - fprintf(sc->fileLogFile, "%s", str); - } - if (level & SSL_LOG_ERROR) - ap_log_error(APLOG_MARK, APLOG_ERR|APLOG_NOERRNO, s, - "mod_ssl: %s%s", vstr, astr); - - /* write out additional attachment messages */ - if (add & SSL_ADD_ERRNO) { - if (level <= sc->nLogLevel && sc->fileLogFile != NULL) { - ap_snprintf(str, sizeof(str), "%s%sSystem: %s (errno: %d)%s", - tstr, lstr, strerror(safe_errno), safe_errno, nstr); - fprintf(sc->fileLogFile, "%s", str); - } - if (level & SSL_LOG_ERROR) - ap_log_error(APLOG_MARK, APLOG_ERR|APLOG_NOERRNO, s, - "System: %s (errno: %d)", - strerror(safe_errno), safe_errno); - } - if (add & SSL_ADD_SSLERR) { - while ((e = ERR_get_error())) { - cpE = ERR_error_string(e, NULL); - cpA = ssl_log_annotation(cpE); - if (level <= sc->nLogLevel && sc->fileLogFile != NULL) { - ap_snprintf(str, sizeof(str), "%s%s%s: %s%s%s%s%s", - tstr, lstr, SSL_LIBRARY_NAME, cpE, - cpA != NULL ? " [Hint: " : "", - cpA != NULL ? cpA : "", cpA != NULL ? "]" : "", - nstr); - fprintf(sc->fileLogFile, "%s", str); - } - if (level & SSL_LOG_ERROR) - ap_log_error(APLOG_MARK, APLOG_ERR|APLOG_NOERRNO, s, - "%s: %s%s%s%s", SSL_LIBRARY_NAME, cpE, - cpA != NULL ? " [Hint: " : "", - cpA != NULL ? cpA : "", cpA != NULL ? "]" : ""); - } - } - /* make sure the next log starts from a clean base */ - /* ERR_clear_error(); */ - - /* cleanup and return */ - if (sc->fileLogFile != NULL) - fflush(sc->fileLogFile); - errno = safe_errno; - va_end(ap); - return; -} - -void ssl_die(void) -{ - /* - * This is used for fatal errors and here - * it is common module practice to really - * exit from the complete program. - */ - exit(1); -} - diff --git a/modules/ssl/ssl_engine_mutex.c b/modules/ssl/ssl_engine_mutex.c deleted file mode 100644 index 146f9ce4d900620de9101dfaad5ca00fafc74d6b..0000000000000000000000000000000000000000 --- a/modules/ssl/ssl_engine_mutex.c +++ /dev/null @@ -1,397 +0,0 @@ -/* _ _ -** _ __ ___ ___ __| | ___ ___| | mod_ssl -** | '_ ` _ \ / _ \ / _` | / __/ __| | Apache Interface to OpenSSL -** | | | | | | (_) | (_| | \__ \__ \ | www.modssl.org -** |_| |_| |_|\___/ \__,_|___|___/___/_| ftp.modssl.org -** |_____| -** ssl_engine_mutex.c -** Semaphore for Mutual Exclusion -*/ - -/* ==================================================================== - * Copyright (c) 1998-2001 Ralf S. Engelschall. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following - * disclaimer in the documentation and/or other materials - * provided with the distribution. - * - * 3. All advertising materials mentioning features or use of this - * software must display the following acknowledgment: - * "This product includes software developed by - * Ralf S. Engelschall for use in the - * mod_ssl project (http://www.modssl.org/)." - * - * 4. The names "mod_ssl" must not be used to endorse or promote - * products derived from this software without prior written - * permission. For written permission, please contact - * rse@engelschall.com. - * - * 5. Products derived from this software may not be called "mod_ssl" - * nor may "mod_ssl" appear in their names without prior - * written permission of Ralf S. Engelschall. - * - * 6. Redistributions of any form whatsoever must retain the following - * acknowledgment: - * "This product includes software developed by - * Ralf S. Engelschall for use in the - * mod_ssl project (http://www.modssl.org/)." - * - * THIS SOFTWARE IS PROVIDED BY RALF S. ENGELSCHALL ``AS IS'' AND ANY - * EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR - * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL RALF S. ENGELSCHALL OR - * HIS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT - * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, - * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED - * OF THE POSSIBILITY OF SUCH DAMAGE. - * ==================================================================== - */ - /* ``Real programmers confuse - Christmas and Halloween - because DEC 25 = OCT 31.'' - -- Unknown */ -#include "mod_ssl.h" - - -/* _________________________________________________________________ -** -** Mutex Support (Common) -** _________________________________________________________________ -*/ - -void ssl_mutex_init(server_rec *s, pool *p) -{ - SSLModConfigRec *mc = myModConfig(); - - if (mc->nMutexMode == SSL_MUTEXMODE_FILE) - ssl_mutex_file_create(s, p); - else if (mc->nMutexMode == SSL_MUTEXMODE_SEM) - ssl_mutex_sem_create(s, p); - return; -} - -void ssl_mutex_reinit(server_rec *s, pool *p) -{ - SSLModConfigRec *mc = myModConfig(); - - if (mc->nMutexMode == SSL_MUTEXMODE_FILE) - ssl_mutex_file_open(s, p); - else if (mc->nMutexMode == SSL_MUTEXMODE_SEM) - ssl_mutex_sem_open(s, p); - return; -} - -void ssl_mutex_on(server_rec *s) -{ - SSLModConfigRec *mc = myModConfig(); - BOOL ok = TRUE; - - if (mc->nMutexMode == SSL_MUTEXMODE_FILE) - ok = ssl_mutex_file_acquire(); - else if (mc->nMutexMode == SSL_MUTEXMODE_SEM) - ok = ssl_mutex_sem_acquire(); - if (!ok) - ssl_log(s, SSL_LOG_WARN, "Failed to acquire global mutex lock"); - return; -} - -void ssl_mutex_off(server_rec *s) -{ - SSLModConfigRec *mc = myModConfig(); - BOOL ok = TRUE; - - if (mc->nMutexMode == SSL_MUTEXMODE_FILE) - ok = ssl_mutex_file_release(); - else if (mc->nMutexMode == SSL_MUTEXMODE_SEM) - ok = ssl_mutex_sem_release(); - if (!ok) - ssl_log(s, SSL_LOG_WARN, "Failed to release global mutex lock"); - return; -} - -void ssl_mutex_kill(server_rec *s) -{ - SSLModConfigRec *mc = myModConfig(); - - if (mc->nMutexMode == SSL_MUTEXMODE_FILE) - ssl_mutex_file_remove(s); - else if (mc->nMutexMode == SSL_MUTEXMODE_SEM) - ssl_mutex_sem_remove(s); - return; -} - - -/* _________________________________________________________________ -** -** Mutex Support (Lockfile) -** _________________________________________________________________ -*/ - -void ssl_mutex_file_create(server_rec *s, pool *p) -{ -#ifndef WIN32 - SSLModConfigRec *mc = myModConfig(); - - /* create the lockfile */ - unlink(mc->szMutexFile); - if ((mc->nMutexFD = ap_popenf(p, mc->szMutexFile, - O_WRONLY|O_CREAT, SSL_MUTEX_LOCK_MODE)) < 0) { - ssl_log(s, SSL_LOG_ERROR|SSL_ADD_ERRNO, - "Parent process could not create SSLMutex lockfile %s", - mc->szMutexFile); - ssl_die(); - } - ap_pclosef(p, mc->nMutexFD); - - /* make sure the childs have access to this file */ -#ifndef OS2 - if (geteuid() == 0 /* is superuser */) - chown(mc->szMutexFile, ap_user_id, -1 /* no gid change */); -#endif - - /* open the lockfile for real */ - if ((mc->nMutexFD = ap_popenf(p, mc->szMutexFile, - O_WRONLY, SSL_MUTEX_LOCK_MODE)) < 0) { - ssl_log(s, SSL_LOG_ERROR|SSL_ADD_ERRNO, - "Parent could not open SSLMutex lockfile %s", - mc->szMutexFile); - ssl_die(); - } -#endif - return; -} - -void ssl_mutex_file_open(server_rec *s, pool *p) -{ -#ifndef WIN32 - SSLModConfigRec *mc = myModConfig(); - - /* open the lockfile (once per child) to get a unique fd */ - if ((mc->nMutexFD = ap_popenf(p, mc->szMutexFile, - O_WRONLY, SSL_MUTEX_LOCK_MODE)) < 0) { - ssl_log(s, SSL_LOG_ERROR|SSL_ADD_ERRNO, - "Child could not open SSLMutex lockfile %s", - mc->szMutexFile); - ssl_die(); - } -#endif - return; -} - -void ssl_mutex_file_remove(void *data) -{ -#ifndef WIN32 - SSLModConfigRec *mc = myModConfig(); - - /* remove the mutex lockfile */ - unlink(mc->szMutexFile); -#endif - return; -} - -#ifndef WIN32 -#ifdef SSL_USE_FCNTL -static struct flock lock_it; -static struct flock unlock_it; -#endif -#endif - -BOOL ssl_mutex_file_acquire(void) -{ - int rc = -1; -#ifndef WIN32 - SSLModConfigRec *mc = myModConfig(); - -#ifdef SSL_USE_FCNTL - lock_it.l_whence = SEEK_SET; /* from current point */ - lock_it.l_start = 0; /* -"- */ - lock_it.l_len = 0; /* until end of file */ - lock_it.l_type = F_WRLCK; /* set exclusive/write lock */ - lock_it.l_pid = 0; /* pid not actually interesting */ - - while ( ((rc = fcntl(mc->nMutexFD, F_SETLKW, &lock_it)) < 0) - && (errno == EINTR) ) - ; -#endif -#ifdef SSL_USE_FLOCK - while ( ((rc = flock(mc->nMutexFD, LOCK_EX)) < 0) - && (errno == EINTR) ) - ; -#endif -#endif - - if (rc < 0) - return FALSE; - else - return TRUE; -} - -BOOL ssl_mutex_file_release(void) -{ - int rc = -1; -#ifndef WIN32 - SSLModConfigRec *mc = myModConfig(); - -#ifdef SSL_USE_FCNTL - unlock_it.l_whence = SEEK_SET; /* from current point */ - unlock_it.l_start = 0; /* -"- */ - unlock_it.l_len = 0; /* until end of file */ - unlock_it.l_type = F_UNLCK; /* unlock */ - unlock_it.l_pid = 0; /* pid not actually interesting */ - - while ( (rc = fcntl(mc->nMutexFD, F_SETLKW, &unlock_it)) < 0 - && (errno == EINTR) ) - ; -#endif -#ifdef SSL_USE_FLOCK - while ( (rc = flock(mc->nMutexFD, LOCK_UN)) < 0 - && (errno == EINTR) ) - ; -#endif -#endif - - if (rc < 0) - return FALSE; - else - return TRUE; -} - -/* _________________________________________________________________ -** -** Mutex Support (Process Semaphore) -** _________________________________________________________________ -*/ - -void ssl_mutex_sem_create(server_rec *s, pool *p) -{ -#ifdef SSL_CAN_USE_SEM - int semid; - SSLModConfigRec *mc = myModConfig(); -#ifdef SSL_HAVE_IPCSEM - union ssl_ipc_semun semctlarg; - struct semid_ds semctlbuf; -#endif - -#ifdef SSL_HAVE_IPCSEM - semid = semget(IPC_PRIVATE, 1, IPC_CREAT|IPC_EXCL|S_IRUSR|S_IWUSR); - if (semid == -1 && errno == EEXIST) - semid = semget(IPC_PRIVATE, 1, IPC_EXCL|S_IRUSR|S_IWUSR); - if (semid == -1) { - ssl_log(s, SSL_LOG_ERROR|SSL_ADD_ERRNO, - "Parent process could not create private SSLMutex semaphore"); - ssl_die(); - } - semctlarg.val = 0; - if (semctl(semid, 0, SETVAL, semctlarg) < 0) { - ssl_log(s, SSL_LOG_ERROR|SSL_ADD_ERRNO, - "Parent process could not initialize SSLMutex semaphore value"); - ssl_die(); - } - semctlbuf.sem_perm.uid = ap_user_id; - semctlbuf.sem_perm.gid = ap_group_id; - semctlbuf.sem_perm.mode = 0660; - semctlarg.buf = &semctlbuf; - if (semctl(semid, 0, IPC_SET, semctlarg) < 0) { - ssl_log(s, SSL_LOG_ERROR|SSL_ADD_ERRNO, - "Parent process could not set permissions for SSLMutex semaphore"); - ssl_die(); - } -#endif -#ifdef SSL_HAVE_W32SEM - semid = (int)ap_create_mutex("mod_ssl_mutex"); -#endif - mc->nMutexSEMID = semid; -#endif - return; -} - -void ssl_mutex_sem_open(server_rec *s, pool *p) -{ -#ifdef SSL_CAN_USE_SEM -#ifdef SSL_HAVE_W32SEM - SSLModConfigRec *mc = myModConfig(); - - mc->nMutexSEMID = (int)ap_open_mutex("mod_ssl_mutex"); -#endif -#endif - return; -} - -void ssl_mutex_sem_remove(void *data) -{ -#ifdef SSL_CAN_USE_SEM - SSLModConfigRec *mc = myModConfig(); - -#ifdef SSL_HAVE_IPCSEM - semctl(mc->nMutexSEMID, 0, IPC_RMID, 0); -#endif -#ifdef SSL_HAVE_W32SEM - ap_destroy_mutex((mutex *)mc->nMutexSEMID); -#endif -#endif - return; -} - -BOOL ssl_mutex_sem_acquire(void) -{ - int rc = 0; -#ifdef SSL_CAN_USE_SEM - SSLModConfigRec *mc = myModConfig(); - -#ifdef SSL_HAVE_IPCSEM - struct sembuf sb[] = { - { 0, 0, 0 }, /* wait for semaphore */ - { 0, 1, SEM_UNDO } /* increment semaphore */ - }; - - while ( (rc = semop(mc->nMutexSEMID, sb, 2)) < 0 - && (errno == EINTR) ) - ; -#endif -#ifdef SSL_HAVE_W32SEM - rc = ap_acquire_mutex((mutex *)mc->nMutexSEMID); -#endif -#endif - if (rc != 0) - return FALSE; - else - return TRUE; -} - -BOOL ssl_mutex_sem_release(void) -{ - int rc = 0; -#ifdef SSL_CAN_USE_SEM - SSLModConfigRec *mc = myModConfig(); - -#ifdef SSL_HAVE_IPCSEM - struct sembuf sb[] = { - { 0, -1, SEM_UNDO } /* decrements semaphore */ - }; - - while ( (rc = semop(mc->nMutexSEMID, sb, 1)) < 0 - && (errno == EINTR) ) - ; -#endif -#ifdef SSL_HAVE_W32SEM - rc = ap_release_mutex((mutex *)mc->nMutexSEMID); -#endif -#endif - if (rc != 0) - return FALSE; - else - return TRUE; -} - diff --git a/modules/ssl/ssl_engine_pphrase.c b/modules/ssl/ssl_engine_pphrase.c deleted file mode 100644 index 2cef4e309eaba53f141449e29fcdf8b992717829..0000000000000000000000000000000000000000 --- a/modules/ssl/ssl_engine_pphrase.c +++ /dev/null @@ -1,545 +0,0 @@ -/* _ _ -** _ __ ___ ___ __| | ___ ___| | mod_ssl -** | '_ ` _ \ / _ \ / _` | / __/ __| | Apache Interface to OpenSSL -** | | | | | | (_) | (_| | \__ \__ \ | www.modssl.org -** |_| |_| |_|\___/ \__,_|___|___/___/_| ftp.modssl.org -** |_____| -** ssl_engine_pphrase.c -** Pass Phrase Dialog -*/ - -/* ==================================================================== - * Copyright (c) 1998-2001 Ralf S. Engelschall. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following - * disclaimer in the documentation and/or other materials - * provided with the distribution. - * - * 3. All advertising materials mentioning features or use of this - * software must display the following acknowledgment: - * "This product includes software developed by - * Ralf S. Engelschall for use in the - * mod_ssl project (http://www.modssl.org/)." - * - * 4. The names "mod_ssl" must not be used to endorse or promote - * products derived from this software without prior written - * permission. For written permission, please contact - * rse@engelschall.com. - * - * 5. Products derived from this software may not be called "mod_ssl" - * nor may "mod_ssl" appear in their names without prior - * written permission of Ralf S. Engelschall. - * - * 6. Redistributions of any form whatsoever must retain the following - * acknowledgment: - * "This product includes software developed by - * Ralf S. Engelschall for use in the - * mod_ssl project (http://www.modssl.org/)." - * - * THIS SOFTWARE IS PROVIDED BY RALF S. ENGELSCHALL ``AS IS'' AND ANY - * EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR - * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL RALF S. ENGELSCHALL OR - * HIS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT - * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, - * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED - * OF THE POSSIBILITY OF SUCH DAMAGE. - * ==================================================================== - */ - /* ``Treat your password like your - toothbrush. Don't let anybody - else use it, and get a new one - every six months.'' - -- Clifford Stoll */ -#include "mod_ssl.h" - - -/* _________________________________________________________________ -** -** Pass Phrase and Private Key Handling -** _________________________________________________________________ -*/ - -#define STDERR_FILENO_STORE 50 -#define BUILTIN_DIALOG_BACKOFF 2 -#define BUILTIN_DIALOG_RETRIES 5 - -void ssl_pphrase_Handle(server_rec *s, pool *p) -{ - SSLModConfigRec *mc = myModConfig(); - SSLSrvConfigRec *sc; - server_rec *pServ; - char *cpVHostID; - char szPath[MAX_STRING_LEN]; - EVP_PKEY *pPrivateKey; - ssl_asn1_t *asn1; - unsigned char *ucp; - X509 *pX509Cert; - FILE *fp; - BOOL bReadable; - ssl_ds_array *aPassPhrase; - int nPassPhrase; - int nPassPhraseCur; - char *cpPassPhraseCur; - int nPassPhraseRetry; - int nPassPhraseDialog; - int nPassPhraseDialogCur; - BOOL bPassPhraseDialogOnce; - char **cpp; - int i, j; - ssl_algo_t algoCert, algoKey, at; - char *an; - char *cp; - - /* - * Start with a fresh pass phrase array - */ - aPassPhrase = ssl_ds_array_make(p, sizeof(char *)); - nPassPhrase = 0; - nPassPhraseDialog = 0; - - /* - * Walk through all configured servers - */ - for (pServ = s; pServ != NULL; pServ = pServ->next) { - sc = mySrvConfig(pServ); - - if (!sc->bEnabled) - continue; - - cpVHostID = ssl_util_vhostid(p, pServ); - ssl_log(pServ, SSL_LOG_INFO, - "Init: Loading certificate & private key of SSL-aware server %s", - cpVHostID); - - /* - * Read in server certificate(s): This is the easy part - * because this file isn't encrypted in any way. - */ - if (sc->szPublicCertFile[0] == NULL) { - ssl_log(pServ, SSL_LOG_ERROR, - "Init: Server %s should be SSL-aware but has no certificate configured " - "[Hint: SSLCertificateFile]", cpVHostID); - ssl_die(); - } - algoCert = SSL_ALGO_UNKNOWN; - algoKey = SSL_ALGO_UNKNOWN; - for (i = 0, j = 0; i < SSL_AIDX_MAX && sc->szPublicCertFile[i] != NULL; i++) { - - ap_cpystrn(szPath, sc->szPublicCertFile[i], sizeof(szPath)); - if ((fp = ap_pfopen(p, szPath, "r")) == NULL) { - ssl_log(s, SSL_LOG_ERROR|SSL_ADD_ERRNO, - "Init: Can't open server certificate file %s", szPath); - ssl_die(); - } - if ((pX509Cert = SSL_read_X509(fp, NULL, NULL)) == NULL) { - ssl_log(s, SSL_LOG_ERROR|SSL_ADD_SSLERR, - "Init: Unable to read server certificate from file %s", szPath); - ssl_die(); - } - ap_pfclose(p, fp); - - /* - * check algorithm type of certificate and make - * sure only one certificate per type is used. - */ - at = ssl_util_algotypeof(pX509Cert, NULL); - an = ssl_util_algotypestr(at); - if (algoCert & at) { - ssl_log(s, SSL_LOG_ERROR|SSL_ADD_SSLERR, - "Init: Multiple %s server certificates not allowed", an); - ssl_die(); - } - algoCert |= at; - - /* - * Insert the certificate into global module configuration to let it - * survive the processing between the 1st Apache API init round (where - * we operate here) and the 2nd Apache init round (where the - * certificate is actually used to configure mod_ssl's per-server - * configuration structures). - */ - cp = ap_psprintf(mc->pPool, "%s:%s", cpVHostID, an); - asn1 = (ssl_asn1_t *)ssl_ds_table_push(mc->tPublicCert, cp); - asn1->nData = i2d_X509(pX509Cert, NULL); - asn1->cpData = ap_palloc(mc->pPool, asn1->nData); - ucp = asn1->cpData; i2d_X509(pX509Cert, &ucp); /* 2nd arg increments */ - - /* - * Free the X509 structure - */ - X509_free(pX509Cert); - - /* - * Read in the private key: This is the non-trivial part, because the - * key is typically encrypted, so a pass phrase dialog has to be used - * to request it from the user (or it has to be alternatively gathered - * from a dialog program). The important point here is that ISPs - * usually have hundrets of virtual servers configured and a lot of - * them use SSL, so really we have to minimize the pass phrase - * dialogs. - * - * The idea is this: When N virtual hosts are configured and all of - * them use encrypted private keys with different pass phrases, we - * have no chance and have to pop up N pass phrase dialogs. But - * usually the admin is clever enough and uses the same pass phrase - * for more private key files (typically he even uses one single pass - * phrase for all). When this is the case we can minimize the dialogs - * by trying to re-use already known/entered pass phrases. - */ - if (sc->szPrivateKeyFile[j] != NULL) - ap_cpystrn(szPath, sc->szPrivateKeyFile[j++], sizeof(szPath)); - - /* - * Try to read the private key file with the help of - * the callback function which serves the pass - * phrases to OpenSSL - */ - myCtxVarSet(mc, 1, pServ); - myCtxVarSet(mc, 2, p); - myCtxVarSet(mc, 3, aPassPhrase); - myCtxVarSet(mc, 4, &nPassPhraseCur); - myCtxVarSet(mc, 5, &cpPassPhraseCur); - myCtxVarSet(mc, 6, cpVHostID); - myCtxVarSet(mc, 7, an); - myCtxVarSet(mc, 8, &nPassPhraseDialog); - myCtxVarSet(mc, 9, &nPassPhraseDialogCur); - myCtxVarSet(mc, 10, &bPassPhraseDialogOnce); - - nPassPhraseCur = 0; - nPassPhraseRetry = 0; - nPassPhraseDialogCur = 0; - bPassPhraseDialogOnce = TRUE; - - pPrivateKey = NULL; - - for (;;) { - /* - * Try to read the private key file with the help of - * the callback function which serves the pass - * phrases to OpenSSL - */ - if ((fp = ap_pfopen(p, szPath, "r")) == NULL) { - ssl_log(s, SSL_LOG_ERROR|SSL_ADD_ERRNO, - "Init: Can't open server private key file %s", szPath); - ssl_die(); - } - cpPassPhraseCur = NULL; - bReadable = ((pPrivateKey = SSL_read_PrivateKey(fp, NULL, - ssl_pphrase_Handle_CB)) != NULL ? TRUE : FALSE); - ap_pfclose(p, fp); - - /* - * when the private key file now was readable, - * it's fine and we go out of the loop - */ - if (bReadable) - break; - - /* - * when we have more remembered pass phrases - * try to reuse these first. - */ - if (nPassPhraseCur < nPassPhrase) { - nPassPhraseCur++; - continue; - } - - /* - * else it's not readable and we have no more - * remembered pass phrases. Then this has to mean - * that the callback function popped up the dialog - * but a wrong pass phrase was entered. We give the - * user (but not the dialog program) a few more - * chances... - */ - if ( sc->nPassPhraseDialogType == SSL_PPTYPE_BUILTIN - && cpPassPhraseCur != NULL - && nPassPhraseRetry < BUILTIN_DIALOG_RETRIES ) { - fprintf(stdout, "Apache:mod_ssl:Error: Pass phrase incorrect " - "(%d more retr%s permitted).\n", - (BUILTIN_DIALOG_RETRIES-nPassPhraseRetry), - (BUILTIN_DIALOG_RETRIES-nPassPhraseRetry) == 1 ? "y" : "ies"); - nPassPhraseRetry++; - if (nPassPhraseRetry > BUILTIN_DIALOG_BACKOFF) - sleep((nPassPhraseRetry-BUILTIN_DIALOG_BACKOFF)*5); - continue; - } - - /* - * Ok, anything else now means a fatal error. - */ - if (cpPassPhraseCur == NULL) - ssl_log(pServ, SSL_LOG_ERROR|SSL_ADD_SSLERR, "Init: Private key not found"); - if (sc->nPassPhraseDialogType == SSL_PPTYPE_BUILTIN) { - fprintf(stdout, "Apache:mod_ssl:Error: Private key not found.\n"); - fprintf(stdout, "**Stopped\n"); - } - else { - ssl_log(pServ, SSL_LOG_ERROR|SSL_ADD_SSLERR, "Init: Pass phrase incorrect"); - if (sc->nPassPhraseDialogType == SSL_PPTYPE_BUILTIN) { - fprintf(stdout, "Apache:mod_ssl:Error: Pass phrase incorrect.\n"); - fprintf(stdout, "**Stopped\n"); - } - } - ssl_die(); - } - - if (pPrivateKey == NULL) { - ssl_log(s, SSL_LOG_ERROR|SSL_ADD_SSLERR, - "Init: Unable to read server private key from file %s", szPath); - ssl_die(); - } - - /* - * check algorithm type of private key and make - * sure only one private key per type is used. - */ - at = ssl_util_algotypeof(NULL, pPrivateKey); - an = ssl_util_algotypestr(at); - if (algoKey & at) { - ssl_log(s, SSL_LOG_ERROR|SSL_ADD_SSLERR, - "Init: Multiple %s server private keys not allowed", an); - ssl_die(); - } - algoKey |= at; - - /* - * Log the type of reading - */ - if (nPassPhraseDialogCur == 0) - ssl_log(pServ, SSL_LOG_TRACE, - "Init: (%s) unencrypted %s private key - pass phrase not required", - cpVHostID, an); - else { - if (cpPassPhraseCur != NULL) - ssl_log(pServ, SSL_LOG_TRACE, - "Init: (%s) encrypted %s private key - pass phrase requested", - cpVHostID, an); - else - ssl_log(pServ, SSL_LOG_TRACE, - "Init: (%s) encrypted %s private key - pass phrase reused", - cpVHostID, an); - } - - /* - * Ok, when we have one more pass phrase store it - */ - if (cpPassPhraseCur != NULL) { - cpp = (char **)ssl_ds_array_push(aPassPhrase); - *cpp = cpPassPhraseCur; - nPassPhrase++; - } - - /* - * Insert private key into the global module configuration - * (we convert it to a stand-alone DER byte sequence - * because the SSL library uses static variables inside a - * RSA structure which do not survive DSO reloads!) - */ - cp = ap_psprintf(mc->pPool, "%s:%s", cpVHostID, an); - asn1 = (ssl_asn1_t *)ssl_ds_table_push(mc->tPrivateKey, cp); - asn1->nData = i2d_PrivateKey(pPrivateKey, NULL); - asn1->cpData = ap_palloc(mc->pPool, asn1->nData); - ucp = asn1->cpData; i2d_PrivateKey(pPrivateKey, &ucp); /* 2nd arg increments */ - - /* - * Free the private key structure - */ - EVP_PKEY_free(pPrivateKey); - } - } - - /* - * Let the user know when we're successful. - */ - if (nPassPhraseDialog > 0) { - sc = mySrvConfig(s); - if (sc->nPassPhraseDialogType == SSL_PPTYPE_BUILTIN) { - fprintf(stdout, "\n"); - fprintf(stdout, "Ok: Pass Phrase Dialog successful.\n"); - } - } - - /* - * Wipe out the used memory from the - * pass phrase array and then deallocate it - */ - if (!ssl_ds_array_isempty(aPassPhrase)) { - ssl_ds_array_wipeout(aPassPhrase); - ssl_ds_array_kill(aPassPhrase); - ssl_log(s, SSL_LOG_INFO, "Init: Wiped out the queried pass phrases from memory"); - } - - return; -} - -int ssl_pphrase_Handle_CB(char *buf, int bufsize, int verify) -{ - SSLModConfigRec *mc = myModConfig(); - server_rec *s; - pool *p; - ssl_ds_array *aPassPhrase; - SSLSrvConfigRec *sc; - int *pnPassPhraseCur; - char **cppPassPhraseCur; - char *cpVHostID; - char *cpAlgoType; - int *pnPassPhraseDialog; - int *pnPassPhraseDialogCur; - BOOL *pbPassPhraseDialogOnce; - int stderr_store; - char **cpp; - int len = -1; - - /* - * Reconnect to the context of ssl_phrase_Handle() - */ - s = myCtxVarGet(mc, 1, server_rec *); - p = myCtxVarGet(mc, 2, pool *); - aPassPhrase = myCtxVarGet(mc, 3, ssl_ds_array *); - pnPassPhraseCur = myCtxVarGet(mc, 4, int *); - cppPassPhraseCur = myCtxVarGet(mc, 5, char **); - cpVHostID = myCtxVarGet(mc, 6, char *); - cpAlgoType = myCtxVarGet(mc, 7, char *); - pnPassPhraseDialog = myCtxVarGet(mc, 8, int *); - pnPassPhraseDialogCur = myCtxVarGet(mc, 9, int *); - pbPassPhraseDialogOnce = myCtxVarGet(mc, 10, BOOL *); - sc = mySrvConfig(s); - - (*pnPassPhraseDialog)++; - (*pnPassPhraseDialogCur)++; - - /* - * When remembered pass phrases are available use them... - */ - if ((cpp = (char **)ssl_ds_array_get(aPassPhrase, *pnPassPhraseCur)) != NULL) { - ap_cpystrn(buf, *cpp, bufsize); - len = strlen(buf); - return len; - } - - /* - * Builtin dialog - */ - if (sc->nPassPhraseDialogType == SSL_PPTYPE_BUILTIN) { - char *prompt; - int i; -#ifdef WIN32 - FILE *con; -#endif - - ssl_log(s, SSL_LOG_INFO, - "Init: Requesting pass phrase via builtin terminal dialog"); - - /* - * Reconnect STDERR to terminal (here STDOUT) because - * at our init stage Apache already connected STDERR - * to the general error logfile. - */ -#ifdef WIN32 - stderr_store = STDERR_FILENO_STORE; -#else - if ((stderr_store = open("/dev/null", O_WRONLY)) == -1) - stderr_store = STDERR_FILENO_STORE; -#endif - dup2(STDERR_FILENO, stderr_store); -#ifdef WIN32 - if ((con = fopen("con", "w")) != NULL) - dup2(fileno(con), STDERR_FILENO); - else - dup2(STDOUT_FILENO, STDERR_FILENO); -#else - dup2(STDOUT_FILENO, STDERR_FILENO); -#endif - - /* - * The first time display a header to inform the user about what - * program he actually speaks to, which module is responsible for - * this terminal dialog and why to the hell he has to enter - * something... - */ - if (*pnPassPhraseDialog == 1) { - fprintf(stderr, "%s mod_ssl/%s (Pass Phrase Dialog)\n", - SERVER_BASEVERSION, MOD_SSL_VERSION); - fprintf(stderr, "Some of your private key files are encrypted for security reasons.\n"); - fprintf(stderr, "In order to read them you have to provide us with the pass phrases.\n"); - } - if (*pbPassPhraseDialogOnce) { - *pbPassPhraseDialogOnce = FALSE; - fprintf(stderr, "\n"); - fprintf(stderr, "Server %s (%s)\n", cpVHostID, cpAlgoType); - } - - /* - * Emulate the OpenSSL internal pass phrase dialog - * (see crypto/pem/pem_lib.c:def_callback() for details) - */ - prompt = "Enter pass phrase:"; - for (;;) { - if ((i = EVP_read_pw_string(buf, bufsize, prompt, FALSE)) != 0) { - PEMerr(PEM_F_DEF_CALLBACK,PEM_R_PROBLEMS_GETTING_PASSWORD); - memset(buf, 0, (unsigned int)bufsize); - return (-1); - } - len = strlen(buf); - if (len < 1) - fprintf(stderr, "Apache:mod_ssl:Error: Pass phrase empty (needs to be at least 1 character).\n"); - else - break; - } - - /* - * Restore STDERR to Apache error logfile - */ - dup2(stderr_store, STDERR_FILENO); - close(stderr_store); -#ifdef WIN32 - if (con != NULL) - fclose(con); -#endif - } - - /* - * Filter program - */ - else if (sc->nPassPhraseDialogType == SSL_PPTYPE_FILTER) { - char *cmd; - char *result; - - ssl_log(s, SSL_LOG_INFO, - "Init: Requesting pass phrase from dialog filter program (%s)", - sc->szPassPhraseDialogPath); - - if (strchr(sc->szPassPhraseDialogPath, ' ') != NULL) - cmd = ap_psprintf(p, "\"%s\" %s %s", sc->szPassPhraseDialogPath, cpVHostID, cpAlgoType); - else - cmd = ap_psprintf(p, "%s %s %s", sc->szPassPhraseDialogPath, cpVHostID, cpAlgoType); - result = ssl_util_readfilter(s, p, cmd); - ap_cpystrn(buf, result, bufsize); - len = strlen(buf); - } - - /* - * Ok, we now have the pass phrase, so give it back - */ - *cppPassPhraseCur = ap_pstrdup(p, buf); - - /* - * And return it's length to OpenSSL... - */ - return (len); -} - diff --git a/modules/ssl/ssl_engine_rand.c b/modules/ssl/ssl_engine_rand.c deleted file mode 100644 index afb49b4f5c9268dca51918c35b53cb266ca2f207..0000000000000000000000000000000000000000 --- a/modules/ssl/ssl_engine_rand.c +++ /dev/null @@ -1,215 +0,0 @@ -/* _ _ -** _ __ ___ ___ __| | ___ ___| | mod_ssl -** | '_ ` _ \ / _ \ / _` | / __/ __| | Apache Interface to OpenSSL -** | | | | | | (_) | (_| | \__ \__ \ | www.modssl.org -** |_| |_| |_|\___/ \__,_|___|___/___/_| ftp.modssl.org -** |_____| -** ssl_engine_rand.c -** Random Number Generator Seeding -*/ - -/* ==================================================================== - * Copyright (c) 1998-2001 Ralf S. Engelschall. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following - * disclaimer in the documentation and/or other materials - * provided with the distribution. - * - * 3. All advertising materials mentioning features or use of this - * software must display the following acknowledgment: - * "This product includes software developed by - * Ralf S. Engelschall for use in the - * mod_ssl project (http://www.modssl.org/)." - * - * 4. The names "mod_ssl" must not be used to endorse or promote - * products derived from this software without prior written - * permission. For written permission, please contact - * rse@engelschall.com. - * - * 5. Products derived from this software may not be called "mod_ssl" - * nor may "mod_ssl" appear in their names without prior - * written permission of Ralf S. Engelschall. - * - * 6. Redistributions of any form whatsoever must retain the following - * acknowledgment: - * "This product includes software developed by - * Ralf S. Engelschall for use in the - * mod_ssl project (http://www.modssl.org/)." - * - * THIS SOFTWARE IS PROVIDED BY RALF S. ENGELSCHALL ``AS IS'' AND ANY - * EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR - * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL RALF S. ENGELSCHALL OR - * HIS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT - * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, - * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED - * OF THE POSSIBILITY OF SUCH DAMAGE. - * ==================================================================== - */ - /* ``The generation of random - numbers is too important - to be left to chance.'' */ - -#include "mod_ssl.h" - - -/* _________________________________________________________________ -** -** Support for better seeding of SSL library's RNG -** _________________________________________________________________ -*/ - -static int ssl_rand_choosenum(int, int); -static int ssl_rand_feedfp(pool *, FILE *, int); - -int ssl_rand_seed(server_rec *s, pool *p, ssl_rsctx_t nCtx, char *prefix) -{ - SSLModConfigRec *mc; - array_header *apRandSeed; - ssl_randseed_t *pRandSeeds; - ssl_randseed_t *pRandSeed; - unsigned char stackdata[256]; - int nReq, nDone; - FILE *fp; - int i, n, l; - time_t t; - pid_t pid; - - mc = myModConfig(); - nReq = 0; - nDone = 0; - apRandSeed = mc->aRandSeed; - pRandSeeds = (ssl_randseed_t *)apRandSeed->elts; - for (i = 0; i < apRandSeed->nelts; i++) { - pRandSeed = &pRandSeeds[i]; - if (pRandSeed->nCtx == nCtx) { - nReq += pRandSeed->nBytes; - if (pRandSeed->nSrc == SSL_RSSRC_FILE) { - /* - * seed in contents of an external file - */ - if ((fp = ap_pfopen(p, pRandSeed->cpPath, "r")) == NULL) - continue; - nDone += ssl_rand_feedfp(p, fp, pRandSeed->nBytes); - ap_pfclose(p, fp); - } - else if (pRandSeed->nSrc == SSL_RSSRC_EXEC) { - /* - * seed in contents generated by an external program - */ - if ((fp = ssl_util_ppopen(s, p, ap_psprintf(p, "%s %d", - pRandSeed->cpPath, pRandSeed->nBytes))) == NULL) - continue; - nDone += ssl_rand_feedfp(p, fp, pRandSeed->nBytes); - ssl_util_ppclose(s, p, fp); - } -#if SSL_LIBRARY_VERSION >= 0x00905100 - else if (pRandSeed->nSrc == SSL_RSSRC_EGD) { - /* - * seed in contents provided by the external - * Entropy Gathering Daemon (EGD) - */ - if ((n = RAND_egd(pRandSeed->cpPath)) == -1) - continue; - nDone += n; - } -#endif - else if (pRandSeed->nSrc == SSL_RSSRC_BUILTIN) { - /* - * seed in the current time (usually just 4 bytes) - */ - t = time(NULL); - l = sizeof(time_t); - RAND_seed((unsigned char *)&t, l); - nDone += l; - - /* - * seed in the current process id (usually just 4 bytes) - */ - pid = getpid(); - l = sizeof(pid_t); - RAND_seed((unsigned char *)&pid, l); - nDone += l; - - /* - * seed in some current state of the run-time stack (128 bytes) - */ - n = ssl_rand_choosenum(0, sizeof(stackdata)-128-1); - RAND_seed(stackdata+n, 128); - nDone += 128; - - /* - * seed in an 1KB extract of the current scoreboard - */ - if (ap_scoreboard_image != NULL) { - n = ssl_rand_choosenum(0, SCOREBOARD_SIZE-1024-1); - RAND_seed((unsigned char *)ap_scoreboard_image+n, 1024); - nDone += 1024; - } - } - } - } - ssl_log(s, SSL_LOG_INFO, "%sSeeding PRNG with %d bytes of entropy", prefix, nDone); - -#if SSL_LIBRARY_VERSION >= 0x00905100 - if (RAND_status() == 0) - ssl_log(s, SSL_LOG_WARN, "%sPRNG still contains not sufficient entropy!", prefix); -#endif - return nDone; -} - -#define BUFSIZE 8192 - -static int ssl_rand_feedfp(pool *p, FILE *fp, int nReq) -{ - int nDone; - unsigned char caBuf[BUFSIZE]; - int nBuf; - int nRead; - int nTodo; - - nDone = 0; - nRead = BUFSIZE; - nTodo = nReq; - while (1) { - if (nReq > 0) - nRead = (nTodo < BUFSIZE ? nTodo : BUFSIZE); - if ((nBuf = (int)fread(caBuf, 1, nRead, fp)) <= 0) - break; - RAND_seed(caBuf, nBuf); - nDone += nBuf; - if (nReq > 0) { - nTodo -= nBuf; - if (nTodo <= 0) - break; - } - } - return nDone; -} - -static int ssl_rand_choosenum(int l, int h) -{ - int i; - char buf[50]; - - srand((unsigned int)time(NULL)); - ap_snprintf(buf, sizeof(buf), "%.0f", - (((double)(rand()%RAND_MAX)/RAND_MAX)*(h-l))); - i = atoi(buf)+1; - if (i < l) i = l; - if (i > h) i = h; - return i; -} - diff --git a/modules/ssl/ssl_engine_vars.c b/modules/ssl/ssl_engine_vars.c deleted file mode 100644 index c0755a5ec841bccf577b66b06670b9d0db719e4f..0000000000000000000000000000000000000000 --- a/modules/ssl/ssl_engine_vars.c +++ /dev/null @@ -1,615 +0,0 @@ -/* _ _ -** _ __ ___ ___ __| | ___ ___| | mod_ssl -** | '_ ` _ \ / _ \ / _` | / __/ __| | Apache Interface to OpenSSL -** | | | | | | (_) | (_| | \__ \__ \ | www.modssl.org -** |_| |_| |_|\___/ \__,_|___|___/___/_| ftp.modssl.org -** |_____| -** ssl_engine_vars.c -** Variable Lookup Facility -*/ - -/* ==================================================================== - * Copyright (c) 1998-2001 Ralf S. Engelschall. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following - * disclaimer in the documentation and/or other materials - * provided with the distribution. - * - * 3. All advertising materials mentioning features or use of this - * software must display the following acknowledgment: - * "This product includes software developed by - * Ralf S. Engelschall for use in the - * mod_ssl project (http://www.modssl.org/)." - * - * 4. The names "mod_ssl" must not be used to endorse or promote - * products derived from this software without prior written - * permission. For written permission, please contact - * rse@engelschall.com. - * - * 5. Products derived from this software may not be called "mod_ssl" - * nor may "mod_ssl" appear in their names without prior - * written permission of Ralf S. Engelschall. - * - * 6. Redistributions of any form whatsoever must retain the following - * acknowledgment: - * "This product includes software developed by - * Ralf S. Engelschall for use in the - * mod_ssl project (http://www.modssl.org/)." - * - * THIS SOFTWARE IS PROVIDED BY RALF S. ENGELSCHALL ``AS IS'' AND ANY - * EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR - * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL RALF S. ENGELSCHALL OR - * HIS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT - * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, - * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED - * OF THE POSSIBILITY OF SUCH DAMAGE. - * ==================================================================== - */ - /* ``Those of you who think they - know everything are very annoying - to those of us who do.'' - -- Unknown */ -#include "mod_ssl.h" - - -/* _________________________________________________________________ -** -** Variable Lookup -** _________________________________________________________________ -*/ - -static char *ssl_var_lookup_header(pool *p, request_rec *r, const char *name); -static char *ssl_var_lookup_ssl(pool *p, conn_rec *c, char *var); -static char *ssl_var_lookup_ssl_cert(pool *p, X509 *xs, char *var); -static char *ssl_var_lookup_ssl_cert_dn(pool *p, X509_NAME *xsname, char *var); -static char *ssl_var_lookup_ssl_cert_valid(pool *p, ASN1_UTCTIME *tm); -static char *ssl_var_lookup_ssl_cert_serial(pool *p, X509 *xs); -static char *ssl_var_lookup_ssl_cert_chain(pool *p, STACK_OF(X509) *sk, char *var); -static char *ssl_var_lookup_ssl_cert_PEM(pool *p, X509 *xs); -static char *ssl_var_lookup_ssl_cert_verify(pool *p, conn_rec *c); -static char *ssl_var_lookup_ssl_cipher(pool *p, conn_rec *c, char *var); -static void ssl_var_lookup_ssl_cipher_bits(SSL *ssl, int *usekeysize, int *algkeysize); -static char *ssl_var_lookup_ssl_version(pool *p, char *var); - -void ssl_var_register(void) -{ - ap_hook_configure("ap::mod_ssl::var_lookup", - AP_HOOK_SIG6(ptr,ptr,ptr,ptr,ptr,ptr), AP_HOOK_DECLINE(NULL)); - ap_hook_register("ap::mod_ssl::var_lookup", - ssl_var_lookup, AP_HOOK_NOCTX); - return; -} - -void ssl_var_unregister(void) -{ - ap_hook_unregister("ap::mod_ssl::var_lookup", ssl_var_lookup); - return; -} - -char *ssl_var_lookup(pool *p, server_rec *s, conn_rec *c, request_rec *r, char *var) -{ - SSLModConfigRec *mc = myModConfig(); - char *result; - BOOL resdup; - time_t tc; - struct tm *tm; - - result = NULL; - resdup = TRUE; - - /* - * When no pool is given try to find one - */ - if (p == NULL) { - if (r != NULL) - p = r->pool; - else if (c != NULL) - p = c->pool; - else - p = mc->pPool; - } - - /* - * Request dependent stuff - */ - if (r != NULL) { - if (strcEQ(var, "HTTP_USER_AGENT")) - result = ssl_var_lookup_header(p, r, "User-Agent"); - else if (strcEQ(var, "HTTP_REFERER")) - result = ssl_var_lookup_header(p, r, "Referer"); - else if (strcEQ(var, "HTTP_COOKIE")) - result = ssl_var_lookup_header(p, r, "Cookie"); - else if (strcEQ(var, "HTTP_FORWARDED")) - result = ssl_var_lookup_header(p, r, "Forwarded"); - else if (strcEQ(var, "HTTP_HOST")) - result = ssl_var_lookup_header(p, r, "Host"); - else if (strcEQ(var, "HTTP_PROXY_CONNECTION")) - result = ssl_var_lookup_header(p, r, "Proxy-Connection"); - else if (strcEQ(var, "HTTP_ACCEPT")) - result = ssl_var_lookup_header(p, r, "Accept"); - else if (strlen(var) > 5 && strcEQn(var, "HTTP:", 5)) - /* all other headers from which we are still not know about */ - result = ssl_var_lookup_header(p, r, var+5); - else if (strcEQ(var, "THE_REQUEST")) - result = r->the_request; - else if (strcEQ(var, "REQUEST_METHOD")) - result = (char *)(r->method); - else if (strcEQ(var, "REQUEST_SCHEME")) - result = ap_http_method(r); - else if (strcEQ(var, "REQUEST_URI")) - result = r->uri; - else if (strcEQ(var, "SCRIPT_FILENAME") || - strcEQ(var, "REQUEST_FILENAME")) - result = r->filename; - else if (strcEQ(var, "PATH_INFO")) - result = r->path_info; - else if (strcEQ(var, "QUERY_STRING")) - result = r->args; - else if (strcEQ(var, "REMOTE_HOST")) - result = (char *)ap_get_remote_host(r->connection, - r->per_dir_config, REMOTE_NAME); - else if (strcEQ(var, "REMOTE_IDENT")) - result = (char *)ap_get_remote_logname(r); - else if (strcEQ(var, "IS_SUBREQ")) - result = (r->main != NULL ? "true" : "false"); - else if (strcEQ(var, "DOCUMENT_ROOT")) - result = (char *)ap_document_root(r); - else if (strcEQ(var, "SERVER_ADMIN")) - result = r->server->server_admin; - else if (strcEQ(var, "SERVER_NAME")) - result = (char *)ap_get_server_name(r); - else if (strcEQ(var, "SERVER_PORT")) - result = ap_psprintf(p, "%u", ap_get_server_port(r)); - else if (strcEQ(var, "SERVER_PROTOCOL")) - result = r->protocol; - } - - /* - * Connection stuff - */ - if (result == NULL && c != NULL) { - if (strcEQ(var, "REMOTE_ADDR")) - result = c->remote_ip; - else if (strcEQ(var, "REMOTE_USER")) - result = c->user; - else if (strcEQ(var, "AUTH_TYPE")) - result = c->ap_auth_type; - else if (strlen(var) > 4 && strcEQn(var, "SSL_", 4)) - result = ssl_var_lookup_ssl(p, c, var+4); - else if (strcEQ(var, "HTTPS")) { - if (ap_ctx_get(c->client->ctx, "ssl") != NULL) - result = "on"; - else - result = "off"; - } - } - - /* - * Totally independent stuff - */ - if (result == NULL) { - if (strlen(var) > 12 && strcEQn(var, "SSL_VERSION_", 12)) - result = ssl_var_lookup_ssl_version(p, var+12); - else if (strcEQ(var, "SERVER_SOFTWARE")) - result = (char *)ap_get_server_version(); - else if (strcEQ(var, "API_VERSION")) { - result = ap_psprintf(p, "%d", MODULE_MAGIC_NUMBER); - resdup = FALSE; - } - else if (strcEQ(var, "TIME_YEAR")) { - tc = time(NULL); - tm = localtime(&tc); - result = ap_psprintf(p, "%02d%02d", - (tm->tm_year / 100) + 19, tm->tm_year % 100); - resdup = FALSE; - } -#define MKTIMESTR(format, tmfield) \ - tc = time(NULL); \ - tm = localtime(&tc); \ - result = ap_psprintf(p, format, tm->tmfield); \ - resdup = FALSE; - else if (strcEQ(var, "TIME_MON")) { - MKTIMESTR("%02d", tm_mon+1) - } - else if (strcEQ(var, "TIME_DAY")) { - MKTIMESTR("%02d", tm_mday) - } - else if (strcEQ(var, "TIME_HOUR")) { - MKTIMESTR("%02d", tm_hour) - } - else if (strcEQ(var, "TIME_MIN")) { - MKTIMESTR("%02d", tm_min) - } - else if (strcEQ(var, "TIME_SEC")) { - MKTIMESTR("%02d", tm_sec) - } - else if (strcEQ(var, "TIME_WDAY")) { - MKTIMESTR("%d", tm_wday) - } - else if (strcEQ(var, "TIME")) { - tc = time(NULL); - tm = localtime(&tc); - result = ap_psprintf(p, - "%02d%02d%02d%02d%02d%02d%02d", (tm->tm_year / 100) + 19, - (tm->tm_year % 100), tm->tm_mon+1, tm->tm_mday, - tm->tm_hour, tm->tm_min, tm->tm_sec); - resdup = FALSE; - } - /* all other env-variables from the parent Apache process */ - else if (strlen(var) > 4 && strcEQn(var, "ENV:", 4)) { - result = (char *)ap_table_get(r->notes, var+4); - if (result == NULL) - result = (char *)ap_table_get(r->subprocess_env, var+4); - if (result == NULL) - result = getenv(var+4); - } - } - - if (result != NULL && resdup) - result = ap_pstrdup(p, result); - if (result == NULL) - result = ""; - return result; -} - -static char *ssl_var_lookup_header(pool *p, request_rec *r, const char *name) -{ - array_header *hdrs_arr; - table_entry *hdrs; - int i; - - hdrs_arr = ap_table_elts(r->headers_in); - hdrs = (table_entry *)hdrs_arr->elts; - for (i = 0; i < hdrs_arr->nelts; ++i) { - if (hdrs[i].key == NULL) - continue; - if (strcEQ(hdrs[i].key, name)) - return ap_pstrdup(p, hdrs[i].val); - } - return NULL; -} - -static char *ssl_var_lookup_ssl(pool *p, conn_rec *c, char *var) -{ - char *result; - X509 *xs; - STACK_OF(X509) *sk; - SSL *ssl; - - result = NULL; - - ssl = ap_ctx_get(c->client->ctx, "ssl"); - if (strlen(var) > 8 && strcEQn(var, "VERSION_", 8)) { - result = ssl_var_lookup_ssl_version(p, var+8); - } - else if (ssl != NULL && strcEQ(var, "PROTOCOL")) { - result = (char *)SSL_get_version(ssl); - } - else if (ssl != NULL && strcEQ(var, "SESSION_ID")) { - SSL_SESSION *pSession = SSL_get_session(ssl); - result = ap_pstrdup(p, SSL_SESSION_id2sz(pSession->session_id, - pSession->session_id_length)); - } - else if (ssl != NULL && strlen(var) >= 6 && strcEQn(var, "CIPHER", 6)) { - result = ssl_var_lookup_ssl_cipher(p, c, var+6); - } - else if (ssl != NULL && strlen(var) > 18 && strcEQn(var, "CLIENT_CERT_CHAIN_", 18)) { - sk = SSL_get_peer_cert_chain(ssl); - result = ssl_var_lookup_ssl_cert_chain(p, sk, var+17); - } - else if (ssl != NULL && strcEQ(var, "CLIENT_VERIFY")) { - result = ssl_var_lookup_ssl_cert_verify(p, c); - } - else if (ssl != NULL && strlen(var) > 7 && strcEQn(var, "CLIENT_", 7)) { - if ((xs = SSL_get_peer_certificate(ssl)) != NULL) - result = ssl_var_lookup_ssl_cert(p, xs, var+7); - } - else if (ssl != NULL && strlen(var) > 7 && strcEQn(var, "SERVER_", 7)) { - if ((xs = SSL_get_certificate(ssl)) != NULL) - result = ssl_var_lookup_ssl_cert(p, xs, var+7); - } - return result; -} - -static char *ssl_var_lookup_ssl_cert(pool *p, X509 *xs, char *var) -{ - char *result; - BOOL resdup; - X509_NAME *xsname; - int nid; - char *cp; - - result = NULL; - resdup = TRUE; - - if (strcEQ(var, "M_VERSION")) { - result = ap_psprintf(p, "%lu", X509_get_version(xs)+1); - resdup = FALSE; - } - else if (strcEQ(var, "M_SERIAL")) { - result = ssl_var_lookup_ssl_cert_serial(p, xs); - } - else if (strcEQ(var, "V_START")) { - result = ssl_var_lookup_ssl_cert_valid(p, X509_get_notBefore(xs)); - } - else if (strcEQ(var, "V_END")) { - result = ssl_var_lookup_ssl_cert_valid(p, X509_get_notAfter(xs)); - } - else if (strcEQ(var, "S_DN")) { - xsname = X509_get_subject_name(xs); - cp = X509_NAME_oneline(xsname, NULL, 0); - result = ap_pstrdup(p, cp); - free(cp); - resdup = FALSE; - } - else if (strlen(var) > 5 && strcEQn(var, "S_DN_", 5)) { - xsname = X509_get_subject_name(xs); - result = ssl_var_lookup_ssl_cert_dn(p, xsname, var+5); - resdup = FALSE; - } - else if (strcEQ(var, "I_DN")) { - xsname = X509_get_issuer_name(xs); - cp = X509_NAME_oneline(xsname, NULL, 0); - result = ap_pstrdup(p, cp); - free(cp); - resdup = FALSE; - } - else if (strlen(var) > 5 && strcEQn(var, "I_DN_", 5)) { - xsname = X509_get_issuer_name(xs); - result = ssl_var_lookup_ssl_cert_dn(p, xsname, var+5); - resdup = FALSE; - } - else if (strcEQ(var, "A_SIG")) { - nid = OBJ_obj2nid(xs->cert_info->signature->algorithm); - result = ap_pstrdup(p, (nid == NID_undef) ? "UNKNOWN" : OBJ_nid2ln(nid)); - resdup = FALSE; - } - else if (strcEQ(var, "A_KEY")) { - nid = OBJ_obj2nid(xs->cert_info->key->algor->algorithm); - result = ap_pstrdup(p, (nid == NID_undef) ? "UNKNOWN" : OBJ_nid2ln(nid)); - resdup = FALSE; - } - else if (strcEQ(var, "CERT")) { - result = ssl_var_lookup_ssl_cert_PEM(p, xs); - } - - if (result != NULL && resdup) - result = ap_pstrdup(p, result); - return result; -} - -static const struct { - char *name; - int nid; -} ssl_var_lookup_ssl_cert_dn_rec[] = { - { "C", NID_countryName }, - { "ST", NID_stateOrProvinceName }, /* officially (RFC2156) */ - { "SP", NID_stateOrProvinceName }, /* compatibility (SSLeay) */ - { "L", NID_localityName }, - { "O", NID_organizationName }, - { "OU", NID_organizationalUnitName }, - { "CN", NID_commonName }, - { "T", NID_title }, - { "I", NID_initials }, - { "G", NID_givenName }, - { "S", NID_surname }, - { "D", NID_description }, - { "UID", NID_uniqueIdentifier }, - { "Email", NID_pkcs9_emailAddress }, - { NULL, 0 } -}; - -static char *ssl_var_lookup_ssl_cert_dn(pool *p, X509_NAME *xsname, char *var) -{ - char *result; - X509_NAME_ENTRY *xsne; - int i, j, n; - - result = NULL; - - for (i = 0; ssl_var_lookup_ssl_cert_dn_rec[i].name != NULL; i++) { - if (strEQ(var, ssl_var_lookup_ssl_cert_dn_rec[i].name)) { - for (j = 0; j < sk_X509_NAME_ENTRY_num(xsname->entries); j++) { - xsne = sk_X509_NAME_ENTRY_value(xsname->entries, j); - n = OBJ_obj2nid(xsne->object); - if (n == ssl_var_lookup_ssl_cert_dn_rec[i].nid) { - result = ap_palloc(p, xsne->value->length+1); - ap_cpystrn(result, (char *)xsne->value->data, xsne->value->length+1); -#ifdef CHARSET_EBCDIC - ascii2ebcdic(result, result, xsne->value->length); -#endif /* CHARSET_EBCDIC */ - result[xsne->value->length] = NUL; - break; - } - } - break; - } - } - return result; -} - -static char *ssl_var_lookup_ssl_cert_valid(pool *p, ASN1_UTCTIME *tm) -{ - char *result; - BIO* bio; - int n; - - if ((bio = BIO_new(BIO_s_mem())) == NULL) - return NULL; - ASN1_UTCTIME_print(bio, tm); - n = BIO_pending(bio); - result = ap_pcalloc(p, n+1); - n = BIO_read(bio, result, n); - result[n] = NUL; - BIO_free(bio); - return result; -} - -static char *ssl_var_lookup_ssl_cert_serial(pool *p, X509 *xs) -{ - char *result; - BIO *bio; - int n; - - if ((bio = BIO_new(BIO_s_mem())) == NULL) - return NULL; - i2a_ASN1_INTEGER(bio, X509_get_serialNumber(xs)); - n = BIO_pending(bio); - result = ap_pcalloc(p, n+1); - n = BIO_read(bio, result, n); - result[n] = NUL; - BIO_free(bio); - return result; -} - -static char *ssl_var_lookup_ssl_cert_chain(pool *p, STACK_OF(X509) *sk, char *var) -{ - char *result; - X509 *xs; - int n; - - result = NULL; - - if (strspn(var, "0123456789") == strlen(var)) { - n = atoi(var); - if (n < sk_X509_num(sk)) { - xs = sk_X509_value(sk, n); - result = ssl_var_lookup_ssl_cert_PEM(p, xs); - } - } - - return result; -} - -static char *ssl_var_lookup_ssl_cert_PEM(pool *p, X509 *xs) -{ - char *result; - BIO *bio; - int n; - - if ((bio = BIO_new(BIO_s_mem())) == NULL) - return NULL; - PEM_write_bio_X509(bio, xs); - n = BIO_pending(bio); - result = ap_pcalloc(p, n+1); - n = BIO_read(bio, result, n); - result[n] = NUL; - BIO_free(bio); - return result; -} - -static char *ssl_var_lookup_ssl_cert_verify(pool *p, conn_rec *c) -{ - char *result; - long vrc; - char *verr; - char *vinfo; - SSL *ssl; - X509 *xs; - - result = NULL; - ssl = ap_ctx_get(c->client->ctx, "ssl"); - verr = ap_ctx_get(c->client->ctx, "ssl::verify::error"); - vinfo = ap_ctx_get(c->client->ctx, "ssl::verify::info"); - vrc = SSL_get_verify_result(ssl); - xs = SSL_get_peer_certificate(ssl); - - if (vrc == X509_V_OK && verr == NULL && vinfo == NULL && xs == NULL) - /* no client verification done at all */ - result = "NONE"; - else if (vrc == X509_V_OK && verr == NULL && vinfo == NULL && xs != NULL) - /* client verification done successful */ - result = "SUCCESS"; - else if (vrc == X509_V_OK && vinfo != NULL && strEQ(vinfo, "GENEROUS")) - /* client verification done in generous way */ - result = "GENEROUS"; - else - /* client verification failed */ - result = ap_psprintf(p, "FAILED:%s", verr); - return result; -} - -static char *ssl_var_lookup_ssl_cipher(pool *p, conn_rec *c, char *var) -{ - char *result; - BOOL resdup; - int usekeysize, algkeysize; - SSL *ssl; - - result = NULL; - resdup = TRUE; - - ssl = ap_ctx_get(c->client->ctx, "ssl"); - ssl_var_lookup_ssl_cipher_bits(ssl, &usekeysize, &algkeysize); - - if (strEQ(var, "")) - result = (ssl != NULL ? (char *)SSL_get_cipher_name(ssl) : NULL); - else if (strcEQ(var, "_EXPORT")) - result = (usekeysize < 56 ? "true" : "false"); - else if (strcEQ(var, "_USEKEYSIZE")) { - result = ap_psprintf(p, "%d", usekeysize); - resdup = FALSE; - } - else if (strcEQ(var, "_ALGKEYSIZE")) { - result = ap_psprintf(p, "%d", algkeysize); - resdup = FALSE; - } - - if (result != NULL && resdup) - result = ap_pstrdup(p, result); - return result; -} - -static void ssl_var_lookup_ssl_cipher_bits(SSL *ssl, int *usekeysize, int *algkeysize) -{ - SSL_CIPHER *cipher; - - *usekeysize = 0; - *algkeysize = 0; - if (ssl != NULL) - if ((cipher = SSL_get_current_cipher(ssl)) != NULL) - *usekeysize = SSL_CIPHER_get_bits(cipher, algkeysize); - return; -} - -static char *ssl_var_lookup_ssl_version(pool *p, char *var) -{ - char *result; - char *cp, *cp2; - - result = NULL; - - if (strEQ(var, "PRODUCT")) { -#if defined(SSL_PRODUCT_NAME) && defined(SSL_PRODUCT_VERSION) - result = ap_psprintf(p, "%s/%s", SSL_PRODUCT_NAME, SSL_PRODUCT_VERSION); -#else - result = NULL; -#endif - } - else if (strEQ(var, "INTERFACE")) { - result = ap_psprintf(p, "mod_ssl/%s", MOD_SSL_VERSION); - } - else if (strEQ(var, "LIBRARY")) { - result = ap_pstrdup(p, SSL_LIBRARY_TEXT); - if ((cp = strchr(result, ' ')) != NULL) { - *cp = '/'; - if ((cp2 = strchr(cp, ' ')) != NULL) - *cp2 = NUL; - } - } - return result; -} - diff --git a/modules/ssl/ssl_expr.c b/modules/ssl/ssl_expr.c deleted file mode 100644 index 49ab873dedc2798af7ddc8314f3039cacf9c1592..0000000000000000000000000000000000000000 --- a/modules/ssl/ssl_expr.c +++ /dev/null @@ -1,119 +0,0 @@ -/* _ _ -** _ __ ___ ___ __| | ___ ___| | mod_ssl -** | '_ ` _ \ / _ \ / _` | / __/ __| | Apache Interface to OpenSSL -** | | | | | | (_) | (_| | \__ \__ \ | www.modssl.org -** |_| |_| |_|\___/ \__,_|___|___/___/_| ftp.modssl.org -** |_____| -** ssl_expr.c -** Expression Handling -*/ - -/* ==================================================================== - * Copyright (c) 1998-2001 Ralf S. Engelschall. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following - * disclaimer in the documentation and/or other materials - * provided with the distribution. - * - * 3. All advertising materials mentioning features or use of this - * software must display the following acknowledgment: - * "This product includes software developed by - * Ralf S. Engelschall for use in the - * mod_ssl project (http://www.modssl.org/)." - * - * 4. The names "mod_ssl" must not be used to endorse or promote - * products derived from this software without prior written - * permission. For written permission, please contact - * rse@engelschall.com. - * - * 5. Products derived from this software may not be called "mod_ssl" - * nor may "mod_ssl" appear in their names without prior - * written permission of Ralf S. Engelschall. - * - * 6. Redistributions of any form whatsoever must retain the following - * acknowledgment: - * "This product includes software developed by - * Ralf S. Engelschall for use in the - * mod_ssl project (http://www.modssl.org/)." - * - * THIS SOFTWARE IS PROVIDED BY RALF S. ENGELSCHALL ``AS IS'' AND ANY - * EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR - * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL RALF S. ENGELSCHALL OR - * HIS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT - * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, - * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED - * OF THE POSSIBILITY OF SUCH DAMAGE. - * ==================================================================== - */ - /* ``It is hard to fly with - the eagles when you work - with the turkeys.'' - -- Unknown */ -#include "mod_ssl.h" - - -/* _________________________________________________________________ -** -** Expression Handling -** _________________________________________________________________ -*/ - -ssl_expr_info_type ssl_expr_info; -char *ssl_expr_error; - -ssl_expr *ssl_expr_comp(pool *p, char *expr) -{ - ssl_expr_info.pool = p; - ssl_expr_info.inputbuf = expr; - ssl_expr_info.inputlen = strlen(expr); - ssl_expr_info.inputptr = ssl_expr_info.inputbuf; - ssl_expr_info.expr = FALSE; - - ssl_expr_error = NULL; - if (ssl_expr_yyparse()) - return NULL; - return ssl_expr_info.expr; -} - -char *ssl_expr_get_error(void) -{ - if (ssl_expr_error == NULL) - return ""; - return ssl_expr_error; -} - -ssl_expr *ssl_expr_make(ssl_expr_node_op op, void *a1, void *a2) -{ - ssl_expr *node; - - node = (ssl_expr *)ap_palloc(ssl_expr_info.pool, sizeof(ssl_expr)); - node->node_op = op; - node->node_arg1 = (char *)a1; - node->node_arg2 = (char *)a2; - return node; -} - -int ssl_expr_exec(request_rec *r, ssl_expr *expr) -{ - BOOL rc; - - rc = ssl_expr_eval(r, expr); - if (ssl_expr_error != NULL) - return (-1); - else - return (rc ? 1 : 0); -} - diff --git a/modules/ssl/ssl_expr.h b/modules/ssl/ssl_expr.h deleted file mode 100644 index 419bb02192745cd616d924814a7d2b8e0aed0897..0000000000000000000000000000000000000000 --- a/modules/ssl/ssl_expr.h +++ /dev/null @@ -1,139 +0,0 @@ -/* _ _ -** _ __ ___ ___ __| | ___ ___| | mod_ssl -** | '_ ` _ \ / _ \ / _` | / __/ __| | Apache Interface to OpenSSL -** | | | | | | (_) | (_| | \__ \__ \ | www.modssl.org -** |_| |_| |_|\___/ \__,_|___|___/___/_| ftp.modssl.org -** |_____| -** ssl_expr.h -** Expression Handling (Header) -*/ - -/* ==================================================================== - * Copyright (c) 1998-2001 Ralf S. Engelschall. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following - * disclaimer in the documentation and/or other materials - * provided with the distribution. - * - * 3. All advertising materials mentioning features or use of this - * software must display the following acknowledgment: - * "This product includes software developed by - * Ralf S. Engelschall for use in the - * mod_ssl project (http://www.modssl.org/)." - * - * 4. The names "mod_ssl" must not be used to endorse or promote - * products derived from this software without prior written - * permission. For written permission, please contact - * rse@engelschall.com. - * - * 5. Products derived from this software may not be called "mod_ssl" - * nor may "mod_ssl" appear in their names without prior - * written permission of Ralf S. Engelschall. - * - * 6. Redistributions of any form whatsoever must retain the following - * acknowledgment: - * "This product includes software developed by - * Ralf S. Engelschall for use in the - * mod_ssl project (http://www.modssl.org/)." - * - * THIS SOFTWARE IS PROVIDED BY RALF S. ENGELSCHALL ``AS IS'' AND ANY - * EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR - * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL RALF S. ENGELSCHALL OR - * HIS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT - * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, - * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED - * OF THE POSSIBILITY OF SUCH DAMAGE. - * ==================================================================== - */ - - /* ``May all your PUSHes be POPed.'' */ - -#ifndef SSL_EXPR_H -#define SSL_EXPR_H - -#ifndef FALSE -#define FALSE 0 -#endif - -#ifndef TRUE -#define TRUE !FALSE -#endif - -#ifndef YY_NULL -#define YY_NULL 0 -#endif - -#ifndef MIN -#define MIN(a,b) (((a)<(b))?(a):(b)) -#endif - -#ifndef BOOL -#define BOOL unsigned int -#endif - -#ifndef NULL -#define NULL (void *)0 -#endif - -#ifndef NUL -#define NUL '\0' -#endif - -#ifndef YYDEBUG -#define YYDEBUG 0 -#endif - -typedef enum { - op_NOP, op_ListElement, - op_True, op_False, op_Not, op_Or, op_And, op_Comp, - op_EQ, op_NE, op_LT, op_LE, op_GT, op_GE, op_IN, op_REG, op_NRE, - op_Digit, op_String, op_Regex, op_Var, op_Func -} ssl_expr_node_op; - -typedef struct { - ssl_expr_node_op node_op; - void *node_arg1; - void *node_arg2; -} ssl_expr_node; - -typedef ssl_expr_node ssl_expr; - -typedef struct { - pool *pool; - char *inputbuf; - int inputlen; - char *inputptr; - ssl_expr *expr; -} ssl_expr_info_type; - -extern ssl_expr_info_type ssl_expr_info; -extern char *ssl_expr_error; - -#define yylval ssl_expr_yylval -#define yyerror ssl_expr_yyerror -#define yyinput ssl_expr_yyinput - -extern int ssl_expr_yyparse(void); -extern int ssl_expr_yyerror(char *); -extern int ssl_expr_yylex(void); - -extern ssl_expr *ssl_expr_comp(pool *, char *); -extern int ssl_expr_exec(request_rec *, ssl_expr *); -extern char *ssl_expr_get_error(void); -extern ssl_expr *ssl_expr_make(ssl_expr_node_op, void *, void *); -extern BOOL ssl_expr_eval(request_rec *, ssl_expr *); - -#endif /* SSL_EXPR_H */ diff --git a/modules/ssl/ssl_expr_eval.c b/modules/ssl/ssl_expr_eval.c deleted file mode 100644 index d8c5ea5f9e2799b9a4c09e305b48b4cc31844d3e..0000000000000000000000000000000000000000 --- a/modules/ssl/ssl_expr_eval.c +++ /dev/null @@ -1,282 +0,0 @@ -/* _ _ -** _ __ ___ ___ __| | ___ ___| | mod_ssl -** | '_ ` _ \ / _ \ / _` | / __/ __| | Apache Interface to OpenSSL -** | | | | | | (_) | (_| | \__ \__ \ | www.modssl.org -** |_| |_| |_|\___/ \__,_|___|___/___/_| ftp.modssl.org -** |_____| -** ssl_expr_eval.c -** Expression Evaluation -*/ - -/* ==================================================================== - * Copyright (c) 1998-2001 Ralf S. Engelschall. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following - * disclaimer in the documentation and/or other materials - * provided with the distribution. - * - * 3. All advertising materials mentioning features or use of this - * software must display the following acknowledgment: - * "This product includes software developed by - * Ralf S. Engelschall for use in the - * mod_ssl project (http://www.modssl.org/)." - * - * 4. The names "mod_ssl" must not be used to endorse or promote - * products derived from this software without prior written - * permission. For written permission, please contact - * rse@engelschall.com. - * - * 5. Products derived from this software may not be called "mod_ssl" - * nor may "mod_ssl" appear in their names without prior - * written permission of Ralf S. Engelschall. - * - * 6. Redistributions of any form whatsoever must retain the following - * acknowledgment: - * "This product includes software developed by - * Ralf S. Engelschall for use in the - * mod_ssl project (http://www.modssl.org/)." - * - * THIS SOFTWARE IS PROVIDED BY RALF S. ENGELSCHALL ``AS IS'' AND ANY - * EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR - * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL RALF S. ENGELSCHALL OR - * HIS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT - * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, - * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED - * OF THE POSSIBILITY OF SUCH DAMAGE. - * ==================================================================== - */ - /* ``Make love, - not software!'' - -- Unknown */ -#include "mod_ssl.h" - - -/* _________________________________________________________________ -** -** Expression Evaluation -** _________________________________________________________________ -*/ - -static BOOL ssl_expr_eval_comp(request_rec *, ssl_expr *); -static char *ssl_expr_eval_word(request_rec *, ssl_expr *); -static char *ssl_expr_eval_func_file(request_rec *, char *); -static int ssl_expr_eval_strcmplex(char *, char *); - -BOOL ssl_expr_eval(request_rec *r, ssl_expr *node) -{ - switch (node->node_op) { - case op_True: { - return TRUE; - } - case op_False: { - return FALSE; - } - case op_Not: { - ssl_expr *e = (ssl_expr *)node->node_arg1; - return (!ssl_expr_eval(r, e)); - } - case op_Or: { - ssl_expr *e1 = (ssl_expr *)node->node_arg1; - ssl_expr *e2 = (ssl_expr *)node->node_arg2; - return (ssl_expr_eval(r, e1) || ssl_expr_eval(r, e2)); - } - case op_And: { - ssl_expr *e1 = (ssl_expr *)node->node_arg1; - ssl_expr *e2 = (ssl_expr *)node->node_arg2; - return (ssl_expr_eval(r, e1) && ssl_expr_eval(r, e2)); - } - case op_Comp: { - ssl_expr *e = (ssl_expr *)node->node_arg1; - return ssl_expr_eval_comp(r, e); - } - default: { - ssl_expr_error = "Internal evaluation error: Unknown expression node"; - return FALSE; - } - } -} - -static BOOL ssl_expr_eval_comp(request_rec *r, ssl_expr *node) -{ - switch (node->node_op) { - case op_EQ: { - ssl_expr *e1 = (ssl_expr *)node->node_arg1; - ssl_expr *e2 = (ssl_expr *)node->node_arg2; - return (strcmp(ssl_expr_eval_word(r, e1), ssl_expr_eval_word(r, e2)) == 0); - } - case op_NE: { - ssl_expr *e1 = (ssl_expr *)node->node_arg1; - ssl_expr *e2 = (ssl_expr *)node->node_arg2; - return (strcmp(ssl_expr_eval_word(r, e1), ssl_expr_eval_word(r, e2)) != 0); - } - case op_LT: { - ssl_expr *e1 = (ssl_expr *)node->node_arg1; - ssl_expr *e2 = (ssl_expr *)node->node_arg2; - return (ssl_expr_eval_strcmplex(ssl_expr_eval_word(r, e1), ssl_expr_eval_word(r, e2)) < 0); - } - case op_LE: { - ssl_expr *e1 = (ssl_expr *)node->node_arg1; - ssl_expr *e2 = (ssl_expr *)node->node_arg2; - return (ssl_expr_eval_strcmplex(ssl_expr_eval_word(r, e1), ssl_expr_eval_word(r, e2)) <= 0); - } - case op_GT: { - ssl_expr *e1 = (ssl_expr *)node->node_arg1; - ssl_expr *e2 = (ssl_expr *)node->node_arg2; - return (ssl_expr_eval_strcmplex(ssl_expr_eval_word(r, e1), ssl_expr_eval_word(r, e2)) > 0); - } - case op_GE: { - ssl_expr *e1 = (ssl_expr *)node->node_arg1; - ssl_expr *e2 = (ssl_expr *)node->node_arg2; - return (ssl_expr_eval_strcmplex(ssl_expr_eval_word(r, e1), ssl_expr_eval_word(r, e2)) >= 0); - } - case op_IN: { - ssl_expr *e1 = (ssl_expr *)node->node_arg1; - ssl_expr *e2 = (ssl_expr *)node->node_arg2; - ssl_expr *e3; - char *w1 = ssl_expr_eval_word(r, e1); - BOOL found = FALSE; - do { - e3 = (ssl_expr *)e2->node_arg1; - e2 = (ssl_expr *)e2->node_arg2; - if (strcmp(w1, ssl_expr_eval_word(r, e3)) == 0) { - found = TRUE; - break; - } - } while (e2 != NULL); - return found; - } - case op_REG: { - ssl_expr *e1; - ssl_expr *e2; - char *word; - regex_t *regex; - - e1 = (ssl_expr *)node->node_arg1; - e2 = (ssl_expr *)node->node_arg2; - word = ssl_expr_eval_word(r, e1); - regex = (regex_t *)(e2->node_arg1); - return (regexec(regex, word, 0, NULL, 0) == 0); - } - case op_NRE: { - ssl_expr *e1; - ssl_expr *e2; - char *word; - regex_t *regex; - - e1 = (ssl_expr *)node->node_arg1; - e2 = (ssl_expr *)node->node_arg2; - word = ssl_expr_eval_word(r, e1); - regex = (regex_t *)(e2->node_arg1); - return !(regexec(regex, word, 0, NULL, 0) == 0); - } - default: { - ssl_expr_error = "Internal evaluation error: Unknown expression node"; - return FALSE; - } - } -} - -static char *ssl_expr_eval_word(request_rec *r, ssl_expr *node) -{ - switch (node->node_op) { - case op_Digit: { - char *string = (char *)node->node_arg1; - return string; - } - case op_String: { - char *string = (char *)node->node_arg1; - return string; - } - case op_Var: { - char *var = (char *)node->node_arg1; - char *val = ssl_var_lookup(r->pool, r->server, r->connection, r, var); - return (val == NULL ? "" : val); - } - case op_Func: { - char *name = (char *)node->node_arg1; - ssl_expr *args = (ssl_expr *)node->node_arg2; - if (strEQ(name, "file")) - return ssl_expr_eval_func_file(r, (char *)(args->node_arg1)); - else { - ssl_expr_error = "Internal evaluation error: Unknown function name"; - return ""; - } - } - default: { - ssl_expr_error = "Internal evaluation error: Unknown expression node"; - return FALSE; - } - } -} - -static char *ssl_expr_eval_func_file(request_rec *r, char *filename) -{ - FILE *fp; - char *buf; - int len; - - if ((fp = ap_pfopen(r->pool, filename, "r")) == NULL) { - ssl_expr_error = "Cannot open file"; - return ""; - } - fseek(fp, 0, SEEK_END); - len = ftell(fp); - if (len == 0) { - buf = (char *)ap_palloc(r->pool, sizeof(char) * 1); - *buf = NUL; - } - else { - if ((buf = (char *)ap_palloc(r->pool, sizeof(char) * len+1)) == NULL) { - ssl_expr_error = "Cannot allocate memory"; - ap_pfclose(r->pool, fp); - return ""; - } - fseek(fp, 0, SEEK_SET); - if (fread(buf, len, 1, fp) == 0) { - ssl_expr_error = "Cannot read from file"; - fclose(fp); - return (""); - } - buf[len] = NUL; - } - ap_pfclose(r->pool, fp); - return buf; -} - -/* a variant of strcmp(3) which works correctly also for number strings */ -static int ssl_expr_eval_strcmplex(char *cpNum1, char *cpNum2) -{ - int i, n1, n2; - - if (cpNum1 == NULL) - return -1; - if (cpNum2 == NULL) - return +1; - n1 = strlen(cpNum1); - n2 = strlen(cpNum2); - if (n1 > n2) - return 1; - if (n1 < n2) - return -1; - for (i = 0; i < n1; i++) { - if (cpNum1[i] > cpNum2[i]) - return 1; - if (cpNum1[i] < cpNum2[i]) - return -1; - } - return 0; -} - diff --git a/modules/ssl/ssl_expr_parse.c b/modules/ssl/ssl_expr_parse.c deleted file mode 100644 index 8e35553a4eac9eee79f633942fe5f35fa786c1dc..0000000000000000000000000000000000000000 --- a/modules/ssl/ssl_expr_parse.c +++ /dev/null @@ -1,605 +0,0 @@ -#ifndef lint -static char const -ssl_expr_yyrcsid[] = "$FreeBSD: src/usr.bin/yacc/skeleton.c,v 1.28 2000/01/17 02:04:06 bde Exp $"; -#endif -#include -#define YYBYACC 1 -#define YYMAJOR 1 -#define YYMINOR 9 -#define YYLEX ssl_expr_yylex() -#define YYEMPTY -1 -#define ssl_expr_yyclearin (ssl_expr_yychar=(YYEMPTY)) -#define ssl_expr_yyerrok (ssl_expr_yyerrflag=0) -#define YYRECOVERING() (ssl_expr_yyerrflag!=0) -static int ssl_expr_yygrowstack(); -#define YYPREFIX "ssl_expr_yy" -#line 72 "ssl_expr_parse.y" -#include "mod_ssl.h" -#line 75 "ssl_expr_parse.y" -typedef union { - char *cpVal; - ssl_expr *exVal; -} YYSTYPE; -#line 24 "y.tab.c" -#define YYERRCODE 256 -#define T_TRUE 257 -#define T_FALSE 258 -#define T_DIGIT 259 -#define T_ID 260 -#define T_STRING 261 -#define T_REGEX 262 -#define T_REGEX_I 263 -#define T_FUNC_FILE 264 -#define T_OP_EQ 265 -#define T_OP_NE 266 -#define T_OP_LT 267 -#define T_OP_LE 268 -#define T_OP_GT 269 -#define T_OP_GE 270 -#define T_OP_REG 271 -#define T_OP_NRE 272 -#define T_OP_IN 273 -#define T_OP_OR 274 -#define T_OP_AND 275 -#define T_OP_NOT 276 -const short ssl_expr_yylhs[] = { -1, - 0, 1, 1, 1, 1, 1, 1, 1, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 5, 5, 6, - 6, 6, 6, 4, 4, 3, -}; -const short ssl_expr_yylen[] = { 2, - 1, 1, 1, 2, 3, 3, 1, 3, 3, 3, - 3, 3, 3, 3, 5, 3, 3, 1, 3, 1, - 1, 4, 1, 1, 1, 4, -}; -const short ssl_expr_yydefred[] = { 0, - 2, 3, 20, 21, 0, 0, 0, 0, 0, 0, - 7, 23, 0, 0, 4, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 8, - 0, 0, 6, 9, 10, 11, 12, 13, 14, 24, - 25, 16, 17, 0, 26, 22, 0, 18, 15, 0, - 19, -}; -const short ssl_expr_yydgoto[] = { 9, - 10, 11, 12, 42, 47, 13, -}; -const short ssl_expr_yysindex[] = { -37, - 0, 0, 0, 0, -35, -37, -37, -99, 0, -247, - 0, 0, -250, -229, 0, -39, -227, -37, -37, -33, - -33, -33, -33, -33, -33, -233, -233, -89, -6, 0, - -87, -239, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, -33, 0, 0, -38, 0, 0, -33, - 0, -}; -const short ssl_expr_yyrindex[] = { 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 39, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, -}; -const short ssl_expr_yygindex[] = { 0, - 7, 0, 0, 13, 0, -13, -}; -#define YYTABLESIZE 275 -const short ssl_expr_yytable[] = { 8, - 5, 30, 7, 8, 14, 50, 34, 35, 36, 37, - 38, 39, 15, 16, 20, 21, 22, 23, 24, 25, - 26, 27, 28, 17, 32, 33, 18, 19, 40, 41, - 48, 29, 31, 44, 45, 19, 51, 46, 1, 43, - 0, 5, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 49, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, - 2, 3, 0, 4, 0, 3, 5, 4, 0, 0, - 5, 0, 0, 0, 18, 19, 0, 0, 6, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 5, -}; -const short ssl_expr_yycheck[] = { 37, - 0, 41, 40, 37, 40, 44, 20, 21, 22, 23, - 24, 25, 6, 7, 265, 266, 267, 268, 269, 270, - 271, 272, 273, 123, 18, 19, 274, 275, 262, 263, - 44, 261, 260, 123, 41, 275, 50, 125, 0, 27, - -1, 41, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, 125, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, 257, - 258, 259, -1, 261, -1, 259, 264, 261, -1, -1, - 264, -1, -1, -1, 274, 275, -1, -1, 276, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, 274, -}; -#define YYFINAL 9 -#ifndef YYDEBUG -#define YYDEBUG 0 -#endif -#define YYMAXTOKEN 276 -#if YYDEBUG -const char * const ssl_expr_yyname[] = { -"end-of-file",0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -0,0,0,"'%'",0,0,"'('","')'",0,0,"','",0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,"'{'",0,"'}'",0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,"T_TRUE", -"T_FALSE","T_DIGIT","T_ID","T_STRING","T_REGEX","T_REGEX_I","T_FUNC_FILE", -"T_OP_EQ","T_OP_NE","T_OP_LT","T_OP_LE","T_OP_GT","T_OP_GE","T_OP_REG", -"T_OP_NRE","T_OP_IN","T_OP_OR","T_OP_AND","T_OP_NOT", -}; -const char * const ssl_expr_yyrule[] = { -"$accept : root", -"root : expr", -"expr : T_TRUE", -"expr : T_FALSE", -"expr : T_OP_NOT expr", -"expr : expr T_OP_OR expr", -"expr : expr T_OP_AND expr", -"expr : comparison", -"expr : '(' expr ')'", -"comparison : word T_OP_EQ word", -"comparison : word T_OP_NE word", -"comparison : word T_OP_LT word", -"comparison : word T_OP_LE word", -"comparison : word T_OP_GT word", -"comparison : word T_OP_GE word", -"comparison : word T_OP_IN '{' words '}'", -"comparison : word T_OP_REG regex", -"comparison : word T_OP_NRE regex", -"words : word", -"words : words ',' word", -"word : T_DIGIT", -"word : T_STRING", -"word : '%' '{' T_ID '}'", -"word : funccall", -"regex : T_REGEX", -"regex : T_REGEX_I", -"funccall : T_FUNC_FILE '(' T_STRING ')'", -}; -#endif -#if YYDEBUG -#include -#endif -#ifdef YYSTACKSIZE -#undef YYMAXDEPTH -#define YYMAXDEPTH YYSTACKSIZE -#else -#ifdef YYMAXDEPTH -#define YYSTACKSIZE YYMAXDEPTH -#else -#define YYSTACKSIZE 10000 -#define YYMAXDEPTH 10000 -#endif -#endif -#define YYINITSTACKSIZE 200 -int ssl_expr_yydebug; -int ssl_expr_yynerrs; -int ssl_expr_yyerrflag; -int ssl_expr_yychar; -short *ssl_expr_yyssp; -YYSTYPE *ssl_expr_yyvsp; -YYSTYPE ssl_expr_yyval; -YYSTYPE ssl_expr_yylval; -short *ssl_expr_yyss; -short *ssl_expr_yysslim; -YYSTYPE *ssl_expr_yyvs; -int ssl_expr_yystacksize; -#line 180 "ssl_expr_parse.y" - -int ssl_expr_yyerror(char *s) -{ - ssl_expr_error = s; - return 2; -} - -#line 230 "y.tab.c" -/* allocate initial stack or double stack size, up to YYMAXDEPTH */ -static int ssl_expr_yygrowstack() -{ - int newsize, i; - short *newss; - YYSTYPE *newvs; - - if ((newsize = ssl_expr_yystacksize) == 0) - newsize = YYINITSTACKSIZE; - else if (newsize >= YYMAXDEPTH) - return -1; - else if ((newsize *= 2) > YYMAXDEPTH) - newsize = YYMAXDEPTH; - i = ssl_expr_yyssp - ssl_expr_yyss; - newss = ssl_expr_yyss ? (short *)realloc(ssl_expr_yyss, newsize * sizeof *newss) : - (short *)malloc(newsize * sizeof *newss); - if (newss == NULL) - return -1; - ssl_expr_yyss = newss; - ssl_expr_yyssp = newss + i; - newvs = ssl_expr_yyvs ? (YYSTYPE *)realloc(ssl_expr_yyvs, newsize * sizeof *newvs) : - (YYSTYPE *)malloc(newsize * sizeof *newvs); - if (newvs == NULL) - return -1; - ssl_expr_yyvs = newvs; - ssl_expr_yyvsp = newvs + i; - ssl_expr_yystacksize = newsize; - ssl_expr_yysslim = ssl_expr_yyss + newsize - 1; - return 0; -} - -#define YYABORT goto ssl_expr_yyabort -#define YYREJECT goto ssl_expr_yyabort -#define YYACCEPT goto ssl_expr_yyaccept -#define YYERROR goto ssl_expr_yyerrlab - -#ifndef YYPARSE_PARAM -#if defined(__cplusplus) || __STDC__ -#define YYPARSE_PARAM_ARG void -#define YYPARSE_PARAM_DECL -#else /* ! ANSI-C/C++ */ -#define YYPARSE_PARAM_ARG -#define YYPARSE_PARAM_DECL -#endif /* ANSI-C/C++ */ -#else /* YYPARSE_PARAM */ -#ifndef YYPARSE_PARAM_TYPE -#define YYPARSE_PARAM_TYPE void * -#endif -#if defined(__cplusplus) || __STDC__ -#define YYPARSE_PARAM_ARG YYPARSE_PARAM_TYPE YYPARSE_PARAM -#define YYPARSE_PARAM_DECL -#else /* ! ANSI-C/C++ */ -#define YYPARSE_PARAM_ARG YYPARSE_PARAM -#define YYPARSE_PARAM_DECL YYPARSE_PARAM_TYPE YYPARSE_PARAM; -#endif /* ANSI-C/C++ */ -#endif /* ! YYPARSE_PARAM */ - -int -ssl_expr_yyparse (YYPARSE_PARAM_ARG) - YYPARSE_PARAM_DECL -{ - register int ssl_expr_yym, ssl_expr_yyn, ssl_expr_yystate; -#if YYDEBUG - register const char *ssl_expr_yys; - - if ((ssl_expr_yys = getenv("YYDEBUG"))) - { - ssl_expr_yyn = *ssl_expr_yys; - if (ssl_expr_yyn >= '0' && ssl_expr_yyn <= '9') - ssl_expr_yydebug = ssl_expr_yyn - '0'; - } -#endif - - ssl_expr_yynerrs = 0; - ssl_expr_yyerrflag = 0; - ssl_expr_yychar = (-1); - - if (ssl_expr_yyss == NULL && ssl_expr_yygrowstack()) goto ssl_expr_yyoverflow; - ssl_expr_yyssp = ssl_expr_yyss; - ssl_expr_yyvsp = ssl_expr_yyvs; - *ssl_expr_yyssp = ssl_expr_yystate = 0; - -ssl_expr_yyloop: - if ((ssl_expr_yyn = ssl_expr_yydefred[ssl_expr_yystate])) goto ssl_expr_yyreduce; - if (ssl_expr_yychar < 0) - { - if ((ssl_expr_yychar = ssl_expr_yylex()) < 0) ssl_expr_yychar = 0; -#if YYDEBUG - if (ssl_expr_yydebug) - { - ssl_expr_yys = 0; - if (ssl_expr_yychar <= YYMAXTOKEN) ssl_expr_yys = ssl_expr_yyname[ssl_expr_yychar]; - if (!ssl_expr_yys) ssl_expr_yys = "illegal-symbol"; - printf("%sdebug: state %d, reading %d (%s)\n", - YYPREFIX, ssl_expr_yystate, ssl_expr_yychar, ssl_expr_yys); - } -#endif - } - if ((ssl_expr_yyn = ssl_expr_yysindex[ssl_expr_yystate]) && (ssl_expr_yyn += ssl_expr_yychar) >= 0 && - ssl_expr_yyn <= YYTABLESIZE && ssl_expr_yycheck[ssl_expr_yyn] == ssl_expr_yychar) - { -#if YYDEBUG - if (ssl_expr_yydebug) - printf("%sdebug: state %d, shifting to state %d\n", - YYPREFIX, ssl_expr_yystate, ssl_expr_yytable[ssl_expr_yyn]); -#endif - if (ssl_expr_yyssp >= ssl_expr_yysslim && ssl_expr_yygrowstack()) - { - goto ssl_expr_yyoverflow; - } - *++ssl_expr_yyssp = ssl_expr_yystate = ssl_expr_yytable[ssl_expr_yyn]; - *++ssl_expr_yyvsp = ssl_expr_yylval; - ssl_expr_yychar = (-1); - if (ssl_expr_yyerrflag > 0) --ssl_expr_yyerrflag; - goto ssl_expr_yyloop; - } - if ((ssl_expr_yyn = ssl_expr_yyrindex[ssl_expr_yystate]) && (ssl_expr_yyn += ssl_expr_yychar) >= 0 && - ssl_expr_yyn <= YYTABLESIZE && ssl_expr_yycheck[ssl_expr_yyn] == ssl_expr_yychar) - { - ssl_expr_yyn = ssl_expr_yytable[ssl_expr_yyn]; - goto ssl_expr_yyreduce; - } - if (ssl_expr_yyerrflag) goto ssl_expr_yyinrecovery; -#if defined(lint) || defined(__GNUC__) - goto ssl_expr_yynewerror; -#endif -ssl_expr_yynewerror: - ssl_expr_yyerror("syntax error"); -#if defined(lint) || defined(__GNUC__) - goto ssl_expr_yyerrlab; -#endif -ssl_expr_yyerrlab: - ++ssl_expr_yynerrs; -ssl_expr_yyinrecovery: - if (ssl_expr_yyerrflag < 3) - { - ssl_expr_yyerrflag = 3; - for (;;) - { - if ((ssl_expr_yyn = ssl_expr_yysindex[*ssl_expr_yyssp]) && (ssl_expr_yyn += YYERRCODE) >= 0 && - ssl_expr_yyn <= YYTABLESIZE && ssl_expr_yycheck[ssl_expr_yyn] == YYERRCODE) - { -#if YYDEBUG - if (ssl_expr_yydebug) - printf("%sdebug: state %d, error recovery shifting\ - to state %d\n", YYPREFIX, *ssl_expr_yyssp, ssl_expr_yytable[ssl_expr_yyn]); -#endif - if (ssl_expr_yyssp >= ssl_expr_yysslim && ssl_expr_yygrowstack()) - { - goto ssl_expr_yyoverflow; - } - *++ssl_expr_yyssp = ssl_expr_yystate = ssl_expr_yytable[ssl_expr_yyn]; - *++ssl_expr_yyvsp = ssl_expr_yylval; - goto ssl_expr_yyloop; - } - else - { -#if YYDEBUG - if (ssl_expr_yydebug) - printf("%sdebug: error recovery discarding state %d\n", - YYPREFIX, *ssl_expr_yyssp); -#endif - if (ssl_expr_yyssp <= ssl_expr_yyss) goto ssl_expr_yyabort; - --ssl_expr_yyssp; - --ssl_expr_yyvsp; - } - } - } - else - { - if (ssl_expr_yychar == 0) goto ssl_expr_yyabort; -#if YYDEBUG - if (ssl_expr_yydebug) - { - ssl_expr_yys = 0; - if (ssl_expr_yychar <= YYMAXTOKEN) ssl_expr_yys = ssl_expr_yyname[ssl_expr_yychar]; - if (!ssl_expr_yys) ssl_expr_yys = "illegal-symbol"; - printf("%sdebug: state %d, error recovery discards token %d (%s)\n", - YYPREFIX, ssl_expr_yystate, ssl_expr_yychar, ssl_expr_yys); - } -#endif - ssl_expr_yychar = (-1); - goto ssl_expr_yyloop; - } -ssl_expr_yyreduce: -#if YYDEBUG - if (ssl_expr_yydebug) - printf("%sdebug: state %d, reducing by rule %d (%s)\n", - YYPREFIX, ssl_expr_yystate, ssl_expr_yyn, ssl_expr_yyrule[ssl_expr_yyn]); -#endif - ssl_expr_yym = ssl_expr_yylen[ssl_expr_yyn]; - ssl_expr_yyval = ssl_expr_yyvsp[1-ssl_expr_yym]; - switch (ssl_expr_yyn) - { -case 1: -#line 118 "ssl_expr_parse.y" -{ ssl_expr_info.expr = ssl_expr_yyvsp[0].exVal; } -break; -case 2: -#line 121 "ssl_expr_parse.y" -{ ssl_expr_yyval.exVal = ssl_expr_make(op_True, NULL, NULL); } -break; -case 3: -#line 122 "ssl_expr_parse.y" -{ ssl_expr_yyval.exVal = ssl_expr_make(op_False, NULL, NULL); } -break; -case 4: -#line 123 "ssl_expr_parse.y" -{ ssl_expr_yyval.exVal = ssl_expr_make(op_Not, ssl_expr_yyvsp[0].exVal, NULL); } -break; -case 5: -#line 124 "ssl_expr_parse.y" -{ ssl_expr_yyval.exVal = ssl_expr_make(op_Or, ssl_expr_yyvsp[-2].exVal, ssl_expr_yyvsp[0].exVal); } -break; -case 6: -#line 125 "ssl_expr_parse.y" -{ ssl_expr_yyval.exVal = ssl_expr_make(op_And, ssl_expr_yyvsp[-2].exVal, ssl_expr_yyvsp[0].exVal); } -break; -case 7: -#line 126 "ssl_expr_parse.y" -{ ssl_expr_yyval.exVal = ssl_expr_make(op_Comp, ssl_expr_yyvsp[0].exVal, NULL); } -break; -case 8: -#line 127 "ssl_expr_parse.y" -{ ssl_expr_yyval.exVal = ssl_expr_yyvsp[-1].exVal; } -break; -case 9: -#line 130 "ssl_expr_parse.y" -{ ssl_expr_yyval.exVal = ssl_expr_make(op_EQ, ssl_expr_yyvsp[-2].exVal, ssl_expr_yyvsp[0].exVal); } -break; -case 10: -#line 131 "ssl_expr_parse.y" -{ ssl_expr_yyval.exVal = ssl_expr_make(op_NE, ssl_expr_yyvsp[-2].exVal, ssl_expr_yyvsp[0].exVal); } -break; -case 11: -#line 132 "ssl_expr_parse.y" -{ ssl_expr_yyval.exVal = ssl_expr_make(op_LT, ssl_expr_yyvsp[-2].exVal, ssl_expr_yyvsp[0].exVal); } -break; -case 12: -#line 133 "ssl_expr_parse.y" -{ ssl_expr_yyval.exVal = ssl_expr_make(op_LE, ssl_expr_yyvsp[-2].exVal, ssl_expr_yyvsp[0].exVal); } -break; -case 13: -#line 134 "ssl_expr_parse.y" -{ ssl_expr_yyval.exVal = ssl_expr_make(op_GT, ssl_expr_yyvsp[-2].exVal, ssl_expr_yyvsp[0].exVal); } -break; -case 14: -#line 135 "ssl_expr_parse.y" -{ ssl_expr_yyval.exVal = ssl_expr_make(op_GE, ssl_expr_yyvsp[-2].exVal, ssl_expr_yyvsp[0].exVal); } -break; -case 15: -#line 136 "ssl_expr_parse.y" -{ ssl_expr_yyval.exVal = ssl_expr_make(op_IN, ssl_expr_yyvsp[-4].exVal, ssl_expr_yyvsp[-1].exVal); } -break; -case 16: -#line 137 "ssl_expr_parse.y" -{ ssl_expr_yyval.exVal = ssl_expr_make(op_REG, ssl_expr_yyvsp[-2].exVal, ssl_expr_yyvsp[0].exVal); } -break; -case 17: -#line 138 "ssl_expr_parse.y" -{ ssl_expr_yyval.exVal = ssl_expr_make(op_NRE, ssl_expr_yyvsp[-2].exVal, ssl_expr_yyvsp[0].exVal); } -break; -case 18: -#line 141 "ssl_expr_parse.y" -{ ssl_expr_yyval.exVal = ssl_expr_make(op_ListElement, ssl_expr_yyvsp[0].exVal, NULL); } -break; -case 19: -#line 142 "ssl_expr_parse.y" -{ ssl_expr_yyval.exVal = ssl_expr_make(op_ListElement, ssl_expr_yyvsp[0].exVal, ssl_expr_yyvsp[-2].exVal); } -break; -case 20: -#line 145 "ssl_expr_parse.y" -{ ssl_expr_yyval.exVal = ssl_expr_make(op_Digit, ssl_expr_yyvsp[0].cpVal, NULL); } -break; -case 21: -#line 146 "ssl_expr_parse.y" -{ ssl_expr_yyval.exVal = ssl_expr_make(op_String, ssl_expr_yyvsp[0].cpVal, NULL); } -break; -case 22: -#line 147 "ssl_expr_parse.y" -{ ssl_expr_yyval.exVal = ssl_expr_make(op_Var, ssl_expr_yyvsp[-1].cpVal, NULL); } -break; -case 23: -#line 148 "ssl_expr_parse.y" -{ ssl_expr_yyval.exVal = ssl_expr_yyvsp[0].exVal; } -break; -case 24: -#line 151 "ssl_expr_parse.y" -{ - regex_t *regex; - if ((regex = ap_pregcomp(ssl_expr_info.pool, ssl_expr_yyvsp[0].cpVal, - REG_EXTENDED|REG_NOSUB)) == NULL) { - ssl_expr_error = "Failed to compile regular expression"; - YYERROR; - regex = NULL; - } - ssl_expr_yyval.exVal = ssl_expr_make(op_Regex, regex, NULL); - } -break; -case 25: -#line 161 "ssl_expr_parse.y" -{ - regex_t *regex; - if ((regex = ap_pregcomp(ssl_expr_info.pool, ssl_expr_yyvsp[0].cpVal, - REG_EXTENDED|REG_NOSUB|REG_ICASE)) == NULL) { - ssl_expr_error = "Failed to compile regular expression"; - YYERROR; - regex = NULL; - } - ssl_expr_yyval.exVal = ssl_expr_make(op_Regex, regex, NULL); - } -break; -case 26: -#line 173 "ssl_expr_parse.y" -{ - ssl_expr *args = ssl_expr_make(op_ListElement, ssl_expr_yyvsp[-1].cpVal, NULL); - ssl_expr_yyval.exVal = ssl_expr_make(op_Func, "file", args); - } -break; -#line 550 "y.tab.c" - } - ssl_expr_yyssp -= ssl_expr_yym; - ssl_expr_yystate = *ssl_expr_yyssp; - ssl_expr_yyvsp -= ssl_expr_yym; - ssl_expr_yym = ssl_expr_yylhs[ssl_expr_yyn]; - if (ssl_expr_yystate == 0 && ssl_expr_yym == 0) - { -#if YYDEBUG - if (ssl_expr_yydebug) - printf("%sdebug: after reduction, shifting from state 0 to\ - state %d\n", YYPREFIX, YYFINAL); -#endif - ssl_expr_yystate = YYFINAL; - *++ssl_expr_yyssp = YYFINAL; - *++ssl_expr_yyvsp = ssl_expr_yyval; - if (ssl_expr_yychar < 0) - { - if ((ssl_expr_yychar = ssl_expr_yylex()) < 0) ssl_expr_yychar = 0; -#if YYDEBUG - if (ssl_expr_yydebug) - { - ssl_expr_yys = 0; - if (ssl_expr_yychar <= YYMAXTOKEN) ssl_expr_yys = ssl_expr_yyname[ssl_expr_yychar]; - if (!ssl_expr_yys) ssl_expr_yys = "illegal-symbol"; - printf("%sdebug: state %d, reading %d (%s)\n", - YYPREFIX, YYFINAL, ssl_expr_yychar, ssl_expr_yys); - } -#endif - } - if (ssl_expr_yychar == 0) goto ssl_expr_yyaccept; - goto ssl_expr_yyloop; - } - if ((ssl_expr_yyn = ssl_expr_yygindex[ssl_expr_yym]) && (ssl_expr_yyn += ssl_expr_yystate) >= 0 && - ssl_expr_yyn <= YYTABLESIZE && ssl_expr_yycheck[ssl_expr_yyn] == ssl_expr_yystate) - ssl_expr_yystate = ssl_expr_yytable[ssl_expr_yyn]; - else - ssl_expr_yystate = ssl_expr_yydgoto[ssl_expr_yym]; -#if YYDEBUG - if (ssl_expr_yydebug) - printf("%sdebug: after reduction, shifting from state %d \ -to state %d\n", YYPREFIX, *ssl_expr_yyssp, ssl_expr_yystate); -#endif - if (ssl_expr_yyssp >= ssl_expr_yysslim && ssl_expr_yygrowstack()) - { - goto ssl_expr_yyoverflow; - } - *++ssl_expr_yyssp = ssl_expr_yystate; - *++ssl_expr_yyvsp = ssl_expr_yyval; - goto ssl_expr_yyloop; -ssl_expr_yyoverflow: - ssl_expr_yyerror("yacc stack overflow"); -ssl_expr_yyabort: - return (1); -ssl_expr_yyaccept: - return (0); -} diff --git a/modules/ssl/ssl_expr_parse.h b/modules/ssl/ssl_expr_parse.h deleted file mode 100644 index 618cacbe3bf45b318e4ef3f0c766722767195cce..0000000000000000000000000000000000000000 --- a/modules/ssl/ssl_expr_parse.h +++ /dev/null @@ -1,29 +0,0 @@ -#ifndef YYERRCODE -#define YYERRCODE 256 -#endif - -#define T_TRUE 257 -#define T_FALSE 258 -#define T_DIGIT 259 -#define T_ID 260 -#define T_STRING 261 -#define T_REGEX 262 -#define T_REGEX_I 263 -#define T_FUNC_FILE 264 -#define T_OP_EQ 265 -#define T_OP_NE 266 -#define T_OP_LT 267 -#define T_OP_LE 268 -#define T_OP_GT 269 -#define T_OP_GE 270 -#define T_OP_REG 271 -#define T_OP_NRE 272 -#define T_OP_IN 273 -#define T_OP_OR 274 -#define T_OP_AND 275 -#define T_OP_NOT 276 -typedef union { - char *cpVal; - ssl_expr *exVal; -} YYSTYPE; -extern YYSTYPE ssl_expr_yylval; diff --git a/modules/ssl/ssl_expr_parse.y b/modules/ssl/ssl_expr_parse.y deleted file mode 100644 index 1e3ad6e51377ecfa86aba444665560a95a6b5a88..0000000000000000000000000000000000000000 --- a/modules/ssl/ssl_expr_parse.y +++ /dev/null @@ -1,186 +0,0 @@ -/* _ _ -** _ __ ___ ___ __| | ___ ___| | -** | '_ ` _ \ / _ \ / _` | / __/ __| | -** | | | | | | (_) | (_| | \__ \__ \ | mod_ssl - Apache Interface to OpenSSL -** |_| |_| |_|\___/ \__,_|___|___/___/_| http://www.modssl.org/ -** |_____| -** ssl_expr_parse.y -** Expression LR(1) Parser -*/ - -/* ==================================================================== - * Copyright (c) 1998-2001 Ralf S. Engelschall. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following - * disclaimer in the documentation and/or other materials - * provided with the distribution. - * - * 3. All advertising materials mentioning features or use of this - * software must display the following acknowledgment: - * "This product includes software developed by - * Ralf S. Engelschall for use in the - * mod_ssl project (http://www.modssl.org/)." - * - * 4. The names "mod_ssl" must not be used to endorse or promote - * products derived from this software without prior written - * permission. For written permission, please contact - * rse@engelschall.com. - * - * 5. Products derived from this software may not be called "mod_ssl" - * nor may "mod_ssl" appear in their names without prior - * written permission of Ralf S. Engelschall. - * - * 6. Redistributions of any form whatsoever must retain the following - * acknowledgment: - * "This product includes software developed by - * Ralf S. Engelschall for use in the - * mod_ssl project (http://www.modssl.org/)." - * - * THIS SOFTWARE IS PROVIDED BY RALF S. ENGELSCHALL ``AS IS'' AND ANY - * EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR - * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL RALF S. ENGELSCHALL OR - * HIS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT - * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, - * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED - * OF THE POSSIBILITY OF SUCH DAMAGE. - * ==================================================================== - */ - - /* ``What you see is all you get.'' - -- Brian Kernighan */ - -/* _________________________________________________________________ -** -** Expression Parser -** _________________________________________________________________ -*/ - -%{ -#include "mod_ssl.h" -%} - -%union { - char *cpVal; - ssl_expr *exVal; -} - -%token T_TRUE -%token T_FALSE - -%token T_DIGIT -%token T_ID -%token T_STRING -%token T_REGEX -%token T_REGEX_I - -%token T_FUNC_FILE - -%token T_OP_EQ -%token T_OP_NE -%token T_OP_LT -%token T_OP_LE -%token T_OP_GT -%token T_OP_GE -%token T_OP_REG -%token T_OP_NRE -%token T_OP_IN - -%token T_OP_OR -%token T_OP_AND -%token T_OP_NOT - -%left T_OP_OR -%left T_OP_AND -%left T_OP_NOT - -%type expr -%type comparison -%type funccall -%type regex -%type words -%type word - -%% - -root : expr { ssl_expr_info.expr = $1; } - ; - -expr : T_TRUE { $$ = ssl_expr_make(op_True, NULL, NULL); } - | T_FALSE { $$ = ssl_expr_make(op_False, NULL, NULL); } - | T_OP_NOT expr { $$ = ssl_expr_make(op_Not, $2, NULL); } - | expr T_OP_OR expr { $$ = ssl_expr_make(op_Or, $1, $3); } - | expr T_OP_AND expr { $$ = ssl_expr_make(op_And, $1, $3); } - | comparison { $$ = ssl_expr_make(op_Comp, $1, NULL); } - | '(' expr ')' { $$ = $2; } - ; - -comparison: word T_OP_EQ word { $$ = ssl_expr_make(op_EQ, $1, $3); } - | word T_OP_NE word { $$ = ssl_expr_make(op_NE, $1, $3); } - | word T_OP_LT word { $$ = ssl_expr_make(op_LT, $1, $3); } - | word T_OP_LE word { $$ = ssl_expr_make(op_LE, $1, $3); } - | word T_OP_GT word { $$ = ssl_expr_make(op_GT, $1, $3); } - | word T_OP_GE word { $$ = ssl_expr_make(op_GE, $1, $3); } - | word T_OP_IN '{' words '}' { $$ = ssl_expr_make(op_IN, $1, $4); } - | word T_OP_REG regex { $$ = ssl_expr_make(op_REG, $1, $3); } - | word T_OP_NRE regex { $$ = ssl_expr_make(op_NRE, $1, $3); } - ; - -words : word { $$ = ssl_expr_make(op_ListElement, $1, NULL); } - | words ',' word { $$ = ssl_expr_make(op_ListElement, $3, $1); } - ; - -word : T_DIGIT { $$ = ssl_expr_make(op_Digit, $1, NULL); } - | T_STRING { $$ = ssl_expr_make(op_String, $1, NULL); } - | '%' '{' T_ID '}' { $$ = ssl_expr_make(op_Var, $3, NULL); } - | funccall { $$ = $1; } - ; - -regex : T_REGEX { - regex_t *regex; - if ((regex = ap_pregcomp(ssl_expr_info.pool, $1, - REG_EXTENDED|REG_NOSUB)) == NULL) { - ssl_expr_error = "Failed to compile regular expression"; - YYERROR; - regex = NULL; - } - $$ = ssl_expr_make(op_Regex, regex, NULL); - } - | T_REGEX_I { - regex_t *regex; - if ((regex = ap_pregcomp(ssl_expr_info.pool, $1, - REG_EXTENDED|REG_NOSUB|REG_ICASE)) == NULL) { - ssl_expr_error = "Failed to compile regular expression"; - YYERROR; - regex = NULL; - } - $$ = ssl_expr_make(op_Regex, regex, NULL); - } - ; - -funccall : T_FUNC_FILE '(' T_STRING ')' { - ssl_expr *args = ssl_expr_make(op_ListElement, $3, NULL); - $$ = ssl_expr_make(op_Func, "file", args); - } - ; - -%% - -int yyerror(char *s) -{ - ssl_expr_error = s; - return 2; -} - diff --git a/modules/ssl/ssl_expr_scan.c b/modules/ssl/ssl_expr_scan.c deleted file mode 100644 index f3e9f9d1f58c5bab8d00a63ece247852ae42b3ac..0000000000000000000000000000000000000000 --- a/modules/ssl/ssl_expr_scan.c +++ /dev/null @@ -1,2002 +0,0 @@ -#define yy_create_buffer ssl_expr_yy_create_buffer -#define yy_delete_buffer ssl_expr_yy_delete_buffer -#define yy_scan_buffer ssl_expr_yy_scan_buffer -#define yy_scan_string ssl_expr_yy_scan_string -#define yy_scan_bytes ssl_expr_yy_scan_bytes -#define yy_flex_debug ssl_expr_yy_flex_debug -#define yy_init_buffer ssl_expr_yy_init_buffer -#define yy_flush_buffer ssl_expr_yy_flush_buffer -#define yy_load_buffer_state ssl_expr_yy_load_buffer_state -#define yy_switch_to_buffer ssl_expr_yy_switch_to_buffer -#define yyin ssl_expr_yyin -#define yyleng ssl_expr_yyleng -#define yylex ssl_expr_yylex -#define yyout ssl_expr_yyout -#define yyrestart ssl_expr_yyrestart -#define yytext ssl_expr_yytext - -/* A lexical scanner generated by flex */ - -/* Scanner skeleton version: - */ - -#define FLEX_SCANNER -#define YY_FLEX_MAJOR_VERSION 2 -#define YY_FLEX_MINOR_VERSION 5 - -#include - - -/* cfront 1.2 defines "c_plusplus" instead of "__cplusplus" */ -#ifdef c_plusplus -#ifndef __cplusplus -#define __cplusplus -#endif -#endif - - -#ifdef __cplusplus - -#include -#include - -/* Use prototypes in function declarations. */ -#define YY_USE_PROTOS - -/* The "const" storage-class-modifier is valid. */ -#define YY_USE_CONST - -#else /* ! __cplusplus */ - -#if __STDC__ - -#define YY_USE_PROTOS -#define YY_USE_CONST - -#endif /* __STDC__ */ -#endif /* ! __cplusplus */ - -#ifdef __TURBOC__ - #pragma warn -rch - #pragma warn -use -#include -#include -#define YY_USE_CONST -#define YY_USE_PROTOS -#endif - -#ifdef YY_USE_CONST -#define yyconst const -#else -#define yyconst -#endif - - -#ifdef YY_USE_PROTOS -#define YY_PROTO(proto) proto -#else -#define YY_PROTO(proto) () -#endif - -/* Returned upon end-of-file. */ -#define YY_NULL 0 - -/* Promotes a possibly negative, possibly signed char to an unsigned - * integer for use as an array index. If the signed char is negative, - * we want to instead treat it as an 8-bit unsigned char, hence the - * double cast. - */ -#define YY_SC_TO_UI(c) ((unsigned int) (unsigned char) c) - -/* Enter a start condition. This macro really ought to take a parameter, - * but we do it the disgusting crufty way forced on us by the ()-less - * definition of BEGIN. - */ -#define BEGIN yy_start = 1 + 2 * - -/* Translate the current start state into a value that can be later handed - * to BEGIN to return to the state. The YYSTATE alias is for lex - * compatibility. - */ -#define YY_START ((yy_start - 1) / 2) -#define YYSTATE YY_START - -/* Action number for EOF rule of a given start state. */ -#define YY_STATE_EOF(state) (YY_END_OF_BUFFER + state + 1) - -/* Special action meaning "start processing a new file". */ -#define YY_NEW_FILE yyrestart( yyin ) - -#define YY_END_OF_BUFFER_CHAR 0 - -/* Size of default input buffer. */ -#define YY_BUF_SIZE 16384 - -typedef struct yy_buffer_state *YY_BUFFER_STATE; - -extern int yyleng; -extern FILE *yyin, *yyout; - -#define EOB_ACT_CONTINUE_SCAN 0 -#define EOB_ACT_END_OF_FILE 1 -#define EOB_ACT_LAST_MATCH 2 - -/* The funky do-while in the following #define is used to turn the definition - * int a single C statement (which needs a semi-colon terminator). This - * avoids problems with code like: - * - * if ( condition_holds ) - * yyless( 5 ); - * else - * do_something_else(); - * - * Prior to using the do-while the compiler would get upset at the - * "else" because it interpreted the "if" statement as being all - * done when it reached the ';' after the yyless() call. - */ - -/* Return all but the first 'n' matched characters back to the input stream. */ - -#define yyless(n) \ - do \ - { \ - /* Undo effects of setting up yytext. */ \ - *yy_cp = yy_hold_char; \ - YY_RESTORE_YY_MORE_OFFSET \ - yy_c_buf_p = yy_cp = yy_bp + n - YY_MORE_ADJ; \ - YY_DO_BEFORE_ACTION; /* set up yytext again */ \ - } \ - while ( 0 ) - -#define unput(c) yyunput( c, yytext_ptr ) - -/* The following is because we cannot portably get our hands on size_t - * (without autoconf's help, which isn't available because we want - * flex-generated scanners to compile on their own). - */ -typedef unsigned int yy_size_t; - - -struct yy_buffer_state - { - FILE *yy_input_file; - - char *yy_ch_buf; /* input buffer */ - char *yy_buf_pos; /* current position in input buffer */ - - /* Size of input buffer in bytes, not including room for EOB - * characters. - */ - yy_size_t yy_buf_size; - - /* Number of characters read into yy_ch_buf, not including EOB - * characters. - */ - int yy_n_chars; - - /* Whether we "own" the buffer - i.e., we know we created it, - * and can realloc() it to grow it, and should free() it to - * delete it. - */ - int yy_is_our_buffer; - - /* Whether this is an "interactive" input source; if so, and - * if we're using stdio for input, then we want to use getc() - * instead of fread(), to make sure we stop fetching input after - * each newline. - */ - int yy_is_interactive; - - /* Whether we're considered to be at the beginning of a line. - * If so, '^' rules will be active on the next match, otherwise - * not. - */ - int yy_at_bol; - - /* Whether to try to fill the input buffer when we reach the - * end of it. - */ - int yy_fill_buffer; - - int yy_buffer_status; -#define YY_BUFFER_NEW 0 -#define YY_BUFFER_NORMAL 1 - /* When an EOF's been seen but there's still some text to process - * then we mark the buffer as YY_EOF_PENDING, to indicate that we - * shouldn't try reading from the input source any more. We might - * still have a bunch of tokens to match, though, because of - * possible backing-up. - * - * When we actually see the EOF, we change the status to "new" - * (via yyrestart()), so that the user can continue scanning by - * just pointing yyin at a new input file. - */ -#define YY_BUFFER_EOF_PENDING 2 - }; - -static YY_BUFFER_STATE yy_current_buffer = 0; - -/* We provide macros for accessing buffer states in case in the - * future we want to put the buffer states in a more general - * "scanner state". - */ -#define YY_CURRENT_BUFFER yy_current_buffer - - -/* yy_hold_char holds the character lost when yytext is formed. */ -static char yy_hold_char; - -static int yy_n_chars; /* number of characters read into yy_ch_buf */ - - -int yyleng; - -/* Points to current character in buffer. */ -static char *yy_c_buf_p = (char *) 0; -static int yy_init = 1; /* whether we need to initialize */ -static int yy_start = 0; /* start state number */ - -/* Flag which is used to allow yywrap()'s to do buffer switches - * instead of setting up a fresh yyin. A bit of a hack ... - */ -static int yy_did_buffer_switch_on_eof; - -void yyrestart YY_PROTO(( FILE *input_file )); - -void yy_switch_to_buffer YY_PROTO(( YY_BUFFER_STATE new_buffer )); -void yy_load_buffer_state YY_PROTO(( void )); -YY_BUFFER_STATE yy_create_buffer YY_PROTO(( FILE *file, int size )); -void yy_delete_buffer YY_PROTO(( YY_BUFFER_STATE b )); -void yy_init_buffer YY_PROTO(( YY_BUFFER_STATE b, FILE *file )); -void yy_flush_buffer YY_PROTO(( YY_BUFFER_STATE b )); -#define YY_FLUSH_BUFFER yy_flush_buffer( yy_current_buffer ) - -YY_BUFFER_STATE yy_scan_buffer YY_PROTO(( char *base, yy_size_t size )); -YY_BUFFER_STATE yy_scan_string YY_PROTO(( yyconst char *yy_str )); -YY_BUFFER_STATE yy_scan_bytes YY_PROTO(( yyconst char *bytes, int len )); - -static void *yy_flex_alloc YY_PROTO(( yy_size_t )); -static void *yy_flex_realloc YY_PROTO(( void *, yy_size_t )); -static void yy_flex_free YY_PROTO(( void * )); - -#define yy_new_buffer yy_create_buffer - -#define yy_set_interactive(is_interactive) \ - { \ - if ( ! yy_current_buffer ) \ - yy_current_buffer = yy_create_buffer( yyin, YY_BUF_SIZE ); \ - yy_current_buffer->yy_is_interactive = is_interactive; \ - } - -#define yy_set_bol(at_bol) \ - { \ - if ( ! yy_current_buffer ) \ - yy_current_buffer = yy_create_buffer( yyin, YY_BUF_SIZE ); \ - yy_current_buffer->yy_at_bol = at_bol; \ - } - -#define YY_AT_BOL() (yy_current_buffer->yy_at_bol) - - -#define yywrap() 1 -#define YY_SKIP_YYWRAP -typedef unsigned char YY_CHAR; -FILE *yyin = (FILE *) 0, *yyout = (FILE *) 0; -typedef int yy_state_type; -extern char *yytext; -#define yytext_ptr yytext - -static yy_state_type yy_get_previous_state YY_PROTO(( void )); -static yy_state_type yy_try_NUL_trans YY_PROTO(( yy_state_type current_state )); -static int yy_get_next_buffer YY_PROTO(( void )); -static void yy_fatal_error YY_PROTO(( yyconst char msg[] )); - -/* Done after the current pattern has been matched and before the - * corresponding action - sets up yytext. - */ -#define YY_DO_BEFORE_ACTION \ - yytext_ptr = yy_bp; \ - yyleng = (int) (yy_cp - yy_bp); \ - yy_hold_char = *yy_cp; \ - *yy_cp = '\0'; \ - yy_c_buf_p = yy_cp; - -#define YY_NUM_RULES 46 -#define YY_END_OF_BUFFER 47 -static yyconst short int yy_accept[86] = - { 0, - 0, 0, 0, 0, 0, 0, 0, 0, 47, 45, - 1, 38, 2, 45, 43, 24, 45, 28, 44, 44, - 44, 44, 44, 44, 44, 44, 44, 44, 44, 45, - 13, 4, 3, 14, 16, 18, 17, 1, 22, 32, - 34, 43, 26, 20, 31, 30, 44, 44, 19, 44, - 44, 29, 27, 39, 25, 23, 15, 15, 21, 44, - 35, 44, 36, 13, 12, 5, 6, 10, 11, 7, - 8, 9, 33, 44, 44, 37, 44, 5, 6, 44, - 40, 41, 5, 42, 0 - } ; - -static yyconst int yy_ec[256] = - { 0, - 1, 1, 1, 1, 1, 1, 1, 1, 2, 3, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 2, 4, 5, 1, 1, 1, 6, 1, 1, - 1, 1, 1, 1, 7, 1, 1, 8, 8, 8, - 8, 8, 8, 8, 8, 9, 9, 7, 1, 10, - 11, 12, 1, 1, 13, 13, 13, 13, 13, 13, - 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, - 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, - 1, 14, 1, 1, 7, 1, 15, 16, 13, 17, - - 18, 19, 20, 13, 21, 13, 13, 22, 23, 24, - 25, 13, 26, 27, 28, 29, 30, 13, 13, 13, - 13, 13, 1, 31, 1, 32, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1 - } ; - -static yyconst int yy_meta[33] = - { 0, - 1, 1, 2, 1, 3, 1, 4, 4, 4, 1, - 1, 1, 4, 3, 4, 4, 4, 4, 4, 4, - 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, - 1, 1 - } ; - -static yyconst short int yy_base[93] = - { 0, - 0, 0, 30, 31, 0, 0, 82, 81, 101, 142, - 35, 28, 142, 94, 32, 88, 31, 87, 0, 69, - 66, 28, 28, 67, 29, 63, 30, 63, 62, 57, - 0, 142, 142, 88, 142, 142, 142, 48, 142, 142, - 142, 44, 142, 142, 142, 142, 0, 70, 0, 64, - 63, 0, 0, 0, 0, 0, 142, 0, 0, 55, - 0, 46, 142, 0, 142, 53, 62, 142, 142, 142, - 142, 142, 0, 44, 48, 0, 41, 70, 72, 38, - 0, 0, 74, 0, 142, 117, 121, 125, 50, 129, - 133, 137 - - } ; - -static yyconst short int yy_def[93] = - { 0, - 85, 1, 86, 86, 87, 87, 88, 88, 85, 85, - 85, 85, 85, 85, 85, 85, 85, 85, 89, 89, - 89, 89, 89, 89, 89, 90, 89, 89, 89, 85, - 91, 85, 85, 92, 85, 85, 85, 85, 85, 85, - 85, 85, 85, 85, 85, 85, 89, 89, 89, 89, - 89, 89, 89, 89, 89, 89, 85, 89, 89, 89, - 89, 89, 85, 91, 85, 85, 85, 85, 85, 85, - 85, 85, 89, 89, 89, 89, 89, 85, 85, 89, - 89, 89, 85, 89, 0, 85, 85, 85, 85, 85, - 85, 85 - - } ; - -static yyconst short int yy_nxt[175] = - { 0, - 10, 11, 11, 12, 13, 14, 10, 15, 15, 16, - 17, 18, 19, 10, 20, 19, 19, 21, 22, 23, - 24, 25, 26, 27, 28, 19, 19, 19, 29, 19, - 30, 10, 32, 32, 33, 33, 38, 38, 39, 42, - 42, 44, 50, 34, 34, 52, 55, 59, 51, 38, - 38, 42, 42, 47, 60, 84, 53, 56, 82, 40, - 78, 79, 45, 57, 57, 81, 57, 57, 57, 79, - 79, 80, 57, 57, 57, 77, 57, 83, 79, 79, - 79, 79, 79, 76, 75, 74, 73, 63, 62, 61, - 54, 49, 48, 57, 57, 66, 67, 46, 43, 41, - - 85, 37, 37, 68, 85, 85, 69, 85, 85, 85, - 85, 70, 85, 85, 71, 85, 72, 31, 31, 31, - 31, 35, 35, 35, 35, 36, 36, 36, 36, 58, - 85, 58, 58, 64, 85, 85, 64, 65, 65, 65, - 65, 9, 85, 85, 85, 85, 85, 85, 85, 85, - 85, 85, 85, 85, 85, 85, 85, 85, 85, 85, - 85, 85, 85, 85, 85, 85, 85, 85, 85, 85, - 85, 85, 85, 85 - } ; - -static yyconst short int yy_chk[175] = - { 0, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 3, 4, 3, 4, 11, 11, 12, 15, - 15, 17, 22, 3, 4, 23, 25, 27, 22, 38, - 38, 42, 42, 89, 27, 80, 23, 25, 77, 12, - 66, 66, 17, 26, 26, 75, 26, 26, 26, 67, - 67, 74, 26, 26, 26, 62, 26, 78, 78, 79, - 79, 83, 83, 60, 51, 50, 48, 30, 29, 28, - 24, 21, 20, 26, 26, 34, 34, 18, 16, 14, - - 9, 8, 7, 34, 0, 0, 34, 0, 0, 0, - 0, 34, 0, 0, 34, 0, 34, 86, 86, 86, - 86, 87, 87, 87, 87, 88, 88, 88, 88, 90, - 0, 90, 90, 91, 0, 0, 91, 92, 92, 92, - 92, 85, 85, 85, 85, 85, 85, 85, 85, 85, - 85, 85, 85, 85, 85, 85, 85, 85, 85, 85, - 85, 85, 85, 85, 85, 85, 85, 85, 85, 85, - 85, 85, 85, 85 - } ; - -static yy_state_type yy_last_accepting_state; -static char *yy_last_accepting_cpos; - -/* The intent behind this definition is that it'll catch - * any uses of REJECT which flex missed. - */ -#define REJECT reject_used_but_not_detected -#define yymore() yymore_used_but_not_detected -#define YY_MORE_ADJ 0 -#define YY_RESTORE_YY_MORE_OFFSET -char *yytext; -#line 1 "ssl_expr_scan.l" -#define INITIAL 0 -/* _ _ -** _ __ ___ ___ __| | ___ ___| | -** | '_ ` _ \ / _ \ / _` | / __/ __| | -** | | | | | | (_) | (_| | \__ \__ \ | mod_ssl - Apache Interface to OpenSSL -** |_| |_| |_|\___/ \__,_|___|___/___/_| http://www.modssl.org/ -** |_____| -** ssl_expr_scan.l -** Expression Scanner -*/ -/* ==================================================================== - * Copyright (c) 1998-2001 Ralf S. Engelschall. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following - * disclaimer in the documentation and/or other materials - * provided with the distribution. - * - * 3. All advertising materials mentioning features or use of this - * software must display the following acknowledgment: - * "This product includes software developed by - * Ralf S. Engelschall for use in the - * mod_ssl project (http://www.modssl.org/)." - * - * 4. The names "mod_ssl" must not be used to endorse or promote - * products derived from this software without prior written - * permission. For written permission, please contact - * rse@engelschall.com. - * - * 5. Products derived from this software may not be called "mod_ssl" - * nor may "mod_ssl" appear in their names without prior - * written permission of Ralf S. Engelschall. - * - * 6. Redistributions of any form whatsoever must retain the following - * acknowledgment: - * "This product includes software developed by - * Ralf S. Engelschall for use in the - * mod_ssl project (http://www.modssl.org/)." - * - * THIS SOFTWARE IS PROVIDED BY RALF S. ENGELSCHALL ``AS IS'' AND ANY - * EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR - * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL RALF S. ENGELSCHALL OR - * HIS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT - * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, - * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED - * OF THE POSSIBILITY OF SUCH DAMAGE. - * ==================================================================== - */ -/* ``Killing for peace is -like fucking for virginity.'' --- Unknown */ -/* _________________________________________________________________ -** -** Expression Scanner -** _________________________________________________________________ -*/ -#line 73 "ssl_expr_scan.l" -#include "mod_ssl.h" - -#include "ssl_expr_parse.h" - -#define YY_NO_UNPUT 1 -int yyinput(char *buf, int max_size); - -#undef YY_INPUT -#define YY_INPUT(buf,result,max_size) \ - (result = yyinput(buf, max_size)) - -#define MAX_STR_LEN 2048 -/* %option stack */ -#define YY_NEVER_INTERACTIVE 1 -#define str 1 - -#define regex 2 -#define regex_flags 3 - -#line 537 "lex.ssl_expr_yy.c" - -/* Macros after this point can all be overridden by user definitions in - * section 1. - */ - -#ifndef YY_SKIP_YYWRAP -#ifdef __cplusplus -extern "C" int yywrap YY_PROTO(( void )); -#else -extern int yywrap YY_PROTO(( void )); -#endif -#endif - -#ifndef YY_NO_UNPUT -static void yyunput YY_PROTO(( int c, char *buf_ptr )); -#endif - -#ifndef yytext_ptr -static void yy_flex_strncpy YY_PROTO(( char *, yyconst char *, int )); -#endif - -#ifdef YY_NEED_STRLEN -static int yy_flex_strlen YY_PROTO(( yyconst char * )); -#endif - -#ifndef YY_NO_INPUT -#ifdef __cplusplus -static int yyinput YY_PROTO(( void )); -#else -static int input YY_PROTO(( void )); -#endif -#endif - -#if YY_STACK_USED -static int yy_start_stack_ptr = 0; -static int yy_start_stack_depth = 0; -static int *yy_start_stack = 0; -#ifndef YY_NO_PUSH_STATE -static void yy_push_state YY_PROTO(( int new_state )); -#endif -#ifndef YY_NO_POP_STATE -static void yy_pop_state YY_PROTO(( void )); -#endif -#ifndef YY_NO_TOP_STATE -static int yy_top_state YY_PROTO(( void )); -#endif - -#else -#define YY_NO_PUSH_STATE 1 -#define YY_NO_POP_STATE 1 -#define YY_NO_TOP_STATE 1 -#endif - -#ifdef YY_MALLOC_DECL -YY_MALLOC_DECL -#else -#if __STDC__ -#ifndef __cplusplus -#include -#endif -#else -/* Just try to get by without declaring the routines. This will fail - * miserably on non-ANSI systems for which sizeof(size_t) != sizeof(int) - * or sizeof(void*) != sizeof(int). - */ -#endif -#endif - -/* Amount of stuff to slurp up with each read. */ -#ifndef YY_READ_BUF_SIZE -#define YY_READ_BUF_SIZE 8192 -#endif - -/* Copy whatever the last rule matched to the standard output. */ - -#ifndef ECHO -/* This used to be an fputs(), but since the string might contain NUL's, - * we now use fwrite(). - */ -#define ECHO (void) fwrite( yytext, yyleng, 1, yyout ) -#endif - -/* Gets input and stuffs it into "buf". number of characters read, or YY_NULL, - * is returned in "result". - */ -#ifndef YY_INPUT -#define YY_INPUT(buf,result,max_size) \ - if ( yy_current_buffer->yy_is_interactive ) \ - { \ - int c = '*', n; \ - for ( n = 0; n < max_size && \ - (c = getc( yyin )) != EOF && c != '\n'; ++n ) \ - buf[n] = (char) c; \ - if ( c == '\n' ) \ - buf[n++] = (char) c; \ - if ( c == EOF && ferror( yyin ) ) \ - YY_FATAL_ERROR( "input in flex scanner failed" ); \ - result = n; \ - } \ - else if ( ((result = fread( buf, 1, max_size, yyin )) == 0) \ - && ferror( yyin ) ) \ - YY_FATAL_ERROR( "input in flex scanner failed" ); -#endif - -/* No semi-colon after return; correct usage is to write "yyterminate();" - - * we don't want an extra ';' after the "return" because that will cause - * some compilers to complain about unreachable statements. - */ -#ifndef yyterminate -#define yyterminate() return YY_NULL -#endif - -/* Number of entries by which start-condition stack grows. */ -#ifndef YY_START_STACK_INCR -#define YY_START_STACK_INCR 25 -#endif - -/* Report a fatal error. */ -#ifndef YY_FATAL_ERROR -#define YY_FATAL_ERROR(msg) yy_fatal_error( msg ) -#endif - -/* Default declaration of generated scanner - a define so the user can - * easily add parameters. - */ -#ifndef YY_DECL -#define YY_DECL int yylex YY_PROTO(( void )) -#endif - -/* Code executed at the beginning of each rule, after yytext and yyleng - * have been set up. - */ -#ifndef YY_USER_ACTION -#define YY_USER_ACTION -#endif - -/* Code executed at the end of each rule. */ -#ifndef YY_BREAK -#define YY_BREAK break; -#endif - -#define YY_RULE_SETUP \ - YY_USER_ACTION - -YY_DECL - { - register yy_state_type yy_current_state; - register char *yy_cp, *yy_bp; - register int yy_act; - -#line 94 "ssl_expr_scan.l" - - - char caStr[MAX_STR_LEN]; - char *cpStr = NULL; - char caRegex[MAX_STR_LEN]; - char *cpRegex = NULL; - char cRegexDel = NUL; - - /* - * Whitespaces - */ -#line 700 "lex.ssl_expr_yy.c" - - if ( yy_init ) - { - yy_init = 0; - -#ifdef YY_USER_INIT - YY_USER_INIT; -#endif - - if ( ! yy_start ) - yy_start = 1; /* first start state */ - - if ( ! yyin ) - yyin = stdin; - - if ( ! yyout ) - yyout = stdout; - - if ( ! yy_current_buffer ) - yy_current_buffer = - yy_create_buffer( yyin, YY_BUF_SIZE ); - - yy_load_buffer_state(); - } - - while ( 1 ) /* loops until end-of-file is reached */ - { - yy_cp = yy_c_buf_p; - - /* Support of yytext. */ - *yy_cp = yy_hold_char; - - /* yy_bp points to the position in yy_ch_buf of the start of - * the current run. - */ - yy_bp = yy_cp; - - yy_current_state = yy_start; -yy_match: - do - { - register YY_CHAR yy_c = yy_ec[YY_SC_TO_UI(*yy_cp)]; - if ( yy_accept[yy_current_state] ) - { - yy_last_accepting_state = yy_current_state; - yy_last_accepting_cpos = yy_cp; - } - while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state ) - { - yy_current_state = (int) yy_def[yy_current_state]; - if ( yy_current_state >= 86 ) - yy_c = yy_meta[(unsigned int) yy_c]; - } - yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c]; - ++yy_cp; - } - while ( yy_current_state != 85 ); - yy_cp = yy_last_accepting_cpos; - yy_current_state = yy_last_accepting_state; - -yy_find_action: - yy_act = yy_accept[yy_current_state]; - - YY_DO_BEFORE_ACTION; - - -do_action: /* This label is used only to access EOF actions. */ - - - switch ( yy_act ) - { /* beginning of action switch */ - case 0: /* must back up */ - /* undo the effects of YY_DO_BEFORE_ACTION */ - *yy_cp = yy_hold_char; - yy_cp = yy_last_accepting_cpos; - yy_current_state = yy_last_accepting_state; - goto yy_find_action; - -case 1: -YY_RULE_SETUP -#line 105 "ssl_expr_scan.l" -{ - /* NOP */ -} - YY_BREAK -/* - * C-style strings ("...") - */ -case 2: -YY_RULE_SETUP -#line 112 "ssl_expr_scan.l" -{ - cpStr = caStr; - BEGIN(str); -} - YY_BREAK -case 3: -YY_RULE_SETUP -#line 116 "ssl_expr_scan.l" -{ - BEGIN(INITIAL); - *cpStr = NUL; - yylval.cpVal = ap_pstrdup(ssl_expr_info.pool, caStr); - return T_STRING; -} - YY_BREAK -case 4: -YY_RULE_SETUP -#line 122 "ssl_expr_scan.l" -{ - yyerror("Unterminated string"); -} - YY_BREAK -case 5: -YY_RULE_SETUP -#line 125 "ssl_expr_scan.l" -{ - int result; - - (void)sscanf(yytext+1, "%o", &result); - if (result > 0xff) - yyerror("Escape sequence out of bound"); - else - *cpStr++ = result; -} - YY_BREAK -case 6: -YY_RULE_SETUP -#line 134 "ssl_expr_scan.l" -{ - yyerror("Bad escape sequence"); -} - YY_BREAK -case 7: -YY_RULE_SETUP -#line 137 "ssl_expr_scan.l" -{ *cpStr++ = '\n'; } - YY_BREAK -case 8: -YY_RULE_SETUP -#line 138 "ssl_expr_scan.l" -{ *cpStr++ = '\r'; } - YY_BREAK -case 9: -YY_RULE_SETUP -#line 139 "ssl_expr_scan.l" -{ *cpStr++ = '\t'; } - YY_BREAK -case 10: -YY_RULE_SETUP -#line 140 "ssl_expr_scan.l" -{ *cpStr++ = '\b'; } - YY_BREAK -case 11: -YY_RULE_SETUP -#line 141 "ssl_expr_scan.l" -{ *cpStr++ = '\f'; } - YY_BREAK -case 12: -YY_RULE_SETUP -#line 142 "ssl_expr_scan.l" -{ - *cpStr++ = yytext[1]; -} - YY_BREAK -case 13: -YY_RULE_SETUP -#line 145 "ssl_expr_scan.l" -{ - char *cp = yytext; - while (*cp != NUL) - *cpStr++ = *cp++; -} - YY_BREAK -case 14: -YY_RULE_SETUP -#line 150 "ssl_expr_scan.l" -{ - *cpStr++ = yytext[1]; -} - YY_BREAK -/* - * Regular Expression - */ -case 15: -YY_RULE_SETUP -#line 157 "ssl_expr_scan.l" -{ - cRegexDel = yytext[1]; - cpRegex = caRegex; - BEGIN(regex); -} - YY_BREAK -case 16: -YY_RULE_SETUP -#line 162 "ssl_expr_scan.l" -{ - if (yytext[0] == cRegexDel) { - *cpRegex = NUL; - BEGIN(regex_flags); - } - else { - *cpRegex++ = yytext[0]; - } -} - YY_BREAK -case 17: -YY_RULE_SETUP -#line 171 "ssl_expr_scan.l" -{ - yylval.cpVal = ap_pstrdup(ssl_expr_info.pool, caRegex); - BEGIN(INITIAL); - return T_REGEX_I; -} - YY_BREAK -case 18: -YY_RULE_SETUP -#line 176 "ssl_expr_scan.l" -{ - yylval.cpVal = ap_pstrdup(ssl_expr_info.pool, caRegex); - yyless(0); - BEGIN(INITIAL); - return T_REGEX; -} - YY_BREAK -case YY_STATE_EOF(regex_flags): -#line 182 "ssl_expr_scan.l" -{ - yylval.cpVal = ap_pstrdup(ssl_expr_info.pool, caRegex); - BEGIN(INITIAL); - return T_REGEX; -} - YY_BREAK -/* - * Operators - */ -case 19: -YY_RULE_SETUP -#line 191 "ssl_expr_scan.l" -{ return T_OP_EQ; } - YY_BREAK -case 20: -YY_RULE_SETUP -#line 192 "ssl_expr_scan.l" -{ return T_OP_EQ; } - YY_BREAK -case 21: -YY_RULE_SETUP -#line 193 "ssl_expr_scan.l" -{ return T_OP_NE; } - YY_BREAK -case 22: -YY_RULE_SETUP -#line 194 "ssl_expr_scan.l" -{ return T_OP_NE; } - YY_BREAK -case 23: -YY_RULE_SETUP -#line 195 "ssl_expr_scan.l" -{ return T_OP_LT; } - YY_BREAK -case 24: -YY_RULE_SETUP -#line 196 "ssl_expr_scan.l" -{ return T_OP_LT; } - YY_BREAK -case 25: -YY_RULE_SETUP -#line 197 "ssl_expr_scan.l" -{ return T_OP_LE; } - YY_BREAK -case 26: -YY_RULE_SETUP -#line 198 "ssl_expr_scan.l" -{ return T_OP_LE; } - YY_BREAK -case 27: -YY_RULE_SETUP -#line 199 "ssl_expr_scan.l" -{ return T_OP_GT; } - YY_BREAK -case 28: -YY_RULE_SETUP -#line 200 "ssl_expr_scan.l" -{ return T_OP_GT; } - YY_BREAK -case 29: -YY_RULE_SETUP -#line 201 "ssl_expr_scan.l" -{ return T_OP_GE; } - YY_BREAK -case 30: -YY_RULE_SETUP -#line 202 "ssl_expr_scan.l" -{ return T_OP_GE; } - YY_BREAK -case 31: -YY_RULE_SETUP -#line 203 "ssl_expr_scan.l" -{ return T_OP_REG; } - YY_BREAK -case 32: -YY_RULE_SETUP -#line 204 "ssl_expr_scan.l" -{ return T_OP_NRE; } - YY_BREAK -case 33: -YY_RULE_SETUP -#line 205 "ssl_expr_scan.l" -{ return T_OP_AND; } - YY_BREAK -case 34: -YY_RULE_SETUP -#line 206 "ssl_expr_scan.l" -{ return T_OP_AND; } - YY_BREAK -case 35: -YY_RULE_SETUP -#line 207 "ssl_expr_scan.l" -{ return T_OP_OR; } - YY_BREAK -case 36: -YY_RULE_SETUP -#line 208 "ssl_expr_scan.l" -{ return T_OP_OR; } - YY_BREAK -case 37: -YY_RULE_SETUP -#line 209 "ssl_expr_scan.l" -{ return T_OP_NOT; } - YY_BREAK -case 38: -YY_RULE_SETUP -#line 210 "ssl_expr_scan.l" -{ return T_OP_NOT; } - YY_BREAK -case 39: -YY_RULE_SETUP -#line 211 "ssl_expr_scan.l" -{ return T_OP_IN; } - YY_BREAK -/* - * Functions - */ -case 40: -YY_RULE_SETUP -#line 216 "ssl_expr_scan.l" -{ return T_FUNC_FILE; } - YY_BREAK -/* - * Specials - */ -case 41: -YY_RULE_SETUP -#line 221 "ssl_expr_scan.l" -{ return T_TRUE; } - YY_BREAK -case 42: -YY_RULE_SETUP -#line 222 "ssl_expr_scan.l" -{ return T_FALSE; } - YY_BREAK -/* - * Digits - */ -case 43: -YY_RULE_SETUP -#line 227 "ssl_expr_scan.l" -{ - yylval.cpVal = ap_pstrdup(ssl_expr_info.pool, yytext); - return T_DIGIT; -} - YY_BREAK -/* - * Identifiers - */ -case 44: -YY_RULE_SETUP -#line 235 "ssl_expr_scan.l" -{ - yylval.cpVal = ap_pstrdup(ssl_expr_info.pool, yytext); - return T_ID; -} - YY_BREAK -/* - * Anything else is returned as is... - */ -case 45: -YY_RULE_SETUP -#line 243 "ssl_expr_scan.l" -{ - return yytext[0]; -} - YY_BREAK -case 46: -YY_RULE_SETUP -#line 247 "ssl_expr_scan.l" -YY_FATAL_ERROR( "flex scanner jammed" ); - YY_BREAK -#line 1100 "lex.ssl_expr_yy.c" -case YY_STATE_EOF(INITIAL): -case YY_STATE_EOF(str): -case YY_STATE_EOF(regex): - yyterminate(); - - case YY_END_OF_BUFFER: - { - /* Amount of text matched not including the EOB char. */ - int yy_amount_of_matched_text = (int) (yy_cp - yytext_ptr) - 1; - - /* Undo the effects of YY_DO_BEFORE_ACTION. */ - *yy_cp = yy_hold_char; - YY_RESTORE_YY_MORE_OFFSET - - if ( yy_current_buffer->yy_buffer_status == YY_BUFFER_NEW ) - { - /* We're scanning a new file or input source. It's - * possible that this happened because the user - * just pointed yyin at a new source and called - * yylex(). If so, then we have to assure - * consistency between yy_current_buffer and our - * globals. Here is the right place to do so, because - * this is the first action (other than possibly a - * back-up) that will match for the new input source. - */ - yy_n_chars = yy_current_buffer->yy_n_chars; - yy_current_buffer->yy_input_file = yyin; - yy_current_buffer->yy_buffer_status = YY_BUFFER_NORMAL; - } - - /* Note that here we test for yy_c_buf_p "<=" to the position - * of the first EOB in the buffer, since yy_c_buf_p will - * already have been incremented past the NUL character - * (since all states make transitions on EOB to the - * end-of-buffer state). Contrast this with the test - * in input(). - */ - if ( yy_c_buf_p <= &yy_current_buffer->yy_ch_buf[yy_n_chars] ) - { /* This was really a NUL. */ - yy_state_type yy_next_state; - - yy_c_buf_p = yytext_ptr + yy_amount_of_matched_text; - - yy_current_state = yy_get_previous_state(); - - /* Okay, we're now positioned to make the NUL - * transition. We couldn't have - * yy_get_previous_state() go ahead and do it - * for us because it doesn't know how to deal - * with the possibility of jamming (and we don't - * want to build jamming into it because then it - * will run more slowly). - */ - - yy_next_state = yy_try_NUL_trans( yy_current_state ); - - yy_bp = yytext_ptr + YY_MORE_ADJ; - - if ( yy_next_state ) - { - /* Consume the NUL. */ - yy_cp = ++yy_c_buf_p; - yy_current_state = yy_next_state; - goto yy_match; - } - - else - { - yy_cp = yy_last_accepting_cpos; - yy_current_state = yy_last_accepting_state; - goto yy_find_action; - } - } - - else switch ( yy_get_next_buffer() ) - { - case EOB_ACT_END_OF_FILE: - { - yy_did_buffer_switch_on_eof = 0; - - if ( yywrap() ) - { - /* Note: because we've taken care in - * yy_get_next_buffer() to have set up - * yytext, we can now set up - * yy_c_buf_p so that if some total - * hoser (like flex itself) wants to - * call the scanner after we return the - * YY_NULL, it'll still work - another - * YY_NULL will get returned. - */ - yy_c_buf_p = yytext_ptr + YY_MORE_ADJ; - - yy_act = YY_STATE_EOF(YY_START); - goto do_action; - } - - else - { - if ( ! yy_did_buffer_switch_on_eof ) - YY_NEW_FILE; - } - break; - } - - case EOB_ACT_CONTINUE_SCAN: - yy_c_buf_p = - yytext_ptr + yy_amount_of_matched_text; - - yy_current_state = yy_get_previous_state(); - - yy_cp = yy_c_buf_p; - yy_bp = yytext_ptr + YY_MORE_ADJ; - goto yy_match; - - case EOB_ACT_LAST_MATCH: - yy_c_buf_p = - &yy_current_buffer->yy_ch_buf[yy_n_chars]; - - yy_current_state = yy_get_previous_state(); - - yy_cp = yy_c_buf_p; - yy_bp = yytext_ptr + YY_MORE_ADJ; - goto yy_find_action; - } - break; - } - - default: - YY_FATAL_ERROR( - "fatal flex scanner internal error--no action found" ); - } /* end of action switch */ - } /* end of scanning one token */ - } /* end of yylex */ - - -/* yy_get_next_buffer - try to read in a new buffer - * - * Returns a code representing an action: - * EOB_ACT_LAST_MATCH - - * EOB_ACT_CONTINUE_SCAN - continue scanning from current position - * EOB_ACT_END_OF_FILE - end of file - */ - -static int yy_get_next_buffer() - { - register char *dest = yy_current_buffer->yy_ch_buf; - register char *source = yytext_ptr; - register int number_to_move, i; - int ret_val; - - if ( yy_c_buf_p > &yy_current_buffer->yy_ch_buf[yy_n_chars + 1] ) - YY_FATAL_ERROR( - "fatal flex scanner internal error--end of buffer missed" ); - - if ( yy_current_buffer->yy_fill_buffer == 0 ) - { /* Don't try to fill the buffer, so this is an EOF. */ - if ( yy_c_buf_p - yytext_ptr - YY_MORE_ADJ == 1 ) - { - /* We matched a single character, the EOB, so - * treat this as a final EOF. - */ - return EOB_ACT_END_OF_FILE; - } - - else - { - /* We matched some text prior to the EOB, first - * process it. - */ - return EOB_ACT_LAST_MATCH; - } - } - - /* Try to read more data. */ - - /* First move last chars to start of buffer. */ - number_to_move = (int) (yy_c_buf_p - yytext_ptr) - 1; - - for ( i = 0; i < number_to_move; ++i ) - *(dest++) = *(source++); - - if ( yy_current_buffer->yy_buffer_status == YY_BUFFER_EOF_PENDING ) - /* don't do the read, it's not guaranteed to return an EOF, - * just force an EOF - */ - yy_current_buffer->yy_n_chars = yy_n_chars = 0; - - else - { - int num_to_read = - yy_current_buffer->yy_buf_size - number_to_move - 1; - - while ( num_to_read <= 0 ) - { /* Not enough room in the buffer - grow it. */ -#ifdef YY_USES_REJECT - YY_FATAL_ERROR( -"input buffer overflow, can't enlarge buffer because scanner uses REJECT" ); -#else - - /* just a shorter name for the current buffer */ - YY_BUFFER_STATE b = yy_current_buffer; - - int yy_c_buf_p_offset = - (int) (yy_c_buf_p - b->yy_ch_buf); - - if ( b->yy_is_our_buffer ) - { - int new_size = b->yy_buf_size * 2; - - if ( new_size <= 0 ) - b->yy_buf_size += b->yy_buf_size / 8; - else - b->yy_buf_size *= 2; - - b->yy_ch_buf = (char *) - /* Include room in for 2 EOB chars. */ - yy_flex_realloc( (void *) b->yy_ch_buf, - b->yy_buf_size + 2 ); - } - else - /* Can't grow it, we don't own it. */ - b->yy_ch_buf = 0; - - if ( ! b->yy_ch_buf ) - YY_FATAL_ERROR( - "fatal error - scanner input buffer overflow" ); - - yy_c_buf_p = &b->yy_ch_buf[yy_c_buf_p_offset]; - - num_to_read = yy_current_buffer->yy_buf_size - - number_to_move - 1; -#endif - } - - if ( num_to_read > YY_READ_BUF_SIZE ) - num_to_read = YY_READ_BUF_SIZE; - - /* Read in more data. */ - YY_INPUT( (&yy_current_buffer->yy_ch_buf[number_to_move]), - yy_n_chars, num_to_read ); - - yy_current_buffer->yy_n_chars = yy_n_chars; - } - - if ( yy_n_chars == 0 ) - { - if ( number_to_move == YY_MORE_ADJ ) - { - ret_val = EOB_ACT_END_OF_FILE; - yyrestart( yyin ); - } - - else - { - ret_val = EOB_ACT_LAST_MATCH; - yy_current_buffer->yy_buffer_status = - YY_BUFFER_EOF_PENDING; - } - } - - else - ret_val = EOB_ACT_CONTINUE_SCAN; - - yy_n_chars += number_to_move; - yy_current_buffer->yy_ch_buf[yy_n_chars] = YY_END_OF_BUFFER_CHAR; - yy_current_buffer->yy_ch_buf[yy_n_chars + 1] = YY_END_OF_BUFFER_CHAR; - - yytext_ptr = &yy_current_buffer->yy_ch_buf[0]; - - return ret_val; - } - - -/* yy_get_previous_state - get the state just before the EOB char was reached */ - -static yy_state_type yy_get_previous_state() - { - register yy_state_type yy_current_state; - register char *yy_cp; - - yy_current_state = yy_start; - - for ( yy_cp = yytext_ptr + YY_MORE_ADJ; yy_cp < yy_c_buf_p; ++yy_cp ) - { - register YY_CHAR yy_c = (*yy_cp ? yy_ec[YY_SC_TO_UI(*yy_cp)] : 1); - if ( yy_accept[yy_current_state] ) - { - yy_last_accepting_state = yy_current_state; - yy_last_accepting_cpos = yy_cp; - } - while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state ) - { - yy_current_state = (int) yy_def[yy_current_state]; - if ( yy_current_state >= 86 ) - yy_c = yy_meta[(unsigned int) yy_c]; - } - yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c]; - } - - return yy_current_state; - } - - -/* yy_try_NUL_trans - try to make a transition on the NUL character - * - * synopsis - * next_state = yy_try_NUL_trans( current_state ); - */ - -#ifdef YY_USE_PROTOS -static yy_state_type yy_try_NUL_trans( yy_state_type yy_current_state ) -#else -static yy_state_type yy_try_NUL_trans( yy_current_state ) -yy_state_type yy_current_state; -#endif - { - register int yy_is_jam; - register char *yy_cp = yy_c_buf_p; - - register YY_CHAR yy_c = 1; - if ( yy_accept[yy_current_state] ) - { - yy_last_accepting_state = yy_current_state; - yy_last_accepting_cpos = yy_cp; - } - while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state ) - { - yy_current_state = (int) yy_def[yy_current_state]; - if ( yy_current_state >= 86 ) - yy_c = yy_meta[(unsigned int) yy_c]; - } - yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c]; - yy_is_jam = (yy_current_state == 85); - - return yy_is_jam ? 0 : yy_current_state; - } - - -#ifndef YY_NO_UNPUT -#ifdef YY_USE_PROTOS -static void yyunput( int c, register char *yy_bp ) -#else -static void yyunput( c, yy_bp ) -int c; -register char *yy_bp; -#endif - { - register char *yy_cp = yy_c_buf_p; - - /* undo effects of setting up yytext */ - *yy_cp = yy_hold_char; - - if ( yy_cp < yy_current_buffer->yy_ch_buf + 2 ) - { /* need to shift things up to make room */ - /* +2 for EOB chars. */ - register int number_to_move = yy_n_chars + 2; - register char *dest = &yy_current_buffer->yy_ch_buf[ - yy_current_buffer->yy_buf_size + 2]; - register char *source = - &yy_current_buffer->yy_ch_buf[number_to_move]; - - while ( source > yy_current_buffer->yy_ch_buf ) - *--dest = *--source; - - yy_cp += (int) (dest - source); - yy_bp += (int) (dest - source); - yy_current_buffer->yy_n_chars = - yy_n_chars = yy_current_buffer->yy_buf_size; - - if ( yy_cp < yy_current_buffer->yy_ch_buf + 2 ) - YY_FATAL_ERROR( "flex scanner push-back overflow" ); - } - - *--yy_cp = (char) c; - - - yytext_ptr = yy_bp; - yy_hold_char = *yy_cp; - yy_c_buf_p = yy_cp; - } -#endif /* ifndef YY_NO_UNPUT */ - - -#ifdef __cplusplus -static int yyinput() -#else -static int input() -#endif - { - int c; - - *yy_c_buf_p = yy_hold_char; - - if ( *yy_c_buf_p == YY_END_OF_BUFFER_CHAR ) - { - /* yy_c_buf_p now points to the character we want to return. - * If this occurs *before* the EOB characters, then it's a - * valid NUL; if not, then we've hit the end of the buffer. - */ - if ( yy_c_buf_p < &yy_current_buffer->yy_ch_buf[yy_n_chars] ) - /* This was really a NUL. */ - *yy_c_buf_p = '\0'; - - else - { /* need more input */ - int offset = yy_c_buf_p - yytext_ptr; - ++yy_c_buf_p; - - switch ( yy_get_next_buffer() ) - { - case EOB_ACT_LAST_MATCH: - /* This happens because yy_g_n_b() - * sees that we've accumulated a - * token and flags that we need to - * try matching the token before - * proceeding. But for input(), - * there's no matching to consider. - * So convert the EOB_ACT_LAST_MATCH - * to EOB_ACT_END_OF_FILE. - */ - - /* Reset buffer status. */ - yyrestart( yyin ); - - /* fall through */ - - case EOB_ACT_END_OF_FILE: - { - if ( yywrap() ) - return EOF; - - if ( ! yy_did_buffer_switch_on_eof ) - YY_NEW_FILE; -#ifdef __cplusplus - return yyinput(); -#else - return input(); -#endif - } - - case EOB_ACT_CONTINUE_SCAN: - yy_c_buf_p = yytext_ptr + offset; - break; - } - } - } - - c = *(unsigned char *) yy_c_buf_p; /* cast for 8-bit char's */ - *yy_c_buf_p = '\0'; /* preserve yytext */ - yy_hold_char = *++yy_c_buf_p; - - - return c; - } - - -#ifdef YY_USE_PROTOS -void yyrestart( FILE *input_file ) -#else -void yyrestart( input_file ) -FILE *input_file; -#endif - { - if ( ! yy_current_buffer ) - yy_current_buffer = yy_create_buffer( yyin, YY_BUF_SIZE ); - - yy_init_buffer( yy_current_buffer, input_file ); - yy_load_buffer_state(); - } - - -#ifdef YY_USE_PROTOS -void yy_switch_to_buffer( YY_BUFFER_STATE new_buffer ) -#else -void yy_switch_to_buffer( new_buffer ) -YY_BUFFER_STATE new_buffer; -#endif - { - if ( yy_current_buffer == new_buffer ) - return; - - if ( yy_current_buffer ) - { - /* Flush out information for old buffer. */ - *yy_c_buf_p = yy_hold_char; - yy_current_buffer->yy_buf_pos = yy_c_buf_p; - yy_current_buffer->yy_n_chars = yy_n_chars; - } - - yy_current_buffer = new_buffer; - yy_load_buffer_state(); - - /* We don't actually know whether we did this switch during - * EOF (yywrap()) processing, but the only time this flag - * is looked at is after yywrap() is called, so it's safe - * to go ahead and always set it. - */ - yy_did_buffer_switch_on_eof = 1; - } - - -#ifdef YY_USE_PROTOS -void yy_load_buffer_state( void ) -#else -void yy_load_buffer_state() -#endif - { - yy_n_chars = yy_current_buffer->yy_n_chars; - yytext_ptr = yy_c_buf_p = yy_current_buffer->yy_buf_pos; - yyin = yy_current_buffer->yy_input_file; - yy_hold_char = *yy_c_buf_p; - } - - -#ifdef YY_USE_PROTOS -YY_BUFFER_STATE yy_create_buffer( FILE *file, int size ) -#else -YY_BUFFER_STATE yy_create_buffer( file, size ) -FILE *file; -int size; -#endif - { - YY_BUFFER_STATE b; - - b = (YY_BUFFER_STATE) yy_flex_alloc( sizeof( struct yy_buffer_state ) ); - if ( ! b ) - YY_FATAL_ERROR( "out of dynamic memory in yy_create_buffer()" ); - - b->yy_buf_size = size; - - /* yy_ch_buf has to be 2 characters longer than the size given because - * we need to put in 2 end-of-buffer characters. - */ - b->yy_ch_buf = (char *) yy_flex_alloc( b->yy_buf_size + 2 ); - if ( ! b->yy_ch_buf ) - YY_FATAL_ERROR( "out of dynamic memory in yy_create_buffer()" ); - - b->yy_is_our_buffer = 1; - - yy_init_buffer( b, file ); - - return b; - } - - -#ifdef YY_USE_PROTOS -void yy_delete_buffer( YY_BUFFER_STATE b ) -#else -void yy_delete_buffer( b ) -YY_BUFFER_STATE b; -#endif - { - if ( ! b ) - return; - - if ( b == yy_current_buffer ) - yy_current_buffer = (YY_BUFFER_STATE) 0; - - if ( b->yy_is_our_buffer ) - yy_flex_free( (void *) b->yy_ch_buf ); - - yy_flex_free( (void *) b ); - } - - -#ifndef YY_ALWAYS_INTERACTIVE -#ifndef YY_NEVER_INTERACTIVE -extern int isatty YY_PROTO(( int )); -#endif -#endif - -#ifdef YY_USE_PROTOS -void yy_init_buffer( YY_BUFFER_STATE b, FILE *file ) -#else -void yy_init_buffer( b, file ) -YY_BUFFER_STATE b; -FILE *file; -#endif - - - { - yy_flush_buffer( b ); - - b->yy_input_file = file; - b->yy_fill_buffer = 1; - -#if YY_ALWAYS_INTERACTIVE - b->yy_is_interactive = 1; -#else -#if YY_NEVER_INTERACTIVE - b->yy_is_interactive = 0; -#else - b->yy_is_interactive = file ? (isatty( fileno(file) ) > 0) : 0; -#endif -#endif - } - - -#ifdef YY_USE_PROTOS -void yy_flush_buffer( YY_BUFFER_STATE b ) -#else -void yy_flush_buffer( b ) -YY_BUFFER_STATE b; -#endif - - { - if ( ! b ) - return; - - b->yy_n_chars = 0; - - /* We always need two end-of-buffer characters. The first causes - * a transition to the end-of-buffer state. The second causes - * a jam in that state. - */ - b->yy_ch_buf[0] = YY_END_OF_BUFFER_CHAR; - b->yy_ch_buf[1] = YY_END_OF_BUFFER_CHAR; - - b->yy_buf_pos = &b->yy_ch_buf[0]; - - b->yy_at_bol = 1; - b->yy_buffer_status = YY_BUFFER_NEW; - - if ( b == yy_current_buffer ) - yy_load_buffer_state(); - } - - -#ifndef YY_NO_SCAN_BUFFER -#ifdef YY_USE_PROTOS -YY_BUFFER_STATE yy_scan_buffer( char *base, yy_size_t size ) -#else -YY_BUFFER_STATE yy_scan_buffer( base, size ) -char *base; -yy_size_t size; -#endif - { - YY_BUFFER_STATE b; - - if ( size < 2 || - base[size-2] != YY_END_OF_BUFFER_CHAR || - base[size-1] != YY_END_OF_BUFFER_CHAR ) - /* They forgot to leave room for the EOB's. */ - return 0; - - b = (YY_BUFFER_STATE) yy_flex_alloc( sizeof( struct yy_buffer_state ) ); - if ( ! b ) - YY_FATAL_ERROR( "out of dynamic memory in yy_scan_buffer()" ); - - b->yy_buf_size = size - 2; /* "- 2" to take care of EOB's */ - b->yy_buf_pos = b->yy_ch_buf = base; - b->yy_is_our_buffer = 0; - b->yy_input_file = 0; - b->yy_n_chars = b->yy_buf_size; - b->yy_is_interactive = 0; - b->yy_at_bol = 1; - b->yy_fill_buffer = 0; - b->yy_buffer_status = YY_BUFFER_NEW; - - yy_switch_to_buffer( b ); - - return b; - } -#endif - - -#ifndef YY_NO_SCAN_STRING -#ifdef YY_USE_PROTOS -YY_BUFFER_STATE yy_scan_string( yyconst char *yy_str ) -#else -YY_BUFFER_STATE yy_scan_string( yy_str ) -yyconst char *yy_str; -#endif - { - int len; - for ( len = 0; yy_str[len]; ++len ) - ; - - return yy_scan_bytes( yy_str, len ); - } -#endif - - -#ifndef YY_NO_SCAN_BYTES -#ifdef YY_USE_PROTOS -YY_BUFFER_STATE yy_scan_bytes( yyconst char *bytes, int len ) -#else -YY_BUFFER_STATE yy_scan_bytes( bytes, len ) -yyconst char *bytes; -int len; -#endif - { - YY_BUFFER_STATE b; - char *buf; - yy_size_t n; - int i; - - /* Get memory for full buffer, including space for trailing EOB's. */ - n = len + 2; - buf = (char *) yy_flex_alloc( n ); - if ( ! buf ) - YY_FATAL_ERROR( "out of dynamic memory in yy_scan_bytes()" ); - - for ( i = 0; i < len; ++i ) - buf[i] = bytes[i]; - - buf[len] = buf[len+1] = YY_END_OF_BUFFER_CHAR; - - b = yy_scan_buffer( buf, n ); - if ( ! b ) - YY_FATAL_ERROR( "bad buffer in yy_scan_bytes()" ); - - /* It's okay to grow etc. this buffer, and we should throw it - * away when we're done. - */ - b->yy_is_our_buffer = 1; - - return b; - } -#endif - - -#ifndef YY_NO_PUSH_STATE -#ifdef YY_USE_PROTOS -static void yy_push_state( int new_state ) -#else -static void yy_push_state( new_state ) -int new_state; -#endif - { - if ( yy_start_stack_ptr >= yy_start_stack_depth ) - { - yy_size_t new_size; - - yy_start_stack_depth += YY_START_STACK_INCR; - new_size = yy_start_stack_depth * sizeof( int ); - - if ( ! yy_start_stack ) - yy_start_stack = (int *) yy_flex_alloc( new_size ); - - else - yy_start_stack = (int *) yy_flex_realloc( - (void *) yy_start_stack, new_size ); - - if ( ! yy_start_stack ) - YY_FATAL_ERROR( - "out of memory expanding start-condition stack" ); - } - - yy_start_stack[yy_start_stack_ptr++] = YY_START; - - BEGIN(new_state); - } -#endif - - -#ifndef YY_NO_POP_STATE -static void yy_pop_state() - { - if ( --yy_start_stack_ptr < 0 ) - YY_FATAL_ERROR( "start-condition stack underflow" ); - - BEGIN(yy_start_stack[yy_start_stack_ptr]); - } -#endif - - -#ifndef YY_NO_TOP_STATE -static int yy_top_state() - { - return yy_start_stack[yy_start_stack_ptr - 1]; - } -#endif - -#ifndef YY_EXIT_FAILURE -#define YY_EXIT_FAILURE 2 -#endif - -#ifdef YY_USE_PROTOS -static void yy_fatal_error( yyconst char msg[] ) -#else -static void yy_fatal_error( msg ) -char msg[]; -#endif - { - (void) fprintf( stderr, "%s\n", msg ); - exit( YY_EXIT_FAILURE ); - } - - - -/* Redefine yyless() so it works in section 3 code. */ - -#undef yyless -#define yyless(n) \ - do \ - { \ - /* Undo effects of setting up yytext. */ \ - yytext[yyleng] = yy_hold_char; \ - yy_c_buf_p = yytext + n; \ - yy_hold_char = *yy_c_buf_p; \ - *yy_c_buf_p = '\0'; \ - yyleng = n; \ - } \ - while ( 0 ) - - -/* Internal utility routines. */ - -#ifndef yytext_ptr -#ifdef YY_USE_PROTOS -static void yy_flex_strncpy( char *s1, yyconst char *s2, int n ) -#else -static void yy_flex_strncpy( s1, s2, n ) -char *s1; -yyconst char *s2; -int n; -#endif - { - register int i; - for ( i = 0; i < n; ++i ) - s1[i] = s2[i]; - } -#endif - -#ifdef YY_NEED_STRLEN -#ifdef YY_USE_PROTOS -static int yy_flex_strlen( yyconst char *s ) -#else -static int yy_flex_strlen( s ) -yyconst char *s; -#endif - { - register int n; - for ( n = 0; s[n]; ++n ) - ; - - return n; - } -#endif - - -#ifdef YY_USE_PROTOS -static void *yy_flex_alloc( yy_size_t size ) -#else -static void *yy_flex_alloc( size ) -yy_size_t size; -#endif - { - return (void *) malloc( size ); - } - -#ifdef YY_USE_PROTOS -static void *yy_flex_realloc( void *ptr, yy_size_t size ) -#else -static void *yy_flex_realloc( ptr, size ) -void *ptr; -yy_size_t size; -#endif - { - /* The cast to (char *) in the following accommodates both - * implementations that use char* generic pointers, and those - * that use void* generic pointers. It works with the latter - * because both ANSI C and C++ allow castless assignment from - * any pointer type to void*, and deal with argument conversions - * as though doing an assignment. - */ - return (void *) realloc( (char *) ptr, size ); - } - -#ifdef YY_USE_PROTOS -static void yy_flex_free( void *ptr ) -#else -static void yy_flex_free( ptr ) -void *ptr; -#endif - { - free( ptr ); - } - -#if YY_MAIN -int main() - { - yylex(); - return 0; - } -#endif -#line 247 "ssl_expr_scan.l" - - -int yyinput(char *buf, int max_size) -{ - int n; - - if ((n = MIN(max_size, ssl_expr_info.inputbuf - + ssl_expr_info.inputlen - - ssl_expr_info.inputptr)) <= 0) - return YY_NULL; - memcpy(buf, ssl_expr_info.inputptr, n); - ssl_expr_info.inputptr += n; - return n; -} - diff --git a/modules/ssl/ssl_expr_scan.l b/modules/ssl/ssl_expr_scan.l deleted file mode 100644 index a0db7cccdeb920e6edc92f18f13581eef920beec..0000000000000000000000000000000000000000 --- a/modules/ssl/ssl_expr_scan.l +++ /dev/null @@ -1,261 +0,0 @@ -/* _ _ -** _ __ ___ ___ __| | ___ ___| | -** | '_ ` _ \ / _ \ / _` | / __/ __| | -** | | | | | | (_) | (_| | \__ \__ \ | mod_ssl - Apache Interface to OpenSSL -** |_| |_| |_|\___/ \__,_|___|___/___/_| http://www.modssl.org/ -** |_____| -** ssl_expr_scan.l -** Expression Scanner -*/ - -/* ==================================================================== - * Copyright (c) 1998-2001 Ralf S. Engelschall. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following - * disclaimer in the documentation and/or other materials - * provided with the distribution. - * - * 3. All advertising materials mentioning features or use of this - * software must display the following acknowledgment: - * "This product includes software developed by - * Ralf S. Engelschall for use in the - * mod_ssl project (http://www.modssl.org/)." - * - * 4. The names "mod_ssl" must not be used to endorse or promote - * products derived from this software without prior written - * permission. For written permission, please contact - * rse@engelschall.com. - * - * 5. Products derived from this software may not be called "mod_ssl" - * nor may "mod_ssl" appear in their names without prior - * written permission of Ralf S. Engelschall. - * - * 6. Redistributions of any form whatsoever must retain the following - * acknowledgment: - * "This product includes software developed by - * Ralf S. Engelschall for use in the - * mod_ssl project (http://www.modssl.org/)." - * - * THIS SOFTWARE IS PROVIDED BY RALF S. ENGELSCHALL ``AS IS'' AND ANY - * EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR - * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL RALF S. ENGELSCHALL OR - * HIS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT - * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, - * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED - * OF THE POSSIBILITY OF SUCH DAMAGE. - * ==================================================================== - */ - - /* ``Killing for peace is - like fucking for virginity.'' - -- Unknown */ - -/* _________________________________________________________________ -** -** Expression Scanner -** _________________________________________________________________ -*/ - -%{ -#include "mod_ssl.h" - -#include "ssl_expr_parse.h" - -#define YY_NO_UNPUT 1 -int yyinput(char *buf, int max_size); - -#undef YY_INPUT -#define YY_INPUT(buf,result,max_size) \ - (result = yyinput(buf, max_size)) - -#define MAX_STR_LEN 2048 -%} - -%pointer -/* %option stack */ -%option never-interactive -%option noyywrap -%x str -%x regex regex_flags - -%% - - char caStr[MAX_STR_LEN]; - char *cpStr = NULL; - char caRegex[MAX_STR_LEN]; - char *cpRegex = NULL; - char cRegexDel = NUL; - - /* - * Whitespaces - */ -[ \t\n]+ { - /* NOP */ -} - - /* - * C-style strings ("...") - */ -\" { - cpStr = caStr; - BEGIN(str); -} -\" { - BEGIN(INITIAL); - *cpStr = NUL; - yylval.cpVal = ap_pstrdup(ssl_expr_info.pool, caStr); - return T_STRING; -} -\n { - yyerror("Unterminated string"); -} -\\[0-7]{1,3} { - int result; - - (void)sscanf(yytext+1, "%o", &result); - if (result > 0xff) - yyerror("Escape sequence out of bound"); - else - *cpStr++ = result; -} -\\[0-9]+ { - yyerror("Bad escape sequence"); -} -\\n { *cpStr++ = '\n'; } -\\r { *cpStr++ = '\r'; } -\\t { *cpStr++ = '\t'; } -\\b { *cpStr++ = '\b'; } -\\f { *cpStr++ = '\f'; } -\\(.|\n) { - *cpStr++ = yytext[1]; -} -[^\\\n\"]+ { - char *cp = yytext; - while (*cp != NUL) - *cpStr++ = *cp++; -} -. { - *cpStr++ = yytext[1]; -} - - /* - * Regular Expression - */ -"m". { - cRegexDel = yytext[1]; - cpRegex = caRegex; - BEGIN(regex); -} -.|\n { - if (yytext[0] == cRegexDel) { - *cpRegex = NUL; - BEGIN(regex_flags); - } - else { - *cpRegex++ = yytext[0]; - } -} -i { - yylval.cpVal = ap_pstrdup(ssl_expr_info.pool, caRegex); - BEGIN(INITIAL); - return T_REGEX_I; -} -.|\n { - yylval.cpVal = ap_pstrdup(ssl_expr_info.pool, caRegex); - yyless(0); - BEGIN(INITIAL); - return T_REGEX; -} -<> { - yylval.cpVal = ap_pstrdup(ssl_expr_info.pool, caRegex); - BEGIN(INITIAL); - return T_REGEX; -} - - /* - * Operators - */ -"eq" { return T_OP_EQ; } -"==" { return T_OP_EQ; } -"ne" { return T_OP_NE; } -"!=" { return T_OP_NE; } -"lt" { return T_OP_LT; } -"<" { return T_OP_LT; } -"le" { return T_OP_LE; } -"<=" { return T_OP_LE; } -"gt" { return T_OP_GT; } -">" { return T_OP_GT; } -"ge" { return T_OP_GE; } -">=" { return T_OP_GE; } -"=~" { return T_OP_REG; } -"!~" { return T_OP_NRE; } -"and" { return T_OP_AND; } -"&&" { return T_OP_AND; } -"or" { return T_OP_OR; } -"||" { return T_OP_OR; } -"not" { return T_OP_NOT; } -"!" { return T_OP_NOT; } -"in" { return T_OP_IN; } - - /* - * Functions - */ -"file" { return T_FUNC_FILE; } - - /* - * Specials - */ -"true" { return T_TRUE; } -"false" { return T_FALSE; } - - /* - * Digits - */ -[0-9]+ { - yylval.cpVal = ap_pstrdup(ssl_expr_info.pool, yytext); - return T_DIGIT; -} - - /* - * Identifiers - */ -[a-zA-Z][a-zA-Z0-9_:-]* { - yylval.cpVal = ap_pstrdup(ssl_expr_info.pool, yytext); - return T_ID; -} - - /* - * Anything else is returned as is... - */ -.|\n { - return yytext[0]; -} - -%% - -int yyinput(char *buf, int max_size) -{ - int n; - - if ((n = MIN(max_size, ssl_expr_info.inputbuf - + ssl_expr_info.inputlen - - ssl_expr_info.inputptr)) <= 0) - return YY_NULL; - memcpy(buf, ssl_expr_info.inputptr, n); - ssl_expr_info.inputptr += n; - return n; -} - diff --git a/modules/ssl/ssl_scache.c b/modules/ssl/ssl_scache.c deleted file mode 100644 index 139c7865fec7333df780be886b7483f32a2fa5ad..0000000000000000000000000000000000000000 --- a/modules/ssl/ssl_scache.c +++ /dev/null @@ -1,204 +0,0 @@ -/* _ _ -** _ __ ___ ___ __| | ___ ___| | mod_ssl -** | '_ ` _ \ / _ \ / _` | / __/ __| | Apache Interface to OpenSSL -** | | | | | | (_) | (_| | \__ \__ \ | www.modssl.org -** |_| |_| |_|\___/ \__,_|___|___/___/_| ftp.modssl.org -** |_____| -** ssl_scache.c -** Session Cache Abstraction -*/ - -/* ==================================================================== - * Copyright (c) 1998-2001 Ralf S. Engelschall. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following - * disclaimer in the documentation and/or other materials - * provided with the distribution. - * - * 3. All advertising materials mentioning features or use of this - * software must display the following acknowledgment: - * "This product includes software developed by - * Ralf S. Engelschall for use in the - * mod_ssl project (http://www.modssl.org/)." - * - * 4. The names "mod_ssl" must not be used to endorse or promote - * products derived from this software without prior written - * permission. For written permission, please contact - * rse@engelschall.com. - * - * 5. Products derived from this software may not be called "mod_ssl" - * nor may "mod_ssl" appear in their names without prior - * written permission of Ralf S. Engelschall. - * - * 6. Redistributions of any form whatsoever must retain the following - * acknowledgment: - * "This product includes software developed by - * Ralf S. Engelschall for use in the - * mod_ssl project (http://www.modssl.org/)." - * - * THIS SOFTWARE IS PROVIDED BY RALF S. ENGELSCHALL ``AS IS'' AND ANY - * EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR - * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL RALF S. ENGELSCHALL OR - * HIS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT - * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, - * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED - * OF THE POSSIBILITY OF SUCH DAMAGE. - * ==================================================================== - */ - /* ``Open-Source Software: generous - programmers from around the world all - join forces to help you shoot - yourself in the foot for free.'' - -- Unknown */ -#include "mod_ssl.h" - -/* _________________________________________________________________ -** -** Session Cache: Common Abstraction Layer -** _________________________________________________________________ -*/ - -void ssl_scache_init(server_rec *s, pool *p) -{ - SSLModConfigRec *mc = myModConfig(); - - if (mc->nSessionCacheMode == SSL_SCMODE_DBM) - ssl_scache_dbm_init(s, p); - else if (mc->nSessionCacheMode == SSL_SCMODE_SHMHT) - ssl_scache_shmht_init(s, p); - else if (mc->nSessionCacheMode == SSL_SCMODE_SHMCB) - ssl_scache_shmcb_init(s, p); -#ifdef SSL_VENDOR - else - ap_hook_use("ap::mod_ssl::vendor::scache_init", - AP_HOOK_SIG3(void,ptr,ptr), AP_HOOK_ALL, s, p); -#endif - return; -} - -void ssl_scache_kill(server_rec *s) -{ - SSLModConfigRec *mc = myModConfig(); - - if (mc->nSessionCacheMode == SSL_SCMODE_DBM) - ssl_scache_dbm_kill(s); - else if (mc->nSessionCacheMode == SSL_SCMODE_SHMHT) - ssl_scache_shmht_kill(s); - else if (mc->nSessionCacheMode == SSL_SCMODE_SHMCB) - ssl_scache_shmcb_kill(s); -#ifdef SSL_VENDOR - else - ap_hook_use("ap::mod_ssl::vendor::scache_kill", - AP_HOOK_SIG2(void,ptr), AP_HOOK_ALL, s); -#endif - return; -} - -BOOL ssl_scache_store(server_rec *s, UCHAR *id, int idlen, time_t expiry, SSL_SESSION *sess) -{ - SSLModConfigRec *mc = myModConfig(); - BOOL rv = FALSE; - - if (mc->nSessionCacheMode == SSL_SCMODE_DBM) - rv = ssl_scache_dbm_store(s, id, idlen, expiry, sess); - else if (mc->nSessionCacheMode == SSL_SCMODE_SHMHT) - rv = ssl_scache_shmht_store(s, id, idlen, expiry, sess); - else if (mc->nSessionCacheMode == SSL_SCMODE_SHMCB) - rv = ssl_scache_shmcb_store(s, id, idlen, expiry, sess); -#ifdef SSL_VENDOR - else - ap_hook_use("ap::mod_ssl::vendor::scache_store", - AP_HOOK_SIG6(int,ptr,ptr,int,int,ptr), AP_HOOK_ALL, - (int *)&rv, s, id, idlen, (int)expiry, sess); -#endif - return rv; -} - -SSL_SESSION *ssl_scache_retrieve(server_rec *s, UCHAR *id, int idlen) -{ - SSLModConfigRec *mc = myModConfig(); - SSL_SESSION *sess = NULL; - - if (mc->nSessionCacheMode == SSL_SCMODE_DBM) - sess = ssl_scache_dbm_retrieve(s, id, idlen); - else if (mc->nSessionCacheMode == SSL_SCMODE_SHMHT) - sess = ssl_scache_shmht_retrieve(s, id, idlen); - else if (mc->nSessionCacheMode == SSL_SCMODE_SHMCB) - sess = ssl_scache_shmcb_retrieve(s, id, idlen); -#ifdef SSL_VENDOR - else - ap_hook_use("ap::mod_ssl::vendor::scache_retrieve", - AP_HOOK_SIG4(ptr,ptr,ptr,int), AP_HOOK_ALL, - &sess, s, id, idlen); -#endif - return sess; -} - -void ssl_scache_remove(server_rec *s, UCHAR *id, int idlen) -{ - SSLModConfigRec *mc = myModConfig(); - - if (mc->nSessionCacheMode == SSL_SCMODE_DBM) - ssl_scache_dbm_remove(s, id, idlen); - else if (mc->nSessionCacheMode == SSL_SCMODE_SHMHT) - ssl_scache_shmht_remove(s, id, idlen); - else if (mc->nSessionCacheMode == SSL_SCMODE_SHMCB) - ssl_scache_shmcb_remove(s, id, idlen); -#ifdef SSL_VENDOR - else - ap_hook_use("ap::mod_ssl::vendor::scache_remove", - AP_HOOK_SIG4(void,ptr,ptr,int), AP_HOOK_ALL, s, id, idlen); -#endif - return; -} - -void ssl_scache_status(server_rec *s, pool *p, void (*func)(char *, void *), void *arg) -{ - SSLModConfigRec *mc = myModConfig(); - - if (mc->nSessionCacheMode == SSL_SCMODE_DBM) - ssl_scache_dbm_status(s, p, func, arg); - else if (mc->nSessionCacheMode == SSL_SCMODE_SHMHT) - ssl_scache_shmht_status(s, p, func, arg); - else if (mc->nSessionCacheMode == SSL_SCMODE_SHMCB) - ssl_scache_shmcb_status(s, p, func, arg); -#ifdef SSL_VENDOR - else - ap_hook_use("ap::mod_ssl::vendor::scache_status", - AP_HOOK_SIG5(void,ptr,ptr,ptr,ptr), AP_HOOK_ALL, - s, p, func, arg); -#endif - return; -} - -void ssl_scache_expire(server_rec *s) -{ - SSLModConfigRec *mc = myModConfig(); - - if (mc->nSessionCacheMode == SSL_SCMODE_DBM) - ssl_scache_dbm_expire(s); - else if (mc->nSessionCacheMode == SSL_SCMODE_SHMHT) - ssl_scache_shmht_expire(s); - else if (mc->nSessionCacheMode == SSL_SCMODE_SHMCB) - ssl_scache_shmcb_expire(s); -#ifdef SSL_VENDOR - else - ap_hook_use("ap::mod_ssl::vendor::scache_expire", - AP_HOOK_SIG2(void,ptr), AP_HOOK_ALL, s); -#endif - return; -} - diff --git a/modules/ssl/ssl_scache_dbm.c b/modules/ssl/ssl_scache_dbm.c deleted file mode 100644 index 323c61299189d7c18e58b2e73076c53301f88e72..0000000000000000000000000000000000000000 --- a/modules/ssl/ssl_scache_dbm.c +++ /dev/null @@ -1,440 +0,0 @@ -/* _ _ -** _ __ ___ ___ __| | ___ ___| | mod_ssl -** | '_ ` _ \ / _ \ / _` | / __/ __| | Apache Interface to OpenSSL -** | | | | | | (_) | (_| | \__ \__ \ | www.modssl.org -** |_| |_| |_|\___/ \__,_|___|___/___/_| ftp.modssl.org -** |_____| -** ssl_scache_dbm.c -** Session Cache via DBM -*/ - -/* ==================================================================== - * Copyright (c) 1998-2001 Ralf S. Engelschall. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following - * disclaimer in the documentation and/or other materials - * provided with the distribution. - * - * 3. All advertising materials mentioning features or use of this - * software must display the following acknowledgment: - * "This product includes software developed by - * Ralf S. Engelschall for use in the - * mod_ssl project (http://www.modssl.org/)." - * - * 4. The names "mod_ssl" must not be used to endorse or promote - * products derived from this software without prior written - * permission. For written permission, please contact - * rse@engelschall.com. - * - * 5. Products derived from this software may not be called "mod_ssl" - * nor may "mod_ssl" appear in their names without prior - * written permission of Ralf S. Engelschall. - * - * 6. Redistributions of any form whatsoever must retain the following - * acknowledgment: - * "This product includes software developed by - * Ralf S. Engelschall for use in the - * mod_ssl project (http://www.modssl.org/)." - * - * THIS SOFTWARE IS PROVIDED BY RALF S. ENGELSCHALL ``AS IS'' AND ANY - * EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR - * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL RALF S. ENGELSCHALL OR - * HIS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT - * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, - * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED - * OF THE POSSIBILITY OF SUCH DAMAGE. - * ==================================================================== - */ - -#include "mod_ssl.h" - -void ssl_scache_dbm_init(server_rec *s, pool *p) -{ - SSLModConfigRec *mc = myModConfig(); - DBM *dbm; - - /* for the DBM we need the data file */ - if (mc->szSessionCacheDataFile == NULL) { - ssl_log(s, SSL_LOG_ERROR, "SSLSessionCache required"); - ssl_die(); - } - - /* open it once to create it and to make sure it _can_ be created */ - ssl_mutex_on(s); - if ((dbm = ssl_dbm_open(mc->szSessionCacheDataFile, - O_RDWR|O_CREAT, SSL_DBM_FILE_MODE)) == NULL) { - ssl_log(s, SSL_LOG_ERROR|SSL_ADD_ERRNO, - "Cannot create SSLSessionCache DBM file `%s'", - mc->szSessionCacheDataFile); - ssl_mutex_off(s); - return; - } - ssl_dbm_close(dbm); - -#if !defined(OS2) && !defined(WIN32) - /* - * We have to make sure the Apache child processes have access to - * the DBM file. But because there are brain-dead platforms where we - * cannot exactly determine the suffixes we try all possibilities. - */ - if (geteuid() == 0 /* is superuser */) { - chown(mc->szSessionCacheDataFile, ap_user_id, -1 /* no gid change */); - if (chown(ap_pstrcat(p, mc->szSessionCacheDataFile, SSL_DBM_FILE_SUFFIX_DIR, NULL), - ap_user_id, -1) == -1) { - if (chown(ap_pstrcat(p, mc->szSessionCacheDataFile, ".db", NULL), - ap_user_id, -1) == -1) - chown(ap_pstrcat(p, mc->szSessionCacheDataFile, ".dir", NULL), - ap_user_id, -1); - } - if (chown(ap_pstrcat(p, mc->szSessionCacheDataFile, SSL_DBM_FILE_SUFFIX_PAG, NULL), - ap_user_id, -1) == -1) { - if (chown(ap_pstrcat(p, mc->szSessionCacheDataFile, ".db", NULL), - ap_user_id, -1) == -1) - chown(ap_pstrcat(p, mc->szSessionCacheDataFile, ".pag", NULL), - ap_user_id, -1); - } - } -#endif - ssl_mutex_off(s); - ssl_scache_dbm_expire(s); - return; -} - -void ssl_scache_dbm_kill(server_rec *s) -{ - SSLModConfigRec *mc = myModConfig(); - pool *p; - - if ((p = ap_make_sub_pool(NULL)) != NULL) { - /* the correct way */ - unlink(ap_pstrcat(p, mc->szSessionCacheDataFile, SSL_DBM_FILE_SUFFIX_DIR, NULL)); - unlink(ap_pstrcat(p, mc->szSessionCacheDataFile, SSL_DBM_FILE_SUFFIX_PAG, NULL)); - /* the additional ways to be sure */ - unlink(ap_pstrcat(p, mc->szSessionCacheDataFile, ".dir", NULL)); - unlink(ap_pstrcat(p, mc->szSessionCacheDataFile, ".pag", NULL)); - unlink(ap_pstrcat(p, mc->szSessionCacheDataFile, ".db", NULL)); - unlink(mc->szSessionCacheDataFile); - ap_destroy_pool(p); - } - return; -} - -BOOL ssl_scache_dbm_store(server_rec *s, UCHAR *id, int idlen, time_t expiry, SSL_SESSION *sess) -{ - SSLModConfigRec *mc = myModConfig(); - DBM *dbm; - datum dbmkey; - datum dbmval; - UCHAR ucaData[SSL_SESSION_MAX_DER]; - int nData; - UCHAR *ucp; - - /* streamline session data */ - ucp = ucaData; - nData = i2d_SSL_SESSION(sess, &ucp); - - /* be careful: do not try to store too much bytes in a DBM file! */ -#ifdef SSL_USE_SDBM - if ((idlen + nData) >= PAIRMAX) - return FALSE; -#else - if ((idlen + nData) >= 950 /* at least less than approx. 1KB */) - return FALSE; -#endif - - /* create DBM key */ - dbmkey.dptr = (char *)id; - dbmkey.dsize = idlen; - - /* create DBM value */ - dbmval.dsize = sizeof(time_t) + nData; - dbmval.dptr = (char *)malloc(dbmval.dsize); - if (dbmval.dptr == NULL) - return FALSE; - memcpy((char *)dbmval.dptr, &expiry, sizeof(time_t)); - memcpy((char *)dbmval.dptr+sizeof(time_t), ucaData, nData); - - /* and store it to the DBM file */ - ssl_mutex_on(s); - if ((dbm = ssl_dbm_open(mc->szSessionCacheDataFile, - O_RDWR, SSL_DBM_FILE_MODE)) == NULL) { - ssl_log(s, SSL_LOG_ERROR|SSL_ADD_ERRNO, - "Cannot open SSLSessionCache DBM file `%s' for writing (store)", - mc->szSessionCacheDataFile); - ssl_mutex_off(s); - free(dbmval.dptr); - return FALSE; - } - if (ssl_dbm_store(dbm, dbmkey, dbmval, DBM_INSERT) < 0) { - ssl_log(s, SSL_LOG_ERROR|SSL_ADD_ERRNO, - "Cannot store SSL session to DBM file `%s'", - mc->szSessionCacheDataFile); - ssl_dbm_close(dbm); - ssl_mutex_off(s); - free(dbmval.dptr); - return FALSE; - } - ssl_dbm_close(dbm); - ssl_mutex_off(s); - - /* free temporary buffers */ - free(dbmval.dptr); - - /* allow the regular expiring to occur */ - ssl_scache_dbm_expire(s); - - return TRUE; -} - -SSL_SESSION *ssl_scache_dbm_retrieve(server_rec *s, UCHAR *id, int idlen) -{ - SSLModConfigRec *mc = myModConfig(); - DBM *dbm; - datum dbmkey; - datum dbmval; - SSL_SESSION *sess = NULL; - UCHAR *ucpData; - int nData; - time_t expiry; - time_t now; - - /* allow the regular expiring to occur */ - ssl_scache_dbm_expire(s); - - /* create DBM key and values */ - dbmkey.dptr = (char *)id; - dbmkey.dsize = idlen; - - /* and fetch it from the DBM file */ - ssl_mutex_on(s); - if ((dbm = ssl_dbm_open(mc->szSessionCacheDataFile, - O_RDONLY, SSL_DBM_FILE_MODE)) == NULL) { - ssl_log(s, SSL_LOG_ERROR|SSL_ADD_ERRNO, - "Cannot open SSLSessionCache DBM file `%s' for reading (fetch)", - mc->szSessionCacheDataFile); - ssl_mutex_off(s); - return NULL; - } - dbmval = ssl_dbm_fetch(dbm, dbmkey); - ssl_dbm_close(dbm); - ssl_mutex_off(s); - - /* immediately return if not found */ - if (dbmval.dptr == NULL || dbmval.dsize <= sizeof(time_t)) - return NULL; - - /* parse resulting data */ - nData = dbmval.dsize-sizeof(time_t); - ucpData = (UCHAR *)malloc(nData); - if (ucpData == NULL) - return NULL; - memcpy(ucpData, (char *)dbmval.dptr+sizeof(time_t), nData); - memcpy(&expiry, dbmval.dptr, sizeof(time_t)); - - /* make sure the stuff is still not expired */ - now = time(NULL); - if (expiry <= now) { - ssl_scache_dbm_remove(s, id, idlen); - return NULL; - } - - /* unstreamed SSL_SESSION */ - sess = d2i_SSL_SESSION(NULL, &ucpData, nData); - - return sess; -} - -void ssl_scache_dbm_remove(server_rec *s, UCHAR *id, int idlen) -{ - SSLModConfigRec *mc = myModConfig(); - DBM *dbm; - datum dbmkey; - - /* create DBM key and values */ - dbmkey.dptr = (char *)id; - dbmkey.dsize = idlen; - - /* and delete it from the DBM file */ - ssl_mutex_on(s); - if ((dbm = ssl_dbm_open(mc->szSessionCacheDataFile, - O_RDWR, SSL_DBM_FILE_MODE)) == NULL) { - ssl_log(s, SSL_LOG_ERROR|SSL_ADD_ERRNO, - "Cannot open SSLSessionCache DBM file `%s' for writing (delete)", - mc->szSessionCacheDataFile); - ssl_mutex_off(s); - return; - } - ssl_dbm_delete(dbm, dbmkey); - ssl_dbm_close(dbm); - ssl_mutex_off(s); - - return; -} - -void ssl_scache_dbm_expire(server_rec *s) -{ - SSLModConfigRec *mc = myModConfig(); - SSLSrvConfigRec *sc = mySrvConfig(s); - static time_t tLast = 0; - DBM *dbm; - datum dbmkey; - datum dbmval; - pool *p; - time_t tExpiresAt; - int nElements = 0; - int nDeleted = 0; - int bDelete; - datum *keylist; - int keyidx; - int i; - time_t tNow; - - /* - * make sure the expiration for still not-accessed session - * cache entries is done only from time to time - */ - tNow = time(NULL); - if (tNow < tLast+sc->nSessionCacheTimeout) - return; - tLast = tNow; - - /* - * Here we have to be very carefully: Not all DBM libraries are - * smart enough to allow one to iterate over the elements and at the - * same time delete expired ones. Some of them get totally crazy - * while others have no problems. So we have to do it the slower but - * more safe way: we first iterate over all elements and remember - * those which have to be expired. Then in a second pass we delete - * all those expired elements. Additionally we reopen the DBM file - * to be really safe in state. - */ - -#define KEYMAX 1024 - - ssl_mutex_on(s); - for (;;) { - /* allocate the key array in a memory sub pool */ - if ((p = ap_make_sub_pool(NULL)) == NULL) - break; - if ((keylist = ap_palloc(p, sizeof(dbmkey)*KEYMAX)) == NULL) { - ap_destroy_pool(p); - break; - } - - /* pass 1: scan DBM database */ - keyidx = 0; - if ((dbm = ssl_dbm_open(mc->szSessionCacheDataFile, - O_RDWR, SSL_DBM_FILE_MODE)) == NULL) { - ssl_log(s, SSL_LOG_ERROR|SSL_ADD_ERRNO, - "Cannot open SSLSessionCache DBM file `%s' for scanning", - mc->szSessionCacheDataFile); - ap_destroy_pool(p); - break; - } - dbmkey = ssl_dbm_firstkey(dbm); - while (dbmkey.dptr != NULL) { - nElements++; - bDelete = FALSE; - dbmval = ssl_dbm_fetch(dbm, dbmkey); - if (dbmval.dsize <= sizeof(time_t) || dbmval.dptr == NULL) - bDelete = TRUE; - else { - memcpy(&tExpiresAt, dbmval.dptr, sizeof(time_t)); - if (tExpiresAt <= tNow) - bDelete = TRUE; - } - if (bDelete) { - if ((keylist[keyidx].dptr = ap_palloc(p, dbmkey.dsize)) != NULL) { - memcpy(keylist[keyidx].dptr, dbmkey.dptr, dbmkey.dsize); - keylist[keyidx].dsize = dbmkey.dsize; - keyidx++; - if (keyidx == KEYMAX) - break; - } - } - dbmkey = ssl_dbm_nextkey(dbm); - } - ssl_dbm_close(dbm); - - /* pass 2: delete expired elements */ - if ((dbm = ssl_dbm_open(mc->szSessionCacheDataFile, - O_RDWR, SSL_DBM_FILE_MODE)) == NULL) { - ssl_log(s, SSL_LOG_ERROR|SSL_ADD_ERRNO, - "Cannot re-open SSLSessionCache DBM file `%s' for expiring", - mc->szSessionCacheDataFile); - ap_destroy_pool(p); - break; - } - for (i = 0; i < keyidx; i++) { - ssl_dbm_delete(dbm, keylist[i]); - nDeleted++; - } - ssl_dbm_close(dbm); - - /* destroy temporary pool */ - ap_destroy_pool(p); - - if (keyidx < KEYMAX) - break; - } - ssl_mutex_off(s); - - ssl_log(s, SSL_LOG_TRACE, "Inter-Process Session Cache (DBM) Expiry: " - "old: %d, new: %d, removed: %d", nElements, nElements-nDeleted, nDeleted); - return; -} - -void ssl_scache_dbm_status(server_rec *s, pool *p, void (*func)(char *, void *), void *arg) -{ - SSLModConfigRec *mc = myModConfig(); - DBM *dbm; - datum dbmkey; - datum dbmval; - int nElem; - int nSize; - int nAverage; - - nElem = 0; - nSize = 0; - ssl_mutex_on(s); - if ((dbm = ssl_dbm_open(mc->szSessionCacheDataFile, - O_RDONLY, SSL_DBM_FILE_MODE)) == NULL) { - ssl_log(s, SSL_LOG_ERROR|SSL_ADD_ERRNO, - "Cannot open SSLSessionCache DBM file `%s' for status retrival", - mc->szSessionCacheDataFile); - ssl_mutex_off(s); - return; - } - dbmkey = ssl_dbm_firstkey(dbm); - for ( ; dbmkey.dptr != NULL; dbmkey = ssl_dbm_nextkey(dbm)) { - dbmval = ssl_dbm_fetch(dbm, dbmkey); - if (dbmval.dptr == NULL) - continue; - nElem += 1; - nSize += dbmval.dsize; - } - ssl_dbm_close(dbm); - ssl_mutex_off(s); - if (nSize > 0 && nElem > 0) - nAverage = nSize / nElem; - else - nAverage = 0; - func(ap_psprintf(p, "cache type: DBM, maximum size: unlimited
    "), arg); - func(ap_psprintf(p, "current sessions: %d, current size: %d bytes
    ", nElem, nSize), arg); - func(ap_psprintf(p, "average session size: %d bytes
    ", nAverage), arg); - return; -} - diff --git a/modules/ssl/ssl_scache_shmcb.c b/modules/ssl/ssl_scache_shmcb.c deleted file mode 100644 index e588f0a5d11f083d43accd91960afe8367b434c3..0000000000000000000000000000000000000000 --- a/modules/ssl/ssl_scache_shmcb.c +++ /dev/null @@ -1,1343 +0,0 @@ -/* _ _ -** _ __ ___ ___ __| | ___ ___| | mod_ssl -** | '_ ` _ \ / _ \ / _` | / __/ __| | Apache Interface to OpenSSL -** | | | | | | (_) | (_| | \__ \__ \ | www.modssl.org -** |_| |_| |_|\___/ \__,_|___|___/___/_| ftp.modssl.org -** |_____| -** ssl_scache_shmcb.c -** Session Cache via Shared Memory (Cyclic Buffer Variant) -*/ - -/* ==================================================================== - * Copyright (c) 2000-2001 Ralf S. Engelschall. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following - * disclaimer in the documentation and/or other materials - * provided with the distribution. - * - * 3. All advertising materials mentioning features or use of this - * software must display the following acknowledgment: - * "This product includes software developed by - * Ralf S. Engelschall for use in the - * mod_ssl project (http://www.modssl.org/)." - * - * 4. The names "mod_ssl" must not be used to endorse or promote - * products derived from this software without prior written - * permission. For written permission, please contact - * rse@engelschall.com. - * - * 5. Products derived from this software may not be called "mod_ssl" - * nor may "mod_ssl" appear in their names without prior - * written permission of Ralf S. Engelschall. - * - * 6. Redistributions of any form whatsoever must retain the following - * acknowledgment: - * "This product includes software developed by - * Ralf S. Engelschall for use in the - * mod_ssl project (http://www.modssl.org/)." - * - * THIS SOFTWARE IS PROVIDED BY RALF S. ENGELSCHALL ``AS IS'' AND ANY - * EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR - * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL RALF S. ENGELSCHALL OR - * HIS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT - * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, - * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED - * OF THE POSSIBILITY OF SUCH DAMAGE. - * ==================================================================== - */ - -#include "mod_ssl.h" - -/* - * This shared memory based SSL session cache implementation was - * originally written by Geoff Thorpe for C2Net Europe - * and as a contribution to Ralf Engelschall's mod_ssl project. - */ - -/* - * The shared-memory segment header can be cast to and from the - * SHMCBHeader type, all other structures need to be initialised by - * utility functions. - * - * The "header" looks like this; - * - * data applying to the overall structure: - * - division_offset (unsigned int): - * how far into the shared memory segment the first division is. - * - division_size (unsigned int): - * how many bytes each division occupies. - * (NB: This includes the queue and the cache) - * - division_mask (unsigned char): - * the "mask" in the next line. Add one to this, - * and that's the number of divisions. - * - * data applying to within each division: - * - queue_size (unsigned int): - * how big each "queue" is. NB: The queue is the first block in each - * division and is followed immediately by the cache itself so so - * there's no cache_offset value. - * - * data applying to within each queue: - * - index_num (unsigned char): - * how many indexes in each cache's queue - * - index_offset (unsigned char): - * how far into the queue the first index is. - * - index_size: - * how big each index is. - * - * data applying to within each cache: - * - cache_data_offset (unsigned int): - * how far into the cache the session-data array is stored. - * - cache_data_size (unsigned int): - * how big each cache's data block is. - * - * statistics data (this will eventually be per-division but right now - * there's only one mutex): - * - stores (unsigned long): - * how many stores have been performed in the cache. - * - expiries (unsigned long): - * how many session have been expired from the cache. - * - scrolled (unsigned long): - * how many sessions have been scrolled out of full cache during a - * "store" operation. This is different to the "removes" stats as - * they are requested by mod_ssl/Apache, these are done because of - * cache logistics. (NB: Also, this value should be deducible from - * the others if my code has no bugs, but I count it anyway - plus - * it helps debugging :-). - * - retrieves_hit (unsigned long): - * how many session-retrieves have succeeded. - * - retrieves_miss (unsigned long): - * how many session-retrieves have failed. - * - removes_hit (unsigned long): - * - removes_miss (unsigned long): - * - * Following immediately after the header is an array of "divisions". - * Each division is simply a "queue" immediately followed by its - * corresponding "cache". Each division handles some pre-defined band - * of sessions by using the "division_mask" in the header. Eg. if - * division_mask=0x1f then there are 32 divisions, the first of which - * will store sessions whose least-significant 5 bits are 0, the second - * stores session whose LS 5 bits equal 1, etc. A queue is an indexing - * structure referring to its corresponding cache. - * - * A "queue" looks like this; - * - * - first_pos (unsigned int): - * the location within the array of indexes where the virtual - * "left-hand-edge" of the cyclic buffer is. - * - pos_count (unsigned int): - * the number of indexes occupied from first_pos onwards. - * - * ...followed by an array of indexes, each of which can be - * memcpy'd to and from an SHMCBIndex, and look like this; - * - * - expires (time_t): - * the time() value at which this session expires. - * - offset (unsigned int): - * the offset within the cache data block where the corresponding - * session is stored. - * - s_id2 (unsigned char): - * the second byte of the session_id, stored as an optimisation to - * reduce the number of d2i_SSL_SESSION calls that are made when doing - * a lookup. - * - removed (unsigned char): - * a byte used to indicate whether a session has been "passively" - * removed. Ie. it is still in the cache but is to be disregarded by - * any "retrieve" operation. - * - * A "cache" looks like this; - * - * - first_pos (unsigned int): - * the location within the data block where the virtual - * "left-hand-edge" of the cyclic buffer is. - * - pos_count (unsigned int): - * the number of bytes used in the data block from first_pos onwards. - * - * ...followed by the data block in which actual DER-encoded SSL - * sessions are stored. - */ - -/* - * Header - can be memcpy'd to and from the front of the shared - * memory segment. NB: The first copy (commented out) has the - * elements in a meaningful order, but due to data-alignment - * braindeadness, the second (uncommented) copy has the types grouped - * so as to decrease "struct-bloat". sigh. - */ -typedef struct { -#if 0 - unsigned char division_mask; - unsigned int division_offset; - unsigned int division_size; - unsigned int queue_size; - unsigned char index_num; - unsigned char index_offset; - unsigned char index_size; - unsigned int cache_data_offset; - unsigned int cache_data_size; - unsigned long num_stores; - unsigned long num_expiries; - unsigned long num_scrolled; - unsigned long num_retrieves_hit; - unsigned long num_retrieves_miss; - unsigned long num_removes_hit; - unsigned long num_removes_miss; -#else - unsigned long num_stores; - unsigned long num_expiries; - unsigned long num_scrolled; - unsigned long num_retrieves_hit; - unsigned long num_retrieves_miss; - unsigned long num_removes_hit; - unsigned long num_removes_miss; - unsigned int division_offset; - unsigned int division_size; - unsigned int queue_size; - unsigned int cache_data_offset; - unsigned int cache_data_size; - unsigned char division_mask; - unsigned char index_num; - unsigned char index_offset; - unsigned char index_size; -#endif -} SHMCBHeader; - -/* - * Index - can be memcpy'd to and from an index inside each - * queue's index array. - */ -typedef struct { - time_t expires; - unsigned int offset; - unsigned char s_id2; - unsigned char removed; -} SHMCBIndex; - -/* - * Queue - must be populated by a call to shmcb_get_division - * and the structure's pointers are used for updating (ie. - * the structure doesn't need any "set" to update values). - */ -typedef struct { - SHMCBHeader *header; - unsigned int *first_pos; - unsigned int *pos_count; - SHMCBIndex *indexes; -} SHMCBQueue; - -/* - * Cache - same comment as for Queue. 'Queue's are in a 1-1 - * correspondance with 'Cache's and are usually carried round - * in a pair, they are only seperated for clarity. - */ -typedef struct { - SHMCBHeader *header; - unsigned int *first_pos; - unsigned int *pos_count; - unsigned char *data; -} SHMCBCache; - -/* - * Forward function prototypes. - */ - -/* Functions for working around data-alignment-picky systems (sparcs, - Irix, etc). These use "memcpy" as a way of foxing these systems into - treating the composite types as byte-arrays rather than higher-level - primitives that it prefers to have 4-(or 8-)byte aligned. I don't - envisage this being a performance issue as a couple of 2 or 4 byte - memcpys can hardly make a dent on the massive memmove operations this - cache technique avoids, nor the overheads of ASN en/decoding. */ -static unsigned int shmcb_get_safe_uint(unsigned int *); -static void shmcb_set_safe_uint(unsigned int *, unsigned int); -#if 0 /* Unused so far */ -static unsigned long shmcb_get_safe_ulong(unsigned long *); -static void shmcb_set_safe_ulong(unsigned long *, unsigned long); -#endif -static time_t shmcb_get_safe_time(time_t *); -static void shmcb_set_safe_time(time_t *, time_t); - -/* Underlying functions for session-caching */ -static BOOL shmcb_init_memory(server_rec *, void *, unsigned int); -static BOOL shmcb_store_session(server_rec *, void *, UCHAR *, int, SSL_SESSION *, time_t); -static SSL_SESSION *shmcb_retrieve_session(server_rec *, void *, UCHAR *, int); -static BOOL shmcb_remove_session(server_rec *, void *, UCHAR *, int); - -/* Utility functions for manipulating the structures */ -static void shmcb_get_header(void *, SHMCBHeader **); -static BOOL shmcb_get_division(SHMCBHeader *, SHMCBQueue *, SHMCBCache *, unsigned int); -static SHMCBIndex *shmcb_get_index(const SHMCBQueue *, unsigned int); -static unsigned int shmcb_expire_division(server_rec *, SHMCBQueue *, SHMCBCache *); -static BOOL shmcb_insert_encoded_session(server_rec *, SHMCBQueue *, SHMCBCache *, unsigned char *, unsigned int, unsigned char *, time_t); -static SSL_SESSION *shmcb_lookup_session_id(server_rec *, SHMCBQueue *, SHMCBCache *, UCHAR *, int); -static BOOL shmcb_remove_session_id(server_rec *, SHMCBQueue *, SHMCBCache *, UCHAR *, int); - -/* - * Data-alignment functions (a.k.a. avoidance tactics) - * - * NB: On HPUX (and possibly others) there is a *very* mischievous little - * "optimisation" in the compilers where it will convert the following; - * memcpy(dest_ptr, &source, sizeof(unsigned int)); - * (where dest_ptr is of type (unsigned int *) and source is (unsigned int)) - * into; - * *dest_ptr = source; (or *dest_ptr = *(&source), not sure). - * Either way, it completely destroys the whole point of these _safe_ - * functions, because the assignment operation will fall victim to the - * architecture's byte-alignment dictations, whereas the memcpy (as a - * byte-by-byte copy) should not. sigh. So, if you're wondering about the - * apparently unnecessary conversions to (unsigned char *) in these - * functions, you now have an explanation. Don't just revert them back and - * say "ooh look, it still works" - if you try it on HPUX (well, 32-bit - * HPUX 11.00 at least) you may find it fails with a SIGBUS. :-( - */ - -static unsigned int shmcb_get_safe_uint(unsigned int *ptr) -{ - unsigned char *from; - unsigned int ret; - - from = (unsigned char *)ptr; - memcpy(&ret, from, sizeof(unsigned int)); - return ret; -} - -static void shmcb_set_safe_uint(unsigned int *ptr, unsigned int val) -{ - unsigned char *to, *from; - - to = (unsigned char *)ptr; - from = (unsigned char *)(&val); - memcpy(to, from, sizeof(unsigned int)); -} - -#if 0 /* Unused so far */ -static unsigned long shmcb_get_safe_ulong(unsigned long *ptr) -{ - unsigned char *from; - unsigned long ret; - - from = (unsigned char *)ptr; - memcpy(&ret, from, sizeof(unsigned long)); - return ret; -} - -static void shmcb_set_safe_ulong(unsigned long *ptr, unsigned long val) -{ - unsigned char *to, *from; - - to = (unsigned char *)ptr; - from = (unsigned char *)(&val); - memcpy(to, from, sizeof(unsigned long)); -} -#endif - -static time_t shmcb_get_safe_time(time_t * ptr) -{ - unsigned char *from; - time_t ret; - - from = (unsigned char *)ptr; - memcpy(&ret, from, sizeof(time_t)); - return ret; -} - -static void shmcb_set_safe_time(time_t * ptr, time_t val) -{ - unsigned char *to, *from; - - to = (unsigned char *)ptr; - from = (unsigned char *)(&val); - memcpy(to, from, sizeof(time_t)); -} - -/* -** -** High-Level "handlers" as per ssl_scache.c -** -*/ - -static void *shmcb_malloc(size_t size) -{ - SSLModConfigRec *mc = myModConfig(); - return ap_mm_malloc(mc->pSessionCacheDataMM, size); -} - -void ssl_scache_shmcb_init(server_rec *s, pool *p) -{ - SSLModConfigRec *mc = myModConfig(); - AP_MM *mm; - void *shm_segment = NULL; - int avail, avail_orig; - - /* - * Create shared memory segment - */ - if (mc->szSessionCacheDataFile == NULL) { - ssl_log(s, SSL_LOG_ERROR, "SSLSessionCache required"); - ssl_die(); - } - if ((mm = ap_mm_create(mc->nSessionCacheDataSize, - mc->szSessionCacheDataFile)) == NULL) { - ssl_log(s, SSL_LOG_ERROR, - "Cannot allocate shared memory: %s", ap_mm_error()); - ssl_die(); - } - mc->pSessionCacheDataMM = mm; - - /* - * Make sure the child processes have access to the underlying files - */ - ap_mm_permission(mm, SSL_MM_FILE_MODE, ap_user_id, -1); - - /* - * Create cache inside the shared memory segment - */ - avail = avail_orig = ap_mm_available(mm); - ssl_log(s, SSL_LOG_TRACE, "Shared-memory segment has %u available", - avail); - - /* - * For some reason to do with MM's internal management, I can't - * allocate the full amount. Implement a reasonable form of trial - * and error and output trace information. - */ - while ((shm_segment == NULL) && ((avail_orig - avail) * 100 < avail_orig)) { - shm_segment = shmcb_malloc(avail); - if (shm_segment == NULL) { - ssl_log(s, SSL_LOG_TRACE, - "shmcb_malloc attempt for %u bytes failed", avail); - avail -= 2; - } - } - if (shm_segment == NULL) { - ssl_log(s, SSL_LOG_ERROR, - "Cannot allocate memory for the 'shmcb' session cache\n"); - ssl_die(); - } - ssl_log(s, SSL_LOG_TRACE, "shmcb_init allocated %u bytes of shared " - "memory", avail); - if (!shmcb_init_memory(s, shm_segment, avail)) { - ssl_log(s, SSL_LOG_ERROR, - "Failure initialising 'shmcb' shared memory"); - ssl_die(); - } - ssl_log(s, SSL_LOG_INFO, "Shared memory session cache initialised"); - - /* - * Success ... we hack the memory block into place by cheating for - * now and stealing a member variable the original shared memory - * cache was using. :-) - */ - mc->tSessionCacheDataTable = (table_t *) shm_segment; - return; -} - -void ssl_scache_shmcb_kill(server_rec *s) -{ - SSLModConfigRec *mc = myModConfig(); - - if (mc->pSessionCacheDataMM != NULL) { - ap_mm_destroy(mc->pSessionCacheDataMM); - mc->pSessionCacheDataMM = NULL; - } - return; -} - -BOOL ssl_scache_shmcb_store(server_rec *s, UCHAR * id, int idlen, - time_t timeout, SSL_SESSION * pSession) -{ - SSLModConfigRec *mc = myModConfig(); - void *shm_segment; - BOOL to_return = FALSE; - - /* We've kludged our pointer into the other cache's member variable. */ - shm_segment = (void *) mc->tSessionCacheDataTable; - ssl_mutex_on(s); - if (!shmcb_store_session(s, shm_segment, id, idlen, pSession, timeout)) - /* in this cache engine, "stores" should never fail. */ - ssl_log(s, SSL_LOG_ERROR, "'shmcb' code was unable to store a " - "session in the cache."); - else { - ssl_log(s, SSL_LOG_TRACE, "shmcb_store successful"); - to_return = TRUE; - } - ssl_mutex_off(s); - return to_return; -} - -SSL_SESSION *ssl_scache_shmcb_retrieve(server_rec *s, UCHAR * id, int idlen) -{ - SSLModConfigRec *mc = myModConfig(); - void *shm_segment; - SSL_SESSION *pSession; - - /* We've kludged our pointer into the other cache's member variable. */ - shm_segment = (void *) mc->tSessionCacheDataTable; - ssl_mutex_on(s); - pSession = shmcb_retrieve_session(s, shm_segment, id, idlen); - ssl_mutex_off(s); - if (pSession) - ssl_log(s, SSL_LOG_TRACE, "shmcb_retrieve had a hit"); - else { - ssl_log(s, SSL_LOG_TRACE, "shmcb_retrieve had a miss"); - ssl_log(s, SSL_LOG_INFO, "Client requested a 'session-resume' but " - "we have no such session."); - } - return pSession; -} - -void ssl_scache_shmcb_remove(server_rec *s, UCHAR * id, int idlen) -{ - SSLModConfigRec *mc = myModConfig(); - void *shm_segment; - - /* We've kludged our pointer into the other cache's member variable. */ - shm_segment = (void *) mc->tSessionCacheDataTable; - shmcb_remove_session(s, shm_segment, id, idlen); -} - -void ssl_scache_shmcb_expire(server_rec *s) -{ - /* NOP */ - return; -} - -void ssl_scache_shmcb_status(server_rec *s, pool *p, - void (*func) (char *, void *), void *arg) -{ - SSLModConfigRec *mc = myModConfig(); - SHMCBHeader *header; - SHMCBQueue queue; - SHMCBCache cache; - SHMCBIndex *idx; - void *shm_segment; - unsigned int loop, total, cache_total, non_empty_divisions; - int index_pct, cache_pct; - double expiry_total; - time_t average_expiry, now, max_expiry, min_expiry, idxexpiry; - - ssl_log(s, SSL_LOG_TRACE, "inside ssl_scache_shmcb_status"); - - /* We've kludged our pointer into the other cache's member variable. */ - shm_segment = (void *) mc->tSessionCacheDataTable; - - /* Get the header structure. */ - shmcb_get_header(shm_segment, &header); - total = cache_total = non_empty_divisions = 0; - average_expiry = max_expiry = min_expiry = 0; - expiry_total = 0; - - /* It may seem strange to grab "now" at this point, but in theory - * we should never have a negative threshold but grabbing "now" after - * the loop (which performs expiries) could allow that chance. */ - now = time(NULL); - for (loop = 0; loop <= header->division_mask; loop++) { - if (shmcb_get_division(header, &queue, &cache, loop)) { - shmcb_expire_division(s, &queue, &cache); - total += shmcb_get_safe_uint(queue.pos_count); - cache_total += shmcb_get_safe_uint(cache.pos_count); - if (shmcb_get_safe_uint(queue.pos_count) > 0) { - idx = shmcb_get_index(&queue, - shmcb_get_safe_uint(queue.first_pos)); - non_empty_divisions++; - idxexpiry = shmcb_get_safe_time(&(idx->expires)); - expiry_total += (double) idxexpiry; - max_expiry = (idxexpiry > max_expiry ? idxexpiry : - max_expiry); - if (min_expiry == 0) - min_expiry = idxexpiry; - else - min_expiry = (idxexpiry < min_expiry ? idxexpiry : - min_expiry); - } - } - } - index_pct = (100 * total) / (header->index_num * (header->division_mask + 1)); - cache_pct = (100 * cache_total) / (header->cache_data_size * (header->division_mask + 1)); - func(ap_psprintf(p, "cache type: SHMCB, shared memory: %d " - "bytes, current sessions: %d
    ", - mc->nSessionCacheDataSize, total), arg); - func(ap_psprintf(p, "sub-caches: %d, indexes per sub-cache: " - "%d
    ", (int) header->division_mask + 1, - (int) header->index_num), arg); - if (non_empty_divisions != 0) { - average_expiry = (time_t)(expiry_total / (double)non_empty_divisions); - func(ap_psprintf(p, "time left on oldest entries' SSL sessions: "), arg); - if (now < average_expiry) - func(ap_psprintf(p, "avg: %d seconds, (range: %d...%d)
    ", - (int)(average_expiry - now), (int) (min_expiry - now), - (int)(max_expiry - now)), arg); - else - func(ap_psprintf(p, "expiry threshold: Calculation Error!" - "
    "), arg); - - } - func(ap_psprintf(p, "index usage: %d%%, cache usage: %d%%" - "
    ", index_pct, cache_pct), arg); - func(ap_psprintf(p, "total sessions stored since starting: %lu
    ", - header->num_stores), arg); - func(ap_psprintf(p, "total sessions expired since starting: %lu
    ", - header->num_expiries), arg); - func(ap_psprintf(p, "total (pre-expiry) sessions scrolled out of the " - "cache: %lu
    ", header->num_scrolled), arg); - func(ap_psprintf(p, "total retrieves since starting: %lu hit, " - "%lu miss
    ", header->num_retrieves_hit, - header->num_retrieves_miss), arg); - func(ap_psprintf(p, "total removes since starting: %lu hit, " - "%lu miss
    ", header->num_removes_hit, - header->num_removes_miss), arg); - ssl_log(s, SSL_LOG_TRACE, "leaving shmcb_status"); - return; -} - -/* -** -** Memory manipulation and low-level cache operations -** -*/ - -static BOOL shmcb_init_memory( - server_rec *s, void *shm_mem, - unsigned int shm_mem_size) -{ - SHMCBHeader *header; - SHMCBQueue queue; - SHMCBCache cache; - unsigned int temp, loop, granularity; - - ssl_log(s, SSL_LOG_TRACE, "entered shmcb_init_memory()"); - - /* Calculate some sizes... */ - temp = sizeof(SHMCBHeader); - - /* If the segment is ridiculously too small, bail out */ - if (shm_mem_size < (2*temp)) { - ssl_log(s, SSL_LOG_ERROR, "shared memory segment too small"); - return FALSE; - } - - /* Make temp the amount of memory without the header */ - temp = shm_mem_size - temp; - - /* Work on the basis that you need 10 bytes index for each session - * (approx 150 bytes), which is to divide temp by 160 - and then - * make sure we err on having too index space to burn even when - * the cache is full, which is a lot less stupid than having - * having not enough index space to utilise the whole cache!. */ - temp /= 120; - ssl_log(s, SSL_LOG_TRACE, "for %u bytes, recommending %u indexes", - shm_mem_size, temp); - - /* We should divide these indexes evenly amongst the queues. Try - * to get it so that there are roughly half the number of divisions - * as there are indexes in each division. */ - granularity = 256; - while ((temp / granularity) < (2 * granularity)) - granularity /= 2; - - /* So we have 'granularity' divisions, set 'temp' equal to the - * number of indexes in each division. */ - temp /= granularity; - - /* Too small? Bail ... */ - if (temp < 5) { - ssl_log(s, SSL_LOG_ERROR, "shared memory segment too small"); - return FALSE; - } - - /* OK, we're sorted - from here on in, the return should be TRUE */ - header = (SHMCBHeader *)shm_mem; - header->division_mask = (unsigned char)(granularity - 1); - header->division_offset = sizeof(SHMCBHeader); - header->index_num = temp; - header->index_offset = (2 * sizeof(unsigned int)); - header->index_size = sizeof(SHMCBIndex); - header->queue_size = header->index_offset + - (header->index_num * header->index_size); - - /* Now calculate the space for each division */ - temp = shm_mem_size - header->division_offset; - header->division_size = temp / granularity; - - /* Calculate the space left in each division for the cache */ - temp -= header->queue_size; - header->cache_data_offset = (2 * sizeof(unsigned int)); - header->cache_data_size = header->division_size - - header->queue_size - header->cache_data_offset; - - /* Output trace info */ - ssl_log(s, SSL_LOG_TRACE, "shmcb_init_memory choices follow"); - ssl_log(s, SSL_LOG_TRACE, "division_mask = 0x%02X", header->division_mask); - ssl_log(s, SSL_LOG_TRACE, "division_offset = %u", header->division_offset); - ssl_log(s, SSL_LOG_TRACE, "division_size = %u", header->division_size); - ssl_log(s, SSL_LOG_TRACE, "queue_size = %u", header->queue_size); - ssl_log(s, SSL_LOG_TRACE, "index_num = %u", header->index_num); - ssl_log(s, SSL_LOG_TRACE, "index_offset = %u", header->index_offset); - ssl_log(s, SSL_LOG_TRACE, "index_size = %u", header->index_size); - ssl_log(s, SSL_LOG_TRACE, "cache_data_offset = %u", header->cache_data_offset); - ssl_log(s, SSL_LOG_TRACE, "cache_data_size = %u", header->cache_data_size); - - /* The header is done, make the caches empty */ - for (loop = 0; loop < granularity; loop++) { - if (!shmcb_get_division(header, &queue, &cache, loop)) - ssl_log(s, SSL_LOG_ERROR, "shmcb_init_memory, " "internal error"); - shmcb_set_safe_uint(cache.first_pos, 0); - shmcb_set_safe_uint(cache.pos_count, 0); - shmcb_set_safe_uint(queue.first_pos, 0); - shmcb_set_safe_uint(queue.pos_count, 0); - } - - ssl_log(s, SSL_LOG_TRACE, "leaving shmcb_init_memory()"); - return TRUE; -} - -static BOOL shmcb_store_session( - server_rec *s, void *shm_segment, UCHAR * id, - int idlen, SSL_SESSION * pSession, - time_t timeout) -{ - SHMCBHeader *header; - SHMCBQueue queue; - SHMCBCache cache; - unsigned char masked_index; - unsigned char encoded[SSL_SESSION_MAX_DER]; - unsigned char *ptr_encoded; - unsigned int len_encoded; - time_t expiry_time; - - ssl_log(s, SSL_LOG_TRACE, "inside shmcb_store_session"); - - /* Get the header structure, which division this session will fall into etc. */ - shmcb_get_header(shm_segment, &header); - masked_index = pSession->session_id[0] & header->division_mask; - ssl_log(s, SSL_LOG_TRACE, "session_id[0]=%u, masked index=%u", - pSession->session_id[0], masked_index); - if (!shmcb_get_division(header, &queue, &cache, (unsigned int)masked_index)) { - ssl_log(s, SSL_LOG_ERROR, "shmcb_store_session, " "internal error"); - return FALSE; - } - - /* Serialise the session, work out how much we're dealing - * with. NB: This check could be removed if we're not paranoid - * or we find some assurance that it will never be necessary. */ - len_encoded = i2d_SSL_SESSION(pSession, NULL); - if (len_encoded > SSL_SESSION_MAX_DER) { - ssl_log(s, SSL_LOG_ERROR, "session is too big (%u bytes)", - len_encoded); - return FALSE; - } - ptr_encoded = encoded; - len_encoded = i2d_SSL_SESSION(pSession, &ptr_encoded); - expiry_time = timeout; - if (!shmcb_insert_encoded_session(s, &queue, &cache, encoded, - len_encoded, pSession->session_id, - expiry_time)) { - ssl_log(s, SSL_LOG_ERROR, "can't store a session!"); - return FALSE; - } - ssl_log(s, SSL_LOG_TRACE, "leaving shmcb_store successfully"); - header->num_stores++; - return TRUE; -} - -static SSL_SESSION *shmcb_retrieve_session( - server_rec *s, void *shm_segment, - UCHAR * id, int idlen) -{ - SHMCBHeader *header; - SHMCBQueue queue; - SHMCBCache cache; - unsigned char masked_index; - SSL_SESSION *pSession; - - ssl_log(s, SSL_LOG_TRACE, "inside shmcb_retrieve_session"); - if (idlen < 2) { - ssl_log(s, SSL_LOG_ERROR, "unusably short session_id provided " - "(%u bytes)", idlen); - return FALSE; - } - - /* Get the header structure, which division this session lookup - * will come from etc. */ - shmcb_get_header(shm_segment, &header); - masked_index = id[0] & header->division_mask; - ssl_log(s, SSL_LOG_TRACE, "id[0]=%u, masked index=%u", id[0], - masked_index); - if (!shmcb_get_division(header, &queue, &cache, (unsigned int) masked_index)) { - ssl_log(s, SSL_LOG_ERROR, "shmcb_retrieve_session, " "internal error"); - header->num_retrieves_miss++; - return FALSE; - } - - /* Get the session corresponding to the session_id or NULL if it - * doesn't exist (or is flagged as "removed"). */ - pSession = shmcb_lookup_session_id(s, &queue, &cache, id, idlen); - if (pSession) - header->num_retrieves_hit++; - else - header->num_retrieves_miss++; - ssl_log(s, SSL_LOG_TRACE, "leaving shmcb_retrieve_session"); - return pSession; -} - -static BOOL shmcb_remove_session( - server_rec *s, void *shm_segment, - UCHAR * id, int idlen) -{ - SHMCBHeader *header; - SHMCBQueue queue; - SHMCBCache cache; - unsigned char masked_index; - BOOL res; - - ssl_log(s, SSL_LOG_TRACE, "inside shmcb_remove_session"); - if (id == NULL) { - ssl_log(s, SSL_LOG_ERROR, "remove called with NULL session_id!"); - return FALSE; - } - - /* Get the header structure, which division this session remove - * will happen in etc. */ - shmcb_get_header(shm_segment, &header); - masked_index = id[0] & header->division_mask; - ssl_log(s, SSL_LOG_TRACE, "id[0]=%u, masked index=%u", - id[0], masked_index); - if (!shmcb_get_division(header, &queue, &cache, (unsigned int)masked_index)) { - ssl_log(s, SSL_LOG_ERROR, "shmcb_remove_session, internal error"); - header->num_removes_miss++; - return FALSE; - } - res = shmcb_remove_session_id(s, &queue, &cache, id, idlen); - if (res) - header->num_removes_hit++; - else - header->num_removes_miss++; - ssl_log(s, SSL_LOG_TRACE, "leaving shmcb_remove_session"); - return res; -} - - -/* -** -** Weirdo cyclic buffer functions -** -*/ - -/* This gets used in the cyclic "index array" (in the 'Queue's) and - * in the cyclic 'Cache's too ... you provide the "width" of the - * cyclic store, the starting position and how far to move (with - * wrapping if necessary). Basically it's addition modulo buf_size. */ -static unsigned int shmcb_cyclic_increment( - unsigned int buf_size, - unsigned int start_pos, - unsigned int to_add) -{ - start_pos += to_add; - while (start_pos >= buf_size) - start_pos -= buf_size; - return start_pos; -} - -/* Given two positions in a cyclic buffer, calculate the "distance". - * This is to cover the case ("non-trivial") where the 'next' offset - * is to the left of the 'start' offset. NB: This calculates the - * space inclusive of one end-point but not the other. There is an - * ambiguous case (which is why we use the - * coordinate system rather than one) when 'start' - * is the same as 'next'. It could indicate the buffer is full or it - * can indicate the buffer is empty ... I choose the latter as it's - * easier and usually necessary to check if the buffer is full anyway - * before doing incremental logic (which is this useful for), but we - * definitely need the empty case handled - in fact it's our starting - * state!! */ -static unsigned int shmcb_cyclic_space( - unsigned int buf_size, - unsigned int start_offset, - unsigned int next_offset) -{ - /* Is it the trivial case? */ - if (start_offset <= next_offset) - return (next_offset - start_offset); /* yes */ - else - return ((buf_size - start_offset) + next_offset); /* no */ -} - -/* A "normal-to-cyclic" memcpy ... this takes a linear block of - * memory and copies it onto a cyclic buffer. The purpose and - * function of this is pretty obvious, you need to cover the case - * that the destination (cyclic) buffer has to wrap round. */ -static void shmcb_cyclic_ntoc_memcpy( - unsigned int buf_size, - unsigned char *data, - unsigned int dest_offset, - unsigned char *src, unsigned int src_len) -{ - /* Can it be copied all in one go? */ - if (dest_offset + src_len < buf_size) - /* yes */ - memcpy(data + dest_offset, src, src_len); - else { - /* no */ - memcpy(data + dest_offset, src, buf_size - dest_offset); - memcpy(data, src + buf_size - dest_offset, - src_len + dest_offset - buf_size); - } - return; -} - -/* A "cyclic-to-normal" memcpy ... given the last function, this - * one's purpose is clear, it copies out of a cyclic buffer handling - * wrapping. */ -static void shmcb_cyclic_cton_memcpy( - unsigned int buf_size, - unsigned char *dest, - unsigned char *data, - unsigned int src_offset, - unsigned int src_len) -{ - /* Can it be copied all in one go? */ - if (src_offset + src_len < buf_size) - /* yes */ - memcpy(dest, data + src_offset, src_len); - else { - /* no */ - memcpy(dest, data + src_offset, buf_size - src_offset); - memcpy(dest + buf_size - src_offset, data, - src_len + src_offset - buf_size); - } - return; -} - -/* Here's the cool hack that makes it all work ... by simply - * making the first collection of bytes *be* our header structure - * (casting it into the C structure), we have the perfect way to - * maintain state in a shared-memory session cache from one call - * (and process) to the next, use the shared memory itself! The - * original mod_ssl shared-memory session cache uses variables - * inside the context, but we simply use that for storing the - * pointer to the shared memory itself. And don't forget, after - * Apache's initialisation, this "header" is constant/read-only - * so we can read it outside any locking. - * - sometimes I just *love* coding y'know?! */ -static void shmcb_get_header(void *shm_mem, SHMCBHeader **header) -{ - *header = (SHMCBHeader *)shm_mem; - return; -} - -/* This is what populates our "interesting" structures. Given a - * pointer to the header, and an index into the appropriate - * division (this must have already been masked using the - * division_mask by the caller!), we can populate the provided - * SHMCBQueue and SHMCBCache structures with values and - * pointers to the underlying shared memory. Upon returning - * (if not FALSE), the caller can meddle with the pointer - * values and they will map into the shared-memory directly, - * as such there's no need to "free" or "set" the Queue or - * Cache values, they were themselves references to the *real* - * data. */ -static BOOL shmcb_get_division( - SHMCBHeader *header, SHMCBQueue *queue, - SHMCBCache *cache, unsigned int idx) -{ - unsigned char *pQueue; - unsigned char *pCache; - - /* bounds check */ - if (idx > (unsigned int) header->division_mask) - return FALSE; - - /* Locate the blocks of memory storing the corresponding data */ - pQueue = ((unsigned char *) header) + header->division_offset + - (idx * header->division_size); - pCache = pQueue + header->queue_size; - - /* Populate the structures with appropriate pointers */ - queue->first_pos = (unsigned int *) pQueue; - - /* Our structures stay packed, no matter what the system's - * data-alignment regime is. */ - queue->pos_count = (unsigned int *) (pQueue + sizeof(unsigned int)); - queue->indexes = (SHMCBIndex *) (pQueue + (2 * sizeof(unsigned int))); - cache->first_pos = (unsigned int *) pCache; - cache->pos_count = (unsigned int *) (pCache + sizeof(unsigned int)); - cache->data = (unsigned char *) (pCache + (2 * sizeof(unsigned int))); - queue->header = cache->header = header; - - return TRUE; -} - -/* This returns a pointer to the piece of shared memory containing - * a specified 'Index'. SHMCBIndex, like SHMCBHeader, is a fixed - * width non-referencing structure of primitive types that can be - * cast onto the corresponding block of shared memory. Thus, by - * returning a cast pointer to that section of shared memory, the - * caller can read and write values to and from the "structure" and - * they are actually reading and writing the underlying shared - * memory. */ -static SHMCBIndex *shmcb_get_index( - const SHMCBQueue *queue, unsigned int idx) -{ - /* bounds check */ - if (idx > (unsigned int) queue->header->index_num) - return NULL; - - /* Return a pointer to the index. NB: I am being horribly pendantic - * here so as to avoid any potential data-alignment assumptions being - * placed on the pointer arithmetic by the compiler (sigh). */ - return (SHMCBIndex *)(((unsigned char *) queue->indexes) + - (idx * sizeof(SHMCBIndex))); -} - -/* This functions rolls expired cache (and index) entries off the front - * of the cyclic buffers in a division. The function returns the number - * of expired sessions. */ -static unsigned int shmcb_expire_division( - server_rec *s, SHMCBQueue *queue, SHMCBCache *cache) -{ - SHMCBIndex *idx; - time_t now; - unsigned int loop, index_num, pos_count, new_pos; - SHMCBHeader *header; - - ssl_log(s, SSL_LOG_TRACE, "entering shmcb_expire_division"); - - /* We must calculate num and space ourselves based on expiry times. */ - now = time(NULL); - loop = 0; - new_pos = shmcb_get_safe_uint(queue->first_pos); - - /* Cache useful values */ - header = queue->header; - index_num = header->index_num; - pos_count = shmcb_get_safe_uint(queue->pos_count); - while (loop < pos_count) { - idx = shmcb_get_index(queue, new_pos); - if (shmcb_get_safe_time(&(idx->expires)) > now) - /* it hasn't expired yet, we're done iterating */ - break; - /* This one should be expired too. Shift to the next entry. */ - loop++; - new_pos = shmcb_cyclic_increment(index_num, new_pos, 1); - } - - /* Find the new_offset and make the expiries happen. */ - if (loop > 0) { - ssl_log(s, SSL_LOG_TRACE, "will be expiring %u sessions", loop); - /* We calculate the new_offset by "peeking" (or in the - * case it's the last entry, "sneaking" ;-). */ - if (loop == pos_count) { - /* We are expiring everything! This is easy to do... */ - shmcb_set_safe_uint(queue->pos_count, 0); - shmcb_set_safe_uint(cache->pos_count, 0); - } - else { - /* The Queue is easy to adjust */ - shmcb_set_safe_uint(queue->pos_count, - shmcb_get_safe_uint(queue->pos_count) - loop); - shmcb_set_safe_uint(queue->first_pos, new_pos); - /* peek to the start of the next session */ - idx = shmcb_get_index(queue, new_pos); - /* We can use shmcb_cyclic_space because we've guaranteed - * we don't fit the ambiguous full/empty case. */ - shmcb_set_safe_uint(cache->pos_count, - shmcb_get_safe_uint(cache->pos_count) - - shmcb_cyclic_space(header->cache_data_size, - shmcb_get_safe_uint(cache->first_pos), - shmcb_get_safe_uint(&(idx->offset)))); - shmcb_set_safe_uint(cache->first_pos, shmcb_get_safe_uint(&(idx->offset))); - } - ssl_log(s, SSL_LOG_TRACE, "we now have %u sessions", - shmcb_get_safe_uint(queue->pos_count)); - } - header->num_expiries += loop; - return loop; -} - -/* Inserts a new encoded session into a queue/cache pair - expiring - * (early or otherwise) any leading sessions as necessary to ensure - * there is room. An error return (FALSE) should only happen in the - * event of surreal values being passed on, or ridiculously small - * cache sizes. NB: For tracing purposes, this function is also given - * the server_rec to allow "ssl_log()". */ -static BOOL shmcb_insert_encoded_session( - server_rec *s, SHMCBQueue * queue, - SHMCBCache * cache, - unsigned char *encoded, - unsigned int encoded_len, - unsigned char *session_id, - time_t expiry_time) -{ - SHMCBHeader *header; - SHMCBIndex *idx = NULL; - unsigned int gap, new_pos, loop, new_offset; - int need; - - ssl_log(s, SSL_LOG_TRACE, "entering shmcb_insert_encoded_session, " - "*queue->pos_count = %u", shmcb_get_safe_uint(queue->pos_count)); - - /* If there's entries to expire, ditch them first thing. */ - shmcb_expire_division(s, queue, cache); - header = cache->header; - gap = header->cache_data_size - shmcb_get_safe_uint(cache->pos_count); - if (gap < encoded_len) { - new_pos = shmcb_get_safe_uint(queue->first_pos); - loop = 0; - need = (int) encoded_len - (int) gap; - while ((need > 0) && (loop + 1 < shmcb_get_safe_uint(queue->pos_count))) { - new_pos = shmcb_cyclic_increment(header->index_num, new_pos, 1); - loop += 1; - idx = shmcb_get_index(queue, new_pos); - need = (int) encoded_len - (int) gap - - shmcb_cyclic_space(header->cache_data_size, - shmcb_get_safe_uint(cache->first_pos), - shmcb_get_safe_uint(&(idx->offset))); - } - if (loop > 0) { - ssl_log(s, SSL_LOG_TRACE, "about to scroll %u sessions from %u", - loop, shmcb_get_safe_uint(queue->pos_count)); - /* We are removing "loop" items from the cache. */ - shmcb_set_safe_uint(cache->pos_count, - shmcb_get_safe_uint(cache->pos_count) - - shmcb_cyclic_space(header->cache_data_size, - shmcb_get_safe_uint(cache->first_pos), - shmcb_get_safe_uint(&(idx->offset)))); - shmcb_set_safe_uint(cache->first_pos, shmcb_get_safe_uint(&(idx->offset))); - shmcb_set_safe_uint(queue->pos_count, shmcb_get_safe_uint(queue->pos_count) - loop); - shmcb_set_safe_uint(queue->first_pos, new_pos); - ssl_log(s, SSL_LOG_TRACE, "now only have %u sessions", - shmcb_get_safe_uint(queue->pos_count)); - /* Update the stats!!! */ - header->num_scrolled += loop; - } - } - - /* probably unecessary checks, but I'll leave them until this code - * is verified. */ - if (shmcb_get_safe_uint(cache->pos_count) + encoded_len > - header->cache_data_size) { - ssl_log(s, SSL_LOG_ERROR, "shmcb_insert_encoded_session, " - "internal error"); - return FALSE; - } - if (shmcb_get_safe_uint(queue->pos_count) == header->index_num) { - ssl_log(s, SSL_LOG_ERROR, "shmcb_insert_encoded_session, " - "internal error"); - return FALSE; - } - ssl_log(s, SSL_LOG_TRACE, "we have %u bytes and %u indexes free - " - "enough", header->cache_data_size - - shmcb_get_safe_uint(cache->pos_count), header->index_num - - shmcb_get_safe_uint(queue->pos_count)); - - - /* HERE WE ASSUME THAT THE NEW SESSION SHOULD GO ON THE END! I'M NOT - * CHECKING WHETHER IT SHOULD BE GENUINELY "INSERTED" SOMEWHERE. - * - * We either fix that, or find out at a "higher" (read "mod_ssl") - * level whether it is possible to have distinct session caches for - * any attempted tomfoolery to do with different session timeouts. - * Knowing in advance that we can have a cache-wide constant timeout - * would make this stuff *MUCH* more efficient. Mind you, it's very - * efficient right now because I'm ignoring this problem!!! - */ - - /* Increment to the first unused byte */ - new_offset = shmcb_cyclic_increment(header->cache_data_size, - shmcb_get_safe_uint(cache->first_pos), - shmcb_get_safe_uint(cache->pos_count)); - /* Copy the DER-encoded session into place */ - shmcb_cyclic_ntoc_memcpy(header->cache_data_size, cache->data, - new_offset, encoded, encoded_len); - /* Get the new index that this session is stored in. */ - new_pos = shmcb_cyclic_increment(header->index_num, - shmcb_get_safe_uint(queue->first_pos), - shmcb_get_safe_uint(queue->pos_count)); - ssl_log(s, SSL_LOG_TRACE, "storing in index %u, at offset %u", new_pos, - new_offset); - idx = shmcb_get_index(queue, new_pos); - if (idx == NULL) { - ssl_log(s, SSL_LOG_ERROR, "shmcb_insert_encoded_session, " - "internal error"); - return FALSE; - } - memset(idx, 0, sizeof(SHMCBIndex)); - shmcb_set_safe_time(&(idx->expires), expiry_time); - shmcb_set_safe_uint(&(idx->offset), new_offset); - - /* idx->removed = (unsigned char)0; */ /* Not needed given the memset above. */ - idx->s_id2 = session_id[1]; - ssl_log(s, SSL_LOG_TRACE, "session_id[0]=%u, idx->s_id2=%u", - session_id[0], session_id[1]); - - /* All that remains is to adjust the cache's and queue's "pos_count"s. */ - shmcb_set_safe_uint(cache->pos_count, - shmcb_get_safe_uint(cache->pos_count) + encoded_len); - shmcb_set_safe_uint(queue->pos_count, - shmcb_get_safe_uint(queue->pos_count) + 1); - - /* And just for good debugging measure ... */ - ssl_log(s, SSL_LOG_TRACE, "leaving now with %u bytes in the cache and " - "%u indexes", shmcb_get_safe_uint(cache->pos_count), - shmcb_get_safe_uint(queue->pos_count)); - ssl_log(s, SSL_LOG_TRACE, "leaving shmcb_insert_encoded_session"); - return TRUE; -} - -/* Performs a lookup into a queue/cache pair for a - * session_id. If found, the session is deserialised - * and returned, otherwise NULL. */ -static SSL_SESSION *shmcb_lookup_session_id( - server_rec *s, SHMCBQueue *queue, - SHMCBCache *cache, UCHAR *id, - int idlen) -{ - unsigned char tempasn[SSL_SESSION_MAX_DER]; - SHMCBIndex *idx; - SHMCBHeader *header; - SSL_SESSION *pSession = NULL; - unsigned int curr_pos, loop, count; - unsigned char *ptr; - time_t now; - - ssl_log(s, SSL_LOG_TRACE, "entering shmcb_lookup_session_id"); - - /* If there are entries to expire, ditch them first thing. */ - shmcb_expire_division(s, queue, cache); - now = time(NULL); - curr_pos = shmcb_get_safe_uint(queue->first_pos); - count = shmcb_get_safe_uint(queue->pos_count); - header = queue->header; - for (loop = 0; loop < count; loop++) { - ssl_log(s, SSL_LOG_TRACE, "loop=%u, count=%u, curr_pos=%u", - loop, count, curr_pos); - idx = shmcb_get_index(queue, curr_pos); - ssl_log(s, SSL_LOG_TRACE, "idx->s_id2=%u, id[1]=%u, offset=%u", - idx->s_id2, id[1], shmcb_get_safe_uint(&(idx->offset))); - /* Only look into the session further if; - * (a) the second byte of the session_id matches, - * (b) the "removed" flag isn't set, - * (c) the session hasn't expired yet. - * We do (c) like this so that it saves us having to - * do natural expiries ... naturally expired sessions - * scroll off the front anyway when the cache is full and - * "rotating", the only real issue that remains is the - * removal or disabling of forcibly killed sessions. */ - if ((idx->s_id2 == id[1]) && !idx->removed && - (shmcb_get_safe_time(&(idx->expires)) > now)) { - ssl_log(s, SSL_LOG_TRACE, "at index %u, found possible " - "session match", curr_pos); - shmcb_cyclic_cton_memcpy(header->cache_data_size, - tempasn, cache->data, - shmcb_get_safe_uint(&(idx->offset)), - SSL_SESSION_MAX_DER); - ptr = tempasn; - pSession = d2i_SSL_SESSION(NULL, &ptr, SSL_SESSION_MAX_DER); - if (pSession == NULL) { - ssl_log(s, SSL_LOG_ERROR, "scach2_lookup_" - "session_id, internal error"); - return NULL; - } - if ((pSession->session_id_length == idlen) && - (memcmp(pSession->session_id, id, idlen) == 0)) { - ssl_log(s, SSL_LOG_TRACE, "a match!"); - return pSession; - } - ssl_log(s, SSL_LOG_TRACE, "not a match"); - SSL_SESSION_free(pSession); - pSession = NULL; - } - curr_pos = shmcb_cyclic_increment(header->index_num, curr_pos, 1); - } - ssl_log(s, SSL_LOG_TRACE, "no matching sessions were found"); - return NULL; -} - -static BOOL shmcb_remove_session_id( - server_rec *s, SHMCBQueue *queue, - SHMCBCache *cache, UCHAR *id, int idlen) -{ - unsigned char tempasn[SSL_SESSION_MAX_DER]; - SSL_SESSION *pSession = NULL; - SHMCBIndex *idx; - SHMCBHeader *header; - unsigned int curr_pos, loop, count; - unsigned char *ptr; - BOOL to_return = FALSE; - - ssl_log(s, SSL_LOG_TRACE, "entering shmcb_remove_session_id"); - - /* If there's entries to expire, ditch them first thing. */ - /* shmcb_expire_division(s, queue, cache); */ - - /* Regarding the above ... hmmm ... I know my expiry code is slightly - * "faster" than all this remove stuff ... but if the higher level - * code calls a "remove" operation (and this *only* seems to happen - * when it has spotted an expired session before we had a chance to) - * then it should get credit for a remove (stats-wise). Also, in the - * off-chance that the server *requests* a renegotiate and wants to - * wipe the session clean we should give that priority over our own - * routine expiry handling. So I've moved the expiry check to *after* - * this general remove stuff. */ - curr_pos = shmcb_get_safe_uint(queue->first_pos); - count = shmcb_get_safe_uint(queue->pos_count); - header = cache->header; - for (loop = 0; loop < count; loop++) { - ssl_log(s, SSL_LOG_TRACE, "loop=%u, count=%u, curr_pos=%u", - loop, count, curr_pos); - idx = shmcb_get_index(queue, curr_pos); - ssl_log(s, SSL_LOG_TRACE, "idx->s_id2=%u, id[1]=%u", idx->s_id2, - id[1]); - /* Only look into the session further if the second byte of the - * session_id matches. */ - if (idx->s_id2 == id[1]) { - ssl_log(s, SSL_LOG_TRACE, "at index %u, found possible " - "session match", curr_pos); - shmcb_cyclic_cton_memcpy(header->cache_data_size, - tempasn, cache->data, - shmcb_get_safe_uint(&(idx->offset)), - SSL_SESSION_MAX_DER); - ptr = tempasn; - pSession = d2i_SSL_SESSION(NULL, &ptr, SSL_SESSION_MAX_DER); - if (pSession == NULL) { - ssl_log(s, SSL_LOG_ERROR, "shmcb_remove_session_id, " - "internal error"); - goto end; - } - if ((pSession->session_id_length == idlen) - && (memcmp(id, pSession->session_id, idlen) == 0)) { - ssl_log(s, SSL_LOG_TRACE, "a match!"); - /* Scrub out this session "quietly" */ - idx->removed = (unsigned char) 1; - SSL_SESSION_free(pSession); - to_return = TRUE; - goto end; - } - ssl_log(s, SSL_LOG_TRACE, "not a match"); - SSL_SESSION_free(pSession); - pSession = NULL; - } - curr_pos = shmcb_cyclic_increment(header->index_num, curr_pos, 1); - } - ssl_log(s, SSL_LOG_TRACE, "no matching sessions were found"); - - /* If there's entries to expire, ditch them now. */ - shmcb_expire_division(s, queue, cache); -end: - ssl_log(s, SSL_LOG_TRACE, "leaving shmcb_remove_session_id"); - return to_return; -} - diff --git a/modules/ssl/ssl_util.c b/modules/ssl/ssl_util.c deleted file mode 100644 index af4a9672f25363168f527e540bca9841f552921b..0000000000000000000000000000000000000000 --- a/modules/ssl/ssl_util.c +++ /dev/null @@ -1,437 +0,0 @@ -/* _ _ -** _ __ ___ ___ __| | ___ ___| | mod_ssl -** | '_ ` _ \ / _ \ / _` | / __/ __| | Apache Interface to OpenSSL -** | | | | | | (_) | (_| | \__ \__ \ | www.modssl.org -** |_| |_| |_|\___/ \__,_|___|___/___/_| ftp.modssl.org -** |_____| -** ssl_util.c -** Utility Functions -*/ - -/* ==================================================================== - * Copyright (c) 1998-2001 Ralf S. Engelschall. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following - * disclaimer in the documentation and/or other materials - * provided with the distribution. - * - * 3. All advertising materials mentioning features or use of this - * software must display the following acknowledgment: - * "This product includes software developed by - * Ralf S. Engelschall for use in the - * mod_ssl project (http://www.modssl.org/)." - * - * 4. The names "mod_ssl" must not be used to endorse or promote - * products derived from this software without prior written - * permission. For written permission, please contact - * rse@engelschall.com. - * - * 5. Products derived from this software may not be called "mod_ssl" - * nor may "mod_ssl" appear in their names without prior - * written permission of Ralf S. Engelschall. - * - * 6. Redistributions of any form whatsoever must retain the following - * acknowledgment: - * "This product includes software developed by - * Ralf S. Engelschall for use in the - * mod_ssl project (http://www.modssl.org/)." - * - * THIS SOFTWARE IS PROVIDED BY RALF S. ENGELSCHALL ``AS IS'' AND ANY - * EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR - * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL RALF S. ENGELSCHALL OR - * HIS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT - * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, - * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED - * OF THE POSSIBILITY OF SUCH DAMAGE. - * ==================================================================== - */ - -/* ==================================================================== - * Copyright (c) 1995-1999 Ben Laurie. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in - * the documentation and/or other materials provided with the - * distribution. - * - * 3. All advertising materials mentioning features or use of this - * software must display the following acknowledgment: - * "This product includes software developed by Ben Laurie - * for use in the Apache-SSL HTTP server project." - * - * 4. The name "Apache-SSL Server" must not be used to - * endorse or promote products derived from this software without - * prior written permission. - * - * 5. Redistributions of any form whatsoever must retain the following - * acknowledgment: - * "This product includes software developed by Ben Laurie - * for use in the Apache-SSL HTTP server project." - * - * THIS SOFTWARE IS PROVIDED BY BEN LAURIE ``AS IS'' AND ANY - * EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR - * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL BEN LAURIE OR - * HIS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT - * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, - * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED - * OF THE POSSIBILITY OF SUCH DAMAGE. - * ==================================================================== - */ - /* ``Every day of my life - I am forced to add another - name to the list of people - who piss me off!'' - -- Calvin */ -#include "mod_ssl.h" - - -/* _________________________________________________________________ -** -** Utility Functions -** _________________________________________________________________ -*/ - -char *ssl_util_server_root_relative(pool *p, char *what, char *arg) -{ - char *rv = NULL; - -#ifdef SSL_VENDOR - ap_hook_use("ap::mod_ssl::vendor::ssl_server_root_relative", - AP_HOOK_SIG4(ptr,ptr,ptr,ptr), AP_HOOK_ALL, &rv, p, what, arg); - if (rv != NULL) - return rv; -#endif - rv = ap_server_root_relative(p, arg); - return rv; -} - -char *ssl_util_vhostid(pool *p, server_rec *s) -{ - char *id; - SSLSrvConfigRec *sc; - char *host; - unsigned int port; - - host = s->server_hostname; - if (s->port != 0) - port = s->port; - else { - sc = mySrvConfig(s); - if (sc->bEnabled) - port = DEFAULT_HTTPS_PORT; - else - port = DEFAULT_HTTP_PORT; - } - id = ap_psprintf(p, "%s:%u", host, port); - return id; -} - -void ssl_util_strupper(char *s) -{ - for (; *s; ++s) - *s = toupper(*s); - return; -} - -static const char ssl_util_uuencode_six2pr[64+1] = - "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/"; - -void ssl_util_uuencode(char *szTo, const char *szFrom, BOOL bPad) -{ - ssl_util_uuencode_binary((unsigned char *)szTo, - (const unsigned char *)szFrom, - strlen(szFrom), bPad); -} - -void ssl_util_uuencode_binary( - unsigned char *szTo, const unsigned char *szFrom, int nLength, BOOL bPad) -{ - const unsigned char *s; - int nPad = 0; - - for (s = szFrom; nLength > 0; s += 3) { - *szTo++ = ssl_util_uuencode_six2pr[s[0] >> 2]; - *szTo++ = ssl_util_uuencode_six2pr[(s[0] << 4 | s[1] >> 4) & 0x3f]; - if (--nLength == 0) { - nPad = 2; - break; - } - *szTo++ = ssl_util_uuencode_six2pr[(s[1] << 2 | s[2] >> 6) & 0x3f]; - if (--nLength == 0) { - nPad = 1; - break; - } - *szTo++ = ssl_util_uuencode_six2pr[s[2] & 0x3f]; - --nLength; - } - while(bPad && nPad--) - *szTo++ = NUL; - *szTo = NUL; - return; -} - -FILE *ssl_util_ppopen(server_rec *s, pool *p, char *cmd) -{ - FILE *fpout; - int rc; - - fpout = NULL; - rc = ap_spawn_child(p, ssl_util_ppopen_child, - (void *)cmd, kill_after_timeout, - NULL, &fpout, NULL); - if (rc == 0 || fpout == NULL) { - ap_log_error(APLOG_MARK, APLOG_ERR, s, - "ssl_util_ppopen: could not run: %s", cmd); - return NULL; - } - return (fpout); -} - -int ssl_util_ppopen_child(void *cmd, child_info *pinfo) -{ - int child_pid = 1; - - /* - * Prepare for exec - */ - ap_cleanup_for_exec(); -#ifdef SIGHUP - signal(SIGHUP, SIG_IGN); -#endif - - /* - * Exec() the child program - */ -#if defined(WIN32) - /* MS Windows */ - { - char pCommand[MAX_STRING_LEN]; - STARTUPINFO si; - PROCESS_INFORMATION pi; - - ap_snprintf(pCommand, sizeof(pCommand), "%s /C %s", SHELL_PATH, cmd); - - memset(&si, 0, sizeof(si)); - memset(&pi, 0, sizeof(pi)); - - si.cb = sizeof(si); - si.dwFlags = STARTF_USESHOWWINDOW | STARTF_USESTDHANDLES; - si.wShowWindow = SW_HIDE; - si.hStdInput = pinfo->hPipeInputRead; - si.hStdOutput = pinfo->hPipeOutputWrite; - si.hStdError = pinfo->hPipeErrorWrite; - - if (CreateProcess(NULL, pCommand, NULL, NULL, TRUE, 0, - environ, NULL, &si, &pi)) { - CloseHandle(pi.hProcess); - CloseHandle(pi.hThread); - child_pid = pi.dwProcessId; - } - } -#elif defined(OS2) - /* IBM OS/2 */ - spawnl(P_NOWAIT, SHELL_PATH, SHELL_PATH, "/c", (char *)cmd, NULL); -#else - /* Standard Unix */ - execl(SHELL_PATH, SHELL_PATH, "-c", (char *)cmd, NULL); -#endif - return (child_pid); -} - -void ssl_util_ppclose(server_rec *s, pool *p, FILE *fp) -{ - ap_pfclose(p, fp); - return; -} - -/* - * Run a filter program and read the first line of its stdout output - */ -char *ssl_util_readfilter(server_rec *s, pool *p, char *cmd) -{ - static char buf[MAX_STRING_LEN]; - FILE *fp; - char c; - int k; - - if ((fp = ssl_util_ppopen(s, p, cmd)) == NULL) - return NULL; - for (k = 0; read(fileno(fp), &c, 1) == 1 - && (k < MAX_STRING_LEN-1) ; ) { - if (c == '\n' || c == '\r') - break; - buf[k++] = c; - } - buf[k] = NUL; - ssl_util_ppclose(s, p, fp); - - return buf; -} - -BOOL ssl_util_path_check(ssl_pathcheck_t pcm, char *path) -{ - struct stat sb; - - if (path == NULL) - return FALSE; - if (pcm & SSL_PCM_EXISTS && stat(path, &sb) != 0) - return FALSE; - if (pcm & SSL_PCM_ISREG && !S_ISREG(sb.st_mode)) - return FALSE; - if (pcm & SSL_PCM_ISDIR && !S_ISDIR(sb.st_mode)) - return FALSE; - if (pcm & SSL_PCM_ISNONZERO && sb.st_mode <= 0) - return FALSE; - return TRUE; -} - -ssl_algo_t ssl_util_algotypeof(X509 *pCert, EVP_PKEY *pKey) -{ - ssl_algo_t t; - - t = SSL_ALGO_UNKNOWN; - if (pCert != NULL) - pKey = X509_get_pubkey(pCert); - if (pKey != NULL) { - switch (EVP_PKEY_type(pKey->type)) { - case EVP_PKEY_RSA: - t = SSL_ALGO_RSA; - break; - case EVP_PKEY_DSA: - t = SSL_ALGO_DSA; - break; - default: - break; - } - } - return t; -} - -char *ssl_util_algotypestr(ssl_algo_t t) -{ - char *cp; - - cp = "UNKNOWN"; - switch (t) { - case SSL_ALGO_RSA: - cp = "RSA"; - break; - case SSL_ALGO_DSA: - cp = "DSA"; - break; - default: - break; - } - return cp; -} - -char *ssl_util_ptxtsub( - pool *p, const char *cpLine, const char *cpMatch, char *cpSubst) -{ -#define MAX_PTXTSUB 100 - char *cppMatch[MAX_PTXTSUB]; - char *cpResult; - int nResult; - int nLine; - int nSubst; - int nMatch; - char *cpI; - char *cpO; - char *cp; - int i; - - /* - * Pass 1: find substitution locations and calculate sizes - */ - nLine = strlen(cpLine); - nMatch = strlen(cpMatch); - nSubst = strlen(cpSubst); - for (cpI = (char *)cpLine, i = 0, nResult = 0; - cpI < cpLine+nLine && i < MAX_PTXTSUB; ) { - if ((cp = strstr(cpI, cpMatch)) != NULL) { - cppMatch[i++] = cp; - nResult += ((cp-cpI)+nSubst); - cpI = (cp+nMatch); - } - else { - nResult += strlen(cpI); - break; - } - } - cppMatch[i] = NULL; - if (i == 0) - return NULL; - - /* - * Pass 2: allocate memory and assemble result - */ - cpResult = ap_pcalloc(p, nResult+1); - for (cpI = (char *)cpLine, cpO = cpResult, i = 0; cppMatch[i] != NULL; i++) { - ap_cpystrn(cpO, cpI, cppMatch[i]-cpI+1); - cpO += (cppMatch[i]-cpI); - ap_cpystrn(cpO, cpSubst, nSubst+1); - cpO += nSubst; - cpI = (cppMatch[i]+nMatch); - } - ap_cpystrn(cpO, cpI, cpResult+nResult-cpO+1); - - return cpResult; -} - -/* _________________________________________________________________ -** -** Special Functions for Win32/OpenSSL -** _________________________________________________________________ -*/ - -#ifdef WIN32 -static HANDLE lock_cs[CRYPTO_NUM_LOCKS]; - -static void win32_locking_callback(int mode, int type, char* file, int line) -{ - if (mode & CRYPTO_LOCK) - WaitForSingleObject(lock_cs[type], INFINITE); - else - ReleaseMutex(lock_cs[type]); - return; -} -#endif /* WIN32 */ - -void ssl_util_thread_setup(void) -{ -#ifdef WIN32 - int i; - - for (i = 0; i < CRYPTO_NUM_LOCKS; i++) - lock_cs[i] = CreateMutex(NULL, FALSE, NULL); - CRYPTO_set_locking_callback((void(*)(int, int, const char *, int)) - win32_locking_callback); -#endif /* WIN32 */ - return; -} - diff --git a/modules/ssl/ssl_util_ssl.c b/modules/ssl/ssl_util_ssl.c deleted file mode 100644 index 19f6bd36292f0727437e55d8187ec0a22549e6d8..0000000000000000000000000000000000000000 --- a/modules/ssl/ssl_util_ssl.c +++ /dev/null @@ -1,544 +0,0 @@ -/* _ _ -** _ __ ___ ___ __| | ___ ___| | mod_ssl -** | '_ ` _ \ / _ \ / _` | / __/ __| | Apache Interface to OpenSSL -** | | | | | | (_) | (_| | \__ \__ \ | www.modssl.org -** |_| |_| |_|\___/ \__,_|___|___/___/_| ftp.modssl.org -** |_____| -** ssl_util_ssl.c -** Additional Utility Functions for OpenSSL -*/ - -/* ==================================================================== - * Copyright (c) 1998-2001 Ralf S. Engelschall. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following - * disclaimer in the documentation and/or other materials - * provided with the distribution. - * - * 3. All advertising materials mentioning features or use of this - * software must display the following acknowledgment: - * "This product includes software developed by - * Ralf S. Engelschall for use in the - * mod_ssl project (http://www.modssl.org/)." - * - * 4. The names "mod_ssl" must not be used to endorse or promote - * products derived from this software without prior written - * permission. For written permission, please contact - * rse@engelschall.com. - * - * 5. Products derived from this software may not be called "mod_ssl" - * nor may "mod_ssl" appear in their names without prior - * written permission of Ralf S. Engelschall. - * - * 6. Redistributions of any form whatsoever must retain the following - * acknowledgment: - * "This product includes software developed by - * Ralf S. Engelschall for use in the - * mod_ssl project (http://www.modssl.org/)." - * - * THIS SOFTWARE IS PROVIDED BY RALF S. ENGELSCHALL ``AS IS'' AND ANY - * EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR - * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL RALF S. ENGELSCHALL OR - * HIS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT - * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, - * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED - * OF THE POSSIBILITY OF SUCH DAMAGE. - * ==================================================================== - */ - -#include "mod_ssl.h" - - -/* _________________________________________________________________ -** -** Additional High-Level Functions for OpenSSL -** _________________________________________________________________ -*/ - -int SSL_get_app_data2_idx(void) -{ - static int app_data2_idx = -1; - - if (app_data2_idx < 0) { - app_data2_idx = SSL_get_ex_new_index(0, - "Second Application Data for SSL", NULL, NULL, NULL); - app_data2_idx = SSL_get_ex_new_index(0, - "Second Application Data for SSL", NULL, NULL, NULL); - } - return(app_data2_idx); -} - -void *SSL_get_app_data2(SSL *ssl) -{ - return (void *)SSL_get_ex_data(ssl, SSL_get_app_data2_idx()); -} - -void SSL_set_app_data2(SSL *ssl, void *arg) -{ - SSL_set_ex_data(ssl, SSL_get_app_data2_idx(), (char *)arg); - return; -} - -/* _________________________________________________________________ -** -** High-Level Certificate / Private Key Loading -** _________________________________________________________________ -*/ - -X509 *SSL_read_X509(FILE *fp, X509 **x509, int (*cb)()) -{ - X509 *rc; - BIO *bioS; - BIO *bioF; - - /* 1. try PEM (= DER+Base64+headers) */ -#if SSL_LIBRARY_VERSION < 0x00904000 - rc = PEM_read_X509(fp, x509, cb); -#else - rc = PEM_read_X509(fp, x509, cb, NULL); -#endif - if (rc == NULL) { - /* 2. try DER+Base64 */ - fseek(fp, 0L, SEEK_SET); - if ((bioS = BIO_new(BIO_s_fd())) == NULL) - return NULL; - BIO_set_fd(bioS, fileno(fp), BIO_NOCLOSE); - if ((bioF = BIO_new(BIO_f_base64())) == NULL) { - BIO_free(bioS); - return NULL; - } - bioS = BIO_push(bioF, bioS); - rc = d2i_X509_bio(bioS, NULL); - BIO_free_all(bioS); - if (rc == NULL) { - /* 3. try plain DER */ - fseek(fp, 0L, SEEK_SET); - if ((bioS = BIO_new(BIO_s_fd())) == NULL) - return NULL; - BIO_set_fd(bioS, fileno(fp), BIO_NOCLOSE); - rc = d2i_X509_bio(bioS, NULL); - BIO_free(bioS); - } - } - if (rc != NULL && x509 != NULL) { - if (*x509 != NULL) - X509_free(*x509); - *x509 = rc; - } - return rc; -} - -#if SSL_LIBRARY_VERSION <= 0x00904100 -static EVP_PKEY *d2i_PrivateKey_bio(BIO *bio, EVP_PKEY **key) -{ - return ((EVP_PKEY *)ASN1_d2i_bio( - (char *(*)())EVP_PKEY_new, - (char *(*)())d2i_PrivateKey, - (bio), (unsigned char **)(key))); -} -#endif - -EVP_PKEY *SSL_read_PrivateKey(FILE *fp, EVP_PKEY **key, int (*cb)()) -{ - EVP_PKEY *rc; - BIO *bioS; - BIO *bioF; - - /* 1. try PEM (= DER+Base64+headers) */ -#if SSL_LIBRARY_VERSION < 0x00904000 - rc = PEM_read_PrivateKey(fp, key, cb); -#else - rc = PEM_read_PrivateKey(fp, key, cb, NULL); -#endif - if (rc == NULL) { - /* 2. try DER+Base64 */ - fseek(fp, 0L, SEEK_SET); - if ((bioS = BIO_new(BIO_s_fd())) == NULL) - return NULL; - BIO_set_fd(bioS, fileno(fp), BIO_NOCLOSE); - if ((bioF = BIO_new(BIO_f_base64())) == NULL) { - BIO_free(bioS); - return NULL; - } - bioS = BIO_push(bioF, bioS); - rc = d2i_PrivateKey_bio(bioS, NULL); - BIO_free_all(bioS); - if (rc == NULL) { - /* 3. try plain DER */ - fseek(fp, 0L, SEEK_SET); - if ((bioS = BIO_new(BIO_s_fd())) == NULL) - return NULL; - BIO_set_fd(bioS, fileno(fp), BIO_NOCLOSE); - rc = d2i_PrivateKey_bio(bioS, NULL); - BIO_free(bioS); - } - } - if (rc != NULL && key != NULL) { - if (*key != NULL) - EVP_PKEY_free(*key); - *key = rc; - } - return rc; -} - -/* _________________________________________________________________ -** -** Smart shutdown -** _________________________________________________________________ -*/ - -int SSL_smart_shutdown(SSL *ssl) -{ - int i; - int rc; - - /* - * Repeat the calls, because SSL_shutdown internally dispatches through a - * little state machine. Usually only one or two interation should be - * needed, so we restrict the total number of restrictions in order to - * avoid process hangs in case the client played bad with the socket - * connection and OpenSSL cannot recognize it. - */ - rc = 0; - for (i = 0; i < 4 /* max 2x pending + 2x data = 4 */; i++) { - if ((rc = SSL_shutdown(ssl))) - break; - } - return rc; -} - -/* _________________________________________________________________ -** -** Certificate Revocation List (CRL) Storage -** _________________________________________________________________ -*/ - -X509_STORE *SSL_X509_STORE_create(char *cpFile, char *cpPath) -{ - X509_STORE *pStore; - X509_LOOKUP *pLookup; - - if (cpFile == NULL && cpPath == NULL) - return NULL; - if ((pStore = X509_STORE_new()) == NULL) - return NULL; - if (cpFile != NULL) { - if ((pLookup = X509_STORE_add_lookup(pStore, X509_LOOKUP_file())) == NULL) { - X509_STORE_free(pStore); - return NULL; - } - X509_LOOKUP_load_file(pLookup, cpFile, X509_FILETYPE_PEM); - } - if (cpPath != NULL) { - if ((pLookup = X509_STORE_add_lookup(pStore, X509_LOOKUP_hash_dir())) == NULL) { - X509_STORE_free(pStore); - return NULL; - } - X509_LOOKUP_add_dir(pLookup, cpPath, X509_FILETYPE_PEM); - } - return pStore; -} - -int SSL_X509_STORE_lookup(X509_STORE *pStore, int nType, - X509_NAME *pName, X509_OBJECT *pObj) -{ - X509_STORE_CTX pStoreCtx; - int rc; - - X509_STORE_CTX_init(&pStoreCtx, pStore, NULL, NULL); - rc = X509_STORE_get_by_subject(&pStoreCtx, nType, pName, pObj); - X509_STORE_CTX_cleanup(&pStoreCtx); - return rc; -} - -/* _________________________________________________________________ -** -** Cipher Suite Spec String Creation -** _________________________________________________________________ -*/ - -char *SSL_make_ciphersuite(pool *p, SSL *ssl) -{ - STACK_OF(SSL_CIPHER) *sk; - SSL_CIPHER *c; - int i; - int l; - char *cpCipherSuite; - char *cp; - - if (ssl == NULL) - return ""; - if ((sk = SSL_get_ciphers(ssl)) == NULL) - return ""; - l = 0; - for (i = 0; i < sk_SSL_CIPHER_num(sk); i++) { - c = sk_SSL_CIPHER_value(sk, i); - l += strlen(c->name)+2+1; - } - if (l == 0) - return ""; - cpCipherSuite = (char *)ap_palloc(p, l+1); - cp = cpCipherSuite; - for (i = 0; i < sk_SSL_CIPHER_num(sk); i++) { - c = sk_SSL_CIPHER_value(sk, i); - l = strlen(c->name); - memcpy(cp, c->name, l); - cp += l; - *cp++ = '/'; - *cp++ = (c->valid == 1 ? '1' : '0'); - *cp++ = ':'; - } - *(cp-1) = NUL; - return cpCipherSuite; -} - -/* _________________________________________________________________ -** -** Certificate Checks -** _________________________________________________________________ -*/ - -/* check whether cert contains extended key usage with a SGC tag */ -BOOL SSL_X509_isSGC(X509 *cert) -{ - X509_EXTENSION *ext; - int ext_nid; - STACK *sk; - BOOL is_sgc; - int idx; - int i; - - is_sgc = FALSE; - idx = X509_get_ext_by_NID(cert, NID_ext_key_usage, -1); - if (idx >= 0) { - ext = X509_get_ext(cert, idx); - if ((sk = (STACK *)X509V3_EXT_d2i(ext)) != NULL) { - for (i = 0; i < sk_num(sk); i++) { - ext_nid = OBJ_obj2nid((ASN1_OBJECT *)sk_value(sk, i)); - if (ext_nid == NID_ms_sgc || ext_nid == NID_ns_sgc) { - is_sgc = TRUE; - break; - } - } - } - } - return is_sgc; -} - -/* retrieve basic constraints ingredients */ -BOOL SSL_X509_getBC(X509 *cert, int *ca, int *pathlen) -{ - X509_EXTENSION *ext; - BASIC_CONSTRAINTS *bc; - int idx; - BIGNUM *bn = NULL; - char *cp; - - if ((idx = X509_get_ext_by_NID(cert, NID_basic_constraints, -1)) < 0) - return FALSE; - ext = X509_get_ext(cert, idx); - if (ext == NULL) - return FALSE; - if ((bc = (BASIC_CONSTRAINTS *)X509V3_EXT_d2i(ext)) == NULL) - return FALSE; - *ca = bc->ca; - *pathlen = -1 /* unlimited */; - if (bc->pathlen != NULL) { - if ((bn = ASN1_INTEGER_to_BN(bc->pathlen, NULL)) == NULL) - return FALSE; - if ((cp = BN_bn2dec(bn)) == NULL) - return FALSE; - *pathlen = atoi(cp); - free(cp); - BN_free(bn); - } - BASIC_CONSTRAINTS_free(bc); - return TRUE; -} - -/* retrieve subject CommonName of certificate */ -BOOL SSL_X509_getCN(pool *p, X509 *xs, char **cppCN) -{ - X509_NAME *xsn; - X509_NAME_ENTRY *xsne; - int i, nid; - - xsn = X509_get_subject_name(xs); - for (i = 0; i < sk_X509_NAME_ENTRY_num(xsn->entries); i++) { - xsne = sk_X509_NAME_ENTRY_value(xsn->entries, i); - nid = OBJ_obj2nid(xsne->object); - if (nid == NID_commonName) { - *cppCN = ap_palloc(p, xsne->value->length+1); - ap_cpystrn(*cppCN, (char *)xsne->value->data, xsne->value->length+1); - (*cppCN)[xsne->value->length] = NUL; -#ifdef CHARSET_EBCDIC - ascii2ebcdic(*cppCN, *cppCN, strlen(*cppCN)); -#endif - return TRUE; - } - } - return FALSE; -} - -/* _________________________________________________________________ -** -** Low-Level CA Certificate Loading -** _________________________________________________________________ -*/ - -#ifdef SSL_EXPERIMENTAL_PROXY - -BOOL SSL_load_CrtAndKeyInfo_file(pool *p, STACK_OF(X509_INFO) *sk, char *filename) -{ - BIO *in; - - if ((in = BIO_new(BIO_s_file())) == NULL) - return FALSE; - if (BIO_read_filename(in, filename) <= 0) { - BIO_free(in); - return FALSE; - } - ERR_clear_error(); -#if SSL_LIBRARY_VERSION < 0x00904000 - PEM_X509_INFO_read_bio(in, sk, NULL); -#else - PEM_X509_INFO_read_bio(in, sk, NULL, NULL); -#endif - BIO_free(in); - return TRUE; -} - -BOOL SSL_load_CrtAndKeyInfo_path(pool *p, STACK_OF(X509_INFO) *sk, char *pathname) -{ - struct stat st; - DIR *dir; - pool *sp; - struct dirent *nextent; - char *fullname; - BOOL ok; - - sp = ap_make_sub_pool(p); - if ((dir = ap_popendir(sp, pathname)) == NULL) { - ap_destroy_pool(sp); - return FALSE; - } - ok = FALSE; - while ((nextent = readdir(dir)) != NULL) { - fullname = ap_pstrcat(sp, pathname, "/", nextent->d_name, NULL); - if (stat(fullname, &st) != 0) - continue; - if (!S_ISREG(st.st_mode)) - continue; - if (SSL_load_CrtAndKeyInfo_file(sp, sk, fullname)) - ok = TRUE; - } - ap_pclosedir(p, dir); - ap_destroy_pool(sp); - return ok; -} - -#endif /* SSL_EXPERIMENTAL_PROXY */ - -/* _________________________________________________________________ -** -** Extra Server Certificate Chain Support -** _________________________________________________________________ -*/ - -/* - * Read a file that optionally contains the server certificate in PEM - * format, possibly followed by a sequence of CA certificates that - * should be sent to the peer in the SSL Certificate message. - */ -int SSL_CTX_use_certificate_chain( - SSL_CTX *ctx, char *file, int skipfirst, int (*cb)()) -{ - BIO *bio; - X509 *x509; - unsigned long err; - int n; - - if ((bio = BIO_new(BIO_s_file_internal())) == NULL) - return -1; - if (BIO_read_filename(bio, file) <= 0) { - BIO_free(bio); - return -1; - } - /* optionally skip a leading server certificate */ - if (skipfirst) { -#if SSL_LIBRARY_VERSION < 0x00904000 - if ((x509 = PEM_read_bio_X509(bio, NULL, cb)) == NULL) { -#else - if ((x509 = PEM_read_bio_X509(bio, NULL, cb, NULL)) == NULL) { -#endif - BIO_free(bio); - return -1; - } - X509_free(x509); - } - /* free a perhaps already configured extra chain */ - if (ctx->extra_certs != NULL) { - sk_X509_pop_free(ctx->extra_certs, X509_free); - ctx->extra_certs = NULL; - } - /* create new extra chain by loading the certs */ - n = 0; -#if SSL_LIBRARY_VERSION < 0x00904000 - while ((x509 = PEM_read_bio_X509(bio, NULL, cb)) != NULL) { -#else - while ((x509 = PEM_read_bio_X509(bio, NULL, cb, NULL)) != NULL) { -#endif - if (!SSL_CTX_add_extra_chain_cert(ctx, x509)) { - X509_free(x509); - BIO_free(bio); - return -1; - } - n++; - } - /* Make sure that only the error is just an EOF */ - if ((err = ERR_peek_error()) > 0) { - if (!( ERR_GET_LIB(err) == ERR_LIB_PEM - && ERR_GET_REASON(err) == PEM_R_NO_START_LINE)) { - BIO_free(bio); - return -1; - } - while (ERR_get_error() > 0) ; - } - BIO_free(bio); - return n; -} - -/* _________________________________________________________________ -** -** Session Stuff -** _________________________________________________________________ -*/ - -char *SSL_SESSION_id2sz(unsigned char *id, int idlen) -{ - static char str[(SSL_MAX_SSL_SESSION_ID_LENGTH+1)*2]; - char *cp; - int n; - - cp = str; - for (n = 0; n < idlen && n < SSL_MAX_SSL_SESSION_ID_LENGTH; n++) { - ap_snprintf(cp, sizeof(str)-(cp-str), "%02X", id[n]); - cp += 2; - } - *cp = NUL; - return str; -} - diff --git a/modules/ssl/ssl_util_ssl.h b/modules/ssl/ssl_util_ssl.h deleted file mode 100644 index 23aaaaa40d20ab627f858aa2595e7c36e8918bdb..0000000000000000000000000000000000000000 --- a/modules/ssl/ssl_util_ssl.h +++ /dev/null @@ -1,115 +0,0 @@ -/* _ _ -** _ __ ___ ___ __| | ___ ___| | mod_ssl -** | '_ ` _ \ / _ \ / _` | / __/ __| | Apache Interface to OpenSSL -** | | | | | | (_) | (_| | \__ \__ \ | www.modssl.org -** |_| |_| |_|\___/ \__,_|___|___/___/_| ftp.modssl.org -** |_____| -** ssl_util_ssl.h -** Additional Utility Functions for OpenSSL -*/ - -/* ==================================================================== - * Copyright (c) 1998-2001 Ralf S. Engelschall. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following - * disclaimer in the documentation and/or other materials - * provided with the distribution. - * - * 3. All advertising materials mentioning features or use of this - * software must display the following acknowledgment: - * "This product includes software developed by - * Ralf S. Engelschall for use in the - * mod_ssl project (http://www.modssl.org/)." - * - * 4. The names "mod_ssl" must not be used to endorse or promote - * products derived from this software without prior written - * permission. For written permission, please contact - * rse@engelschall.com. - * - * 5. Products derived from this software may not be called "mod_ssl" - * nor may "mod_ssl" appear in their names without prior - * written permission of Ralf S. Engelschall. - * - * 6. Redistributions of any form whatsoever must retain the following - * acknowledgment: - * "This product includes software developed by - * Ralf S. Engelschall for use in the - * mod_ssl project (http://www.modssl.org/)." - * - * THIS SOFTWARE IS PROVIDED BY RALF S. ENGELSCHALL ``AS IS'' AND ANY - * EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR - * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL RALF S. ENGELSCHALL OR - * HIS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT - * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, - * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED - * OF THE POSSIBILITY OF SUCH DAMAGE. - * ==================================================================== - */ - -#ifndef SSL_UTIL_SSL_H -#define SSL_UTIL_SSL_H - -/* - * Determine SSL library version number - */ -#ifdef OPENSSL_VERSION_NUMBER -#define SSL_LIBRARY_VERSION OPENSSL_VERSION_NUMBER -#define SSL_LIBRARY_NAME "OpenSSL" -#define SSL_LIBRARY_TEXT OPENSSL_VERSION_TEXT -#else -#define SSL_LIBRARY_VERSION 0x0000 -#define SSL_LIBRARY_NAME "OtherSSL" -#define SSL_LIBRARY_TEXT "OtherSSL 0.0.0 00 XXX 0000" -#endif - -/* - * Support for retrieving/overriding states - */ -#ifndef SSL_get_state -#define SSL_get_state(ssl) SSL_state(ssl) -#endif -#define SSL_set_state(ssl,val) (ssl)->state = val - -/* - * Maximum length of a DER encoded session. - * FIXME: There is no define in OpenSSL, but OpenSSL uses 1024*10, - * so this value should be ok. Although we have no warm feeling. - */ -#define SSL_SESSION_MAX_DER 1024*10 - -/* - * Additional Functions - */ -int SSL_get_app_data2_idx(void); -void *SSL_get_app_data2(SSL *); -void SSL_set_app_data2(SSL *, void *); -X509 *SSL_read_X509(FILE *, X509 **, int (*)()); -EVP_PKEY *SSL_read_PrivateKey(FILE *, EVP_PKEY **, int (*)()); -int SSL_smart_shutdown(SSL *ssl); -X509_STORE *SSL_X509_STORE_create(char *, char *); -int SSL_X509_STORE_lookup(X509_STORE *, int, X509_NAME *, X509_OBJECT *); -char *SSL_make_ciphersuite(pool *, SSL *); -BOOL SSL_X509_isSGC(X509 *); -BOOL SSL_X509_getBC(X509 *, int *, int *); -BOOL SSL_X509_getCN(pool *, X509 *, char **); -#ifdef SSL_EXPERIMENTAL_PROXY -BOOL SSL_load_CrtAndKeyInfo_file(pool *, STACK_OF(X509_INFO) *, char *); -BOOL SSL_load_CrtAndKeyInfo_path(pool *, STACK_OF(X509_INFO) *, char *); -#endif /* SSL_EXPERIMENTAL_PROXY */ -int SSL_CTX_use_certificate_chain(SSL_CTX *, char *, int, int (*)()); -char *SSL_SESSION_id2sz(unsigned char *, int); - -#endif /* SSL_UTIL_SSL_H */ diff --git a/modules/test/.cvsignore b/modules/test/.cvsignore deleted file mode 100644 index 8b4c6e3da420bce04859c68624df9b0c5e693224..0000000000000000000000000000000000000000 --- a/modules/test/.cvsignore +++ /dev/null @@ -1,3 +0,0 @@ -Makefile -*.lo -*.so diff --git a/modules/test/.indent.pro b/modules/test/.indent.pro deleted file mode 100644 index a9fbe9f9a1f2e6e7bcc54171c215bdacd44171ba..0000000000000000000000000000000000000000 --- a/modules/test/.indent.pro +++ /dev/null @@ -1,54 +0,0 @@ --i4 -npsl -di0 -br -nce -d0 -cli0 -npcs -nfc1 --TBUFF --TFILE --TTRANS --TUINT4 --T_trans --Tallow_options_t --Tapache_sfio --Tarray_header --Tbool_int --Tbuf_area --Tbuff_struct --Tbuffy --Tcmd_how --Tcmd_parms --Tcommand_rec --Tcommand_struct --Tconn_rec --Tcore_dir_config --Tcore_server_config --Tdir_maker_func --Tevent --Tglobals_s --Thandler_func --Thandler_rec --Tjoblist_s --Tlisten_rec --Tmerger_func --Tmode_t --Tmodule --Tmodule_struct --Tmutex --Tn_long --Tother_child_rec --Toverrides_t --Tparent_score --Tpid_t --Tpiped_log --Tpool --Trequest_rec --Trequire_line --Trlim_t --Tscoreboard --Tsemaphore --Tserver_addr_rec --Tserver_rec --Tserver_rec_chain --Tshort_score --Ttable --Ttable_entry --Tthread --Tu_wide_int --Tvtime_t --Twide_int diff --git a/modules/test/Makefile.in b/modules/test/Makefile.in deleted file mode 100644 index 7c5c149d852ad309f0cd958ac3e84c3cb5b72dc9..0000000000000000000000000000000000000000 --- a/modules/test/Makefile.in +++ /dev/null @@ -1,3 +0,0 @@ -# a modules Makefile has no explicit targets -- they will be defined by -# whatever modules are enabled. just grab special.mk to deal with this. -include $(top_srcdir)/build/special.mk diff --git a/modules/test/README b/modules/test/README deleted file mode 100644 index c61763c1dde928ad130e7dd3f09a5702685f1475..0000000000000000000000000000000000000000 --- a/modules/test/README +++ /dev/null @@ -1,3 +0,0 @@ -This directory is intended to house modules which are used for testing -server functionality. They're unsupported, and not guaranteed to remain -consistant between releases. You're on your own completely with these. diff --git a/modules/test/config.m4 b/modules/test/config.m4 deleted file mode 100644 index 01bc0fa9717191217a07c19b25e1c5aa5db82142..0000000000000000000000000000000000000000 --- a/modules/test/config.m4 +++ /dev/null @@ -1,9 +0,0 @@ - -APACHE_MODPATH_INIT(test) - -APACHE_MODULE(optional_hook_export, example optional hook exporter, , , no) -APACHE_MODULE(optional_hook_import, example optional hook importer, , , no) -APACHE_MODULE(optional_fn_import, example optional function importer, , , no) -APACHE_MODULE(optional_fn_export, example optional function exporter, , , no) - -APACHE_MODPATH_FINISH diff --git a/modules/test/mod_bucketeer.c b/modules/test/mod_bucketeer.c deleted file mode 100644 index b77c86a2f6db2601189ef03235aa4b5fdf9fe0fa..0000000000000000000000000000000000000000 --- a/modules/test/mod_bucketeer.c +++ /dev/null @@ -1,224 +0,0 @@ -/* ==================================================================== - * The Apache Software License, Version 1.1 - * - * Copyright (c) 2000-2001 The Apache Software Foundation. All rights - * reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in - * the documentation and/or other materials provided with the - * distribution. - * - * 3. The end-user documentation included with the redistribution, - * if any, must include the following acknowledgment: - * "This product includes software developed by the - * Apache Software Foundation (http://www.apache.org/)." - * Alternately, this acknowledgment may appear in the software itself, - * if and wherever such third-party acknowledgments normally appear. - * - * 4. The names "Apache" and "Apache Software Foundation" must - * not be used to endorse or promote products derived from this - * software without prior written permission. For written - * permission, please contact apache@apache.org. - * - * 5. Products derived from this software may not be called "Apache", - * nor may "Apache" appear in their name, without prior written - * permission of the Apache Software Foundation. - * - * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED - * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES - * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR - * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF - * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND - * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, - * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT - * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * ==================================================================== - * - * This software consists of voluntary contributions made by many - * individuals on behalf of the Apache Software Foundation. For more - * information on the Apache Software Foundation, please see - * . - * - * Portions of this software are based upon public domain software - * (zlib functions gz_open and gzwrite) - */ - -/* - * mod_bucketeer.c: split buckets whenever we find a control-char - * - * Written by Ian Holsman (IanH@apache.org) - * - */ - -#include "httpd.h" -#include "http_config.h" -#include "http_log.h" -#include "apr_strings.h" -#include "apr_general.h" -#include "util_filter.h" -#include "apr_buckets.h" -#include "http_request.h" - - -static const char bucketeerFilterName[] = "BUCKETEER"; -module AP_MODULE_DECLARE_DATA bucketeer_module; - -typedef struct bucketeer_filter_config_t -{ - char bucketdelimter; - char flushdelimiter; - -} bucketeer_filter_config_t; - - -static void *create_bucketeer_server_config(apr_pool_t *p, server_rec *s) -{ - bucketeer_filter_config_t *c = apr_pcalloc(p, sizeof *c); - - c->bucketdelimter = 0x02; /* ^B */ - c->flushdelimiter = 0x06; /* ^F */ - - return c; -} - - -typedef struct bucketeer_ctx_t -{ - apr_bucket_brigade *bb; -} bucketeer_ctx_t; - -static apr_status_t bucketeer_out_filter(ap_filter_t *f, - apr_bucket_brigade *bb) -{ - apr_bucket *e; - request_rec *r = f->r; - bucketeer_ctx_t *ctx = f->ctx; - - bucketeer_filter_config_t *c = ap_get_module_config(r->server->module_config, - &bucketeer_module); - - /* If we don't have a context, we need to ensure that it is okay to send - * the deflated content. If we have a context, that means we've done - * this before and we liked it. - * This could be not so nice if we always fail. But, if we succeed, - * we're in better shape. - */ - if (!ctx) { - if (strncmp(r->content_type, "text/", 5)) { - ap_remove_output_filter(f); - return ap_pass_brigade(f->next, bb); - } - - /* We're cool with filtering this. */ - ctx = f->ctx = apr_pcalloc(f->r->pool, sizeof(*ctx)); - ctx->bb = apr_brigade_create(f->r->pool); - } - - APR_BRIGADE_FOREACH(e, bb) { - const char *data; - apr_size_t len; - - int done = 0; - apr_size_t i; - apr_size_t lastpos; - - if (APR_BUCKET_IS_EOS(e)) { - - APR_BUCKET_REMOVE(e); - APR_BRIGADE_INSERT_TAIL(ctx->bb, e); - - /* Okay, we've seen the EOS. - * Time to pass it along down the chain. - */ - return ap_pass_brigade(f->next, ctx->bb); - } - - if (APR_BUCKET_IS_FLUSH(e)) { - /* - * Ignore flush buckets for the moment.. - * we decide what to stream - */ - continue; - } - - /* read */ - apr_bucket_read(e, &data, &len, APR_BLOCK_READ); - if (len>0) { - lastpos=0; - for (i=0; iflushdelimiter ) { - apr_bucket *p; - if ( i-lastpos>0) { - p = apr_bucket_pool_create(apr_pmemdup( f->r->pool, - &data[lastpos], - i-lastpos), - i-lastpos, - f->r->pool); - APR_BRIGADE_INSERT_TAIL(ctx->bb,p); - } - lastpos=i+1; - - p = apr_bucket_flush_create(); - APR_BRIGADE_INSERT_TAIL(ctx->bb,p); - - } - else { - if (data[i] == c->bucketdelimter) { - apr_bucket *p; - if ( i-lastpos>0) { - p = apr_bucket_pool_create(apr_pmemdup( f->r->pool, - &data[lastpos], - i-lastpos), - i-lastpos, - f->r->pool); - - APR_BRIGADE_INSERT_TAIL(ctx->bb,p); - } - lastpos=i+1; - } - } - } - /* XXX: really should append this to the next 'real' bucket */ - if ( lastpos < i ) { - apr_bucket *p; - p = apr_bucket_pool_create(apr_pmemdup( f->r->pool,&data[lastpos],i-lastpos),i-lastpos,f->r->pool); - lastpos=i; - APR_BRIGADE_INSERT_TAIL(ctx->bb,p); - } - } - } - - return APR_SUCCESS; -} - -static void register_hooks(apr_pool_t * p) -{ - ap_register_output_filter(bucketeerFilterName, bucketeer_out_filter, - AP_FTYPE_CONTENT-1); -} - -static const command_rec bucketeer_filter_cmds[] = { - {NULL} -}; - -module AP_MODULE_DECLARE_DATA bucketeer_module = { - STANDARD20_MODULE_STUFF, - NULL, - NULL, - create_bucketeer_server_config, - NULL, - bucketeer_filter_cmds, - register_hooks -}; diff --git a/modules/test/mod_optional_fn_export.c b/modules/test/mod_optional_fn_export.c deleted file mode 100644 index b214a36621b2e8e28efc10ccc5fed2229a725a14..0000000000000000000000000000000000000000 --- a/modules/test/mod_optional_fn_export.c +++ /dev/null @@ -1,86 +0,0 @@ -/* ==================================================================== - * The Apache Software License, Version 1.1 - * - * Copyright (c) 2001 The Apache Software Foundation. All rights - * reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in - * the documentation and/or other materials provided with the - * distribution. - * - * 3. The end-user documentation included with the redistribution, - * if any, must include the following acknowledgment: - * "This product includes software developed by the - * Apache Software Foundation (http://www.apache.org/)." - * Alternately, this acknowledgment may appear in the software itself, - * if and wherever such third-party acknowledgments normally appear. - * - * 4. The names "Apache" and "Apache Software Foundation" must - * not be used to endorse or promote products derived from this - * software without prior written permission. For written - * permission, please contact apache@apache.org. - * - * 5. Products derived from this software may not be called "Apache", - * nor may "Apache" appear in their name, without prior written - * permission of the Apache Software Foundation. - * - * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED - * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES - * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR - * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF - * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND - * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, - * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT - * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * ==================================================================== - * - * This software consists of voluntary contributions made by many - * individuals on behalf of the Apache Software Foundation. For more - * information on the Apache Software Foundation, please see - * . - */ - -#include "httpd.h" -#include "http_config.h" -#include "http_log.h" -#include "mod_optional_fn_export.h" - -/* The alert will note a strange mirror-image style resemblance to - * mod_generic_hook_import.c. Yes, I _did_ mean import. Think about it. - */ - -static int TestOptionalFn(const char *szStr) -{ - ap_log_error(APLOG_MARK,APLOG_ERR,OK,NULL, - "Optional function test said: %s",szStr); - - return OK; -} - -static void ExportRegisterHooks(apr_pool_t *p) -{ - APR_REGISTER_OPTIONAL_FN(TestOptionalFn); -} - -module optional_fn_export_module= -{ - STANDARD20_MODULE_STUFF, - NULL, - NULL, - NULL, - NULL, - NULL, - ExportRegisterHooks -}; diff --git a/modules/test/mod_optional_fn_export.h b/modules/test/mod_optional_fn_export.h deleted file mode 100644 index 800ccab4f6840c188038a42116ac9342b8aa53a0..0000000000000000000000000000000000000000 --- a/modules/test/mod_optional_fn_export.h +++ /dev/null @@ -1,3 +0,0 @@ -#include "apr_optional.h" - -APR_DECLARE_OPTIONAL_FN(int,TestOptionalFn,(const char *)) diff --git a/modules/test/mod_optional_fn_import.c b/modules/test/mod_optional_fn_import.c deleted file mode 100644 index 2ad313ef9add2e3031a5b6fe7ae6cedf0d0d3773..0000000000000000000000000000000000000000 --- a/modules/test/mod_optional_fn_import.c +++ /dev/null @@ -1,93 +0,0 @@ -/* ==================================================================== - * The Apache Software License, Version 1.1 - * - * Copyright (c) 2001 The Apache Software Foundation. All rights - * reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in - * the documentation and/or other materials provided with the - * distribution. - * - * 3. The end-user documentation included with the redistribution, - * if any, must include the following acknowledgment: - * "This product includes software developed by the - * Apache Software Foundation (http://www.apache.org/)." - * Alternately, this acknowledgment may appear in the software itself, - * if and wherever such third-party acknowledgments normally appear. - * - * 4. The names "Apache" and "Apache Software Foundation" must - * not be used to endorse or promote products derived from this - * software without prior written permission. For written - * permission, please contact apache@apache.org. - * - * 5. Products derived from this software may not be called "Apache", - * nor may "Apache" appear in their name, without prior written - * permission of the Apache Software Foundation. - * - * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED - * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES - * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR - * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF - * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND - * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, - * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT - * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * ==================================================================== - * - * This software consists of voluntary contributions made by many - * individuals on behalf of the Apache Software Foundation. For more - * information on the Apache Software Foundation, please see - * . - */ - -#include "httpd.h" -#include "http_config.h" -#include "mod_optional_fn_export.h" -#include "http_protocol.h" - -/* The alert will note a strange mirror-image style resemblance to - * mod_generic_hook_export.c. Yes, I _did_ mean export. Think about it. - */ - -static APR_OPTIONAL_FN_TYPE(TestOptionalFn) *pfn; - -static int ImportLogTransaction(request_rec *r) -{ - if(pfn) - return pfn(r->the_request); - return DECLINED; -} - -void ImportFnRetrieve(void) -{ - pfn=APR_RETRIEVE_OPTIONAL_FN(TestOptionalFn); -} - -static void ImportRegisterHooks(apr_pool_t *p) -{ - ap_hook_log_transaction(ImportLogTransaction,NULL,NULL,APR_HOOK_MIDDLE); - ap_hook_optional_fn_retrieve(ImportFnRetrieve,NULL,NULL,APR_HOOK_MIDDLE); -} - -module optional_fn_import_module = -{ - STANDARD20_MODULE_STUFF, - NULL, - NULL, - NULL, - NULL, - NULL, - ImportRegisterHooks -}; diff --git a/modules/test/mod_optional_hook_export.c b/modules/test/mod_optional_hook_export.c deleted file mode 100644 index 34ef97b543aee095ee24c578e83463d2445f5359..0000000000000000000000000000000000000000 --- a/modules/test/mod_optional_hook_export.c +++ /dev/null @@ -1,83 +0,0 @@ -/* ==================================================================== - * The Apache Software License, Version 1.1 - * - * Copyright (c) 2000-2001 The Apache Software Foundation. All rights - * reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in - * the documentation and/or other materials provided with the - * distribution. - * - * 3. The end-user documentation included with the redistribution, - * if any, must include the following acknowledgment: - * "This product includes software developed by the - * Apache Software Foundation (http://www.apache.org/)." - * Alternately, this acknowledgment may appear in the software itself, - * if and wherever such third-party acknowledgments normally appear. - * - * 4. The names "Apache" and "Apache Software Foundation" must - * not be used to endorse or promote products derived from this - * software without prior written permission. For written - * permission, please contact apache@apache.org. - * - * 5. Products derived from this software may not be called "Apache", - * nor may "Apache" appear in their name, without prior written - * permission of the Apache Software Foundation. - * - * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED - * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES - * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR - * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF - * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND - * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, - * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT - * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * ==================================================================== - * - * This software consists of voluntary contributions made by many - * individuals on behalf of the Apache Software Foundation. For more - * information on the Apache Software Foundation, please see - * . - */ - -#include "httpd.h" -#include "http_config.h" -#include "mod_optional_hook_export.h" -#include "http_protocol.h" - -APR_IMPLEMENT_OPTIONAL_HOOK_RUN_ALL(ap,AP_MODULE,int,generic_hook_test, - (const char *szStr), - (szStr),OK,DECLINED) - -static int ExportLogTransaction(request_rec *r) -{ - return ap_run_generic_hook_test(r->the_request); -} - -static void ExportRegisterHooks(apr_pool_t *p) -{ - ap_hook_log_transaction(ExportLogTransaction,NULL,NULL,APR_HOOK_MIDDLE); -} - -module optional_hook_export_module = -{ - STANDARD20_MODULE_STUFF, - NULL, - NULL, - NULL, - NULL, - NULL, - ExportRegisterHooks -}; diff --git a/modules/test/mod_optional_hook_export.h b/modules/test/mod_optional_hook_export.h deleted file mode 100644 index 7494078cdd244bfd9abcb0266e952a6a2fcd1ec2..0000000000000000000000000000000000000000 --- a/modules/test/mod_optional_hook_export.h +++ /dev/null @@ -1,62 +0,0 @@ -/* ==================================================================== - * The Apache Software License, Version 1.1 - * - * Copyright (c) 2000-2001 The Apache Software Foundation. All rights - * reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in - * the documentation and/or other materials provided with the - * distribution. - * - * 3. The end-user documentation included with the redistribution, - * if any, must include the following acknowledgment: - * "This product includes software developed by the - * Apache Software Foundation (http://www.apache.org/)." - * Alternately, this acknowledgment may appear in the software itself, - * if and wherever such third-party acknowledgments normally appear. - * - * 4. The names "Apache" and "Apache Software Foundation" must - * not be used to endorse or promote products derived from this - * software without prior written permission. For written - * permission, please contact apache@apache.org. - * - * 5. Products derived from this software may not be called "Apache", - * nor may "Apache" appear in their name, without prior written - * permission of the Apache Software Foundation. - * - * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED - * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES - * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR - * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF - * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND - * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, - * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT - * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * ==================================================================== - * - * This software consists of voluntary contributions made by many - * individuals on behalf of the Apache Software Foundation. For more - * information on the Apache Software Foundation, please see - * . - */ - -#ifndef MOD_GENERIC_HOOK_EXPORT_H -#define MOD_GENERIC_HOOK_EXPORT_H - -#include "apr_optional_hooks.h" - -APR_DECLARE_EXTERNAL_HOOK(ap,AP_MODULE,int,generic_hook_test,(const char *)) - -#endif /* def MOD_GENERIC_HOOK_EXPORT_H */ diff --git a/modules/test/mod_optional_hook_import.c b/modules/test/mod_optional_hook_import.c deleted file mode 100644 index ebf01586108c4dba4f00c484052d31d6f3df26e3..0000000000000000000000000000000000000000 --- a/modules/test/mod_optional_hook_import.c +++ /dev/null @@ -1,83 +0,0 @@ -/* ==================================================================== - * The Apache Software License, Version 1.1 - * - * Copyright (c) 2000-2001 The Apache Software Foundation. All rights - * reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in - * the documentation and/or other materials provided with the - * distribution. - * - * 3. The end-user documentation included with the redistribution, - * if any, must include the following acknowledgment: - * "This product includes software developed by the - * Apache Software Foundation (http://www.apache.org/)." - * Alternately, this acknowledgment may appear in the software itself, - * if and wherever such third-party acknowledgments normally appear. - * - * 4. The names "Apache" and "Apache Software Foundation" must - * not be used to endorse or promote products derived from this - * software without prior written permission. For written - * permission, please contact apache@apache.org. - * - * 5. Products derived from this software may not be called "Apache", - * nor may "Apache" appear in their name, without prior written - * permission of the Apache Software Foundation. - * - * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED - * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES - * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR - * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF - * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND - * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, - * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT - * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * ==================================================================== - * - * This software consists of voluntary contributions made by many - * individuals on behalf of the Apache Software Foundation. For more - * information on the Apache Software Foundation, please see - * . - */ - -#include "httpd.h" -#include "http_config.h" -#include "http_log.h" -#include "mod_optional_hook_export.h" - -static int ImportGenericHookTestHook(const char *szStr) -{ - ap_log_error(APLOG_MARK,APLOG_ERR,OK,NULL,"Generic hook test said: %s", - szStr); - - return OK; -} - -static void ImportRegisterHooks(apr_pool_t *p) -{ - APR_OPTIONAL_HOOK(ap,generic_hook_test,ImportGenericHookTestHook,NULL,NULL, - APR_HOOK_MIDDLE); -} - -module optional_hook_import_module= -{ - STANDARD20_MODULE_STUFF, - NULL, - NULL, - NULL, - NULL, - NULL, - ImportRegisterHooks -}; diff --git a/os/.cvsignore b/os/.cvsignore deleted file mode 100644 index f3c7a7c5da68804a1bdf391127ba34aed33c3cca..0000000000000000000000000000000000000000 --- a/os/.cvsignore +++ /dev/null @@ -1 +0,0 @@ -Makefile diff --git a/os/.indent.pro b/os/.indent.pro deleted file mode 100644 index a9fbe9f9a1f2e6e7bcc54171c215bdacd44171ba..0000000000000000000000000000000000000000 --- a/os/.indent.pro +++ /dev/null @@ -1,54 +0,0 @@ --i4 -npsl -di0 -br -nce -d0 -cli0 -npcs -nfc1 --TBUFF --TFILE --TTRANS --TUINT4 --T_trans --Tallow_options_t --Tapache_sfio --Tarray_header --Tbool_int --Tbuf_area --Tbuff_struct --Tbuffy --Tcmd_how --Tcmd_parms --Tcommand_rec --Tcommand_struct --Tconn_rec --Tcore_dir_config --Tcore_server_config --Tdir_maker_func --Tevent --Tglobals_s --Thandler_func --Thandler_rec --Tjoblist_s --Tlisten_rec --Tmerger_func --Tmode_t --Tmodule --Tmodule_struct --Tmutex --Tn_long --Tother_child_rec --Toverrides_t --Tparent_score --Tpid_t --Tpiped_log --Tpool --Trequest_rec --Trequire_line --Trlim_t --Tscoreboard --Tsemaphore --Tserver_addr_rec --Tserver_rec --Tserver_rec_chain --Tshort_score --Ttable --Ttable_entry --Tthread --Tu_wide_int --Tvtime_t --Twide_int diff --git a/os/Makefile.in b/os/Makefile.in deleted file mode 100644 index 0e62c951ce8d180060211f912d21e7bb97d2d66b..0000000000000000000000000000000000000000 --- a/os/Makefile.in +++ /dev/null @@ -1,9 +0,0 @@ - -DEPTH = .. -topsrcdir = @topsrcdir@ -srcdir = @srcdir@ -VPATH = @srcdir@ - -SUBDIRS = $(OS) - -include $(topsrcdir)/build/rules.mk diff --git a/os/beos/.cvsignore b/os/beos/.cvsignore deleted file mode 100644 index bbc8ba00d112af1e97c1d11db19fdd45a7aab9a5..0000000000000000000000000000000000000000 --- a/os/beos/.cvsignore +++ /dev/null @@ -1,5 +0,0 @@ -Makefile -.deps -.libs -*.lo -*.la diff --git a/os/beos/Makefile.in b/os/beos/Makefile.in deleted file mode 100644 index ea86214b21a631770bee75fb48c940ea6567aefd..0000000000000000000000000000000000000000 --- a/os/beos/Makefile.in +++ /dev/null @@ -1,10 +0,0 @@ - -DEPTH = ../.. -topsrcdir = @topsrcdir@ -srcdir = @srcdir@ -VPATH = @srcdir@ - -LTLIBRARY_NAME = libos.la -LTLIBRARY_SOURCES = os.c os-inline.c beosd.c iol_socket.c - -include $(topsrcdir)/build/ltlib.mk diff --git a/os/beos/beosd.c b/os/beos/beosd.c deleted file mode 100644 index af364c6989900940137d81c141326f01423fd1dd..0000000000000000000000000000000000000000 --- a/os/beos/beosd.c +++ /dev/null @@ -1,227 +0,0 @@ -/* ==================================================================== - * Copyright (c) 1998-1999 The Apache Group. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in - * the documentation and/or other materials provided with the - * distribution. - * - * 3. All advertising materials mentioning features or use of this - * software must display the following acknowledgment: - * "This product includes software developed by the Apache Group - * for use in the Apache HTTP server project (http://www.apache.org/)." - * - * 4. The names "Apache Server" and "Apache Group" must not be used to - * endorse or promote products derived from this software without - * prior written permission. For written permission, please contact - * apache@apache.org. - * - * 5. Products derived from this software may not be called "Apache" - * nor may "Apache" appear in their names without prior written - * permission of the Apache Group. - * - * 6. Redistributions of any form whatsoever must retain the following - * acknowledgment: - * "This product includes software developed by the Apache Group - * for use in the Apache HTTP server project (http://www.apache.org/)." - * - * THIS SOFTWARE IS PROVIDED BY THE APACHE GROUP ``AS IS'' AND ANY - * EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR - * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE APACHE GROUP OR - * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT - * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, - * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED - * OF THE POSSIBILITY OF SUCH DAMAGE. - * ==================================================================== - * - * This software consists of voluntary contributions made by many - * individuals on behalf of the Apache Group and was originally based - * on public domain software written at the National Center for - * Supercomputing Applications, University of Illinois, Urbana-Champaign. - * For more information on the Apache Group and the Apache HTTP server - * project, please see . - * - */ - -#include "httpd.h" -#include "http_config.h" -#include "http_main.h" -#include "http_log.h" -#include "unixd.h" - -unixd_config_rec unixd_config; - -void unixd_detach(void) -{ - int x; - pid_t pgrp; - - chdir("/"); - - if ((x = fork()) > 0) - exit(0); - else if (x == -1) { - perror("fork"); - fprintf(stderr, "%s: unable to fork new process\n", ap_server_argv0); - exit(1); - } - RAISE_SIGSTOP(DETACH); - -#ifndef NO_SETSID - if ((pgrp = setsid()) == -1) { - perror("setsid"); - fprintf(stderr, "%s: setsid failed\n", ap_server_argv0); - exit(1); - } -#else - if ((pgrp = setpgrp(getpid(), 0)) == -1) { - perror("setpgrp"); - fprintf(stderr, "%s: setpgrp failed\n", ap_server_argv0); - exit(1); - } -#endif - - /* close out the standard file descriptors */ - if (freopen("/dev/null", "r", stdin) == NULL) { - fprintf(stderr, "%s: unable to replace stdin with /dev/null: %s\n", - ap_server_argv0, strerror(errno)); - /* continue anyhow -- note we can't close out descriptor 0 because we - * have nothing to replace it with, and if we didn't have a descriptor - * 0 the next file would be created with that value ... leading to - * havoc. - */ - } - if (freopen("/dev/null", "w", stdout) == NULL) { - fprintf(stderr, "%s: unable to replace stdout with /dev/null: %s\n", - ap_server_argv0, strerror(errno)); - } - /* stderr is a tricky one, we really want it to be the error_log, - * but we haven't opened that yet. So leave it alone for now and it'll - * be reopened moments later. - */ -} - -/* Set group privileges. - * - * Note that we use the username as set in the config files, rather than - * the lookup of to uid --- the same uid may have multiple passwd entries, - * with different sets of groups for each. - */ - -static int set_group_privs(void) -{ - if (!geteuid()) { - char *name; - - /* Get username if passed as a uid */ - - if (unixd_config.user_name[0] == '#') { - struct passwd *ent; - uid_t uid = atoi(&unixd_config.user_name[1]); - - if ((ent = getpwuid(uid)) == NULL) { - ap_log_error(APLOG_MARK, APLOG_ALERT, NULL, - "getpwuid: couldn't determine user name from uid %u, " - "you probably need to modify the User directive", - (unsigned)uid); - return -1; - } - - name = ent->pw_name; - } - else - name = unixd_config.user_name; - - if (setgid(unixd_config.group_id) == -1) { - ap_log_error(APLOG_MARK, APLOG_ALERT, NULL, - "setgid: unable to set group id to Group %u", - (unsigned)unixd_config.group_id); - return -1; - } - - /* Reset `groups' attributes. */ - - if (initgroups(name, unixd_config.group_id) == -1) { - ap_log_error(APLOG_MARK, APLOG_ALERT, NULL, - "initgroups: unable to set groups for User %s " - "and Group %u", name, (unsigned)unixd_config.group_id); - return -1; - } - } - return 0; -} - - -int unixd_setup_child(void) -{ - if (set_group_privs()) { - return -1; - } - - /* Only try to switch if we're running as root */ - if (!geteuid() && ( - setuid(unixd_config.user_id) == -1)) { - ap_log_error(APLOG_MARK, APLOG_ALERT, NULL, - "setuid: unable to change uid"); - return -1; - } - return 0; -} - - -const char *unixd_set_user(cmd_parms *cmd, void *dummy, char *arg) -{ - const char *err = ap_check_cmd_context(cmd, GLOBAL_ONLY); - if (err != NULL) { - return err; - } - - unixd_config.user_name = arg; - unixd_config.user_id = ap_uname2id(arg); -#if !defined (BIG_SECURITY_HOLE) && !defined (OS2) - if (unixd_config.user_id == 0) { - return "Error:\tApache has not been designed to serve pages while\n" - "\trunning as root. There are known race conditions that\n" - "\twill allow any local user to read any file on the system.\n" - "\tIf you still desire to serve pages as root then\n" - "\tadd -DBIG_SECURITY_HOLE to the EXTRA_CFLAGS line in your\n" - "\tsrc/Configuration file and rebuild the server. It is\n" - "\tstrongly suggested that you instead modify the User\n" - "\tdirective in your httpd.conf file to list a non-root\n" - "\tuser.\n"; - } -#endif - - return NULL; -} - -const char *unixd_set_group(cmd_parms *cmd, void *dummy, char *arg) -{ - const char *err = ap_check_cmd_context(cmd, GLOBAL_ONLY); - if (err != NULL) { - return err; - } - - unixd_config.group_id = ap_gname2id(arg); - - return NULL; -} - -void unixd_pre_config(void) -{ - unixd_config.user_name = DEFAULT_USER; - unixd_config.user_id = ap_uname2id(DEFAULT_USER); - unixd_config.group_id = ap_gname2id(DEFAULT_GROUP); -} diff --git a/os/beos/beosd.h b/os/beos/beosd.h deleted file mode 100644 index 37cb2f95b69995aae3fffd8bca97f9e676537c4c..0000000000000000000000000000000000000000 --- a/os/beos/beosd.h +++ /dev/null @@ -1,82 +0,0 @@ -/* ==================================================================== - * Copyright (c) 1998-1999 The Apache Group. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in - * the documentation and/or other materials provided with the - * distribution. - * - * 3. All advertising materials mentioning features or use of this - * software must display the following acknowledgment: - * "This product includes software developed by the Apache Group - * for use in the Apache HTTP server project (http://www.apache.org/)." - * - * 4. The names "Apache Server" and "Apache Group" must not be used to - * endorse or promote products derived from this software without - * prior written permission. For written permission, please contact - * apache@apache.org. - * - * 5. Products derived from this software may not be called "Apache" - * nor may "Apache" appear in their names without prior written - * permission of the Apache Group. - * - * 6. Redistributions of any form whatsoever must retain the following - * acknowledgment: - * "This product includes software developed by the Apache Group - * for use in the Apache HTTP server project (http://www.apache.org/)." - * - * THIS SOFTWARE IS PROVIDED BY THE APACHE GROUP ``AS IS'' AND ANY - * EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR - * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE APACHE GROUP OR - * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT - * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, - * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED - * OF THE POSSIBILITY OF SUCH DAMAGE. - * ==================================================================== - * - * This software consists of voluntary contributions made by many - * individuals on behalf of the Apache Group and was originally based - * on public domain software written at the National Center for - * Supercomputing Applications, University of Illinois, Urbana-Champaign. - * For more information on the Apache Group and the Apache HTTP server - * project, please see . - * - */ - -#ifndef UNIXD_H -#define UNIXD_H - -/* common stuff that unix MPMs will want */ - -typedef struct { - char *user_name; - uid_t user_id; - gid_t group_id; -} unixd_config_rec; -extern unixd_config_rec unixd_config; - -void unixd_detach(void); -int unixd_setup_child(void); -void unixd_pre_config(void); -const char *unixd_set_user(cmd_parms *cmd, void *dummy, char *arg); -const char *unixd_set_group(cmd_parms *cmd, void *dummy, char *arg); - -#define UNIX_DAEMON_COMMANDS \ -{ "User", unixd_set_user, NULL, RSRC_CONF, TAKE1, \ - "Effective user id for this server"}, \ -{ "Group", unixd_set_group, NULL, RSRC_CONF, TAKE1, \ - "Effective group id for this server"}, \ - -#endif diff --git a/os/beos/config.m4 b/os/beos/config.m4 deleted file mode 100644 index 823ac063ab515c99a38c0d5d8bc22c3ec91d2b47..0000000000000000000000000000000000000000 --- a/os/beos/config.m4 +++ /dev/null @@ -1,3 +0,0 @@ -if test "$OS" = "beos" ; then - CFLAGS="$CFLAGS -DBEOS" -fi diff --git a/os/beos/os.c b/os/beos/os.c deleted file mode 100644 index 72281c296eb83772c4b6ec9e93797768539273ee..0000000000000000000000000000000000000000 --- a/os/beos/os.c +++ /dev/null @@ -1,75 +0,0 @@ -/* - * This file will include OS specific functions which are not inlineable. - * Any inlineable functions should be defined in os-inline.c instead. - */ - -#include "ap_config.h" -#include "os.h" - -int ap_os_is_path_absolute(const char *file) -{ - return file[0] == '/'; -} - -int ap_spawnvp(const char *file, char *const argv[]) -{ - int pid; - - if ((pid = fork()) == -1) { - return pid; - } else if (pid == 0) { - if (execvp(file, argv) == -1) - return -1; - else - return -1; /* If we get, we have a real error, but this keeps - us from getting a warning during compile time. */ - } else - return pid; -} - - -/* some linkers complain unless there's at least one function in each - * .o file... and extra prototype is for gcc -Wmissing-prototypes - */ -extern void ap_is_not_here(void); -void ap_is_not_here(void) {} - -/* - * Abstraction layer for loading - * Apache modules under run-time via - * dynamic shared object (DSO) mechanism - */ - -void ap_os_dso_init(void) -{ - /* Nothing required to be done! */ -} - -void* ap_os_dso_load(const char *path) -{ - return (void*) load_add_on(path); -} - -void ap_os_dso_unload(void* handle) -{ - unload_add_on((image_id)handle); -} - -void *ap_os_dso_sym(void *handle, const char *symname) -{ - void * retval = 0; -#if defined(DLSYM_NEEDS_UNDERSCORE) - char *symbol = (char*)malloc(sizeof(char)*(strlen(symname)+2)); - sprintf(symbol, "_%s", symname); - get_image_symbol((image_id)handle, symbol, B_SYMBOL_TYPE_ANY, (void **)&retval); - free(symbol); - return retval; -#endif - get_image_symbol((image_id)handle, symname, B_SYMBOL_TYPE_ANY, (void **)&retval); - return retval; -} - -const char *ap_os_dso_error(void) -{ - return NULL; -} diff --git a/os/beos/os.h b/os/beos/os.h deleted file mode 100644 index a4af416269fe073cfb60783f9a08db6927ce6321..0000000000000000000000000000000000000000 --- a/os/beos/os.h +++ /dev/null @@ -1,100 +0,0 @@ -/* ==================================================================== - * Copyright (c) 1998-1999 The Apache Group. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in - * the documentation and/or other materials provided with the - * distribution. - * - * 3. All advertising materials mentioning features or use of this - * software must display the following acknowledgment: - * "This product includes software developed by the Apache Group - * for use in the Apache HTTP server project (http://www.apache.org/)." - * - * 4. The names "Apache Server" and "Apache Group" must not be used to - * endorse or promote products derived from this software without - * prior written permission. For written permission, please contact - * apache@apache.org. - * - * 5. Products derived from this software may not be called "Apache" - * nor may "Apache" appear in their names without prior written - * permission of the Apache Group. - * - * 6. Redistributions of any form whatsoever must retain the following - * acknowledgment: - * "This product includes software developed by the Apache Group - * for use in the Apache HTTP server project (http://www.apache.org/)." - * - * THIS SOFTWARE IS PROVIDED BY THE APACHE GROUP ``AS IS'' AND ANY - * EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR - * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE APACHE GROUP OR - * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT - * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, - * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED - * OF THE POSSIBILITY OF SUCH DAMAGE. - * ==================================================================== - * - * This software consists of voluntary contributions made by many - * individuals on behalf of the Apache Group and was originally based - * on public domain software written at the National Center for - * Supercomputing Applications, University of Illinois, Urbana-Champaign. - * For more information on the Apache Group and the Apache HTTP server - * project, please see . - * - */ - -#ifndef APACHE_OS_H -#define APACHE_OS_H - -#include "ap_config.h" -#include - -#ifndef PLATFORM -#define PLATFORM "BeOS" -#endif - -/* - * 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 or os-inline.c - */ - -extern int ap_os_is_path_absolute(const char *file); -extern int ap_spawnvp(const char *file, char *const argv[]); -#define ap_os_is_filename_valid(f) (1) -#define ap_os_kill(pid, sig) kill(pid, sig) - -/* - * Abstraction layer for loading - * Apache modules under run-time via - * dynamic shared object (DSO) mechanism - */ - -void *dlopen(const char *, int); -int dlclose(void *); -void *dlsym(void *, const char *); -const char *dlerror(void); - -#define RTLD_NOW 1 -#define RTLD_GLOBAL 0 - -#define ap_os_dso_handle_t image_id * -void ap_os_dso_init(void); -void * ap_os_dso_load(const char *); -void ap_os_dso_unload(void *); -void * ap_os_dso_sym(void *, const char *); -const char *ap_os_dso_error(void); - -#endif /* !APACHE_OS_H */ diff --git a/os/bs2000/.cvsignore b/os/bs2000/.cvsignore deleted file mode 100644 index f3c7a7c5da68804a1bdf391127ba34aed33c3cca..0000000000000000000000000000000000000000 --- a/os/bs2000/.cvsignore +++ /dev/null @@ -1 +0,0 @@ -Makefile diff --git a/os/bs2000/ebcdic.c b/os/bs2000/ebcdic.c deleted file mode 100644 index 0303fc6dbb7f08629e593d3961b12e7156911432..0000000000000000000000000000000000000000 --- a/os/bs2000/ebcdic.c +++ /dev/null @@ -1,252 +0,0 @@ -/* ==================================================================== - * Copyright (c) 1998-1999 The Apache Group. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in - * the documentation and/or other materials provided with the - * distribution. - * - * 3. All advertising materials mentioning features or use of this - * software must display the following acknowledgment: - * "This product includes software developed by the Apache Group - * for use in the Apache HTTP server project (http://www.apache.org/)." - * - * 4. The names "Apache Server" and "Apache Group" must not be used to - * endorse or promote products derived from this software without - * prior written permission. For written permission, please contact - * apache@apache.org. - * - * 5. Products derived from this software may not be called "Apache" - * nor may "Apache" appear in their names without prior written - * permission of the Apache Group. - * - * 6. Redistributions of any form whatsoever must retain the following - * acknowledgment: - * "This product includes software developed by the Apache Group - * for use in the Apache HTTP server project (http://www.apache.org/)." - * - * THIS SOFTWARE IS PROVIDED BY THE APACHE GROUP ``AS IS'' AND ANY - * EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR - * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE APACHE GROUP OR - * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT - * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, - * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED - * OF THE POSSIBILITY OF SUCH DAMAGE. - * ==================================================================== - * - * This software consists of voluntary contributions made by many - * individuals on behalf of the Apache Group and was originally based - * on public domain software written at the National Center for - * Supercomputing Applications, University of Illinois, Urbana-Champaign. - * For more information on the Apache Group and the Apache HTTP server - * project, please see . - * - */ - - -#ifdef CHARSET_EBCDIC -#include "ap_config.h" -#include "ebcdic.h" -/* - Initial Port for Apache-1.3 by - -"BS2000 OSD" is a POSIX on a main frame. It is made by Siemens AG, Germany. -Within the POSIX subsystem, the same character set was chosen as in -"native BS2000", namely EBCDIC. - -EBCDIC Table. (Yes, in EBCDIC, the letters 'a'..'z' are not contiguous!) -This table is bijective, i.e. there are no ambigous or duplicate characters -00 00 01 02 03 85 09 86 7f 87 8d 8e 0b 0c 0d 0e 0f *................* -10 10 11 12 13 8f 0a 08 97 18 19 9c 9d 1c 1d 1e 1f *................* -20 80 81 82 83 84 92 17 1b 88 89 8a 8b 8c 05 06 07 *................* -30 90 91 16 93 94 95 96 04 98 99 9a 9b 14 15 9e 1a *................* -40 20 a0 e2 e4 e0 e1 e3 e5 e7 f1 60 2e 3c 28 2b 7c * .........`.<(+|* -50 26 e9 ea eb e8 ed ee ef ec df 21 24 2a 29 3b 9f *&.........!$*);.* -60 2d 2f c2 c4 c0 c1 c3 c5 c7 d1 5e 2c 25 5f 3e 3f *-/........^,%_>?* -70 f8 c9 ca cb c8 cd ce cf cc a8 3a 23 40 27 3d 22 *..........:#@'="* -80 d8 61 62 63 64 65 66 67 68 69 ab bb f0 fd fe b1 *.abcdefghi......* -90 b0 6a 6b 6c 6d 6e 6f 70 71 72 aa ba e6 b8 c6 a4 *.jklmnopqr......* -a0 b5 af 73 74 75 76 77 78 79 7a a1 bf d0 dd de ae *..stuvwxyz......* -b0 a2 a3 a5 b7 a9 a7 b6 bc bd be ac 5b 5c 5d b4 d7 *...........[\]..* -c0 f9 41 42 43 44 45 46 47 48 49 ad f4 f6 f2 f3 f5 *.ABCDEFGHI......* -d0 a6 4a 4b 4c 4d 4e 4f 50 51 52 b9 fb fc db fa ff *.JKLMNOPQR......* -e0 d9 f7 53 54 55 56 57 58 59 5a b2 d4 d6 d2 d3 d5 *..STUVWXYZ......* -f0 30 31 32 33 34 35 36 37 38 39 b3 7b dc 7d da 7e *0123456789.{.}.~* -*/ - -/* The bijective ebcdic-to-ascii table: */ -const unsigned char os_toascii_strictly[256] = { -/*00*/ 0x00, 0x01, 0x02, 0x03, 0x85, 0x09, 0x86, 0x7f, - 0x87, 0x8d, 0x8e, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f, /*................*/ -/*10*/ 0x10, 0x11, 0x12, 0x13, 0x8f, 0x0a, 0x08, 0x97, - 0x18, 0x19, 0x9c, 0x9d, 0x1c, 0x1d, 0x1e, 0x1f, /*................*/ -/*20*/ 0x80, 0x81, 0x82, 0x83, 0x84, 0x92, 0x17, 0x1b, - 0x88, 0x89, 0x8a, 0x8b, 0x8c, 0x05, 0x06, 0x07, /*................*/ -/*30*/ 0x90, 0x91, 0x16, 0x93, 0x94, 0x95, 0x96, 0x04, - 0x98, 0x99, 0x9a, 0x9b, 0x14, 0x15, 0x9e, 0x1a, /*................*/ -/*40*/ 0x20, 0xa0, 0xe2, 0xe4, 0xe0, 0xe1, 0xe3, 0xe5, - 0xe7, 0xf1, 0x60, 0x2e, 0x3c, 0x28, 0x2b, 0x7c, /* .........`.<(+|*/ -/*50*/ 0x26, 0xe9, 0xea, 0xeb, 0xe8, 0xed, 0xee, 0xef, - 0xec, 0xdf, 0x21, 0x24, 0x2a, 0x29, 0x3b, 0x9f, /*&.........!$*);.*/ -/*60*/ 0x2d, 0x2f, 0xc2, 0xc4, 0xc0, 0xc1, 0xc3, 0xc5, - 0xc7, 0xd1, 0x5e, 0x2c, 0x25, 0x5f, 0x3e, 0x3f, /*-/........^,%_>?*/ -/*70*/ 0xf8, 0xc9, 0xca, 0xcb, 0xc8, 0xcd, 0xce, 0xcf, - 0xcc, 0xa8, 0x3a, 0x23, 0x40, 0x27, 0x3d, 0x22, /*..........:#@'="*/ -/*80*/ 0xd8, 0x61, 0x62, 0x63, 0x64, 0x65, 0x66, 0x67, - 0x68, 0x69, 0xab, 0xbb, 0xf0, 0xfd, 0xfe, 0xb1, /*.abcdefghi......*/ -/*90*/ 0xb0, 0x6a, 0x6b, 0x6c, 0x6d, 0x6e, 0x6f, 0x70, - 0x71, 0x72, 0xaa, 0xba, 0xe6, 0xb8, 0xc6, 0xa4, /*.jklmnopqr......*/ -/*a0*/ 0xb5, 0xaf, 0x73, 0x74, 0x75, 0x76, 0x77, 0x78, - 0x79, 0x7a, 0xa1, 0xbf, 0xd0, 0xdd, 0xde, 0xae, /*..stuvwxyz......*/ -/*b0*/ 0xa2, 0xa3, 0xa5, 0xb7, 0xa9, 0xa7, 0xb6, 0xbc, - 0xbd, 0xbe, 0xac, 0x5b, 0x5c, 0x5d, 0xb4, 0xd7, /*...........[\]..*/ -/*c0*/ 0xf9, 0x41, 0x42, 0x43, 0x44, 0x45, 0x46, 0x47, - 0x48, 0x49, 0xad, 0xf4, 0xf6, 0xf2, 0xf3, 0xf5, /*.ABCDEFGHI......*/ -/*d0*/ 0xa6, 0x4a, 0x4b, 0x4c, 0x4d, 0x4e, 0x4f, 0x50, - 0x51, 0x52, 0xb9, 0xfb, 0xfc, 0xdb, 0xfa, 0xff, /*.JKLMNOPQR......*/ -/*e0*/ 0xd9, 0xf7, 0x53, 0x54, 0x55, 0x56, 0x57, 0x58, - 0x59, 0x5a, 0xb2, 0xd4, 0xd6, 0xd2, 0xd3, 0xd5, /*..STUVWXYZ......*/ -/*f0*/ 0x30, 0x31, 0x32, 0x33, 0x34, 0x35, 0x36, 0x37, - 0x38, 0x39, 0xb3, 0x7b, 0xdc, 0x7d, 0xda, 0x7e /*0123456789.{.}.~*/ -}; - -/* This table is (almost) identical to the previous one. The only difference - * is the fact that it maps every EBCDIC *except 0x0A* to its ASCII - * equivalent. The reason for this table is simple: Throughout the - * server, protocol strings are used in the form - * "Content-Type: text/plain\015\012". Now all the characters in the string - * are stored as EBCDIC, only the semantics of \012 is completely - * different from LF (look it up in the table above). \015 happens to be - * mapped to \015 anyway, so there's no special case for it. - * - * In THIS table, EBCDIC-\012 is mapped to ASCII-\012. - * This table is therefore used wherever an EBCDIC to ASCII conversion is - * needed in the server. - */ -/* ebcdic-to-ascii with \012 mapped to ASCII-\n */ -const unsigned char os_toascii[256] = { -/*00*/ 0x00, 0x01, 0x02, 0x03, 0x85, 0x09, 0x86, 0x7f, - 0x87, 0x8d, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f, /*................*/ -/*10*/ 0x10, 0x11, 0x12, 0x13, 0x8f, 0x0a, 0x08, 0x97, - 0x18, 0x19, 0x9c, 0x9d, 0x1c, 0x1d, 0x1e, 0x1f, /*................*/ -/*20*/ 0x80, 0x81, 0x82, 0x83, 0x84, 0x92, 0x17, 0x1b, - 0x88, 0x89, 0x8a, 0x8b, 0x8c, 0x05, 0x06, 0x07, /*................*/ -/*30*/ 0x90, 0x91, 0x16, 0x93, 0x94, 0x95, 0x96, 0x04, - 0x98, 0x99, 0x9a, 0x9b, 0x14, 0x15, 0x9e, 0x1a, /*................*/ -/*40*/ 0x20, 0xa0, 0xe2, 0xe4, 0xe0, 0xe1, 0xe3, 0xe5, - 0xe7, 0xf1, 0x60, 0x2e, 0x3c, 0x28, 0x2b, 0x7c, /* .........`.<(+|*/ -/*50*/ 0x26, 0xe9, 0xea, 0xeb, 0xe8, 0xed, 0xee, 0xef, - 0xec, 0xdf, 0x21, 0x24, 0x2a, 0x29, 0x3b, 0x9f, /*&.........!$*);.*/ -/*60*/ 0x2d, 0x2f, 0xc2, 0xc4, 0xc0, 0xc1, 0xc3, 0xc5, - 0xc7, 0xd1, 0x5e, 0x2c, 0x25, 0x5f, 0x3e, 0x3f, /*-/........^,%_>?*/ -/*70*/ 0xf8, 0xc9, 0xca, 0xcb, 0xc8, 0xcd, 0xce, 0xcf, - 0xcc, 0xa8, 0x3a, 0x23, 0x40, 0x27, 0x3d, 0x22, /*..........:#@'="*/ -/*80*/ 0xd8, 0x61, 0x62, 0x63, 0x64, 0x65, 0x66, 0x67, - 0x68, 0x69, 0xab, 0xbb, 0xf0, 0xfd, 0xfe, 0xb1, /*.abcdefghi......*/ -/*90*/ 0xb0, 0x6a, 0x6b, 0x6c, 0x6d, 0x6e, 0x6f, 0x70, - 0x71, 0x72, 0xaa, 0xba, 0xe6, 0xb8, 0xc6, 0xa4, /*.jklmnopqr......*/ -/*a0*/ 0xb5, 0xaf, 0x73, 0x74, 0x75, 0x76, 0x77, 0x78, - 0x79, 0x7a, 0xa1, 0xbf, 0xd0, 0xdd, 0xde, 0xae, /*..stuvwxyz......*/ -/*b0*/ 0xa2, 0xa3, 0xa5, 0xb7, 0xa9, 0xa7, 0xb6, 0xbc, - 0xbd, 0xbe, 0xac, 0x5b, 0x5c, 0x5d, 0xb4, 0xd7, /*...........[\]..*/ -/*c0*/ 0xf9, 0x41, 0x42, 0x43, 0x44, 0x45, 0x46, 0x47, - 0x48, 0x49, 0xad, 0xf4, 0xf6, 0xf2, 0xf3, 0xf5, /*.ABCDEFGHI......*/ -/*d0*/ 0xa6, 0x4a, 0x4b, 0x4c, 0x4d, 0x4e, 0x4f, 0x50, - 0x51, 0x52, 0xb9, 0xfb, 0xfc, 0xdb, 0xfa, 0xff, /*.JKLMNOPQR......*/ -/*e0*/ 0xd9, 0xf7, 0x53, 0x54, 0x55, 0x56, 0x57, 0x58, - 0x59, 0x5a, 0xb2, 0xd4, 0xd6, 0xd2, 0xd3, 0xd5, /*..STUVWXYZ......*/ -/*f0*/ 0x30, 0x31, 0x32, 0x33, 0x34, 0x35, 0x36, 0x37, - 0x38, 0x39, 0xb3, 0x7b, 0xdc, 0x7d, 0xda, 0x7e /*0123456789.{.}.~*/ -}; - -/* The ascii-to-ebcdic table: -00 00 01 02 03 37 2d 2e 2f 16 05 15 0b 0c 0d 0e 0f *................* -10 10 11 12 13 3c 3d 32 26 18 19 3f 27 1c 1d 1e 1f *................* -20 40 5a 7f 7b 5b 6c 50 7d 4d 5d 5c 4e 6b 60 4b 61 * !"#$%&'()*+,-./ -30 f0 f1 f2 f3 f4 f5 f6 f7 f8 f9 7a 5e 4c 7e 6e 6f *0123456789:;<=>?* -40 7c c1 c2 c3 c4 c5 c6 c7 c8 c9 d1 d2 d3 d4 d5 d6 *@ABCDEFGHIJKLMNO* -50 d7 d8 d9 e2 e3 e4 e5 e6 e7 e8 e9 bb bc bd 6a 6d *PQRSTUVWXYZ[\]^_* -60 4a 81 82 83 84 85 86 87 88 89 91 92 93 94 95 96 *`abcdefghijklmno* -70 97 98 99 a2 a3 a4 a5 a6 a7 a8 a9 fb 4f fd ff 07 *pqrstuvwxyz{|}~.* -80 20 21 22 23 24 04 06 08 28 29 2a 2b 2c 09 0a 14 *................* -90 30 31 25 33 34 35 36 17 38 39 3a 3b 1a 1b 3e 5f *................* -a0 41 aa b0 b1 9f b2 d0 b5 79 b4 9a 8a ba ca af a1 *................* -b0 90 8f ea fa be a0 b6 b3 9d da 9b 8b b7 b8 b9 ab *................* -c0 64 65 62 66 63 67 9e 68 74 71 72 73 78 75 76 77 *................* -d0 ac 69 ed ee eb ef ec bf 80 e0 fe dd fc ad ae 59 *................* -e0 44 45 42 46 43 47 9c 48 54 51 52 53 58 55 56 57 *................* -f0 8c 49 cd ce cb cf cc e1 70 c0 de db dc 8d 8e df *................* -*/ -const unsigned char os_toebcdic[256] = { -/*00*/ 0x00, 0x01, 0x02, 0x03, 0x37, 0x2d, 0x2e, 0x2f, - 0x16, 0x05, 0x15, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f, /*................*/ -/*10*/ 0x10, 0x11, 0x12, 0x13, 0x3c, 0x3d, 0x32, 0x26, - 0x18, 0x19, 0x3f, 0x27, 0x1c, 0x1d, 0x1e, 0x1f, /*................*/ -/*20*/ 0x40, 0x5a, 0x7f, 0x7b, 0x5b, 0x6c, 0x50, 0x7d, - 0x4d, 0x5d, 0x5c, 0x4e, 0x6b, 0x60, 0x4b, 0x61, /* !"#$%&'()*+,-./ */ -/*30*/ 0xf0, 0xf1, 0xf2, 0xf3, 0xf4, 0xf5, 0xf6, 0xf7, - 0xf8, 0xf9, 0x7a, 0x5e, 0x4c, 0x7e, 0x6e, 0x6f, /*0123456789:;<=>?*/ -/*40*/ 0x7c, 0xc1, 0xc2, 0xc3, 0xc4, 0xc5, 0xc6, 0xc7, - 0xc8, 0xc9, 0xd1, 0xd2, 0xd3, 0xd4, 0xd5, 0xd6, /*@ABCDEFGHIJKLMNO*/ -/*50*/ 0xd7, 0xd8, 0xd9, 0xe2, 0xe3, 0xe4, 0xe5, 0xe6, - 0xe7, 0xe8, 0xe9, 0xbb, 0xbc, 0xbd, 0x6a, 0x6d, /*PQRSTUVWXYZ[\]^_*/ -/*60*/ 0x4a, 0x81, 0x82, 0x83, 0x84, 0x85, 0x86, 0x87, - 0x88, 0x89, 0x91, 0x92, 0x93, 0x94, 0x95, 0x96, /*`abcdefghijklmno*/ -/*70*/ 0x97, 0x98, 0x99, 0xa2, 0xa3, 0xa4, 0xa5, 0xa6, - 0xa7, 0xa8, 0xa9, 0xfb, 0x4f, 0xfd, 0xff, 0x07, /*pqrstuvwxyz{|}~.*/ -/*80*/ 0x20, 0x21, 0x22, 0x23, 0x24, 0x04, 0x06, 0x08, - 0x28, 0x29, 0x2a, 0x2b, 0x2c, 0x09, 0x0a, 0x14, /*................*/ -/*90*/ 0x30, 0x31, 0x25, 0x33, 0x34, 0x35, 0x36, 0x17, - 0x38, 0x39, 0x3a, 0x3b, 0x1a, 0x1b, 0x3e, 0x5f, /*................*/ -/*a0*/ 0x41, 0xaa, 0xb0, 0xb1, 0x9f, 0xb2, 0xd0, 0xb5, - 0x79, 0xb4, 0x9a, 0x8a, 0xba, 0xca, 0xaf, 0xa1, /*................*/ -/*b0*/ 0x90, 0x8f, 0xea, 0xfa, 0xbe, 0xa0, 0xb6, 0xb3, - 0x9d, 0xda, 0x9b, 0x8b, 0xb7, 0xb8, 0xb9, 0xab, /*................*/ -/*c0*/ 0x64, 0x65, 0x62, 0x66, 0x63, 0x67, 0x9e, 0x68, - 0x74, 0x71, 0x72, 0x73, 0x78, 0x75, 0x76, 0x77, /*................*/ -/*d0*/ 0xac, 0x69, 0xed, 0xee, 0xeb, 0xef, 0xec, 0xbf, - 0x80, 0xe0, 0xfe, 0xdd, 0xfc, 0xad, 0xae, 0x59, /*................*/ -/*e0*/ 0x44, 0x45, 0x42, 0x46, 0x43, 0x47, 0x9c, 0x48, - 0x54, 0x51, 0x52, 0x53, 0x58, 0x55, 0x56, 0x57, /*................*/ -/*f0*/ 0x8c, 0x49, 0xcd, 0xce, 0xcb, 0xcf, 0xcc, 0xe1, - 0x70, 0xc0, 0xde, 0xdb, 0xdc, 0x8d, 0x8e, 0xdf /*................*/ -}; - -/* Translate a memory block from EBCDIC (host charset) to ASCII (net charset) - * dest and srce may be identical, or separate memory blocks, but - * should not overlap. - */ -void -ebcdic2ascii(unsigned char *dest, const unsigned char *srce, size_t count) -{ - while (count-- != 0) { - *dest++ = os_toascii[*srce++]; - } -} -void -ebcdic2ascii_strictly(unsigned char *dest, const unsigned char *srce, size_t count) -{ - while (count-- != 0) { - *dest++ = os_toascii_strictly[*srce++]; - } -} -void -ascii2ebcdic(unsigned char *dest, const unsigned char *srce, size_t count) -{ - while (count-- != 0) { - *dest++ = os_toebcdic[*srce++]; - } -} -#endif /*CHARSET_EBCDIC*/ diff --git a/os/bs2000/ebcdic.h b/os/bs2000/ebcdic.h deleted file mode 100644 index 267f9786df2365eaf678c7717cfb9996162c7dcc..0000000000000000000000000000000000000000 --- a/os/bs2000/ebcdic.h +++ /dev/null @@ -1,8 +0,0 @@ -#include - -extern const unsigned char os_toascii[256]; -extern const unsigned char os_toebcdic[256]; -void ebcdic2ascii(unsigned char *dest, const unsigned char *srce, size_t count); -void ebcdic2ascii_strictly(unsigned char *dest, const unsigned char *srce, size_t count); -void ascii2ebcdic(unsigned char *dest, const unsigned char *srce, size_t count); - diff --git a/os/bs2000/os.c b/os/bs2000/os.c deleted file mode 100644 index c33810a2f0dca100e92117c4ee125de88b421965..0000000000000000000000000000000000000000 --- a/os/bs2000/os.c +++ /dev/null @@ -1,103 +0,0 @@ -/* ==================================================================== - * Copyright (c) 1998-1999 The Apache Group. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in - * the documentation and/or other materials provided with the - * distribution. - * - * 3. All advertising materials mentioning features or use of this - * software must display the following acknowledgment: - * "This product includes software developed by the Apache Group - * for use in the Apache HTTP server project (http://www.apache.org/)." - * - * 4. The names "Apache Server" and "Apache Group" must not be used to - * endorse or promote products derived from this software without - * prior written permission. For written permission, please contact - * apache@apache.org. - * - * 5. Products derived from this software may not be called "Apache" - * nor may "Apache" appear in their names without prior written - * permission of the Apache Group. - * - * 6. Redistributions of any form whatsoever must retain the following - * acknowledgment: - * "This product includes software developed by the Apache Group - * for use in the Apache HTTP server project (http://www.apache.org/)." - * - * THIS SOFTWARE IS PROVIDED BY THE APACHE GROUP ``AS IS'' AND ANY - * EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR - * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE APACHE GROUP OR - * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT - * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, - * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED - * OF THE POSSIBILITY OF SUCH DAMAGE. - * ==================================================================== - * - * This software consists of voluntary contributions made by many - * individuals on behalf of the Apache Group and was originally based - * on public domain software written at the National Center for - * Supercomputing Applications, University of Illinois, Urbana-Champaign. - * For more information on the Apache Group and the Apache HTTP server - * project, please see . - * - */ - -/* - * This file will include OS specific functions which are not inlineable. - * Any inlineable functions should be defined in os-inline.c instead. - */ - -#include "httpd.h" -#include "http_core.h" -#include "os.h" - -/* Check the Content-Type to decide if conversion is needed */ -int ap_checkconv(struct request_rec *r) -{ - int convert_to_ascii; - const char *type; - - /* To make serving of "raw ASCII text" files easy (they serve faster - * since they don't have to be converted from EBCDIC), a new - * "magic" type prefix was invented: text/x-ascii-{plain,html,...} - * If we detect one of these content types here, we simply correct - * the type to the real text/{plain,html,...} type. Otherwise, we - * set a flag that translation is required later on. - */ - - type = (r->content_type == NULL) ? ap_default_type(r) : r->content_type; - - /* If no content type is set then treat it as (ebcdic) text/plain */ - convert_to_ascii = (type == NULL); - - /* Conversion is applied to text/ files only, if ever. */ - if (type && (strncasecmp(type, "text/", 5) == 0 || - strncasecmp(type, "message/", 8) == 0)) { - if (strncasecmp(type, ASCIITEXT_MAGIC_TYPE_PREFIX, - sizeof(ASCIITEXT_MAGIC_TYPE_PREFIX)-1) == 0) - r->content_type = ap_pstrcat(r->pool, "text/", - type+sizeof(ASCIITEXT_MAGIC_TYPE_PREFIX)-1, - NULL); - else - /* translate EBCDIC to ASCII */ - convert_to_ascii = 1; - } - /* Enable conversion if it's a text document */ - ap_bsetflag(r->connection->client, B_EBCDIC2ASCII, convert_to_ascii); - - return convert_to_ascii; -} - diff --git a/os/bs2000/os.h b/os/bs2000/os.h deleted file mode 100644 index 1ede0813f2ef6a3526092b1e51e3e4ebd1d64d7a..0000000000000000000000000000000000000000 --- a/os/bs2000/os.h +++ /dev/null @@ -1,51 +0,0 @@ -#ifndef APACHE_OS_H -#define APACHE_OS_H - -#define PLATFORM "BS2000" - -/* - * 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 or os-inline.c - */ - -#if !defined(INLINE) && defined(USE_GNU_INLINE) -/* Compiler supports inline, so include the inlineable functions as - * part of the header - */ -#define INLINE extern ap_inline - -INLINE int ap_os_is_path_absolute(const char *file); - -#include "os-inline.c" -#endif - -#ifndef INLINE -/* Compiler does not support inline, so prototype the inlineable functions - * as normal - */ -extern int ap_os_is_path_absolute(const char *file); -#endif - -/* Other ap_os_ routines not used by this platform */ - -#define ap_os_is_filename_valid(f) (1) -#define ap_os_kill(pid, sig) kill(pid, sig) - -#if !defined(_POSIX_SOURCE) && !defined(_XOPEN_SOURCE) -typedef struct { - char *username; - char *account; - char *processor_name; -} _rini_struct; - -extern int _rini(_rini_struct *); -#endif /* !defined(_POSIX_SOURCE) && !defined(_XOPEN_SOURCE) */ - -/* Sorry if this is ugly, but the include order doesn't allow me - * to use request_rec here... */ -struct request_rec; -extern int ap_checkconv(struct request_rec *r); -extern pid_t os_fork(const char *user); - -#endif /*! APACHE_OS_H*/ diff --git a/os/config.m4 b/os/config.m4 deleted file mode 100644 index 750f9b0183b30ac0bd47384e5db1bfaef6750bbd..0000000000000000000000000000000000000000 --- a/os/config.m4 +++ /dev/null @@ -1,8 +0,0 @@ -AC_MSG_CHECKING(which OS this is) - -dnl ## XXX - I'm not sure, but this might not handle the non-Unix case yet -OS=unix -OS_DIR=os/$OS - -AC_MSG_RESULT([$OS]) -APACHE_OUTPUT(os/$OS/Makefile) diff --git a/os/netware/Apache.def b/os/netware/Apache.def deleted file mode 100644 index ef051ebf23aec7df94471665eee2f07146ca9e05..0000000000000000000000000000000000000000 --- a/os/netware/Apache.def +++ /dev/null @@ -1,4 +0,0 @@ -#MODULE APRLIB.NLM -MODULE LIBC.NLM -MODULE WS2_32.NLM -FLAG_ON 3 diff --git a/os/netware/apache.xdc b/os/netware/apache.xdc deleted file mode 100644 index 12a7f6ba2df41eccb047c2884088c022f9395540..0000000000000000000000000000000000000000 Binary files a/os/netware/apache.xdc and /dev/null differ diff --git a/os/netware/modules.c b/os/netware/modules.c deleted file mode 100644 index 3868521c856e548cc63a42ee321ff12fd9d0ee5a..0000000000000000000000000000000000000000 --- a/os/netware/modules.c +++ /dev/null @@ -1,77 +0,0 @@ -/* modules.c --- major modules compiled into Apache for NetWare. - * Only insert an entry for a module if it must be compiled into - * the core server - */ - -#define CORE_PRIVATE -#include "httpd.h" -#include "http_config.h" - -extern module core_module; -extern module mpm_netware_module; -extern module http_module; -extern module so_module; -extern module mime_module; -extern module access_module; -extern module auth_module; -extern module negotiation_module; -extern module include_module; -extern module autoindex_module; -extern module dir_module; -extern module cgi_module; -extern module userdir_module; -extern module alias_module; -extern module env_module; -extern module log_config_module; -extern module asis_module; -extern module imap_module; -extern module actions_module; -extern module setenvif_module; - -module *ap_prelinked_modules[] = { - &core_module, - &mpm_netware_module, - &http_module, - &so_module, - &mime_module, - &access_module, - &auth_module, - &negotiation_module, - &include_module, - &autoindex_module, - &dir_module, - &cgi_module, - &userdir_module, - &alias_module, - &env_module, - &log_config_module, - &asis_module, - &imap_module, - &actions_module, - &setenvif_module, - NULL -}; - -module *ap_preloaded_modules[] = { - &core_module, - &mpm_netware_module, - &http_module, - &so_module, - &mime_module, - &access_module, - &auth_module, - &negotiation_module, - &include_module, - &autoindex_module, - &dir_module, - &cgi_module, - &userdir_module, - &alias_module, - &env_module, - &log_config_module, - &asis_module, - &imap_module, - &actions_module, - &setenvif_module, - NULL -}; diff --git a/os/netware/os.h b/os/netware/os.h deleted file mode 100644 index df9e1feabe963e8745307b23236881c74b91c34f..0000000000000000000000000000000000000000 --- a/os/netware/os.h +++ /dev/null @@ -1,74 +0,0 @@ -/* ==================================================================== - * The Apache Software License, Version 1.1 - * - * Copyright (c) 2000-2001 The Apache Software Foundation. All rights - * reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in - * the documentation and/or other materials provided with the - * distribution. - * - * 3. The end-user documentation included with the redistribution, - * if any, must include the following acknowledgment: - * "This product includes software developed by the - * Apache Software Foundation (http://www.apache.org/)." - * Alternately, this acknowledgment may appear in the software itself, - * if and wherever such third-party acknowledgments normally appear. - * - * 4. The names "Apache" and "Apache Software Foundation" must - * not be used to endorse or promote products derived from this - * software without prior written permission. For written - * permission, please contact apache@apache.org. - * - * 5. Products derived from this software may not be called "Apache", - * nor may "Apache" appear in their name, without prior written - * permission of the Apache Software Foundation. - * - * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED - * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES - * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR - * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF - * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND - * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, - * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT - * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * ==================================================================== - * - * This software consists of voluntary contributions made by many - * individuals on behalf of the Apache Software Foundation. For more - * information on the Apache Software Foundation, please see - * . - * - * Portions of this software are based upon public domain software - * originally written at the National Center for Supercomputing Applications, - * University of Illinois, Urbana-Champaign. - */ - -#ifndef APACHE_OS_H -#define APACHE_OS_H - -#ifndef PLATFORM -#define PLATFORM "NETWARE" -#endif - -#define CASE_BLIND_FILESYSTEM -#define NO_WRITEV - -#define APACHE_MPM_DIR "server/mpm/netware" /* generated on unix */ - -#define getpid NXThreadGetId -//#define exit(s) _exit(s) - -#endif /* ! APACHE_OS_H */ diff --git a/os/netware/pre_nw.h b/os/netware/pre_nw.h deleted file mode 100644 index 6a3d99c45d9f8016c9fad5411d812534e87d3c92..0000000000000000000000000000000000000000 --- a/os/netware/pre_nw.h +++ /dev/null @@ -1,43 +0,0 @@ -#ifndef __pre_nw__ -#define __pre_nw__ - -#pragma precompile_target "precomp.mch" -#define NETWARE - - -#define N_PLAT_NLM - -/* hint for MSL C++ that we're on NetWare platform */ -#define __NETWARE__ - -/* the FAR keyword has no meaning in a 32-bit environment - but is used in the SDK headers so we take it out */ -#define FAR -#define far - -/* no-op for Codewarrior C compiler; a functions are cdecl - by default */ -#define cdecl - -/* if we have wchar_t enabled in C++, predefine this type to avoid - a conflict in Novell's header files */ -#if (__option(cplusplus) && __option(wchar_type)) -#define _WCHAR_T -#endif - -/* C9X defintion used by MSL C++ library */ -#define DECIMAL_DIG 17 - -/* define long long typedefs for Watcom compatiblity */ -typedef long long int64_t; -typedef unsigned long long uint64_t; - -/* some code may want to use the MS convention for long long */ -#ifndef __int64 -#define __int64 long long -#endif - -#endif - - - diff --git a/os/netware/util_nw.c b/os/netware/util_nw.c deleted file mode 100644 index 77219815bed3a562c23446cd3df19905cc85db99..0000000000000000000000000000000000000000 --- a/os/netware/util_nw.c +++ /dev/null @@ -1,76 +0,0 @@ -/* ==================================================================== - * The Apache Software License, Version 1.1 - * - * Copyright (c) 2000-2001 The Apache Software Foundation. All rights - * reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in - * the documentation and/or other materials provided with the - * distribution. - * - * 3. The end-user documentation included with the redistribution, - * if any, must include the following acknowledgment: - * "This product includes software developed by the - * Apache Software Foundation (http://www.apache.org/)." - * Alternately, this acknowledgment may appear in the software itself, - * if and wherever such third-party acknowledgments normally appear. - * - * 4. The names "Apache" and "Apache Software Foundation" must - * not be used to endorse or promote products derived from this - * software without prior written permission. For written - * permission, please contact apache@apache.org. - * - * 5. Products derived from this software may not be called "Apache", - * nor may "Apache" appear in their name, without prior written - * permission of the Apache Software Foundation. - * - * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED - * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES - * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR - * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF - * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND - * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, - * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT - * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * ==================================================================== - * - * This software consists of voluntary contributions made by many - * individuals on behalf of the Apache Software Foundation. For more - * information on the Apache Software Foundation, please see - * . - * - * Portions of this software are based upon public domain software - * originally written at the National Center for Supercomputing Applications, - * University of Illinois, Urbana-Champaign. - */ - -#include "httpd.h" -#include "http_log.h" -#include "apr_strings.h" - -#include -#include -#include - - -AP_DECLARE(apr_status_t) ap_os_create_privileged_process( - const request_rec *r, - apr_proc_t *newproc, const char *progname, - const char * const *args, - const char * const *env, - apr_procattr_t *attr, apr_pool_t *p) -{ - return APR_ENOTIMPL; -} diff --git a/os/os2/.cvsignore b/os/os2/.cvsignore deleted file mode 100644 index f3c7a7c5da68804a1bdf391127ba34aed33c3cca..0000000000000000000000000000000000000000 --- a/os/os2/.cvsignore +++ /dev/null @@ -1 +0,0 @@ -Makefile diff --git a/os/os2/Makefile.in b/os/os2/Makefile.in deleted file mode 100644 index c03ac3fca1584c1576030de5667fac1df17b433e..0000000000000000000000000000000000000000 --- a/os/os2/Makefile.in +++ /dev/null @@ -1,10 +0,0 @@ - -DEPTH = ../.. -topsrcdir = @topsrcdir@ -srcdir = @srcdir@ -VPATH = @srcdir@ - -LTLIBRARY_NAME = libos.la -LTLIBRARY_SOURCES = os.c os-inline.c util_os2.c iol_socket.c - -include $(topsrcdir)/build/ltlib.mk diff --git a/os/os2/config.m4 b/os/os2/config.m4 deleted file mode 100644 index d6bab02dd4e42802c26765bffd418c3d967c4427..0000000000000000000000000000000000000000 --- a/os/os2/config.m4 +++ /dev/null @@ -1,4 +0,0 @@ -if test "$OS" = "os2" ; then - CFLAGS="$CFLAGS -DOS2 -O2" - LDFLAGS="$LDFLAGS -Zexe" -fi diff --git a/os/os2/core.mk b/os/os2/core.mk deleted file mode 100644 index aac4356532cdc39011908c29b21473bab79c251d..0000000000000000000000000000000000000000 --- a/os/os2/core.mk +++ /dev/null @@ -1,7 +0,0 @@ -# Some rules for making a shared core dll on OS/2 - -os2core: httpd.dll $(CORE_IMPLIB) - $(LIBTOOL) --mode=link gcc $(EXTRA_LDFLAGS) -o httpd $(CORE_IMPLIB) - -httpd.dll: $(PROGRAM_DEPENDENCIES) $(CORE_IMPLIB) - $(LINK) -Zdll $(EXTRA_LDFLAGS) -s -o $@ server/exports.lo modules.lo $(PROGRAM_DEPENDENCIES) $(EXTRA_LIBS) server/ApacheCoreOS2.def diff --git a/os/os2/core_header.def b/os/os2/core_header.def deleted file mode 100644 index 85e02fbd85be15432bf6e253596f27e51ce110dd..0000000000000000000000000000000000000000 --- a/os/os2/core_header.def +++ /dev/null @@ -1,11 +0,0 @@ -LIBRARY httpd INITINSTANCE -DESCRIPTION "Apache Server Core" -EXPORTS - "main" - "ap_my_generation" - "ap_restart_time" - "ap_extended_status" - "ap_scoreboard_image" - "ap_conftree" - "ap_server_root" - "ap_top_module" diff --git a/os/os2/os.h b/os/os2/os.h deleted file mode 100644 index d717f1f8ca4cb0578c815ec76823fbcc9d15aa10..0000000000000000000000000000000000000000 --- a/os/os2/os.h +++ /dev/null @@ -1,52 +0,0 @@ -#ifndef APACHE_OS_H -#define APACHE_OS_H - -#define PLATFORM "OS/2" -#define HAVE_CANONICAL_FILENAME -#define HAVE_DRIVE_LETTERS - -/* - * 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 or os-inline.c - */ - -#if defined(__GNUC__) && !defined(INLINE) -/* Compiler supports inline, so include the inlineable functions as - * part of the header - */ -#define INLINE extern __inline__ - -INLINE int ap_os_is_path_absolute(const char *file); - -#include "os-inline.c" -#endif - -#ifndef INLINE -/* Compiler does not support inline, so prototype the inlineable functions - * as normal - */ -extern int ap_os_is_path_absolute(const char *file); -#endif - -/* FIXME: the following should be implemented on this platform */ -#define ap_os_is_filename_valid(f) (1) - -/* Use a specialized kill() function */ -int ap_os_kill(int pid, int sig); - -/* Maps an OS error code to an error message */ -char *ap_os_error_message(int err); - -/* OS/2 doesn't have symlinks so S_ISLNK is always false */ -#define S_ISLNK(m) 0 - -/* Dynamic loading functions */ -#define ap_os_dso_handle_t unsigned long -void ap_os_dso_init(void); -ap_os_dso_handle_t ap_os_dso_load(const char *); -void ap_os_dso_unload(ap_os_dso_handle_t); -void * ap_os_dso_sym(ap_os_dso_handle_t, const char *); -const char *ap_os_dso_error(void); - -#endif /* ! APACHE_OS_H */ diff --git a/os/os2/util_os2.c b/os/os2/util_os2.c deleted file mode 100644 index 820ea618008010b6b9c99874d0ab414579754291..0000000000000000000000000000000000000000 --- a/os/os2/util_os2.c +++ /dev/null @@ -1,96 +0,0 @@ -#define INCL_DOS -#define INCL_DOSERRORS -#include -#include "httpd.h" -#include "http_log.h" - - -API_EXPORT(char *)ap_os_canonical_filename(pool *pPool, const char *szFile) -{ - char buf[HUGE_STRING_LEN]; - char buf2[HUGE_STRING_LEN]; - int rc, len; - char *pos; - -/* Remove trailing slash unless it's a root directory */ - strcpy(buf, szFile); - len = strlen(buf); - - if (len > 3 && buf[len-1] == '/') - buf[--len] = 0; - - rc = DosQueryPathInfo(buf, FIL_QUERYFULLNAME, buf2, HUGE_STRING_LEN); - - if (rc) { - if ( rc != ERROR_INVALID_NAME ) { - ap_log_error(APLOG_MARK, APLOG_ERR|APLOG_NOERRNO, NULL, "OS/2 error %d for file %s", rc, szFile); - return ap_pstrdup(pPool, ""); - } else { - return ap_pstrdup(pPool, szFile); - } - } - - strlwr(buf2); - -/* Switch backslashes to forward */ - for (pos=buf2; *pos; pos++) - if (*pos == '\\') - *pos = '/'; - - return ap_pstrdup(pPool, buf2); -} - - - -int ap_os_kill(pid_t pid, int sig) -{ -/* SIGTERM's don't work too well in OS/2 (only affects other EMX programs). - CGIs may not be, esp. REXX scripts, so use a native call instead */ - - int rc; - - if ( sig == SIGTERM ) { - rc = DosSendSignalException( pid, XCPT_SIGNAL_BREAK ); - - if ( rc ) { - errno = ESRCH; - rc = -1; - } - } else { - rc = kill(pid, sig); - } - - return rc; -} - - - -char *ap_os_error_message(int err) -{ - static char result[200]; - char message[HUGE_STRING_LEN]; - ULONG len; - char *pos; - int c; - - if (DosGetMessage(NULL, 0, message, HUGE_STRING_LEN, err, "OSO001.MSG", &len) == 0) { - len--; - message[len] = 0; - pos = result; - - if (len >= sizeof(result)) - len = sizeof(result-1); - - for (c=0; c. - * - */ - - -#ifdef CHARSET_EBCDIC -#include "ap_config.h" -#include "ebcdic.h" -/* -This code does basic character mapping for IBM's TPF operating system. -It is a modified version of 's code for -the BS2000 (apache/src/os/bs2000/ebcdic.c). -*/ - -/* -Bijective EBCDIC (character set IBM-1047) to US-ASCII table: -This table is bijective - there are no ambigous or duplicate characters. -*/ -const unsigned char os_toascii_strictly[256] = { - 0x00, 0x01, 0x02, 0x03, 0x85, 0x09, 0x86, 0x7f, /* 00-0f: */ - 0x87, 0x8d, 0x8e, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f, /* ................ */ - 0x10, 0x11, 0x12, 0x13, 0x8f, 0x0a, 0x08, 0x97, /* 10-1f: */ - 0x18, 0x19, 0x9c, 0x9d, 0x1c, 0x1d, 0x1e, 0x1f, /* ................ */ - 0x80, 0x81, 0x82, 0x83, 0x84, 0x92, 0x17, 0x1b, /* 20-2f: */ - 0x88, 0x89, 0x8a, 0x8b, 0x8c, 0x05, 0x06, 0x07, /* ................ */ - 0x90, 0x91, 0x16, 0x93, 0x94, 0x95, 0x96, 0x04, /* 30-3f: */ - 0x98, 0x99, 0x9a, 0x9b, 0x14, 0x15, 0x9e, 0x1a, /* ................ */ - 0x20, 0xa0, 0xe2, 0xe4, 0xe0, 0xe1, 0xe3, 0xe5, /* 40-4f: */ - 0xe7, 0xf1, 0xa2, 0x2e, 0x3c, 0x28, 0x2b, 0x7c, /* ...........<(+| */ - 0x26, 0xe9, 0xea, 0xeb, 0xe8, 0xed, 0xee, 0xef, /* 50-5f: */ - 0xec, 0xdf, 0x21, 0x24, 0x2a, 0x29, 0x3b, 0x5e, /* &.........!$*);^ */ - 0x2d, 0x2f, 0xc2, 0xc4, 0xc0, 0xc1, 0xc3, 0xc5, /* 60-6f: */ - 0xc7, 0xd1, 0xa6, 0x2c, 0x25, 0x5f, 0x3e, 0x3f, /* -/.........,%_>? */ - 0xf8, 0xc9, 0xca, 0xcb, 0xc8, 0xcd, 0xce, 0xcf, /* 70-7f: */ - 0xcc, 0x60, 0x3a, 0x23, 0x40, 0x27, 0x3d, 0x22, /* .........`:#@'=" */ - 0xd8, 0x61, 0x62, 0x63, 0x64, 0x65, 0x66, 0x67, /* 80-8f: */ - 0x68, 0x69, 0xab, 0xbb, 0xf0, 0xfd, 0xfe, 0xb1, /* .abcdefghi...... */ - 0xb0, 0x6a, 0x6b, 0x6c, 0x6d, 0x6e, 0x6f, 0x70, /* 90-9f: */ - 0x71, 0x72, 0xaa, 0xba, 0xe6, 0xb8, 0xc6, 0xa4, /* .jklmnopqr...... */ - 0xb5, 0x7e, 0x73, 0x74, 0x75, 0x76, 0x77, 0x78, /* a0-af: */ - 0x79, 0x7a, 0xa1, 0xbf, 0xd0, 0x5b, 0xde, 0xae, /* .~stuvwxyz...[.. */ - 0xac, 0xa3, 0xa5, 0xb7, 0xa9, 0xa7, 0xb6, 0xbc, /* b0-bf: */ - 0xbd, 0xbe, 0xdd, 0xa8, 0xaf, 0x5d, 0xb4, 0xd7, /* .............].. */ - 0x7b, 0x41, 0x42, 0x43, 0x44, 0x45, 0x46, 0x47, /* c0-cf: */ - 0x48, 0x49, 0xad, 0xf4, 0xf6, 0xf2, 0xf3, 0xf5, /* {ABCDEFGHI...... */ - 0x7d, 0x4a, 0x4b, 0x4c, 0x4d, 0x4e, 0x4f, 0x50, /* d0-df: */ - 0x51, 0x52, 0xb9, 0xfb, 0xfc, 0xf9, 0xfa, 0xff, /* }JKLMNOPQR...... */ - 0x5c, 0xf7, 0x53, 0x54, 0x55, 0x56, 0x57, 0x58, /* e0-ef: */ - 0x59, 0x5a, 0xb2, 0xd4, 0xd6, 0xd2, 0xd3, 0xd5, /* \.STUVWXYZ...... */ - 0x30, 0x31, 0x32, 0x33, 0x34, 0x35, 0x36, 0x37, /* f0-ff: */ - 0x38, 0x39, 0xb3, 0xdb, 0xdc, 0xd9, 0xda, 0x9f /* 0123456789...... */ -}; - -/* -Server EBCDIC (character set IBM-1047) to US-ASCII table: -This table is a copy of the os_toascii_strictly bijective table above. -The only change is that hex 0a (\012 octal) is mapped to hex 0a -(ASCII's line feed) instead of hex 8e. This is done because throughout -Apache, protocol string definitions hardcode the linefeed as \012 (octal): -"Content-Type: text/plain\015\012". Without this kludge all protocol -string definitions would need to be changed from ...\012 to ...\025. -*/ -const unsigned char os_toascii[256] = { - 0x00, 0x01, 0x02, 0x03, 0x85, 0x09, 0x86, 0x7f, /* 00-0f: */ - 0x87, 0x8d, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f, /* ................ */ - 0x10, 0x11, 0x12, 0x13, 0x8f, 0x0a, 0x08, 0x97, /* 10-1f: */ - 0x18, 0x19, 0x9c, 0x9d, 0x1c, 0x1d, 0x1e, 0x1f, /* ................ */ - 0x80, 0x81, 0x82, 0x83, 0x84, 0x92, 0x17, 0x1b, /* 20-2f: */ - 0x88, 0x89, 0x8a, 0x8b, 0x8c, 0x05, 0x06, 0x07, /* ................ */ - 0x90, 0x91, 0x16, 0x93, 0x94, 0x95, 0x96, 0x04, /* 30-3f: */ - 0x98, 0x99, 0x9a, 0x9b, 0x14, 0x15, 0x9e, 0x1a, /* ................ */ - 0x20, 0xa0, 0xe2, 0xe4, 0xe0, 0xe1, 0xe3, 0xe5, /* 40-4f: */ - 0xe7, 0xf1, 0xa2, 0x2e, 0x3c, 0x28, 0x2b, 0x7c, /* ...........<(+| */ - 0x26, 0xe9, 0xea, 0xeb, 0xe8, 0xed, 0xee, 0xef, /* 50-5f: */ - 0xec, 0xdf, 0x21, 0x24, 0x2a, 0x29, 0x3b, 0x5e, /* &.........!$*);^ */ - 0x2d, 0x2f, 0xc2, 0xc4, 0xc0, 0xc1, 0xc3, 0xc5, /* 60-6f: */ - 0xc7, 0xd1, 0xa6, 0x2c, 0x25, 0x5f, 0x3e, 0x3f, /* -/.........,%_>? */ - 0xf8, 0xc9, 0xca, 0xcb, 0xc8, 0xcd, 0xce, 0xcf, /* 70-7f: */ - 0xcc, 0x60, 0x3a, 0x23, 0x40, 0x27, 0x3d, 0x22, /* .........`:#@'=" */ - 0xd8, 0x61, 0x62, 0x63, 0x64, 0x65, 0x66, 0x67, /* 80-8f: */ - 0x68, 0x69, 0xab, 0xbb, 0xf0, 0xfd, 0xfe, 0xb1, /* .abcdefghi...... */ - 0xb0, 0x6a, 0x6b, 0x6c, 0x6d, 0x6e, 0x6f, 0x70, /* 90-9f: */ - 0x71, 0x72, 0xaa, 0xba, 0xe6, 0xb8, 0xc6, 0xa4, /* .jklmnopqr...... */ - 0xb5, 0x7e, 0x73, 0x74, 0x75, 0x76, 0x77, 0x78, /* a0-af: */ - 0x79, 0x7a, 0xa1, 0xbf, 0xd0, 0x5b, 0xde, 0xae, /* .~stuvwxyz...[.. */ - 0xac, 0xa3, 0xa5, 0xb7, 0xa9, 0xa7, 0xb6, 0xbc, /* b0-bf: */ - 0xbd, 0xbe, 0xdd, 0xa8, 0xaf, 0x5d, 0xb4, 0xd7, /* .............].. */ - 0x7b, 0x41, 0x42, 0x43, 0x44, 0x45, 0x46, 0x47, /* c0-cf: */ - 0x48, 0x49, 0xad, 0xf4, 0xf6, 0xf2, 0xf3, 0xf5, /* {ABCDEFGHI...... */ - 0x7d, 0x4a, 0x4b, 0x4c, 0x4d, 0x4e, 0x4f, 0x50, /* d0-df: */ - 0x51, 0x52, 0xb9, 0xfb, 0xfc, 0xf9, 0xfa, 0xff, /* }JKLMNOPQR...... */ - 0x5c, 0xf7, 0x53, 0x54, 0x55, 0x56, 0x57, 0x58, /* e0-ef: */ - 0x59, 0x5a, 0xb2, 0xd4, 0xd6, 0xd2, 0xd3, 0xd5, /* \.STUVWXYZ...... */ - 0x30, 0x31, 0x32, 0x33, 0x34, 0x35, 0x36, 0x37, /* f0-ff: */ - 0x38, 0x39, 0xb3, 0xdb, 0xdc, 0xd9, 0xda, 0x9f /* 0123456789...... */ -}; - -/* -The US-ASCII to EBCDIC (character set IBM-1047) table: -This table is bijective (no ambiguous or duplicate characters) -*/ -const unsigned char os_toebcdic[256] = { - 0x00, 0x01, 0x02, 0x03, 0x37, 0x2d, 0x2e, 0x2f, /* 00-0f: */ - 0x16, 0x05, 0x15, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f, /* ................ */ - 0x10, 0x11, 0x12, 0x13, 0x3c, 0x3d, 0x32, 0x26, /* 10-1f: */ - 0x18, 0x19, 0x3f, 0x27, 0x1c, 0x1d, 0x1e, 0x1f, /* ................ */ - 0x40, 0x5a, 0x7f, 0x7b, 0x5b, 0x6c, 0x50, 0x7d, /* 20-2f: */ - 0x4d, 0x5d, 0x5c, 0x4e, 0x6b, 0x60, 0x4b, 0x61, /* !"#$%&'()*+,-./ */ - 0xf0, 0xf1, 0xf2, 0xf3, 0xf4, 0xf5, 0xf6, 0xf7, /* 30-3f: */ - 0xf8, 0xf9, 0x7a, 0x5e, 0x4c, 0x7e, 0x6e, 0x6f, /* 0123456789:;<=>? */ - 0x7c, 0xc1, 0xc2, 0xc3, 0xc4, 0xc5, 0xc6, 0xc7, /* 40-4f: */ - 0xc8, 0xc9, 0xd1, 0xd2, 0xd3, 0xd4, 0xd5, 0xd6, /* @ABCDEFGHIJKLMNO */ - 0xd7, 0xd8, 0xd9, 0xe2, 0xe3, 0xe4, 0xe5, 0xe6, /* 50-5f: */ - 0xe7, 0xe8, 0xe9, 0xad, 0xe0, 0xbd, 0x5f, 0x6d, /* PQRSTUVWXYZ[\]^_ */ - 0x79, 0x81, 0x82, 0x83, 0x84, 0x85, 0x86, 0x87, /* 60-6f: */ - 0x88, 0x89, 0x91, 0x92, 0x93, 0x94, 0x95, 0x96, /* `abcdefghijklmno */ - 0x97, 0x98, 0x99, 0xa2, 0xa3, 0xa4, 0xa5, 0xa6, /* 70-7f: */ - 0xa7, 0xa8, 0xa9, 0xc0, 0x4f, 0xd0, 0xa1, 0x07, /* pqrstuvwxyz{|}~. */ - 0x20, 0x21, 0x22, 0x23, 0x24, 0x04, 0x06, 0x08, /* 80-8f: */ - 0x28, 0x29, 0x2a, 0x2b, 0x2c, 0x09, 0x0a, 0x14, /* ................ */ - 0x30, 0x31, 0x25, 0x33, 0x34, 0x35, 0x36, 0x17, /* 90-9f: */ - 0x38, 0x39, 0x3a, 0x3b, 0x1a, 0x1b, 0x3e, 0xff, /* ................ */ - 0x41, 0xaa, 0x4a, 0xb1, 0x9f, 0xb2, 0x6a, 0xb5, /* a0-af: */ - 0xbb, 0xb4, 0x9a, 0x8a, 0xb0, 0xca, 0xaf, 0xbc, /* ................ */ - 0x90, 0x8f, 0xea, 0xfa, 0xbe, 0xa0, 0xb6, 0xb3, /* b0-bf: */ - 0x9d, 0xda, 0x9b, 0x8b, 0xb7, 0xb8, 0xb9, 0xab, /* ................ */ - 0x64, 0x65, 0x62, 0x66, 0x63, 0x67, 0x9e, 0x68, /* c0-cf: */ - 0x74, 0x71, 0x72, 0x73, 0x78, 0x75, 0x76, 0x77, /* ................ */ - 0xac, 0x69, 0xed, 0xee, 0xeb, 0xef, 0xec, 0xbf, /* d0-df: */ - 0x80, 0xfd, 0xfe, 0xfb, 0xfc, 0xba, 0xae, 0x59, /* ................ */ - 0x44, 0x45, 0x42, 0x46, 0x43, 0x47, 0x9c, 0x48, /* e0-ef: */ - 0x54, 0x51, 0x52, 0x53, 0x58, 0x55, 0x56, 0x57, /* ................ */ - 0x8c, 0x49, 0xcd, 0xce, 0xcb, 0xcf, 0xcc, 0xe1, /* f0-ff: */ - 0x70, 0xdd, 0xde, 0xdb, 0xdc, 0x8d, 0x8e, 0xdf /* ................ */ -}; - -/* Translate a memory block from EBCDIC (host charset) to ASCII (net charset) - * dest and srce may be identical, or separate memory blocks, but - * should not overlap. - */ -void -ebcdic2ascii(void *dest, const void *srce, size_t count) -{ - unsigned char *udest = dest; - const unsigned char *usrce = srce; - while (count-- != 0) { - *udest++ = os_toascii[*usrce++]; - } -} -void -ebcdic2ascii_strictly(unsigned char *dest, const unsigned char *srce, size_t count) -{ - while (count-- != 0) { - *dest++ = os_toascii_strictly[*srce++]; - } -} -void -ascii2ebcdic(void *dest, const void *srce, size_t count) -{ - unsigned char *udest = dest; - const unsigned char *usrce = srce; - - while (count-- != 0) { - *udest++ = os_toebcdic[*usrce++]; - } -} -#endif /*CHARSET_EBCDIC*/ - diff --git a/os/tpf/ebcdic.h b/os/tpf/ebcdic.h deleted file mode 100644 index e9c4120e1a3c923e5af1e8ed4d653162dc592383..0000000000000000000000000000000000000000 --- a/os/tpf/ebcdic.h +++ /dev/null @@ -1,8 +0,0 @@ -#include - -extern const unsigned char os_toascii[256]; -extern const unsigned char os_toebcdic[256]; -void ebcdic2ascii(void *dest, const void *srce, size_t count); -void ebcdic2ascii_strictly(unsigned char *dest, const unsigned char *srce, size_t count); -void ascii2ebcdic(void *dest, const void *srce, size_t count); - diff --git a/os/tpf/os.c b/os/tpf/os.c deleted file mode 100644 index e4682324cd1f45d15455accda59b26f3c3903769..0000000000000000000000000000000000000000 --- a/os/tpf/os.c +++ /dev/null @@ -1,414 +0,0 @@ -/* ==================================================================== - * Copyright (c) 1998-1999 The Apache Group. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in - * the documentation and/or other materials provided with the - * distribution. - * - * 3. All advertising materials mentioning features or use of this - * software must display the following acknowledgment: - * "This product includes software developed by the Apache Group - * for use in the Apache HTTP server project (http://www.apache.org/)." - * - * 4. The names "Apache Server" and "Apache Group" must not be used to - * endorse or promote products derived from this software without - * prior written permission. For written permission, please contact - * apache@apache.org. - * - * 5. Products derived from this software may not be called "Apache" - * nor may "Apache" appear in their names without prior written - * permission of the Apache Group. - * - * 6. Redistributions of any form whatsoever must retain the following - * acknowledgment: - * "This product includes software developed by the Apache Group - * for use in the Apache HTTP server project (http://www.apache.org/)." - * - * THIS SOFTWARE IS PROVIDED BY THE APACHE GROUP ``AS IS'' AND ANY - * EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR - * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE APACHE GROUP OR - * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT - * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, - * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED - * OF THE POSSIBILITY OF SUCH DAMAGE. - * ==================================================================== - * - * This software consists of voluntary contributions made by many - * individuals on behalf of the Apache Group and was originally based - * on public domain software written at the National Center for - * Supercomputing Applications, University of Illinois, Urbana-Champaign. - * For more information on the Apache Group and the Apache HTTP server - * project, please see . - * - */ - -/* - * This file will include OS specific functions which are not inlineable. - * Any inlineable functions should be defined in os-inline.c instead. - */ - -#include "httpd.h" -#include "http_core.h" -#include "os.h" -#include "scoreboard.h" -#include "http_log.h" -#include "http_conf_globals.h" - -static FILE *sock_fp; - -/* Check the Content-Type to decide if conversion is needed */ -int ap_checkconv(struct request_rec *r) -{ - int convert_to_ascii; - const char *type; - - /* To make serving of "raw ASCII text" files easy (they serve faster - * since they don't have to be converted from EBCDIC), a new - * "magic" type prefix was invented: text/x-ascii-{plain,html,...} - * If we detect one of these content types here, we simply correct - * the type to the real text/{plain,html,...} type. Otherwise, we - * set a flag that translation is required later on. - */ - - type = (r->content_type == NULL) ? ap_default_type(r) : r->content_type; - - /* If no content type is set then treat it as (ebcdic) text/plain */ - convert_to_ascii = (type == NULL); - - /* Conversion is applied to text/ files only, if ever. */ - if (type && (strncasecmp(type, "text/", 5) == 0 || - strncasecmp(type, "message/", 8) == 0)) { - if (strncasecmp(type, ASCIITEXT_MAGIC_TYPE_PREFIX, - sizeof(ASCIITEXT_MAGIC_TYPE_PREFIX)-1) == 0){ - r->content_type = ap_pstrcat(r->pool, "text/", - type+sizeof(ASCIITEXT_MAGIC_TYPE_PREFIX)-1, NULL); - if (r->method_number == M_PUT) - ap_bsetflag(r->connection->client, B_ASCII2EBCDIC, 0); - } - - else - /* translate EBCDIC to ASCII */ - convert_to_ascii = 1; - } - else{ - if (r->method_number == M_PUT) - ap_bsetflag(r->connection->client, B_ASCII2EBCDIC, 0); - /* don't translate non-text files to EBCDIC */ - } - /* Enable conversion if it's a text document */ - ap_bsetflag(r->connection->client, B_EBCDIC2ASCII, convert_to_ascii); - - return convert_to_ascii; -} - -int tpf_select(int maxfds, fd_set *reads, fd_set *writes, fd_set *excepts, struct timeval *tv) -{ -/* We're going to force our way through select. We're only interested reads and TPF allows - 2billion+ socket descriptors for we don't want an fd_set that big. Just assume that maxfds-1 - contains the socket descriptor we're interested in. If it's 0, leave it alone. */ - - int sockets[1]; - int no_reads = 0; - int no_writes = 0; - int no_excepts = 0; - int timeout = 0; - int rv; - - if(maxfds) { - if(tv) - timeout = tv->tv_sec * 1000 + tv->tv_usec; - sockets[0] = maxfds-1; - no_reads++; - } - else - sockets[0] = 0; - - ap_check_signals(); - rv = select(sockets, no_reads, no_writes, no_excepts, timeout); - ap_check_signals(); - - return rv; - -} - -int tpf_accept(int sockfd, struct sockaddr *peer, int *paddrlen) -{ - int socks[1]; - int rv; - - ap_check_signals(); - socks[0] = sockfd; - rv = select(socks, 1, 0, 0, 1000); - errno = sock_errno(); - if(rv>0) { - ap_check_signals(); - rv = accept(sockfd, peer, paddrlen); - errno = sock_errno(); - } - return rv; -} - -/* the getpass function is not usable on TPF */ -char *getpass(const char* prompt) -{ - errno = EIO; - return((char *)NULL); -} - -#ifndef __PIPE_ -int pipe(int fildes[2]) -{ - errno = ENOSYS; - return(-1); -} -#endif - -/* fork and exec functions are not defined on - TPF due to the implementation of tpf_fork() */ - -pid_t fork(void) -{ - errno = ENOSYS; - return(-1); -} - -int execl(const char *path, const char *arg0, ...) -{ - errno = ENOSYS; - return(-1); -} - -int execle(const char *path, const char *arg0, ...) -{ - errno = ENOSYS; - return(-1); -} - -int execve(const char *path, char *const argv[], char *const envp[]) -{ - errno = ENOSYS; - return(-1); -} - -int execvp(const char *file, char *const argv[]) -{ - errno = ENOSYS; - return(-1); -} - - - -int ap_tpf_spawn_child(pool *p, int (*func) (void *, child_info *), - void *data, enum kill_conditions kill_how, - int *pipe_in, int *pipe_out, int *pipe_err, - int out_fds[], int in_fds[], int err_fds[]) - -{ - - int i, temp_out, temp_in, temp_err, save_errno, pid, result=0; - int fd_flags_out, fd_flags_in, fd_flags_err; - struct tpf_fork_input fork_input; - TPF_FORK_CHILD *cld = (TPF_FORK_CHILD *) data; - array_header *env_arr = ap_table_elts ((array_header *) cld->subprocess_env); - table_entry *elts = (table_entry *) env_arr->elts; - - - - if (func) { - if (result=func(data, NULL)) { - return 0; /* error from child function */ - } - } - - if (pipe_out) { - fd_flags_out = fcntl(out_fds[0], F_GETFD); - fcntl(out_fds[0], F_SETFD, FD_CLOEXEC); - temp_out = dup(STDOUT_FILENO); - fcntl(temp_out, F_SETFD, FD_CLOEXEC); - dup2(out_fds[1], STDOUT_FILENO); - } - - - if (pipe_in) { - fd_flags_in = fcntl(in_fds[1], F_GETFD); - fcntl(in_fds[1], F_SETFD, FD_CLOEXEC); - temp_in = dup(STDIN_FILENO); - fcntl(temp_in, F_SETFD, FD_CLOEXEC); - dup2(in_fds[0], STDIN_FILENO); - } - - if (pipe_err) { - fd_flags_err = fcntl(err_fds[0], F_GETFD); - fcntl(err_fds[0], F_SETFD, FD_CLOEXEC); - temp_err = dup(STDERR_FILENO); - fcntl(temp_err, F_SETFD, FD_CLOEXEC); - dup2(err_fds[1], STDERR_FILENO); - } - - if (cld->subprocess_env) { - for (i = 0; i < env_arr->nelts; ++i) { - if (!elts[i].key) - continue; - setenv (elts[i].key, elts[i].val, 1); - } - } - - fork_input.program = (const char*) cld->filename; - fork_input.prog_type = cld->prog_type; - fork_input.istream = TPF_FORK_IS_BALANCE; - fork_input.ebw_data_length = 0; - fork_input.ebw_data = NULL; - fork_input.parm_data = NULL; - - - if ((pid = tpf_fork(&fork_input)) < 0) { - save_errno = errno; - if (pipe_out) { - close(out_fds[0]); - } - if (pipe_in) { - close(in_fds[1]); - } - if (pipe_err) { - close(err_fds[0]); - } - errno = save_errno; - pid = 0; - } - - if (cld->subprocess_env) { - for (i = 0; i < env_arr->nelts; ++i) { - if (!elts[i].key) - continue; - unsetenv (elts[i].key); - } - } - - if (pipe_out) { - close(out_fds[1]); - dup2(temp_out, STDOUT_FILENO); - close(temp_out); - fcntl(out_fds[0], F_SETFD, fd_flags_out); - } - - if (pipe_in) { - close(in_fds[0]); - dup2(temp_in, STDIN_FILENO); - close(temp_in); - fcntl(in_fds[1], F_SETFD, fd_flags_in); - } - - - if (pipe_err) { - close(err_fds[1]); - dup2(temp_err, STDERR_FILENO); - close(temp_err); - fcntl(err_fds[0], F_SETFD, fd_flags_err); - } - - - if (pid) { - - ap_note_subprocess(p, pid, kill_how); - - if (pipe_out) { - *pipe_out = out_fds[0]; - } - if (pipe_in) { - *pipe_in = in_fds[1]; - } - if (pipe_err) { - *pipe_err = err_fds[0]; - } - } - - return pid; - -} - -pid_t os_fork(server_rec *s, int slot) -{ - struct tpf_fork_input fork_input; - APACHE_TPF_INPUT input_parms; - int count; - listen_rec *lr; - - fflush(stdin); - if (dup2(fileno(sock_fp), STDIN_FILENO) == -1) - ap_log_error(APLOG_MARK, APLOG_CRIT, s, - "unable to replace stdin with sock device driver"); - fflush(stdout); - if (dup2(fileno(sock_fp), STDOUT_FILENO) == -1) - ap_log_error(APLOG_MARK, APLOG_CRIT, s, - "unable to replace stdout with sock device driver"); - input_parms.generation = ap_my_generation; -#ifdef SCOREBOARD_FILE - input_parms.scoreboard_fd = scoreboard_fd; -#else /* must be USE_TPF_SCOREBOARD or USE_SHMGET_SCOREBOARD */ - input_parms.scoreboard_heap = ap_scoreboard_image; -#endif - - lr = ap_listeners; - count = 0; - do { - input_parms.listeners[count] = lr->fd; - lr = lr->next; - count++; - } while(lr != ap_listeners); - - input_parms.slot = slot; - input_parms.restart_time = ap_restart_time; - fork_input.ebw_data = &input_parms; - fork_input.program = ap_server_argv0; - fork_input.prog_type = TPF_FORK_NAME; - fork_input.istream = TPF_FORK_IS_BALANCE; - fork_input.ebw_data_length = sizeof(input_parms); - fork_input.parm_data = "-x"; - return tpf_fork(&fork_input); -} - -int os_check_server(char *server) { - #ifndef USE_TPF_DAEMON - int rv; - int *current_acn; - if((rv = inetd_getServerStatus(server)) == INETD_SERVER_STATUS_INACTIVE) - return 1; - else { - current_acn = (int *)cinfc_fast(CINFC_CMMACNUM); - if(ecbp2()->ce2acn != *current_acn) - return 1; - } - #endif - return 0; -} - -void os_note_additional_cleanups(pool *p, int sd) { - char sockfilename[50]; - /* write the socket to file so that TPF socket device driver will close socket in case - we happen to abend. */ - sprintf(sockfilename, "/dev/tpf.socket.file/%.8X", sd); - sock_fp = fopen(sockfilename, "r+"); - ap_note_cleanups_for_file(p, sock_fp); /* arrange to close on exec or restart */ - fcntl(sd,F_SETFD,FD_CLOEXEC); -} - -void os_tpf_child(APACHE_TPF_INPUT *input_parms) { - tpf_child = 1; - ap_my_generation = input_parms->generation; - ap_restart_time = input_parms->restart_time; -} - - diff --git a/os/tpf/os.h b/os/tpf/os.h deleted file mode 100644 index ff65322902940eb29e8f010a23bec70af6a02f0b..0000000000000000000000000000000000000000 --- a/os/tpf/os.h +++ /dev/null @@ -1,108 +0,0 @@ -#ifndef APACHE_OS_H -#define APACHE_OS_H - -#define PLATFORM "TPF" - -#ifdef errno -#undef errno -#endif - -/* - * 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 or os-inline.c - */ - -#include "ap_config.h" - -#if !defined(INLINE) && defined(USE_GNU_INLINE) -/* Compiler supports inline, so include the inlineable functions as - * part of the header - */ -#define INLINE extern ap_inline -#include "os-inline.c" -#endif - -#ifndef INLINE -/* Compiler does not support inline, so prototype the inlineable functions - * as normal - */ -extern int ap_os_is_path_absolute(const char *f); -#endif - -/* Other ap_os_ routines not used by this platform */ - -#define ap_os_is_filename_valid(f) (1) -#define ap_os_kill(pid, sig) kill(pid, sig) - -/* Sorry if this is ugly, but the include order doesn't allow me - * to use request_rec here... */ -struct request_rec; -extern int ap_checkconv(struct request_rec *r); - -#include -#ifndef __strings_h - -#define FD_SETSIZE 2048 - -typedef long fd_mask; - -#define NBBY 8 /* number of bits in a byte */ -#define NFDBITS (sizeof(fd_mask) * NBBY) -#define howmany(x, y) (((x)+((y)-1))/(y)) - -typedef struct fd_set { - fd_mask fds_bits [howmany(FD_SETSIZE, NFDBITS)]; -} fd_set; - -#define FD_CLR(n, p)((p)->fds_bits[(n)/NFDBITS] &= ~(1 << ((n) % NFDBITS))) -#define FD_ISSET(n, p)((p)->fds_bits[(n)/NFDBITS] & (1 <<((n) % NFDBITS))) -#define FD_ZERO(p) memset((char *)(p), 0, sizeof(*(p))) -#endif - -#ifdef FD_SET -#undef FD_SET -#define FD_SET(n, p) (0) -#endif - -#define RESOURCE_KEY ((void*) 0xC1C2C1C3) - -/* TPF doesn't have, or need, tzset (it is used in mod_expires.c) */ -#define tzset() - -#include -struct apache_input { - INETD_SERVER_INPUT inetd_server; - void *scoreboard_heap; /* scoreboard system heap address */ - int scoreboard_fd; /* scoreboard file descriptor */ - int slot; /* child number */ - int generation; /* server generation number */ - int listeners[10]; - time_t restart_time; -}; - -typedef struct apache_input APACHE_TPF_INPUT; - -typedef struct tpf_fork_child { - char *filename; - enum { FORK_NAME = 1, FORK_FILE = 2 } prog_type; - void *subprocess_env; -}TPF_FORK_CHILD; - -int tpf_accept(int sockfd, struct sockaddr *peer, int *paddrlen); -extern int tpf_child; - -struct server_rec; -pid_t os_fork(struct server_rec *s, int slot); -int os_check_server(char *server); -char *getpass(const char *prompt); -extern char *ap_server_argv0; -extern int scoreboard_fd; -#include -#ifndef SIGPIPE -#define SIGPIPE 14 -#endif -#ifdef NSIG -#undef NSIG -#endif -#endif /*! APACHE_OS_H*/ diff --git a/os/tpf/samples/linkdll.jcl b/os/tpf/samples/linkdll.jcl deleted file mode 100644 index 6bcd17c6b073e001b31743199a371dad07ffa6e6..0000000000000000000000000000000000000000 --- a/os/tpf/samples/linkdll.jcl +++ /dev/null @@ -1,121 +0,0 @@ -//APACH JOB MSGLEVEL=(1,1),CLASS=A,MSGCLASS=A -/*ROUTE PRINT XXXXXX.XXXXXX -/*ROUTE PUNCH XXXXXX.XXXXXX -/*NOTIFY XXXXXX.XXXXXX -//CCLE JCLLIB ORDER=(SYS1.CBC.SCBCPRC,SYS1.CEE.SCEEPROC) -//PRELINK EXEC EDCPL,COND.LKED=(0,NE), -// PPARM='OMVS,DLLNAME(pppp)', -// LREGSIZ='2048K', -// LPARM='AMODE=31,RMODE=ANY,LIST,XREF' -//PLKED.SYSLIB DD DISP=SHR,DSN=FSE0000.DEVP.STUB.OB -// DD DISP=SHR,DSN=FSE0000.DEVP.CLIB.OB -// DD DISP=SHR,DSN=ACP.CLIB.RLSE46.WEB -// DD DISP=SHR,DSN=ACP.STUB.RLSE46.WEB -// DD DISP=SHR,DSN=ACP.CLIB.RLSE40 -// DD DISP=SHR,DSN=ACP.STUB.RLSE40 -//PLKED.SYSDEFSD DD DSN=APA0000.DEVP.IMPORTS.DSD(ppppvv),DISP=SHR -//PLKED.DSD DD DSN=APA0000.DEVP.IMPORTS.DSD,DISP=SHR -//PLKED.OBJLIB DD DISP=SHR,DSN=FSE0000.DEVP.TEST.OB -// DD DISP=SHR,DSN=ACP.OBJ.RLSE46.WEB -// DD DISP=SHR,DSN=ACP.OBJ.INTG98.NBS -// DD DISP=SHR,DSN=ACP.MAIN.SYST.OBBSS -// DD DISP=SHR,DSN=ACP.DF.MAIN.SYST.OBBSS -// DD DISP=SHR,DSN=ACP.OBJ.RLSE40.BSS -//PLKED.OBJ1 DD PATH='/usr/local/apache/src/ap/ap_cpystrn.o' -//PLKED.OBJ2 DD PATH='/usr/local/apache/src/ap/ap_execve.o' -//PLKED.OBJ3 DD PATH='/usr/local/apache/src/ap/ap_signal.o' -//PLKED.OBJ4 DD PATH='/usr/local/apache/src/ap/ap_slack.o' -//PLKED.OBJ5 DD PATH='/usr/local/apache/src/ap/ap_snprintf.o' -//PLKED.OBJ6 DD PATH='/usr/local/apache/src/ap/ap_strings.o' -//PLKED.OBJ7 DD PATH='/usr/local/apache/src/os/tpf/ebcdic.o' -//PLKED.OBJ8 DD PATH='/usr/local/apache/src/os/tpf/os.o' -//PLKED.OBJ9 DD PATH='/usr/local/apache/src/os/tpf/os-inline.o' -//PLKED.OBJ10 DD PATH='/usr/local/apache/src/regex/regcomp.o' -//PLKED.OBJ11 DD PATH='/usr/local/apache/src/regex/regerror.o' -//PLKED.OBJ12 DD PATH='/usr/local/apache/src/regex/regexec.o' -//PLKED.OBJ13 DD PATH='/usr/local/apache/src/regex/regfree.o' -//PLKED.OBJ14 DD PATH='/usr/local/apache/src/main/alloc.o' -//PLKED.OBJ15 DD PATH='/usr/local/apache/src/main/buff.o' -//PLKED.OBJ16 DD PATH='/usr/local/apache/src/main/fnmatch.o' -//PLKED.OBJ17 DD PATH='/usr/local/apache/src/main/http_config.o' -//PLKED.OBJ18 DD PATH='/usr/local/apache/src/main/http_core.o' -//PLKED.OBJ19 DD PATH='/usr/local/apache/src/main/http_log.o' -//PLKED.OBJ20 DD PATH='/usr/local/apache/src/main/http_main.o' -//PLKED.OBJ21 DD PATH='/usr/local/apache/src/main/http_protocol.o' -//PLKED.OBJ22 DD PATH='/usr/local/apache/src/main/http_request.o' -//PLKED.OBJ23 DD PATH='/usr/local/apache/src/main/http_vhost.o' -//PLKED.OBJ24 DD PATH='/usr/local/apache/src/main/md5c.o' -//PLKED.OBJ25 DD PATH='/usr/local/apache/src/main/rfc1413.o' -//PLKED.OBJ26 DD PATH='/usr/local/apache/src/main/util.o' -//PLKED.OBJ27 DD PATH='/usr/local/apache/src/main/util_date.o' -//PLKED.OBJ28 DD PATH='/usr/local/apache/src/main/util_md5.o' -//PLKED.OBJ29 DD PATH='/usr/local/apache/src/main/util_script.o' -//PLKED.OBJ30 DD PATH='/usr/local/apache/src/main/util_uri.o' -//PLKED.OBJ31 DD PATH='/usr/local/apache/src/modules.o' -//PLKED.OBJ32 DD PATH='/usr/local/apache/src/buildmark.o' -//PLKED.OBJ33 DD PATH='/usr/local/apache/src/modules/standard/mod_auto\ -// index.o' -//PLKED.OBJ34 DD PATH='/usr/local/apache/src/modules/standard/mod_dir.\ -// o' -//PLKED.OBJ35 DD PATH='/usr/local/apache/src/modules/standard/mod_mime\ -// .o' -//PLKED.OBJ36 DD PATH='/usr/local/apache/src/modules/standard/mod_sete\ -// nvif.o' -//PLKED.OBJ37 DD PATH='/usr/local/apache/src/modules/standard/mod_alia\ -// s.o' -//PLKED.OBJ38 DD PATH='/usr/local/apache/src/modules/standard/mod_acce\ -// ss.o' -//PLKED.OBJ39 DD PATH='/usr/local/apache/src/modules/standard/mod_user\ -// dir.o' -//PLKED.OBJ40 DD PATH='/usr/local/apache/src/modules/standard/mod_spel\ -// ing.o' -//PLKED.OBJ41 DD PATH='/usr/local/apache/src/modules/standard/mod_nego\ -// tiation.o' -//PLKED.SYSIN DD * - ORDER @@DLMHDR - INCLUDE OBJLIB(CSTRTD40) - INCLUDE OBJ1 - INCLUDE OBJ2 - INCLUDE OBJ3 - INCLUDE OBJ4 - INCLUDE OBJ5 - INCLUDE OBJ6 - INCLUDE OBJ7 - INCLUDE OBJ8 - INCLUDE OBJ9 - INCLUDE OBJ10 - INCLUDE OBJ11 - INCLUDE OBJ12 - INCLUDE OBJ13 - INCLUDE OBJ14 - INCLUDE OBJ15 - INCLUDE OBJ16 - INCLUDE OBJ17 - INCLUDE OBJ18 - INCLUDE OBJ19 - INCLUDE OBJ20 - INCLUDE OBJ21 - INCLUDE OBJ22 - INCLUDE OBJ23 - INCLUDE OBJ24 - INCLUDE OBJ25 - INCLUDE OBJ26 - INCLUDE OBJ27 - INCLUDE OBJ28 - INCLUDE OBJ29 - INCLUDE OBJ30 - INCLUDE OBJ31 - INCLUDE OBJ32 - INCLUDE OBJ33 - INCLUDE OBJ34 - INCLUDE OBJ35 - INCLUDE OBJ36 - INCLUDE OBJ37 - INCLUDE OBJ38 - INCLUDE OBJ39 - INCLUDE OBJ40 - INCLUDE OBJ41 -/* -//*** WARNING *** NEVER change .LK to .OB in SYSLMOD!!! -//LKED.SYSLMOD DD DISP=OLD,DSN=xxxxxx.xxxx(ppppvv) -// diff --git a/os/tpf/samples/loadset.jcl b/os/tpf/samples/loadset.jcl deleted file mode 100644 index c0134d4cb82dc92ab421958148ba66cbc2bcae7c..0000000000000000000000000000000000000000 --- a/os/tpf/samples/loadset.jcl +++ /dev/null @@ -1,58 +0,0 @@ -//OLDRWEB JOB MSGLEVEL=1,CLASS=A,MSGCLASS=S -//JOBCAT DD DSN=ICFCAT.ESAWK2,DISP=SHR -/*ROUTE PRINT xxxxxx.xxxxxxx -/*ROUTE PUNCH xxxxxx.xxxxxxx -//TLDR EXEC PGM=TPFLDRCA,REGION=8M, -// PARM='OLDR,SYS=ACP,CLMSIZE=8000000' -//STEPLIB DD DSN=ACP.LINK.RLSE46.WEB,DISP=SHR -// DD DSN=ACP.LINK.RLSE40.BSS,DISP=SHR -// DD DSN=VIS0000.DEVP.TEST.LK,DISP=SHR -// DD DSN=SYS1.CEE.SCEERUN,DISP=SHR -//SALTB DD DSN=ACP.SALTBL.RLSE46.WEB,DISP=SHR -// DD DSN=ACP.SALTBL.INTG46.WEB,DISP=SHR -//OBJLIB DD DSN=FSE0000.DEVP.TEST.OB,DISP=SHR -// DD DSN=APA0000.DEVP.TEST.OB,DISP=SHR -// DD DSN=ACP.DRVE.TEST.OB,DISP=SHR -// DD DSN=ACP.OBJ.RLSE46.WEB,DISP=SHR -// DD DSN=ACP.OBJ.INTG36.DRV,DISP=SHR -// DD DSN=ACP.OBJ.INTG46.WEB,DISP=SHR -// DD DSN=ACP.OBJ.INTG40.BSS,DISP=SHR -//LOADMOD DD DSN=FSE0000.DEVP.TEST.LK,DISP=SHR -// DD DSN=APA0000.DEVP.TEST.LK,DISP=SHR -// DD DSN=CWEISS.LINK,DISP=SHR -// DD DSN=ACP.DRVE.TEST.LK,DISP=SHR -// DD DSN=ACP.LINK.RLSE46.WEB,DISP=SHR -// DD DSN=ACP.LINK.INTG98.NBS,DISP=SHR -// DD DSN=ACP.LINK.INTG46.WEB,DISP=SHR -// DD DSN=ACP.LINK.INTG36.DRV,DISP=SHR -// DD DSN=ACP.LINK.INTG40.BSS,DISP=SHR -//LOADSUM DD DSN=&&LOADSUM,DISP=(NEW,PASS),UNIT=SYSDA, -// LRECL=133,SPACE=(TRK,(10,10)),RECFM=FBA -//CPRTEMP DD UNIT=SYSDA, -// DSN=&&CPRTEMP,SPACE=(TRK,(100,20)), -// DCB=(RECFM=FB,BLKSIZE=4095,LRECL=4095), -// DISP=(NEW,DELETE) -//PROGTEMP DD UNIT=SYSDA, -// DSN=&&PRTEMP,SPACE=(TRK,(100,20)), -// DCB=(RECFM=FB,BLKSIZE=4095,LRECL=4095), -// DISP=(NEW,DELETE) -//OUTPUT DD DSN=&&VRDROUT,DISP=(NEW,PASS),UNIT=SYSDA, -// DCB=(RECFM=F,BLKSIZE=4095,LRECL=4095) -//SYSUDUMP DD DUMMY -//SYSABEND DD DUMMY -//SYSOUT DD SYSOUT=A -//SYSPRINT DD SYSOUT=A -//PRINTER DD SYSOUT=A -//CEEDUMP DD SYSOUT=A -//SYSIN DD * -SYSID=BSS -PATVERS=NONE -SALVERS=40 -LOADER LOADSET lllllll -LOADER CALL PROG ppppvv -/* -//TRANSMIT EXEC PGM=IKJEFT01, -// PARM='TRANSMIT xxxxxx.xxxxxx DDNAME(SYSTSIN) NOLOG NONOTIFY SEQ' -//SYSTSIN DD UNIT=SYSDA, -// DSN=&&VRDROUT,DISP=(OLD,DELETE) -//SYSTSPRT DD DUMMY diff --git a/os/unix/.cvsignore b/os/unix/.cvsignore deleted file mode 100644 index f3c7a7c5da68804a1bdf391127ba34aed33c3cca..0000000000000000000000000000000000000000 --- a/os/unix/.cvsignore +++ /dev/null @@ -1 +0,0 @@ -Makefile diff --git a/os/unix/Makefile.in b/os/unix/Makefile.in deleted file mode 100644 index 82b2dfc8cade311101e084944f1493bd7cedd71f..0000000000000000000000000000000000000000 --- a/os/unix/Makefile.in +++ /dev/null @@ -1,10 +0,0 @@ - -DEPTH = ../.. -topsrcdir = @topsrcdir@ -srcdir = @srcdir@ -VPATH = @srcdir@ - -LTLIBRARY_NAME = libos.la -LTLIBRARY_SOURCES = os.c os-inline.c unixd.c iol_socket.c - -include $(topsrcdir)/build/ltlib.mk diff --git a/os/unix/config.m4 b/os/unix/config.m4 deleted file mode 100644 index 86469135b606deeb475897ca381a30d731a376f8..0000000000000000000000000000000000000000 --- a/os/unix/config.m4 +++ /dev/null @@ -1,7 +0,0 @@ -AC_CHECK_FUNCS( \ -setsid \ -killpg \ -) - -dnl XXX - This doesn't deal with _sys_siglist. Probably have to roll our own -AC_DECL_SYS_SIGLIST diff --git a/os/unix/os.h b/os/unix/os.h deleted file mode 100644 index 6689dfae5c66d5bab4f37f9fb04b0a400a763ff5..0000000000000000000000000000000000000000 --- a/os/unix/os.h +++ /dev/null @@ -1,147 +0,0 @@ -/* ==================================================================== - * Copyright (c) 1998-1999 The Apache Group. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in - * the documentation and/or other materials provided with the - * distribution. - * - * 3. All advertising materials mentioning features or use of this - * software must display the following acknowledgment: - * "This product includes software developed by the Apache Group - * for use in the Apache HTTP server project (http://www.apache.org/)." - * - * 4. The names "Apache Server" and "Apache Group" must not be used to - * endorse or promote products derived from this software without - * prior written permission. For written permission, please contact - * apache@apache.org. - * - * 5. Products derived from this software may not be called "Apache" - * nor may "Apache" appear in their names without prior written - * permission of the Apache Group. - * - * 6. Redistributions of any form whatsoever must retain the following - * acknowledgment: - * "This product includes software developed by the Apache Group - * for use in the Apache HTTP server project (http://www.apache.org/)." - * - * THIS SOFTWARE IS PROVIDED BY THE APACHE GROUP ``AS IS'' AND ANY - * EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR - * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE APACHE GROUP OR - * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT - * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, - * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED - * OF THE POSSIBILITY OF SUCH DAMAGE. - * ==================================================================== - * - * This software consists of voluntary contributions made by many - * individuals on behalf of the Apache Group and was originally based - * on public domain software written at the National Center for - * Supercomputing Applications, University of Illinois, Urbana-Champaign. - * For more information on the Apache Group and the Apache HTTP server - * project, please see . - * - */ - -#ifndef APACHE_OS_H -#define APACHE_OS_H - -#include "ap_config.h" - -#ifndef PLATFORM -#define PLATFORM "Unix" -#endif - -/* - * 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 or os-inline.c - */ - -#if !defined(INLINE) && defined(USE_GNU_INLINE) -/* Compiler supports inline, so include the inlineable functions as - * part of the header - */ -#define INLINE extern ap_inline - -INLINE int ap_os_is_path_absolute(const char *file); - -#include "os-inline.c" - -#else - -/* Compiler does not support inline, so prototype the inlineable functions - * as normal - */ -extern int ap_os_is_path_absolute(const char *file); -#endif - -/* Other ap_os_ routines not used by this platform */ - -#define ap_os_is_filename_valid(f) (1) -#define ap_os_kill(pid, sig) kill(pid, sig) - -/* - * Abstraction layer for loading - * Apache modules under run-time via - * dynamic shared object (DSO) mechanism - */ - -#ifdef HAVE_DL_H -#include -#endif - -/* - * Do not use native AIX DSO support - */ -#ifdef AIX -#undef HAVE_DLFCN_H -#endif - -#ifdef HAVE_DLFCN_H -#include -#else -void *dlopen(const char *, int); -int dlclose(void *); -void *dlsym(void *, const char *); -const char *dlerror(void); -#endif - -/* probably on an older system that doesn't support RTLD_NOW or RTLD_LAZY. - * The below define is a lie since we are really doing RTLD_LAZY since the - * system doesn't support RTLD_NOW. - */ -#ifndef RTLD_NOW -#define RTLD_NOW 1 -#endif - -#ifndef RTLD_GLOBAL -#define RTLD_GLOBAL 0 -#endif - -#if (defined(__FreeBSD__) ||\ - defined(__OpenBSD__) ||\ - defined(__NetBSD__) ) && !defined(__ELF__) -#define DLSYM_NEEDS_UNDERSCORE -#endif - -#define ap_os_dso_handle_t void * -void ap_os_dso_init(void); -void * ap_os_dso_load(const char *); -void ap_os_dso_unload(void *); -void * ap_os_dso_sym(void *, const char *); -const char *ap_os_dso_error(void); - -#endif /* !APACHE_OS_H */ diff --git a/os/unix/unixd.c b/os/unix/unixd.c deleted file mode 100644 index 5af54ec011b240efe0ede2ecc203d47b06157c40..0000000000000000000000000000000000000000 --- a/os/unix/unixd.c +++ /dev/null @@ -1,265 +0,0 @@ -/* ==================================================================== - * Copyright (c) 1998-1999 The Apache Group. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in - * the documentation and/or other materials provided with the - * distribution. - * - * 3. All advertising materials mentioning features or use of this - * software must display the following acknowledgment: - * "This product includes software developed by the Apache Group - * for use in the Apache HTTP server project (http://www.apache.org/)." - * - * 4. The names "Apache Server" and "Apache Group" must not be used to - * endorse or promote products derived from this software without - * prior written permission. For written permission, please contact - * apache@apache.org. - * - * 5. Products derived from this software may not be called "Apache" - * nor may "Apache" appear in their names without prior written - * permission of the Apache Group. - * - * 6. Redistributions of any form whatsoever must retain the following - * acknowledgment: - * "This product includes software developed by the Apache Group - * for use in the Apache HTTP server project (http://www.apache.org/)." - * - * THIS SOFTWARE IS PROVIDED BY THE APACHE GROUP ``AS IS'' AND ANY - * EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR - * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE APACHE GROUP OR - * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT - * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, - * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED - * OF THE POSSIBILITY OF SUCH DAMAGE. - * ==================================================================== - * - * This software consists of voluntary contributions made by many - * individuals on behalf of the Apache Group and was originally based - * on public domain software written at the National Center for - * Supercomputing Applications, University of Illinois, Urbana-Champaign. - * For more information on the Apache Group and the Apache HTTP server - * project, please see . - * - */ - -#include "httpd.h" -#include "http_config.h" -#include "http_main.h" -#include "http_log.h" -#include "unixd.h" - -unixd_config_rec unixd_config; - -void unixd_detach(void) -{ - int x; - pid_t pgrp; - - chdir("/"); -#if !defined(MPE) && !defined(OS2) && !defined(TPF) -/* Don't detach for MPE because child processes can't survive the death of - the parent. */ - if ((x = fork()) > 0) - exit(0); - else if (x == -1) { - perror("fork"); - fprintf(stderr, "%s: unable to fork new process\n", ap_server_argv0); - exit(1); - } - RAISE_SIGSTOP(DETACH); -#endif -#ifndef NO_SETSID - if ((pgrp = setsid()) == -1) { - perror("setsid"); - fprintf(stderr, "%s: setsid failed\n", ap_server_argv0); - exit(1); - } -#elif defined(NEXT) || defined(NEWSOS) - if (setpgrp(0, getpid()) == -1 || (pgrp = getpgrp(0)) == -1) { - perror("setpgrp"); - fprintf(stderr, "%s: setpgrp or getpgrp failed\n", ap_server_argv0); - exit(1); - } -#elif defined(OS2) || defined(TPF) - /* OS/2 and TPF don't support process group IDs */ - pgrp = getpid(); -#elif defined(MPE) - /* MPE uses negative pid for process group */ - pgrp = -getpid(); -#else - if ((pgrp = setpgrp(getpid(), 0)) == -1) { - perror("setpgrp"); - fprintf(stderr, "%s: setpgrp failed\n", ap_server_argv0); - exit(1); - } -#endif - - /* close out the standard file descriptors */ - if (freopen("/dev/null", "r", stdin) == NULL) { - fprintf(stderr, "%s: unable to replace stdin with /dev/null: %s\n", - ap_server_argv0, strerror(errno)); - /* continue anyhow -- note we can't close out descriptor 0 because we - * have nothing to replace it with, and if we didn't have a descriptor - * 0 the next file would be created with that value ... leading to - * havoc. - */ - } - if (freopen("/dev/null", "w", stdout) == NULL) { - fprintf(stderr, "%s: unable to replace stdout with /dev/null: %s\n", - ap_server_argv0, strerror(errno)); - } - /* stderr is a tricky one, we really want it to be the error_log, - * but we haven't opened that yet. So leave it alone for now and it'll - * be reopened moments later. - */ -} - -/* Set group privileges. - * - * Note that we use the username as set in the config files, rather than - * the lookup of to uid --- the same uid may have multiple passwd entries, - * with different sets of groups for each. - */ - -static int set_group_privs(void) -{ - if (!geteuid()) { - char *name; - - /* Get username if passed as a uid */ - - if (unixd_config.user_name[0] == '#') { - struct passwd *ent; - uid_t uid = atoi(&unixd_config.user_name[1]); - - if ((ent = getpwuid(uid)) == NULL) { - ap_log_error(APLOG_MARK, APLOG_ALERT, NULL, - "getpwuid: couldn't determine user name from uid %u, " - "you probably need to modify the User directive", - (unsigned)uid); - return -1; - } - - name = ent->pw_name; - } - else - name = unixd_config.user_name; - -#if !defined(OS2) && !defined(TPF) - /* OS/2 and TPF don't support groups. */ - - /* - * Set the GID before initgroups(), since on some platforms - * setgid() is known to zap the group list. - */ - if (setgid(unixd_config.group_id) == -1) { - ap_log_error(APLOG_MARK, APLOG_ALERT, NULL, - "setgid: unable to set group id to Group %u", - (unsigned)unixd_config.group_id); - return -1; - } - - /* Reset `groups' attributes. */ - - if (initgroups(name, unixd_config.group_id) == -1) { - ap_log_error(APLOG_MARK, APLOG_ALERT, NULL, - "initgroups: unable to set groups for User %s " - "and Group %u", name, (unsigned)unixd_config.group_id); - return -1; - } -#endif /* !defined(OS2) && !defined(TPF) */ - } - return 0; -} - - -int unixd_setup_child(void) -{ - if (set_group_privs()) { - return -1; - } -#ifdef MPE - /* Only try to switch if we're running as MANAGER.SYS */ - if (geteuid() == 1 && unixd_config.user_id > 1) { - GETPRIVMODE(); - if (setuid(unixd_config.user_id) == -1) { - GETUSERMODE(); - ap_log_error(APLOG_MARK, APLOG_ALERT, NULL, - "setuid: unable to change uid"); - exit(1); - } - GETUSERMODE(); - } -#else - /* Only try to switch if we're running as root */ - if (!geteuid() && ( -#ifdef _OSD_POSIX - os_init_job_environment(server_conf, unixd_config.user_name, one_process) != 0 || -#endif - setuid(unixd_config.user_id) == -1)) { - ap_log_error(APLOG_MARK, APLOG_ALERT, NULL, - "setuid: unable to change uid"); - return -1; - } -#endif - return 0; -} - - -const char *unixd_set_user(cmd_parms *cmd, void *dummy, char *arg) -{ - const char *err = ap_check_cmd_context(cmd, GLOBAL_ONLY); - if (err != NULL) { - return err; - } - - unixd_config.user_name = arg; - unixd_config.user_id = ap_uname2id(arg); -#if !defined (BIG_SECURITY_HOLE) && !defined (OS2) - if (unixd_config.user_id == 0) { - return "Error:\tApache has not been designed to serve pages while\n" - "\trunning as root. There are known race conditions that\n" - "\twill allow any local user to read any file on the system.\n" - "\tIf you still desire to serve pages as root then\n" - "\tadd -DBIG_SECURITY_HOLE to the EXTRA_CFLAGS line in your\n" - "\tsrc/Configuration file and rebuild the server. It is\n" - "\tstrongly suggested that you instead modify the User\n" - "\tdirective in your httpd.conf file to list a non-root\n" - "\tuser.\n"; - } -#endif - - return NULL; -} - -const char *unixd_set_group(cmd_parms *cmd, void *dummy, char *arg) -{ - const char *err = ap_check_cmd_context(cmd, GLOBAL_ONLY); - if (err != NULL) { - return err; - } - - unixd_config.group_id = ap_gname2id(arg); - - return NULL; -} - -void unixd_pre_config(void) -{ - unixd_config.user_name = DEFAULT_USER; - unixd_config.user_id = ap_uname2id(DEFAULT_USER); - unixd_config.group_id = ap_gname2id(DEFAULT_GROUP); -} diff --git a/os/unix/unixd.h b/os/unix/unixd.h deleted file mode 100644 index 37cb2f95b69995aae3fffd8bca97f9e676537c4c..0000000000000000000000000000000000000000 --- a/os/unix/unixd.h +++ /dev/null @@ -1,82 +0,0 @@ -/* ==================================================================== - * Copyright (c) 1998-1999 The Apache Group. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in - * the documentation and/or other materials provided with the - * distribution. - * - * 3. All advertising materials mentioning features or use of this - * software must display the following acknowledgment: - * "This product includes software developed by the Apache Group - * for use in the Apache HTTP server project (http://www.apache.org/)." - * - * 4. The names "Apache Server" and "Apache Group" must not be used to - * endorse or promote products derived from this software without - * prior written permission. For written permission, please contact - * apache@apache.org. - * - * 5. Products derived from this software may not be called "Apache" - * nor may "Apache" appear in their names without prior written - * permission of the Apache Group. - * - * 6. Redistributions of any form whatsoever must retain the following - * acknowledgment: - * "This product includes software developed by the Apache Group - * for use in the Apache HTTP server project (http://www.apache.org/)." - * - * THIS SOFTWARE IS PROVIDED BY THE APACHE GROUP ``AS IS'' AND ANY - * EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR - * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE APACHE GROUP OR - * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT - * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, - * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED - * OF THE POSSIBILITY OF SUCH DAMAGE. - * ==================================================================== - * - * This software consists of voluntary contributions made by many - * individuals on behalf of the Apache Group and was originally based - * on public domain software written at the National Center for - * Supercomputing Applications, University of Illinois, Urbana-Champaign. - * For more information on the Apache Group and the Apache HTTP server - * project, please see . - * - */ - -#ifndef UNIXD_H -#define UNIXD_H - -/* common stuff that unix MPMs will want */ - -typedef struct { - char *user_name; - uid_t user_id; - gid_t group_id; -} unixd_config_rec; -extern unixd_config_rec unixd_config; - -void unixd_detach(void); -int unixd_setup_child(void); -void unixd_pre_config(void); -const char *unixd_set_user(cmd_parms *cmd, void *dummy, char *arg); -const char *unixd_set_group(cmd_parms *cmd, void *dummy, char *arg); - -#define UNIX_DAEMON_COMMANDS \ -{ "User", unixd_set_user, NULL, RSRC_CONF, TAKE1, \ - "Effective user id for this server"}, \ -{ "Group", unixd_set_group, NULL, RSRC_CONF, TAKE1, \ - "Effective group id for this server"}, \ - -#endif diff --git a/os/win32/BaseAddr.ref b/os/win32/BaseAddr.ref deleted file mode 100644 index 7f5a7f66caee415381759e6ee25c46cdd6c6d9ef..0000000000000000000000000000000000000000 --- a/os/win32/BaseAddr.ref +++ /dev/null @@ -1,24 +0,0 @@ --- Begin New BaseAddr.ref -- -; os/win32/BaseAddr.ref contains the central repository -; of all module base addresses -; to avoid relocation - -; WARNING: Update this file by reviewing the image size -; of the debug-generated dll files; release images -; should fit in the larger debug-sized space. - -; module name base-address max-size - -aprlib 0x6FFA0000 0x00060000 -ApacheCore 0x6FF00000 0x000A0000 -mod_auth_anon 0x6FEF0000 0x00010000 -mod_cern_meta 0x6FEE0000 0x00010000 -mod_digest 0x6FED0000 0x00010000 -mod_expires 0x6FEC0000 0x00010000 -mod_headers 0x6FEB0000 0x00010000 -mod_info 0x6FEA0000 0x00010000 -mod_rewrite 0x6FE80000 0x00020000 -mod_speling 0x6FE70000 0x00010000 -mod_status 0x6FE60000 0x00010000 -mod_usertrack 0x6FE50000 0x00010000 -mod_proxy 0x6FE30000 0x00020000 diff --git a/os/win32/modules.c b/os/win32/modules.c deleted file mode 100644 index d55d3d832c55e1a01def08578e328a11b5e65c09..0000000000000000000000000000000000000000 --- a/os/win32/modules.c +++ /dev/null @@ -1,72 +0,0 @@ -/* modules.c --- major modules compiled into Apache for Win32. - * Only insert an entry for a module if it must be compiled into - * the core server - */ - -#include "httpd.h" -#include "http_config.h" - -extern module core_module; -extern module so_module; -extern module mime_module; -extern module access_module; -extern module auth_module; -extern module negotiation_module; -extern module includes_module; -extern module autoindex_module; -extern module dir_module; -extern module cgi_module; -extern module userdir_module; -extern module alias_module; -extern module env_module; -extern module config_log_module; -extern module asis_module; -extern module imap_module; -extern module action_module; -extern module setenvif_module; -extern module isapi_module; - -module *ap_prelinked_modules[] = { - &core_module, - &so_module, - &mime_module, - &access_module, - &auth_module, - &negotiation_module, - &includes_module, - &autoindex_module, - &dir_module, - &cgi_module, - &userdir_module, - &alias_module, - &env_module, - &config_log_module, - &asis_module, - &imap_module, - &action_module, - &setenvif_module, - &isapi_module, - NULL -}; -module *ap_preloaded_modules[] = { - &core_module, - &so_module, - &mime_module, - &access_module, - &auth_module, - &negotiation_module, - &includes_module, - &autoindex_module, - &dir_module, - &cgi_module, - &userdir_module, - &alias_module, - &env_module, - &config_log_module, - &asis_module, - &imap_module, - &action_module, - &setenvif_module, - &isapi_module, - NULL -}; diff --git a/os/win32/os.h b/os/win32/os.h deleted file mode 100644 index 80ffd7e65e37279e76c88e2b0784348f44d250aa..0000000000000000000000000000000000000000 --- a/os/win32/os.h +++ /dev/null @@ -1,126 +0,0 @@ -#ifndef APACHE_OS_H -#define APACHE_OS_H - -#define 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 WIN32_LEAN_AND_MEAN Now defined in project files */ -#ifndef STRICT - #define STRICT -#endif -#define CASE_BLIND_FILESYSTEM -#define NO_WRITEV -#define NO_SETSID -#define NO_USE_SIGACTION -#define NO_TIMES -#define NO_GETTIMEOFDAY -//#define NEED_PROCESS_H although we do, this is specially handled in ap_config.h -#define USE_LONGJMP -#define HAVE_MMAP -#define USE_MMAP_SCOREBOARD -#define MULTITHREAD -#define HAVE_CANONICAL_FILENAME -#define HAVE_DRIVE_LETTERS -typedef int uid_t; -typedef int gid_t; -typedef int pid_t; -typedef int mode_t; -typedef char * caddr_t; - -/* -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 -#else -# define API_VAR_EXPORT __declspec(dllexport) -# define API_EXPORT(type) __declspec(dllexport) type __stdcall -# define API_EXPORT_NONSTD(type) __declspec(dllexport) type -#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) -#define S_ISLNK(m) (0) -#define S_ISREG(m) ((m & _S_IFREG) == _S_IFREG) -#ifndef S_ISDIR -#define S_ISDIR(m) (((m) & S_IFDIR) == S_IFDIR) -#endif -#ifndef S_ISREG -#define S_ISREG(m) (((m)&(S_IFREG)) == (S_IFREG)) -#endif -#define STDIN_FILENO 0 -#define STDOUT_FILENO 1 -#define STDERR_FILENO 2 -#define JMP_BUF jmp_buf -#define sleep(t) Sleep(t*1000) -#define O_CREAT _O_CREAT -#define O_RDWR _O_RDWR -#define SIGPIPE 17 -/* Seems Windows is not a subgenius */ -#define NO_SLACK -#include - -#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[0] == '/' || file[1] == ':'; -} - -#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(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_load(l) LoadLibraryEx(l, NULL, LOAD_WITH_ALTERED_SEARCH_PATH) -#define ap_os_dso_unload(l) FreeLibrary(l) -#define ap_os_dso_sym(h,s) GetProcAddress(h,s) -#define ap_os_dso_error() "" /* for now */ - -/* Other ap_os_ routines not used by this platform */ -#define ap_os_kill(pid, sig) kill(pid, sig) - -#endif /* ! APACHE_OS_H */ diff --git a/os/win32/util_win32.c b/os/win32/util_win32.c deleted file mode 100644 index 348e0f9e2aad21b7c70bd5a16e06735f794eccf4..0000000000000000000000000000000000000000 --- a/os/win32/util_win32.c +++ /dev/null @@ -1,677 +0,0 @@ -#include -#include -#include -#include -#include - -#include "httpd.h" -#include "http_log.h" - -/* Returns TRUE if the input string is a string - * of one or more '.' characters. - */ -static BOOL OnlyDots(char *pString) -{ - char *c; - - if (*pString == '\0') - return FALSE; - - for (c = pString;*c;c++) - if (*c != '.') - return FALSE; - - return TRUE; -} - -/* Accepts as input a pathname, and tries to match it to an - * existing path and return the pathname in the case that - * is present on the existing path. This routine also - * converts alias names to long names. - */ -API_EXPORT(char *) ap_os_systemcase_filename(pool *pPool, - const char *szFile) -{ - char buf[HUGE_STRING_LEN]; - char *pInputName; - char *p, *q; - BOOL bDone = FALSE; - BOOL bFileExists = TRUE; - HANDLE hFind; - WIN32_FIND_DATA wfd; - - if (!szFile || strlen(szFile) == 0 || strlen(szFile) >= sizeof(buf)) - return ap_pstrdup(pPool, ""); - - buf[0] = '\0'; - pInputName = ap_pstrdup(pPool, szFile); - - /* First convert all slashes to \ so Win32 calls work OK */ - for (p = pInputName; *p; p++) { - if (*p == '/') - *p = '\\'; - } - - p = pInputName; - /* If there is drive information, copy it over. */ - if (pInputName[1] == ':') { - buf[0] = tolower(*p++); - buf[1] = *p++; - buf[2] = '\0'; - - /* If all we have is a drive letter, then we are done */ - if (strlen(pInputName) == 2) - bDone = TRUE; - } - - q = p; - if (*p == '\\') { - p++; - if (*p == '\\') /* Possible UNC name */ - { - p++; - /* Get past the machine name. FindFirstFile */ - /* will not find a machine name only */ - p = strchr(p, '\\'); - if (p) - { - p++; - /* Get past the share name. FindFirstFile */ - /* will not find a \\machine\share name only */ - p = strchr(p, '\\'); - if (p) { - strncat(buf,q,p-q); - q = p; - p++; - } - } - - if (!p) - p = q; - } - } - - p = strchr(p, '\\'); - - while (!bDone) { - if (p) - *p = '\0'; - - if (strchr(q, '*') || strchr(q, '?')) - bFileExists = FALSE; - - /* If the path exists so far, call FindFirstFile - * again. However, if this portion of the path contains - * only '.' charaters, skip the call to FindFirstFile - * since it will convert '.' and '..' to actual names. - * Note: in the call to OnlyDots, we may have to skip - * a leading slash. - */ - if (bFileExists && !OnlyDots((*q == '.' ? q : q+1))) { - hFind = FindFirstFile(pInputName, &wfd); - - if (hFind == INVALID_HANDLE_VALUE) { - bFileExists = FALSE; - } - else { - FindClose(hFind); - - if (*q == '\\') - strcat(buf,"\\"); - strcat(buf, wfd.cFileName); - } - } - - if (!bFileExists || OnlyDots((*q == '.' ? q : q+1))) { - strcat(buf, q); - } - - if (p) { - q = p; - *p++ = '\\'; - p = strchr(p, '\\'); - } - else { - bDone = TRUE; - } - } - - /* First convert all slashes to / so server code handles it ok */ - for (p = buf; *p; p++) { - if (*p == '\\') - *p = '/'; - } - - return ap_pstrdup(pPool, buf); -} - - -/* Perform canonicalization with the exception that the - * input case is preserved. - */ -API_EXPORT(char *) ap_os_case_canonical_filename(pool *pPool, - const char *szFile) -{ - char *pNewStr; - char *s; - char *p; - char *q; - - if (szFile == NULL || strlen(szFile) == 0) - return ap_pstrdup(pPool, ""); - - pNewStr = ap_pstrdup(pPool, szFile); - - /* Change all '\' characters to '/' characters. - * While doing this, remove any trailing '.'. - * Also, blow away any directories with 3 or - * more '.' - */ - for (p = pNewStr,s = pNewStr; *s; s++,p++) { - if (*s == '\\' || *s == '/') { - - q = p; - while (p > pNewStr && *(p-1) == '.') - p--; - - if (p == pNewStr && q-p <= 2 && *p == '.') - p = q; - else if (p > pNewStr && p < q && *(p-1) == '/') { - if (q-p > 2) - p--; - else - p = q; - } - - *p = '/'; - } - else { - *p = *s; - } - } - *p = '\0'; - - /* Blow away any final trailing '.' since on Win32 - * foo.bat == foo.bat. == foo.bat... etc. - * Also blow away any trailing spaces since - * "filename" == "filename " - */ - q = p; - while (p > pNewStr && (*(p-1) == '.' || *(p-1) == ' ')) - p--; - if ((p > pNewStr) || - (p == pNewStr && q-p > 2)) - *p = '\0'; - - - /* One more security issue to deal with. Win32 allows - * you to create long filenames. However, alias filenames - * are always created so that the filename will - * conform to 8.3 rules. According to the Microsoft - * Developer's network CD (1/98) - * "Automatically generated aliases are composed of the - * first six characters of the filename plus ~n - * (where n is a number) and the first three characters - * after the last period." - * Here, we attempt to detect and decode these names. - */ - p = strchr(pNewStr, '~'); - if (p != NULL) { - char *pConvertedName, *pQstr, *pPstr; - char buf[HUGE_STRING_LEN]; - /* We potentially have a short name. Call - * ap_os_systemcase_filename to examine the filesystem - * and possibly extract the long name. - */ - pConvertedName = ap_os_systemcase_filename(pPool, pNewStr); - - /* Since we want to preserve the incoming case as much - * as we can, compare for differences in the string and - * only substitute in the path names that changed. - */ - if (stricmp(pNewStr, pConvertedName)) { - buf[0] = '\0'; - - q = pQstr = pConvertedName; - p = pPstr = pNewStr; - do { - q = strchr(q,'/'); - p = strchr(p,'/'); - - if (p != NULL) { - *q = '\0'; - *p = '\0'; - } - - if (stricmp(pQstr, pPstr)) - strcat(buf, pQstr); /* Converted name */ - else - strcat(buf, pPstr); /* Original name */ - - - if (p != NULL) { - pQstr = q; - pPstr = p; - *q++ = '/'; - *p++ = '/'; - } - - } while (p != NULL); - - pNewStr = ap_pstrdup(pPool, buf); - } - } - - - return pNewStr; -} - -/* Perform complete canonicalization. - */ -API_EXPORT(char *) ap_os_canonical_filename(pool *pPool, const char *szFile) -{ - char *pNewName; - pNewName = ap_os_case_canonical_filename(pPool, szFile); - strlwr(pNewName); - return pNewName; -} - -/* Win95 doesn't like trailing /s. NT and Unix don't mind. This works - * around the problem. - * Errr... except if it is UNC and we are referring to the root of - * the UNC, we MUST have a trailing \ and we can't use /s. Jeez. - * Not sure if this refers to all UNCs or just roots, - * but I'm going to fix it for all cases for now. (Ben) - */ - -#undef stat -API_EXPORT(int) os_stat(const char *szPath, struct stat *pStat) -{ - int n; - - if (strlen(szPath) == 0) { - return -1; - } - - if (szPath[0] == '/' && szPath[1] == '/') { - char buf[_MAX_PATH]; - char *s; - int nSlashes = 0; - - ap_assert(strlen(szPath) < _MAX_PATH); - strcpy(buf, szPath); - for (s = buf; *s; ++s) { - if (*s == '/') { - *s = '\\'; - ++nSlashes; - } - } - /* then we need to add one more to get \\machine\share\ */ - if (nSlashes == 3) { - *s++ = '\\'; - } - *s = '\0'; - return stat(buf, pStat); - } - - /* - * Below removes the trailing /, however, do not remove - * it in the case of 'x:/' or stat will fail - */ - n = strlen(szPath); - if ((szPath[n - 1] == '\\' || szPath[n - 1] == '/') && - !(n == 3 && szPath[1] == ':')) { - char buf[_MAX_PATH]; - - ap_assert(n < _MAX_PATH); - strcpy(buf, szPath); - buf[n - 1] = '\0'; - - return stat(buf, pStat); - } - return stat(szPath, pStat); -} - -/* Fix two really crap problems with Win32 spawn[lv]e*: - * - * 1. Win32 doesn't deal with spaces in argv. - * 2. Win95 doesn't like / in cmdname. - */ - -#undef _spawnv -API_EXPORT(int) os_spawnv(int mode, const char *cmdname, - const char *const *argv) -{ - int n; - char **aszArgs; - const char *szArg; - char *szCmd; - char *s; - - szCmd = _alloca(strlen(cmdname)+1); - strcpy(szCmd, cmdname); - for (s = szCmd; *s; ++s) { - if (*s == '/') { - *s = '\\'; - } - } - - for (n = 0; argv[n]; ++n) - ; - - aszArgs = _alloca((n + 1) * sizeof(const char *)); - - for (n = 0; szArg = argv[n]; ++n) { - if (strchr(szArg, ' ')) { - int l = strlen(szArg); - - aszArgs[n] = _alloca(l + 2 + 1); - aszArgs[n][0] = '"'; - strcpy(&aszArgs[n][1], szArg); - aszArgs[n][l + 1] = '"'; - aszArgs[n][l + 2] = '\0'; - } - else { - aszArgs[n] = (char *)szArg; - } - } - - aszArgs[n] = NULL; - - return _spawnv(mode, szCmd, aszArgs); -} - -#undef _spawnve -API_EXPORT(int) os_spawnve(int mode, const char *cmdname, - const char *const *argv, const char *const *envp) -{ - int n; - char **aszArgs; - const char *szArg; - char *szCmd; - char *s; - - szCmd = _alloca(strlen(cmdname)+1); - strcpy(szCmd, cmdname); - for (s = szCmd; *s; ++s) { - if (*s == '/') { - *s = '\\'; - } - } - - for (n = 0; argv[n]; ++n) - ; - - aszArgs = _alloca((n + 1)*sizeof(const char *)); - - for (n = 0; szArg = argv[n]; ++n){ - if (strchr(szArg, ' ')) { - int l = strlen(szArg); - - aszArgs[n] = _alloca(l + 2 + 1); - aszArgs[n][0] = '"'; - strcpy(&aszArgs[n][1], szArg); - aszArgs[n][l + 1] = '"'; - aszArgs[n][l + 2] = '\0'; - } - else { - aszArgs[n] = (char *)szArg; - } - } - - aszArgs[n] = NULL; - - return _spawnve(mode, szCmd, aszArgs, envp); -} - -API_EXPORT(int) os_spawnle(int mode, const char *cmdname, ...) -{ - int n; - va_list vlist; - char **aszArgs; - const char *szArg; - const char *const *aszEnv; - char *szCmd; - char *s; - - szCmd = _alloca(strlen(cmdname)+1); - strcpy(szCmd, cmdname); - for (s = szCmd; *s; ++s) { - if (*s == '/') { - *s = '\\'; - } - } - - va_start(vlist, cmdname); - for (n = 0; va_arg(vlist, const char *); ++n) - ; - va_end(vlist); - - aszArgs = _alloca((n + 1) * sizeof(const char *)); - - va_start(vlist, cmdname); - for (n = 0; szArg = va_arg(vlist, const char *); ++n) { - if (strchr(szArg, ' ')) { - int l = strlen(szArg); - - aszArgs[n] = _alloca(l + 2 + 1); - aszArgs[n][0] = '"'; - strcpy(&aszArgs[n][1], szArg); - aszArgs[n][l + 1] = '"'; - aszArgs[n][l + 2] = '\0'; - } - else { - aszArgs[n] = (char *)szArg; - } - } - - aszArgs[n] = NULL; - - aszEnv = va_arg(vlist, const char *const *); - va_end(vlist); - - return _spawnve(mode, szCmd, aszArgs, aszEnv); -} - -#undef strftime - -/* Partial replacement for strftime. This adds certain expandos to the - * Windows version - */ - -API_EXPORT(int) os_strftime(char *s, size_t max, const char *format, - const struct tm *tm) { - /* If the new format string is bigger than max, the result string probably - * won't fit anyway. When %-expandos are added, made sure the padding below - * is enough. - */ - char *new_format = (char *) _alloca(max + 11); - size_t i, j, format_length = strlen(format); - int return_value; - int length_written; - - for (i = 0, j = 0; (i < format_length && j < max);) { - if (format[i] != '%') { - new_format[j++] = format[i++]; - continue; - } - switch (format[i+1]) { - case 'D': - /* Is this locale dependent? Shouldn't be... - Also note the year 2000 exposure here */ - memcpy(new_format + j, "%m/%d/%y", 8); - i += 2; - j += 8; - break; - case 'r': - memcpy(new_format + j, "%I:%M:%S %p", 11); - i += 2; - j += 11; - break; - case 'T': - memcpy(new_format + j, "%H:%M:%S", 8); - i += 2; - j += 8; - break; - case 'e': - length_written = ap_snprintf(new_format + j, max - j, "%2d", - tm->tm_mday); - j = (length_written == -1) ? max : (j + length_written); - i += 2; - break; - default: - /* We know we can advance two characters forward here. */ - new_format[j++] = format[i++]; - new_format[j++] = format[i++]; - } - } - if (j >= max) { - *s = '\0'; /* Defensive programming, okay since output is undefined */ - return_value = 0; - } else { - new_format[j] = '\0'; - return_value = strftime(s, max, new_format, tm); - } - return return_value; -} - -/* - * ap_os_is_filename_valid is given a filename, and returns 0 if the filename - * is not valid for use on this system. On Windows, this means it fails any - * of the tests below. Otherwise returns 1. - * - * Test for filename validity on Win32. This is of tests come in part from - * the MSDN article at "Technical Articles, Windows Platform, Base Services, - * Guidelines, Making Room for Long Filenames" although the information - * in MSDN about filename testing is incomplete or conflicting. There is a - * similar set of tests in "Technical Articles, Windows Platform, Base Services, - * Guidelines, Moving Unix Applications to Windows NT". - * - * The tests are: - * - * 1) total path length greater than MAX_PATH - * - * 2) anything using the octets 0-31 or characters " < > | : - * (these are reserved for Windows use in filenames. In addition - * each file system has its own additional characters that are - * invalid. See KB article Q100108 for more details). - * - * 3) anything ending in "." (no matter how many) - * (filename doc, doc. and doc... all refer to the same file) - * - * 4) any segment in which the basename (before first period) matches - * one of the DOS device names - * (the list comes from KB article Q100108 although some people - * reports that additional names such as "COM5" are also special - * devices). - * - * If the path fails ANY of these tests, the result must be to deny access. - */ - -API_EXPORT(int) ap_os_is_filename_valid(const char *file) -{ - const char *segstart; - unsigned int seglength; - const char *pos; - static const char * const invalid_characters = "?\"<>*|:"; - static const char * const invalid_filenames[] = { - "CON", "AUX", "COM1", "COM2", "COM3", - "COM4", "LPT1", "LPT2", "LPT3", "PRN", "NUL", NULL - }; - - /* Test 1 */ - if (strlen(file) > MAX_PATH) { - /* Path too long for Windows. Note that this test is not valid - * if the path starts with //?/ or \\?\. */ - return 0; - } - - pos = file; - - /* Skip any leading non-path components. This can be either a - * drive letter such as C:, or a UNC path such as \\SERVER\SHARE\. - * We continue and check the rest of the path based on the rules above. - * This means we could eliminate valid filenames from servers which - * are not running NT (such as Samba). - */ - - if (pos[0] && pos[1] == ':') { - /* Skip leading drive letter */ - pos += 2; - } - else { - if ((pos[0] == '\\' || pos[0] == '/') && - (pos[1] == '\\' || pos[1] == '/')) { - /* Is a UNC, so skip the server name and share name */ - pos += 2; - while (*pos && *pos != '/' && *pos != '\\') - pos++; - if (!*pos) { - /* No share name */ - return 0; - } - pos++; /* Move to start of share name */ - while (*pos && *pos != '/' && *pos != '\\') - pos++; - if (!*pos) { - /* No path information */ - return 0; - } - } - } - - while (*pos) { - unsigned int idx; - unsigned int baselength; - - while (*pos == '/' || *pos == '\\') { - pos++; - } - if (*pos == '\0') { - break; - } - segstart = pos; /* start of segment */ - while (*pos && *pos != '/' && *pos != '\\') { - pos++; - } - seglength = pos - segstart; - /* - * Now we have a segment of the path, starting at position "segstart" - * and length "seglength" - */ - - /* Test 2 */ - for (idx = 0; idx < seglength; idx++) { - if ((segstart[idx] > 0 && segstart[idx] < 32) || - strchr(invalid_characters, segstart[idx])) { - return 0; - } - } - - /* Test 3 */ - if (segstart[seglength-1] == '.') { - return 0; - } - - /* Test 4 */ - for (baselength = 0; baselength < seglength; baselength++) { - if (segstart[baselength] == '.') { - break; - } - } - - /* baselength is the number of characters in the base path of - * the segment (which could be the same as the whole segment length, - * if it does not include any dot characters). */ - if (baselength == 3 || baselength == 4) { - for (idx = 0; invalid_filenames[idx]; idx++) { - if (strlen(invalid_filenames[idx]) == baselength && - !strnicmp(invalid_filenames[idx], segstart, baselength)) { - return 0; - } - } - } - } - - return 1; -} diff --git a/server/.cvsignore b/server/.cvsignore deleted file mode 100644 index f8193cb91be9efa159c0236fc020fac70580280b..0000000000000000000000000000000000000000 --- a/server/.cvsignore +++ /dev/null @@ -1,13 +0,0 @@ -Makefile -uri_delims.h -gen_uri_delims -test_char.h -gen_test_char -gen_uri_delims_R -gen_test_char_R -gen_uri_delims_D -gen_uri_delims.ilk -gen_uri_delims.pdb -gen_test_char_D -gen_test_char.ilk -gen_test_char.pdb diff --git a/server/.indent.pro b/server/.indent.pro deleted file mode 100644 index a9fbe9f9a1f2e6e7bcc54171c215bdacd44171ba..0000000000000000000000000000000000000000 --- a/server/.indent.pro +++ /dev/null @@ -1,54 +0,0 @@ --i4 -npsl -di0 -br -nce -d0 -cli0 -npcs -nfc1 --TBUFF --TFILE --TTRANS --TUINT4 --T_trans --Tallow_options_t --Tapache_sfio --Tarray_header --Tbool_int --Tbuf_area --Tbuff_struct --Tbuffy --Tcmd_how --Tcmd_parms --Tcommand_rec --Tcommand_struct --Tconn_rec --Tcore_dir_config --Tcore_server_config --Tdir_maker_func --Tevent --Tglobals_s --Thandler_func --Thandler_rec --Tjoblist_s --Tlisten_rec --Tmerger_func --Tmode_t --Tmodule --Tmodule_struct --Tmutex --Tn_long --Tother_child_rec --Toverrides_t --Tparent_score --Tpid_t --Tpiped_log --Tpool --Trequest_rec --Trequire_line --Trlim_t --Tscoreboard --Tsemaphore --Tserver_addr_rec --Tserver_rec --Tserver_rec_chain --Tshort_score --Ttable --Ttable_entry --Tthread --Tu_wide_int --Tvtime_t --Twide_int diff --git a/server/Makefile.in b/server/Makefile.in deleted file mode 100644 index 86facf2fddbecbb1142fc0bdd950857381f96bb9..0000000000000000000000000000000000000000 --- a/server/Makefile.in +++ /dev/null @@ -1,32 +0,0 @@ - -DEPTH = .. -topsrcdir = @topsrcdir@ -srcdir = @srcdir@ -VPATH = @srcdir@ - -LTLIBRARY_NAME = libmain.la -LTLIBRARY_SOURCES = \ - uri_delims.h test_char.h \ - buff.c http_config.c http_core.c http_log.c http_main.c \ - http_protocol.c http_request.c http_vhost.c util.c util_date.c \ - util_script.c util_uri.c util_md5.c \ - rfc1413.c http_connection.c iol_file.c listen.c - -include $(topsrcdir)/build/ltlib.mk - -gen_uri_delims_OBJECTS = gen_uri_delims.lo -gen_uri_delims: $(gen_uri_delims_OBJECTS) - $(LINK) $(gen_uri_delims_OBJECTS) - -gen_test_char_OBJECTS = gen_test_char.lo -gen_test_char: $(gen_test_char_OBJECTS) - $(LINK) $(gen_test_char_OBJECTS) - -uri_delims.h: gen_uri_delims - ./gen_uri_delims > uri_delims.h - -test_char.h: gen_test_char - ./gen_test_char > test_char.h - -util_uri.c: uri_delims.h -util.c: test_char.h diff --git a/server/NWGNUmakefile b/server/NWGNUmakefile deleted file mode 100644 index 7dabc8ec670d918217f1f9a859e4fdbf32512f68..0000000000000000000000000000000000000000 --- a/server/NWGNUmakefile +++ /dev/null @@ -1,250 +0,0 @@ -# -# Declare the sub-directories to be built here -# - -SUBDIRS = \ - $(EOLIST) - -# -# Get the 'head' of the build environment. This includes default targets and -# paths to tools -# - -include $(AP_WORK)\build\NWGNUhead.inc - -# -# build this level's files - -# -# These directories will be at the beginning of the include list, followed by -# INCDIRS -# -XINCDIRS += \ - $(NWOS) \ - $(APR)/include \ - $(AP_WORK)/include \ - $(APRUTIL)/include \ - $(EOLIST) - -# -# These flags will come after CFLAGS -# -XCFLAGS += \ - $(EOLIST) - -# -# These defines will come after DEFINES -# -XDEFINES += \ - $(EOLIST) - -# -# These flags will be added to the link.opt file -# -XLFLAGS += \ - $(EOLIST) - -# -# These values will be appended to the correct variables based on the value of -# RELEASE -# -ifeq "$(RELEASE)" "debug" -XINCDIRS += \ - $(EOLIST) - -XCFLAGS += \ - $(EOLIST) - -XDEFINES += \ - $(EOLIST) - -XLFLAGS += \ - $(EOLIST) -endif - -ifeq "$(RELEASE)" "noopt" -XINCDIRS += \ - $(EOLIST) - -XCFLAGS += \ - $(EOLIST) - -XDEFINES += \ - $(EOLIST) - -XLFLAGS += \ - $(EOLIST) -endif - -ifeq "$(RELEASE)" "release" -XINCDIRS += \ - $(EOLIST) - -XCFLAGS += \ - $(EOLIST) - -XDEFINES += \ - $(EOLIST) - -XLFLAGS += \ - $(EOLIST) -endif - -# -# These are used by the link target if an NLM is being generated -# This is used by the link 'name' directive to name the nlm. If left blank -# TARGET_nlm (see below) will be used. -# -NLM_NAME = genchars - -# -# This is used by the link '-desc ' directive. -# If left blank, NLM_NAME will be used. -# -NLM_DESCRIPTION = Generate Test Characters - -# -# This is used by the '-threadname' directive. If left blank, -# NLM_NAME Thread will be used. -# -NLM_THREAD_NAME = genchars - -# -# If this is specified, it will override VERSION value in -# $(AP_WORK)\NWGNUNetWare.rul -# -NLM_VERSION = 1,0,0 - -# -# If this is specified, it will override the default of 64K -# -NLM_STACK_SIZE = 8192 - -# -# If this is specified it will be used by the link '-entry' directive -# -NLM_ENTRY_SYM =_LibCPrelude - -# -# If this is specified it will be used by the link '-exit' directive -# -NLM_EXIT_SYM =_LibCPostlude - -# -# If this is specified it will be used by the link '-check' directive -# -NLM_CHECK_SYM = - -# -# If this is specified it will be used by the link '-flags' directive -# -NLM_FLAGS = PSEUDOPREEMPTION - -# -# If this is specified it will be linked in with the XDCData option in the def -# file instead of the default of $(NWOS)/apache.xdc. XDCData can be disabled -# by setting APACHE_UNIPROC in the environment -# -XDCDATA = - -# -# Declare all target files (you must add your files here) -# - -# -# If there is an NLM target, put it here -# -TARGET_nlm = \ -$(OBJDIR)/genchars.nlm \ - $(EOLIST) - -# -# If there is an LIB target, put it here -# -TARGET_lib = \ - $(EOLIST) - -# -# These are the OBJ files needed to create the NLM target above. -# Paths must all use the '/' character -# -FILES_nlm_objs = \ - $(OBJDIR)/gen_test_char.o \ - $(EOLIST) - -# -# These are the LIB files needed to create the NLM target above. -# These will be added as a library command in the link.opt file. -# -FILES_nlm_libs = \ - libcpre.o \ - $(EOLIST) - -# -# These are the modules that the above NLM target depends on to load. -# These will be added as a module command in the link.opt file. -# -FILES_nlm_modules = \ - Libc \ - $(EOLIST) - -# -# If the nlm has a msg file, put it's path here -# -FILE_nlm_msg = - -# -# If the nlm has a hlp file put it's path here -# -FILE_nlm_hlp = - -# -# If this is specified, it will override $(NWOS)\copyright.txt. -# -FILE_nlm_copyright = - -# -# Any additional imports go here -# -FILES_nlm_Ximports = \ - @libc.imp \ - $(EOLIST) - -# -# Any symbols exported to here -# -FILES_nlm_exports = \ - $(EOLIST) - -# -# These are the OBJ files needed to create the LIB target above. -# Paths must all use the '/' character -# -FILES_lib_objs = \ - $(EOLIST) - -# -# implement targets and dependancies (leave this section alone) -# - -libs :: $(OBJDIR) $(TARGET_lib) - -nlms :: libs $(TARGET_nlm) - -# -# Updated this target to create necessary directories and copy files to the -# correct place. -# -install :: nlms FORCE - -# -# Any specialized rules here -# - -# -# Include the 'tail' makefile that has targets that depend on variables defined -# in this makefile -# - -include $(AP_WORK)\build\NWGNUtail.inc - diff --git a/server/buildmark.c b/server/buildmark.c deleted file mode 100644 index 575b9731a097a60b322be67e31c15803b8eec6fa..0000000000000000000000000000000000000000 --- a/server/buildmark.c +++ /dev/null @@ -1,70 +0,0 @@ -/* ==================================================================== - * Copyright (c) 1995-1999 The Apache Group. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in - * the documentation and/or other materials provided with the - * distribution. - * - * 3. All advertising materials mentioning features or use of this - * software must display the following acknowledgment: - * "This product includes software developed by the Apache Group - * for use in the Apache HTTP server project (http://www.apache.org/)." - * - * 4. The names "Apache Server" and "Apache Group" must not be used to - * endorse or promote products derived from this software without - * prior written permission. For written permission, please contact - * apache@apache.org. - * - * 5. Products derived from this software may not be called "Apache" - * nor may "Apache" appear in their names without prior written - * permission of the Apache Group. - * - * 6. Redistributions of any form whatsoever must retain the following - * acknowledgment: - * "This product includes software developed by the Apache Group - * for use in the Apache HTTP server project (http://www.apache.org/)." - * - * THIS SOFTWARE IS PROVIDED BY THE APACHE GROUP ``AS IS'' AND ANY - * EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR - * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE APACHE GROUP OR - * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT - * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, - * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED - * OF THE POSSIBILITY OF SUCH DAMAGE. - * ==================================================================== - * - * This software consists of voluntary contributions made by many - * individuals on behalf of the Apache Group and was originally based - * on public domain software written at the National Center for - * Supercomputing Applications, University of Illinois, Urbana-Champaign. - * For more information on the Apache Group and the Apache HTTP server - * project, please see . - * - */ - -#include "ap_config.h" -#include "httpd.h" - -#if defined(__DATE__) && defined(__TIME__) -static const char server_built[] = __DATE__ " " __TIME__; -#else -static const char server_built[] = "unknown"; -#endif - -API_EXPORT(const char *) ap_get_server_built() -{ - return server_built; -} diff --git a/server/config.c b/server/config.c deleted file mode 100644 index 8980f98ec48462282cd9ecb01f90755b6f846b8c..0000000000000000000000000000000000000000 --- a/server/config.c +++ /dev/null @@ -1,1641 +0,0 @@ -/* ==================================================================== - * Copyright (c) 1995-1999 The Apache Group. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in - * the documentation and/or other materials provided with the - * distribution. - * - * 3. All advertising materials mentioning features or use of this - * software must display the following acknowledgment: - * "This product includes software developed by the Apache Group - * for use in the Apache HTTP server project (http://www.apache.org/)." - * - * 4. The names "Apache Server" and "Apache Group" must not be used to - * endorse or promote products derived from this software without - * prior written permission. For written permission, please contact - * apache@apache.org. - * - * 5. Products derived from this software may not be called "Apache" - * nor may "Apache" appear in their names without prior written - * permission of the Apache Group. - * - * 6. Redistributions of any form whatsoever must retain the following - * acknowledgment: - * "This product includes software developed by the Apache Group - * for use in the Apache HTTP server project (http://www.apache.org/)." - * - * THIS SOFTWARE IS PROVIDED BY THE APACHE GROUP ``AS IS'' AND ANY - * EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR - * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE APACHE GROUP OR - * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT - * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, - * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED - * OF THE POSSIBILITY OF SUCH DAMAGE. - * ==================================================================== - * - * This software consists of voluntary contributions made by many - * individuals on behalf of the Apache Group and was originally based - * on public domain software written at the National Center for - * Supercomputing Applications, University of Illinois, Urbana-Champaign. - * For more information on the Apache Group and the Apache HTTP server - * project, please see . - * - */ - -/* - * http_config.c: once was auxillary functions for reading httpd's config - * file and converting filenames into a namespace - * - * Rob McCool - * - * Wall-to-wall rewrite for Apache... commands which are part of the - * server core can now be found next door in "http_core.c". Now contains - * general command loop, and functions which do bookkeeping for the new - * Apache config stuff (modules and configuration vectors). - * - * rst - * - */ - -#define CORE_PRIVATE - -#include "httpd.h" -#include "http_config.h" -#include "http_core.h" -#include "http_log.h" /* for errors in parse_htaccess */ -#include "http_request.h" /* for default_handler (see invoke_handler) */ -#include "http_conf_globals.h" /* Sigh... */ -#include "http_vhost.h" -#include "explain.h" - -DEF_Explain - -/**************************************************************** - * - * We begin with the functions which deal with the linked list - * of modules which control just about all of the server operation. - */ - -/* total_modules is the number of modules that have been linked - * into the server. - */ -static int total_modules = 0; -/* dynamic_modules is the number of modules that have been added - * after the pre-loaded ones have been set up. It shouldn't be larger - * than DYNAMIC_MODULE_LIMIT. - */ -static int dynamic_modules = 0; -API_VAR_EXPORT module *top_module = NULL; -API_VAR_EXPORT module **ap_loaded_modules=NULL; - -typedef int (*handler_func) (request_rec *); -typedef void *(*dir_maker_func) (pool *, char *); -typedef void *(*merger_func) (pool *, void *, void *); - -/* Dealing with config vectors. These are associated with per-directory, - * per-server, and per-request configuration, and have a void* pointer for - * each modules. The nature of the structure pointed to is private to the - * module in question... the core doesn't (and can't) know. However, there - * are defined interfaces which allow it to create instances of its private - * per-directory and per-server structures, and to merge the per-directory - * structures of a directory and its subdirectory (producing a new one in - * which the defaults applying to the base directory have been properly - * overridden). - */ - -#ifndef ap_get_module_config -API_EXPORT(void *) ap_get_module_config(void *conf_vector, module *m) -{ - void **confv = (void **) conf_vector; - return confv[m->module_index]; -} -#endif - -#ifndef ap_set_module_config -API_EXPORT(void) ap_set_module_config(void *conf_vector, module *m, void *val) -{ - void **confv = (void **) conf_vector; - confv[m->module_index] = val; -} -#endif - -static void *create_empty_config(pool *p) -{ - void **conf_vector = (void **) ap_pcalloc(p, sizeof(void *) * - (total_modules + DYNAMIC_MODULE_LIMIT)); - return (void *) conf_vector; -} - -static void *create_default_per_dir_config(pool *p) -{ - void **conf_vector = (void **) ap_pcalloc(p, sizeof(void *) * (total_modules + DYNAMIC_MODULE_LIMIT)); - module *modp; - - for (modp = top_module; modp; modp = modp->next) { - dir_maker_func df = modp->create_dir_config; - - if (df) - conf_vector[modp->module_index] = (*df) (p, NULL); - } - - return (void *) conf_vector; -} - -void * - ap_merge_per_dir_configs(pool *p, void *base, void *new) -{ - void **conf_vector = (void **) ap_palloc(p, sizeof(void *) * total_modules); - void **base_vector = (void **) base; - void **new_vector = (void **) new; - module *modp; - - for (modp = top_module; modp; modp = modp->next) { - merger_func df = modp->merge_dir_config; - int i = modp->module_index; - - if (df && new_vector[i]) - conf_vector[i] = (*df) (p, base_vector[i], new_vector[i]); - else - conf_vector[i] = new_vector[i] ? new_vector[i] : base_vector[i]; - } - - return (void *) conf_vector; -} - -static void *create_server_config(pool *p, server_rec *s) -{ - void **conf_vector = (void **) ap_pcalloc(p, sizeof(void *) * (total_modules + DYNAMIC_MODULE_LIMIT)); - module *modp; - - for (modp = top_module; modp; modp = modp->next) { - if (modp->create_server_config) - conf_vector[modp->module_index] = (*modp->create_server_config) (p, s); - } - - return (void *) conf_vector; -} - -static void merge_server_configs(pool *p, void *base, void *virt) -{ - /* Can reuse the 'virt' vector for the spine of it, since we don't - * have to deal with the moral equivalent of .htaccess files here... - */ - - void **base_vector = (void **) base; - void **virt_vector = (void **) virt; - module *modp; - - for (modp = top_module; modp; modp = modp->next) { - merger_func df = modp->merge_server_config; - int i = modp->module_index; - - if (!virt_vector[i]) - virt_vector[i] = base_vector[i]; - else if (df) - virt_vector[i] = (*df) (p, base_vector[i], virt_vector[i]); - } -} - -void *ap_create_request_config(pool *p) -{ - return create_empty_config(p); -} - -CORE_EXPORT(void *) ap_create_per_dir_config(pool *p) -{ - return create_empty_config(p); -} - -#ifdef EXPLAIN - -struct { - int offset; - char *method; -} aMethods[] = - -{ -#define m(meth) { XtOffsetOf(module,meth),#meth } - m(translate_handler), - m(ap_check_user_id), - m(auth_checker), - m(type_checker), - m(fixer_upper), - m(logger), - { -1, "?" }, -#undef m -}; - -char *ShowMethod(module *modp, int offset) -{ - int n; - static char buf[200]; - - for (n = 0; aMethods[n].offset >= 0; ++n) - if (aMethods[n].offset == offset) - break; - ap_snprintf(buf, sizeof(buf), "%s:%s", modp->name, aMethods[n].method); - return buf; -} -#else -#define ShowMethod(modp,offset) -#endif - -/**************************************************************** - * - * Dispatch through the modules to find handlers for various phases - * of request handling. These are invoked by http_request.c to actually - * do the dirty work of slogging through the module structures. - */ - -/* - * Optimized run_method routines. The observation here is that many modules - * have NULL for most of the methods. So we build optimized lists of - * everything. If you think about it, this is really just like a sparse array - * implementation to avoid scanning the zero entries. - */ -static const int method_offsets[] = -{ - XtOffsetOf(module, translate_handler), - XtOffsetOf(module, ap_check_user_id), - XtOffsetOf(module, auth_checker), - XtOffsetOf(module, access_checker), - XtOffsetOf(module, type_checker), - XtOffsetOf(module, fixer_upper), - XtOffsetOf(module, logger), - XtOffsetOf(module, header_parser), - XtOffsetOf(module, post_read_request) -}; -#define NMETHODS (sizeof (method_offsets)/sizeof (method_offsets[0])) - -static struct { - int translate_handler; - int ap_check_user_id; - int auth_checker; - int access_checker; - int type_checker; - int fixer_upper; - int logger; - int header_parser; - int post_read_request; -} offsets_into_method_ptrs; - -/* - * This is just one big array of method_ptrs. It's constructed such that, - * for example, method_ptrs[ offsets_into_method_ptrs.logger ] is the first - * logger function. You go one-by-one from there until you hit a NULL. - * This structure was designed to hopefully maximize cache-coolness. - */ -static handler_func *method_ptrs; - -/* routine to reconstruct all these shortcuts... called after every - * add_module. - * XXX: this breaks if modules dink with their methods pointers - */ -static void build_method_shortcuts(void) -{ - module *modp; - int how_many_ptrs; - int i; - int next_ptr; - handler_func fp; - - if (method_ptrs) { - /* free up any previous set of method_ptrs */ - free(method_ptrs); - } - - /* first we count how many functions we have */ - how_many_ptrs = 0; - for (modp = top_module; modp; modp = modp->next) { - for (i = 0; i < NMETHODS; ++i) { - if (*(handler_func *) (method_offsets[i] + (char *) modp)) { - ++how_many_ptrs; - } - } - } - method_ptrs = malloc((how_many_ptrs + NMETHODS) * sizeof(handler_func)); - if (method_ptrs == NULL) { - fprintf(stderr, "Ouch! Out of memory in build_method_shortcuts()!\n"); - } - next_ptr = 0; - for (i = 0; i < NMETHODS; ++i) { - /* XXX: This is an itsy bit presumptuous about the alignment - * constraints on offsets_into_method_ptrs. I can't remember if - * ANSI says this has to be true... -djg */ - ((int *) &offsets_into_method_ptrs)[i] = next_ptr; - for (modp = top_module; modp; modp = modp->next) { - fp = *(handler_func *) (method_offsets[i] + (char *) modp); - if (fp) { - method_ptrs[next_ptr++] = fp; - } - } - method_ptrs[next_ptr++] = NULL; - } -} - - -static int run_method(request_rec *r, int offset, int run_all) -{ - int i; - - for (i = offset; method_ptrs[i]; ++i) { - handler_func mod_handler = method_ptrs[i]; - - if (mod_handler) { - int result; - - result = (*mod_handler) (r); - - if (result != DECLINED && (!run_all || result != OK)) - return result; - } - } - - return run_all ? OK : DECLINED; -} - -int ap_translate_name(request_rec *r) -{ - return run_method(r, offsets_into_method_ptrs.translate_handler, 0); -} - -int ap_check_access(request_rec *r) -{ - return run_method(r, offsets_into_method_ptrs.access_checker, 1); -} - -int ap_find_types(request_rec *r) -{ - return run_method(r, offsets_into_method_ptrs.type_checker, 0); -} - -int ap_run_fixups(request_rec *r) -{ - return run_method(r, offsets_into_method_ptrs.fixer_upper, 1); -} - -int ap_log_transaction(request_rec *r) -{ - return run_method(r, offsets_into_method_ptrs.logger, 1); -} - -int ap_header_parse(request_rec *r) -{ - return run_method(r, offsets_into_method_ptrs.header_parser, 1); -} - -int ap_run_post_read_request(request_rec *r) -{ - return run_method(r, offsets_into_method_ptrs.post_read_request, 1); -} - -/* Auth stuff --- anything that defines one of these will presumably - * want to define something for the other. Note that check_auth is - * separate from check_access to make catching some config errors easier. - */ - -int ap_check_user_id(request_rec *r) -{ - return run_method(r, offsets_into_method_ptrs.ap_check_user_id, 0); -} - -int ap_check_auth(request_rec *r) -{ - return run_method(r, offsets_into_method_ptrs.auth_checker, 0); -} - -/* - * For speed/efficiency we generate a compact list of all the handlers - * and wildcard handlers. This means we won't have to scan the entire - * module list looking for handlers... where we'll find a whole whack - * of NULLs. - */ -typedef struct { - handler_rec hr; - size_t len; -} fast_handler_rec; - -static fast_handler_rec *handlers; -static fast_handler_rec *wildhandlers; - -static void init_handlers(pool *p) -{ - module *modp; - int nhandlers = 0; - int nwildhandlers = 0; - const handler_rec *handp; - fast_handler_rec *ph, *pw; - char *starp; - - for (modp = top_module; modp; modp = modp->next) { - if (!modp->handlers) - continue; - for (handp = modp->handlers; handp->content_type; ++handp) { - if (strchr(handp->content_type, '*')) { - nwildhandlers ++; - } else { - nhandlers ++; - } - } - } - ph = handlers = ap_palloc(p, sizeof(*ph)*(nhandlers + 1)); - pw = wildhandlers = ap_palloc(p, sizeof(*pw)*(nwildhandlers + 1)); - for (modp = top_module; modp; modp = modp->next) { - if (!modp->handlers) - continue; - for (handp = modp->handlers; handp->content_type; ++handp) { - if ((starp = strchr(handp->content_type, '*'))) { - pw->hr.content_type = handp->content_type; - pw->hr.handler = handp->handler; - pw->len = starp - handp->content_type; - pw ++; - } else { - ph->hr.content_type = handp->content_type; - ph->hr.handler = handp->handler; - ph->len = strlen(handp->content_type); - ph ++; - } - } - } - pw->hr.content_type = NULL; - pw->hr.handler = NULL; - ph->hr.content_type = NULL; - ph->hr.handler = NULL; -} - -int ap_invoke_handler(request_rec *r) -{ - fast_handler_rec *handp; - const char *handler; - char *p; - size_t handler_len; - int result = HTTP_INTERNAL_SERVER_ERROR; - - if (r->handler) { - handler = r->handler; - handler_len = strlen(handler); - } - else { - handler = r->content_type ? r->content_type : ap_default_type(r); - if ((p = strchr(handler, ';')) != NULL) { /* MIME type arguments */ - while (p > handler && p[-1] == ' ') - --p; /* strip trailing spaces */ - handler_len = p - handler; - } - else { - handler_len = strlen(handler); - } - } - - /* Pass one --- direct matches */ - - for (handp = handlers; handp->hr.content_type; ++handp) { - if (handler_len == handp->len - && !strncmp(handler, handp->hr.content_type, handler_len)) { - result = (*handp->hr.handler) (r); - - if (result != DECLINED) - return result; - } - } - - if (result == HTTP_INTERNAL_SERVER_ERROR && r->handler) { - ap_log_rerror(APLOG_MARK, APLOG_NOERRNO|APLOG_WARNING, r, - "handler \"%s\" not found for: %s", r->handler, r->filename); - } - - /* Pass two --- wildcard matches */ - - for (handp = wildhandlers; handp->hr.content_type; ++handp) { - if (handler_len >= handp->len - && !strncmp(handler, handp->hr.content_type, handp->len)) { - result = (*handp->hr.handler) (r); - - if (result != DECLINED) - return result; - } - } - - return HTTP_INTERNAL_SERVER_ERROR; -} - -/* One-time setup for precompiled modules --- NOT to be done on restart */ - -API_EXPORT(void) ap_add_module(module *m) -{ - /* This could be called from an AddModule httpd.conf command, - * after the file has been linked and the module structure within it - * teased out... - */ - - if (m->version != MODULE_MAGIC_NUMBER_MAJOR) { - fprintf(stderr, "%s: module \"%s\" is not compatible with this " - "version of Apache.\n", ap_server_argv0, m->name); - fprintf(stderr, "Please contact the vendor for the correct version.\n"); - exit(1); - } - - if (m->next == NULL) { - m->next = top_module; - top_module = m; - } - if (m->module_index == -1) { - m->module_index = total_modules++; - dynamic_modules++; - - if (dynamic_modules > DYNAMIC_MODULE_LIMIT) { - fprintf(stderr, "%s: module \"%s\" could not be loaded, because" - " the dynamic\n", ap_server_argv0, m->name); - fprintf(stderr, "module limit was reached. Please increase " - "DYNAMIC_MODULE_LIMIT and recompile.\n"); - exit(1); - } - } - - /* Some C compilers put a complete path into __FILE__, but we want - * only the filename (e.g. mod_includes.c). So check for path - * components (Unix and DOS), and remove them. - */ - - if (strrchr(m->name, '/')) - m->name = 1 + strrchr(m->name, '/'); - if (strrchr(m->name, '\\')) - m->name = 1 + strrchr(m->name, '\\'); - -#ifdef _OSD_POSIX /* __FILE__="*POSIX(/home/martin/apache/src/modules/standard/mod_info.c)" */ - /* We cannot fix the string in-place, because it's const */ - if (m->name[strlen(m->name)-1]==')') { - char *tmp = strdup(m->name); /* FIXME:memory leak, albeit a small one */ - tmp[strlen(tmp)-1] = '\0'; - m->name = tmp; - } -#endif /*_OSD_POSIX*/ -} - -/* - * remove_module undoes what add_module did. There are some caveats: - * when the module is removed, its slot is lost so all the current - * per-dir and per-server configurations are invalid. So we should - * only ever call this function when you are invalidating almost - * all our current data. I.e. when doing a restart. - */ - -API_EXPORT(void) ap_remove_module(module *m) -{ - module *modp; - - modp = top_module; - if (modp == m) { - /* We are the top module, special case */ - top_module = modp->next; - m->next = NULL; - } - else { - /* Not the top module, find use. When found modp will - * point to the module _before_ us in the list - */ - - while (modp && modp->next != m) { - modp = modp->next; - } - if (!modp) { - /* Uh-oh, this module doesn't exist */ - ap_log_error(APLOG_MARK, APLOG_ERR|APLOG_NOERRNO, NULL, - "Cannot remove module %s: not found in module list", - m->name); - return; - } - /* Eliminate us from the module list */ - modp->next = modp->next->next; - } - - m->module_index = -1; /* simulate being unloaded, should - * be unnecessary */ - dynamic_modules--; - total_modules--; -} - -API_EXPORT(void) ap_add_loaded_module(module *mod) -{ - module **m; - - /* - * Add module pointer to top of chained module list - */ - ap_add_module(mod); - - /* - * And module pointer to list of loaded modules - * - * Notes: 1. ap_add_module() would already complain if no more space - * exists for adding a dynamically loaded module - * 2. ap_add_module() accepts double-inclusion, so we have - * to accept this, too. - */ - for (m = ap_loaded_modules; *m != NULL; m++) - ; - *m++ = mod; - *m = NULL; -} - -API_EXPORT(void) ap_remove_loaded_module(module *mod) -{ - module **m; - module **m2; - int done; - - /* - * Remove module pointer from chained module list - */ - ap_remove_module(mod); - - /* - * Remove module pointer from list of loaded modules - * - * Note: 1. We cannot determine if the module was successfully - * removed by ap_remove_module(). - * 2. We have not to complain explicity when the module - * is not found because ap_remove_module() did it - * for us already. - */ - for (m = m2 = ap_loaded_modules, done = 0; *m2 != NULL; m2++) { - if (*m2 == mod && done == 0) - done = 1; - else - *m++ = *m2; - } - *m = NULL; -} - -void ap_setup_prelinked_modules() -{ - module **m; - module **m2; - - /* - * Initialise total_modules variable and module indices - */ - total_modules = 0; - for (m = ap_preloaded_modules; *m != NULL; m++) - (*m)->module_index = total_modules++; - - /* - * Initialise list of loaded modules - */ - ap_loaded_modules = (module **)malloc( - sizeof(module *)*(total_modules+DYNAMIC_MODULE_LIMIT+1)); - if (ap_loaded_modules == NULL) { - fprintf(stderr, "Ouch! Out of memory in ap_setup_prelinked_modules()!\n"); - } - for (m = ap_preloaded_modules, m2 = ap_loaded_modules; *m != NULL; ) - *m2++ = *m++; - *m2 = NULL; - - /* - * Initialize chain of linked (=activate) modules - */ - for (m = ap_prelinked_modules; *m != NULL; m++) - ap_add_module(*m); -} - -API_EXPORT(const char *) ap_find_module_name(module *m) -{ - return m->name; -} - -API_EXPORT(module *) ap_find_linked_module(const char *name) -{ - module *modp; - - for (modp = top_module; modp; modp = modp->next) { - if (strcmp(modp->name, name) == 0) - return modp; - } - return NULL; -} - -/* Add a named module. Returns 1 if module found, 0 otherwise. */ -API_EXPORT(int) ap_add_named_module(const char *name) -{ - module *modp; - int i = 0; - - for (modp = ap_loaded_modules[i]; modp; modp = ap_loaded_modules[++i]) { - if (strcmp(modp->name, name) == 0) { - /* Only add modules that are not already enabled. */ - if (modp->next == NULL) { - ap_add_module(modp); - } - return 1; - } - } - - return 0; -} - -/* Clear the internal list of modules, in preparation for starting over. */ -API_EXPORT(void) ap_clear_module_list() -{ - module **m = &top_module; - module **next_m; - - while (*m) { - next_m = &((*m)->next); - *m = NULL; - m = next_m; - } - - /* This is required; so we add it always. */ - ap_add_named_module("http_core.c"); -} - -/***************************************************************** - * - * Resource, access, and .htaccess config files now parsed by a common - * command loop. - * - * Let's begin with the basics; parsing the line and - * invoking the function... - */ - -static const char *invoke_cmd(const command_rec *cmd, cmd_parms *parms, - void *mconfig, const char *args) -{ - char *w, *w2, *w3; - const char *errmsg; - - if ((parms->override & cmd->req_override) == 0) - return ap_pstrcat(parms->pool, cmd->name, " not allowed here", NULL); - - parms->info = cmd->cmd_data; - parms->cmd = cmd; - - switch (cmd->args_how) { - case RAW_ARGS: - return ((const char *(*)(cmd_parms *, void *, const char *)) - (cmd->func)) (parms, mconfig, args); - - case NO_ARGS: - if (*args != 0) - return ap_pstrcat(parms->pool, cmd->name, " takes no arguments", - NULL); - - return ((const char *(*)(cmd_parms *, void *)) - (cmd->func)) (parms, mconfig); - - case TAKE1: - w = ap_getword_conf(parms->pool, &args); - - if (*w == '\0' || *args != 0) - return ap_pstrcat(parms->pool, cmd->name, " takes one argument", - cmd->errmsg ? ", " : NULL, cmd->errmsg, NULL); - - return ((const char *(*)(cmd_parms *, void *, const char *)) - (cmd->func)) (parms, mconfig, w); - - case TAKE2: - - w = ap_getword_conf(parms->pool, &args); - w2 = ap_getword_conf(parms->pool, &args); - - if (*w == '\0' || *w2 == '\0' || *args != 0) - return ap_pstrcat(parms->pool, cmd->name, " takes two arguments", - cmd->errmsg ? ", " : NULL, cmd->errmsg, NULL); - - return ((const char *(*)(cmd_parms *, void *, const char *, - const char *)) (cmd->func)) (parms, mconfig, w, w2); - - case TAKE12: - - w = ap_getword_conf(parms->pool, &args); - w2 = ap_getword_conf(parms->pool, &args); - - if (*w == '\0' || *args != 0) - return ap_pstrcat(parms->pool, cmd->name, " takes 1-2 arguments", - cmd->errmsg ? ", " : NULL, cmd->errmsg, NULL); - - return ((const char *(*)(cmd_parms *, void *, const char *, - const char *)) (cmd->func)) (parms, mconfig, w, - *w2 ? w2 : NULL); - - case TAKE3: - - w = ap_getword_conf(parms->pool, &args); - w2 = ap_getword_conf(parms->pool, &args); - w3 = ap_getword_conf(parms->pool, &args); - - if (*w == '\0' || *w2 == '\0' || *w3 == '\0' || *args != 0) - return ap_pstrcat(parms->pool, cmd->name, " takes three arguments", - cmd->errmsg ? ", " : NULL, cmd->errmsg, NULL); - - return ((const char *(*)(cmd_parms *, void *, const char *, - const char *, const char *)) (cmd->func)) (parms, - mconfig, w, w2, w3); - - case TAKE23: - - w = ap_getword_conf(parms->pool, &args); - w2 = ap_getword_conf(parms->pool, &args); - w3 = *args ? ap_getword_conf(parms->pool, &args) : NULL; - - if (*w == '\0' || *w2 == '\0' || *args != 0) - return ap_pstrcat(parms->pool, cmd->name, - " takes two or three arguments", - cmd->errmsg ? ", " : NULL, cmd->errmsg, NULL); - - return ((const char *(*)(cmd_parms *, void *, const char *, - const char *, const char *)) (cmd->func)) (parms, - mconfig, w, w2, w3); - - case TAKE123: - - w = ap_getword_conf(parms->pool, &args); - w2 = *args ? ap_getword_conf(parms->pool, &args) : NULL; - w3 = *args ? ap_getword_conf(parms->pool, &args) : NULL; - - if (*w == '\0' || *args != 0) - return ap_pstrcat(parms->pool, cmd->name, - " takes one, two or three arguments", - cmd->errmsg ? ", " : NULL, cmd->errmsg, NULL); - - return ((const char *(*)(cmd_parms *, void *, const char *, - const char *, const char *)) (cmd->func)) (parms, - mconfig, w, w2, w3); - - case TAKE13: - - w = ap_getword_conf(parms->pool, &args); - w2 = *args ? ap_getword_conf(parms->pool, &args) : NULL; - w3 = *args ? ap_getword_conf(parms->pool, &args) : NULL; - - if (*w == '\0' || (*w2 && !w3) || *args != 0) - return ap_pstrcat(parms->pool, cmd->name, - " takes one or three arguments", - cmd->errmsg ? ", " : NULL, cmd->errmsg, NULL); - - return ((const char *(*)(cmd_parms *, void *, const char *, - const char *, const char *)) (cmd->func)) (parms, - mconfig, w, w2, w3); - - case ITERATE: - - while (*(w = ap_getword_conf(parms->pool, &args)) != '\0') - if ((errmsg = ((const char *(*)(cmd_parms *, void *, - const char *)) (cmd->func)) (parms, mconfig, w))) - return errmsg; - - return NULL; - - case ITERATE2: - - w = ap_getword_conf(parms->pool, &args); - - if (*w == '\0' || *args == 0) - return ap_pstrcat(parms->pool, cmd->name, - " requires at least two arguments", - cmd->errmsg ? ", " : NULL, cmd->errmsg, NULL); - - - while (*(w2 = ap_getword_conf(parms->pool, &args)) != '\0') - if ((errmsg = ((const char *(*)(cmd_parms *, void *, - const char *, const char *)) (cmd->func)) (parms, - mconfig, w, w2))) - return errmsg; - - return NULL; - - case FLAG: - - w = ap_getword_conf(parms->pool, &args); - - if (*w == '\0' || (strcasecmp(w, "on") && strcasecmp(w, "off"))) - return ap_pstrcat(parms->pool, cmd->name, " must be On or Off", - NULL); - - return ((const char *(*)(cmd_parms *, void *, int)) - (cmd->func)) (parms, mconfig, strcasecmp(w, "off") != 0); - - default: - - return ap_pstrcat(parms->pool, cmd->name, - " is improperly configured internally (server bug)", - NULL); - } -} - -CORE_EXPORT(const command_rec *) ap_find_command(const char *name, const command_rec *cmds) -{ - while (cmds->name) - if (!strcasecmp(name, cmds->name)) - return cmds; - else - ++cmds; - - return NULL; -} - -CORE_EXPORT(const command_rec *) ap_find_command_in_modules(const char *cmd_name, module **mod) -{ - const command_rec *cmdp; - module *modp; - - for (modp = *mod; modp; modp = modp->next) - if (modp->cmds && (cmdp = ap_find_command(cmd_name, modp->cmds))) { - *mod = modp; - return cmdp; - } - - return NULL; -} - -CORE_EXPORT(void *) ap_set_config_vectors(cmd_parms *parms, void *config, module *mod) -{ - void *mconfig = ap_get_module_config(config, mod); - void *sconfig = ap_get_module_config(parms->server->module_config, mod); - - if (!mconfig && mod->create_dir_config) { - mconfig = (*mod->create_dir_config) (parms->pool, parms->path); - ap_set_module_config(config, mod, mconfig); - } - - if (!sconfig && mod->create_server_config) { - sconfig = (*mod->create_server_config) (parms->pool, parms->server); - ap_set_module_config(parms->server->module_config, mod, sconfig); - } - return mconfig; -} - -CORE_EXPORT(const char *) ap_handle_command(cmd_parms *parms, void *config, const char *l) -{ - void *oldconfig; - const char *args, *cmd_name, *retval; - const command_rec *cmd; - module *mod = top_module; - - if ((l[0] == '#') || (!l[0])) - return NULL; - - args = l; - cmd_name = ap_getword_conf(parms->temp_pool, &args); - if (*cmd_name == '\0') - return NULL; - - oldconfig = parms->context; - parms->context = config; - do { - if (!(cmd = ap_find_command_in_modules(cmd_name, &mod))) { - errno = EINVAL; - return ap_pstrcat(parms->pool, "Invalid command '", cmd_name, - "', perhaps mis-spelled or defined by a module " - "not included in the server configuration", NULL); - } - else { - void *mconfig = ap_set_config_vectors(parms,config, mod); - - retval = invoke_cmd(cmd, parms, mconfig, args); - mod = mod->next; /* Next time around, skip this one */ - } - } while (retval && !strcmp(retval, DECLINE_CMD)); - parms->context = oldconfig; - - return retval; -} - -API_EXPORT(const char *) ap_srm_command_loop(cmd_parms *parms, void *config) -{ - char l[MAX_STRING_LEN]; - - while (!(ap_cfg_getline(l, MAX_STRING_LEN, parms->config_file))) { - const char *errmsg = ap_handle_command(parms, config, l); - if (errmsg) { - return errmsg; - } - } - - return NULL; -} - -/* - * Generic command functions... - */ - -API_EXPORT_NONSTD(const char *) ap_set_string_slot(cmd_parms *cmd, - char *struct_ptr, char *arg) -{ - /* This one's pretty generic... */ - - int offset = (int) (long) cmd->info; - *(char **) (struct_ptr + offset) = arg; - return NULL; -} - -API_EXPORT_NONSTD(const char *) ap_set_string_slot_lower(cmd_parms *cmd, - char *struct_ptr, char *arg) -{ - /* This one's pretty generic... */ - - int offset = (int) (long) cmd->info; - ap_str_tolower(arg); - *(char **) (struct_ptr + offset) = arg; - return NULL; -} - -API_EXPORT_NONSTD(const char *) ap_set_flag_slot(cmd_parms *cmd, - char *struct_ptr, int arg) -{ - /* This one's pretty generic too... */ - - int offset = (int) (long) cmd->info; - *(int *) (struct_ptr + offset) = arg ? 1 : 0; - return NULL; -} - -API_EXPORT_NONSTD(const char *) ap_set_file_slot(cmd_parms *cmd, char *struct_ptr, char *arg) -{ - /* Prepend server_root to relative arg. - This allows .htaccess to be independent of server_root, - so the server can be moved or mirrored with less pain. */ - char *p; - int offset = (int) (long) cmd->info; - if (ap_os_is_path_absolute(arg)) - p = arg; - else - p = ap_make_full_path(cmd->pool, ap_server_root, arg); - *(char **) (struct_ptr + offset) = p; - return NULL; -} - -/***************************************************************** - * - * Reading whole config files... - */ - -static cmd_parms default_parms = -{NULL, 0, -1, NULL, NULL, NULL, NULL, NULL, NULL, NULL}; - -API_EXPORT(char *) ap_server_root_relative(pool *p, char *file) -{ - if(ap_os_is_path_absolute(file)) - return file; - return ap_make_full_path(p, ap_server_root, file); -} - - -/* This structure and the following functions are needed for the - * table-based config file reading. They are passed to the - * cfg_open_custom() routine. - */ - -/* Structure to be passed to cfg_open_custom(): it contains an - * index which is incremented from 0 to nelts on each call to - * cfg_getline() (which in turn calls arr_elts_getstr()) - * and an array_header pointer for the string array. - */ -typedef struct { - array_header *array; - int curr_idx; -} arr_elts_param_t; - - -/* arr_elts_getstr() returns the next line from the string array. */ -static void *arr_elts_getstr(void *buf, size_t bufsiz, void *param) -{ - arr_elts_param_t *arr_param = (arr_elts_param_t *) param; - - /* End of array reached? */ - if (++arr_param->curr_idx > arr_param->array->nelts) - return NULL; - - /* return the line */ - ap_cpystrn(buf, ((char **) arr_param->array->elts)[arr_param->curr_idx - 1], bufsiz); - - return buf; -} - - -/* arr_elts_close(): dummy close routine (makes sure no more lines can be read) */ -static int arr_elts_close(void *param) -{ - arr_elts_param_t *arr_param = (arr_elts_param_t *) param; - arr_param->curr_idx = arr_param->array->nelts; - return 0; -} - -static void process_command_config(server_rec *s, array_header *arr, pool *p, - pool *ptemp) -{ - const char *errmsg; - cmd_parms parms; - arr_elts_param_t arr_parms; - - arr_parms.curr_idx = 0; - arr_parms.array = arr; - - parms = default_parms; - parms.pool = p; - parms.temp_pool = ptemp; - parms.server = s; - parms.override = (RSRC_CONF | OR_ALL) & ~(OR_AUTHCFG | OR_LIMIT); - parms.config_file = ap_pcfg_open_custom(p, "-c/-C directives", - &arr_parms, NULL, - arr_elts_getstr, arr_elts_close); - - errmsg = ap_srm_command_loop(&parms, s->lookup_defaults); - - if (errmsg) { - fprintf(stderr, "Syntax error in -C/-c directive:\n%s\n", errmsg); - exit(1); - } - - ap_cfg_closefile(parms.config_file); -} - -void ap_process_resource_config(server_rec *s, char *fname, pool *p, pool *ptemp) -{ - const char *errmsg; - cmd_parms parms; - struct stat finfo; - - fname = ap_server_root_relative(p, fname); - - if (!(strcmp(fname, ap_server_root_relative(p, RESOURCE_CONFIG_FILE))) || - !(strcmp(fname, ap_server_root_relative(p, ACCESS_CONFIG_FILE)))) { - if (stat(fname, &finfo) == -1) - return; - } - - /* don't require conf/httpd.conf if we have a -C or -c switch */ - if((ap_server_pre_read_config->nelts || ap_server_post_read_config->nelts) && - !(strcmp(fname, ap_server_root_relative(p, SERVER_CONFIG_FILE)))) { - if (stat(fname, &finfo) == -1) - return; - } - - /* GCC's initialization extensions are soooo nice here... */ - - parms = default_parms; - parms.pool = p; - parms.temp_pool = ptemp; - parms.server = s; - parms.override = (RSRC_CONF | OR_ALL) & ~(OR_AUTHCFG | OR_LIMIT); - - if (!(parms.config_file = ap_pcfg_openfile(p,fname))) { - perror("fopen"); - fprintf(stderr, "%s: could not open document config file %s\n", - ap_server_argv0, fname); - exit(1); - } - - errmsg = ap_srm_command_loop(&parms, s->lookup_defaults); - - if (errmsg) { - fprintf(stderr, "Syntax error on line %d of %s:\n", - parms.config_file->line_number, parms.config_file->name); - fprintf(stderr, "%s\n", errmsg); - exit(1); - } - - ap_cfg_closefile(parms.config_file); -} - - -int ap_parse_htaccess(void **result, request_rec *r, int override, - const char *d, const char *access_name) -{ - configfile_t *f = NULL; - cmd_parms parms; - const char *errmsg; - char *filename = NULL; - const struct htaccess_result *cache; - struct htaccess_result *new; - void *dc = NULL; - -/* firstly, search cache */ - for (cache = r->htaccess; cache != NULL; cache = cache->next) - if (cache->override == override && strcmp(cache->dir, d) == 0) { - if (cache->htaccess != NULL) - *result = cache->htaccess; - return OK; - } - - parms = default_parms; - parms.override = override; - parms.pool = r->pool; - parms.temp_pool = r->pool; - parms.server = r->server; - parms.path = ap_pstrdup(r->pool, d); - - /* loop through the access names and find the first one */ - - while (access_name[0]) { - filename = ap_make_full_path(r->pool, d, - ap_getword_conf(r->pool, &access_name)); - - if ((f = ap_pcfg_openfile(r->pool, filename)) != NULL) { - - dc = ap_create_per_dir_config(r->pool); - - parms.config_file = f; - - errmsg = ap_srm_command_loop(&parms, dc); - - ap_cfg_closefile(f); - - if (errmsg) { - ap_log_rerror(APLOG_MARK, APLOG_ALERT|APLOG_NOERRNO, r, - "%s: %s", filename, errmsg); - return HTTP_INTERNAL_SERVER_ERROR; - } - *result = dc; - break; - } - else if (errno != ENOENT && errno != ENOTDIR) { - ap_log_rerror(APLOG_MARK, APLOG_CRIT, r, - "%s pcfg_openfile: unable to check htaccess file, " - "ensure it is readable", - filename); - ap_table_setn(r->notes, "error-notes", - "Server unable to read htaccess file, denying " - "access to be safe"); - return HTTP_FORBIDDEN; - } - } - -/* cache it */ - new = ap_palloc(r->pool, sizeof(struct htaccess_result)); - new->dir = parms.path; - new->override = override; - new->htaccess = dc; -/* add to head of list */ - new->next = r->htaccess; - r->htaccess = new; - - return OK; -} - - -CORE_EXPORT(const char *) ap_init_virtual_host(pool *p, const char *hostname, - server_rec *main_server, server_rec **ps) -{ - server_rec *s = (server_rec *) ap_pcalloc(p, sizeof(server_rec)); - -#ifdef RLIMIT_NOFILE - struct rlimit limits; - - getrlimit(RLIMIT_NOFILE, &limits); - if (limits.rlim_cur < limits.rlim_max) { - limits.rlim_cur += 2; - if (setrlimit(RLIMIT_NOFILE, &limits) < 0) { - perror("setrlimit(RLIMIT_NOFILE)"); - fprintf(stderr, "Cannot exceed hard limit for open files"); - } - } -#endif - - s->server_admin = NULL; - s->server_hostname = NULL; - s->error_fname = NULL; - s->srm_confname = NULL; - s->access_confname = NULL; - s->timeout = 0; - s->keep_alive_timeout = 0; - s->keep_alive = -1; - s->keep_alive_max = -1; - s->error_log = main_server->error_log; - s->loglevel = main_server->loglevel; - /* useful default, otherwise we get a port of 0 on redirects */ - s->port = main_server->port; - s->next = NULL; - - s->is_virtual = 1; - s->names = ap_make_array(p, 4, sizeof(char **)); - s->wild_names = ap_make_array(p, 4, sizeof(char **)); - - s->module_config = create_empty_config(p); - s->lookup_defaults = ap_create_per_dir_config(p); - - s->server_uid = ap_user_id; - s->server_gid = ap_group_id; - - s->limit_req_line = main_server->limit_req_line; - s->limit_req_fieldsize = main_server->limit_req_fieldsize; - s->limit_req_fields = main_server->limit_req_fields; - - *ps = s; - - return ap_parse_vhost_addrs(p, hostname, s); -} - - -static void fixup_virtual_hosts(pool *p, server_rec *main_server) -{ - server_rec *virt; - - for (virt = main_server->next; virt; virt = virt->next) { - merge_server_configs(p, main_server->module_config, - virt->module_config); - - virt->lookup_defaults = - ap_merge_per_dir_configs(p, main_server->lookup_defaults, - virt->lookup_defaults); - - if (virt->server_admin == NULL) - virt->server_admin = main_server->server_admin; - - if (virt->srm_confname == NULL) - virt->srm_confname = main_server->srm_confname; - - if (virt->access_confname == NULL) - virt->access_confname = main_server->access_confname; - - if (virt->timeout == 0) - virt->timeout = main_server->timeout; - - if (virt->keep_alive_timeout == 0) - virt->keep_alive_timeout = main_server->keep_alive_timeout; - - if (virt->keep_alive == -1) - virt->keep_alive = main_server->keep_alive; - - if (virt->keep_alive_max == -1) - virt->keep_alive_max = main_server->keep_alive_max; - - if (virt->send_buffer_size == 0) - virt->send_buffer_size = main_server->send_buffer_size; - - /* XXX: this is really something that should be dealt with by a - * post-config api phase */ - ap_core_reorder_directories(p, virt); - } - ap_core_reorder_directories(p, main_server); -} - -/***************************************************************** - * - * Getting *everything* configured... - */ - -static void init_config_globals(pool *p) -{ - /* ServerRoot, server_confname set in httpd.c */ - - ap_standalone = 1; - ap_user_name = DEFAULT_USER; - ap_user_id = ap_uname2id(DEFAULT_USER); - ap_group_id = ap_gname2id(DEFAULT_GROUP); - ap_daemons_to_start = DEFAULT_START_DAEMON; - ap_daemons_min_free = DEFAULT_MIN_FREE_DAEMON; - ap_daemons_max_free = DEFAULT_MAX_FREE_DAEMON; - ap_daemons_limit = HARD_SERVER_LIMIT; - ap_pid_fname = DEFAULT_PIDLOG; - ap_scoreboard_fname = DEFAULT_SCOREBOARD; - ap_lock_fname = DEFAULT_LOCKFILE; - ap_max_requests_per_child = DEFAULT_MAX_REQUESTS_PER_CHILD; - ap_bind_address.s_addr = htonl(INADDR_ANY); - ap_listeners = NULL; - ap_listenbacklog = DEFAULT_LISTENBACKLOG; - ap_extended_status = 0; - - /* Global virtual host hash bucket pointers. Init to null. */ - ap_init_vhost_config(p); - - ap_cpystrn(ap_coredump_dir, ap_server_root, sizeof(ap_coredump_dir)); -} - -static server_rec *init_server_config(pool *p) -{ - server_rec *s = (server_rec *) ap_pcalloc(p, sizeof(server_rec)); - - s->port = 0; - s->server_admin = DEFAULT_ADMIN; - s->server_hostname = NULL; - s->error_fname = DEFAULT_ERRORLOG; - s->error_log = stderr; - s->loglevel = DEFAULT_LOGLEVEL; - s->srm_confname = RESOURCE_CONFIG_FILE; - s->access_confname = ACCESS_CONFIG_FILE; - s->limit_req_line = DEFAULT_LIMIT_REQUEST_LINE; - s->limit_req_fieldsize = DEFAULT_LIMIT_REQUEST_FIELDSIZE; - s->limit_req_fields = DEFAULT_LIMIT_REQUEST_FIELDS; - s->timeout = DEFAULT_TIMEOUT; - s->keep_alive_timeout = DEFAULT_KEEPALIVE_TIMEOUT; - s->keep_alive_max = DEFAULT_KEEPALIVE; - s->keep_alive = 1; - s->next = NULL; - s->addrs = ap_pcalloc(p, sizeof(server_addr_rec)); - /* NOT virtual host; don't match any real network interface */ - s->addrs->host_addr.s_addr = htonl(INADDR_ANY); - s->addrs->host_port = 0; /* matches any port */ - s->addrs->virthost = ""; /* must be non-NULL */ - s->names = s->wild_names = NULL; - - s->module_config = create_server_config(p, s); - s->lookup_defaults = create_default_per_dir_config(p); - - return s; -} - - -static void default_listeners(pool *p, server_rec *s) -{ - listen_rec *new; - - if (ap_listeners != NULL) { - return; - } - /* allocate a default listener */ - new = ap_pcalloc(p, sizeof(listen_rec)); - new->local_addr.sin_family = AF_INET; - new->local_addr.sin_addr = ap_bind_address; - new->local_addr.sin_port = htons(s->port ? s->port : DEFAULT_HTTP_PORT); - new->fd = -1; - new->used = 0; - new->next = NULL; - ap_listeners = new; -} - - -server_rec *ap_read_config(pool *p, pool *ptemp, char *confname) -{ - server_rec *s = init_server_config(p); - - init_config_globals(p); - - /* All server-wide config files now have the SAME syntax... */ - - process_command_config(s, ap_server_pre_read_config, p, ptemp); - - ap_process_resource_config(s, confname, p, ptemp); - ap_process_resource_config(s, s->srm_confname, p, ptemp); - ap_process_resource_config(s, s->access_confname, p, ptemp); - - process_command_config(s, ap_server_post_read_config, p, ptemp); - - fixup_virtual_hosts(p, s); - default_listeners(p, s); - ap_fini_vhost_config(p, s); - - return s; -} - -void ap_single_module_configure(pool *p, server_rec *s, module *m) -{ - if (m->create_server_config) - ap_set_module_config(s->module_config, m, - (*m->create_server_config)(p, s)); - if (m->create_dir_config) - ap_set_module_config(s->lookup_defaults, m, - (*m->create_dir_config)(p, NULL)); -} - -void ap_init_modules(pool *p, server_rec *s) -{ - module *m; - - for (m = top_module; m; m = m->next) - if (m->init) - (*m->init) (s, p); - build_method_shortcuts(); - init_handlers(p); -} - -void ap_child_init_modules(pool *p, server_rec *s) -{ - module *m; - - for (m = top_module; m; m = m->next) - if (m->child_init) - (*m->child_init) (s, p); -} - -void ap_child_exit_modules(pool *p, server_rec *s) -{ - module *m; - -#ifdef SIGHUP - signal(SIGHUP, SIG_IGN); -#endif -#ifdef SIGUSR1 - signal(SIGUSR1, SIG_IGN); -#endif - - for (m = top_module; m; m = m->next) - if (m->child_exit) - (*m->child_exit) (s, p); - -} - -/******************************************************************** - * Configuration directives are restricted in terms of where they may - * appear in the main configuration files and/or .htaccess files according - * to the bitmask req_override in the command_rec structure. - * If any of the overrides set in req_override are also allowed in the - * context in which the command is read, then the command is allowed. - * The context is determined as follows: - * - * inside *.conf --> override = (RSRC_CONF|OR_ALL)&~(OR_AUTHCFG|OR_LIMIT); - * within or --> override = OR_ALL|ACCESS_CONF; - * within .htaccess --> override = AllowOverride for current directory; - * - * the result is, well, a rather confusing set of possibilities for when - * a particular directive is allowed to be used. This procedure prints - * in English where the given (pc) directive can be used. - */ -static void show_overrides(const command_rec *pc, module *pm) -{ - int n = 0; - - printf("\tAllowed in *.conf "); - if ((pc->req_override & (OR_OPTIONS | OR_FILEINFO | OR_INDEXES)) || - ((pc->req_override & RSRC_CONF) && - ((pc->req_override & (ACCESS_CONF | OR_AUTHCFG | OR_LIMIT))))) - printf("anywhere"); - else if (pc->req_override & RSRC_CONF) - printf("only outside , or "); - else - printf("only inside , or "); - - /* Warn if the directive is allowed inside or .htaccess - * but module doesn't support per-dir configuration */ - - if ((pc->req_override & (OR_ALL | ACCESS_CONF)) && !pm->create_dir_config) - printf(" [no per-dir config]"); - - if (pc->req_override & OR_ALL) { - printf(" and in .htaccess\n\twhen AllowOverride"); - - if ((pc->req_override & OR_ALL) == OR_ALL) - printf(" isn't None"); - else { - printf(" includes "); - - if (pc->req_override & OR_AUTHCFG) { - if (n++) - printf(" or "); - printf("AuthConfig"); - } - if (pc->req_override & OR_LIMIT) { - if (n++) - printf(" or "); - printf("Limit"); - } - if (pc->req_override & OR_OPTIONS) { - if (n++) - printf(" or "); - printf("Options"); - } - if (pc->req_override & OR_FILEINFO) { - if (n++) - printf(" or "); - printf("FileInfo"); - } - if (pc->req_override & OR_INDEXES) { - if (n++) - printf(" or "); - printf("Indexes"); - } - } - } - printf("\n"); -} - -/* Show the preloaded configuration directives, the help string explaining - * the directive arguments, in what module they are handled, and in - * what parts of the configuration they are allowed. Used for httpd -h. - */ -void ap_show_directives() -{ - const command_rec *pc; - int n; - - for (n = 0; ap_loaded_modules[n]; ++n) - for (pc = ap_loaded_modules[n]->cmds; pc && pc->name; ++pc) { - printf("%s (%s)\n", pc->name, ap_loaded_modules[n]->name); - if (pc->errmsg) - printf("\t%s\n", pc->errmsg); - show_overrides(pc, ap_loaded_modules[n]); - } -} - -/* Show the preloaded module names. Used for httpd -l. */ -void ap_show_modules() -{ - int n; - - printf("Compiled-in modules:\n"); - for (n = 0; ap_loaded_modules[n]; ++n) - printf(" %s\n", ap_loaded_modules[n]->name); -} diff --git a/server/config.m4 b/server/config.m4 deleted file mode 100644 index e37203db85a87095384cfcbb33d0ec616873c250..0000000000000000000000000000000000000000 --- a/server/config.m4 +++ /dev/null @@ -1,53 +0,0 @@ -dnl ## Check for libraries - -AC_CHECK_LIB(nsl, gethostname, [ - AC_ADD_LIBRARY(nsl) ], []) - -AC_CHECK_LIB(socket, socket, [ - AC_ADD_LIBRARY(socket) ], []) - -AC_CHECK_LIB(nsl, gethostbyaddr, [ - AC_ADD_LIBRARY(nsl) ], []) - -AC_CHECK_LIB(crypt, crypt, [ - AC_ADD_LIBRARY(crypt) - AC_DEFINE(HAVE_CRYPT)], []) - -AC_CHECK_LIB(c, crypt, [ - AC_DEFINE(HAVE_CRYPT)], []) - -dnl ## Check for header files - -AC_HEADER_STDC -AC_CHECK_HEADERS( -bstring.h \ -crypt.h \ -unistd.h \ -sys/resource.h \ -sys/select.h \ -sys/processor.h \ -) - -dnl ## Check for typedefs, structures, and compiler characteristics. - -AC_CACHE_CHECK([for tm_gmtoff in struct tm], ac_cv_struct_tm_gmtoff, -[AC_TRY_COMPILE([#include -#include <$ac_cv_struct_tm>], [struct tm tm; tm.tm_gmtoff;], - ac_cv_struct_tm_gmtoff=yes, ac_cv_struct_tm_gmtoff=no)]) - -if test "$ac_cv_struct_tm_gmtoff" = "yes"; then - AC_DEFINE(HAVE_GMTOFF) -fi - -dnl ## Check for library functions - -AC_CHECK_FUNCS( -difftime \ -syslog \ -) -AC_FUNC_MMAP - -dnl XXX - is autoconf's detection routine good enough? -if test "$ac_cv_func_mmap_fixed_mapped" = "yes"; then - AC_DEFINE(USE_MMAP_FILES) -fi diff --git a/server/connection.c b/server/connection.c deleted file mode 100644 index 16ee8d494f60fa25a59f38dd99f984cdb4743fd0..0000000000000000000000000000000000000000 --- a/server/connection.c +++ /dev/null @@ -1,236 +0,0 @@ -/* ==================================================================== - * Copyright (c) 1995-1999 The Apache Group. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in - * the documentation and/or other materials provided with the - * distribution. - * - * 3. All advertising materials mentioning features or use of this - * software must display the following acknowledgment: - * "This product includes software developed by the Apache Group - * for use in the Apache HTTP server project (http://www.apache.org/)." - * - * 4. The names "Apache Server" and "Apache Group" must not be used to - * endorse or promote products derived from this software without - * prior written permission. For written permission, please contact - * apache@apache.org. - * - * 5. Products derived from this software may not be called "Apache" - * nor may "Apache" appear in their names without prior written - * permission of the Apache Group. - * - * 6. Redistributions of any form whatsoever must retain the following - * acknowledgment: - * "This product includes software developed by the Apache Group - * for use in the Apache HTTP server project (http://www.apache.org/)." - * - * THIS SOFTWARE IS PROVIDED BY THE APACHE GROUP ``AS IS'' AND ANY - * EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR - * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE APACHE GROUP OR - * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT - * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, - * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED - * OF THE POSSIBILITY OF SUCH DAMAGE. - * ==================================================================== - * - * This software consists of voluntary contributions made by many - * individuals on behalf of the Apache Group and was originally based - * on public domain software written at the National Center for - * Supercomputing Applications, University of Illinois, Urbana-Champaign. - * For more information on the Apache Group and the Apache HTTP server - * project, please see . - * - */ - -#define CORE_PRIVATE -#include "httpd.h" -#include "http_connection.h" -#include "http_request.h" -#include "http_protocol.h" -#include "ap_mpm.h" -#include "http_config.h" -#include "http_vhost.h" - -#include - -/* - * More machine-dependent networking gooo... on some systems, - * you've got to be *really* sure that all the packets are acknowledged - * before closing the connection, since the client will not be able - * to see the last response if their TCP buffer is flushed by a RST - * packet from us, which is what the server's TCP stack will send - * if it receives any request data after closing the connection. - * - * In an ideal world, this function would be accomplished by simply - * setting the socket option SO_LINGER and handling it within the - * server's TCP stack while the process continues on to the next request. - * Unfortunately, it seems that most (if not all) operating systems - * block the server process on close() when SO_LINGER is used. - * For those that don't, see USE_SO_LINGER below. For the rest, - * we have created a home-brew lingering_close. - * - * Many operating systems tend to block, puke, or otherwise mishandle - * calls to shutdown only half of the connection. You should define - * NO_LINGCLOSE in ap_config.h if such is the case for your system. - */ -#ifndef MAX_SECS_TO_LINGER -#define MAX_SECS_TO_LINGER 30 -#endif - -#ifdef USE_SO_LINGER -#define NO_LINGCLOSE /* The two lingering options are exclusive */ - -static void sock_enable_linger(int s) // ZZZZZ abstract the socket, s -{ - struct linger li; // ZZZZZ SocketOptions... - - li.l_onoff = 1; - li.l_linger = MAX_SECS_TO_LINGER; - - if (setsockopt(s, SOL_SOCKET, SO_LINGER, // ZZZZZ abstract, return SUCCESS or not - (char *) &li, sizeof(struct linger)) < 0) { - ap_log_error(APLOG_MARK, APLOG_WARNING, server_conf, - "setsockopt: (SO_LINGER)"); - /* not a fatal error */ - } -} - -#else -#define sock_enable_linger(s) /* NOOP */ -#endif /* USE_SO_LINGER */ - -#ifndef NO_LINGCLOSE - -/* Since many clients will abort a connection instead of closing it, - * attempting to log an error message from this routine will only - * confuse the webmaster. There doesn't seem to be any portable way to - * distinguish between a dropped connection and something that might be - * worth logging. - */ -/*ZZZ this routine needs to be adapted for use with poll()*/ -static void lingering_close(request_rec *r) -{ - /*ZZZ remove the hardwired 512. This is an IO Buffer Size */ - char dummybuf[512]; - struct pollfd pd; - int lsd; - int max_wait; - - /* Prevent a slow-drip client from holding us here indefinitely */ - - max_wait = 30; - ap_bsetopt(r->connection->client, BO_TIMEOUT, &max_wait); - - /* Send any leftover data to the client, but never try to again */ - - if (ap_bflush(r->connection->client) == -1) { - ap_bclose(r->connection->client); - return; - } - ap_bsetflag(r->connection->client, B_EOUT, 1); - - /* Close our half of the connection --- send the client a FIN */ - - lsd = r->connection->client->fd; - - if ((shutdown(lsd, 1) != 0) /* ZZZ abstract shutdown */ - || ap_is_aborted(r->connection)) { - ap_bclose(r->connection->client); - return; - } - - /* Set up to wait for readable data on socket... */ - pd.fd = lsd; - pd.events = POLLIN; - - /* Wait for readable data or error condition on socket; - * slurp up any data that arrives... We exit when we go for an - * interval of tv length without getting any more data, get an error - * from poll(), get an error or EOF on a read, or the timer expires. - */ - /* We use a 2 second timeout because current (Feb 97) browsers - * fail to close a connection after the server closes it. Thus, - * to avoid keeping the child busy, we are only lingering long enough - * for a client that is actively sending data on a connection. - * This should be sufficient unless the connection is massively - * losing packets, in which case we might have missed the RST anyway. - * These parameters are reset on each pass, since they might be - * changed by poll. - */ - do { - pd.revents = 0; - } while ((poll(&pd, 1, 2) == 1) - && read(lsd, dummybuf, sizeof(dummybuf))); - /* && (time() = epoch) < max_wait); */ /* ZZZZ time function is not good... */ - - /* Should now have seen final ack. Safe to finally kill socket */ - ap_bclose(r->connection->client); -} -#endif /* ndef NO_LINGCLOSE */ - - -CORE_EXPORT(void) ap_process_connection(conn_rec *c) -{ - request_rec *r; - - ap_update_vhost_given_ip(c); - - /* - * Read and process each request found on our connection - * until no requests are left or we decide to close. - */ - - while ((r = ap_read_request(c)) != NULL) { - - /* process the request if it was read without error */ - - if (r->status == HTTP_OK) - ap_process_request(r); - - if (!c->keepalive || c->aborted) - break; - - ap_destroy_pool(r->pool); - - if (ap_mpm_graceful_stop()) { - /* XXX: hey wait, this should do a lingering_close! */ - ap_bclose(c->client); - return; - } - } - - /* - * Close the connection, being careful to send out whatever is still - * in our buffers. If possible, try to avoid a hard close until the - * client has ACKed our FIN and/or has stopped sending us data. - */ - -#ifdef NO_LINGCLOSE - ap_bclose(c->client); /* just close it */ -#else - if (r && r->connection - && !r->connection->aborted - && r->connection->client - && (r->connection->client->fd >= 0)) { - - lingering_close(r); - } - else { - ap_bsetflag(c->client, B_EOUT, 1); - ap_bclose(c->client); - } -#endif -} diff --git a/server/core.c b/server/core.c deleted file mode 100644 index 070c4d1e09b43a1a80c88d30099efe90e77c8e19..0000000000000000000000000000000000000000 --- a/server/core.c +++ /dev/null @@ -1,3267 +0,0 @@ -/* ==================================================================== - * The Apache Software License, Version 1.1 - * - * Copyright (c) 2000-2001 The Apache Software Foundation. All rights - * reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in - * the documentation and/or other materials provided with the - * distribution. - * - * 3. The end-user documentation included with the redistribution, - * if any, must include the following acknowledgment: - * "This product includes software developed by the - * Apache Software Foundation (http://www.apache.org/)." - * Alternately, this acknowledgment may appear in the software itself, - * if and wherever such third-party acknowledgments normally appear. - * - * 4. The names "Apache" and "Apache Software Foundation" must - * not be used to endorse or promote products derived from this - * software without prior written permission. For written - * permission, please contact apache@apache.org. - * - * 5. Products derived from this software may not be called "Apache", - * nor may "Apache" appear in their name, without prior written - * permission of the Apache Software Foundation. - * - * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED - * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES - * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR - * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF - * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND - * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, - * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT - * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * ==================================================================== - * - * This software consists of voluntary contributions made by many - * individuals on behalf of the Apache Software Foundation. For more - * information on the Apache Software Foundation, please see - * . - * - * Portions of this software are based upon public domain software - * originally written at the National Center for Supercomputing Applications, - * University of Illinois, Urbana-Champaign. - */ - -#include "apr.h" -#include "apr_strings.h" -#include "apr_lib.h" -#include "apr_fnmatch.h" -#include "apr_thread_proc.h" /* for RLIMIT stuff */ - -#define APR_WANT_IOVEC -#define APR_WANT_STRFUNC -#define APR_WANT_MEMFUNC -#include "apr_want.h" - -#define CORE_PRIVATE -#include "ap_config.h" -#include "httpd.h" -#include "http_config.h" -#include "http_core.h" -#include "http_protocol.h" /* For index_of_response(). Grump. */ -#include "http_request.h" -#include "http_vhost.h" -#include "http_main.h" /* For the default_handler below... */ -#include "http_log.h" -#include "rfc1413.h" -#include "util_md5.h" -#include "http_connection.h" -#include "apr_buckets.h" -#include "util_filter.h" -#include "util_ebcdic.h" -#include "mpm.h" - -#include "mod_core.h" - - -/* LimitXMLRequestBody handling */ -#define AP_LIMIT_UNSET ((long) -1) -#define AP_DEFAULT_LIMIT_XML_BODY ((size_t)1000000) - -#define AP_MIN_SENDFILE_BYTES (256) - -/* Server core module... This module provides support for really basic - * server operations, including options and commands which control the - * operation of other modules. Consider this the bureaucracy module. - * - * The core module also defines handlers, etc., do handle just enough - * to allow a server with the core module ONLY to actually serve documents - * (though it slaps DefaultType on all of 'em); this was useful in testing, - * but may not be worth preserving. - * - * This file could almost be mod_core.c, except for the stuff which affects - * the http_conf_globals. - */ - -static void *create_core_dir_config(apr_pool_t *a, char *dir) -{ - core_dir_config *conf; - - conf = (core_dir_config *)apr_pcalloc(a, sizeof(core_dir_config)); - if (!dir || dir[strlen(dir) - 1] == '/') { - conf->d = dir; - } - else if (strncmp(dir, "proxy:", 6) == 0) { - conf->d = apr_pstrdup(a, dir); - } - else { - conf->d = apr_pstrcat(a, dir, "/", NULL); - } - conf->d_is_fnmatch = conf->d ? (apr_is_fnmatch(conf->d) != 0) : 0; - conf->d_components = conf->d ? ap_count_dirs(conf->d) : 0; - - conf->opts = dir ? OPT_UNSET : OPT_UNSET|OPT_ALL; - conf->opts_add = conf->opts_remove = OPT_NONE; - conf->override = dir ? OR_UNSET : OR_UNSET|OR_ALL; - - conf->content_md5 = 2; - - conf->use_canonical_name = USE_CANONICAL_NAME_UNSET; - - conf->hostname_lookups = HOSTNAME_LOOKUP_UNSET; - conf->do_rfc1413 = DEFAULT_RFC1413 | 2; /* set bit 1 to indicate default */ - conf->satisfy = SATISFY_NOSPEC; - -#ifdef RLIMIT_CPU - conf->limit_cpu = NULL; -#endif -#if defined(RLIMIT_DATA) || defined(RLIMIT_VMEM) || defined(RLIMIT_AS) - conf->limit_mem = NULL; -#endif -#ifdef RLIMIT_NPROC - conf->limit_nproc = NULL; -#endif - - conf->limit_req_body = 0; - conf->limit_xml_body = AP_LIMIT_UNSET; - conf->sec = apr_array_make(a, 2, sizeof(ap_conf_vector_t *)); -#ifdef WIN32 - conf->script_interpreter_source = INTERPRETER_SOURCE_UNSET; -#endif - - conf->server_signature = srv_sig_unset; - - conf->add_default_charset = ADD_DEFAULT_CHARSET_UNSET; - conf->add_default_charset_name = DEFAULT_ADD_DEFAULT_CHARSET_NAME; - - conf->output_filters = apr_array_make(a, 2, sizeof(void *)); - conf->input_filters = apr_array_make(a, 2, sizeof(void *)); - return (void *)conf; -} - -static void *merge_core_dir_configs(apr_pool_t *a, void *basev, void *newv) -{ - core_dir_config *base = (core_dir_config *)basev; - core_dir_config *new = (core_dir_config *)newv; - core_dir_config *conf; - int i; - - conf = (core_dir_config *)apr_palloc(a, sizeof(core_dir_config)); - memcpy((char *)conf, (const char *)base, sizeof(core_dir_config)); - if (base->response_code_strings) { - conf->response_code_strings = - apr_palloc(a, sizeof(*conf->response_code_strings) - * RESPONSE_CODES); - memcpy(conf->response_code_strings, base->response_code_strings, - sizeof(*conf->response_code_strings) * RESPONSE_CODES); - } - - conf->d = new->d; - conf->d_is_fnmatch = new->d_is_fnmatch; - conf->d_components = new->d_components; - conf->r = new->r; - - if (new->opts & OPT_UNSET) { - /* there was no explicit setting of new->opts, so we merge - * preserve the invariant (opts_add & opts_remove) == 0 - */ - conf->opts_add = (conf->opts_add & ~new->opts_remove) | new->opts_add; - conf->opts_remove = (conf->opts_remove & ~new->opts_add) - | new->opts_remove; - conf->opts = (conf->opts & ~conf->opts_remove) | conf->opts_add; - if ((base->opts & OPT_INCNOEXEC) && (new->opts & OPT_INCLUDES)) { - conf->opts = (conf->opts & ~OPT_INCNOEXEC) | OPT_INCLUDES; - } - } - else { - /* otherwise we just copy, because an explicit opts setting - * overrides all earlier +/- modifiers - */ - conf->opts = new->opts; - conf->opts_add = new->opts_add; - conf->opts_remove = new->opts_remove; - } - - if (!(new->override & OR_UNSET)) { - conf->override = new->override; - } - if (new->ap_default_type) { - conf->ap_default_type = new->ap_default_type; - } - - if (new->ap_auth_type) { - conf->ap_auth_type = new->ap_auth_type; - } - if (new->ap_auth_name) { - conf->ap_auth_name = new->ap_auth_name; - } - if (new->ap_requires) { - conf->ap_requires = new->ap_requires; - } - - if (new->response_code_strings) { - if (conf->response_code_strings == NULL) { - conf->response_code_strings = apr_palloc(a, - sizeof(*conf->response_code_strings) * RESPONSE_CODES); - memcpy(conf->response_code_strings, new->response_code_strings, - sizeof(*conf->response_code_strings) * RESPONSE_CODES); - } - else { - for (i = 0; i < RESPONSE_CODES; ++i) { - if (new->response_code_strings[i] != NULL) { - conf->response_code_strings[i] - = new->response_code_strings[i]; - } - } - } - } - if (new->hostname_lookups != HOSTNAME_LOOKUP_UNSET) { - conf->hostname_lookups = new->hostname_lookups; - } - if ((new->do_rfc1413 & 2) == 0) { - conf->do_rfc1413 = new->do_rfc1413; - } - if ((new->content_md5 & 2) == 0) { - conf->content_md5 = new->content_md5; - } - if (new->use_canonical_name != USE_CANONICAL_NAME_UNSET) { - conf->use_canonical_name = new->use_canonical_name; - } - -#ifdef RLIMIT_CPU - if (new->limit_cpu) { - conf->limit_cpu = new->limit_cpu; - } -#endif -#if defined(RLIMIT_DATA) || defined(RLIMIT_VMEM) || defined(RLIMIT_AS) - if (new->limit_mem) { - conf->limit_mem = new->limit_mem; - } -#endif -#ifdef RLIMIT_NPROC - if (new->limit_nproc) { - conf->limit_nproc = new->limit_nproc; - } -#endif - - if (new->limit_req_body) { - conf->limit_req_body = new->limit_req_body; - } - - if (new->limit_xml_body != AP_LIMIT_UNSET) - conf->limit_xml_body = new->limit_xml_body; - else - conf->limit_xml_body = base->limit_xml_body; - - conf->sec = apr_array_append(a, base->sec, new->sec); - - if (new->satisfy != SATISFY_NOSPEC) { - conf->satisfy = new->satisfy; - } - -#ifdef WIN32 - if (new->script_interpreter_source != INTERPRETER_SOURCE_UNSET) { - conf->script_interpreter_source = new->script_interpreter_source; - } -#endif - - if (new->server_signature != srv_sig_unset) { - conf->server_signature = new->server_signature; - } - - if (new->add_default_charset != ADD_DEFAULT_CHARSET_UNSET) { - conf->add_default_charset = new->add_default_charset; - if (new->add_default_charset_name) { - conf->add_default_charset_name = new->add_default_charset_name; - } - } - conf->output_filters = apr_array_append(a, base->output_filters, - new->output_filters); - conf->input_filters = apr_array_append(a, base->input_filters, - new->input_filters); - - return (void*)conf; -} - -static void *create_core_server_config(apr_pool_t *a, server_rec *s) -{ - core_server_config *conf; - int is_virtual = s->is_virtual; - - conf = (core_server_config *)apr_pcalloc(a, sizeof(core_server_config)); -#ifdef GPROF - conf->gprof_dir = NULL; -#endif - conf->access_name = is_virtual ? NULL : DEFAULT_ACCESS_FNAME; - conf->ap_document_root = is_virtual ? NULL : DOCUMENT_LOCATION; - conf->sec = apr_array_make(a, 40, sizeof(ap_conf_vector_t *)); - conf->sec_url = apr_array_make(a, 40, sizeof(ap_conf_vector_t *)); - - return (void *)conf; -} - -static void *merge_core_server_configs(apr_pool_t *p, void *basev, void *virtv) -{ - core_server_config *base = (core_server_config *)basev; - core_server_config *virt = (core_server_config *)virtv; - core_server_config *conf; - - conf = (core_server_config *)apr_pcalloc(p, sizeof(core_server_config)); - *conf = *virt; - if (!conf->access_name) { - conf->access_name = base->access_name; - } - if (!conf->ap_document_root) { - conf->ap_document_root = base->ap_document_root; - } - conf->sec = apr_array_append(p, base->sec, virt->sec); - conf->sec_url = apr_array_append(p, base->sec_url, virt->sec_url); - - return conf; -} - -/* Add per-directory configuration entry (for section); - * these are part of the core server config. - */ - -AP_CORE_DECLARE(void) ap_add_per_dir_conf(server_rec *s, void *dir_config) -{ - core_server_config *sconf = ap_get_module_config(s->module_config, - &core_module); - void **new_space = (void **)apr_array_push(sconf->sec); - - *new_space = dir_config; -} - -AP_CORE_DECLARE(void) ap_add_per_url_conf(server_rec *s, void *url_config) -{ - core_server_config *sconf = ap_get_module_config(s->module_config, - &core_module); - void **new_space = (void **)apr_array_push(sconf->sec_url); - - *new_space = url_config; -} - -AP_CORE_DECLARE(void) ap_add_file_conf(core_dir_config *conf, void *url_config) -{ - void **new_space = (void **)apr_array_push(conf->sec); - - *new_space = url_config; -} - -/* core_reorder_directories reorders the directory sections such that the - * 1-component sections come first, then the 2-component, and so on, finally - * followed by the "special" sections. A section is "special" if it's a regex, - * or if it doesn't start with / -- consider proxy: matching. All movements - * are in-order to preserve the ordering of the sections from the config files. - * See directory_walk(). - */ - -#if defined(HAVE_DRIVE_LETTERS) -#define IS_SPECIAL(entry_core) \ - ((entry_core)->r != NULL \ - || ((entry_core)->d[0] != '/' && (entry_core)->d[1] != ':')) -#elif defined(NETWARE) -/* XXX: Fairly certain this is correct... '/' must prefix the path - * or else in the case xyz:/ or abc/xyz:/, '/' must follow the ':'. - * If there is no leading '/' or embedded ':/', then we are special. - */ -#define IS_SPECIAL(entry_core) \ - ((entry_core)->r != NULL \ - || ((entry_core)->d[0] != '/' \ - && strchr((entry_core)->d, ':') \ - && *(strchr((entry_core)->d, ':') + 1) != '/')) -#else -#define IS_SPECIAL(entry_core) \ - ((entry_core)->r != NULL || (entry_core)->d[0] != '/') -#endif - -/* We need to do a stable sort, qsort isn't stable. So to make it stable - * we'll be maintaining the original index into the list, and using it - * as the minor key during sorting. The major key is the number of - * components (where a "special" section has infinite components). - */ -struct reorder_sort_rec { - ap_conf_vector_t *elt; - int orig_index; -}; - -static int reorder_sorter(const void *va, const void *vb) -{ - const struct reorder_sort_rec *a = va; - const struct reorder_sort_rec *b = vb; - core_dir_config *core_a; - core_dir_config *core_b; - - core_a = ap_get_module_config(a->elt, &core_module); - core_b = ap_get_module_config(b->elt, &core_module); - if (IS_SPECIAL(core_a)) { - if (!IS_SPECIAL(core_b)) { - return 1; - } - } - else if (IS_SPECIAL(core_b)) { - return -1; - } - else { - /* we know they're both not special */ - if (core_a->d_components < core_b->d_components) { - return -1; - } - else if (core_a->d_components > core_b->d_components) { - return 1; - } - } - /* Either they're both special, or they're both not special and have the - * same number of components. In any event, we now have to compare - * the minor key. */ - return a->orig_index - b->orig_index; -} - -void ap_core_reorder_directories(apr_pool_t *p, server_rec *s) -{ - core_server_config *sconf; - apr_array_header_t *sec; - struct reorder_sort_rec *sortbin; - int nelts; - ap_conf_vector_t **elts; - int i; - apr_pool_t *tmp; - - sconf = ap_get_module_config(s->module_config, &core_module); - sec = sconf->sec; - nelts = sec->nelts; - elts = (ap_conf_vector_t **)sec->elts; - - /* we have to allocate tmp space to do a stable sort */ - apr_pool_create(&tmp, p); - sortbin = apr_palloc(tmp, sec->nelts * sizeof(*sortbin)); - for (i = 0; i < nelts; ++i) { - sortbin[i].orig_index = i; - sortbin[i].elt = elts[i]; - } - - qsort(sortbin, nelts, sizeof(*sortbin), reorder_sorter); - - /* and now copy back to the original array */ - for (i = 0; i < nelts; ++i) { - elts[i] = sortbin[i].elt; - } - - apr_pool_destroy(tmp); -} - -/***************************************************************** - * - * There are some elements of the core config structures in which - * other modules have a legitimate interest (this is ugly, but necessary - * to preserve NCSA back-compatibility). So, we have a bunch of accessors - * here... - */ - -AP_DECLARE(int) ap_allow_options(request_rec *r) -{ - core_dir_config *conf = - (core_dir_config *)ap_get_module_config(r->per_dir_config, &core_module); - - return conf->opts; -} - -AP_DECLARE(int) ap_allow_overrides(request_rec *r) -{ - core_dir_config *conf; - conf = (core_dir_config *)ap_get_module_config(r->per_dir_config, - &core_module); - - return conf->override; -} - -AP_DECLARE(const char *) ap_auth_type(request_rec *r) -{ - core_dir_config *conf; - - conf = (core_dir_config *)ap_get_module_config(r->per_dir_config, - &core_module); - return conf->ap_auth_type; -} - -AP_DECLARE(const char *) ap_auth_name(request_rec *r) -{ - core_dir_config *conf; - - conf = (core_dir_config *)ap_get_module_config(r->per_dir_config, - &core_module); - return conf->ap_auth_name; -} - -AP_DECLARE(const char *) ap_default_type(request_rec *r) -{ - core_dir_config *conf; - - conf = (core_dir_config *)ap_get_module_config(r->per_dir_config, - &core_module); - return conf->ap_default_type - ? conf->ap_default_type - : DEFAULT_CONTENT_TYPE; -} - -AP_DECLARE(const char *) ap_document_root(request_rec *r) /* Don't use this! */ -{ - core_server_config *conf; - - conf = (core_server_config *)ap_get_module_config(r->server->module_config, - &core_module); - return conf->ap_document_root; -} - -AP_DECLARE(const apr_array_header_t *) ap_requires(request_rec *r) -{ - core_dir_config *conf; - - conf = (core_dir_config *)ap_get_module_config(r->per_dir_config, - &core_module); - return conf->ap_requires; -} - -AP_DECLARE(int) ap_satisfies(request_rec *r) -{ - core_dir_config *conf; - - conf = (core_dir_config *)ap_get_module_config(r->per_dir_config, - &core_module); - - return conf->satisfy; -} - -/* Should probably just get rid of this... the only code that cares is - * part of the core anyway (and in fact, it isn't publicised to other - * modules). - */ - -char *ap_response_code_string(request_rec *r, int error_index) -{ - core_dir_config *conf; - - conf = (core_dir_config *)ap_get_module_config(r->per_dir_config, - &core_module); - - if (conf->response_code_strings == NULL) { - return NULL; - } - return conf->response_code_strings[error_index]; -} - - -/* Code from Harald Hanche-Olsen */ -static APR_INLINE void do_double_reverse (conn_rec *conn) -{ - apr_sockaddr_t *sa; - apr_status_t rv; - - if (conn->double_reverse) { - /* already done */ - return; - } - if (conn->remote_host == NULL || conn->remote_host[0] == '\0') { - /* single reverse failed, so don't bother */ - conn->double_reverse = -1; - return; - } - rv = apr_sockaddr_info_get(&sa, conn->remote_host, APR_UNSPEC, 0, 0, conn->pool); - if (rv == APR_SUCCESS) { - while (sa) { - if (sa->ipaddr_len == conn->remote_addr->ipaddr_len && - !memcmp(sa->ipaddr_ptr, conn->remote_addr->ipaddr_ptr, - sa->ipaddr_len)) { - conn->double_reverse = 1; - return; - } - sa = sa->next; - } - } - conn->double_reverse = -1; -} - -AP_DECLARE(const char *) ap_get_remote_host(conn_rec *conn, void *dir_config, - int type) -{ - int hostname_lookups; - - /* If we haven't checked the host name, and we want to */ - if (dir_config) { - hostname_lookups = - ((core_dir_config *)ap_get_module_config(dir_config, &core_module)) - ->hostname_lookups; - if (hostname_lookups == HOSTNAME_LOOKUP_UNSET) { - hostname_lookups = HOSTNAME_LOOKUP_OFF; - } - } - else { - /* the default */ - hostname_lookups = HOSTNAME_LOOKUP_OFF; - } - - if (type != REMOTE_NOLOOKUP - && conn->remote_host == NULL - && (type == REMOTE_DOUBLE_REV - || hostname_lookups != HOSTNAME_LOOKUP_OFF)) { - apr_sockaddr_t *remote_addr; - - apr_socket_addr_get(&remote_addr, APR_REMOTE, conn->client_socket); - if (apr_getnameinfo(&conn->remote_host, remote_addr, 0) == APR_SUCCESS) { - ap_str_tolower(conn->remote_host); - - if (hostname_lookups == HOSTNAME_LOOKUP_DOUBLE) { - do_double_reverse(conn); - if (conn->double_reverse != 1) { - conn->remote_host = NULL; - } - } - } - /* if failed, set it to the NULL string to indicate error */ - if (conn->remote_host == NULL) { - conn->remote_host = ""; - } - } - if (type == REMOTE_DOUBLE_REV) { - do_double_reverse(conn); - if (conn->double_reverse == -1) { - return NULL; - } - } - -/* - * Return the desired information; either the remote DNS name, if found, - * or either NULL (if the hostname was requested) or the IP address - * (if any identifier was requested). - */ - if (conn->remote_host != NULL && conn->remote_host[0] != '\0') { - return conn->remote_host; - } - else { - if (type == REMOTE_HOST || type == REMOTE_DOUBLE_REV) { - return NULL; - } - else { - return conn->remote_ip; - } - } -} - -AP_DECLARE(const char *) ap_get_remote_logname(request_rec *r) -{ - core_dir_config *dir_conf; - - if (r->connection->remote_logname != NULL) { - return r->connection->remote_logname; - } - -/* If we haven't checked the identity, and we want to */ - dir_conf = (core_dir_config *)ap_get_module_config(r->per_dir_config, - &core_module); - - if (dir_conf->do_rfc1413 & 1) { - return ap_rfc1413(r->connection, r->server); - } - else { - return NULL; - } -} - -/* There are two options regarding what the "name" of a server is. The - * "canonical" name as defined by ServerName and Port, or the "client's - * name" as supplied by a possible Host: header or full URI. We never - * trust the port passed in the client's headers, we always use the - * port of the actual socket. - * - * The DNS option to UseCanonicalName causes this routine to do a - * reverse lookup on the local IP address of the connection and use - * that for the ServerName. This makes its value more reliable while - * at the same time allowing Demon's magic virtual hosting to work. - * The assumption is that DNS lookups are sufficiently quick... - * -- fanf 1998-10-03 - */ -AP_DECLARE(const char *) ap_get_server_name(request_rec *r) -{ - conn_rec *conn = r->connection; - core_dir_config *d; - - d = (core_dir_config *)ap_get_module_config(r->per_dir_config, - &core_module); - - if (d->use_canonical_name == USE_CANONICAL_NAME_OFF) { - return r->hostname ? r->hostname : r->server->server_hostname; - } - if (d->use_canonical_name == USE_CANONICAL_NAME_DNS) { - if (conn->local_host == NULL) { - apr_sockaddr_t *local_addr; - - apr_socket_addr_get(&local_addr, APR_LOCAL, conn->client_socket); - if (apr_getnameinfo(&conn->local_host, local_addr, 0) != APR_SUCCESS) - conn->local_host = apr_pstrdup(conn->pool, r->server->server_hostname); - else { - ap_str_tolower(conn->local_host); - } - } - return conn->local_host; - } - /* default */ - return r->server->server_hostname; -} - -AP_DECLARE(apr_port_t) ap_get_server_port(const request_rec *r) -{ - apr_port_t port; - core_dir_config *d = - (core_dir_config *)ap_get_module_config(r->per_dir_config, &core_module); - - port = r->server->port ? r->server->port : ap_default_port(r); - - if (d->use_canonical_name == USE_CANONICAL_NAME_OFF - || d->use_canonical_name == USE_CANONICAL_NAME_DNS) { - if (r->hostname) { - apr_sockaddr_t *localsa; - - apr_socket_addr_get(&localsa, APR_LOCAL, r->connection->client_socket); - apr_sockaddr_port_get(&port, localsa); - } - } - /* default */ - return port; -} - -AP_DECLARE(char *) ap_construct_url(apr_pool_t *p, const char *uri, - request_rec *r) -{ - unsigned port = ap_get_server_port(r); - const char *host = ap_get_server_name(r); - - if (ap_is_default_port(port, r)) { - return apr_pstrcat(p, ap_http_method(r), "://", host, uri, NULL); - } - return apr_psprintf(p, "%s://%s:%u%s", ap_http_method(r), host, port, uri); -} - -AP_DECLARE(unsigned long) ap_get_limit_req_body(const request_rec *r) -{ - core_dir_config *d = - (core_dir_config *)ap_get_module_config(r->per_dir_config, &core_module); - - return d->limit_req_body; -} - -#ifdef WIN32 -static apr_status_t get_win32_registry_default_value(apr_pool_t *p, HKEY hkey, - char* relativepath, - char **value) -{ - HKEY hkeyOpen; - DWORD type; - DWORD size = 0; - DWORD result = RegOpenKeyEx(hkey, relativepath, 0, - KEY_QUERY_VALUE, &hkeyOpen); - - if (result != ERROR_SUCCESS) - return APR_FROM_OS_ERROR(result); - - /* Read to NULL buffer to determine value size */ - result = RegQueryValueEx(hkeyOpen, "", 0, &type, NULL, &size); - - if (result == ERROR_SUCCESS) { - if ((size < 2) || (type != REG_SZ && type != REG_EXPAND_SZ)) { - result = ERROR_INVALID_PARAMETER; - } - else { - *value = apr_palloc(p, size); - /* Read value based on size query above */ - result = RegQueryValueEx(hkeyOpen, "", 0, &type, *value, &size); - } - } - - /* TODO: This might look fine, but we need to provide some warning - * somewhere that some environment variables may -not- be translated, - * seeing as we may have chopped the environment table down somewhat. - */ - if ((result == ERROR_SUCCESS) && (type == REG_EXPAND_SZ)) - { - char *tmp = *value; - size = ExpandEnvironmentStrings(tmp, *value, 0); - if (size) { - *value = apr_palloc(p, size); - size = ExpandEnvironmentStrings(tmp, *value, size); - } - } - - RegCloseKey(hkeyOpen); - return APR_FROM_OS_ERROR(result); -} - -static char* get_interpreter_from_win32_registry(apr_pool_t *p, const char* ext, - char** arguments, int strict) -{ - char execcgi_path[] = "SHELL\\EXECCGI\\COMMAND"; - char execopen_path[] = "SHELL\\OPEN\\COMMAND"; - char typeName[MAX_PATH]; - int cmdOfName = FALSE; - HKEY hkeyName; - HKEY hkeyType; - DWORD type; - int size; - int result; - char *buffer; - char *s; - - if (!ext) - return NULL; - /* - * Future optimization: - * When the registry is successfully searched, store the strings for - * interpreter and arguments in an ext hash to speed up subsequent look-ups - */ - - /* Open the key associated with the script filetype extension */ - result = RegOpenKeyEx(HKEY_CLASSES_ROOT, ext, 0, KEY_QUERY_VALUE, - &hkeyType); - - if (result != ERROR_SUCCESS) - return NULL; - - /* Retrieve the name of the script filetype extension */ - size = sizeof(typeName); - result = RegQueryValueEx(hkeyType, "", NULL, &type, typeName, &size); - - if (result == ERROR_SUCCESS && type == REG_SZ && typeName[0]) { - /* Open the key associated with the script filetype extension */ - result = RegOpenKeyEx(HKEY_CLASSES_ROOT, typeName, 0, - KEY_QUERY_VALUE, &hkeyName); - - if (result == ERROR_SUCCESS) - cmdOfName = TRUE; - } - - /* Open the key for the script command path by: - * - * 1) the 'named' filetype key for ExecCGI/Command - * 2) the extension's type key for ExecCGI/Command - * - * and if the strict arg is false, then continue trying: - * - * 3) the 'named' filetype key for Open/Command - * 4) the extension's type key for Open/Command - */ - - if (cmdOfName) { - result = get_win32_registry_default_value(p, hkeyName, - execcgi_path, &buffer); - } - - if (!cmdOfName || (result != ERROR_SUCCESS)) { - result = get_win32_registry_default_value(p, hkeyType, - execcgi_path, &buffer); - } - - if (!strict && cmdOfName && (result != ERROR_SUCCESS)) { - result = get_win32_registry_default_value(p, hkeyName, - execopen_path, &buffer); - } - - if (!strict && (result != ERROR_SUCCESS)) { - result = get_win32_registry_default_value(p, hkeyType, - execopen_path, &buffer); - } - - if (cmdOfName) - RegCloseKey(hkeyName); - - RegCloseKey(hkeyType); - - if (result != ERROR_SUCCESS) - return NULL; - - /* - * The canonical way shell command entries are entered in the Win32 - * registry is as follows: - * shell [options] "%1" [args] - * where - * shell - full path name to interpreter or shell to run. - * E.g., c:\usr\local\ntreskit\perl\bin\perl.exe - * options - optional switches - * E.g., \C - * "%1" - Place holder for file to run the shell against. - * Typically quoted. - * options - additional arguments - * E.g., /silent - * - * If we find a %1 or a quoted %1, lop off the remainder to arguments. - */ - if (buffer && *buffer) { - if ((s = strstr(buffer, "\"%1"))) - { - *s = '\0'; - *arguments = s + 4; - } - else if ((s = strstr(buffer, "%1"))) - { - *s = '\0'; - *arguments = buffer + 2; - } - else - *arguments = strchr(buffer, '\0'); - while (**arguments && isspace(**arguments)) - ++*arguments; - } - - return buffer; -} - -AP_DECLARE (file_type_e) ap_get_win32_interpreter(const request_rec *r, - char** interpreter, - char** arguments) -{ - HANDLE hFile; - DWORD nBytesRead; - BOOLEAN bResult; - char buffer[1024]; - core_dir_config *d; - int i; - file_type_e fileType = eFileTypeUNKNOWN; - char *ext = NULL; - char *exename = NULL; - - d = (core_dir_config *)ap_get_module_config(r->per_dir_config, - &core_module); - - /* Find the file extension */ - exename = strrchr(r->filename, '/'); - if (!exename) { - exename = strrchr(r->filename, '\\'); - } - if (!exename) { - exename = r->filename; - } - else { - exename++; - } - ext = strrchr(exename, '.'); - - if (ext && (!strcasecmp(ext,".bat") || !strcasecmp(ext,".cmd"))) - { - char *comspec = getenv("COMSPEC"); - if (comspec) { - *interpreter = apr_pstrcat(r->pool, "\"", comspec, "\" /c ", NULL); - return eFileTypeSCRIPT; - } - ap_log_error(APLOG_MARK, APLOG_NOERRNO|APLOG_INFO, 0, r->server, - "Failed to start a '%s' file as a script." APR_EOL_STR - "\tCOMSPEC variable is missing from the environment.", ext); - return eFileTypeUNKNOWN; - } - - /* If the file has an extension and it is not .com and not .exe and - * we've been instructed to search the registry, then do it! - */ - if (ext && strcasecmp(ext,".exe") && strcasecmp(ext,".com") && - (d->script_interpreter_source == INTERPRETER_SOURCE_REGISTRY || - d->script_interpreter_source == INTERPRETER_SOURCE_REGISTRY_STRICT)) { - /* Check the registry */ - int strict = (d->script_interpreter_source - == INTERPRETER_SOURCE_REGISTRY_STRICT); - *interpreter = get_interpreter_from_win32_registry(r->pool, ext, - arguments, strict); - if (*interpreter) - return eFileTypeSCRIPT; - else if (d->script_interpreter_source == INTERPRETER_SOURCE_REGISTRY_STRICT) { - ap_log_error(APLOG_MARK, APLOG_NOERRNO|APLOG_INFO, 0, r->server, - "ScriptInterpreterSource config directive set to \"registry-strict\"." APR_EOL_STR - "\tInterpreter not found for files of type '%s'.", ext); - return eFileTypeUNKNOWN; - } - else - { - ap_log_error(APLOG_MARK, APLOG_NOERRNO|APLOG_INFO, 0, r->server, - "ScriptInterpreterSource config directive set to \"registry\"." APR_EOL_STR - "\tInterpreter not found for files of type '%s', " - "trying \"script\" method...", ext); - } - } - - /* Need to peek into the file figure out what it really is... */ - /* This is wrong for Unicode FS ... should move to APR */ - hFile = CreateFile(r->filename, GENERIC_READ, FILE_SHARE_READ, NULL, - OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL); - if (hFile == INVALID_HANDLE_VALUE) { - return eFileTypeUNKNOWN; - } - bResult = ReadFile(hFile, (void*) &buffer, sizeof(buffer) - 1, - &nBytesRead, NULL); - if (!bResult || (nBytesRead == 0)) { - ap_log_rerror(APLOG_MARK, APLOG_ERR, GetLastError(), r, - "ReadFile(%s) failed", r->filename); - CloseHandle(hFile); - return eFileTypeUNKNOWN; - } - CloseHandle(hFile); - buffer[nBytesRead] = '\0'; - - /* Script or executable, that is the question... */ - if ((buffer[0] == '#') && (buffer[1] == '!')) { - /* Assuming file is a script since it starts with a shebang */ - fileType = eFileTypeSCRIPT; - for (i = 2; i < sizeof(buffer); i++) { - if ((buffer[i] == '\r') - || (buffer[i] == '\n')) { - break; - } - } - buffer[i] = '\0'; - for (i = 2; buffer[i] == ' ' ; ++i) - ; - *interpreter = apr_pstrdup(r->pool, buffer + i ); - } - else { - /* Not a script, is it an executable? */ - IMAGE_DOS_HEADER *hdr = (IMAGE_DOS_HEADER*)buffer; - if ((nBytesRead >= sizeof(IMAGE_DOS_HEADER)) && (hdr->e_magic == IMAGE_DOS_SIGNATURE)) { - if (hdr->e_lfarlc < 0x40) - fileType = eFileTypeEXE16; - else - fileType = eFileTypeEXE32; - } - else - fileType = eFileTypeUNKNOWN; - } - - return fileType; -} -#endif - -/***************************************************************** - * - * Commands... this module handles almost all of the NCSA httpd.conf - * commands, but most of the old srm.conf is in the the modules. - */ - - -/* returns a parent if it matches the given directive */ -static const ap_directive_t * find_parent(const ap_directive_t *dirp, - const char *what) -{ - while (dirp->parent != NULL) { - dirp = dirp->parent; - /* ### it would be nice to have atom-ized directives */ - if (strcasecmp(dirp->directive, what) == 0) - return dirp; - } - return NULL; -} - -AP_DECLARE(const char *) ap_check_cmd_context(cmd_parms *cmd, - unsigned forbidden) -{ - const char *gt = (cmd->cmd->name[0] == '<' - && cmd->cmd->name[strlen(cmd->cmd->name)-1] != '>') - ? ">" : ""; - const ap_directive_t *found; - - if ((forbidden & NOT_IN_VIRTUALHOST) && cmd->server->is_virtual) { - return apr_pstrcat(cmd->pool, cmd->cmd->name, gt, - " cannot occur within section", NULL); - } - - if ((forbidden & NOT_IN_LIMIT) && cmd->limited != -1) { - return apr_pstrcat(cmd->pool, cmd->cmd->name, gt, - " cannot occur within section", NULL); - } - - if ((forbidden & NOT_IN_DIR_LOC_FILE) == NOT_IN_DIR_LOC_FILE - && cmd->path != NULL) { - return apr_pstrcat(cmd->pool, cmd->cmd->name, gt, - " cannot occur within " - "section", NULL); - } - - if (((forbidden & NOT_IN_DIRECTORY) - && ((found = find_parent(cmd->directive, "directive, "directive, "directive, "directive, "directive, "pool, cmd->cmd->name, gt, - " cannot occur within ", found->directive, - "> section", NULL); - } - - return NULL; -} - -static const char *set_access_name(cmd_parms *cmd, void *dummy, - const char *arg) -{ - void *sconf = cmd->server->module_config; - core_server_config *conf = ap_get_module_config(sconf, &core_module); - - const char *err = ap_check_cmd_context(cmd, - NOT_IN_DIR_LOC_FILE|NOT_IN_LIMIT); - if (err != NULL) { - return err; - } - - conf->access_name = apr_pstrdup(cmd->pool, arg); - return NULL; -} - -#ifdef GPROF -static const char *set_gprof_dir(cmd_parms *cmd, void *dummy, const char *arg) -{ - void *sconf = cmd->server->module_config; - core_server_config *conf = ap_get_module_config(sconf, &core_module); - - const char *err = ap_check_cmd_context(cmd, - NOT_IN_DIR_LOC_FILE|NOT_IN_LIMIT); - if (err != NULL) { - return err; - } - - conf->gprof_dir = apr_pstrdup(cmd->pool, arg); - return NULL; -} -#endif /*GPROF*/ - -static const char *set_add_default_charset(cmd_parms *cmd, - void *d_, const char *arg) -{ - core_dir_config *d=d_; - - const char *err = ap_check_cmd_context(cmd, NOT_IN_LIMIT); - if (err != NULL) { - return err; - } - if (!strcasecmp(arg, "Off")) { - d->add_default_charset = ADD_DEFAULT_CHARSET_OFF; - } - else if (!strcasecmp(arg, "On")) { - d->add_default_charset = ADD_DEFAULT_CHARSET_ON; - d->add_default_charset_name = DEFAULT_ADD_DEFAULT_CHARSET_NAME; - } - else { - d->add_default_charset = ADD_DEFAULT_CHARSET_ON; - d->add_default_charset_name = arg; - } - return NULL; -} - -static const char *set_document_root(cmd_parms *cmd, void *dummy, - const char *arg) -{ - void *sconf = cmd->server->module_config; - core_server_config *conf = ap_get_module_config(sconf, &core_module); - - const char *err = ap_check_cmd_context(cmd, - NOT_IN_DIR_LOC_FILE|NOT_IN_LIMIT); - if (err != NULL) { - return err; - } - - arg = ap_os_canonical_filename(cmd->pool, arg); - if (/* TODO: ap_configtestonly && ap_docrootcheck && */ !ap_is_directory(cmd->pool, arg)) { - if (cmd->server->is_virtual) { - ap_log_perror(APLOG_MARK, APLOG_STARTUP | APLOG_NOERRNO, 0, cmd->pool, - "Warning: DocumentRoot [%s] does not exist", - arg); - } - else { - return "DocumentRoot must be a directory"; - } - } - - conf->ap_document_root = arg; - return NULL; -} - -AP_DECLARE(void) ap_custom_response(request_rec *r, int status, char *string) -{ - core_dir_config *conf = - ap_get_module_config(r->per_dir_config, &core_module); - int idx; - - if(conf->response_code_strings == NULL) { - conf->response_code_strings = - apr_pcalloc(r->pool, - sizeof(*conf->response_code_strings) * - RESPONSE_CODES); - } - - idx = ap_index_of_response(status); - - conf->response_code_strings[idx] = - ((ap_is_url(string) || (*string == '/')) && (*string != '"')) ? - apr_pstrdup(r->pool, string) : apr_pstrcat(r->pool, "\"", string, NULL); -} - -static const char *set_error_document(cmd_parms *cmd, void *conf_, - const char *errno_str, const char *msg) -{ - core_dir_config *conf=conf_; - int error_number, index_number, idx500; - enum { MSG, LOCAL_PATH, REMOTE_PATH } what = MSG; - - const char *err = ap_check_cmd_context(cmd, NOT_IN_LIMIT); - if (err != NULL) { - return err; - } - - /* 1st parameter should be a 3 digit number, which we recognize; - * convert it into an array index - */ - error_number = atoi(errno_str); - idx500 = ap_index_of_response(HTTP_INTERNAL_SERVER_ERROR); - - if (error_number == HTTP_INTERNAL_SERVER_ERROR) { - index_number = idx500; - } - else if ((index_number = ap_index_of_response(error_number)) == idx500) { - return apr_pstrcat(cmd->pool, "Unsupported HTTP response code ", - errno_str, NULL); - } - - /* Heuristic to determine second argument. */ - if (ap_strchr_c(msg,' ')) - what = MSG; - else if (msg[0] == '/') - what = LOCAL_PATH; - else if (ap_is_url(msg)) - what = REMOTE_PATH; - else - what = MSG; - - /* The entry should be ignored if it is a full URL for a 401 error */ - - if (error_number == 401 && what == REMOTE_PATH) { - ap_log_error(APLOG_MARK, APLOG_NOERRNO|APLOG_NOTICE, 0, cmd->server, - "cannot use a full URL in a 401 ErrorDocument " - "directive --- ignoring!"); - } - else { /* Store it... */ - if (conf->response_code_strings == NULL) { - conf->response_code_strings = - apr_pcalloc(cmd->pool, - sizeof(*conf->response_code_strings) * RESPONSE_CODES); - } - /* hack. Prefix a " if it is a msg; as that is what - * http_protocol.c relies on to distinguish between - * a msg and a (local) path. - */ - conf->response_code_strings[index_number] = (what == MSG) ? - apr_pstrcat(cmd->pool, "\"",msg,NULL) : - apr_pstrdup(cmd->pool, msg); - } - - return NULL; -} - -static const char *set_override(cmd_parms *cmd, void *d_, const char *l) -{ - core_dir_config *d=d_; - char *w; - - const char *err = ap_check_cmd_context(cmd, NOT_IN_LIMIT); - if (err != NULL) { - return err; - } - - d->override = OR_NONE; - while (l[0]) { - w = ap_getword_conf(cmd->pool, &l); - if (!strcasecmp(w, "Limit")) { - d->override |= OR_LIMIT; - } - else if (!strcasecmp(w, "Options")) { - d->override |= OR_OPTIONS; - } - else if (!strcasecmp(w, "FileInfo")) { - d->override |= OR_FILEINFO; - } - else if (!strcasecmp(w, "AuthConfig")) { - d->override |= OR_AUTHCFG; - } - else if (!strcasecmp(w, "Indexes")) { - d->override |= OR_INDEXES; - } - else if (!strcasecmp(w, "None")) { - d->override = OR_NONE; - } - else if (!strcasecmp(w, "All")) { - d->override = OR_ALL; - } - else { - return apr_pstrcat(cmd->pool, "Illegal override option ", w, NULL); - } - d->override &= ~OR_UNSET; - } - - return NULL; -} - -static const char *set_options(cmd_parms *cmd, void *d_, const char *l) -{ - core_dir_config *d=d_; - allow_options_t opt; - int first = 1; - char action; - - while (l[0]) { - char *w = ap_getword_conf(cmd->pool, &l); - action = '\0'; - - if (*w == '+' || *w == '-') { - action = *(w++); - } - else if (first) { - d->opts = OPT_NONE; - first = 0; - } - - if (!strcasecmp(w, "Indexes")) { - opt = OPT_INDEXES; - } - else if (!strcasecmp(w, "Includes")) { - opt = OPT_INCLUDES; - } - else if (!strcasecmp(w, "IncludesNOEXEC")) { - opt = (OPT_INCLUDES | OPT_INCNOEXEC); - } - else if (!strcasecmp(w, "FollowSymLinks")) { - opt = OPT_SYM_LINKS; - } - else if (!strcasecmp(w, "SymLinksIfOwnerMatch")) { - opt = OPT_SYM_OWNER; - } - else if (!strcasecmp(w, "execCGI")) { - opt = OPT_EXECCGI; - } - else if (!strcasecmp(w, "MultiViews")) { - opt = OPT_MULTI; - } - else if (!strcasecmp(w, "RunScripts")) { /* AI backcompat. Yuck */ - opt = OPT_MULTI|OPT_EXECCGI; - } - else if (!strcasecmp(w, "None")) { - opt = OPT_NONE; - } - else if (!strcasecmp(w, "All")) { - opt = OPT_ALL; - } - else { - return apr_pstrcat(cmd->pool, "Illegal option ", w, NULL); - } - - /* we ensure the invariant (d->opts_add & d->opts_remove) == 0 */ - if (action == '-') { - d->opts_remove |= opt; - d->opts_add &= ~opt; - d->opts &= ~opt; - } - else if (action == '+') { - d->opts_add |= opt; - d->opts_remove &= ~opt; - d->opts |= opt; - } - else { - d->opts |= opt; - } - } - - return NULL; -} - -static const char *satisfy(cmd_parms *cmd, void *c_, const char *arg) -{ - core_dir_config *c=c_; - - if (!strcasecmp(arg, "all")) { - c->satisfy = SATISFY_ALL; - } - else if (!strcasecmp(arg, "any")) { - c->satisfy = SATISFY_ANY; - } - else { - return "Satisfy either 'any' or 'all'."; - } - return NULL; -} - -static const char *require(cmd_parms *cmd, void *c_, const char *arg) -{ - require_line *r; - core_dir_config *c=c_; - - if (!c->ap_requires) { - c->ap_requires = apr_array_make(cmd->pool, 2, sizeof(require_line)); - } - r = (require_line *)apr_array_push(c->ap_requires); - r->requirement = apr_pstrdup(cmd->pool, arg); - r->method_mask = cmd->limited; - return NULL; -} - -AP_CORE_DECLARE_NONSTD(const char *) ap_limit_section(cmd_parms *cmd, void *dummy, - const char *arg) { - const char *limited_methods = ap_getword(cmd->pool, &arg, '>'); - void *tog = cmd->cmd->cmd_data; - int limited = 0; - const char *errmsg; - - const char *err = ap_check_cmd_context(cmd, NOT_IN_LIMIT); - if (err != NULL) { - return err; - } - - while (limited_methods[0]) { - char *method = ap_getword_conf(cmd->pool, &limited_methods); - int methnum = ap_method_number_of(method); - - if (methnum == M_TRACE && !tog) { - return "TRACE cannot be controlled by "; - } - else if (methnum == M_INVALID) { - char **xmethod; - register int i, j, k; - - /* - * Deal with by adding the method to the list. - */ - if (!tog) { - if (cmd->limited_xmethods == NULL) { - cmd->limited_xmethods = apr_array_make(cmd->pool, 2, - sizeof(char *)); - } - xmethod = (char **) apr_array_push(cmd->limited_xmethods); - *xmethod = apr_pstrdup(cmd->pool, method); - } - /* - * , so remove any/all occurrences of the method - * in the extension array. - */ - else if ((cmd->limited_xmethods != NULL) - && (cmd->limited_xmethods->nelts != 0)) { - xmethod = (char **) cmd->limited_xmethods->elts; - for (i = 0; i < cmd->limited_xmethods->nelts; ) { - if (strcmp(xmethod[i], method) == 0) { - for (j = i, k = i + 1; - k < cmd->limited_xmethods->nelts; - ++j, ++k) { - xmethod[j] = xmethod[k]; - } - cmd->limited_xmethods->nelts--; - } - } - } - } - limited |= (1 << methnum); - } - - /* Killing two features with one function, - * if (tog == NULL) , else - */ - cmd->limited = tog ? ~limited : limited; - - errmsg = ap_walk_config(cmd->directive->first_child, cmd, cmd->context); - - cmd->limited = -1; - - return errmsg; -} - -/* We use this in and , to ensure that - * people don't get bitten by wrong-cased regex matches - */ - -#ifdef WIN32 -#define USE_ICASE REG_ICASE -#else -#define USE_ICASE 0 -#endif - -/* - * Report a missing-'>' syntax error. - */ -static char *unclosed_directive(cmd_parms *cmd) -{ - return apr_pstrcat(cmd->pool, cmd->cmd->name, - "> directive missing closing '>'", NULL); -} - -static const char *dirsection(cmd_parms *cmd, void *mconfig, const char *arg) -{ - const char *errmsg; - const char *endp = ap_strrchr_c(arg, '>'); - int old_overrides = cmd->override; - char *old_path = cmd->path; - core_dir_config *conf; - ap_conf_vector_t *new_dir_conf = ap_create_per_dir_config(cmd->pool); - regex_t *r = NULL; - const command_rec *thiscmd = cmd->cmd; - - const char *err = ap_check_cmd_context(cmd, - NOT_IN_DIR_LOC_FILE|NOT_IN_LIMIT); - if (err != NULL) { - return err; - } - - if (endp == NULL) { - return unclosed_directive(cmd); - } - - arg=apr_pstrndup(cmd->pool, arg, endp-arg); - - cmd->path = ap_getword_conf(cmd->pool, &arg); - cmd->override = OR_ALL|ACCESS_CONF; - - if (thiscmd->cmd_data) { /* */ - r = ap_pregcomp(cmd->pool, cmd->path, REG_EXTENDED|USE_ICASE); - } - else if (!strcmp(cmd->path, "~")) { - cmd->path = ap_getword_conf(cmd->pool, &arg); - r = ap_pregcomp(cmd->pool, cmd->path, REG_EXTENDED|USE_ICASE); - } -#if defined(HAVE_DRIVE_LETTERS) || defined(NETWARE) - else if (strcmp(cmd->path, "/") == 0) { - /* Treat 'default' path / as an inalienable root */ - cmd->path = apr_pstrdup(cmd->pool, cmd->path); - } -#endif -#if defined(HAVE_UNC_PATHS) - else if (strcmp(cmd->path, "//") == 0) { - /* Treat UNC path // as an inalienable root */ - cmd->path = apr_pstrdup(cmd->pool, cmd->path); - } -#endif - else { - /* Ensure that the pathname is canonical */ - cmd->path = ap_os_canonical_filename(cmd->pool, cmd->path); - } - - /* initialize our config and fetch it */ - conf = ap_set_config_vectors(cmd->server, new_dir_conf, cmd->path, - &core_module, cmd->pool); - - errmsg = ap_walk_config(cmd->directive->first_child, cmd, new_dir_conf); - if (errmsg != NULL) - return errmsg; - - conf->r = r; - - ap_add_per_dir_conf(cmd->server, new_dir_conf); - - if (*arg != '\0') { - return apr_pstrcat(cmd->pool, "Multiple ", thiscmd->name, - "> arguments not (yet) supported.", NULL); - } - - cmd->path = old_path; - cmd->override = old_overrides; - - return NULL; -} - -static const char *urlsection(cmd_parms *cmd, void *mconfig, const char *arg) -{ - const char *errmsg; - const char *endp = ap_strrchr_c(arg, '>'); - int old_overrides = cmd->override; - char *old_path = cmd->path; - core_dir_config *conf; - regex_t *r = NULL; - const command_rec *thiscmd = cmd->cmd; - ap_conf_vector_t *new_url_conf = ap_create_per_dir_config(cmd->pool); - const char *err = ap_check_cmd_context(cmd, - NOT_IN_DIR_LOC_FILE|NOT_IN_LIMIT); - if (err != NULL) { - return err; - } - - if (endp == NULL) { - return unclosed_directive(cmd); - } - - arg=apr_pstrndup(cmd->pool, arg, endp-arg); - - cmd->path = ap_getword_conf(cmd->pool, &arg); - cmd->override = OR_ALL|ACCESS_CONF; - - if (thiscmd->cmd_data) { /* */ - r = ap_pregcomp(cmd->pool, cmd->path, REG_EXTENDED); - } - else if (!strcmp(cmd->path, "~")) { - cmd->path = ap_getword_conf(cmd->pool, &arg); - r = ap_pregcomp(cmd->pool, cmd->path, REG_EXTENDED); - } - - /* initialize our config and fetch it */ - conf = ap_set_config_vectors(cmd->server, new_url_conf, cmd->path, - &core_module, cmd->pool); - - errmsg = ap_walk_config(cmd->directive->first_child, cmd, new_url_conf); - if (errmsg != NULL) - return errmsg; - - conf->d = apr_pstrdup(cmd->pool, cmd->path); /* No mangling, please */ - conf->d_is_fnmatch = apr_is_fnmatch(conf->d) != 0; - conf->r = r; - - ap_add_per_url_conf(cmd->server, new_url_conf); - - if (*arg != '\0') { - return apr_pstrcat(cmd->pool, "Multiple ", thiscmd->name, - "> arguments not (yet) supported.", NULL); - } - - cmd->path = old_path; - cmd->override = old_overrides; - - return NULL; -} - -static const char *filesection(cmd_parms *cmd, void *mconfig, const char *arg) -{ - const char *errmsg; - const char *endp = ap_strrchr_c(arg, '>'); - int old_overrides = cmd->override; - char *old_path = cmd->path; - core_dir_config *conf; - regex_t *r = NULL; - const command_rec *thiscmd = cmd->cmd; - core_dir_config *c=mconfig; - ap_conf_vector_t *new_file_conf = ap_create_per_dir_config(cmd->pool); - const char *err = ap_check_cmd_context(cmd, NOT_IN_LIMIT|NOT_IN_LOCATION); - - if (err != NULL) { - return err; - } - - if (endp == NULL) { - return unclosed_directive(cmd); - } - - arg=apr_pstrndup(cmd->pool, arg, endp-arg); - - cmd->path = ap_getword_conf(cmd->pool, &arg); - /* Only if not an .htaccess file */ - if (!old_path) { - cmd->override = OR_ALL|ACCESS_CONF; - } - - if (thiscmd->cmd_data) { /* */ - r = ap_pregcomp(cmd->pool, cmd->path, REG_EXTENDED|USE_ICASE); - } - else if (!strcmp(cmd->path, "~")) { - cmd->path = ap_getword_conf(cmd->pool, &arg); - r = ap_pregcomp(cmd->pool, cmd->path, REG_EXTENDED|USE_ICASE); - } - else { - /* Ensure that the pathname is canonical */ - cmd->path = ap_os_canonical_filename(cmd->pool, cmd->path); - } - - /* initialize our config and fetch it */ - conf = ap_set_config_vectors(cmd->server, new_file_conf, cmd->path, - &core_module, cmd->pool); - - errmsg = ap_walk_config(cmd->directive->first_child, cmd, new_file_conf); - if (errmsg != NULL) - return errmsg; - - conf->d = cmd->path; - conf->d_is_fnmatch = apr_is_fnmatch(conf->d) != 0; - conf->r = r; - - ap_add_file_conf(c, new_file_conf); - - if (*arg != '\0') { - return apr_pstrcat(cmd->pool, "Multiple ", thiscmd->name, - "> arguments not (yet) supported.", NULL); - } - - cmd->path = old_path; - cmd->override = old_overrides; - - return NULL; -} - -static const char *start_ifmod(cmd_parms *cmd, void *mconfig, const char *arg) -{ - const char *endp = ap_strrchr_c(arg, '>'); - int not = (arg[0] == '!'); - module *found; - - if (endp == NULL) { - return unclosed_directive(cmd); - } - - arg=apr_pstrndup(cmd->pool, arg, endp-arg); - - if (not) { - arg++; - } - - found = ap_find_linked_module(arg); - - if ((!not && found) || (not && !found)) { - ap_directive_t *parent = NULL; - ap_directive_t *current = NULL; - const char *retval; - - retval = ap_build_cont_config(cmd->pool, cmd->temp_pool, cmd, - ¤t, &parent, "elts; - for (i = 0; i < ap_server_config_defines->nelts; i++) { - if (strcmp(defines[i], name) == 0) { - return 1; - } - } - return 0; -} - -static const char *start_ifdefine(cmd_parms *cmd, void *dummy, const char *arg) -{ - const char *endp; - int defined; - int not = 0; - - endp = ap_strrchr_c(arg, '>'); - if (endp == NULL) { - return unclosed_directive(cmd); - } - - arg=apr_pstrndup(cmd->pool, arg, endp-arg); - - if (arg[0] == '!') { - not = 1; - arg++; - } - - defined = ap_exists_config_define(arg); - if ((!not && defined) || (not && !defined)) { - ap_directive_t *parent = NULL; - ap_directive_t *current = NULL; - const char *retval; - - retval = ap_build_cont_config(cmd->pool, cmd->temp_pool, cmd, - ¤t, &parent, " business */ - -static const char *virtualhost_section(cmd_parms *cmd, void *dummy, - const char *arg) -{ - server_rec *main_server = cmd->server, *s; - const char *errmsg; - const char *endp = ap_strrchr_c(arg, '>'); - apr_pool_t *p = cmd->pool; - - const char *err = ap_check_cmd_context(cmd, GLOBAL_ONLY); - if (err != NULL) { - return err; - } - - if (endp == NULL) { - return unclosed_directive(cmd); - } - - arg=apr_pstrndup(cmd->pool, arg, endp-arg); - - /* FIXME: There's another feature waiting to happen here -- since you - can now put multiple addresses/names on a single - you might want to use it to group common definitions and then - define other "subhosts" with their individual differences. But - personally I'd rather just do it with a macro preprocessor. -djg */ - if (main_server->is_virtual) { - return " doesn't nest!"; - } - - errmsg = ap_init_virtual_host(p, arg, main_server, &s); - if (errmsg) { - return errmsg; - } - - s->next = main_server->next; - main_server->next = s; - - s->defn_name = cmd->directive->filename; - s->defn_line_number = cmd->directive->line_num; - - cmd->server = s; - - errmsg = ap_walk_config(cmd->directive->first_child, cmd, - s->lookup_defaults); - - cmd->server = main_server; - - return errmsg; -} - -static const char *set_server_alias(cmd_parms *cmd, void *dummy, - const char *arg) -{ - if (!cmd->server->names) { - return "ServerAlias only used in "; - } - while (*arg) { - char **item, *name = ap_getword_conf(cmd->pool, &arg); - if (ap_is_matchexp(name)) { - item = (char **)apr_array_push(cmd->server->wild_names); - } - else { - item = (char **)apr_array_push(cmd->server->names); - } - *item = name; - } - return NULL; -} - -static const char *add_filter(cmd_parms *cmd, void *dummy, const char *arg) -{ - core_dir_config *conf = dummy; - char **newfilter; - - newfilter = (char **)apr_array_push(conf->output_filters); - *newfilter = apr_pstrdup(cmd->pool, arg); - return NULL; -} - -static const char *add_input_filter(cmd_parms *cmd, void *dummy, const char *arg) -{ - core_dir_config *conf = dummy; - char **newfilter; - - newfilter = (char **)apr_array_push(conf->input_filters); - *newfilter = apr_pstrdup(cmd->pool, arg); - return NULL; -} - -static const char *set_server_string_slot(cmd_parms *cmd, void *dummy, - const char *arg) -{ - /* This one's pretty generic... */ - - int offset = (int)(long)cmd->info; - char *struct_ptr = (char *)cmd->server; - - const char *err = ap_check_cmd_context(cmd, - NOT_IN_DIR_LOC_FILE|NOT_IN_LIMIT); - if (err != NULL) { - return err; - } - - *(const char **)(struct_ptr + offset) = arg; - return NULL; -} - -static const char *server_port(cmd_parms *cmd, void *dummy, const char *arg) -{ - const char *err = ap_check_cmd_context(cmd, NOT_IN_DIR_LOC_FILE|NOT_IN_LIMIT); - int port; - - if (err != NULL) { - return err; - } - port = atoi(arg); - if (port <= 0 || port >= 65536) { /* 65536 == 1<<16 */ - return apr_pstrcat(cmd->temp_pool, "The port number \"", arg, - "\" is outside the appropriate range " - "(i.e., 1..65535).", NULL); - } - cmd->server->port = port; - return NULL; -} - -static const char *set_signature_flag(cmd_parms *cmd, void *d_, - const char *arg) -{ - core_dir_config *d=d_; - - const char *err = ap_check_cmd_context(cmd, NOT_IN_LIMIT); - if (err != NULL) { - return err; - } - - if (strcasecmp(arg, "On") == 0) { - d->server_signature = srv_sig_on; - } - else if (strcasecmp(arg, "Off") == 0) { - d->server_signature = srv_sig_off; - } - else if (strcasecmp(arg, "EMail") == 0) { - d->server_signature = srv_sig_withmail; - } - else { - return "ServerSignature: use one of: off | on | email"; - } - return NULL; -} - -static const char *set_server_root(cmd_parms *cmd, void *dummy, - const char *arg) -{ - const char *err = ap_check_cmd_context(cmd, GLOBAL_ONLY); - - if (err != NULL) { - return err; - } - - arg = ap_os_canonical_filename(cmd->pool, arg); - - if (!ap_is_directory(cmd->pool, arg)) { - return "ServerRoot must be a valid directory"; - } - ap_server_root = arg; - return NULL; -} - -static const char *set_timeout(cmd_parms *cmd, void *dummy, const char *arg) -{ - const char *err = ap_check_cmd_context(cmd, NOT_IN_DIR_LOC_FILE|NOT_IN_LIMIT); - if (err != NULL) { - return err; - } - - cmd->server->timeout = atoi(arg); - return NULL; -} - -static const char *set_idcheck(cmd_parms *cmd, void *d_, int arg) -{ - core_dir_config *d=d_; - const char *err = ap_check_cmd_context(cmd, NOT_IN_LIMIT); - if (err != NULL) { - return err; - } - - d->do_rfc1413 = arg != 0; - return NULL; -} - -static const char *set_hostname_lookups(cmd_parms *cmd, void *d_, - const char *arg) -{ - core_dir_config *d=d_; - - const char *err = ap_check_cmd_context(cmd, NOT_IN_LIMIT); - if (err != NULL) { - return err; - } - - if (!strcasecmp(arg, "on")) { - d->hostname_lookups = HOSTNAME_LOOKUP_ON; - } - else if (!strcasecmp(arg, "off")) { - d->hostname_lookups = HOSTNAME_LOOKUP_OFF; - } - else if (!strcasecmp(arg, "double")) { - d->hostname_lookups = HOSTNAME_LOOKUP_DOUBLE; - } - else { - return "parameter must be 'on', 'off', or 'double'"; - } - return NULL; -} - -static const char *set_serverpath(cmd_parms *cmd, void *dummy, - const char *arg) -{ - const char *err = ap_check_cmd_context(cmd, NOT_IN_DIR_LOC_FILE|NOT_IN_LIMIT); - if (err != NULL) { - return err; - } - - cmd->server->path = arg; - cmd->server->pathlen = strlen(arg); - return NULL; -} - -static const char *set_content_md5(cmd_parms *cmd, void *d_, int arg) -{ - core_dir_config *d=d_; - const char *err = ap_check_cmd_context(cmd, NOT_IN_LIMIT); - if (err != NULL) { - return err; - } - - d->content_md5 = arg != 0; - return NULL; -} - -static const char *set_use_canonical_name(cmd_parms *cmd, void *d_, - const char *arg) -{ - core_dir_config *d=d_; - const char *err = ap_check_cmd_context(cmd, NOT_IN_LIMIT); - if (err != NULL) { - return err; - } - - if (strcasecmp(arg, "on") == 0) { - d->use_canonical_name = USE_CANONICAL_NAME_ON; - } - else if (strcasecmp(arg, "off") == 0) { - d->use_canonical_name = USE_CANONICAL_NAME_OFF; - } - else if (strcasecmp(arg, "dns") == 0) { - d->use_canonical_name = USE_CANONICAL_NAME_DNS; - } - else { - return "parameter must be 'on', 'off', or 'dns'"; - } - return NULL; -} - - -static const char *include_config (cmd_parms *cmd, void *dummy, - const char *name) -{ - ap_directive_t *conftree = NULL; - - ap_process_resource_config(cmd->server, - ap_server_root_relative(cmd->pool, name), - &conftree, cmd->pool, cmd->temp_pool); - *(ap_directive_t **)dummy = conftree; - return NULL; -} - -static const char *set_loglevel(cmd_parms *cmd, void *dummy, const char *arg) -{ - char *str; - - const char *err = ap_check_cmd_context(cmd, - NOT_IN_DIR_LOC_FILE|NOT_IN_LIMIT); - if (err != NULL) { - return err; - } - - if ((str = ap_getword_conf(cmd->pool, &arg))) { - if (!strcasecmp(str, "emerg")) { - cmd->server->loglevel = APLOG_EMERG; - } - else if (!strcasecmp(str, "alert")) { - cmd->server->loglevel = APLOG_ALERT; - } - else if (!strcasecmp(str, "crit")) { - cmd->server->loglevel = APLOG_CRIT; - } - else if (!strcasecmp(str, "error")) { - cmd->server->loglevel = APLOG_ERR; - } - else if (!strcasecmp(str, "warn")) { - cmd->server->loglevel = APLOG_WARNING; - } - else if (!strcasecmp(str, "notice")) { - cmd->server->loglevel = APLOG_NOTICE; - } - else if (!strcasecmp(str, "info")) { - cmd->server->loglevel = APLOG_INFO; - } - else if (!strcasecmp(str, "debug")) { - cmd->server->loglevel = APLOG_DEBUG; - } - else { - return "LogLevel requires level keyword: one of " - "emerg/alert/crit/error/warn/notice/info/debug"; - } - } - else { - return "LogLevel requires level keyword"; - } - - return NULL; -} - -AP_DECLARE(const char *) ap_psignature(const char *prefix, request_rec *r) -{ - char sport[20]; - core_dir_config *conf; - - conf = (core_dir_config *)ap_get_module_config(r->per_dir_config, - &core_module); - if ((conf->server_signature == srv_sig_off) - || (conf->server_signature == srv_sig_unset)) { - return ""; - } - - apr_snprintf(sport, sizeof sport, "%u", (unsigned) ap_get_server_port(r)); - - if (conf->server_signature == srv_sig_withmail) { - return apr_pstrcat(r->pool, prefix, "
    " AP_SERVER_BASEVERSION - " Server at server->server_admin, "\">", - ap_get_server_name(r), " Port ", sport, - "
    \n", NULL); - } - return apr_pstrcat(r->pool, prefix, "
    " AP_SERVER_BASEVERSION - " Server at ", ap_get_server_name(r), " Port ", sport, - "
    \n", NULL); -} - -/* - * Load an authorisation realm into our location configuration, applying the - * usual rules that apply to realms. - */ -static const char *set_authname(cmd_parms *cmd, void *mconfig, - const char *word1) -{ - core_dir_config *aconfig = (core_dir_config *)mconfig; - - aconfig->ap_auth_name = ap_escape_quotes(cmd->pool, word1); - return NULL; -} - -#ifdef _OSD_POSIX /* BS2000 Logon Passwd file */ -static const char *set_bs2000_account(cmd_parms *cmd, void *dummy, char *name) -{ - const char *err = ap_check_cmd_context(cmd, GLOBAL_ONLY); - if (err != NULL) { - return err; - } - - return os_set_account(cmd->pool, name); -} -#endif /*_OSD_POSIX*/ - -/* - * Handle a request to include the server's OS platform in the Server - * response header field (the ServerTokens directive). Unfortunately - * this requires a new global in order to communicate the setting back to - * http_main so it can insert the information in the right place in the - * string. - */ - -static char *server_version = NULL; -static int version_locked = 0; - -enum server_token_type { - SrvTk_MIN, /* eg: Apache/1.3.0 */ - SrvTk_OS, /* eg: Apache/1.3.0 (UNIX) */ - SrvTk_FULL, /* eg: Apache/1.3.0 (UNIX) PHP/3.0 FooBar/1.2b */ - SrvTk_PRODUCT_ONLY /* eg: Apache */ -}; -static enum server_token_type ap_server_tokens = SrvTk_FULL; - -static apr_status_t reset_version(void *dummy) -{ - version_locked = 0; - ap_server_tokens = SrvTk_FULL; - server_version = NULL; - return APR_SUCCESS; -} - -AP_DECLARE(const char *) ap_get_server_version(void) -{ - return (server_version ? server_version : AP_SERVER_BASEVERSION); -} - -AP_DECLARE(void) ap_add_version_component(apr_pool_t *pconf, const char *component) -{ - if (! version_locked) { - /* - * If the version string is null, register our cleanup to reset the - * pointer on pool destruction. We also know that, if NULL, - * we are adding the original SERVER_BASEVERSION string. - */ - if (server_version == NULL) { - apr_pool_cleanup_register(pconf, NULL, reset_version, - apr_pool_cleanup_null); - server_version = apr_pstrdup(pconf, component); - } - else { - /* - * Tack the given component identifier to the end of - * the existing string. - */ - server_version = apr_pstrcat(pconf, server_version, " ", - component, NULL); - } - } -} - -/* - * This routine adds the real server base identity to the version string, - * and then locks out changes until the next reconfig. - */ -static void ap_set_version(apr_pool_t *pconf) -{ - if (ap_server_tokens == SrvTk_PRODUCT_ONLY) { - ap_add_version_component(pconf, AP_SERVER_BASEPRODUCT); - } - else if (ap_server_tokens == SrvTk_MIN) { - ap_add_version_component(pconf, AP_SERVER_BASEVERSION); - } - else { - ap_add_version_component(pconf, AP_SERVER_BASEVERSION " (" PLATFORM ")"); - } - /* - * Lock the server_version string if we're not displaying - * the full set of tokens - */ - if (ap_server_tokens != SrvTk_FULL) { - version_locked++; - } -} - -static const char *set_serv_tokens(cmd_parms *cmd, void *dummy, - const char *arg) -{ - const char *err = ap_check_cmd_context(cmd, GLOBAL_ONLY); - if (err != NULL) { - return err; - } - - if (!strcasecmp(arg, "OS")) { - ap_server_tokens = SrvTk_OS; - } - else if (!strcasecmp(arg, "Min") || !strcasecmp(arg, "Minimal")) { - ap_server_tokens = SrvTk_MIN; - } - else if (!strcasecmp(arg, "Prod") || !strcasecmp(arg, "ProductOnly")) { - ap_server_tokens = SrvTk_PRODUCT_ONLY; - } - else { - ap_server_tokens = SrvTk_FULL; - } - return NULL; -} - -static const char *set_limit_req_line(cmd_parms *cmd, void *dummy, - const char *arg) -{ - const char *err = ap_check_cmd_context(cmd, - NOT_IN_DIR_LOC_FILE|NOT_IN_LIMIT); - int lim; - - if (err != NULL) { - return err; - } - lim = atoi(arg); - if (lim < 0) { - return apr_pstrcat(cmd->temp_pool, "LimitRequestLine \"", arg, - "\" must be a non-negative integer", NULL); - } - if (lim > DEFAULT_LIMIT_REQUEST_LINE) { - return apr_psprintf(cmd->temp_pool, "LimitRequestLine \"%s\" " - "must not exceed the precompiled maximum of %d", - arg, DEFAULT_LIMIT_REQUEST_LINE); - } - cmd->server->limit_req_line = lim; - return NULL; -} - -static const char *set_limit_req_fieldsize(cmd_parms *cmd, void *dummy, - const char *arg) -{ - const char *err = ap_check_cmd_context(cmd, - NOT_IN_DIR_LOC_FILE|NOT_IN_LIMIT); - int lim; - - if (err != NULL) { - return err; - } - lim = atoi(arg); - if (lim < 0) { - return apr_pstrcat(cmd->temp_pool, "LimitRequestFieldsize \"", arg, - "\" must be a non-negative integer (0 = no limit)", - NULL); - } - if (lim > DEFAULT_LIMIT_REQUEST_FIELDSIZE) { - return apr_psprintf(cmd->temp_pool, "LimitRequestFieldsize \"%s\" " - "must not exceed the precompiled maximum of %d", - arg, DEFAULT_LIMIT_REQUEST_FIELDSIZE); - } - cmd->server->limit_req_fieldsize = lim; - return NULL; -} - -static const char *set_limit_req_fields(cmd_parms *cmd, void *dummy, - const char *arg) -{ - const char *err = ap_check_cmd_context(cmd, - NOT_IN_DIR_LOC_FILE|NOT_IN_LIMIT); - int lim; - - if (err != NULL) { - return err; - } - lim = atoi(arg); - if (lim < 0) { - return apr_pstrcat(cmd->temp_pool, "LimitRequestFields \"", arg, - "\" must be a non-negative integer (0 = no limit)", - NULL); - } - cmd->server->limit_req_fields = lim; - return NULL; -} - -static const char *set_limit_req_body(cmd_parms *cmd, void *conf_, - const char *arg) -{ - core_dir_config *conf=conf_; - const char *err = ap_check_cmd_context(cmd, NOT_IN_LIMIT); - if (err != NULL) { - return err; - } - - /* WTF: If strtoul is not portable, then write a replacement. - * Instead we have an idiotic define in httpd.h that prevents - * it from being used even when it is available. Sheesh. - */ - conf->limit_req_body = (unsigned long)strtol(arg, (char **)NULL, 10); - return NULL; -} - -static const char *set_limit_xml_req_body(cmd_parms *cmd, void *conf_, - const char *arg) -{ - core_dir_config *conf = conf_; - const char *err = ap_check_cmd_context(cmd, NOT_IN_LIMIT); - if (err != NULL) { - return err; - } - - conf->limit_xml_body = atol(arg); - if (conf->limit_xml_body < 0) - return "LimitXMLRequestBody requires a non-negative integer."; - - return NULL; -} - -AP_DECLARE(size_t) ap_get_limit_xml_body(const request_rec *r) -{ - core_dir_config *conf; - - conf = ap_get_module_config(r->per_dir_config, &core_module); - if (conf->limit_xml_body == AP_LIMIT_UNSET) - return AP_DEFAULT_LIMIT_XML_BODY; - return (size_t)conf->limit_xml_body; -} - -#ifdef WIN32 -static const char *set_interpreter_source(cmd_parms *cmd, core_dir_config *d, - char *arg) -{ - if (!strcasecmp(arg, "registry")) { - d->script_interpreter_source = INTERPRETER_SOURCE_REGISTRY; - } else if (!strcasecmp(arg, "registry-strict")) { - d->script_interpreter_source = INTERPRETER_SOURCE_REGISTRY_STRICT; - } else if (!strcasecmp(arg, "script")) { - d->script_interpreter_source = INTERPRETER_SOURCE_SHEBANG; - } else { - return apr_pstrcat(cmd->temp_pool, "ScriptInterpreterSource \"", arg, - "\" must be \"registry\", \"registry-strict\" or " - "\"script\"", NULL); - } - return NULL; -} -#endif - -#if !defined (RLIMIT_CPU) || !(defined (RLIMIT_DATA) || defined (RLIMIT_VMEM) || defined(RLIMIT_AS)) || !defined (RLIMIT_NPROC) -static const char *no_set_limit(cmd_parms *cmd, void *conf_, - const char *arg, const char *arg2) -{ - ap_log_error(APLOG_MARK, APLOG_NOERRNO|APLOG_ERR, 0, cmd->server, - "%s not supported on this platform", cmd->cmd->name); - return NULL; -} -#endif - -#ifdef RLIMIT_CPU -static const char *set_limit_cpu(cmd_parms *cmd, void *conf_, - const char *arg, const char *arg2) -{ - core_dir_config *conf=conf_; - - unixd_set_rlimit(cmd, &conf->limit_cpu, arg, arg2, RLIMIT_CPU); - return NULL; -} -#endif - -#if defined (RLIMIT_DATA) || defined (RLIMIT_VMEM) || defined(RLIMIT_AS) -static const char *set_limit_mem(cmd_parms *cmd, void *conf_, - const char *arg, const char * arg2) -{ - core_dir_config *conf=conf_; - -#if defined(RLIMIT_AS) - unixd_set_rlimit(cmd, &conf->limit_mem, arg, arg2 ,RLIMIT_AS); -#elif defined(RLIMIT_DATA) - unixd_set_rlimit(cmd, &conf->limit_mem, arg, arg2, RLIMIT_DATA); -#elif defined(RLIMIT_VMEM) - unixd_set_rlimit(cmd, &conf->limit_mem, arg, arg2, RLIMIT_VMEM); -#endif - return NULL; -} -#endif - -#ifdef RLIMIT_NPROC -static const char *set_limit_nproc(cmd_parms *cmd, void *conf_, - const char *arg, const char * arg2) -{ - core_dir_config *conf=conf_; - - unixd_set_rlimit(cmd, &conf->limit_nproc, arg, arg2, RLIMIT_NPROC); - return NULL; -} -#endif - -static apr_status_t writev_it_all(apr_socket_t *s, - struct iovec *vec, int nvec, - apr_size_t len, apr_size_t *nbytes) -{ - apr_size_t bytes_written = 0; - apr_status_t rv; - apr_size_t n = len; - apr_size_t i = 0; - - *nbytes = 0; - - /* XXX handle checking for non-blocking socket */ - while (bytes_written != len) { - rv = apr_sendv(s, vec + i, nvec - i, &n); - bytes_written += n; - if (rv != APR_SUCCESS) - return rv; - *nbytes += n; - - /* If the write did not complete, adjust the iovecs and issue - * apr_sendv again - */ - if (bytes_written < len) { - /* Skip over the vectors that have already been written */ - apr_size_t cnt = vec[i].iov_len; - while (n >= cnt && i + 1 < nvec) { - i++; - cnt += vec[i].iov_len; - } - if (n < cnt) { - /* Handle partial write of vec i */ - vec[i].iov_base = (char *) vec[i].iov_base + - (vec[i].iov_len - (cnt - n)); - vec[i].iov_len = cnt -n; - } - } - n = len - bytes_written; - } - - return APR_SUCCESS; -} - -/* sendfile_it_all() - * send the entire file using sendfile() - * handle partial writes - * return only when all bytes have been sent or an error is encountered. - */ - -#if APR_HAS_SENDFILE -static apr_status_t sendfile_it_all(conn_rec *c, - apr_file_t *fd, - apr_hdtr_t *hdtr, - apr_off_t file_offset, - apr_size_t file_bytes_left, - apr_size_t total_bytes_left, - apr_int32_t flags) -{ - apr_status_t rv; -#ifdef AP_DEBUG - apr_int32_t timeout = 0; -#endif - - AP_DEBUG_ASSERT((apr_getsocketopt(c->client_socket, APR_SO_TIMEOUT, - &timeout) == APR_SUCCESS) && - timeout > 0); /* socket must be in timeout mode */ - do { - apr_size_t tmplen = file_bytes_left; - - rv = apr_sendfile(c->client_socket, fd, hdtr, &file_offset, &tmplen, - flags); - total_bytes_left -= tmplen; - if (!total_bytes_left || rv != APR_SUCCESS) { - return rv; /* normal case & error exit */ - } - - AP_DEBUG_ASSERT(total_bytes_left > 0 && tmplen > 0); - - /* partial write, oooh noooo... - * Skip over any header data which was written - */ - while (tmplen && hdtr->numheaders) { - if (tmplen >= hdtr->headers[0].iov_len) { - tmplen -= hdtr->headers[0].iov_len; - --hdtr->numheaders; - ++hdtr->headers; - } - else { - char *iov_base = (char *)hdtr->headers[0].iov_base; - - hdtr->headers[0].iov_len -= tmplen; - iov_base += tmplen; - hdtr->headers[0].iov_base = iov_base; - tmplen = 0; - } - } - - /* Skip over any file data which was written */ - - if (tmplen <= file_bytes_left) { - file_offset += tmplen; - file_bytes_left -= tmplen; - continue; - } - tmplen -= file_bytes_left; - file_bytes_left = 0; - file_offset = 0; - - /* Skip over any trailer data which was written */ - - while (tmplen && hdtr->numtrailers) { - if (tmplen >= hdtr->trailers[0].iov_len) { - tmplen -= hdtr->trailers[0].iov_len; - --hdtr->numtrailers; - ++hdtr->trailers; - } - else { - char *iov_base = (char *)hdtr->trailers[0].iov_base; - - hdtr->trailers[0].iov_len -= tmplen; - iov_base += tmplen; - hdtr->trailers[0].iov_base = iov_base; - tmplen = 0; - } - } - } while (1); -} -#endif - -/* - * send_the_file() - * Sends the contents of file fd along with header/trailer bytes, if any, - * to the network. send_the_file will return only when all the bytes have been - * sent (i.e., it handles partial writes) or on a network error condition. - */ -static apr_status_t send_the_file(conn_rec *c, apr_file_t *fd, - apr_hdtr_t *hdtr, apr_off_t offset, - apr_size_t length, apr_size_t *nbytes) -{ - apr_status_t rv = APR_SUCCESS; - apr_int32_t togo; /* Remaining number of bytes in the file to send */ - apr_size_t sendlen = 0; - apr_size_t bytes_sent; - apr_int32_t i; - apr_off_t o; /* Track the file offset for partial writes */ - char buffer[8192]; - - *nbytes = 0; - - /* Send the headers - * writev_it_all handles partial writes. - * XXX: optimization... if headers are less than MIN_WRITE_SIZE, copy - * them into buffer - */ - if ( hdtr && hdtr->numheaders > 0 ) { - for (i = 0; i < hdtr->numheaders; i++) { - sendlen += hdtr->headers[i].iov_len; - } - rv = writev_it_all(c->client_socket, hdtr->headers, hdtr->numheaders, - sendlen, &bytes_sent); - if (rv == APR_SUCCESS) - *nbytes += bytes_sent; /* track total bytes sent */ - } - - /* Seek the file to 'offset' */ - if (offset != 0 && rv == APR_SUCCESS) { - rv = apr_file_seek(fd, APR_SET, &offset); - } - - /* Send the file, making sure to handle partial writes */ - togo = length; - while (rv == APR_SUCCESS && togo) { - sendlen = togo > sizeof(buffer) ? sizeof(buffer) : togo; - o = 0; - rv = apr_file_read(fd, buffer, &sendlen); - while (rv == APR_SUCCESS && sendlen) { - bytes_sent = sendlen; - rv = apr_send(c->client_socket, &buffer[o], &bytes_sent); - if (rv == APR_SUCCESS) { - sendlen -= bytes_sent; /* sendlen != bytes_sent ==> partial write */ - o += bytes_sent; /* o is where we are in the buffer */ - *nbytes += bytes_sent; - togo -= bytes_sent; /* track how much of the file we've sent */ - } - } - } - - /* Send the trailers - * XXX: optimization... if it will fit, send this on the last send in the - * loop above - */ - sendlen = 0; - if ( rv == APR_SUCCESS && hdtr && hdtr->numtrailers > 0 ) { - for (i = 0; i < hdtr->numtrailers; i++) { - sendlen += hdtr->trailers[i].iov_len; - } - rv = writev_it_all(c->client_socket, hdtr->trailers, hdtr->numtrailers, - sendlen, &bytes_sent); - if (rv == APR_SUCCESS) - *nbytes += bytes_sent; - } - - return rv; -} - -/* Note --- ErrorDocument will now work from .htaccess files. - * The AllowOverride of Fileinfo allows webmasters to turn it off - */ - -static const command_rec core_cmds[] = { - -/* Old access config file commands */ - -AP_INIT_RAW_ARGS("server->module_config; - core_server_config *conf = ap_get_module_config(sconf, &core_module); - - if (r->proxyreq) { - return HTTP_FORBIDDEN; - } - if ((r->uri[0] != '/') && strcmp(r->uri, "*")) { - ap_log_rerror(APLOG_MARK, APLOG_NOERRNO|APLOG_ERR, 0, r, - "Invalid URI in request %s", r->the_request); - return HTTP_BAD_REQUEST; - } - - if (r->server->path - && !strncmp(r->uri, r->server->path, r->server->pathlen) - && (r->server->path[r->server->pathlen - 1] == '/' - || r->uri[r->server->pathlen] == '/' - || r->uri[r->server->pathlen] == '\0')) { - r->filename = apr_pstrcat(r->pool, conf->ap_document_root, - (r->uri + r->server->pathlen), NULL); - } - else { - /* - * Make sure that we do not mess up the translation by adding two - * /'s in a row. This happens under windows when the document - * root ends with a / - */ - if ((conf->ap_document_root[strlen(conf->ap_document_root)-1] == '/') - && (*(r->uri) == '/')) { - r->filename = apr_pstrcat(r->pool, conf->ap_document_root, r->uri+1, - NULL); - } - else { - r->filename = apr_pstrcat(r->pool, conf->ap_document_root, r->uri, - NULL); - } - } - - return OK; -} - -static int do_nothing(request_rec *r) { return OK; } - -static int default_handler(request_rec *r) -{ - apr_bucket_brigade *bb; - apr_bucket *e; - core_dir_config *d; - int errstatus; - apr_file_t *fd = NULL; - apr_status_t status; - /* XXX if/when somebody writes a content-md5 filter we either need to - * remove this support or coordinate when to use the filter vs. - * when to use this code - * The current choice of when to compute the md5 here matches the 1.3 - * support fairly closely (unlike 1.3, we don't handle computing md5 - * when the charset is translated). - */ - int bld_content_md5; - - /* - * The old way of doing handlers meant that this handler would - * match literally anything - this way will require handler to - * have a / in the middle, which probably captures the original - * intent, but may cause problems at first - Ben 7th Jan 01 - */ - if(strcmp(r->handler,"default-handler") - && ap_strcmp_match(r->handler,"*/*")) - return DECLINED; - - d = (core_dir_config *)ap_get_module_config(r->per_dir_config, - &core_module); - bld_content_md5 = (d->content_md5 & 1) - && r->output_filters->frec->ftype != AP_FTYPE_CONTENT; - - ap_allow_methods(r, MERGE_ALLOW, "GET", "OPTIONS", "POST", NULL); - - if ((errstatus = ap_discard_request_body(r)) != OK) { - return errstatus; - } - - if (r->method_number == M_INVALID) { - ap_log_rerror(APLOG_MARK, APLOG_NOERRNO|APLOG_ERR, 0, r, - "Invalid method in request %s", r->the_request); - return HTTP_NOT_IMPLEMENTED; - } - if (r->method_number == M_OPTIONS) { - return ap_send_http_options(r); - } - if (r->method_number == M_PUT) { - return HTTP_METHOD_NOT_ALLOWED; - } - if (r->finfo.filetype == 0 || (r->path_info && *r->path_info)) { - ap_log_rerror(APLOG_MARK, APLOG_ERR|APLOG_NOERRNO, 0, r, - "File does not exist: %s",r->path_info ? - apr_pstrcat(r->pool, r->filename, r->path_info, NULL) - : r->filename); - return HTTP_NOT_FOUND; - } - - if (r->method_number != M_GET && r->method_number != M_POST) { - return HTTP_METHOD_NOT_ALLOWED; - } - - if ((status = apr_file_open(&fd, r->filename, APR_READ | APR_BINARY, 0, r->connection->pool)) != APR_SUCCESS) { - ap_log_rerror(APLOG_MARK, APLOG_ERR, status, r, - "file permissions deny server access: %s", r->filename); - return HTTP_FORBIDDEN; - } - ap_update_mtime(r, r->finfo.mtime); - ap_set_last_modified(r); - ap_set_etag(r); - apr_table_setn(r->headers_out, "Accept-Ranges", "bytes"); - ap_set_content_length(r, r->finfo.size); - if ((errstatus = ap_meets_conditions(r)) != OK) { - apr_file_close(fd); - return errstatus; - } - - if (bld_content_md5) { - apr_table_setn(r->headers_out, "Content-MD5", - ap_md5digest(r->pool, fd)); - } - - bb = apr_brigade_create(r->pool); - e = apr_bucket_file_create(fd, 0, r->finfo.size); - - APR_BRIGADE_INSERT_HEAD(bb, e); - e = apr_bucket_eos_create(); - APR_BRIGADE_INSERT_TAIL(bb, e); - - return ap_pass_brigade(r->output_filters, bb); -} - -static int core_input_filter(ap_filter_t *f, apr_bucket_brigade *b, ap_input_mode_t mode) -{ - apr_bucket *e; - - if (!f->ctx) { /* If we haven't passed up the socket yet... */ - f->ctx = (void *)1; - e = apr_bucket_socket_create(f->c->client_socket); - APR_BRIGADE_INSERT_TAIL(b, e); - return APR_SUCCESS; - } - else { - /* Either some code lost track of the socket - * bucket or we already found out that the - * client closed. - */ - return APR_EOF; - } -} - -/* Default filter. This filter should almost always be used. Its only job - * is to send the headers if they haven't already been sent, and then send - * the actual data. - */ -typedef struct CORE_OUTPUT_FILTER_CTX { - apr_bucket_brigade *b; -} core_output_filter_ctx_t; - -#define MAX_IOVEC_TO_WRITE 16 - -static apr_status_t core_output_filter(ap_filter_t *f, apr_bucket_brigade *b) -{ - apr_status_t rv; - conn_rec *c = f->c; - core_output_filter_ctx_t *ctx = f->ctx; - - if (ctx == NULL) { - f->ctx = ctx = apr_pcalloc(c->pool, sizeof(core_output_filter_ctx_t)); - } - - /* If we have a saved brigade, concatenate the new brigade to it */ - if (ctx->b) { - APR_BRIGADE_CONCAT(ctx->b, b); - b = ctx->b; - ctx->b = NULL; - } - - /* Perform multiple passes over the brigade, sending batches of output - to the connection. */ - while (b) { - apr_size_t nbytes = 0; - apr_bucket *e; - - /* tail of brigade if we need another pass */ - apr_bucket_brigade *more = NULL; - - /* one group of iovecs per pass over the brigade */ - apr_size_t nvec = 0; - apr_size_t nvec_trailers = 0; - struct iovec vec[MAX_IOVEC_TO_WRITE]; - struct iovec vec_trailers[MAX_IOVEC_TO_WRITE]; - - /* one file per pass over the brigade */ - apr_file_t *fd = NULL; - apr_size_t flen = 0; - apr_off_t foffset = 0; - - /* Iterate over the brigade: collect iovecs and/or a file */ - APR_BRIGADE_FOREACH(e, b) { - if (APR_BUCKET_IS_EOS(e) || APR_BUCKET_IS_FLUSH(e)) { - break; - } - /* It doesn't make any sense to use sendfile for a file bucket - * that represents 10 bytes. - */ - else if (APR_BUCKET_IS_FILE(e) - && (e->length >= AP_MIN_SENDFILE_BYTES)) { - apr_bucket_file *a = e->data; - - /* We can't handle more than one file bucket at a time - * so we split here and send the file we have already - * found. - */ - if (fd) { - more = apr_brigade_split(b, e); - break; - } - - fd = a->fd; - flen = e->length; - foffset = e->start; - } - else { - const char *str; - apr_size_t n; - - rv = apr_bucket_read(e, &str, &n, APR_BLOCK_READ); - if (n) { - nbytes += n; - if (!fd) { - vec[nvec].iov_base = (char*) str; - vec[nvec].iov_len = n; - nvec++; - } - else { - /* The bucket is a trailer to a file bucket */ - vec_trailers[nvec_trailers].iov_base = (char*) str; - vec_trailers[nvec_trailers].iov_len = n; - nvec_trailers++; - } - } - } - - if ((nvec == MAX_IOVEC_TO_WRITE) || - (nvec_trailers == MAX_IOVEC_TO_WRITE)) { - /* Split the brigade and break */ - if (APR_BUCKET_NEXT(e) != APR_BRIGADE_SENTINEL(b)) { - more = apr_brigade_split(b, APR_BUCKET_NEXT(e)); - } - break; - } - } - - /* Completed iterating over the brigades, now determine if we want - * to buffer the brigade or send the brigade out on the network. - * - * Save if: - * - * 1) we didn't see a file, we don't have more passes over the - * brigade to perform, we haven't accumulated enough bytes to - * send, AND we didn't stop at a FLUSH bucket. - * (IOW, we will save away plain old bytes) - * or - * 2) we hit the EOS and have a keep-alive connection - * (IOW, this response is a bit more complex, but we save it - * with the hope of concatenating with another response) - */ - if ((!fd && !more && - (nbytes < AP_MIN_BYTES_TO_WRITE) && !APR_BUCKET_IS_FLUSH(e)) - || (APR_BUCKET_IS_EOS(e) && c->keepalive)) { - - /* NEVER save an EOS in here. If we are saving a brigade with - * an EOS bucket, then we are doing keepalive connections, and - * we want to process to second request fully. - */ - if (APR_BUCKET_IS_EOS(e)) { - apr_bucket_delete(e); - } - ap_save_brigade(f, &ctx->b, &b); - return APR_SUCCESS; - } - - if (fd) { - apr_hdtr_t hdtr; -#if APR_HAS_SENDFILE - apr_int32_t flags = 0; -#endif - - memset(&hdtr, '\0', sizeof(hdtr)); - if (nvec) { - hdtr.numheaders = nvec; - hdtr.headers = vec; - } - if (nvec_trailers) { - hdtr.numtrailers = nvec_trailers; - hdtr.trailers = vec_trailers; - } -#if APR_HAS_SENDFILE - if (!c->keepalive) { - /* Prepare the socket to be reused */ - flags |= APR_SENDFILE_DISCONNECT_SOCKET; - } - rv = sendfile_it_all(c, /* the connection */ - fd, /* the file to send */ - &hdtr, /* header and trailer iovecs */ - foffset, /* offset in the file to begin - sending from */ - flen, /* length of file */ - nbytes + flen, /* total length including - headers */ - flags); /* apr_sendfile flags */ - - /* If apr_sendfile() returns APR_ENOTIMPL, call send_the_file() - * to loop on apr_file_read/apr_send to send the file. Our Windows - * binary distributions (which work on Windows 9x/NT) are - * compiled on Windows NT. TransmitFile is not available on - * Windows 95/98 and we discover this at runtime when - * apr_sendfile() returns APR_ENOTIMPL. Having apr_sendfile() - * return APR_ENOTIMPL seems the cleanest way to handle this - * case. - */ - if (rv == APR_ENOTIMPL) -#endif - { - apr_size_t unused_bytes_sent; - - rv = send_the_file(c, fd, &hdtr, foffset, flen, - &unused_bytes_sent); - } - fd = NULL; - } - else { - apr_size_t unused_bytes_sent; - - rv = writev_it_all(c->client_socket, - vec, nvec, - nbytes, &unused_bytes_sent); - } - - apr_brigade_destroy(b); - if (rv != APR_SUCCESS) { - /* XXX: log the error */ - if (more) - apr_brigade_destroy(more); - return rv; - } - - b = more; - more = NULL; - } /* end while () */ - - return APR_SUCCESS; -} - -static void core_post_config(apr_pool_t *pconf, apr_pool_t *plog, apr_pool_t *ptemp, server_rec *s) -{ - ap_set_version(pconf); -} - -static void core_open_logs(apr_pool_t *pconf, apr_pool_t *plog, apr_pool_t *ptemp, server_rec *s) -{ - ap_open_logs(s, pconf); -} - -static void core_insert_filter(request_rec *r) -{ - int i; - core_dir_config *conf = (core_dir_config *) - ap_get_module_config(r->per_dir_config, - &core_module); - char **items = (char **)conf->output_filters->elts; - - for (i = 0; i < conf->output_filters->nelts; i++) { - char *foobar = items[i]; - ap_add_output_filter(foobar, NULL, r, r->connection); - } - - items = (char **)conf->input_filters->elts; - for (i = 0; i < conf->input_filters->nelts; i++) { - char *foobar = items[i]; - ap_add_input_filter(foobar, NULL, r, r->connection); - } -} - -static void register_hooks(apr_pool_t *p) -{ - ap_hook_post_config(core_post_config,NULL,NULL,APR_HOOK_REALLY_FIRST); - ap_hook_translate_name(ap_core_translate,NULL,NULL,APR_HOOK_REALLY_LAST); - ap_hook_open_logs(core_open_logs,NULL,NULL,APR_HOOK_MIDDLE); - ap_hook_handler(default_handler,NULL,NULL,APR_HOOK_REALLY_LAST); - /* FIXME: I suspect we can eliminate the need for these - Ben */ - ap_hook_type_checker(do_nothing,NULL,NULL,APR_HOOK_REALLY_LAST); - ap_hook_access_checker(do_nothing,NULL,NULL,APR_HOOK_REALLY_LAST); - - /* register the core's insert_filter hook and register core-provided - * filters - */ - ap_hook_insert_filter(core_insert_filter, NULL, NULL, APR_HOOK_MIDDLE); - - ap_register_input_filter("CORE_IN", core_input_filter, AP_FTYPE_NETWORK); - ap_register_output_filter("CONTENT_LENGTH", ap_content_length_filter, - AP_FTYPE_HTTP_HEADER); - ap_register_output_filter("BYTERANGE", ap_byterange_filter, - AP_FTYPE_HTTP_HEADER); - ap_register_output_filter("CORE", core_output_filter, AP_FTYPE_NETWORK); - ap_register_output_filter("SUBREQ_CORE", ap_sub_req_output_filter, - AP_FTYPE_CONTENT); - ap_register_output_filter("OLD_WRITE", ap_old_write_filter, - AP_FTYPE_CONTENT - 1); -} - -AP_DECLARE_DATA module core_module = { - STANDARD20_MODULE_STUFF, - create_core_dir_config, /* create per-directory config structure */ - merge_core_dir_configs, /* merge per-directory config structures */ - create_core_server_config, /* create per-server config structure */ - merge_core_server_configs, /* merge per-server config structures */ - core_cmds, /* command apr_table_t */ - register_hooks /* register hooks */ -}; diff --git a/server/error_bucket.c b/server/error_bucket.c deleted file mode 100644 index 071119882be7b364d4618473f7479ce249e1c512..0000000000000000000000000000000000000000 --- a/server/error_bucket.c +++ /dev/null @@ -1,104 +0,0 @@ -/* ==================================================================== - * The Apache Software License, Version 1.1 - * - * Copyright (c) 2000-2001 The Apache Software Foundation. All rights - * reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in - * the documentation and/or other materials provided with the - * distribution. - * - * 3. The end-user documentation included with the redistribution, - * if any, must include the following acknowledgment: - * "This product includes software developed by the - * Apache Software Foundation (http://www.apache.org/)." - * Alternately, this acknowledgment may appear in the software itself, - * if and wherever such third-party acknowledgments normally appear. - * - * 4. The names "Apache" and "Apache Software Foundation" must - * not be used to endorse or promote products derived from this - * software without prior written permission. For written - * permission, please contact apache@apache.org. - * - * 5. Products derived from this software may not be called "Apache", - * nor may "Apache" appear in their name, without prior written - * permission of the Apache Software Foundation. - * - * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED - * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES - * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR - * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF - * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND - * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, - * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT - * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * ==================================================================== - * - * This software consists of voluntary contributions made by many - * individuals on behalf of the Apache Software Foundation. For more - * information on the Apache Software Foundation, please see - * . - */ - -#include "http_protocol.h" -#include "apr_buckets.h" -#include "apr_strings.h" -#include -#if APR_HAVE_STRINGS_H -#include -#endif - -static apr_status_t error_read(apr_bucket *b, const char **str, - apr_size_t *len, apr_read_type_e block) -{ - *str = NULL; - *len = 0; - return APR_SUCCESS; -} - -AP_DECLARE(apr_bucket *) ap_bucket_error_make(apr_bucket *b, int error, - const char *buf, apr_pool_t *p) -{ - ap_bucket_error *h; - - h = malloc(sizeof(*h)); - if (h == NULL) { - return NULL; - } - h->status = error; - if (buf) { - h->start = apr_pstrdup(p, buf); - } - - b->length = 0; - b->type = &ap_bucket_type_error; - b->data = h; - return b; -} - -AP_DECLARE(apr_bucket *) ap_bucket_error_create(int error, - const char *buf, apr_pool_t *p) -{ - apr_bucket_do_create(ap_bucket_error_make(b, error, buf, p)); -} - -AP_DECLARE_DATA const apr_bucket_type_t ap_bucket_type_error = { - "ERROR", 5, - free, - error_read, - apr_bucket_setaside_notimpl, - apr_bucket_split_notimpl, - apr_bucket_copy_notimpl -}; diff --git a/server/gen_test_char.c b/server/gen_test_char.c deleted file mode 100644 index dc33a73d86bf7a53c48b1b8f063e60b8cdf908d2..0000000000000000000000000000000000000000 --- a/server/gen_test_char.c +++ /dev/null @@ -1,62 +0,0 @@ -/* we need some of the portability definitions... for strchr */ -#include "httpd.h" - -/* A bunch of functions in util.c scan strings looking for certain characters. - * To make that more efficient we encode a lookup table. - */ -#define T_ESCAPE_SHELL_CMD (0x01) -#define T_ESCAPE_PATH_SEGMENT (0x02) -#define T_OS_ESCAPE_PATH (0x04) -#define T_HTTP_TOKEN_STOP (0x08) - -int main(int argc, char *argv[]) -{ - unsigned c; - unsigned char flags; - - printf( -"/* this file is automatically generated by gen_test_char, do not edit */\n" -"#define T_ESCAPE_SHELL_CMD (%u)\n" -"#define T_ESCAPE_PATH_SEGMENT (%u)\n" -"#define T_OS_ESCAPE_PATH (%u)\n" -"#define T_HTTP_TOKEN_STOP (%u)\n" -"\n" -"static const unsigned char test_char_table[256] = {\n" -" 0,", - T_ESCAPE_SHELL_CMD, - T_ESCAPE_PATH_SEGMENT, - T_OS_ESCAPE_PATH, - T_HTTP_TOKEN_STOP); - - /* we explicitly dealt with NUL above - * in case some strchr() do bogosity with it */ - - for (c = 1; c < 256; ++c) { - flags = 0; - if (c % 20 == 0) - printf("\n "); - - /* escape_shell_cmd */ - if (strchr("&;`'\"|*?~<>^()[]{}$\\\n", c)) { - flags |= T_ESCAPE_SHELL_CMD; - } - - if (!ap_isalnum(c) && !strchr("$-_.+!*'(),:@&=~", c)) { - flags |= T_ESCAPE_PATH_SEGMENT; - } - - if (!ap_isalnum(c) && !strchr("$-_.+!*'(),:@&=/~", c)) { - flags |= T_OS_ESCAPE_PATH; - } - - /* these are the "tspecials" from RFC2068 */ - if (ap_iscntrl(c) || strchr(" \t()<>@,;:\\/[]?={}", c)) { - flags |= T_HTTP_TOKEN_STOP; - } - printf("%u%c", flags, (c < 255) ? ',' : ' '); - - } - printf("\n};\n"); - - return 0; -} diff --git a/server/gen_test_char.dsp b/server/gen_test_char.dsp deleted file mode 100644 index c2630ce9d146e97e54dbf23916c4cc9722f743b8..0000000000000000000000000000000000000000 --- a/server/gen_test_char.dsp +++ /dev/null @@ -1,105 +0,0 @@ -# Microsoft Developer Studio Project File - Name="gen_test_char" - Package Owner=<4> -# Microsoft Developer Studio Generated Build File, Format Version 5.00 -# ** DO NOT EDIT ** - -# TARGTYPE "Win32 (x86) Console Application" 0x0103 - -CFG=gen_test_char - Win32 Debug -!MESSAGE This is not a valid makefile. To build this project using NMAKE, -!MESSAGE use the Export Makefile command and run -!MESSAGE -!MESSAGE NMAKE /f "gen_test_char.mak". -!MESSAGE -!MESSAGE You can specify a configuration when running NMAKE -!MESSAGE by defining the macro CFG on the command line. For example: -!MESSAGE -!MESSAGE NMAKE /f "gen_test_char.mak" CFG="gen_test_char - Win32 Debug" -!MESSAGE -!MESSAGE Possible choices for configuration are: -!MESSAGE -!MESSAGE "gen_test_char - Win32 Release" (based on\ - "Win32 (x86) Console Application") -!MESSAGE "gen_test_char - Win32 Debug" (based on\ - "Win32 (x86) Console Application") -!MESSAGE - -# Begin Project -# PROP Scc_ProjName "" -# PROP Scc_LocalPath "" -CPP=cl.exe -RSC=rc.exe - -!IF "$(CFG)" == "gen_test_char - Win32 Release" - -# PROP BASE Use_MFC 0 -# PROP BASE Use_Debug_Libraries 0 -# PROP BASE Output_Dir "gen_test" -# PROP BASE Intermediate_Dir "gen_test" -# PROP BASE Target_Dir "" -# PROP Use_MFC 0 -# PROP Use_Debug_Libraries 0 -# PROP Output_Dir "" -# PROP Intermediate_Dir "gen_test_char_R" -# PROP Ignore_Export_Lib 0 -# PROP Target_Dir "" -# ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c -# ADD CPP /nologo /W3 /GX /O2 /I "..\include" /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c -# ADD BASE RSC /l 0x809 /d "NDEBUG" -# ADD RSC /l 0x809 /d "NDEBUG" -BSC32=bscmake.exe -# ADD BASE BSC32 /nologo -# ADD BSC32 /nologo -LINK32=link.exe -# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /machine:I386 -# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib /nologo /subsystem:console /machine:I386 -# Begin Special Build Tool -SOURCE=$(InputPath) -PostBuild_Desc=Create test_char.h -PostBuild_Cmds=.\gen_test_char > test_char.h -# End Special Build Tool - -!ELSEIF "$(CFG)" == "gen_test_char - Win32 Debug" - -# PROP BASE Use_MFC 0 -# PROP BASE Use_Debug_Libraries 1 -# PROP BASE Output_Dir "gen_tes0" -# PROP BASE Intermediate_Dir "gen_tes0" -# PROP BASE Target_Dir "" -# PROP Use_MFC 0 -# PROP Use_Debug_Libraries 1 -# PROP Output_Dir "" -# PROP Intermediate_Dir "gen_test_char_D" -# PROP Ignore_Export_Lib 0 -# PROP Target_Dir "" -# ADD BASE CPP /nologo /W3 /Gm /GX /Zi /Od /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c -# ADD CPP /nologo /W3 /Gm /GX /Zi /Od /I "..\include" /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c -# ADD BASE RSC /l 0x809 /d "_DEBUG" -# ADD RSC /l 0x809 /d "_DEBUG" -BSC32=bscmake.exe -# ADD BASE BSC32 /nologo -# ADD BSC32 /nologo -LINK32=link.exe -# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept -# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept -# Begin Special Build Tool -SOURCE=$(InputPath) -PostBuild_Desc=Create test_char.h -PostBuild_Cmds=.\gen_test_char > test_char.h -# End Special Build Tool - -!ENDIF - -# Begin Target - -# Name "gen_test_char - Win32 Release" -# Name "gen_test_char - Win32 Debug" -# Begin Group "Source Files" - -# PROP Default_Filter "" -# Begin Source File - -SOURCE=.\gen_test_char.c -# End Source File -# End Group -# End Target -# End Project diff --git a/server/listen.c b/server/listen.c deleted file mode 100644 index 9f7c121b7345a51a3a09d8b1cbeb9f7bad783081..0000000000000000000000000000000000000000 --- a/server/listen.c +++ /dev/null @@ -1,310 +0,0 @@ -/* ==================================================================== - * Copyright (c) 1998-1999 The Apache Group. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in - * the documentation and/or other materials provided with the - * distribution. - * - * 3. All advertising materials mentioning features or use of this - * software must display the following acknowledgment: - * "This product includes software developed by the Apache Group - * for use in the Apache HTTP server project (http://www.apache.org/)." - * - * 4. The names "Apache Server" and "Apache Group" must not be used to - * endorse or promote products derived from this software without - * prior written permission. For written permission, please contact - * apache@apache.org. - * - * 5. Products derived from this software may not be called "Apache" - * nor may "Apache" appear in their names without prior written - * permission of the Apache Group. - * - * 6. Redistributions of any form whatsoever must retain the following - * acknowledgment: - * "This product includes software developed by the Apache Group - * for use in the Apache HTTP server project (http://www.apache.org/)." - * - * THIS SOFTWARE IS PROVIDED BY THE APACHE GROUP ``AS IS'' AND ANY - * EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR - * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE APACHE GROUP OR - * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT - * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, - * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED - * OF THE POSSIBILITY OF SUCH DAMAGE. - * ==================================================================== - * - * This software consists of voluntary contributions made by many - * individuals on behalf of the Apache Group and was originally based - * on public domain software written at the National Center for - * Supercomputing Applications, University of Illinois, Urbana-Champaign. - * For more information on the Apache Group and the Apache HTTP server - * project, please see . - * - */ - -#include "httpd.h" -#include "http_config.h" -#include "ap_listen.h" -#include "http_log.h" - -ap_listen_rec *ap_listeners; -static ap_listen_rec *old_listeners; -static int ap_listenbacklog; -static int send_buffer_size; - -/* TODO: make_sock is just begging and screaming for APR abstraction */ -static int make_sock(const struct sockaddr_in *server) -{ - int s; - int one = 1; - char addr[512]; - - if (server->sin_addr.s_addr != htonl(INADDR_ANY)) - ap_snprintf(addr, sizeof(addr), "address %s port %d", - inet_ntoa(server->sin_addr), ntohs(server->sin_port)); - else - ap_snprintf(addr, sizeof(addr), "port %d", ntohs(server->sin_port)); - - if ((s = socket(AF_INET, SOCK_STREAM, IPPROTO_TCP)) == -1) { - ap_log_error(APLOG_MARK, APLOG_CRIT, NULL, - "make_sock: failed to get a socket for %s", addr); - return -1; - } - -#ifdef SO_REUSEADDR - if (setsockopt(s, SOL_SOCKET, SO_REUSEADDR, (char *) &one, sizeof(int)) < 0) { - ap_log_error(APLOG_MARK, APLOG_CRIT, NULL, - "make_sock: for %s, setsockopt: (SO_REUSEADDR)", addr); - close(s); - return -1; - } -#endif - one = 1; -#ifdef SO_KEEPALIVE - if (setsockopt(s, SOL_SOCKET, SO_KEEPALIVE, (char *) &one, sizeof(int)) < 0) { - ap_log_error(APLOG_MARK, APLOG_CRIT, NULL, - "make_sock: for %s, setsockopt: (SO_KEEPALIVE)", addr); - close(s); - return -1; - } -#endif - - /* - * To send data over high bandwidth-delay connections at full - * speed we must force the TCP window to open wide enough to keep the - * pipe full. The default window size on many systems - * is only 4kB. Cross-country WAN connections of 100ms - * at 1Mb/s are not impossible for well connected sites. - * If we assume 100ms cross-country latency, - * a 4kB buffer limits throughput to 40kB/s. - * - * To avoid this problem I've added the SendBufferSize directive - * to allow the web master to configure send buffer size. - * - * The trade-off of larger buffers is that more kernel memory - * is consumed. YMMV, know your customers and your network! - * - * -John Heidemann 25-Oct-96 - * - * If no size is specified, use the kernel default. - */ -#ifndef SO_SNDBUF - if (send_buffer_size) { - if (setsockopt(s, SOL_SOCKET, SO_SNDBUF, - (char *) &send_buffer_size, sizeof(int)) < 0) { - ap_log_error(APLOG_MARK, APLOG_WARNING, NULL, - "make_sock: failed to set SendBufferSize for %s, " - "using default", addr); - /* not a fatal error */ - } - } -#endif - - if (bind(s, (struct sockaddr *) server, sizeof(struct sockaddr_in)) == -1) { - ap_log_error(APLOG_MARK, APLOG_CRIT, NULL, - "make_sock: could not bind to %s", addr); - close(s); - return -1; - } - - if (listen(s, ap_listenbacklog) == -1) { - ap_log_error(APLOG_MARK, APLOG_ERR, NULL, - "make_sock: unable to listen for connections on %s", addr); - close(s); - return -1; - } - - return s; -} - - -static void close_listeners_on_exec(void *v) -{ - ap_listen_rec *lr; - - for (lr = ap_listeners; lr; lr = lr->next) { - close(lr->fd); - } -} - - -static void alloc_listener(struct sockaddr_in *local_addr) -{ - ap_listen_rec **walk; - ap_listen_rec *new; - - /* see if we've got an old listener for this address:port */ - for (walk = &old_listeners; *walk; walk = &(*walk)->next) { - if (!memcmp(&(*walk)->local_addr, local_addr, sizeof(local_addr))) { - /* re-use existing record */ - new = *walk; - *walk = new->next; - new->next = ap_listeners; - ap_listeners = new; - return; - } - } - - /* this has to survive restarts */ - new = malloc(sizeof(ap_listen_rec)); - new->local_addr = *local_addr; - new->fd = -1; - new->next = ap_listeners; - ap_listeners = new; -} - - -int ap_listen_open(pool *pconf, unsigned port) -{ - ap_listen_rec *lr; - ap_listen_rec *next; - int num_open; - struct sockaddr_in local_addr; - - /* allocate a default listener if necessary */ - if (ap_listeners == NULL) { - local_addr.sin_family = AF_INET; - local_addr.sin_addr.s_addr = htonl(INADDR_ANY); /* XXX */ - local_addr.sin_port = htons(port ? port : DEFAULT_HTTP_PORT); - alloc_listener(&local_addr); - } - - num_open = 0; - for (lr = ap_listeners; lr; lr = lr->next) { - if (lr->fd < 0) { - lr->fd = make_sock(&lr->local_addr); - } - if (lr->fd >= 0) { - ++num_open; - } - } - - /* close the old listeners */ - for (lr = old_listeners; lr; lr = next) { - close(lr->fd); - next = lr->next; - free(lr); - } - old_listeners = NULL; - - ap_register_cleanup(pconf, NULL, ap_null_cleanup, close_listeners_on_exec); - - return num_open ? 0 : -1; -} - - -void ap_listen_pre_config(void) -{ - old_listeners = ap_listeners; - ap_listeners = NULL; - ap_listenbacklog = DEFAULT_LISTENBACKLOG; -} - - -const char *ap_set_listener(cmd_parms *cmd, void *dummy, char *ips) -{ - char *ports; - unsigned short port; - struct sockaddr_in local_addr; - - const char *err = ap_check_cmd_context(cmd, GLOBAL_ONLY); - if (err != NULL) { - return err; - } - - ports = strchr(ips, ':'); - if (ports != NULL) { - if (ports == ips) { - return "Missing IP address"; - } - else if (ports[1] == '\0') { - return "Address must end in :"; - } - *(ports++) = '\0'; - } - else { - ports = ips; - } - - local_addr.sin_family = AF_INET; - if (ports == ips) { /* no address */ - local_addr.sin_addr.s_addr = htonl(INADDR_ANY); - } - else { - local_addr.sin_addr.s_addr = ap_get_virthost_addr(ips, NULL); - } - port = atoi(ports); - if (!port) { - return "Port must be numeric"; - } - local_addr.sin_port = htons(port); - - alloc_listener(&local_addr); - - return NULL; -} - -const char *ap_set_listenbacklog(cmd_parms *cmd, void *dummy, char *arg) -{ - int b; - - const char *err = ap_check_cmd_context(cmd, GLOBAL_ONLY); - if (err != NULL) { - return err; - } - - b = atoi(arg); - if (b < 1) { - return "ListenBacklog must be > 0"; - } - ap_listenbacklog = b; - return NULL; -} - -const char *ap_set_send_buffer_size(cmd_parms *cmd, void *dummy, char *arg) -{ - int s = atoi(arg); - const char *err = ap_check_cmd_context(cmd, GLOBAL_ONLY); - if (err != NULL) { - return err; - } - - if (s < 512 && s != 0) { - return "SendBufferSize must be >= 512 bytes, or 0 for system default."; - } - send_buffer_size = s; - return NULL; -} diff --git a/server/log.c b/server/log.c deleted file mode 100644 index 7a1e0ea5d0cd696a8907026bbb8433a2c7327db4..0000000000000000000000000000000000000000 --- a/server/log.c +++ /dev/null @@ -1,777 +0,0 @@ -/* ==================================================================== - * Copyright (c) 1995-1999 The Apache Group. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in - * the documentation and/or other materials provided with the - * distribution. - * - * 3. All advertising materials mentioning features or use of this - * software must display the following acknowledgment: - * "This product includes software developed by the Apache Group - * for use in the Apache HTTP server project (http://www.apache.org/)." - * - * 4. The names "Apache Server" and "Apache Group" must not be used to - * endorse or promote products derived from this software without - * prior written permission. For written permission, please contact - * apache@apache.org. - * - * 5. Products derived from this software may not be called "Apache" - * nor may "Apache" appear in their names without prior written - * permission of the Apache Group. - * - * 6. Redistributions of any form whatsoever must retain the following - * acknowledgment: - * "This product includes software developed by the Apache Group - * for use in the Apache HTTP server project (http://www.apache.org/)." - * - * THIS SOFTWARE IS PROVIDED BY THE APACHE GROUP ``AS IS'' AND ANY - * EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR - * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE APACHE GROUP OR - * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT - * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, - * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED - * OF THE POSSIBILITY OF SUCH DAMAGE. - * ==================================================================== - * - * This software consists of voluntary contributions made by many - * individuals on behalf of the Apache Group and was originally based - * on public domain software written at the National Center for - * Supercomputing Applications, University of Illinois, Urbana-Champaign. - * For more information on the Apache Group and the Apache HTTP server - * project, please see . - * - */ - -/* - * http_log.c: Dealing with the logs and errors - * - * Rob McCool - * - */ - - -#define CORE_PRIVATE -#include "httpd.h" -#include "http_conf_globals.h" -#include "http_config.h" -#include "http_core.h" -#include "http_log.h" -#include "http_main.h" - -#include - -typedef struct { - char *t_name; - int t_val; -} TRANS; - -#ifdef HAVE_SYSLOG - -static const TRANS facilities[] = { - {"auth", LOG_AUTH}, -#ifdef LOG_AUTHPRIV - {"authpriv",LOG_AUTHPRIV}, -#endif -#ifdef LOG_CRON - {"cron", LOG_CRON}, -#endif -#ifdef LOG_DAEMON - {"daemon", LOG_DAEMON}, -#endif -#ifdef LOG_FTP - {"ftp", LOG_FTP}, -#endif -#ifdef LOG_KERN - {"kern", LOG_KERN}, -#endif -#ifdef LOG_LPR - {"lpr", LOG_LPR}, -#endif -#ifdef LOG_MAIL - {"mail", LOG_MAIL}, -#endif -#ifdef LOG_NEWS - {"news", LOG_NEWS}, -#endif -#ifdef LOG_SYSLOG - {"syslog", LOG_SYSLOG}, -#endif -#ifdef LOG_USER - {"user", LOG_USER}, -#endif -#ifdef LOG_UUCP - {"uucp", LOG_UUCP}, -#endif -#ifdef LOG_LOCAL0 - {"local0", LOG_LOCAL0}, -#endif -#ifdef LOG_LOCAL1 - {"local1", LOG_LOCAL1}, -#endif -#ifdef LOG_LOCAL2 - {"local2", LOG_LOCAL2}, -#endif -#ifdef LOG_LOCAL3 - {"local3", LOG_LOCAL3}, -#endif -#ifdef LOG_LOCAL4 - {"local4", LOG_LOCAL4}, -#endif -#ifdef LOG_LOCAL5 - {"local5", LOG_LOCAL5}, -#endif -#ifdef LOG_LOCAL6 - {"local6", LOG_LOCAL6}, -#endif -#ifdef LOG_LOCAL7 - {"local7", LOG_LOCAL7}, -#endif - {NULL, -1}, -}; -#endif - -static const TRANS priorities[] = { - {"emerg", APLOG_EMERG}, - {"alert", APLOG_ALERT}, - {"crit", APLOG_CRIT}, - {"error", APLOG_ERR}, - {"warn", APLOG_WARNING}, - {"notice", APLOG_NOTICE}, - {"info", APLOG_INFO}, - {"debug", APLOG_DEBUG}, - {NULL, -1}, -}; - -static int error_log_child(void *cmd, child_info *pinfo) -{ - /* Child process code for 'ErrorLog "|..."'; - * may want a common framework for this, since I expect it will - * be common for other foo-loggers to want this sort of thing... - */ - int child_pid = 0; - - ap_cleanup_for_exec(); -#ifdef SIGHUP - /* No concept of a child process on Win32 */ - signal(SIGHUP, SIG_IGN); -#endif /* ndef SIGHUP */ -#if defined(WIN32) - child_pid = spawnl(_P_NOWAIT, SHELL_PATH, SHELL_PATH, "/c", (char *)cmd, NULL); - return(child_pid); -#elif defined(OS2) - /* For OS/2 we need to use a '/' and spawn the child rather than exec as - * we haven't forked */ - child_pid = spawnl(P_NOWAIT, SHELL_PATH, SHELL_PATH, "/c", (char *)cmd, NULL); - return(child_pid); -#else - execl(SHELL_PATH, SHELL_PATH, "-c", (char *)cmd, NULL); -#endif - exit(1); - /* NOT REACHED */ - return(child_pid); -} - -static void open_error_log(server_rec *s, pool *p) -{ - char *fname; - - if (*s->error_fname == '|') { - FILE *dummy; -#ifdef TPF - TPF_FORK_CHILD cld; - cld.filename = s->error_fname+1; - cld.subprocess_env = NULL; - cld.prog_type = FORK_NAME; - if (!ap_spawn_child(p, NULL, &cld, - kill_after_timeout, &dummy, NULL, NULL)) { -#else - if (!ap_spawn_child(p, error_log_child, (void *)(s->error_fname+1), - kill_after_timeout, &dummy, NULL, NULL)) { -#endif /* TPF */ - perror("ap_spawn_child"); - fprintf(stderr, "Couldn't fork child for ErrorLog process\n"); - exit(1); - } - - s->error_log = dummy; - } - -#ifdef HAVE_SYSLOG - else if (!strncasecmp(s->error_fname, "syslog", 6)) { - if ((fname = strchr(s->error_fname, ':'))) { - const TRANS *fac; - - fname++; - for (fac = facilities; fac->t_name; fac++) { - if (!strcasecmp(fname, fac->t_name)) { - openlog(ap_server_argv0, LOG_NDELAY|LOG_CONS|LOG_PID, - fac->t_val); - s->error_log = NULL; - return; - } - } - } - else - openlog(ap_server_argv0, LOG_NDELAY|LOG_CONS|LOG_PID, LOG_LOCAL7); - - s->error_log = NULL; - } -#endif - else { - fname = ap_server_root_relative(p, s->error_fname); - if (!(s->error_log = ap_pfopen(p, fname, "a"))) { - perror("fopen"); - fprintf(stderr, "%s: could not open error log file %s.\n", - ap_server_argv0, fname); - exit(1); - } - } -} - -void ap_open_logs(server_rec *s_main, pool *p) -{ - server_rec *virt, *q; - int replace_stderr; - - open_error_log(s_main, p); - - replace_stderr = 1; - if (s_main->error_log) { - /* replace stderr with this new log */ - fflush(stderr); - if (dup2(fileno(s_main->error_log), STDERR_FILENO) == -1) { - ap_log_error(APLOG_MARK, APLOG_CRIT, s_main, - "unable to replace stderr with error_log"); - } else { - replace_stderr = 0; - } - } - /* note that stderr may still need to be replaced with something - * because it points to the old error log, or back to the tty - * of the submitter. - */ - if (replace_stderr && freopen("/dev/null", "w", stderr) == NULL) { - ap_log_error(APLOG_MARK, APLOG_CRIT, s_main, - "unable to replace stderr with /dev/null"); - } - - for (virt = s_main->next; virt; virt = virt->next) { - if (virt->error_fname) - { - for (q=s_main; q != virt; q = q->next) - if (q->error_fname != NULL && - strcmp(q->error_fname, virt->error_fname) == 0) - break; - if (q == virt) - open_error_log(virt, p); - else - virt->error_log = q->error_log; - } - else - virt->error_log = s_main->error_log; - } -} - -API_EXPORT(void) ap_error_log2stderr(server_rec *s) { - if ( s->error_log != NULL - && fileno(s->error_log) != STDERR_FILENO) - dup2(fileno(s->error_log), STDERR_FILENO); -} - -static void log_error_core(const char *file, int line, int level, - const server_rec *s, const request_rec *r, - const char *fmt, va_list args) -{ - char errstr[MAX_STRING_LEN]; - size_t len; - int save_errno = errno; - FILE *logf; - - if (s == NULL) { - /* - * If we are doing stderr logging (startup), don't log messages that are - * above the default server log level unless it is a startup/shutdown - * notice - */ - if (((level & APLOG_LEVELMASK) != APLOG_NOTICE) && - ((level & APLOG_LEVELMASK) > DEFAULT_LOGLEVEL)) - return; - logf = stderr; - } - else if (s->error_log) { - /* - * If we are doing normal logging, don't log messages that are - * above the server log level unless it is a startup/shutdown notice - */ - if (((level & APLOG_LEVELMASK) != APLOG_NOTICE) && - ((level & APLOG_LEVELMASK) > s->loglevel)) - return; - logf = s->error_log; - } -#ifdef TPF - else if (tpf_child) { - /* - * If we are doing normal logging, don't log messages that are - * above the server log level unless it is a startup/shutdown notice - */ - if (((level & APLOG_LEVELMASK) != APLOG_NOTICE) && - ((level & APLOG_LEVELMASK) > s->loglevel)) - return; - logf = stderr; - } -#endif /* TPF */ - else { - /* - * If we are doing syslog logging, don't log messages that are - * above the server log level (including a startup/shutdown notice) - */ - if ((level & APLOG_LEVELMASK) > s->loglevel) - return; - logf = NULL; - } - - if (logf) { - len = ap_snprintf(errstr, sizeof(errstr), "[%s] ", ap_get_time()); - } else { - len = 0; - } - - len += ap_snprintf(errstr + len, sizeof(errstr) - len, - "[%s] ", priorities[level & APLOG_LEVELMASK].t_name); - -#ifndef TPF - if (file && (level & APLOG_LEVELMASK) == APLOG_DEBUG) { -#ifdef _OSD_POSIX - char tmp[256]; - char *e = strrchr(file, '/'); - - /* In OSD/POSIX, the compiler returns for __FILE__ - * a string like: __FILE__="*POSIX(/usr/include/stdio.h)" - * (it even returns an absolute path for sources in - * the current directory). Here we try to strip this - * down to the basename. - */ - if (e != NULL && e[1] != '\0') { - ap_snprintf(tmp, sizeof(tmp), "%s", &e[1]); - e = &tmp[strlen(tmp)-1]; - if (*e == ')') - *e = '\0'; - file = tmp; - } -#endif /*_OSD_POSIX*/ - len += ap_snprintf(errstr + len, sizeof(errstr) - len, - "%s(%d): ", file, line); - } -#endif /* TPF */ - if (r) { - /* XXX: TODO: add a method of selecting whether logged client - * addresses are in dotted quad or resolved form... dotted - * quad is the most secure, which is why I'm implementing it - * first. -djg - */ - len += ap_snprintf(errstr + len, sizeof(errstr) - len, - "[client %s] ", r->connection->remote_ip); - } - if (!(level & APLOG_NOERRNO) - && (save_errno != 0) -#ifdef WIN32 - && !(level & APLOG_WIN32ERROR) -#endif - ) { - len += ap_snprintf(errstr + len, sizeof(errstr) - len, - "(%d)%s: ", save_errno, strerror(save_errno)); - } -#ifdef WIN32 - if (level & APLOG_WIN32ERROR) { - int nChars; - int nErrorCode; - - nErrorCode = GetLastError(); - len += ap_snprintf(errstr + len, sizeof(errstr) - len, - "(%d)", nErrorCode); - - nChars = FormatMessage( - FORMAT_MESSAGE_FROM_SYSTEM, - NULL, - nErrorCode, - MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT), // Default language - (LPTSTR) errstr + len, - sizeof(errstr) - len, - NULL - ); - len += nChars; - if (nChars == 0) { - /* Um, error occurred, but we can't recurse to log it again - * (and it would probably only fail anyway), so lets just - * log the numeric value. - */ - nErrorCode = GetLastError(); - len += ap_snprintf(errstr + len, sizeof(errstr) - len, - "(FormatMessage failed with code %d): ", - nErrorCode); - } - else { - /* FormatMessage put the message in the buffer, but it may - * have appended a newline (\r\n). So remove it and use - * ": " instead like the Unix errors. The error may also - * end with a . before the return - if so, trash it. - */ - if (len > 1 && errstr[len-2] == '\r' && errstr[len-1] == '\n') { - if (len > 2 && errstr[len-3] == '.') - len--; - errstr[len-2] = ':'; - errstr[len-1] = ' '; - } - } - } -#endif - - len += ap_vsnprintf(errstr + len, sizeof(errstr) - len, fmt, args); - - /* NULL if we are logging to syslog */ - if (logf) { - fputs(errstr, logf); - fputc('\n', logf); - fflush(logf); - } -#ifdef HAVE_SYSLOG - else { - syslog(level & APLOG_LEVELMASK, "%s", errstr); - } -#endif -} - -API_EXPORT(void) ap_log_error(const char *file, int line, int level, - const server_rec *s, const char *fmt, ...) -{ - va_list args; - - va_start(args, fmt); - log_error_core(file, line, level, s, NULL, fmt, args); - va_end(args); -} - -API_EXPORT(void) ap_log_rerror(const char *file, int line, int level, - const request_rec *r, const char *fmt, ...) -{ - va_list args; - - va_start(args, fmt); - log_error_core(file, line, level, r->server, r, fmt, args); - /* - * IF the error level is 'warning' or more severe, - * AND there isn't already error text associated with this request, - * THEN make the message text available to ErrorDocument and - * other error processors. This can be disabled by stuffing - * something, even an empty string, into the "error-notes" cell - * before calling this routine. - */ - va_end(args); - va_start(args,fmt); - if (((level & APLOG_LEVELMASK) <= APLOG_WARNING) - && (ap_table_get(r->notes, "error-notes") == NULL)) { - ap_table_setn(r->notes, "error-notes", - ap_pvsprintf(r->pool, fmt, args)); - } - va_end(args); -} - -void ap_log_pid(pool *p, char *fname) -{ - FILE *pid_file; - struct stat finfo; - static pid_t saved_pid = -1; - pid_t mypid; - - if (!fname) - return; - - fname = ap_server_root_relative(p, fname); - mypid = getpid(); - if (mypid != saved_pid && stat(fname, &finfo) == 0) { - /* USR1 and HUP call this on each restart. - * Only warn on first time through for this pid. - * - * XXX: Could just write first time through too, although - * that may screw up scripts written to do something - * based on the last modification time of the pid file. - */ - ap_log_error(APLOG_MARK, APLOG_NOERRNO|APLOG_WARNING, NULL, - ap_psprintf(p, - "pid file %s overwritten -- Unclean shutdown of previous Apache run?", - fname) - ); - } - - if(!(pid_file = fopen(fname, "w"))) { - perror("fopen"); - fprintf(stderr, "%s: could not log pid to file %s\n", - ap_server_argv0, fname); - exit(1); - } - fprintf(pid_file, "%ld\n", (long)mypid); - fclose(pid_file); - saved_pid = mypid; -} - -API_EXPORT(void) ap_log_error_old(const char *err, server_rec *s) -{ - ap_log_error(APLOG_MARK, APLOG_ERR, s, "%s", err); -} - -API_EXPORT(void) ap_log_unixerr(const char *routine, const char *file, - const char *msg, server_rec *s) -{ - ap_log_error(file, 0, APLOG_ERR, s, "%s", msg); -} - -API_EXPORT(void) ap_log_printf(const server_rec *s, const char *fmt, ...) -{ - va_list args; - - va_start(args, fmt); - log_error_core(APLOG_MARK, APLOG_ERR, s, NULL, fmt, args); - va_end(args); -} - -API_EXPORT(void) ap_log_reason(const char *reason, const char *file, request_rec *r) -{ - ap_log_error(APLOG_MARK, APLOG_ERR, r->server, - "access to %s failed for %s, reason: %s", - file, - ap_get_remote_host(r->connection, r->per_dir_config, REMOTE_NAME), - reason); -} - -API_EXPORT(void) ap_log_assert(const char *szExp, const char *szFile, int nLine) -{ - fprintf(stderr, "[%s] file %s, line %d, assertion \"%s\" failed\n", - ap_get_time(), szFile, nLine, szExp); -#ifndef WIN32 - /* unix assert does an abort leading to a core dump */ - abort(); -#else - exit(1); -#endif -} - -/* piped log support */ - -#ifndef NO_RELIABLE_PIPED_LOGS -/* forward declaration */ -static void piped_log_maintenance(int reason, void *data, ap_wait_t status); - -static int piped_log_spawn(piped_log *pl) -{ - int pid; - - ap_block_alarms(); - pid = fork(); - if (pid == 0) { - /* XXX: this needs porting to OS2 and WIN32 */ - /* XXX: need to check what open fds the logger is actually passed, - * XXX: and CGIs for that matter ... cleanup_for_exec *should* - * XXX: close all the relevant stuff, but hey, it could be broken. */ - RAISE_SIGSTOP(PIPED_LOG_SPAWN); - /* we're now in the child */ - close(STDIN_FILENO); - dup2(pl->fds[0], STDIN_FILENO); - - ap_cleanup_for_exec(); - signal(SIGCHLD, SIG_DFL); /* for HPUX */ - signal(SIGHUP, SIG_IGN); - execl(SHELL_PATH, SHELL_PATH, "-c", pl->program, NULL); - fprintf(stderr, - "piped_log_spawn: unable to exec %s -c '%s': %s\n", - SHELL_PATH, pl->program, strerror (errno)); - exit(1); - } - if (pid == -1) { - fprintf(stderr, - "piped_log_spawn: unable to fork(): %s\n", strerror (errno)); - ap_unblock_alarms(); - return -1; - } - ap_unblock_alarms(); - pl->pid = pid; - ap_register_other_child(pid, piped_log_maintenance, pl, pl->fds[1]); - return 0; -} - - -static void piped_log_maintenance(int reason, void *data, ap_wait_t status) -{ - piped_log *pl = data; - - switch (reason) { - case OC_REASON_DEATH: - case OC_REASON_LOST: - pl->pid = -1; - ap_unregister_other_child(pl); - if (pl->program == NULL) { - /* during a restart */ - break; - } - if (piped_log_spawn(pl) == -1) { - /* what can we do? This could be the error log we're having - * problems opening up... */ - fprintf(stderr, - "piped_log_maintenance: unable to respawn '%s': %s\n", - pl->program, strerror(errno)); - } - break; - - case OC_REASON_UNWRITABLE: - if (pl->pid != -1) { - kill(pl->pid, SIGTERM); - } - break; - - case OC_REASON_RESTART: - pl->program = NULL; - if (pl->pid != -1) { - kill(pl->pid, SIGTERM); - } - break; - - case OC_REASON_UNREGISTER: - break; - } -} - - -static void piped_log_cleanup(void *data) -{ - piped_log *pl = data; - - if (pl->pid != -1) { - kill(pl->pid, SIGTERM); - } - ap_unregister_other_child(pl); - close(pl->fds[0]); - close(pl->fds[1]); -} - - -static void piped_log_cleanup_for_exec(void *data) -{ - piped_log *pl = data; - - close(pl->fds[0]); - close(pl->fds[1]); -} - - -API_EXPORT(piped_log *) ap_open_piped_log(pool *p, const char *program) -{ - piped_log *pl; - - pl = ap_palloc(p, sizeof (*pl)); - pl->p = p; - pl->program = ap_pstrdup(p, program); - pl->pid = -1; - ap_block_alarms (); - if (pipe(pl->fds) == -1) { - int save_errno = errno; - ap_unblock_alarms(); - errno = save_errno; - return NULL; - } - ap_register_cleanup(p, pl, piped_log_cleanup, piped_log_cleanup_for_exec); - if (piped_log_spawn(pl) == -1) { - int save_errno = errno; - ap_kill_cleanup(p, pl, piped_log_cleanup); - close(pl->fds[0]); - close(pl->fds[1]); - ap_unblock_alarms(); - errno = save_errno; - return NULL; - } - ap_unblock_alarms(); - return pl; -} - -API_EXPORT(void) ap_close_piped_log(piped_log *pl) -{ - ap_block_alarms(); - piped_log_cleanup(pl); - ap_kill_cleanup(pl->p, pl, piped_log_cleanup); - ap_unblock_alarms(); -} - -#else -static int piped_log_child(void *cmd, child_info *pinfo) -{ - /* Child process code for 'TransferLog "|..."'; - * may want a common framework for this, since I expect it will - * be common for other foo-loggers to want this sort of thing... - */ - int child_pid = 1; - - ap_cleanup_for_exec(); -#ifdef SIGHUP - signal(SIGHUP, SIG_IGN); -#endif -#if defined(WIN32) - child_pid = spawnl(_P_NOWAIT, SHELL_PATH, SHELL_PATH, "/c", (char *)cmd, NULL); - return(child_pid); -#elif defined(OS2) - /* For OS/2 we need to use a '/' and spawn the child rather than exec as - * we haven't forked */ - child_pid = spawnl(P_NOWAIT, SHELL_PATH, SHELL_PATH, "/c", (char *)cmd, NULL); - return(child_pid); -#else - execl (SHELL_PATH, SHELL_PATH, "-c", (char *)cmd, NULL); -#endif - perror("exec"); - fprintf(stderr, "Exec of shell for logging failed!!!\n"); - return(child_pid); -} - - -API_EXPORT(piped_log *) ap_open_piped_log(pool *p, const char *program) -{ - piped_log *pl; - FILE *dummy; -#ifdef TPF - TPF_FORK_CHILD cld; - cld.filename = (char *)program; - cld.subprocess_env = NULL; - cld.prog_type = FORK_NAME; - - if (!ap_spawn_child (p, NULL, &cld, - kill_after_timeout, &dummy, NULL, NULL)){ -#else - if (!ap_spawn_child(p, piped_log_child, (void *)program, - kill_after_timeout, &dummy, NULL, NULL)) { -#endif /* TPF */ - perror("ap_spawn_child"); - fprintf(stderr, "Couldn't fork child for piped log process\n"); - exit (1); - } - pl = ap_palloc(p, sizeof (*pl)); - pl->p = p; - pl->write_f = dummy; - - return pl; -} - - -API_EXPORT(void) ap_close_piped_log(piped_log *pl) -{ - ap_pfclose(pl->p, pl->write_f); -} -#endif diff --git a/server/main.c b/server/main.c deleted file mode 100644 index 5bd372bbc4b7f6e7607f50905387fbe1aad98d1f..0000000000000000000000000000000000000000 --- a/server/main.c +++ /dev/null @@ -1,6669 +0,0 @@ -/* ==================================================================== - * Copyright (c) 1995-1999 The Apache Group. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in - * the documentation and/or other materials provided with the - * distribution. - * - * 3. All advertising materials mentioning features or use of this - * software must display the following acknowledgment: - * "This product includes software developed by the Apache Group - * for use in the Apache HTTP server project (http://www.apache.org/)." - * - * 4. The names "Apache Server" and "Apache Group" must not be used to - * endorse or promote products derived from this software without - * prior written permission. For written permission, please contact - * apache@apache.org. - * - * 5. Products derived from this software may not be called "Apache" - * nor may "Apache" appear in their names without prior written - * permission of the Apache Group. - * - * 6. Redistributions of any form whatsoever must retain the following - * acknowledgment: - * "This product includes software developed by the Apache Group - * for use in the Apache HTTP server project (http://www.apache.org/)." - * - * THIS SOFTWARE IS PROVIDED BY THE APACHE GROUP ``AS IS'' AND ANY - * EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR - * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE APACHE GROUP OR - * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT - * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, - * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED - * OF THE POSSIBILITY OF SUCH DAMAGE. - * ==================================================================== - * - * This software consists of voluntary contributions made by many - * individuals on behalf of the Apache Group and was originally based - * on public domain software written at the National Center for - * Supercomputing Applications, University of Illinois, Urbana-Champaign. - * For more information on the Apache Group and the Apache HTTP server - * project, please see . - * - */ - -/* - * httpd.c: simple http daemon for answering WWW file requests - * - * - * 03-21-93 Rob McCool wrote original code (up to NCSA HTTPd 1.3) - * - * 03-06-95 blong - * changed server number for child-alone processes to 0 and changed name - * of processes - * - * 03-10-95 blong - * Added numerous speed hacks proposed by Robert S. Thau (rst@ai.mit.edu) - * including set group before fork, and call gettime before to fork - * to set up libraries. - * - * 04-14-95 rst / rh - * Brandon's code snarfed from NCSA 1.4, but tinkered to work with the - * Apache server, and also to have child processes do accept() directly. - * - * April-July '95 rst - * Extensive rework for Apache. - */ - -#ifndef SHARED_CORE_BOOTSTRAP -#ifndef SHARED_CORE_TIESTATIC - -#ifdef SHARED_CORE -#define REALMAIN ap_main -int ap_main(int argc, char *argv[]); -#else -#define REALMAIN main -#endif - -#define CORE_PRIVATE - -#include "httpd.h" -#include "http_main.h" -#include "http_log.h" -#include "http_config.h" /* for read_config */ -#include "http_protocol.h" /* for read_request */ -#include "http_request.h" /* for process_request */ -#include "http_conf_globals.h" -#include "http_core.h" /* for get_remote_host */ -#include "http_vhost.h" -#include "util_script.h" /* to force util_script.c linking */ -#include "util_uri.h" -#include "scoreboard.h" -#include "multithread.h" -#include -#ifdef USE_SHMGET_SCOREBOARD -#include -#include -#include -#endif -#ifdef SecureWare -#include -#include -#include -#endif -#ifdef WIN32 -#include "../os/win32/getopt.h" -#elif !defined(BEOS) && !defined(TPF) -#include -#endif - -#ifdef HAVE_BSTRING_H -#include /* for IRIX, FD_SET calls bzero() */ -#endif - -#ifdef MULTITHREAD -/* special debug stuff -- PCS */ - -/* Set this non-zero if you are prepared to put up with more than one log entry per second */ -#define SEVERELY_VERBOSE 0 - - /* APD1() to APD5() are macros to help us debug. They can either - * log to the screen or the error_log file. In release builds, these - * macros do nothing. In debug builds, they send messages at priority - * "debug" to the error log file, or if DEBUG_TO_CONSOLE is defined, - * to the console. - */ - -# ifdef _DEBUG -# ifndef DEBUG_TO_CONSOLE -# define APD1(a) ap_log_error(APLOG_MARK,APLOG_DEBUG|APLOG_NOERRNO,server_conf,a) -# define APD2(a,b) ap_log_error(APLOG_MARK,APLOG_DEBUG|APLOG_NOERRNO,server_conf,a,b) -# define APD3(a,b,c) ap_log_error(APLOG_MARK,APLOG_DEBUG|APLOG_NOERRNO,server_conf,a,b,c) -# define APD4(a,b,c,d) ap_log_error(APLOG_MARK,APLOG_DEBUG|APLOG_NOERRNO,server_conf,a,b,c,d) -# define APD5(a,b,c,d,e) ap_log_error(APLOG_MARK,APLOG_DEBUG|APLOG_NOERRNO,server_conf,a,b,c,d,e) -# else -# define APD1(a) printf("%s\n",a) -# define APD2(a,b) do { printf(a,b);putchar('\n'); } while(0); -# define APD3(a,b,c) do { printf(a,b,c);putchar('\n'); } while(0); -# define APD4(a,b,c,d) do { printf(a,b,c,d);putchar('\n'); } while(0); -# define APD5(a,b,c,d,e) do { printf(a,b,c,d,e);putchar('\n'); } while(0); -# endif -# else /* !_DEBUG */ -# define APD1(a) -# define APD2(a,b) -# define APD3(a,b,c) -# define APD4(a,b,c,d) -# define APD5(a,b,c,d,e) -# endif /* _DEBUG */ -#endif /* MULTITHREAD */ - -/* This next function is never used. It is here to ensure that if we - * make all the modules into shared libraries that core httpd still - * includes the full Apache API. Without this function the objects in - * main/util_script.c would not be linked into a minimal httpd. - * And the extra prototype is to make gcc -Wmissing-prototypes quiet. - */ -extern void ap_force_library_loading(void); -void ap_force_library_loading(void) { - ap_add_cgi_vars(NULL); -} - -#include "explain.h" - -#if !defined(max) -#define max(a,b) (a > b ? a : b) -#endif - -#ifdef WIN32 -#include "../os/win32/service.h" -#include "../os/win32/registry.h" -#define DEFAULTSERVICENAME "Apache" -#define PATHSEPARATOR '\\' -#else -#define PATHSEPARATOR '/' -#endif - - -#ifdef MINT -long _stksize = 32768; -#endif - -#ifdef USE_OS2_SCOREBOARD - /* Add MMAP style functionality to OS/2 */ -#define INCL_DOSMEMMGR -#define INCL_DOSEXCEPTIONS -#define INCL_DOSSEMAPHORES -#include -#include -#include -caddr_t create_shared_heap(const char *, size_t); -caddr_t get_shared_heap(const char *); -#endif - -DEF_Explain - -/* Defining GPROF when compiling uses the moncontrol() function to - * disable gprof profiling in the parent, and enable it only for - * request processing in children (or in one_process mode). It's - * absolutely required to get useful gprof results under linux - * because the profile itimers and such are disabled across a - * fork(). It's probably useful elsewhere as well. - */ -#ifdef GPROF -extern void moncontrol(int); -#define MONCONTROL(x) moncontrol(x) -#else -#define MONCONTROL(x) -#endif - -#ifndef MULTITHREAD -/* this just need to be anything non-NULL */ -void *ap_dummy_mutex = &ap_dummy_mutex; -#endif - -/* - * Actual definitions of config globals... here because this is - * for the most part the only code that acts on 'em. (Hmmm... mod_main.c?) - */ - -int ap_standalone=0; -int ap_configtestonly=0; -int ap_docrootcheck=1; -uid_t ap_user_id=0; -char *ap_user_name=NULL; -gid_t ap_group_id=0; -#ifdef MULTIPLE_GROUPS -gid_t group_id_list[NGROUPS_MAX]; -#endif -int ap_max_requests_per_child=0; -int ap_threads_per_child=0; -int ap_excess_requests_per_child=0; -char *ap_pid_fname=NULL; -char *ap_scoreboard_fname=NULL; -char *ap_lock_fname; -char *ap_server_argv0=NULL; -struct in_addr ap_bind_address; -int ap_daemons_to_start=0; -int ap_daemons_min_free=0; -int ap_daemons_max_free=0; -int ap_daemons_limit=0; -time_t ap_restart_time=0; -int ap_suexec_enabled = 0; -int ap_listenbacklog; -int ap_dump_settings = 0; -API_VAR_EXPORT int ap_extended_status = 0; - -/* - * The max child slot ever assigned, preserved across restarts. Necessary - * to deal with MaxClients changes across SIGUSR1 restarts. We use this - * value to optimize routines that have to scan the entire scoreboard. - */ -static int max_daemons_limit = -1; - -/* - * During config time, listeners is treated as a NULL-terminated list. - * child_main previously would start at the beginning of the list each time - * through the loop, so a socket early on in the list could easily starve out - * sockets later on in the list. The solution is to start at the listener - * after the last one processed. But to do that fast/easily in child_main it's - * way more convenient for listeners to be a ring that loops back on itself. - * The routine setup_listeners() is called after config time to both open up - * the sockets and to turn the NULL-terminated list into a ring that loops back - * on itself. - * - * head_listener is used by each child to keep track of what they consider - * to be the "start" of the ring. It is also set by make_child to ensure - * that new children also don't starve any sockets. - * - * Note that listeners != NULL is ensured by read_config(). - */ -listen_rec *ap_listeners; -static listen_rec *head_listener; - -API_VAR_EXPORT char ap_server_root[MAX_STRING_LEN]=""; -char ap_server_confname[MAX_STRING_LEN]=""; -char ap_coredump_dir[MAX_STRING_LEN]; - -array_header *ap_server_pre_read_config; -array_header *ap_server_post_read_config; -array_header *ap_server_config_defines; - -/* *Non*-shared http_main globals... */ - -static server_rec *server_conf; -static JMP_BUF APACHE_TLS jmpbuffer; -static int sd; -static fd_set listenfds; -static int listenmaxfd; -static pid_t pgrp; - -/* one_process --- debugging mode variable; can be set from the command line - * with the -X flag. If set, this gets you the child_main loop running - * in the process which originally started up (no detach, no make_child), - * which is a pretty nice debugging environment. (You'll get a SIGHUP - * early in standalone_main; just continue through. This is the server - * trying to kill off any child processes which it might have lying - * around --- Apache doesn't keep track of their pids, it just sends - * SIGHUP to the process group, ignoring it in the root process. - * Continue through and you'll be fine.). - */ - -static int one_process = 0; - -/* set if timeouts are to be handled by the children and not by the parent. - * i.e. child_timeouts = !standalone || one_process. - */ -static int child_timeouts; - -#ifdef DEBUG_SIGSTOP -int raise_sigstop_flags; -#endif - -#ifndef NO_OTHER_CHILD -/* used to maintain list of children which aren't part of the scoreboard */ -typedef struct other_child_rec other_child_rec; -struct other_child_rec { - other_child_rec *next; - int pid; - void (*maintenance) (int, void *, ap_wait_t); - void *data; - int write_fd; -}; -static other_child_rec *other_children; -#endif - -static pool *pglobal; /* Global pool */ -static pool *pconf; /* Pool for config stuff */ -static pool *plog; /* Pool for error-logging files */ -static pool *ptrans; /* Pool for per-transaction stuff */ -static pool *pchild; /* Pool for httpd child stuff */ -static pool *pcommands; /* Pool for -C and -c switches */ - -static int APACHE_TLS my_pid; /* it seems silly to call getpid all the time */ -#ifndef MULTITHREAD -static int my_child_num; -#endif - -#ifdef TPF -int tpf_child = 0; -char tpf_server_name[INETD_SERVNAME_LENGTH+1]; -#endif /* TPF */ - -scoreboard *ap_scoreboard_image = NULL; - -/* - * Pieces for managing the contents of the Server response header - * field. - */ -static char *server_version = NULL; -static int version_locked = 0; - -/* Global, alas, so http_core can talk to us */ -enum server_token_type ap_server_tokens = SrvTk_FULL; - -/* - * This routine is called when the pconf pool is vacuumed. It resets the - * server version string to a known value and [re]enables modifications - * (which are disabled by configuration completion). - */ -static void reset_version(void *dummy) -{ - version_locked = 0; - ap_server_tokens = SrvTk_FULL; - server_version = NULL; -} - -API_EXPORT(const char *) ap_get_server_version(void) -{ - return (server_version ? server_version : SERVER_BASEVERSION); -} - -API_EXPORT(void) ap_add_version_component(const char *component) -{ - if (! version_locked) { - /* - * If the version string is null, register our cleanup to reset the - * pointer on pool destruction. We also know that, if NULL, - * we are adding the original SERVER_BASEVERSION string. - */ - if (server_version == NULL) { - ap_register_cleanup(pconf, NULL, (void (*)(void *))reset_version, - ap_null_cleanup); - server_version = ap_pstrdup(pconf, component); - } - else { - /* - * Tack the given component identifier to the end of - * the existing string. - */ - server_version = ap_pstrcat(pconf, server_version, " ", - component, NULL); - } - } -} - -/* - * This routine adds the real server base identity to the version string, - * and then locks out changes until the next reconfig. - */ -static void ap_set_version(void) -{ - if (ap_server_tokens == SrvTk_MIN) { - ap_add_version_component(SERVER_BASEVERSION); - } - else { - ap_add_version_component(SERVER_BASEVERSION " (" PLATFORM ")"); - } - /* - * Lock the server_version string if we're not displaying - * the full set of tokens - */ - if (ap_server_tokens != SrvTk_FULL) { - version_locked++; - } -} - -static APACHE_TLS int volatile exit_after_unblock = 0; - -#ifdef GPROF -/* - * change directory for gprof to plop the gmon.out file - * configure in httpd.conf: - * GprofDir logs/ -> $ServerRoot/logs/gmon.out - * GprofDir logs/% -> $ServerRoot/logs/gprof.$pid/gmon.out - */ -static void chdir_for_gprof(void) -{ - core_server_config *sconf = - ap_get_module_config(server_conf->module_config, &core_module); - char *dir = sconf->gprof_dir; - - if(dir) { - char buf[512]; - int len = strlen(sconf->gprof_dir) - 1; - if(*(dir + len) == '%') { - dir[len] = '\0'; - ap_snprintf(buf, sizeof(buf), "%sgprof.%d", dir, (int)getpid()); - } - dir = ap_server_root_relative(pconf, buf[0] ? buf : dir); - if(mkdir(dir, 0755) < 0 && errno != EEXIST) { - ap_log_error(APLOG_MARK, APLOG_ERR, server_conf, - "gprof: error creating directory %s", dir); - } - } - else { - dir = ap_server_root_relative(pconf, "logs"); - } - - chdir(dir); -} -#else -#define chdir_for_gprof() -#endif - -/* a clean exit from a child with proper cleanup */ -static void clean_child_exit(int code) __attribute__ ((noreturn)); -static void clean_child_exit(int code) -{ - if (pchild) { - ap_child_exit_modules(pchild, server_conf); - ap_destroy_pool(pchild); - } - chdir_for_gprof(); - exit(code); -} - -#if defined(USE_FCNTL_SERIALIZED_ACCEPT) || defined(USE_FLOCK_SERIALIZED_ACCEPT) -static void expand_lock_fname(pool *p) -{ - /* XXXX possibly bogus cast */ - ap_lock_fname = ap_psprintf(p, "%s.%lu", - ap_server_root_relative(p, ap_lock_fname), (unsigned long)getpid()); -} -#endif - -#if defined (USE_USLOCK_SERIALIZED_ACCEPT) - -#include - -static ulock_t uslock = NULL; - -#define accept_mutex_child_init(x) - -static void accept_mutex_init(pool *p) -{ - ptrdiff_t old; - usptr_t *us; - - - /* default is 8, allocate enough for all the children plus the parent */ - if ((old = usconfig(CONF_INITUSERS, HARD_SERVER_LIMIT + 1)) == -1) { - perror("usconfig(CONF_INITUSERS)"); - exit(-1); - } - - if ((old = usconfig(CONF_LOCKTYPE, US_NODEBUG)) == -1) { - perror("usconfig(CONF_LOCKTYPE)"); - exit(-1); - } - if ((old = usconfig(CONF_ARENATYPE, US_SHAREDONLY)) == -1) { - perror("usconfig(CONF_ARENATYPE)"); - exit(-1); - } - if ((us = usinit("/dev/zero")) == NULL) { - perror("usinit"); - exit(-1); - } - - if ((uslock = usnewlock(us)) == NULL) { - perror("usnewlock"); - exit(-1); - } -} - -static void accept_mutex_on(void) -{ - switch (ussetlock(uslock)) { - case 1: - /* got lock */ - break; - case 0: - fprintf(stderr, "didn't get lock\n"); - clean_child_exit(APEXIT_CHILDFATAL); - case -1: - perror("ussetlock"); - clean_child_exit(APEXIT_CHILDFATAL); - } -} - -static void accept_mutex_off(void) -{ - if (usunsetlock(uslock) == -1) { - perror("usunsetlock"); - clean_child_exit(APEXIT_CHILDFATAL); - } -} - -#elif defined (USE_PTHREAD_SERIALIZED_ACCEPT) - -/* This code probably only works on Solaris ... but it works really fast - * on Solaris. Note that pthread mutexes are *NOT* released when a task - * dies ... the task has to free it itself. So we block signals and - * try to be nice about releasing the mutex. - */ - -#include - -static pthread_mutex_t *accept_mutex = (void *)(caddr_t) -1; -static int have_accept_mutex; -static sigset_t accept_block_mask; -static sigset_t accept_previous_mask; - -static void accept_mutex_child_cleanup(void *foo) -{ - if (accept_mutex != (void *)(caddr_t)-1 - && have_accept_mutex) { - pthread_mutex_unlock(accept_mutex); - } -} - -static void accept_mutex_child_init(pool *p) -{ - ap_register_cleanup(p, NULL, accept_mutex_child_cleanup, ap_null_cleanup); -} - -static void accept_mutex_cleanup(void *foo) -{ - if (accept_mutex != (void *)(caddr_t)-1 - && munmap((caddr_t) accept_mutex, sizeof(*accept_mutex))) { - perror("munmap"); - } - accept_mutex = (void *)(caddr_t)-1; -} - -static void accept_mutex_init(pool *p) -{ - pthread_mutexattr_t mattr; - int fd; - - fd = open("/dev/zero", O_RDWR); - if (fd == -1) { - perror("open(/dev/zero)"); - exit(APEXIT_INIT); - } - accept_mutex = (pthread_mutex_t *) mmap((caddr_t) 0, sizeof(*accept_mutex), - PROT_READ | PROT_WRITE, MAP_SHARED, fd, 0); - if (accept_mutex == (void *) (caddr_t) - 1) { - perror("mmap"); - exit(APEXIT_INIT); - } - close(fd); - if ((errno = pthread_mutexattr_init(&mattr))) { - perror("pthread_mutexattr_init"); - exit(APEXIT_INIT); - } - if ((errno = pthread_mutexattr_setpshared(&mattr, - PTHREAD_PROCESS_SHARED))) { - perror("pthread_mutexattr_setpshared"); - exit(APEXIT_INIT); - } - if ((errno = pthread_mutex_init(accept_mutex, &mattr))) { - perror("pthread_mutex_init"); - exit(APEXIT_INIT); - } - sigfillset(&accept_block_mask); - sigdelset(&accept_block_mask, SIGHUP); - sigdelset(&accept_block_mask, SIGTERM); - sigdelset(&accept_block_mask, SIGUSR1); - ap_register_cleanup(p, NULL, accept_mutex_cleanup, ap_null_cleanup); -} - -static void accept_mutex_on(void) -{ - int err; - - if (sigprocmask(SIG_BLOCK, &accept_block_mask, &accept_previous_mask)) { - perror("sigprocmask(SIG_BLOCK)"); - clean_child_exit(APEXIT_CHILDFATAL); - } - if ((err = pthread_mutex_lock(accept_mutex))) { - errno = err; - perror("pthread_mutex_lock"); - clean_child_exit(APEXIT_CHILDFATAL); - } - have_accept_mutex = 1; -} - -static void accept_mutex_off(void) -{ - int err; - - if ((err = pthread_mutex_unlock(accept_mutex))) { - errno = err; - perror("pthread_mutex_unlock"); - clean_child_exit(APEXIT_CHILDFATAL); - } - /* There is a slight race condition right here... if we were to die right - * now, we'd do another pthread_mutex_unlock. Now, doing that would let - * another process into the mutex. pthread mutexes are designed to be - * fast, as such they don't have protection for things like testing if the - * thread owning a mutex is actually unlocking it (or even any way of - * testing who owns the mutex). - * - * If we were to unset have_accept_mutex prior to releasing the mutex - * then the race could result in the server unable to serve hits. Doing - * it this way means that the server can continue, but an additional - * child might be in the critical section ... at least it's still serving - * hits. - */ - have_accept_mutex = 0; - if (sigprocmask(SIG_SETMASK, &accept_previous_mask, NULL)) { - perror("sigprocmask(SIG_SETMASK)"); - clean_child_exit(1); - } -} - -#elif defined (USE_SYSVSEM_SERIALIZED_ACCEPT) - -#include -#include -#include - -#ifdef NEED_UNION_SEMUN -/* it makes no sense, but this isn't defined on solaris */ -union semun { - long val; - struct semid_ds *buf; - ushort *array; -}; - -#endif - -static int sem_id = -1; -static struct sembuf op_on; -static struct sembuf op_off; - -/* We get a random semaphore ... the lame sysv semaphore interface - * means we have to be sure to clean this up or else we'll leak - * semaphores. - */ -static void accept_mutex_cleanup(void *foo) -{ - union semun ick; - - if (sem_id < 0) - return; - /* this is ignored anyhow */ - ick.val = 0; - semctl(sem_id, 0, IPC_RMID, ick); -} - -#define accept_mutex_child_init(x) - -static void accept_mutex_init(pool *p) -{ - union semun ick; - struct semid_ds buf; - - /* acquire the semaphore */ - sem_id = semget(IPC_PRIVATE, 1, IPC_CREAT | 0600); - if (sem_id < 0) { - perror("semget"); - exit(APEXIT_INIT); - } - ick.val = 1; - if (semctl(sem_id, 0, SETVAL, ick) < 0) { - perror("semctl(SETVAL)"); - exit(APEXIT_INIT); - } - if (!getuid()) { - /* restrict it to use only by the appropriate user_id ... not that this - * stops CGIs from acquiring it and dinking around with it. - */ - buf.sem_perm.uid = ap_user_id; - buf.sem_perm.gid = ap_group_id; - buf.sem_perm.mode = 0600; - ick.buf = &buf; - if (semctl(sem_id, 0, IPC_SET, ick) < 0) { - perror("semctl(IPC_SET)"); - exit(APEXIT_INIT); - } - } - ap_register_cleanup(p, NULL, accept_mutex_cleanup, ap_null_cleanup); - - /* pre-initialize these */ - op_on.sem_num = 0; - op_on.sem_op = -1; - op_on.sem_flg = SEM_UNDO; - op_off.sem_num = 0; - op_off.sem_op = 1; - op_off.sem_flg = SEM_UNDO; -} - -static void accept_mutex_on(void) -{ - while (semop(sem_id, &op_on, 1) < 0) { - if (errno != EINTR) { - perror("accept_mutex_on"); - clean_child_exit(APEXIT_CHILDFATAL); - } - } -} - -static void accept_mutex_off(void) -{ - while (semop(sem_id, &op_off, 1) < 0) { - if (errno != EINTR) { - perror("accept_mutex_off"); - clean_child_exit(APEXIT_CHILDFATAL); - } - } -} - -#elif defined(USE_FCNTL_SERIALIZED_ACCEPT) -static struct flock lock_it; -static struct flock unlock_it; - -static int lock_fd = -1; - -#define accept_mutex_child_init(x) - -/* - * Initialize mutex lock. - * Must be safe to call this on a restart. - */ -static void accept_mutex_init(pool *p) -{ - - lock_it.l_whence = SEEK_SET; /* from current point */ - lock_it.l_start = 0; /* -"- */ - lock_it.l_len = 0; /* until end of file */ - lock_it.l_type = F_WRLCK; /* set exclusive/write lock */ - lock_it.l_pid = 0; /* pid not actually interesting */ - unlock_it.l_whence = SEEK_SET; /* from current point */ - unlock_it.l_start = 0; /* -"- */ - unlock_it.l_len = 0; /* until end of file */ - unlock_it.l_type = F_UNLCK; /* set exclusive/write lock */ - unlock_it.l_pid = 0; /* pid not actually interesting */ - - expand_lock_fname(p); - lock_fd = ap_popenf(p, ap_lock_fname, O_CREAT | O_WRONLY | O_EXCL, 0644); - if (lock_fd == -1) { - perror("open"); - fprintf(stderr, "Cannot open lock file: %s\n", ap_lock_fname); - exit(APEXIT_INIT); - } - unlink(ap_lock_fname); -} - -static void accept_mutex_on(void) -{ - int ret; - - while ((ret = fcntl(lock_fd, F_SETLKW, &lock_it)) < 0 && errno == EINTR) { - /* nop */ - } - - if (ret < 0) { - ap_log_error(APLOG_MARK, APLOG_EMERG, server_conf, - "fcntl: F_SETLKW: Error getting accept lock, exiting! " - "Perhaps you need to use the LockFile directive to place " - "your lock file on a local disk!"); - clean_child_exit(APEXIT_CHILDFATAL); - } -} - -static void accept_mutex_off(void) -{ - int ret; - - while ((ret = fcntl(lock_fd, F_SETLKW, &unlock_it)) < 0 && errno == EINTR) { - /* nop */ - } - if (ret < 0) { - ap_log_error(APLOG_MARK, APLOG_EMERG, server_conf, - "fcntl: F_SETLKW: Error freeing accept lock, exiting! " - "Perhaps you need to use the LockFile directive to place " - "your lock file on a local disk!"); - clean_child_exit(APEXIT_CHILDFATAL); - } -} - -#elif defined(USE_FLOCK_SERIALIZED_ACCEPT) - -static int lock_fd = -1; - -static void accept_mutex_cleanup(void *foo) -{ - unlink(ap_lock_fname); -} - -/* - * Initialize mutex lock. - * Done by each child at it's birth - */ -static void accept_mutex_child_init(pool *p) -{ - - lock_fd = ap_popenf(p, ap_lock_fname, O_WRONLY, 0600); - if (lock_fd == -1) { - ap_log_error(APLOG_MARK, APLOG_EMERG, server_conf, - "Child cannot open lock file: %s", ap_lock_fname); - clean_child_exit(APEXIT_CHILDINIT); - } -} - -/* - * Initialize mutex lock. - * Must be safe to call this on a restart. - */ -static void accept_mutex_init(pool *p) -{ - expand_lock_fname(p); - unlink(ap_lock_fname); - lock_fd = ap_popenf(p, ap_lock_fname, O_CREAT | O_WRONLY | O_EXCL, 0600); - if (lock_fd == -1) { - ap_log_error(APLOG_MARK, APLOG_EMERG, server_conf, - "Parent cannot open lock file: %s", ap_lock_fname); - exit(APEXIT_INIT); - } - ap_register_cleanup(p, NULL, accept_mutex_cleanup, ap_null_cleanup); -} - -static void accept_mutex_on(void) -{ - int ret; - - while ((ret = flock(lock_fd, LOCK_EX)) < 0 && errno == EINTR) - continue; - - if (ret < 0) { - ap_log_error(APLOG_MARK, APLOG_EMERG, server_conf, - "flock: LOCK_EX: Error getting accept lock. Exiting!"); - clean_child_exit(APEXIT_CHILDFATAL); - } -} - -static void accept_mutex_off(void) -{ - if (flock(lock_fd, LOCK_UN) < 0) { - ap_log_error(APLOG_MARK, APLOG_EMERG, server_conf, - "flock: LOCK_UN: Error freeing accept lock. Exiting!"); - clean_child_exit(APEXIT_CHILDFATAL); - } -} - -#elif defined(USE_OS2SEM_SERIALIZED_ACCEPT) - -static HMTX lock_sem = -1; - -static void accept_mutex_cleanup(void *foo) -{ - DosReleaseMutexSem(lock_sem); - DosCloseMutexSem(lock_sem); -} - -/* - * Initialize mutex lock. - * Done by each child at it's birth - */ -static void accept_mutex_child_init(pool *p) -{ - int rc = DosOpenMutexSem(NULL, &lock_sem); - - if (rc != 0) { - ap_log_error(APLOG_MARK, APLOG_NOERRNO|APLOG_EMERG, server_conf, - "Child cannot open lock semaphore, rc=%d", rc); - clean_child_exit(APEXIT_CHILDINIT); - } else { - ap_register_cleanup(p, NULL, accept_mutex_cleanup, ap_null_cleanup); - } -} - -/* - * Initialize mutex lock. - * Must be safe to call this on a restart. - */ -static void accept_mutex_init(pool *p) -{ - int rc = DosCreateMutexSem(NULL, &lock_sem, DC_SEM_SHARED, FALSE); - - if (rc != 0) { - ap_log_error(APLOG_MARK, APLOG_NOERRNO|APLOG_EMERG, server_conf, - "Parent cannot create lock semaphore, rc=%d", rc); - exit(APEXIT_INIT); - } - - ap_register_cleanup(p, NULL, accept_mutex_cleanup, ap_null_cleanup); -} - -static void accept_mutex_on(void) -{ - int rc = DosRequestMutexSem(lock_sem, SEM_INDEFINITE_WAIT); - - if (rc != 0) { - ap_log_error(APLOG_MARK, APLOG_NOERRNO|APLOG_EMERG, server_conf, - "OS2SEM: Error %d getting accept lock. Exiting!", rc); - clean_child_exit(APEXIT_CHILDFATAL); - } -} - -static void accept_mutex_off(void) -{ - int rc = DosReleaseMutexSem(lock_sem); - - if (rc != 0) { - ap_log_error(APLOG_MARK, APLOG_NOERRNO|APLOG_EMERG, server_conf, - "OS2SEM: Error %d freeing accept lock. Exiting!", rc); - clean_child_exit(APEXIT_CHILDFATAL); - } -} - -#elif defined(USE_TPF_CORE_SERIALIZED_ACCEPT) - -static int tpf_core_held; - -static void accept_mutex_cleanup(void *foo) -{ - if(tpf_core_held) - coruc(RESOURCE_KEY); -} - -#define accept_mutex_init(x) - -static void accept_mutex_child_init(pool *p) -{ - ap_register_cleanup(p, NULL, accept_mutex_cleanup, ap_null_cleanup); - tpf_core_held = 0; -} - -static void accept_mutex_on(void) -{ - corhc(RESOURCE_KEY); - tpf_core_held = 1; - ap_check_signals(); -} - -static void accept_mutex_off(void) -{ - coruc(RESOURCE_KEY); - tpf_core_held = 0; - ap_check_signals(); -} - -#else -/* Default --- no serialization. Other methods *could* go here, - * as #elifs... - */ -#if !defined(MULTITHREAD) -/* Multithreaded systems don't complete between processes for - * the sockets. */ -#define NO_SERIALIZED_ACCEPT -#define accept_mutex_child_init(x) -#define accept_mutex_init(x) -#define accept_mutex_on() -#define accept_mutex_off() -#endif -#endif - -/* On some architectures it's safe to do unserialized accept()s in the single - * Listen case. But it's never safe to do it in the case where there's - * multiple Listen statements. Define SINGLE_LISTEN_UNSERIALIZED_ACCEPT - * when it's safe in the single Listen case. - */ -#ifdef SINGLE_LISTEN_UNSERIALIZED_ACCEPT -#define SAFE_ACCEPT(stmt) do {if(ap_listeners->next != ap_listeners) {stmt;}} while(0) -#else -#define SAFE_ACCEPT(stmt) do {stmt;} while(0) -#endif - -static void usage(char *bin) -{ - char pad[MAX_STRING_LEN]; - unsigned i; - - for (i = 0; i < strlen(bin); i++) - pad[i] = ' '; - pad[i] = '\0'; -#ifdef SHARED_CORE - fprintf(stderr, "Usage: %s [-R directory] [-D name] [-d directory] [-f file]\n", bin); -#else - fprintf(stderr, "Usage: %s [-D name] [-d directory] [-f file]\n", bin); -#endif - fprintf(stderr, " %s [-C \"directive\"] [-c \"directive\"]\n", pad); - fprintf(stderr, " %s [-v] [-V] [-h] [-l] [-L] [-S] [-t] [-T]\n", pad); -#ifdef WIN32 - fprintf(stderr, " %s [-n service] [-k signal] [-i] [-u]\n", pad); -#endif - fprintf(stderr, "Options:\n"); -#ifdef SHARED_CORE - fprintf(stderr, " -R directory : specify an alternate location for shared object files\n"); -#endif - fprintf(stderr, " -D name : define a name for use in directives\n"); - fprintf(stderr, " -d directory : specify an alternate initial ServerRoot\n"); - fprintf(stderr, " -f file : specify an alternate ServerConfigFile\n"); - fprintf(stderr, " -C \"directive\" : process directive before reading config files\n"); - fprintf(stderr, " -c \"directive\" : process directive after reading config files\n"); - fprintf(stderr, " -v : show version number\n"); - fprintf(stderr, " -V : show compile settings\n"); - fprintf(stderr, " -h : list available command line options (this page)\n"); - fprintf(stderr, " -l : list compiled-in modules\n"); - fprintf(stderr, " -L : list available configuration directives\n"); - fprintf(stderr, " -S : show parsed settings (currently only vhost settings)\n"); - fprintf(stderr, " -t : run syntax check for config files (with docroot check)\n"); - fprintf(stderr, " -T : run syntax check for config files (without docroot check)\n"); -#ifdef WIN32 - fprintf(stderr, " -n name : set service name and use its ServerConfigFile\n"); - fprintf(stderr, " -k shutdown : tell running Apache to shutdown\n"); - fprintf(stderr, " -k restart : tell running Apache to do a graceful restart\n"); - fprintf(stderr, " -k start : tell Apache to start\n"); - fprintf(stderr, " -i : install an Apache service\n"); - fprintf(stderr, " -u : uninstall an Apache service\n"); -#endif - exit(1); -} - -/***************************************************************** - * - * Timeout handling. DISTINCTLY not thread-safe, but all this stuff - * has to change for threads anyway. Note that this code allows only - * one timeout in progress at a time... - */ - -static APACHE_TLS conn_rec *volatile current_conn; -static APACHE_TLS request_rec *volatile timeout_req; -static APACHE_TLS const char *volatile timeout_name = NULL; -static APACHE_TLS int volatile alarms_blocked = 0; -static APACHE_TLS int volatile alarm_pending = 0; - -static void timeout(int sig) -{ - void *dirconf; - - if (alarms_blocked) { - alarm_pending = 1; - return; - } - if (exit_after_unblock) { - clean_child_exit(0); - } - - if (!current_conn) { - ap_longjmp(jmpbuffer, 1); - } - - if (timeout_req != NULL) - dirconf = timeout_req->per_dir_config; - else - dirconf = current_conn->server->lookup_defaults; - if (!current_conn->keptalive) { - ap_log_error(APLOG_MARK, APLOG_NOERRNO|APLOG_INFO, - current_conn->server, "[client %s] %s timed out", - current_conn->remote_ip, - timeout_name ? timeout_name : "request"); - } - - if (timeout_req) { - /* Someone has asked for this transaction to just be aborted - * if it times out... - */ - - request_rec *log_req = timeout_req; - request_rec *save_req = timeout_req; - - /* avoid looping... if ap_log_transaction started another - * timer (say via rfc1413.c) we could loop... - */ - timeout_req = NULL; - - while (log_req->main || log_req->prev) { - /* Get back to original request... */ - if (log_req->main) - log_req = log_req->main; - else - log_req = log_req->prev; - } - - if (!current_conn->keptalive) { - /* in some cases we come here before setting the time */ - if (log_req->request_time == 0) { - log_req->request_time = time(0); - } - ap_log_transaction(log_req); - } - - ap_bsetflag(save_req->connection->client, B_EOUT, 1); - ap_bclose(save_req->connection->client); - - if (!ap_standalone) - exit(0); - - ap_longjmp(jmpbuffer, 1); - } - else { /* abort the connection */ - ap_bsetflag(current_conn->client, B_EOUT, 1); - ap_bclose(current_conn->client); - current_conn->aborted = 1; - } -} - -#ifndef TPF -/* - * These two called from alloc.c to protect its critical sections... - * Note that they can nest (as when destroying the sub_pools of a pool - * which is itself being cleared); we have to support that here. - */ - -API_EXPORT(void) ap_block_alarms(void) -{ - ++alarms_blocked; -} - -API_EXPORT(void) ap_unblock_alarms(void) -{ - --alarms_blocked; - if (alarms_blocked == 0) { - if (exit_after_unblock) { - /* We have a couple race conditions to deal with here, we can't - * allow a timeout that comes in this small interval to allow - * the child to jump back to the main loop. Instead we block - * alarms again, and then note that exit_after_unblock is - * being dealt with. We choose this way to solve this so that - * the common path through unblock_alarms() is really short. - */ - ++alarms_blocked; - exit_after_unblock = 0; - clean_child_exit(0); - } - if (alarm_pending) { - alarm_pending = 0; - timeout(0); - } - } -} -#endif /* TPF */ - -static APACHE_TLS void (*volatile alarm_fn) (int) = NULL; -#ifdef WIN32 -static APACHE_TLS unsigned int alarm_expiry_time = 0; -#endif /* WIN32 */ - -#ifndef WIN32 -static void alrm_handler(int sig) -{ - if (alarm_fn) { - (*alarm_fn) (sig); - } -} -#endif - -unsigned int ap_set_callback_and_alarm(void (*fn) (int), int x) -{ - unsigned int old; - -#ifdef WIN32 - old = alarm_expiry_time; - if (old) - old -= time(0); - if (x == 0) { - alarm_fn = NULL; - alarm_expiry_time = 0; - } - else { - alarm_fn = fn; - alarm_expiry_time = time(NULL) + x; - } -#else - if (alarm_fn && x && fn != alarm_fn) { - ap_log_error(APLOG_MARK, APLOG_NOERRNO|APLOG_DEBUG, NULL, - "ap_set_callback_and_alarm: possible nested timer!"); - } - alarm_fn = fn; -#ifndef OPTIMIZE_TIMEOUTS - old = alarm(x); -#else - if (child_timeouts) { - old = alarm(x); - } - else { - /* Just note the timeout in our scoreboard, no need to call the system. - * We also note that the virtual time has gone forward. - */ - ap_check_signals(); - old = ap_scoreboard_image->servers[my_child_num].timeout_len; - ap_scoreboard_image->servers[my_child_num].timeout_len = x; - ++ap_scoreboard_image->servers[my_child_num].cur_vtime; - } -#endif -#endif - return (old); -} - - -#ifdef WIN32 -API_EXPORT(int) ap_check_alarm(void) -{ - if (alarm_expiry_time) { - unsigned int t; - - t = time(NULL); - if (t >= alarm_expiry_time) { - alarm_expiry_time = 0; - (*alarm_fn) (0); - return (-1); - } - else { - return (alarm_expiry_time - t); - } - } - else - return (0); -} -#endif /* WIN32 */ - - - -/* reset_timeout (request_rec *) resets the timeout in effect, - * as long as it hasn't expired already. - */ - -API_EXPORT(void) ap_reset_timeout(request_rec *r) -{ - int i; - - if (timeout_name) { /* timeout has been set */ - i = ap_set_callback_and_alarm(alarm_fn, r->server->timeout); - if (i == 0) /* timeout already expired, so set it back to 0 */ - ap_set_callback_and_alarm(alarm_fn, 0); - } -} - - - - -void ap_keepalive_timeout(char *name, request_rec *r) -{ - unsigned int to; - - timeout_req = r; - timeout_name = name; - - if (r->connection->keptalive) - to = r->server->keep_alive_timeout; - else - to = r->server->timeout; - ap_set_callback_and_alarm(timeout, to); - -} - -API_EXPORT(void) ap_hard_timeout(char *name, request_rec *r) -{ - timeout_req = r; - timeout_name = name; - - ap_set_callback_and_alarm(timeout, r->server->timeout); - -} - -API_EXPORT(void) ap_soft_timeout(char *name, request_rec *r) -{ - timeout_name = name; - - ap_set_callback_and_alarm(timeout, r->server->timeout); - -} - -API_EXPORT(void) ap_kill_timeout(request_rec *dummy) -{ - ap_check_signals(); - ap_set_callback_and_alarm(NULL, 0); - timeout_req = NULL; - timeout_name = NULL; -} - - -/* - * More machine-dependent networking gooo... on some systems, - * you've got to be *really* sure that all the packets are acknowledged - * before closing the connection, since the client will not be able - * to see the last response if their TCP buffer is flushed by a RST - * packet from us, which is what the server's TCP stack will send - * if it receives any request data after closing the connection. - * - * In an ideal world, this function would be accomplished by simply - * setting the socket option SO_LINGER and handling it within the - * server's TCP stack while the process continues on to the next request. - * Unfortunately, it seems that most (if not all) operating systems - * block the server process on close() when SO_LINGER is used. - * For those that don't, see USE_SO_LINGER below. For the rest, - * we have created a home-brew lingering_close. - * - * Many operating systems tend to block, puke, or otherwise mishandle - * calls to shutdown only half of the connection. You should define - * NO_LINGCLOSE in ap_config.h if such is the case for your system. - */ -#ifndef MAX_SECS_TO_LINGER -#define MAX_SECS_TO_LINGER 30 -#endif - -#ifdef USE_SO_LINGER -#define NO_LINGCLOSE /* The two lingering options are exclusive */ - -static void sock_enable_linger(int s) -{ - struct linger li; - - li.l_onoff = 1; - li.l_linger = MAX_SECS_TO_LINGER; - - if (setsockopt(s, SOL_SOCKET, SO_LINGER, - (char *) &li, sizeof(struct linger)) < 0) { - ap_log_error(APLOG_MARK, APLOG_WARNING, server_conf, - "setsockopt: (SO_LINGER)"); - /* not a fatal error */ - } -} - -#else -#define sock_enable_linger(s) /* NOOP */ -#endif /* USE_SO_LINGER */ - -#ifndef NO_LINGCLOSE - -/* Special version of timeout for lingering_close */ - -static void lingerout(int sig) -{ - if (alarms_blocked) { - alarm_pending = 1; - return; - } - - if (!current_conn) { - ap_longjmp(jmpbuffer, 1); - } - ap_bsetflag(current_conn->client, B_EOUT, 1); - current_conn->aborted = 1; -} - -static void linger_timeout(void) -{ - timeout_name = "lingering close"; - - ap_set_callback_and_alarm(lingerout, MAX_SECS_TO_LINGER); -} - -/* Since many clients will abort a connection instead of closing it, - * attempting to log an error message from this routine will only - * confuse the webmaster. There doesn't seem to be any portable way to - * distinguish between a dropped connection and something that might be - * worth logging. - */ -static void lingering_close(request_rec *r) -{ - char dummybuf[512]; - struct timeval tv; - fd_set lfds; - int select_rv; - int lsd; - - /* Prevent a slow-drip client from holding us here indefinitely */ - - linger_timeout(); - - /* Send any leftover data to the client, but never try to again */ - - if (ap_bflush(r->connection->client) == -1) { - ap_kill_timeout(r); - ap_bclose(r->connection->client); - return; - } - ap_bsetflag(r->connection->client, B_EOUT, 1); - - /* Close our half of the connection --- send the client a FIN */ - - lsd = r->connection->client->fd; - - if ((shutdown(lsd, 1) != 0) || r->connection->aborted) { - ap_kill_timeout(r); - ap_bclose(r->connection->client); - return; - } - - /* Set up to wait for readable data on socket... */ - - FD_ZERO(&lfds); - - /* Wait for readable data or error condition on socket; - * slurp up any data that arrives... We exit when we go for an - * interval of tv length without getting any more data, get an error - * from select(), get an error or EOF on a read, or the timer expires. - */ - - do { - /* We use a 2 second timeout because current (Feb 97) browsers - * fail to close a connection after the server closes it. Thus, - * to avoid keeping the child busy, we are only lingering long enough - * for a client that is actively sending data on a connection. - * This should be sufficient unless the connection is massively - * losing packets, in which case we might have missed the RST anyway. - * These parameters are reset on each pass, since they might be - * changed by select. - */ - FD_SET(lsd, &lfds); - tv.tv_sec = 2; - tv.tv_usec = 0; - - select_rv = ap_select(lsd + 1, &lfds, NULL, NULL, &tv); - - } while ((select_rv > 0) && - (read(lsd, dummybuf, sizeof dummybuf) > 0)); - - /* Should now have seen final ack. Safe to finally kill socket */ - - ap_bclose(r->connection->client); - - ap_kill_timeout(r); -} -#endif /* ndef NO_LINGCLOSE */ - -/***************************************************************** - * dealing with other children - */ - -#ifndef NO_OTHER_CHILD -API_EXPORT(void) ap_register_other_child(int pid, - void (*maintenance) (int reason, void *, ap_wait_t status), - void *data, int write_fd) -{ - other_child_rec *ocr; - - ocr = ap_palloc(pconf, sizeof(*ocr)); - ocr->pid = pid; - ocr->maintenance = maintenance; - ocr->data = data; - ocr->write_fd = write_fd; - ocr->next = other_children; - other_children = ocr; -} - -/* note that since this can be called by a maintenance function while we're - * scanning the other_children list, all scanners should protect themself - * by loading ocr->next before calling any maintenance function. - */ -API_EXPORT(void) ap_unregister_other_child(void *data) -{ - other_child_rec **pocr, *nocr; - - for (pocr = &other_children; *pocr; pocr = &(*pocr)->next) { - if ((*pocr)->data == data) { - nocr = (*pocr)->next; - (*(*pocr)->maintenance) (OC_REASON_UNREGISTER, (*pocr)->data, -1); - *pocr = nocr; - /* XXX: um, well we've just wasted some space in pconf ? */ - return; - } - } -} - -/* test to ensure that the write_fds are all still writable, otherwise - * invoke the maintenance functions as appropriate */ -static void probe_writable_fds(void) -{ - fd_set writable_fds; - int fd_max; - other_child_rec *ocr, *nocr; - struct timeval tv; - int rc; - - if (other_children == NULL) - return; - - fd_max = 0; - FD_ZERO(&writable_fds); - do { - for (ocr = other_children; ocr; ocr = ocr->next) { - if (ocr->write_fd == -1) - continue; - FD_SET(ocr->write_fd, &writable_fds); - if (ocr->write_fd > fd_max) { - fd_max = ocr->write_fd; - } - } - if (fd_max == 0) - return; - - tv.tv_sec = 0; - tv.tv_usec = 0; - rc = ap_select(fd_max + 1, NULL, &writable_fds, NULL, &tv); - } while (rc == -1 && errno == EINTR); - - if (rc == -1) { - /* XXX: uhh this could be really bad, we could have a bad file - * descriptor due to a bug in one of the maintenance routines */ - ap_log_unixerr("probe_writable_fds", "select", - "could not probe writable fds", server_conf); - return; - } - if (rc == 0) - return; - - for (ocr = other_children; ocr; ocr = nocr) { - nocr = ocr->next; - if (ocr->write_fd == -1) - continue; - if (FD_ISSET(ocr->write_fd, &writable_fds)) - continue; - (*ocr->maintenance) (OC_REASON_UNWRITABLE, ocr->data, -1); - } -} - -/* possibly reap an other_child, return 0 if yes, -1 if not */ -static int reap_other_child(int pid, ap_wait_t status) -{ - other_child_rec *ocr, *nocr; - - for (ocr = other_children; ocr; ocr = nocr) { - nocr = ocr->next; - if (ocr->pid != pid) - continue; - ocr->pid = -1; - (*ocr->maintenance) (OC_REASON_DEATH, ocr->data, status); - return 0; - } - return -1; -} -#endif - -/***************************************************************** - * - * Dealing with the scoreboard... a lot of these variables are global - * only to avoid getting clobbered by the longjmp() that happens when - * a hard timeout expires... - * - * We begin with routines which deal with the file itself... - */ - -#ifdef MULTITHREAD -/* - * In the multithreaded mode, have multiple threads - not multiple - * processes that need to talk to each other. Just use a simple - * malloc. But let the routines that follow, think that you have - * shared memory (so they use memcpy etc.) - */ - -static void reinit_scoreboard(pool *p) -{ - ap_assert(!ap_scoreboard_image); - ap_scoreboard_image = (scoreboard *) malloc(SCOREBOARD_SIZE); - if (ap_scoreboard_image == NULL) { - fprintf(stderr, "Ouch! Out of memory reiniting scoreboard!\n"); - } - memset(ap_scoreboard_image, 0, SCOREBOARD_SIZE); -} - -void cleanup_scoreboard(void) -{ - ap_assert(ap_scoreboard_image); - free(ap_scoreboard_image); - ap_scoreboard_image = NULL; -} - -API_EXPORT(void) ap_sync_scoreboard_image(void) -{ -} - - -#else /* MULTITHREAD */ -#if defined(USE_OS2_SCOREBOARD) - -/* The next two routines are used to access shared memory under OS/2. */ -/* This requires EMX v09c to be installed. */ - -caddr_t create_shared_heap(const char *name, size_t size) -{ - ULONG rc; - void *mem; - Heap_t h; - - rc = DosAllocSharedMem(&mem, name, size, - PAG_COMMIT | PAG_READ | PAG_WRITE); - if (rc != 0) - return NULL; - h = _ucreate(mem, size, !_BLOCK_CLEAN, _HEAP_REGULAR | _HEAP_SHARED, - NULL, NULL); - if (h == NULL) - DosFreeMem(mem); - return (caddr_t) h; -} - -caddr_t get_shared_heap(const char *Name) -{ - - PVOID BaseAddress; /* Pointer to the base address of - the shared memory object */ - ULONG AttributeFlags; /* Flags describing characteristics - of the shared memory object */ - APIRET rc; /* Return code */ - - /* Request read and write access to */ - /* the shared memory object */ - AttributeFlags = PAG_WRITE | PAG_READ; - - rc = DosGetNamedSharedMem(&BaseAddress, Name, AttributeFlags); - - if (rc != 0) { - printf("DosGetNamedSharedMem error: return code = %ld", rc); - return 0; - } - - return BaseAddress; -} - -static void setup_shared_mem(pool *p) -{ - caddr_t m; - - int rc; - - m = (caddr_t) create_shared_heap("\\SHAREMEM\\SCOREBOARD", SCOREBOARD_SIZE); - if (m == 0) { - fprintf(stderr, "%s: Could not create OS/2 Shared memory pool.\n", - ap_server_argv0); - exit(APEXIT_INIT); - } - - rc = _uopen((Heap_t) m); - if (rc != 0) { - fprintf(stderr, - "%s: Could not uopen() newly created OS/2 Shared memory pool.\n", - ap_server_argv0); - } - ap_scoreboard_image = (scoreboard *) m; - ap_scoreboard_image->global.running_generation = 0; -} - -static void reopen_scoreboard(pool *p) -{ - caddr_t m; - int rc; - - m = (caddr_t) get_shared_heap("\\SHAREMEM\\SCOREBOARD"); - if (m == 0) { - fprintf(stderr, "%s: Could not find existing OS/2 Shared memory pool.\n", - ap_server_argv0); - exit(APEXIT_INIT); - } - - rc = _uopen((Heap_t) m); - ap_scoreboard_image = (scoreboard *) m; -} - -#elif defined(USE_POSIX_SCOREBOARD) -#include -/* - * POSIX 1003.4 style - * - * Note 1: - * As of version 4.23A, shared memory in QNX must reside under /dev/shmem, - * where no subdirectories allowed. - * - * POSIX shm_open() and shm_unlink() will take care about this issue, - * but to avoid confusion, I suggest to redefine scoreboard file name - * in httpd.conf to cut "logs/" from it. With default setup actual name - * will be "/dev/shmem/logs.apache_status". - * - * If something went wrong and Apache did not unlinked this object upon - * exit, you can remove it manually, using "rm -f" command. - * - * Note 2: - * in QNX defines MAP_ANON, but current implementation - * does NOT support BSD style anonymous mapping. So, the order of - * conditional compilation is important: - * this #ifdef section must be ABOVE the next one (BSD style). - * - * I tested this stuff and it works fine for me, but if it provides - * trouble for you, just comment out USE_MMAP_SCOREBOARD in QNX section - * of ap_config.h - * - * June 5, 1997, - * Igor N. Kovalenko -- infoh@mail.wplus.net - */ - -static void cleanup_shared_mem(void *d) -{ - shm_unlink(ap_scoreboard_fname); -} - -static void setup_shared_mem(pool *p) -{ - char buf[512]; - caddr_t m; - int fd; - - fd = shm_open(ap_scoreboard_fname, O_RDWR | O_CREAT, S_IRUSR | S_IWUSR); - if (fd == -1) { - ap_snprintf(buf, sizeof(buf), "%s: could not open(create) scoreboard", - ap_server_argv0); - perror(buf); - exit(APEXIT_INIT); - } - if (ltrunc(fd, (off_t) SCOREBOARD_SIZE, SEEK_SET) == -1) { - ap_snprintf(buf, sizeof(buf), "%s: could not ltrunc scoreboard", - ap_server_argv0); - perror(buf); - shm_unlink(ap_scoreboard_fname); - exit(APEXIT_INIT); - } - if ((m = (caddr_t) mmap((caddr_t) 0, - (size_t) SCOREBOARD_SIZE, PROT_READ | PROT_WRITE, - MAP_SHARED, fd, (off_t) 0)) == (caddr_t) - 1) { - ap_snprintf(buf, sizeof(buf), "%s: cannot mmap scoreboard", - ap_server_argv0); - perror(buf); - shm_unlink(ap_scoreboard_fname); - exit(APEXIT_INIT); - } - close(fd); - ap_register_cleanup(p, NULL, cleanup_shared_mem, ap_null_cleanup); - ap_scoreboard_image = (scoreboard *) m; - ap_scoreboard_image->global.running_generation = 0; -} - -static void reopen_scoreboard(pool *p) -{ -} - -#elif defined(USE_MMAP_SCOREBOARD) - -static void setup_shared_mem(pool *p) -{ - caddr_t m; - -#if defined(MAP_ANON) -/* BSD style */ -#ifdef CONVEXOS11 - /* - * 9-Aug-97 - Jeff Venters (venters@convex.hp.com) - * ConvexOS maps address space as follows: - * 0x00000000 - 0x7fffffff : Kernel - * 0x80000000 - 0xffffffff : User - * Start mmapped area 1GB above start of text. - * - * Also, the length requires a pointer as the actual length is - * returned (rounded up to a page boundary). - */ - { - unsigned len = SCOREBOARD_SIZE; - - m = mmap((caddr_t) 0xC0000000, &len, - PROT_READ | PROT_WRITE, MAP_ANON | MAP_SHARED, NOFD, 0); - } -#elif defined(MAP_TMPFILE) - { - char mfile[] = "/tmp/apache_shmem_XXXX"; - int fd = mkstemp(mfile); - if (fd == -1) { - perror("open"); - fprintf(stderr, "%s: Could not open %s\n", ap_server_argv0, mfile); - exit(APEXIT_INIT); - } - m = mmap((caddr_t) 0, SCOREBOARD_SIZE, - PROT_READ | PROT_WRITE, MAP_SHARED, fd, 0); - if (m == (caddr_t) - 1) { - perror("mmap"); - fprintf(stderr, "%s: Could not mmap %s\n", ap_server_argv0, mfile); - exit(APEXIT_INIT); - } - close(fd); - unlink(mfile); - } -#else - m = mmap((caddr_t) 0, SCOREBOARD_SIZE, - PROT_READ | PROT_WRITE, MAP_ANON | MAP_SHARED, -1, 0); -#endif - if (m == (caddr_t) - 1) { - perror("mmap"); - fprintf(stderr, "%s: Could not mmap memory\n", ap_server_argv0); - exit(APEXIT_INIT); - } -#else -/* Sun style */ - int fd; - - fd = open("/dev/zero", O_RDWR); - if (fd == -1) { - perror("open"); - fprintf(stderr, "%s: Could not open /dev/zero\n", ap_server_argv0); - exit(APEXIT_INIT); - } - m = mmap((caddr_t) 0, SCOREBOARD_SIZE, - PROT_READ | PROT_WRITE, MAP_SHARED, fd, 0); - if (m == (caddr_t) - 1) { - perror("mmap"); - fprintf(stderr, "%s: Could not mmap /dev/zero\n", ap_server_argv0); - exit(APEXIT_INIT); - } - close(fd); -#endif - ap_scoreboard_image = (scoreboard *) m; - ap_scoreboard_image->global.running_generation = 0; -} - -static void reopen_scoreboard(pool *p) -{ -} - -#elif defined(USE_SHMGET_SCOREBOARD) -static key_t shmkey = IPC_PRIVATE; -static int shmid = -1; - -static void setup_shared_mem(pool *p) -{ - struct shmid_ds shmbuf; -#ifdef MOVEBREAK - char *obrk; -#endif - - if ((shmid = shmget(shmkey, SCOREBOARD_SIZE, IPC_CREAT | SHM_R | SHM_W)) == -1) { -#ifdef LINUX - if (errno == ENOSYS) { - ap_log_error(APLOG_MARK, APLOG_NOERRNO|APLOG_EMERG, server_conf, - "Your kernel was built without CONFIG_SYSVIPC\n" - "%s: Please consult the Apache FAQ for details", - ap_server_argv0); - } -#endif - ap_log_error(APLOG_MARK, APLOG_EMERG, server_conf, - "could not call shmget"); - exit(APEXIT_INIT); - } - - ap_log_error(APLOG_MARK, APLOG_NOERRNO|APLOG_INFO, server_conf, - "created shared memory segment #%d", shmid); - -#ifdef MOVEBREAK - /* - * Some SysV systems place the shared segment WAY too close - * to the dynamic memory break point (sbrk(0)). This severely - * limits the use of malloc/sbrk in the program since sbrk will - * refuse to move past that point. - * - * To get around this, we move the break point "way up there", - * attach the segment and then move break back down. Ugly - */ - if ((obrk = sbrk(MOVEBREAK)) == (char *) -1) { - ap_log_error(APLOG_MARK, APLOG_ERR, server_conf, - "sbrk() could not move break"); - } -#endif - -#define BADSHMAT ((scoreboard *)(-1)) - if ((ap_scoreboard_image = (scoreboard *) shmat(shmid, 0, 0)) == BADSHMAT) { - ap_log_error(APLOG_MARK, APLOG_EMERG, server_conf, "shmat error"); - /* - * We exit below, after we try to remove the segment - */ - } - else { /* only worry about permissions if we attached the segment */ - if (shmctl(shmid, IPC_STAT, &shmbuf) != 0) { - ap_log_error(APLOG_MARK, APLOG_ERR, server_conf, - "shmctl() could not stat segment #%d", shmid); - } - else { - shmbuf.shm_perm.uid = ap_user_id; - shmbuf.shm_perm.gid = ap_group_id; - if (shmctl(shmid, IPC_SET, &shmbuf) != 0) { - ap_log_error(APLOG_MARK, APLOG_ERR, server_conf, - "shmctl() could not set segment #%d", shmid); - } - } - } - /* - * We must avoid leaving segments in the kernel's - * (small) tables. - */ - if (shmctl(shmid, IPC_RMID, NULL) != 0) { - ap_log_error(APLOG_MARK, APLOG_WARNING, server_conf, - "shmctl: IPC_RMID: could not remove shared memory segment #%d", - shmid); - } - if (ap_scoreboard_image == BADSHMAT) /* now bailout */ - exit(APEXIT_INIT); - -#ifdef MOVEBREAK - if (obrk == (char *) -1) - return; /* nothing else to do */ - if (sbrk(-(MOVEBREAK)) == (char *) -1) { - ap_log_error(APLOG_MARK, APLOG_ERR, server_conf, - "sbrk() could not move break back"); - } -#endif - ap_scoreboard_image->global.running_generation = 0; -} - -static void reopen_scoreboard(pool *p) -{ -} - -#elif defined(USE_TPF_SCOREBOARD) - -static void cleanup_scoreboard_heap() -{ - int rv; - rv = rsysc(ap_scoreboard_image, SCOREBOARD_FRAMES, SCOREBOARD_NAME); - if(rv == RSYSC_ERROR) { - ap_log_error(APLOG_MARK, APLOG_ERR, server_conf, - "rsysc() could not release scoreboard system heap"); - } -} - -static void setup_shared_mem(pool *p) -{ - cinfc(CINFC_WRITE, CINFC_CMMCTK2); - ap_scoreboard_image = (scoreboard *) gsysc(SCOREBOARD_FRAMES, SCOREBOARD_NAME); - - if (!ap_scoreboard_image) { - fprintf(stderr, "httpd: Could not create scoreboard system heap storage.\n"); - exit(APEXIT_INIT); - } - - ap_register_cleanup(p, NULL, cleanup_scoreboard_heap, ap_null_cleanup); - ap_scoreboard_image->global.running_generation = 0; -} - -static void reopen_scoreboard(pool *p) -{ - cinfc(CINFC_WRITE, CINFC_CMMCTK2); -} - -#else -#define SCOREBOARD_FILE -static scoreboard _scoreboard_image; -static int scoreboard_fd = -1; - -/* XXX: things are seriously screwed if we ever have to do a partial - * read or write ... we could get a corrupted scoreboard - */ -static int force_write(int fd, void *buffer, int bufsz) -{ - int rv, orig_sz = bufsz; - - do { - rv = write(fd, buffer, bufsz); - if (rv > 0) { - buffer = (char *) buffer + rv; - bufsz -= rv; - } - } while ((rv > 0 && bufsz > 0) || (rv == -1 && errno == EINTR)); - - return rv < 0 ? rv : orig_sz - bufsz; -} - -static int force_read(int fd, void *buffer, int bufsz) -{ - int rv, orig_sz = bufsz; - - do { - rv = read(fd, buffer, bufsz); - if (rv > 0) { - buffer = (char *) buffer + rv; - bufsz -= rv; - } - } while ((rv > 0 && bufsz > 0) || (rv == -1 && errno == EINTR)); - - return rv < 0 ? rv : orig_sz - bufsz; -} - -static void cleanup_scoreboard_file(void *foo) -{ - unlink(ap_scoreboard_fname); -} - -void reopen_scoreboard(pool *p) -{ - if (scoreboard_fd != -1) - ap_pclosef(p, scoreboard_fd); - -#ifdef TPF - ap_scoreboard_fname = ap_server_root_relative(p, ap_scoreboard_fname); -#endif /* TPF */ - scoreboard_fd = ap_popenf(p, ap_scoreboard_fname, O_CREAT | O_BINARY | O_RDWR, 0666); - if (scoreboard_fd == -1) { - perror(ap_scoreboard_fname); - fprintf(stderr, "Cannot open scoreboard file:\n"); - clean_child_exit(1); - } -} -#endif - -/* Called by parent process */ -static void reinit_scoreboard(pool *p) -{ - int running_gen = 0; - if (ap_scoreboard_image) - running_gen = ap_scoreboard_image->global.running_generation; - -#ifndef SCOREBOARD_FILE - if (ap_scoreboard_image == NULL) { - setup_shared_mem(p); - } - memset(ap_scoreboard_image, 0, SCOREBOARD_SIZE); - ap_scoreboard_image->global.running_generation = running_gen; -#else - ap_scoreboard_image = &_scoreboard_image; - ap_scoreboard_fname = ap_server_root_relative(p, ap_scoreboard_fname); - - scoreboard_fd = ap_popenf(p, ap_scoreboard_fname, O_CREAT | O_BINARY | O_RDWR, 0644); - if (scoreboard_fd == -1) { - perror(ap_scoreboard_fname); - fprintf(stderr, "Cannot open scoreboard file:\n"); - exit(APEXIT_INIT); - } - ap_register_cleanup(p, NULL, cleanup_scoreboard_file, ap_null_cleanup); - - memset((char *) ap_scoreboard_image, 0, sizeof(*ap_scoreboard_image)); - ap_scoreboard_image->global.running_generation = running_gen; - force_write(scoreboard_fd, ap_scoreboard_image, sizeof(*ap_scoreboard_image)); -#endif -} - -/* Routines called to deal with the scoreboard image - * --- note that we do *not* need write locks, since update_child_status - * only updates a *single* record in place, and only one process writes to - * a given scoreboard slot at a time (either the child process owning that - * slot, or the parent, noting that the child has died). - * - * As a final note --- setting the score entry to getpid() is always safe, - * since when the parent is writing an entry, it's only noting SERVER_DEAD - * anyway. - */ - -ap_inline void ap_sync_scoreboard_image(void) -{ -#ifdef SCOREBOARD_FILE - lseek(scoreboard_fd, 0L, 0); - force_read(scoreboard_fd, ap_scoreboard_image, sizeof(*ap_scoreboard_image)); -#endif -} - -#endif /* MULTITHREAD */ - -API_EXPORT(int) ap_exists_scoreboard_image(void) -{ - return (ap_scoreboard_image ? 1 : 0); -} - -static ap_inline void put_scoreboard_info(int child_num, - short_score *new_score_rec) -{ -#ifdef SCOREBOARD_FILE - lseek(scoreboard_fd, (long) child_num * sizeof(short_score), 0); - force_write(scoreboard_fd, new_score_rec, sizeof(short_score)); -#endif -} - -/* a clean exit from the parent with proper cleanup */ -static void clean_parent_exit(int code) __attribute__((noreturn)); -static void clean_parent_exit(int code) -{ - /* Clear the pool - including any registered cleanups */ - ap_destroy_pool(pglobal); - exit(code); -} - -int ap_update_child_status(int child_num, int status, request_rec *r) -{ - int old_status; - short_score *ss; - - if (child_num < 0) - return -1; - - ap_check_signals(); - - ap_sync_scoreboard_image(); - ss = &ap_scoreboard_image->servers[child_num]; - old_status = ss->status; - ss->status = status; -#ifdef OPTIMIZE_TIMEOUTS - ++ss->cur_vtime; -#endif - - if (ap_extended_status) { -#ifndef OPTIMIZE_TIMEOUTS - ss->last_used = time(NULL); -#endif - if (status == SERVER_READY || status == SERVER_DEAD) { - /* - * Reset individual counters - */ - if (status == SERVER_DEAD) { - ss->my_access_count = 0L; - ss->my_bytes_served = 0L; - } - ss->conn_count = (unsigned short) 0; - ss->conn_bytes = (unsigned long) 0; - } - if (r) { - conn_rec *c = r->connection; - ap_cpystrn(ss->client, ap_get_remote_host(c, r->per_dir_config, - REMOTE_NOLOOKUP), sizeof(ss->client)); - if (r->the_request == NULL) { - ap_cpystrn(ss->request, "NULL", sizeof(ss->request)); - } else if (r->parsed_uri.password == NULL) { - ap_cpystrn(ss->request, r->the_request, sizeof(ss->request)); - } else { - /* Don't reveal the password in the server-status view */ - ap_cpystrn(ss->request, ap_pstrcat(r->pool, r->method, " ", - ap_unparse_uri_components(r->pool, &r->parsed_uri, UNP_OMITPASSWORD), - r->assbackwards ? NULL : " ", r->protocol, NULL), - sizeof(ss->request)); - } - ss->vhostrec = r->server; - } - } - if (status == SERVER_STARTING && r == NULL) { - /* clean up the slot's vhostrec pointer (maybe re-used) - * and mark the slot as belonging to a new generation. - */ - ss->vhostrec = NULL; - ap_scoreboard_image->parent[child_num].generation = ap_my_generation; -#ifdef SCOREBOARD_FILE - lseek(scoreboard_fd, XtOffsetOf(scoreboard, parent[child_num]), 0); - force_write(scoreboard_fd, &ap_scoreboard_image->parent[child_num], - sizeof(parent_score)); -#endif - } - put_scoreboard_info(child_num, ss); - - return old_status; -} - -static void update_scoreboard_global(void) -{ -#ifdef SCOREBOARD_FILE - lseek(scoreboard_fd, - (char *) &ap_scoreboard_image->global -(char *) ap_scoreboard_image, 0); - force_write(scoreboard_fd, &ap_scoreboard_image->global, - sizeof ap_scoreboard_image->global); -#endif -} - -void ap_time_process_request(int child_num, int status) -{ - short_score *ss; -#if defined(NO_GETTIMEOFDAY) && !defined(NO_TIMES) - struct tms tms_blk; -#endif - - if (child_num < 0) - return; - - ap_sync_scoreboard_image(); - ss = &ap_scoreboard_image->servers[child_num]; - - if (status == START_PREQUEST) { -#if defined(NO_GETTIMEOFDAY) -#ifndef NO_TIMES - if ((ss->start_time = times(&tms_blk)) == -1) -#endif /* NO_TIMES */ - ss->start_time = (clock_t) 0; -#else - if (gettimeofday(&ss->start_time, (struct timezone *) 0) < 0) - ss->start_time.tv_sec = - ss->start_time.tv_usec = 0L; -#endif - } - else if (status == STOP_PREQUEST) { -#if defined(NO_GETTIMEOFDAY) -#ifndef NO_TIMES - if ((ss->stop_time = times(&tms_blk)) == -1) -#endif - ss->stop_time = ss->start_time = (clock_t) 0; -#else - if (gettimeofday(&ss->stop_time, (struct timezone *) 0) < 0) - ss->stop_time.tv_sec = - ss->stop_time.tv_usec = - ss->start_time.tv_sec = - ss->start_time.tv_usec = 0L; -#endif - - } - - put_scoreboard_info(child_num, ss); -} - -static void increment_counts(int child_num, request_rec *r) -{ - long int bs = 0; - short_score *ss; - - ap_sync_scoreboard_image(); - ss = &ap_scoreboard_image->servers[child_num]; - - if (r->sent_bodyct) - ap_bgetopt(r->connection->client, BO_BYTECT, &bs); - -#ifndef NO_TIMES - times(&ss->times); -#endif - ss->access_count++; - ss->my_access_count++; - ss->conn_count++; - ss->bytes_served += (unsigned long) bs; - ss->my_bytes_served += (unsigned long) bs; - ss->conn_bytes += (unsigned long) bs; - - put_scoreboard_info(child_num, ss); -} - -static int find_child_by_pid(int pid) -{ - int i; - - for (i = 0; i < max_daemons_limit; ++i) - if (ap_scoreboard_image->parent[i].pid == pid) - return i; - - return -1; -} - -static void reclaim_child_processes(int terminate) -{ -#ifndef MULTITHREAD - int i, status; - long int waittime = 1024 * 16; /* in usecs */ - struct timeval tv; - int waitret, tries; - int not_dead_yet; -#ifndef NO_OTHER_CHILD - other_child_rec *ocr, *nocr; -#endif - - ap_sync_scoreboard_image(); - - for (tries = terminate ? 4 : 1; tries <= 9; ++tries) { - /* don't want to hold up progress any more than - * necessary, but we need to allow children a few moments to exit. - * Set delay with an exponential backoff. - */ - tv.tv_sec = waittime / 1000000; - tv.tv_usec = waittime % 1000000; - waittime = waittime * 4; - ap_select(0, NULL, NULL, NULL, &tv); - - /* now see who is done */ - not_dead_yet = 0; - for (i = 0; i < max_daemons_limit; ++i) { - int pid = ap_scoreboard_image->parent[i].pid; - - if (pid == my_pid || pid == 0) - continue; - - waitret = waitpid(pid, &status, WNOHANG); - if (waitret == pid || waitret == -1) { - ap_scoreboard_image->parent[i].pid = 0; - continue; - } - ++not_dead_yet; - switch (tries) { - case 1: /* 16ms */ - case 2: /* 82ms */ - break; - case 3: /* 344ms */ - /* perhaps it missed the SIGHUP, lets try again */ - ap_log_error(APLOG_MARK, APLOG_NOERRNO|APLOG_WARNING, - server_conf, - "child process %d did not exit, sending another SIGHUP", - pid); - kill(pid, SIGHUP); - waittime = 1024 * 16; - break; - case 4: /* 16ms */ - case 5: /* 82ms */ - case 6: /* 344ms */ - break; - case 7: /* 1.4sec */ - /* ok, now it's being annoying */ - ap_log_error(APLOG_MARK, APLOG_NOERRNO|APLOG_WARNING, - server_conf, - "child process %d still did not exit, sending a SIGTERM", - pid); - kill(pid, SIGTERM); - break; - case 8: /* 6 sec */ - /* die child scum */ - ap_log_error(APLOG_MARK, APLOG_NOERRNO|APLOG_ERR, server_conf, - "child process %d still did not exit, sending a SIGKILL", - pid); - kill(pid, SIGKILL); - break; - case 9: /* 14 sec */ - /* gave it our best shot, but alas... If this really - * is a child we are trying to kill and it really hasn't - * exited, we will likely fail to bind to the port - * after the restart. - */ - ap_log_error(APLOG_MARK, APLOG_NOERRNO|APLOG_ERR, server_conf, - "could not make child process %d exit, " - "attempting to continue anyway", pid); - break; - } - } -#ifndef NO_OTHER_CHILD - for (ocr = other_children; ocr; ocr = nocr) { - nocr = ocr->next; - if (ocr->pid == -1) - continue; - - waitret = waitpid(ocr->pid, &status, WNOHANG); - if (waitret == ocr->pid) { - ocr->pid = -1; - (*ocr->maintenance) (OC_REASON_DEATH, ocr->data, status); - } - else if (waitret == 0) { - (*ocr->maintenance) (OC_REASON_RESTART, ocr->data, -1); - ++not_dead_yet; - } - else if (waitret == -1) { - /* uh what the heck? they didn't call unregister? */ - ocr->pid = -1; - (*ocr->maintenance) (OC_REASON_LOST, ocr->data, -1); - } - } -#endif - if (!not_dead_yet) { - /* nothing left to wait for */ - break; - } - } -#endif /* ndef MULTITHREAD */ -} - - -#if defined(NEED_WAITPID) -/* - Systems without a real waitpid sometimes lose a child's exit while waiting - for another. Search through the scoreboard for missing children. - */ -int reap_children(ap_wait_t *status) -{ - int n, pid; - - for (n = 0; n < max_daemons_limit; ++n) { - ap_sync_scoreboard_image(); - if (ap_scoreboard_image->servers[n].status != SERVER_DEAD && - kill((pid = ap_scoreboard_image->parent[n].pid), 0) == -1) { - ap_update_child_status(n, SERVER_DEAD, NULL); - /* just mark it as having a successful exit status */ - bzero((char *) status, sizeof(ap_wait_t)); - return(pid); - } - } - return 0; -} -#endif - -/* Finally, this routine is used by the caretaker process to wait for - * a while... - */ - -/* number of calls to wait_or_timeout between writable probes */ -#ifndef INTERVAL_OF_WRITABLE_PROBES -#define INTERVAL_OF_WRITABLE_PROBES 10 -#endif -static int wait_or_timeout_counter; - -static int wait_or_timeout(ap_wait_t *status) -{ -#ifdef WIN32 -#define MAXWAITOBJ MAXIMUM_WAIT_OBJECTS - HANDLE h[MAXWAITOBJ]; - int e[MAXWAITOBJ]; - int round, pi, hi, rv, err; - for (round = 0; round <= (HARD_SERVER_LIMIT - 1) / MAXWAITOBJ + 1; round++) { - hi = 0; - for (pi = round * MAXWAITOBJ; - (pi < (round + 1) * MAXWAITOBJ) && (pi < HARD_SERVER_LIMIT); - pi++) { - if (ap_scoreboard_image->servers[pi].status != SERVER_DEAD) { - e[hi] = pi; - h[hi++] = (HANDLE) ap_scoreboard_image->parent[pi].pid; - } - - } - if (hi > 0) { - rv = WaitForMultipleObjects(hi, h, FALSE, 10000); - if (rv == -1) - err = GetLastError(); - if ((WAIT_OBJECT_0 <= (unsigned int) rv) && ((unsigned int) rv < (WAIT_OBJECT_0 + hi))) - return (ap_scoreboard_image->parent[e[rv - WAIT_OBJECT_0]].pid); - else if ((WAIT_ABANDONED_0 <= (unsigned int) rv) && ((unsigned int) rv < (WAIT_ABANDONED_0 + hi))) - return (ap_scoreboard_image->parent[e[rv - WAIT_ABANDONED_0]].pid); - - } - } - return (-1); - -#else /* WIN32 */ - struct timeval tv; - int ret; - - ++wait_or_timeout_counter; - if (wait_or_timeout_counter == INTERVAL_OF_WRITABLE_PROBES) { - wait_or_timeout_counter = 0; -#ifndef NO_OTHER_CHILD - probe_writable_fds(); -#endif - } - ret = waitpid(-1, status, WNOHANG); - if (ret == -1 && errno == EINTR) { - return -1; - } - if (ret > 0) { - return ret; - } -#ifdef NEED_WAITPID - if ((ret = reap_children(status)) > 0) { - return ret; - } -#endif - tv.tv_sec = SCOREBOARD_MAINTENANCE_INTERVAL / 1000000; - tv.tv_usec = SCOREBOARD_MAINTENANCE_INTERVAL % 1000000; - ap_select(0, NULL, NULL, NULL, &tv); - return -1; -#endif /* WIN32 */ -} - - -#if defined(NSIG) -#define NumSIG NSIG -#elif defined(_NSIG) -#define NumSIG _NSIG -#elif defined(__NSIG) -#define NumSIG __NSIG -#else -#define NumSIG 32 /* for 1998's unixes, this is still a good assumption */ -#endif - -#ifdef SYS_SIGLIST /* platform has sys_siglist[] */ -#define INIT_SIGLIST() /*nothing*/ -#else /* platform has no sys_siglist[], define our own */ -#define SYS_SIGLIST ap_sys_siglist -#define INIT_SIGLIST() siglist_init(); - -const char *ap_sys_siglist[NumSIG]; - -static void siglist_init(void) -{ - int sig; - - ap_sys_siglist[0] = "Signal 0"; -#ifdef SIGHUP - ap_sys_siglist[SIGHUP] = "Hangup"; -#endif -#ifdef SIGINT - ap_sys_siglist[SIGINT] = "Interrupt"; -#endif -#ifdef SIGQUIT - ap_sys_siglist[SIGQUIT] = "Quit"; -#endif -#ifdef SIGILL - ap_sys_siglist[SIGILL] = "Illegal instruction"; -#endif -#ifdef SIGTRAP - ap_sys_siglist[SIGTRAP] = "Trace/BPT trap"; -#endif -#ifdef SIGIOT - ap_sys_siglist[SIGIOT] = "IOT instruction"; -#endif -#ifdef SIGABRT - ap_sys_siglist[SIGABRT] = "Abort"; -#endif -#ifdef SIGEMT - ap_sys_siglist[SIGEMT] = "Emulator trap"; -#endif -#ifdef SIGFPE - ap_sys_siglist[SIGFPE] = "Arithmetic exception"; -#endif -#ifdef SIGKILL - ap_sys_siglist[SIGKILL] = "Killed"; -#endif -#ifdef SIGBUS - ap_sys_siglist[SIGBUS] = "Bus error"; -#endif -#ifdef SIGSEGV - ap_sys_siglist[SIGSEGV] = "Segmentation fault"; -#endif -#ifdef SIGSYS - ap_sys_siglist[SIGSYS] = "Bad system call"; -#endif -#ifdef SIGPIPE - ap_sys_siglist[SIGPIPE] = "Broken pipe"; -#endif -#ifdef SIGALRM - ap_sys_siglist[SIGALRM] = "Alarm clock"; -#endif -#ifdef SIGTERM - ap_sys_siglist[SIGTERM] = "Terminated"; -#endif -#ifdef SIGUSR1 - ap_sys_siglist[SIGUSR1] = "User defined signal 1"; -#endif -#ifdef SIGUSR2 - ap_sys_siglist[SIGUSR2] = "User defined signal 2"; -#endif -#ifdef SIGCLD - ap_sys_siglist[SIGCLD] = "Child status change"; -#endif -#ifdef SIGCHLD - ap_sys_siglist[SIGCHLD] = "Child status change"; -#endif -#ifdef SIGPWR - ap_sys_siglist[SIGPWR] = "Power-fail restart"; -#endif -#ifdef SIGWINCH - ap_sys_siglist[SIGWINCH] = "Window changed"; -#endif -#ifdef SIGURG - ap_sys_siglist[SIGURG] = "urgent socket condition"; -#endif -#ifdef SIGPOLL - ap_sys_siglist[SIGPOLL] = "Pollable event occurred"; -#endif -#ifdef SIGIO - ap_sys_siglist[SIGIO] = "socket I/O possible"; -#endif -#ifdef SIGSTOP - ap_sys_siglist[SIGSTOP] = "Stopped (signal)"; -#endif -#ifdef SIGTSTP - ap_sys_siglist[SIGTSTP] = "Stopped"; -#endif -#ifdef SIGCONT - ap_sys_siglist[SIGCONT] = "Continued"; -#endif -#ifdef SIGTTIN - ap_sys_siglist[SIGTTIN] = "Stopped (tty input)"; -#endif -#ifdef SIGTTOU - ap_sys_siglist[SIGTTOU] = "Stopped (tty output)"; -#endif -#ifdef SIGVTALRM - ap_sys_siglist[SIGVTALRM] = "virtual timer expired"; -#endif -#ifdef SIGPROF - ap_sys_siglist[SIGPROF] = "profiling timer expired"; -#endif -#ifdef SIGXCPU - ap_sys_siglist[SIGXCPU] = "exceeded cpu limit"; -#endif -#ifdef SIGXFSZ - ap_sys_siglist[SIGXFSZ] = "exceeded file size limit"; -#endif - for (sig=0; sig < sizeof(ap_sys_siglist)/sizeof(ap_sys_siglist[0]); ++sig) - if (ap_sys_siglist[sig] == NULL) - ap_sys_siglist[sig] = ""; -} -#endif /* platform has sys_siglist[] */ - - -/* handle all varieties of core dumping signals */ -static void sig_coredump(int sig) -{ - chdir(ap_coredump_dir); - signal(sig, SIG_DFL); -#ifndef WIN32 - kill(getpid(), sig); -#else - raise(sig); -#endif - /* At this point we've got sig blocked, because we're still inside - * the signal handler. When we leave the signal handler it will - * be unblocked, and we'll take the signal... and coredump or whatever - * is appropriate for this particular Unix. In addition the parent - * will see the real signal we received -- whereas if we called - * abort() here, the parent would only see SIGABRT. - */ -} - -/***************************************************************** - * Connection structures and accounting... - */ - -static void just_die(int sig) -{ /* SIGHUP to child process??? */ - /* if alarms are blocked we have to wait to die otherwise we might - * end up with corruption in alloc.c's internal structures */ - if (alarms_blocked) { - exit_after_unblock = 1; - } - else { - clean_child_exit(0); - } -} - -static int volatile usr1_just_die = 1; -static int volatile deferred_die; - -static void usr1_handler(int sig) -{ - if (usr1_just_die) { - just_die(sig); - } - deferred_die = 1; -} - -/* volatile just in case */ -static int volatile shutdown_pending; -static int volatile restart_pending; -static int volatile is_graceful; -ap_generation_t volatile ap_my_generation=0; - -#ifdef WIN32 -/* - * Signalling Apache on NT. - * - * Under Unix, Apache can be told to shutdown or restart by sending various - * signals (HUP, USR, TERM). On NT we don't have easy access to signals, so - * we use "events" instead. The parent apache process goes into a loop - * where it waits forever for a set of events. Two of those events are - * called - * - * apPID_shutdown - * apPID_restart - * - * (where PID is the PID of the apache parent process). When one of these - * is signalled, the Apache parent performs the appropriate action. The events - * can become signalled through internal Apache methods (e.g. if the child - * finds a fatal error and needs to kill its parent), via the service - * control manager (the control thread will signal the shutdown event when - * requested to stop the Apache service), from the -k Apache command line, - * or from any external program which finds the Apache PID from the - * httpd.pid file. - * - * The signal_parent() function, below, is used to signal one of these events. - * It can be called by any child or parent process, since it does not - * rely on global variables. - * - * On entry, type gives the event to signal. 0 means shutdown, 1 means - * graceful restart. - */ - -static void signal_parent(int type) -{ - HANDLE e; - char *signal_name; - extern char signal_shutdown_name[]; - extern char signal_restart_name[]; - - /* after updating the shutdown_pending or restart flags, we need - * to wake up the parent process so it can see the changes. The - * parent will normally be waiting for either a child process - * to die, or for a signal on the "spache-signal" event. So set the - * "apache-signal" event here. - */ - - if (one_process) { - return; - } - - switch(type) { - case 0: signal_name = signal_shutdown_name; break; - case 1: signal_name = signal_restart_name; break; - default: return; - } - - APD2("signal_parent signalling event \"%s\"", signal_name); - - e = OpenEvent(EVENT_ALL_ACCESS, FALSE, signal_name); - if (!e) { - /* Um, problem, can't signal the parent, which means we can't - * signal ourselves to die. Ignore for now... - */ - ap_log_error(APLOG_MARK, APLOG_EMERG|APLOG_WIN32ERROR, server_conf, - "OpenEvent on %s event", signal_name); - return; - } - if (SetEvent(e) == 0) { - /* Same problem as above */ - ap_log_error(APLOG_MARK, APLOG_EMERG|APLOG_WIN32ERROR, server_conf, - "SetEvent on %s event", signal_name); - CloseHandle(e); - return; - } - CloseHandle(e); -} -#endif - -/* - * ap_start_shutdown() and ap_start_restart(), below, are a first stab at - * functions to initiate shutdown or restart without relying on signals. - * Previously this was initiated in sig_term() and restart() signal handlers, - * but we want to be able to start a shutdown/restart from other sources -- - * e.g. on Win32, from the service manager. Now the service manager can - * call ap_start_shutdown() or ap_start_restart() as appropiate. Note that - * these functions can also be called by the child processes, since global - * variables are no longer used to pass on the required action to the parent. - */ - -void ap_start_shutdown(void) -{ -#ifndef WIN32 - if (shutdown_pending == 1) { - /* Um, is this _probably_ not an error, if the user has - * tried to do a shutdown twice quickly, so we won't - * worry about reporting it. - */ - return; - } - shutdown_pending = 1; -#else - signal_parent(0); /* get the parent process to wake up */ -#endif -} - -/* do a graceful restart if graceful == 1 */ -void ap_start_restart(int graceful) -{ -#ifndef WIN32 - if (restart_pending == 1) { - /* Probably not an error - don't bother reporting it */ - return; - } - restart_pending = 1; - is_graceful = graceful; -#else - signal_parent(1); /* get the parent process to wake up */ -#endif /* WIN32 */ -} - -static void sig_term(int sig) -{ - ap_start_shutdown(); -} - -static void restart(int sig) -{ -#ifndef WIN32 - ap_start_restart(sig == SIGUSR1); -#else - ap_start_restart(1); -#endif -} - -static void set_signals(void) -{ -#ifndef NO_USE_SIGACTION - struct sigaction sa; - - sigemptyset(&sa.sa_mask); - sa.sa_flags = 0; - - if (!one_process) { - sa.sa_handler = sig_coredump; -#if defined(SA_ONESHOT) - sa.sa_flags = SA_ONESHOT; -#elif defined(SA_RESETHAND) - sa.sa_flags = SA_RESETHAND; -#endif - if (sigaction(SIGSEGV, &sa, NULL) < 0) - ap_log_error(APLOG_MARK, APLOG_WARNING, server_conf, "sigaction(SIGSEGV)"); -#ifdef SIGBUS - if (sigaction(SIGBUS, &sa, NULL) < 0) - ap_log_error(APLOG_MARK, APLOG_WARNING, server_conf, "sigaction(SIGBUS)"); -#endif -#ifdef SIGABORT - if (sigaction(SIGABORT, &sa, NULL) < 0) - ap_log_error(APLOG_MARK, APLOG_WARNING, server_conf, "sigaction(SIGABORT)"); -#endif -#ifdef SIGABRT - if (sigaction(SIGABRT, &sa, NULL) < 0) - ap_log_error(APLOG_MARK, APLOG_WARNING, server_conf, "sigaction(SIGABRT)"); -#endif -#ifdef SIGILL - if (sigaction(SIGILL, &sa, NULL) < 0) - ap_log_error(APLOG_MARK, APLOG_WARNING, server_conf, "sigaction(SIGILL)"); -#endif - sa.sa_flags = 0; - } - sa.sa_handler = sig_term; - if (sigaction(SIGTERM, &sa, NULL) < 0) - ap_log_error(APLOG_MARK, APLOG_WARNING, server_conf, "sigaction(SIGTERM)"); -#ifdef SIGINT - if (sigaction(SIGINT, &sa, NULL) < 0) - ap_log_error(APLOG_MARK, APLOG_WARNING, server_conf, "sigaction(SIGINT)"); -#endif -#ifdef SIGXCPU - sa.sa_handler = SIG_DFL; - if (sigaction(SIGXCPU, &sa, NULL) < 0) - ap_log_error(APLOG_MARK, APLOG_WARNING, server_conf, "sigaction(SIGXCPU)"); -#endif -#ifdef SIGXFSZ - sa.sa_handler = SIG_DFL; - if (sigaction(SIGXFSZ, &sa, NULL) < 0) - ap_log_error(APLOG_MARK, APLOG_WARNING, server_conf, "sigaction(SIGXFSZ)"); -#endif -#ifdef SIGPIPE - sa.sa_handler = SIG_IGN; - if (sigaction(SIGPIPE, &sa, NULL) < 0) - ap_log_error(APLOG_MARK, APLOG_WARNING, server_conf, "sigaction(SIGPIPE)"); -#endif - - /* we want to ignore HUPs and USR1 while we're busy processing one */ - sigaddset(&sa.sa_mask, SIGHUP); - sigaddset(&sa.sa_mask, SIGUSR1); - sa.sa_handler = restart; - if (sigaction(SIGHUP, &sa, NULL) < 0) - ap_log_error(APLOG_MARK, APLOG_WARNING, server_conf, "sigaction(SIGHUP)"); - if (sigaction(SIGUSR1, &sa, NULL) < 0) - ap_log_error(APLOG_MARK, APLOG_WARNING, server_conf, "sigaction(SIGUSR1)"); -#else - if (!one_process) { - signal(SIGSEGV, sig_coredump); -#ifdef SIGBUS - signal(SIGBUS, sig_coredump); -#endif /* SIGBUS */ -#ifdef SIGABORT - signal(SIGABORT, sig_coredump); -#endif /* SIGABORT */ -#ifdef SIGABRT - signal(SIGABRT, sig_coredump); -#endif /* SIGABRT */ -#ifdef SIGILL - signal(SIGILL, sig_coredump); -#endif /* SIGILL */ -#ifdef SIGXCPU - signal(SIGXCPU, SIG_DFL); -#endif /* SIGXCPU */ -#ifdef SIGXFSZ - signal(SIGXFSZ, SIG_DFL); -#endif /* SIGXFSZ */ - } - - signal(SIGTERM, sig_term); -#ifdef SIGHUP - signal(SIGHUP, restart); -#endif /* SIGHUP */ -#ifdef SIGUSR1 - signal(SIGUSR1, restart); -#endif /* SIGUSR1 */ -#ifdef SIGPIPE - signal(SIGPIPE, SIG_IGN); -#endif /* SIGPIPE */ - -#endif -} - - -/***************************************************************** - * Here follows a long bunch of generic server bookkeeping stuff... - */ - -static void detach(void) -{ -#if !defined(WIN32) - int x; - - chdir("/"); -#if !defined(MPE) && !defined(OS2) && !defined(TPF) -/* Don't detach for MPE because child processes can't survive the death of - the parent. */ - if ((x = fork()) > 0) - exit(0); - else if (x == -1) { - perror("fork"); - fprintf(stderr, "%s: unable to fork new process\n", ap_server_argv0); - exit(1); - } - RAISE_SIGSTOP(DETACH); -#endif -#ifndef NO_SETSID - if ((pgrp = setsid()) == -1) { - perror("setsid"); - fprintf(stderr, "%s: setsid failed\n", ap_server_argv0); - exit(1); - } -#elif defined(NEXT) || defined(NEWSOS) - if (setpgrp(0, getpid()) == -1 || (pgrp = getpgrp(0)) == -1) { - perror("setpgrp"); - fprintf(stderr, "%s: setpgrp or getpgrp failed\n", ap_server_argv0); - exit(1); - } -#elif defined(OS2) || defined(TPF) - /* OS/2 and TPF don't support process group IDs */ - pgrp = getpid(); -#elif defined(MPE) - /* MPE uses negative pid for process group */ - pgrp = -getpid(); -#else - if ((pgrp = setpgrp(getpid(), 0)) == -1) { - perror("setpgrp"); - fprintf(stderr, "%s: setpgrp failed\n", ap_server_argv0); - exit(1); - } -#endif - - /* close out the standard file descriptors */ - if (freopen("/dev/null", "r", stdin) == NULL) { - fprintf(stderr, "%s: unable to replace stdin with /dev/null: %s\n", - ap_server_argv0, strerror(errno)); - /* continue anyhow -- note we can't close out descriptor 0 because we - * have nothing to replace it with, and if we didn't have a descriptor - * 0 the next file would be created with that value ... leading to - * havoc. - */ - } - if (freopen("/dev/null", "w", stdout) == NULL) { - fprintf(stderr, "%s: unable to replace stdout with /dev/null: %s\n", - ap_server_argv0, strerror(errno)); - } - /* stderr is a tricky one, we really want it to be the error_log, - * but we haven't opened that yet. So leave it alone for now and it'll - * be reopened moments later. - */ -#endif /* ndef WIN32 */ -} - -/* Set group privileges. - * - * Note that we use the username as set in the config files, rather than - * the lookup of to uid --- the same uid may have multiple passwd entries, - * with different sets of groups for each. - */ - -static void set_group_privs(void) -{ -#ifndef WIN32 - if (!geteuid()) { - char *name; - - /* Get username if passed as a uid */ - - if (ap_user_name[0] == '#') { - struct passwd *ent; - uid_t uid = atoi(&ap_user_name[1]); - - if ((ent = getpwuid(uid)) == NULL) { - ap_log_error(APLOG_MARK, APLOG_ALERT, server_conf, - "getpwuid: couldn't determine user name from uid %u, " - "you probably need to modify the User directive", - (unsigned)uid); - clean_child_exit(APEXIT_CHILDFATAL); - } - - name = ent->pw_name; - } - else - name = ap_user_name; - -#if !defined(OS2) && !defined(TPF) - /* OS/2 and TPF don't support groups. */ - - /* - * Set the GID before initgroups(), since on some platforms - * setgid() is known to zap the group list. - */ - if (setgid(ap_group_id) == -1) { - ap_log_error(APLOG_MARK, APLOG_ALERT, server_conf, - "setgid: unable to set group id to Group %u", - (unsigned)ap_group_id); - clean_child_exit(APEXIT_CHILDFATAL); - } - - /* Reset `groups' attributes. */ - - if (initgroups(name, ap_group_id) == -1) { - ap_log_error(APLOG_MARK, APLOG_ALERT, server_conf, - "initgroups: unable to set groups for User %s " - "and Group %u", name, (unsigned)ap_group_id); - clean_child_exit(APEXIT_CHILDFATAL); - } -#ifdef MULTIPLE_GROUPS - if (getgroups(NGROUPS_MAX, group_id_list) == -1) { - ap_log_error(APLOG_MARK, APLOG_ALERT, server_conf, - "getgroups: unable to get group list"); - clean_child_exit(APEXIT_CHILDFATAL); - } -#endif /* MULTIPLE_GROUPS */ -#endif /* !defined(OS2) && !defined(TPF) */ - } -#endif /* ndef WIN32 */ -} - -/* check to see if we have the 'suexec' setuid wrapper installed */ -static int init_suexec(void) -{ -#ifndef WIN32 - struct stat wrapper; - - if ((stat(SUEXEC_BIN, &wrapper)) != 0) - return (ap_suexec_enabled); - - if ((wrapper.st_mode & S_ISUID) && wrapper.st_uid == 0) { - ap_suexec_enabled = 1; - } -#endif /* ndef WIN32 */ - return (ap_suexec_enabled); -} - -/***************************************************************** - * Connection structures and accounting... - */ - - -static conn_rec *new_connection(pool *p, server_rec *server, BUFF *inout, - const struct sockaddr_in *remaddr, - const struct sockaddr_in *saddr, - int child_num) -{ - conn_rec *conn = (conn_rec *) ap_pcalloc(p, sizeof(conn_rec)); - - /* Got a connection structure, so initialize what fields we can - * (the rest are zeroed out by pcalloc). - */ - - conn->child_num = child_num; - - conn->pool = p; - conn->local_addr = *saddr; - conn->local_ip = ap_pstrdup(conn->pool, - inet_ntoa(conn->local_addr.sin_addr)); - conn->server = server; /* just a guess for now */ - ap_update_vhost_given_ip(conn); - conn->base_server = conn->server; - conn->client = inout; - - conn->remote_addr = *remaddr; - conn->remote_ip = ap_pstrdup(conn->pool, - inet_ntoa(conn->remote_addr.sin_addr)); - - return conn; -} - -#if defined(TCP_NODELAY) && !defined(MPE) && !defined(TPF) -static void sock_disable_nagle(int s) -{ - /* The Nagle algorithm says that we should delay sending partial - * packets in hopes of getting more data. We don't want to do - * this; we are not telnet. There are bad interactions between - * persistent connections and Nagle's algorithm that have very severe - * performance penalties. (Failing to disable Nagle is not much of a - * problem with simple HTTP.) - * - * In spite of these problems, failure here is not a shooting offense. - */ - int just_say_no = 1; - - if (setsockopt(s, IPPROTO_TCP, TCP_NODELAY, (char *) &just_say_no, - sizeof(int)) < 0) { - ap_log_error(APLOG_MARK, APLOG_WARNING, server_conf, - "setsockopt: (TCP_NODELAY)"); - } -} - -#else -#define sock_disable_nagle(s) /* NOOP */ -#endif - - -static int make_sock(pool *p, const struct sockaddr_in *server) -{ - int s; - int one = 1; - char addr[512]; - - if (server->sin_addr.s_addr != htonl(INADDR_ANY)) - ap_snprintf(addr, sizeof(addr), "address %s port %d", - inet_ntoa(server->sin_addr), ntohs(server->sin_port)); - else - ap_snprintf(addr, sizeof(addr), "port %d", ntohs(server->sin_port)); - - /* note that because we're about to slack we don't use psocket */ - ap_block_alarms(); - if ((s = socket(AF_INET, SOCK_STREAM, IPPROTO_TCP)) == -1) { - ap_log_error(APLOG_MARK, APLOG_CRIT, server_conf, - "make_sock: failed to get a socket for %s", addr); - ap_unblock_alarms(); - exit(1); - } - - /* Solaris (probably versions 2.4, 2.5, and 2.5.1 with various levels - * of tcp patches) has some really weird bugs where if you dup the - * socket now it breaks things across SIGHUP restarts. It'll either - * be unable to bind, or it won't respond. - */ -#if defined (SOLARIS2) && SOLARIS2 < 260 -#define WORKAROUND_SOLARIS_BUG -#endif - - /* PR#1282 Unixware 1.x appears to have the same problem as solaris */ -#if defined (UW) && UW < 200 -#define WORKAROUND_SOLARIS_BUG -#endif - - /* PR#1973 NCR SVR4 systems appear to have the same problem */ -#if defined (MPRAS) -#define WORKAROUND_SOLARIS_BUG -#endif - -#ifndef WORKAROUND_SOLARIS_BUG -#ifndef BEOS /* this won't work for BeOS sockets!! */ - s = ap_slack(s, AP_SLACK_HIGH); -#endif - - ap_note_cleanups_for_socket(p, s); /* arrange to close on exec or restart */ -#ifdef TPF - os_note_additional_cleanups(p, s); -#endif /* TPF */ -#endif - -#ifndef MPE -/* MPE does not support SO_REUSEADDR and SO_KEEPALIVE */ -#ifndef _OSD_POSIX - if (setsockopt(s, SOL_SOCKET, SO_REUSEADDR, (char *) &one, sizeof(int)) < 0) { - ap_log_error(APLOG_MARK, APLOG_CRIT, server_conf, - "make_sock: for %s, setsockopt: (SO_REUSEADDR)", addr); -#ifdef BEOS - closesocket(s); -#else - close(s); -#endif - ap_unblock_alarms(); - return -1; - } -#endif /*_OSD_POSIX*/ - one = 1; -#ifdef SO_KEEPALIVE - if (setsockopt(s, SOL_SOCKET, SO_KEEPALIVE, (char *) &one, sizeof(int)) < 0) { - ap_log_error(APLOG_MARK, APLOG_CRIT, server_conf, - "make_sock: for %s, setsockopt: (SO_KEEPALIVE)", addr); -#ifdef BEOS - closesocket(s); -#else - close(s); -#endif - - ap_unblock_alarms(); - return -1; - } -#endif -#endif - - sock_disable_nagle(s); - sock_enable_linger(s); - - /* - * To send data over high bandwidth-delay connections at full - * speed we must force the TCP window to open wide enough to keep the - * pipe full. The default window size on many systems - * is only 4kB. Cross-country WAN connections of 100ms - * at 1Mb/s are not impossible for well connected sites. - * If we assume 100ms cross-country latency, - * a 4kB buffer limits throughput to 40kB/s. - * - * To avoid this problem I've added the SendBufferSize directive - * to allow the web master to configure send buffer size. - * - * The trade-off of larger buffers is that more kernel memory - * is consumed. YMMV, know your customers and your network! - * - * -John Heidemann 25-Oct-96 - * - * If no size is specified, use the kernel default. - */ -#ifndef BEOS /* BeOS does not support SO_SNDBUF */ - if (server_conf->send_buffer_size) { - if (setsockopt(s, SOL_SOCKET, SO_SNDBUF, - (char *) &server_conf->send_buffer_size, sizeof(int)) < 0) { - ap_log_error(APLOG_MARK, APLOG_WARNING, server_conf, - "make_sock: failed to set SendBufferSize for %s, " - "using default", addr); - /* not a fatal error */ - } - } -#endif - -#ifdef MPE -/* MPE requires CAP=PM and GETPRIVMODE to bind to ports less than 1024 */ - if (ntohs(server->sin_port) < 1024) - GETPRIVMODE(); -#endif - - if (bind(s, (struct sockaddr *) server, sizeof(struct sockaddr_in)) == -1) { - ap_log_error(APLOG_MARK, APLOG_CRIT, server_conf, - "make_sock: could not bind to %s", addr); -#ifdef MPE - if (ntohs(server->sin_port) < 1024) - GETUSERMODE(); -#endif - -#ifdef BEOS - closesocket(s); -#else - close(s); -#endif - ap_unblock_alarms(); - exit(1); - } -#ifdef MPE - if (ntohs(server->sin_port) < 1024) - GETUSERMODE(); -#endif - - if (listen(s, ap_listenbacklog) == -1) { - ap_log_error(APLOG_MARK, APLOG_ERR, server_conf, - "make_sock: unable to listen for connections on %s", addr); -#ifdef BEOS - closesocket(s); -#else - close(s); -#endif - ap_unblock_alarms(); - exit(1); - } - -#ifdef WORKAROUND_SOLARIS_BUG - s = ap_slack(s, AP_SLACK_HIGH); - - ap_note_cleanups_for_socket(p, s); /* arrange to close on exec or restart */ -#endif - ap_unblock_alarms(); - -#ifdef CHECK_FD_SETSIZE - /* protect various fd_sets */ - if (s >= FD_SETSIZE) { - ap_log_error(APLOG_MARK, APLOG_NOERRNO|APLOG_WARNING, NULL, - "make_sock: problem listening on %s, filedescriptor (%u) " - "larger than FD_SETSIZE (%u) " - "found, you probably need to rebuild Apache with a " - "larger FD_SETSIZE", addr, s, FD_SETSIZE); -#ifdef BEOS - closesocket(s); -#else - close(s); -#endif - return -1; - } -#endif - - return s; -} - - -/* - * During a restart we keep track of the old listeners here, so that we - * can re-use the sockets. We have to do this because we won't be able - * to re-open the sockets ("Address already in use"). - * - * Unlike the listeners ring, old_listeners is a NULL terminated list. - * - * copy_listeners() makes the copy, find_listener() finds an old listener - * and close_unused_listener() cleans up whatever wasn't used. - */ -static listen_rec *old_listeners; - -/* unfortunately copy_listeners may be called before listeners is a ring */ -static void copy_listeners(pool *p) -{ - listen_rec *lr; - - ap_assert(old_listeners == NULL); - if (ap_listeners == NULL) { - return; - } - lr = ap_listeners; - do { - listen_rec *nr = malloc(sizeof *nr); - if (nr == NULL) { - fprintf(stderr, "Ouch! malloc failed in copy_listeners()\n"); - exit(1); - } - *nr = *lr; - ap_kill_cleanups_for_socket(p, nr->fd); - nr->next = old_listeners; - ap_assert(!nr->used); - old_listeners = nr; - lr = lr->next; - } while (lr && lr != ap_listeners); -} - - -static int find_listener(listen_rec *lr) -{ - listen_rec *or; - - for (or = old_listeners; or; or = or->next) { - if (!memcmp(&or->local_addr, &lr->local_addr, sizeof(or->local_addr))) { - or->used = 1; - return or->fd; - } - } - return -1; -} - - -static void close_unused_listeners(void) -{ - listen_rec *or, *next; - - for (or = old_listeners; or; or = next) { - next = or->next; - if (!or->used) - closesocket(or->fd); - free(or); - } - old_listeners = NULL; -} - - -/* open sockets, and turn the listeners list into a singly linked ring */ -static void setup_listeners(pool *p) -{ - listen_rec *lr; - int fd; - - listenmaxfd = -1; - FD_ZERO(&listenfds); - lr = ap_listeners; - for (;;) { - fd = find_listener(lr); - if (fd < 0) { - fd = make_sock(p, &lr->local_addr); - } - else { - ap_note_cleanups_for_socket(p, fd); - } - if (fd >= 0) { - FD_SET(fd, &listenfds); - if (fd > listenmaxfd) - listenmaxfd = fd; - } - lr->fd = fd; - if (lr->next == NULL) - break; - lr = lr->next; - } - /* turn the list into a ring */ - lr->next = ap_listeners; - head_listener = ap_listeners; - close_unused_listeners(); - -#ifdef NO_SERIALIZED_ACCEPT - /* warn them about the starvation problem if they're using multiple - * sockets - */ - if (ap_listeners->next != ap_listeners) { - ap_log_error(APLOG_MARK, APLOG_NOERRNO|APLOG_CRIT, NULL, - "You cannot use multiple Listens safely on your system, " - "proceeding anyway. See src/PORTING, search for " - "SERIALIZED_ACCEPT."); - } -#endif -} - - -/* - * Find a listener which is ready for accept(). This advances the - * head_listener global. - */ -static ap_inline listen_rec *find_ready_listener(fd_set * main_fds) -{ - listen_rec *lr; - - lr = head_listener; - do { - if (FD_ISSET(lr->fd, main_fds)) { - head_listener = lr->next; - return (lr); - } - lr = lr->next; - } while (lr != head_listener); - return NULL; -} - - -#ifdef WIN32 -static int s_iInitCount = 0; - -static int AMCSocketInitialize(void) -{ - int iVersionRequested; - WSADATA wsaData; - int err; - - if (s_iInitCount > 0) { - s_iInitCount++; - return (0); - } - else if (s_iInitCount < 0) - return (s_iInitCount); - - /* s_iInitCount == 0. Do the initailization */ - iVersionRequested = MAKEWORD(1, 1); - err = WSAStartup((WORD) iVersionRequested, &wsaData); - if (err) { - s_iInitCount = -1; - return (s_iInitCount); - } - if (LOBYTE(wsaData.wVersion) != 1 || - HIBYTE(wsaData.wVersion) != 1) { - s_iInitCount = -2; - WSACleanup(); - return (s_iInitCount); - } - - s_iInitCount++; - return (s_iInitCount); - -} - - -static void AMCSocketCleanup(void) -{ - if (--s_iInitCount == 0) - WSACleanup(); - return; -} -#endif - -static void show_compile_settings(void) -{ - printf("Server version: %s\n", ap_get_server_version()); - printf("Server built: %s\n", ap_get_server_built()); - printf("Server's Module Magic Number: %u:%u\n", - MODULE_MAGIC_NUMBER_MAJOR, MODULE_MAGIC_NUMBER_MINOR); - printf("Server compiled with....\n"); -#ifdef BIG_SECURITY_HOLE - printf(" -D BIG_SECURITY_HOLE\n"); -#endif -#ifdef SECURITY_HOLE_PASS_AUTHORIZATION - printf(" -D SECURITY_HOLE_PASS_AUTHORIZATION\n"); -#endif -#ifdef HAVE_MMAP - printf(" -D HAVE_MMAP\n"); -#endif -#ifdef HAVE_SHMGET - printf(" -D HAVE_SHMGET\n"); -#endif -#ifdef USE_MMAP_SCOREBOARD - printf(" -D USE_MMAP_SCOREBOARD\n"); -#endif -#ifdef USE_SHMGET_SCOREBOARD - printf(" -D USE_SHMGET_SCOREBOARD\n"); -#endif -#ifdef USE_OS2_SCOREBOARD - printf(" -D USE_OS2_SCOREBOARD\n"); -#endif -#ifdef USE_POSIX_SCOREBOARD - printf(" -D USE_POSIX_SCOREBOARD\n"); -#endif -#ifdef USE_MMAP_FILES - printf(" -D USE_MMAP_FILES\n"); -#ifdef MMAP_SEGMENT_SIZE - printf(" -D MMAP_SEGMENT_SIZE=%ld\n",(long)MMAP_SEGMENT_SIZE); -#endif -#endif /*USE_MMAP_FILES*/ -#ifdef NO_WRITEV - printf(" -D NO_WRITEV\n"); -#endif -#ifdef NO_LINGCLOSE - printf(" -D NO_LINGCLOSE\n"); -#endif -#ifdef USE_FCNTL_SERIALIZED_ACCEPT - printf(" -D USE_FCNTL_SERIALIZED_ACCEPT\n"); -#endif -#ifdef USE_FLOCK_SERIALIZED_ACCEPT - printf(" -D USE_FLOCK_SERIALIZED_ACCEPT\n"); -#endif -#ifdef USE_USLOCK_SERIALIZED_ACCEPT - printf(" -D USE_USLOCK_SERIALIZED_ACCEPT\n"); -#endif -#ifdef USE_SYSVSEM_SERIALIZED_ACCEPT - printf(" -D USE_SYSVSEM_SERIALIZED_ACCEPT\n"); -#endif -#ifdef USE_PTHREAD_SERIALIZED_ACCEPT - printf(" -D USE_PTHREAD_SERIALIZED_ACCEPT\n"); -#endif -#ifdef SINGLE_LISTEN_UNSERIALIZED_ACCEPT - printf(" -D SINGLE_LISTEN_UNSERIALIZED_ACCEPT\n"); -#endif -#ifdef NO_OTHER_CHILD - printf(" -D NO_OTHER_CHILD\n"); -#endif -#ifdef NO_RELIABLE_PIPED_LOGS - printf(" -D NO_RELIABLE_PIPED_LOGS\n"); -#endif -#ifdef BUFFERED_LOGS - printf(" -D BUFFERED_LOGS\n"); -#ifdef PIPE_BUF - printf(" -D PIPE_BUF=%ld\n",(long)PIPE_BUF); -#endif -#endif -#ifdef MULTITHREAD - printf(" -D MULTITHREAD\n"); -#endif -#ifdef CHARSET_EBCDIC - printf(" -D CHARSET_EBCDIC\n"); -#endif -#ifdef NEED_HASHBANG_EMUL - printf(" -D NEED_HASHBANG_EMUL\n"); -#endif -#ifdef SHARED_CORE - printf(" -D SHARED_CORE\n"); -#endif - -/* This list displays the compiled-in default paths: */ -#ifdef HTTPD_ROOT - printf(" -D HTTPD_ROOT=\"" HTTPD_ROOT "\"\n"); -#endif -#ifdef SUEXEC_BIN - printf(" -D SUEXEC_BIN=\"" SUEXEC_BIN "\"\n"); -#endif -#if defined(SHARED_CORE) && defined(SHARED_CORE_DIR) - printf(" -D SHARED_CORE_DIR=\"" SHARED_CORE_DIR "\"\n"); -#endif -#ifdef DEFAULT_PIDLOG - printf(" -D DEFAULT_PIDLOG=\"" DEFAULT_PIDLOG "\"\n"); -#endif -#ifdef DEFAULT_SCOREBOARD - printf(" -D DEFAULT_SCOREBOARD=\"" DEFAULT_SCOREBOARD "\"\n"); -#endif -#ifdef DEFAULT_LOCKFILE - printf(" -D DEFAULT_LOCKFILE=\"" DEFAULT_LOCKFILE "\"\n"); -#endif -#ifdef DEFAULT_XFERLOG - printf(" -D DEFAULT_XFERLOG=\"" DEFAULT_XFERLOG "\"\n"); -#endif -#ifdef DEFAULT_ERRORLOG - printf(" -D DEFAULT_ERRORLOG=\"" DEFAULT_ERRORLOG "\"\n"); -#endif -#ifdef TYPES_CONFIG_FILE - printf(" -D TYPES_CONFIG_FILE=\"" TYPES_CONFIG_FILE "\"\n"); -#endif -#ifdef SERVER_CONFIG_FILE - printf(" -D SERVER_CONFIG_FILE=\"" SERVER_CONFIG_FILE "\"\n"); -#endif -#ifdef ACCESS_CONFIG_FILE - printf(" -D ACCESS_CONFIG_FILE=\"" ACCESS_CONFIG_FILE "\"\n"); -#endif -#ifdef RESOURCE_CONFIG_FILE - printf(" -D RESOURCE_CONFIG_FILE=\"" RESOURCE_CONFIG_FILE "\"\n"); -#endif -} - - -/* Some init code that's common between win32 and unix... well actually - * some of it is #ifdef'd but was duplicated before anyhow. This stuff - * is still a mess. - */ -static void common_init(void) -{ - INIT_SIGLIST() -#ifdef AUX3 - (void) set42sig(); -#endif - -#ifdef WIN32 - /* Initialize the stupid sockets */ - AMCSocketInitialize(); -#endif /* WIN32 */ - - pglobal = ap_init_alloc(); - pconf = ap_make_sub_pool(pglobal); - plog = ap_make_sub_pool(pglobal); - ptrans = ap_make_sub_pool(pconf); - - ap_util_init(); - ap_util_uri_init(); - - pcommands = ap_make_sub_pool(NULL); - ap_server_pre_read_config = ap_make_array(pcommands, 1, sizeof(char *)); - ap_server_post_read_config = ap_make_array(pcommands, 1, sizeof(char *)); - ap_server_config_defines = ap_make_array(pcommands, 1, sizeof(char *)); -} - -#ifndef MULTITHREAD -/***************************************************************** - * Child process main loop. - * The following vars are static to avoid getting clobbered by longjmp(); - * they are really private to child_main. - */ - -static int srv; -static int csd; -static int dupped_csd; -static int requests_this_child; -static fd_set main_fds; - -API_EXPORT(void) ap_child_terminate(request_rec *r) -{ - r->connection->keepalive = 0; - requests_this_child = ap_max_requests_per_child = 1; -} - -static void child_main(int child_num_arg) -{ - NET_SIZE_T clen; - struct sockaddr sa_server; - struct sockaddr sa_client; - listen_rec *lr; - - /* All of initialization is a critical section, we don't care if we're - * told to HUP or USR1 before we're done initializing. For example, - * we could be half way through child_init_modules() when a restart - * signal arrives, and we'd have no real way to recover gracefully - * and exit properly. - * - * I suppose a module could take forever to initialize, but that would - * be either a broken module, or a broken configuration (i.e. network - * problems, file locking problems, whatever). -djg - */ - ap_block_alarms(); - - my_pid = getpid(); - csd = -1; - dupped_csd = -1; - my_child_num = child_num_arg; - requests_this_child = 0; - - /* Get a sub pool for global allocations in this child, so that - * we can have cleanups occur when the child exits. - */ - pchild = ap_make_sub_pool(pconf); - - /* needs to be done before we switch UIDs so we have permissions */ - reopen_scoreboard(pchild); - SAFE_ACCEPT(accept_mutex_child_init(pchild)); - - set_group_privs(); -#ifdef MPE - /* Only try to switch if we're running as MANAGER.SYS */ - if (geteuid() == 1 && ap_user_id > 1) { - GETPRIVMODE(); - if (setuid(ap_user_id) == -1) { - GETUSERMODE(); - ap_log_error(APLOG_MARK, APLOG_ALERT, server_conf, - "setuid: unable to change to uid: %d", ap_user_id); - exit(1); - } - GETUSERMODE(); - } -#else - /* Only try to switch if we're running as root */ - if (!geteuid() && ( -#ifdef _OSD_POSIX - os_init_job_environment(server_conf, ap_user_name, one_process) != 0 || -#endif - setuid(ap_user_id) == -1)) { - ap_log_error(APLOG_MARK, APLOG_ALERT, server_conf, - "setuid: unable to change to uid: %ld", (long) ap_user_id); - clean_child_exit(APEXIT_CHILDFATAL); - } -#endif - - ap_child_init_modules(pchild, server_conf); - - /* done with the initialization critical section */ - ap_unblock_alarms(); - - (void) ap_update_child_status(my_child_num, SERVER_READY, (request_rec *) NULL); - - /* - * Setup the jump buffers so that we can return here after a timeout - */ - ap_setjmp(jmpbuffer); -#ifndef OS2 -#ifdef SIGURG - signal(SIGURG, timeout); -#endif -#endif - signal(SIGALRM, alrm_handler); -#ifdef TPF - signal(SIGHUP, just_die); - signal(SIGTERM, just_die); - signal(SIGUSR1, just_die); -#endif /* TPF */ - -#ifdef OS2 -/* Stop Ctrl-C/Ctrl-Break signals going to child processes */ - { - unsigned long ulTimes; - DosSetSignalExceptionFocus(0, &ulTimes); - } -#endif - - while (1) { - BUFF *conn_io; - request_rec *r; - - /* Prepare to receive a SIGUSR1 due to graceful restart so that - * we can exit cleanly. Since we're between connections right - * now it's the right time to exit, but we might be blocked in a - * system call when the graceful restart request is made. */ - usr1_just_die = 1; - signal(SIGUSR1, usr1_handler); - - /* - * (Re)initialize this child to a pre-connection state. - */ - - ap_kill_timeout(0); /* Cancel any outstanding alarms. */ - current_conn = NULL; - - ap_clear_pool(ptrans); - - ap_sync_scoreboard_image(); - if (ap_scoreboard_image->global.running_generation != ap_my_generation) { - clean_child_exit(0); - } - -#ifndef WIN32 - if ((ap_max_requests_per_child > 0 - && requests_this_child++ >= ap_max_requests_per_child)) { - clean_child_exit(0); - } -#else - ++requests_this_child; -#endif - - (void) ap_update_child_status(my_child_num, SERVER_READY, (request_rec *) NULL); - - /* - * Wait for an acceptable connection to arrive. - */ - - /* Lock around "accept", if necessary */ - SAFE_ACCEPT(accept_mutex_on()); - - for (;;) { - if (ap_listeners->next != ap_listeners) { - /* more than one socket */ - memcpy(&main_fds, &listenfds, sizeof(fd_set)); - srv = ap_select(listenmaxfd + 1, &main_fds, NULL, NULL, NULL); - - if (srv < 0 && errno != EINTR) { - /* Single Unix documents select as returning errnos - * EBADF, EINTR, and EINVAL... and in none of those - * cases does it make sense to continue. In fact - * on Linux 2.0.x we seem to end up with EFAULT - * occasionally, and we'd loop forever due to it. - */ - ap_log_error(APLOG_MARK, APLOG_ERR, server_conf, "select: (listen)"); - clean_child_exit(1); - } - - if (srv <= 0) - continue; - - lr = find_ready_listener(&main_fds); - if (lr == NULL) - continue; - sd = lr->fd; - } - else { - /* only one socket, just pretend we did the other stuff */ - sd = ap_listeners->fd; - } - - /* if we accept() something we don't want to die, so we have to - * defer the exit - */ - deferred_die = 0; - usr1_just_die = 0; - for (;;) { - clen = sizeof(sa_client); - csd = ap_accept(sd, &sa_client, &clen); - if (csd >= 0 || errno != EINTR) - break; - if (deferred_die) { - /* we didn't get a socket, and we were told to die */ - clean_child_exit(0); - } - } - - if (csd >= 0) - break; /* We have a socket ready for reading */ - else { - - /* Our old behaviour here was to continue after accept() - * errors. But this leads us into lots of troubles - * because most of the errors are quite fatal. For - * example, EMFILE can be caused by slow descriptor - * leaks (say in a 3rd party module, or libc). It's - * foolish for us to continue after an EMFILE. We also - * seem to tickle kernel bugs on some platforms which - * lead to never-ending loops here. So it seems best - * to just exit in most cases. - */ - switch (errno) { -#ifdef EPROTO - /* EPROTO on certain older kernels really means - * ECONNABORTED, so we need to ignore it for them. - * See discussion in new-httpd archives nh.9701 - * search for EPROTO. - * - * Also see nh.9603, search for EPROTO: - * There is potentially a bug in Solaris 2.x x<6, - * and other boxes that implement tcp sockets in - * userland (i.e. on top of STREAMS). On these - * systems, EPROTO can actually result in a fatal - * loop. See PR#981 for example. It's hard to - * handle both uses of EPROTO. - */ - case EPROTO: -#endif -#ifdef ECONNABORTED - case ECONNABORTED: -#endif - /* Linux generates the rest of these, other tcp - * stacks (i.e. bsd) tend to hide them behind - * getsockopt() interfaces. They occur when - * the net goes sour or the client disconnects - * after the three-way handshake has been done - * in the kernel but before userland has picked - * up the socket. - */ -#ifdef ECONNRESET - case ECONNRESET: -#endif -#ifdef ETIMEDOUT - case ETIMEDOUT: -#endif -#ifdef EHOSTUNREACH - case EHOSTUNREACH: -#endif -#ifdef ENETUNREACH - case ENETUNREACH: -#endif - break; -#ifdef ENETDOWN - case ENETDOWN: - /* - * When the network layer has been shut down, there - * is not much use in simply exiting: the parent - * would simply re-create us (and we'd fail again). - * Use the CHILDFATAL code to tear the server down. - * @@@ Martin's idea for possible improvement: - * A different approach would be to define - * a new APEXIT_NETDOWN exit code, the reception - * of which would make the parent shutdown all - * children, then idle-loop until it detected that - * the network is up again, and restart the children. - * Ben Hyde noted that temporary ENETDOWN situations - * occur in mobile IP. - */ - ap_log_error(APLOG_MARK, APLOG_EMERG, server_conf, - "accept: giving up."); - clean_child_exit(APEXIT_CHILDFATAL); -#endif /*ENETDOWN*/ - -#ifdef TPF - case EINACT: - ap_log_error(APLOG_MARK, APLOG_EMERG, server_conf, - "offload device inactive"); - clean_child_exit(APEXIT_CHILDFATAL); - break; - default: - ap_log_error(APLOG_MARK, APLOG_NOERRNO|APLOG_ERR, server_conf, - "select/accept error (%u)", errno); - clean_child_exit(APEXIT_CHILDFATAL); -#else - default: - ap_log_error(APLOG_MARK, APLOG_ERR, server_conf, - "accept: (client socket)"); - clean_child_exit(1); -#endif - } - } - - /* go around again, safe to die */ - usr1_just_die = 1; - if (deferred_die) { - /* ok maybe not, see ya later */ - clean_child_exit(0); - } - /* or maybe we missed a signal, you never know on systems - * without reliable signals - */ - ap_sync_scoreboard_image(); - if (ap_scoreboard_image->global.running_generation != ap_my_generation) { - clean_child_exit(0); - } - } - - SAFE_ACCEPT(accept_mutex_off()); /* unlock after "accept" */ - -#ifdef TPF - if (csd == 0) /* 0 is invalid socket for TPF */ - continue; -#endif - - /* We've got a socket, let's at least process one request off the - * socket before we accept a graceful restart request. - */ - signal(SIGUSR1, SIG_IGN); - - ap_note_cleanups_for_fd(ptrans, csd); - - /* protect various fd_sets */ -#ifdef CHECK_FD_SETSIZE - if (csd >= FD_SETSIZE) { - ap_log_error(APLOG_MARK, APLOG_NOERRNO|APLOG_WARNING, NULL, - "[csd] filedescriptor (%u) larger than FD_SETSIZE (%u) " - "found, you probably need to rebuild Apache with a " - "larger FD_SETSIZE", csd, FD_SETSIZE); - continue; - } -#endif - - /* - * We now have a connection, so set it up with the appropriate - * socket options, file descriptors, and read/write buffers. - */ - - clen = sizeof(sa_server); - if (getsockname(csd, &sa_server, &clen) < 0) { - ap_log_error(APLOG_MARK, APLOG_ERR, server_conf, "getsockname"); - continue; - } - - sock_disable_nagle(csd); - - (void) ap_update_child_status(my_child_num, SERVER_BUSY_READ, - (request_rec *) NULL); - - conn_io = ap_bcreate(ptrans, B_RDWR | B_SOCKET); - -#ifdef B_SFIO - (void) sfdisc(conn_io->sf_in, SF_POPDISC); - sfdisc(conn_io->sf_in, bsfio_new(conn_io->pool, conn_io)); - sfsetbuf(conn_io->sf_in, NULL, 0); - - (void) sfdisc(conn_io->sf_out, SF_POPDISC); - sfdisc(conn_io->sf_out, bsfio_new(conn_io->pool, conn_io)); - sfsetbuf(conn_io->sf_out, NULL, 0); -#endif - - dupped_csd = csd; -#if defined(NEED_DUPPED_CSD) - if ((dupped_csd = dup(csd)) < 0) { - ap_log_error(APLOG_MARK, APLOG_ERR, server_conf, - "dup: couldn't duplicate csd"); - dupped_csd = csd; /* Oh well... */ - } - ap_note_cleanups_for_fd(ptrans, dupped_csd); - - /* protect various fd_sets */ -#ifdef CHECK_FD_SETSIZE - if (dupped_csd >= FD_SETSIZE) { - ap_log_error(APLOG_MARK, APLOG_NOERRNO|APLOG_WARNING, NULL, - "[dupped_csd] filedescriptor (%u) larger than FD_SETSIZE (%u) " - "found, you probably need to rebuild Apache with a " - "larger FD_SETSIZE", dupped_csd, FD_SETSIZE); - continue; - } -#endif -#endif - ap_bpushfd(conn_io, csd, dupped_csd); - - current_conn = new_connection(ptrans, server_conf, conn_io, - (struct sockaddr_in *) &sa_client, - (struct sockaddr_in *) &sa_server, - my_child_num); - - /* - * Read and process each request found on our connection - * until no requests are left or we decide to close. - */ - - while ((r = ap_read_request(current_conn)) != NULL) { - - /* read_request_line has already done a - * signal (SIGUSR1, SIG_IGN); - */ - - (void) ap_update_child_status(my_child_num, SERVER_BUSY_WRITE, r); - - /* process the request if it was read without error */ - - if (r->status == HTTP_OK) - ap_process_request(r); - - if(ap_extended_status) - increment_counts(my_child_num, r); - - if (!current_conn->keepalive || current_conn->aborted) - break; - - ap_destroy_pool(r->pool); - (void) ap_update_child_status(my_child_num, SERVER_BUSY_KEEPALIVE, - (request_rec *) NULL); - - ap_sync_scoreboard_image(); - if (ap_scoreboard_image->global.running_generation != ap_my_generation) { - ap_bclose(conn_io); - clean_child_exit(0); - } - - /* In case we get a graceful restart while we're blocked - * waiting for the request. - * - * XXX: This isn't perfect, we might actually read the - * request and then just die without saying anything to - * the client. This can be fixed by using deferred_die - * but you have to teach buff.c about it so that it can handle - * the EINTR properly. - * - * In practice though browsers (have to) expect keepalive - * connections to close before receiving a response because - * of network latencies and server timeouts. - */ - usr1_just_die = 1; - signal(SIGUSR1, usr1_handler); - } - - /* - * Close the connection, being careful to send out whatever is still - * in our buffers. If possible, try to avoid a hard close until the - * client has ACKed our FIN and/or has stopped sending us data. - */ - -#ifdef NO_LINGCLOSE - ap_bclose(conn_io); /* just close it */ -#else - if (r && r->connection - && !r->connection->aborted - && r->connection->client - && (r->connection->client->fd >= 0)) { - - lingering_close(r); - } - else { - ap_bsetflag(conn_io, B_EOUT, 1); - ap_bclose(conn_io); - } -#endif - } -} - -#ifdef TPF -static void reset_tpf_listeners(APACHE_TPF_INPUT *input_parms) -{ - int count; - listen_rec *lr; - - count = 0; - listenmaxfd = -1; - FD_ZERO(&listenfds); - lr = ap_listeners; - - for(;;) { - lr->fd = input_parms->listeners[count]; - if(lr->fd >= 0) { - FD_SET(lr->fd, &listenfds); - if(lr->fd > listenmaxfd) - listenmaxfd = lr->fd; - } - if(lr->next == NULL) - break; - lr = lr->next; - count++; - } - lr->next = ap_listeners; - head_listener = ap_listeners; - close_unused_listeners(); -} - -#endif /* TPF */ - -static int make_child(server_rec *s, int slot, time_t now) -{ - int pid; - - if (slot + 1 > max_daemons_limit) { - max_daemons_limit = slot + 1; - } - - if (one_process) { - signal(SIGHUP, just_die); - signal(SIGINT, just_die); -#ifdef SIGQUIT - signal(SIGQUIT, SIG_DFL); -#endif - signal(SIGTERM, just_die); - child_main(slot); - } - - /* avoid starvation */ - head_listener = head_listener->next; - - Explain1("Starting new child in slot %d", slot); - (void) ap_update_child_status(slot, SERVER_STARTING, (request_rec *) NULL); - - -#ifdef _OSD_POSIX - /* BS2000 requires a "special" version of fork() before a setuid() call */ - if ((pid = os_fork(ap_user_name)) == -1) { -#elif defined(TPF) - if ((pid = os_fork(s, slot)) == -1) { -#else - if ((pid = fork()) == -1) { -#endif - ap_log_error(APLOG_MARK, APLOG_ERR, s, "fork: Unable to fork new process"); - - /* fork didn't succeed. Fix the scoreboard or else - * it will say SERVER_STARTING forever and ever - */ - (void) ap_update_child_status(slot, SERVER_DEAD, (request_rec *) NULL); - - /* In case system resources are maxxed out, we don't want - Apache running away with the CPU trying to fork over and - over and over again. */ - sleep(10); - - return -1; - } - - if (!pid) { -#ifdef AIX_BIND_PROCESSOR -/* by default AIX binds to a single processor - * this bit unbinds children which will then bind to another cpu - */ -#include - int status = bindprocessor(BINDPROCESS, (int)getpid(), - PROCESSOR_CLASS_ANY); - if (status != OK) { - ap_log_error(APLOG_MARK, APLOG_NOERRNO|APLOG_WARNING, server_conf, - "processor unbind failed %d", status); - } -#endif - RAISE_SIGSTOP(MAKE_CHILD); - MONCONTROL(1); - /* Disable the restart signal handlers and enable the just_die stuff. - * Note that since restart() just notes that a restart has been - * requested there's no race condition here. - */ - signal(SIGHUP, just_die); - signal(SIGUSR1, just_die); - signal(SIGTERM, just_die); - child_main(slot); - } - -#ifdef OPTIMIZE_TIMEOUTS - ap_scoreboard_image->parent[slot].last_rtime = now; -#endif - ap_scoreboard_image->parent[slot].pid = pid; -#ifdef SCOREBOARD_FILE - lseek(scoreboard_fd, XtOffsetOf(scoreboard, parent[slot]), 0); - force_write(scoreboard_fd, &ap_scoreboard_image->parent[slot], - sizeof(parent_score)); -#endif - - return 0; -} - - -/* start up a bunch of children */ -static void startup_children(int number_to_start) -{ - int i; - time_t now = time(0); - - for (i = 0; number_to_start && i < ap_daemons_limit; ++i) { - if (ap_scoreboard_image->servers[i].status != SERVER_DEAD) { - continue; - } - if (make_child(server_conf, i, now) < 0) { - break; - } - --number_to_start; - } -} - - -/* - * idle_spawn_rate is the number of children that will be spawned on the - * next maintenance cycle if there aren't enough idle servers. It is - * doubled up to MAX_SPAWN_RATE, and reset only when a cycle goes by - * without the need to spawn. - */ -static int idle_spawn_rate = 1; -#ifndef MAX_SPAWN_RATE -#define MAX_SPAWN_RATE (32) -#endif -static int hold_off_on_exponential_spawning; - -static void perform_idle_server_maintenance(void) -{ - int i; - int to_kill; - int idle_count; - short_score *ss; - time_t now = time(0); - int free_length; - int free_slots[MAX_SPAWN_RATE]; - int last_non_dead; - int total_non_dead; - - /* initialize the free_list */ - free_length = 0; - - to_kill = -1; - idle_count = 0; - last_non_dead = -1; - total_non_dead = 0; - - ap_sync_scoreboard_image(); - for (i = 0; i < ap_daemons_limit; ++i) { - int status; - - if (i >= max_daemons_limit && free_length == idle_spawn_rate) - break; - ss = &ap_scoreboard_image->servers[i]; - status = ss->status; - if (status == SERVER_DEAD) { - /* try to keep children numbers as low as possible */ - if (free_length < idle_spawn_rate) { - free_slots[free_length] = i; - ++free_length; - } - } - else { - /* We consider a starting server as idle because we started it - * at least a cycle ago, and if it still hasn't finished starting - * then we're just going to swamp things worse by forking more. - * So we hopefully won't need to fork more if we count it. - * This depends on the ordering of SERVER_READY and SERVER_STARTING. - */ - if (status <= SERVER_READY) { - ++ idle_count; - /* always kill the highest numbered child if we have to... - * no really well thought out reason ... other than observing - * the server behaviour under linux where lower numbered children - * tend to service more hits (and hence are more likely to have - * their data in cpu caches). - */ - to_kill = i; - } - - ++total_non_dead; - last_non_dead = i; -#ifdef OPTIMIZE_TIMEOUTS - if (ss->timeout_len) { - /* if it's a live server, with a live timeout then - * start checking its timeout */ - parent_score *ps = &ap_scoreboard_image->parent[i]; - if (ss->cur_vtime != ps->last_vtime) { - /* it has made progress, so update its last_rtime, - * last_vtime */ - ps->last_rtime = now; - ps->last_vtime = ss->cur_vtime; - } - else if (ps->last_rtime + ss->timeout_len < now) { - /* no progress, and the timeout length has been exceeded */ - ss->timeout_len = 0; - kill(ps->pid, SIGALRM); - } - } -#endif - } - } - max_daemons_limit = last_non_dead + 1; - if (idle_count > ap_daemons_max_free) { - /* kill off one child... we use SIGUSR1 because that'll cause it to - * shut down gracefully, in case it happened to pick up a request - * while we were counting - */ - kill(ap_scoreboard_image->parent[to_kill].pid, SIGUSR1); - idle_spawn_rate = 1; - } - else if (idle_count < ap_daemons_min_free) { - /* terminate the free list */ - if (free_length == 0) { - /* only report this condition once */ - static int reported = 0; - - if (!reported) { - ap_log_error(APLOG_MARK, APLOG_NOERRNO|APLOG_ERR, server_conf, - "server reached MaxClients setting, consider" - " raising the MaxClients setting"); - reported = 1; - } - idle_spawn_rate = 1; - } - else { - if (idle_spawn_rate >= 8) { - ap_log_error(APLOG_MARK, APLOG_NOERRNO|APLOG_INFO, server_conf, - "server seems busy, (you may need " - "to increase StartServers, or Min/MaxSpareServers), " - "spawning %d children, there are %d idle, and " - "%d total children", idle_spawn_rate, - idle_count, total_non_dead); - } - for (i = 0; i < free_length; ++i) { -#ifdef TPF - if(make_child(server_conf, free_slots[i], now) == -1) { - if(free_length == 1) { - shutdown_pending = 1; - ap_log_error(APLOG_MARK, APLOG_EMERG, server_conf, - "No active child processes: shutting down"); - } - } -#else - make_child(server_conf, free_slots[i], now); -#endif /* TPF */ - } - /* the next time around we want to spawn twice as many if this - * wasn't good enough, but not if we've just done a graceful - */ - if (hold_off_on_exponential_spawning) { - --hold_off_on_exponential_spawning; - } - else if (idle_spawn_rate < MAX_SPAWN_RATE) { - idle_spawn_rate *= 2; - } - } - } - else { - idle_spawn_rate = 1; - } -} - - -static void process_child_status(int pid, ap_wait_t status) -{ - /* Child died... if it died due to a fatal error, - * we should simply bail out. - */ - if ((WIFEXITED(status)) && - WEXITSTATUS(status) == APEXIT_CHILDFATAL) { - ap_log_error(APLOG_MARK, APLOG_ALERT|APLOG_NOERRNO, server_conf, - "Child %d returned a Fatal error... \n" - "Apache is exiting!", - pid); - exit(APEXIT_CHILDFATAL); - } - if (WIFSIGNALED(status)) { - switch (WTERMSIG(status)) { - case SIGTERM: - case SIGHUP: - case SIGUSR1: - case SIGKILL: - break; - default: -#ifdef SYS_SIGLIST -#ifdef WCOREDUMP - if (WCOREDUMP(status)) { - ap_log_error(APLOG_MARK, APLOG_NOERRNO|APLOG_NOTICE, - server_conf, - "child pid %d exit signal %s (%d), " - "possible coredump in %s", - pid, (WTERMSIG(status) >= NumSIG) ? "" : - SYS_SIGLIST[WTERMSIG(status)], WTERMSIG(status), - ap_coredump_dir); - } - else { -#endif - ap_log_error(APLOG_MARK, APLOG_NOERRNO|APLOG_NOTICE, - server_conf, - "child pid %d exit signal %s (%d)", pid, - SYS_SIGLIST[WTERMSIG(status)], WTERMSIG(status)); -#ifdef WCOREDUMP - } -#endif -#else - ap_log_error(APLOG_MARK, APLOG_NOERRNO|APLOG_NOTICE, - server_conf, - "child pid %d exit signal %d", - pid, WTERMSIG(status)); -#endif - } - } -} - - -/***************************************************************** - * Executive routines. - */ - -#ifndef STANDALONE_MAIN -#define STANDALONE_MAIN standalone_main - -static void standalone_main(int argc, char **argv) -{ - int remaining_children_to_start; - -#ifdef OS2 - printf("%s \n", ap_get_server_version()); -#endif - - ap_standalone = 1; - - is_graceful = 0; - - if (!one_process) { - detach(); - } - else { - MONCONTROL(1); - } - - my_pid = getpid(); - - do { - copy_listeners(pconf); - if (!is_graceful) { - ap_restart_time = time(NULL); - } -#ifdef SCOREBOARD_FILE - else if (scoreboard_fd != -1) { - ap_kill_cleanup(pconf, NULL, cleanup_scoreboard_file); - ap_kill_cleanups_for_fd(pconf, scoreboard_fd); - } -#endif - ap_clear_pool(pconf); - ptrans = ap_make_sub_pool(pconf); - - server_conf = ap_read_config(pconf, ptrans, ap_server_confname); - setup_listeners(pconf); - ap_clear_pool(plog); - ap_open_logs(server_conf, plog); - ap_log_pid(pconf, ap_pid_fname); - ap_set_version(); /* create our server_version string */ - ap_init_modules(pconf, server_conf); - version_locked++; /* no more changes to server_version */ - SAFE_ACCEPT(accept_mutex_init(pconf)); - if (!is_graceful) { - reinit_scoreboard(pconf); - } -#ifdef SCOREBOARD_FILE - else { - ap_scoreboard_fname = ap_server_root_relative(pconf, ap_scoreboard_fname); - ap_note_cleanups_for_fd(pconf, scoreboard_fd); - } -#endif - - set_signals(); - - if (ap_daemons_max_free < ap_daemons_min_free + 1) /* Don't thrash... */ - ap_daemons_max_free = ap_daemons_min_free + 1; - - /* If we're doing a graceful_restart then we're going to see a lot - * of children exiting immediately when we get into the main loop - * below (because we just sent them SIGUSR1). This happens pretty - * rapidly... and for each one that exits we'll start a new one until - * we reach at least daemons_min_free. But we may be permitted to - * start more than that, so we'll just keep track of how many we're - * supposed to start up without the 1 second penalty between each fork. - */ - remaining_children_to_start = ap_daemons_to_start; - if (remaining_children_to_start > ap_daemons_limit) { - remaining_children_to_start = ap_daemons_limit; - } - if (!is_graceful) { - startup_children(remaining_children_to_start); - remaining_children_to_start = 0; - } - else { - /* give the system some time to recover before kicking into - * exponential mode */ - hold_off_on_exponential_spawning = 10; - } - - ap_log_error(APLOG_MARK, APLOG_NOERRNO|APLOG_NOTICE, server_conf, - "%s configured -- resuming normal operations", - ap_get_server_version()); - if (ap_suexec_enabled) { - ap_log_error(APLOG_MARK, APLOG_NOERRNO|APLOG_NOTICE, server_conf, - "suEXEC mechanism enabled (wrapper: %s)", SUEXEC_BIN); - } - ap_log_error(APLOG_MARK, APLOG_NOERRNO|APLOG_INFO, server_conf, - "Server built: %s", ap_get_server_built()); - restart_pending = shutdown_pending = 0; - - while (!restart_pending && !shutdown_pending) { - int child_slot; - ap_wait_t status; - int pid = wait_or_timeout(&status); - - /* XXX: if it takes longer than 1 second for all our children - * to start up and get into IDLE state then we may spawn an - * extra child - */ - if (pid >= 0) { - process_child_status(pid, status); - /* non-fatal death... note that it's gone in the scoreboard. */ - ap_sync_scoreboard_image(); - child_slot = find_child_by_pid(pid); - Explain2("Reaping child %d slot %d", pid, child_slot); - if (child_slot >= 0) { - (void) ap_update_child_status(child_slot, SERVER_DEAD, - (request_rec *) NULL); - if (remaining_children_to_start - && child_slot < ap_daemons_limit) { - /* we're still doing a 1-for-1 replacement of dead - * children with new children - */ - make_child(server_conf, child_slot, time(0)); - --remaining_children_to_start; - } -#ifndef NO_OTHER_CHILD - } - else if (reap_other_child(pid, status) == 0) { - /* handled */ -#endif - } - else if (is_graceful) { - /* Great, we've probably just lost a slot in the - * scoreboard. Somehow we don't know about this - * child. - */ - ap_log_error(APLOG_MARK, APLOG_NOERRNO|APLOG_WARNING, server_conf, - "long lost child came home! (pid %d)", pid); - } - /* Don't perform idle maintenance when a child dies, - * only do it when there's a timeout. Remember only a - * finite number of children can die, and it's pretty - * pathological for a lot to die suddenly. - */ - continue; - } - else if (remaining_children_to_start) { - /* we hit a 1 second timeout in which none of the previous - * generation of children needed to be reaped... so assume - * they're all done, and pick up the slack if any is left. - */ - startup_children(remaining_children_to_start); - remaining_children_to_start = 0; - /* In any event we really shouldn't do the code below because - * few of the servers we just started are in the IDLE state - * yet, so we'd mistakenly create an extra server. - */ - continue; - } - - perform_idle_server_maintenance(); -#ifdef TPF - shutdown_pending = os_check_server(tpf_server_name); - ap_check_signals(); - sleep(1); -#endif /*TPF */ - } - - if (shutdown_pending) { - /* Time to gracefully shut down: - * Kill child processes, tell them to call child_exit, etc... - */ - if (ap_killpg(pgrp, SIGTERM) < 0) { - ap_log_error(APLOG_MARK, APLOG_WARNING, server_conf, "killpg SIGTERM"); - } - reclaim_child_processes(1); /* Start with SIGTERM */ - - /* cleanup pid file on normal shutdown */ - { - const char *pidfile = NULL; - pidfile = ap_server_root_relative (pconf, ap_pid_fname); - if ( pidfile != NULL && unlink(pidfile) == 0) - ap_log_error(APLOG_MARK, APLOG_NOERRNO|APLOG_INFO, - server_conf, - "removed PID file %s (pid=%ld)", - pidfile, (long)getpid()); - } - - ap_log_error(APLOG_MARK, APLOG_NOERRNO|APLOG_NOTICE, server_conf, - "caught SIGTERM, shutting down"); - clean_parent_exit(0); - } - - /* we've been told to restart */ - signal(SIGHUP, SIG_IGN); - signal(SIGUSR1, SIG_IGN); - - if (one_process) { - /* not worth thinking about */ - clean_parent_exit(0); - } - - /* advance to the next generation */ - /* XXX: we really need to make sure this new generation number isn't in - * use by any of the children. - */ - ++ap_my_generation; - ap_scoreboard_image->global.running_generation = ap_my_generation; - update_scoreboard_global(); - - if (is_graceful) { -#ifndef SCOREBOARD_FILE - int i; -#endif - ap_log_error(APLOG_MARK, APLOG_NOERRNO|APLOG_NOTICE, server_conf, - "SIGUSR1 received. Doing graceful restart"); - - /* kill off the idle ones */ - if (ap_killpg(pgrp, SIGUSR1) < 0) { - ap_log_error(APLOG_MARK, APLOG_WARNING, server_conf, "killpg SIGUSR1"); - } -#ifndef SCOREBOARD_FILE - /* This is mostly for debugging... so that we know what is still - * gracefully dealing with existing request. But we can't really - * do it if we're in a SCOREBOARD_FILE because it'll cause - * corruption too easily. - */ - ap_sync_scoreboard_image(); - for (i = 0; i < ap_daemons_limit; ++i) { - if (ap_scoreboard_image->servers[i].status != SERVER_DEAD) { - ap_scoreboard_image->servers[i].status = SERVER_GRACEFUL; - } - } -#endif - } - else { - /* Kill 'em off */ - if (ap_killpg(pgrp, SIGHUP) < 0) { - ap_log_error(APLOG_MARK, APLOG_WARNING, server_conf, "killpg SIGHUP"); - } - reclaim_child_processes(0); /* Not when just starting up */ - ap_log_error(APLOG_MARK, APLOG_NOERRNO|APLOG_NOTICE, server_conf, - "SIGHUP received. Attempting to restart"); - } - } while (restart_pending); - - /*add_common_vars(NULL);*/ -} /* standalone_main */ -#else -/* prototype */ -void STANDALONE_MAIN(int argc, char **argv); -#endif /* STANDALONE_MAIN */ - -extern char *optarg; -extern int optind; - -int REALMAIN(int argc, char *argv[]) -{ - int c; - int sock_in; - int sock_out; - char *s; - -#ifdef SecureWare - if (set_auth_parameters(argc, argv) < 0) - perror("set_auth_parameters"); - if (getluid() < 0) - if (setluid(getuid()) < 0) - perror("setluid"); - if (setreuid(0, 0) < 0) - perror("setreuid"); -#endif - -#ifdef SOCKS - SOCKSinit(argv[0]); -#endif - -#ifdef TPF - APACHE_TPF_INPUT input_parms; - ecbptr()->ebrout = PRIMECRAS; - input_parms = * (APACHE_TPF_INPUT *)(&(ecbptr()->ebw000)); -#endif - - MONCONTROL(0); - - common_init(); - - if ((s = strrchr(argv[0], PATHSEPARATOR)) != NULL) { - ap_server_argv0 = ++s; - } - else { - ap_server_argv0 = argv[0]; - } - - ap_cpystrn(ap_server_root, HTTPD_ROOT, sizeof(ap_server_root)); - ap_cpystrn(ap_server_confname, SERVER_CONFIG_FILE, sizeof(ap_server_confname)); - - ap_setup_prelinked_modules(); - - while ((c = getopt(argc, argv, - "D:C:c:xXd:f:vVlLR:StTh" -#ifdef DEBUG_SIGSTOP - "Z:" -#endif - )) != -1) { - char **new; - switch (c) { - case 'c': - new = (char **)ap_push_array(ap_server_post_read_config); - *new = ap_pstrdup(pcommands, optarg); - break; - case 'C': - new = (char **)ap_push_array(ap_server_pre_read_config); - *new = ap_pstrdup(pcommands, optarg); - break; - case 'D': - new = (char **)ap_push_array(ap_server_config_defines); - *new = ap_pstrdup(pcommands, optarg); - break; - case 'd': - ap_cpystrn(ap_server_root, optarg, sizeof(ap_server_root)); - break; - case 'f': - ap_cpystrn(ap_server_confname, optarg, sizeof(ap_server_confname)); - break; - case 'v': - ap_set_version(); - printf("Server version: %s\n", ap_get_server_version()); - printf("Server built: %s\n", ap_get_server_built()); - exit(0); - case 'V': - ap_set_version(); - show_compile_settings(); - exit(0); - case 'l': - ap_show_modules(); - exit(0); - case 'L': - ap_show_directives(); - exit(0); - case 'X': - ++one_process; /* Weird debugging mode. */ - break; -#ifdef TPF - case 'x': - os_tpf_child(&input_parms); - set_signals(); - break; -#endif -#ifdef DEBUG_SIGSTOP - case 'Z': - raise_sigstop_flags = atoi(optarg); - break; -#endif -#ifdef SHARED_CORE - case 'R': - /* just ignore this option here, because it has only - * effect when SHARED_CORE is used and then it was - * already handled in the Shared Core Bootstrap - * program. - */ - break; -#endif - case 'S': - ap_dump_settings = 1; - break; - case 't': - ap_configtestonly = 1; - ap_docrootcheck = 1; - break; - case 'T': - ap_configtestonly = 1; - ap_docrootcheck = 0; - break; - case 'h': - usage(argv[0]); - case '?': - usage(argv[0]); - } - } - - ap_suexec_enabled = init_suexec(); - server_conf = ap_read_config(pconf, ptrans, ap_server_confname); - - if (ap_configtestonly) { - fprintf(stderr, "Syntax OK\n"); - exit(0); - } - if (ap_dump_settings) { - exit(0); - } - - child_timeouts = !ap_standalone || one_process; - -#ifndef TPF - if (ap_standalone) { - ap_open_logs(server_conf, plog); - ap_set_version(); - ap_init_modules(pconf, server_conf); - version_locked++; - STANDALONE_MAIN(argc, argv); - } -#else - if (ap_standalone) { - if(!tpf_child) { - memcpy(tpf_server_name, input_parms.inetd_server.servname, INETD_SERVNAME_LENGTH); - tpf_server_name[INETD_SERVNAME_LENGTH+1] = '\0'; - ap_open_logs(server_conf, pconf); - } - ap_set_version(); - ap_init_modules(pconf, server_conf); - version_locked++; - if(tpf_child) { - copy_listeners(pconf); - reset_tpf_listeners(&input_parms); - server_conf->error_log = NULL; -#ifdef SCOREBOARD_FILE - scoreboard_fd = input_parms.scoreboard_fd; - ap_scoreboard_image = &_scoreboard_image; -#else /* must be USE_TPF_SCOREBOARD or USE_SHMGET_SCOREBOARD */ - ap_scoreboard_image = (scoreboard *)input_parms.scoreboard_heap; -#endif - child_main(input_parms.slot); - } - else - STANDALONE_MAIN(argc, argv); - } -#endif - else { - conn_rec *conn; - request_rec *r; - struct sockaddr sa_server, sa_client; - BUFF *cio; - NET_SIZE_T l; - - ap_set_version(); - /* Yes this is called twice. */ - ap_init_modules(pconf, server_conf); - version_locked++; - ap_open_logs(server_conf, plog); - ap_init_modules(pconf, server_conf); - set_group_privs(); - -#ifdef MPE - /* Only try to switch if we're running as MANAGER.SYS */ - if (geteuid() == 1 && ap_user_id > 1) { - GETPRIVMODE(); - if (setuid(ap_user_id) == -1) { - GETUSERMODE(); - ap_log_error(APLOG_MARK, APLOG_ALERT, server_conf, - "setuid: unable to change to uid: %d", ap_user_id); - exit(1); - } - GETUSERMODE(); - } -#else - /* Only try to switch if we're running as root */ - if (!geteuid() && setuid(ap_user_id) == -1) { - ap_log_error(APLOG_MARK, APLOG_ALERT, server_conf, - "setuid: unable to change to uid: %ld", - (long) ap_user_id); - exit(1); - } -#endif - if (ap_setjmp(jmpbuffer)) { - exit(0); - } - -#ifdef TPF -/* TPF only passes the incoming socket number from the internet daemon - in ebw000 */ - sock_in = * (int*)(&(ecbptr()->ebw000)); - sock_out = * (int*)(&(ecbptr()->ebw000)); -/* TPF also needs a signal set for alarm in inetd mode */ - signal(SIGALRM, alrm_handler); -#elif defined(MPE) -/* HP MPE 5.5 inetd only passes the incoming socket as stdin (fd 0), whereas - HPUX inetd passes the incoming socket as stdin (fd 0) and stdout (fd 1). - Go figure. SR 5003355016 has been submitted to request that the existing - functionality be documented, and then to enhance the functionality to be - like HPUX. */ - sock_in = fileno(stdin); - sock_out = fileno(stdin); -#else - sock_in = fileno(stdin); - sock_out = fileno(stdout); -#endif - - l = sizeof(sa_client); - if ((getpeername(sock_in, &sa_client, &l)) < 0) { -/* get peername will fail if the input isn't a socket */ - perror("getpeername"); - memset(&sa_client, '\0', sizeof(sa_client)); - } - - l = sizeof(sa_server); - if (getsockname(sock_in, &sa_server, &l) < 0) { - perror("getsockname"); - fprintf(stderr, "Error getting local address\n"); - exit(1); - } - server_conf->port = ntohs(((struct sockaddr_in *) &sa_server)->sin_port); - cio = ap_bcreate(ptrans, B_RDWR | B_SOCKET); - cio->fd = sock_out; - cio->fd_in = sock_in; - conn = new_connection(ptrans, server_conf, cio, - (struct sockaddr_in *) &sa_client, - (struct sockaddr_in *) &sa_server, -1); - - while ((r = ap_read_request(conn)) != NULL) { - - if (r->status == HTTP_OK) - ap_process_request(r); - - if (!conn->keepalive || conn->aborted) - break; - - ap_destroy_pool(r->pool); - } - - ap_bclose(cio); - } - exit(0); -} - -#else /* ndef MULTITHREAD */ - - -/********************************************************************** - * Multithreaded implementation - * - * This code is fairly specific to Win32. - * - * The model used to handle requests is a set of threads. One "main" - * thread listens for new requests. When something becomes - * available, it does a select and places the newly available socket - * onto a list of "jobs" (add_job()). Then any one of a fixed number - * of "worker" threads takes the top job off the job list with - * remove_job() and handles that connection to completion. After - * the connection has finished the thread is free to take another - * job from the job list. - * - * In the code, the "main" thread is running within the worker_main() - * function. The first thing this function does is create the - * worker threads, which operate in the child_sub_main() function. The - * main thread then goes into a loop within worker_main() where they - * do a select() on the listening sockets. The select times out once - * per second so that the thread can check for an "exit" signal - * from the parent process (see below). If this signal is set, the - * thread can exit, but only after it has accepted all incoming - * connections already in the listen queue (since Win32 appears - * to through away listened but unaccepted connections when a - * process dies). - * - * Because the main and worker threads exist within a single process - * they are vulnerable to crashes or memory leaks (crashes can also - * be caused within modules, of course). There also needs to be a - * mechanism to perform restarts and shutdowns. This is done by - * creating the main & worker threads within a subprocess. A - * main process (the "parent process") creates one (or more) - * processes to do the work, then the parent sits around waiting - * for the working process to die, in which case it starts a new - * one. The parent process also handles restarts (by creating - * a new working process then signalling the previous working process - * exit ) and shutdowns (by signalling the working process to exit). - * The parent process operates within the master_main() function. This - * process also handles requests from the service manager (NT only). - * - * Signalling between the parent and working process uses a Win32 - * event. Each child has a unique name for the event, which is - * passed to it with the -Z argument when the child is spawned. The - * parent sets (signals) this event to tell the child to die. - * At present all children do a graceful die - they finish all - * current jobs _and_ empty the listen queue before they exit. - * A non-graceful die would need a second event. The -Z argument in - * the child is also used to create the shutdown and restart events, - * since the prefix (apPID) contains the parent process PID. - * - * The code below starts with functions at the lowest level - - * worker threads, and works up to the top level - the main() - * function of the parent process. - * - * The scoreboard (in process memory) contains details of the worker - * threads (within the active working process). There is no shared - * "scoreboard" between processes, since only one is ever active - * at once (or at most, two, when one has been told to shutdown but - * is processes outstanding requests, and a new one has been started). - * This is controlled by a "start_mutex" which ensures only one working - * process is active at once. - **********************************************************************/ - -/* The code protected by #ifdef UNGRACEFUL_RESTARTS/#endif sections - * could implement a sort-of ungraceful restart for Win32. instead of - * graceful restarts. - * - * However it does not work too well because it does not intercept a - * connection already in progress (in child_sub_main()). We'd have to - * get that to poll on the exit event. - */ - -/* - * Definition of jobs, shared by main and worker threads. - */ - -typedef struct joblist_s { - struct joblist_s *next; - int sock; -} joblist; - -/* - * Globals common to main and worker threads. This structure is not - * used by the parent process. - */ - -typedef struct globals_s { -#ifdef UNGRACEFUL_RESTART - HANDLE thread_exit_event; -#else - int exit_now; -#endif - semaphore *jobsemaphore; - joblist *jobhead; - joblist *jobtail; - mutex *jobmutex; - int jobcount; -} globals; - -globals allowed_globals = -{0, NULL, NULL, NULL, NULL, 0}; - -/* - * add_job()/remove_job() - add or remove an accepted socket from the - * list of sockets connected to clients. allowed_globals.jobmutex protects - * against multiple concurrent access to the linked list of jobs. - */ - -void add_job(int sock) -{ - joblist *new_job; - - ap_assert(allowed_globals.jobmutex); - /* TODO: If too many jobs in queue, sleep, check for problems */ - ap_acquire_mutex(allowed_globals.jobmutex); - new_job = (joblist *) malloc(sizeof(joblist)); - if (new_job == NULL) { - fprintf(stderr, "Ouch! Out of memory in add_job()!\n"); - } - new_job->next = NULL; - new_job->sock = sock; - if (allowed_globals.jobtail != NULL) - allowed_globals.jobtail->next = new_job; - allowed_globals.jobtail = new_job; - if (!allowed_globals.jobhead) - allowed_globals.jobhead = new_job; - allowed_globals.jobcount++; - release_semaphore(allowed_globals.jobsemaphore); - ap_release_mutex(allowed_globals.jobmutex); -} - -int remove_job(void) -{ - joblist *job; - int sock; - -#ifdef UNGRACEFUL_RESTART - HANDLE hObjects[2]; - int rv; - - hObjects[0] = allowed_globals.jobsemaphore; - hObjects[1] = allowed_globals.thread_exit_event; - - rv = WaitForMultipleObjects(2, hObjects, FALSE, INFINITE); - ap_assert(rv != WAIT_FAILED); - if (rv == WAIT_OBJECT_0 + 1) { - /* thread_exit_now */ - APD1("thread got exit now event"); - return -1; - } - /* must be semaphore */ -#else - acquire_semaphore(allowed_globals.jobsemaphore); -#endif - ap_assert(allowed_globals.jobmutex); - -#ifdef UNGRACEFUL_RESTART - if (!allowed_globals.jobhead) { -#else - ap_acquire_mutex(allowed_globals.jobmutex); - if (allowed_globals.exit_now && !allowed_globals.jobhead) { -#endif - ap_release_mutex(allowed_globals.jobmutex); - return (-1); - } - job = allowed_globals.jobhead; - ap_assert(job); - allowed_globals.jobhead = job->next; - if (allowed_globals.jobhead == NULL) - allowed_globals.jobtail = NULL; - ap_release_mutex(allowed_globals.jobmutex); - sock = job->sock; - free(job); - return (sock); -} - -/* - * child_sub_main() - this is the main loop for the worker threads - * - * Each thread runs within this function. They wait within remove_job() - * for a job to become available, then handle all the requests on that - * connection until it is closed, then return to remove_job(). - * - * The worker thread will exit when it removes a job which contains - * socket number -1. This provides a graceful thread exit, since - * it will never exit during a connection. - * - * This code in this function is basically equivalent to the child_main() - * from the multi-process (Unix) environment, except that we - * - * - do not call child_init_modules (child init API phase) - * - block in remove_job, and when unblocked we have an already - * accepted socket, instead of blocking on a mutex or select(). - */ - -static void child_sub_main(int child_num) -{ - NET_SIZE_T clen; - struct sockaddr sa_server; - struct sockaddr sa_client; - pool *ptrans; - int requests_this_child = 0; - int csd = -1; - int dupped_csd = -1; - int srv = 0; - - ptrans = ap_make_sub_pool(pconf); - - (void) ap_update_child_status(child_num, SERVER_READY, (request_rec *) NULL); - - /* - * Setup the jump buffers so that we can return here after a timeout. - */ -#if defined(USE_LONGJMP) - setjmp(jmpbuffer); -#else - sigsetjmp(jmpbuffer, 1); -#endif -#ifdef SIGURG - signal(SIGURG, timeout); -#endif - - while (1) { - BUFF *conn_io; - request_rec *r; - - /* - * (Re)initialize this child to a pre-connection state. - */ - - ap_set_callback_and_alarm(NULL, 0); /* Cancel any outstanding alarms */ - timeout_req = NULL; /* No request in progress */ - current_conn = NULL; - - ap_clear_pool(ptrans); - - (void) ap_update_child_status(child_num, SERVER_READY, - (request_rec *) NULL); - - /* Get job from the job list. This will block until a job is ready. - * If -1 is returned then the main thread wants us to exit. - */ - csd = remove_job(); - if (csd == -1) - break; /* time to exit */ - requests_this_child++; - - ap_note_cleanups_for_socket(ptrans, csd); - - /* - * We now have a connection, so set it up with the appropriate - * socket options, file descriptors, and read/write buffers. - */ - - clen = sizeof(sa_server); - if (getsockname(csd, &sa_server, &clen) < 0) { - ap_log_error(APLOG_MARK, APLOG_WARNING, server_conf, "getsockname"); - continue; - } - clen = sizeof(sa_client); - if ((getpeername(csd, &sa_client, &clen)) < 0) { - /* get peername will fail if the input isn't a socket */ - perror("getpeername"); - memset(&sa_client, '\0', sizeof(sa_client)); - } - - sock_disable_nagle(csd); - - (void) ap_update_child_status(child_num, SERVER_BUSY_READ, - (request_rec *) NULL); - - conn_io = ap_bcreate(ptrans, B_RDWR | B_SOCKET); - dupped_csd = csd; -#if defined(NEED_DUPPED_CSD) - if ((dupped_csd = dup(csd)) < 0) { - ap_log_error(APLOG_MARK, APLOG_ERR, server_conf, - "dup: couldn't duplicate csd"); - dupped_csd = csd; /* Oh well... */ - } - ap_note_cleanups_for_socket(ptrans, dupped_csd); -#endif - ap_bpushfd(conn_io, csd, dupped_csd); - - current_conn = new_connection(ptrans, server_conf, conn_io, - (struct sockaddr_in *) &sa_client, - (struct sockaddr_in *) &sa_server, - child_num); - - /* - * Read and process each request found on our connection - * until no requests are left or we decide to close. - */ - - while ((r = ap_read_request(current_conn)) != NULL) { - (void) ap_update_child_status(child_num, SERVER_BUSY_WRITE, r); - - if (r->status == HTTP_OK) - ap_process_request(r); - - if (ap_extended_status) - increment_counts(child_num, r); - - if (!current_conn->keepalive || current_conn->aborted) - break; - - ap_destroy_pool(r->pool); - (void) ap_update_child_status(child_num, SERVER_BUSY_KEEPALIVE, - (request_rec *) NULL); - - ap_sync_scoreboard_image(); - } - - /* - * Close the connection, being careful to send out whatever is still - * in our buffers. If possible, try to avoid a hard close until the - * client has ACKed our FIN and/or has stopped sending us data. - */ - ap_kill_cleanups_for_socket(ptrans, csd); - -#ifdef NO_LINGCLOSE - ap_bclose(conn_io); /* just close it */ -#else - if (r && r->connection - && !r->connection->aborted - && r->connection->client - && (r->connection->client->fd >= 0)) { - - lingering_close(r); - } - else { - ap_bsetflag(conn_io, B_EOUT, 1); - ap_bclose(conn_io); - } -#endif - } - ap_destroy_pool(ptrans); - (void) ap_update_child_status(child_num, SERVER_DEAD, NULL); -} - - -void child_main(int child_num_arg) -{ - /* - * Only reason for this function, is to pass in - * arguments to child_sub_main() on its stack so - * that longjump doesn't try to corrupt its local - * variables and I don't need to make those - * damn variables static/global - */ - child_sub_main(child_num_arg); -} - - - -void cleanup_thread(thread **handles, int *thread_cnt, int thread_to_clean) -{ - int i; - - free_thread(handles[thread_to_clean]); - for (i = thread_to_clean; i < ((*thread_cnt) - 1); i++) - handles[i] = handles[i + 1]; - (*thread_cnt)--; -} -#ifdef WIN32 -/* - * The Win32 call WaitForMultipleObjects will only allow you to wait for - * a maximum of MAXIMUM_WAIT_OBJECTS (current 64). Since the threading - * model in the multithreaded version of apache wants to use this call, - * we are restricted to a maximum of 64 threads. This is a simplistic - * routine that will increase this size. - */ -static DWORD wait_for_many_objects(DWORD nCount, CONST HANDLE *lpHandles, - DWORD dwSeconds) -{ - time_t tStopTime; - DWORD dwRet = WAIT_TIMEOUT; - DWORD dwIndex=0; - BOOL bFirst = TRUE; - - tStopTime = time(NULL) + dwSeconds; - - do { - if (!bFirst) - Sleep(1000); - else - bFirst = FALSE; - - for (dwIndex = 0; dwIndex * MAXIMUM_WAIT_OBJECTS < nCount; dwIndex++) { - dwRet = WaitForMultipleObjects( - min(MAXIMUM_WAIT_OBJECTS, - nCount - (dwIndex * MAXIMUM_WAIT_OBJECTS)), - lpHandles + (dwIndex * MAXIMUM_WAIT_OBJECTS), - 0, 0); - - if (dwRet != WAIT_TIMEOUT) { - break; - } - } - } while((time(NULL) < tStopTime) && (dwRet == WAIT_TIMEOUT)); - - return dwRet; -} -#endif -/***************************************************************** - * Executive routines. - */ - -extern void main_control_server(void *); /* in hellop.c */ - -event *exit_event; -mutex *start_mutex; - -#define MAX_SIGNAL_NAME 30 /* Long enough for apPID_shutdown, where PID is an int */ -char signal_name_prefix[MAX_SIGNAL_NAME]; -char signal_restart_name[MAX_SIGNAL_NAME]; -char signal_shutdown_name[MAX_SIGNAL_NAME]; - -#define MAX_SELECT_ERRORS 100 - -/* - * Initialise the signal names, in the global variables signal_name_prefix, - * signal_restart_name and signal_shutdown_name. - */ - -void setup_signal_names(char *prefix) -{ - ap_snprintf(signal_name_prefix, sizeof(signal_name_prefix), prefix); - ap_snprintf(signal_shutdown_name, sizeof(signal_shutdown_name), - "%s_shutdown", signal_name_prefix); - ap_snprintf(signal_restart_name, sizeof(signal_restart_name), - "%s_restart", signal_name_prefix); - - APD2("signal prefix %s", signal_name_prefix); -} - -static void setup_inherited_listeners(pool *p) -{ - HANDLE pipe; - listen_rec *lr; - int fd; - WSAPROTOCOL_INFO WSAProtocolInfo; - DWORD BytesRead; - - /* Open the pipe to the parent process to receive the inherited socket - * data. The sockets have been set to listening in the parent process. - */ - pipe = GetStdHandle(STD_INPUT_HANDLE); - - /* Setup the listeners */ - listenmaxfd = -1; - FD_ZERO(&listenfds); - lr = ap_listeners; - - FD_ZERO(&listenfds); - - for (;;) { - fd = find_listener(lr); - if (fd < 0) { - if (!ReadFile(pipe, - &WSAProtocolInfo, sizeof(WSAPROTOCOL_INFO), - &BytesRead, - (LPOVERLAPPED) NULL)){ - ap_log_error(APLOG_MARK, APLOG_WIN32ERROR|APLOG_CRIT, server_conf, - "setup_inherited_listeners: Unable to read socket data from parent"); - exit(1); - } - fd = WSASocket(FROM_PROTOCOL_INFO, - FROM_PROTOCOL_INFO, - FROM_PROTOCOL_INFO, - &WSAProtocolInfo, - 0, - 0); - if (fd == INVALID_SOCKET) { - ap_log_error(APLOG_MARK, APLOG_WIN32ERROR|APLOG_CRIT, server_conf, - "setup_inherited_listeners: WSASocket failed to get inherit the socket."); - exit(1); - } - APD2("setup_inherited_listeners: WSASocket() returned socket %d", fd); - } - else { - ap_note_cleanups_for_socket(p, fd); - } - if (fd >= 0) { - FD_SET(fd, &listenfds); - if (fd > listenmaxfd) - listenmaxfd = fd; - } - lr->fd = fd; - if (lr->next == NULL) - break; - lr = lr->next; - } - /* turn the list into a ring */ - lr->next = ap_listeners; - head_listener = ap_listeners; - close_unused_listeners(); - CloseHandle(pipe); - return; -} - -/* - * worker_main() is main loop for the child process. The loop in - * this function becomes the controlling thread for the actually working - * threads (which run in a loop in child_sub_main()). - */ - -void worker_main(void) -{ - int nthreads; - fd_set main_fds; - int srv; - int clen; - int csd; - struct sockaddr_in sa_client; - int total_jobs = 0; - thread **child_handles; - int rv; - time_t end_time; - int i; - struct timeval tv; - int wait_time = 1; - int max_jobs_per_exe; - int max_jobs_after_exit_request; - HANDLE hObjects[2]; - int count_select_errors = 0; - pool *pchild; - - pchild = ap_make_sub_pool(pconf); - - ap_standalone = 1; - sd = -1; - nthreads = ap_threads_per_child; - max_jobs_after_exit_request = ap_excess_requests_per_child; - max_jobs_per_exe = ap_max_requests_per_child; - if (nthreads <= 0) - nthreads = 40; - if (max_jobs_per_exe <= 0) - max_jobs_per_exe = 0; - if (max_jobs_after_exit_request <= 0) - max_jobs_after_exit_request = max_jobs_per_exe / 10; - - if (!one_process) - detach(); - - my_pid = getpid(); - - ++ap_my_generation; - - copy_listeners(pconf); - ap_restart_time = time(NULL); - - reinit_scoreboard(pconf); - - /* - * Wait until we have permission to start accepting connections. - * start_mutex is used to ensure that only one child ever - * goes into the listen/accept loop at once. Also wait on exit_event, - * in case we (this child) is told to die before we get a chance to - * serve any requests. - */ - hObjects[0] = (HANDLE)start_mutex; - hObjects[1] = (HANDLE)exit_event; - rv = WaitForMultipleObjects(2, hObjects, FALSE, INFINITE); - if (rv == WAIT_FAILED) { - ap_log_error(APLOG_MARK,APLOG_ERR|APLOG_WIN32ERROR, server_conf, - "Waiting for start_mutex or exit_event -- process will exit"); - - ap_destroy_pool(pchild); - cleanup_scoreboard(); - exit(0); - } - if (rv == WAIT_OBJECT_0 + 1) { - /* exit event signalled - exit now */ - ap_destroy_pool(pchild); - cleanup_scoreboard(); - exit(0); - } - /* start_mutex obtained, continue into the select() loop */ - if (one_process) { - setup_listeners(pconf); - } else { - /* Get listeners from the parent process */ - setup_inherited_listeners(pconf); - } - - if (listenmaxfd == -1) { - /* Help, no sockets were made, better log something and exit */ - ap_log_error(APLOG_MARK, APLOG_CRIT|APLOG_NOERRNO, NULL, - "No sockets were created for listening"); - - signal_parent(0); /* tell parent to die */ - - ap_destroy_pool(pchild); - cleanup_scoreboard(); - exit(0); - } - set_signals(); - - /* - * - Initialize allowed_globals - * - Create the thread table - * - Spawn off threads - * - Create listen socket set (done above) - * - loop { - * wait for request - * create new job - * } while (!time to exit) - * - Close all listeners - * - Wait for all threads to complete - * - Exit - */ - - ap_child_init_modules(pconf, server_conf); - - allowed_globals.jobsemaphore = create_semaphore(0); - allowed_globals.jobmutex = ap_create_mutex(NULL); - - /* spawn off the threads */ - child_handles = (thread *) alloca(nthreads * sizeof(int)); - for (i = 0; i < nthreads; i++) { - child_handles[i] = create_thread((void (*)(void *)) child_main, (void *) i); - } - if (nthreads > max_daemons_limit) { - max_daemons_limit = nthreads; - } - - while (1) { - if (max_jobs_per_exe && (total_jobs > max_jobs_per_exe)) { - /* MaxRequestsPerChild hit... - */ - break; - } - /* Always check for the exit event being signaled. - */ - rv = WaitForSingleObject(exit_event, 0); - ap_assert((rv == WAIT_TIMEOUT) || (rv == WAIT_OBJECT_0)); - if (rv == WAIT_OBJECT_0) { - APD1("child: exit event signalled, exiting"); - break; - } - - tv.tv_sec = wait_time; - tv.tv_usec = 0; - - memcpy(&main_fds, &listenfds, sizeof(fd_set)); - srv = ap_select(listenmaxfd + 1, &main_fds, NULL, NULL, &tv); -#ifdef WIN32 - if (srv == SOCKET_ERROR) { - /* Map the Win32 error into a standard Unix error condition */ - errno = WSAGetLastError(); - srv = -1; - } -#endif /* WIN32 */ - - if (srv < 0) { - /* Error occurred - if EINTR, loop around with problem */ - if (errno != EINTR) { - /* A "real" error occurred, log it and increment the count of - * select errors. This count is used to ensure we don't go into - * a busy loop of continuous errors. - */ - ap_log_error(APLOG_MARK, APLOG_ERR, server_conf, "select: (listen)"); - count_select_errors++; - if (count_select_errors > MAX_SELECT_ERRORS) { - ap_log_error(APLOG_MARK, APLOG_ERR|APLOG_NOERRNO, server_conf, - "Too many errors in select loop. Child process exiting."); - break; - } - } - continue; - } - count_select_errors = 0; /* reset count of errors */ - if (srv == 0) { - continue; - } - - { - listen_rec *lr; - - lr = find_ready_listener(&main_fds); - if (lr != NULL) { - sd = lr->fd; - } - } - do { - clen = sizeof(sa_client); - csd = accept(sd, (struct sockaddr *) &sa_client, &clen); -#ifdef WIN32 - if (csd == INVALID_SOCKET) { - csd = -1; - errno = WSAGetLastError(); - } -#endif /* WIN32 */ - } while (csd < 0 && errno == EINTR); - - if (csd < 0) { -#if defined(EPROTO) && defined(ECONNABORTED) - if ((errno != EPROTO) && (errno != ECONNABORTED)) -#elif defined(EPROTO) - if (errno != EPROTO) -#elif defined(ECONNABORTED) - if (errno != ECONNABORTED) -#endif - ap_log_error(APLOG_MARK, APLOG_ERR, server_conf, - "accept: (client socket)"); - } - else { - add_job(csd); - total_jobs++; - } - } - - APD2("process PID %d exiting", my_pid); - - /* Get ready to shutdown and exit */ - allowed_globals.exit_now = 1; - ap_release_mutex(start_mutex); - -#ifdef UNGRACEFUL_RESTART - SetEvent(allowed_globals.thread_exit_event); -#else - for (i = 0; i < nthreads; i++) { - add_job(-1); - } -#endif - - APD2("process PID %d waiting for worker threads to exit", my_pid); - /* Wait for all your children */ - end_time = time(NULL) + 180; - while (nthreads) { - rv = wait_for_many_objects(nthreads, child_handles, - end_time - time(NULL)); - if (rv != WAIT_TIMEOUT) { - rv = rv - WAIT_OBJECT_0; - ap_assert((rv >= 0) && (rv < nthreads)); - cleanup_thread(child_handles, &nthreads, rv); - continue; - } - break; - } - - APD2("process PID %d killing remaining worker threads", my_pid); - for (i = 0; i < nthreads; i++) { - kill_thread(child_handles[i]); - free_thread(child_handles[i]); - } -#ifdef UNGRACEFUL_RESTART - ap_assert(CloseHandle(allowed_globals.thread_exit_event)); -#endif - destroy_semaphore(allowed_globals.jobsemaphore); - ap_destroy_mutex(allowed_globals.jobmutex); - - ap_child_exit_modules(pconf, server_conf); - ap_destroy_pool(pchild); - - cleanup_scoreboard(); - - APD2("process PID %d exited", my_pid); - clean_parent_exit(0); -} /* standalone_main */ - -/* - * Spawn a child Apache process. The child process has the command line arguments from - * argc and argv[], plus a -Z argument giving the name of an event. The child should - * open and poll or wait on this event. When it is signalled, the child should die. - * prefix is a prefix string for the event name. - * - * The child_num argument on entry contains a serial number for this child (used to create - * a unique event name). On exit, this number will have been incremented by one, ready - * for the next call. - * - * On exit, the value pointed to be *ev will contain the event created - * to signal the new child process. - * - * The return value is the handle to the child process if successful, else -1. If -1 is - * returned the error will already have been logged by ap_log_error(). - */ - -/********************************************************************** - * master_main - this is the parent (main) process. We create a - * child process to do the work, then sit around waiting for either - * the child to exit, or a restart or exit signal. If the child dies, - * we just respawn a new one. If we have a shutdown or graceful restart, - * tell the child to die when it is ready. If it is a non-graceful - * restart, force the child to die immediately. - **********************************************************************/ - -#define MAX_PROCESSES 50 /* must be < MAX_WAIT_OBJECTS-1 */ - -static void cleanup_process(HANDLE *handles, HANDLE *events, int position, int *processes) -{ - int i; - int handle = 0; - - CloseHandle(handles[position]); - CloseHandle(events[position]); - - handle = (int)handles[position]; - - for (i = position; i < (*processes)-1; i++) { - handles[i] = handles[i + 1]; - events[i] = events[i + 1]; - } - (*processes)--; - - APD4("cleanup_processes: removed child in slot %d handle %d, max=%d", position, handle, *processes); -} - -static int create_process(pool *p, HANDLE *handles, HANDLE *events, - int *processes, int *child_num, char *kill_event_name, int argc, char **argv) -{ - - int rv, i; - HANDLE kill_event; - char buf[1024]; - char exit_event_name[40]; /* apPID_C# */ - char *pCommand; - - STARTUPINFO si; /* Filled in prior to call to CreateProcess */ - PROCESS_INFORMATION pi; /* filled in on call to CreateProces */ - LPWSAPROTOCOL_INFO lpWSAProtocolInfo; - listen_rec *lr; - DWORD BytesWritten; - HANDLE hPipeRead = NULL; - HANDLE hPipeWrite = NULL; - SECURITY_ATTRIBUTES sa = {0}; - - sa.nLength = sizeof(sa); - sa.bInheritHandle = TRUE; - sa.lpSecurityDescriptor = NULL; - - /* Build the command line. Should look something like this: - * C:/apache/bin/apache.exe -Z exit_event -f ap_server_confname - * First, get the path to the executable... - */ - rv = GetModuleFileName(NULL, buf, sizeof(buf)); - if (rv == sizeof(buf)) { - ap_log_error(APLOG_MARK, APLOG_WIN32ERROR | APLOG_CRIT, server_conf, - "Parent: Path to Apache process too long"); - return -1; - } else if (rv == 0) { - ap_log_error(APLOG_MARK, APLOG_WIN32ERROR | APLOG_CRIT, server_conf, - "Parent: GetModuleFileName() returned NULL for current process."); - return -1; - } - - /* Create the exit event (apPID_C#). Parent signals this event to tell the - * child to exit - */ - ap_snprintf(exit_event_name, sizeof(exit_event_name), "%s_C%d", kill_event_name, ++(*child_num)); - kill_event = CreateEvent(NULL, TRUE, FALSE, exit_event_name); - if (!kill_event) { - ap_log_error(APLOG_MARK, APLOG_WIN32ERROR | APLOG_CRIT, server_conf, - "Parent: Could not create exit event for child process"); - return -1; - } - - pCommand = ap_psprintf(p, "\"%s\" -Z %s -f \"%s\"", buf, exit_event_name, ap_server_confname); - - for (i = 1; i < argc; i++) { - pCommand = ap_pstrcat(p, pCommand, " ", argv[i], NULL); - } - - /* Create a pipe to send socket info to the child */ - if (!CreatePipe(&hPipeRead, &hPipeWrite, &sa, 0)) { - ap_log_error(APLOG_MARK, APLOG_WIN32ERROR | APLOG_CRIT, server_conf, - "Parent: Unable to create pipe to child process.\n"); - return -1; - } - - /* Give the read in of teh pipe (hPipeRead) to the child as stdin. The - * parent will write the socket data to the child on this pipe. - */ - memset(&si, 0, sizeof(si)); - memset(&pi, 0, sizeof(pi)); - si.cb = sizeof(si); - si.dwFlags = STARTF_USESHOWWINDOW | STARTF_USESTDHANDLES; - si.wShowWindow = SW_HIDE; - si.hStdInput = hPipeRead; - - if (!CreateProcess(NULL, pCommand, NULL, NULL, - TRUE, /* Inherit handles */ - 0, /* Creation flags */ - NULL, NULL, - &si, &pi)) { - ap_log_error(APLOG_MARK, APLOG_WIN32ERROR | APLOG_CRIT, server_conf, - "Parent: Not able to create the child process."); - /* - * We must close the handles to the new process and its main thread - * to prevent handle and memory leaks. - */ - CloseHandle(pi.hProcess); - CloseHandle(pi.hThread); - - return -1; - } - else { - ap_log_error(APLOG_MARK, APLOG_NOERRNO | APLOG_INFO, server_conf, - "Parent: Created child process %d", pi.dwProcessId); - - /* Assume the child process lives. Update the process and event tables */ - handles[*processes] = pi.hProcess; - events[*processes] = kill_event; - (*processes)++; - - /* We never store the thread's handle, so close it now. */ - CloseHandle(pi.hThread); - - /* Run the chain of open sockets. For each socket, duplicate it - * for the target process then send the WSAPROTOCOL_INFO - * (returned by dup socket) to the child */ - lr = ap_listeners; - while (lr != NULL) { - lpWSAProtocolInfo = ap_pcalloc(p, sizeof(WSAPROTOCOL_INFO)); - ap_log_error(APLOG_MARK, APLOG_NOERRNO | APLOG_INFO, server_conf, - "Parent: Duplicating socket %d and sending it to child process %d", lr->fd, pi.dwProcessId); - if (WSADuplicateSocket(lr->fd, - pi.dwProcessId, - lpWSAProtocolInfo) == SOCKET_ERROR) { - ap_log_error(APLOG_MARK, APLOG_WIN32ERROR | APLOG_CRIT, server_conf, - "Parent: WSADuplicateSocket failed for socket %d.", lr->fd ); - return -1; - } - - if (!WriteFile(hPipeWrite, lpWSAProtocolInfo, (DWORD) sizeof(WSAPROTOCOL_INFO), - &BytesWritten, - (LPOVERLAPPED) NULL)) { - ap_log_error(APLOG_MARK, APLOG_WIN32ERROR | APLOG_CRIT, server_conf, - "Parent: Unable to write duplicated socket %d to the child.", lr->fd ); - return -1; - } - - lr = lr->next; - if (lr == ap_listeners) - break; - } - } - CloseHandle(hPipeRead); - CloseHandle(hPipeWrite); - - return 0; -} - -/* To share the semaphores with other processes, we need a NULL ACL - * Code from MS KB Q106387 - */ - -static PSECURITY_ATTRIBUTES GetNullACL() -{ - PSECURITY_DESCRIPTOR pSD; - PSECURITY_ATTRIBUTES sa; - - sa = (PSECURITY_ATTRIBUTES) LocalAlloc(LPTR, sizeof(SECURITY_ATTRIBUTES)); - pSD = (PSECURITY_DESCRIPTOR) LocalAlloc(LPTR, - SECURITY_DESCRIPTOR_MIN_LENGTH); - if (pSD == NULL || sa == NULL) { - return NULL; - } - /* - * We can safely use GetLastError() here without presetting it; - * {Initialize,Set}SecurityDescriptor() have been verified as clearing it - * on successful completion. - */ - if (!InitializeSecurityDescriptor(pSD, SECURITY_DESCRIPTOR_REVISION) - || GetLastError()) { - LocalFree( pSD ); - LocalFree( sa ); - return NULL; - } - if (!SetSecurityDescriptorDacl(pSD, TRUE, (PACL) NULL, FALSE) - || GetLastError()) { - LocalFree( pSD ); - LocalFree( sa ); - return NULL; - } - sa->nLength = sizeof(sa); - sa->lpSecurityDescriptor = pSD; - sa->bInheritHandle = TRUE; - return sa; -} - - -static void CleanNullACL( void *sa ) { - if( sa ) { - LocalFree( ((PSECURITY_ATTRIBUTES)sa)->lpSecurityDescriptor); - LocalFree( sa ); - } -} - -int master_main(int argc, char **argv) -{ - /* returns NULL if invalid (Win95?) */ - PSECURITY_ATTRIBUTES sa = GetNullACL(); - int nchild = ap_daemons_to_start; - int child_num = 0; - int rv, cld; - char signal_prefix_string[100]; - int i; - time_t tmstart; - HANDLE signal_shutdown_event; /* used to signal shutdown to parent */ - HANDLE signal_restart_event; /* used to signal a restart to parent */ - HANDLE process_handles[MAX_PROCESSES]; - HANDLE process_kill_events[MAX_PROCESSES]; - int current_live_processes = 0; /* number of child process we know about */ - int processes_to_create = 0; /* number of child processes to create */ - pool *pparent = NULL; /* pool for the parent process. Cleaned on each restart */ - - nchild = 1; /* only allowed one child process for current generation */ - processes_to_create = nchild; - - is_graceful = 0; - - ap_snprintf(signal_prefix_string, sizeof(signal_prefix_string), - "ap%d", getpid()); - setup_signal_names(signal_prefix_string); - - /* Create shutdown event, apPID_shutdown, where PID is the parent - * Apache process ID. Shutdown is signaled by 'apache -k shutdown'. - */ - signal_shutdown_event = CreateEvent(sa, TRUE, FALSE, signal_shutdown_name); - if (!signal_shutdown_event) { - ap_log_error(APLOG_MARK, APLOG_EMERG|APLOG_WIN32ERROR, server_conf, - "master_main: Cannot create shutdown event %s", signal_shutdown_name); - CleanNullACL((void *)sa); - exit(1); - } - - /* Create restart event, apPID_restart, where PID is the parent - * Apache process ID. Restart is signaled by 'apache -k restart'. - */ - signal_restart_event = CreateEvent(sa, TRUE, FALSE, signal_restart_name); - if (!signal_restart_event) { - CloseHandle(signal_shutdown_event); - ap_log_error(APLOG_MARK, APLOG_EMERG|APLOG_WIN32ERROR, server_conf, - "master_main: Cannot create restart event %s", signal_restart_name); - CleanNullACL((void *)sa); - exit(1); - } - CleanNullACL((void *)sa); - - /* Create the start mutex, apPID, where PID is the parent Apache process ID. - * Ths start mutex is used during a restart to prevent more than one - * child process from entering the accept loop at once. - */ - start_mutex = ap_create_mutex(signal_prefix_string); - restart_pending = shutdown_pending = 0; - - do { /* restart-pending */ - if (!is_graceful) { - ap_restart_time = time(NULL); - } - copy_listeners(pconf); - ap_clear_pool(pconf); - pparent = ap_make_sub_pool(pconf); - - server_conf = ap_read_config(pconf, pparent, ap_server_confname); - setup_listeners(pconf); - ap_clear_pool(plog); - ap_open_logs(server_conf, plog); - ap_set_version(); - ap_init_modules(pconf, server_conf); - version_locked++; - service_set_status(SERVICE_START_PENDING); - /* Create child processes */ - while (processes_to_create--) { - if (create_process(pconf, process_handles, process_kill_events, - ¤t_live_processes, &child_num, signal_prefix_string, argc, argv) < 0) { - ap_log_error(APLOG_MARK, APLOG_ERR, server_conf, - "master_main: create child process failed. Exiting."); - goto die_now; - } - } - service_set_status(SERVICE_RUNNING); - restart_pending = shutdown_pending = 0; - - /* Wait for either the shutdown or restart events to be signaled */ - process_handles[current_live_processes] = signal_shutdown_event; - process_handles[current_live_processes+1] = signal_restart_event; - rv = WaitForMultipleObjects(current_live_processes+2, (HANDLE *)process_handles, - FALSE, INFINITE); - if (rv == WAIT_FAILED) { - /* Something serious is wrong */ - ap_log_error(APLOG_MARK,APLOG_CRIT|APLOG_WIN32ERROR, server_conf, - "master_main: : WaitForMultipeObjects on process handles and apache-signal -- doing shutdown"); - shutdown_pending = 1; - break; - } - if (rv == WAIT_TIMEOUT) { - /* Hey, this cannot happen */ - ap_log_error(APLOG_MARK, APLOG_ERR, server_conf, - "master_main: WaitForMultipeObjects with INFINITE wait exited with WAIT_TIMEOUT"); - shutdown_pending = 1; - } - - cld = rv - WAIT_OBJECT_0; - APD4("main process: wait finished, cld=%d handle %d (max=%d)", cld, process_handles[cld], current_live_processes); - if (cld == current_live_processes) { - /* apPID_shutdown event signalled, we should exit now */ - shutdown_pending = 1; - ap_log_error(APLOG_MARK, APLOG_NOERRNO|APLOG_INFO, server_conf, - "master_main: Shutdown event signaled. Shutting the server down."); - if (ResetEvent(signal_shutdown_event) == 0) { - ap_log_error(APLOG_MARK, APLOG_ERR|APLOG_WIN32ERROR, server_conf, - "ResetEvent(signal_shutdown_event)"); - } - /* Signal each child processes to die */ - for (i = 0; i < current_live_processes; i++) { - APD3("master_main: signalling child %d, handle %d to die", i, process_handles[i]); - if (SetEvent(process_kill_events[i]) == 0) - ap_log_error(APLOG_MARK,APLOG_ERR|APLOG_WIN32ERROR, server_conf, - "master_main: SetEvent for child process in slot #%d failed", i); - } - break; - } else if (cld == current_live_processes+1) { - /* apPID_restart event signalled, restart the child process */ - int children_to_kill = current_live_processes; - restart_pending = 1; - ap_log_error(APLOG_MARK, APLOG_NOERRNO|APLOG_INFO, server_conf, - "master_main: Restart event signaled. Doing a graceful restart."); - if (ResetEvent(signal_restart_event) == 0) { - ap_log_error(APLOG_MARK, APLOG_ERR|APLOG_WIN32ERROR, server_conf, - "master_main: ResetEvent(signal_restart_event) failed."); - } - /* Signal each child process to die */ - for (i = 0; i < children_to_kill; i++) { - APD3("master_main: signalling child #%d handle %d to die", i, process_handles[i]); - if (SetEvent(process_kill_events[i]) == 0) - ap_log_error(APLOG_MARK, APLOG_ERR|APLOG_WIN32ERROR, server_conf, - "master_main: SetEvent for child process in slot #%d failed", i); - /* Remove the process (and event) from the process table */ - cleanup_process(process_handles, process_kill_events, i, ¤t_live_processes); - } - processes_to_create = nchild; - ++ap_my_generation; - continue; - } else { - /* A child process must have exited because of MaxRequestPerChild being hit - * or a fatal error condition (seg fault, etc.). Remove the dead process - * from the process_handles and process_kill_events table and create a new - * child process. - */ - ap_log_error(APLOG_MARK, APLOG_NOERRNO|APLOG_INFO, server_conf, - "master_main: Child processed exited (due to MaxRequestsPerChild?). Restarting the child process."); - ap_assert(cld < current_live_processes); - cleanup_process(process_handles, process_kill_events, cld, ¤t_live_processes); - APD2("main_process: child in slot %d died", rv); - processes_to_create = 1; - continue; - } - - } while (1); - - /* If we dropped out of the loop we definitly want to die completely. We need to - * make sure we wait for all the child process to exit first. - */ - - APD2("*** main process shutdown, processes=%d ***", current_live_processes); - -die_now: - - tmstart = time(NULL); - while (current_live_processes && ((tmstart+60) > time(NULL))) { - service_set_status(SERVICE_STOP_PENDING); - rv = WaitForMultipleObjects(current_live_processes, (HANDLE *)process_handles, FALSE, 2000); - if (rv == WAIT_TIMEOUT) - continue; - ap_assert(rv != WAIT_FAILED); - cld = rv - WAIT_OBJECT_0; - ap_assert(rv < current_live_processes); - APD4("main_process: child in #%d handle %d died, left=%d", - rv, process_handles[rv], current_live_processes); - cleanup_process(process_handles, process_kill_events, cld, ¤t_live_processes); - } - for (i = 0; i < current_live_processes; i++) { - ap_log_error(APLOG_MARK,APLOG_ERR|APLOG_NOERRNO, server_conf, - "forcing termination of child #%d (handle %d)", i, process_handles[i]); - TerminateProcess((HANDLE) process_handles[i], 1); - } - - CloseHandle(signal_restart_event); - CloseHandle(signal_shutdown_event); - - /* cleanup pid file on normal shutdown */ - { - const char *pidfile = NULL; - pidfile = ap_server_root_relative (pparent, ap_pid_fname); - if ( pidfile != NULL && unlink(pidfile) == 0) - ap_log_error(APLOG_MARK, APLOG_NOERRNO|APLOG_INFO, - server_conf, - "removed PID file %s (pid=%ld)", - pidfile, (long)getpid()); - } - - if (pparent) { - ap_destroy_pool(pparent); - } - - ap_destroy_mutex(start_mutex); - - service_set_status(SERVICE_STOPPED); - return (0); -} - -/* - * Send signal to a running Apache. On entry signal should contain - * either "shutdown" or "restart" - */ - -int send_signal(pool *p, char *signal) -{ - char prefix[20]; - FILE *fp; - int nread; - char *fname; - int end; - - fname = ap_server_root_relative (p, ap_pid_fname); - - fp = fopen(fname, "r"); - if (!fp) { - printf("Cannot read apache PID file %s\n", fname); - return FALSE; - } - prefix[0] = 'a'; - prefix[1] = 'p'; - - nread = fread(prefix+2, 1, sizeof(prefix)-3, fp); - if (nread == 0) { - fclose(fp); - printf("PID file %s was empty\n", fname); - return FALSE; - } - fclose(fp); - - /* Terminate the prefix string */ - end = 2 + nread - 1; - while (end > 0 && (prefix[end] == '\r' || prefix[end] == '\n')) - end--; - prefix[end + 1] = '\0'; - - setup_signal_names(prefix); - - if (!strcasecmp(signal, "shutdown")) - ap_start_shutdown(); - else if (!strcasecmp(signal, "restart")) - ap_start_restart(1); - else { - printf("Unknown signal name \"%s\". Use either shutdown or restart.\n", - signal); - return FALSE; - } - return TRUE; -} - -void post_parse_init() -{ - ap_set_version(); - ap_init_modules(pconf, server_conf); - ap_suexec_enabled = init_suexec(); - version_locked++; - ap_open_logs(server_conf, plog); - set_group_privs(); -} - -int service_init() -{ - common_init(); - - ap_cpystrn(ap_server_root, HTTPD_ROOT, sizeof(ap_server_root)); - if (ap_registry_get_service_conf(pconf, ap_server_confname, sizeof(ap_server_confname), - ap_server_argv0)) - return FALSE; - - ap_setup_prelinked_modules(); - server_conf = ap_read_config(pconf, ptrans, ap_server_confname); - ap_log_pid(pconf, ap_pid_fname); - post_parse_init(); - return TRUE; -} - -#ifdef WIN32 -__declspec(dllexport) - int apache_main(int argc, char *argv[]) -#else -int REALMAIN(int argc, char *argv[]) -#endif -{ - int c; - int child = 0; - char *cp; - char *s; - char *service_name = NULL; - int install = 0; - int conf_specified = 0; - char *signal_to_send = NULL; - char cwd[MAX_STRING_LEN]; - - /* Service application - * Configuration file in registry at: - * HKLM\System\CurrentControlSet\Services\[Svc name]\Parameters\ConfPath - */ - if (isProcessService()) { - service_main(master_main, argc, argv); - clean_parent_exit(0); - } - - /* Console application or a child process. */ - - if ((s = strrchr(argv[0], PATHSEPARATOR)) != NULL) { - ap_server_argv0 = ++s; - } - else { - ap_server_argv0 = argv[0]; - } - - common_init(); - ap_setup_prelinked_modules(); - - if(!GetCurrentDirectory(sizeof(cwd),cwd)) { - ap_log_error(APLOG_MARK,APLOG_WIN32ERROR, NULL, - "GetCurrentDirectory() failure"); - return -1; - } - - ap_cpystrn(cwd, ap_os_canonical_filename(pcommands, cwd), sizeof(cwd)); - ap_cpystrn(ap_server_root, cwd, sizeof(ap_server_root)); - - while ((c = getopt(argc, argv, "D:C:c:Xd:f:vVlLZ:iusStThk:n:")) != -1) { - char **new; - switch (c) { - case 'c': - new = (char **)ap_push_array(ap_server_post_read_config); - *new = ap_pstrdup(pcommands, optarg); - break; - case 'C': - new = (char **)ap_push_array(ap_server_pre_read_config); - *new = ap_pstrdup(pcommands, optarg); - break; - case 'D': - new = (char **)ap_push_array(ap_server_config_defines); - *new = ap_pstrdup(pcommands, optarg); - break; -#ifdef WIN32 - case 'Z': - exit_event = open_event(optarg); - APD2("child: opened process event %s", optarg); - cp = strchr(optarg, '_'); - ap_assert(cp); - *cp = 0; - setup_signal_names(optarg); - start_mutex = ap_open_mutex(signal_name_prefix); - ap_assert(start_mutex); - child = 1; - break; - case 'n': - service_name = ap_pstrdup(pcommands, optarg); - if (isValidService(optarg)) { - ap_registry_get_service_conf(pconf, ap_server_confname, sizeof(ap_server_confname), - optarg); - conf_specified = 1; - } - break; - case 'i': - install = 1; - break; - case 'u': - install = -1; - break; - case 'S': - ap_dump_settings = 1; - break; - case 'k': - signal_to_send = optarg; - break; -#endif /* WIN32 */ - case 'd': - optarg = ap_os_canonical_filename(pcommands, optarg); - if (!ap_os_is_path_absolute(optarg)) { - optarg = ap_pstrcat(pcommands, cwd, optarg, NULL); - ap_getparents(optarg); - } - if (optarg[strlen(optarg)-1] != '/') - optarg = ap_pstrcat(pcommands, optarg, "/", NULL); - ap_cpystrn(ap_server_root, - optarg, - sizeof(ap_server_root)); - break; - case 'f': - ap_cpystrn(ap_server_confname, - ap_os_canonical_filename(pcommands, optarg), - sizeof(ap_server_confname)); - conf_specified = 1; - break; - case 'v': - ap_set_version(); - printf("Server version: %s\n", ap_get_server_version()); - printf("Server built: %s\n", ap_get_server_built()); - exit(0); - case 'V': - ap_set_version(); - show_compile_settings(); - exit(0); - case 'l': - ap_show_modules(); - exit(0); - case 'L': - ap_show_directives(); - exit(0); - case 'X': - ++one_process; /* Weird debugging mode. */ - break; - case 't': - ap_configtestonly = 1; - ap_docrootcheck = 1; - break; - case 'T': - ap_configtestonly = 1; - ap_docrootcheck = 0; - break; - case 'h': - usage(ap_server_argv0); - case '?': - usage(ap_server_argv0); - } /* switch */ - } /* while */ - - /* ServerConfFile is found in this order: - * (1) -f or -n - * (2) [-d]/SERVER_CONFIG_FILE - * (3) ./SERVER_CONFIG_FILE - * (4) [Registry: HKLM\Software\[product]\ServerRoot]/SERVER_CONFIG_FILE - * (5) /HTTPD_ROOT/SERVER_CONFIG_FILE - */ - - if (!conf_specified) { - ap_cpystrn(ap_server_confname, SERVER_CONFIG_FILE, sizeof(ap_server_confname)); - if (access(ap_server_root_relative(pcommands, ap_server_confname), 0)) { - ap_registry_get_server_root(pconf, ap_server_root, sizeof(ap_server_root)); - if (!*ap_server_root) - ap_cpystrn(ap_server_root, HTTPD_ROOT, sizeof(ap_server_root)); - ap_cpystrn(ap_server_root, ap_os_canonical_filename(pcommands, ap_server_root), - sizeof(ap_server_root)); - } - } - - if (!ap_os_is_path_absolute(ap_server_confname)) { - char *full_conf_path; - - full_conf_path = ap_pstrcat(pcommands, ap_server_root, "/", ap_server_confname, NULL); - full_conf_path = ap_os_canonical_filename(pcommands, full_conf_path); - ap_cpystrn(ap_server_confname, full_conf_path, sizeof(ap_server_confname)); - } - ap_getparents(ap_server_confname); - ap_no2slash(ap_server_confname); - -#ifdef WIN32 - if (install) { - if (!service_name) - service_name = ap_pstrdup(pconf, DEFAULTSERVICENAME); - if (install > 0) - InstallService(service_name, ap_server_root_relative(pcommands, ap_server_confname)); - else - RemoveService(service_name); - clean_parent_exit(0); - } - - if (service_name && signal_to_send) { - send_signal_to_service(service_name, signal_to_send); - clean_parent_exit(0); - } - - if (service_name && !conf_specified) { - printf("Unknown service: %s\n", service_name); - clean_parent_exit(0); - } -#endif - server_conf = ap_read_config(pconf, ptrans, ap_server_confname); - - if (ap_configtestonly) { - fprintf(stderr, "%s: Syntax OK\n", ap_server_root_relative(pcommands, ap_server_confname)); - clean_parent_exit(0); - } - - if (ap_dump_settings) { - clean_parent_exit(0); - } - - /* Treat -k start confpath as just -f confpath */ - if (signal_to_send && strcasecmp(signal_to_send, "start")) { - send_signal(pconf, signal_to_send); - clean_parent_exit(0); - } - - if (!child && !ap_dump_settings) { - ap_log_pid(pconf, ap_pid_fname); - } - - post_parse_init(); - -#ifdef OS2 - printf("%s running...\n", ap_get_server_version()); -#endif -#ifdef WIN32 - if (!child) { - printf("%s running...\n", ap_get_server_version()); - } -#endif - if (one_process && !exit_event) - exit_event = create_event(0, 0, NULL); - if (one_process && !start_mutex) - start_mutex = ap_create_mutex(NULL); - /* - * In the future, the main will spawn off a couple - * of children and monitor them. As soon as a child - * exits, it spawns off a new one - */ - if (child || one_process) { - if (!exit_event || !start_mutex) - exit(-1); - worker_main(); - ap_destroy_mutex(start_mutex); - destroy_event(exit_event); - } - else - master_main(argc, argv); - - clean_parent_exit(0); - return 0; /* purely to avoid a warning */ -} - -#endif /* ndef MULTITHREAD */ - -#else /* ndef SHARED_CORE_TIESTATIC */ - -/* -** Standalone Tie Program for Shared Core support -** -** It's purpose is to tie the static libraries and -** the shared core library under link-time and -** passing execution control to the real main function -** in the shared core library under run-time. -*/ - -extern int ap_main(int argc, char *argv[]); - -int main(int argc, char *argv[]) -{ - return ap_main(argc, argv); -} - -#endif /* ndef SHARED_CORE_TIESTATIC */ -#else /* ndef SHARED_CORE_BOOTSTRAP */ - -#ifdef OS2 -/* Shared core loader for OS/2 */ - -int ap_main(int argc, char *argv[]); /* Load time linked from libhttpd.dll */ - -int main(int argc, char *argv[]) -{ - return ap_main(argc, argv); -} - -#else - -/* -** Standalone Bootstrap Program for Shared Core support -** -** It's purpose is to initialise the LD_LIBRARY_PATH -** environment variable therewith the Unix loader is able -** to start the Standalone Tie Program (see above) -** and then replacing itself with this program by -** immediately passing execution to it. -*/ - -#include -#include -#include - -#include "ap_config.h" -#include "httpd.h" - -#if defined(HPUX) || defined(HPUX10) || defined(HPUX11) -#define VARNAME "SHLIB_PATH" -#else -#define VARNAME "LD_LIBRARY_PATH" -#endif - -#ifndef SHARED_CORE_DIR -#define SHARED_CORE_DIR HTTPD_ROOT "/libexec" -#endif - -#ifndef SHARED_CORE_EXECUTABLE_PROGRAM -#define SHARED_CORE_EXECUTABLE_PROGRAM "lib" TARGET ".ep" -#endif - -extern char *optarg; -extern int optind; - -int main(int argc, char *argv[], char *envp[]) -{ - char prog[MAX_STRING_LEN]; - char llp_buf[MAX_STRING_LEN]; - char **llp_slot; - char *llp_existing; - char *llp_dir; - char **envpnew; - int c, i, l; - - /* - * parse argument line, - * but only handle the -L option - */ - llp_dir = SHARED_CORE_DIR; - while ((c = getopt(argc, argv, "D:C:c:Xd:f:vVlLR:SZ:tTh")) != -1) { - switch (c) { - case 'D': - case 'C': - case 'c': - case 'X': - case 'd': - case 'f': - case 'v': - case 'V': - case 'l': - case 'L': - case 'S': - case 'Z': - case 't': - case 'T': - case 'h': - case '?': - break; - case 'R': - llp_dir = strdup(optarg); - break; - } - } - - /* - * create path to SHARED_CORE_EXECUTABLE_PROGRAM - */ - ap_snprintf(prog, sizeof(prog), "%s/%s", llp_dir, SHARED_CORE_EXECUTABLE_PROGRAM); - - /* - * adjust process environment therewith the Unix loader - * is able to start the SHARED_CORE_EXECUTABLE_PROGRAM. - */ - llp_slot = NULL; - llp_existing = NULL; - l = strlen(VARNAME); - for (i = 0; envp[i] != NULL; i++) { - if (strncmp(envp[i], VARNAME "=", l+1) == 0) { - llp_slot = &envp[i]; - llp_existing = strchr(envp[i], '=') + 1; - } - } - if (llp_slot == NULL) { - envpnew = (char **)malloc(sizeof(char *)*(i + 2)); - if (envpnew == NULL) { - fprintf(stderr, "Ouch! Out of memory generating envpnew!\n"); - } - memcpy(envpnew, envp, sizeof(char *)*i); - envp = envpnew; - llp_slot = &envp[i++]; - envp[i] = NULL; - } - if (llp_existing != NULL) - ap_snprintf(llp_buf, sizeof(llp_buf), "%s=%s:%s", VARNAME, llp_dir, llp_existing); - else - ap_snprintf(llp_buf, sizeof(llp_buf), "%s=%s", VARNAME, llp_dir); - *llp_slot = strdup(llp_buf); - - /* - * finally replace our process with - * the SHARED_CORE_EXECUTABLE_PROGRAM - */ - if (execve(prog, argv, envp) == -1) { - fprintf(stderr, - "%s: Unable to exec Shared Core Executable Program `%s'\n", - argv[0], prog); - return 1; - } - else - return 0; -} - -#endif /* def OS2 */ -#endif /* ndef SHARED_CORE_BOOTSTRAP */ - -#ifndef SHARED_CORE_BOOTSTRAP -/* - * Force ap_validate_password() into the image so that modules like - * mod_auth can use it even if they're dynamically loaded. - */ -void suck_in_ap_validate_password(void); -void suck_in_ap_validate_password(void) -{ - ap_validate_password("a", "b"); -} -#endif - -/* force Expat to be linked into the server executable */ -#if defined(USE_EXPAT) && !defined(SHARED_CORE_BOOTSTRAP) -#include "xmlparse.h" -const XML_LChar *suck_in_expat(void); -const XML_LChar *suck_in_expat(void) -{ - return XML_ErrorString(XML_ERROR_NONE); -} -#endif /* USE_EXPAT */ - diff --git a/server/mpm/.cvsignore b/server/mpm/.cvsignore deleted file mode 100644 index f3c7a7c5da68804a1bdf391127ba34aed33c3cca..0000000000000000000000000000000000000000 --- a/server/mpm/.cvsignore +++ /dev/null @@ -1 +0,0 @@ -Makefile diff --git a/server/mpm/MPM.NAMING b/server/mpm/MPM.NAMING deleted file mode 100644 index 3ce40f02e6a6578a5f60d9a6407e5d9eb91c04ac..0000000000000000000000000000000000000000 --- a/server/mpm/MPM.NAMING +++ /dev/null @@ -1,22 +0,0 @@ -For right now, the naming of the MPM methods follows -the following example for the 'prefork' method. - - 1. The directory name under modules/mpm is the actual - name. - - eg: modules/mpm/prefork - - 2. The internal module name must be that name, prepended with - mpm_ and suffixed with _module - - eg: mpm_prefork_module - - 3. The Makefile.tmpl must create lib.a - - eg: libprefork.a - -Numbers 1 and 3 follow the normal rules (for example, modules/standard -creates libstandard.a, etc...). - -The MPM_METHOD Rule will use the actual name (eg: prefork) to -pick the correct method module to build. diff --git a/server/mpm/Makefile.in b/server/mpm/Makefile.in deleted file mode 100644 index 7f678e86bfd25f75e54c2e676b9d8ad5d6932195..0000000000000000000000000000000000000000 --- a/server/mpm/Makefile.in +++ /dev/null @@ -1,9 +0,0 @@ - -DEPTH = ../.. -topsrcdir = @topsrcdir@ -srcdir = @srcdir@ -VPATH = @srcdir@ - -SUBDIRS = $(MPM_NAME) - -include $(topsrcdir)/build/rules.mk diff --git a/server/mpm/beos/.cvsignore b/server/mpm/beos/.cvsignore deleted file mode 100644 index 84df2572148ad85b6c1c286350aa7c0b6a931e7a..0000000000000000000000000000000000000000 --- a/server/mpm/beos/.cvsignore +++ /dev/null @@ -1,5 +0,0 @@ -.deps -.libs -*.lo -*.la -Makefile diff --git a/server/mpm/beos/Makefile.in b/server/mpm/beos/Makefile.in deleted file mode 100644 index ba75075533ede5e6fc57a4019931fd5ee47b02b1..0000000000000000000000000000000000000000 --- a/server/mpm/beos/Makefile.in +++ /dev/null @@ -1,5 +0,0 @@ - -LTLIBRARY_NAME = libbeos.la -LTLIBRARY_SOURCES = beos.c scoreboard.c - -include $(top_srcdir)/build/ltlib.mk diff --git a/server/mpm/beos/beos.c b/server/mpm/beos/beos.c deleted file mode 100644 index b70576bb16cc3844f40e06c8c2ad547a34bff8ab..0000000000000000000000000000000000000000 --- a/server/mpm/beos/beos.c +++ /dev/null @@ -1,1134 +0,0 @@ -/* ==================================================================== - * The Apache Software License, Version 1.1 - * - * Copyright (c) 2000 The Apache Software Foundation. All rights - * reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in - * the documentation and/or other materials provided with the - * distribution. - * - * 3. The end-user documentation included with the redistribution, - * if any, must include the following acknowledgment: - * "This product includes software developed by the - * Apache Software Foundation (http://www.apache.org/)." - * Alternately, this acknowledgment may appear in the software itself, - * if and wherever such third-party acknowledgments normally appear. - * - * 4. The names "Apache" and "Apache Software Foundation" must - * not be used to endorse or promote products derived from this - * software without prior written permission. For written - * permission, please contact apache@apache.org. - * - * 5. Products derived from this software may not be called "Apache", - * nor may "Apache" appear in their name, without prior written - * permission of the Apache Software Foundation. - * - * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED - * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES - * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR - * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF - * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND - * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, - * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT - * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * ==================================================================== - * - * This software consists of voluntary contributions made by many - * individuals on behalf of the Apache Software Foundation. For more - * information on the Apache Software Foundation, please see - * . - * - * Portions of this software are based upon public domain software - * originally written at the National Center for Supercomputing Applications, - * University of Illinois, Urbana-Champaign. - */ - -/* The new BeOS MPM! - * - * This one basically is a single process multi threaded model, but - * I couldn't be bothered adding the spmt_ to the front of the name! - * Anyway, this is still under development so it isn't yet the default - * choice. - */ - -#define CORE_PRIVATE - -#include "apr_portable.h" -#include "httpd.h" -#include "http_main.h" -#include "http_log.h" -#include "http_config.h" /* for read_config */ -#include "http_core.h" /* for get_remote_host */ -#include "http_connection.h" -#include "ap_mpm.h" -#include "beosd.h" -#include "iol_socket.h" -#include "ap_listen.h" -#include "scoreboard.h" -//#include "poll.h" -#include "mpm_common.h" -#include "mpm.h" -#include -#include - -/* - * Actual definitions of config globals - */ - -int ap_threads_per_child=0; /* Worker threads per child */ -int ap_max_requests_per_child=0; -static char *ap_pid_fname=NULL; -static char *ap_scoreboard_fname=NULL; -static int ap_threads_to_start=0; -static int min_spare_threads=0; -static int max_spare_threads=0; -static int ap_thread_limit=0; -static time_t ap_restart_time=0; -API_VAR_EXPORT int ap_extended_status = 0; -static int num_listening_sockets = 0; /* set by open_listeners in ap_mpm_run */ -static ap_socket_t ** listening_sockets; -ap_lock_t *accept_mutex = NULL; - -static ap_pool_t *pconf; /* Pool for config stuff */ -static ap_pool_t *pchild; /* Pool for httpd child stuff */ - -static int server_pid; - -/* Keep track of the number of worker threads currently active */ -static int worker_thread_count; -ap_lock_t *worker_thread_count_mutex; - -/* The structure used to pass unique initialization info to each thread */ -typedef struct { - int slot; - ap_pool_t *tpool; -} proc_info; - -struct ap_ctable ap_child_table[HARD_SERVER_LIMIT]; - -/* - * The max child slot ever assigned, preserved across restarts. Necessary - * to deal with MaxClients changes across SIGWINCH restarts. We use this - * value to optimize routines that have to scan the entire scoreboard. - */ -int ap_max_child_assigned = -1; -int ap_max_threads_limit = -1; -static char ap_coredump_dir[MAX_STRING_LEN]; - -/* shared http_main globals... */ - -server_rec *ap_server_conf; - -/* one_process */ -/* TODO - get this working again... */ -static int one_process = 0; - -#ifdef DEBUG_SIGSTOP -int raise_sigstop_flags; -#endif - -API_EXPORT(const server_rec *) ap_get_server_conf(void) -{ - return (ap_server_conf); -} - -API_EXPORT(int) ap_get_max_daemons(void) -{ - return ap_max_child_assigned; -} - -/* a clean exit from a child with proper cleanup - static void clean_child_exit(int code) __attribute__ ((noreturn)); */ -void clean_child_exit(int code) -{ - if (pchild) - ap_destroy_pool(pchild); - exit(code); -} - -/* handle all varieties of core dumping signals */ -static void sig_coredump(int sig) -{ - chdir(ap_coredump_dir); - signal(sig, SIG_DFL); - kill(server_pid, sig); - /* At this point we've got sig blocked, because we're still inside - * the signal handler. When we leave the signal handler it will - * be unblocked, and we'll take the signal... and coredump or whatever - * is appropriate for this particular Unix. In addition the parent - * will see the real signal we received -- whereas if we called - * abort() here, the parent would only see SIGABRT. - */ -} - -/***************************************************************** - * Connection structures and accounting... - */ - -/* volatile just in case */ -static int volatile shutdown_pending; -static int volatile restart_pending; -static int volatile is_graceful; - -/* - * ap_start_shutdown() and ap_start_restart(), below, are a first stab at - * functions to initiate shutdown or restart without relying on signals. - * Previously this was initiated in sig_term() and restart() signal handlers, - * but we want to be able to start a shutdown/restart from other sources -- - * e.g. on Win32, from the service manager. Now the service manager can - * call ap_start_shutdown() or ap_start_restart() as appropiate. Note that - * these functions can also be called by the child processes, since global - * variables are no longer used to pass on the required action to the parent. - * - * These should only be called from the parent process itself, since the - * parent process will use the shutdown_pending and restart_pending variables - * to determine whether to shutdown or restart. The child process should - * call signal_parent() directly to tell the parent to die -- this will - * cause neither of those variable to be set, which the parent will - * assume means something serious is wrong (which it will be, for the - * child to force an exit) and so do an exit anyway. - */ - -void ap_start_shutdown(void) -{ - if (shutdown_pending == 1) { - /* Um, is this _probably_ not an error, if the user has - * tried to do a shutdown twice quickly, so we won't - * worry about reporting it. - */ - return; - } - shutdown_pending = 1; -} - -/* do a graceful restart if graceful == 1 */ -void ap_start_restart(int graceful) -{ - - if (restart_pending == 1) { - /* Probably not an error - don't bother reporting it */ - return; - } - restart_pending = 1; - is_graceful = graceful; -} - -static void sig_term(int sig) -{ - ap_start_shutdown(); -} - -static void restart(int sig) -{ - ap_start_restart(sig == SIGWINCH); -} - -static void tell_workers_to_exit() -{ - int i, code = 99; - - for (i=0;i= NumSIG) ? "" : - SYS_SIGLIST[WTERMSIG(status)], WTERMSIG(status), - ap_coredump_dir); - } - else { -#endif - ap_log_error(APLOG_MARK, APLOG_NOERRNO|APLOG_NOTICE, - errno, ap_server_conf, - "child pid %d exit signal %s (%d)", pid, - SYS_SIGLIST[WTERMSIG(status)], WTERMSIG(status)); -#ifdef WCOREDUMP - } -#endif -#else - ap_log_error(APLOG_MARK, APLOG_NOERRNO|APLOG_NOTICE, - errno, ap_server_conf, - "child pid %d exit signal %d", - pid, WTERMSIG(status)); -#endif - } - } -} - -static int setup_listeners(server_rec *s) -{ - ap_listen_rec *lr; - int num_listeners = 0; - if (ap_listen_open(s->process, s->port)) { - return 0; - } - for (lr = ap_listeners; lr; lr = lr->next) { - num_listeners++; - } - return num_listeners; -} - -/***************************************************************** - * Here follows a long bunch of generic server bookkeeping stuff... - */ - -//#define sock_disable_nagle(s) /* NOOP */ - -int ap_graceful_stop_signalled(void) -{ - /* XXX - Does this really work? - Manoj */ - return is_graceful; -} - -/***************************************************************** - * Child process main loop. - */ - -static void process_socket(ap_pool_t *p, ap_socket_t *sock, int my_child_num) -{ - BUFF *conn_io; - conn_rec *current_conn; - ap_iol *iol; - long conn_id = my_child_num; - int csd; - - iol = beos_attach_socket(sock); - if (iol == NULL) { - if (errno == EBADF) { - ap_log_error(APLOG_MARK, APLOG_NOERRNO|APLOG_WARNING, errno, NULL, - "filedescriptor (%u) larger than FD_SETSIZE (%u) " - "found, you probably need to rebuild Apache with a " - "larger FD_SETSIZE", csd, FD_SETSIZE); - } - else { - ap_log_error(APLOG_MARK, APLOG_WARNING, errno, NULL, - "error attaching to socket"); - } - ap_close_socket(sock); - return; - } - - conn_io = ap_bcreate(p, B_RDWR); - ap_bpush_iol(conn_io, iol); - - current_conn = ap_new_apr_connection(p, ap_server_conf, conn_io, sock, - conn_id); - - ap_process_connection(current_conn); - ap_lingering_close(current_conn); -} - -static int32 worker_thread(void * dummy) -{ - proc_info * ti = dummy; - int child_slot = ti->slot; - ap_pool_t *tpool = ti->tpool; - ap_socket_t *csd = NULL; - ap_pool_t *ptrans; /* Pool for per-transaction stuff */ - ap_socket_t *sd = NULL; - int srv , n; - int curr_pollfd, last_pollfd = 0; - sigset_t sig_mask; - int requests_this_child = ap_max_requests_per_child; - ap_pollfd_t *pollset; - /* each worker thread is in control of it's own destiny...*/ - int this_worker_should_exit = 0; - thread_id me = find_thread(NULL); - - free(ti); - - /* block the signals for this thread */ - sigfillset(&sig_mask); - sigprocmask(SIG_BLOCK, &sig_mask, NULL); - - ap_create_pool(&ptrans, tpool); - - ap_lock(worker_thread_count_mutex); - worker_thread_count++; - ap_unlock(worker_thread_count_mutex); - - /* now setup our own pollset...this will use APR woohoo! */ - ap_setup_poll(&pollset, num_listening_sockets, tpool); - for(n=0 ; n < num_listening_sockets ; ++n) - ap_add_poll_socket(pollset, listening_sockets[n], APR_POLLIN); - - while (!this_worker_should_exit) { - this_worker_should_exit |= (ap_max_requests_per_child != 0) && (requests_this_child <= 0); - - if (this_worker_should_exit) break; - - ap_lock(accept_mutex); - while (!this_worker_should_exit) { - ap_int16_t event; - ap_status_t ret = ap_poll(pollset, &srv, -1); - - if (has_data(me)) { - thread_id sender; - receive_data(&sender, NULL, 0); - this_worker_should_exit = 1; - } - if (ret != APR_SUCCESS) { - if (errno == EINTR) { - continue; - } - - /* poll() will only return errors in catastrophic - * circumstances. Let's try exiting gracefully, for now. */ - ap_log_error(APLOG_MARK, APLOG_ERR,errno, (const server_rec *) - ap_get_server_conf(), "poll: (listen)"); - this_worker_should_exit = 1; - } - - if (this_worker_should_exit) break; - - if (num_listening_sockets == 1) { - sd = ap_listeners->sd; - goto got_fd; - } - else { - /* find a listener */ - curr_pollfd = last_pollfd; - do { - curr_pollfd++; - if (curr_pollfd > num_listening_sockets) { - curr_pollfd = 1; - } - /* Get the revent... */ - ap_get_revents(&event, listening_sockets[curr_pollfd], pollset); - - /* XXX: Should we check for POLLERR? */ - if (event & APR_POLLIN) { - last_pollfd = curr_pollfd; - sd = listening_sockets[curr_pollfd]; - goto got_fd; - } - } while (curr_pollfd != last_pollfd); - } - } - got_fd: - if (!this_worker_should_exit) { - ap_accept(&csd, sd, ptrans); - ap_unlock(accept_mutex); - process_socket(ptrans, csd, child_slot); - requests_this_child--; - } - else { - ap_unlock(accept_mutex); - break; - } - ap_clear_pool(ptrans); - } - - ap_destroy_pool(tpool); - ap_lock(worker_thread_count_mutex); - worker_thread_count--; - if (worker_thread_count == 0) { - /* All the threads have exited, now finish the shutdown process - * by signalling the sigwait thread */ - kill(server_pid, SIGTERM); - } - ap_unlock(worker_thread_count_mutex); - - return (0); -} - -static int make_worker(server_rec *s, int slot, time_t now) -{ - thread_id tid; - proc_info *my_info = (proc_info *)malloc(sizeof(proc_info)); - - if (my_info == NULL) { - ap_log_error(APLOG_MARK, APLOG_ALERT, errno, ap_server_conf, - "malloc: out of memory"); - clean_child_exit(APEXIT_CHILDFATAL); - } - - my_info->slot = slot; - ap_create_pool(&my_info->tpool, pchild); - - if (slot + 1 > ap_max_child_assigned) - ap_max_child_assigned = slot + 1; - - /* TODO: figure out the one_process stuff... */ -/* - if (one_process) { - set_signals(); - ap_child_table[slot].pid = getpid(); - ap_child_table[slot].status = SERVER_ALIVE; - } -This is deliberate to remind me to do something about it! -*/ - - tid = spawn_thread(worker_thread, "apache_worker", B_NORMAL_PRIORITY, - my_info); - if (tid < B_NO_ERROR) { - ap_log_error(APLOG_MARK, APLOG_ERR, errno, s, - "spawn_thread: Unable to start a new thread"); - /* In case system resources are maxxed out, we don't want - * Apache running away with the CPU trying to fork over and - * over and over again. */ - sleep(10); - - return -1; - } - resume_thread(tid); - - ap_child_table[slot].pid = getpid(); - ap_child_table[slot].status = SERVER_ALIVE; - return 0; -} - -/* start up a bunch of children */ -static void startup_threads(int number_to_start) -{ - int i; - - for (i = 0; number_to_start && i < ap_thread_limit; ++i) { - if (ap_child_table[i].status != SERVER_DEAD) { - continue; - } - if (make_worker(ap_server_conf, i, 0) < 0) { - break; - } - --number_to_start; - } -} - - -/* - * spawn_rate is the number of children that will be spawned on the - * next maintenance cycle if there aren't enough idle servers. It is - * doubled up to MAX_SPAWN_RATE, and reset only when a cycle goes by - * without the need to spawn. - */ -static int spawn_rate = 1; -#ifndef MAX_SPAWN_RATE -#define MAX_SPAWN_RATE (32) -#endif -static int hold_off_on_exponential_spawning; - -static void perform_idle_server_maintenance(void) -{ - int i; - time_t now = 0; - int free_length; - int free_slots[MAX_SPAWN_RATE]; - int last_non_dead; - - /* initialize the free_list */ - free_length = 0; - - for (i = 0; i < ap_thread_limit; ++i) { - if (ap_child_table[i].status == SERVER_DEAD) { - if (free_length < spawn_rate) { - free_slots[free_length] = i; - ++free_length; - } - } - else { - last_non_dead = i; - } - - if (i >= ap_max_child_assigned && free_length >= spawn_rate) { - break; - } - } - ap_max_child_assigned = last_non_dead + 1; - - if (free_length > 0) { - for (i = 0; i < free_length; ++i) { - make_worker(ap_server_conf, free_slots[i], now); - } - /* the next time around we want to spawn twice as many if this - * wasn't good enough, but not if we've just done a graceful - */ - if (hold_off_on_exponential_spawning) { - --hold_off_on_exponential_spawning; - } else if (spawn_rate < MAX_SPAWN_RATE) { - spawn_rate *= 2; - } - } else { - spawn_rate = 1; - } -} - -static void server_main_loop(int remaining_threads_to_start) -{ - int child_slot; - ap_wait_t status; - ap_proc_t pid; - int i; - - while (!restart_pending && !shutdown_pending) { - ap_wait_or_timeout(&status, &pid, pconf); - - if (pid.pid >= 0) { - process_child_status(pid.pid, status); - /* non-fatal death... note that it's gone in the scoreboard. */ - child_slot = -1; - for (i = 0; i < ap_max_child_assigned; ++i) { - if (ap_child_table[i].pid == pid.pid) { - int j; - - child_slot = i; - for (j = 0; j < HARD_THREAD_LIMIT; j++) { - ap_beos_force_reset_connection_status(i * HARD_THREAD_LIMIT + j); - } - break; - } - } - if (child_slot >= 0) { - ap_child_table[child_slot].status = SERVER_DEAD; - - if (remaining_threads_to_start - && child_slot < ap_thread_limit) { - /* we're still doing a 1-for-1 replacement of dead - * children with new children - */ - make_worker(ap_server_conf, child_slot, time(NULL)); - --remaining_threads_to_start; - } -#ifdef APR_HAS_OTHER_CHILD - } - else if (ap_reap_other_child(&pid, status) == 0) { - /* handled */ -#endif - } - else if (is_graceful) { - /* Great, we've probably just lost a slot in the - * scoreboard. Somehow we don't know about this - * child. - */ - ap_log_error(APLOG_MARK, APLOG_NOERRNO|APLOG_WARNING, errno, ap_server_conf, - "long lost child came home! (pid %ld)", pid.pid); - } - - /* Don't perform idle maintenance when a child dies, - * only do it when there's a timeout. Remember only a - * finite number of children can die, and it's pretty - * pathological for a lot to die suddenly. - */ - continue; - } - else if (remaining_threads_to_start) { - /* we hit a 1 second timeout in which none of the previous - * generation of children needed to be reaped... so assume - * they're all done, and pick up the slack if any is left. - */ - startup_threads(remaining_threads_to_start); - remaining_threads_to_start = 0; - /* In any event we really shouldn't do the code below because - * few of the servers we just started are in the IDLE state - * yet, so we'd mistakenly create an extra server. - */ - continue; - } - - perform_idle_server_maintenance(); - } -} - -int ap_mpm_run(ap_pool_t *_pconf, ap_pool_t *plog, server_rec *s) -{ - int remaining_threads_to_start, i; - ap_status_t rv; - ap_listen_rec *lr; - pconf = _pconf; - ap_server_conf = s; - - if ((num_listening_sockets = setup_listeners(ap_server_conf)) < 1) { - /* XXX: hey, what's the right way for the mpm to indicate a fatal error? */ - ap_log_error(APLOG_MARK, APLOG_NOERRNO|APLOG_ALERT, errno, s, - "no listening sockets available, shutting down"); - return 1; - } - - ap_log_pid(pconf, ap_pid_fname); - - /* - * Create our locks... - */ - - /* accept_mutex - * used to lock around select so we only have one thread - * in select at a time - */ - if ((rv = ap_create_lock(&accept_mutex, APR_MUTEX, APR_CROSS_PROCESS, - NULL, pconf)) != APR_SUCCESS) { - /* tsch tsch, can't have more than one thread in the accept loop - at a time so we need to fall on our sword... */ - ap_log_error(APLOG_MARK, APLOG_EMERG, rv, s, - "Couldn't create accept lock"); - return 1; - } - /* worker_thread_count_mutex - * locks the worker_thread_count so we have ana ccurate count... - */ - if ((rv = ap_create_lock(&worker_thread_count_mutex, APR_MUTEX, APR_CROSS_PROCESS, - NULL, pconf)) != APR_SUCCESS) { - ap_log_error(APLOG_MARK, APLOG_EMERG, rv, s, - "Couldn't create worker thread count lock"); - return 1; - } - - /* - * Startup/shutdown... - */ - - if (!is_graceful) - reinit_scoreboard(pconf); - - set_signals(); - /* Sanity cehcks to avoid thrashing... */ - if (max_spare_threads < min_spare_threads ) - max_spare_threads = min_spare_threads; - - /* If we're doing a graceful_restart then we're going to see a lot - * of threads exiting immediately when we get into the main loop - * below (because we just sent them SIGWINCH). This happens pretty - * rapidly... and for each one that exits we'll start a new one until - * we reach at least threads_min_free. But we may be permitted to - * start more than that, so we'll just keep track of how many we're - * supposed to start up without the 1 second penalty between each fork. - */ - remaining_threads_to_start = ap_threads_to_start; - /* sanity check on the number to start... */ - if (remaining_threads_to_start > ap_thread_limit) { - remaining_threads_to_start = ap_thread_limit; - } - - /* setup the child pool to use for the workers. Each worker creates - * a seperate pool of it's own to use. - */ - ap_create_pool(&pchild, pconf); - ap_child_init_hook(pchild, ap_server_conf); - - /* Now that we have the child pool (pchild) we can allocate - * the listenfds and creat the pollset... - */ - listening_sockets = ap_palloc(pchild, - sizeof(*listening_sockets) * (num_listening_sockets)); - for (lr = ap_listeners, i = 0; i < num_listening_sockets; lr = lr->next, ++i) - listening_sockets[i]=lr->sd; - - /* we assume all goes OK...hmm might want to check that! */ - if (!is_graceful) { - startup_threads(remaining_threads_to_start); - remaining_threads_to_start = 0; - } - else { - /* give the system some time to recover before kicking into - * exponential mode */ - hold_off_on_exponential_spawning = 10; - } - - /* - * record that we've entered the world ! - */ - ap_log_error(APLOG_MARK, APLOG_NOERRNO|APLOG_NOTICE, errno, ap_server_conf, - "%s configured -- resuming normal operations", - ap_get_server_version()); - ap_log_error(APLOG_MARK, APLOG_NOERRNO|APLOG_INFO, errno, ap_server_conf, - "Server built: %s", ap_get_server_built()); - restart_pending = shutdown_pending = 0; - - /* - * main_loop until it's all over - */ - server_main_loop(remaining_threads_to_start); - - /* - * If we get here we're shutting down... - */ - if (shutdown_pending) { - /* Time to gracefully shut down: - * Kill child processes, tell them to call child_exit, etc... - */ - if (beosd_killpg(getpgrp(), SIGTERM) < 0) - ap_log_error(APLOG_MARK, APLOG_WARNING, errno, ap_server_conf, - "killpg SIGTERM"); - - /* cleanup pid file on normal shutdown */ - { - const char *pidfile = NULL; - pidfile = ap_server_root_relative (pconf, ap_pid_fname); - if ( pidfile != NULL && unlink(pidfile) == 0) - ap_log_error(APLOG_MARK, APLOG_NOERRNO|APLOG_INFO, - errno, ap_server_conf, - "removed PID file %s (pid=%ld)", - pidfile, (long)getpid()); - } - - /* use ap_reclaim_child_processes starting with SIGTERM */ - ap_reclaim_child_processes(1); - - /* record the shutdown in the log */ - ap_log_error(APLOG_MARK, APLOG_NOERRNO|APLOG_NOTICE, errno, ap_server_conf, - "caught SIGTERM, shutting down"); - - return 1; - } - - /* we've been told to restart */ - signal(SIGHUP, SIG_IGN); - - if (one_process) { - return 1; - } - - if (is_graceful) { - ap_log_error(APLOG_MARK, APLOG_NOERRNO|APLOG_NOTICE, errno, ap_server_conf, - "SIGWINCH received. Doing graceful restart"); - tell_workers_to_exit(); - /* TODO - need to test some ideas here... */ - } - else { - /* Kill 'em all. Since the child acts the same on the parents SIGTERM - * and a SIGHUP, we may as well use the same signal, because some user - * pthreads are stealing signals from us left and right. - */ - push_workers_off_cliff(SIGTERM); - - ap_reclaim_child_processes(1); /* Start with SIGTERM */ - ap_log_error(APLOG_MARK, APLOG_NOERRNO|APLOG_NOTICE, errno, ap_server_conf, - "SIGHUP received. Attempting to restart"); - } - - if (!is_graceful) { - ap_restart_time = time(NULL); - } - - return 0; -} - -static void beos_pre_config(ap_pool_t *pconf, ap_pool_t *plog, ap_pool_t *ptemp) -{ - static int restart_num = 0; - - one_process = !!getenv("ONE_PROCESS"); - - /* sigh, want this only the second time around */ - if (restart_num++ == 1) { - is_graceful = 0; - if (!one_process) - beosd_detach(); - server_pid = getpid(); - } - - beosd_pre_config(); - ap_listen_pre_config(); - ap_threads_to_start = DEFAULT_START_THREADS; - min_spare_threads = DEFAULT_MIN_FREE_DAEMON * DEFAULT_THREADS_PER_CHILD; - max_spare_threads = DEFAULT_MAX_FREE_DAEMON * DEFAULT_THREADS_PER_CHILD; - ap_thread_limit = HARD_SERVER_LIMIT; - ap_threads_per_child = DEFAULT_THREADS_PER_CHILD; - ap_pid_fname = DEFAULT_PIDLOG; - ap_max_requests_per_child = DEFAULT_MAX_REQUESTS_PER_CHILD; - ap_beos_set_maintain_connection_status(1); - - ap_cpystrn(ap_coredump_dir, ap_server_root, sizeof(ap_coredump_dir)); -} - -static void beos_hooks(void) -{ - INIT_SIGLIST() - one_process = 0; - - ap_hook_pre_config(beos_pre_config, NULL, NULL, AP_HOOK_MIDDLE); -} - - -static const char *set_pidfile(cmd_parms *cmd, void *dummy, char *arg) -{ - const char *err = ap_check_cmd_context(cmd, GLOBAL_ONLY); - if (err != NULL) { - return err; - } - - if (cmd->server->is_virtual) { - return "PidFile directive not allowed in "; - } - ap_pid_fname = arg; - return NULL; -} - -static const char *set_scoreboard(cmd_parms *cmd, void *dummy, char *arg) -{ - const char *err = ap_check_cmd_context(cmd, GLOBAL_ONLY); - if (err != NULL) { - return err; - } - - ap_scoreboard_fname = arg; - return NULL; -} - -static const char *set_daemons_to_start(cmd_parms *cmd, void *dummy, char *arg) -{ - const char *err = ap_check_cmd_context(cmd, GLOBAL_ONLY); - if (err != NULL) { - return err; - } - - ap_threads_to_start = atoi(arg); - return NULL; -} - -static const char *set_min_spare_threads(cmd_parms *cmd, void *dummy, char *arg) -{ - const char *err = ap_check_cmd_context(cmd, GLOBAL_ONLY); - if (err != NULL) { - return err; - } - - min_spare_threads = atoi(arg); - if (min_spare_threads <= 0) { - ap_log_error(APLOG_MARK, APLOG_STARTUP | APLOG_NOERRNO, 0, NULL, - "WARNING: detected MinSpareThreads set to non-positive."); - ap_log_error(APLOG_MARK, APLOG_STARTUP | APLOG_NOERRNO, 0, NULL, - "Resetting to 1 to avoid almost certain Apache failure."); - ap_log_error(APLOG_MARK, APLOG_STARTUP | APLOG_NOERRNO, 0, NULL, - "Please read the documentation."); - min_spare_threads = 1; - } - - return NULL; -} - -static const char *set_max_spare_threads(cmd_parms *cmd, void *dummy, char *arg) -{ - const char *err = ap_check_cmd_context(cmd, GLOBAL_ONLY); - if (err != NULL) { - return err; - } - - max_spare_threads = atoi(arg); - return NULL; -} - -static const char *set_server_limit (cmd_parms *cmd, void *dummy, char *arg) -{ - const char *err = ap_check_cmd_context(cmd, GLOBAL_ONLY); - if (err != NULL) { - return err; - } - - ap_thread_limit = atoi(arg); - if (ap_thread_limit > HARD_SERVER_LIMIT) { - ap_log_error(APLOG_MARK, APLOG_STARTUP | APLOG_NOERRNO, 0, NULL, - "WARNING: MaxClients of %d exceeds compile time limit " - "of %d servers,", ap_thread_limit, HARD_SERVER_LIMIT); - ap_log_error(APLOG_MARK, APLOG_STARTUP | APLOG_NOERRNO, 0, NULL, - " lowering MaxClients to %d. To increase, please " - "see the", HARD_SERVER_LIMIT); - ap_log_error(APLOG_MARK, APLOG_STARTUP | APLOG_NOERRNO, 0, NULL, - " HARD_SERVER_LIMIT define in src/include/httpd.h."); - ap_thread_limit = HARD_SERVER_LIMIT; - } - else if (ap_thread_limit < 1) { - ap_log_error(APLOG_MARK, APLOG_STARTUP | APLOG_NOERRNO, 0, NULL, - "WARNING: Require MaxClients > 0, setting to 1"); - ap_thread_limit = 1; - } - return NULL; -} - -static const char *set_threads_per_child (cmd_parms *cmd, void *dummy, char *arg) -{ - const char *err = ap_check_cmd_context(cmd, GLOBAL_ONLY); - if (err != NULL) { - return err; - } - - ap_threads_per_child = atoi(arg); - if (ap_threads_per_child > HARD_THREAD_LIMIT) { - ap_log_error(APLOG_MARK, APLOG_STARTUP | APLOG_NOERRNO, 0, NULL, - "WARNING: ThreadsPerChild of %d exceeds compile time" - "limit of %d threads,\n", ap_threads_per_child, - HARD_THREAD_LIMIT); - ap_log_error(APLOG_MARK, APLOG_STARTUP | APLOG_NOERRNO, 0, NULL, - " lowering ThreadsPerChild to %d. To increase, please" - "see the", HARD_THREAD_LIMIT); - ap_log_error(APLOG_MARK, APLOG_STARTUP | APLOG_NOERRNO, 0, NULL, - " HARD_THREAD_LIMIT define in src/include/httpd.h."); - } - else if (ap_threads_per_child < 1) { - ap_log_error(APLOG_MARK, APLOG_STARTUP | APLOG_NOERRNO, 0, NULL, - "WARNING: Require ThreadsPerChild > 0, setting to 1"); - ap_threads_per_child = 1; - } - return NULL; -} - -static const char *set_max_requests(cmd_parms *cmd, void *dummy, char *arg) -{ - const char *err = ap_check_cmd_context(cmd, GLOBAL_ONLY); - if (err != NULL) { - return err; - } - - ap_max_requests_per_child = atoi(arg); - - return NULL; -} - -static const char *set_maintain_connection_status(cmd_parms *cmd, - core_dir_config *d, int arg) -{ - const char *err = ap_check_cmd_context(cmd, GLOBAL_ONLY); - if (err != NULL) { - return err; - } - - ap_beos_set_maintain_connection_status(arg != 0); - return NULL; -} - -static const char *set_coredumpdir (cmd_parms *cmd, void *dummy, char *arg) -{ - ap_finfo_t finfo; - const char *fname; - const char *err = ap_check_cmd_context(cmd, GLOBAL_ONLY); - if (err != NULL) { - return err; - } - - fname = ap_server_root_relative(cmd->pool, arg); - if ((ap_stat(&finfo, fname, cmd->pool) != APR_SUCCESS) || - (finfo.filetype != APR_DIR)) { - return ap_pstrcat(cmd->pool, "CoreDumpDirectory ", fname, - " does not exist or is not a directory", NULL); - } - ap_cpystrn(ap_coredump_dir, fname, sizeof(ap_coredump_dir)); - return NULL; -} - -static const command_rec beos_cmds[] = { -UNIX_DAEMON_COMMANDS -LISTEN_COMMANDS -{ "PidFile", set_pidfile, NULL, RSRC_CONF, TAKE1, - "A file for logging the server process ID"}, -{ "ScoreBoardFile", set_scoreboard, NULL, RSRC_CONF, TAKE1, - "A file for Apache to maintain runtime process management information"}, -{ "StartServers", set_daemons_to_start, NULL, RSRC_CONF, TAKE1, - "Number of child processes launched at server startup" }, -{ "MinSpareThreads", set_min_spare_threads, NULL, RSRC_CONF, TAKE1, - "Minimum number of idle children, to handle request spikes" }, -{ "MaxSpareThreads", set_max_spare_threads, NULL, RSRC_CONF, TAKE1, - "Maximum number of idle children" }, -{ "MaxClients", set_server_limit, NULL, RSRC_CONF, TAKE1, - "Maximum number of children alive at the same time" }, -{ "ThreadsPerChild", set_threads_per_child, NULL, RSRC_CONF, TAKE1, - "Number of threads each child creates" }, -{ "MaxRequestsPerChild", set_max_requests, NULL, RSRC_CONF, TAKE1, - "Maximum number of requests a particular child serves before dying." }, -{ "ConnectionStatus", set_maintain_connection_status, NULL, RSRC_CONF, FLAG, - "Whether or not to maintain status information on current connections"}, -{ "CoreDumpDirectory", set_coredumpdir, NULL, RSRC_CONF, TAKE1, - "The location of the directory Apache changes to before dumping core" }, -{ NULL } -}; - -module MODULE_VAR_EXPORT mpm_beos_module = { - MPM20_MODULE_STUFF, - NULL, /* hook to run before apache parses args */ - NULL, /* create per-directory config structure */ - NULL, /* merge per-directory config structures */ - NULL, /* create per-server config structure */ - NULL, /* merge per-server config structures */ - beos_cmds, /* command ap_table_t */ - NULL, /* handlers */ - beos_hooks /* register_hooks */ -}; - diff --git a/server/mpm/beos/beos.h b/server/mpm/beos/beos.h deleted file mode 100644 index c7cffdef24a7cb4a60978af4d657f46c900b1dd8..0000000000000000000000000000000000000000 --- a/server/mpm/beos/beos.h +++ /dev/null @@ -1,69 +0,0 @@ -/* ==================================================================== - * The Apache Software License, Version 1.1 - * - * Copyright (c) 2000 The Apache Software Foundation. All rights - * reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in - * the documentation and/or other materials provided with the - * distribution. - * - * 3. The end-user documentation included with the redistribution, - * if any, must include the following acknowledgment: - * "This product includes software developed by the - * Apache Software Foundation (http://www.apache.org/)." - * Alternately, this acknowledgment may appear in the software itself, - * if and wherever such third-party acknowledgments normally appear. - * - * 4. The names "Apache" and "Apache Software Foundation" must - * not be used to endorse or promote products derived from this - * software without prior written permission. For written - * permission, please contact apache@apache.org. - * - * 5. Products derived from this software may not be called "Apache", - * nor may "Apache" appear in their name, without prior written - * permission of the Apache Software Foundation. - * - * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED - * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES - * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR - * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF - * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND - * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, - * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT - * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * ==================================================================== - * - * This software consists of voluntary contributions made by many - * individuals on behalf of the Apache Software Foundation. For more - * information on the Apache Software Foundation, please see - * . - * - * Portions of this software are based upon public domain software - * originally written at the National Center for Supercomputing Applications, - * University of Illinois, Urbana-Champaign. - */ - -#ifndef APACHE_MPM_BEOS_H -#define APACHE_MPM_BEOS_H - -extern int ap_threads_per_child; -extern int ap_max_requests_per_child; -extern int ap_pipe_of_death[2]; -extern int ap_extended_status; -extern void clean_child_exit(int); -extern int max_daemons_limit; - -#endif /* APACHE_MPM_BEOS_H */ diff --git a/server/mpm/beos/config5.m4 b/server/mpm/beos/config5.m4 deleted file mode 100644 index 4f201408d6c93d6ab86e50bcb2e3e86b5b6e30cf..0000000000000000000000000000000000000000 --- a/server/mpm/beos/config5.m4 +++ /dev/null @@ -1,7 +0,0 @@ -dnl ## XXX - Need a more thorough check of the proper flags to use - -if test "$MPM_NAME" = "beos" ; then - apache_apr_flags="--enable-threads" - - APACHE_FAST_OUTPUT(server/mpm/$MPM_NAME/Makefile) -fi diff --git a/server/mpm/beos/mpm.h b/server/mpm/beos/mpm.h deleted file mode 100644 index af4e2377772e9f45fd545111fe7a1b44ba3b98f0..0000000000000000000000000000000000000000 --- a/server/mpm/beos/mpm.h +++ /dev/null @@ -1,79 +0,0 @@ -/* ==================================================================== - * The Apache Software License, Version 1.1 - * - * Copyright (c) 2000 The Apache Software Foundation. All rights - * reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in - * the documentation and/or other materials provided with the - * distribution. - * - * 3. The end-user documentation included with the redistribution, - * if any, must include the following acknowledgment: - * "This product includes software developed by the - * Apache Software Foundation (http://www.apache.org/)." - * Alternately, this acknowledgment may appear in the software itself, - * if and wherever such third-party acknowledgments normally appear. - * - * 4. The names "Apache" and "Apache Software Foundation" must - * not be used to endorse or promote products derived from this - * software without prior written permission. For written - * permission, please contact apache@apache.org. - * - * 5. Products derived from this software may not be called "Apache", - * nor may "Apache" appear in their name, without prior written - * permission of the Apache Software Foundation. - * - * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED - * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES - * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR - * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF - * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND - * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, - * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT - * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * ==================================================================== - * - * This software consists of voluntary contributions made by many - * individuals on behalf of the Apache Software Foundation. For more - * information on the Apache Software Foundation, please see - * . - * - * Portions of this software are based upon public domain software - * originally written at the National Center for Supercomputing Applications, - * University of Illinois, Urbana-Champaign. - */ - -#ifndef APACHE_MPM_BEOS_H -#define APACHE_MPM_BEOS_H - -#define BEOS_MPM -extern int ap_max_child_assigned; -#include "scoreboard.h" - -#define SERVER_DEAD 0 -#define SERVER_DYING 1 -#define SERVER_ALIVE 2 - -typedef struct ap_ctable{ - pid_t pid; - unsigned char status; -} ap_ctable; - -extern ap_ctable ap_child_table[HARD_SERVER_LIMIT]; -extern server_rec *ap_server_conf; - - -#endif /* APACHE_MPM_BEOS_H */ diff --git a/server/mpm/beos/mpm_default.h b/server/mpm/beos/mpm_default.h deleted file mode 100644 index ffe055d40d8492954e4bdd139574aec84e378b59..0000000000000000000000000000000000000000 --- a/server/mpm/beos/mpm_default.h +++ /dev/null @@ -1,143 +0,0 @@ -/* ==================================================================== - * The Apache Software License, Version 1.1 - * - * Copyright (c) 2000 The Apache Software Foundation. All rights - * reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in - * the documentation and/or other materials provided with the - * distribution. - * - * 3. The end-user documentation included with the redistribution, - * if any, must include the following acknowledgment: - * "This product includes software developed by the - * Apache Software Foundation (http://www.apache.org/)." - * Alternately, this acknowledgment may appear in the software itself, - * if and wherever such third-party acknowledgments normally appear. - * - * 4. The names "Apache" and "Apache Software Foundation" must - * not be used to endorse or promote products derived from this - * software without prior written permission. For written - * permission, please contact apache@apache.org. - * - * 5. Products derived from this software may not be called "Apache", - * nor may "Apache" appear in their name, without prior written - * permission of the Apache Software Foundation. - * - * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED - * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES - * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR - * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF - * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND - * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, - * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT - * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * ==================================================================== - * - * This software consists of voluntary contributions made by many - * individuals on behalf of the Apache Software Foundation. For more - * information on the Apache Software Foundation, please see - * . - * - * Portions of this software are based upon public domain software - * originally written at the National Center for Supercomputing Applications, - * University of Illinois, Urbana-Champaign. - */ - -#ifndef APACHE_MPM_DEFAULT_H -#define APACHE_MPM_DEFAULT_H - -/* Number of servers to spawn off by default --- also, if fewer than - * this free when the caretaker checks, it will spawn more. - */ -#ifndef DEFAULT_START_DAEMON -#define DEFAULT_START_DAEMON 5 -#endif -#define DEFAULT_START_THREADS 20 - -/* Maximum number of *free* server processes --- more than this, and - * they will die off. - */ - -#ifndef DEFAULT_MAX_FREE_DAEMON -#define DEFAULT_MAX_FREE_DAEMON 10 -#endif - -/* Minimum --- fewer than this, and more will be created */ - -#ifndef DEFAULT_MIN_FREE_DAEMON -#define DEFAULT_MIN_FREE_DAEMON 5 -#endif - -/* Limit on the total --- clients will be locked out if more servers than - * this are needed. It is intended solely to keep the server from crashing - * when things get out of hand. - * - * We keep a hard maximum number of servers, for two reasons --- first off, - * in case something goes seriously wrong, we want to stop the fork bomb - * short of actually crashing the machine we're running on by filling some - * kernel table. Secondly, it keeps the size of the scoreboard file small - * enough that we can read the whole thing without worrying too much about - * the overhead. - */ - -#ifdef NO_THREADS -#define HARD_SERVER_LIMIT 256 -#endif -#ifndef HARD_SERVER_LIMIT -#define HARD_SERVER_LIMIT 64 -#endif - -/* Limit on the threads per process. Clients will be locked out if more than - * this * HARD_SERVER_LIMIT are needed. - * - * We keep this for one reason it keeps the size of the scoreboard file small - * enough that we can read the whole thing without worrying too much about - * the overhead. - */ -#ifdef NO_THREADS -#define HARD_THREAD_LIMIT 1 -#endif -#ifndef HARD_THREAD_LIMIT -#define HARD_THREAD_LIMIT 64 -#endif - -#ifdef NO_THREADS -#define DEFAULT_THREADS_PER_CHILD 1 -#endif -#ifndef DEFAULT_THREADS_PER_CHILD -#define DEFAULT_THREADS_PER_CHILD 10 -#endif - -/* Where the main/parent process's pid is logged */ -#ifndef DEFAULT_PIDLOG -#define DEFAULT_PIDLOG "logs/httpd.pid" -#endif - -/* - * Interval, in microseconds, between scoreboard maintenance. - */ -#ifndef SCOREBOARD_MAINTENANCE_INTERVAL -#define SCOREBOARD_MAINTENANCE_INTERVAL 1000000 -#endif - -/* Number of requests to try to handle in a single process. If <= 0, - * the children don't die off. - */ -#ifndef DEFAULT_MAX_REQUESTS_PER_CHILD -#define DEFAULT_MAX_REQUESTS_PER_CHILD 10000 -#endif - -#endif /* AP_MPM_DEFAULT_H */ diff --git a/server/mpm/config.m4 b/server/mpm/config.m4 deleted file mode 100644 index 3c30fd07c0cb05f5108adb220c113a845aff5160..0000000000000000000000000000000000000000 --- a/server/mpm/config.m4 +++ /dev/null @@ -1,56 +0,0 @@ -AC_MSG_CHECKING(which MPM to use) -AC_ARG_WITH(mpm, -[ --with-mpm=MPM Choose the process model, etc. for Apache to use.], -[ - if test "$withval" != "no" ; then - apache_cv_mpm=$withval - AC_MSG_RESULT($apache_cv_mpm) - else - AC_MSG_ERROR(An MPM must be specified) - fi -],[ - AC_MSG_ERROR(An MPM must be specified) -]) - -APACHE_OUTPUT(modules/mpm/Makefile) -MPM_NAME=$apache_cv_mpm -MPM_DIR=modules/mpm/$MPM_NAME -MPM_LIB=$MPM_DIR/lib${MPM_NAME}.la - -AC_SUBST(MPM_NAME) - -dnl All the unix MPMs use shared memory; save a little duplication -AC_DEFUN(APACHE_MPM_CHECK_SHMEM, [ - AC_CHECK_FUNCS(shmget) - AC_FUNC_MMAP - - AC_MSG_CHECKING(which shared memory mechanism to use) - if test "$ac_cv_func_shmget" = "yes" ; then - AC_DEFINE(USE_SHMGET_SCOREBOARD) - AC_MSG_RESULT(shmget) - elif test "$ac_cv_func_mmap" = "yes" ; then - AC_DEFINE(USE_MMAP_SCOREBOARD) - AC_MSG_RESULT(mmap) - else - AC_MSG_ERROR(No known shared memory system) - fi -]) - -dnl Check for pthreads and attempt to support it -AC_DEFUN(APACHE_MPM_PTHREAD, [ - -dnl XXX - We should be checking for the proper flags to use on a particular -dnl platform. This will cover a couple of them, anyway - CFLAGS="-pthread $CFLAGS" - CXXFLAGS="-pthread $CXXFLAGS" - - AC_CHECK_HEADER(pthread.h, [ ],[ - AC_MSG_ERROR(This MPM requires pthreads. Try --with-mpm=prefork.) - ]) - AC_CHECK_FUNC(pthread_create, [ ],[ - AC_MSG_ERROR(Can't compile pthread code.) - ]) - - dnl User threads libraries need pthread.h included everywhere - AC_DEFINE(PTHREAD_EVERYWHERE) -]) diff --git a/server/mpm/experimental/perchild/.cvsignore b/server/mpm/experimental/perchild/.cvsignore deleted file mode 100644 index 84df2572148ad85b6c1c286350aa7c0b6a931e7a..0000000000000000000000000000000000000000 --- a/server/mpm/experimental/perchild/.cvsignore +++ /dev/null @@ -1,5 +0,0 @@ -.deps -.libs -*.lo -*.la -Makefile diff --git a/server/mpm/experimental/perchild/Makefile.in b/server/mpm/experimental/perchild/Makefile.in deleted file mode 100644 index 4d83d72d2d23b76897b0744253063108771989a6..0000000000000000000000000000000000000000 --- a/server/mpm/experimental/perchild/Makefile.in +++ /dev/null @@ -1,5 +0,0 @@ - -LTLIBRARY_NAME = libperchild.la -LTLIBRARY_SOURCES = perchild.c scoreboard.c - -include $(top_srcdir)/build/ltlib.mk diff --git a/server/mpm/experimental/perchild/config5.m4 b/server/mpm/experimental/perchild/config5.m4 deleted file mode 100644 index bd179baed93362f0ad8880ef9e172a6473640a0c..0000000000000000000000000000000000000000 --- a/server/mpm/experimental/perchild/config5.m4 +++ /dev/null @@ -1,6 +0,0 @@ -dnl ## XXX - Need a more thorough check of the proper flags to use - -if test "$MPM_NAME" = "perchild" ; then - - APACHE_FAST_OUTPUT(server/mpm/$MPM_NAME/Makefile) -fi diff --git a/server/mpm/experimental/perchild/mpm.h b/server/mpm/experimental/perchild/mpm.h deleted file mode 100644 index eef0032dd38129057eb67e677ee4f164c50c0dc3..0000000000000000000000000000000000000000 --- a/server/mpm/experimental/perchild/mpm.h +++ /dev/null @@ -1,83 +0,0 @@ -/* ==================================================================== - * The Apache Software License, Version 1.1 - * - * Copyright (c) 2000 The Apache Software Foundation. All rights - * reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in - * the documentation and/or other materials provided with the - * distribution. - * - * 3. The end-user documentation included with the redistribution, - * if any, must include the following acknowledgment: - * "This product includes software developed by the - * Apache Software Foundation (http://www.apache.org/)." - * Alternately, this acknowledgment may appear in the software itself, - * if and wherever such third-party acknowledgments normally appear. - * - * 4. The names "Apache" and "Apache Software Foundation" must - * not be used to endorse or promote products derived from this - * software without prior written permission. For written - * permission, please contact apache@apache.org. - * - * 5. Products derived from this software may not be called "Apache", - * nor may "Apache" appear in their name, without prior written - * permission of the Apache Software Foundation. - * - * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED - * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES - * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR - * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF - * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND - * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, - * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT - * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * ==================================================================== - * - * This software consists of voluntary contributions made by many - * individuals on behalf of the Apache Software Foundation. For more - * information on the Apache Software Foundation, please see - * . - * - * Portions of this software are based upon public domain software - * originally written at the National Center for Supercomputing Applications, - * University of Illinois, Urbana-Champaign. - */ - -#include "httpd.h" -#include "mpm_default.h" -#include "unixd.h" - -#ifndef APACHE_MPM_PERCHILD_H -#define APACHE_MPM_PERCHILD_H - -#define PERCHILD_MPM - -/* Table of child status */ -#define SERVER_DEAD 0 -#define SERVER_DYING 1 -#define SERVER_ALIVE 2 - -typedef struct ap_ctable{ - pid_t pid; - unsigned char status; -} ap_ctable; - -extern int ap_max_daemons_limit; -extern ap_ctable ap_child_table[HARD_SERVER_LIMIT]; -extern server_rec *ap_server_conf; -extern char ap_coredump_dir[MAX_STRING_LEN]; - -#endif /* APACHE_MPM_PERCHILD_H */ diff --git a/server/mpm/experimental/perchild/mpm_default.h b/server/mpm/experimental/perchild/mpm_default.h deleted file mode 100644 index 5bd323b09b456effc1d33a130f5c826e3fd1bd70..0000000000000000000000000000000000000000 --- a/server/mpm/experimental/perchild/mpm_default.h +++ /dev/null @@ -1,144 +0,0 @@ -/* ==================================================================== - * The Apache Software License, Version 1.1 - * - * Copyright (c) 2000 The Apache Software Foundation. All rights - * reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in - * the documentation and/or other materials provided with the - * distribution. - * - * 3. The end-user documentation included with the redistribution, - * if any, must include the following acknowledgment: - * "This product includes software developed by the - * Apache Software Foundation (http://www.apache.org/)." - * Alternately, this acknowledgment may appear in the software itself, - * if and wherever such third-party acknowledgments normally appear. - * - * 4. The names "Apache" and "Apache Software Foundation" must - * not be used to endorse or promote products derived from this - * software without prior written permission. For written - * permission, please contact apache@apache.org. - * - * 5. Products derived from this software may not be called "Apache", - * nor may "Apache" appear in their name, without prior written - * permission of the Apache Software Foundation. - * - * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED - * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES - * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR - * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF - * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND - * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, - * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT - * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * ==================================================================== - * - * This software consists of voluntary contributions made by many - * individuals on behalf of the Apache Software Foundation. For more - * information on the Apache Software Foundation, please see - * . - * - * Portions of this software are based upon public domain software - * originally written at the National Center for Supercomputing Applications, - * University of Illinois, Urbana-Champaign. - */ - -#ifndef APACHE_MPM_DEFAULT_H -#define APACHE_MPM_DEFAULT_H - -/* Number of threads to spawn off by default --- also, if fewer than - * this free when the caretaker checks, it will spawn more. - */ -#ifndef DEFAULT_START_THREAD -#define DEFAULT_START_THREAD 5 -#endif - -/* Maximum number of *free* server threads --- more than this, and - * they will die off. - */ - -#ifndef DEFAULT_MAX_SPARE_THREAD -#define DEFAULT_MAX_SPARE_THREAD 10 -#endif - -/* Minimum --- fewer than this, and more will be created */ - -#ifndef DEFAULT_MIN_SPARE_THREAD -#define DEFAULT_MIN_SPARE_THREAD 5 -#endif - -/* Limit on the threads per process. Clients will be locked out if more than - * this * HARD_SERVER_LIMIT are needed. - * - * We keep this for one reason it keeps the size of the scoreboard file small - * enough that we can read the whole thing without worrying too much about - * the overhead. - */ -#ifndef HARD_THREAD_LIMIT -#define HARD_THREAD_LIMIT 64 -#endif - -/* Number of servers to spawn off by default - */ -#ifndef DEFAULT_NUM_DAEMON -#define DEFAULT_NUM_DAEMON 2 -#endif - -/* Limit on the total --- clients will be locked out if more servers than - * this are needed. It is intended solely to keep the server from crashing - * when things get out of hand. - * - * We keep a hard maximum number of servers, for two reasons --- first off, - * in case something goes seriously wrong, we want to stop the fork bomb - * short of actually crashing the machine we're running on by filling some - * kernel table. Secondly, it keeps the size of the scoreboard file small - * enough that we can read the whole thing without worrying too much about - * the overhead. - */ -#ifndef HARD_SERVER_LIMIT -#define HARD_SERVER_LIMIT 8 -#endif - -/* File used for accept locking, when we use a file */ -#ifndef DEFAULT_LOCKFILE -#define DEFAULT_LOCKFILE "logs/accept.lock" -#endif - -/* Scoreboard file, if there is one */ -#ifndef DEFAULT_SCOREBOARD -#define DEFAULT_SCOREBOARD "logs/apache_runtime_status" -#endif - -/* Where the main/parent process's pid is logged */ -#ifndef DEFAULT_PIDLOG -#define DEFAULT_PIDLOG "logs/httpd.pid" -#endif - -/* - * Interval, in microseconds, between scoreboard maintenance. - */ -#ifndef SCOREBOARD_MAINTENANCE_INTERVAL -#define SCOREBOARD_MAINTENANCE_INTERVAL 1000000 -#endif - -/* Number of requests to try to handle in a single process. If <= 0, - * the children don't die off. - */ -#ifndef DEFAULT_MAX_REQUESTS_PER_CHILD -#define DEFAULT_MAX_REQUESTS_PER_CHILD 10000 -#endif - -#endif /* AP_MPM_DEFAULT_H */ diff --git a/server/mpm/experimental/perchild/perchild.c b/server/mpm/experimental/perchild/perchild.c deleted file mode 100644 index 3a9748755f19345cd653aae4862341fe861b4bcb..0000000000000000000000000000000000000000 --- a/server/mpm/experimental/perchild/perchild.c +++ /dev/null @@ -1,1430 +0,0 @@ -/* ==================================================================== - * The Apache Software License, Version 1.1 - * - * Copyright (c) 2000 The Apache Software Foundation. All rights - * reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in - * the documentation and/or other materials provided with the - * distribution. - * - * 3. The end-user documentation included with the redistribution, - * if any, must include the following acknowledgment: - * "This product includes software developed by the - * Apache Software Foundation (http://www.apache.org/)." - * Alternately, this acknowledgment may appear in the software itself, - * if and wherever such third-party acknowledgments normally appear. - * - * 4. The names "Apache" and "Apache Software Foundation" must - * not be used to endorse or promote products derived from this - * software without prior written permission. For written - * permission, please contact apache@apache.org. - * - * 5. Products derived from this software may not be called "Apache", - * nor may "Apache" appear in their name, without prior written - * permission of the Apache Software Foundation. - * - * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED - * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES - * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR - * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF - * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND - * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, - * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT - * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * ==================================================================== - * - * This software consists of voluntary contributions made by many - * individuals on behalf of the Apache Software Foundation. For more - * information on the Apache Software Foundation, please see - * . - * - * Portions of this software are based upon public domain software - * originally written at the National Center for Supercomputing Applications, - * University of Illinois, Urbana-Champaign. - */ - -#define CORE_PRIVATE - -#include "ap_config.h" -#include "apr_strings.h" -#include "apr_portable.h" -#include "apr_file_io.h" -#include "httpd.h" -#include "http_main.h" -#include "http_log.h" -#include "http_config.h" /* for read_config */ -#include "http_core.h" /* for get_remote_host */ -#include "http_connection.h" -#include "ap_mpm.h" -#include "unixd.h" -#include "mpm_common.h" -#include "iol_socket.h" -#include "ap_listen.h" -#include "mpm_default.h" -#include "mpm.h" -#include "scoreboard.h" - -#ifdef HAVE_UNISTD_H -#include -#endif -#include -#ifdef HAVE_SYS_SOCKET_H -#include -#endif -#ifdef HAVE_NETINET_TCP_H -#include -#endif -#include -#include - -/* - * Actual definitions of config globals - */ - -static int threads_to_start = 0; /* Worker threads per child */ -static int min_spare_threads = 0; -static int max_spare_threads = 0; -static int max_threads = 0; -static int max_requests_per_child = 0; -static const char *ap_pid_fname=NULL; -API_VAR_EXPORT const char *ap_scoreboard_fname=NULL; -static int num_daemons=0; -static int workers_may_exit = 0; -static int requests_this_child; -static int num_listenfds = 0; -static ap_socket_t **listenfds; - -struct ap_ctable ap_child_table[HARD_SERVER_LIMIT]; - -/* - * The max child slot ever assigned, preserved across restarts. Necessary - * to deal with NumServers changes across SIGWINCH restarts. We use this - * value to optimize routines that have to scan the entire child table. - * - * XXX - It might not be worth keeping this code in. There aren't very - * many child processes in this MPM. - */ -int ap_max_daemons_limit = -1; - -char ap_coredump_dir[MAX_STRING_LEN]; - -static ap_file_t *pipe_of_death_in = NULL; -static ap_file_t *pipe_of_death_out = NULL; -static pthread_mutex_t pipe_of_death_mutex; - -/* *Non*-shared http_main globals... */ - -server_rec *ap_server_conf; - -/* one_process --- debugging mode variable; can be set from the command line - * with the -X flag. If set, this gets you the child_main loop running - * in the process which originally started up (no detach, no make_child), - * which is a pretty nice debugging environment. (You'll get a SIGHUP - * early in standalone_main; just continue through. This is the server - * trying to kill off any child processes which it might have lying - * around --- Apache doesn't keep track of their pids, it just sends - * SIGHUP to the process group, ignoring it in the root process. - * Continue through and you'll be fine.). - */ - -static int one_process = 0; - -#ifdef DEBUG_SIGSTOP -int raise_sigstop_flags; -#endif - -static ap_pool_t *pconf; /* Pool for config stuff */ -static ap_pool_t *pchild; /* Pool for httpd child stuff */ -static ap_pool_t *thread_pool_parent; /* Parent of per-thread pools */ -static pthread_mutex_t thread_pool_parent_mutex; - -static int child_num; -static unsigned int my_pid; /* Linux getpid() doesn't work except in - main thread. Use this instead */ -/* Keep track of the number of worker threads currently active */ -static int worker_thread_count; -static pthread_mutex_t worker_thread_count_mutex; -static int worker_thread_free_ids[HARD_THREAD_LIMIT]; -static pthread_attr_t worker_thread_attr; - -/* Keep track of the number of idle worker threads */ -static int idle_thread_count; -static pthread_mutex_t idle_thread_count_mutex; - -/* Locks for accept serialization */ -#ifdef NO_SERIALIZED_ACCEPT -#define SAFE_ACCEPT(stmt) APR_SUCCESS -#else -#define SAFE_ACCEPT(stmt) (stmt) -static ap_lock_t *process_accept_mutex; -#endif /* NO_SERIALIZED_ACCEPT */ -static const char *lock_fname; -static pthread_mutex_t thread_accept_mutex = PTHREAD_MUTEX_INITIALIZER; - -API_EXPORT(int) ap_get_max_daemons(void) -{ - return ap_max_daemons_limit; -} - -/* a clean exit from a child with proper cleanup */ -static void clean_child_exit(int code) -{ - if (pchild) { - ap_destroy_pool(pchild); - } - exit(code); -} - -/* handle all varieties of core dumping signals */ -static void sig_coredump(int sig) -{ - chdir(ap_coredump_dir); - ap_signal(sig, SIG_DFL); - kill(getpid(), sig); - /* At this point we've got sig blocked, because we're still inside - * the signal handler. When we leave the signal handler it will - * be unblocked, and we'll take the signal... and coredump or whatever - * is appropriate for this particular Unix. In addition the parent - * will see the real signal we received -- whereas if we called - * abort() here, the parent would only see SIGABRT. - */ -} - -static void just_die(int sig) -{ - clean_child_exit(0); -} - -/***************************************************************** - * Connection structures and accounting... - */ - -/* volatile just in case */ -static int volatile shutdown_pending; -static int volatile restart_pending; -static int volatile is_graceful; - -/* - * ap_start_shutdown() and ap_start_restart(), below, are a first stab at - * functions to initiate shutdown or restart without relying on signals. - * Previously this was initiated in sig_term() and restart() signal handlers, - * but we want to be able to start a shutdown/restart from other sources -- - * e.g. on Win32, from the service manager. Now the service manager can - * call ap_start_shutdown() or ap_start_restart() as appropiate. Note that - * these functions can also be called by the child processes, since global - * variables are no longer used to pass on the required action to the parent. - * - * These should only be called from the parent process itself, since the - * parent process will use the shutdown_pending and restart_pending variables - * to determine whether to shutdown or restart. The child process should - * call signal_parent() directly to tell the parent to die -- this will - * cause neither of those variable to be set, which the parent will - * assume means something serious is wrong (which it will be, for the - * child to force an exit) and so do an exit anyway. - */ - -void ap_start_shutdown(void) -{ - if (shutdown_pending == 1) { - /* Um, is this _probably_ not an error, if the user has - * tried to do a shutdown twice quickly, so we won't - * worry about reporting it. - */ - return; - } - shutdown_pending = 1; -} - -/* do a graceful restart if graceful == 1 */ -void ap_start_restart(int graceful) -{ - - if (restart_pending == 1) { - /* Probably not an error - don't bother reporting it */ - return; - } - restart_pending = 1; - is_graceful = graceful; -} - -static void sig_term(int sig) -{ - ap_start_shutdown(); -} - -static void restart(int sig) -{ -#ifndef WIN32 - ap_start_restart(sig == SIGWINCH); -#else - ap_start_restart(1); -#endif -} - -static void set_signals(void) -{ -#ifndef NO_USE_SIGACTION - struct sigaction sa; - - sigemptyset(&sa.sa_mask); - sa.sa_flags = 0; - - if (!one_process) { - sa.sa_handler = sig_coredump; -#if defined(SA_ONESHOT) - sa.sa_flags = SA_ONESHOT; -#elif defined(SA_RESETHAND) - sa.sa_flags = SA_RESETHAND; -#endif - if (sigaction(SIGSEGV, &sa, NULL) < 0) - ap_log_error(APLOG_MARK, APLOG_WARNING, errno, ap_server_conf, "sigaction(SIGSEGV)"); -#ifdef SIGBUS - if (sigaction(SIGBUS, &sa, NULL) < 0) - ap_log_error(APLOG_MARK, APLOG_WARNING, errno, ap_server_conf, "sigaction(SIGBUS)"); -#endif -#ifdef SIGABORT - if (sigaction(SIGABORT, &sa, NULL) < 0) - ap_log_error(APLOG_MARK, APLOG_WARNING, errno, ap_server_conf, "sigaction(SIGABORT)"); -#endif -#ifdef SIGABRT - if (sigaction(SIGABRT, &sa, NULL) < 0) - ap_log_error(APLOG_MARK, APLOG_WARNING, errno, ap_server_conf, "sigaction(SIGABRT)"); -#endif -#ifdef SIGILL - if (sigaction(SIGILL, &sa, NULL) < 0) - ap_log_error(APLOG_MARK, APLOG_WARNING, errno, ap_server_conf, "sigaction(SIGILL)"); -#endif - sa.sa_flags = 0; - } - sa.sa_handler = sig_term; - if (sigaction(SIGTERM, &sa, NULL) < 0) - ap_log_error(APLOG_MARK, APLOG_WARNING, errno, ap_server_conf, "sigaction(SIGTERM)"); -#ifdef SIGINT - if (sigaction(SIGINT, &sa, NULL) < 0) - ap_log_error(APLOG_MARK, APLOG_WARNING, errno, ap_server_conf, "sigaction(SIGINT)"); -#endif -#ifdef SIGXCPU - sa.sa_handler = SIG_DFL; - if (sigaction(SIGXCPU, &sa, NULL) < 0) - ap_log_error(APLOG_MARK, APLOG_WARNING, errno, ap_server_conf, "sigaction(SIGXCPU)"); -#endif -#ifdef SIGXFSZ - sa.sa_handler = SIG_DFL; - if (sigaction(SIGXFSZ, &sa, NULL) < 0) - ap_log_error(APLOG_MARK, APLOG_WARNING, errno, ap_server_conf, "sigaction(SIGXFSZ)"); -#endif -#ifdef SIGPIPE - sa.sa_handler = SIG_IGN; - if (sigaction(SIGPIPE, &sa, NULL) < 0) - ap_log_error(APLOG_MARK, APLOG_WARNING, errno, ap_server_conf, "sigaction(SIGPIPE)"); -#endif - - /* we want to ignore HUPs and WINCH while we're busy processing one */ - sigaddset(&sa.sa_mask, SIGHUP); - sigaddset(&sa.sa_mask, SIGWINCH); - sa.sa_handler = restart; - if (sigaction(SIGHUP, &sa, NULL) < 0) - ap_log_error(APLOG_MARK, APLOG_WARNING, errno, ap_server_conf, "sigaction(SIGHUP)"); - if (sigaction(SIGWINCH, &sa, NULL) < 0) - ap_log_error(APLOG_MARK, APLOG_WARNING, errno, ap_server_conf, "sigaction(SIGWINCH)"); -#else - if (!one_process) { - ap_signal(SIGSEGV, sig_coredump); -#ifdef SIGBUS - ap_signal(SIGBUS, sig_coredump); -#endif /* SIGBUS */ -#ifdef SIGABORT - ap_signal(SIGABORT, sig_coredump); -#endif /* SIGABORT */ -#ifdef SIGABRT - ap_signal(SIGABRT, sig_coredump); -#endif /* SIGABRT */ -#ifdef SIGILL - ap_signal(SIGILL, sig_coredump); -#endif /* SIGILL */ -#ifdef SIGXCPU - ap_signal(SIGXCPU, SIG_DFL); -#endif /* SIGXCPU */ -#ifdef SIGXFSZ - ap_signal(SIGXFSZ, SIG_DFL); -#endif /* SIGXFSZ */ - } - - ap_signal(SIGTERM, sig_term); -#ifdef SIGHUP - ap_signal(SIGHUP, restart); -#endif /* SIGHUP */ -#ifdef SIGWINCH - ap_signal(SIGWINCH, restart); -#endif /* SIGWINCH */ -#ifdef SIGPIPE - ap_signal(SIGPIPE, SIG_IGN); -#endif /* SIGPIPE */ - -#endif -} - -/***************************************************************** - * Here follows a long bunch of generic server bookkeeping stuff... - */ - -int ap_graceful_stop_signalled(void) -{ - /* XXX - Does this really work? - Manoj */ - return is_graceful; -} - -/***************************************************************** - * Child process main loop. - */ - -static void process_socket(ap_pool_t *p, ap_socket_t *sock, long conn_id) -{ - BUFF *conn_io; - conn_rec *current_conn; - ap_iol *iol; - int csd; - ap_status_t rv; - - if ((rv = ap_get_os_sock(&csd, sock)) != APR_SUCCESS) { - ap_log_error(APLOG_MARK, APLOG_ERR, rv, NULL, "ap_get_os_sock"); - } - - if (csd >= FD_SETSIZE) { - ap_log_error(APLOG_MARK, APLOG_NOERRNO|APLOG_WARNING, 0, NULL, - "new file descriptor %d is too large; you probably need " - "to rebuild Apache with a larger FD_SETSIZE " - "(currently %d)", - csd, FD_SETSIZE); - ap_close_socket(sock); - return; - } - - ap_sock_disable_nagle(csd); - iol = ap_iol_attach_socket(p, sock); - conn_io = ap_bcreate(p, B_RDWR); - ap_bpush_iol(conn_io, iol); - - current_conn = ap_new_apr_connection(p, ap_server_conf, conn_io, sock, - conn_id); - - ap_process_connection(current_conn); - ap_lingering_close(current_conn); -} - -static void *worker_thread(void *); - -/* Starts a thread as long as we're below max_threads */ -static int start_thread(void) -{ - pthread_t thread; - - pthread_mutex_lock(&worker_thread_count_mutex); - if (worker_thread_count < max_threads) { - if (pthread_create(&thread, &worker_thread_attr, worker_thread, - &worker_thread_free_ids[worker_thread_count])) { - ap_log_error(APLOG_MARK, APLOG_ALERT, errno, ap_server_conf, - "pthread_create: unable to create worker thread"); - /* In case system resources are maxxed out, we don't want - Apache running away with the CPU trying to fork over and - over and over again if we exit. */ - sleep(10); - workers_may_exit = 1; - pthread_mutex_unlock(&worker_thread_count_mutex); - return 0; - } - else { - worker_thread_count++; - } - } - else { - static int reported = 0; - - if (!reported) { - ap_log_error(APLOG_MARK, APLOG_NOERRNO|APLOG_ERR, 0, ap_server_conf, - "server reached MaxThreadsPerChild setting, consider raising the" - " MaxThreadsPerChild or NumServers settings"); - reported = 1; - } - pthread_mutex_unlock(&worker_thread_count_mutex); - return 0; - } - pthread_mutex_unlock(&worker_thread_count_mutex); - return 1; - -} -/* Sets workers_may_exit if we received a character on the pipe_of_death */ -static void check_pipe_of_death(void) -{ - pthread_mutex_lock(&pipe_of_death_mutex); - if (!workers_may_exit) { - int ret; - char pipe_read_char; - ap_ssize_t n = 1; - - ret = ap_recv(listenfds[0], &pipe_read_char, &n); - if (ap_canonical_error(ret) == APR_EAGAIN) { - /* It lost the lottery. It must continue to suffer - * through a life of servitude. */ - } - else { - /* It won the lottery (or something else is very - * wrong). Embrace death with open arms. */ - workers_may_exit = 1; - } - } - pthread_mutex_unlock(&pipe_of_death_mutex); -} - -/* idle_thread_count should be incremented before starting a worker_thread */ - -static void *worker_thread(void *arg) -{ - ap_socket_t *csd = NULL; - ap_pool_t *tpool; /* Pool for this thread */ - ap_pool_t *ptrans; /* Pool for per-transaction stuff */ - ap_socket_t *sd = NULL; - int srv; - int curr_pollfd, last_pollfd = 0; - int thread_just_started = 1; - int thread_num = *((int *) arg); - long conn_id = child_num * HARD_THREAD_LIMIT + thread_num; - ap_pollfd_t *pollset; - int n; - ap_status_t rv; - - pthread_mutex_lock(&thread_pool_parent_mutex); - ap_create_pool(&tpool, thread_pool_parent); - pthread_mutex_unlock(&thread_pool_parent_mutex); - ap_create_pool(&ptrans, tpool); - - ap_setup_poll(&pollset, num_listenfds+1, tpool); - for(n=0 ; n <= num_listenfds ; ++n) - ap_add_poll_socket(pollset, listenfds[n], APR_POLLIN); - - while (!workers_may_exit) { - workers_may_exit |= (max_requests_per_child != 0) && (requests_this_child <= 0); - if (workers_may_exit) break; - if (!thread_just_started) { - pthread_mutex_lock(&idle_thread_count_mutex); - if (idle_thread_count < max_spare_threads) { - idle_thread_count++; - pthread_mutex_unlock(&idle_thread_count_mutex); - } - else { - pthread_mutex_unlock(&idle_thread_count_mutex); - break; - } - } - else { - thread_just_started = 0; - } - pthread_mutex_lock(&thread_accept_mutex); - if (workers_may_exit) { - pthread_mutex_unlock(&thread_accept_mutex); - break; - } - if ((rv = SAFE_ACCEPT(ap_lock(process_accept_mutex))) - != APR_SUCCESS) { - ap_log_error(APLOG_MARK, APLOG_EMERG, rv, ap_server_conf, - "ap_lock failed. Attempting to shutdown " - "process gracefully."); - workers_may_exit = 1; - } - - while (!workers_may_exit) { - ap_int16_t event; - srv = ap_poll(pollset, &n, -1); - - if (srv != APR_SUCCESS) { - if (ap_canonical_error(srv) == APR_EINTR) { - continue; - } - - /* ap_poll() will only return errors in catastrophic - * circumstances. Let's try exiting gracefully, for now. */ - ap_log_error(APLOG_MARK, APLOG_ERR, srv, (const server_rec *) - ap_server_conf, "ap_poll: (listen)"); - workers_may_exit = 1; - } - if (workers_may_exit) break; - - ap_get_revents(&event, listenfds[0], pollset); - if (event & APR_POLLIN) { - /* A process got a signal on the shutdown pipe. Check if we're - * the lucky process to die. */ - check_pipe_of_death(); - continue; - } - - if (num_listenfds == 1) { - sd = ap_listeners->sd; - goto got_fd; - } - else { - /* find a listener */ - curr_pollfd = last_pollfd; - do { - curr_pollfd++; - if (curr_pollfd > num_listenfds) { - curr_pollfd = 1; - } - /* XXX: Should we check for POLLERR? */ - ap_get_revents(&event, listenfds[curr_pollfd], pollset); - if (event & APR_POLLIN) { - last_pollfd = curr_pollfd; - sd = listenfds[curr_pollfd]; - goto got_fd; - } - } while (curr_pollfd != last_pollfd); - } - } - got_fd: - if (!workers_may_exit) { - if ((rv = ap_accept(&csd, sd, ptrans)) != APR_SUCCESS) { - ap_log_error(APLOG_MARK, APLOG_ERR, rv, ap_server_conf, "ap_accept"); - } - if ((rv = SAFE_ACCEPT(ap_unlock(process_accept_mutex))) - != APR_SUCCESS) { - ap_log_error(APLOG_MARK, APLOG_EMERG, rv, ap_server_conf, - "ap_unlock failed. Attempting to shutdown " - "process gracefully."); - workers_may_exit = 1; - } - pthread_mutex_unlock(&thread_accept_mutex); - pthread_mutex_lock(&idle_thread_count_mutex); - if (idle_thread_count > min_spare_threads) { - idle_thread_count--; - } - else { - if (!start_thread()) { - idle_thread_count--; - } - } - pthread_mutex_unlock(&idle_thread_count_mutex); - process_socket(ptrans, csd, conn_id); - requests_this_child--; - } else { - if ((rv = SAFE_ACCEPT(ap_unlock(process_accept_mutex))) - != APR_SUCCESS) { - ap_log_error(APLOG_MARK, APLOG_EMERG, rv, ap_server_conf, - "ap_unlock failed. Attempting to shutdown " - "process gracefully."); - workers_may_exit = 1; - } - pthread_mutex_unlock(&thread_accept_mutex); - pthread_mutex_lock(&idle_thread_count_mutex); - idle_thread_count--; - pthread_mutex_unlock(&idle_thread_count_mutex); - break; - } - ap_clear_pool(ptrans); - } - - pthread_mutex_lock(&thread_pool_parent_mutex); - ap_destroy_pool(tpool); - pthread_mutex_unlock(&thread_pool_parent_mutex); - pthread_mutex_lock(&worker_thread_count_mutex); - worker_thread_count--; - worker_thread_free_ids[worker_thread_count] = thread_num; - if (worker_thread_count == 0) { - /* All the threads have exited, now finish the shutdown process - * by signalling the sigwait thread */ - kill(my_pid, SIGTERM); - } - pthread_mutex_unlock(&worker_thread_count_mutex); - - return NULL; -} - -static void child_main(int child_num_arg) -{ - sigset_t sig_mask; - int signal_received; - int i; - ap_listen_rec *lr; - ap_status_t rv; - - my_pid = getpid(); - child_num = child_num_arg; - ap_create_pool(&pchild, pconf); - - /*stuff to do before we switch id's, so we have permissions.*/ - - rv = SAFE_ACCEPT(ap_child_init_lock(&process_accept_mutex, lock_fname, - pchild)); - if (rv != APR_SUCCESS) { - ap_log_error(APLOG_MARK, APLOG_EMERG, rv, ap_server_conf, - "Couldn't initialize cross-process lock in child"); - clean_child_exit(APEXIT_CHILDFATAL); - } - - if (unixd_setup_child()) { - clean_child_exit(APEXIT_CHILDFATAL); - } - - ap_child_init_hook(pchild, ap_server_conf); - - /*done with init critical section */ - - /* All threads should mask signals out, accoring to sigwait(2) man page */ - sigfillset(&sig_mask); - -#ifdef SIGPROCMASK_SETS_THREAD_MASK - if (sigprocmask(SIG_SETMASK, &sig_mask, NULL) != 0) { - ap_log_error(APLOG_MARK, APLOG_ALERT, errno, ap_server_conf, "sigprocmask"); - } -#else - if (pthread_sigmask(SIG_SETMASK, &sig_mask, NULL) != 0) { - ap_log_error(APLOG_MARK, APLOG_ALERT, errno, ap_server_conf, - "pthread_sigmask"); - } -#endif - - requests_this_child = max_requests_per_child; - - /* Set up the pollfd array */ - listenfds = ap_pcalloc(pchild, sizeof(*listenfds) * (num_listenfds + 1)); -#if APR_FILES_AS_SOCKETS - ap_socket_from_file(&listenfds[0], pipe_of_death_in); -#endif - for (lr = ap_listeners, i = 1; i <= num_listenfds; lr = lr->next, ++i) - listenfds[i]=lr->sd; - - /* Setup worker threads */ - - if (threads_to_start > max_threads) { - threads_to_start = max_threads; - } - idle_thread_count = threads_to_start; - worker_thread_count = 0; - for (i = 0; i < max_threads; i++) { - worker_thread_free_ids[i] = i; - } - ap_create_pool(&thread_pool_parent, pchild); - pthread_mutex_init(&thread_pool_parent_mutex, NULL); - pthread_mutex_init(&idle_thread_count_mutex, NULL); - pthread_mutex_init(&worker_thread_count_mutex, NULL); - pthread_mutex_init(&pipe_of_death_mutex, NULL); - pthread_attr_init(&worker_thread_attr); -#ifdef PTHREAD_ATTR_SETDETACHSTATE_ARG2_ADDR - { - int on = 1; - - pthread_attr_setdetachstate(&worker_thread_attr, &on); - } -#else - pthread_attr_setdetachstate(&worker_thread_attr, PTHREAD_CREATE_DETACHED); -#endif - - /* We are creating worker threads right now */ - for (i=0; i < threads_to_start; i++) { - /* start_thread shouldn't fail here */ - if (!start_thread()) { - break; - } - } - - /* This thread will be the one responsible for handling signals */ - sigemptyset(&sig_mask); - sigaddset(&sig_mask, SIGTERM); - sigaddset(&sig_mask, SIGINT); - ap_sigwait(&sig_mask, &signal_received); - switch (signal_received) { - case SIGTERM: - case SIGINT: - just_die(signal_received); - break; - default: - ap_log_error(APLOG_MARK, APLOG_ALERT, errno, ap_server_conf, - "received impossible signal: %d", signal_received); - just_die(SIGTERM); - } -} - -static int make_child(server_rec *s, int slot, time_t now) -{ - int pid; - - if (slot + 1 > ap_max_daemons_limit) { - ap_max_daemons_limit = slot + 1; - } - - if (one_process) { - set_signals(); - ap_child_table[slot].pid = getpid(); - ap_child_table[slot].status = SERVER_ALIVE; - child_main(slot); - } - - if ((pid = fork()) == -1) { - ap_log_error(APLOG_MARK, APLOG_ERR, errno, s, - "fork: Unable to fork new process"); - /* In case system resources are maxxed out, we don't want - Apache running away with the CPU trying to fork over and - over and over again. */ - sleep(10); - - return -1; - } - - if (!pid) { -#ifdef AIX_BIND_PROCESSOR - /* By default, AIX binds to a single processor. This bit unbinds - children which will then bind to another CPU. - */ -#include - int status = bindprocessor(BINDPROCESS, (int)getpid(), - PROCESSOR_CLASS_ANY); - if (status != OK) - ap_log_error(APLOG_MARK, APLOG_NOERRNO|APLOG_WARNING, errno, - ap_server_conf, "processor unbind failed %d", status); -#endif - - RAISE_SIGSTOP(MAKE_CHILD); - - /* XXX - For an unthreaded server, a signal handler will be necessary - ap_signal(SIGTERM, just_die); - */ - child_main(slot); - - return 0; - } - /* else */ - ap_child_table[slot].pid = pid; - ap_child_table[slot].status = SERVER_ALIVE; - - return 0; -} - -/* start up a bunch of children */ -static int startup_children(int number_to_start) -{ - int i; - - for (i = 0; number_to_start && i < num_daemons; ++i) { - if (ap_child_table[i].status != SERVER_DEAD) { - continue; - } - if (make_child(ap_server_conf, i, 0) < 0) { - break; - } - --number_to_start; - } - return number_to_start; -} - - -/* - * spawn_rate is the number of children that will be spawned on the - * next maintenance cycle if there aren't enough servers. It is - * doubled up to MAX_SPAWN_RATE, and reset only when a cycle goes by - * without the need to spawn. - */ -static int spawn_rate = 1; -#ifndef MAX_SPAWN_RATE -#define MAX_SPAWN_RATE (32) -#endif -static int hold_off_on_exponential_spawning; - -static void perform_child_maintenance(void) -{ - int i; - time_t now = 0; - int free_length; - int free_slots[MAX_SPAWN_RATE]; - int last_non_dead = -1; - - /* initialize the free_list */ - free_length = 0; - - for (i = 0; i < num_daemons; ++i) { - if (ap_child_table[i].status == SERVER_DEAD) { - if (free_length < spawn_rate) { - free_slots[free_length] = i; - ++free_length; - } - } - else { - last_non_dead = i; - } - - if (i >= ap_max_daemons_limit && free_length >= spawn_rate) { - break; - } - } - ap_max_daemons_limit = last_non_dead + 1; - - if (free_length > 0) { - for (i = 0; i < free_length; ++i) { - make_child(ap_server_conf, free_slots[i], now); - } - /* the next time around we want to spawn twice as many if this - * wasn't good enough, but not if we've just done a graceful - */ - if (hold_off_on_exponential_spawning) { - --hold_off_on_exponential_spawning; - } - else if (spawn_rate < MAX_SPAWN_RATE) { - spawn_rate *= 2; - } - } - else { - spawn_rate = 1; - } -} - -static void server_main_loop(int remaining_children_to_start) -{ - int child_slot; - ap_wait_t status; - ap_proc_t pid; - int i; - - while (!restart_pending && !shutdown_pending) { - ap_wait_or_timeout(&status, &pid, pconf); - - if (pid.pid != -1) { - ap_process_child_status(&pid, status); - /* non-fatal death... note that it's gone in the child table and - * clean out the status table. */ - child_slot = -1; - for (i = 0; i < ap_max_daemons_limit; ++i) { - if (ap_child_table[i].pid == pid.pid) { - int j; - - child_slot = i; - for (j = 0; j < HARD_THREAD_LIMIT; j++) { - ap_perchild_force_reset_connection_status(i * HARD_THREAD_LIMIT + j); - } - break; - } - } - if (child_slot >= 0) { - ap_child_table[child_slot].status = SERVER_DEAD; - - if (remaining_children_to_start - && child_slot < num_daemons) { - /* we're still doing a 1-for-1 replacement of dead - * children with new children - */ - make_child(ap_server_conf, child_slot, time(NULL)); - --remaining_children_to_start; - } -#if APR_HAS_OTHER_CHILD - } - else if (ap_reap_other_child(&pid, status) == 0) { - /* handled */ -#endif - } - else if (is_graceful) { - /* Great, we've probably just lost a slot in the - * child table. Somehow we don't know about this - * child. - */ - ap_log_error(APLOG_MARK, APLOG_NOERRNO|APLOG_WARNING, 0, - ap_server_conf, - "long lost child came home! (pid %ld)", - (long)pid.pid); - } - /* Don't perform idle maintenance when a child dies, - * only do it when there's a timeout. Remember only a - * finite number of children can die, and it's pretty - * pathological for a lot to die suddenly. - */ - continue; - } - else if (remaining_children_to_start) { - /* we hit a 1 second timeout in which none of the previous - * generation of children needed to be reaped... so assume - * they're all done, and pick up the slack if any is left. - */ - remaining_children_to_start = \ - startup_children(remaining_children_to_start); - /* In any event we really shouldn't do the code below because - * few of the servers we just started are in the IDLE state - * yet, so we'd mistakenly create an extra server. - */ - continue; - } - - perform_child_maintenance(); - } -} - -int ap_mpm_run(ap_pool_t *_pconf, ap_pool_t *plog, server_rec *s) -{ - int remaining_children_to_start; - int i; - ap_status_t rv; - ap_ssize_t one = 1; - - pconf = _pconf; - ap_server_conf = s; - if ((rv = ap_create_pipe(&pipe_of_death_in, &pipe_of_death_out, pconf)) - != APR_SUCCESS) { - ap_log_error(APLOG_MARK, APLOG_ERR, rv, - (const server_rec*) ap_server_conf, - "ap_create_pipe (pipe_of_death)"); - exit(1); - } - if ((rv = ap_set_pipe_timeout(pipe_of_death_in, 0)) != APR_SUCCESS) { - ap_log_error(APLOG_MARK, APLOG_ERR, rv, - (const server_rec*) ap_server_conf, - "ap_set_pipe_timeout (pipe_of_death)"); - exit(1); - } - ap_server_conf = s; - if ((num_listenfds = ap_setup_listeners(ap_server_conf)) < 1) { - /* XXX: hey, what's the right way for the mpm to indicate a fatal error? */ - ap_log_error(APLOG_MARK, APLOG_NOERRNO|APLOG_ALERT, 0, s, - "no listening sockets available, shutting down"); - return 1; - } - ap_log_pid(pconf, ap_pid_fname); - - /* Initialize cross-process accept lock */ - lock_fname = ap_psprintf(_pconf, "%s.%u", - ap_server_root_relative(_pconf, lock_fname), - my_pid); - rv = SAFE_ACCEPT(ap_create_lock(&process_accept_mutex, APR_MUTEX, - APR_CROSS_PROCESS, lock_fname, _pconf)); - if (rv != APR_SUCCESS) { - ap_log_error(APLOG_MARK, APLOG_EMERG, rv, s, - "Couldn't create cross-process lock"); - return 1; - } - - if (!is_graceful) { - reinit_scoreboard(pconf); - } - /* Initialize the child table */ - if (!is_graceful) { - for (i = 0; i < HARD_SERVER_LIMIT; i++) { - ap_child_table[i].status = SERVER_DEAD; - } - } - - set_signals(); - - /* If we're doing a graceful_restart then we're going to see a lot - * of children exiting immediately when we get into the main loop - * below (because we just sent them SIGWINCH). This happens pretty - * rapidly... and for each one that exits we'll start a new one until - * we reach at least daemons_min_free. But we may be permitted to - * start more than that, so we'll just keep track of how many we're - * supposed to start up without the 1 second penalty between each fork. - */ - remaining_children_to_start = num_daemons; - if (!is_graceful) { - remaining_children_to_start = \ - startup_children(remaining_children_to_start); - } - else { - /* give the system some time to recover before kicking into - * exponential mode */ - hold_off_on_exponential_spawning = 10; - } - - ap_log_error(APLOG_MARK, APLOG_NOERRNO|APLOG_NOTICE, 0, ap_server_conf, - "%s configured -- resuming normal operations", - ap_get_server_version()); - ap_log_error(APLOG_MARK, APLOG_NOERRNO|APLOG_INFO, 0, ap_server_conf, - "Server built: %s", ap_get_server_built()); - restart_pending = shutdown_pending = 0; - - server_main_loop(remaining_children_to_start); - - if (shutdown_pending) { - /* Time to gracefully shut down: - * Kill child processes, tell them to call child_exit, etc... - */ - if (unixd_killpg(getpgrp(), SIGTERM) < 0) { - ap_log_error(APLOG_MARK, APLOG_WARNING, errno, ap_server_conf, - "killpg SIGTERM"); - } - ap_reclaim_child_processes(1); /* Start with SIGTERM */ - - /* cleanup pid file on normal shutdown */ - { - const char *pidfile = NULL; - pidfile = ap_server_root_relative (pconf, ap_pid_fname); - if ( pidfile != NULL && unlink(pidfile) == 0) - ap_log_error(APLOG_MARK, APLOG_NOERRNO|APLOG_INFO, 0, - ap_server_conf, - "removed PID file %s (pid=%ld)", - pidfile, (long)getpid()); - } - - ap_log_error(APLOG_MARK, APLOG_NOERRNO|APLOG_NOTICE, 0, - ap_server_conf, "caught SIGTERM, shutting down"); - - return 1; - } - - /* we've been told to restart */ - ap_signal(SIGHUP, SIG_IGN); - - if (one_process) { - /* not worth thinking about */ - return 1; - } - - if (is_graceful) { - char char_of_death = '!'; - - ap_log_error(APLOG_MARK, APLOG_NOERRNO|APLOG_NOTICE, 0, ap_server_conf, - "SIGWINCH received. Doing graceful restart"); - - /* This is mostly for debugging... so that we know what is still - * gracefully dealing with existing request. - */ - - for (i = 0; i < num_daemons; ++i) { - if (ap_child_table[i].status != SERVER_DEAD) { - ap_child_table[i].status = SERVER_DYING; - } - } - /* give the children the signal to die */ - for (i = 0; i < num_daemons;) { - if ((rv = ap_write(pipe_of_death_out, &char_of_death, &one)) != APR_SUCCESS) { - if (ap_canonical_error(rv) == APR_EINTR) continue; - ap_log_error(APLOG_MARK, APLOG_WARNING, rv, ap_server_conf, - "write pipe_of_death"); - } - i++; - } - } - else { - /* Kill 'em all. Since the child acts the same on the parents SIGTERM - * and a SIGHUP, we may as well use the same signal, because some user - * pthreads are stealing signals from us left and right. - */ - if (unixd_killpg(getpgrp(), SIGTERM) < 0) { - ap_log_error(APLOG_MARK, APLOG_WARNING, errno, ap_server_conf, - "killpg SIGTERM"); - } - ap_reclaim_child_processes(1); /* Start with SIGTERM */ - ap_log_error(APLOG_MARK, APLOG_NOERRNO|APLOG_NOTICE, 0, - ap_server_conf, "SIGHUP received. Attempting to restart"); - } - return 0; -} - -static void perchild_pre_config(ap_pool_t *p, ap_pool_t *plog, ap_pool_t *ptemp) -{ - static int restart_num = 0; - - one_process = !!getenv("ONE_PROCESS"); - - /* sigh, want this only the second time around */ - if (restart_num++ == 1) { - is_graceful = 0; - - if (!one_process) { - ap_detach(); - } - - my_pid = getpid(); - } - - unixd_pre_config(); - ap_listen_pre_config(); - num_daemons = DEFAULT_NUM_DAEMON; - threads_to_start = DEFAULT_START_THREAD; - min_spare_threads = DEFAULT_MIN_SPARE_THREAD; - max_spare_threads = DEFAULT_MAX_SPARE_THREAD; - max_threads = HARD_THREAD_LIMIT; - ap_pid_fname = DEFAULT_PIDLOG; - ap_scoreboard_fname = DEFAULT_SCOREBOARD; - lock_fname = DEFAULT_LOCKFILE; - max_requests_per_child = DEFAULT_MAX_REQUESTS_PER_CHILD; - ap_perchild_set_maintain_connection_status(1); - - ap_cpystrn(ap_coredump_dir, ap_server_root, sizeof(ap_coredump_dir)); -} - -static void perchild_hooks(void) -{ - INIT_SIGLIST() - one_process = 0; - - ap_hook_pre_config(perchild_pre_config, NULL, NULL, AP_HOOK_MIDDLE); -} - -static const char *set_pidfile(cmd_parms *cmd, void *dummy, const char *arg) -{ - const char *err = ap_check_cmd_context(cmd, GLOBAL_ONLY); - if (err != NULL) { - return err; - } - - if (cmd->server->is_virtual) { - return "PidFile directive not allowed in "; - } - ap_pid_fname = arg; - return NULL; -} - -static const char *set_scoreboard(cmd_parms *cmd, void *dummy, const char *arg) -{ - const char *err = ap_check_cmd_context(cmd, GLOBAL_ONLY); - if (err != NULL) { - return err; - } - - ap_scoreboard_fname = arg; - return NULL; -} - -static const char *set_lockfile(cmd_parms *cmd, void *dummy, const char *arg) -{ - const char *err = ap_check_cmd_context(cmd, GLOBAL_ONLY); - if (err != NULL) { - return err; - } - - lock_fname = arg; - return NULL; -} -static const char *set_num_daemons (cmd_parms *cmd, void *dummy, const char *arg) -{ - const char *err = ap_check_cmd_context(cmd, GLOBAL_ONLY); - if (err != NULL) { - return err; - } - - num_daemons = atoi(arg); - if (num_daemons > HARD_SERVER_LIMIT) { - ap_log_error(APLOG_MARK, APLOG_STARTUP | APLOG_NOERRNO, 0, NULL, - "WARNING: NumServers of %d exceeds compile time limit " - "of %d servers,", num_daemons, HARD_SERVER_LIMIT); - ap_log_error(APLOG_MARK, APLOG_STARTUP | APLOG_NOERRNO, 0, NULL, - " lowering NumServers to %d. To increase, please " - "see the", HARD_SERVER_LIMIT); - ap_log_error(APLOG_MARK, APLOG_STARTUP | APLOG_NOERRNO, 0, NULL, - " HARD_SERVER_LIMIT define in %s.", - AP_MPM_HARD_LIMITS_FILE); - num_daemons = HARD_SERVER_LIMIT; - } - else if (num_daemons < 1) { - ap_log_error(APLOG_MARK, APLOG_STARTUP | APLOG_NOERRNO, 0, NULL, - "WARNING: Require NumServers > 0, setting to 1"); - num_daemons = 1; - } - return NULL; -} - -static const char *set_threads_to_start (cmd_parms *cmd, void *dummy, const char *arg) -{ - const char *err = ap_check_cmd_context(cmd, GLOBAL_ONLY); - if (err != NULL) { - return err; - } - - threads_to_start = atoi(arg); - if (threads_to_start > HARD_THREAD_LIMIT) { - ap_log_error(APLOG_MARK, APLOG_STARTUP | APLOG_NOERRNO, 0, NULL, - "WARNING: StartThreads of %d exceeds compile time" - " limit of %d threads,", threads_to_start, - HARD_THREAD_LIMIT); - ap_log_error(APLOG_MARK, APLOG_STARTUP | APLOG_NOERRNO, 0, NULL, - " lowering StartThreads to %d. To increase, please" - " see the", HARD_THREAD_LIMIT); - ap_log_error(APLOG_MARK, APLOG_STARTUP | APLOG_NOERRNO, 0, NULL, - " HARD_THREAD_LIMIT define in %s.", - AP_MPM_HARD_LIMITS_FILE); - } - else if (threads_to_start < 1) { - ap_log_error(APLOG_MARK, APLOG_STARTUP | APLOG_NOERRNO, 0, NULL, - "WARNING: Require StartThreads > 0, setting to 1"); - threads_to_start = 1; - } - return NULL; -} - -static const char *set_min_spare_threads(cmd_parms *cmd, void *dummy, const char *arg) -{ - const char *err = ap_check_cmd_context(cmd, GLOBAL_ONLY); - if (err != NULL) { - return err; - } - - min_spare_threads = atoi(arg); - if (min_spare_threads <= 0) { - ap_log_error(APLOG_MARK, APLOG_STARTUP | APLOG_NOERRNO, 0, NULL, - "WARNING: detected MinSpareThreads set to non-positive."); - ap_log_error(APLOG_MARK, APLOG_STARTUP | APLOG_NOERRNO, 0, NULL, - "Resetting to 1 to avoid almost certain Apache failure."); - ap_log_error(APLOG_MARK, APLOG_STARTUP | APLOG_NOERRNO, 0, NULL, - "Please read the documentation."); - min_spare_threads = 1; - } - - return NULL; -} - -static const char *set_max_spare_threads(cmd_parms *cmd, void *dummy, const char *arg) -{ - const char *err = ap_check_cmd_context(cmd, GLOBAL_ONLY); - if (err != NULL) { - return err; - } - - max_spare_threads = atoi(arg); - if (max_spare_threads >= HARD_THREAD_LIMIT) { - ap_log_error(APLOG_MARK, APLOG_STARTUP | APLOG_NOERRNO, 0, NULL, - "WARNING: detected MinSpareThreads set higher than"); - ap_log_error(APLOG_MARK, APLOG_STARTUP | APLOG_NOERRNO, 0, NULL, - "HARD_THREAD_LIMIT. Resetting to %d", HARD_THREAD_LIMIT); - max_spare_threads = HARD_THREAD_LIMIT; - } - return NULL; -} - -static const char *set_max_threads(cmd_parms *cmd, void *dummy, const char *arg) -{ - const char *err = ap_check_cmd_context(cmd, GLOBAL_ONLY); - if (err != NULL) { - return err; - } - - max_threads = atoi(arg); - if (max_threads > HARD_THREAD_LIMIT) { - ap_log_error(APLOG_MARK, APLOG_STARTUP | APLOG_NOERRNO, 0, NULL, - "WARNING: detected MaxThreadsPerChild set higher than"); - ap_log_error(APLOG_MARK, APLOG_STARTUP | APLOG_NOERRNO, 0, NULL, - "HARD_THREAD_LIMIT. Resetting to %d", HARD_THREAD_LIMIT); - max_threads = HARD_THREAD_LIMIT; - } - return NULL; -} - -static const char *set_max_requests(cmd_parms *cmd, void *dummy, const char *arg) -{ - const char *err = ap_check_cmd_context(cmd, GLOBAL_ONLY); - if (err != NULL) { - return err; - } - - max_requests_per_child = atoi(arg); - - return NULL; -} - -static const char *set_maintain_connection_status(cmd_parms *cmd, - void *dummy, int arg) -{ - const char *err = ap_check_cmd_context(cmd, GLOBAL_ONLY); - if (err != NULL) { - return err; - } - - ap_perchild_set_maintain_connection_status(arg != 0); - return NULL; -} - -static const char *set_coredumpdir (cmd_parms *cmd, void *dummy, const char *arg) -{ - ap_finfo_t finfo; - const char *fname; - const char *err = ap_check_cmd_context(cmd, GLOBAL_ONLY); - if (err != NULL) { - return err; - } - - fname = ap_server_root_relative(cmd->pool, arg); - if ((ap_stat(&finfo, fname, cmd->pool) != APR_SUCCESS) || - (finfo.filetype != APR_DIR)) { - return ap_pstrcat(cmd->pool, "CoreDumpDirectory ", fname, - " does not exist or is not a directory", NULL); - } - ap_cpystrn(ap_coredump_dir, fname, sizeof(ap_coredump_dir)); - return NULL; -} -static const char *set_childprocess(cmd_parms *cmd, void *dummy, const char *arg) -{ -} -/* - if (unlink(sconf->sockname) < 0 && - errno != ENOENT) { - ap_log_error(APLOG_MARK, APLOG_ERR, errno, main_server, - "Couldn't unlink unix domain socket %s", - sconf->sockname); - /* just a warning; don't bail out - } - - if ((sd = socket(AF_UNIX, SOCK_STREAM, 0)) < 0) { - ap_log_error(APLOG_MARK, APLOG_ERR, errno, main_server, - "Couldn't create unix domain socket"); - return errno; - } - - memset(&unix_addr, 0, sizeof(unix_addr)); - unix_addr.sun_family = AF_UNIX; - strcpy(unix_addr.sun_path, sconf->sockname); - - omask = umask(0077); /* so that only Apache can use socket - rc = bind(sd, (struct sockaddr *)&unix_addr, sizeof(unix_addr)); -*/ - - - - - - -static const command_rec perchild_cmds[] = { -UNIX_DAEMON_COMMANDS -LISTEN_COMMANDS -AP_INIT_TAKE1("PidFile", set_pidfile, NULL, RSRC_CONF, - "A file for logging the server process ID"), -AP_INIT_TAKE1("ScoreBoardFile", set_scoreboard, NULL, RSRC_CONF, - "A file for Apache to maintain runtime process management information"), -AP_INIT_TAKE1("LockFile", set_lockfile, NULL, RSRC_CONF, - "The lockfile used when Apache needs to lock the accept() call"), -AP_INIT_TAKE1("NumServers", set_num_daemons, NULL, RSRC_CONF, - "Number of children alive at the same time"), -AP_INIT_TAKE1("StartThreads", set_threads_to_start, NULL, RSRC_CONF, - "Number of threads each child creates"), -AP_INIT_TAKE1("MinSpareThreads", set_min_spare_threads, NULL, RSRC_CONF, - "Minimum number of idle threads per child, to handle request spikes"), -AP_INIT_TAKE1("MaxSpareThreads", set_max_spare_threads, NULL, RSRC_CONF, - "Maximum number of idle threads per child"), -AP_INIT_TAKE1("MaxThreadsPerChild", set_max_threads, NULL, RSRC_CONF, - "Maximum number of threads per child"), -AP_INIT_TAKE1("MaxRequestsPerChild", set_max_requests, NULL, RSRC_CONF, - "Maximum number of requests a particular child serves before dying."), -AP_INIT_FLAG("ConnectionStatus", set_maintain_connection_status, NULL, RSRC_CONF, - "Whether or not to maintain status information on current connections"), -AP_INIT_TAKE1("CoreDumpDirectory", set_coredumpdir, NULL, RSRC_CONF, - "The location of the directory Apache changes to before dumping core"), -AP_INIT_TAKE1("ChildProcess", set_childprocess, NULL, RSRC_CONF, - "Which child process is responsible for serving this virtual host"), -{ NULL } -}; - -module MODULE_VAR_EXPORT mpm_perchild_module = { - MPM20_MODULE_STUFF, - NULL, /* hook to run before apache parses args */ - NULL, /* create per-directory config structure */ - NULL, /* merge per-directory config structures */ - NULL, /* create per-server config structure */ - NULL, /* merge per-server config structures */ - perchild_cmds, /* command ap_table_t */ - NULL, /* handlers */ - perchild_hooks /* register_hooks */ -}; - diff --git a/server/mpm/monitoring-services.txt b/server/mpm/monitoring-services.txt deleted file mode 100644 index 24665890257a96be2362363238f635278c40f8ad..0000000000000000000000000000000000000000 --- a/server/mpm/monitoring-services.txt +++ /dev/null @@ -1,94 +0,0 @@ -From: William A. Rowe, Jr. -Date: June 7th '00 -Subject: service monitoring in Apache 1.3.13 - -The concept for a taskbar monitor has been thrown around -for a very long while. 1.3.13 introduced Win9x services, -and that added fuel to the mix. Here are some sideband -observations I've made for other developers... - -About Apache as a console, don't start Apache hidden without -any command line arguments if you want to launch it yourself -in a hidden window (it will do the classic test for -AllocConsole/FreeConsole)... drop in some arguments such as -the -f or -r option and it will fly without thinking it is a -service under 9x and NT. - -Rule two, don't use --ntservice as an argument, ever. Only -the Windows NT Service Control Manager is allowed to pass that -flag, and only that flag, when it runs Apache.exe. Do use ---ntservice as the sole argument to the executable name if -you are installing an Apache NT service yourself. - -Rule three, use -k start and -n name when maintaining the -HKLM/Software/Microsoft/Windows/CurrentVersion/RunServices -list, since there is no other way for Apache to know what -the service is named :) And look at any 9x installed service's -RunServices entry in the registry for the start service semantic. - -Rule four, use the WinNT Service Control Manager exclusively -for starting, stopping and restarting Apache as an NT service. -The restart signal is the value 128, as documented in service.h -and service.c - this will continue to work in Apache 2.0. If -it fails, you are handling an older version (pre 1.3.13) of -Apache, and need to stop and then start the service instead. - -Rule five, use the legacy pid-named events to signal Win9x -service Apache to restart and stop the service. But don't -bother looking for httpd.pid files... you can get the pid -right from the hidden service control window. Apache 1.3.13 -and 2.x create a hidden window named for the name of the -service (without the spaces), with a window class of -"ApacheWin95ServiceMonitor", so can use FindWindow to track -down running Win9x services. See the service.c code for how -I accomplished this pretty simply in the -k stop/-k restart -handler. - -Taskbar Monitor App -------------------- - -Basic requirements: a C code application using strictly the -Win32 API, and not MFC or other Win32 frameworks. Could use -the service.c module to share some basic functions. That -module could be extended in Apache 2.0 to make this all easier. - -I think we are looking for an external app that simply acts -as a monitor or allows a stopped service to be started. If -the user logs off, we loose the monitor app, but installed as -a shortcut in the Start group or in the registry key -HKLM/Software/Microsoft/Windows/CurrentVersion/Run -we will be just fine. I'd like to see the monitor run only -one instance to monitor all running services, for memory -and resource conservation. - -I was thinking that the hover/iconbar title would tell them -"Test service is running", or "Test service is stopped". -If they left click, they could stop or restart, or simply -start if it is stopped. There could be a preference that -each service doesn't get it's own individual task icon unless -it is running, if it is a manual start service (or missing -from the RunServices list, which is the equivilant under 9x). - -If a specific service is set to Auto start or is in the -RunServices Win9x registry key, we must show them the stopped -icon, of course. We might also keep the icon for any running -service that stops abruptly. But there could be a 'single -icon' option for the taskbar icon monitor that says show only -a single status icon, for simplicity if the administrator runs -many Apache services. - -But I was hoping that any right click would provide a menu -of all Apache services with their status. e.g. - Test service is stopped - Apache_2 service is running - MyWeb service is running -and each would do the logical submenu, same as if that -specific taskbar icon were left clicked, offering to start or -offering to stop or restart the server, as appropriate. - -Finally, to identify all installed Apache services, just query -the registry key HKLM\SYSTEM\CurrentControlSet\Services for any -key that has the ImagePath value of "...\Apache.exe"... (quotes -are significant here, if the leading quote is ommitted the -entire string ends with the text \Apache.exe - based on Apache's -own service installer in every released version.) diff --git a/server/mpm/mpmt_os2/.cvsignore b/server/mpm/mpmt_os2/.cvsignore deleted file mode 100644 index dc53ac865db83c80308871e5f66a75349935cd73..0000000000000000000000000000000000000000 --- a/server/mpm/mpmt_os2/.cvsignore +++ /dev/null @@ -1,5 +0,0 @@ -*.lo -*.la -Makefile -.deps -.libs diff --git a/server/mpm/mpmt_os2/Makefile.in b/server/mpm/mpmt_os2/Makefile.in deleted file mode 100644 index 38e598edf3aa14d48e2e271d2122b493215e169a..0000000000000000000000000000000000000000 --- a/server/mpm/mpmt_os2/Makefile.in +++ /dev/null @@ -1,5 +0,0 @@ - -LTLIBRARY_NAME = libmpmt_os2.la -LTLIBRARY_SOURCES = mpmt_os2.c mpmt_os2_child.c - -include $(top_srcdir)/build/ltlib.mk diff --git a/server/mpm/mpmt_os2/config5.m4 b/server/mpm/mpmt_os2/config5.m4 deleted file mode 100644 index b27c296d2a47d3abc22a639d616de441f1a0f308..0000000000000000000000000000000000000000 --- a/server/mpm/mpmt_os2/config5.m4 +++ /dev/null @@ -1,5 +0,0 @@ -if test "$MPM_NAME" = "mpmt_os2" ; then - AC_CACHE_SAVE - APACHE_FAST_OUTPUT(server/mpm/$MPM_NAME/Makefile) - APR_ADDTO(CFLAGS,-Zmt) -fi diff --git a/server/mpm/mpmt_os2/mpm.h b/server/mpm/mpmt_os2/mpm.h deleted file mode 100644 index 37d2f6c20c4ee5186fe55888649d9b521e4df01a..0000000000000000000000000000000000000000 --- a/server/mpm/mpmt_os2/mpm.h +++ /dev/null @@ -1,74 +0,0 @@ -/* ==================================================================== - * The Apache Software License, Version 1.1 - * - * Copyright (c) 2000-2001 The Apache Software Foundation. All rights - * reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in - * the documentation and/or other materials provided with the - * distribution. - * - * 3. The end-user documentation included with the redistribution, - * if any, must include the following acknowledgment: - * "This product includes software developed by the - * Apache Software Foundation (http://www.apache.org/)." - * Alternately, this acknowledgment may appear in the software itself, - * if and wherever such third-party acknowledgments normally appear. - * - * 4. The names "Apache" and "Apache Software Foundation" must - * not be used to endorse or promote products derived from this - * software without prior written permission. For written - * permission, please contact apache@apache.org. - * - * 5. Products derived from this software may not be called "Apache", - * nor may "Apache" appear in their name, without prior written - * permission of the Apache Software Foundation. - * - * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED - * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES - * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR - * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF - * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND - * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, - * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT - * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * ==================================================================== - * - * This software consists of voluntary contributions made by many - * individuals on behalf of the Apache Software Foundation. For more - * information on the Apache Software Foundation, please see - * . - * - * Portions of this software are based upon public domain software - * originally written at the National Center for Supercomputing Applications, - * University of Illinois, Urbana-Champaign. - */ - -#ifndef APACHE_MPM_MPMT_OS2_H -#define APACHE_MPM_MPMT_OS2_H - -#define MPMT_OS2_MPM - -#include "httpd.h" -#include "mpm_default.h" -#include "scoreboard.h" - -#define MPM_NAME "MPMT_OS2" - -extern server_rec *ap_server_conf; -#define AP_MPM_WANT_SET_PIDFILE -#define AP_MPM_WANT_SET_MAX_REQUESTS - -#endif /* APACHE_MPM_SPMT_OS2_H */ diff --git a/server/mpm/mpmt_os2/mpm_default.h b/server/mpm/mpmt_os2/mpm_default.h deleted file mode 100644 index 100beb2e61f94632574a23a679f9b8a0be537a5e..0000000000000000000000000000000000000000 --- a/server/mpm/mpmt_os2/mpm_default.h +++ /dev/null @@ -1,116 +0,0 @@ -/* ==================================================================== - * The Apache Software License, Version 1.1 - * - * Copyright (c) 2000-2001 The Apache Software Foundation. All rights - * reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in - * the documentation and/or other materials provided with the - * distribution. - * - * 3. The end-user documentation included with the redistribution, - * if any, must include the following acknowledgment: - * "This product includes software developed by the - * Apache Software Foundation (http://www.apache.org/)." - * Alternately, this acknowledgment may appear in the software itself, - * if and wherever such third-party acknowledgments normally appear. - * - * 4. The names "Apache" and "Apache Software Foundation" must - * not be used to endorse or promote products derived from this - * software without prior written permission. For written - * permission, please contact apache@apache.org. - * - * 5. Products derived from this software may not be called "Apache", - * nor may "Apache" appear in their name, without prior written - * permission of the Apache Software Foundation. - * - * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED - * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES - * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR - * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF - * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND - * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, - * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT - * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * ==================================================================== - * - * This software consists of voluntary contributions made by many - * individuals on behalf of the Apache Software Foundation. For more - * information on the Apache Software Foundation, please see - * . - * - * Portions of this software are based upon public domain software - * originally written at the National Center for Supercomputing Applications, - * University of Illinois, Urbana-Champaign. - */ - -#ifndef APACHE_MPM_DEFAULT_H -#define APACHE_MPM_DEFAULT_H - -/* Number of servers processes to spawn off by default - */ -#ifndef DEFAULT_START_DAEMON -#define DEFAULT_START_DAEMON 2 -#endif - -/* We don't need many processes, - * they're only for redundancy in the event of a crash - */ -#define HARD_SERVER_LIMIT 10 - -/* Limit on the total number of threads per process - */ -#ifndef HARD_THREAD_LIMIT -#define HARD_THREAD_LIMIT 256 -#endif - -/* Maximum number of *free* server threads --- more than this, and - * they will die off. - */ - -#ifndef DEFAULT_MAX_SPARE_THREAD -#define DEFAULT_MAX_SPARE_THREAD 10 -#endif - -/* Minimum --- fewer than this, and more will be created */ - -#ifndef DEFAULT_MIN_SPARE_THREAD -#define DEFAULT_MIN_SPARE_THREAD 5 -#endif - -/* Where the main/parent process's pid is logged */ -#ifndef DEFAULT_PIDLOG -#define DEFAULT_PIDLOG "logs/httpd.pid" -#endif - -/* - * Interval, in microseconds, between scoreboard maintenance. - */ -#ifndef SCOREBOARD_MAINTENANCE_INTERVAL -#define SCOREBOARD_MAINTENANCE_INTERVAL 1000000 -#endif - -/* Number of requests to try to handle in a single process. If <= 0, - * the children don't die off. - */ -#ifndef DEFAULT_MAX_REQUESTS_PER_CHILD -#define DEFAULT_MAX_REQUESTS_PER_CHILD 10000 -#endif - -/* AP_CHILD_THREAD_FROM_ID is used by the scoreboard. */ -#define AP_CHILD_THREAD_FROM_ID(i) (i / HARD_THREAD_LIMIT), (i % HARD_THREAD_LIMIT) -#define AP_ID_FROM_CHILD_THREAD(c, t) ((c * HARD_THREAD_LIMIT) + t) - -#endif /* AP_MPM_DEFAULT_H */ diff --git a/server/mpm/mpmt_os2/mpmt_os2.c b/server/mpm/mpmt_os2/mpmt_os2.c deleted file mode 100644 index 99806d1c8eb48c6ca3239d404005d08b574bb43d..0000000000000000000000000000000000000000 --- a/server/mpm/mpmt_os2/mpmt_os2.c +++ /dev/null @@ -1,587 +0,0 @@ -/* ==================================================================== - * The Apache Software License, Version 1.1 - * - * Copyright (c) 2000-2001 The Apache Software Foundation. All rights - * reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in - * the documentation and/or other materials provided with the - * distribution. - * - * 3. The end-user documentation included with the redistribution, - * if any, must include the following acknowledgment: - * "This product includes software developed by the - * Apache Software Foundation (http://www.apache.org/)." - * Alternately, this acknowledgment may appear in the software itself, - * if and wherever such third-party acknowledgments normally appear. - * - * 4. The names "Apache" and "Apache Software Foundation" must - * not be used to endorse or promote products derived from this - * software without prior written permission. For written - * permission, please contact apache@apache.org. - * - * 5. Products derived from this software may not be called "Apache", - * nor may "Apache" appear in their name, without prior written - * permission of the Apache Software Foundation. - * - * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED - * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES - * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR - * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF - * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND - * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, - * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT - * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * ==================================================================== - * - * This software consists of voluntary contributions made by many - * individuals on behalf of the Apache Software Foundation. For more - * information on the Apache Software Foundation, please see - * . - * - * Portions of this software are based upon public domain software - * originally written at the National Center for Supercomputing Applications, - * University of Illinois, Urbana-Champaign. - */ - -/* Multi-process, multi-threaded MPM for OS/2 - * - * Server consists of - * - a main, parent process - * - a small, static number of child processes - * - * The parent process's job is to manage the child processes. This involves - * spawning children as required to ensure there are always ap_daemons_to_start - * processes accepting connections. - * - * Each child process consists of a a pool of worker threads and a - * main thread that accepts connections & passes them to the workers via - * a work queue. The worker thread pool is dynamic, managed by a maintanence - * thread so that the number of idle threads is kept between - * min_spare_threads & max_spare_threads. - * - */ - -/* - Todo list - - Fix log file clashing between child processes - - Enforce MaxClients somehow - - Catch thread exceptions & initiate graceful shutdown of child process -*/ -#define CORE_PRIVATE -#define INCL_NOPMAPI -#define INCL_DOS -#define INCL_DOSERRORS - -#include "ap_config.h" -#include "httpd.h" -#include "mpm_default.h" -#include "http_main.h" -#include "http_log.h" -#include "http_config.h" -#include "http_core.h" /* for get_remote_host */ -#include "http_connection.h" -#include "mpm.h" -#include "ap_mpm.h" -#include "ap_listen.h" -#include "apr_portable.h" -#include "mpm_common.h" -#include "apr_strings.h" -#include -#include - -server_rec *ap_server_conf; -static apr_pool_t *pconf = NULL; /* Pool for config stuff */ -static const char *ap_pid_fname=NULL; - -/* Config globals */ -static int one_process = 0; -static int ap_daemons_to_start = 0; -static int ap_thread_limit = 0; -static int ap_max_requests_per_child = 0; -int ap_min_spare_threads = 0; -int ap_max_spare_threads = 0; - -/* Keep track of a few interesting statistics */ -int ap_max_daemons_limit = -1; - -/* volatile just in case */ -static int volatile shutdown_pending; -static int volatile restart_pending; -static int volatile is_graceful = 0; -ap_generation_t volatile ap_my_generation=0; /* Used by the scoreboard */ -static int is_parent_process=TRUE; -HMTX ap_mpm_accept_mutex = 0; - -/* An array of these is stored in a shared memory area for passing - * sockets from the parent to child processes - */ -typedef struct { - struct sockaddr_in name; - apr_os_sock_t listen_fd; -} listen_socket_t; - -typedef struct { - apr_os_file_t errorlog_fd; - apr_time_t restart_time; - HMTX accept_mutex; - listen_socket_t listeners[1]; -} parent_info_t; - -static char master_main(); -static void spawn_child(int slot); -void ap_mpm_child_main(apr_pool_t *pconf); -static void set_signals(); - - -int ap_mpm_run(apr_pool_t *_pconf, apr_pool_t *plog, server_rec *s ) -{ - char *listener_shm_name; - parent_info_t *parent_info; - ULONG rc; - pconf = _pconf; - ap_server_conf = s; - restart_pending = 0; - - DosSetMaxFH(ap_thread_limit * 2); - listener_shm_name = apr_psprintf(pconf, "/sharemem/httpd/parent_info.%d", getppid()); - rc = DosGetNamedSharedMem((PPVOID)&parent_info, listener_shm_name, PAG_READ); - is_parent_process = rc != 0; - ap_scoreboard_fname = apr_psprintf(pconf, "/sharemem/httpd/scoreboard.%d", is_parent_process ? getpid() : getppid()); - - if (rc == 0) { - /* Child process */ - ap_listen_rec *lr; - int num_listeners = 0; - - apr_file_close(ap_server_conf->error_log); - apr_os_file_put(&ap_server_conf->error_log, &parent_info->errorlog_fd, pconf); - ap_restart_time = parent_info->restart_time; - ap_mpm_accept_mutex = parent_info->accept_mutex; - - /* Set up a default listener if necessary */ - if (ap_listeners == NULL) { - ap_listen_rec *lr = apr_pcalloc(s->process->pool, sizeof(ap_listen_rec)); - ap_listeners = lr; - apr_sockaddr_info_get(&lr->bind_addr, "0.0.0.0", APR_UNSPEC, - DEFAULT_HTTP_PORT, 0, s->process->pool); - apr_socket_create(&lr->sd, lr->bind_addr->sa.sin.sin_family, - SOCK_STREAM, s->process->pool); - } - - for (lr = ap_listeners; lr; lr = lr->next) { - apr_os_sock_put(&lr->sd, &parent_info->listeners[num_listeners].listen_fd, pconf); - num_listeners++; - } - - DosFreeMem(parent_info); - - /* Do the work */ - ap_mpm_child_main(pconf); - - /* Outta here */ - return 1; - } - else { - /* Parent process */ - char restart; - is_parent_process = TRUE; - ap_log_pid(pconf, ap_pid_fname); - - if (ap_setup_listeners(ap_server_conf) < 1) { - ap_log_error(APLOG_MARK, APLOG_NOERRNO|APLOG_ALERT, 0, s, - "no listening sockets available, shutting down"); - return 1; - } - - restart = master_main(); - ++ap_my_generation; - ap_scoreboard_image->global.running_generation = ap_my_generation; - - if (!restart) { - const char *pidfile = ap_server_root_relative(pconf, ap_pid_fname); - - if (pidfile != NULL && remove(pidfile) == 0) { - ap_log_error(APLOG_MARK, APLOG_NOERRNO|APLOG_INFO, APR_SUCCESS, - ap_server_conf, "removed PID file %s (pid=%d)", - pidfile, getpid()); - } - - ap_log_error(APLOG_MARK, APLOG_NOERRNO|APLOG_NOTICE, 0, ap_server_conf, - "caught SIGTERM, shutting down"); - return 1; - } - } /* Parent process */ - - return 0; /* Restart */ -} - - - -/* Main processing of the parent process - * returns TRUE if restarting - */ -static char master_main() -{ - server_rec *s = ap_server_conf; - ap_listen_rec *lr; - parent_info_t *parent_info; - char *listener_shm_name; - int listener_num, num_listeners, slot; - ULONG rc; - - printf("%s \n", ap_get_server_version()); - set_signals(); - - if (ap_setup_listeners(ap_server_conf) < 1) { - ap_log_error(APLOG_MARK, APLOG_NOERRNO|APLOG_ALERT, 0, s, - "no listening sockets available, shutting down"); - return FALSE; - } - - /* Allocate a shared memory block for the array of listeners */ - for (num_listeners = 0, lr = ap_listeners; lr; lr = lr->next) { - num_listeners++; - } - - listener_shm_name = apr_psprintf(pconf, "/sharemem/httpd/parent_info.%d", getpid()); - rc = DosAllocSharedMem((PPVOID)&parent_info, listener_shm_name, - sizeof(parent_info_t) + num_listeners * sizeof(listen_socket_t), - PAG_READ|PAG_WRITE|PAG_COMMIT); - - if (rc) { - ap_log_error(APLOG_MARK, APLOG_ALERT, APR_FROM_OS_ERROR(rc), s, - "failure allocating shared memory, shutting down"); - return FALSE; - } - - /* Store the listener sockets in the shared memory area for our children to see */ - for (listener_num = 0, lr = ap_listeners; lr; lr = lr->next, listener_num++) { - apr_os_sock_get(&parent_info->listeners[listener_num].listen_fd, lr->sd); - } - - /* Create mutex to prevent multiple child processes from detecting - * a connection with apr_poll() - */ - - rc = DosCreateMutexSem(NULL, &ap_mpm_accept_mutex, DC_SEM_SHARED, FALSE); - - if (rc) { - ap_log_error(APLOG_MARK, APLOG_ALERT, APR_FROM_OS_ERROR(rc), s, - "failure creating accept mutex, shutting down"); - return FALSE; - } - - ap_restart_time = apr_time_now(); - parent_info->restart_time = ap_restart_time; - parent_info->accept_mutex = ap_mpm_accept_mutex; - apr_os_file_get(&parent_info->errorlog_fd, s->error_log); - - /* Allocate shared memory for scoreboard */ - if (ap_scoreboard_image == NULL) { - rc = DosAllocSharedMem((PPVOID)&ap_scoreboard_image, ap_scoreboard_fname, - sizeof(scoreboard), PAG_COMMIT|PAG_READ|PAG_WRITE); - - if (rc) { - ap_log_error(APLOG_MARK, APLOG_ERR, APR_FROM_OS_ERROR(rc), ap_server_conf, - "unable to allocate shared memory for scoreboard , exiting"); - return FALSE; - } - - memset(ap_scoreboard_image, 0, sizeof(scoreboard)); - } - - ap_log_error(APLOG_MARK, APLOG_NOERRNO|APLOG_NOTICE, 0, ap_server_conf, - "%s configured -- resuming normal operations", - ap_get_server_version()); - ap_log_error(APLOG_MARK, APLOG_NOERRNO|APLOG_INFO, 0, ap_server_conf, - "Server built: %s", ap_get_server_built()); - - if (one_process) { - ap_scoreboard_image->parent[0].pid = getpid(); - ap_mpm_child_main(pconf); - return FALSE; - } - - while (!restart_pending && !shutdown_pending) { - RESULTCODES proc_rc; - PID child_pid; - int active_children = 0; - - /* Count number of active children */ - for (slot=0; slot < HARD_SERVER_LIMIT; slot++) { - active_children += ap_scoreboard_image->parent[slot].pid != 0 && - !ap_scoreboard_image->parent[slot].quiescing; - } - - /* Spawn children if needed */ - for (slot=0; slot < HARD_SERVER_LIMIT && active_children < ap_daemons_to_start; slot++) { - if (ap_scoreboard_image->parent[slot].pid == 0) { - spawn_child(slot); - active_children++; - } - } - - rc = DosWaitChild(DCWA_PROCESSTREE, DCWW_NOWAIT, &proc_rc, &child_pid, 0); - - if (rc == 0) { - /* A child has terminated, remove its scoreboard entry & terminate if necessary */ - for (slot=0; ap_scoreboard_image->parent[slot].pid != child_pid && slot < HARD_SERVER_LIMIT; slot++); - - if (slot < HARD_SERVER_LIMIT) { - ap_scoreboard_image->parent[slot].pid = 0; - ap_scoreboard_image->parent[slot].quiescing = 0; - - if (proc_rc.codeTerminate == TC_EXIT) { - /* Child terminated normally, check its exit code and - * terminate server if child indicates a fatal error - */ - if (proc_rc.codeResult == APEXIT_CHILDFATAL) - break; - } - } - } else if (rc == ERROR_CHILD_NOT_COMPLETE) { - /* No child exited, lets sleep for a while.... */ - apr_sleep(SCOREBOARD_MAINTENANCE_INTERVAL); - } - } - - /* Signal children to shut down, either gracefully or immediately */ - for (slot=0; slotparent[slot].pid, is_graceful ? SIGHUP : SIGTERM); - } - - DosFreeMem(parent_info); - return restart_pending; -} - - - -static void spawn_child(int slot) -{ - PPIB ppib; - PTIB ptib; - char fail_module[100]; - char progname[CCHMAXPATH]; - RESULTCODES proc_rc; - ULONG rc; - - ap_scoreboard_image->parent[slot].generation = ap_my_generation; - DosGetInfoBlocks(&ptib, &ppib); - DosQueryModuleName(ppib->pib_hmte, sizeof(progname), progname); - rc = DosExecPgm(fail_module, sizeof(fail_module), EXEC_ASYNCRESULT, - ppib->pib_pchcmd, NULL, &proc_rc, progname); - - if (rc) { - ap_log_error(APLOG_MARK, APLOG_ERR, APR_FROM_OS_ERROR(rc), ap_server_conf, - "error spawning child, slot %d", slot); - } - - if (ap_max_daemons_limit < slot) { - ap_max_daemons_limit = slot; - } - - ap_scoreboard_image->parent[slot].pid = proc_rc.codeTerminate; -} - - - -/* Signal handling routines */ - -static void sig_term(int sig) -{ - shutdown_pending = 1; -} - - - -static void sig_restart(int sig) -{ - if (sig == SIGUSR1) { - is_graceful = 1; - } - - restart_pending = 1; -} - - - -static void set_signals() -{ - struct sigaction sa; - - sigemptyset(&sa.sa_mask); - sa.sa_flags = 0; - sa.sa_handler = sig_term; - - if (sigaction(SIGTERM, &sa, NULL) < 0) - ap_log_error(APLOG_MARK, APLOG_WARNING, errno, ap_server_conf, "sigaction(SIGTERM)"); - - if (sigaction(SIGINT, &sa, NULL) < 0) - ap_log_error(APLOG_MARK, APLOG_WARNING, errno, ap_server_conf, "sigaction(SIGINT)"); - - sa.sa_handler = sig_restart; - - if (sigaction(SIGHUP, &sa, NULL) < 0) - ap_log_error(APLOG_MARK, APLOG_WARNING, errno, ap_server_conf, "sigaction(SIGHUP)"); - if (sigaction(SIGUSR1, &sa, NULL) < 0) - ap_log_error(APLOG_MARK, APLOG_WARNING, errno, ap_server_conf, "sigaction(SIGUSR1)"); -} - - - -/* Enquiry functions used get MPM status info */ - -AP_DECLARE(apr_status_t) ap_mpm_query(int query_code, int *result) -{ - switch (query_code) { - case AP_MPMQ_MAX_DAEMON_USED: - *result = ap_max_daemons_limit; - return APR_SUCCESS; - case AP_MPMQ_IS_THREADED: - *result = AP_MPMQ_DYNAMIC; - return APR_SUCCESS; - case AP_MPMQ_IS_FORKED: - *result = AP_MPMQ_NOT_SUPPORTED; - return APR_SUCCESS; - case AP_MPMQ_HARD_LIMIT_DAEMONS: - *result = HARD_SERVER_LIMIT; - return APR_SUCCESS; - case AP_MPMQ_HARD_LIMIT_THREADS: - *result = HARD_THREAD_LIMIT; - return APR_SUCCESS; - case AP_MPMQ_MIN_SPARE_DEAMONS: - *result = 0; - return APR_SUCCESS; - case AP_MPMQ_MAX_SPARE_DAEMONS: - *result = 0; - return APR_SUCCESS; - case AP_MPMQ_MAX_REQUESTS_DEAMON: - *result = ap_max_requests_per_child; - return APR_SUCCESS; - } - return APR_ENOTIMPL; -} - - - -int ap_graceful_stop_signalled(void) -{ - return is_graceful; -} - - - -/* Configuration handling stuff */ - -static void mpmt_os2_pre_config(apr_pool_t *pconf, apr_pool_t *plog, apr_pool_t *ptemp) -{ - one_process = !!ap_exists_config_define("ONE_PROCESS"); - is_graceful = 0; - ap_listen_pre_config(); - ap_daemons_to_start = DEFAULT_START_DAEMON; - ap_thread_limit = HARD_THREAD_LIMIT; - ap_pid_fname = DEFAULT_PIDLOG; - ap_max_requests_per_child = DEFAULT_MAX_REQUESTS_PER_CHILD; - ap_extended_status = 0; - ap_min_spare_threads = DEFAULT_MIN_SPARE_THREAD; - ap_max_spare_threads = DEFAULT_MAX_SPARE_THREAD; -} - - - -static void mpmt_os2_hooks(apr_pool_t *p) -{ - ap_hook_pre_config(mpmt_os2_pre_config, NULL, NULL, APR_HOOK_MIDDLE); -} - - - -static const char *set_daemons_to_start(cmd_parms *cmd, void *dummy, const char *arg) -{ - const char *err = ap_check_cmd_context(cmd, GLOBAL_ONLY); - - if (err != NULL) { - return err; - } - - ap_daemons_to_start = atoi(arg); - return NULL; -} - - - -static const char *set_min_spare_threads(cmd_parms *cmd, void *dummy, - const char *arg) -{ - const char *err = ap_check_cmd_context(cmd, GLOBAL_ONLY); - - if (err != NULL) { - return err; - } - - ap_min_spare_threads = atoi(arg); - - if (ap_min_spare_threads <= 0) { - ap_log_error(APLOG_MARK, APLOG_STARTUP | APLOG_NOERRNO, 0, NULL, - "WARNING: detected MinSpareThreads set to non-positive."); - ap_log_error(APLOG_MARK, APLOG_STARTUP | APLOG_NOERRNO, 0, NULL, - "Resetting to 1 to avoid almost certain Apache failure."); - ap_log_error(APLOG_MARK, APLOG_STARTUP | APLOG_NOERRNO, 0, NULL, - "Please read the documentation."); - ap_min_spare_threads = 1; - } - - return NULL; -} - - - -static const char *set_max_spare_threads(cmd_parms *cmd, void *dummy, - const char *arg) -{ - const char *err = ap_check_cmd_context(cmd, GLOBAL_ONLY); - - if (err != NULL) { - return err; - } - - ap_max_spare_threads = atoi(arg); - return NULL; -} - - - -static const command_rec mpmt_os2_cmds[] = { -LISTEN_COMMANDS -AP_INIT_TAKE1( "StartServers", set_daemons_to_start, NULL, RSRC_CONF, - "Number of child processes launched at server startup" ), -AP_INIT_TAKE1("MinSpareThreads", set_min_spare_threads, NULL, RSRC_CONF, - "Minimum number of idle children, to handle request spikes"), -AP_INIT_TAKE1("MaxSpareThreads", set_max_spare_threads, NULL, RSRC_CONF, - "Maximum number of idle children"), -{ NULL } -}; - -module AP_MODULE_DECLARE_DATA mpm_mpmt_os2_module = { - MPM20_MODULE_STUFF, - NULL, /* hook to run before apache parses args */ - NULL, /* create per-directory config structure */ - NULL, /* merge per-directory config structures */ - NULL, /* create per-server config structure */ - NULL, /* merge per-server config structures */ - mpmt_os2_cmds, /* command apr_table_t */ - mpmt_os2_hooks, /* register_hooks */ -}; diff --git a/server/mpm/mpmt_os2/mpmt_os2_child.c b/server/mpm/mpmt_os2/mpmt_os2_child.c deleted file mode 100644 index 36a96ca939c616a4ec58d064ba6fd719881c9faf..0000000000000000000000000000000000000000 --- a/server/mpm/mpmt_os2/mpmt_os2_child.c +++ /dev/null @@ -1,463 +0,0 @@ -/* ==================================================================== - * The Apache Software License, Version 1.1 - * - * Copyright (c) 2000-2001 The Apache Software Foundation. All rights - * reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in - * the documentation and/or other materials provided with the - * distribution. - * - * 3. The end-user documentation included with the redistribution, - * if any, must include the following acknowledgment: - * "This product includes software developed by the - * Apache Software Foundation (http://www.apache.org/)." - * Alternately, this acknowledgment may appear in the software itself, - * if and wherever such third-party acknowledgments normally appear. - * - * 4. The names "Apache" and "Apache Software Foundation" must - * not be used to endorse or promote products derived from this - * software without prior written permission. For written - * permission, please contact apache@apache.org. - * - * 5. Products derived from this software may not be called "Apache", - * nor may "Apache" appear in their name, without prior written - * permission of the Apache Software Foundation. - * - * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED - * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES - * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR - * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF - * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND - * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, - * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT - * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * ==================================================================== - * - * This software consists of voluntary contributions made by many - * individuals on behalf of the Apache Software Foundation. For more - * information on the Apache Software Foundation, please see - * . - * - * Portions of this software are based upon public domain software - * originally written at the National Center for Supercomputing Applications, - * University of Illinois, Urbana-Champaign. - */ - -#define CORE_PRIVATE -#define INCL_NOPMAPI -#define INCL_DOS -#define INCL_DOSERRORS - -#include "ap_config.h" -#include "httpd.h" -#include "mpm_default.h" -#include "http_main.h" -#include "http_log.h" -#include "http_config.h" -#include "http_core.h" /* for get_remote_host */ -#include "http_connection.h" -#include "mpm.h" -#include "ap_mpm.h" -#include "ap_listen.h" -#include "apr_portable.h" -#include "mpm_common.h" -#include "apr_strings.h" -#include -#include - -typedef struct { - apr_pool_t *pconn; - apr_socket_t *conn_sd; -} worker_args_t; - -#define WORKTYPE_CONN 0 -#define WORKTYPE_EXIT 1 - -static apr_pool_t *pchild = NULL; -static int child_slot; -static int shutdown_pending = 0; -extern int ap_my_generation; -static int volatile is_graceful = 1; -HEV shutdown_event; /* signaled when this child is shutting down */ - -/* grab some MPM globals */ -extern int ap_min_spare_threads; -extern int ap_max_spare_threads; -extern HMTX ap_mpm_accept_mutex; - -static void worker_main(void *vpArg); -static void clean_child_exit(int code); -static void set_signals(); -static void server_maintenance(void *vpArg); - - -static void clean_child_exit(int code) -{ - if (pchild) { - apr_pool_destroy(pchild); - } - - exit(code); -} - - - -void ap_mpm_child_main(apr_pool_t *pconf) -{ - ap_listen_rec *lr = NULL; - ap_listen_rec *first_lr = NULL; - int requests_this_child = 0; - apr_socket_t *sd = ap_listeners->sd; - int nsds, rv = 0; - unsigned long ulTimes; - int my_pid = getpid(); - ULONG rc, c; - HQUEUE workq; - apr_pollfd_t *pollset; - int num_listeners; - TID server_maint_tid; - - /* Stop Ctrl-C/Ctrl-Break signals going to child processes */ - DosSetSignalExceptionFocus(0, &ulTimes); - set_signals(); - - /* Create pool for child */ - apr_pool_create(&pchild, pconf); - - /* Create an event semaphore used to trigger other threads to shutdown */ - rc = DosCreateEventSem(NULL, &shutdown_event, 0, FALSE); - - if (rc) { - ap_log_error(APLOG_MARK, APLOG_ERR, APR_FROM_OS_ERROR(rc), ap_server_conf, - "unable to create shutdown semaphore, exiting"); - clean_child_exit(APEXIT_CHILDFATAL); - } - - /* Gain access to the scoreboard. */ - rc = DosGetNamedSharedMem((PPVOID)&ap_scoreboard_image, ap_scoreboard_fname, - PAG_READ|PAG_WRITE); - - if (rc) { - ap_log_error(APLOG_MARK, APLOG_ERR, APR_FROM_OS_ERROR(rc), ap_server_conf, - "scoreboard not readable in child, exiting"); - clean_child_exit(APEXIT_CHILDFATAL); - } - - /* Gain access to the accpet mutex */ - rc = DosOpenMutexSem(NULL, &ap_mpm_accept_mutex); - - if (rc) { - ap_log_error(APLOG_MARK, APLOG_ERR, APR_FROM_OS_ERROR(rc), ap_server_conf, - "accept mutex couldn't be accessed in child, exiting"); - clean_child_exit(APEXIT_CHILDFATAL); - } - - /* Find our pid in the scoreboard so we know what slot our parent allocated us */ - for (child_slot = 0; ap_scoreboard_image->parent[child_slot].pid != my_pid && child_slot < HARD_SERVER_LIMIT; child_slot++); - - if (child_slot == HARD_SERVER_LIMIT) { - ap_log_error(APLOG_MARK, APLOG_ERR|APLOG_NOERRNO, 0, ap_server_conf, - "child pid not found in scoreboard, exiting"); - clean_child_exit(APEXIT_CHILDFATAL); - } - - ap_my_generation = ap_scoreboard_image->parent[child_slot].generation; - - /* Set up an OS/2 queue for passing connections & termination requests - * to worker threads - */ - rc = DosCreateQueue(&workq, QUE_FIFO, apr_psprintf(pchild, "/queues/httpd/work.%d", my_pid)); - - if (rc) { - ap_log_error(APLOG_MARK, APLOG_ERR, APR_FROM_OS_ERROR(rc), ap_server_conf, - "unable to create work queue, exiting"); - clean_child_exit(APEXIT_CHILDFATAL); - } - - /* Create initial pool of worker threads */ - for (c = 0; c < ap_min_spare_threads; c++) { -// ap_scoreboard_image->servers[child_slot][c].tid = _beginthread(worker_main, NULL, 128*1024, (void *)c); - } - - /* Start maintenance thread */ - server_maint_tid = _beginthread(server_maintenance, NULL, 32768, NULL); - - /* Set up poll */ - for (num_listeners = 0, lr = ap_listeners; lr; lr = lr->next) { - num_listeners++; - } - - apr_poll_setup(&pollset, num_listeners, pchild); - - for (lr = ap_listeners; lr; lr = lr->next) { - apr_poll_socket_add(pollset, lr->sd, APR_POLLIN); - } - - /* Main connection accept loop */ - do { - apr_pool_t *pconn; - worker_args_t *worker_args; - - apr_pool_create(&pconn, pchild); - worker_args = apr_palloc(pconn, sizeof(worker_args_t)); - worker_args->pconn = pconn; - - if (num_listeners == 1) { - rv = apr_accept(&worker_args->conn_sd, ap_listeners->sd, pconn); - } else { - rc = DosRequestMutexSem(ap_mpm_accept_mutex, SEM_INDEFINITE_WAIT); - - if (shutdown_pending) { - DosReleaseMutexSem(ap_mpm_accept_mutex); - break; - } - - rv = APR_FROM_OS_ERROR(rc); - - if (rv == APR_SUCCESS) { - rv = apr_poll(pollset, &nsds, -1); - DosReleaseMutexSem(ap_mpm_accept_mutex); - } - - if (rv == APR_SUCCESS) { - if (first_lr == NULL) { - first_lr = ap_listeners; - } - - lr = first_lr; - - do { - apr_int16_t event; - - apr_poll_revents_get(&event, lr->sd, pollset); - - if (event == APR_POLLIN) { - apr_sockaddr_t *sa; - apr_port_t port; - apr_socket_addr_get(&sa, APR_LOCAL, lr->sd); - apr_sockaddr_port_get(&port, sa); - first_lr = lr->next; - break; - } - lr = lr->next; - - if (!lr) { - lr = ap_listeners; - } - } while (lr != first_lr); - - if (lr == first_lr) { - continue; - } - - sd = lr->sd; - rv = apr_accept(&worker_args->conn_sd, sd, pconn); - } - } - - if (rv != APR_SUCCESS) { - if (!APR_STATUS_IS_EINTR(rv)) { - ap_log_error(APLOG_MARK, APLOG_ERR, rv, ap_server_conf, - "apr_accept"); - clean_child_exit(APEXIT_CHILDFATAL); - } - } else { - DosWriteQueue(workq, WORKTYPE_CONN, sizeof(worker_args_t), worker_args, 0); - requests_this_child++; - } - - if (ap_max_requests_per_child != 0 && requests_this_child >= ap_max_requests_per_child) - break; - } while (!shutdown_pending && ap_my_generation == ap_scoreboard_image->global.running_generation); - - ap_scoreboard_image->parent[child_slot].quiescing = 1; - DosPostEventSem(shutdown_event); - DosWaitThread(&server_maint_tid, DCWW_WAIT); - - if (is_graceful) { - char someleft; - - /* tell our worker threads to exit */ - for (c=0; cservers[child_slot][c].status != SERVER_DEAD) { - DosWriteQueue(workq, WORKTYPE_EXIT, 0, NULL, 0); - } - } - - do { - someleft = 0; - - for (c=0; cservers[child_slot][c].status != SERVER_DEAD) { - someleft = 1; - DosSleep(1000); - break; - } - } - } while (someleft); - } else { - DosPurgeQueue(workq); - - for (c=0; cservers[child_slot][c].status != SERVER_DEAD) { - DosKillThread(ap_scoreboard_image->servers[child_slot][c].tid); - } - } - } - - apr_pool_destroy(pchild); -} - - - -void add_worker() -{ - int thread_slot; - - /* Find a free thread slot */ - for (thread_slot=0; thread_slot < HARD_THREAD_LIMIT; thread_slot++) { - if (ap_scoreboard_image->servers[child_slot][thread_slot].status == SERVER_DEAD) { - ap_scoreboard_image->servers[child_slot][thread_slot].status = SERVER_STARTING; - ap_scoreboard_image->servers[child_slot][thread_slot].tid = - _beginthread(worker_main, NULL, 128*1024, (void *)thread_slot); - break; - } - } -} - - - -static void worker_main(void *vpArg) -{ - long conn_id; - conn_rec *current_conn; - apr_pool_t *pconn; - worker_args_t *worker_args; - HQUEUE workq; - PID owner; - int rc; - REQUESTDATA rd; - ULONG len; - BYTE priority; - int thread_slot = (int)vpArg; - - rc = DosOpenQueue(&owner, &workq, - apr_psprintf(pchild, "/queues/httpd/work.%d", getpid())); - - if (rc) { - ap_log_error(APLOG_MARK, APLOG_ERR, APR_FROM_OS_ERROR(rc), ap_server_conf, - "unable to open work queue, exiting"); - ap_scoreboard_image->servers[child_slot][thread_slot].tid = 0; - } - - conn_id = AP_ID_FROM_CHILD_THREAD(child_slot, thread_slot); - ap_update_child_status(child_slot, thread_slot, SERVER_READY, NULL); - - while (rc = DosReadQueue(workq, &rd, &len, (PPVOID)&worker_args, 0, DCWW_WAIT, &priority, NULLHANDLE), - rc == 0 && rd.ulData != WORKTYPE_EXIT) { - pconn = worker_args->pconn; - ap_sock_disable_nagle(worker_args->conn_sd); - current_conn = ap_new_connection(pconn, ap_server_conf, worker_args->conn_sd, conn_id); - - if (current_conn) { - ap_process_connection(current_conn); - ap_lingering_close(current_conn); - } - - apr_pool_destroy(pconn); - ap_update_child_status(child_slot, thread_slot, SERVER_READY, NULL); - } - - ap_update_child_status(child_slot, thread_slot, SERVER_DEAD, NULL); -} - - - -static void server_maintenance(void *vpArg) -{ - int num_idle, num_needed; - ULONG num_pending = 0; - int threadnum; - HQUEUE workq; - ULONG rc; - PID owner; - - rc = DosOpenQueue(&owner, &workq, - apr_psprintf(pchild, "/queues/httpd/work.%d", getpid())); - - if (rc) { - ap_log_error(APLOG_MARK, APLOG_ERR, APR_FROM_OS_ERROR(rc), ap_server_conf, - "unable to open work queue in maintenance thread"); - return; - } - - do { - for (num_idle=0, threadnum=0; threadnum < HARD_THREAD_LIMIT; threadnum++) { - num_idle += ap_scoreboard_image->servers[child_slot][threadnum].status == SERVER_READY; - } - - DosQueryQueue(workq, &num_pending); - num_needed = ap_min_spare_threads - num_idle + num_pending; - - if (num_needed > 0) { - for (threadnum=0; threadnum < num_needed; threadnum++) { - add_worker(); - } - } - - if (num_idle - num_pending > ap_max_spare_threads) { - DosWriteQueue(workq, WORKTYPE_EXIT, 0, NULL, 0); - } - } while (DosWaitEventSem(shutdown_event, 500) == ERROR_TIMEOUT); -} - - - -/* Signal handling routines */ - -static void sig_term(int sig) -{ - shutdown_pending = 1; - is_graceful = 0; - signal(SIGTERM, SIG_DFL); -} - - - -static void sig_hup(int sig) -{ - shutdown_pending = 1; - is_graceful = 1; -} - - - -static void set_signals() -{ - struct sigaction sa; - - sigemptyset(&sa.sa_mask); - sa.sa_flags = 0; - sa.sa_handler = sig_term; - - if (sigaction(SIGTERM, &sa, NULL) < 0) - ap_log_error(APLOG_MARK, APLOG_WARNING, errno, ap_server_conf, "sigaction(SIGTERM)"); - - sa.sa_handler = sig_hup; - - if (sigaction(SIGHUP, &sa, NULL) < 0) - ap_log_error(APLOG_MARK, APLOG_WARNING, errno, ap_server_conf, "sigaction(SIGHUP)"); -} diff --git a/server/mpm/netware/mpm.h b/server/mpm/netware/mpm.h deleted file mode 100644 index 1ce59331e5de2d012d670d5187d48433488764d2..0000000000000000000000000000000000000000 --- a/server/mpm/netware/mpm.h +++ /dev/null @@ -1,87 +0,0 @@ -/* ==================================================================== - * The Apache Software License, Version 1.1 - * - * Copyright (c) 2000-2001 The Apache Software Foundation. All rights - * reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in - * the documentation and/or other materials provided with the - * distribution. - * - * 3. The end-user documentation included with the redistribution, - * if any, must include the following acknowledgment: - * "This product includes software developed by the - * Apache Software Foundation (http://www.apache.org/)." - * Alternately, this acknowledgment may appear in the software itself, - * if and wherever such third-party acknowledgments normally appear. - * - * 4. The names "Apache" and "Apache Software Foundation" must - * not be used to endorse or promote products derived from this - * software without prior written permission. For written - * permission, please contact apache@apache.org. - * - * 5. Products derived from this software may not be called "Apache", - * nor may "Apache" appear in their name, without prior written - * permission of the Apache Software Foundation. - * - * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED - * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES - * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR - * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF - * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND - * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, - * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT - * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * ==================================================================== - * - * This software consists of voluntary contributions made by many - * individuals on behalf of the Apache Software Foundation. For more - * information on the Apache Software Foundation, please see - * . - * - * Portions of this software are based upon public domain software - * originally written at the National Center for Supercomputing Applications, - * University of Illinois, Urbana-Champaign. - */ -#include "scoreboard.h" -//#include "unixd.h" - -#ifndef APACHE_MPM_THREADED_H -#define APACHE_MPM_THREADED_H - -#define THREADED_MPM - -#define MPM_NAME "NetWare_Threaded" - -//#define AP_MPM_WANT_RECLAIM_CHILD_PROCESSES -#define AP_MPM_WANT_WAIT_OR_TIMEOUT -//#define AP_MPM_WANT_PROCESS_CHILD_STATUS -#define AP_MPM_WANT_SET_PIDFILE -#define AP_MPM_WANT_SET_SCOREBOARD -#define AP_MPM_WANT_SET_LOCKFILE -#define AP_MPM_WANT_SET_MAX_REQUESTS -#define AP_MPM_WANT_SET_COREDUMPDIR -//#define AP_MPM_WANT_SET_ACCEPT_LOCK_MECH - -#define MPM_SYNC_CHILD_TABLE() (ap_sync_scoreboard_image()) -#define MPM_CHILD_PID(i) (ap_scoreboard_image->parent[i].pid) -#define MPM_NOTE_CHILD_KILLED(i) (MPM_CHILD_PID(i) = 0) - -extern int ap_threads_per_child; -extern int ap_thread_stack_size; -extern int ap_max_workers_limit; -extern server_rec *ap_server_conf; - -#endif /* APACHE_MPM_THREADED_H */ diff --git a/server/mpm/netware/mpm_default.h b/server/mpm/netware/mpm_default.h deleted file mode 100644 index 6ae8d1a81bd834a1b1ec083ae3a1fb6bfae2539d..0000000000000000000000000000000000000000 --- a/server/mpm/netware/mpm_default.h +++ /dev/null @@ -1,145 +0,0 @@ -/* ==================================================================== - * The Apache Software License, Version 1.1 - * - * Copyright (c) 2000-2001 The Apache Software Foundation. All rights - * reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in - * the documentation and/or other materials provided with the - * distribution. - * - * 3. The end-user documentation included with the redistribution, - * if any, must include the following acknowledgment: - * "This product includes software developed by the - * Apache Software Foundation (http://www.apache.org/)." - * Alternately, this acknowledgment may appear in the software itself, - * if and wherever such third-party acknowledgments normally appear. - * - * 4. The names "Apache" and "Apache Software Foundation" must - * not be used to endorse or promote products derived from this - * software without prior written permission. For written - * permission, please contact apache@apache.org. - * - * 5. Products derived from this software may not be called "Apache", - * nor may "Apache" appear in their name, without prior written - * permission of the Apache Software Foundation. - * - * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED - * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES - * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR - * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF - * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND - * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, - * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT - * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * ==================================================================== - * - * This software consists of voluntary contributions made by many - * individuals on behalf of the Apache Software Foundation. For more - * information on the Apache Software Foundation, please see - * . - * - * Portions of this software are based upon public domain software - * originally written at the National Center for Supercomputing Applications, - * University of Illinois, Urbana-Champaign. - */ - -#ifndef APACHE_MPM_DEFAULT_H -#define APACHE_MPM_DEFAULT_H - -#define AP_ID_FROM_CHILD_THREAD(c, t) ((c * HARD_THREAD_LIMIT) + t) -#define AP_CHILD_THREAD_FROM_ID(i) (0), (i) - -/* Number of servers to spawn off by default --- also, if fewer than - * this free when the caretaker checks, it will spawn more. - */ -#ifndef DEFAULT_START_DAEMON -#define DEFAULT_START_DAEMON 1 -#endif - -/* Maximum number of *free* server processes --- more than this, and - * they will die off. - */ - -#ifndef DEFAULT_MAX_FREE_DAEMON -#define DEFAULT_MAX_FREE_DAEMON 1 -#endif - -/* Minimum --- fewer than this, and more will be created */ - -#ifndef DEFAULT_MIN_FREE_DAEMON -#define DEFAULT_MIN_FREE_DAEMON 1 -#endif - -/* Limit on the total --- clients will be locked out if more servers than - * this are needed. It is intended solely to keep the server from crashing - * when things get out of hand. - * - * We keep a hard maximum number of servers, for two reasons --- first off, - * in case something goes seriously wrong, we want to stop the fork bomb - * short of actually crashing the machine we're running on by filling some - * kernel table. Secondly, it keeps the size of the scoreboard file small - * enough that we can read the whole thing without worrying too much about - * the overhead. - */ -#ifndef HARD_SERVER_LIMIT -#define HARD_SERVER_LIMIT 1 -#endif - -/* Limit on the threads per process. Clients will be locked out if more than - * this * HARD_SERVER_LIMIT are needed. - * - * We keep this for one reason it keeps the size of the scoreboard file small - * enough that we can read the whole thing without worrying too much about - * the overhead. - */ -#ifndef HARD_THREAD_LIMIT -#define HARD_THREAD_LIMIT 2048 -#endif - -#ifndef DEFAULT_THREADS_PER_CHILD -#define DEFAULT_THREADS_PER_CHILD 50 -#endif - -/* File used for accept locking, when we use a file */ -#ifndef DEFAULT_LOCKFILE -#define DEFAULT_LOCKFILE "logs/accept.lock" -#endif - -/* Scoreboard file, if there is one */ -#ifndef DEFAULT_SCOREBOARD -#define DEFAULT_SCOREBOARD "logs/apache_runtime_status" -#endif - -/* Where the main/parent process's pid is logged */ -#ifndef DEFAULT_PIDLOG -#define DEFAULT_PIDLOG "logs/httpd.pid" -#endif - -/* - * Interval, in microseconds, between scoreboard maintenance. - */ -#ifndef SCOREBOARD_MAINTENANCE_INTERVAL -#define SCOREBOARD_MAINTENANCE_INTERVAL 1000000 -#endif - -/* Number of requests to try to handle in a single process. If <= 0, - * the children don't die off. - */ -#ifndef DEFAULT_MAX_REQUESTS_PER_CHILD -#define DEFAULT_MAX_REQUESTS_PER_CHILD 10000 -#endif - -#endif /* AP_MPM_DEFAULT_H */ diff --git a/server/mpm/netware/mpm_netware.c b/server/mpm/netware/mpm_netware.c deleted file mode 100644 index e16a7ab5921132d5312f8a970eb13d11445b2bb5..0000000000000000000000000000000000000000 --- a/server/mpm/netware/mpm_netware.c +++ /dev/null @@ -1,1255 +0,0 @@ -/* ==================================================================== - * The Apache Software License, Version 1.1 - * - * Copyright (c) 2000-2001 The Apache Software Foundation. All rights - * reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in - * the documentation and/or other materials provided with the - * distribution. - * - * 3. The end-user documentation included with the redistribution, - * if any, must include the following acknowledgment: - * "This product includes software developed by the - * Apache Software Foundation (http://www.apache.org/)." - * Alternately, this acknowledgment may appear in the software itself, - * if and wherever such third-party acknowledgments normally appear. - * - * 4. The names "Apache" and "Apache Software Foundation" must - * not be used to endorse or promote products derived from this - * software without prior written permission. For written - * permission, please contact apache@apache.org. - * - * 5. Products derived from this software may not be called "Apache", - * nor may "Apache" appear in their name, without prior written - * permission of the Apache Software Foundation. - * - * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED - * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES - * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR - * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF - * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND - * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, - * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT - * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * ==================================================================== - * - * This software consists of voluntary contributions made by many - * individuals on behalf of the Apache Software Foundation. For more - * information on the Apache Software Foundation, please see - * . - * - * Portions of this software are based upon public domain software - * originally written at the National Center for Supercomputing Applications, - * University of Illinois, Urbana-Champaign. - */ - -/* - * httpd.c: simple http daemon for answering WWW file requests - * - * - * 03-21-93 Rob McCool wrote original code (up to NCSA HTTPd 1.3) - * - * 03-06-95 blong - * changed server number for child-alone processes to 0 and changed name - * of processes - * - * 03-10-95 blong - * Added numerous speed hacks proposed by Robert S. Thau (rst@ai.mit.edu) - * including set group before fork, and call gettime before to fork - * to set up libraries. - * - * 04-14-95 rst / rh - * Brandon's code snarfed from NCSA 1.4, but tinkered to work with the - * Apache server, and also to have child processes do accept() directly. - * - * April-July '95 rst - * Extensive rework for Apache. - */ - -/* TODO: this is a cobbled together prefork MPM example... it should mostly - * TODO: behave like apache-1.3... here's a short list of things I think - * TODO: need cleaning up still: - */ - -#include "apr.h" -#include "apr_portable.h" -#include "apr_strings.h" -#include "apr_thread_proc.h" -#include "apr_signal.h" -#include "apr_tables.h" -#include "apr_getopt.h" - -#define APR_WANT_STDIO -#define APR_WANT_STRFUNC -#include "apr_want.h" - -#if APR_HAVE_UNISTD_H -#include -#endif -#if APR_HAVE_SYS_TYPES_H -#include -#endif - -#define CORE_PRIVATE - -#include "ap_config.h" -#include "httpd.h" -#include "mpm_default.h" -#include "http_main.h" -#include "http_log.h" -#include "http_config.h" -#include "http_core.h" /* for get_remote_host */ -#include "http_connection.h" -#include "scoreboard.h" -#include "ap_mpm.h" -#include "mpm_common.h" -#include "ap_listen.h" -#include "ap_mmn.h" - -#ifdef HAVE_TIME_H -#include -#endif - -#include - -#define WORKER_DEAD SERVER_DEAD -#define WORKER_STARTING SERVER_STARTING -#define WORKER_READY SERVER_READY - -/* config globals */ - -int ap_threads_per_child=0; /* Worker threads per child */ -int ap_thread_stack_size=65536; -static apr_lock_t *accept_lock; -static int ap_threads_to_start=0; -static int ap_threads_min_free=0; -static int ap_threads_max_free=0; -static int ap_threads_limit=0; - -/* - * The max child slot ever assigned, preserved across restarts. Necessary - * to deal with MaxClients changes across SIGWINCH restarts. We use this - * value to optimize routines that have to scan the entire scoreboard. - */ -int ap_max_workers_limit = -1; -server_rec *ap_server_conf; - -/* *Non*-shared http_main globals... */ - -static apr_socket_t *sd; -static fd_set listenfds; -static int listenmaxfd; - -/* one_process --- debugging mode variable; can be set from the command line - * with the -X flag. If set, this gets you the child_main loop running - * in the process which originally started up (no detach, no make_child), - * which is a pretty nice debugging environment. (You'll get a SIGHUP - * early in standalone_main; just continue through. This is the server - * trying to kill off any child processes which it might have lying - * around --- Apache doesn't keep track of their pids, it just sends - * SIGHUP to the process group, ignoring it in the root process. - * Continue through and you'll be fine.). - */ - -static int one_process = 0; - -static apr_pool_t *pconf; /* Pool for config stuff */ -static apr_pool_t *pmain; /* Pool for httpd child stuff */ - -static pid_t ap_my_pid; /* it seems silly to call getpid all the time */ -static pid_t parent_pid; -#ifndef MULTITHREAD -static int my_child_num; -#endif - -static int die_now = 0; -static apr_lock_t *accept_mutex = NULL; - -/* Keep track of the number of worker threads currently active */ -static int worker_thread_count; -static apr_lock_t *worker_thread_count_mutex; - - -#ifdef GPROF -/* - * change directory for gprof to plop the gmon.out file - * configure in httpd.conf: - * GprofDir logs/ -> $ServerRoot/logs/gmon.out - * GprofDir logs/% -> $ServerRoot/logs/gprof.$pid/gmon.out - */ -static void chdir_for_gprof(void) -{ - core_server_config *sconf = - ap_get_module_config(ap_server_conf->module_config, &core_module); - char *dir = sconf->gprof_dir; - const char *use_dir; - - if(dir) { - apr_status_t res; - char buf[512]; - int len = strlen(sconf->gprof_dir) - 1; - if(*(dir + len) == '%') { - dir[len] = '\0'; - apr_snprintf(buf, sizeof(buf), "%sgprof.%d", dir, (int)getpid()); - } - use_dir = ap_server_root_relative(pconf, buf[0] ? buf : dir); - res = apr_dir_make(use_dir, 0755, pconf); - if(res != APR_SUCCESS && !APR_STATUS_IS_EEXIST(res)) { - ap_log_error(APLOG_MARK, APLOG_ERR, errno, ap_server_conf, - "gprof: error creating directory %s", dir); - } - } - else { - use_dir = ap_server_root_relative(pconf, "logs"); - } - - chdir(dir); -} -#else -#define chdir_for_gprof() -#endif - -/* XXX - I don't know if TPF will ever use this module or not, so leave - * the ap_check_signals calls in but disable them - manoj */ -#define ap_check_signals() - -/* a clean exit from a child with proper cleanup */ -static void clean_child_exit(int code) __attribute__ ((noreturn)); -static void clean_child_exit(int code) -{ - apr_thread_mutex_lock(worker_thread_count_mutex); - worker_thread_count--; - apr_thread_mutex_unlock(worker_thread_count_mutex); - NXThreadExit((void*)&code); -} - -static apr_status_t accept_mutex_child_cleanup(void *foo) -{ - return apr_thread_mutex_unlock(accept_mutex); -} - -/* Initialize mutex lock. - * Done by each child at its birth - */ -static void accept_mutex_child_init(apr_pool_t *p) -{ - apr_pool_cleanup_register(p, NULL, accept_mutex_child_cleanup, apr_pool_cleanup_null); -} - -static void accept_mutex_on(void) -{ - apr_status_t rc = apr_thread_mutex_lock(accept_mutex); - - if (rc != APR_SUCCESS) { - ap_log_error(APLOG_MARK, APLOG_EMERG, rc, ap_server_conf, - "Error getting accept lock. Exiting!"); - clean_child_exit(APEXIT_CHILDFATAL); - } -} - -static void accept_mutex_off(void) -{ - apr_status_t rc = apr_thread_mutex_unlock(accept_mutex); - - if (rc != APR_SUCCESS) { - ap_log_error(APLOG_MARK, APLOG_EMERG, rc, ap_server_conf, - "Error freeing accept lock. Exiting!"); - clean_child_exit(APEXIT_CHILDFATAL); - } -} - -/* On some architectures it's safe to do unserialized accept()s in the single - * Listen case. But it's never safe to do it in the case where there's - * multiple Listen statements. Define SINGLE_LISTEN_UNSERIALIZED_ACCEPT - * when it's safe in the single Listen case. - */ -#ifdef SINGLE_LISTEN_UNSERIALIZED_ACCEPT -#define SAFE_ACCEPT(stmt) do {if (ap_listeners->next) {stmt;}} while(0) -#else -#define SAFE_ACCEPT(stmt) do {stmt;} while(0) -#endif - -//#ifdef NO_SERIALIZED_ACCEPT -//#define SAFE_ACCEPT(stmt) APR_SUCCESS -//#else -//#define SAFE_ACCEPT(stmt) (stmt) -//#endif - -AP_DECLARE(apr_status_t) ap_mpm_query(int query_code, int *result) -{ - switch(query_code){ - case AP_MPMQ_MAX_DAEMON_USED: - *result = ap_threads_limit; - return APR_SUCCESS; - case AP_MPMQ_IS_THREADED: - *result = AP_MPMQ_NOT_SUPPORTED; - return APR_SUCCESS; - case AP_MPMQ_IS_FORKED: - *result = AP_MPMQ_DYNAMIC; - return APR_SUCCESS; - case AP_MPMQ_HARD_LIMIT_DAEMONS: - *result = HARD_SERVER_LIMIT; - return APR_SUCCESS; - case AP_MPMQ_HARD_LIMIT_THREADS: - *result = HARD_THREAD_LIMIT; - return APR_SUCCESS; - case AP_MPMQ_MAX_THREADS: - *result = 0; - return APR_SUCCESS; - case AP_MPMQ_MIN_SPARE_DEAMONS: - *result = ap_threads_min_free; - return APR_SUCCESS; - case AP_MPMQ_MIN_SPARE_THREADS: - *result = 0; - return APR_SUCCESS; - case AP_MPMQ_MAX_SPARE_DAEMONS: - *result = ap_threads_max_free; - return APR_SUCCESS; - case AP_MPMQ_MAX_SPARE_THREADS: - *result = 0; - return APR_SUCCESS; - case AP_MPMQ_MAX_REQUESTS_DEAMON: - *result = ap_max_requests_per_child; - return APR_SUCCESS; - case AP_MPMQ_MAX_DAEMONS: - *result = ap_threads_limit; - return APR_SUCCESS; - } - return APR_ENOTIMPL; -} - - -/***************************************************************** - * Connection structures and accounting... - */ - -static void just_die(int sig) -{ - clean_child_exit(0); -} - -/* volatile just in case */ -static int volatile shutdown_pending; -static int volatile restart_pending; -static int volatile is_graceful; -static int volatile wait_to_finish=1; -ap_generation_t volatile ap_my_generation=0; - -static void sig_term(int sig) -{ - if (shutdown_pending == 1) { - /* Um, is this _probably_ not an error, if the user has - * tried to do a shutdown twice quickly, so we won't - * worry about reporting it. - */ - return; - } - shutdown_pending = 1; - - while (wait_to_finish) - delay(500); -// NXThreadYield(); - delay(2000); -// The shut down flag wait_to_finish needs to be set in -// the atexit() routine when it is finally working. -} - -/* restart() is the signal handler for SIGHUP and SIGWINCH - * in the parent process, unless running in ONE_PROCESS mode - */ -static void restart(int sig) -{ - if (restart_pending == 1) { - /* Probably not an error - don't bother reporting it */ - return; - } - restart_pending = 1; -} - -static void set_signals(void) -{ - apr_signal(SIGTERM, sig_term); -} - -/***************************************************************** - * Child process main loop. - * The following vars are static to avoid getting clobbered by longjmp(); - * they are really private to child_main. - */ - -//static int srv; -//static apr_socket_t *csd; -//static int requests_this_child; -static fd_set main_fds; - -int ap_graceful_stop_signalled(void) -{ - /* not ever called anymore... */ - return 0; -} - -static int setup_listen_poll(apr_pool_t *pmain, apr_pollfd_t **listen_poll) -{ - ap_listen_rec *lr; - int numfds = 0; - - for (lr = ap_listeners; lr; lr = lr->next) { - numfds++; - } - - apr_poll_setup(listen_poll, numfds, pmain); - - for (lr = ap_listeners; lr; lr = lr->next) { - apr_poll_socket_add(*listen_poll, lr->sd, APR_POLLIN); - } - return 0; -} - - -static void worker_main(void *arg) -{ - ap_listen_rec *lr; - ap_listen_rec *last_lr; - ap_listen_rec *first_lr; - apr_pool_t *ptrans; - conn_rec *current_conn; - apr_status_t stat = APR_EINIT; - int sockdes; - int worker_num_arg = *((int*)arg); - apr_pollfd_t *listen_poll; - int nsds, rv; - - int my_worker_num = worker_num_arg; - apr_socket_t *csd = NULL; - int requests_this_child = 0; - int srv; - struct timeval tv; - - last_lr = NULL; - tv.tv_sec = 1; - tv.tv_usec = 0; - - apr_pool_create(&ptrans, pmain); - - apr_thread_mutex_lock(worker_thread_count_mutex); - worker_thread_count++; - apr_thread_mutex_unlock(worker_thread_count_mutex); - - if (setup_listen_poll(pmain, &listen_poll)) { - clean_child_exit(1); - } - - ap_update_child_status(AP_CHILD_THREAD_FROM_ID(my_child_num), WORKER_READY, (request_rec *) NULL); - -// ap_sync_scoreboard_image(); - while (!die_now) { - /* - * (Re)initialize this child to a pre-connection state. - */ - current_conn = NULL; - apr_pool_clear(ptrans); - - if ((ap_max_requests_per_child > 0 - && requests_this_child++ >= ap_max_requests_per_child)) { - clean_child_exit(0); - } - - ap_update_child_status(AP_CHILD_THREAD_FROM_ID(my_child_num), WORKER_READY, (request_rec *) NULL); - - /* - * Wait for an acceptable connection to arrive. - */ - - /* Lock around "accept", if necessary */ - SAFE_ACCEPT(accept_mutex_on()); - - for (;;) { - if (shutdown_pending) { -printf ("Thread %d is shutting down\n", getpid()); - SAFE_ACCEPT(accept_mutex_off()); - clean_child_exit(0); - } - - /* more than one socket */ - memcpy(&main_fds, &listenfds, sizeof(fd_set)); - srv = select(listenmaxfd + 1, &main_fds, NULL, NULL, &tv); - - if (srv < 0 && h_errno != EINTR) { - /* Single Unix documents select as returning errnos - * EBADF, EINTR, and EINVAL... and in none of those - * cases does it make sense to continue. In fact - * on Linux 2.0.x we seem to end up with EFAULT - * occasionally, and we'd loop forever due to it. - */ - ap_log_error(APLOG_MARK, APLOG_ERR, h_errno, ap_server_conf, "select: (listen)"); - clean_child_exit(1); - } - - if (srv <= 0) - continue; - - /* we remember the last_lr we searched last time around so that - we don't end up starving any particular listening socket */ - if (last_lr == NULL) { - lr = ap_listeners; - } - else { - lr = last_lr->next; - if (!lr) - lr = ap_listeners; - } - first_lr = lr; - do { - apr_os_sock_get(&sockdes, lr->sd); - if (FD_ISSET(sockdes, &main_fds)) - goto got_listener; - lr = lr->next; - if (!lr) - lr = ap_listeners; - } while (lr != first_lr); - /* FIXME: if we get here, something bad has happened, and we're - probably gonna spin forever. - */ - continue; -got_listener: - last_lr = lr; - sd = lr->sd; - - /* if we accept() something we don't want to die, so we have to - * defer the exit - */ - for (;;) { -// ap_sync_scoreboard_image(); - stat = apr_accept(&csd, sd, ptrans); - if (stat == APR_SUCCESS || !APR_STATUS_IS_EINTR(stat)) - break; - } - - if (stat == APR_SUCCESS) - break; /* We have a socket ready for reading */ - else { - /* Our old behaviour here was to continue after accept() - * errors. But this leads us into lots of troubles - * because most of the errors are quite fatal. For - * example, EMFILE can be caused by slow descriptor - * leaks (say in a 3rd party module, or libc). It's - * foolish for us to continue after an EMFILE. We also - * seem to tickle kernel bugs on some platforms which - * lead to never-ending loops here. So it seems best - * to just exit in most cases. - */ - switch (stat) { - - /* Linux generates the rest of these, other tcp - * stacks (i.e. bsd) tend to hide them behind - * getsockopt() interfaces. They occur when - * the net goes sour or the client disconnects - * after the three-way handshake has been done - * in the kernel but before userland has picked - * up the socket. - */ - case ECONNRESET: - case ETIMEDOUT: - case EHOSTUNREACH: - case ENETUNREACH: - break; - - case ENETDOWN: - /* - * When the network layer has been shut down, there - * is not much use in simply exiting: the parent - * would simply re-create us (and we'd fail again). - * Use the CHILDFATAL code to tear the server down. - * @@@ Martin's idea for possible improvement: - * A different approach would be to define - * a new APEXIT_NETDOWN exit code, the reception - * of which would make the parent shutdown all - * children, then idle-loop until it detected that - * the network is up again, and restart the children. - * Ben Hyde noted that temporary ENETDOWN situations - * occur in mobile IP. - */ - ap_log_error(APLOG_MARK, APLOG_EMERG, stat, ap_server_conf, - "apr_accept: giving up."); - clean_child_exit(APEXIT_CHILDFATAL); - - default: - ap_log_error(APLOG_MARK, APLOG_ERR, stat, ap_server_conf, - "apr_accept: (client socket)"); - clean_child_exit(1); - } - } - -// ap_sync_scoreboard_image(); - } - - SAFE_ACCEPT(accept_mutex_off()); /* unlock after "accept" */ - - /* - * We now have a connection, so set it up with the appropriate - * socket options, file descriptors, and read/write buffers. - */ - - apr_os_sock_get(&sockdes, csd); - - if (sockdes >= FD_SETSIZE) { - ap_log_error(APLOG_MARK, APLOG_NOERRNO|APLOG_WARNING, 0, NULL, - "new file descriptor %d is too large; you probably need " - "to rebuild Apache with a larger FD_SETSIZE " - "(currently %d)", - sockdes, FD_SETSIZE); - apr_socket_close(csd); -// ap_sync_scoreboard_image(); - continue; - } - - ap_sock_disable_nagle(csd); - - current_conn = ap_new_connection(ptrans, ap_server_conf, csd, - my_child_num); - if (current_conn) { - ap_process_connection(current_conn); - ap_lingering_close(current_conn); - } - -// ap_sync_scoreboard_image(); - } - clean_child_exit(0); -} - - -static int make_child(server_rec *s, int slot) -{ - int tid; - int err=0; - NXContext_t ctx; - - if (slot + 1 > ap_max_workers_limit) { - ap_max_workers_limit = slot + 1; - } - - if (one_process) { - apr_signal(SIGINT, just_die); - apr_signal(SIGTERM, just_die); - worker_main((void*)&slot); - } - - ap_update_child_status(AP_CHILD_THREAD_FROM_ID(slot), WORKER_STARTING, (request_rec *) NULL); - - if (ctx = NXContextAlloc((void (*)(void *)) worker_main, &slot, NX_PRIO_MED, ap_thread_stack_size, NX_CTX_NORMAL, &err)) { - char threadName[32]; - - sprintf (threadName, "Apache_Worker %d", slot); - NXContextSetName(ctx, threadName); - err = NXThreadCreate(ctx, NX_THR_BIND_CONTEXT, &tid); - if (err) { - NXContextFree (ctx); - } - } - - if (err) { - /* create thread didn't succeed. Fix the scoreboard or else - * it will say SERVER_STARTING forever and ever - */ - ap_update_child_status(AP_CHILD_THREAD_FROM_ID(slot), WORKER_DEAD, (request_rec *) NULL); - - /* In case system resources are maxxed out, we don't want - Apache running away with the CPU trying to fork over and - over and over again. */ - apr_thread_yield(); - - return -1; - } - - ap_scoreboard_image->servers[0][slot].tid = tid; - - return 0; -} - - -/* start up a bunch of worker threads */ -static void startup_workers(int number_to_start) -{ - int i; - - for (i = 0; number_to_start && i < ap_threads_limit; ++i) { - if (ap_scoreboard_image->servers[0][i].status != WORKER_DEAD) { - continue; - } - if (make_child(ap_server_conf, i) < 0) { - break; - } - --number_to_start; - } -} - - -/* - * idle_spawn_rate is the number of children that will be spawned on the - * next maintenance cycle if there aren't enough idle servers. It is - * doubled up to MAX_SPAWN_RATE, and reset only when a cycle goes by - * without the need to spawn. - */ -static int idle_spawn_rate = 1; -#ifndef MAX_SPAWN_RATE -#define MAX_SPAWN_RATE (32) -#endif -static int hold_off_on_exponential_spawning; - -static void perform_idle_server_maintenance(apr_pool_t *p) -{ - int i; - int to_kill; - int idle_count; - worker_score *ws; - int free_length; - int free_slots[MAX_SPAWN_RATE]; - int last_non_dead; - int total_non_dead; - - /* initialize the free_list */ - free_length = 0; - - to_kill = -1; - idle_count = 0; - last_non_dead = -1; - total_non_dead = 0; - - ap_sync_scoreboard_image(); - for (i = 0; i < ap_threads_limit; ++i) { - int status; - - if (i >= ap_max_workers_limit && free_length == idle_spawn_rate) - break; - ws = &ap_scoreboard_image->servers[i][0]; - status = ws->status; - if (status == WORKER_DEAD) { - /* try to keep children numbers as low as possible */ - if (free_length < idle_spawn_rate) { - free_slots[free_length] = i; - ++free_length; - } - } - else { - /* We consider a starting server as idle because we started it - * at least a cycle ago, and if it still hasn't finished starting - * then we're just going to swamp things worse by forking more. - * So we hopefully won't need to fork more if we count it. - * This depends on the ordering of SERVER_READY and SERVER_STARTING. - */ - if (status <= SERVER_READY) { - ++ idle_count; - /* always kill the highest numbered child if we have to... - * no really well thought out reason ... other than observing - * the server behaviour under linux where lower numbered children - * tend to service more hits (and hence are more likely to have - * their data in cpu caches). - */ - to_kill = i; - } - - ++total_non_dead; - last_non_dead = i; - } - } - ap_max_workers_limit = last_non_dead + 1; - if (idle_count > ap_threads_max_free) { - /* kill off one child... we use the pod because that'll cause it to - * shut down gracefully, in case it happened to pick up a request - * while we were counting - */ - idle_spawn_rate = 1; - } - else if (idle_count < ap_threads_min_free) { - /* terminate the free list */ - if (free_length == 0) { - /* only report this condition once */ - static int reported = 0; - - if (!reported) { - ap_log_error(APLOG_MARK, APLOG_NOERRNO|APLOG_ERR, 0, ap_server_conf, - "server reached MaxClients setting, consider" - " raising the MaxClients setting"); - reported = 1; - } - idle_spawn_rate = 1; - } - else { - if (idle_spawn_rate >= 8) { - ap_log_error(APLOG_MARK, APLOG_NOERRNO|APLOG_INFO, 0, ap_server_conf, - "server seems busy, (you may need " - "to increase StartServers, or Min/MaxSpareServers), " - "spawning %d children, there are %d idle, and " - "%d total children", idle_spawn_rate, - idle_count, total_non_dead); - } - for (i = 0; i < free_length; ++i) { - make_child(ap_server_conf, free_slots[i]); - } - /* the next time around we want to spawn twice as many if this - * wasn't good enough, but not if we've just done a graceful - */ - if (hold_off_on_exponential_spawning) { - --hold_off_on_exponential_spawning; - } - else if (idle_spawn_rate < MAX_SPAWN_RATE) { - idle_spawn_rate *= 2; - } - } - } - else { - idle_spawn_rate = 1; - } -} - -static int setup_listeners(server_rec *s) -{ - ap_listen_rec *lr; - int sockdes; - - if (ap_setup_listeners(s) < 1 ) { - ap_log_error(APLOG_MARK, APLOG_NOERRNO|APLOG_ALERT, 0, s, - "no listening sockets available, shutting down"); - return -1; - } - - listenmaxfd = -1; - FD_ZERO(&listenfds); - for (lr = ap_listeners; lr; lr = lr->next) { - apr_os_sock_get(&sockdes, lr->sd); - FD_SET(sockdes, &listenfds); - if (sockdes > listenmaxfd) { - listenmaxfd = sockdes; - } - } - return 0; -} - -/***************************************************************** - * Executive routines. - */ - -int ap_mpm_run(apr_pool_t *_pconf, apr_pool_t *plog, server_rec *s) -{ - int index; - int remaining_workers_to_start; - apr_status_t status=0; - - pconf = _pconf; - ap_server_conf = s; - - if (setup_listeners(s)) { - ap_log_error(APLOG_MARK, APLOG_NOERRNO|APLOG_ALERT, status, s, - "no listening sockets available, shutting down"); - return -1; - } - - ap_log_pid(pconf, ap_pid_fname); - - worker_thread_count = 0; - apr_thread_mutex_create(&worker_thread_count_mutex, pconf); - apr_thread_mutex_create(&accept_mutex, pconf); - if (!is_graceful) { - ap_run_pre_mpm(pconf, SB_NOT_SHARED); - } - - set_signals(); - -/* Normal child main stuff */ - - apr_pool_create(&pmain, pconf); - - /* needs to be done before we switch UIDs so we have permissions */ - reopen_scoreboard(pmain); - - ap_run_child_init(pmain, ap_server_conf); - - -/* End Normal child main stuff */ - - if (ap_threads_max_free < ap_threads_min_free + 1) /* Don't thrash... */ - ap_threads_max_free = ap_threads_min_free + 1; - - /* If we're doing a graceful_restart then we're going to see a lot - * of children exiting immediately when we get into the main loop - * below (because we just sent them SIGWINCH). This happens pretty - * rapidly... and for each one that exits we'll start a new one until - * we reach at least daemons_min_free. But we may be permitted to - * start more than that, so we'll just keep track of how many we're - * supposed to start up without the 1 second penalty between each fork. - */ - remaining_workers_to_start = ap_threads_to_start; - if (remaining_workers_to_start > ap_threads_limit) { - remaining_workers_to_start = ap_threads_limit; - } - if (!is_graceful) { - startup_workers(remaining_workers_to_start); - remaining_workers_to_start = 0; - } - else { - /* give the system some time to recover before kicking into - * exponential mode */ - hold_off_on_exponential_spawning = 10; - } - - ap_log_error(APLOG_MARK, APLOG_NOERRNO|APLOG_NOTICE, 0, ap_server_conf, - "%s configured -- resuming normal operations", - ap_get_server_version()); - ap_log_error(APLOG_MARK, APLOG_NOERRNO|APLOG_INFO, 0, ap_server_conf, - "Server built: %s", ap_get_server_built()); - restart_pending = shutdown_pending = 0; - - printf("%s \n", ap_get_server_version()); - - while (!restart_pending && !shutdown_pending) { - int worker_slot; - apr_wait_t status; - -// /* this is a memory leak, but I'll fix it later. */ -// apr_proc_t pid; -// -// ap_wait_or_timeout(&status, &pid, pconf); -// -// /* XXX: if it takes longer than 1 second for all our children -// * to start up and get into IDLE state then we may spawn an -// * extra child -// */ -// if (pid.pid != -1) { -// ap_process_child_status(&pid, status); -// /* non-fatal death... note that it's gone in the scoreboard. */ -// ap_sync_scoreboard_image(); -// child_slot = find_child_by_pid(&pid); -// if (child_slot >= 0) { -// ap_update_child_status(AP_CHILD_THREAD_FROM_ID(child_slot), WORKER_DEAD, -// (request_rec *) NULL); -// if (remaining_workers_to_start && child_slot < ap_threads_limit) { -// /* we're still doing a 1-for-1 replacement of dead -// * children with new children -// */ -// make_child(ap_server_conf, child_slot); -// --remaining_workers_to_start; -// } -//#if APR_HAS_OTHER_CHILD -// } -// else if (apr_proc_other_child_read(&pid, status) == 0) { -// /* handled */ -//#endif -// } -// else if (is_graceful) { -// /* Great, we've probably just lost a slot in the -// * scoreboard. Somehow we don't know about this -// * child. -// */ -// ap_log_error(APLOG_MARK, APLOG_NOERRNO|APLOG_WARNING, -// 0, ap_server_conf, -// "long lost child came home! (pid %ld)", (long)pid.pid); -// } -// /* Don't perform idle maintenance when a child dies, -// * only do it when there's a timeout. Remember only a -// * finite number of children can die, and it's pretty -// * pathological for a lot to die suddenly. -// */ -// continue; -// } -// else if (remaining_workers_to_start) { -// /* we hit a 1 second timeout in which none of the previous -// * generation of children needed to be reaped... so assume -// * they're all done, and pick up the slack if any is left. -// */ -// startup_children(remaining_workers_to_start); -// remaining_workers_to_start = 0; -// /* In any event we really shouldn't do the code below because -// * few of the servers we just started are in the IDLE state -// * yet, so we'd mistakenly create an extra server. -// */ -// continue; -// } - -// perform_idle_server_maintenance(pconf); - apr_thread_yield(); - } - - if (shutdown_pending) { - ap_log_error(APLOG_MARK, APLOG_NOERRNO|APLOG_NOTICE, 0, ap_server_conf, - "caught SIGTERM, shutting down"); - - while (worker_thread_count > 0) - apr_thread_yield(); - - printf ("Press any key to continue..."); - getc(stdin); - wait_to_finish = 0; - return 1; - } - - /* we've been told to restart */ -// apr_signal(SIGHUP, SIG_IGN); - if (one_process) { - /* not worth thinking about */ - return 1; - } - - /* advance to the next generation */ - /* XXX: we really need to make sure this new generation number isn't in - * use by any of the children. - */ - ++ap_my_generation; - ap_scoreboard_image->global.running_generation = ap_my_generation; - update_scoreboard_global(); - - if (is_graceful) { - ap_log_error(APLOG_MARK, APLOG_NOERRNO|APLOG_NOTICE, 0, ap_server_conf, - "Graceful restart requested, doing restart"); - - /* kill off the idle ones */ - -#ifndef SCOREBOARD_FILE - /* This is mostly for debugging... so that we know what is still - * gracefully dealing with existing request. But we can't really - * do it if we're in a SCOREBOARD_FILE because it'll cause - * corruption too easily. - */ - ap_sync_scoreboard_image(); - for (index = 0; index < ap_threads_limit; ++index) { - if (ap_scoreboard_image->servers[0][index].status != WORKER_DEAD) { - ap_scoreboard_image->servers[0][index].status = SERVER_GRACEFUL; - } - } -#endif - } - else { - /* Kill 'em off */ - ap_log_error(APLOG_MARK, APLOG_NOERRNO|APLOG_NOTICE, 0, ap_server_conf, - "SIGHUP received. Attempting to restart"); - } - - return 0; -} - -static void netware_pre_config(apr_pool_t *p, apr_pool_t *plog, apr_pool_t *ptemp) -{ - static int restart_num = 0; - int no_detach, debug; - - debug = ap_exists_config_define("DEBUG"); - - if (debug) - no_detach = one_process = 1; - else - { - no_detach = ap_exists_config_define("NO_DETACH"); - one_process = ap_exists_config_define("ONE_PROCESS"); - } - - /* sigh, want this only the second time around */ - if (restart_num++ == 1) { - is_graceful = 0; - - if (!one_process && !no_detach) { - apr_proc_detach(); - } - - parent_pid = ap_my_pid = getpid(); - } - - ap_listen_pre_config(); - ap_threads_to_start = DEFAULT_START_DAEMON; - ap_threads_min_free = DEFAULT_MIN_FREE_DAEMON; - ap_threads_max_free = DEFAULT_MAX_FREE_DAEMON; - ap_threads_limit = HARD_THREAD_LIMIT; - ap_pid_fname = DEFAULT_PIDLOG; - ap_scoreboard_fname = DEFAULT_SCOREBOARD; - ap_lock_fname = DEFAULT_LOCKFILE; - ap_max_requests_per_child = DEFAULT_MAX_REQUESTS_PER_CHILD; - ap_extended_status = 0; - - apr_cpystrn(ap_coredump_dir, ap_server_root, sizeof(ap_coredump_dir)); -} - -static void netware_mpm_hooks(apr_pool_t *p) -{ - ap_hook_pre_config(netware_pre_config, NULL, NULL, APR_HOOK_MIDDLE); -} - -void netware_rewrite_args(process_rec *process) -{ - char *def_server_root; - char optbuf[3]; - const char *optarg; - apr_getopt_t *opt; - apr_array_header_t *mpm_new_argv; - - - /* Rewrite process->argv[]; - * - * add default -d serverroot from the path of this executable - * - * The end result will look like: - * The -d serverroot default from the running executable - */ - if (process->argc > 0) { - char *s = apr_pstrdup (process->pconf, process->argv[0]); - if (s) { - int i, len = strlen(s); - - for (i=len; i; i--) { - if (s[i] == '\\' || s[i] == '/') { - s[i] = NULL; - apr_filepath_merge(&def_server_root, NULL, s, - APR_FILEPATH_TRUENAME, process->pool); - break; - } - } - /* Use process->pool so that the rewritten argv - * lasts for the lifetime of the server process, - * because pconf will be destroyed after the - * initial pre-flight of the config parser. - */ - mpm_new_argv = apr_array_make(process->pool, process->argc + 2, - sizeof(const char *)); - *(const char **)apr_array_push(mpm_new_argv) = process->argv[0]; - *(const char **)apr_array_push(mpm_new_argv) = "-d"; - *(const char **)apr_array_push(mpm_new_argv) = def_server_root; - - optbuf[0] = '-'; - optbuf[2] = '\0'; - apr_getopt_init(&opt, process->pool, process->argc, (char**) process->argv); - while (apr_getopt(opt, AP_SERVER_BASEARGS, optbuf + 1, &optarg) == APR_SUCCESS) { - switch (optbuf[1]) { - default: - *(const char **)apr_array_push(mpm_new_argv) = - apr_pstrdup(process->pool, optbuf); - - if (optarg) { - *(const char **)apr_array_push(mpm_new_argv) = optarg; - } - break; - } - } - process->argc = mpm_new_argv->nelts; - process->argv = (const char * const *) mpm_new_argv->elts; - } - } -} - -static const char *set_threads_to_start(cmd_parms *cmd, void *dummy, const char *arg) -{ - const char *err = ap_check_cmd_context(cmd, GLOBAL_ONLY); - if (err != NULL) { - return err; - } - - ap_threads_to_start = atoi(arg); - return NULL; -} - -static const char *set_min_free_threads(cmd_parms *cmd, void *dummy, const char *arg) -{ - const char *err = ap_check_cmd_context(cmd, GLOBAL_ONLY); - if (err != NULL) { - return err; - } - - ap_threads_min_free = atoi(arg); - if (ap_threads_min_free <= 0) { - ap_log_error(APLOG_MARK, APLOG_STARTUP | APLOG_NOERRNO, 0, NULL, - "WARNING: detected MinSpareServers set to non-positive."); - ap_log_error(APLOG_MARK, APLOG_STARTUP | APLOG_NOERRNO, 0, NULL, - "Resetting to 1 to avoid almost certain Apache failure."); - ap_log_error(APLOG_MARK, APLOG_STARTUP | APLOG_NOERRNO, 0, NULL, - "Please read the documentation."); - ap_threads_min_free = 1; - } - - return NULL; -} - -static const char *set_max_free_threads(cmd_parms *cmd, void *dummy, const char *arg) -{ - const char *err = ap_check_cmd_context(cmd, GLOBAL_ONLY); - if (err != NULL) { - return err; - } - - ap_threads_max_free = atoi(arg); - return NULL; -} - -static const char *set_thread_limit (cmd_parms *cmd, void *dummy, const char *arg) -{ - const char *err = ap_check_cmd_context(cmd, GLOBAL_ONLY); - if (err != NULL) { - return err; - } - - ap_threads_limit = atoi(arg); - if (ap_threads_limit > HARD_THREAD_LIMIT) { - ap_log_error(APLOG_MARK, APLOG_STARTUP | APLOG_NOERRNO, 0, NULL, - "WARNING: MaxClients of %d exceeds compile time limit " - "of %d servers,", ap_threads_limit, HARD_SERVER_LIMIT); - ap_log_error(APLOG_MARK, APLOG_STARTUP | APLOG_NOERRNO, 0, NULL, - " lowering MaxClients to %d. To increase, please " - "see the", HARD_SERVER_LIMIT); - ap_log_error(APLOG_MARK, APLOG_STARTUP | APLOG_NOERRNO, 0, NULL, - " HARD_SERVER_LIMIT define in %s.", - AP_MPM_HARD_LIMITS_FILE); - ap_threads_limit = HARD_THREAD_LIMIT; - } - else if (ap_threads_limit < 1) { - ap_log_error(APLOG_MARK, APLOG_STARTUP | APLOG_NOERRNO, 0, NULL, - "WARNING: Require MaxClients > 0, setting to 1"); - ap_threads_limit = 1; - } - return NULL; -} - -static const char *set_thread_stacksize(cmd_parms *cmd, void *dummy, - const char *arg) -{ - const char *err = ap_check_cmd_context(cmd, GLOBAL_ONLY); - if (err != NULL) { - return err; - } - - ap_thread_stack_size = atoi(arg); - return NULL; -} - -static const command_rec netware_mpm_cmds[] = { -AP_INIT_TAKE1("ThreadStackSize", set_thread_stacksize, NULL, RSRC_CONF, - "Stack size each created thread will use."), -LISTEN_COMMANDS -AP_INIT_TAKE1("StartThreads", set_threads_to_start, NULL, RSRC_CONF, - "Number of worker threads launched at server startup"), -AP_INIT_TAKE1("MinSpareThreads", set_min_free_threads, NULL, RSRC_CONF, - "Minimum number of idle threads, to handle request spikes"), -AP_INIT_TAKE1("MaxSpareThreads", set_max_free_threads, NULL, RSRC_CONF, - "Maximum number of idle threads"), -AP_INIT_TAKE1("MaxThreads", set_thread_limit, NULL, RSRC_CONF, - "Maximum number of worker threads alive at the same time"), -{ NULL } -}; - -module AP_MODULE_DECLARE_DATA mpm_netware_module = { - MPM20_MODULE_STUFF, - netware_rewrite_args, /* hook to run before apache parses args */ - NULL, /* create per-directory config structure */ - NULL, /* merge per-directory config structures */ - NULL, /* create per-server config structure */ - NULL, /* merge per-server config structures */ - netware_mpm_cmds, /* command apr_table_t */ - netware_mpm_hooks, /* register hooks */ -}; diff --git a/server/mpm/prefork/.cvsignore b/server/mpm/prefork/.cvsignore deleted file mode 100644 index f3c7a7c5da68804a1bdf391127ba34aed33c3cca..0000000000000000000000000000000000000000 --- a/server/mpm/prefork/.cvsignore +++ /dev/null @@ -1 +0,0 @@ -Makefile diff --git a/server/mpm/prefork/Makefile.in b/server/mpm/prefork/Makefile.in deleted file mode 100644 index 5d086070f2c639a15101cac2f55d63c14cf85759..0000000000000000000000000000000000000000 --- a/server/mpm/prefork/Makefile.in +++ /dev/null @@ -1,10 +0,0 @@ - -DEPTH = ../../.. -topsrcdir = @topsrcdir@ -srcdir = @srcdir@ -VPATH = @srcdir@ - -LTLIBRARY_NAME = libprefork.la -LTLIBRARY_SOURCES = prefork.c - -include $(topsrcdir)/build/ltlib.mk diff --git a/server/mpm/prefork/config.m4 b/server/mpm/prefork/config.m4 deleted file mode 100644 index b4cfe383576649ea30020a3c3d7aa33fe2270c4b..0000000000000000000000000000000000000000 --- a/server/mpm/prefork/config.m4 +++ /dev/null @@ -1,5 +0,0 @@ -if test "$MPM_NAME" = "prefork" ; then - APACHE_OUTPUT(modules/mpm/$MPM_NAME/Makefile) - - APACHE_MPM_CHECK_SHMEM -fi diff --git a/server/mpm/prefork/mpm.h b/server/mpm/prefork/mpm.h deleted file mode 100644 index df8ea97d62d452078d8545ec139c096268c6d3da..0000000000000000000000000000000000000000 --- a/server/mpm/prefork/mpm.h +++ /dev/null @@ -1,72 +0,0 @@ -/* ==================================================================== - * The Apache Software License, Version 1.1 - * - * Copyright (c) 2000 The Apache Software Foundation. All rights - * reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in - * the documentation and/or other materials provided with the - * distribution. - * - * 3. The end-user documentation included with the redistribution, - * if any, must include the following acknowledgment: - * "This product includes software developed by the - * Apache Software Foundation (http://www.apache.org/)." - * Alternately, this acknowledgment may appear in the software itself, - * if and wherever such third-party acknowledgments normally appear. - * - * 4. The names "Apache" and "Apache Software Foundation" must - * not be used to endorse or promote products derived from this - * software without prior written permission. For written - * permission, please contact apache@apache.org. - * - * 5. Products derived from this software may not be called "Apache", - * nor may "Apache" appear in their name, without prior written - * permission of the Apache Software Foundation. - * - * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED - * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES - * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR - * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF - * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND - * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, - * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT - * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * ==================================================================== - * - * This software consists of voluntary contributions made by many - * individuals on behalf of the Apache Software Foundation. For more - * information on the Apache Software Foundation, please see - * . - * - * Portions of this software are based upon public domain software - * originally written at the National Center for Supercomputing Applications, - * University of Illinois, Urbana-Champaign. - */ - -#include "httpd.h" -#include "mpm_default.h" -#include "scoreboard.h" - -#ifndef APACHE_MPM_PREFORK_H -#define APACHE_MPM_PREFORK_H - -#define PREFORK_MPM - -extern int ap_max_daemons_limit; -extern scoreboard *ap_scoreboard_image; -extern server_rec *ap_server_conf; -extern int ap_my_pid; -#endif /* APACHE_MPM_DEXTER_H */ diff --git a/server/mpm/prefork/mpm_default.h b/server/mpm/prefork/mpm_default.h deleted file mode 100644 index 3ff9ac27f7fe6e5ff99de3a741d822343199e9d2..0000000000000000000000000000000000000000 --- a/server/mpm/prefork/mpm_default.h +++ /dev/null @@ -1,97 +0,0 @@ -/* ==================================================================== - * Copyright (c) 1995-1999 The Apache Group. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in - * the documentation and/or other materials provided with the - * distribution. - * - * 3. All advertising materials mentioning features or use of this - * software must display the following acknowledgment: - * "This product includes software developed by the Apache Group - * for use in the Apache HTTP server project (http://www.apache.org/)." - * - * 4. The names "Apache Server" and "Apache Group" must not be used to - * endorse or promote products derived from this software without - * prior written permission. For written permission, please contact - * apache@apache.org. - * - * 5. Products derived from this software may not be called "Apache" - * nor may "Apache" appear in their names without prior written - * permission of the Apache Group. - * - * 6. Redistributions of any form whatsoever must retain the following - * acknowledgment: - * "This product includes software developed by the Apache Group - * for use in the Apache HTTP server project (http://www.apache.org/)." - * - * THIS SOFTWARE IS PROVIDED BY THE APACHE GROUP ``AS IS'' AND ANY - * EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR - * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE APACHE GROUP OR - * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT - * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, - * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED - * OF THE POSSIBILITY OF SUCH DAMAGE. - * ==================================================================== - * - * This software consists of voluntary contributions made by many - * individuals on behalf of the Apache Group and was originally based - * on public domain software written at the National Center for - * Supercomputing Applications, University of Illinois, Urbana-Champaign. - * For more information on the Apache Group and the Apache HTTP server - * project, please see . - * - */ - -#ifndef APACHE_MPM_DEFAULT_H -#define APACHE_MPM_DEFAULT_H - -/* Number of servers to spawn off by default --- also, if fewer than - * this free when the caretaker checks, it will spawn more. - */ -#ifndef DEFAULT_START_DAEMON -#define DEFAULT_START_DAEMON 5 -#endif - -/* Maximum number of *free* server processes --- more than this, and - * they will die off. - */ - -#ifndef DEFAULT_MAX_FREE_DAEMON -#define DEFAULT_MAX_FREE_DAEMON 10 -#endif - -/* Minimum --- fewer than this, and more will be created */ - -#ifndef DEFAULT_MIN_FREE_DAEMON -#define DEFAULT_MIN_FREE_DAEMON 5 -#endif - -/* Limit on the total --- clients will be locked out if more servers than - * this are needed. It is intended solely to keep the server from crashing - * when things get out of hand. - * - * We keep a hard maximum number of servers, for two reasons --- first off, - * in case something goes seriously wrong, we want to stop the fork bomb - * short of actually crashing the machine we're running on by filling some - * kernel table. Secondly, it keeps the size of the scoreboard file small - * enough that we can read the whole thing without worrying too much about - * the overhead. - */ -#ifndef HARD_SERVER_LIMIT -#define HARD_SERVER_LIMIT 256 -#endif - -#endif /* AP_MPM_DEFAULT_H */ diff --git a/server/mpm/prefork/prefork.c b/server/mpm/prefork/prefork.c deleted file mode 100644 index 0d7c19e05b3a82c1fb836c94e20926b9d68dd78a..0000000000000000000000000000000000000000 --- a/server/mpm/prefork/prefork.c +++ /dev/null @@ -1,3514 +0,0 @@ -/* ==================================================================== - * Copyright (c) 1995-1999 The Apache Group. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in - * the documentation and/or other materials provided with the - * distribution. - * - * 3. All advertising materials mentioning features or use of this - * software must display the following acknowledgment: - * "This product includes software developed by the Apache Group - * for use in the Apache HTTP server project (http://www.apache.org/)." - * - * 4. The names "Apache Server" and "Apache Group" must not be used to - * endorse or promote products derived from this software without - * prior written permission. For written permission, please contact - * apache@apache.org. - * - * 5. Products derived from this software may not be called "Apache" - * nor may "Apache" appear in their names without prior written - * permission of the Apache Group. - * - * 6. Redistributions of any form whatsoever must retain the following - * acknowledgment: - * "This product includes software developed by the Apache Group - * for use in the Apache HTTP server project (http://www.apache.org/)." - * - * THIS SOFTWARE IS PROVIDED BY THE APACHE GROUP ``AS IS'' AND ANY - * EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR - * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE APACHE GROUP OR - * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT - * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, - * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED - * OF THE POSSIBILITY OF SUCH DAMAGE. - * ==================================================================== - * - * This software consists of voluntary contributions made by many - * individuals on behalf of the Apache Group and was originally based - * on public domain software written at the National Center for - * Supercomputing Applications, University of Illinois, Urbana-Champaign. - * For more information on the Apache Group and the Apache HTTP server - * project, please see . - * - */ - -/* - * httpd.c: simple http daemon for answering WWW file requests - * - * - * 03-21-93 Rob McCool wrote original code (up to NCSA HTTPd 1.3) - * - * 03-06-95 blong - * changed server number for child-alone processes to 0 and changed name - * of processes - * - * 03-10-95 blong - * Added numerous speed hacks proposed by Robert S. Thau (rst@ai.mit.edu) - * including set group before fork, and call gettime before to fork - * to set up libraries. - * - * 04-14-95 rst / rh - * Brandon's code snarfed from NCSA 1.4, but tinkered to work with the - * Apache server, and also to have child processes do accept() directly. - * - * April-July '95 rst - * Extensive rework for Apache. - */ - -/* TODO: this is a cobbled together prefork MPM example... it should mostly - * TODO: behave like apache-1.3... here's a short list of things I think - * TODO: need cleaning up still: - * TODO: - use ralf's mm stuff for the shared mem and mutexes - * TODO: - abstract the Listen stuff, it's going to be common with other MPM - * TODO: - clean up scoreboard stuff when we figure out how to do it in 2.0 - */ - -#define CORE_PRIVATE - -#include "httpd.h" -#include "http_main.h" -#include "http_log.h" -#include "http_config.h" -#include "http_core.h" /* for get_remote_host */ -#include "http_connection.h" -#include "scoreboard_prefork.h" -#include "ap_mpm.h" -#include "unixd.h" -#ifdef USE_SHMGET_SCOREBOARD -#include -#include -#include -#endif - -#ifdef HAVE_BSTRING_H -#include /* for IRIX, FD_SET calls bzero() */ -#endif - -/* config globals */ - -static int ap_max_requests_per_child=0; -static char *ap_pid_fname=NULL; -static char *ap_scoreboard_fname=NULL; -static char *ap_lock_fname; -static char *ap_server_argv0=NULL; -static struct in_addr ap_bind_address; -static int ap_daemons_to_start=0; -static int ap_daemons_min_free=0; -static int ap_daemons_max_free=0; -static int ap_daemons_limit=0; -static time_t ap_restart_time=0; -static int ap_listenbacklog; -static int ap_extended_status = 0; - -/* - * The max child slot ever assigned, preserved across restarts. Necessary - * to deal with MaxClients changes across SIGUSR1 restarts. We use this - * value to optimize routines that have to scan the entire scoreboard. - */ -static int max_daemons_limit = -1; - -/* - * During config time, listeners is treated as a NULL-terminated list. - * child_main previously would start at the beginning of the list each time - * through the loop, so a socket early on in the list could easily starve out - * sockets later on in the list. The solution is to start at the listener - * after the last one processed. But to do that fast/easily in child_main it's - * way more convenient for listeners to be a ring that loops back on itself. - * The routine setup_listeners() is called after config time to both open up - * the sockets and to turn the NULL-terminated list into a ring that loops back - * on itself. - * - * head_listener is used by each child to keep track of what they consider - * to be the "start" of the ring. It is also set by make_child to ensure - * that new children also don't starve any sockets. - * - * Note that listeners != NULL is ensured by read_config(). - */ -static listen_rec *ap_listeners; -static listen_rec *head_listener; - -static char ap_coredump_dir[MAX_STRING_LEN]; - -/* *Non*-shared http_main globals... */ - -static server_rec *server_conf; -static int sd; -static fd_set listenfds; -static int listenmaxfd; - -/* one_process --- debugging mode variable; can be set from the command line - * with the -X flag. If set, this gets you the child_main loop running - * in the process which originally started up (no detach, no make_child), - * which is a pretty nice debugging environment. (You'll get a SIGHUP - * early in standalone_main; just continue through. This is the server - * trying to kill off any child processes which it might have lying - * around --- Apache doesn't keep track of their pids, it just sends - * SIGHUP to the process group, ignoring it in the root process. - * Continue through and you'll be fine.). - */ - -static int one_process = 0; - -#ifdef HAS_OTHER_CHILD -/* used to maintain list of children which aren't part of the scoreboard */ -typedef struct other_child_rec other_child_rec; -struct other_child_rec { - other_child_rec *next; - int pid; - void (*maintenance) (int, void *, ap_wait_t); - void *data; - int write_fd; -}; -static other_child_rec *other_children; -#endif - -static pool *pconf; /* Pool for config stuff */ -static pool *pchild; /* Pool for httpd child stuff */ - -static int my_pid; /* it seems silly to call getpid all the time */ -#ifndef MULTITHREAD -static int my_child_num; -#endif - -#ifdef TPF -int tpf_child = 0; -char tpf_server_name[INETD_SERVNAME_LENGTH+1]; -#endif /* TPF */ - -static scoreboard *ap_scoreboard_image = NULL; - -static int volatile exit_after_unblock = 0; - -#ifdef GPROF -/* - * change directory for gprof to plop the gmon.out file - * configure in httpd.conf: - * GprofDir logs/ -> $ServerRoot/logs/gmon.out - * GprofDir logs/% -> $ServerRoot/logs/gprof.$pid/gmon.out - */ -static void chdir_for_gprof(void) -{ - core_server_config *sconf = - ap_get_module_config(server_conf->module_config, &core_module); - char *dir = sconf->gprof_dir; - - if(dir) { - char buf[512]; - int len = strlen(sconf->gprof_dir) - 1; - if(*(dir + len) == '%') { - dir[len] = '\0'; - ap_snprintf(buf, sizeof(buf), "%sgprof.%d", dir, (int)getpid()); - } - dir = ap_server_root_relative(pconf, buf[0] ? buf : dir); - if(mkdir(dir, 0755) < 0 && errno != EEXIST) { - ap_log_error(APLOG_MARK, APLOG_ERR, server_conf, - "gprof: error creating directory %s", dir); - } - } - else { - dir = ap_server_root_relative(pconf, "logs"); - } - - chdir(dir); -} -#else -#define chdir_for_gprof() -#endif - -/* a clean exit from a child with proper cleanup */ -static void clean_child_exit(int code) __attribute__ ((noreturn)); -static void clean_child_exit(int code) -{ - if (pchild) { - ap_destroy_pool(pchild); - } - chdir_for_gprof(); - exit(code); -} - -#if defined(USE_FCNTL_SERIALIZED_ACCEPT) || defined(USE_FLOCK_SERIALIZED_ACCEPT) -static void expand_lock_fname(pool *p) -{ - /* XXXX possibly bogus cast */ - ap_lock_fname = ap_psprintf(p, "%s.%lu", - ap_server_root_relative(p, ap_lock_fname), (unsigned long)getpid()); -} -#endif - -#if defined (USE_USLOCK_SERIALIZED_ACCEPT) - -#include - -static ulock_t uslock = NULL; - -#define accept_mutex_child_init(x) - -static void accept_mutex_init(pool *p) -{ - ptrdiff_t old; - usptr_t *us; - - - /* default is 8, allocate enough for all the children plus the parent */ - if ((old = usconfig(CONF_INITUSERS, HARD_SERVER_LIMIT + 1)) == -1) { - perror("usconfig(CONF_INITUSERS)"); - exit(-1); - } - - if ((old = usconfig(CONF_LOCKTYPE, US_NODEBUG)) == -1) { - perror("usconfig(CONF_LOCKTYPE)"); - exit(-1); - } - if ((old = usconfig(CONF_ARENATYPE, US_SHAREDONLY)) == -1) { - perror("usconfig(CONF_ARENATYPE)"); - exit(-1); - } - if ((us = usinit("/dev/zero")) == NULL) { - perror("usinit"); - exit(-1); - } - - if ((uslock = usnewlock(us)) == NULL) { - perror("usnewlock"); - exit(-1); - } -} - -static void accept_mutex_on(void) -{ - switch (ussetlock(uslock)) { - case 1: - /* got lock */ - break; - case 0: - fprintf(stderr, "didn't get lock\n"); - clean_child_exit(APEXIT_CHILDFATAL); - case -1: - perror("ussetlock"); - clean_child_exit(APEXIT_CHILDFATAL); - } -} - -static void accept_mutex_off(void) -{ - if (usunsetlock(uslock) == -1) { - perror("usunsetlock"); - clean_child_exit(APEXIT_CHILDFATAL); - } -} - -#elif defined (USE_PTHREAD_SERIALIZED_ACCEPT) - -/* This code probably only works on Solaris ... but it works really fast - * on Solaris. Note that pthread mutexes are *NOT* released when a task - * dies ... the task has to free it itself. So we block signals and - * try to be nice about releasing the mutex. - */ - -#include - -static pthread_mutex_t *accept_mutex = (void *)(caddr_t) -1; -static int have_accept_mutex; -static sigset_t accept_block_mask; -static sigset_t accept_previous_mask; - -static void accept_mutex_child_cleanup(void *foo) -{ - if (accept_mutex != (void *)(caddr_t)-1 - && have_accept_mutex) { - pthread_mutex_unlock(accept_mutex); - } -} - -static void accept_mutex_child_init(pool *p) -{ - ap_register_cleanup(p, NULL, accept_mutex_child_cleanup, ap_null_cleanup); -} - -static void accept_mutex_cleanup(void *foo) -{ - if (accept_mutex != (void *)(caddr_t)-1 - && munmap((caddr_t) accept_mutex, sizeof(*accept_mutex))) { - perror("munmap"); - } - accept_mutex = (void *)(caddr_t)-1; -} - -static void accept_mutex_init(pool *p) -{ - pthread_mutexattr_t mattr; - int fd; - - fd = open("/dev/zero", O_RDWR); - if (fd == -1) { - perror("open(/dev/zero)"); - exit(APEXIT_INIT); - } - accept_mutex = (pthread_mutex_t *) mmap((caddr_t) 0, sizeof(*accept_mutex), - PROT_READ | PROT_WRITE, MAP_SHARED, fd, 0); - if (accept_mutex == (void *) (caddr_t) - 1) { - perror("mmap"); - exit(APEXIT_INIT); - } - close(fd); - if ((errno = pthread_mutexattr_init(&mattr))) { - perror("pthread_mutexattr_init"); - exit(APEXIT_INIT); - } - if ((errno = pthread_mutexattr_setpshared(&mattr, - PTHREAD_PROCESS_SHARED))) { - perror("pthread_mutexattr_setpshared"); - exit(APEXIT_INIT); - } - if ((errno = pthread_mutex_init(accept_mutex, &mattr))) { - perror("pthread_mutex_init"); - exit(APEXIT_INIT); - } - sigfillset(&accept_block_mask); - sigdelset(&accept_block_mask, SIGHUP); - sigdelset(&accept_block_mask, SIGTERM); - sigdelset(&accept_block_mask, SIGUSR1); - ap_register_cleanup(p, NULL, accept_mutex_cleanup, ap_null_cleanup); -} - -static void accept_mutex_on(void) -{ - int err; - - if (sigprocmask(SIG_BLOCK, &accept_block_mask, &accept_previous_mask)) { - perror("sigprocmask(SIG_BLOCK)"); - clean_child_exit(APEXIT_CHILDFATAL); - } - if ((err = pthread_mutex_lock(accept_mutex))) { - errno = err; - perror("pthread_mutex_lock"); - clean_child_exit(APEXIT_CHILDFATAL); - } - have_accept_mutex = 1; -} - -static void accept_mutex_off(void) -{ - int err; - - if ((err = pthread_mutex_unlock(accept_mutex))) { - errno = err; - perror("pthread_mutex_unlock"); - clean_child_exit(APEXIT_CHILDFATAL); - } - /* There is a slight race condition right here... if we were to die right - * now, we'd do another pthread_mutex_unlock. Now, doing that would let - * another process into the mutex. pthread mutexes are designed to be - * fast, as such they don't have protection for things like testing if the - * thread owning a mutex is actually unlocking it (or even any way of - * testing who owns the mutex). - * - * If we were to unset have_accept_mutex prior to releasing the mutex - * then the race could result in the server unable to serve hits. Doing - * it this way means that the server can continue, but an additional - * child might be in the critical section ... at least it's still serving - * hits. - */ - have_accept_mutex = 0; - if (sigprocmask(SIG_SETMASK, &accept_previous_mask, NULL)) { - perror("sigprocmask(SIG_SETMASK)"); - clean_child_exit(1); - } -} - -#elif defined (USE_SYSVSEM_SERIALIZED_ACCEPT) - -#include -#include -#include - -#ifdef NEED_UNION_SEMUN -/* it makes no sense, but this isn't defined on solaris */ -union semun { - long val; - struct semid_ds *buf; - ushort *array; -}; - -#endif - -static int sem_id = -1; -static struct sembuf op_on; -static struct sembuf op_off; - -/* We get a random semaphore ... the lame sysv semaphore interface - * means we have to be sure to clean this up or else we'll leak - * semaphores. - */ -static void accept_mutex_cleanup(void *foo) -{ - union semun ick; - - if (sem_id < 0) - return; - /* this is ignored anyhow */ - ick.val = 0; - semctl(sem_id, 0, IPC_RMID, ick); -} - -#define accept_mutex_child_init(x) - -static void accept_mutex_init(pool *p) -{ - union semun ick; - struct semid_ds buf; - - /* acquire the semaphore */ - sem_id = semget(IPC_PRIVATE, 1, IPC_CREAT | 0600); - if (sem_id < 0) { - perror("semget"); - exit(APEXIT_INIT); - } - ick.val = 1; - if (semctl(sem_id, 0, SETVAL, ick) < 0) { - perror("semctl(SETVAL)"); - exit(APEXIT_INIT); - } - if (!getuid()) { - /* restrict it to use only by the appropriate user_id ... not that this - * stops CGIs from acquiring it and dinking around with it. - */ - buf.sem_perm.uid = unixd_config.user_id; - buf.sem_perm.gid = unixd_config.group_id; - buf.sem_perm.mode = 0600; - ick.buf = &buf; - if (semctl(sem_id, 0, IPC_SET, ick) < 0) { - perror("semctl(IPC_SET)"); - exit(APEXIT_INIT); - } - } - ap_register_cleanup(p, NULL, accept_mutex_cleanup, ap_null_cleanup); - - /* pre-initialize these */ - op_on.sem_num = 0; - op_on.sem_op = -1; - op_on.sem_flg = SEM_UNDO; - op_off.sem_num = 0; - op_off.sem_op = 1; - op_off.sem_flg = SEM_UNDO; -} - -static void accept_mutex_on(void) -{ - while (semop(sem_id, &op_on, 1) < 0) { - if (errno != EINTR) { - perror("accept_mutex_on"); - clean_child_exit(APEXIT_CHILDFATAL); - } - } -} - -static void accept_mutex_off(void) -{ - while (semop(sem_id, &op_off, 1) < 0) { - if (errno != EINTR) { - perror("accept_mutex_off"); - clean_child_exit(APEXIT_CHILDFATAL); - } - } -} - -#elif defined(USE_FCNTL_SERIALIZED_ACCEPT) -static struct flock lock_it; -static struct flock unlock_it; - -static int lock_fd = -1; - -#define accept_mutex_child_init(x) - -/* - * Initialize mutex lock. - * Must be safe to call this on a restart. - */ -static void accept_mutex_init(pool *p) -{ - - lock_it.l_whence = SEEK_SET; /* from current point */ - lock_it.l_start = 0; /* -"- */ - lock_it.l_len = 0; /* until end of file */ - lock_it.l_type = F_WRLCK; /* set exclusive/write lock */ - lock_it.l_pid = 0; /* pid not actually interesting */ - unlock_it.l_whence = SEEK_SET; /* from current point */ - unlock_it.l_start = 0; /* -"- */ - unlock_it.l_len = 0; /* until end of file */ - unlock_it.l_type = F_UNLCK; /* set exclusive/write lock */ - unlock_it.l_pid = 0; /* pid not actually interesting */ - - expand_lock_fname(p); - lock_fd = ap_popenf(p, ap_lock_fname, O_CREAT | O_WRONLY | O_EXCL, 0644); - if (lock_fd == -1) { - perror("open"); - fprintf(stderr, "Cannot open lock file: %s\n", ap_lock_fname); - exit(APEXIT_INIT); - } - unlink(ap_lock_fname); -} - -static void accept_mutex_on(void) -{ - int ret; - - while ((ret = fcntl(lock_fd, F_SETLKW, &lock_it)) < 0 && errno == EINTR) { - /* nop */ - } - - if (ret < 0) { - ap_log_error(APLOG_MARK, APLOG_EMERG, server_conf, - "fcntl: F_SETLKW: Error getting accept lock, exiting! " - "Perhaps you need to use the LockFile directive to place " - "your lock file on a local disk!"); - clean_child_exit(APEXIT_CHILDFATAL); - } -} - -static void accept_mutex_off(void) -{ - int ret; - - while ((ret = fcntl(lock_fd, F_SETLKW, &unlock_it)) < 0 && errno == EINTR) { - /* nop */ - } - if (ret < 0) { - ap_log_error(APLOG_MARK, APLOG_EMERG, server_conf, - "fcntl: F_SETLKW: Error freeing accept lock, exiting! " - "Perhaps you need to use the LockFile directive to place " - "your lock file on a local disk!"); - clean_child_exit(APEXIT_CHILDFATAL); - } -} - -#elif defined(USE_FLOCK_SERIALIZED_ACCEPT) - -static int lock_fd = -1; - -static void accept_mutex_cleanup(void *foo) -{ - unlink(ap_lock_fname); -} - -/* - * Initialize mutex lock. - * Done by each child at it's birth - */ -static void accept_mutex_child_init(pool *p) -{ - - lock_fd = ap_popenf(p, ap_lock_fname, O_WRONLY, 0600); - if (lock_fd == -1) { - ap_log_error(APLOG_MARK, APLOG_EMERG, server_conf, - "Child cannot open lock file: %s", ap_lock_fname); - clean_child_exit(APEXIT_CHILDINIT); - } -} - -/* - * Initialize mutex lock. - * Must be safe to call this on a restart. - */ -static void accept_mutex_init(pool *p) -{ - expand_lock_fname(p); - unlink(ap_lock_fname); - lock_fd = ap_popenf(p, ap_lock_fname, O_CREAT | O_WRONLY | O_EXCL, 0600); - if (lock_fd == -1) { - ap_log_error(APLOG_MARK, APLOG_EMERG, server_conf, - "Parent cannot open lock file: %s", ap_lock_fname); - exit(APEXIT_INIT); - } - ap_register_cleanup(p, NULL, accept_mutex_cleanup, ap_null_cleanup); -} - -static void accept_mutex_on(void) -{ - int ret; - - while ((ret = flock(lock_fd, LOCK_EX)) < 0 && errno == EINTR) - continue; - - if (ret < 0) { - ap_log_error(APLOG_MARK, APLOG_EMERG, server_conf, - "flock: LOCK_EX: Error getting accept lock. Exiting!"); - clean_child_exit(APEXIT_CHILDFATAL); - } -} - -static void accept_mutex_off(void) -{ - if (flock(lock_fd, LOCK_UN) < 0) { - ap_log_error(APLOG_MARK, APLOG_EMERG, server_conf, - "flock: LOCK_UN: Error freeing accept lock. Exiting!"); - clean_child_exit(APEXIT_CHILDFATAL); - } -} - -#elif defined(USE_OS2SEM_SERIALIZED_ACCEPT) - -static HMTX lock_sem = -1; - -static void accept_mutex_cleanup(void *foo) -{ - DosReleaseMutexSem(lock_sem); - DosCloseMutexSem(lock_sem); -} - -/* - * Initialize mutex lock. - * Done by each child at it's birth - */ -static void accept_mutex_child_init(pool *p) -{ - int rc = DosOpenMutexSem(NULL, &lock_sem); - - if (rc != 0) { - ap_log_error(APLOG_MARK, APLOG_NOERRNO|APLOG_EMERG, server_conf, - "Child cannot open lock semaphore, rc=%d", rc); - clean_child_exit(APEXIT_CHILDINIT); - } -} - -/* - * Initialize mutex lock. - * Must be safe to call this on a restart. - */ -static void accept_mutex_init(pool *p) -{ - int rc = DosCreateMutexSem(NULL, &lock_sem, DC_SEM_SHARED, FALSE); - - if (rc != 0) { - ap_log_error(APLOG_MARK, APLOG_NOERRNO|APLOG_EMERG, server_conf, - "Parent cannot create lock semaphore, rc=%d", rc); - exit(APEXIT_INIT); - } - - ap_register_cleanup(p, NULL, accept_mutex_cleanup, ap_null_cleanup); -} - -static void accept_mutex_on(void) -{ - int rc = DosRequestMutexSem(lock_sem, SEM_INDEFINITE_WAIT); - - if (rc != 0) { - ap_log_error(APLOG_MARK, APLOG_NOERRNO|APLOG_EMERG, server_conf, - "OS2SEM: Error %d getting accept lock. Exiting!", rc); - clean_child_exit(APEXIT_CHILDFATAL); - } -} - -static void accept_mutex_off(void) -{ - int rc = DosReleaseMutexSem(lock_sem); - - if (rc != 0) { - ap_log_error(APLOG_MARK, APLOG_NOERRNO|APLOG_EMERG, server_conf, - "OS2SEM: Error %d freeing accept lock. Exiting!", rc); - clean_child_exit(APEXIT_CHILDFATAL); - } -} - -#elif defined(USE_TPF_CORE_SERIALIZED_ACCEPT) - -static int tpf_core_held; - -static void accept_mutex_cleanup(void *foo) -{ - if(tpf_core_held) - coruc(RESOURCE_KEY); -} - -#define accept_mutex_init(x) - -static void accept_mutex_child_init(pool *p) -{ - ap_register_cleanup(p, NULL, accept_mutex_cleanup, ap_null_cleanup); - tpf_core_held = 0; -} - -static void accept_mutex_on(void) -{ - corhc(RESOURCE_KEY); - tpf_core_held = 1; - ap_check_signals(); -} - -static void accept_mutex_off(void) -{ - coruc(RESOURCE_KEY); - tpf_core_held = 0; - ap_check_signals(); -} - -#else -/* Default --- no serialization. Other methods *could* go here, - * as #elifs... - */ -#if !defined(MULTITHREAD) -/* Multithreaded systems don't complete between processes for - * the sockets. */ -#define NO_SERIALIZED_ACCEPT -#define accept_mutex_child_init(x) -#define accept_mutex_init(x) -#define accept_mutex_on() -#define accept_mutex_off() -#endif -#endif - -/* On some architectures it's safe to do unserialized accept()s in the single - * Listen case. But it's never safe to do it in the case where there's - * multiple Listen statements. Define SINGLE_LISTEN_UNSERIALIZED_ACCEPT - * when it's safe in the single Listen case. - */ -#ifdef SINGLE_LISTEN_UNSERIALIZED_ACCEPT -#define SAFE_ACCEPT(stmt) do {if(ap_listeners->next != ap_listeners) {stmt;}} while(0) -#else -#define SAFE_ACCEPT(stmt) do {stmt;} while(0) -#endif - - -/***************************************************************** - * dealing with other children - */ - -#ifdef HAS_OTHER_CHILD -API_EXPORT(void) ap_register_other_child(int pid, - void (*maintenance) (int reason, void *, ap_wait_t status), - void *data, int write_fd) -{ - other_child_rec *ocr; - - ocr = ap_palloc(pconf, sizeof(*ocr)); - ocr->pid = pid; - ocr->maintenance = maintenance; - ocr->data = data; - ocr->write_fd = write_fd; - ocr->next = other_children; - other_children = ocr; -} - -/* note that since this can be called by a maintenance function while we're - * scanning the other_children list, all scanners should protect themself - * by loading ocr->next before calling any maintenance function. - */ -API_EXPORT(void) ap_unregister_other_child(void *data) -{ - other_child_rec **pocr, *nocr; - - for (pocr = &other_children; *pocr; pocr = &(*pocr)->next) { - if ((*pocr)->data == data) { - nocr = (*pocr)->next; - (*(*pocr)->maintenance) (OC_REASON_UNREGISTER, (*pocr)->data, -1); - *pocr = nocr; - /* XXX: um, well we've just wasted some space in pconf ? */ - return; - } - } -} - -/* test to ensure that the write_fds are all still writable, otherwise - * invoke the maintenance functions as appropriate */ -static void probe_writable_fds(void) -{ - fd_set writable_fds; - int fd_max; - other_child_rec *ocr, *nocr; - struct timeval tv; - int rc; - - if (other_children == NULL) - return; - - fd_max = 0; - FD_ZERO(&writable_fds); - do { - for (ocr = other_children; ocr; ocr = ocr->next) { - if (ocr->write_fd == -1) - continue; - FD_SET(ocr->write_fd, &writable_fds); - if (ocr->write_fd > fd_max) { - fd_max = ocr->write_fd; - } - } - if (fd_max == 0) - return; - - tv.tv_sec = 0; - tv.tv_usec = 0; - rc = ap_select(fd_max + 1, NULL, &writable_fds, NULL, &tv); - } while (rc == -1 && errno == EINTR); - - if (rc == -1) { - /* XXX: uhh this could be really bad, we could have a bad file - * descriptor due to a bug in one of the maintenance routines */ - ap_log_unixerr("probe_writable_fds", "select", - "could not probe writable fds", server_conf); - return; - } - if (rc == 0) - return; - - for (ocr = other_children; ocr; ocr = nocr) { - nocr = ocr->next; - if (ocr->write_fd == -1) - continue; - if (FD_ISSET(ocr->write_fd, &writable_fds)) - continue; - (*ocr->maintenance) (OC_REASON_UNWRITABLE, ocr->data, -1); - } -} - -/* possibly reap an other_child, return 0 if yes, -1 if not */ -static int reap_other_child(int pid, ap_wait_t status) -{ - other_child_rec *ocr, *nocr; - - for (ocr = other_children; ocr; ocr = nocr) { - nocr = ocr->next; - if (ocr->pid != pid) - continue; - ocr->pid = -1; - (*ocr->maintenance) (OC_REASON_DEATH, ocr->data, status); - return 0; - } - return -1; -} -#endif - -/***************************************************************** - * - * Dealing with the scoreboard... a lot of these variables are global - * only to avoid getting clobbered by the longjmp() that happens when - * a hard timeout expires... - * - * We begin with routines which deal with the file itself... - */ - -#if defined(USE_OS2_SCOREBOARD) - -/* The next two routines are used to access shared memory under OS/2. */ -/* This requires EMX v09c to be installed. */ - -caddr_t create_shared_heap(const char *name, size_t size) -{ - ULONG rc; - void *mem; - Heap_t h; - - rc = DosAllocSharedMem(&mem, name, size, - PAG_COMMIT | PAG_READ | PAG_WRITE); - if (rc != 0) - return NULL; - h = _ucreate(mem, size, !_BLOCK_CLEAN, _HEAP_REGULAR | _HEAP_SHARED, - NULL, NULL); - if (h == NULL) - DosFreeMem(mem); - return (caddr_t) h; -} - -caddr_t get_shared_heap(const char *Name) -{ - - PVOID BaseAddress; /* Pointer to the base address of - the shared memory object */ - ULONG AttributeFlags; /* Flags describing characteristics - of the shared memory object */ - APIRET rc; /* Return code */ - - /* Request read and write access to */ - /* the shared memory object */ - AttributeFlags = PAG_WRITE | PAG_READ; - - rc = DosGetNamedSharedMem(&BaseAddress, Name, AttributeFlags); - - if (rc != 0) { - printf("DosGetNamedSharedMem error: return code = %ld", rc); - return 0; - } - - return BaseAddress; -} - -static void setup_shared_mem(pool *p) -{ - caddr_t m; - - int rc; - - m = (caddr_t) create_shared_heap("\\SHAREMEM\\SCOREBOARD", SCOREBOARD_SIZE); - if (m == 0) { - fprintf(stderr, "%s: Could not create OS/2 Shared memory pool.\n", - ap_server_argv0); - exit(APEXIT_INIT); - } - - rc = _uopen((Heap_t) m); - if (rc != 0) { - fprintf(stderr, - "%s: Could not uopen() newly created OS/2 Shared memory pool.\n", - ap_server_argv0); - } - ap_scoreboard_image = (scoreboard *) m; - ap_scoreboard_image->global.running_generation = 0; -} - -static void reopen_scoreboard(pool *p) -{ - caddr_t m; - int rc; - - m = (caddr_t) get_shared_heap("\\SHAREMEM\\SCOREBOARD"); - if (m == 0) { - fprintf(stderr, "%s: Could not find existing OS/2 Shared memory pool.\n", - ap_server_argv0); - exit(APEXIT_INIT); - } - - rc = _uopen((Heap_t) m); - ap_scoreboard_image = (scoreboard *) m; -} - -#elif defined(USE_POSIX_SCOREBOARD) -#include -/* - * POSIX 1003.4 style - * - * Note 1: - * As of version 4.23A, shared memory in QNX must reside under /dev/shmem, - * where no subdirectories allowed. - * - * POSIX shm_open() and shm_unlink() will take care about this issue, - * but to avoid confusion, I suggest to redefine scoreboard file name - * in httpd.conf to cut "logs/" from it. With default setup actual name - * will be "/dev/shmem/logs.apache_status". - * - * If something went wrong and Apache did not unlinked this object upon - * exit, you can remove it manually, using "rm -f" command. - * - * Note 2: - * in QNX defines MAP_ANON, but current implementation - * does NOT support BSD style anonymous mapping. So, the order of - * conditional compilation is important: - * this #ifdef section must be ABOVE the next one (BSD style). - * - * I tested this stuff and it works fine for me, but if it provides - * trouble for you, just comment out USE_MMAP_SCOREBOARD in QNX section - * of ap_config.h - * - * June 5, 1997, - * Igor N. Kovalenko -- infoh@mail.wplus.net - */ - -static void cleanup_shared_mem(void *d) -{ - shm_unlink(ap_scoreboard_fname); -} - -static void setup_shared_mem(pool *p) -{ - char buf[512]; - caddr_t m; - int fd; - - fd = shm_open(ap_scoreboard_fname, O_RDWR | O_CREAT, S_IRUSR | S_IWUSR); - if (fd == -1) { - ap_snprintf(buf, sizeof(buf), "%s: could not open(create) scoreboard", - ap_server_argv0); - perror(buf); - exit(APEXIT_INIT); - } - if (ltrunc(fd, (off_t) SCOREBOARD_SIZE, SEEK_SET) == -1) { - ap_snprintf(buf, sizeof(buf), "%s: could not ltrunc scoreboard", - ap_server_argv0); - perror(buf); - shm_unlink(ap_scoreboard_fname); - exit(APEXIT_INIT); - } - if ((m = (caddr_t) mmap((caddr_t) 0, - (size_t) SCOREBOARD_SIZE, PROT_READ | PROT_WRITE, - MAP_SHARED, fd, (off_t) 0)) == (caddr_t) - 1) { - ap_snprintf(buf, sizeof(buf), "%s: cannot mmap scoreboard", - ap_server_argv0); - perror(buf); - shm_unlink(ap_scoreboard_fname); - exit(APEXIT_INIT); - } - close(fd); - ap_register_cleanup(p, NULL, cleanup_shared_mem, ap_null_cleanup); - ap_scoreboard_image = (scoreboard *) m; - ap_scoreboard_image->global.running_generation = 0; -} - -static void reopen_scoreboard(pool *p) -{ -} - -#elif defined(USE_MMAP_SCOREBOARD) - -static void setup_shared_mem(pool *p) -{ - caddr_t m; - -#if defined(MAP_ANON) -/* BSD style */ -#ifdef CONVEXOS11 - /* - * 9-Aug-97 - Jeff Venters (venters@convex.hp.com) - * ConvexOS maps address space as follows: - * 0x00000000 - 0x7fffffff : Kernel - * 0x80000000 - 0xffffffff : User - * Start mmapped area 1GB above start of text. - * - * Also, the length requires a pointer as the actual length is - * returned (rounded up to a page boundary). - */ - { - unsigned len = SCOREBOARD_SIZE; - - m = mmap((caddr_t) 0xC0000000, &len, - PROT_READ | PROT_WRITE, MAP_ANON | MAP_SHARED, NOFD, 0); - } -#elif defined(MAP_TMPFILE) - { - char mfile[] = "/tmp/apache_shmem_XXXX"; - int fd = mkstemp(mfile); - if (fd == -1) { - perror("open"); - fprintf(stderr, "%s: Could not open %s\n", ap_server_argv0, mfile); - exit(APEXIT_INIT); - } - m = mmap((caddr_t) 0, SCOREBOARD_SIZE, - PROT_READ | PROT_WRITE, MAP_SHARED, fd, 0); - if (m == (caddr_t) - 1) { - perror("mmap"); - fprintf(stderr, "%s: Could not mmap %s\n", ap_server_argv0, mfile); - exit(APEXIT_INIT); - } - close(fd); - unlink(mfile); - } -#else - m = mmap((caddr_t) 0, SCOREBOARD_SIZE, - PROT_READ | PROT_WRITE, MAP_ANON | MAP_SHARED, -1, 0); -#endif - if (m == (caddr_t) - 1) { - perror("mmap"); - fprintf(stderr, "%s: Could not mmap memory\n", ap_server_argv0); - exit(APEXIT_INIT); - } -#else -/* Sun style */ - int fd; - - fd = open("/dev/zero", O_RDWR); - if (fd == -1) { - perror("open"); - fprintf(stderr, "%s: Could not open /dev/zero\n", ap_server_argv0); - exit(APEXIT_INIT); - } - m = mmap((caddr_t) 0, SCOREBOARD_SIZE, - PROT_READ | PROT_WRITE, MAP_SHARED, fd, 0); - if (m == (caddr_t) - 1) { - perror("mmap"); - fprintf(stderr, "%s: Could not mmap /dev/zero\n", ap_server_argv0); - exit(APEXIT_INIT); - } - close(fd); -#endif - ap_scoreboard_image = (scoreboard *) m; - ap_scoreboard_image->global.running_generation = 0; -} - -static void reopen_scoreboard(pool *p) -{ -} - -#elif defined(USE_SHMGET_SCOREBOARD) -static key_t shmkey = IPC_PRIVATE; -static int shmid = -1; - -static void setup_shared_mem(pool *p) -{ - struct shmid_ds shmbuf; -#ifdef MOVEBREAK - char *obrk; -#endif - - if ((shmid = shmget(shmkey, SCOREBOARD_SIZE, IPC_CREAT | SHM_R | SHM_W)) == -1) { -#ifdef LINUX - if (errno == ENOSYS) { - ap_log_error(APLOG_MARK, APLOG_NOERRNO|APLOG_EMERG, server_conf, - "Your kernel was built without CONFIG_SYSVIPC\n" - "%s: Please consult the Apache FAQ for details", - ap_server_argv0); - } -#endif - ap_log_error(APLOG_MARK, APLOG_EMERG, server_conf, - "could not call shmget"); - exit(APEXIT_INIT); - } - - ap_log_error(APLOG_MARK, APLOG_NOERRNO|APLOG_INFO, server_conf, - "created shared memory segment #%d", shmid); - -#ifdef MOVEBREAK - /* - * Some SysV systems place the shared segment WAY too close - * to the dynamic memory break point (sbrk(0)). This severely - * limits the use of malloc/sbrk in the program since sbrk will - * refuse to move past that point. - * - * To get around this, we move the break point "way up there", - * attach the segment and then move break back down. Ugly - */ - if ((obrk = sbrk(MOVEBREAK)) == (char *) -1) { - ap_log_error(APLOG_MARK, APLOG_ERR, server_conf, - "sbrk() could not move break"); - } -#endif - -#define BADSHMAT ((scoreboard *)(-1)) - if ((ap_scoreboard_image = (scoreboard *) shmat(shmid, 0, 0)) == BADSHMAT) { - ap_log_error(APLOG_MARK, APLOG_EMERG, server_conf, "shmat error"); - /* - * We exit below, after we try to remove the segment - */ - } - else { /* only worry about permissions if we attached the segment */ - if (shmctl(shmid, IPC_STAT, &shmbuf) != 0) { - ap_log_error(APLOG_MARK, APLOG_ERR, server_conf, - "shmctl() could not stat segment #%d", shmid); - } - else { - shmbuf.shm_perm.uid = unixd_config.user_id; - shmbuf.shm_perm.gid = unixd_config.group_id; - if (shmctl(shmid, IPC_SET, &shmbuf) != 0) { - ap_log_error(APLOG_MARK, APLOG_ERR, server_conf, - "shmctl() could not set segment #%d", shmid); - } - } - } - /* - * We must avoid leaving segments in the kernel's - * (small) tables. - */ - if (shmctl(shmid, IPC_RMID, NULL) != 0) { - ap_log_error(APLOG_MARK, APLOG_WARNING, server_conf, - "shmctl: IPC_RMID: could not remove shared memory segment #%d", - shmid); - } - if (ap_scoreboard_image == BADSHMAT) /* now bailout */ - exit(APEXIT_INIT); - -#ifdef MOVEBREAK - if (obrk == (char *) -1) - return; /* nothing else to do */ - if (sbrk(-(MOVEBREAK)) == (char *) -1) { - ap_log_error(APLOG_MARK, APLOG_ERR, server_conf, - "sbrk() could not move break back"); - } -#endif - ap_scoreboard_image->global.running_generation = 0; -} - -static void reopen_scoreboard(pool *p) -{ -} - -#elif defined(USE_TPF_SCOREBOARD) - -static void cleanup_scoreboard_heap() -{ - int rv; - rv = rsysc(ap_scoreboard_image, SCOREBOARD_FRAMES, SCOREBOARD_NAME); - if(rv == RSYSC_ERROR) { - ap_log_error(APLOG_MARK, APLOG_ERR, server_conf, - "rsysc() could not release scoreboard system heap"); - } -} - -static void setup_shared_mem(pool *p) -{ - cinfc(CINFC_WRITE, CINFC_CMMCTK2); - ap_scoreboard_image = (scoreboard *) gsysc(SCOREBOARD_FRAMES, SCOREBOARD_NAME); - - if (!ap_scoreboard_image) { - fprintf(stderr, "httpd: Could not create scoreboard system heap storage.\n"); - exit(APEXIT_INIT); - } - - ap_register_cleanup(p, NULL, cleanup_scoreboard_heap, ap_null_cleanup); - ap_scoreboard_image->global.running_generation = 0; -} - -static void reopen_scoreboard(pool *p) -{ - cinfc(CINFC_WRITE, CINFC_CMMCTK2); -} - -#else -#define SCOREBOARD_FILE -static scoreboard _scoreboard_image; -static int scoreboard_fd = -1; - -/* XXX: things are seriously screwed if we ever have to do a partial - * read or write ... we could get a corrupted scoreboard - */ -static int force_write(int fd, void *buffer, int bufsz) -{ - int rv, orig_sz = bufsz; - - do { - rv = write(fd, buffer, bufsz); - if (rv > 0) { - buffer = (char *) buffer + rv; - bufsz -= rv; - } - } while ((rv > 0 && bufsz > 0) || (rv == -1 && errno == EINTR)); - - return rv < 0 ? rv : orig_sz - bufsz; -} - -static int force_read(int fd, void *buffer, int bufsz) -{ - int rv, orig_sz = bufsz; - - do { - rv = read(fd, buffer, bufsz); - if (rv > 0) { - buffer = (char *) buffer + rv; - bufsz -= rv; - } - } while ((rv > 0 && bufsz > 0) || (rv == -1 && errno == EINTR)); - - return rv < 0 ? rv : orig_sz - bufsz; -} - -static void cleanup_scoreboard_file(void *foo) -{ - unlink(ap_scoreboard_fname); -} - -void reopen_scoreboard(pool *p) -{ - if (scoreboard_fd != -1) - ap_pclosef(p, scoreboard_fd); - -#ifdef TPF - ap_scoreboard_fname = ap_server_root_relative(p, ap_scoreboard_fname); -#endif /* TPF */ - scoreboard_fd = ap_popenf(p, ap_scoreboard_fname, O_CREAT | O_BINARY | O_RDWR, 0666); - if (scoreboard_fd == -1) { - perror(ap_scoreboard_fname); - fprintf(stderr, "Cannot open scoreboard file:\n"); - clean_child_exit(1); - } -} -#endif - -/* Called by parent process */ -static void reinit_scoreboard(pool *p) -{ - int running_gen = 0; - if (ap_scoreboard_image) - running_gen = ap_scoreboard_image->global.running_generation; - -#ifndef SCOREBOARD_FILE - if (ap_scoreboard_image == NULL) { - setup_shared_mem(p); - } - memset(ap_scoreboard_image, 0, SCOREBOARD_SIZE); - ap_scoreboard_image->global.running_generation = running_gen; -#else - ap_scoreboard_image = &_scoreboard_image; - ap_scoreboard_fname = ap_server_root_relative(p, ap_scoreboard_fname); - - scoreboard_fd = ap_popenf(p, ap_scoreboard_fname, O_CREAT | O_BINARY | O_RDWR, 0644); - if (scoreboard_fd == -1) { - perror(ap_scoreboard_fname); - fprintf(stderr, "Cannot open scoreboard file:\n"); - exit(APEXIT_INIT); - } - ap_register_cleanup(p, NULL, cleanup_scoreboard_file, ap_null_cleanup); - - memset((char *) ap_scoreboard_image, 0, sizeof(*ap_scoreboard_image)); - ap_scoreboard_image->global.running_generation = running_gen; - force_write(scoreboard_fd, ap_scoreboard_image, sizeof(*ap_scoreboard_image)); -#endif -} - -/* Routines called to deal with the scoreboard image - * --- note that we do *not* need write locks, since update_child_status - * only updates a *single* record in place, and only one process writes to - * a given scoreboard slot at a time (either the child process owning that - * slot, or the parent, noting that the child has died). - * - * As a final note --- setting the score entry to getpid() is always safe, - * since when the parent is writing an entry, it's only noting SERVER_DEAD - * anyway. - */ - -ap_inline void ap_sync_scoreboard_image(void) -{ -#ifdef SCOREBOARD_FILE - lseek(scoreboard_fd, 0L, 0); - force_read(scoreboard_fd, ap_scoreboard_image, sizeof(*ap_scoreboard_image)); -#endif -} - -API_EXPORT(int) ap_exists_scoreboard_image(void) -{ - return (ap_scoreboard_image ? 1 : 0); -} - -static ap_inline void put_scoreboard_info(int child_num, - short_score *new_score_rec) -{ -#ifdef SCOREBOARD_FILE - lseek(scoreboard_fd, (long) child_num * sizeof(short_score), 0); - force_write(scoreboard_fd, new_score_rec, sizeof(short_score)); -#endif -} - -int ap_update_child_status(int child_num, int status, request_rec *r) -{ - int old_status; - short_score *ss; - - if (child_num < 0) - return -1; - - ap_check_signals(); - - ap_sync_scoreboard_image(); - ss = &ap_scoreboard_image->servers[child_num]; - old_status = ss->status; - ss->status = status; - - if (ap_extended_status) { - if (status == SERVER_READY || status == SERVER_DEAD) { - /* - * Reset individual counters - */ - if (status == SERVER_DEAD) { - ss->my_access_count = 0L; - ss->my_bytes_served = 0L; - } - ss->conn_count = (unsigned short) 0; - ss->conn_bytes = (unsigned long) 0; - } - if (r) { - conn_rec *c = r->connection; - ap_cpystrn(ss->client, ap_get_remote_host(c, r->per_dir_config, - REMOTE_NOLOOKUP), sizeof(ss->client)); - if (r->the_request == NULL) { - ap_cpystrn(ss->request, "NULL", sizeof(ss->request)); - } else if (r->parsed_uri.password == NULL) { - ap_cpystrn(ss->request, r->the_request, sizeof(ss->request)); - } else { - /* Don't reveal the password in the server-status view */ - ap_cpystrn(ss->request, ap_pstrcat(r->pool, r->method, " ", - ap_unparse_uri_components(r->pool, &r->parsed_uri, UNP_OMITPASSWORD), - r->assbackwards ? NULL : " ", r->protocol, NULL), - sizeof(ss->request)); - } - ss->vhostrec = r->server; - } - } - if (status == SERVER_STARTING && r == NULL) { - /* clean up the slot's vhostrec pointer (maybe re-used) - * and mark the slot as belonging to a new generation. - */ - ss->vhostrec = NULL; - ap_scoreboard_image->parent[child_num].generation = ap_my_generation; -#ifdef SCOREBOARD_FILE - lseek(scoreboard_fd, XtOffsetOf(scoreboard, parent[child_num]), 0); - force_write(scoreboard_fd, &ap_scoreboard_image->parent[child_num], - sizeof(parent_score)); -#endif - } - put_scoreboard_info(child_num, ss); - - return old_status; -} - -static void update_scoreboard_global(void) -{ -#ifdef SCOREBOARD_FILE - lseek(scoreboard_fd, - (char *) &ap_scoreboard_image->global -(char *) ap_scoreboard_image, 0); - force_write(scoreboard_fd, &ap_scoreboard_image->global, - sizeof ap_scoreboard_image->global); -#endif -} - -void ap_time_process_request(int child_num, int status) -{ - short_score *ss; -#if defined(NO_GETTIMEOFDAY) && !defined(NO_TIMES) - struct tms tms_blk; -#endif - - if (child_num < 0) - return; - - ap_sync_scoreboard_image(); - ss = &ap_scoreboard_image->servers[child_num]; - - if (status == START_PREQUEST) { -#if defined(NO_GETTIMEOFDAY) -#ifndef NO_TIMES - if ((ss->start_time = times(&tms_blk)) == -1) -#endif /* NO_TIMES */ - ss->start_time = (clock_t) 0; -#else - if (gettimeofday(&ss->start_time, (struct timezone *) 0) < 0) - ss->start_time.tv_sec = - ss->start_time.tv_usec = 0L; -#endif - } - else if (status == STOP_PREQUEST) { -#if defined(NO_GETTIMEOFDAY) -#ifndef NO_TIMES - if ((ss->stop_time = times(&tms_blk)) == -1) -#endif - ss->stop_time = ss->start_time = (clock_t) 0; -#else - if (gettimeofday(&ss->stop_time, (struct timezone *) 0) < 0) - ss->stop_time.tv_sec = - ss->stop_time.tv_usec = - ss->start_time.tv_sec = - ss->start_time.tv_usec = 0L; -#endif - - } - - put_scoreboard_info(child_num, ss); -} - -static void increment_counts(int child_num, request_rec *r) -{ - long int bs = 0; - short_score *ss; - - ap_sync_scoreboard_image(); - ss = &ap_scoreboard_image->servers[child_num]; - - if (r->sent_bodyct) - ap_bgetopt(r->connection->client, BO_BYTECT, &bs); - -#ifndef NO_TIMES - times(&ss->times); -#endif - ss->access_count++; - ss->my_access_count++; - ss->conn_count++; - ss->bytes_served += (unsigned long) bs; - ss->my_bytes_served += (unsigned long) bs; - ss->conn_bytes += (unsigned long) bs; - - put_scoreboard_info(child_num, ss); -} - -static int find_child_by_pid(int pid) -{ - int i; - - for (i = 0; i < max_daemons_limit; ++i) - if (ap_scoreboard_image->parent[i].pid == pid) - return i; - - return -1; -} - -static void reclaim_child_processes(int terminate) -{ -#ifndef MULTITHREAD - int i, status; - long int waittime = 1024 * 16; /* in usecs */ - struct timeval tv; - int waitret, tries; - int not_dead_yet; -#ifdef HAS_OTHER_CHILD - other_child_rec *ocr, *nocr; -#endif - - ap_sync_scoreboard_image(); - - for (tries = terminate ? 4 : 1; tries <= 9; ++tries) { - /* don't want to hold up progress any more than - * necessary, but we need to allow children a few moments to exit. - * Set delay with an exponential backoff. - */ - tv.tv_sec = waittime / 1000000; - tv.tv_usec = waittime % 1000000; - waittime = waittime * 4; - ap_select(0, NULL, NULL, NULL, &tv); - - /* now see who is done */ - not_dead_yet = 0; - for (i = 0; i < max_daemons_limit; ++i) { - int pid = ap_scoreboard_image->parent[i].pid; - - if (pid == my_pid || pid == 0) - continue; - - waitret = waitpid(pid, &status, WNOHANG); - if (waitret == pid || waitret == -1) { - ap_scoreboard_image->parent[i].pid = 0; - continue; - } - ++not_dead_yet; - switch (tries) { - case 1: /* 16ms */ - case 2: /* 82ms */ - break; - case 3: /* 344ms */ - /* perhaps it missed the SIGHUP, lets try again */ - ap_log_error(APLOG_MARK, APLOG_NOERRNO|APLOG_WARNING, - server_conf, - "child process %d did not exit, sending another SIGHUP", - pid); - kill(pid, SIGHUP); - waittime = 1024 * 16; - break; - case 4: /* 16ms */ - case 5: /* 82ms */ - case 6: /* 344ms */ - break; - case 7: /* 1.4sec */ - /* ok, now it's being annoying */ - ap_log_error(APLOG_MARK, APLOG_NOERRNO|APLOG_WARNING, - server_conf, - "child process %d still did not exit, sending a SIGTERM", - pid); - kill(pid, SIGTERM); - break; - case 8: /* 6 sec */ - /* die child scum */ - ap_log_error(APLOG_MARK, APLOG_NOERRNO|APLOG_ERR, server_conf, - "child process %d still did not exit, sending a SIGKILL", - pid); - kill(pid, SIGKILL); - break; - case 9: /* 14 sec */ - /* gave it our best shot, but alas... If this really - * is a child we are trying to kill and it really hasn't - * exited, we will likely fail to bind to the port - * after the restart. - */ - ap_log_error(APLOG_MARK, APLOG_NOERRNO|APLOG_ERR, server_conf, - "could not make child process %d exit, " - "attempting to continue anyway", pid); - break; - } - } -#ifdef HAS_OTHER_CHILD - for (ocr = other_children; ocr; ocr = nocr) { - nocr = ocr->next; - if (ocr->pid == -1) - continue; - - waitret = waitpid(ocr->pid, &status, WNOHANG); - if (waitret == ocr->pid) { - ocr->pid = -1; - (*ocr->maintenance) (OC_REASON_DEATH, ocr->data, status); - } - else if (waitret == 0) { - (*ocr->maintenance) (OC_REASON_RESTART, ocr->data, -1); - ++not_dead_yet; - } - else if (waitret == -1) { - /* uh what the heck? they didn't call unregister? */ - ocr->pid = -1; - (*ocr->maintenance) (OC_REASON_LOST, ocr->data, -1); - } - } -#endif - if (!not_dead_yet) { - /* nothing left to wait for */ - break; - } - } -#endif /* ndef MULTITHREAD */ -} - - -#if defined(NEED_WAITPID) -/* - Systems without a real waitpid sometimes lose a child's exit while waiting - for another. Search through the scoreboard for missing children. - */ -int reap_children(ap_wait_t *status) -{ - int n, pid; - - for (n = 0; n < max_daemons_limit; ++n) { - ap_sync_scoreboard_image(); - if (ap_scoreboard_image->servers[n].status != SERVER_DEAD && - kill((pid = ap_scoreboard_image->parent[n].pid), 0) == -1) { - ap_update_child_status(n, SERVER_DEAD, NULL); - /* just mark it as having a successful exit status */ - bzero((char *) status, sizeof(ap_wait_t)); - return(pid); - } - } - return 0; -} -#endif - -/* Finally, this routine is used by the caretaker process to wait for - * a while... - */ - -/* number of calls to wait_or_timeout between writable probes */ -#ifndef INTERVAL_OF_WRITABLE_PROBES -#define INTERVAL_OF_WRITABLE_PROBES 10 -#endif -static int wait_or_timeout_counter; - -static int wait_or_timeout(ap_wait_t *status) -{ - struct timeval tv; - int ret; - - ++wait_or_timeout_counter; - if (wait_or_timeout_counter == INTERVAL_OF_WRITABLE_PROBES) { - wait_or_timeout_counter = 0; -#ifdef HAS_OTHER_CHILD - probe_writable_fds(); -#endif - } - ret = waitpid(-1, status, WNOHANG); - if (ret == -1 && errno == EINTR) { - return -1; - } - if (ret > 0) { - return ret; - } -#ifdef NEED_WAITPID - if ((ret = reap_children(status)) > 0) { - return ret; - } -#endif - tv.tv_sec = SCOREBOARD_MAINTENANCE_INTERVAL / 1000000; - tv.tv_usec = SCOREBOARD_MAINTENANCE_INTERVAL % 1000000; - ap_select(0, NULL, NULL, NULL, &tv); - return -1; -} - - -#if defined(NSIG) -#define NumSIG NSIG -#elif defined(_NSIG) -#define NumSIG _NSIG -#elif defined(__NSIG) -#define NumSIG __NSIG -#else -#define NumSIG 32 /* for 1998's unixes, this is still a good assumption */ -#endif - -#ifdef SYS_SIGLIST /* platform has sys_siglist[] */ -#define INIT_SIGLIST() /*nothing*/ -#else /* platform has no sys_siglist[], define our own */ -#define SYS_SIGLIST ap_sys_siglist -#define INIT_SIGLIST() siglist_init(); - -const char *ap_sys_siglist[NumSIG]; - -static void siglist_init(void) -{ - int sig; - - ap_sys_siglist[0] = "Signal 0"; -#ifdef SIGHUP - ap_sys_siglist[SIGHUP] = "Hangup"; -#endif -#ifdef SIGINT - ap_sys_siglist[SIGINT] = "Interrupt"; -#endif -#ifdef SIGQUIT - ap_sys_siglist[SIGQUIT] = "Quit"; -#endif -#ifdef SIGILL - ap_sys_siglist[SIGILL] = "Illegal instruction"; -#endif -#ifdef SIGTRAP - ap_sys_siglist[SIGTRAP] = "Trace/BPT trap"; -#endif -#ifdef SIGIOT - ap_sys_siglist[SIGIOT] = "IOT instruction"; -#endif -#ifdef SIGABRT - ap_sys_siglist[SIGABRT] = "Abort"; -#endif -#ifdef SIGEMT - ap_sys_siglist[SIGEMT] = "Emulator trap"; -#endif -#ifdef SIGFPE - ap_sys_siglist[SIGFPE] = "Arithmetic exception"; -#endif -#ifdef SIGKILL - ap_sys_siglist[SIGKILL] = "Killed"; -#endif -#ifdef SIGBUS - ap_sys_siglist[SIGBUS] = "Bus error"; -#endif -#ifdef SIGSEGV - ap_sys_siglist[SIGSEGV] = "Segmentation fault"; -#endif -#ifdef SIGSYS - ap_sys_siglist[SIGSYS] = "Bad system call"; -#endif -#ifdef SIGPIPE - ap_sys_siglist[SIGPIPE] = "Broken pipe"; -#endif -#ifdef SIGALRM - ap_sys_siglist[SIGALRM] = "Alarm clock"; -#endif -#ifdef SIGTERM - ap_sys_siglist[SIGTERM] = "Terminated"; -#endif -#ifdef SIGUSR1 - ap_sys_siglist[SIGUSR1] = "User defined signal 1"; -#endif -#ifdef SIGUSR2 - ap_sys_siglist[SIGUSR2] = "User defined signal 2"; -#endif -#ifdef SIGCLD - ap_sys_siglist[SIGCLD] = "Child status change"; -#endif -#ifdef SIGCHLD - ap_sys_siglist[SIGCHLD] = "Child status change"; -#endif -#ifdef SIGPWR - ap_sys_siglist[SIGPWR] = "Power-fail restart"; -#endif -#ifdef SIGWINCH - ap_sys_siglist[SIGWINCH] = "Window changed"; -#endif -#ifdef SIGURG - ap_sys_siglist[SIGURG] = "urgent socket condition"; -#endif -#ifdef SIGPOLL - ap_sys_siglist[SIGPOLL] = "Pollable event occurred"; -#endif -#ifdef SIGIO - ap_sys_siglist[SIGIO] = "socket I/O possible"; -#endif -#ifdef SIGSTOP - ap_sys_siglist[SIGSTOP] = "Stopped (signal)"; -#endif -#ifdef SIGTSTP - ap_sys_siglist[SIGTSTP] = "Stopped"; -#endif -#ifdef SIGCONT - ap_sys_siglist[SIGCONT] = "Continued"; -#endif -#ifdef SIGTTIN - ap_sys_siglist[SIGTTIN] = "Stopped (tty input)"; -#endif -#ifdef SIGTTOU - ap_sys_siglist[SIGTTOU] = "Stopped (tty output)"; -#endif -#ifdef SIGVTALRM - ap_sys_siglist[SIGVTALRM] = "virtual timer expired"; -#endif -#ifdef SIGPROF - ap_sys_siglist[SIGPROF] = "profiling timer expired"; -#endif -#ifdef SIGXCPU - ap_sys_siglist[SIGXCPU] = "exceeded cpu limit"; -#endif -#ifdef SIGXFSZ - ap_sys_siglist[SIGXFSZ] = "exceeded file size limit"; -#endif - for (sig=0; sig < sizeof(ap_sys_siglist)/sizeof(ap_sys_siglist[0]); ++sig) - if (ap_sys_siglist[sig] == NULL) - ap_sys_siglist[sig] = ""; -} -#endif /* platform has sys_siglist[] */ - - -/* handle all varieties of core dumping signals */ -static void sig_coredump(int sig) -{ - chdir(ap_coredump_dir); - signal(sig, SIG_DFL); - kill(getpid(), sig); - /* At this point we've got sig blocked, because we're still inside - * the signal handler. When we leave the signal handler it will - * be unblocked, and we'll take the signal... and coredump or whatever - * is appropriate for this particular Unix. In addition the parent - * will see the real signal we received -- whereas if we called - * abort() here, the parent would only see SIGABRT. - */ -} - -/***************************************************************** - * Connection structures and accounting... - */ - -static void just_die(int sig) -{ - clean_child_exit(0); -} - -static int volatile deferred_die; -static int volatile usr1_just_die; - -static void usr1_handler(int sig) -{ - if (usr1_just_die) { - just_die(sig); - } - deferred_die = 1; -} - -/* volatile just in case */ -static int volatile shutdown_pending; -static int volatile restart_pending; -static int volatile is_graceful; -ap_generation_t volatile ap_my_generation=0; - -static void sig_term(int sig) -{ - if (shutdown_pending == 1) { - /* Um, is this _probably_ not an error, if the user has - * tried to do a shutdown twice quickly, so we won't - * worry about reporting it. - */ - return; - } - shutdown_pending = 1; -} - -static void restart(int sig) -{ - if (restart_pending == 1) { - /* Probably not an error - don't bother reporting it */ - return; - } - restart_pending = 1; - is_graceful = sig == SIGUSR1; -} - -static void set_signals(void) -{ -#ifndef NO_USE_SIGACTION - struct sigaction sa; - - sigemptyset(&sa.sa_mask); - sa.sa_flags = 0; - - if (!one_process) { - sa.sa_handler = sig_coredump; -#if defined(SA_ONESHOT) - sa.sa_flags = SA_ONESHOT; -#elif defined(SA_RESETHAND) - sa.sa_flags = SA_RESETHAND; -#endif - if (sigaction(SIGSEGV, &sa, NULL) < 0) - ap_log_error(APLOG_MARK, APLOG_WARNING, server_conf, "sigaction(SIGSEGV)"); -#ifdef SIGBUS - if (sigaction(SIGBUS, &sa, NULL) < 0) - ap_log_error(APLOG_MARK, APLOG_WARNING, server_conf, "sigaction(SIGBUS)"); -#endif -#ifdef SIGABORT - if (sigaction(SIGABORT, &sa, NULL) < 0) - ap_log_error(APLOG_MARK, APLOG_WARNING, server_conf, "sigaction(SIGABORT)"); -#endif -#ifdef SIGABRT - if (sigaction(SIGABRT, &sa, NULL) < 0) - ap_log_error(APLOG_MARK, APLOG_WARNING, server_conf, "sigaction(SIGABRT)"); -#endif -#ifdef SIGILL - if (sigaction(SIGILL, &sa, NULL) < 0) - ap_log_error(APLOG_MARK, APLOG_WARNING, server_conf, "sigaction(SIGILL)"); -#endif - sa.sa_flags = 0; - } - sa.sa_handler = sig_term; - if (sigaction(SIGTERM, &sa, NULL) < 0) - ap_log_error(APLOG_MARK, APLOG_WARNING, server_conf, "sigaction(SIGTERM)"); -#ifdef SIGINT - if (sigaction(SIGINT, &sa, NULL) < 0) - ap_log_error(APLOG_MARK, APLOG_WARNING, server_conf, "sigaction(SIGINT)"); -#endif -#ifdef SIGXCPU - sa.sa_handler = SIG_DFL; - if (sigaction(SIGXCPU, &sa, NULL) < 0) - ap_log_error(APLOG_MARK, APLOG_WARNING, server_conf, "sigaction(SIGXCPU)"); -#endif -#ifdef SIGXFSZ - sa.sa_handler = SIG_DFL; - if (sigaction(SIGXFSZ, &sa, NULL) < 0) - ap_log_error(APLOG_MARK, APLOG_WARNING, server_conf, "sigaction(SIGXFSZ)"); -#endif -#ifdef SIGPIPE - sa.sa_handler = SIG_IGN; - if (sigaction(SIGPIPE, &sa, NULL) < 0) - ap_log_error(APLOG_MARK, APLOG_WARNING, server_conf, "sigaction(SIGPIPE)"); -#endif - - /* we want to ignore HUPs and USR1 while we're busy processing one */ - sigaddset(&sa.sa_mask, SIGHUP); - sigaddset(&sa.sa_mask, SIGUSR1); - sa.sa_handler = restart; - if (sigaction(SIGHUP, &sa, NULL) < 0) - ap_log_error(APLOG_MARK, APLOG_WARNING, server_conf, "sigaction(SIGHUP)"); - if (sigaction(SIGUSR1, &sa, NULL) < 0) - ap_log_error(APLOG_MARK, APLOG_WARNING, server_conf, "sigaction(SIGUSR1)"); -#else - if (!one_process) { - signal(SIGSEGV, sig_coredump); -#ifdef SIGBUS - signal(SIGBUS, sig_coredump); -#endif /* SIGBUS */ -#ifdef SIGABORT - signal(SIGABORT, sig_coredump); -#endif /* SIGABORT */ -#ifdef SIGABRT - signal(SIGABRT, sig_coredump); -#endif /* SIGABRT */ -#ifdef SIGILL - signal(SIGILL, sig_coredump); -#endif /* SIGILL */ -#ifdef SIGXCPU - signal(SIGXCPU, SIG_DFL); -#endif /* SIGXCPU */ -#ifdef SIGXFSZ - signal(SIGXFSZ, SIG_DFL); -#endif /* SIGXFSZ */ - } - - signal(SIGTERM, sig_term); -#ifdef SIGHUP - signal(SIGHUP, restart); -#endif /* SIGHUP */ -#ifdef SIGUSR1 - signal(SIGUSR1, restart); -#endif /* SIGUSR1 */ -#ifdef SIGPIPE - signal(SIGPIPE, SIG_IGN); -#endif /* SIGPIPE */ - -#endif -} - -/***************************************************************** - * Connection structures and accounting... - */ - - -static conn_rec *new_connection(pool *p, server_rec *server, BUFF *inout, - const struct sockaddr_in *remaddr, - const struct sockaddr_in *saddr, - int child_num) -{ - conn_rec *conn = (conn_rec *) ap_pcalloc(p, sizeof(conn_rec)); - - /* Got a connection structure, so initialize what fields we can - * (the rest are zeroed out by pcalloc). - */ - - conn->child_num = child_num; - - conn->pool = p; - conn->local_addr = *saddr; - conn->base_server = server; - conn->client = inout; - - conn->remote_addr = *remaddr; - conn->remote_ip = ap_pstrdup(conn->pool, - inet_ntoa(conn->remote_addr.sin_addr)); - - return conn; -} - -#if defined(TCP_NODELAY) && !defined(MPE) && !defined(TPF) -static void sock_disable_nagle(int s) -{ - /* The Nagle algorithm says that we should delay sending partial - * packets in hopes of getting more data. We don't want to do - * this; we are not telnet. There are bad interactions between - * persistent connections and Nagle's algorithm that have very severe - * performance penalties. (Failing to disable Nagle is not much of a - * problem with simple HTTP.) - * - * In spite of these problems, failure here is not a shooting offense. - */ - int just_say_no = 1; - - if (setsockopt(s, IPPROTO_TCP, TCP_NODELAY, (char *) &just_say_no, - sizeof(int)) < 0) { - ap_log_error(APLOG_MARK, APLOG_WARNING, server_conf, - "setsockopt: (TCP_NODELAY)"); - } -} - -#else -#define sock_disable_nagle(s) /* NOOP */ -#endif - - -static int make_sock(pool *p, const struct sockaddr_in *server) -{ - int s; - int one = 1; - char addr[512]; - - if (server->sin_addr.s_addr != htonl(INADDR_ANY)) - ap_snprintf(addr, sizeof(addr), "address %s port %d", - inet_ntoa(server->sin_addr), ntohs(server->sin_port)); - else - ap_snprintf(addr, sizeof(addr), "port %d", ntohs(server->sin_port)); - - /* note that because we're about to slack we don't use psocket */ - if ((s = socket(AF_INET, SOCK_STREAM, IPPROTO_TCP)) == -1) { - ap_log_error(APLOG_MARK, APLOG_CRIT, server_conf, - "make_sock: failed to get a socket for %s", addr); - exit(1); - } - - /* Solaris (probably versions 2.4, 2.5, and 2.5.1 with various levels - * of tcp patches) has some really weird bugs where if you dup the - * socket now it breaks things across SIGHUP restarts. It'll either - * be unable to bind, or it won't respond. - */ -#if defined (SOLARIS2) && SOLARIS2 < 260 -#define WORKAROUND_SOLARIS_BUG -#endif - - /* PR#1282 Unixware 1.x appears to have the same problem as solaris */ -#if defined (UW) && UW < 200 -#define WORKAROUND_SOLARIS_BUG -#endif - - /* PR#1973 NCR SVR4 systems appear to have the same problem */ -#if defined (MPRAS) -#define WORKAROUND_SOLARIS_BUG -#endif - -#ifndef WORKAROUND_SOLARIS_BUG - s = ap_slack(s, AP_SLACK_HIGH); - - ap_note_cleanups_for_socket(p, s); /* arrange to close on exec or restart */ -#ifdef TPF - os_note_additional_cleanups(p, s); -#endif /* TPF */ -#endif - -#ifndef MPE -/* MPE does not support SO_REUSEADDR and SO_KEEPALIVE */ -#ifndef _OSD_POSIX - if (setsockopt(s, SOL_SOCKET, SO_REUSEADDR, (char *) &one, sizeof(int)) < 0) { - ap_log_error(APLOG_MARK, APLOG_CRIT, server_conf, - "make_sock: for %s, setsockopt: (SO_REUSEADDR)", addr); - close(s); - return -1; - } -#endif /*_OSD_POSIX*/ - one = 1; -#ifdef SO_KEEPALIVE - if (setsockopt(s, SOL_SOCKET, SO_KEEPALIVE, (char *) &one, sizeof(int)) < 0) { - ap_log_error(APLOG_MARK, APLOG_CRIT, server_conf, - "make_sock: for %s, setsockopt: (SO_KEEPALIVE)", addr); - close(s); - return -1; - } -#endif -#endif - - sock_disable_nagle(s); - - /* - * To send data over high bandwidth-delay connections at full - * speed we must force the TCP window to open wide enough to keep the - * pipe full. The default window size on many systems - * is only 4kB. Cross-country WAN connections of 100ms - * at 1Mb/s are not impossible for well connected sites. - * If we assume 100ms cross-country latency, - * a 4kB buffer limits throughput to 40kB/s. - * - * To avoid this problem I've added the SendBufferSize directive - * to allow the web master to configure send buffer size. - * - * The trade-off of larger buffers is that more kernel memory - * is consumed. YMMV, know your customers and your network! - * - * -John Heidemann 25-Oct-96 - * - * If no size is specified, use the kernel default. - */ -#ifndef BEOS /* BeOS does not support SO_SNDBUF */ - if (server_conf->send_buffer_size) { - if (setsockopt(s, SOL_SOCKET, SO_SNDBUF, - (char *) &server_conf->send_buffer_size, sizeof(int)) < 0) { - ap_log_error(APLOG_MARK, APLOG_WARNING, server_conf, - "make_sock: failed to set SendBufferSize for %s, " - "using default", addr); - /* not a fatal error */ - } - } -#endif - -#ifdef MPE -/* MPE requires CAP=PM and GETPRIVMODE to bind to ports less than 1024 */ - if (ntohs(server->sin_port) < 1024) - GETPRIVMODE(); -#endif - if (bind(s, (struct sockaddr *) server, sizeof(struct sockaddr_in)) == -1) { - ap_log_error(APLOG_MARK, APLOG_CRIT, server_conf, - "make_sock: could not bind to %s", addr); -#ifdef MPE - if (ntohs(server->sin_port) < 1024) - GETUSERMODE(); -#endif - close(s); - exit(1); - } -#ifdef MPE - if (ntohs(server->sin_port) < 1024) - GETUSERMODE(); -#endif - - if (listen(s, ap_listenbacklog) == -1) { - ap_log_error(APLOG_MARK, APLOG_ERR, server_conf, - "make_sock: unable to listen for connections on %s", addr); - close(s); - exit(1); - } - -#ifdef WORKAROUND_SOLARIS_BUG - s = ap_slack(s, AP_SLACK_HIGH); - - ap_note_cleanups_for_socket(p, s); /* arrange to close on exec or restart */ -#endif - -#ifdef CHECK_FD_SETSIZE - /* protect various fd_sets */ - if (s >= FD_SETSIZE) { - ap_log_error(APLOG_MARK, APLOG_NOERRNO|APLOG_WARNING, NULL, - "make_sock: problem listening on %s, filedescriptor (%u) " - "larger than FD_SETSIZE (%u) " - "found, you probably need to rebuild Apache with a " - "larger FD_SETSIZE", addr, s, FD_SETSIZE); - close(s); - return -1; - } -#endif - - return s; -} - - -/* - * During a restart we keep track of the old listeners here, so that we - * can re-use the sockets. We have to do this because we won't be able - * to re-open the sockets ("Address already in use"). - * - * Unlike the listeners ring, old_listeners is a NULL terminated list. - * - * copy_listeners() makes the copy, find_listener() finds an old listener - * and close_unused_listener() cleans up whatever wasn't used. - */ -static listen_rec *old_listeners; - -/* unfortunately copy_listeners may be called before listeners is a ring */ -static void copy_listeners(pool *p) -{ - listen_rec *lr; - - ap_assert(old_listeners == NULL); - if (ap_listeners == NULL) { - return; - } - lr = ap_listeners; - do { - listen_rec *nr = malloc(sizeof *nr); - if (nr == NULL) { - fprintf(stderr, "Ouch! malloc failed in copy_listeners()\n"); - exit(1); - } - *nr = *lr; - ap_kill_cleanups_for_socket(p, nr->fd); - nr->next = old_listeners; - ap_assert(!nr->used); - old_listeners = nr; - lr = lr->next; - } while (lr && lr != ap_listeners); -} - - -static int find_listener(listen_rec *lr) -{ - listen_rec *or; - - for (or = old_listeners; or; or = or->next) { - if (!memcmp(&or->local_addr, &lr->local_addr, sizeof(or->local_addr))) { - or->used = 1; - return or->fd; - } - } - return -1; -} - - -static void close_unused_listeners(void) -{ - listen_rec *or, *next; - - for (or = old_listeners; or; or = next) { - next = or->next; - if (!or->used) - closesocket(or->fd); - free(or); - } - old_listeners = NULL; -} - - -/* open sockets, and turn the listeners list into a singly linked ring */ -static void setup_listeners(pool *p) -{ - listen_rec *lr; - int fd; - - listenmaxfd = -1; - FD_ZERO(&listenfds); - lr = ap_listeners; - for (;;) { - fd = find_listener(lr); - if (fd < 0) { - fd = make_sock(p, &lr->local_addr); - } - else { - ap_note_cleanups_for_socket(p, fd); - } - if (fd >= 0) { - FD_SET(fd, &listenfds); - if (fd > listenmaxfd) - listenmaxfd = fd; - } - lr->fd = fd; - if (lr->next == NULL) - break; - lr = lr->next; - } - /* turn the list into a ring */ - lr->next = ap_listeners; - head_listener = ap_listeners; - close_unused_listeners(); - -#ifdef NO_SERIALIZED_ACCEPT - /* warn them about the starvation problem if they're using multiple - * sockets - */ - if (ap_listeners->next != ap_listeners) { - ap_log_error(APLOG_MARK, APLOG_NOERRNO|APLOG_CRIT, NULL, - "You cannot use multiple Listens safely on your system, " - "proceeding anyway. See src/PORTING, search for " - "SERIALIZED_ACCEPT."); - } -#endif -} - - -/* - * Find a listener which is ready for accept(). This advances the - * head_listener global. - */ -static ap_inline listen_rec *find_ready_listener(fd_set * main_fds) -{ - listen_rec *lr; - - lr = head_listener; - do { - if (FD_ISSET(lr->fd, main_fds)) { - head_listener = lr->next; - return (lr); - } - lr = lr->next; - } while (lr != head_listener); - return NULL; -} - - -/***************************************************************** - * Child process main loop. - * The following vars are static to avoid getting clobbered by longjmp(); - * they are really private to child_main. - */ - -static int srv; -static int csd; -static int requests_this_child; -static fd_set main_fds; - -API_EXPORT(void) ap_child_terminate(request_rec *r) -{ - r->connection->keepalive = 0; - requests_this_child = ap_max_requests_per_child = 1; -} - -int ap_graceful_stop_signalled(void) -{ - ap_sync_scoreboard_image(); - if (deferred_die || - ap_scoreboard_image->global.running_generation != ap_my_generation) { - return 1; - } - return 0; -} - -static void child_main(int child_num_arg) -{ - NET_SIZE_T clen; - struct sockaddr sa_server; - struct sockaddr sa_client; - listen_rec *lr; - pool *ptrans; - conn_rec *current_conn; - - my_pid = getpid(); - csd = -1; - my_child_num = child_num_arg; - requests_this_child = 0; - - /* Get a sub pool for global allocations in this child, so that - * we can have cleanups occur when the child exits. - */ - pchild = ap_make_sub_pool(pconf); - - ptrans = ap_make_sub_pool(pchild); - - /* needs to be done before we switch UIDs so we have permissions */ - reopen_scoreboard(pchild); - SAFE_ACCEPT(accept_mutex_child_init(pchild)); - - if (unixd_setup_child()) { - clean_child_exit(APEXIT_CHILDFATAL); - } - - ap_child_init_hook(pchild, server_conf); - - (void) ap_update_child_status(my_child_num, SERVER_READY, (request_rec *) NULL); - - signal(SIGHUP, just_die); - signal(SIGTERM, just_die); - -#ifdef OS2 -/* Stop Ctrl-C/Ctrl-Break signals going to child processes */ - { - unsigned long ulTimes; - DosSetSignalExceptionFocus(0, &ulTimes); - } -#endif - - while (!ap_graceful_stop_signalled()) { - BUFF *conn_io; - - /* Prepare to receive a SIGUSR1 due to graceful restart so that - * we can exit cleanly. - */ - usr1_just_die = 1; - signal(SIGUSR1, usr1_handler); - - /* - * (Re)initialize this child to a pre-connection state. - */ - - current_conn = NULL; - - ap_clear_pool(ptrans); - - if ((ap_max_requests_per_child > 0 - && requests_this_child++ >= ap_max_requests_per_child)) { - clean_child_exit(0); - } - - (void) ap_update_child_status(my_child_num, SERVER_READY, (request_rec *) NULL); - - /* - * Wait for an acceptable connection to arrive. - */ - - /* Lock around "accept", if necessary */ - SAFE_ACCEPT(accept_mutex_on()); - - for (;;) { - if (ap_listeners->next != ap_listeners) { - /* more than one socket */ - memcpy(&main_fds, &listenfds, sizeof(fd_set)); - srv = ap_select(listenmaxfd + 1, &main_fds, NULL, NULL, NULL); - - if (srv < 0 && errno != EINTR) { - /* Single Unix documents select as returning errnos - * EBADF, EINTR, and EINVAL... and in none of those - * cases does it make sense to continue. In fact - * on Linux 2.0.x we seem to end up with EFAULT - * occasionally, and we'd loop forever due to it. - */ - ap_log_error(APLOG_MARK, APLOG_ERR, server_conf, "select: (listen)"); - clean_child_exit(1); - } - - if (srv <= 0) - continue; - - lr = find_ready_listener(&main_fds); - if (lr == NULL) - continue; - sd = lr->fd; - } - else { - /* only one socket, just pretend we did the other stuff */ - sd = ap_listeners->fd; - } - - /* if we accept() something we don't want to die, so we have to - * defer the exit - */ - usr1_just_die = 0; - for (;;) { - if (deferred_die) { - /* we didn't get a socket, and we were told to die */ - clean_child_exit(0); - } - clen = sizeof(sa_client); - csd = ap_accept(sd, &sa_client, &clen); - if (csd >= 0 || errno != EINTR) - break; - } - - if (csd >= 0) - break; /* We have a socket ready for reading */ - else { - - /* Our old behaviour here was to continue after accept() - * errors. But this leads us into lots of troubles - * because most of the errors are quite fatal. For - * example, EMFILE can be caused by slow descriptor - * leaks (say in a 3rd party module, or libc). It's - * foolish for us to continue after an EMFILE. We also - * seem to tickle kernel bugs on some platforms which - * lead to never-ending loops here. So it seems best - * to just exit in most cases. - */ - switch (errno) { -#ifdef EPROTO - /* EPROTO on certain older kernels really means - * ECONNABORTED, so we need to ignore it for them. - * See discussion in new-httpd archives nh.9701 - * search for EPROTO. - * - * Also see nh.9603, search for EPROTO: - * There is potentially a bug in Solaris 2.x x<6, - * and other boxes that implement tcp sockets in - * userland (i.e. on top of STREAMS). On these - * systems, EPROTO can actually result in a fatal - * loop. See PR#981 for example. It's hard to - * handle both uses of EPROTO. - */ - case EPROTO: -#endif -#ifdef ECONNABORTED - case ECONNABORTED: -#endif - /* Linux generates the rest of these, other tcp - * stacks (i.e. bsd) tend to hide them behind - * getsockopt() interfaces. They occur when - * the net goes sour or the client disconnects - * after the three-way handshake has been done - * in the kernel but before userland has picked - * up the socket. - */ -#ifdef ECONNRESET - case ECONNRESET: -#endif -#ifdef ETIMEDOUT - case ETIMEDOUT: -#endif -#ifdef EHOSTUNREACH - case EHOSTUNREACH: -#endif -#ifdef ENETUNREACH - case ENETUNREACH: -#endif - break; -#ifdef TPF - case EINACT: - ap_log_error(APLOG_MARK, APLOG_EMERG, server_conf, - "offload device inactive"); - clean_child_exit(APEXIT_CHILDFATAL); - break; - default: - ap_log_error(APLOG_MARK, APLOG_NOERRNO|APLOG_ERR, server_conf, - "select/accept error (%u)", errno); - clean_child_exit(APEXIT_CHILDFATAL); -#else - default: - ap_log_error(APLOG_MARK, APLOG_ERR, server_conf, - "accept: (client socket)"); - clean_child_exit(1); -#endif - } - } - - if (ap_graceful_stop_signalled()) { - clean_child_exit(0); - } - usr1_just_die = 1; - } - - SAFE_ACCEPT(accept_mutex_off()); /* unlock after "accept" */ - -#ifdef TPF - if (csd == 0) /* 0 is invalid socket for TPF */ - continue; -#endif - - /* We've got a socket, let's at least process one request off the - * socket before we accept a graceful restart request. We set - * the signal to ignore because we don't want to disturb any - * third party code. - */ - signal(SIGUSR1, SIG_IGN); - - ap_note_cleanups_for_fd(ptrans, csd); - - /* protect various fd_sets */ -#ifdef CHECK_FD_SETSIZE - if (csd >= FD_SETSIZE) { - ap_log_error(APLOG_MARK, APLOG_NOERRNO|APLOG_WARNING, NULL, - "[csd] filedescriptor (%u) larger than FD_SETSIZE (%u) " - "found, you probably need to rebuild Apache with a " - "larger FD_SETSIZE", csd, FD_SETSIZE); - continue; - } -#endif - - /* - * We now have a connection, so set it up with the appropriate - * socket options, file descriptors, and read/write buffers. - */ - - clen = sizeof(sa_server); - if (getsockname(csd, &sa_server, &clen) < 0) { - ap_log_error(APLOG_MARK, APLOG_ERR, server_conf, "getsockname"); - continue; - } - - sock_disable_nagle(csd); - - (void) ap_update_child_status(my_child_num, SERVER_BUSY_READ, - (request_rec *) NULL); - - conn_io = ap_bcreate(ptrans, B_RDWR | B_SOCKET); - -#ifdef B_SFIO - (void) sfdisc(conn_io->sf_in, SF_POPDISC); - sfdisc(conn_io->sf_in, bsfio_new(conn_io->pool, conn_io)); - sfsetbuf(conn_io->sf_in, NULL, 0); - - (void) sfdisc(conn_io->sf_out, SF_POPDISC); - sfdisc(conn_io->sf_out, bsfio_new(conn_io->pool, conn_io)); - sfsetbuf(conn_io->sf_out, NULL, 0); -#endif - - ap_bpushfd(conn_io, csd); - - current_conn = new_connection(ptrans, server_conf, conn_io, - (struct sockaddr_in *) &sa_client, - (struct sockaddr_in *) &sa_server, - my_child_num); - - ap_process_connection(current_conn); - } -} - -#ifdef TPF -static void reset_tpf_listeners(APACHE_TPF_INPUT *input_parms) -{ - int count; - listen_rec *lr; - - count = 0; - listenmaxfd = -1; - FD_ZERO(&listenfds); - lr = ap_listeners; - - for(;;) { - lr->fd = input_parms->listeners[count]; - if(lr->fd >= 0) { - FD_SET(lr->fd, &listenfds); - if(lr->fd > listenmaxfd) - listenmaxfd = lr->fd; - } - if(lr->next == NULL) - break; - lr = lr->next; - count++; - } - lr->next = ap_listeners; - head_listener = ap_listeners; - close_unused_listeners(); -} - -#endif /* TPF */ - -static int make_child(server_rec *s, int slot, time_t now) -{ - int pid; - - if (slot + 1 > max_daemons_limit) { - max_daemons_limit = slot + 1; - } - - if (one_process) { - signal(SIGHUP, just_die); - signal(SIGINT, just_die); -#ifdef SIGQUIT - signal(SIGQUIT, SIG_DFL); -#endif - signal(SIGTERM, just_die); - child_main(slot); - } - - /* avoid starvation */ - head_listener = head_listener->next; - - (void) ap_update_child_status(slot, SERVER_STARTING, (request_rec *) NULL); - - -#ifdef _OSD_POSIX - /* BS2000 requires a "special" version of fork() before a setuid() call */ - if ((pid = os_fork(unixd_config.user_name)) == -1) { -#elif defined(TPF) - if ((pid = os_fork(s, slot)) == -1) { -#else - if ((pid = fork()) == -1) { -#endif - ap_log_error(APLOG_MARK, APLOG_ERR, s, "fork: Unable to fork new process"); - - /* fork didn't succeed. Fix the scoreboard or else - * it will say SERVER_STARTING forever and ever - */ - (void) ap_update_child_status(slot, SERVER_DEAD, (request_rec *) NULL); - - /* In case system resources are maxxed out, we don't want - Apache running away with the CPU trying to fork over and - over and over again. */ - sleep(10); - - return -1; - } - - if (!pid) { -#ifdef AIX_BIND_PROCESSOR -/* by default AIX binds to a single processor - * this bit unbinds children which will then bind to another cpu - */ -#include - int status = bindprocessor(BINDPROCESS, (int)getpid(), - PROCESSOR_CLASS_ANY); - if (status != OK) { - ap_log_error(APLOG_MARK, APLOG_NOERRNO|APLOG_WARNING, server_conf, - "processor unbind failed %d", status); - } -#endif - RAISE_SIGSTOP(MAKE_CHILD); - /* Disable the restart signal handlers and enable the just_die stuff. - * Note that since restart() just notes that a restart has been - * requested there's no race condition here. - */ - signal(SIGHUP, just_die); - signal(SIGUSR1, just_die); - signal(SIGTERM, just_die); - child_main(slot); - } - - ap_scoreboard_image->parent[slot].pid = pid; -#ifdef SCOREBOARD_FILE - lseek(scoreboard_fd, XtOffsetOf(scoreboard, parent[slot]), 0); - force_write(scoreboard_fd, &ap_scoreboard_image->parent[slot], - sizeof(parent_score)); -#endif - - return 0; -} - - -/* start up a bunch of children */ -static void startup_children(int number_to_start) -{ - int i; - time_t now = time(0); - - for (i = 0; number_to_start && i < ap_daemons_limit; ++i) { - if (ap_scoreboard_image->servers[i].status != SERVER_DEAD) { - continue; - } - if (make_child(server_conf, i, now) < 0) { - break; - } - --number_to_start; - } -} - - -/* - * idle_spawn_rate is the number of children that will be spawned on the - * next maintenance cycle if there aren't enough idle servers. It is - * doubled up to MAX_SPAWN_RATE, and reset only when a cycle goes by - * without the need to spawn. - */ -static int idle_spawn_rate = 1; -#ifndef MAX_SPAWN_RATE -#define MAX_SPAWN_RATE (32) -#endif -static int hold_off_on_exponential_spawning; - -static void perform_idle_server_maintenance(void) -{ - int i; - int to_kill; - int idle_count; - short_score *ss; - time_t now = time(0); - int free_length; - int free_slots[MAX_SPAWN_RATE]; - int last_non_dead; - int total_non_dead; - - /* initialize the free_list */ - free_length = 0; - - to_kill = -1; - idle_count = 0; - last_non_dead = -1; - total_non_dead = 0; - - ap_sync_scoreboard_image(); - for (i = 0; i < ap_daemons_limit; ++i) { - int status; - - if (i >= max_daemons_limit && free_length == idle_spawn_rate) - break; - ss = &ap_scoreboard_image->servers[i]; - status = ss->status; - if (status == SERVER_DEAD) { - /* try to keep children numbers as low as possible */ - if (free_length < idle_spawn_rate) { - free_slots[free_length] = i; - ++free_length; - } - } - else { - /* We consider a starting server as idle because we started it - * at least a cycle ago, and if it still hasn't finished starting - * then we're just going to swamp things worse by forking more. - * So we hopefully won't need to fork more if we count it. - * This depends on the ordering of SERVER_READY and SERVER_STARTING. - */ - if (status <= SERVER_READY) { - ++ idle_count; - /* always kill the highest numbered child if we have to... - * no really well thought out reason ... other than observing - * the server behaviour under linux where lower numbered children - * tend to service more hits (and hence are more likely to have - * their data in cpu caches). - */ - to_kill = i; - } - - ++total_non_dead; - last_non_dead = i; - } - } - max_daemons_limit = last_non_dead + 1; - if (idle_count > ap_daemons_max_free) { - /* kill off one child... we use SIGUSR1 because that'll cause it to - * shut down gracefully, in case it happened to pick up a request - * while we were counting - */ - kill(ap_scoreboard_image->parent[to_kill].pid, SIGUSR1); - idle_spawn_rate = 1; - } - else if (idle_count < ap_daemons_min_free) { - /* terminate the free list */ - if (free_length == 0) { - /* only report this condition once */ - static int reported = 0; - - if (!reported) { - ap_log_error(APLOG_MARK, APLOG_NOERRNO|APLOG_ERR, server_conf, - "server reached MaxClients setting, consider" - " raising the MaxClients setting"); - reported = 1; - } - idle_spawn_rate = 1; - } - else { - if (idle_spawn_rate >= 8) { - ap_log_error(APLOG_MARK, APLOG_NOERRNO|APLOG_INFO, server_conf, - "server seems busy, (you may need " - "to increase StartServers, or Min/MaxSpareServers), " - "spawning %d children, there are %d idle, and " - "%d total children", idle_spawn_rate, - idle_count, total_non_dead); - } - for (i = 0; i < free_length; ++i) { -#ifdef TPF - if(make_child(server_conf, free_slots[i], now) == -1) { - if(free_length == 1) { - shutdown_pending = 1; - ap_log_error(APLOG_MARK, APLOG_EMERG, server_conf, - "No active child processes: shutting down"); - } - } -#else - make_child(server_conf, free_slots[i], now); -#endif /* TPF */ - } - /* the next time around we want to spawn twice as many if this - * wasn't good enough, but not if we've just done a graceful - */ - if (hold_off_on_exponential_spawning) { - --hold_off_on_exponential_spawning; - } - else if (idle_spawn_rate < MAX_SPAWN_RATE) { - idle_spawn_rate *= 2; - } - } - } - else { - idle_spawn_rate = 1; - } -} - - -static void process_child_status(int pid, ap_wait_t status) -{ - /* Child died... if it died due to a fatal error, - * we should simply bail out. - */ - if ((WIFEXITED(status)) && - WEXITSTATUS(status) == APEXIT_CHILDFATAL) { - ap_log_error(APLOG_MARK, APLOG_ALERT|APLOG_NOERRNO, server_conf, - "Child %d returned a Fatal error... \n" - "Apache is exiting!", - pid); - exit(APEXIT_CHILDFATAL); - } - if (WIFSIGNALED(status)) { - switch (WTERMSIG(status)) { - case SIGTERM: - case SIGHUP: - case SIGUSR1: - case SIGKILL: - break; - default: -#ifdef SYS_SIGLIST -#ifdef WCOREDUMP - if (WCOREDUMP(status)) { - ap_log_error(APLOG_MARK, APLOG_NOERRNO|APLOG_NOTICE, - server_conf, - "child pid %d exit signal %s (%d), " - "possible coredump in %s", - pid, (WTERMSIG(status) >= NumSIG) ? "" : - SYS_SIGLIST[WTERMSIG(status)], WTERMSIG(status), - ap_coredump_dir); - } - else { -#endif - ap_log_error(APLOG_MARK, APLOG_NOERRNO|APLOG_NOTICE, - server_conf, - "child pid %d exit signal %s (%d)", pid, - SYS_SIGLIST[WTERMSIG(status)], WTERMSIG(status)); -#ifdef WCOREDUMP - } -#endif -#else - ap_log_error(APLOG_MARK, APLOG_NOERRNO|APLOG_NOTICE, - server_conf, - "child pid %d exit signal %d", - pid, WTERMSIG(status)); -#endif - } - } -} - - -/***************************************************************** - * Executive routines. - */ - -int ap_mpm_run(pool *_pconf, pool *plog, server_rec *s) -{ - int remaining_children_to_start; - - pconf = _pconf; - - server_conf = s; - - ap_log_pid(pconf, ap_pid_fname); - setup_listeners(pconf); - - SAFE_ACCEPT(accept_mutex_init(pconf)); - if (!is_graceful) { - reinit_scoreboard(pconf); - } -#ifdef SCOREBOARD_FILE - else { - ap_scoreboard_fname = ap_server_root_relative(pconf, ap_scoreboard_fname); - ap_note_cleanups_for_fd(pconf, scoreboard_fd); - } -#endif - - set_signals(); - - if (ap_daemons_max_free < ap_daemons_min_free + 1) /* Don't thrash... */ - ap_daemons_max_free = ap_daemons_min_free + 1; - - /* If we're doing a graceful_restart then we're going to see a lot - * of children exiting immediately when we get into the main loop - * below (because we just sent them SIGUSR1). This happens pretty - * rapidly... and for each one that exits we'll start a new one until - * we reach at least daemons_min_free. But we may be permitted to - * start more than that, so we'll just keep track of how many we're - * supposed to start up without the 1 second penalty between each fork. - */ - remaining_children_to_start = ap_daemons_to_start; - if (remaining_children_to_start > ap_daemons_limit) { - remaining_children_to_start = ap_daemons_limit; - } - if (!is_graceful) { - startup_children(remaining_children_to_start); - remaining_children_to_start = 0; - } - else { - /* give the system some time to recover before kicking into - * exponential mode */ - hold_off_on_exponential_spawning = 10; - } - - ap_log_error(APLOG_MARK, APLOG_NOERRNO|APLOG_NOTICE, server_conf, - "%s configured -- resuming normal operations", - ap_get_server_version()); - ap_log_error(APLOG_MARK, APLOG_NOERRNO|APLOG_INFO, server_conf, - "Server built: %s", ap_get_server_built()); - restart_pending = shutdown_pending = 0; - - while (!restart_pending && !shutdown_pending) { - int child_slot; - ap_wait_t status; - int pid = wait_or_timeout(&status); - - /* XXX: if it takes longer than 1 second for all our children - * to start up and get into IDLE state then we may spawn an - * extra child - */ - if (pid >= 0) { - process_child_status(pid, status); - /* non-fatal death... note that it's gone in the scoreboard. */ - ap_sync_scoreboard_image(); - child_slot = find_child_by_pid(pid); - if (child_slot >= 0) { - (void) ap_update_child_status(child_slot, SERVER_DEAD, - (request_rec *) NULL); - if (remaining_children_to_start - && child_slot < ap_daemons_limit) { - /* we're still doing a 1-for-1 replacement of dead - * children with new children - */ - make_child(server_conf, child_slot, time(0)); - --remaining_children_to_start; - } -#ifdef HAS_OTHER_CHILD - } - else if (reap_other_child(pid, status) == 0) { - /* handled */ -#endif - } - else if (is_graceful) { - /* Great, we've probably just lost a slot in the - * scoreboard. Somehow we don't know about this - * child. - */ - ap_log_error(APLOG_MARK, APLOG_NOERRNO|APLOG_WARNING, server_conf, - "long lost child came home! (pid %d)", pid); - } - /* Don't perform idle maintenance when a child dies, - * only do it when there's a timeout. Remember only a - * finite number of children can die, and it's pretty - * pathological for a lot to die suddenly. - */ - continue; - } - else if (remaining_children_to_start) { - /* we hit a 1 second timeout in which none of the previous - * generation of children needed to be reaped... so assume - * they're all done, and pick up the slack if any is left. - */ - startup_children(remaining_children_to_start); - remaining_children_to_start = 0; - /* In any event we really shouldn't do the code below because - * few of the servers we just started are in the IDLE state - * yet, so we'd mistakenly create an extra server. - */ - continue; - } - - perform_idle_server_maintenance(); -#ifdef TPF - shutdown_pending = os_check_server(tpf_server_name); - ap_check_signals(); - sleep(1); -#endif /*TPF */ - } - - if (shutdown_pending) { - /* Time to gracefully shut down: - * Kill child processes, tell them to call child_exit, etc... - */ - if (ap_killpg(getpgrp(), SIGTERM) < 0) { - ap_log_error(APLOG_MARK, APLOG_WARNING, server_conf, "killpg SIGTERM"); - } - reclaim_child_processes(1); /* Start with SIGTERM */ - - /* cleanup pid file on normal shutdown */ - { - const char *pidfile = NULL; - pidfile = ap_server_root_relative (pconf, ap_pid_fname); - if ( pidfile != NULL && unlink(pidfile) == 0) - ap_log_error(APLOG_MARK, APLOG_NOERRNO|APLOG_INFO, - server_conf, - "removed PID file %s (pid=%ld)", - pidfile, (long)getpid()); - } - - ap_log_error(APLOG_MARK, APLOG_NOERRNO|APLOG_NOTICE, server_conf, - "caught SIGTERM, shutting down"); - return 1; - } - - /* we've been told to restart */ - signal(SIGHUP, SIG_IGN); - signal(SIGUSR1, SIG_IGN); - - if (one_process) { - /* not worth thinking about */ - return 1; - } - - /* advance to the next generation */ - /* XXX: we really need to make sure this new generation number isn't in - * use by any of the children. - */ - ++ap_my_generation; - ap_scoreboard_image->global.running_generation = ap_my_generation; - update_scoreboard_global(); - - if (is_graceful) { -#ifndef SCOREBOARD_FILE - int i; -#endif - ap_log_error(APLOG_MARK, APLOG_NOERRNO|APLOG_NOTICE, server_conf, - "SIGUSR1 received. Doing graceful restart"); - - /* kill off the idle ones */ - if (ap_killpg(getpgrp(), SIGUSR1) < 0) { - ap_log_error(APLOG_MARK, APLOG_WARNING, server_conf, "killpg SIGUSR1"); - } -#ifndef SCOREBOARD_FILE - /* This is mostly for debugging... so that we know what is still - * gracefully dealing with existing request. But we can't really - * do it if we're in a SCOREBOARD_FILE because it'll cause - * corruption too easily. - */ - ap_sync_scoreboard_image(); - for (i = 0; i < ap_daemons_limit; ++i) { - if (ap_scoreboard_image->servers[i].status != SERVER_DEAD) { - ap_scoreboard_image->servers[i].status = SERVER_GRACEFUL; - } - } -#endif - } - else { - /* Kill 'em off */ - if (ap_killpg(getpgrp(), SIGHUP) < 0) { - ap_log_error(APLOG_MARK, APLOG_WARNING, server_conf, "killpg SIGHUP"); - } - reclaim_child_processes(0); /* Not when just starting up */ - ap_log_error(APLOG_MARK, APLOG_NOERRNO|APLOG_NOTICE, server_conf, - "SIGHUP received. Attempting to restart"); - } - - /* must copy now before pconf is cleared */ - copy_listeners(pconf); - if (!is_graceful) { - ap_restart_time = time(NULL); - } - - return 0; -} - -static void prefork_pre_command_line(pool *pcommands) -{ - INIT_SIGLIST(); -#ifdef AUX3 - (void) set42sig(); -#endif - /* TODO: set one_process properly */ one_process = 0; -} - -static void prefork_pre_config(pool *pconf, pool *plog, pool *ptemp) -{ - static int restart_num = 0; - - one_process = ap_exists_config_define("ONE_PROCESS"); - - /* sigh, want this only the second time around */ - if (restart_num++ == 1) { - is_graceful = 0; - - if (!one_process) { - unixd_detach(); - } - - my_pid = getpid(); - } - - unixd_pre_config(); - ap_daemons_to_start = DEFAULT_START_DAEMON; - ap_daemons_min_free = DEFAULT_MIN_FREE_DAEMON; - ap_daemons_max_free = DEFAULT_MAX_FREE_DAEMON; - ap_daemons_limit = HARD_SERVER_LIMIT; - ap_pid_fname = DEFAULT_PIDLOG; - ap_scoreboard_fname = DEFAULT_SCOREBOARD; - ap_lock_fname = DEFAULT_LOCKFILE; - ap_max_requests_per_child = DEFAULT_MAX_REQUESTS_PER_CHILD; - /* ZZZ Initialize the Network Address here. */ - ap_bind_address.s_addr = htonl(INADDR_ANY); - ap_listeners = NULL; - ap_listenbacklog = DEFAULT_LISTENBACKLOG; - ap_extended_status = 0; - - ap_cpystrn(ap_coredump_dir, ap_server_root, sizeof(ap_coredump_dir)); -} - -static void prefork_post_config(pool *pconf, pool *plog, pool *ptemp, server_rec *s) -{ - if (ap_listeners == NULL) { - /* allocate a default listener */ - listen_rec *new; - - new = ap_pcalloc(pconf, sizeof(listen_rec)); - new->local_addr.sin_family = AF_INET; - new->local_addr.sin_addr = ap_bind_address; - new->local_addr.sin_port = htons(s->port ? s->port : DEFAULT_HTTP_PORT); - new->fd = -1; - new->next = NULL; - ap_listeners = new; - } -} - -static const char *set_pidfile(cmd_parms *cmd, void *dummy, char *arg) -{ - const char *err = ap_check_cmd_context(cmd, GLOBAL_ONLY); - if (err != NULL) { - return err; - } - - if (cmd->server->is_virtual) { - return "PidFile directive not allowed in "; - } - ap_pid_fname = arg; - return NULL; -} - -static const char *set_scoreboard(cmd_parms *cmd, void *dummy, char *arg) -{ - const char *err = ap_check_cmd_context(cmd, GLOBAL_ONLY); - if (err != NULL) { - return err; - } - - ap_scoreboard_fname = arg; - return NULL; -} - -static const char *set_lockfile(cmd_parms *cmd, void *dummy, char *arg) -{ - const char *err = ap_check_cmd_context(cmd, GLOBAL_ONLY); - if (err != NULL) { - return err; - } - - ap_lock_fname = arg; - return NULL; -} - -static const char *set_daemons_to_start(cmd_parms *cmd, void *dummy, char *arg) -{ - const char *err = ap_check_cmd_context(cmd, GLOBAL_ONLY); - if (err != NULL) { - return err; - } - - ap_daemons_to_start = atoi(arg); - return NULL; -} - -static const char *set_min_free_servers(cmd_parms *cmd, void *dummy, char *arg) -{ - const char *err = ap_check_cmd_context(cmd, GLOBAL_ONLY); - if (err != NULL) { - return err; - } - - ap_daemons_min_free = atoi(arg); - if (ap_daemons_min_free <= 0) { - fprintf(stderr, "WARNING: detected MinSpareServers set to non-positive.\n"); - fprintf(stderr, "Resetting to 1 to avoid almost certain Apache failure.\n"); - fprintf(stderr, "Please read the documentation.\n"); - ap_daemons_min_free = 1; - } - - return NULL; -} - -static const char *set_max_free_servers(cmd_parms *cmd, void *dummy, char *arg) -{ - const char *err = ap_check_cmd_context(cmd, GLOBAL_ONLY); - if (err != NULL) { - return err; - } - - ap_daemons_max_free = atoi(arg); - return NULL; -} - -static const char *set_server_limit (cmd_parms *cmd, void *dummy, char *arg) -{ - const char *err = ap_check_cmd_context(cmd, GLOBAL_ONLY); - if (err != NULL) { - return err; - } - - ap_daemons_limit = atoi(arg); - if (ap_daemons_limit > HARD_SERVER_LIMIT) { - fprintf(stderr, "WARNING: MaxClients of %d exceeds compile time limit " - "of %d servers,\n", ap_daemons_limit, HARD_SERVER_LIMIT); - fprintf(stderr, " lowering MaxClients to %d. To increase, please " - "see the\n", HARD_SERVER_LIMIT); - fprintf(stderr, " HARD_SERVER_LIMIT define in src/include/httpd.h.\n"); - ap_daemons_limit = HARD_SERVER_LIMIT; - } - else if (ap_daemons_limit < 1) { - fprintf(stderr, "WARNING: Require MaxClients > 0, setting to 1\n"); - ap_daemons_limit = 1; - } - return NULL; -} - -static const char *set_max_requests(cmd_parms *cmd, void *dummy, char *arg) -{ - const char *err = ap_check_cmd_context(cmd, GLOBAL_ONLY); - if (err != NULL) { - return err; - } - - ap_max_requests_per_child = atoi(arg); - - return NULL; -} - -static const char *set_coredumpdir (cmd_parms *cmd, void *dummy, char *arg) -{ - struct stat finfo; - const char *fname; - const char *err = ap_check_cmd_context(cmd, GLOBAL_ONLY); - if (err != NULL) { - return err; - } - - fname = ap_server_root_relative(cmd->pool, arg); - /* ZZZ change this to the AP func FileInfo*/ - if ((stat(fname, &finfo) == -1) || !S_ISDIR(finfo.st_mode)) { - return ap_pstrcat(cmd->pool, "CoreDumpDirectory ", fname, - " does not exist or is not a directory", NULL); - } - ap_cpystrn(ap_coredump_dir, fname, sizeof(ap_coredump_dir)); - return NULL; -} - -static const char *set_listenbacklog(cmd_parms *cmd, void *dummy, char *arg) -{ - int b; - - const char *err = ap_check_cmd_context(cmd, GLOBAL_ONLY); - if (err != NULL) { - return err; - } - - b = atoi(arg); - if (b < 1) { - return "ListenBacklog must be > 0"; - } - ap_listenbacklog = b; - return NULL; -} - -static const char *set_listener(cmd_parms *cmd, void *dummy, char *ips) -{ - listen_rec *new; - char *ports; - unsigned short port; - - const char *err = ap_check_cmd_context(cmd, GLOBAL_ONLY); - if (err != NULL) { - return err; - } - - ports = strchr(ips, ':'); - if (ports != NULL) { - if (ports == ips) { - return "Missing IP address"; - } - else if (ports[1] == '\0') { - return "Address must end in :"; - } - *(ports++) = '\0'; - } - else { - ports = ips; - } - - new=ap_pcalloc(cmd->pool, sizeof(listen_rec)); - /* ZZZ let's set this using the AP funcs. */ - new->local_addr.sin_family = AF_INET; - if (ports == ips) { /* no address */ - /* ZZZ Initialize the Network Address */ - new->local_addr.sin_addr.s_addr = htonl(INADDR_ANY); - } - else { - new->local_addr.sin_addr.s_addr = ap_get_virthost_addr(ips, NULL); - } - port = atoi(ports); - if (!port) { - return "Port must be numeric"; - } - /* ZZZ change to AP funcs.*/ - new->local_addr.sin_port = htons(port); - new->fd = -1; /*ZZZ change to NULL */ - new->used = 0; - new->next = ap_listeners; - ap_listeners = new; - return NULL; -} - -/* there are no threads in the prefork model, so the mutexes are - nops. */ -/* TODO: make these #defines to eliminate the function call */ - -struct ap_thread_mutex { - int dummy; -}; - -API_EXPORT(ap_thread_mutex *) ap_thread_mutex_new(void) -{ - return malloc(sizeof(ap_thread_mutex)); -} - -API_EXPORT(void) ap_thread_mutex_lock(ap_thread_mutex *mtx) -{ -} - -API_EXPORT(void) ap_thread_mutex_unlock(ap_thread_mutex *mtx) -{ -} - -API_EXPORT(void) ap_thread_mutex_destroy(ap_thread_mutex *mtx) -{ - free(mtx); -} - - -static const command_rec prefork_cmds[] = { -UNIX_DAEMON_COMMANDS -{ "PidFile", set_pidfile, NULL, RSRC_CONF, TAKE1, - "A file for logging the server process ID"}, -{ "ScoreBoardFile", set_scoreboard, NULL, RSRC_CONF, TAKE1, - "A file for Apache to maintain runtime process management information"}, -{ "LockFile", set_lockfile, NULL, RSRC_CONF, TAKE1, - "The lockfile used when Apache needs to lock the accept() call"}, -{ "StartServers", set_daemons_to_start, NULL, RSRC_CONF, TAKE1, - "Number of child processes launched at server startup" }, -{ "MinSpareServers", set_min_free_servers, NULL, RSRC_CONF, TAKE1, - "Minimum number of idle children, to handle request spikes" }, -{ "MaxSpareServers", set_max_free_servers, NULL, RSRC_CONF, TAKE1, - "Maximum number of idle children" }, -{ "MaxClients", set_server_limit, NULL, RSRC_CONF, TAKE1, - "Maximum number of children alive at the same time" }, -{ "MaxRequestsPerChild", set_max_requests, NULL, RSRC_CONF, TAKE1, - "Maximum number of requests a particular child serves before dying." }, -{ "CoreDumpDirectory", set_coredumpdir, NULL, RSRC_CONF, TAKE1, - "The location of the directory Apache changes to before dumping core" }, -{ "ListenBacklog", set_listenbacklog, NULL, RSRC_CONF, TAKE1, - "Maximum length of the queue of pending connections, as used by listen(2)" }, -{ "Listen", set_listener, NULL, RSRC_CONF, TAKE1, - "A port number or a numeric IP address and a port number"}, -{ NULL } -}; - -module MODULE_VAR_EXPORT mpm_prefork_module = { - STANDARD20_MODULE_STUFF, - prefork_pre_command_line, /* pre_command_line */ - prefork_pre_config, /* pre_config */ - prefork_post_config, /* post_config */ - NULL, /* open_logs */ - NULL, /* child_init */ - NULL, /* create per-directory config structure */ - NULL, /* merge per-directory config structures */ - NULL, /* create per-server config structure */ - NULL, /* merge per-server config structures */ - prefork_cmds, /* command table */ - NULL, /* handlers */ - NULL, /* translate_handler */ - NULL, /* check_user_id */ - NULL, /* check auth */ - NULL, /* check access */ - NULL, /* type_checker */ - NULL, /* pre-run fixups */ - NULL, /* logger */ - NULL, /* header parser */ - NULL /* post_read_request */ -}; diff --git a/server/mpm/winnt/Win9xConHook.c b/server/mpm/winnt/Win9xConHook.c deleted file mode 100644 index 7f1224ab6a122b76ff8b2ef5234288868e76761b..0000000000000000000000000000000000000000 --- a/server/mpm/winnt/Win9xConHook.c +++ /dev/null @@ -1,517 +0,0 @@ -/* ==================================================================== - * Copyright (c) 1995-2000 The Apache Group. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in - * the documentation and/or other materials provided with the - * distribution. - * - * 3. All advertising materials mentioning features or use of this - * software must display the following acknowledgment: - * "This product includes software developed by the Apache Group - * for use in the Apache HTTP server project (http://httpd.apache.org/)." - * - * 4. The names "Apache Server" and "Apache Group" must not be used to - * endorse or promote products derived from this software without - * prior written permission. For written permission, please contact - * apache@apache.org. - * - * 5. Products derived from this software may not be called "Apache" - * nor may "Apache" appear in their names without prior written - * permission of the Apache Group. - * - * 6. Redistributions of any form whatsoever must retain the following - * acknowledgment: - * "This product includes software developed by the Apache Group - * for use in the Apache HTTP server project (http://httpd.apache.org/)." - * - * THIS SOFTWARE IS PROVIDED BY THE APACHE GROUP ``AS IS'' AND ANY - * EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR - * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE APACHE GROUP OR - * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT - * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, - * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED - * OF THE POSSIBILITY OF SUCH DAMAGE. - * ==================================================================== - * - * This software consists of voluntary contributions made by many - * individuals on behalf of the Apache Group and was originally based - * on public domain software written at the National Center for - * Supercomputing Applications, University of Illinois, Urbana-Champaign. - * For more information on the Apache Group and the Apache HTTP server - * project, please see . - * - */ - - -/* - * Win9xConHook.dll - a hook proc to clean up Win95/98 console behavior. - * - * It is well(?) documented by Microsoft that the Win9x HandlerRoutine - * hooked by the SetConsoleCtrlHandler never receives the CTRL_CLOSE_EVENT, - * CTRL_LOGOFF_EVENT or CTRL_SHUTDOWN_EVENT signals. - * - * It is possible to have a second window to monitor the WM_ENDSESSION - * message, but the close button still fails.. - * - * There is a 16bit polling method for the close window option, but this - * is CPU intensive and requires thunking. - * - * Attempts to subclass the 'tty' console fail, since that message thread - * is actually owned by the 16 bit winoldap.mod process, although the - * window reports it is owned by the process/thread of the console app. - * - * Win9xConHook is thunks the WM_CLOSE and WM_ENDSESSION messages, - * first through a window hook procedure in the winoldap context, into - * a subclass WndProc, and on to a second hidden monitor window in the - * console application's context that dispatches them to the console app's - * registered HandlerRoutine. - */ - -#define DBG 1 - -#include - -/* - * is_tty flags this process; -1 == unknown, 1 == if tty, 0 == if not - * hw_tty is the handle of the top level tty in this process context - * is_subclassed is toggled to assure DllMain removes the subclass - * is_hooked is toggled to assure DllMain removes the subclass - */ -static int is_tty = -1; -static HWND hwtty = NULL; -static BOOL is_subclassed = 0; - -static HMODULE hmodHook = NULL; -static HHOOK hhkGetMessage; -//static HHOOK hhkCallWndProc; - -static LPCTSTR origwndprop = NULL; -static LPCTSTR hookwndprop = NULL; - -#ifdef DBG -static VOID DbgPrintf(LPTSTR fmt, ...); -#endif - -static BOOL CALLBACK EnumttyWindow(HWND wnd, LPARAM retwnd); - - -BOOL __declspec(dllexport) APIENTRY DllMain(PVOID hModule, ULONG ulReason, PCONTEXT pctx) -{ - if (ulReason == DLL_PROCESS_ATTACH) - { -#ifdef DBG - DbgPrintf("H ProcessAttach:%8.8x\r\n", GetCurrentProcessId()); -#endif - origwndprop = MAKEINTATOM(GlobalAddAtom("Win9xConHookOrigProc")); - hookwndprop = MAKEINTATOM(GlobalAddAtom("Win9xConHookThunkWnd")); - } - else if ( ulReason == DLL_PROCESS_DETACH ) - { - HWND parent; -#ifdef DBG - DbgPrintf("H ProcessDetach:%8.8x\r\n", GetCurrentProcessId()); -#endif - if (is_subclassed) { - WNDPROC origproc = (WNDPROC) GetProp(hwtty, origwndprop); - if (origproc) { - SetWindowLong(hwtty, GWL_WNDPROC, (LONG)origproc); - RemoveProp(hwtty, origwndprop); - } - } - EnumWindows(EnumttyWindow, (LPARAM)&parent); - if (parent) { - HWND child = (HWND)GetProp(parent, hookwndprop); - if (child) - SendMessage(child, WM_DESTROY, 0, 0); - } - if (hmodHook) - { - if (hhkGetMessage) { - UnhookWindowsHookEx(hhkGetMessage); - hhkGetMessage = NULL; - } - FreeLibrary(hmodHook); - hmodHook = NULL; - } - GlobalDeleteAtom((ATOM)origwndprop); - GlobalDeleteAtom((ATOM)hookwndprop); - } - return TRUE; -} - - -typedef struct { - PHANDLER_ROUTINE phandler; - HINSTANCE instance; - HWND parent; -} tty_info; - - -#define gwltty_phandler 0 -#define gwltty_ttywnd 4 - -/* This is the WndProc procedure for our invisible window. - * When our tty subclass WndProc recieves the WM_CLOSE, - * or WM_QUERYENDSESSION messages, we call the installed - * HandlerRoutine that was registered with - * If a user logs off, the window is sent WM_QUERYENDSESSION - * as well, but with lParam != 0. We ignore this case. - */ -LRESULT CALLBACK ttyConsoleCtrlWndProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam) -{ - if (msg == WM_CREATE) - { - tty_info *tty = (tty_info*)(((LPCREATESTRUCT)lParam)->lpCreateParams); - SetWindowLong(hwnd, gwltty_phandler, (LONG)tty->phandler); - SetWindowLong(hwnd, gwltty_ttywnd, (LONG)tty->parent); -#ifdef DBG - DbgPrintf("S Created ttyConHookChild:%8.8x\r\n", hwnd); -#endif - SetProp(((tty_info*)tty)->parent, hookwndprop, hwnd); - return 0; - } - else if (msg == WM_DESTROY) - { - HWND parent = (HWND)GetWindowLong(hwnd, gwltty_ttywnd); - RemoveProp(parent, hookwndprop); - } - else if (msg == WM_CLOSE) - { - PHANDLER_ROUTINE phandler = - (PHANDLER_ROUTINE)GetWindowLong(hwnd, gwltty_phandler); -#ifdef DBG - DbgPrintf("S Invoking CTRL_CLOSE_EVENT:%8.8x\r\n", - GetCurrentProcessId()); -#endif - return !phandler(CTRL_CLOSE_EVENT); - } - else if (msg == WM_QUERYENDSESSION) - { - if (lParam & ENDSESSION_LOGOFF) - { - PHANDLER_ROUTINE phandler = - (PHANDLER_ROUTINE)GetWindowLong(hwnd, gwltty_phandler); -#ifdef DBG - DbgPrintf("S Invoking CTRL_LOGOFF_EVENT:%8.8x\r\n", - GetCurrentProcessId()); -#endif - return !phandler(CTRL_LOGOFF_EVENT); - } - else - { - PHANDLER_ROUTINE phandler = - (PHANDLER_ROUTINE)GetWindowLong(hwnd, gwltty_phandler); -#ifdef DBG - DbgPrintf("S Invoking CTRL_SHUTDOWN_EVENT:%8.8x\r\n", - GetCurrentProcessId()); -#endif - return !phandler(CTRL_SHUTDOWN_EVENT); - } - } - return (DefWindowProc(hwnd, msg, wParam, lParam)); -} - - -DWORD WINAPI ttyConsoleCtrlThread(LPVOID tty) -{ - /* When running as a service under Windows 9x, ConsoleCtrlHandler - * does not respond properly when the user logs off or the system - * is shutdown. If the WatchWindow thread is created with a NULL - * service_name argument, then the ...SystemMonitor window class is - * used to create the "Apache" window to watch for logoff and shutdown. - * If the service_name is provided, the ...ServiceMonitor window class - * is used to create the window named by the service_name argument, - * and the logoff message is ignored. - */ - WNDCLASS wc; - HWND hwnd; - MSG msg; - wc.style = CS_GLOBALCLASS; - wc.lpfnWndProc = ttyConsoleCtrlWndProc; - wc.cbClsExtra = 0; - wc.cbWndExtra = 8; - wc.hInstance = NULL; - wc.hIcon = NULL; - wc.hCursor = NULL; - wc.hbrBackground = NULL; - wc.lpszMenuName = NULL; - wc.lpszClassName = "ttyConHookChild"; - - if (!RegisterClass(&wc)) { -#ifdef DBG - DbgPrintf("S Created ttyConHookChild class\r\n"); -#endif - return 0; - } - - /* Create an invisible window */ - hwnd = CreateWindow(wc.lpszClassName, "", - WS_OVERLAPPED & ~WS_VISIBLE, - CW_USEDEFAULT, CW_USEDEFAULT, - CW_USEDEFAULT, CW_USEDEFAULT, - NULL, NULL, - ((tty_info*)tty)->instance, tty); - - if (!hwnd) { -#ifdef DBG - DbgPrintf("S Error Creating ttyConHookChild:%d\r\n", GetLastError()); -#endif - return 0; - } - - while (GetMessage(&msg, NULL, 0, 0)) - { - TranslateMessage(&msg); - DispatchMessage(&msg); - if (msg.message == WM_DESTROY) - DestroyWindow(hwnd); - } - return 0; -} - - -/* - * This function only works when this process is the active process - * (e.g. once it is running a child process, it can no longer determine - * which console window is its own.) - */ -static BOOL CALLBACK EnumttyWindow(HWND wnd, LPARAM retwnd) -{ - char tmp[4]; - if (GetClassName(wnd, tmp, sizeof(tmp)) && !strcmp(tmp, "tty")) - { - DWORD wndproc, thisproc = GetCurrentProcessId(); - GetWindowThreadProcessId(wnd, &wndproc); - if (wndproc == thisproc) { - *((HWND*)retwnd) = wnd; - return FALSE; - } - } - return TRUE; -} - - -/* - * Exported function that sets up the fixup child window and dispatch - */ -BOOL __declspec(dllexport) WINAPI FixConsoleCtrlHandler( - PHANDLER_ROUTINE phandler, - BOOL add) -{ - HWND parent; - EnumWindows(EnumttyWindow, (LPARAM)&parent); - - if (!parent) - return FALSE; - - if (add) - { - HANDLE hThread; - DWORD tid; - static tty_info tty; - tty.phandler = phandler; - tty.parent = parent; - tty.instance = GetModuleHandle(NULL); - - hmodHook = LoadLibrary("Win9xConHook.dll"); - if (hmodHook) - { - hhkGetMessage = SetWindowsHookEx(WH_GETMESSAGE, - (HOOKPROC)GetProcAddress(hmodHook, "GetMsgProc"), hmodHook, 0); - //hhkCallWndProc = SetWindowsHookEx(WH_CALLWNDPROC, - // (HOOKPROC)GetProcAddress(hmodHook, "CallWndProc"), hmodHook, 0); - } - - hThread = CreateThread(NULL, 0, ttyConsoleCtrlThread, - (LPVOID)&tty, 0, &tid); - if (hThread) - { - CloseHandle(hThread); - return TRUE; - } - } - else /* remove */ - { - HWND child = FindWindowEx(parent, NULL, "ttyConHookChild", NULL); - if (child) - SendMessage(child, WM_DESTROY, 0, 0); - if (hmodHook) - { - if (hhkGetMessage) { - UnhookWindowsHookEx(hhkGetMessage); - hhkGetMessage = NULL; - } - FreeLibrary(hmodHook); - hmodHook = NULL; - } - return TRUE; - } - return FALSE; -} - - -/* - * Subclass message process for the tty window - */ -LRESULT CALLBACK WndProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam) -{ - WNDPROC origproc = (WNDPROC) GetProp(hwnd, origwndprop); - if (!origproc) - return 0; - - switch (msg) - { - case WM_NCDESTROY: -#ifdef DBG - DbgPrintf("W Proc %08x hwnd:%08x Subclass removed\r\n", - GetCurrentProcessId(), hwnd); -#endif - is_subclassed = FALSE; - SetWindowLong(hwnd, GWL_WNDPROC, (LONG)origproc); - RemoveProp(hwnd, origwndprop); - break; - - case WM_CLOSE: - case WM_ENDSESSION: - case WM_QUERYENDSESSION: - { - HWND child = (HWND)GetProp(hwnd, hookwndprop); -#ifdef DBG - DbgPrintf("W Proc %08x hwnd:%08x msg:%d\r\n", - GetCurrentProcessId(), hwnd, msg); -#endif - if (!child) - break; - return SendMessage(child, msg, wParam, lParam); - } - } - return CallWindowProc(origproc, hwnd, msg, wParam, lParam); -} - - -int HookProc(int hc, HWND *hwnd, UINT *msg, WPARAM *wParam, LPARAM *lParam) -{ - if (is_tty == -1 && *hwnd) - { - char ttybuf[4]; - HWND htty; - hwtty = *hwnd; - while (htty = GetParent(hwtty)) - hwtty = htty; - is_tty = (GetClassName(hwtty, ttybuf, sizeof(ttybuf)) - && !strcmp(ttybuf, "tty")); - if (is_tty) - { - WNDPROC origproc = (WNDPROC)GetWindowLong(hwtty, GWL_WNDPROC); - SetProp(hwtty, origwndprop, origproc); - SetWindowLong(hwtty, GWL_WNDPROC, (LONG)WndProc); - is_subclassed = TRUE; -#ifdef DBG - DbgPrintf("W Proc %08x hwnd:%08x Subclassed\r\n", - GetCurrentProcessId(), hwtty); -#endif - } -#ifdef DBG - DbgPrintf("H Proc %08x %s %08x\r\n", GetCurrentProcessId(), - is_tty ? "tracking" : "ignoring", hwtty); -#endif - } - - if (hc >= 0 && is_tty && *hwnd == hwtty) - { - if ((*msg == WM_CLOSE) - || (*msg == WM_ENDSESSION)) { - DWORD apppid, ttypid = GetCurrentProcessId(); - GetWindowThreadProcessId(*hwnd, &apppid); -#ifdef DBG - DbgPrintf("H Proc %08x hwnd:%08x owned by %08x msg:%d\r\n", ttypid, *hwnd, apppid, *msg); -#endif - //*msg = WM_NULL; - /* - * Experimental, return 0 or 1 will bypass the next hook and return that - * value from the hook procedure, -1 continues to call the next hook. - */ - return -1; - } - } - return -1; -} - - -/* - * PostMessage Hook: - */ -LRESULT __declspec(dllexport) CALLBACK GetMsgProc(INT hc, WPARAM wParam, LPARAM lParam) -{ - PMSG pmsg; - - pmsg = (PMSG)lParam; - - if (pmsg) { - int rv = HookProc(hc, &pmsg->hwnd, &pmsg->message, &pmsg->lParam, &pmsg->wParam); - if (rv != -1) - return rv; - } - /* - * CallNextHookEx apparently ignores the hhook argument, so pass NULL - */ - return CallNextHookEx(NULL, hc, wParam, lParam); -} - - -/* - * SendMessage Hook: - */ -LRESULT __declspec(dllexport) CALLBACK CallWndProc(INT hc, WPARAM wParam, LPARAM lParam) -{ - PCWPSTRUCT pcwps = (PCWPSTRUCT)lParam; - - if (pcwps) { - int rv = HookProc(hc, &pcwps->hwnd, &pcwps->message, &pcwps->wParam, &pcwps->lParam); - if (rv != -1) - return rv; - } - /* - * CallNextHookEx apparently ignores the hhook argument, so pass NULL - */ - return CallNextHookEx(NULL, hc, wParam, lParam); -} - - -#ifdef DBG -VOID DbgPrintf( - LPTSTR fmt, - ... - ) -{ - va_list marker; - TCHAR szBuf[256]; - DWORD t; - HANDLE gDbgOut; - - va_start(marker, fmt); - wvsprintf(szBuf, fmt, marker); - va_end(marker); - - gDbgOut = CreateFile("COM1", GENERIC_READ | GENERIC_WRITE, - FILE_SHARE_READ | FILE_SHARE_WRITE, - NULL, OPEN_EXISTING, FILE_FLAG_WRITE_THROUGH, NULL); - WriteFile(gDbgOut, szBuf, strlen(szBuf), &t, NULL); - CloseHandle(gDbgOut); -} -#endif - - diff --git a/server/mpm/winnt/Win9xConHook.def b/server/mpm/winnt/Win9xConHook.def deleted file mode 100644 index 689eb75a2cb3308d59ca067311f1f6d19388313d..0000000000000000000000000000000000000000 --- a/server/mpm/winnt/Win9xConHook.def +++ /dev/null @@ -1,9 +0,0 @@ -LIBRARY Win9xConHook - -EXETYPE WINDOWS - -EXPORTS - DllMain - GetMsgProc - CallWndProc - FixConsoleCtrlHandler \ No newline at end of file diff --git a/server/mpm/winnt/Win9xConHook.dsp b/server/mpm/winnt/Win9xConHook.dsp deleted file mode 100644 index 3704f5b62eb43ca2fffbfe44c0ce098d09ee8848..0000000000000000000000000000000000000000 --- a/server/mpm/winnt/Win9xConHook.dsp +++ /dev/null @@ -1,103 +0,0 @@ -# Microsoft Developer Studio Project File - Name="Win9xConHook" - Package Owner=<4> -# Microsoft Developer Studio Generated Build File, Format Version 6.00 -# ** DO NOT EDIT ** - -# TARGTYPE "Win32 (x86) Dynamic-Link Library" 0x0102 - -CFG=Win9xConHook - Win32 Release -!MESSAGE This is not a valid makefile. To build this project using NMAKE, -!MESSAGE use the Export Makefile command and run -!MESSAGE -!MESSAGE NMAKE /f "Win9xConHook.mak". -!MESSAGE -!MESSAGE You can specify a configuration when running NMAKE -!MESSAGE by defining the macro CFG on the command line. For example: -!MESSAGE -!MESSAGE NMAKE /f "Win9xConHook.mak" CFG="Win9xConHook - Win32 Release" -!MESSAGE -!MESSAGE Possible choices for configuration are: -!MESSAGE -!MESSAGE "Win9xConHook - Win32 Release" (based on "Win32 (x86) Dynamic-Link Library") -!MESSAGE "Win9xConHook - Win32 Debug" (based on "Win32 (x86) Dynamic-Link Library") -!MESSAGE - -# Begin Project -# PROP AllowPerConfigDependencies 0 -# PROP Scc_ProjName "" -# PROP Scc_LocalPath "" -CPP=cl.exe -MTL=midl.exe -RSC=rc.exe - -!IF "$(CFG)" == "Win9xConHook - Win32 Release" - -# PROP BASE Use_MFC 0 -# PROP BASE Use_Debug_Libraries 0 -# PROP BASE Output_Dir ".\Release" -# PROP BASE Intermediate_Dir ".\Release" -# PROP BASE Target_Dir "" -# PROP Use_MFC 0 -# PROP Use_Debug_Libraries 0 -# PROP Output_Dir "Win9xConHookR" -# PROP Intermediate_Dir "Win9xConHookR" -# PROP Ignore_Export_Lib 0 -# PROP Target_Dir "" -# ADD BASE CPP /nologo /MT /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /c -# ADD CPP /nologo /MD /W3 /GX /O2 /D "NDEBUG" /D "WIN32" /D "_WINDOWS" /D "SHARED_MODULE" /FD /c -# ADD BASE MTL /nologo /D "NDEBUG" /win32 -# ADD MTL /nologo /D "NDEBUG" /mktyplib203 /win32 -# ADD BASE RSC /l 0x809 /d "NDEBUG" -# ADD RSC /l 0x809 /d "NDEBUG" -BSC32=bscmake.exe -# ADD BASE BSC32 /nologo -# ADD BSC32 /nologo -LINK32=link.exe -# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:windows /dll /machine:I386 /base:@"BaseAddr.ref",mod_status -# ADD LINK32 kernel32.lib user32.lib gdi32.lib /nologo /base:"0x1c0f0000" /subsystem:windows /dll /map /machine:I386 - -!ELSEIF "$(CFG)" == "Win9xConHook - Win32 Debug" - -# PROP BASE Use_MFC 0 -# PROP BASE Use_Debug_Libraries 1 -# PROP BASE Output_Dir ".\Debug" -# PROP BASE Intermediate_Dir ".\Debug" -# PROP BASE Target_Dir "" -# PROP Use_MFC 0 -# PROP Use_Debug_Libraries 1 -# PROP Output_Dir "Win9xConHookD" -# PROP Intermediate_Dir "Win9xConHookD" -# PROP Ignore_Export_Lib 0 -# PROP Target_Dir "" -# ADD BASE CPP /nologo /MTd /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /c -# ADD CPP /nologo /MDd /W3 /Gm /GX /ZI /Od /D "_DEBUG" /D "WIN32" /D "_WINDOWS" /D "SHARED_MODULE" /FD /c -# ADD BASE MTL /nologo /D "_DEBUG" /win32 -# ADD MTL /nologo /D "_DEBUG" /mktyplib203 /win32 -# ADD BASE RSC /l 0x809 /d "_DEBUG" -# ADD RSC /l 0x809 /d "_DEBUG" -BSC32=bscmake.exe -# ADD BASE BSC32 /nologo -# ADD BSC32 /nologo -LINK32=link.exe -# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:windows /dll /debug /machine:I386 /base:@"BaseAddr.ref",mod_status -# ADD LINK32 kernel32.lib user32.lib gdi32.lib /nologo /base:"0x1c0f0000" /subsystem:windows /dll /incremental:no /map /debug /machine:I386 - -!ENDIF - -# Begin Target - -# Name "Win9xConHook - Win32 Release" -# Name "Win9xConHook - Win32 Debug" -# Begin Source File - -SOURCE=.\Win9xConHook.c -# End Source File -# Begin Source File - -SOURCE=.\Win9xConHook.def -# End Source File -# Begin Source File - -SOURCE=.\Win9xConHook.h -# End Source File -# End Target -# End Project diff --git a/server/mpm/winnt/Win9xConHook.h b/server/mpm/winnt/Win9xConHook.h deleted file mode 100644 index 107cdbe2f51f258d14f16342020ea62ef2bc768d..0000000000000000000000000000000000000000 --- a/server/mpm/winnt/Win9xConHook.h +++ /dev/null @@ -1,24 +0,0 @@ - - - -/* - * FixConsoleControlHandler will register a handler routine with the - * Win9xConHook.dll, creating a hidden window and forwarding the - * WM_ENDSESSION and WM_CLOSE messages to the registered handler - * as CTRL_SHUTDOWN_EVENT, CTRL_LOGOFF_EVENT and CTRL_CLOSE_EVENT. - */ -BOOL WINAPI FixConsoleCtrlHandler( - PHANDLER_ROUTINE phandler, - BOOL add); - -/* - * PostMessage Hook: - */ -LRESULT CALLBACK GetMsgProc(INT hc, WPARAM wParam, LPARAM lParam); - - -/* - * SendMessage Hook: - */ -LRESULT CALLBACK CallWndProc(INT hc, WPARAM wParam, LPARAM lParam); - diff --git a/server/mpm/winnt/mpm.h b/server/mpm/winnt/mpm.h deleted file mode 100644 index a75dba6682c5588afd6d41837a552805ab640b35..0000000000000000000000000000000000000000 --- a/server/mpm/winnt/mpm.h +++ /dev/null @@ -1,63 +0,0 @@ -/* ==================================================================== - * The Apache Software License, Version 1.1 - * - * Copyright (c) 2000 The Apache Software Foundation. All rights - * reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in - * the documentation and/or other materials provided with the - * distribution. - * - * 3. The end-user documentation included with the redistribution, - * if any, must include the following acknowledgment: - * "This product includes software developed by the - * Apache Software Foundation (http://www.apache.org/)." - * Alternately, this acknowledgment may appear in the software itself, - * if and wherever such third-party acknowledgments normally appear. - * - * 4. The names "Apache" and "Apache Software Foundation" must - * not be used to endorse or promote products derived from this - * software without prior written permission. For written - * permission, please contact apache@apache.org. - * - * 5. Products derived from this software may not be called "Apache", - * nor may "Apache" appear in their name, without prior written - * permission of the Apache Software Foundation. - * - * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED - * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES - * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR - * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF - * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND - * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, - * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT - * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * ==================================================================== - * - * This software consists of voluntary contributions made by many - * individuals on behalf of the Apache Software Foundation. For more - * information on the Apache Software Foundation, please see - * . - * - * Portions of this software are based upon public domain software - * originally written at the National Center for Supercomputing Applications, - * University of Illinois, Urbana-Champaign. - */ - -#ifndef APACHE_MPM_WINNT_H -#define APACHE_MPM_WINNT_H - - -#endif /* APACHE_MPM_WINNT_H */ diff --git a/server/mpm/winnt/mpm_default.h b/server/mpm/winnt/mpm_default.h deleted file mode 100644 index 5ac2fe40aa4e1162d46d4c5d6e4c5bf99c586a1c..0000000000000000000000000000000000000000 --- a/server/mpm/winnt/mpm_default.h +++ /dev/null @@ -1,114 +0,0 @@ -/* ==================================================================== - * Copyright (c) 1995-1999 The Apache Group. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in - * the documentation and/or other materials provided with the - * distribution. - * - * 3. All advertising materials mentioning features or use of this - * software must display the following acknowledgment: - * "This product includes software developed by the Apache Group - * for use in the Apache HTTP server project (http://www.apache.org/)." - * - * 4. The names "Apache Server" and "Apache Group" must not be used to - * endorse or promote products derived from this software without - * prior written permission. For written permission, please contact - * apache@apache.org. - * - * 5. Products derived from this software may not be called "Apache" - * nor may "Apache" appear in their names without prior written - * permission of the Apache Group. - * - * 6. Redistributions of any form whatsoever must retain the following - * acknowledgment: - * "This product includes software developed by the Apache Group - * for use in the Apache HTTP server project (http://www.apache.org/)." - * - * THIS SOFTWARE IS PROVIDED BY THE APACHE GROUP ``AS IS'' AND ANY - * EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR - * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE APACHE GROUP OR - * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT - * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, - * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED - * OF THE POSSIBILITY OF SUCH DAMAGE. - * ==================================================================== - * - * This software consists of voluntary contributions made by many - * individuals on behalf of the Apache Group and was originally based - * on public domain software written at the National Center for - * Supercomputing Applications, University of Illinois, Urbana-Champaign. - * For more information on the Apache Group and the Apache HTTP server - * project, please see . - * - */ - -#ifndef APACHE_MPM_DEFAULT_H -#define APACHE_MPM_DEFAULT_H - -/* Number of threads to spawn off by default --- also, if fewer than - * this free when the caretaker checks, it will spawn more. - */ -#ifndef DEFAULT_START_THREAD -#define DEFAULT_START_THREAD 5 -#endif - -/* Maximum number of *free* server threads --- more than this, and - * they will die off. -#ifndef DEFAULT_MAX_SPARE_THREAD -#define DEFAULT_MAX_SPARE_THREAD 10 -#endif -*/ - -/* Minimum --- fewer than this, and more will be created */ -/* -#ifndef DEFAULT_MIN_SPARE_THREAD -#define DEFAULT_MIN_SPARE_THREAD 5 -#endif -*/ - -/* Limit on the threads per process. Clients will be locked out if more than - * this * HARD_SERVER_LIMIT are needed. - * - * We keep this for one reason it keeps the size of the scoreboard file small - * enough that we can read the whole thing without worrying too much about - * the overhead. - */ -#ifndef HARD_THREAD_LIMIT -#define HARD_THREAD_LIMIT 64 -#endif - -/* Number of servers to spawn off by default - */ -#ifndef DEFAULT_NUM_DAEMON -#define DEFAULT_NUM_DAEMON 1 -#endif - -/* Limit on the total --- clients will be locked out if more servers than - * this are needed. It is intended solely to keep the server from crashing - * when things get out of hand. - * - * We keep a hard maximum number of servers, for two reasons --- first off, - * in case something goes seriously wrong, we want to stop the fork bomb - * short of actually crashing the machine we're running on by filling some - * kernel table. Secondly, it keeps the size of the scoreboard file small - * enough that we can read the whole thing without worrying too much about - * the overhead. - */ -#ifndef HARD_SERVER_LIMIT -#define HARD_SERVER_LIMIT 8 -#endif - -#endif /* AP_MPM_DEFAULT_H */ diff --git a/server/mpm/winnt/mpm_winnt.c b/server/mpm/winnt/mpm_winnt.c deleted file mode 100644 index 9ab533d28959c18012e4bf4fecf72f710255e4c4..0000000000000000000000000000000000000000 --- a/server/mpm/winnt/mpm_winnt.c +++ /dev/null @@ -1,1683 +0,0 @@ -/* ==================================================================== - * Copyright (c) 1995-1999 The Apache Group. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in - * the documentation and/or other materials provided with the - * distribution. - * - * 3. All advertising materials mentioning features or use of this - * software must display the following acknowledgment: - * "This product includes software developed by the Apache Group - * for use in the Apache HTTP server project (http://www.apache.org/)." - * - * 4. The names "Apache Server" and "Apache Group" must not be used to - * endorse or promote products derived from this software without - * prior written permission. For written permission, please contact - * apache@apache.org. - * - * 5. Products derived from this software may not be called "Apache" - * nor may "Apache" appear in their names without prior written - * permission of the Apache Group. - * - * 6. Redistributions of any form whatsoever must retain the following - * acknowledgment: - * "This product includes software developed by the Apache Group - * for use in the Apache HTTP server project (http://www.apache.org/)." - * - * THIS SOFTWARE IS PROVIDED BY THE APACHE GROUP ``AS IS'' AND ANY - * EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR - * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE APACHE GROUP OR - * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT - * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, - * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED - * OF THE POSSIBILITY OF SUCH DAMAGE. - * ==================================================================== - * - * This software consists of voluntary contributions made by many - * individuals on behalf of the Apache Group and was originally based - * on public domain software written at the National Center for - * Supercomputing Applications, University of Illinois, Urbana-Champaign. - * For more information on the Apache Group and the Apache HTTP server - * project, please see . - * - */ - -#define CORE_PRIVATE - -#include "httpd.h" -#include "http_main.h" -#include "http_log.h" -#include "http_config.h" /* for read_config */ -#include "http_core.h" /* for get_remote_host */ -#include "http_connection.h" -#include "ap_mpm.h" -#include "ap_config.h" -#include "ap_listen.h" -#include "multithread.h" -#include "../os/win32/getopt.h" -#include "mpm_default.h" -/* - * Actual definitions of WINNT MPM specific config globals - */ -int ap_max_requests_per_child=0; -int ap_daemons_to_start=0; -static char *mpm_pid_fname=NULL; -static int ap_threads_per_child = 0; -//static int ap_max_threads_per_child = 0; -static int workers_may_exit = 0; -static int max_requests_per_child = 0; -static int requests_this_child; -static int num_listenfds = 0; -static struct pollfd *listenfds; -static pool *pconf; /* Pool for config stuff */ - -static char ap_coredump_dir[MAX_STRING_LEN]; - - -static server_rec *server_conf; -/*static int sd; ZZZ why is the global...? Only seems to be needed on Win32*/ - -/* one_process --- debugging mode variable; can be set from the command line - * with the -X flag. If set, this gets you the child_main loop running - * in the process which originally started up (no detach, no make_child), - * which is a pretty nice debugging environment. (You'll get a SIGHUP - * early in standalone_main; just continue through. This is the server - * trying to kill off any child processes which it might have lying - * around --- Apache doesn't keep track of their pids, it just sends - * SIGHUP to the process group, ignoring it in the root process. - * Continue through and you'll be fine.). - */ - -static int one_process = 0; - -#ifdef DEBUG_SIGSTOP -int raise_sigstop_flags; -#endif - - -/* *Non*-shared winnt.c globals... */ -event *exit_event; -mutex *start_mutex; -int my_pid; -int parent_pid; -int listenmaxfd; - -/* a clean exit from a child with proper cleanup - static void clean_child_exit(int code) __attribute__ ((noreturn)); -void clean_child_exit(int code) -{ - if (pchild) { - ap_destroy_pool(pchild); - } - exit(code); -} -*/ -/***************************************************************** - * Connection structures and accounting... - */ - -/* volatile just in case */ -static int volatile shutdown_pending; -static int volatile restart_pending; -static int volatile is_graceful; - -/* - * ap_start_shutdown() and ap_start_restart(), below, are a first stab at - * functions to initiate shutdown or restart without relying on signals. - * Previously this was initiated in sig_term() and restart() signal handlers, - * but we want to be able to start a shutdown/restart from other sources -- - * e.g. on Win32, from the service manager. Now the service manager can - * call ap_start_shutdown() or ap_start_restart() as appropiate. Note that - * these functions can also be called by the child processes, since global - * variables are no longer used to pass on the required action to the parent. - * - * These should only be called from the parent process itself, since the - * parent process will use the shutdown_pending and restart_pending variables - * to determine whether to shutdown or restart. The child process should - * call signal_parent() directly to tell the parent to die -- this will - * cause neither of those variable to be set, which the parent will - * assume means something serious is wrong (which it will be, for the - * child to force an exit) and so do an exit anyway. - */ - -void ap_start_shutdown(void) -{ - if (shutdown_pending == 1) { - /* Um, is this _probably_ not an error, if the user has - * tried to do a shutdown twice quickly, so we won't - * worry about reporting it. - */ - return; - } - shutdown_pending = 1; -} - -/* do a graceful restart if graceful == 1 */ -void ap_start_restart(int graceful) -{ - - if (restart_pending == 1) { - /* Probably not an error - don't bother reporting it */ - return; - } - restart_pending = 1; - is_graceful = graceful; -} - -static void sig_term(int sig) -{ - ap_start_shutdown(); -} - -static void restart(int sig) -{ - ap_start_restart(1); -} - -static ap_listen_rec *old_listeners; -static ap_listen_rec *head_listener; -static int setup_listeners(pool *pconf, server_rec *s) -{ - ap_listen_rec *lr; - int num_listeners = 0; - - if (ap_listen_open(pconf, s->port)) { - return 0; - } - for (lr = ap_listeners; lr; lr = lr->next) { - num_listeners++; - } - return num_listeners; -} - -static int find_listener(ap_listen_rec *lr) -{ - ap_listen_rec *or; - - for (or = old_listeners; or; or = or->next) { - if (!memcmp(&or->local_addr, &lr->local_addr, sizeof(or->local_addr))) { -// or->used = 1; - return or->fd; - } - } - return -1; -} - - -static void close_unused_listeners(void) -{ - ap_listen_rec *or, *next; - - for (or = old_listeners; or; or = next) { - next = or->next; -// if (!or->used) - closesocket(or->fd); - free(or); - } - old_listeners = NULL; -} - -/* - * Find a listener which is ready for accept(). This advances the - * head_listener global. - */ -static ap_inline ap_listen_rec *find_ready_listener(fd_set * main_fds) -//static ap_listen_rec *find_ready_listener(fd_set * main_fds) -{ - ap_listen_rec *lr; - - lr = head_listener; - do { - if (FD_ISSET(lr->fd, main_fds)) { - head_listener = lr->next; - return (lr); - } - lr = lr->next; - } while (lr != head_listener); - return NULL; -} - -/* - * Signalling Apache on NT. - * - * Under Unix, Apache can be told to shutdown or restart by sending various - * signals (HUP, USR, TERM). On NT we don't have easy access to signals, so - * we use "events" instead. The parent apache process goes into a loop - * where it waits forever for a set of events. Two of those events are - * called - * - * apPID_shutdown - * apPID_restart - * - * (where PID is the PID of the apache parent process). When one of these - * is signalled, the Apache parent performs the appropriate action. The events - * can become signalled through internal Apache methods (e.g. if the child - * finds a fatal error and needs to kill its parent), via the service - * control manager (the control thread will signal the shutdown event when - * requested to stop the Apache service), from the -k Apache command line, - * or from any external program which finds the Apache PID from the - * httpd.pid file. - * - * The signal_parent() function, below, is used to signal one of these events. - * It can be called by any child or parent process, since it does not - * rely on global variables. - * - * On entry, type gives the event to signal. 0 means shutdown, 1 means - * graceful restart. - */ - -static void signal_parent(int type) -{ - HANDLE e; - char *signal_name; - extern char signal_shutdown_name[]; - extern char signal_restart_name[]; - - /* after updating the shutdown_pending or restart flags, we need - * to wake up the parent process so it can see the changes. The - * parent will normally be waiting for either a child process - * to die, or for a signal on the "spache-signal" event. So set the - * "apache-signal" event here. - */ - - if (one_process) { - return; - } - - switch(type) { - case 0: signal_name = signal_shutdown_name; break; - case 1: signal_name = signal_restart_name; break; - default: return; - } - -// APD2("signal_parent signalling event \"%s\"", signal_name); - - e = OpenEvent(EVENT_ALL_ACCESS, FALSE, signal_name); - if (!e) { - /* Um, problem, can't signal the parent, which means we can't - * signal ourselves to die. Ignore for now... - */ - ap_log_error(APLOG_MARK, APLOG_EMERG|APLOG_WIN32ERROR, server_conf, - "OpenEvent on %s event", signal_name); - return; - } - if (SetEvent(e) == 0) { - /* Same problem as above */ - ap_log_error(APLOG_MARK, APLOG_EMERG|APLOG_WIN32ERROR, server_conf, - "SetEvent on %s event", signal_name); - CloseHandle(e); - return; - } - CloseHandle(e); -} - - -/***************************************************************** - * Here follows a long bunch of generic server bookkeeping stuff... - */ - -static void sock_disable_nagle(int s) /* ZZZ abstract */ -{ - /* The Nagle algorithm says that we should delay sending partial - * packets in hopes of getting more data. We don't want to do - * this; we are not telnet. There are bad interactions between - * persistent connections and Nagle's algorithm that have very severe - * performance penalties. (Failing to disable Nagle is not much of a - * problem with simple HTTP.) - * - * In spite of these problems, failure here is not a shooting offense. - */ - int just_say_no = 1; - - if (setsockopt(s, IPPROTO_TCP, TCP_NODELAY, (char *) &just_say_no, - sizeof(int)) < 0) { - ap_log_error(APLOG_MARK, APLOG_WARNING, server_conf, - "setsockopt: (TCP_NODELAY)"); - } -} - - -/********************************************************************** - * Multithreaded implementation - * - * This code is fairly specific to Win32. - * - * The model used to handle requests is a set of threads. One "main" - * thread listens for new requests. When something becomes - * available, it does a select and places the newly available socket - * onto a list of "jobs" (add_job()). Then any one of a fixed number - * of "worker" threads takes the top job off the job list with - * remove_job() and handles that connection to completion. After - * the connection has finished the thread is free to take another - * job from the job list. - * - * In the code, the "main" thread is running within the worker_main() - * function. The first thing this function does is create the - * worker threads, which operate in the child_sub_main() function. The - * main thread then goes into a loop within worker_main() where they - * do a select() on the listening sockets. The select times out once - * per second so that the thread can check for an "exit" signal - * from the parent process (see below). If this signal is set, the - * thread can exit, but only after it has accepted all incoming - * connections already in the listen queue (since Win32 appears - * to through away listened but unaccepted connections when a - * process dies). - * - * Because the main and worker threads exist within a single process - * they are vulnerable to crashes or memory leaks (crashes can also - * be caused within modules, of course). There also needs to be a - * mechanism to perform restarts and shutdowns. This is done by - * creating the main & worker threads within a subprocess. A - * main process (the "parent process") creates one (or more) - * processes to do the work, then the parent sits around waiting - * for the working process to die, in which case it starts a new - * one. The parent process also handles restarts (by creating - * a new working process then signalling the previous working process - * exit ) and shutdowns (by signalling the working process to exit). - * The parent process operates within the master_main() function. This - * process also handles requests from the service manager (NT only). - * - * Signalling between the parent and working process uses a Win32 - * event. Each child has a unique name for the event, which is - * passed to it with the -Z argument when the child is spawned. The - * parent sets (signals) this event to tell the child to die. - * At present all children do a graceful die - they finish all - * current jobs _and_ empty the listen queue before they exit. - * A non-graceful die would need a second event. The -Z argument in - * the child is also used to create the shutdown and restart events, - * since the prefix (apPID) contains the parent process PID. - * - * The code below starts with functions at the lowest level - - * worker threads, and works up to the top level - the main() - * function of the parent process. - * - * The scoreboard (in process memory) contains details of the worker - * threads (within the active working process). There is no shared - * "scoreboard" between processes, since only one is ever active - * at once (or at most, two, when one has been told to shutdown but - * is processes outstanding requests, and a new one has been started). - * This is controlled by a "start_mutex" which ensures only one working - * process is active at once. - **********************************************************************/ - -/* The code protected by #ifdef UNGRACEFUL_RESTARTS/#endif sections - * could implement a sort-of ungraceful restart for Win32. instead of - * graceful restarts. - * - * However it does not work too well because it does not intercept a - * connection already in progress (in child_sub_main()). We'd have to - * get that to poll on the exit event. - */ - -/* - * Definition of jobs, shared by main and worker threads. - */ - -typedef struct joblist_s { - struct joblist_s *next; - int sock; -} joblist; - -/* - * Globals common to main and worker threads. This structure is not - * used by the parent process. - */ - -typedef struct globals_s { -#ifdef UNGRACEFUL_RESTART - HANDLE thread_exit_event; -#else - int exit_now; -#endif - semaphore *jobsemaphore; - joblist *jobhead; - joblist *jobtail; - mutex *jobmutex; - int jobcount; -} globals; - -globals allowed_globals = -{0, NULL, NULL, NULL, NULL, 0}; - -/* - * add_job()/remove_job() - add or remove an accepted socket from the - * list of sockets connected to clients. allowed_globals.jobmutex protects - * against multiple concurrent access to the linked list of jobs. - */ - -void add_job(int sock) -{ - joblist *new_job; - - ap_assert(allowed_globals.jobmutex); - /* TODO: If too many jobs in queue, sleep, check for problems */ - ap_acquire_mutex(allowed_globals.jobmutex); - new_job = (joblist *) malloc(sizeof(joblist)); - if (new_job == NULL) { - fprintf(stderr, "Ouch! Out of memory in add_job()!\n"); - } - new_job->next = NULL; - new_job->sock = sock; - if (allowed_globals.jobtail != NULL) - allowed_globals.jobtail->next = new_job; - allowed_globals.jobtail = new_job; - if (!allowed_globals.jobhead) - allowed_globals.jobhead = new_job; - allowed_globals.jobcount++; - release_semaphore(allowed_globals.jobsemaphore); - ap_release_mutex(allowed_globals.jobmutex); -} - -int remove_job(void) -{ - joblist *job; - int sock; - -#ifdef UNGRACEFUL_RESTART - HANDLE hObjects[2]; - int rv; - - hObjects[0] = allowed_globals.jobsemaphore; - hObjects[1] = allowed_globals.thread_exit_event; - - rv = WaitForMultipleObjects(2, hObjects, FALSE, INFINITE); - ap_assert(rv != WAIT_FAILED); - if (rv == WAIT_OBJECT_0 + 1) { - /* thread_exit_now */ -// APD1("thread got exit now event"); - return -1; - } - /* must be semaphore */ -#else - acquire_semaphore(allowed_globals.jobsemaphore); -#endif - ap_assert(allowed_globals.jobmutex); - -#ifdef UNGRACEFUL_RESTART - if (!allowed_globals.jobhead) { -#else - ap_acquire_mutex(allowed_globals.jobmutex); - if (allowed_globals.exit_now && !allowed_globals.jobhead) { -#endif - ap_release_mutex(allowed_globals.jobmutex); - return (-1); - } - job = allowed_globals.jobhead; - ap_assert(job); - allowed_globals.jobhead = job->next; - if (allowed_globals.jobhead == NULL) - allowed_globals.jobtail = NULL; - ap_release_mutex(allowed_globals.jobmutex); - sock = job->sock; - free(job); - return (sock); -} - -/* - * child_sub_main() - this is the main loop for the worker threads - * - * Each thread runs within this function. They wait within remove_job() - * for a job to become available, then handle all the requests on that - * connection until it is closed, then return to remove_job(). - * - * The worker thread will exit when it removes a job which contains - * socket number -1. This provides a graceful thread exit, since - * it will never exit during a connection. - * - * This code in this function is basically equivalent to the child_main() - * from the multi-process (Unix) environment, except that we - * - * - do not call child_init_modules (child init API phase) - * - block in remove_job, and when unblocked we have an already - * accepted socket, instead of blocking on a mutex or select(). - */ - -static void child_sub_main(int child_num) -{ - NET_SIZE_T clen; - struct sockaddr sa_server; - struct sockaddr sa_client; - pool *ptrans; - int requests_this_child = 0; - int csd = -1; - int dupped_csd = -1; - int srv = 0; - - /* Note: current_conn used to be a defined at file scope as follows... Since the signal code is - not being used in WIN32, make the variable local */ - // static APACHE_TLS conn_rec *volatile current_conn; - conn_rec *current_conn; - - ptrans = ap_make_sub_pool(pconf); - -#if 0 - /* ZZZ scoreboard */ - (void) ap_update_child_status(child_num, SERVER_READY, (request_rec *) NULL); -#endif - - /* - * Setup the jump buffers so that we can return here after a timeout. - */ -#if 0 /* ZZZ */ -#if defined(USE_LONGJMP) - setjmp(jmpbuffer); -#else - sigsetjmp(jmpbuffer, 1); -#endif -#ifdef SIGURG - signal(SIGURG, timeout); -#endif -#endif - - while (1) { - BUFF *conn_io; - request_rec *r; - - /* - * (Re)initialize this child to a pre-connection state. - */ -#if 0 /* ZZZ Alarms... */ - ap_set_callback_and_alarm(NULL, 0); /* Cancel any outstanding alarms */ -#endif -#if 0 /* ZZZ what is this? It's not thread safe! */ - timeout_req = NULL; /* No request in progress */ -#endif - current_conn = NULL; - - ap_clear_pool(ptrans); - -#if 0 - /* ZZZ scoreboard */ - (void) ap_update_child_status(child_num, SERVER_READY, - (request_rec *) NULL); -#endif - - /* Get job from the job list. This will block until a job is ready. - * If -1 is returned then the main thread wants us to exit. - */ - csd = remove_job(); - if (csd == -1) - break; /* time to exit */ - requests_this_child++; - - ap_note_cleanups_for_socket(ptrans, csd); - - /* - * We now have a connection, so set it up with the appropriate - * socket options, file descriptors, and read/write buffers. - */ - - clen = sizeof(sa_server); - if (getsockname(csd, &sa_server, &clen) < 0) { - ap_log_error(APLOG_MARK, APLOG_WARNING, server_conf, "getsockname"); - continue; - } - clen = sizeof(sa_client); - if ((getpeername(csd, &sa_client, &clen)) < 0) { - /* get peername will fail if the input isn't a socket */ - perror("getpeername"); - memset(&sa_client, '\0', sizeof(sa_client)); - } - - sock_disable_nagle(csd); -#if 0 - /* ZZZ scoreboard */ - (void) ap_update_child_status(child_num, SERVER_BUSY_READ, - (request_rec *) NULL); -#endif - -/* ZZZ . This will break CGIs since they need to know whether a fd is a socket or - a file handle... Fix with APR -*/ - conn_io = ap_bcreate(ptrans, B_RDWR | B_SOCKET); -// conn_io = ap_bcreate(ptrans, B_RDWR); - dupped_csd = csd; -#if defined(NEED_DUPPED_CSD) - if ((dupped_csd = dup(csd)) < 0) { - ap_log_error(APLOG_MARK, APLOG_ERR, server_conf, - "dup: couldn't duplicate csd"); - dupped_csd = csd; /* Oh well... */ - } - ap_note_cleanups_for_socket(ptrans, dupped_csd); -#endif - ap_bpushfd(conn_io, csd); /* ap_bpushfd(conn_io, csd, dupped_csd); why did we drop duped fd? */ - - current_conn = ap_new_connection(ptrans, server_conf, conn_io, - (struct sockaddr_in *) &sa_client, - (struct sockaddr_in *) &sa_server, - child_num, 0); /* Set my_thread_num to 0 for now */ - - ap_process_connection(current_conn); - } -} - - -void child_main(int child_num_arg) -{ - /* - * Only reason for this function, is to pass in - * arguments to child_sub_main() on its stack so - * that longjump doesn't try to corrupt its local - * variables and I don't need to make those - * damn variables static/global - */ - child_sub_main(child_num_arg); -} - - - -void cleanup_thread(thread **handles, int *thread_cnt, int thread_to_clean) -{ - int i; - - free_thread(handles[thread_to_clean]); - for (i = thread_to_clean; i < ((*thread_cnt) - 1); i++) - handles[i] = handles[i + 1]; - (*thread_cnt)--; -} - -/* - * The Win32 call WaitForMultipleObjects will only allow you to wait for - * a maximum of MAXIMUM_WAIT_OBJECTS (current 64). Since the threading - * model in the multithreaded version of apache wants to use this call, - * we are restricted to a maximum of 64 threads. This is a simplistic - * routine that will increase this size. - */ -static DWORD wait_for_many_objects(DWORD nCount, CONST HANDLE *lpHandles, - DWORD dwSeconds) -{ - time_t tStopTime; - DWORD dwRet = WAIT_TIMEOUT; - DWORD dwIndex=0; - BOOL bFirst = TRUE; - - tStopTime = time(NULL) + dwSeconds; - - do { - if (!bFirst) - Sleep(1000); - else - bFirst = FALSE; - - for (dwIndex = 0; dwIndex * MAXIMUM_WAIT_OBJECTS < nCount; dwIndex++) { - dwRet = WaitForMultipleObjects( - min(MAXIMUM_WAIT_OBJECTS, - nCount - (dwIndex * MAXIMUM_WAIT_OBJECTS)), - lpHandles + (dwIndex * MAXIMUM_WAIT_OBJECTS), - 0, 0); - - if (dwRet != WAIT_TIMEOUT) { - break; - } - } - } while((time(NULL) < tStopTime) && (dwRet == WAIT_TIMEOUT)); - - return dwRet; -} - -//extern void main_control_server(void *); /* in hellop.c */ - -#define MAX_SELECT_ERRORS 100 - -/* - * Initialise the signal names, in the global variables signal_name_prefix, - * signal_restart_name and signal_shutdown_name. - */ - -#define MAX_SIGNAL_NAME 30 /* Long enough for apPID_shutdown, where PID is an int */ -char signal_name_prefix[MAX_SIGNAL_NAME]; -char signal_restart_name[MAX_SIGNAL_NAME]; -char signal_shutdown_name[MAX_SIGNAL_NAME]; -static void setup_signal_names(char *prefix) -{ - ap_snprintf(signal_name_prefix, sizeof(signal_name_prefix), prefix); - ap_snprintf(signal_shutdown_name, sizeof(signal_shutdown_name), - "%s_shutdown", signal_name_prefix); - ap_snprintf(signal_restart_name, sizeof(signal_restart_name), - "%s_restart", signal_name_prefix); -} - -static void setup_inherited_listeners(pool *p) -{ - HANDLE pipe; - ap_listen_rec *lr; - int fd; - WSAPROTOCOL_INFO WSAProtocolInfo; - DWORD BytesRead; - - /* Open the pipe to the parent process to receive the inherited socket - * data. The sockets have been set to listening in the parent process. - */ - pipe = GetStdHandle(STD_INPUT_HANDLE); - - /* Setup the listeners */ - listenmaxfd = -1; - FD_ZERO(&listenfds); - lr = ap_listeners; - - FD_ZERO(&listenfds); - - for (;;) { - fd = find_listener(lr); - if (fd < 0) { - if (!ReadFile(pipe, - &WSAProtocolInfo, sizeof(WSAPROTOCOL_INFO), - &BytesRead, - (LPOVERLAPPED) NULL)){ - ap_log_error(APLOG_MARK, APLOG_WIN32ERROR|APLOG_CRIT, server_conf, - "setup_inherited_listeners: Unable to read socket data from parent"); - exit(1); - } - fd = WSASocket(FROM_PROTOCOL_INFO, - FROM_PROTOCOL_INFO, - FROM_PROTOCOL_INFO, - &WSAProtocolInfo, - 0, - 0); - if (fd == INVALID_SOCKET) { - ap_log_error(APLOG_MARK, APLOG_WIN32ERROR|APLOG_CRIT, server_conf, - "setup_inherited_listeners: WSASocket failed to get inherit the socket."); - exit(1); - } -// APD2("setup_inherited_listeners: WSASocket() returned socket %d", fd); - } - else { - ap_note_cleanups_for_socket(p, fd); - } - if (fd >= 0) { - FD_SET(fd, &listenfds); - if (fd > listenmaxfd) - listenmaxfd = fd; - } - lr->fd = fd; - if (lr->next == NULL) - break; - lr = lr->next; - } - /* turn the list into a ring */ - lr->next = ap_listeners; - head_listener = ap_listeners; - close_unused_listeners(); - CloseHandle(pipe); - return; -} - -/* - * worker_main() is main loop for the child process. The loop in - * this function becomes the controlling thread for the actually working - * threads (which run in a loop in child_sub_main()). - */ - -void worker_main(void) -{ - int nthreads; - fd_set main_fds; - int srv; - int clen; - int csd; - int sd = -1; // made this local and not global - struct sockaddr_in sa_client; - int total_jobs = 0; - thread **child_handles; - int rv; - time_t end_time; - int i; - struct timeval tv; - int wait_time = 1; - HANDLE hObjects[2]; - int count_select_errors = 0; - pool *pchild; - - pchild = ap_make_sub_pool(pconf); - -// ap_standalone = 1; -// sd = -1; ?? this variable is global in 1.3.x! - nthreads = ap_threads_per_child; - - if (nthreads <= 0) /* maybe this is not needed... Should be checked in config... */ - nthreads = 1; - - my_pid = getpid(); - - - ap_restart_time = time(NULL); - -// reinit_scoreboard(pconf); - - /* - * Wait until we have permission to start accepting connections. - * start_mutex is used to ensure that only one child ever - * goes into the listen/accept loop at once. Also wait on exit_event, - * in case we (this child) is told to die before we get a chance to - * serve any requests. - */ - hObjects[0] = (HANDLE)start_mutex; - hObjects[1] = (HANDLE)exit_event; - rv = WaitForMultipleObjects(2, hObjects, FALSE, INFINITE); - if (rv == WAIT_FAILED) { - ap_log_error(APLOG_MARK,APLOG_ERR|APLOG_WIN32ERROR, server_conf, - "Waiting for start_mutex or exit_event -- process will exit"); - - ap_destroy_pool(pchild); -// cleanup_scoreboard(); - exit(0); - } - if (rv == WAIT_OBJECT_0 + 1) { - /* exit event signalled - exit now */ - ap_destroy_pool(pchild); -// cleanup_scoreboard(); - exit(0); - } - /* start_mutex obtained, continue into the select() loop */ - if (one_process) { - setup_listeners(pconf, server_conf); - } else { - /* Get listeners from the parent process */ - setup_inherited_listeners(pconf); - } - - if (listenmaxfd == -1) { - /* Help, no sockets were made, better log something and exit */ - ap_log_error(APLOG_MARK, APLOG_CRIT|APLOG_NOERRNO, NULL, - "No sockets were created for listening"); - - signal_parent(0); /* tell parent to die */ - - ap_destroy_pool(pchild); -// cleanup_scoreboard(); - exit(0); - } -// set_signals(); - -// ap_child_init_modules(pconf, server_conf); - - allowed_globals.jobsemaphore = create_semaphore(0); - allowed_globals.jobmutex = ap_create_mutex(NULL); - - /* spawn off the threads */ - child_handles = (thread *) alloca(nthreads * sizeof(int)); - for (i = 0; i < nthreads; i++) { - child_handles[i] = create_thread((void (*)(void *)) child_main, (void *) i); - } - - while (1) { - if (ap_max_requests_per_child && (total_jobs > ap_max_requests_per_child)) { - /* MaxRequestsPerChild hit... - */ - break; - } - /* Always check for the exit event being signaled. - */ - rv = WaitForSingleObject(exit_event, 0); - ap_assert((rv == WAIT_TIMEOUT) || (rv == WAIT_OBJECT_0)); - if (rv == WAIT_OBJECT_0) { -// APD1("child: exit event signalled, exiting"); - break; - } - - tv.tv_sec = wait_time; - tv.tv_usec = 0; - - memcpy(&main_fds, &listenfds, sizeof(fd_set)); - srv = ap_select(listenmaxfd + 1, &main_fds, NULL, NULL, &tv); -#ifdef WIN32 - if (srv == SOCKET_ERROR) { - /* Map the Win32 error into a standard Unix error condition */ - errno = WSAGetLastError(); - srv = -1; - } -#endif /* WIN32 */ - - if (srv < 0) { - /* Error occurred - if EINTR, loop around with problem */ - if (errno != EINTR) { - /* A "real" error occurred, log it and increment the count of - * select errors. This count is used to ensure we don't go into - * a busy loop of continuous errors. - */ - ap_log_error(APLOG_MARK, APLOG_ERR, server_conf, "select: (listen)"); - count_select_errors++; - if (count_select_errors > MAX_SELECT_ERRORS) { - ap_log_error(APLOG_MARK, APLOG_ERR|APLOG_NOERRNO, server_conf, - "Too many errors in select loop. Child process exiting."); - break; - } - } - continue; - } - count_select_errors = 0; /* reset count of errors */ - if (srv == 0) { - continue; - } - - { - ap_listen_rec *lr; - - lr = find_ready_listener(&main_fds); - if (lr != NULL) { - sd = lr->fd; - } - } - do { - clen = sizeof(sa_client); - csd = accept(sd, (struct sockaddr *) &sa_client, &clen); -#ifdef WIN32 - if (csd == INVALID_SOCKET) { - csd = -1; - errno = WSAGetLastError(); - } -#endif /* WIN32 */ - } while (csd < 0 && errno == EINTR); - - if (csd < 0) { -#if defined(EPROTO) && defined(ECONNABORTED) - if ((errno != EPROTO) && (errno != ECONNABORTED)) -#elif defined(EPROTO) - if (errno != EPROTO) -#elif defined(ECONNABORTED) - if (errno != ECONNABORTED) -#endif - ap_log_error(APLOG_MARK, APLOG_ERR, server_conf, - "accept: (client socket)"); - } - else { - add_job(csd); - total_jobs++; - } - } - -// APD2("process PID %d exiting", my_pid); - - /* Get ready to shutdown and exit */ - allowed_globals.exit_now = 1; - ap_release_mutex(start_mutex); - -#ifdef UNGRACEFUL_RESTART - SetEvent(allowed_globals.thread_exit_event); -#else - for (i = 0; i < nthreads; i++) { - add_job(-1); - } -#endif - -// APD2("process PID %d waiting for worker threads to exit", my_pid); - /* Wait for all your children */ - end_time = time(NULL) + 180; - while (nthreads) { - rv = wait_for_many_objects(nthreads, child_handles, - end_time - time(NULL)); - if (rv != WAIT_TIMEOUT) { - rv = rv - WAIT_OBJECT_0; - ap_assert((rv >= 0) && (rv < nthreads)); - cleanup_thread(child_handles, &nthreads, rv); - continue; - } - break; - } - -// APD2("process PID %d killing remaining worker threads", my_pid); - for (i = 0; i < nthreads; i++) { - kill_thread(child_handles[i]); - free_thread(child_handles[i]); - } -#ifdef UNGRACEFUL_RESTART - ap_assert(CloseHandle(allowed_globals.thread_exit_event)); -#endif - destroy_semaphore(allowed_globals.jobsemaphore); - ap_destroy_mutex(allowed_globals.jobmutex); - -// ap_child_exit_modules(pconf, server_conf); - ap_destroy_pool(pchild); - -// cleanup_scoreboard(); - -// APD2("process PID %d exited", my_pid); -// clean_parent_exit(0); -} /* standalone_main */ - -/* - * Spawn a child Apache process. The child process has the command line arguments from - * argc and argv[], plus a -Z argument giving the name of an event. The child should - * open and poll or wait on this event. When it is signalled, the child should die. - * prefix is a prefix string for the event name. - * - * The child_num argument on entry contains a serial number for this child (used to create - * a unique event name). On exit, this number will have been incremented by one, ready - * for the next call. - * - * On exit, the value pointed to be *ev will contain the event created - * to signal the new child process. - * - * The return value is the handle to the child process if successful, else -1. If -1 is - * returned the error will already have been logged by ap_log_error(). - */ - -/********************************************************************** - * master_main - this is the parent (main) process. We create a - * child process to do the work, then sit around waiting for either - * the child to exit, or a restart or exit signal. If the child dies, - * we just respawn a new one. If we have a shutdown or graceful restart, - * tell the child to die when it is ready. If it is a non-graceful - * restart, force the child to die immediately. - **********************************************************************/ - -#define MAX_PROCESSES 50 /* must be < MAX_WAIT_OBJECTS-1 */ - -static void cleanup_process(HANDLE *handles, HANDLE *events, int position, int *processes) -{ - int i; - int handle = 0; - - CloseHandle(handles[position]); - CloseHandle(events[position]); - - handle = (int)handles[position]; - - for (i = position; i < (*processes)-1; i++) { - handles[i] = handles[i + 1]; - events[i] = events[i + 1]; - } - (*processes)--; - -// APD4("cleanup_processes: removed child in slot %d handle %d, max=%d", position, handle, *processes); -} - -static int create_process(pool *p, HANDLE *handles, HANDLE *events, - int *processes, int *child_num, char *kill_event_name) -{ - - int rv, i; - HANDLE kill_event; - char buf[1024]; - char exit_event_name[40]; /* apPID_C# */ - char *pCommand; - char *pEnvBlock; - - STARTUPINFO si; /* Filled in prior to call to CreateProcess */ - PROCESS_INFORMATION pi; /* filled in on call to CreateProces */ - LPWSAPROTOCOL_INFO lpWSAProtocolInfo; - ap_listen_rec *lr; - DWORD BytesWritten; - HANDLE hPipeRead = NULL; - HANDLE hPipeWrite = NULL; - SECURITY_ATTRIBUTES sa = {0}; - - sa.nLength = sizeof(sa); - sa.bInheritHandle = TRUE; - sa.lpSecurityDescriptor = NULL; - - /* Build the command line. Should look something like this: - * C:/apache/bin/apache.exe -f ap_server_confname - * First, get the path to the executable... - */ - rv = GetModuleFileName(NULL, buf, sizeof(buf)); - if (rv == sizeof(buf)) { - ap_log_error(APLOG_MARK, APLOG_WIN32ERROR | APLOG_CRIT, server_conf, - "Parent: Path to Apache process too long"); - return -1; - } else if (rv == 0) { - ap_log_error(APLOG_MARK, APLOG_WIN32ERROR | APLOG_CRIT, server_conf, - "Parent: GetModuleFileName() returned NULL for current process."); - return -1; - } - - /* Create the exit event (apPID_C#). Parent signals this event to tell the - * child to exit - */ - ap_snprintf(exit_event_name, sizeof(exit_event_name), "%s_C%d", kill_event_name, ++(*child_num)); - kill_event = CreateEvent(NULL, TRUE, FALSE, exit_event_name); - if (!kill_event) { - ap_log_error(APLOG_MARK, APLOG_WIN32ERROR | APLOG_CRIT, server_conf, - "Parent: Could not create exit event for child process"); - return -1; - } - -// pCommand = ap_psprintf(p, "\"%s\" -f \"%s\"", buf, ap_server_confname); - pCommand = ap_psprintf(p, "\"%s\" -f \"%s\"", buf, SERVER_CONFIG_FILE); - - /* Create a pipe to send socket info to the child */ - if (!CreatePipe(&hPipeRead, &hPipeWrite, &sa, 0)) { - ap_log_error(APLOG_MARK, APLOG_WIN32ERROR | APLOG_CRIT, server_conf, - "Parent: Unable to create pipe to child process.\n"); - return -1; - } - - pEnvBlock = ap_psprintf(p, "AP_PARENT_PID=%d\0AP_CHILD_NUM=%d\0\0",parent_pid,*child_num); - - /* Give the read in of the pipe (hPipeRead) to the child as stdin. The - * parent will write the socket data to the child on this pipe. - */ - memset(&si, 0, sizeof(si)); - memset(&pi, 0, sizeof(pi)); - si.cb = sizeof(si); - si.dwFlags = STARTF_USESHOWWINDOW | STARTF_USESTDHANDLES; - si.wShowWindow = SW_HIDE; - si.hStdInput = hPipeRead; - - if (!CreateProcess(NULL, pCommand, NULL, NULL, - TRUE, /* Inherit handles */ - 0, /* Creation flags */ - pEnvBlock, /* Environment block */ - NULL, - &si, &pi)) { - ap_log_error(APLOG_MARK, APLOG_WIN32ERROR | APLOG_CRIT, server_conf, - "Parent: Not able to create the child process."); - /* - * We must close the handles to the new process and its main thread - * to prevent handle and memory leaks. - */ - CloseHandle(pi.hProcess); - CloseHandle(pi.hThread); - - return -1; - } - else { - ap_log_error(APLOG_MARK, APLOG_NOERRNO | APLOG_INFO, server_conf, - "Parent: Created child process %d", pi.dwProcessId); - - /* Assume the child process lives. Update the process and event tables */ - handles[*processes] = pi.hProcess; - events[*processes] = kill_event; - (*processes)++; - - /* We never store the thread's handle, so close it now. */ - CloseHandle(pi.hThread); - - /* Run the chain of open sockets. For each socket, duplicate it - * for the target process then send the WSAPROTOCOL_INFO - * (returned by dup socket) to the child */ - lr = ap_listeners; - while (lr != NULL) { - lpWSAProtocolInfo = ap_pcalloc(p, sizeof(WSAPROTOCOL_INFO)); - ap_log_error(APLOG_MARK, APLOG_NOERRNO | APLOG_INFO, server_conf, - "Parent: Duplicating socket %d and sending it to child process %d", lr->fd, pi.dwProcessId); - if (WSADuplicateSocket(lr->fd, - pi.dwProcessId, - lpWSAProtocolInfo) == SOCKET_ERROR) { - ap_log_error(APLOG_MARK, APLOG_WIN32ERROR | APLOG_CRIT, server_conf, - "Parent: WSADuplicateSocket failed for socket %d.", lr->fd ); - return -1; - } - - if (!WriteFile(hPipeWrite, lpWSAProtocolInfo, (DWORD) sizeof(WSAPROTOCOL_INFO), - &BytesWritten, - (LPOVERLAPPED) NULL)) { - ap_log_error(APLOG_MARK, APLOG_WIN32ERROR | APLOG_CRIT, server_conf, - "Parent: Unable to write duplicated socket %d to the child.", lr->fd ); - return -1; - } - - lr = lr->next; - if (lr == ap_listeners) - break; - } - } - CloseHandle(hPipeRead); - CloseHandle(hPipeWrite); - - return 0; -} - -/* To share the semaphores with other processes, we need a NULL ACL - * Code from MS KB Q106387 - */ - -static PSECURITY_ATTRIBUTES GetNullACL() -{ - PSECURITY_DESCRIPTOR pSD; - PSECURITY_ATTRIBUTES sa; - - sa = (PSECURITY_ATTRIBUTES) LocalAlloc(LPTR, sizeof(SECURITY_ATTRIBUTES)); - pSD = (PSECURITY_DESCRIPTOR) LocalAlloc(LPTR, - SECURITY_DESCRIPTOR_MIN_LENGTH); - if (pSD == NULL || sa == NULL) { - return NULL; - } - if (!InitializeSecurityDescriptor(pSD, SECURITY_DESCRIPTOR_REVISION) - || GetLastError()) { - LocalFree( pSD ); - LocalFree( sa ); - return NULL; - } - if (!SetSecurityDescriptorDacl(pSD, TRUE, (PACL) NULL, FALSE) - || GetLastError()) { - LocalFree( pSD ); - LocalFree( sa ); - return NULL; - } - sa->nLength = sizeof(sa); - sa->lpSecurityDescriptor = pSD; - sa->bInheritHandle = TRUE; - return sa; -} - - -static void CleanNullACL( void *sa ) { - if( sa ) { - LocalFree( ((PSECURITY_ATTRIBUTES)sa)->lpSecurityDescriptor); - LocalFree( sa ); - } -} - -static int master_main(server_rec *s, HANDLE shutdown_event, HANDLE restart_event) -{ - int remaining_children_to_start; - - int child_num = 0; - int rv, cld; - HANDLE process_handles[MAX_PROCESSES]; - HANDLE process_kill_events[MAX_PROCESSES]; - int current_live_processes = 0; /* number of child process we know about */ - int processes_to_create = 0; /* number of child processes to create */ - pool *pparent = NULL; /* pool for the parent process. Cleaned on each restart */ - - restart_pending = shutdown_pending = 0; - - remaining_children_to_start = ap_daemons_to_start; - - /* Create child process - * Should only be one in this version of Apache for WIN32 - */ - while (remaining_children_to_start--) { - if (create_process(pconf, process_handles, process_kill_events, - ¤t_live_processes, &child_num, signal_prefix_string) < 0) { - ap_log_error(APLOG_MARK, APLOG_ERR, server_conf, - "master_main: create child process failed. Exiting."); - shutdown_pending = 1; - goto die_now; - } - } - - /* service_set_status(SERVICE_RUNNING);*/ - restart_pending = shutdown_pending = 0; - - /* Wait for shutdown or restart events or for child death */ - process_handles[current_live_processes] = shutdown_event; - process_handles[current_live_processes+1] = restart_event; - rv = WaitForMultipleObjects(current_live_processes+2, (HANDLE *)process_handles, - FALSE, INFINITE); - if (rv == WAIT_FAILED) { - /* Something serious is wrong */ - ap_log_error(APLOG_MARK,APLOG_CRIT|APLOG_WIN32ERROR, server_conf, - "master_main: : WaitForMultipeObjects on process handles and apache-signal -- doing shutdown"); - shutdown_pending = 1; - break; - } - if (rv == WAIT_TIMEOUT) { - /* Hey, this cannot happen */ - ap_log_error(APLOG_MARK, APLOG_ERR, s, - "master_main: WaitForMultipeObjects with INFINITE wait exited with WAIT_TIMEOUT"); - shutdown_pending = 1; - } - - cld = rv - WAIT_OBJECT_0; -// APD4("main process: wait finished, cld=%d handle %d (max=%d)", cld, process_handles[cld], current_live_processes); - if (cld == current_live_processes) { - /* shutdown_event signalled */ - shutdown_pending = 1; - ap_log_error(APLOG_MARK, APLOG_NOERRNO|APLOG_INFO, s, - "master_main: Shutdown event signaled. Shutting the server down."); - if (ResetEvent(shutdown_event) == 0) { - ap_log_error(APLOG_MARK, APLOG_ERR|APLOG_WIN32ERROR, s, - "ResetEvent(shutdown_event)"); - } - /* Signal each child processes to die */ - for (i = 0; i < current_live_processes; i++) { -// APD3("master_main: signalling child %d, handle %d to die", i, process_handles[i]); - if (SetEvent(process_kill_events[i]) == 0) - ap_log_error(APLOG_MARK,APLOG_ERR|APLOG_WIN32ERROR, server_conf, - "master_main: SetEvent for child process in slot #%d failed", i); - } - break; - } else if (cld == current_live_processes+1) { - /* restart_event signalled */ - int children_to_kill = current_live_processes; - restart_pending = 1; - ap_log_error(APLOG_MARK, APLOG_NOERRNO|APLOG_INFO, s, - "master_main: Restart event signaled. Doing a graceful restart."); - if (ResetEvent(restart_event) == 0) { - ap_log_error(APLOG_MARK, APLOG_ERR|APLOG_WIN32ERROR, s, - "master_main: ResetEvent(restart_event) failed."); - } - /* Signal each child process to die */ - for (i = 0; i < children_to_kill; i++) { -// APD3("master_main: signalling child #%d handle %d to die", i, process_handles[i]); - if (SetEvent(process_kill_events[i]) == 0) - ap_log_error(APLOG_MARK, APLOG_ERR|APLOG_WIN32ERROR, s, - "master_main: SetEvent for child process in slot #%d failed", i); - /* Remove the process (and event) from the process table */ - cleanup_process(process_handles, process_kill_events, i, ¤t_live_processes); - } - processes_to_create = ap_daemons_to_start; - } else { - /* A child process must have exited because of MaxRequestPerChild being hit - * or a fatal error condition (seg fault, etc.). Remove the dead process - * from the process_handles and process_kill_events table and create a new - * child process. - * TODO: Consider restarting the child immediately without looping through http_main - * This will become necesasary if we ever support multiple children. - * One option, create a parent thread which waits on child death and restarts it. - */ - ap_log_error(APLOG_MARK, APLOG_NOERRNO|APLOG_INFO, server_conf, - "master_main: Child processed exited (due to MaxRequestsPerChild?). Restarting the child process."); - ap_assert(cld < current_live_processes); - cleanup_process(process_handles, process_kill_events, cld, ¤t_live_processes); -// APD2("main_process: child in slot %d died", rv); - remaining_children_to_start = 1; - continue; - } - - /* If we dropped out of the loop we definitly want to die completely. We need to - * make sure we wait for all the child process to exit first. - */ -die_now: - if (shutdown_pending) { - tmstart = time(NULL); - while (current_live_processes && ((tmstart+60) > time(NULL))) { - rv = WaitForMultipleObjects(current_live_processes, (HANDLE *)process_handles, FALSE, 2000); - if (rv == WAIT_TIMEOUT) - continue; - ap_assert(rv != WAIT_FAILED); - cld = rv - WAIT_OBJECT_0; - ap_assert(rv < current_live_processes); -// APD4("main_process: child in #%d handle %d died, left=%d", -// rv, process_handles[rv], current_live_processes); - cleanup_process(process_handles, process_kill_events, cld, ¤t_live_processes); - } - for (i = 0; i < current_live_processes; i++) { - ap_log_error(APLOG_MARK,APLOG_ERR|APLOG_NOERRNO, server_conf, - "forcing termination of child #%d (handle %d)", i, process_handles[i]); - TerminateProcess((HANDLE) process_handles[i], 1); - } - - } - - CloseHandle(restart_event); - CloseHandle(shutdown_event); - - if (pparent) { - ap_destroy_pool(pparent); - } - - return (0); -} - -/* - * winnt_pre_config() - * Gets called twice at startup. - */ -static void winnt_pre_config(pool *pconf, pool *plog, pool *ptemp) -{ - char *pid; - one_process = !!getenv("ONE_PROCESS"); - - /* Track parent/child pids... */ - pid = getenv("AP_PARENT_PID"); - if (pid) { - /* AP_PARENT_PID is only valid in the child */ - parent_pid = atoi(pid); - my_pid = getpid(); - } - else { - /* This is the parent... */ - parent_pid = my_pid = getpid(); - ap_log_pid(pconf, mpm_pid_fname); - } - - ap_listen_pre_config(); - ap_daemons_to_start = DEFAULT_NUM_DAEMON - ap_threads_per_child = DEFAULT_START_THREAD; - mpm_pid_fname = DEFAULT_PIDLOG; - max_requests_per_child = DEFAULT_MAX_REQUESTS_PER_CHILD; - - ap_cpystrn(ap_coredump_dir, ap_server_root, sizeof(ap_coredump_dir)); -} - -/* -Need to register this hook if we want it... -*/ -static void winnt_post_config(pool *pconf, pool *plog, pool *ptemp, server_rec* server_conf) -{ - server_conf = server_conf; -} - -API_EXPORT(int) ap_mpm_run(pool *_pconf, pool *plog, server_rec *s ) -{ - - int child_num; - char* exit_event_name; - -// char signal_prefix_string[100]; - int i; - time_t tmstart; - HANDLE shutdown_event; /* used to signal shutdown to parent */ - HANDLE restart_event; /* used to signal a restart to parent */ - - pconf = _pconf; - server_conf = s; - - if ((parent_pid != my_pid) || one_process) { - /* Child process */ - child_num = atoi(getenv("AP_CHILD_NUM")); - exit_event_name = ap_psprintf(pconf, "ap_%d_C%d", parent_pid, child_num); - exit_event = open_event(exit_event_name); - setup_signal_names(ap_psprintf(pconf,"ap_%d", parent_pid)); - start_mutex = ap_open_mutex(signal_name_prefix); - ap_assert(start_mutex); - - worker_main(); - - - destroy_event(exit_event); - } - else { - /* Parent process */ - static int restart = 0; - PSECURITY_ATTRIBUTES sa = GetNullACL(); /* returns NULL if invalid (Win95?) */ - ap_clear_pool(plog); - ap_open_logs(server_conf, plog); - - if (!restart) { - /* service_set_status(SERVICE_START_PENDING);*/ - - setup_signal_names(ap_psprintf(pconf,"ap_%d", parent_pid)); - - /* Create shutdown event, apPID_shutdown, where PID is the parent - * Apache process ID. Shutdown is signaled by 'apache -k shutdown'. - */ - shutdown_event = CreateEvent(sa, TRUE, FALSE, signal_shutdown_name); - if (!shutdown_event) { - ap_log_error(APLOG_MARK, APLOG_EMERG|APLOG_WIN32ERROR, s, - "master_main: Cannot create shutdown event %s", signal_shutdown_name); - CleanNullACL((void *)sa); - exit(1); - } - - /* Create restart event, apPID_restart, where PID is the parent - * Apache process ID. Restart is signaled by 'apache -k restart'. - */ - restart_event = CreateEvent(sa, TRUE, FALSE, signal_restart_name); - if (!restart_event) { - CloseHandle(shutdown_event); - ap_log_error(APLOG_MARK, APLOG_EMERG|APLOG_WIN32ERROR, s, - "master_main: Cannot create restart event %s", signal_restart_name); - CleanNullACL((void *)sa); - exit(1); - } - CleanNullACL((void *)sa); - - /* Create the start mutex, apPID, where PID is the parent Apache process ID. - * Ths start mutex is used during a restart to prevent more than one - * child process from entering the accept loop at once. - */ - start_mutex = ap_create_mutex(signal_prefix_string); - /* TOTD: Add some code to detect failure */ - } - - /* Go to work... */ - restart = master_main(server_conf, shutdown_event, restart_event); - - if (!restart) { - const char *pidfile = NULL; - /* Shutting down. Clean up... */ - pidfile = ap_server_root_relative (pconf, mpm_pid_fname); - if ( pidfile != NULL && unlink(pidfile) == 0) - ap_log_error(APLOG_MARK, APLOG_NOERRNO|APLOG_INFO, - server_conf, - "removed PID file %s (pid=%ld)", - pidfile, (long)getpid()); - ap_destroy_mutex(start_mutex); - - /* service_set_status(SERVICE_STOPPED); */ - } - - return !restart; -} - -static void winnt_hooks(void) -{ -// INIT_SIGLIST() - one_process = 0; - /* Configuration hooks implemented by http_config.c ... */ - ap_hook_pre_config(winnt_pre_config, NULL, NULL, HOOK_MIDDLE); - /* - ap_hook_post_config()...); - ap_hook_open_logs(xxx,NULL,NULL,HOOK_MIDDLE); - */ - -/* - ap_hook_translate_name(xxx,NULL,NULL,HOOK_REALLY_LAST); - ap_hook_process_connection(xxx,NULL,NULL, - HOOK_REALLY_LAST); - ap_hook_http_method(xxx,NULL,NULL,HOOK_REALLY_LAST); - ap_hook_default_port(xxx,NULL,NULL,HOOK_REALLY_LAST); - - /* FIXME: I suspect we can eliminate the need for these - Ben */ - ap_hook_type_checker(xxx,NULL,NULL,HOOK_REALLY_LAST); -*/ -} - - -/* - * Command processors - */ -static const char *set_pidfile(cmd_parms *cmd, void *dummy, char *arg) -{ - const char *err = ap_check_cmd_context(cmd, GLOBAL_ONLY); - if (err != NULL) { - return err; - } - - if (cmd->server->is_virtual) { - return "PidFile directive not allowed in "; - } - mpm_pid_fname = arg; - return NULL; -} - -static const char *set_threads_per_child (cmd_parms *cmd, void *dummy, char *arg) -{ - const char *err = ap_check_cmd_context(cmd, GLOBAL_ONLY); - if (err != NULL) { - return err; - } - - ap_threads_per_child = atoi(arg); - if (ap_threads_per_child > HARD_THREAD_LIMIT) { - fprintf(stderr, "WARNING: ThreadsPerChild of %d exceeds compile time" - "limit of %d threads,\n", ap_threads_per_child, - HARD_THREAD_LIMIT); - fprintf(stderr, " lowering ThreadsPerChild to %d. To increase, please" - "see the\n", HARD_THREAD_LIMIT); - fprintf(stderr, " HARD_THREAD_LIMIT define in src/include/httpd.h.\n"); - } - else if (ap_threads_per_child < 1) { - fprintf(stderr, "WARNING: Require ThreadsPerChild > 0, setting to 1\n"); - ap_threads_per_child = 1; - } - return NULL; -} - - -static const char *set_max_requests(cmd_parms *cmd, void *dummy, char *arg) -{ - const char *err = ap_check_cmd_context(cmd, GLOBAL_ONLY); - if (err != NULL) { - return err; - } - - max_requests_per_child = atoi(arg); - - return NULL; -} - -static const char *set_coredumpdir (cmd_parms *cmd, void *dummy, char *arg) -{ - struct stat finfo; - const char *fname; - const char *err = ap_check_cmd_context(cmd, GLOBAL_ONLY); - if (err != NULL) { - return err; - } - - fname = ap_server_root_relative(cmd->pool, arg); - /* ZZZ change this to the AP func FileInfo*/ - if ((stat(fname, &finfo) == -1) || !S_ISDIR(finfo.st_mode)) { - return ap_pstrcat(cmd->pool, "CoreDumpDirectory ", fname, - " does not exist or is not a directory", NULL); - } - ap_cpystrn(ap_coredump_dir, fname, sizeof(ap_coredump_dir)); - return NULL; -} - -static const command_rec winnt_cmds[] = { -LISTEN_COMMANDS -{ "PidFile", set_pidfile, NULL, RSRC_CONF, TAKE1, - "A file for logging the server process ID"}, -//{ "ScoreBoardFile", set_scoreboard, NULL, RSRC_CONF, TAKE1, -// "A file for Apache to maintain runtime process management information"}, -{ "ThreadsPerChild", set_threads_per_child, NULL, RSRC_CONF, TAKE1, - "Number of threads each child creates" }, -{ "MaxRequestsPerChild", set_max_requests, NULL, RSRC_CONF, TAKE1, - "Maximum number of requests a particular child serves before dying." }, -{ "CoreDumpDirectory", set_coredumpdir, NULL, RSRC_CONF, TAKE1, - "The location of the directory Apache changes to before dumping core" }, -{ NULL } -}; - -module MODULE_VAR_EXPORT mpm_winnt_module = { - STANDARD20_MODULE_STUFF, - NULL, /* child_init */ - NULL, /* create per-directory config structure */ - NULL, /* merge per-directory config structures */ - NULL, /* create per-server config structure */ - NULL, /* merge per-server config structures */ - winnt_cmds, /* command table */ - NULL, /* handlers */ - NULL, /* check auth */ - NULL, /* check access */ - winnt_hooks /* register_hooks */ -}; - -/* force Expat to be linked into the server executable */ -#if defined(USE_EXPAT) && !defined(SHARED_CORE_BOOTSTRAP) -#include "xmlparse.h" -const XML_LChar *suck_in_expat(void); -const XML_LChar *suck_in_expat(void) -{ - return XML_ErrorString(XML_ERROR_NONE); -} -#endif /* USE_EXPAT */ diff --git a/server/mpm/winnt/mpm_winnt.h b/server/mpm/winnt/mpm_winnt.h deleted file mode 100644 index 1d987d71bb13d67a805c2d44555facf385059118..0000000000000000000000000000000000000000 --- a/server/mpm/winnt/mpm_winnt.h +++ /dev/null @@ -1,67 +0,0 @@ -/* ==================================================================== - * Copyright (c) 1995-1999 The Apache Group. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in - * the documentation and/or other materials provided with the - * distribution. - * - * 3. All advertising materials mentioning features or use of this - * software must display the following acknowledgment: - * "This product includes software developed by the Apache Group - * for use in the Apache HTTP server project (http://www.apache.org/)." - * - * 4. The names "Apache Server" and "Apache Group" must not be used to - * endorse or promote products derived from this software without - * prior written permission. For written permission, please contact - * apache@apache.org. - * - * 5. Products derived from this software may not be called "Apache" - * nor may "Apache" appear in their names without prior written - * permission of the Apache Group. - * - * 6. Redistributions of any form whatsoever must retain the following - * acknowledgment: - * "This product includes software developed by the Apache Group - * for use in the Apache HTTP server project (http://www.apache.org/)." - * - * THIS SOFTWARE IS PROVIDED BY THE APACHE GROUP ``AS IS'' AND ANY - * EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR - * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE APACHE GROUP OR - * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT - * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, - * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED - * OF THE POSSIBILITY OF SUCH DAMAGE. - * ==================================================================== - * - * This software consists of voluntary contributions made by many - * individuals on behalf of the Apache Group and was originally based - * on public domain software written at the National Center for - * Supercomputing Applications, University of Illinois, Urbana-Champaign. - * For more information on the Apache Group and the Apache HTTP server - * project, please see . - * - */ - -#ifndef APACHE_MPM_WINNT_H -#define APACHE_MPM_WINNT_H - -extern int ap_threads_per_child; -extern int ap_max_requests_per_child; -extern void clean_child_exit(int); -extern int ap_extended_status; -extern void clean_child_exit(int); - -#endif /* APACHE_MPM_WINNT_H */ diff --git a/server/mpm/winnt/nt_eventlog.c b/server/mpm/winnt/nt_eventlog.c deleted file mode 100644 index 962ebc77a4ba655b4b16a229eb421cfe57b5d357..0000000000000000000000000000000000000000 --- a/server/mpm/winnt/nt_eventlog.c +++ /dev/null @@ -1,225 +0,0 @@ -/* ==================================================================== - * The Apache Software License, Version 1.1 - * - * Copyright (c) 2000-2002 The Apache Software Foundation. All rights - * reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in - * the documentation and/or other materials provided with the - * distribution. - * - * 3. The end-user documentation included with the redistribution, - * if any, must include the following acknowledgment: - * "This product includes software developed by the - * Apache Software Foundation (http://www.apache.org/)." - * Alternately, this acknowledgment may appear in the software itself, - * if and wherever such third-party acknowledgments normally appear. - * - * 4. The names "Apache" and "Apache Software Foundation" must - * not be used to endorse or promote products derived from this - * software without prior written permission. For written - * permission, please contact apache@apache.org. - * - * 5. Products derived from this software may not be called "Apache", - * nor may "Apache" appear in their name, without prior written - * permission of the Apache Software Foundation. - * - * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED - * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES - * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR - * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF - * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND - * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, - * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT - * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * ==================================================================== - * - * This software consists of voluntary contributions made by many - * individuals on behalf of the Apache Software Foundation. For more - * information on the Apache Software Foundation, please see - * . - * - * Portions of this software are based upon public domain software - * originally written at the National Center for Supercomputing Applications, - * University of Illinois, Urbana-Champaign. - */ - -#define CORE_PRIVATE - -#include "httpd.h" -#include "http_log.h" -#include "mpm_winnt.h" -#include "apr_strings.h" -#include "apr_lib.h" - -#include "apr_dbg_win32_handles.h" - - -static char *display_name = NULL; -static HANDLE stderr_thread = NULL; -static HANDLE stderr_ready; - -static DWORD WINAPI service_stderr_thread(LPVOID hPipe) -{ - HANDLE hPipeRead = (HANDLE) hPipe; - HANDLE hEventSource; - char errbuf[256]; - char *errmsg = errbuf; - const char *errarg[9]; - DWORD errres; - HKEY hk; - - errarg[0] = "The Apache service named"; - errarg[1] = display_name; - errarg[2] = "reported the following error:\r\n>>>"; - errarg[3] = errbuf; - errarg[4] = NULL; - errarg[5] = NULL; - errarg[6] = NULL; - errarg[7] = NULL; - errarg[8] = NULL; - - /* What are we going to do in here, bail on the user? not. */ - if (!RegCreateKey(HKEY_LOCAL_MACHINE, "SYSTEM\\CurrentControlSet\\Services" - "\\EventLog\\Application\\Apache Service", &hk)) - { - /* The stock message file */ - char *netmsgkey = "%SystemRoot%\\System32\\netmsg.dll"; - DWORD dwData = EVENTLOG_ERROR_TYPE | EVENTLOG_WARNING_TYPE | - EVENTLOG_INFORMATION_TYPE; - - RegSetValueEx(hk, "EventMessageFile", 0, REG_EXPAND_SZ, - (LPBYTE) netmsgkey, strlen(netmsgkey) + 1); - - RegSetValueEx(hk, "TypesSupported", 0, REG_DWORD, - (LPBYTE) &dwData, sizeof(dwData)); - RegCloseKey(hk); - } - - hEventSource = RegisterEventSource(NULL, "Apache Service"); - - SetEvent(stderr_ready); - - while (ReadFile(hPipeRead, errmsg, 1, &errres, NULL) && (errres == 1)) - { - if ((errmsg > errbuf) || !isspace(*errmsg)) - { - ++errmsg; - if ((*(errmsg - 1) == '\n') - || (errmsg >= errbuf + sizeof(errbuf) - 1)) - { - while ((errmsg > errbuf) && isspace(*(errmsg - 1))) { - --errmsg; - } - *errmsg = '\0'; - - /* Generic message: '%1 %2 %3 %4 %5 %6 %7 %8 %9' - * The event code in netmsg.dll is 3299 - */ - ReportEvent(hEventSource, EVENTLOG_ERROR_TYPE, 0, - 3299, NULL, 9, 0, errarg, NULL); - errmsg = errbuf; - } - } - } - - if ((errres = GetLastError()) != ERROR_BROKEN_PIPE) { - apr_snprintf(errbuf, sizeof(errbuf), - "Win32 error %d reading stderr pipe stream\r\n", - GetLastError()); - - ReportEvent(hEventSource, EVENTLOG_ERROR_TYPE, 0, - 3299, NULL, 9, 0, errarg, NULL); - } - - CloseHandle(hPipeRead); - DeregisterEventSource(hEventSource); - CloseHandle(stderr_thread); - stderr_thread = NULL; - return 0; -} - - -void mpm_nt_eventlog_stderr_flush(void) -{ - HANDLE cleanup_thread = stderr_thread; - - if (cleanup_thread) { - HANDLE hErr = GetStdHandle(STD_ERROR_HANDLE); - fclose(stderr); - CloseHandle(hErr); - WaitForSingleObject(cleanup_thread, 30000); - CloseHandle(cleanup_thread); - } -} - - -void mpm_nt_eventlog_stderr_open(char *argv0, apr_pool_t *p) -{ - SECURITY_ATTRIBUTES sa; - HANDLE hProc = GetCurrentProcess(); - HANDLE hPipeRead = NULL; - HANDLE hPipeWrite = NULL; - HANDLE hDup = NULL; - DWORD threadid; - int fd; - - display_name = argv0; - - /* Create a pipe to send stderr messages to the system error log. - * - * _dup2() duplicates the write handle inheritable for us. - */ - sa.nLength = sizeof(sa); - sa.lpSecurityDescriptor = NULL; - sa.bInheritHandle = FALSE; - CreatePipe(&hPipeRead, &hPipeWrite, NULL, 0); - ap_assert(hPipeRead && hPipeWrite); - - stderr_ready = CreateEvent(NULL, FALSE, FALSE, NULL); - stderr_thread = CreateThread(NULL, 0, service_stderr_thread, - (LPVOID) hPipeRead, 0, &threadid); - ap_assert(stderr_ready && stderr_thread); - - WaitForSingleObject(stderr_ready, INFINITE); - - /* Flush stderr and unset its buffer, then commit and replace stderr. - * This is typically a noop for Win2K/XP since services with NULL std - * handles [but valid FILE *'s, oddly enough], but is required - * for NT 4.0 and to use this code outside of services. - */ - fflush(stderr); - setvbuf(stderr, NULL, _IONBF, 0); - _commit(2 /* stderr */); - fd = _open_osfhandle((long) hPipeWrite, - _O_WRONLY | _O_BINARY); - _dup2(fd, 2); - _close(fd); - _setmode(2, _O_BINARY); - - /* hPipeWrite was _close()'ed above, and _dup2()'ed - * to fd 2 creating a new, inherited Win32 handle. - * Recover that real handle from fd 2. - */ - hPipeWrite = (HANDLE)_get_osfhandle(2); - - SetStdHandle(STD_ERROR_HANDLE, hPipeWrite); - - /* The code above _will_ corrupt the StdHandle... - * and we must do so anyways. We set this up only - * after we initialized the posix stderr API. - */ - ap_open_stderr_log(p); -} diff --git a/server/mpm/winnt/service.c b/server/mpm/winnt/service.c deleted file mode 100644 index 8108ae1ad9347cc384df8ee87dc9dfdc6b074e2f..0000000000000000000000000000000000000000 --- a/server/mpm/winnt/service.c +++ /dev/null @@ -1,431 +0,0 @@ -#ifdef WIN32 - -#include -#include -#include -#include -#include - -#include "httpd.h" -#include "http_conf_globals.h" -#include "http_log.h" -#include "http_main.h" -#include "multithread.h" -#include "service.h" -#include "registry.h" - -static struct -{ - int (*main_fn)(int, char **); - event *stop_event; - int connected; - SERVICE_STATUS_HANDLE hServiceStatus; - char *name; - int exit_status; - SERVICE_STATUS ssStatus; - FILE *logFile; -} globdat; - -static void WINAPI service_main_fn(DWORD, LPTSTR *); -static void WINAPI service_ctrl(DWORD ctrlCode); -static int ReportStatusToSCMgr(int currentState, int exitCode, int waitHint); -static int ap_start_service(SC_HANDLE); -static int ap_stop_service(SC_HANDLE); - -int service_main(int (*main_fn)(int, char **), int argc, char **argv ) -{ - SERVICE_TABLE_ENTRY dispatchTable[] = - { - { "", service_main_fn }, - { NULL, NULL } - }; - - globdat.main_fn = main_fn; - globdat.stop_event = create_event(0, 0, "apache-signal"); - globdat.connected = 1; - - if(!StartServiceCtrlDispatcher(dispatchTable)) - { - /* This is a genuine failure of the SCM. */ - ap_log_error(APLOG_MARK, APLOG_ERR|APLOG_WIN32ERROR, NULL, - "Error starting service control dispatcher"); - return(globdat.exit_status); - } - else - { - return(globdat.exit_status); - } -} - -void service_cd() -{ - /* change to the drive with the executable */ - char buf[300]; - GetModuleFileName(NULL, buf, 300); - buf[2] = 0; - chdir(buf); -} - -void __stdcall service_main_fn(DWORD argc, LPTSTR *argv) -{ - ap_server_argv0 = globdat.name = argv[0]; - - if(!(globdat.hServiceStatus = RegisterServiceCtrlHandler( globdat.name, service_ctrl))) - { - ap_log_error(APLOG_MARK, APLOG_ERR|APLOG_WIN32ERROR, NULL, - "Failure registering service handler"); - return; - } - - ReportStatusToSCMgr( - SERVICE_START_PENDING, // service state - NO_ERROR, // exit code - 3000); // wait hint - - service_cd(); - if( service_init() ) - /* Arguments are ok except for \! */ - globdat.exit_status = (*globdat.main_fn)( argc, argv ); - - ReportStatusToSCMgr(SERVICE_STOPPED, NO_ERROR, 0); - - return; -} - -void service_set_status(int status) -{ - ReportStatusToSCMgr(status, NO_ERROR, 3000); -} - - - -// -// FUNCTION: service_ctrl -// -// PURPOSE: This function is called by the SCM whenever -// ControlService() is called on this service. -// -// PARAMETERS: -// dwCtrlCode - type of control requested -// -// RETURN VALUE: -// none -// -// COMMENTS: -// -VOID WINAPI service_ctrl(DWORD dwCtrlCode) -{ - int state; - - - state = globdat.ssStatus.dwCurrentState; - switch(dwCtrlCode) - { - // Stop the service. - // - case SERVICE_CONTROL_STOP: - state = SERVICE_STOP_PENDING; - ap_start_shutdown(); - break; - - // Update the service status. - // - case SERVICE_CONTROL_INTERROGATE: - break; - - // invalid control code - // - default: - break; - - } - - ReportStatusToSCMgr(state, NO_ERROR, 0); -} - - -int ReportStatusToSCMgr(int currentState, int exitCode, int waitHint) -{ - static int firstTime = 1; - static int checkPoint = 1; - int rv; - - if(firstTime) - { - firstTime = 0; - globdat.ssStatus.dwServiceType = SERVICE_WIN32_OWN_PROCESS; - globdat.ssStatus.dwServiceSpecificExitCode = 0; - globdat.ssStatus.dwCheckPoint = 1; - } - - if(globdat.connected) - { - if (currentState == SERVICE_START_PENDING) - globdat.ssStatus.dwControlsAccepted = 0; - else - globdat.ssStatus.dwControlsAccepted = SERVICE_ACCEPT_STOP; - - globdat.ssStatus.dwCurrentState = currentState; - globdat.ssStatus.dwWin32ExitCode = exitCode; - if(waitHint) - globdat.ssStatus.dwWaitHint = waitHint; - - if ( ( currentState == SERVICE_RUNNING ) || - ( currentState == SERVICE_STOPPED ) ) - { - globdat.ssStatus.dwWaitHint = 0; - globdat.ssStatus.dwCheckPoint = 0; - } - else - globdat.ssStatus.dwCheckPoint = ++checkPoint; - - rv = SetServiceStatus(globdat.hServiceStatus, &globdat.ssStatus); - - } - return(1); -} - -void InstallService(char *service_name, char *conf) -{ - SC_HANDLE schService; - SC_HANDLE schSCManager; - - TCHAR szPath[512]; - TCHAR szQuotedPath[512]; - - printf("Installing the %s service to use %s\n", service_name, conf); - - if (GetModuleFileName( NULL, szPath, 512 ) == 0) - { - ap_log_error(APLOG_MARK, APLOG_ERR|APLOG_WIN32ERROR, NULL, - "GetModuleFileName failed"); - return; - } - - ap_snprintf(szQuotedPath, 512, "\"%s\"", szPath); - - schSCManager = OpenSCManager( - NULL, // machine (NULL == local) - NULL, // database (NULL == default) - SC_MANAGER_ALL_ACCESS // access required - ); - if (!schSCManager) { - ap_log_error(APLOG_MARK, APLOG_ERR|APLOG_WIN32ERROR, NULL, - "OpenSCManager failed"); - } - else { - schService = CreateService( - schSCManager, // SCManager database - service_name, // name of service - service_name, // name to display - SERVICE_ALL_ACCESS, // desired access - SERVICE_WIN32_OWN_PROCESS, // service type - SERVICE_AUTO_START, // start type - SERVICE_ERROR_NORMAL, // error control type - szQuotedPath, // service's binary - NULL, // no load ordering group - NULL, // no tag identifier - NULL, // dependencies - NULL, // LocalSystem account - NULL); // no password - - if (schService) { - CloseServiceHandle(schService); - - /* Now store the server_root in the registry */ - if(!ap_registry_set_service_conf(conf, service_name)) - printf("The %s service has been installed successfully.\n", service_name ); - } - else { - ap_log_error(APLOG_MARK, APLOG_ERR|APLOG_WIN32ERROR, NULL, - "CreateService failed"); - } - - CloseServiceHandle(schSCManager); - } -} - - -void RemoveService(char *service_name) -{ - SC_HANDLE schService; - SC_HANDLE schSCManager; - - printf("Removing the %s service\n", service_name); - - schSCManager = OpenSCManager( - NULL, // machine (NULL == local) - NULL, // database (NULL == default) - SC_MANAGER_ALL_ACCESS // access required - ); - if (!schSCManager) { - ap_log_error(APLOG_MARK, APLOG_ERR|APLOG_WIN32ERROR, NULL, - "OpenSCManager failed"); - } - else { - schService = OpenService(schSCManager, service_name, SERVICE_ALL_ACCESS); - - if (schService == NULL) { - /* Could not open the service */ - ap_log_error(APLOG_MARK, APLOG_ERR|APLOG_WIN32ERROR, NULL, - "OpenService failed"); - } - else { - /* try to stop the service */ - ap_stop_service(schService); - - // now remove the service - if (DeleteService(schService) == 0) - ap_log_error(APLOG_MARK, APLOG_ERR|APLOG_WIN32ERROR, NULL, - "DeleteService failed"); - else - printf("The %s service has been removed successfully.\n", service_name ); - CloseServiceHandle(schService); - } - /* SCM removes registry parameters */ - CloseServiceHandle(schSCManager); - } - -} - -/* A hack to determine if we're running as a service without waiting for - * the SCM to fail; if AllocConsole succeeds, we're a service. - */ - -BOOL isProcessService() { - if( !AllocConsole() ) - return FALSE; - FreeConsole(); - return TRUE; -} - -/* Determine is service_name is a valid service - */ - -BOOL isValidService(char *service_name) { - SC_HANDLE schSCM, schSVC; - int Err; - - if (!(schSCM = OpenSCManager(NULL, NULL, SC_MANAGER_ALL_ACCESS))) { - ap_log_error(APLOG_MARK, APLOG_ERR|APLOG_WIN32ERROR, NULL, - "OpenSCManager failed"); - return FALSE; - } - - if ((schSVC = OpenService(schSCM, service_name, SERVICE_ALL_ACCESS))) { - CloseServiceHandle(schSVC); - CloseServiceHandle(schSCM); - return TRUE; - } - - Err = GetLastError(); - if (Err != ERROR_SERVICE_DOES_NOT_EXIST && Err != ERROR_INVALID_NAME) - ap_log_error(APLOG_MARK, APLOG_ERR|APLOG_WIN32ERROR, NULL, - "OpenService failed"); - - return FALSE; -} - -int send_signal_to_service(char *service_name, char *sig) { - SC_HANDLE schService; - SC_HANDLE schSCManager; - int success = FALSE; - - enum { start, restart, stop, unknown } action; - static char *param[] = { "start", "restart", "shutdown" }; - static char *participle[] = { "starting", "restarting", "stopping" }; - static char *past[] = { "started", "restarted", "stopped" }; - - for (action = start; action < unknown; action++) - if (!strcasecmp(sig, param[action])) - break; - - if (action == unknown) { - printf("signal must be start, restart, or shutdown\n"); - return FALSE; - } - - schSCManager = OpenSCManager( - NULL, // machine (NULL == local) - NULL, // database (NULL == default) - SC_MANAGER_ALL_ACCESS // access required - ); - if (!schSCManager) { - ap_log_error(APLOG_MARK, APLOG_ERR|APLOG_WIN32ERROR, NULL, - "OpenSCManager failed"); - } - else { - schService = OpenService(schSCManager, service_name, SERVICE_ALL_ACCESS); - - if (schService == NULL) { - /* Could not open the service */ - ap_log_error(APLOG_MARK, APLOG_ERR|APLOG_WIN32ERROR, NULL, - "OpenService failed"); - } - else { - if (!QueryServiceStatus(schService, &globdat.ssStatus)) - ap_log_error(APLOG_MARK, APLOG_ERR|APLOG_WIN32ERROR, NULL, - "QueryService failed"); - else { - if (globdat.ssStatus.dwCurrentState == SERVICE_STOPPED && action == stop) - printf("The %s service is not started.\n", service_name); - else if (globdat.ssStatus.dwCurrentState == SERVICE_RUNNING && action == start) - printf("The %s service has already been started.\n", service_name); - else { - printf("The %s service is %s.\n", service_name, participle[action]); - - if (action == stop || action == restart) - success = ap_stop_service(schService); - if (action == start || action == restart) - success = ap_start_service(schService); - - if( success ) - printf("The %s service has %s.\n", service_name, past[action]); - else - printf("Failed to %s the %s service.\n", sig, service_name ); - } - - CloseServiceHandle(schService); - } - } - /* SCM removes registry parameters */ - CloseServiceHandle(schSCManager); - } - return success; -} - -int ap_stop_service(SC_HANDLE schService) -{ - if (ControlService(schService, SERVICE_CONTROL_STOP, &globdat.ssStatus)) { - Sleep(1000); - while (QueryServiceStatus(schService, &globdat.ssStatus)) { - if (globdat.ssStatus.dwCurrentState == SERVICE_STOP_PENDING) - Sleep(1000); - else - break; - } - } - if (QueryServiceStatus(schService, &globdat.ssStatus)) - if (globdat.ssStatus.dwCurrentState == SERVICE_STOPPED) - return TRUE; - return FALSE; -} - -int ap_start_service(SC_HANDLE schService) { - if (StartService(schService, 0, NULL)) { - Sleep(1000); - while(QueryServiceStatus(schService, &globdat.ssStatus)) { - if(globdat.ssStatus.dwCurrentState == SERVICE_START_PENDING) - Sleep(1000); - else - break; - } - } - if (QueryServiceStatus(schService, &globdat.ssStatus)) - if (globdat.ssStatus.dwCurrentState == SERVICE_RUNNING) - return TRUE; - return FALSE; -} - -#endif /* WIN32 */ - diff --git a/server/mpm/worker/.cvsignore b/server/mpm/worker/.cvsignore deleted file mode 100644 index 84df2572148ad85b6c1c286350aa7c0b6a931e7a..0000000000000000000000000000000000000000 --- a/server/mpm/worker/.cvsignore +++ /dev/null @@ -1,5 +0,0 @@ -.deps -.libs -*.lo -*.la -Makefile diff --git a/server/mpm/worker/Makefile.in b/server/mpm/worker/Makefile.in deleted file mode 100644 index 64a02436f3c23ec424c098631a8d3ea59e0f0471..0000000000000000000000000000000000000000 --- a/server/mpm/worker/Makefile.in +++ /dev/null @@ -1,5 +0,0 @@ - -LTLIBRARY_NAME = libworker.la -LTLIBRARY_SOURCES = worker.c fdqueue.c - -include $(top_srcdir)/build/ltlib.mk diff --git a/server/mpm/worker/config5.m4 b/server/mpm/worker/config5.m4 deleted file mode 100644 index 52ab50e82ce3a9b54261e2d8a280e953396fdac0..0000000000000000000000000000000000000000 --- a/server/mpm/worker/config5.m4 +++ /dev/null @@ -1,5 +0,0 @@ -dnl ## XXX - Need a more thorough check of the proper flags to use - -if test "$MPM_NAME" = "worker" ; then - APACHE_FAST_OUTPUT(server/mpm/$MPM_NAME/Makefile) -fi diff --git a/server/mpm/worker/fdqueue.c b/server/mpm/worker/fdqueue.c deleted file mode 100644 index 147a3b7a946937eb94b9bd0e44f7e3f8806d2376..0000000000000000000000000000000000000000 --- a/server/mpm/worker/fdqueue.c +++ /dev/null @@ -1,161 +0,0 @@ -/* ==================================================================== - * The Apache Software License, Version 1.1 - * - * Copyright (c) 2000-2001 The Apache Software Foundation. All rights - * reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in - * the documentation and/or other materials provided with the - * distribution. - * - * 3. The end-user documentation included with the redistribution, - * if any, must include the following acknowledgment: - * "This product includes software developed by the - * Apache Software Foundation (http://www.apache.org/)." - * Alternately, this acknowledgment may appear in the software itself, - * if and wherever such third-party acknowledgments normally appear. - * - * 4. The names "Apache" and "Apache Software Foundation" must - * not be used to endorse or promote products derived from this - * software without prior written permission. For written - * permission, please contact apache@apache.org. - * - * 5. Products derived from this software may not be called "Apache", - * nor may "Apache" appear in their name, without prior written - * permission of the Apache Software Foundation. - * - * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED - * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES - * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR - * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF - * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND - * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, - * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT - * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * ==================================================================== - * - * This software consists of voluntary contributions made by many - * individuals on behalf of the Apache Software Foundation. For more - * information on the Apache Software Foundation, please see - * . - * - * Portions of this software are based upon public domain software - * originally written at the National Center for Supercomputing Applications, - * University of Illinois, Urbana-Champaign. - */ - -#include "fdqueue.h" -#include "apr_pools.h" - -/* Assumption: queue itself is allocated by the user */ -/* Assumption: increment and decrement are atomic on int */ - -int ap_queue_size(FDQueue *queue) { - return ((queue->tail - queue->head + queue->bounds) % queue->bounds); -} - -int ap_queue_full(FDQueue *queue) { - return(queue->blanks <= 0); -} - -int ap_block_on_queue(FDQueue *queue) { -#if 0 - if (pthread_mutex_lock(&queue->one_big_mutex) != 0) { - return FD_QUEUE_FAILURE; - } -#endif - if (ap_queue_full(queue)) { - pthread_cond_wait(&queue->not_full, &queue->one_big_mutex); - } -#if 0 - if (pthread_mutex_unlock(&queue->one_big_mutex) != 0) { - return FD_QUEUE_FAILURE; - } -#endif - return FD_QUEUE_SUCCESS; -} - -static int increase_blanks(FDQueue *queue) { - queue->blanks++; - return FD_QUEUE_SUCCESS; -} - -static apr_status_t ap_queue_destroy(void *data) { - FDQueue *queue = data; - /* Ignore errors here, we can't do anything about them anyway */ - pthread_cond_destroy(&queue->not_empty); - pthread_cond_destroy(&queue->not_full); - pthread_mutex_destroy(&queue->one_big_mutex); - return FD_QUEUE_SUCCESS; -} - -int ap_queue_init(FDQueue *queue, int queue_capacity, apr_pool_t *a) { - int i; - int bounds = queue_capacity + 1; - pthread_mutex_init(&queue->one_big_mutex, NULL); - pthread_cond_init(&queue->not_empty, NULL); - pthread_cond_init(&queue->not_full, NULL); - queue->head = queue->tail = 0; - queue->data = apr_palloc(a, bounds * sizeof(FDQueueElement)); - queue->bounds = bounds; - queue->blanks = queue_capacity; - apr_pool_cleanup_register(a, queue, ap_queue_destroy, apr_pool_cleanup_null); - for (i=0; i < bounds; ++i) - queue->data[i].sd = NULL; - return FD_QUEUE_SUCCESS; -} - -int ap_queue_push(FDQueue *queue, apr_socket_t *sd, apr_pool_t *p) { - queue->data[queue->tail].sd = sd; - queue->data[queue->tail].p = p; - queue->tail = (queue->tail + 1) % queue->bounds; - queue->blanks--; - pthread_cond_signal(&queue->not_empty); -#if 0 - if (queue->head == (queue->tail + 1) % queue->bounds) { -#endif - if (ap_queue_full(queue)) { - pthread_cond_wait(&queue->not_full, &queue->one_big_mutex); - } - return FD_QUEUE_SUCCESS; -} - -apr_status_t ap_queue_pop(FDQueue *queue, apr_socket_t **sd, apr_pool_t **p, int block_if_empty) { - increase_blanks(queue); - /* We have just removed one from the queue. By definition, it is - * no longer full. We can ALWAYS signal the listener thread at - * this point. However, the original code didn't do it this way, - * so I am leaving the original code in, just commented out. BTW, - * originally, the increase_blanks wasn't in this function either. - * - if (queue->blanks > 0) { - */ - pthread_cond_signal(&queue->not_full); - - /* } */ - if (queue->head == queue->tail) { - if (block_if_empty) { - pthread_cond_wait(&queue->not_empty, &queue->one_big_mutex); - } - } - - *sd = queue->data[queue->head].sd; - *p = queue->data[queue->head].p; - queue->data[queue->head].sd = NULL; - if (*sd != NULL) { - queue->head = (queue->head + 1) % queue->bounds; - } - return APR_SUCCESS; -} diff --git a/server/mpm/worker/fdqueue.h b/server/mpm/worker/fdqueue.h deleted file mode 100644 index b1cab2d01867538bf64b40103ead4f5c546aa305..0000000000000000000000000000000000000000 --- a/server/mpm/worker/fdqueue.h +++ /dev/null @@ -1,95 +0,0 @@ -/* ==================================================================== - * The Apache Software License, Version 1.1 - * - * Copyright (c) 2000-2001 The Apache Software Foundation. All rights - * reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in - * the documentation and/or other materials provided with the - * distribution. - * - * 3. The end-user documentation included with the redistribution, - * if any, must include the following acknowledgment: - * "This product includes software developed by the - * Apache Software Foundation (http://www.apache.org/)." - * Alternately, this acknowledgment may appear in the software itself, - * if and wherever such third-party acknowledgments normally appear. - * - * 4. The names "Apache" and "Apache Software Foundation" must - * not be used to endorse or promote products derived from this - * software without prior written permission. For written - * permission, please contact apache@apache.org. - * - * 5. Products derived from this software may not be called "Apache", - * nor may "Apache" appear in their name, without prior written - * permission of the Apache Software Foundation. - * - * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED - * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES - * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR - * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF - * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND - * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, - * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT - * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * ==================================================================== - * - * This software consists of voluntary contributions made by many - * individuals on behalf of the Apache Software Foundation. For more - * information on the Apache Software Foundation, please see - * . - * - * Portions of this software are based upon public domain software - * originally written at the National Center for Supercomputing Applications, - * University of Illinois, Urbana-Champaign. - */ - -#ifndef FDQUEUE_H -#define FDQUEUE_H -#include "httpd.h" -#include -#include -#include -#include -#include - -#define FD_QUEUE_SUCCESS 0 -#define FD_QUEUE_FAILURE -1 /* Needs to be an invalid file descriptor because - of queue_pop semantics */ - -typedef struct fd_queue_elem { - apr_socket_t *sd; - apr_pool_t *p; -} FDQueueElement; - -typedef struct fd_queue { - int head; - int tail; - FDQueueElement *data; - int bounds; - int blanks; - pthread_mutex_t one_big_mutex; - pthread_cond_t not_empty; - pthread_cond_t not_full; -} FDQueue; - -int ap_queue_init(FDQueue *queue, int queue_size, apr_pool_t *a); -int ap_queue_push(FDQueue *queue, apr_socket_t *sd, apr_pool_t *p); -apr_status_t ap_queue_pop(FDQueue *queue, apr_socket_t **sd, apr_pool_t **p, int block_if_empty); -int ap_queue_size(FDQueue *queue); -int ap_queue_full(FDQueue *queue); -int ap_block_on_queue(FDQueue *queue); - -#endif /* FDQUEUE_H */ diff --git a/server/mpm/worker/mpm.h b/server/mpm/worker/mpm.h deleted file mode 100644 index 23ed27c1ea096f2a0d55dd70513fdc4be5dbeb16..0000000000000000000000000000000000000000 --- a/server/mpm/worker/mpm.h +++ /dev/null @@ -1,78 +0,0 @@ -/* ==================================================================== - * The Apache Software License, Version 1.1 - * - * Copyright (c) 2000-2001 The Apache Software Foundation. All rights - * reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in - * the documentation and/or other materials provided with the - * distribution. - * - * 3. The end-user documentation included with the redistribution, - * if any, must include the following acknowledgment: - * "This product includes software developed by the - * Apache Software Foundation (http://www.apache.org/)." - * Alternately, this acknowledgment may appear in the software itself, - * if and wherever such third-party acknowledgments normally appear. - * - * 4. The names "Apache" and "Apache Software Foundation" must - * not be used to endorse or promote products derived from this - * software without prior written permission. For written - * permission, please contact apache@apache.org. - * - * 5. Products derived from this software may not be called "Apache", - * nor may "Apache" appear in their name, without prior written - * permission of the Apache Software Foundation. - * - * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED - * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES - * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR - * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF - * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND - * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, - * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT - * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * ==================================================================== - * - * This software consists of voluntary contributions made by many - * individuals on behalf of the Apache Software Foundation. For more - * information on the Apache Software Foundation, please see - * . - * - * Portions of this software are based upon public domain software - * originally written at the National Center for Supercomputing Applications, - * University of Illinois, Urbana-Champaign. - */ -#include "scoreboard.h" -#include "unixd.h" - -#ifndef APACHE_MPM_WORKER_H -#define APACHE_MPM_WORKER_H - -#define WORKER_MPM - -#define MPM_NAME "Worker" - -#define AP_MPM_NEEDS_RECLAIM_CHILD_PROCESSES 1 -#define MPM_SYNC_CHILD_TABLE() (ap_sync_scoreboard_image()) -#define MPM_CHILD_PID(i) (ap_scoreboard_image->parent[i].pid) -#define MPM_NOTE_CHILD_KILLED(i) (MPM_CHILD_PID(i) = 0) - -extern int ap_threads_per_child; -extern int ap_max_daemons_limit; -extern server_rec *ap_server_conf; -extern char ap_coredump_dir[MAX_STRING_LEN]; - -#endif /* APACHE_MPM_WORKER_H */ diff --git a/server/mpm/worker/mpm_default.h b/server/mpm/worker/mpm_default.h deleted file mode 100644 index 84c1304bfa83f2a2142a649795517d4694e6747a..0000000000000000000000000000000000000000 --- a/server/mpm/worker/mpm_default.h +++ /dev/null @@ -1,154 +0,0 @@ -/* ==================================================================== - * The Apache Software License, Version 1.1 - * - * Copyright (c) 2000-2001 The Apache Software Foundation. All rights - * reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in - * the documentation and/or other materials provided with the - * distribution. - * - * 3. The end-user documentation included with the redistribution, - * if any, must include the following acknowledgment: - * "This product includes software developed by the - * Apache Software Foundation (http://www.apache.org/)." - * Alternately, this acknowledgment may appear in the software itself, - * if and wherever such third-party acknowledgments normally appear. - * - * 4. The names "Apache" and "Apache Software Foundation" must - * not be used to endorse or promote products derived from this - * software without prior written permission. For written - * permission, please contact apache@apache.org. - * - * 5. Products derived from this software may not be called "Apache", - * nor may "Apache" appear in their name, without prior written - * permission of the Apache Software Foundation. - * - * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED - * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES - * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR - * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF - * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND - * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, - * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT - * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * ==================================================================== - * - * This software consists of voluntary contributions made by many - * individuals on behalf of the Apache Software Foundation. For more - * information on the Apache Software Foundation, please see - * . - * - * Portions of this software are based upon public domain software - * originally written at the National Center for Supercomputing Applications, - * University of Illinois, Urbana-Champaign. - */ - -#ifndef APACHE_MPM_DEFAULT_H -#define APACHE_MPM_DEFAULT_H - -#define AP_ID_FROM_CHILD_THREAD(c, t) ((c * HARD_THREAD_LIMIT) + t) -#define AP_CHILD_THREAD_FROM_ID(i) (i / HARD_THREAD_LIMIT), (i % HARD_THREAD_LIMIT) - -/* Number of servers to spawn off by default --- also, if fewer than - * this free when the caretaker checks, it will spawn more. - */ -#ifndef DEFAULT_START_DAEMON -#define DEFAULT_START_DAEMON 3 -#endif - -/* Maximum number of *free* server processes --- more than this, and - * they will die off. - */ - -#ifndef DEFAULT_MAX_FREE_DAEMON -#define DEFAULT_MAX_FREE_DAEMON 10 -#endif - -/* Minimum --- fewer than this, and more will be created */ - -#ifndef DEFAULT_MIN_FREE_DAEMON -#define DEFAULT_MIN_FREE_DAEMON 3 -#endif - -/* Limit on the total --- clients will be locked out if more servers than - * this are needed. It is intended solely to keep the server from crashing - * when things get out of hand. - * - * We keep a hard maximum number of servers, for two reasons --- first off, - * in case something goes seriously wrong, we want to stop the fork bomb - * short of actually crashing the machine we're running on by filling some - * kernel table. Secondly, it keeps the size of the scoreboard file small - * enough that we can read the whole thing without worrying too much about - * the overhead. - */ -#ifdef NO_THREADS -#define HARD_SERVER_LIMIT 256 -#endif -#ifndef HARD_SERVER_LIMIT -#define HARD_SERVER_LIMIT 8 -#endif - -/* Limit on the threads per process. Clients will be locked out if more than - * this * HARD_SERVER_LIMIT are needed. - * - * We keep this for one reason it keeps the size of the scoreboard file small - * enough that we can read the whole thing without worrying too much about - * the overhead. - */ -#ifdef NO_THREADS -#define HARD_THREAD_LIMIT 1 -#endif -#ifndef HARD_THREAD_LIMIT -#define HARD_THREAD_LIMIT 64 -#endif - -#ifdef NO_THREADS -#define DEFAULT_THREADS_PER_CHILD 1 -#endif -#ifndef DEFAULT_THREADS_PER_CHILD -#define DEFAULT_THREADS_PER_CHILD 25 -#endif - -/* File used for accept locking, when we use a file */ -#ifndef DEFAULT_LOCKFILE -#define DEFAULT_LOCKFILE "logs/accept.lock" -#endif - -/* Scoreboard file, if there is one */ -#ifndef DEFAULT_SCOREBOARD -#define DEFAULT_SCOREBOARD "logs/apache_runtime_status" -#endif - -/* Where the main/parent process's pid is logged */ -#ifndef DEFAULT_PIDLOG -#define DEFAULT_PIDLOG "logs/httpd.pid" -#endif - -/* - * Interval, in microseconds, between scoreboard maintenance. - */ -#ifndef SCOREBOARD_MAINTENANCE_INTERVAL -#define SCOREBOARD_MAINTENANCE_INTERVAL 1000000 -#endif - -/* Number of requests to try to handle in a single process. If <= 0, - * the children don't die off. - */ -#ifndef DEFAULT_MAX_REQUESTS_PER_CHILD -#define DEFAULT_MAX_REQUESTS_PER_CHILD 10000 -#endif - -#endif /* AP_MPM_DEFAULT_H */ diff --git a/server/mpm/worker/pod.c b/server/mpm/worker/pod.c deleted file mode 100644 index c869e43832aae3274ab093ff041b1c4bcba16719..0000000000000000000000000000000000000000 --- a/server/mpm/worker/pod.c +++ /dev/null @@ -1,234 +0,0 @@ -/* ==================================================================== - * The Apache Software License, Version 1.1 - * - * Copyright (c) 2000-2001 The Apache Software Foundation. All rights - * reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in - * the documentation and/or other materials provided with the - * distribution. - * - * 3. The end-user documentation included with the redistribution, - * if any, must include the following acknowledgment: - * "This product includes software developed by the - * Apache Software Foundation (http://www.apache.org/)." - * Alternately, this acknowledgment may appear in the software itself, - * if and wherever such third-party acknowledgments normally appear. - * - * 4. The names "Apache" and "Apache Software Foundation" must - * not be used to endorse or promote products derived from this - * software without prior written permission. For written - * permission, please contact apache@apache.org. - * - * 5. Products derived from this software may not be called "Apache", - * nor may "Apache" appear in their name, without prior written - * permission of the Apache Software Foundation. - * - * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED - * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES - * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR - * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF - * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND - * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, - * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT - * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * ==================================================================== - * - * This software consists of voluntary contributions made by many - * individuals on behalf of the Apache Software Foundation. For more - * information on the Apache Software Foundation, please see - * . - * - * Portions of this software are based upon public domain software - * originally written at the National Center for Supercomputing Applications, - * University of Illinois, Urbana-Champaign. - */ - -#include "apr.h" -#include "apr_strings.h" -#include "apr_lock.h" -#define APR_WANT_STRFUNC -#include "apr_want.h" - -#include "httpd.h" -#include "http_config.h" -#include "http_log.h" -#include "http_main.h" -#include "mpm.h" -#include "pod.h" -#include "mpm_common.h" -#include "ap_mpm.h" -#include "ap_listen.h" -#include "mpm_default.h" - -AP_DECLARE(apr_status_t) ap_mpm_pod_open(apr_pool_t *p, ap_pod_t **pod) -{ - apr_status_t rv; - - *pod = apr_palloc(p, sizeof(**pod)); - rv = apr_file_pipe_create(&((*pod)->pod_in), &((*pod)->pod_out), p); - if (rv != APR_SUCCESS) { - return rv; - } -/* - apr_file_pipe_timeout_set((*pod)->pod_in, 0); -*/ - (*pod)->p = p; - - apr_sockaddr_info_get(&(*pod)->sa, ap_listeners->bind_addr->hostname, - APR_UNSPEC, ap_listeners->bind_addr->port, 0, p); - - return APR_SUCCESS; -} - -AP_DECLARE(int) ap_mpm_pod_check(ap_pod_t *pod) -{ - char c; - apr_size_t len = 1; - apr_status_t rv; - - rv = apr_file_read(pod->pod_in, &c, &len); - - if ((rv == APR_SUCCESS) && (len ==1)) { - if (c == RESTART_CHAR) { - return AP_RESTART; - } - if (c == GRACEFUL_CHAR) { - return AP_GRACEFUL; - } - } - else if (rv != APR_SUCCESS) { - return rv; - } - return AP_NORESTART; -} - -AP_DECLARE(apr_status_t) ap_mpm_pod_close(ap_pod_t *pod) -{ - apr_status_t rv; - - rv = apr_file_close(pod->pod_out); - if (rv != APR_SUCCESS) { - return rv; - } - - rv = apr_file_close(pod->pod_in); - if (rv != APR_SUCCESS) { - return rv; - } - return rv; -} - -static apr_status_t pod_signal_internal(ap_pod_t *pod, int graceful) -{ - apr_status_t rv; - char char_of_death = graceful ? GRACEFUL_CHAR : RESTART_CHAR; - apr_size_t one = 1; - - do { - rv = apr_file_write(pod->pod_out, &char_of_death, &one); - } while (APR_STATUS_IS_EINTR(rv)); - if (rv != APR_SUCCESS) { - ap_log_error(APLOG_MARK, APLOG_WARNING, rv, ap_server_conf, - "write pipe_of_death"); - } - return rv; -} - -/* This function connects to the server, then immediately closes the connection. - * This permits the MPM to skip the poll when there is only one listening - * socket, because it provides a alternate way to unblock an accept() when - * the pod is used. - */ - -static apr_status_t dummy_connection(ap_pod_t *pod) -{ - apr_status_t rv; - apr_socket_t *sock; - apr_pool_t *p; - - /* create a temporary pool for the socket. pconf stays around too long */ - rv = apr_pool_create(&p, pod->p); - if (rv != APR_SUCCESS) { - return rv; - } - - rv = apr_socket_create(&sock, pod->sa->family, SOCK_STREAM, p); - if (rv != APR_SUCCESS) { - ap_log_error(APLOG_MARK, APLOG_WARNING, rv, ap_server_conf, - "get socket to connect to listener"); - return rv; - } - /* on some platforms (e.g., FreeBSD), the kernel won't accept many - * queued connections before it starts blocking local connects... - * we need to keep from blocking too long and instead return an error, - * because the MPM won't want to hold up a graceful restart for a - * long time - */ - rv = apr_setsocketopt(sock, APR_SO_TIMEOUT, 3 * APR_USEC_PER_SEC); - if (rv != APR_SUCCESS) { - ap_log_error(APLOG_MARK, APLOG_WARNING, rv, ap_server_conf, - "set timeout on socket to connect to listener"); - return rv; - } - - rv = apr_connect(sock, pod->sa); - if (rv != APR_SUCCESS) { - int log_level = APLOG_WARNING; - - if (APR_STATUS_IS_TIMEUP(rv)) { - /* probably some server processes bailed out already and there - * is nobody around to call accept and clear out the kernel - * connection queue; usually this is not worth logging - */ - log_level = APLOG_DEBUG; - } - - ap_log_error(APLOG_MARK, log_level, rv, ap_server_conf, - "connect to listener"); - } - - apr_socket_close(sock); - apr_pool_destroy(p); - - return rv; -} - -AP_DECLARE(apr_status_t) ap_mpm_pod_signal(ap_pod_t *pod, int graceful) -{ - apr_status_t rv; - - rv = pod_signal_internal(pod, graceful); - if (rv != APR_SUCCESS) { - return rv; - } - return dummy_connection(pod); -} - -AP_DECLARE(void) ap_mpm_pod_killpg(ap_pod_t *pod, int num, int graceful) -{ - int i; - apr_status_t rv = APR_SUCCESS; - - for (i = 0; i < num && rv == APR_SUCCESS; i++) { - rv = pod_signal_internal(pod, graceful); - } - if (rv == APR_SUCCESS) { - for (i = 0; i < num && rv == APR_SUCCESS; i++) { - rv = dummy_connection(pod); - } - } -} - diff --git a/server/mpm/worker/pod.h b/server/mpm/worker/pod.h deleted file mode 100644 index cc68b4b6e384bc3490091399fa1556d82f760109..0000000000000000000000000000000000000000 --- a/server/mpm/worker/pod.h +++ /dev/null @@ -1,94 +0,0 @@ -/* ==================================================================== - * The Apache Software License, Version 1.1 - * - * Copyright (c) 2000-2001 The Apache Software Foundation. All rights - * reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in - * the documentation and/or other materials provided with the - * distribution. - * - * 3. The end-user documentation included with the redistribution, - * if any, must include the following acknowledgment: - * "This product includes software developed by the - * Apache Software Foundation (http://www.apache.org/)." - * Alternately, this acknowledgment may appear in the software itself, - * if and wherever such third-party acknowledgments normally appear. - * - * 4. The names "Apache" and "Apache Software Foundation" must - * not be used to endorse or promote products derived from this - * software without prior written permission. For written - * permission, please contact apache@apache.org. - * - * 5. Products derived from this software may not be called "Apache", - * nor may "Apache" appear in their name, without prior written - * permission of the Apache Software Foundation. - * - * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED - * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES - * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR - * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF - * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND - * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, - * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT - * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * ==================================================================== - * - * This software consists of voluntary contributions made by many - * individuals on behalf of the Apache Software Foundation. For more - * information on the Apache Software Foundation, please see - * . - * - * Portions of this software are based upon public domain software - * originally written at the National Center for Supercomputing Applications, - * University of Illinois, Urbana-Champaign. - */ - -#include "apr.h" -#include "apr_strings.h" -#include "apr_lock.h" -#define APR_WANT_STRFUNC -#include "apr_want.h" - -#include "httpd.h" -#include "http_config.h" -#include "http_log.h" -#include "http_main.h" -#include "mpm.h" -#include "mpm_common.h" -#include "ap_mpm.h" -#include "ap_listen.h" -#include "mpm_default.h" - -#define RESTART_CHAR '$' -#define GRACEFUL_CHAR '!' - -#define AP_RESTART 0 -#define AP_GRACEFUL 1 - -typedef struct ap_pod_t ap_pod_t; - -struct ap_pod_t { - apr_file_t *pod_in; - apr_file_t *pod_out; - apr_pool_t *p; - apr_sockaddr_t *sa; -}; - -AP_DECLARE(apr_status_t) ap_mpm_pod_open(apr_pool_t *p, ap_pod_t **pod); -AP_DECLARE(int) ap_mpm_pod_check(ap_pod_t *pod); -AP_DECLARE(apr_status_t) ap_mpm_pod_close(ap_pod_t *pod); -AP_DECLARE(apr_status_t) ap_mpm_pod_signal(ap_pod_t *pod, int graceful); -AP_DECLARE(void) ap_mpm_pod_killpg(ap_pod_t *pod, int num, int graceful); diff --git a/server/mpm/worker/worker.c b/server/mpm/worker/worker.c deleted file mode 100644 index 9f969af51c49cbe1716ac087b71b5f05ebdf6dbc..0000000000000000000000000000000000000000 --- a/server/mpm/worker/worker.c +++ /dev/null @@ -1,1660 +0,0 @@ -/* ==================================================================== - * The Apache Software License, Version 1.1 - * - * Copyright (c) 2000-2001 The Apache Software Foundation. All rights - * reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in - * the documentation and/or other materials provided with the - * distribution. - * - * 3. The end-user documentation included with the redistribution, - * if any, must include the following acknowledgment: - * "This product includes software developed by the - * Apache Software Foundation (http://www.apache.org/)." - * Alternately, this acknowledgment may appear in the software itself, - * if and wherever such third-party acknowledgments normally appear. - * - * 4. The names "Apache" and "Apache Software Foundation" must - * not be used to endorse or promote products derived from this - * software without prior written permission. For written - * permission, please contact apache@apache.org. - * - * 5. Products derived from this software may not be called "Apache", - * nor may "Apache" appear in their name, without prior written - * permission of the Apache Software Foundation. - * - * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED - * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES - * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR - * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF - * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND - * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, - * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT - * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * ==================================================================== - * - * This software consists of voluntary contributions made by many - * individuals on behalf of the Apache Software Foundation. For more - * information on the Apache Software Foundation, please see - * . - * - * Portions of this software are based upon public domain software - * originally written at the National Center for Supercomputing Applications, - * University of Illinois, Urbana-Champaign. - */ - -#include "apr.h" -#include "apr_portable.h" -#include "apr_strings.h" -#include "apr_file_io.h" -#include "apr_thread_proc.h" -#include "apr_signal.h" -#define APR_WANT_STRFUNC -#include "apr_want.h" - -#if APR_HAVE_UNISTD_H -#include -#endif -#if APR_HAVE_SYS_SOCKET_H -#include -#endif -#if APR_HAVE_SYS_WAIT_H -#include -#endif -#ifdef HAVE_SYS_PROCESSOR_H -#include /* for bindprocessor() */ -#endif - -#if !APR_HAS_THREADS -#error The Worker MPM requires APR threads, but they are unavailable. -#endif - -#define CORE_PRIVATE - -#include "ap_config.h" -#include "httpd.h" -#include "http_main.h" -#include "http_log.h" -#include "http_config.h" /* for read_config */ -#include "http_core.h" /* for get_remote_host */ -#include "http_connection.h" -#include "ap_mpm.h" -#include "unixd.h" -#include "mpm_common.h" -#include "ap_listen.h" -#include "scoreboard.h" -#include "fdqueue.h" - -#include -#include /* for INT_MAX */ - -/* - * Actual definitions of config globals - */ - -int ap_threads_per_child=0; /* Worker threads per child */ -static int ap_max_requests_per_child=0; -static const char *ap_pid_fname=NULL; -static int ap_daemons_to_start=0; -static int min_spare_threads=0; -static int max_spare_threads=0; -static int ap_daemons_limit=0; -static int dying = 0; -static int workers_may_exit = 0; -static int requests_this_child; -static int num_listensocks = 0; -static apr_socket_t **listensocks; -static FDQueue *worker_queue; - -/* The structure used to pass unique initialization info to each thread */ -typedef struct { - int pid; - int tid; - int sd; - apr_pool_t *tpool; /* "pthread" would be confusing */ -} proc_info; - -/* Structure used to pass information to the thread responsible for - * creating the rest of the threads. - */ -typedef struct { - apr_thread_t **threads; - int child_num_arg; - apr_threadattr_t *threadattr; -} thread_starter; - -/* - * The max child slot ever assigned, preserved across restarts. Necessary - * to deal with MaxClients changes across SIGWINCH restarts. We use this - * value to optimize routines that have to scan the entire scoreboard. - */ -int ap_max_daemons_limit = -1; - -char ap_coredump_dir[MAX_STRING_LEN]; - -static apr_file_t *pipe_of_death_in = NULL; -static apr_file_t *pipe_of_death_out = NULL; -static apr_lock_t *pipe_of_death_mutex; /* insures that a child process only - consumes one character */ - -/* *Non*-shared http_main globals... */ - -server_rec *ap_server_conf; - -/* one_process --- debugging mode variable; can be set from the command line - * with the -X flag. If set, this gets you the child_main loop running - * in the process which originally started up (no detach, no make_child), - * which is a pretty nice debugging environment. (You'll get a SIGHUP - * early in standalone_main; just continue through. This is the server - * trying to kill off any child processes which it might have lying - * around --- Apache doesn't keep track of their pids, it just sends - * SIGHUP to the process group, ignoring it in the root process. - * Continue through and you'll be fine.). - */ - -static int one_process = 0; - -#ifdef DEBUG_SIGSTOP -int raise_sigstop_flags; -#endif - -static apr_pool_t *pconf; /* Pool for config stuff */ -static apr_pool_t *pchild; /* Pool for httpd child stuff */ - -static pid_t ap_my_pid; /* Linux getpid() doesn't work except in main - thread. Use this instead */ -/* Keep track of the number of worker threads currently active */ -static int worker_thread_count; -static apr_lock_t *worker_thread_count_mutex; - -/* Locks for accept serialization */ -static apr_lock_t *accept_mutex; -static apr_lockmech_e_np accept_lock_mech = APR_LOCK_DEFAULT; -static const char *lock_fname; - -#ifdef NO_SERIALIZED_ACCEPT -#define SAFE_ACCEPT(stmt) APR_SUCCESS -#else -#define SAFE_ACCEPT(stmt) (stmt) -#endif - -AP_DECLARE(apr_status_t) ap_mpm_query(int query_code, int *result) -{ - switch(query_code){ - case AP_MPMQ_MAX_DAEMON_USED: - *result = ap_max_daemons_limit; - return APR_SUCCESS; - case AP_MPMQ_IS_THREADED: - *result = AP_MPMQ_STATIC; - return APR_SUCCESS; - case AP_MPMQ_IS_FORKED: - *result = AP_MPMQ_DYNAMIC; - return APR_SUCCESS; - case AP_MPMQ_HARD_LIMIT_DAEMONS: - *result = HARD_SERVER_LIMIT; - return APR_SUCCESS; - case AP_MPMQ_HARD_LIMIT_THREADS: - *result = HARD_THREAD_LIMIT; - return APR_SUCCESS; - case AP_MPMQ_MAX_THREADS: - *result = ap_threads_per_child; - return APR_SUCCESS; - case AP_MPMQ_MIN_SPARE_DEAMONS: - *result = 0; - return APR_SUCCESS; - case AP_MPMQ_MIN_SPARE_THREADS: - *result = min_spare_threads; - return APR_SUCCESS; - case AP_MPMQ_MAX_SPARE_DAEMONS: - *result = 0; - return APR_SUCCESS; - case AP_MPMQ_MAX_SPARE_THREADS: - *result = max_spare_threads; - return APR_SUCCESS; - case AP_MPMQ_MAX_REQUESTS_DEAMON: - *result = ap_max_requests_per_child; - return APR_SUCCESS; - case AP_MPMQ_MAX_DAEMONS: - *result = ap_daemons_limit; - return APR_SUCCESS; - } - return APR_ENOTIMPL; -} - -/* a clean exit from a child with proper cleanup */ -static void clean_child_exit(int code) __attribute__ ((noreturn)); -static void clean_child_exit(int code) -{ - if (pchild) { - apr_pool_destroy(pchild); - } - exit(code); -} - -/* handle all varieties of core dumping signals */ -static void sig_coredump(int sig) -{ - chdir(ap_coredump_dir); - apr_signal(sig, SIG_DFL); - kill(ap_my_pid, sig); - /* At this point we've got sig blocked, because we're still inside - * the signal handler. When we leave the signal handler it will - * be unblocked, and we'll take the signal... and coredump or whatever - * is appropriate for this particular Unix. In addition the parent - * will see the real signal we received -- whereas if we called - * abort() here, the parent would only see SIGABRT. - */ -} - -static void just_die(int sig) -{ - clean_child_exit(0); -} - -/***************************************************************** - * Connection structures and accounting... - */ - -/* volatile just in case */ -static int volatile shutdown_pending; -static int volatile restart_pending; -static int volatile is_graceful; -ap_generation_t volatile ap_my_generation; - -/* - * ap_start_shutdown() and ap_start_restart(), below, are a first stab at - * functions to initiate shutdown or restart without relying on signals. - * Previously this was initiated in sig_term() and restart() signal handlers, - * but we want to be able to start a shutdown/restart from other sources -- - * e.g. on Win32, from the service manager. Now the service manager can - * call ap_start_shutdown() or ap_start_restart() as appropiate. Note that - * these functions can also be called by the child processes, since global - * variables are no longer used to pass on the required action to the parent. - * - * These should only be called from the parent process itself, since the - * parent process will use the shutdown_pending and restart_pending variables - * to determine whether to shutdown or restart. The child process should - * call signal_parent() directly to tell the parent to die -- this will - * cause neither of those variable to be set, which the parent will - * assume means something serious is wrong (which it will be, for the - * child to force an exit) and so do an exit anyway. - */ - -static void ap_start_shutdown(void) -{ - if (shutdown_pending == 1) { - /* Um, is this _probably_ not an error, if the user has - * tried to do a shutdown twice quickly, so we won't - * worry about reporting it. - */ - return; - } - shutdown_pending = 1; -} - -/* do a graceful restart if graceful == 1 */ -static void ap_start_restart(int graceful) -{ - - if (restart_pending == 1) { - /* Probably not an error - don't bother reporting it */ - return; - } - restart_pending = 1; - is_graceful = graceful; - if (is_graceful) { - apr_pool_cleanup_kill(pconf, NULL, ap_cleanup_scoreboard); - } -} - -static void sig_term(int sig) -{ - ap_start_shutdown(); -} - -static void restart(int sig) -{ - ap_start_restart(sig == SIGWINCH); -} - -static void set_signals(void) -{ -#ifndef NO_USE_SIGACTION - struct sigaction sa; - - sigemptyset(&sa.sa_mask); - sa.sa_flags = 0; - - if (!one_process) { - sa.sa_handler = sig_coredump; -#if defined(SA_ONESHOT) - sa.sa_flags = SA_ONESHOT; -#elif defined(SA_RESETHAND) - sa.sa_flags = SA_RESETHAND; -#endif - if (sigaction(SIGSEGV, &sa, NULL) < 0) - ap_log_error(APLOG_MARK, APLOG_WARNING, errno, ap_server_conf, "sigaction(SIGSEGV)"); -#ifdef SIGBUS - if (sigaction(SIGBUS, &sa, NULL) < 0) - ap_log_error(APLOG_MARK, APLOG_WARNING, errno, ap_server_conf, "sigaction(SIGBUS)"); -#endif -#ifdef SIGABORT - if (sigaction(SIGABORT, &sa, NULL) < 0) - ap_log_error(APLOG_MARK, APLOG_WARNING, errno, ap_server_conf, "sigaction(SIGABORT)"); -#endif -#ifdef SIGABRT - if (sigaction(SIGABRT, &sa, NULL) < 0) - ap_log_error(APLOG_MARK, APLOG_WARNING, errno, ap_server_conf, "sigaction(SIGABRT)"); -#endif -#ifdef SIGILL - if (sigaction(SIGILL, &sa, NULL) < 0) - ap_log_error(APLOG_MARK, APLOG_WARNING, errno, ap_server_conf, "sigaction(SIGILL)"); -#endif - sa.sa_flags = 0; - } - sa.sa_handler = sig_term; - if (sigaction(SIGTERM, &sa, NULL) < 0) - ap_log_error(APLOG_MARK, APLOG_WARNING, errno, ap_server_conf, "sigaction(SIGTERM)"); -#ifdef SIGINT - if (sigaction(SIGINT, &sa, NULL) < 0) - ap_log_error(APLOG_MARK, APLOG_WARNING, errno, ap_server_conf, "sigaction(SIGINT)"); -#endif -#ifdef SIGXCPU - sa.sa_handler = SIG_DFL; - if (sigaction(SIGXCPU, &sa, NULL) < 0) - ap_log_error(APLOG_MARK, APLOG_WARNING, errno, ap_server_conf, "sigaction(SIGXCPU)"); -#endif -#ifdef SIGXFSZ - sa.sa_handler = SIG_DFL; - if (sigaction(SIGXFSZ, &sa, NULL) < 0) - ap_log_error(APLOG_MARK, APLOG_WARNING, errno, ap_server_conf, "sigaction(SIGXFSZ)"); -#endif -#ifdef SIGPIPE - sa.sa_handler = SIG_IGN; - if (sigaction(SIGPIPE, &sa, NULL) < 0) - ap_log_error(APLOG_MARK, APLOG_WARNING, errno, ap_server_conf, "sigaction(SIGPIPE)"); -#endif - - /* we want to ignore HUPs and WINCH while we're busy processing one */ - sigaddset(&sa.sa_mask, SIGHUP); - sigaddset(&sa.sa_mask, SIGWINCH); - sa.sa_handler = restart; - if (sigaction(SIGHUP, &sa, NULL) < 0) - ap_log_error(APLOG_MARK, APLOG_WARNING, errno, ap_server_conf, "sigaction(SIGHUP)"); - if (sigaction(SIGWINCH, &sa, NULL) < 0) - ap_log_error(APLOG_MARK, APLOG_WARNING, errno, ap_server_conf, "sigaction(SIGWINCH)"); -#else - if (!one_process) { - apr_signal(SIGSEGV, sig_coredump); -#ifdef SIGBUS - apr_signal(SIGBUS, sig_coredump); -#endif /* SIGBUS */ -#ifdef SIGABORT - apr_signal(SIGABORT, sig_coredump); -#endif /* SIGABORT */ -#ifdef SIGABRT - apr_signal(SIGABRT, sig_coredump); -#endif /* SIGABRT */ -#ifdef SIGILL - apr_signal(SIGILL, sig_coredump); -#endif /* SIGILL */ -#ifdef SIGXCPU - apr_signal(SIGXCPU, SIG_DFL); -#endif /* SIGXCPU */ -#ifdef SIGXFSZ - apr_signal(SIGXFSZ, SIG_DFL); -#endif /* SIGXFSZ */ - } - - apr_signal(SIGTERM, sig_term); -#ifdef SIGHUP - apr_signal(SIGHUP, restart); -#endif /* SIGHUP */ -#ifdef SIGWINCH - apr_signal(SIGWINCH, restart); -#endif /* SIGWINCH */ -#ifdef SIGPIPE - apr_signal(SIGPIPE, SIG_IGN); -#endif /* SIGPIPE */ - -#endif -} - -/***************************************************************** - * Here follows a long bunch of generic server bookkeeping stuff... - */ - -int ap_graceful_stop_signalled(void) -{ - /* XXX - Does this really work? - Manoj */ - return is_graceful; -} - -/***************************************************************** - * Child process main loop. - */ - -static void process_socket(apr_pool_t *p, apr_socket_t *sock, int my_child_num, int my_thread_num) -{ - conn_rec *current_conn; - long conn_id = AP_ID_FROM_CHILD_THREAD(my_child_num, my_thread_num); - int csd; - - (void) apr_os_sock_get(&csd, sock); - - if (csd >= FD_SETSIZE) { - ap_log_error(APLOG_MARK, APLOG_NOERRNO|APLOG_WARNING, 0, NULL, - "new file descriptor %d is too large; you probably need " - "to rebuild Apache with a larger FD_SETSIZE " - "(currently %d)", - csd, FD_SETSIZE); - apr_socket_close(sock); - return; - } - - ap_sock_disable_nagle(sock); - - current_conn = ap_new_connection(p, ap_server_conf, sock, conn_id); - if (current_conn) { - ap_process_connection(current_conn); - ap_lingering_close(current_conn); - } -} - -/* requests_this_child has gone to zero or below. See if the admin coded - "MaxRequestsPerChild 0", and keep going in that case. Doing it this way - simplifies the hot path in worker_thread */ - -static void check_infinite_requests(void) -{ - if (ap_max_requests_per_child) { - workers_may_exit = 1; - } - else { - /* wow! if you're executing this code, you may have set a record. - * either this child process has served over 2 billion requests, or - * you're running a threaded 2.0 on a 16 bit machine. - * - * I'll buy pizza and beers at Apachecon for the first person to do - * the former without cheating (dorking with INT_MAX, or running with - * uncommitted performance patches, for example). - * - * for the latter case, you probably deserve a beer too. Greg Ames - */ - - requests_this_child = INT_MAX; /* keep going */ - } -} - -/* Sets workers_may_exit if we received a character on the pipe_of_death */ -static void check_pipe_of_death(void) -{ - apr_lock_acquire(pipe_of_death_mutex); - if (!workers_may_exit) { - apr_status_t ret; - char pipe_read_char; - apr_size_t n = 1; - - ret = apr_recv(listensocks[0], &pipe_read_char, &n); - if (APR_STATUS_IS_EAGAIN(ret)) { - /* It lost the lottery. It must continue to suffer - * through a life of servitude. */ - } - else { - /* It won the lottery (or something else is very - * wrong). Embrace death with open arms. */ - workers_may_exit = 1; - } - } - apr_lock_release(pipe_of_death_mutex); -} - -static void *listener_thread(apr_thread_t *thd, void * dummy) -{ - proc_info * ti = dummy; - int process_slot = ti->pid; - int thread_slot = ti->tid; - apr_pool_t *tpool = ti->tpool; - apr_socket_t *csd = NULL; - apr_pool_t *ptrans; /* Pool for per-transaction stuff */ - apr_socket_t *sd = NULL; - int n; - int curr_pollfd, last_pollfd = 0; - apr_pollfd_t *pollset; - apr_status_t rv; - - free(ti); - - apr_pool_create(&ptrans, tpool); - - apr_lock_acquire(worker_thread_count_mutex); - worker_thread_count++; - apr_lock_release(worker_thread_count_mutex); - - apr_poll_setup(&pollset, num_listensocks+1, tpool); - for(n=0 ; n <= num_listensocks ; ++n) - apr_poll_socket_add(pollset, listensocks[n], APR_POLLIN); - - worker_queue = apr_pcalloc(pchild, sizeof(*worker_queue)); - ap_queue_init(worker_queue, ap_threads_per_child, pchild); - - /* TODO: Switch to a system where threads reuse the results from earlier - poll calls - manoj */ - while (1) { - if (requests_this_child <= 0) { - check_infinite_requests(); - } - if (workers_may_exit) break; - - if ((rv = SAFE_ACCEPT(apr_lock_acquire(accept_mutex))) - != APR_SUCCESS) { - ap_log_error(APLOG_MARK, APLOG_EMERG, rv, ap_server_conf, - "apr_lock_acquire failed. Attempting to shutdown " - "process gracefully."); - workers_may_exit = 1; - } - - while (!workers_may_exit) { - apr_status_t ret; - apr_int16_t event; - - ret = apr_poll(pollset, &n, -1); - if (ret != APR_SUCCESS) { - if (APR_STATUS_IS_EINTR(ret)) { - continue; - } - - /* apr_poll() will only return errors in catastrophic - * circumstances. Let's try exiting gracefully, for now. */ - ap_log_error(APLOG_MARK, APLOG_ERR, ret, (const server_rec *) - ap_server_conf, "apr_poll: (listen)"); - workers_may_exit = 1; - } - - if (workers_may_exit) break; - - apr_poll_revents_get(&event, listensocks[0], pollset); - if (event & APR_POLLIN) { - /* A process got a signal on the shutdown pipe. Check if we're - * the lucky process to die. */ - check_pipe_of_death(); - continue; - } - - if (num_listensocks == 1) { - sd = ap_listeners->sd; - goto got_fd; - } - else { - /* find a listener */ - curr_pollfd = last_pollfd; - do { - curr_pollfd++; - if (curr_pollfd > num_listensocks) { - curr_pollfd = 1; - } - /* XXX: Should we check for POLLERR? */ - apr_poll_revents_get(&event, listensocks[curr_pollfd], pollset); - if (event & APR_POLLIN) { - last_pollfd = curr_pollfd; - sd=listensocks[curr_pollfd]; - goto got_fd; - } - } while (curr_pollfd != last_pollfd); - } - } - got_fd: - if (!workers_may_exit) { - if ((rv = apr_accept(&csd, sd, ptrans)) != APR_SUCCESS) { - csd = NULL; - ap_log_error(APLOG_MARK, APLOG_ERR, rv, ap_server_conf, - "apr_accept"); - } - if ((rv = SAFE_ACCEPT(apr_lock_release(accept_mutex))) - != APR_SUCCESS) { - ap_log_error(APLOG_MARK, APLOG_EMERG, rv, ap_server_conf, - "apr_lock_release failed. Attempting to shutdown " - "process gracefully."); - workers_may_exit = 1; - } - if (csd != NULL) { - ap_queue_push(worker_queue, csd, ptrans); - ap_block_on_queue(worker_queue); - } - } - else { - if ((rv = SAFE_ACCEPT(apr_lock_release(accept_mutex))) - != APR_SUCCESS) { - ap_log_error(APLOG_MARK, APLOG_EMERG, rv, ap_server_conf, - "apr_lock_release failed. Attempting to shutdown " - "process gracefully."); - workers_may_exit = 1; - } - break; - } - } - - apr_pool_destroy(tpool); - ap_update_child_status(process_slot, thread_slot, (dying) ? SERVER_DEAD : SERVER_GRACEFUL, - (request_rec *) NULL); - dying = 1; - apr_lock_acquire(worker_thread_count_mutex); - worker_thread_count--; - if (worker_thread_count == 0) { - /* All the threads have exited, now finish the shutdown process - * by signalling the sigwait thread */ - kill(ap_my_pid, SIGTERM); - } - apr_lock_release(worker_thread_count_mutex); - - return NULL; -} - -static void *worker_thread(apr_thread_t *thd, void * dummy) -{ - proc_info * ti = dummy; - int process_slot = ti->pid; - int thread_slot = ti->tid; - apr_pool_t *tpool = ti->tpool; - apr_socket_t *csd = NULL; - apr_pool_t *ptrans; /* Pool for per-transaction stuff */ - apr_socket_t *sd = NULL; - int n; - int curr_pollfd, last_pollfd = 0; - apr_pollfd_t *pollset; - apr_status_t rv; - - free(ti); - - while (!workers_may_exit) { - ap_queue_pop(worker_queue, &csd, &ptrans, 1); - process_socket(ptrans, csd, process_slot, thread_slot); - requests_this_child--; - apr_pool_clear(ptrans); - } - - apr_pool_destroy(tpool); - ap_update_child_status(process_slot, thread_slot, (dying) ? SERVER_DEAD : SERVER_GRACEFUL, - (request_rec *) NULL); - apr_lock_acquire(worker_thread_count_mutex); - if (!dying) { - /* this is the first thread to exit */ - if (ap_my_pid == ap_scoreboard_image->parent[process_slot].pid) { - /* tell the parent that it may use this scoreboard slot */ - ap_scoreboard_image->parent[process_slot].quiescing = 1; - } - dying = 1; - } - worker_thread_count--; - if (worker_thread_count == 0) { - /* All the threads have exited, now finish the shutdown process - * by signalling the sigwait thread */ - kill(ap_my_pid, SIGTERM); - } - apr_lock_release(worker_thread_count_mutex); - - return NULL; -} - -static int check_signal(int signum) -{ - switch (signum) { - case SIGTERM: - case SIGINT: - return 1; - } - return 0; -} - -static void *start_threads(apr_thread_t *thd, void * dummy) -{ - thread_starter *ts = dummy; - apr_thread_t **threads = ts->threads; - apr_threadattr_t *thread_attr = ts->threadattr; - int child_num_arg = ts->child_num_arg; - int i; - int my_child_num = child_num_arg; - proc_info *my_info = NULL; - apr_status_t rv; - int threads_created = 0; - apr_thread_t *listener; - - while (1) { - my_info = (proc_info *)malloc(sizeof(proc_info)); - my_info->pid = my_child_num; - my_info->tid = i; - my_info->sd = 0; - apr_pool_create(&my_info->tpool, pchild); - apr_thread_create(&listener, thread_attr, listener_thread, my_info, pchild); - for (i=0; i < ap_threads_per_child; i++) { - int status = ap_scoreboard_image->servers[child_num_arg][i].status; - - if (status != SERVER_GRACEFUL && status != SERVER_DEAD) { - continue; - } - - my_info = (proc_info *)malloc(sizeof(proc_info)); - if (my_info == NULL) { - ap_log_error(APLOG_MARK, APLOG_ALERT, errno, ap_server_conf, - "malloc: out of memory"); - clean_child_exit(APEXIT_CHILDFATAL); - } - my_info->pid = my_child_num; - my_info->tid = i; - my_info->sd = 0; - apr_pool_create(&my_info->tpool, pchild); - - /* We are creating threads right now */ - (void) ap_update_child_status(my_child_num, i, SERVER_STARTING, - (request_rec *) NULL); - /* We let each thread update its own scoreboard entry. This is - * done because it lets us deal with tid better. - */ - if ((rv = apr_thread_create(&threads[i], thread_attr, worker_thread, my_info, pchild))) { - ap_log_error(APLOG_MARK, APLOG_ALERT, rv, ap_server_conf, - "apr_thread_create: unable to create worker thread"); - /* In case system resources are maxxed out, we don't want - Apache running away with the CPU trying to fork over and - over and over again if we exit. */ - sleep(10); - clean_child_exit(APEXIT_CHILDFATAL); - } - threads_created++; - } - if (workers_may_exit || threads_created == ap_threads_per_child) { - break; - } - sleep(1); /* wait for previous generation to clean up an entry */ - } - - /* What state should this child_main process be listed as in the scoreboard...? - * ap_update_child_status(my_child_num, i, SERVER_STARTING, (request_rec *) NULL); - * - * This state should be listed separately in the scoreboard, in some kind - * of process_status, not mixed in with the worker threads' status. - * "life_status" is almost right, but it's in the worker's structure, and - * the name could be clearer. gla - */ - return NULL; -} - -static void child_main(int child_num_arg) -{ - apr_thread_t **threads; - int i; - ap_listen_rec *lr; - apr_status_t rv; - thread_starter *ts; - apr_threadattr_t *thread_attr; - apr_thread_t *start_thread_id; - - ap_my_pid = getpid(); - apr_pool_create(&pchild, pconf); - - /*stuff to do before we switch id's, so we have permissions.*/ - reopen_scoreboard(pchild); - - rv = SAFE_ACCEPT(apr_lock_child_init(&accept_mutex, lock_fname, - pchild)); - if (rv != APR_SUCCESS) { - ap_log_error(APLOG_MARK, APLOG_EMERG, rv, ap_server_conf, - "Couldn't initialize cross-process lock in child"); - clean_child_exit(APEXIT_CHILDFATAL); - } - - if (unixd_setup_child()) { - clean_child_exit(APEXIT_CHILDFATAL); - } - - ap_run_child_init(pchild, ap_server_conf); - - /*done with init critical section */ - - rv = apr_setup_signal_thread(); - if (rv != APR_SUCCESS) { - ap_log_error(APLOG_MARK, APLOG_EMERG, rv, ap_server_conf, - "Couldn't initialize signal thread"); - clean_child_exit(APEXIT_CHILDFATAL); - } - - if (ap_max_requests_per_child) { - requests_this_child = ap_max_requests_per_child; - } - else { - /* coding a value of zero means infinity */ - requests_this_child = INT_MAX; - } - - /* Set up the pollfd array */ - listensocks = apr_pcalloc(pchild, - sizeof(*listensocks) * (num_listensocks + 1)); -#if APR_FILES_AS_SOCKETS - apr_socket_from_file(&listensocks[0], pipe_of_death_in); -#endif - for (lr = ap_listeners, i = 1; i <= num_listensocks; lr = lr->next, ++i) - listensocks[i]=lr->sd; - - /* Setup worker threads */ - - /* clear the storage; we may not create all our threads immediately, and we want - * a 0 entry to indicate a thread which was not created - */ - threads = (apr_thread_t **)calloc(1, sizeof(apr_thread_t *) * ap_threads_per_child); - if (threads == NULL) { - ap_log_error(APLOG_MARK, APLOG_ALERT, errno, ap_server_conf, - "malloc: out of memory"); - clean_child_exit(APEXIT_CHILDFATAL); - } - worker_thread_count = 0; - apr_lock_create(&worker_thread_count_mutex, APR_MUTEX, APR_INTRAPROCESS, - NULL, pchild); - apr_lock_create(&pipe_of_death_mutex, APR_MUTEX, APR_INTRAPROCESS, - NULL, pchild); - - ts = apr_palloc(pchild, sizeof(*ts)); - - apr_threadattr_create(&thread_attr, pchild); - apr_threadattr_detach_set(thread_attr, 0); /* 0 means PTHREAD_CREATE_JOINABLE */ - - ts->threads = threads; - ts->child_num_arg = child_num_arg; - ts->threadattr = thread_attr; - - if ((rv = apr_thread_create(&start_thread_id, thread_attr, start_threads, ts, pchild))) { - ap_log_error(APLOG_MARK, APLOG_ALERT, rv, ap_server_conf, - "apr_thread_create: unable to create worker thread"); - /* In case system resources are maxxed out, we don't want - Apache running away with the CPU trying to fork over and - over and over again if we exit. */ - sleep(10); - clean_child_exit(APEXIT_CHILDFATAL); - } - - apr_signal_thread(check_signal); - - workers_may_exit = 1; /* helps us terminate a little more quickly when - * the dispatch of the signal thread - * beats the Pipe of Death and the browsers - */ - - /* A terminating signal was received. Now join each of the workers to clean them up. - * If the worker already exited, then the join frees their resources and returns. - * If the worker hasn't exited, then this blocks until they have (then cleans up). - */ - apr_thread_join(&rv, start_thread_id); - for (i = 0; i < ap_threads_per_child; i++) { - if (threads[i]) { /* if we ever created this thread */ - apr_thread_join(&rv, threads[i]); - } - } - - free(threads); - - clean_child_exit(0); -} - -static int make_child(server_rec *s, int slot) -{ - int pid; - - if (slot + 1 > ap_max_daemons_limit) { - ap_max_daemons_limit = slot + 1; - } - - if (one_process) { - set_signals(); - ap_scoreboard_image->parent[slot].pid = getpid(); - child_main(slot); - } - - if ((pid = fork()) == -1) { - ap_log_error(APLOG_MARK, APLOG_ERR, errno, s, "fork: Unable to fork new process"); - - /* fork didn't succeed. Fix the scoreboard or else - * it will say SERVER_STARTING forever and ever - */ - (void) ap_update_child_status(slot, 0, SERVER_DEAD, (request_rec *) NULL); - - /* In case system resources are maxxed out, we don't want - Apache running away with the CPU trying to fork over and - over and over again. */ - sleep(10); - - return -1; - } - - if (!pid) { -#ifdef HAVE_BINDPROCESSOR - /* By default, AIX binds to a single processor. This bit unbinds - * children which will then bind to another CPU. - */ - int status = bindprocessor(BINDPROCESS, (int)getpid(), - PROCESSOR_CLASS_ANY); - if (status != OK) - ap_log_error(APLOG_MARK, APLOG_NOERRNO|APLOG_WARNING, errno, ap_server_conf, - "processor unbind failed %d", status); -#endif - RAISE_SIGSTOP(MAKE_CHILD); - - apr_signal(SIGTERM, just_die); - child_main(slot); - - clean_child_exit(0); - } - /* else */ - ap_scoreboard_image->parent[slot].quiescing = 0; - ap_scoreboard_image->parent[slot].pid = pid; - return 0; -} - -/* If there aren't many connections coming in from the network, the child - * processes may need to be awakened from their network i/o waits. - * The pipe of death is an effective prod. - */ - -static void wake_up_and_die(void) -{ - int i; - char char_of_death = '!'; - apr_size_t one = 1; - apr_status_t rv; - - for (i = 0; i < ap_daemons_limit;) { - if ((rv = apr_file_write(pipe_of_death_out, &char_of_death, &one)) - != APR_SUCCESS) { - if (APR_STATUS_IS_EINTR(rv)) continue; - ap_log_error(APLOG_MARK, APLOG_WARNING, rv, ap_server_conf, - "write pipe_of_death"); - } - i++; - } -} - -/* start up a bunch of children */ -static void startup_children(int number_to_start) -{ - int i; - - for (i = 0; number_to_start && i < ap_daemons_limit; ++i) { - if (ap_scoreboard_image->parent[i].pid != 0) { - continue; - } - if (make_child(ap_server_conf, i) < 0) { - break; - } - --number_to_start; - } -} - - -/* - * idle_spawn_rate is the number of children that will be spawned on the - * next maintenance cycle if there aren't enough idle servers. It is - * doubled up to MAX_SPAWN_RATE, and reset only when a cycle goes by - * without the need to spawn. - */ -static int idle_spawn_rate = 1; -#ifndef MAX_SPAWN_RATE -#define MAX_SPAWN_RATE (32) -#endif -static int hold_off_on_exponential_spawning; - -static void perform_idle_server_maintenance(void) -{ - int i, j; - int idle_thread_count; - worker_score *ws; - process_score *ps; - int free_length; - int free_slots[MAX_SPAWN_RATE]; - int last_non_dead; - int total_non_dead; - apr_size_t one = 1; - apr_status_t rv; - - /* initialize the free_list */ - free_length = 0; - - idle_thread_count = 0; - last_non_dead = -1; - total_non_dead = 0; - - ap_sync_scoreboard_image(); - for (i = 0; i < ap_daemons_limit; ++i) { - /* Initialization to satisfy the compiler. It doesn't know - * that ap_threads_per_child is always > 0 */ - int status = SERVER_DEAD; - int any_dying_threads = 0; - int any_dead_threads = 0; - - if (i >= ap_max_daemons_limit && free_length == idle_spawn_rate) - break; - ps = &ap_scoreboard_image->parent[i]; - for (j = 0; j < ap_threads_per_child; j++) { - ws = &ap_scoreboard_image->servers[i][j]; - status = ws->status; - - any_dying_threads = any_dying_threads || (status == SERVER_GRACEFUL); - any_dead_threads = any_dead_threads || (status == SERVER_DEAD); - - /* We consider a starting server as idle because we started it - * at least a cycle ago, and if it still hasn't finished starting - * then we're just going to swamp things worse by forking more. - * So we hopefully won't need to fork more if we count it. - * This depends on the ordering of SERVER_READY and SERVER_STARTING. - */ - if (status <= SERVER_READY && status != SERVER_DEAD && - ps->generation == ap_my_generation && - /* XXX the following shouldn't be necessary if we clean up - * properly after seg faults, but we're not yet GLA - */ - ps->pid != 0) { - ++idle_thread_count; - } - } - /* XXX any_dead_threads may not be needed any more GLA */ - if (any_dead_threads && free_length < idle_spawn_rate - && (!ps->pid /* no process in the slot */ - || ps->quiescing)) { /* or at least one is going away */ - free_slots[free_length] = i; - ++free_length; - } - if (!any_dying_threads) { - last_non_dead = i; - ++total_non_dead; - } - } - ap_max_daemons_limit = last_non_dead + 1; - - if (idle_thread_count > max_spare_threads) { - char char_of_death = '!'; - /* Kill off one child */ - if ((rv = apr_file_write(pipe_of_death_out, &char_of_death, &one)) != APR_SUCCESS) { - ap_log_error(APLOG_MARK, APLOG_WARNING, rv, ap_server_conf, "write pipe_of_death"); - } - idle_spawn_rate = 1; - } - else if (idle_thread_count < min_spare_threads) { - /* terminate the free list */ - if (free_length == 0) { - /* only report this condition once */ - static int reported = 0; - - if (!reported) { - ap_log_error(APLOG_MARK, APLOG_NOERRNO|APLOG_ERR, 0, ap_server_conf, - "server reached MaxClients setting, consider" - " raising the MaxClients setting"); - reported = 1; - } - idle_spawn_rate = 1; - } - else { - - if (idle_spawn_rate >= 8) { - ap_log_error(APLOG_MARK, APLOG_NOERRNO|APLOG_INFO, 0, ap_server_conf, - "server seems busy, (you may need " - "to increase StartServers, ThreadsPerChild " - "or Min/MaxSpareThreads), " - "spawning %d children, there are around %d idle " - "threads, and %d total children", free_length, - idle_thread_count, total_non_dead); - } - for (i = 0; i < free_length; ++i) { - make_child(ap_server_conf, free_slots[i]); - } - /* the next time around we want to spawn twice as many if this - * wasn't good enough, but not if we've just done a graceful - */ - if (hold_off_on_exponential_spawning) { - --hold_off_on_exponential_spawning; - } - else if (idle_spawn_rate < MAX_SPAWN_RATE) { - idle_spawn_rate *= 2; - } - } - } - else { - idle_spawn_rate = 1; - } -} - -static void server_main_loop(int remaining_children_to_start) -{ - int child_slot; - apr_wait_t status; - apr_proc_t pid; - int i; - - while (!restart_pending && !shutdown_pending) { - ap_wait_or_timeout(&status, &pid, pconf); - - if (pid.pid != -1) { - ap_process_child_status(&pid, status); - /* non-fatal death... note that it's gone in the scoreboard. */ - child_slot = find_child_by_pid(&pid); - if (child_slot >= 0) { - for (i = 0; i < ap_threads_per_child; i++) - ap_update_child_status(child_slot, i, SERVER_DEAD, (request_rec *) NULL); - - ap_scoreboard_image->parent[child_slot].pid = 0; - ap_scoreboard_image->parent[child_slot].quiescing = 0; - if (remaining_children_to_start - && child_slot < ap_daemons_limit) { - /* we're still doing a 1-for-1 replacement of dead - * children with new children - */ - make_child(ap_server_conf, child_slot); - --remaining_children_to_start; - } -#if APR_HAS_OTHER_CHILD - } - else if (apr_proc_other_child_read(&pid, status) == 0) { - /* handled */ -#endif - } - else if (is_graceful) { - /* Great, we've probably just lost a slot in the - * scoreboard. Somehow we don't know about this child. - */ - ap_log_error(APLOG_MARK, APLOG_NOERRNO|APLOG_WARNING, 0, - ap_server_conf, - "long lost child came home! (pid %ld)", - (long)pid.pid); - } - /* Don't perform idle maintenance when a child dies, - * only do it when there's a timeout. Remember only a - * finite number of children can die, and it's pretty - * pathological for a lot to die suddenly. - */ - continue; - } - else if (remaining_children_to_start) { - /* we hit a 1 second timeout in which none of the previous - * generation of children needed to be reaped... so assume - * they're all done, and pick up the slack if any is left. - */ - startup_children(remaining_children_to_start); - remaining_children_to_start = 0; - /* In any event we really shouldn't do the code below because - * few of the servers we just started are in the IDLE state - * yet, so we'd mistakenly create an extra server. - */ - continue; - } - - perform_idle_server_maintenance(); - } -} - -int ap_mpm_run(apr_pool_t *_pconf, apr_pool_t *plog, server_rec *s) -{ - int remaining_children_to_start; - apr_status_t rv; - - pconf = _pconf; - ap_server_conf = s; - - rv = apr_file_pipe_create(&pipe_of_death_in, &pipe_of_death_out, pconf); - if (rv != APR_SUCCESS) { - ap_log_error(APLOG_MARK, APLOG_ERR, rv, - (const server_rec*) ap_server_conf, - "apr_file_pipe_create (pipe_of_death)"); - exit(1); - } - - if ((rv = apr_file_pipe_timeout_set(pipe_of_death_in, 0)) != APR_SUCCESS) { - ap_log_error(APLOG_MARK, APLOG_ERR, rv, - (const server_rec*) ap_server_conf, - "apr_file_pipe_timeout_set (pipe_of_death)"); - exit(1); - } - - if ((num_listensocks = ap_setup_listeners(ap_server_conf)) < 1) { - /* XXX: hey, what's the right way for the mpm to indicate a fatal error? */ - ap_log_error(APLOG_MARK, APLOG_NOERRNO|APLOG_ALERT, 0, s, - "no listening sockets available, shutting down"); - return 1; - } - ap_log_pid(pconf, ap_pid_fname); - - /* Initialize cross-process accept lock */ - lock_fname = apr_psprintf(_pconf, "%s.%" APR_OS_PROC_T_FMT, - ap_server_root_relative(_pconf, lock_fname), - ap_my_pid); - rv = apr_lock_create_np(&accept_mutex, APR_MUTEX, APR_LOCKALL, - accept_lock_mech, lock_fname, _pconf); - if (rv != APR_SUCCESS) { - ap_log_error(APLOG_MARK, APLOG_EMERG, rv, s, - "Couldn't create accept lock"); - return 1; - } - - if (!is_graceful) { - ap_run_pre_mpm(pconf, SB_SHARED); - } - - set_signals(); - /* Don't thrash... */ - if (max_spare_threads < min_spare_threads + ap_threads_per_child) - max_spare_threads = min_spare_threads + ap_threads_per_child; - - /* If we're doing a graceful_restart then we're going to see a lot - * of children exiting immediately when we get into the main loop - * below (because we just sent them SIGWINCH). This happens pretty - * rapidly... and for each one that exits we'll start a new one until - * we reach at least daemons_min_free. But we may be permitted to - * start more than that, so we'll just keep track of how many we're - * supposed to start up without the 1 second penalty between each fork. - */ - remaining_children_to_start = ap_daemons_to_start; - if (remaining_children_to_start > ap_daemons_limit) { - remaining_children_to_start = ap_daemons_limit; - } - if (!is_graceful) { - startup_children(remaining_children_to_start); - remaining_children_to_start = 0; - } - else { - /* give the system some time to recover before kicking into - * exponential mode */ - hold_off_on_exponential_spawning = 10; - } - - ap_log_error(APLOG_MARK, APLOG_NOERRNO|APLOG_NOTICE, 0, ap_server_conf, - "%s configured -- resuming normal operations", - ap_get_server_version()); - ap_log_error(APLOG_MARK, APLOG_NOERRNO|APLOG_INFO, 0, ap_server_conf, - "Server built: %s", ap_get_server_built()); - restart_pending = shutdown_pending = 0; - - server_main_loop(remaining_children_to_start); - - if (shutdown_pending) { - /* Time to gracefully shut down: - * Kill child processes, tell them to call child_exit, etc... - */ - wake_up_and_die(); - - if (unixd_killpg(getpgrp(), SIGTERM) < 0) { - ap_log_error(APLOG_MARK, APLOG_WARNING, errno, ap_server_conf, "killpg SIGTERM"); - } - ap_reclaim_child_processes(1); /* Start with SIGTERM */ - - /* cleanup pid file on normal shutdown */ - { - const char *pidfile = NULL; - pidfile = ap_server_root_relative (pconf, ap_pid_fname); - if ( pidfile != NULL && unlink(pidfile) == 0) - ap_log_error(APLOG_MARK, APLOG_NOERRNO|APLOG_INFO, 0, - ap_server_conf, - "removed PID file %s (pid=%ld)", - pidfile, (long)getpid()); - } - - ap_log_error(APLOG_MARK, APLOG_NOERRNO|APLOG_NOTICE, 0, ap_server_conf, - "caught SIGTERM, shutting down"); - - return 1; - } - - /* we've been told to restart */ - apr_signal(SIGHUP, SIG_IGN); - - if (one_process) { - /* not worth thinking about */ - return 1; - } - - /* advance to the next generation */ - /* XXX: we really need to make sure this new generation number isn't in - * use by any of the children. - */ - ++ap_my_generation; - ap_scoreboard_image->global.running_generation = ap_my_generation; - update_scoreboard_global(); - - /* wake up the children...time to die. But we'll have more soon */ - wake_up_and_die(); - - if (is_graceful) { - ap_log_error(APLOG_MARK, APLOG_NOERRNO|APLOG_NOTICE, 0, ap_server_conf, - "SIGWINCH received. Doing graceful restart"); - - /* This is mostly for debugging... so that we know what is still - * gracefully dealing with existing request. - */ - - } - else { - /* Kill 'em all. Since the child acts the same on the parents SIGTERM - * and a SIGHUP, we may as well use the same signal, because some user - * pthreads are stealing signals from us left and right. - */ - if (unixd_killpg(getpgrp(), SIGTERM) < 0) { - ap_log_error(APLOG_MARK, APLOG_WARNING, errno, ap_server_conf, "killpg SIGTERM"); - } - ap_reclaim_child_processes(1); /* Start with SIGTERM */ - ap_log_error(APLOG_MARK, APLOG_NOERRNO|APLOG_NOTICE, 0, ap_server_conf, - "SIGHUP received. Attempting to restart"); - } - return 0; -} - -static void worker_pre_config(apr_pool_t *pconf, apr_pool_t *plog, apr_pool_t *ptemp) -{ - static int restart_num = 0; - int no_detach = 0; - - one_process = !!ap_exists_config_define("ONE_PROCESS"); - no_detach = !!ap_exists_config_define("NO_DETACH"); - - /* sigh, want this only the second time around */ - if (restart_num++ == 1) { - is_graceful = 0; - - if (!one_process && !no_detach) { - apr_proc_detach(); - } - ap_my_pid = getpid(); - } - - unixd_pre_config(ptemp); - ap_listen_pre_config(); - ap_daemons_to_start = DEFAULT_START_DAEMON; - min_spare_threads = DEFAULT_MIN_FREE_DAEMON * DEFAULT_THREADS_PER_CHILD; - max_spare_threads = DEFAULT_MAX_FREE_DAEMON * DEFAULT_THREADS_PER_CHILD; - ap_daemons_limit = HARD_SERVER_LIMIT; - ap_threads_per_child = DEFAULT_THREADS_PER_CHILD; - ap_pid_fname = DEFAULT_PIDLOG; - ap_scoreboard_fname = DEFAULT_SCOREBOARD; - lock_fname = DEFAULT_LOCKFILE; - ap_max_requests_per_child = DEFAULT_MAX_REQUESTS_PER_CHILD; - ap_extended_status = 0; - - apr_cpystrn(ap_coredump_dir, ap_server_root, sizeof(ap_coredump_dir)); -} - -static void worker_hooks(apr_pool_t *p) -{ - one_process = 0; - - ap_hook_pre_config(worker_pre_config, NULL, NULL, APR_HOOK_MIDDLE); -} - - -static const char *set_pidfile(cmd_parms *cmd, void *dummy, const char *arg) -{ - const char *err = ap_check_cmd_context(cmd, GLOBAL_ONLY); - if (err != NULL) { - return err; - } - - if (cmd->server->is_virtual) { - return "PidFile directive not allowed in "; - } - ap_pid_fname = arg; - return NULL; -} - -static const char *set_scoreboard(cmd_parms *cmd, void *dummy, - const char *arg) -{ - const char *err = ap_check_cmd_context(cmd, GLOBAL_ONLY); - if (err != NULL) { - return err; - } - - ap_scoreboard_fname = arg; - return NULL; -} - -static const char *set_lockfile(cmd_parms *cmd, void *dummy, const char *arg) -{ - const char *err = ap_check_cmd_context(cmd, GLOBAL_ONLY); - if (err != NULL) { - return err; - } - - lock_fname = arg; - return NULL; -} - -static const char *set_daemons_to_start(cmd_parms *cmd, void *dummy, - const char *arg) -{ - const char *err = ap_check_cmd_context(cmd, GLOBAL_ONLY); - if (err != NULL) { - return err; - } - - ap_daemons_to_start = atoi(arg); - return NULL; -} - -static const char *set_min_spare_threads(cmd_parms *cmd, void *dummy, - const char *arg) -{ - const char *err = ap_check_cmd_context(cmd, GLOBAL_ONLY); - if (err != NULL) { - return err; - } - - min_spare_threads = atoi(arg); - if (min_spare_threads <= 0) { - ap_log_error(APLOG_MARK, APLOG_STARTUP | APLOG_NOERRNO, 0, NULL, - "WARNING: detected MinSpareThreads set to non-positive."); - ap_log_error(APLOG_MARK, APLOG_STARTUP | APLOG_NOERRNO, 0, NULL, - "Resetting to 1 to avoid almost certain Apache failure."); - ap_log_error(APLOG_MARK, APLOG_STARTUP | APLOG_NOERRNO, 0, NULL, - "Please read the documentation."); - min_spare_threads = 1; - } - - return NULL; -} - -static const char *set_max_spare_threads(cmd_parms *cmd, void *dummy, - const char *arg) -{ - const char *err = ap_check_cmd_context(cmd, GLOBAL_ONLY); - if (err != NULL) { - return err; - } - - max_spare_threads = atoi(arg); - return NULL; -} - -static const char *set_server_limit (cmd_parms *cmd, void *dummy, - const char *arg) -{ - const char *err = ap_check_cmd_context(cmd, GLOBAL_ONLY); - if (err != NULL) { - return err; - } - - ap_daemons_limit = atoi(arg); - if (ap_daemons_limit > HARD_SERVER_LIMIT) { - ap_log_error(APLOG_MARK, APLOG_STARTUP | APLOG_NOERRNO, 0, NULL, - "WARNING: MaxClients of %d exceeds compile time limit " - "of %d servers,", ap_daemons_limit, HARD_SERVER_LIMIT); - ap_log_error(APLOG_MARK, APLOG_STARTUP | APLOG_NOERRNO, 0, NULL, - " lowering MaxClients to %d. To increase, please " - "see the", HARD_SERVER_LIMIT); - ap_log_error(APLOG_MARK, APLOG_STARTUP | APLOG_NOERRNO, 0, NULL, - " HARD_SERVER_LIMIT define in %s.", - AP_MPM_HARD_LIMITS_FILE); - ap_daemons_limit = HARD_SERVER_LIMIT; - } - else if (ap_daemons_limit < 1) { - ap_log_error(APLOG_MARK, APLOG_STARTUP | APLOG_NOERRNO, 0, NULL, "WARNING: Require MaxClients > 0, setting to 1"); - ap_daemons_limit = 1; - } - return NULL; -} - -static const char *set_threads_per_child (cmd_parms *cmd, void *dummy, - const char *arg) -{ - const char *err = ap_check_cmd_context(cmd, GLOBAL_ONLY); - if (err != NULL) { - return err; - } - - ap_threads_per_child = atoi(arg); - if (ap_threads_per_child > HARD_THREAD_LIMIT) { - ap_log_error(APLOG_MARK, APLOG_STARTUP | APLOG_NOERRNO, 0, NULL, - "WARNING: ThreadsPerChild of %d exceeds compile time " - "limit of %d threads,", ap_threads_per_child, - HARD_THREAD_LIMIT); - ap_log_error(APLOG_MARK, APLOG_STARTUP | APLOG_NOERRNO, 0, NULL, - " lowering ThreadsPerChild to %d. To increase, please" - " see the", HARD_THREAD_LIMIT); - ap_log_error(APLOG_MARK, APLOG_STARTUP | APLOG_NOERRNO, 0, NULL, - " HARD_THREAD_LIMIT define in %s.", - AP_MPM_HARD_LIMITS_FILE); - ap_threads_per_child = HARD_THREAD_LIMIT; - } - else if (ap_threads_per_child < 1) { - ap_log_error(APLOG_MARK, APLOG_STARTUP | APLOG_NOERRNO, 0, NULL, - "WARNING: Require ThreadsPerChild > 0, setting to 1"); - ap_threads_per_child = 1; - } - return NULL; -} - -static const char *set_max_requests(cmd_parms *cmd, void *dummy, - const char *arg) -{ - const char *err = ap_check_cmd_context(cmd, GLOBAL_ONLY); - if (err != NULL) { - return err; - } - - ap_max_requests_per_child = atoi(arg); - - return NULL; -} - -static const char *set_coredumpdir (cmd_parms *cmd, void *dummy, - const char *arg) -{ - apr_finfo_t finfo; - const char *fname; - const char *err = ap_check_cmd_context(cmd, GLOBAL_ONLY); - if (err != NULL) { - return err; - } - - fname = ap_server_root_relative(cmd->pool, arg); - if ((apr_stat(&finfo, fname, APR_FINFO_TYPE, cmd->pool) != APR_SUCCESS) - || (finfo.filetype != APR_DIR)) { - return apr_pstrcat(cmd->pool, "CoreDumpDirectory ", fname, - " does not exist or is not a directory", NULL); - } - apr_cpystrn(ap_coredump_dir, fname, sizeof(ap_coredump_dir)); - return NULL; -} - -static const char *set_accept_lock_mech(cmd_parms *cmd, void *dummy, const char *arg) -{ - const char *err = ap_check_cmd_context(cmd, GLOBAL_ONLY); - if (err != NULL) { - return err; - } - - if (!strcasecmp(arg, "default")) { - accept_lock_mech = APR_LOCK_DEFAULT; - } -#if APR_HAS_FLOCK_SERIALIZE - else if (!strcasecmp(arg, "flock")) { - accept_lock_mech = APR_LOCK_FLOCK; - } -#endif -#if APR_HAS_FCNTL_SERIALIZE - else if (!strcasecmp(arg, "fcntl")) { - accept_lock_mech = APR_LOCK_FCNTL; - } -#endif -#if APR_HAS_SYSVSEM_SERIALIZE - else if (!strcasecmp(arg, "sysvsem")) { - accept_lock_mech = APR_LOCK_SYSVSEM; - } -#endif -#if APR_HAS_PROC_PTHREAD_SERIALIZE - else if (!strcasecmp(arg, "proc_pthread")) { - accept_lock_mech = APR_LOCK_PROC_PTHREAD; - } -#endif - else { - return apr_pstrcat(cmd->pool, arg, " is an invalid mutex mechanism; valid " - "ones for this platform are: default" -#if APR_HAS_FLOCK_SERIALIZE - ", flock" -#endif -#if APR_HAS_FCNTL_SERIALIZE - ", fcntl" -#endif -#if APR_HAS_SYSVSEM_SERIALIZE - ", sysvsem" -#endif -#if APR_HAS_PROC_PTHREAD_SERIALIZE - ", proc_pthread" -#endif - , NULL); - } - return NULL; -} - -static const command_rec worker_cmds[] = { -UNIX_DAEMON_COMMANDS -LISTEN_COMMANDS -AP_INIT_TAKE1("PidFile", set_pidfile, NULL, RSRC_CONF, - "A file for logging the server process ID"), -AP_INIT_TAKE1("ScoreBoardFile", set_scoreboard, NULL, RSRC_CONF, - "A file for Apache to maintain runtime process management information"), -AP_INIT_TAKE1("LockFile", set_lockfile, NULL, RSRC_CONF, - "The lockfile used when Apache needs to lock the accept() call"), -AP_INIT_TAKE1("StartServers", set_daemons_to_start, NULL, RSRC_CONF, - "Number of child processes launched at server startup"), -AP_INIT_TAKE1("MinSpareThreads", set_min_spare_threads, NULL, RSRC_CONF, - "Minimum number of idle children, to handle request spikes"), -AP_INIT_TAKE1("MaxSpareThreads", set_max_spare_threads, NULL, RSRC_CONF, - "Maximum number of idle children"), -AP_INIT_TAKE1("MaxClients", set_server_limit, NULL, RSRC_CONF, - "Maximum number of children alive at the same time"), -AP_INIT_TAKE1("ThreadsPerChild", set_threads_per_child, NULL, RSRC_CONF, - "Number of threads each child creates"), -AP_INIT_TAKE1("MaxRequestsPerChild", set_max_requests, NULL, RSRC_CONF, - "Maximum number of requests a particular child serves before dying."), -AP_INIT_TAKE1("CoreDumpDirectory", set_coredumpdir, NULL, RSRC_CONF, - "The location of the directory Apache changes to before dumping core"), -AP_INIT_TAKE1("AcceptMutex", set_accept_lock_mech, NULL, RSRC_CONF, - "The system mutex implementation to use for the accept mutex"), -{ NULL } -}; - -module AP_MODULE_DECLARE_DATA mpm_worker_module = { - MPM20_MODULE_STUFF, - NULL, /* hook to run before apache parses args */ - NULL, /* create per-directory config structure */ - NULL, /* merge per-directory config structures */ - NULL, /* create per-server config structure */ - NULL, /* merge per-server config structures */ - worker_cmds, /* command apr_table_t */ - worker_hooks /* register_hooks */ -}; - diff --git a/server/mpm_common.c b/server/mpm_common.c deleted file mode 100644 index 3201b4c72bdc60b87ef4e4e9ed2d7951bfaba2f5..0000000000000000000000000000000000000000 --- a/server/mpm_common.c +++ /dev/null @@ -1,170 +0,0 @@ -/* ==================================================================== - * The Apache Software License, Version 1.1 - * - * Copyright (c) 2000 The Apache Software Foundation. All rights - * reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in - * the documentation and/or other materials provided with the - * distribution. - * - * 3. The end-user documentation included with the redistribution, - * if any, must include the following acknowledgment: - * "This product includes software developed by the - * Apache Software Foundation (http://www.apache.org/)." - * Alternately, this acknowledgment may appear in the software itself, - * if and wherever such third-party acknowledgments normally appear. - * - * 4. The names "Apache" and "Apache Software Foundation" must - * not be used to endorse or promote products derived from this - * software without prior written permission. For written - * permission, please contact apache@apache.org. - * - * 5. Products derived from this software may not be called "Apache", - * nor may "Apache" appear in their name, without prior written - * permission of the Apache Software Foundation. - * - * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED - * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES - * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR - * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF - * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND - * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, - * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT - * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * ==================================================================== - * - * This software consists of voluntary contributions made by many - * individuals on behalf of the Apache Software Foundation. For more - * information on the Apache Software Foundation, please see - * . - * - * Portions of this software are based upon public domain software - * originally written at the National Center for Supercomputing Applications, - * University of Illinois, Urbana-Champaign. - */ - -/* The purpose of this file is to store the code that MOST mpm's will need - * this does not mean a function only goes into this file if every MPM needs - * it. It means that if a function is needed by more than one MPM, and - * future maintenance would be served by making the code common, then the - * function belongs here. - * - * This is going in src/main because it is not platform specific, it is - * specific to multi-process servers, but NOT to Unix. Which is why it - * does not belong in src/os/unix - */ - -#include "apr_thread_proc.h" -#include "httpd.h" -#include "http_config.h" -#include "http_log.h" -#include "mpm.h" - -#ifdef DEXTER_MPM -#define CHILD_INFO_TABLE ap_child_table -#elif defined(MPMT_PTHREAD_MPM) || defined (PREFORK_MPM) -#define CHILD_INFO_TABLE ap_scoreboard_image->parent -#endif - - -void ap_reclaim_child_processes(int terminate) -{ - int i, status; - long int waittime = 1024 * 16; /* in usecs */ - struct timeval tv; - int waitret, tries; - int not_dead_yet; - -#ifndef DEXTER_MPM - ap_sync_scoreboard_image(); -#endif - - for (tries = terminate ? 4 : 1; tries <= 9; ++tries) { - /* don't want to hold up progress any more than - * necessary, but we need to allow children a few moments to exit. - * Set delay with an exponential backoff. - */ - tv.tv_sec = waittime / 1000000; - tv.tv_usec = waittime % 1000000; - waittime = waittime * 4; - ap_select(0, NULL, NULL, NULL, &tv); - - /* now see who is done */ - not_dead_yet = 0; - for (i = 0; i < ap_max_daemons_limit; ++i) { - int pid = CHILD_INFO_TABLE[i].pid; - -#ifdef DEXTER_MPM - if (ap_child_table[i].status == SERVER_DEAD) -#elif defined(MPMT_PTHREAD_MPM) || defined (PREFORK_MPM) - if (pid == ap_my_pid || pid == 0) -#endif - continue; - - waitret = waitpid(pid, &status, WNOHANG); - if (waitret == pid || waitret == -1) { -#ifdef DEXTER_MPM - ap_child_table[i].status = SERVER_DEAD; -#elif defined(MPMT_PTHREAD_MPM) || defined(PREFORK_MPM) - ap_scoreboard_image->parent[i].pid = 0; -#endif - continue; - } - ++not_dead_yet; - switch (tries) { - case 1: /* 16ms */ - case 2: /* 82ms */ - break; - case 3: /* 344ms */ - case 4: /* 16ms */ - case 5: /* 82ms */ - case 6: /* 344ms */ - case 7: /* 1.4sec */ - /* ok, now it's being annoying */ - ap_log_error(APLOG_MARK, APLOG_NOERRNO|APLOG_WARNING, - 0, ap_server_conf, - "child process %d still did not exit, sending a SIGTERM", - pid); - kill(pid, SIGTERM); - break; - case 8: /* 6 sec */ - /* die child scum */ - ap_log_error(APLOG_MARK, APLOG_NOERRNO|APLOG_ERR, 0, ap_server_conf, - "child process %d still did not exit, sending a SIGKILL", - pid); - kill(pid, SIGKILL); - break; - case 9: /* 14 sec */ - /* gave it our best shot, but alas... If this really - * is a child we are trying to kill and it really hasn't - * exited, we will likely fail to bind to the port - * after the restart. - */ - ap_log_error(APLOG_MARK, APLOG_NOERRNO|APLOG_ERR, 0, ap_server_conf, - "could not make child process %d exit, " - "attempting to continue anyway", pid); - break; - } - } - ap_check_other_child(); - if (!not_dead_yet) { - /* nothing left to wait for */ - break; - } - } -} - - diff --git a/server/protocol.c b/server/protocol.c deleted file mode 100644 index f3b1e7e685b33c1aa08076f66d8e5efabad70c62..0000000000000000000000000000000000000000 --- a/server/protocol.c +++ /dev/null @@ -1,1594 +0,0 @@ -/* ==================================================================== - * The Apache Software License, Version 1.1 - * - * Copyright (c) 2000-2001 The Apache Software Foundation. All rights - * reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in - * the documentation and/or other materials provided with the - * distribution. - * - * 3. The end-user documentation included with the redistribution, - * if any, must include the following acknowledgment: - * "This product includes software developed by the - * Apache Software Foundation (http://www.apache.org/)." - * Alternately, this acknowledgment may appear in the software itself, - * if and wherever such third-party acknowledgments normally appear. - * - * 4. The names "Apache" and "Apache Software Foundation" must - * not be used to endorse or promote products derived from this - * software without prior written permission. For written - * permission, please contact apache@apache.org. - * - * 5. Products derived from this software may not be called "Apache", - * nor may "Apache" appear in their name, without prior written - * permission of the Apache Software Foundation. - * - * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED - * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES - * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR - * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF - * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND - * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, - * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT - * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * ==================================================================== - * - * This software consists of voluntary contributions made by many - * individuals on behalf of the Apache Software Foundation. For more - * information on the Apache Software Foundation, please see - * . - * - * Portions of this software are based upon public domain software - * originally written at the National Center for Supercomputing Applications, - * University of Illinois, Urbana-Champaign. - */ - -/* - * http_protocol.c --- routines which directly communicate with the client. - * - * Code originally by Rob McCool; much redone by Robert S. Thau - * and the Apache Software Foundation. - */ - -#include "apr.h" -#include "apr_strings.h" -#include "apr_buckets.h" -#include "apr_lib.h" -#include "apr_signal.h" - -#define APR_WANT_STDIO /* for sscanf */ -#define APR_WANT_STRFUNC -#define APR_WANT_MEMFUNC -#include "apr_want.h" - -#define CORE_PRIVATE -#include "util_filter.h" -#include "ap_config.h" -#include "httpd.h" -#include "http_config.h" -#include "http_core.h" -#include "http_protocol.h" -#include "http_main.h" -#include "http_request.h" -#include "http_vhost.h" -#include "http_log.h" /* For errors detected in basic auth common - * support code... */ -#include "util_date.h" /* For parseHTTPdate and BAD_DATE */ -#include "util_charset.h" -#include "util_ebcdic.h" - -#if APR_HAVE_STDARG_H -#include -#endif -#if APR_HAVE_UNISTD_H -#include -#endif - - -APR_HOOK_STRUCT( - APR_HOOK_LINK(post_read_request) - APR_HOOK_LINK(log_transaction) - APR_HOOK_LINK(http_method) - APR_HOOK_LINK(default_port) -) - -/* - * Builds the content-type that should be sent to the client from the - * content-type specified. The following rules are followed: - * - if type is NULL, type is set to ap_default_type(r) - * - if charset adding is disabled, stop processing and return type. - * - then, if there are no parameters on type, add the default charset - * - return type - */ -const char *ap_make_content_type(request_rec *r, const char *type) -{ - static const char *needcset[] = { - "text/plain", - "text/html", - NULL }; - const char **pcset; - core_dir_config *conf = - (core_dir_config *)ap_get_module_config(r->per_dir_config, - &core_module); - - if (!type) { - type = ap_default_type(r); - } - if (conf->add_default_charset != ADD_DEFAULT_CHARSET_ON) { - return type; - } - - if (ap_strcasestr(type, "charset=") != NULL) { - /* already has parameter, do nothing */ - /* XXX we don't check the validity */ - ; - } - else { - /* see if it makes sense to add the charset. At present, - * we only add it if the Content-type is one of needcset[] - */ - for (pcset = needcset; *pcset ; pcset++) { - if (ap_strcasestr(type, *pcset) != NULL) { - type = apr_pstrcat(r->pool, type, "; charset=", - conf->add_default_charset_name, NULL); - break; - } - } - } - return type; -} - -static int parse_byterange(char *range, apr_off_t clength, - apr_off_t *start, apr_off_t *end) -{ - char *dash = strchr(range, '-'); - - if (!dash) - return 0; - - if ((dash == range)) { - /* In the form "-5" */ - *start = clength - atol(dash + 1); - *end = clength - 1; - } - else { - *dash = '\0'; - dash++; - *start = atol(range); - if (*dash) - *end = atol(dash); - else /* "5-" */ - *end = clength - 1; - } - - if (*start < 0) - *start = 0; - - if (*end >= clength) - *end = clength - 1; - - if (*start > *end) - return -1; - - return (*start > 0 || *end < clength); -} - -static int ap_set_byterange(request_rec *r); - -typedef struct byterange_ctx { - apr_bucket_brigade *bb; - int num_ranges; - const char *orig_ct; -} byterange_ctx; - -/* - * Here we try to be compatible with clients that want multipart/x-byteranges - * instead of multipart/byteranges (also see above), as per HTTP/1.1. We - * look for the Request-Range header (e.g. Netscape 2 and 3) as an indication - * that the browser supports an older protocol. We also check User-Agent - * for Microsoft Internet Explorer 3, which needs this as well. - */ -static int use_range_x(request_rec *r) -{ - const char *ua; - return (apr_table_get(r->headers_in, "Request-Range") || - ((ua = apr_table_get(r->headers_in, "User-Agent")) - && ap_strstr_c(ua, "MSIE 3"))); -} - -#define BYTERANGE_FMT "%" APR_OFF_T_FMT "-%" APR_OFF_T_FMT "/%" APR_OFF_T_FMT - -AP_CORE_DECLARE_NONSTD(apr_status_t) ap_byterange_filter( - ap_filter_t *f, - apr_bucket_brigade *bb) -{ -#define MIN_LENGTH(len1, len2) ((len1 > len2) ? len2 : len1) - request_rec *r = f->r; - byterange_ctx *ctx = f->ctx; - apr_bucket *e; - apr_bucket_brigade *bsend; - apr_off_t range_start; - apr_off_t range_end; - char *current; - char *bound_head; - apr_ssize_t bb_length; - apr_off_t clength = 0; - apr_status_t rv; - int found = 0; - - if (!ctx) { - int num_ranges = ap_set_byterange(r); - - if (num_ranges == -1) { - ap_remove_output_filter(f); - bsend = apr_brigade_create(r->pool); - e = ap_bucket_error_create(HTTP_RANGE_NOT_SATISFIABLE, NULL, r->pool); - APR_BRIGADE_INSERT_TAIL(bsend, e); - e = apr_bucket_eos_create(); - APR_BRIGADE_INSERT_TAIL(bsend, e); - return ap_pass_brigade(f->next, bsend); - } - if (num_ranges == 0) { - ap_remove_output_filter(f); - return ap_pass_brigade(f->next, bb); - } - - ctx = f->ctx = apr_pcalloc(r->pool, sizeof(*ctx)); - ctx->num_ranges = num_ranges; - - if (num_ranges > 1) { - ctx->orig_ct = r->content_type; - r->content_type = - apr_pstrcat(r->pool, "multipart", use_range_x(r) ? "/x-" : "/", - "byteranges; boundary=", r->boundary, NULL); - } - - /* create a brigade in case we never call ap_save_brigade() */ - ctx->bb = apr_brigade_create(r->pool); - } - - /* We can't actually deal with byte-ranges until we have the whole brigade - * because the byte-ranges can be in any order, and according to the RFC, - * we SHOULD return the data in the same order it was requested. - */ - if (!APR_BUCKET_IS_EOS(APR_BRIGADE_LAST(bb))) { - ap_save_brigade(f, &ctx->bb, &bb); - return APR_SUCCESS; - } - - /* compute this once (it is an invariant) */ - bound_head = apr_pstrcat(r->pool, - CRLF "--", r->boundary, - CRLF "Content-type: ", - ap_make_content_type(r, ctx->orig_ct), - CRLF "Content-range: bytes ", - NULL); - ap_xlate_proto_to_ascii(bound_head, strlen(bound_head)); - - /* If we have a saved brigade from a previous run, concat the passed - * brigade with our saved brigade. Otherwise just continue. - */ - if (ctx->bb) { - APR_BRIGADE_CONCAT(ctx->bb, bb); - bb = ctx->bb; - ctx->bb = NULL; /* ### strictly necessary? call brigade_destroy? */ - } - - /* It is possible that we won't have a content length yet, so we have to - * compute the length before we can actually do the byterange work. - */ - (void) apr_brigade_length(bb, 1, &bb_length); - clength = (apr_off_t)bb_length; - - /* this brigade holds what we will be sending */ - bsend = apr_brigade_create(r->pool); - - while ((current = ap_getword(r->pool, &r->range, ',')) && - (rv = parse_byterange(current, clength, &range_start, &range_end))) { - apr_bucket *e2; - apr_bucket *ec; - - if (rv == -1) { - continue; - } - else { - found = 1; - } - - if (ctx->num_ranges > 1) { - char *ts; - - e = apr_bucket_pool_create(bound_head, - strlen(bound_head), r->pool); - APR_BRIGADE_INSERT_TAIL(bsend, e); - - ts = apr_psprintf(r->pool, BYTERANGE_FMT CRLF CRLF, - range_start, range_end, clength); - ap_xlate_proto_to_ascii(ts, strlen(ts)); - e = apr_bucket_pool_create(ts, strlen(ts), r->pool); - APR_BRIGADE_INSERT_TAIL(bsend, e); - } - - e = apr_brigade_partition(bb, range_start); - e2 = apr_brigade_partition(bb, range_end + 1); - - ec = e; - do { - apr_bucket *foo; - const char *str; - apr_size_t len; - - if (apr_bucket_copy(ec, &foo) != APR_SUCCESS) { - apr_bucket_read(ec, &str, &len, APR_BLOCK_READ); - foo = apr_bucket_heap_create(str, len, 0, NULL); - } - APR_BRIGADE_INSERT_TAIL(bsend, foo); - ec = APR_BUCKET_NEXT(ec); - } while (ec != e2); - } - - if (found == 0) { - ap_remove_output_filter(f); - r->status = HTTP_OK; - return HTTP_RANGE_NOT_SATISFIABLE; - } - - if (ctx->num_ranges > 1) { - char *end; - - /* add the final boundary */ - end = apr_pstrcat(r->pool, CRLF "--", r->boundary, "--" CRLF, NULL); - ap_xlate_proto_to_ascii(end, strlen(end)); - e = apr_bucket_pool_create(end, strlen(end), r->pool); - APR_BRIGADE_INSERT_TAIL(bsend, e); - } - - e = apr_bucket_eos_create(); - APR_BRIGADE_INSERT_TAIL(bsend, e); - - /* we're done with the original content */ - apr_brigade_destroy(bb); - - /* send our multipart output */ - return ap_pass_brigade(f->next, bsend); -} - -AP_DECLARE(void) ap_set_content_length(request_rec *r, apr_off_t clength) -{ - r->clength = clength; - apr_table_setn(r->headers_out, "Content-Length", - apr_psprintf(r->pool, "%" APR_OFF_T_FMT, clength)); -} - -/* - * Return the latest rational time from a request/mtime (modification time) - * pair. We return the mtime unless it's in the future, in which case we - * return the current time. We use the request time as a reference in order - * to limit the number of calls to time(). We don't check for futurosity - * unless the mtime is at least as new as the reference. - */ -AP_DECLARE(apr_time_t) ap_rationalize_mtime(request_rec *r, apr_time_t mtime) -{ - apr_time_t now; - - /* For all static responses, it's almost certain that the file was - * last modified before the beginning of the request. So there's - * no reason to call time(NULL) again. But if the response has been - * created on demand, then it might be newer than the time the request - * started. In this event we really have to call time(NULL) again - * so that we can give the clients the most accurate Last-Modified. If we - * were given a time in the future, we return the current time - the - * Last-Modified can't be in the future. - */ - now = (mtime < r->request_time) ? r->request_time : apr_time_now(); - return (mtime > now) ? now : mtime; -} - -/* - * Construct an entity tag (ETag) from resource information. If it's a real - * file, build in some of the file characteristics. If the modification time - * is newer than (request-time minus 1 second), mark the ETag as weak - it - * could be modified again in as short an interval. We rationalize the - * modification time we're given to keep it from being in the future. - */ -AP_DECLARE(char *) ap_make_etag(request_rec *r, int force_weak) -{ - char *etag; - char *weak; - - /* - * Make an ETag header out of various pieces of information. We use - * the last-modified date and, if we have a real file, the - * length and inode number - note that this doesn't have to match - * the content-length (i.e. includes), it just has to be unique - * for the file. - * - * If the request was made within a second of the last-modified date, - * we send a weak tag instead of a strong one, since it could - * be modified again later in the second, and the validation - * would be incorrect. - */ - - weak = ((r->request_time - r->mtime > APR_USEC_PER_SEC) - && !force_weak) ? "" : "W/"; - - if (r->finfo.filetype != 0) { - etag = apr_psprintf(r->pool, - "%s\"%lx-%lx-%lx\"", weak, - (unsigned long) r->finfo.inode, - (unsigned long) r->finfo.size, - (unsigned long) r->mtime); - } - else { - etag = apr_psprintf(r->pool, "%s\"%lx\"", weak, - (unsigned long) r->mtime); - } - - return etag; -} - -AP_DECLARE(void) ap_set_etag(request_rec *r) -{ - char *etag; - char *variant_etag, *vlv; - int vlv_weak; - - if (!r->vlist_validator) { - etag = ap_make_etag(r, 0); - } - else { - /* If we have a variant list validator (vlv) due to the - * response being negotiated, then we create a structured - * entity tag which merges the variant etag with the variant - * list validator (vlv). This merging makes revalidation - * somewhat safer, ensures that caches which can deal with - * Vary will (eventually) be updated if the set of variants is - * changed, and is also a protocol requirement for transparent - * content negotiation. - */ - - /* if the variant list validator is weak, we make the whole - * structured etag weak. If we would not, then clients could - * have problems merging range responses if we have different - * variants with the same non-globally-unique strong etag. - */ - - vlv = r->vlist_validator; - vlv_weak = (vlv[0] == 'W'); - - variant_etag = ap_make_etag(r, vlv_weak); - - /* merge variant_etag and vlv into a structured etag */ - - variant_etag[strlen(variant_etag) - 1] = '\0'; - if (vlv_weak) - vlv += 3; - else - vlv++; - etag = apr_pstrcat(r->pool, variant_etag, ";", vlv, NULL); - } - - apr_table_setn(r->headers_out, "ETag", etag); -} - -/* Get a line of protocol input, including any continuation lines - * caused by MIME folding (or broken clients) if fold != 0, and place it - * in the buffer s, of size n bytes, without the ending newline. - * - * Returns -1 on error, or the length of s. - * - * Notes: Because the buffer uses 1 char for NUL, the most we can return is - * (n - 1) actual characters. - * - * If no LF is detected on the last line due to a dropped connection - * or a full buffer, that's considered an error. - */ -AP_CORE_DECLARE(int) ap_getline(char *s, int n, request_rec *r, int fold) -{ - char *pos = s; - char *last_char; - char *beyond_buff = s + n; - const char *temp; - int retval; - int total = 0; - int looking_ahead = 0; - apr_size_t length; - conn_rec *c = r->connection; - core_request_config *req_cfg; - apr_bucket_brigade *b; - apr_bucket *e; - - req_cfg = (core_request_config *) - ap_get_module_config(r->request_config, &core_module); - b = req_cfg->bb; - /* make sure it's empty unless we're folding */ - AP_DEBUG_ASSERT(fold || APR_BRIGADE_EMPTY(b)); - - while (1) { - if (APR_BRIGADE_EMPTY(b)) { - if (ap_get_brigade(c->input_filters, b, AP_MODE_BLOCKING) != APR_SUCCESS || - APR_BRIGADE_EMPTY(b)) { - return -1; - } - } - e = APR_BRIGADE_FIRST(b); - if (e->length == 0) { - apr_bucket_delete(e); - continue; - } - retval = apr_bucket_read(e, &temp, &length, APR_BLOCK_READ); - - if (retval != APR_SUCCESS) { - total = ((length < 0) && (total == 0)) ? -1 : total; - break; - } - - if ((looking_ahead) && (*temp != APR_ASCII_BLANK) && (*temp != APR_ASCII_TAB)) { - /* can't fold because next line isn't indented, - * so return what we have. lookahead brigade is - * stashed on req_cfg->bb - */ - AP_DEBUG_ASSERT(!APR_BRIGADE_EMPTY(req_cfg->bb)); - break; - } - last_char = pos + length - 1; - if (last_char < beyond_buff) { - memcpy(pos, temp, length); - apr_bucket_delete(e); - } - else { - /* input line was larger than the caller's buffer */ - apr_brigade_destroy(b); - - /* don't need to worry about req_cfg->bb being bogus. - * the request is about to die, and ErrorDocument - * redirects get a new req_cfg->bb - */ - - return -1; - } - - pos = last_char; /* Point at the last character */ - - if (*pos == APR_ASCII_LF) { /* Did we get a full line of input? */ - - if (pos > s && *(pos - 1) == APR_ASCII_CR) { - --pos; /* zap optional CR before LF */ - } - - /* - * Trim any extra trailing spaces or tabs except for the first - * space or tab at the beginning of a blank string. This makes - * it much easier to check field values for exact matches, and - * saves memory as well. Terminate string at end of line. - */ - while (pos > (s + 1) && - (*(pos - 1) == APR_ASCII_BLANK || *(pos - 1) == APR_ASCII_TAB)) { - --pos; /* trim extra trailing spaces or tabs */ - } - *pos = '\0'; /* zap end of string */ - total = pos - s; /* update total string length */ - - /* look ahead another line if line folding is desired - * and this line isn't empty - */ - if (fold && total) { - looking_ahead = 1; - } - else { - AP_DEBUG_ASSERT(APR_BRIGADE_EMPTY(req_cfg->bb)); - break; - } - } - else { - /* no LF yet...character mode client (telnet)...keep going - * bump past last character read, - * and set total in case we bail before finding a LF - */ - total = ++pos - s; - looking_ahead = 0; /* only appropriate right after LF */ - } - } - ap_xlate_proto_from_ascii(s, total); - return total; -} - -/* parse_uri: break apart the uri - * Side Effects: - * - sets r->args to rest after '?' (or NULL if no '?') - * - sets r->uri to request uri (without r->args part) - * - sets r->hostname (if not set already) from request (scheme://host:port) - */ -AP_CORE_DECLARE(void) ap_parse_uri(request_rec *r, const char *uri) -{ - int status = HTTP_OK; - - r->unparsed_uri = apr_pstrdup(r->pool, uri); - - if (r->method_number == M_CONNECT) { - status = ap_parse_hostinfo_components(r->pool, uri, &r->parsed_uri); - } - else { - /* Simple syntax Errors in URLs are trapped by parse_uri_components(). */ - status = ap_parse_uri_components(r->pool, uri, &r->parsed_uri); - } - - if (ap_is_HTTP_SUCCESS(status)) { - /* if it has a scheme we may need to do absoluteURI vhost stuff */ - if (r->parsed_uri.scheme - && !strcasecmp(r->parsed_uri.scheme, ap_http_method(r))) { - r->hostname = r->parsed_uri.hostname; - } - else if (r->method_number == M_CONNECT) { - r->hostname = r->parsed_uri.hostname; - } - r->args = r->parsed_uri.query; - r->uri = r->parsed_uri.path ? r->parsed_uri.path - : apr_pstrdup(r->pool, "/"); -#if defined(OS2) || defined(WIN32) - /* Handle path translations for OS/2 and plug security hole. - * This will prevent "http://www.wherever.com/..\..\/" from - * returning a directory for the root drive. - */ - { - char *x; - - for (x = r->uri; (x = strchr(x, '\\')) != NULL; ) - *x = '/'; - } -#endif /* OS2 || WIN32 */ - } - else { - r->args = NULL; - r->hostname = NULL; - r->status = status; /* set error status */ - r->uri = apr_pstrdup(r->pool, uri); - } -} - -static int read_request_line(request_rec *r) -{ - char l[DEFAULT_LIMIT_REQUEST_LINE + 2]; /* getline's two extra for \n\0 */ - const char *ll = l; - const char *uri; -#if 0 - conn_rec *conn = r->connection; -#endif - int major = 1, minor = 0; /* Assume HTTP/1.0 if non-"HTTP" protocol */ - int len; - - /* Read past empty lines until we get a real request line, - * a read error, the connection closes (EOF), or we timeout. - * - * We skip empty lines because browsers have to tack a CRLF on to the end - * of POSTs to support old CERN webservers. But note that we may not - * have flushed any previous response completely to the client yet. - * We delay the flush as long as possible so that we can improve - * performance for clients that are pipelining requests. If a request - * is pipelined then we won't block during the (implicit) read() below. - * If the requests aren't pipelined, then the client is still waiting - * for the final buffer flush from us, and we will block in the implicit - * read(). B_SAFEREAD ensures that the BUFF layer flushes if it will - * have to block during a read. - */ - - while ((len = ap_getline(l, sizeof(l), r, 0)) <= 0) { - if (len < 0) { /* includes EOF */ - /* this is a hack to make sure that request time is set, - * it's not perfect, but it's better than nothing - */ - r->request_time = apr_time_now(); - return 0; - } - } - /* we've probably got something to do, ignore graceful restart requests */ - - /* XXX - sigwait doesn't work if the signal has been SIG_IGNed (under - * linux 2.0 w/ glibc 2.0, anyway), and this step isn't necessary when - * we're running a sigwait thread anyway. If/when unthreaded mode is - * put back in, we should make sure to ignore this signal iff a sigwait - * thread isn't used. - mvsk - -#ifdef SIGWINCH - apr_signal(SIGWINCH, SIG_IGN); -#endif - */ - - r->request_time = apr_time_now(); - r->the_request = apr_pstrdup(r->pool, l); - r->method = ap_getword_white(r->pool, &ll); - -#if 0 -/* XXX If we want to keep track of the Method, the protocol module should do - * it. That support isn't in the scoreboard yet. Hopefully next week - * sometime. rbb */ - ap_update_connection_status(AP_CHILD_THREAD_FROM_ID(conn->id), "Method", r->method); -#endif - uri = ap_getword_white(r->pool, &ll); - - /* Provide quick information about the request method as soon as known */ - - r->method_number = ap_method_number_of(r->method); - if (r->method_number == M_GET && r->method[0] == 'H') { - r->header_only = 1; - } - - ap_parse_uri(r, uri); - - /* ap_getline returns (size of max buffer - 1) if it fills up the - * buffer before finding the end-of-line. This is only going to - * happen if it exceeds the configured limit for a request-line. - */ - if (len > r->server->limit_req_line) { - r->status = HTTP_REQUEST_URI_TOO_LARGE; - r->proto_num = HTTP_VERSION(1,0); - r->protocol = apr_pstrdup(r->pool, "HTTP/1.0"); - return 0; - } - - r->assbackwards = (ll[0] == '\0'); - r->protocol = apr_pstrdup(r->pool, ll[0] ? ll : "HTTP/0.9"); -/* XXX If we want to keep track of the Method, the protocol module should do - * it. That support isn't in the scoreboard yet. Hopefully next week - * sometime. rbb - ap_update_connection_status(conn->id, "Protocol", r->protocol); - */ - - if (2 == sscanf(r->protocol, "HTTP/%u.%u", &major, &minor) - && minor < HTTP_VERSION(1,0)) /* don't allow HTTP/0.1000 */ - r->proto_num = HTTP_VERSION(major, minor); - else - r->proto_num = HTTP_VERSION(1,0); - - return 1; -} - -static void get_mime_headers(request_rec *r) -{ - char field[DEFAULT_LIMIT_REQUEST_FIELDSIZE + 2]; /* getline's two extra */ - char *value; - char *copy; - int len; - int fields_read = 0; - apr_table_t *tmp_headers; - - /* We'll use apr_table_overlap later to merge these into r->headers_in. */ - tmp_headers = apr_table_make(r->pool, 50); - - /* - * Read header lines until we get the empty separator line, a read error, - * the connection closes (EOF), reach the server limit, or we timeout. - */ - while ((len = ap_getline(field, sizeof(field), r, 1)) > 0) { - - if (r->server->limit_req_fields && - (++fields_read > r->server->limit_req_fields)) { - r->status = HTTP_BAD_REQUEST; - apr_table_setn(r->notes, "error-notes", - "The number of request header fields exceeds " - "this server's limit.

    \n"); - return; - } - /* ap_getline returns (size of max buffer - 1) if it fills up the - * buffer before finding the end-of-line. This is only going to - * happen if it exceeds the configured limit for a field size. - */ - if (len > r->server->limit_req_fieldsize) { - r->status = HTTP_BAD_REQUEST; - apr_table_setn(r->notes, "error-notes", - apr_pstrcat(r->pool, - "Size of a request header field " - "exceeds server limit.

    \n" - "

    \n",
    -				       ap_escape_html(r->pool, field),
    -				       "
    \n", NULL)); - return; - } - copy = apr_palloc(r->pool, len + 1); - memcpy(copy, field, len + 1); - - if (!(value = strchr(copy, ':'))) { /* Find the colon separator */ - r->status = HTTP_BAD_REQUEST; /* or abort the bad request */ - apr_table_setn(r->notes, "error-notes", - apr_pstrcat(r->pool, - "Request header field is missing " - "colon separator.

    \n" - "

    \n",
    -				       ap_escape_html(r->pool, copy),
    -				       "
    \n", NULL)); - return; - } - - *value = '\0'; - ++value; - while (*value == ' ' || *value == '\t') { - ++value; /* Skip to start of value */ - } - - apr_table_addn(tmp_headers, copy, value); - } - - apr_table_overlap(r->headers_in, tmp_headers, APR_OVERLAP_TABLES_MERGE); -} - -request_rec *ap_read_request(conn_rec *conn) -{ - request_rec *r; - apr_pool_t *p; - const char *expect; - int access_status; - core_request_config *req_cfg; - - apr_pool_create(&p, conn->pool); - r = apr_pcalloc(p, sizeof(request_rec)); - r->pool = p; - r->connection = conn; - r->server = conn->base_server; - - conn->keptalive = conn->keepalive == 1; - conn->keepalive = 0; - - r->user = NULL; - r->ap_auth_type = NULL; - - r->allowed_methods = ap_make_method_list(p, 2); - - r->headers_in = apr_table_make(r->pool, 50); - r->subprocess_env = apr_table_make(r->pool, 50); - r->headers_out = apr_table_make(r->pool, 12); - r->err_headers_out = apr_table_make(r->pool, 5); - r->notes = apr_table_make(r->pool, 5); - - r->request_config = ap_create_request_config(r->pool); - req_cfg = apr_pcalloc(r->pool, sizeof(core_request_config)); - req_cfg->bb = apr_brigade_create(r->pool); - ap_set_module_config(r->request_config, &core_module, req_cfg); - - r->per_dir_config = r->server->lookup_defaults; - - r->sent_bodyct = 0; /* bytect isn't for body */ - - r->read_length = 0; - r->read_body = REQUEST_NO_BODY; - - r->status = HTTP_REQUEST_TIME_OUT; /* Until we get a request */ - r->the_request = NULL; - r->output_filters = conn->output_filters; - r->input_filters = conn->input_filters; - - apr_setsocketopt(conn->client_socket, APR_SO_TIMEOUT, - (int)(conn->keptalive - ? r->server->keep_alive_timeout * APR_USEC_PER_SEC - : r->server->timeout * APR_USEC_PER_SEC)); - - ap_add_output_filter("BYTERANGE", NULL, r, r->connection); - ap_add_output_filter("CONTENT_LENGTH", NULL, r, r->connection); - ap_add_output_filter("HTTP_HEADER", NULL, r, r->connection); - - /* Get the request... */ - if (!read_request_line(r)) { - if (r->status == HTTP_REQUEST_URI_TOO_LARGE) { - ap_log_rerror(APLOG_MARK, APLOG_NOERRNO|APLOG_ERR, 0, r, - "request failed: URI too long"); - ap_send_error_response(r, 0); - ap_run_log_transaction(r); - return r; - } - return NULL; - } - if (r->connection->keptalive) { - apr_setsocketopt(r->connection->client_socket, APR_SO_TIMEOUT, - (int)(r->server->timeout * APR_USEC_PER_SEC)); - } - if (!r->assbackwards) { - get_mime_headers(r); - if (r->status != HTTP_REQUEST_TIME_OUT) { - ap_log_rerror(APLOG_MARK, APLOG_NOERRNO|APLOG_ERR, 0, r, - "request failed: error reading the headers"); - ap_send_error_response(r, 0); - ap_run_log_transaction(r); - return r; - } - } - else { - if (r->header_only) { - /* - * Client asked for headers only with HTTP/0.9, which doesn't send - * headers! Have to dink things just to make sure the error message - * comes through... - */ - ap_log_rerror(APLOG_MARK, APLOG_NOERRNO|APLOG_ERR, 0, r, - "client sent invalid HTTP/0.9 request: HEAD %s", - r->uri); - r->header_only = 0; - r->status = HTTP_BAD_REQUEST; - ap_send_error_response(r, 0); - ap_run_log_transaction(r); - return r; - } - } - - r->status = HTTP_OK; /* Until further notice. */ - - /* update what we think the virtual host is based on the headers we've - * now read. may update status. - */ - ap_update_vhost_from_headers(r); - - /* we may have switched to another server */ - r->per_dir_config = r->server->lookup_defaults; - - conn->keptalive = 0; /* We now have a request to play with */ - - if ((!r->hostname && (r->proto_num >= HTTP_VERSION(1,1))) || - ((r->proto_num == HTTP_VERSION(1,1)) && - !apr_table_get(r->headers_in, "Host"))) { - /* - * Client sent us an HTTP/1.1 or later request without telling us the - * hostname, either with a full URL or a Host: header. We therefore - * need to (as per the 1.1 spec) send an error. As a special case, - * HTTP/1.1 mentions twice (S9, S14.23) that a request MUST contain - * a Host: header, and the server MUST respond with 400 if it doesn't. - */ - r->status = HTTP_BAD_REQUEST; - ap_log_rerror(APLOG_MARK, APLOG_NOERRNO|APLOG_ERR, 0, r, - "client sent HTTP/1.1 request without hostname " - "(see RFC2616 section 14.23): %s", r->uri); - } - if (r->status != HTTP_OK) { - ap_send_error_response(r, 0); - ap_run_log_transaction(r); - return r; - } - if (((expect = apr_table_get(r->headers_in, "Expect")) != NULL) && - (expect[0] != '\0')) { - /* - * The Expect header field was added to HTTP/1.1 after RFC 2068 - * as a means to signal when a 100 response is desired and, - * unfortunately, to signal a poor man's mandatory extension that - * the server must understand or return 417 Expectation Failed. - */ - if (strcasecmp(expect, "100-continue") == 0) { - r->expecting_100 = 1; - } - else { - r->status = HTTP_EXPECTATION_FAILED; - ap_log_rerror(APLOG_MARK, APLOG_NOERRNO|APLOG_INFO, 0, r, - "client sent an unrecognized expectation value of " - "Expect: %s", expect); - ap_send_error_response(r, 0); - (void) ap_discard_request_body(r); - ap_run_log_transaction(r); - return r; - } - } - - if ((access_status = ap_run_post_read_request(r))) { - ap_die(access_status, r); - ap_run_log_transaction(r); - return NULL; - } - - return r; -} - -/* - * A couple of other functions which initialize some of the fields of - * a request structure, as appropriate for adjuncts of one kind or another - * to a request in progress. Best here, rather than elsewhere, since - * *someone* has to set the protocol-specific fields... - */ - -void ap_set_sub_req_protocol(request_rec *rnew, const request_rec *r) -{ - rnew->the_request = r->the_request; /* Keep original request-line */ - - rnew->assbackwards = 1; /* Don't send headers from this. */ - rnew->no_local_copy = 1; /* Don't try to send HTTP_NOT_MODIFIED for a - * fragment. */ - rnew->method = "GET"; - rnew->method_number = M_GET; - rnew->protocol = "INCLUDED"; - - rnew->status = HTTP_OK; - - rnew->headers_in = r->headers_in; - rnew->subprocess_env = apr_table_copy(rnew->pool, r->subprocess_env); - rnew->headers_out = apr_table_make(rnew->pool, 5); - rnew->err_headers_out = apr_table_make(rnew->pool, 5); - rnew->notes = apr_table_make(rnew->pool, 5); - - rnew->expecting_100 = r->expecting_100; - rnew->read_length = r->read_length; - rnew->read_body = REQUEST_NO_BODY; - - rnew->main = (request_rec *) r; -} - -static void end_output_stream(request_rec *r) -{ - apr_bucket_brigade *bb; - apr_bucket *b; - - bb = apr_brigade_create(r->pool); - b = apr_bucket_eos_create(); - APR_BRIGADE_INSERT_TAIL(bb, b); - ap_pass_brigade(r->output_filters, bb); -} - -void ap_finalize_sub_req_protocol(request_rec *sub) -{ - end_output_stream(sub); -} - -/* finalize_request_protocol is called at completion of sending the - * response. Its sole purpose is to send the terminating protocol - * information for any wrappers around the response message body - * (i.e., transfer encodings). It should have been named finalize_response. - */ -AP_DECLARE(void) ap_finalize_request_protocol(request_rec *r) -{ - while (r->next) { - r = r->next; - } - /* tell the filter chain there is no more content coming */ - if (!r->eos_sent) { - end_output_stream(r); - } -} - -/* - * Support for the Basic authentication protocol, and a bit for Digest. - */ - -AP_DECLARE(void) ap_note_auth_failure(request_rec *r) -{ - if (!strcasecmp(ap_auth_type(r), "Basic")) - ap_note_basic_auth_failure(r); - else if (!strcasecmp(ap_auth_type(r), "Digest")) - ap_note_digest_auth_failure(r); -} - -AP_DECLARE(void) ap_note_basic_auth_failure(request_rec *r) -{ - if (strcasecmp(ap_auth_type(r), "Basic")) - ap_note_auth_failure(r); - else - apr_table_setn(r->err_headers_out, - r->proxyreq ? "Proxy-Authenticate" : "WWW-Authenticate", - apr_pstrcat(r->pool, "Basic realm=\"", ap_auth_name(r), "\"", - NULL)); -} - -AP_DECLARE(void) ap_note_digest_auth_failure(request_rec *r) -{ - apr_table_setn(r->err_headers_out, - r->proxyreq ? "Proxy-Authenticate" : "WWW-Authenticate", - apr_psprintf(r->pool, "Digest realm=\"%s\", nonce=\"%llx\"", - ap_auth_name(r), r->request_time)); -} - -AP_DECLARE(int) ap_get_basic_auth_pw(request_rec *r, const char **pw) -{ - const char *auth_line = apr_table_get(r->headers_in, - r->proxyreq ? "Proxy-Authorization" - : "Authorization"); - const char *t; - - if (!(t = ap_auth_type(r)) || strcasecmp(t, "Basic")) - return DECLINED; - - if (!ap_auth_name(r)) { - ap_log_rerror(APLOG_MARK, APLOG_NOERRNO|APLOG_ERR, - 0, r, "need AuthName: %s", r->uri); - return HTTP_INTERNAL_SERVER_ERROR; - } - - if (!auth_line) { - ap_note_basic_auth_failure(r); - return HTTP_UNAUTHORIZED; - } - - if (strcasecmp(ap_getword(r->pool, &auth_line, ' '), "Basic")) { - /* Client tried to authenticate using wrong auth scheme */ - ap_log_rerror(APLOG_MARK, APLOG_NOERRNO|APLOG_ERR, 0, r, - "client used wrong authentication scheme: %s", r->uri); - ap_note_basic_auth_failure(r); - return HTTP_UNAUTHORIZED; - } - - while (*auth_line== ' ' || *auth_line== '\t') { - auth_line++; - } - - t = ap_pbase64decode(r->pool, auth_line); - /* Note that this allocation has to be made from r->connection->pool - * because it has the lifetime of the connection. The other allocations - * are temporary and can be tossed away any time. - */ - r->user = ap_getword_nulls (r->pool, &t, ':'); - r->ap_auth_type = "Basic"; - - *pw = t; - - return OK; -} - -struct content_length_ctx { - apr_bucket_brigade *saved; - int compute_len; - apr_size_t curr_len; -}; - -/* This filter computes the content length, but it also computes the number - * of bytes sent to the client. This means that this filter will always run - * through all of the buckets in all brigades - */ -AP_CORE_DECLARE_NONSTD(apr_status_t) ap_content_length_filter(ap_filter_t *f, - apr_bucket_brigade *b) -{ - request_rec *r = f->r; - struct content_length_ctx *ctx; - apr_status_t rv; - apr_bucket *e; - int send_it = 0; - - ctx = f->ctx; - if (!ctx) { /* first time through */ - f->ctx = ctx = apr_pcalloc(r->pool, sizeof(struct content_length_ctx)); - } - - APR_BRIGADE_FOREACH(e, b) { - const char *ignored; - apr_size_t length; - - if (APR_BUCKET_IS_EOS(e) || APR_BUCKET_IS_FLUSH(e)) { - send_it = 1; - } - if (e->length == -1) { /* if length unknown */ - rv = apr_bucket_read(e, &ignored, &length, APR_BLOCK_READ); - if (rv != APR_SUCCESS) { - return rv; - } - } - else { - length = e->length; - } - ctx->curr_len += length; - r->bytes_sent += length; - } - - if ((ctx->curr_len < AP_MIN_BYTES_TO_WRITE) && !send_it) { - return ap_save_brigade(f, &ctx->saved, &b); - } - - /* We will compute a content length if: - * We already have all the data - * This is a bit confusing, because we will always buffer up - * to AP_MIN_BYTES_TO_WRITE, so if we get all the data while - * we are buffering that much data, we set the c-l. - * or We are in a 1.1 request and we can't chunk - * or This is a keepalive connection - * We may want to change this later to just close the connection - */ - if ((r->proto_num == HTTP_VERSION(1,1) - && !ap_find_last_token(f->r->pool, - apr_table_get(r->headers_out, - "Transfer-Encoding"), - "chunked")) - || (f->r->connection->keepalive) - || (APR_BUCKET_IS_EOS(APR_BRIGADE_LAST(b)))) { - ctx->compute_len = 1; - } - else { - ctx->compute_len = 0; - } - - if (ctx->compute_len) { - /* save the brigade; we can't pass any data to the next - * filter until we have the entire content length - */ - if (!send_it) { - ap_save_brigade(f, &ctx->saved, &b); - return APR_SUCCESS; - } - ap_set_content_length(r, r->bytes_sent); - } - if (ctx->saved) { - APR_BRIGADE_CONCAT(ctx->saved, b); - apr_brigade_destroy(b); - b = ctx->saved; - ctx->saved = NULL; - } - - ctx->curr_len = 0; - return ap_pass_brigade(f->next, b); -} - -static int ap_set_byterange(request_rec *r) -{ - const char *range; - const char *if_range; - const char *match; - const char *ct; - apr_off_t range_start; - apr_off_t range_end; - int num_ranges; - - if (r->assbackwards) - return 0; - - /* Check for Range request-header (HTTP/1.1) or Request-Range for - * backwards-compatibility with second-draft Luotonen/Franks - * byte-ranges (e.g. Netscape Navigator 2-3). - * - * We support this form, with Request-Range, and (farther down) we - * send multipart/x-byteranges instead of multipart/byteranges for - * Request-Range based requests to work around a bug in Netscape - * Navigator 2-3 and MSIE 3. - */ - - if (!(range = apr_table_get(r->headers_in, "Range"))) - range = apr_table_get(r->headers_in, "Request-Range"); - - if (!range || strncasecmp(range, "bytes=", 6)) { - return 0; - } - - /* Check the If-Range header for Etag or Date. - * Note that this check will return false (as required) if either - * of the two etags are weak. - */ - if ((if_range = apr_table_get(r->headers_in, "If-Range"))) { - if (if_range[0] == '"') { - if (!(match = apr_table_get(r->headers_out, "Etag")) || - (strcmp(if_range, match) != 0)) - return 0; - } - else if (!(match = apr_table_get(r->headers_out, "Last-Modified")) || - (strcmp(if_range, match) != 0)) - return 0; - } - - /* would be nice to pick this up from f->ctx */ - ct = ap_make_content_type(r, r->content_type); - - if (!ap_strchr_c(range, ',')) { - int rv; - /* A single range */ - - /* rvarse_byterange() modifies the contents, so make a copy */ - if ((rv = parse_byterange(apr_pstrdup(r->pool, range + 6), r->clength, - &range_start, &range_end)) <= 0) { - return rv; - } - apr_table_setn(r->headers_out, "Content-Range", - apr_psprintf(r->pool, "bytes " BYTERANGE_FMT, - range_start, range_end, r->clength)); - apr_table_setn(r->headers_out, "Content-Type", ct); - - num_ranges = 1; - } - else { - /* a multiple range */ - - num_ranges = 2; - - /* ### it would be nice if r->boundary was in f->ctx */ - r->boundary = apr_psprintf(r->pool, "%qx%lx", - r->request_time, (long) getpid()); - - apr_table_setn(r->headers_out, "Content-Type", - apr_pstrcat(r->pool, - "multipart", use_range_x(r) ? "/x-" : "/", - "byteranges; boundary=", r->boundary, - NULL)); - } - - r->status = HTTP_PARTIAL_CONTENT; - r->range = range + 6; - - return num_ranges; -} - -/* - * Send the body of a response to the client. - */ -AP_DECLARE(apr_status_t) ap_send_fd(apr_file_t *fd, request_rec *r, apr_off_t offset, - apr_size_t len, apr_size_t *nbytes) -{ - apr_bucket_brigade *bb = NULL; - apr_bucket *b; - apr_status_t rv; - - bb = apr_brigade_create(r->pool); - b = apr_bucket_file_create(fd, offset, len); - APR_BRIGADE_INSERT_TAIL(bb, b); - - rv = ap_pass_brigade(r->output_filters, bb); - if (rv != APR_SUCCESS) { - *nbytes = 0; /* no way to tell how many were actually sent */ - } - else { - *nbytes = len; - } - - return rv; -} - -#if APR_HAS_MMAP -/* send data from an in-memory buffer */ -AP_DECLARE(size_t) ap_send_mmap(apr_mmap_t *mm, request_rec *r, size_t offset, - size_t length) -{ - apr_bucket_brigade *bb = NULL; - apr_bucket *b; - - bb = apr_brigade_create(r->pool); - b = apr_bucket_mmap_create(mm, offset, length); - APR_BRIGADE_INSERT_TAIL(bb, b); - ap_pass_brigade(r->output_filters, bb); - - return mm->size; /* XXX - change API to report apr_status_t? */ -} -#endif /* APR_HAS_MMAP */ - -typedef struct { - char *buf; - char *cur; - apr_size_t avail; -} old_write_filter_ctx; - -AP_CORE_DECLARE_NONSTD(apr_status_t) ap_old_write_filter( - ap_filter_t *f, apr_bucket_brigade *bb) -{ - old_write_filter_ctx *ctx = f->ctx; - - AP_DEBUG_ASSERT(ctx); - - if (ctx->buf != NULL) { - apr_size_t nbyte = ctx->cur - ctx->buf; - - if (nbyte != 0) { - /* whatever is coming down the pipe (we don't care), we - can simply insert our buffered data at the front and - pass the whole bundle down the chain. */ - apr_bucket *b = apr_bucket_heap_create(ctx->buf, nbyte, 0, NULL); - APR_BRIGADE_INSERT_HEAD(bb, b); - ctx->buf = NULL; - } - } - - return ap_pass_brigade(f->next, bb); -} - -static apr_status_t flush_buffer(request_rec *r, old_write_filter_ctx *ctx, - const char *extra, apr_size_t extra_len) -{ - apr_bucket_brigade *bb = apr_brigade_create(r->pool); - apr_size_t nbyte = ctx->cur - ctx->buf; - apr_bucket *b = apr_bucket_heap_create(ctx->buf, nbyte, 0, NULL); - - APR_BRIGADE_INSERT_TAIL(bb, b); - ctx->buf = NULL; - - /* if there is extra data, then send that, too */ - if (extra != NULL) { - b = apr_bucket_transient_create(extra, extra_len); - APR_BRIGADE_INSERT_TAIL(bb, b); - } - - return ap_pass_brigade(r->output_filters, bb); -} - -static apr_status_t buffer_output(request_rec *r, - const char *str, apr_size_t len) -{ - ap_filter_t *f; - old_write_filter_ctx *ctx; - apr_size_t amt; - apr_status_t status; - - if (len == 0) - return APR_SUCCESS; - - /* ### future optimization: record some flags in the request_rec to - ### say whether we've added our filter, and whether it is first. */ - - /* this will typically exit on the first test */ - for (f = r->output_filters; f != NULL; f = f->next) - if (strcmp("OLD_WRITE", f->frec->name) == 0) - break; - if (f == NULL) { - /* our filter hasn't been added yet */ - ctx = apr_pcalloc(r->pool, sizeof(*ctx)); - ap_add_output_filter("OLD_WRITE", ctx, r, r->connection); - } - - /* if the first filter is not our buffering filter, then we have to - deliver the content through the normal filter chain */ - if (strcmp("OLD_WRITE", r->output_filters->frec->name) != 0) { - apr_bucket_brigade *bb = apr_brigade_create(r->pool); - apr_bucket *b = apr_bucket_transient_create(str, len); - APR_BRIGADE_INSERT_TAIL(bb, b); - - return ap_pass_brigade(r->output_filters, bb); - } - - /* grab the context from our filter */ - ctx = r->output_filters->ctx; - - /* if there isn't a buffer in the context yet, put one there. */ - if (ctx->buf == NULL) { - /* use the heap so it will get free'd after being flushed */ - ctx->avail = AP_MIN_BYTES_TO_WRITE; - ctx->buf = ctx->cur = malloc(ctx->avail); - } - - /* squeeze the data into the existing buffer */ - if (len <= ctx->avail) { - memcpy(ctx->cur, str, len); - ctx->cur += len; - if ((ctx->avail -= len) == 0) - return flush_buffer(r, ctx, NULL, 0); - return APR_SUCCESS; - } - - /* the new content can't fit in the existing buffer */ - - if (len >= AP_MIN_BYTES_TO_WRITE) { - /* it is really big. send what we have, and the new stuff. */ - return flush_buffer(r, ctx, str, len); - } - - /* the new data is small. put some into the current buffer, flush it, - and then drop the remaining into a new buffer. */ - amt = ctx->avail; - memcpy(ctx->cur, str, amt); - ctx->cur += amt; - ctx->avail = 0; - if ((status = flush_buffer(r, ctx, NULL, 0)) != APR_SUCCESS) - return status; - - ctx->buf = malloc(AP_MIN_BYTES_TO_WRITE); - memcpy(ctx->buf, str + amt, len - amt); - ctx->cur = ctx->buf + (len - amt); - ctx->avail = AP_MIN_BYTES_TO_WRITE - (len - amt); - - return APR_SUCCESS; -} - -AP_DECLARE(int) ap_rputc(int c, request_rec *r) -{ - char c2 = (char)c; - - if (r->connection->aborted) { - return -1; - } - - if (buffer_output(r, &c2, 1) != APR_SUCCESS) - return -1; - - return c; -} - -AP_DECLARE(int) ap_rputs(const char *str, request_rec *r) -{ - apr_size_t len; - - if (r->connection->aborted) - return -1; - - if (buffer_output(r, str, len = strlen(str)) != APR_SUCCESS) - return -1; - - return len; -} - -AP_DECLARE(int) ap_rwrite(const void *buf, int nbyte, request_rec *r) -{ - if (r->connection->aborted) - return -1; - - if (buffer_output(r, buf, nbyte) != APR_SUCCESS) - return -1; - - return nbyte; -} - -AP_DECLARE(int) ap_vrprintf(request_rec *r, const char *fmt, va_list va) -{ - char buf[4096]; - apr_size_t written; - - if (r->connection->aborted) - return -1; - - /* ### fix this mechanism to allow more than 4K of output */ - written = apr_vsnprintf(buf, sizeof(buf), fmt, va); - if (buffer_output(r, buf, written) != APR_SUCCESS) - return -1; - - return written; -} - -AP_DECLARE_NONSTD(int) ap_rprintf(request_rec *r, const char *fmt, ...) -{ - va_list va; - int n; - - if (r->connection->aborted) - return -1; - - va_start(va, fmt); - n = ap_vrprintf(r, fmt, va); - va_end(va); - - return n; -} - -AP_DECLARE_NONSTD(int) ap_rvputs(request_rec *r, ...) -{ - va_list va; - const char *s; - apr_size_t len; - apr_size_t written = 0; - - if (r->connection->aborted) - return -1; - - /* ### TODO: if the total output is large, put all the strings - ### into a single brigade, rather than flushing each time we - ### fill the buffer */ - va_start(va, r); - while (1) { - s = va_arg(va, const char *); - if (s == NULL) - break; - - len = strlen(s); - if (buffer_output(r, s, len) != APR_SUCCESS) { - return -1; - } - - written += len; - } - va_end(va); - - return written; -} - -AP_DECLARE(int) ap_rflush(request_rec *r) -{ - apr_bucket_brigade *bb; - apr_bucket *b; - - bb = apr_brigade_create(r->pool); - b = apr_bucket_flush_create(); - APR_BRIGADE_INSERT_TAIL(bb, b); - if (ap_pass_brigade(r->output_filters, bb) != APR_SUCCESS) - return -1; - return 0; -} - -AP_IMPLEMENT_HOOK_RUN_ALL(int,post_read_request, - (request_rec *r),(r),OK,DECLINED) -AP_IMPLEMENT_HOOK_RUN_ALL(int,log_transaction, - (request_rec *r),(r),OK,DECLINED) -AP_IMPLEMENT_HOOK_RUN_FIRST(const char *,http_method, - (const request_rec *r),(r),NULL) -AP_IMPLEMENT_HOOK_RUN_FIRST(unsigned short,default_port, - (const request_rec *r),(r),0) diff --git a/server/request.c b/server/request.c deleted file mode 100644 index bacf8fc608c8ec85338869be4ac11742dc4132fc..0000000000000000000000000000000000000000 --- a/server/request.c +++ /dev/null @@ -1,1124 +0,0 @@ -/* ==================================================================== - * The Apache Software License, Version 1.1 - * - * Copyright (c) 2000-2001 The Apache Software Foundation. All rights - * reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in - * the documentation and/or other materials provided with the - * distribution. - * - * 3. The end-user documentation included with the redistribution, - * if any, must include the following acknowledgment: - * "This product includes software developed by the - * Apache Software Foundation (http://www.apache.org/)." - * Alternately, this acknowledgment may appear in the software itself, - * if and wherever such third-party acknowledgments normally appear. - * - * 4. The names "Apache" and "Apache Software Foundation" must - * not be used to endorse or promote products derived from this - * software without prior written permission. For written - * permission, please contact apache@apache.org. - * - * 5. Products derived from this software may not be called "Apache", - * nor may "Apache" appear in their name, without prior written - * permission of the Apache Software Foundation. - * - * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED - * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES - * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR - * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF - * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND - * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, - * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT - * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * ==================================================================== - * - * This software consists of voluntary contributions made by many - * individuals on behalf of the Apache Software Foundation. For more - * information on the Apache Software Foundation, please see - * . - * - * Portions of this software are based upon public domain software - * originally written at the National Center for Supercomputing Applications, - * University of Illinois, Urbana-Champaign. - */ - -/* - * http_request.c: functions to get and process requests - * - * Rob McCool 3/21/93 - * - * Thoroughly revamped by rst for Apache. NB this file reads - * best from the bottom up. - * - */ - -#include "apr_strings.h" -#include "apr_file_io.h" -#include "apr_fnmatch.h" - -#define APR_WANT_STRFUNC -#include "apr_want.h" - -#define CORE_PRIVATE -#include "ap_config.h" -#include "httpd.h" -#include "http_config.h" -#include "http_request.h" -#include "http_core.h" -#include "http_protocol.h" -#include "http_log.h" -#include "http_main.h" -#include "util_filter.h" -#include "util_charset.h" - -#include "mod_core.h" - -#if APR_HAVE_STDARG_H -#include -#endif - -APR_HOOK_STRUCT( - APR_HOOK_LINK(translate_name) - APR_HOOK_LINK(check_user_id) - APR_HOOK_LINK(fixups) - APR_HOOK_LINK(type_checker) - APR_HOOK_LINK(access_checker) - APR_HOOK_LINK(auth_checker) - APR_HOOK_LINK(insert_filter) -) - -AP_IMPLEMENT_HOOK_RUN_FIRST(int,translate_name, - (request_rec *r),(r),DECLINED) -AP_IMPLEMENT_HOOK_RUN_FIRST(int,check_user_id, - (request_rec *r),(r),DECLINED) -AP_IMPLEMENT_HOOK_RUN_ALL(int,fixups, - (request_rec *r),(r),OK,DECLINED) -AP_IMPLEMENT_HOOK_RUN_FIRST(int,type_checker, - (request_rec *r),(r),DECLINED) -AP_IMPLEMENT_HOOK_RUN_ALL(int,access_checker, - (request_rec *r),(r),OK,DECLINED) -AP_IMPLEMENT_HOOK_RUN_FIRST(int,auth_checker, - (request_rec *r),(r),DECLINED) -AP_IMPLEMENT_HOOK_VOID(insert_filter, (request_rec *r), (r)) - -/***************************************************************** - * - * Getting and checking directory configuration. Also checks the - * FollowSymlinks and FollowSymOwner stuff, since this is really the - * only place that can happen (barring a new mid_dir_walk callout). - * - * We can't do it as an access_checker module function which gets - * called with the final per_dir_config, since we could have a directory - * with FollowSymLinks disabled, which contains a symlink to another - * with a .htaccess file which turns FollowSymLinks back on --- and - * access in such a case must be denied. So, whatever it is that - * checks FollowSymLinks needs to know the state of the options as - * they change, all the way down. - */ - -/* - * We don't want people able to serve up pipes, or unix sockets, or other - * scary things. Note that symlink tests are performed later. - */ -static int check_safe_file(request_rec *r) -{ - - if (r->finfo.filetype == 0 /* doesn't exist */ - || r->finfo.filetype == APR_DIR - || r->finfo.filetype == APR_REG - || r->finfo.filetype == APR_LNK) { - return OK; - } - - ap_log_rerror(APLOG_MARK, APLOG_NOERRNO|APLOG_ERR, 0, r, - "object is not a file, directory or symlink: %s", - r->filename); - return HTTP_FORBIDDEN; -} - - -static int check_symlinks(char *d, int opts, apr_pool_t *p) -{ -#if defined(OS2) - /* OS/2 doesn't have symlinks */ - return OK; -#else - apr_finfo_t lfi, fi; - char *lastp; - int res; - - if (opts & OPT_SYM_LINKS) - return OK; - - /* - * Strip trailing '/', if any, off what we're checking; trailing slashes - * make some systems follow symlinks to directories even in lstat(). - * After we've done the lstat, put it back. Also, don't bother checking - * '/' at all... - * - * Note that we don't have to worry about multiple slashes here because of - * no2slash() below... - */ - - lastp = d + strlen(d) - 1; - if (lastp == d) - return OK; /* Root directory, '/' */ - - if (*lastp == '/') - *lastp = '\0'; - else - lastp = NULL; - - res = apr_lstat(&lfi, d, APR_FINFO_TYPE | APR_FINFO_OWNER, p); - - if (lastp) - *lastp = '/'; - - /* - * Note that we don't reject accesses to nonexistent files (multiviews or - * the like may cons up a way to run the transaction anyway)... - */ - - if ((res != APR_SUCCESS && res != APR_INCOMPLETE) - || (lfi.filetype != APR_LNK)) - return OK; - - /* OK, it's a symlink. May still be OK with OPT_SYM_OWNER */ - - if (!(opts & OPT_SYM_OWNER)) - return HTTP_FORBIDDEN; - - /* OPT_SYM_OWNER only works if we can get the owner from the file */ - - if (res != APR_SUCCESS) - return HTTP_FORBIDDEN; - - if (apr_stat(&fi, d, APR_FINFO_OWNER, p) != APR_SUCCESS) - return HTTP_FORBIDDEN; - - /* TODO: replace with an apr_compare_users() fn */ - return (fi.user == lfi.user) ? OK : HTTP_FORBIDDEN; - -#endif -} - -/* Dealing with the file system to get PATH_INFO - */ -static int get_path_info(request_rec *r) -{ - char *cp; - char *path = r->filename; - char *end = &path[strlen(path)]; - char *last_cp = NULL; - int rv; -#if defined(HAVE_DRIVE_LETTERS) || defined(HAVE_UNC_PATHS) - char bStripSlash=1; -#endif - - if (r->finfo.filetype) { - /* assume path_info already set */ - return OK; - } - -#ifdef HAVE_DRIVE_LETTERS - /* If the directory is x:\, then we don't want to strip - * the trailing slash since x: is not a valid directory. - */ - if (strlen(path) == 3 && path[1] == ':' && path[2] == '/') - bStripSlash = 0; -#endif - -#ifdef HAVE_UNC_PATHS - /* If UNC name == //machine/share/, do not - * advance over the trailing slash. Any other - * UNC name is OK to strip the slash. - */ - cp = end; - if (path[0] == '/' && path[1] == '/' && - path[2] != '/' && cp[-1] == '/') { - char *p; - int iCount=0; - p = path; - while ((p = strchr(p,'/')) != NULL) { - p++; - iCount++; - } - - if (iCount == 4) - bStripSlash = 0; - } -#endif - -#if defined(HAVE_DRIVE_LETTERS) || defined(HAVE_UNC_PATHS) - if (bStripSlash) -#endif - /* Advance over trailing slashes ... NOT part of filename - * if file is not a UNC name (Win32 only). - */ - for (cp = end; cp > path && cp[-1] == '/'; --cp) - continue; - - while (cp > path) { - - /* See if the pathname ending here exists... */ - *cp = '\0'; - - /* ### We no longer need the test ap_os_is_filename_valid() here - * since apr_stat isn't a posix thing - it's apr_stat's responsibility - * to handle whatever path string arrives at it's door - by platform - * and volume restrictions as applicable... - * TODO: This code becomes even simpler if apr_stat grows - * an APR_PATHINCOMPLETE result to indicate that we are staring at - * an partial virtual root. Only OS2/Win32/Netware need apply it :-) - */ - rv = apr_stat(&r->finfo, path, APR_FINFO_MIN, r->pool); - - if (cp != end) - *cp = '/'; - - if (rv == APR_SUCCESS || rv == APR_INCOMPLETE) { - /* - * Aha! Found something. If it was a directory, we will search - * contents of that directory for a multi_match, so the PATH_INFO - * argument starts with the component after that. - */ - if (r->finfo.filetype == APR_DIR && last_cp) { - r->finfo.filetype = APR_NOFILE; /* No such file... */ - cp = last_cp; - } - - r->path_info = apr_pstrdup(r->pool, cp); - *cp = '\0'; - return OK; - } - - if (APR_STATUS_IS_ENOENT(rv) || APR_STATUS_IS_ENOTDIR(rv)) { - last_cp = cp; - - while (--cp > path && *cp != '/') - continue; - - while (cp > path && cp[-1] == '/') - --cp; - } - else { - if (APR_STATUS_IS_EACCES(rv)) - ap_log_rerror(APLOG_MARK, APLOG_ERR, rv, r, - "access to %s denied", r->uri); - else - ap_log_rerror(APLOG_MARK, APLOG_ERR, rv, r, - "access to %s failed", r->uri); - return HTTP_FORBIDDEN; - } - } - return OK; -} - -AP_DECLARE(int) directory_walk(request_rec *r) -{ - core_server_config *sconf = ap_get_module_config(r->server->module_config, - &core_module); - ap_conf_vector_t *per_dir_defaults = r->server->lookup_defaults; - ap_conf_vector_t **sec = (ap_conf_vector_t **) sconf->sec->elts; - int num_sec = sconf->sec->nelts; - char *test_filename; - char *test_dirname; - int res; - unsigned i, num_dirs; - int j, test_filename_len; -#if defined(HAVE_UNC_PATHS) || defined(NETWARE) - unsigned iStart = 1; -#endif - ap_conf_vector_t *entry_config; - ap_conf_vector_t *this_conf; - core_dir_config *entry_core; - - /* - * Are we dealing with a file? If not, we can (hopefuly) safely assume we - * have a handler that doesn't require one, but for safety's sake, and so - * we have something find_types() can get something out of, fake one. But - * don't run through the directory entries. - */ - - if (r->filename == NULL) { - r->filename = apr_pstrdup(r->pool, r->uri); - r->finfo.filetype = APR_NOFILE; - r->per_dir_config = per_dir_defaults; - - return OK; - } - - /* - * Go down the directory hierarchy. Where we have to check for symlinks, - * do so. Where a .htaccess file has permission to override anything, - * try to find one. If either of these things fails, we could poke - * around, see why, and adjust the lookup_rec accordingly --- this might - * save us a call to get_path_info (with the attendant stat()s); however, - * for the moment, that's not worth the trouble. - * - * Fake filenames (i.e. proxy:) only match Directory sections. - */ - - if (!ap_os_is_path_absolute(r->filename)) - { - const char *entry_dir; - - for (j = 0; j < num_sec; ++j) { - - entry_config = sec[j]; - entry_core = ap_get_module_config(entry_config, &core_module); - entry_dir = entry_core->d; - - this_conf = NULL; - if (entry_core->r) { - if (!ap_regexec(entry_core->r, r->filename, 0, NULL, 0)) - this_conf = entry_config; - } - else if (entry_core->d_is_fnmatch) { - if (!apr_fnmatch(entry_dir, r->filename, 0)) - this_conf = entry_config; - } - else if (!strncmp(r->filename, entry_dir, strlen(entry_dir))) - this_conf = entry_config; - - if (this_conf) - per_dir_defaults = ap_merge_per_dir_configs(r->pool, - per_dir_defaults, - this_conf); - } - - r->per_dir_config = per_dir_defaults; - - return OK; - } - - /* XXX This needs to be rolled into APR, the APR function will not - * be allowed to fold the case of any non-existant segment of the path: - */ - r->filename = ap_os_case_canonical_filename(r->pool, r->filename); - - /* TODO This is rather silly right here, we should simply be setting - * filename and path_info at the end of our directory_walk - */ - res = get_path_info(r); - if (res != OK) { - return res; - } - - /* XXX This becomes moot, and will already happen above for elements - * that actually exist: - */ - r->filename = ap_os_canonical_filename(r->pool, r->filename); - - test_filename = apr_pstrdup(r->pool, r->filename); - - /* XXX This becomes mute, since the APR canonical parsing will handle - * 2slash and dot directory issues: - */ - ap_no2slash(test_filename); - num_dirs = ap_count_dirs(test_filename); - - /* XXX This needs to be rolled into APR: */ - if ((res = check_safe_file(r))) { - return res; - } - - test_filename_len = strlen(test_filename); - if (test_filename[test_filename_len - 1] == '/') - --num_dirs; - - if (r->finfo.filetype == APR_DIR) - ++num_dirs; - - /* - * We will use test_dirname as scratch space while we build directory - * names during the walk. Profiling shows directory_walk to be a busy - * function so we try to avoid allocating lots of extra memory here. - * We need 2 extra bytes, one for trailing \0 and one because - * make_dirstr_prefix will add potentially one extra /. - */ - test_dirname = apr_palloc(r->pool, test_filename_len + 2); - - /* XXX These exception cases go away if apr_stat() returns the - * APR_PATHINCOMPLETE status, so we skip hard filesystem testing - * of the initial 'pseudo' elements: - */ - -#if defined(HAVE_UNC_PATHS) - /* If the name is a UNC name, then do not perform any true file test - * against the machine name (start at //machine/share/) - * This is optimized to use the normal walk (skips the redundant '/' root) - */ - if (num_dirs > 3 && test_filename[0] == '/' && test_filename[1] == '/') - iStart = 4; -#endif - -#if defined(NETWARE) - /* If the name is a fully qualified volume name, then do not perform any - * true file test on the machine name (start at machine/share:/) - * XXX: The implementation eludes me at this moment... - * Does this make sense? Please test! - */ - if (num_dirs > 1 && strchr(test_filename, '/') < strchr(test_filename, ':')) - iStart = 2; -#endif - -#if defined(HAVE_DRIVE_LETTERS) || defined(NETWARE) - /* Should match sections starting from '/', not 'e:/' - * (for example). WIN32/OS2/NETWARE do not have a single root directory, - * they have one for each filesystem. Traditionally, Apache has treated - * permissions as the base for the whole server, and this - * tradition should probably be preserved. - * - * NOTE: MUST SYNC WITH ap_make_dirstr_prefix() CHANGE IN src/main/util.c - */ - if (test_filename[0] == '/') - i = 1; - else - i = 0; -#else - /* Normal File Systems are rooted at / */ - i = 1; -#endif /* def HAVE_DRIVE_LETTERS || NETWARE */ - - /* j keeps track of which section we're on, see core_reorder_directories */ - j = 0; - for (; i <= num_dirs; ++i) { - int overrides_here; - core_dir_config *core_dir = ap_get_module_config(per_dir_defaults, - &core_module); - - /* - * XXX: this could be made faster by only copying the next component - * rather than copying the entire thing all over. - */ - ap_make_dirstr_prefix(test_dirname, test_filename, i); - - /* - * Do symlink checks first, because they are done with the - * permissions appropriate to the *parent* directory... - */ - -#if defined(HAVE_UNC_PATHS) || defined(NETWARE) - /* Test only legal names against the real filesystem */ - if (i >= iStart) -#endif - if ((res = check_symlinks(test_dirname, core_dir->opts, r->pool))) { - ap_log_rerror(APLOG_MARK, APLOG_NOERRNO|APLOG_ERR, 0, r, - "Symbolic link not allowed: %s", test_dirname); - return res; - } - - /* - * Begin *this* level by looking for matching sections - * from access.conf. - */ - - for (; j < num_sec; ++j) { - char *entry_dir; - - entry_config = sec[j]; - entry_core = ap_get_module_config(entry_config, &core_module); - entry_dir = entry_core->d; - - if (entry_core->r - || !ap_os_is_path_absolute(entry_dir) -#if defined(HAVE_DRIVE_LETTERS) || defined(NETWARE) - /* To account for the top-level "/" directory when i == 0 - * XXX: The net test may be wrong... may fail ap_os_is_path_absolute - */ - || (entry_core->d_components > 1 - && entry_core->d_components > i) -#else - || entry_core->d_components > i -#endif /* def HAVE_DRIVE_LETTERS || NETWARE */ - ) - break; - - this_conf = NULL; - if (entry_core->d_is_fnmatch) { - if (!apr_fnmatch(entry_dir, test_dirname, FNM_PATHNAME)) { - this_conf = entry_config; - } - } - else if (!strcmp(test_dirname, entry_dir)) - this_conf = entry_config; - - if (this_conf) { - per_dir_defaults = ap_merge_per_dir_configs(r->pool, - per_dir_defaults, - this_conf); - core_dir = ap_get_module_config(per_dir_defaults, - &core_module); - } -#if defined(HAVE_DRIVE_LETTERS) || defined(NETWARE) - /* So that other top-level directory sections (e.g. "e:/") aren't - * skipped when i == 0 - * XXX: I don't get you here, Tim... That's a level 1 section, but - * we are at level 0. Did you mean fast-forward to the next? - */ - else if (!i) - break; -#endif /* def HAVE_DRIVE_LETTERS || NETWARE */ - } - overrides_here = core_dir->override; - - /* If .htaccess files are enabled, check for one. */ - -#if defined(HAVE_UNC_PATHS) || defined(NETWARE) - /* Test only legal names against the real filesystem */ - if (i >= iStart) -#endif - if (overrides_here) { - ap_conf_vector_t *htaccess_conf = NULL; - - res = ap_parse_htaccess(&htaccess_conf, r, overrides_here, - apr_pstrdup(r->pool, test_dirname), - sconf->access_name); - if (res) - return res; - - if (htaccess_conf) { - per_dir_defaults = ap_merge_per_dir_configs(r->pool, - per_dir_defaults, - htaccess_conf); - r->per_dir_config = per_dir_defaults; - } - } - } - - /* - * There's two types of IS_SPECIAL sections (see http_core.c), and we've - * already handled the proxy:-style stuff. Now we'll deal with the - * regexes. - */ - for (; j < num_sec; ++j) { - - entry_config = sec[j]; - entry_core = ap_get_module_config(entry_config, &core_module); - - if (entry_core->r) { - if (!ap_regexec(entry_core->r, test_dirname, 0, NULL, REG_NOTEOL)) { - per_dir_defaults = ap_merge_per_dir_configs(r->pool, - per_dir_defaults, - entry_config); - } - } - } - r->per_dir_config = per_dir_defaults; - - /* - * Symlink permissions are determined by the parent. If the request is - * for a directory then applying the symlink test here would use the - * permissions of the directory as opposed to its parent. Consider a - * symlink pointing to a dir with a .htaccess disallowing symlinks. If - * you access /symlink (or /symlink/) you would get a 403 without this - * S_ISDIR test. But if you accessed /symlink/index.html, for example, - * you would *not* get the 403. - */ - if (r->finfo.filetype != APR_DIR - && (res = check_symlinks(r->filename, ap_allow_options(r), r->pool))) { - ap_log_rerror(APLOG_MARK, APLOG_NOERRNO|APLOG_ERR, 0, r, - "Symbolic link not allowed: %s", r->filename); - return res; - } - return OK; /* Can only "fail" if access denied by the - * symlink goop. */ -} - -AP_DECLARE(int) location_walk(request_rec *r) -{ - core_server_config *sconf = ap_get_module_config(r->server->module_config, - &core_module); - ap_conf_vector_t *per_dir_defaults = r->per_dir_config; - ap_conf_vector_t **url = (ap_conf_vector_t **) sconf->sec_url->elts; - int len, num_url = sconf->sec_url->nelts; - char *test_location; - ap_conf_vector_t *this_conf; - ap_conf_vector_t *entry_config; - core_dir_config *entry_core; - char *entry_url; - int j; - - if (!num_url) { - return OK; - } - - /* Location and LocationMatch differ on their behaviour w.r.t. multiple - * slashes. Location matches multiple slashes with a single slash, - * LocationMatch doesn't. An exception, for backwards brokenness is - * absoluteURIs... in which case neither match multiple slashes. - */ - if (r->uri[0] != '/') { - test_location = r->uri; - } - else { - test_location = apr_pstrdup(r->pool, r->uri); - ap_no2slash(test_location); - } - - /* Go through the location entries, and check for matches. */ - - /* we apply the directive sections in some order; - * should really try them with the most general first. - */ - for (j = 0; j < num_url; ++j) { - - entry_config = url[j]; - - entry_core = ap_get_module_config(entry_config, &core_module); - entry_url = entry_core->d; - - len = strlen(entry_url); - - this_conf = NULL; - - if (entry_core->r) { - if (!ap_regexec(entry_core->r, r->uri, 0, NULL, 0)) - this_conf = entry_config; - } - else if (entry_core->d_is_fnmatch) { - if (!apr_fnmatch(entry_url, test_location, FNM_PATHNAME)) { - this_conf = entry_config; - } - } - else if (!strncmp(test_location, entry_url, len) && - (entry_url[len - 1] == '/' || - test_location[len] == '/' || test_location[len] == '\0')) - this_conf = entry_config; - - if (this_conf) - per_dir_defaults = ap_merge_per_dir_configs(r->pool, - per_dir_defaults, - this_conf); - } - r->per_dir_config = per_dir_defaults; - - return OK; -} - -AP_DECLARE(int) file_walk(request_rec *r) -{ - core_dir_config *conf = ap_get_module_config(r->per_dir_config, - &core_module); - ap_conf_vector_t *per_dir_defaults = r->per_dir_config; - ap_conf_vector_t **file = (ap_conf_vector_t **) conf->sec->elts; - int num_files = conf->sec->nelts; - char *test_file; - - /* get the basename */ - test_file = strrchr(r->filename, '/'); - if (test_file == NULL) { - test_file = r->filename; - } - else { - ++test_file; - } - - /* Go through the file entries, and check for matches. */ - - if (num_files) { - ap_conf_vector_t *this_conf; - ap_conf_vector_t *entry_config; - core_dir_config *entry_core; - char *entry_file; - int j; - - /* we apply the directive sections in some order; - * should really try them with the most general first. - */ - for (j = 0; j < num_files; ++j) { - - entry_config = file[j]; - - entry_core = ap_get_module_config(entry_config, &core_module); - entry_file = entry_core->d; - - this_conf = NULL; - - if (entry_core->r) { - if (!ap_regexec(entry_core->r, test_file, 0, NULL, 0)) - this_conf = entry_config; - } - else if (entry_core->d_is_fnmatch) { - if (!apr_fnmatch(entry_file, test_file, FNM_PATHNAME)) { - this_conf = entry_config; - } - } - else if (!strcmp(test_file, entry_file)) { - this_conf = entry_config; - } - - if (this_conf) - per_dir_defaults = ap_merge_per_dir_configs(r->pool, - per_dir_defaults, - this_conf); - } - r->per_dir_config = per_dir_defaults; - } - return OK; -} - -/***************************************************************** - * - * The sub_request mechanism. - * - * Fns to look up a relative URI from, e.g., a map file or SSI document. - * These do all access checks, etc., but don't actually run the transaction - * ... use run_sub_req below for that. Also, be sure to use destroy_sub_req - * as appropriate if you're likely to be creating more than a few of these. - * (An early Apache version didn't destroy the sub_reqs used in directory - * indexing. The result, when indexing a directory with 800-odd files in - * it, was massively excessive storage allocation). - * - * Note more manipulation of protocol-specific vars in the request - * structure... - */ - -static request_rec *make_sub_request(const request_rec *r) -{ - apr_pool_t *rrp; - request_rec *rr; - - apr_pool_create(&rrp, r->pool); - rr = apr_pcalloc(rrp, sizeof(request_rec)); - rr->pool = rrp; - return rr; -} - -AP_CORE_DECLARE_NONSTD(apr_status_t) ap_sub_req_output_filter(ap_filter_t *f, - apr_bucket_brigade *bb) -{ - apr_bucket *e = APR_BRIGADE_LAST(bb); - - if (APR_BUCKET_IS_EOS(e)) { - apr_bucket_delete(e); - } - ap_pass_brigade(f->next, bb); - return APR_SUCCESS; -} - - -AP_DECLARE(int) ap_some_auth_required(request_rec *r) -{ - /* Is there a require line configured for the type of *this* req? */ - - const apr_array_header_t *reqs_arr = ap_requires(r); - require_line *reqs; - int i; - - if (!reqs_arr) - return 0; - - reqs = (require_line *) reqs_arr->elts; - - for (i = 0; i < reqs_arr->nelts; ++i) - if (reqs[i].method_mask & (1 << r->method_number)) - return 1; - - return 0; -} - -AP_DECLARE(request_rec *) ap_sub_req_method_uri(const char *method, - const char *new_file, - const request_rec *r, - ap_filter_t *next_filter) -{ - request_rec *rnew; - int res; - char *udir; - - rnew = make_sub_request(r); - rnew->hostname = r->hostname; - rnew->request_time = r->request_time; - rnew->connection = r->connection; - rnew->server = r->server; - - rnew->request_config = ap_create_request_config(rnew->pool); - ap_set_module_config(rnew->request_config, &core_module, - ap_get_module_config(r->request_config, &core_module)); - - rnew->htaccess = r->htaccess; - rnew->per_dir_config = r->server->lookup_defaults; - rnew->allowed_methods = ap_make_method_list(rnew->pool, 2); - - /* make a copy of the allowed-methods list */ - ap_copy_method_list(rnew->allowed_methods, r->allowed_methods); - - /* start with the same set of output filters */ - if (next_filter) { - rnew->output_filters = next_filter; - } - else { - rnew->output_filters = r->output_filters; - } - ap_add_output_filter("SUBREQ_CORE", NULL, rnew, rnew->connection); - - /* no input filters for a subrequest */ - - ap_set_sub_req_protocol(rnew, r); - - /* would be nicer to pass "method" to ap_set_sub_req_protocol */ - rnew->method = method; - rnew->method_number = ap_method_number_of(method); - - if (new_file[0] == '/') - ap_parse_uri(rnew, new_file); - else { - udir = ap_make_dirstr_parent(rnew->pool, r->uri); - udir = ap_escape_uri(rnew->pool, udir); /* re-escape it */ - ap_parse_uri(rnew, ap_make_full_path(rnew->pool, udir, new_file)); - } - - res = ap_unescape_url(rnew->uri); - if (res) { - rnew->status = res; - return rnew; - } - - ap_getparents(rnew->uri); - - if ((res = location_walk(rnew))) { - rnew->status = res; - return rnew; - } - - res = ap_run_translate_name(rnew); - if (res) { - rnew->status = res; - return rnew; - } - - /* - * We could be clever at this point, and avoid calling directory_walk, - * etc. However, we'd need to test that the old and new filenames contain - * the same directory components, so it would require duplicating the - * start of translate_name. Instead we rely on the cache of .htaccess - * results. - * - * NB: directory_walk() clears the per_dir_config, so we don't inherit - * from location_walk() above - */ - - if ((res = directory_walk(rnew)) - || (res = file_walk(rnew)) - || (res = location_walk(rnew)) - || ((ap_satisfies(rnew) == SATISFY_ALL - || ap_satisfies(rnew) == SATISFY_NOSPEC) - ? ((res = ap_run_access_checker(rnew)) - || (ap_some_auth_required(rnew) - && ((res = ap_run_check_user_id(rnew)) - || (res = ap_run_auth_checker(rnew))))) - : ((res = ap_run_access_checker(rnew)) - && (!ap_some_auth_required(rnew) - || ((res = ap_run_check_user_id(rnew)) - || (res = ap_run_auth_checker(rnew))))) - ) - || (res = ap_run_type_checker(rnew)) - || (res = ap_run_fixups(rnew)) - ) { - rnew->status = res; - } - return rnew; -} - -AP_DECLARE(request_rec *) ap_sub_req_lookup_uri(const char *new_file, - const request_rec *r, - ap_filter_t *next_filter) -{ - return ap_sub_req_method_uri("GET", new_file, r, next_filter); -} - -AP_DECLARE(request_rec *) ap_sub_req_lookup_file(const char *new_file, - const request_rec *r, - ap_filter_t *next_filter) -{ - request_rec *rnew; - int res; - char *fdir; - - rnew = make_sub_request(r); - rnew->hostname = r->hostname; - rnew->request_time = r->request_time; - rnew->connection = r->connection; - rnew->server = r->server; - - rnew->request_config = ap_create_request_config(rnew->pool); - ap_set_module_config(rnew->request_config, &core_module, - ap_get_module_config(r->request_config, &core_module)); - - rnew->htaccess = r->htaccess; - rnew->chunked = r->chunked; - rnew->allowed_methods = ap_make_method_list(rnew->pool, 2); - - /* make a copy of the allowed-methods list */ - ap_copy_method_list(rnew->allowed_methods, r->allowed_methods); - - /* start with the same set of output filters */ - if (next_filter) { - rnew->output_filters = next_filter; - } - else { - rnew->output_filters = r->output_filters; - } - ap_add_output_filter("SUBREQ_CORE", NULL, rnew, rnew->connection); - - /* no input filters for a subrequest */ - - ap_set_sub_req_protocol(rnew, r); - fdir = ap_make_dirstr_parent(rnew->pool, r->filename); - - /* - * Check for a special case... if there are no '/' characters in new_file - * at all, then we are looking at a relative lookup in the same - * directory. That means we won't have to redo directory_walk, and we may - * not even have to redo access checks. - */ - - if (ap_strchr_c(new_file, '/') == NULL) { - char *udir = ap_make_dirstr_parent(rnew->pool, r->uri); - apr_status_t rv; - - rnew->uri = ap_make_full_path(rnew->pool, udir, new_file); - rnew->filename = ap_make_full_path(rnew->pool, fdir, new_file); - ap_parse_uri(rnew, rnew->uri); /* fill in parsed_uri values */ - - if (((rv = apr_stat(&rnew->finfo, rnew->filename, - APR_FINFO_MIN, rnew->pool)) != APR_SUCCESS) - && (rv != APR_INCOMPLETE)) { - rnew->finfo.filetype = 0; - } - - if ((res = check_safe_file(rnew))) { - rnew->status = res; - return rnew; - } - - rnew->per_dir_config = r->per_dir_config; - - /* - * no matter what, if it's a subdirectory, we need to re-run - * directory_walk - */ - if (rnew->finfo.filetype == APR_DIR) { - res = directory_walk(rnew); - if (!res) { - res = file_walk(rnew); - } - } - else { - if ((res = check_symlinks(rnew->filename, ap_allow_options(rnew), - rnew->pool))) { - ap_log_rerror(APLOG_MARK, APLOG_NOERRNO|APLOG_ERR, 0, rnew, - "Symbolic link not allowed: %s", rnew->filename); - rnew->status = res; - return rnew; - } - /* - * do a file_walk, if it doesn't change the per_dir_config then - * we know that we don't have to redo all the access checks - */ - if ((res = file_walk(rnew))) { - rnew->status = res; - return rnew; - } - if (rnew->per_dir_config == r->per_dir_config) { - if ((res = ap_run_type_checker(rnew)) || (res = ap_run_fixups(rnew))) { - rnew->status = res; - } - return rnew; - } - } - } - else { - /* XXX: @@@: What should be done with the parsed_uri values? */ - ap_parse_uri(rnew, new_file); /* fill in parsed_uri values */ - /* - * XXX: this should be set properly like it is in the same-dir case - * but it's actually sometimes to impossible to do it... because the - * file may not have a uri associated with it -djg - */ - rnew->uri = "INTERNALLY GENERATED file-relative req"; - rnew->filename = ((ap_os_is_path_absolute(new_file)) ? - apr_pstrdup(rnew->pool, new_file) : - ap_make_full_path(rnew->pool, fdir, new_file)); - rnew->per_dir_config = r->server->lookup_defaults; - res = directory_walk(rnew); - if (!res) { - res = file_walk(rnew); - } - } - - if (res - || ((ap_satisfies(rnew) == SATISFY_ALL - || ap_satisfies(rnew) == SATISFY_NOSPEC) - ? ((res = ap_run_access_checker(rnew)) - || (ap_some_auth_required(rnew) - && ((res = ap_run_check_user_id(rnew)) - || (res = ap_run_auth_checker(rnew))))) - : ((res = ap_run_access_checker(rnew)) - && (!ap_some_auth_required(rnew) - || ((res = ap_run_check_user_id(rnew)) - || (res = ap_run_auth_checker(rnew))))) - ) - || (res = ap_run_type_checker(rnew)) - || (res = ap_run_fixups(rnew)) - ) { - rnew->status = res; - } - return rnew; -} - -AP_DECLARE(int) ap_run_sub_req(request_rec *r) -{ - int retval; - - /* see comments in process_request_internal() */ - ap_run_insert_filter(r); - retval = ap_invoke_handler(r); - ap_finalize_sub_req_protocol(r); - return retval; -} - -AP_DECLARE(void) ap_destroy_sub_req(request_rec *r) -{ - /* Reclaim the space */ - apr_pool_destroy(r->pool); -} - -/* - * Function to set the r->mtime field to the specified value if it's later - * than what's already there. - */ -AP_DECLARE(void) ap_update_mtime(request_rec *r, apr_time_t dependency_mtime) -{ - if (r->mtime < dependency_mtime) { - r->mtime = dependency_mtime; - } -} - -/* - * Is it the initial main request, which we only get *once* per HTTP request? - */ -AP_DECLARE(int) ap_is_initial_req(request_rec *r) -{ - return - (r->main == NULL) /* otherwise, this is a sub-request */ - && - (r->prev == NULL); /* otherwise, this is an internal redirect */ -} - diff --git a/server/scoreboard.c b/server/scoreboard.c deleted file mode 100644 index e36bb892227cf667f2acb94e7e03321007426a12..0000000000000000000000000000000000000000 --- a/server/scoreboard.c +++ /dev/null @@ -1,283 +0,0 @@ -/* ==================================================================== - * The Apache Software License, Version 1.1 - * - * Copyright (c) 2000 The Apache Software Foundation. All rights - * reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in - * the documentation and/or other materials provided with the - * distribution. - * - * 3. The end-user documentation included with the redistribution, - * if any, must include the following acknowledgment: - * "This product includes software developed by the - * Apache Software Foundation (http://www.apache.org/)." - * Alternately, this acknowledgment may appear in the software itself, - * if and wherever such third-party acknowledgments normally appear. - * - * 4. The names "Apache" and "Apache Software Foundation" must - * not be used to endorse or promote products derived from this - * software without prior written permission. For written - * permission, please contact apache@apache.org. - * - * 5. Products derived from this software may not be called "Apache", - * nor may "Apache" appear in their name, without prior written - * permission of the Apache Software Foundation. - * - * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED - * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES - * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR - * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF - * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND - * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, - * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT - * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * ==================================================================== - * - * This software consists of voluntary contributions made by many - * individuals on behalf of the Apache Software Foundation. For more - * information on the Apache Software Foundation, please see - * . - * - * Portions of this software are based upon public domain software - * originally written at the National Center for Supercomputing Applications, - * University of Illinois, Urbana-Champaign. - */ - -#include "apr_strings.h" -#include "apr_portable.h" -#include "ap_config.h" -#include "httpd.h" -#include "http_log.h" -#include "http_main.h" -#include "http_core.h" -#include "http_config.h" -#include "unixd.h" -#include "http_conf_globals.h" -#include "mpm.h" -#include "scoreboard.h" -#ifdef HAVE_SYS_TYPES_H -#include -#endif - -AP_DECLARE_DATA scoreboard *ap_scoreboard_image = NULL; -AP_DECLARE_DATA const char *ap_scoreboard_fname=NULL; -AP_DECLARE_DATA int ap_extended_status = 0; -AP_DECLARE_DATA apr_time_t ap_restart_time = 0; - -#if APR_HAS_SHARED_MEMORY -#include "apr_shmem.h" - -static apr_shmem_t *scoreboard_shm = NULL; - -apr_status_t ap_cleanup_shared_mem(void *d) -{ - apr_shm_free(scoreboard_shm, ap_scoreboard_image); - ap_scoreboard_image = NULL; - apr_shm_destroy(scoreboard_shm); - - return APR_SUCCESS; -} - -static void setup_shared_mem(apr_pool_t *p) -{ - char buf[512]; - char errmsg[120]; - const char *fname; - apr_status_t rv; - - fname = ap_server_root_relative(p, ap_scoreboard_fname); - rv = apr_shm_init(&scoreboard_shm, SCOREBOARD_SIZE, fname, p); - if (rv != APR_SUCCESS) { - apr_snprintf(buf, sizeof(buf), "%s: could not open(create) scoreboard: %s", - ap_server_argv0, apr_strerror(rv, errmsg, sizeof errmsg)); - fprintf(stderr, "%s\n", buf); - exit(APEXIT_INIT); - } - ap_scoreboard_image = apr_shm_malloc(scoreboard_shm, SCOREBOARD_SIZE); - if (ap_scoreboard_image == NULL) { - apr_snprintf(buf, sizeof(buf), "%s: cannot allocate scoreboard", - ap_server_argv0); - perror(buf); /* o.k. since MM sets errno */ - apr_shm_destroy(scoreboard_shm); - exit(APEXIT_INIT); - } - apr_register_cleanup(p, NULL, ap_cleanup_shared_mem, apr_null_cleanup); - ap_scoreboard_image->global.running_generation = 0; -} - -void reopen_scoreboard(apr_pool_t *p) -{ -} -#endif /* APR_SHARED_MEM */ - -/* Called by parent process */ -void reinit_scoreboard(apr_pool_t *p) -{ - int running_gen = 0; - if (ap_scoreboard_image) - running_gen = ap_scoreboard_image->global.running_generation; - if (ap_scoreboard_image == NULL) { - setup_shared_mem(p); - } - memset(ap_scoreboard_image, 0, SCOREBOARD_SIZE); - ap_scoreboard_image->global.running_generation = running_gen; -} - -/* Routines called to deal with the scoreboard image - * --- note that we do *not* need write locks, since update_child_status - * only updates a *single* record in place, and only one process writes to - * a given scoreboard slot at a time (either the child process owning that - * slot, or the parent, noting that the child has died). - * - * As a final note --- setting the score entry to getpid() is always safe, - * since when the parent is writing an entry, it's only noting SERVER_DEAD - * anyway. - */ - -apr_inline void ap_sync_scoreboard_image(void) -{ -} - -AP_DECLARE(int) ap_exists_scoreboard_image(void) -{ - return (ap_scoreboard_image ? 1 : 0); -} - -static apr_inline void put_scoreboard_info(int child_num, int thread_num, - short_score *new_score_rec) -{ - /* XXX - needs to be fixed to account for threads */ -#ifdef SCOREBOARD_FILE - lseek(scoreboard_fd, (long) child_num * sizeof(short_score), 0); - force_write(scoreboard_fd, new_score_rec, sizeof(short_score)); -#endif -} - -void update_scoreboard_global(void) -{ -#ifdef SCOREBOARD_FILE - lseek(scoreboard_fd, - (char *) &ap_scoreboard_image->global -(char *) ap_scoreboard_image, 0); - force_write(scoreboard_fd, &ap_scoreboard_image->global, - sizeof ap_scoreboard_image->global); -#endif -} - -void increment_counts(int child_num, int thread_num, request_rec *r) -{ - short_score *ss; - - ss = &ap_scoreboard_image->servers[child_num][thread_num]; - -#ifdef HAVE_TIMES - times(&ss->times); -#endif - ss->access_count++; - ss->my_access_count++; - ss->conn_count++; - ss->bytes_served += r->bytes_sent; - ss->my_bytes_served += r->bytes_sent; - ss->conn_bytes += r->bytes_sent; - - put_scoreboard_info(child_num, thread_num, ss); -} - -AP_DECLARE(int) find_child_by_pid(apr_proc_t *pid) -{ - int i; - int max_daemons_limit = ap_get_max_daemons(); - - for (i = 0; i < max_daemons_limit; ++i) - if (ap_scoreboard_image->parent[i].pid == pid->pid) - return i; - - return -1; -} - -int ap_update_child_status(int child_num, int thread_num, int status, request_rec *r) -{ - int old_status; - short_score *ss; - parent_score *ps; - - if (child_num < 0) - return -1; - - ss = &ap_scoreboard_image->servers[child_num][thread_num]; - old_status = ss->status; - ss->status = status; - - ps = &ap_scoreboard_image->parent[child_num]; - - if ((status == SERVER_READY || status == SERVER_ACCEPTING) - && old_status == SERVER_STARTING) { - ss->thread_num = child_num * HARD_SERVER_LIMIT + thread_num; - ps->worker_threads = ap_threads_per_child; - } - - if (ap_extended_status) { - if (status == SERVER_READY || status == SERVER_DEAD) { - /* - * Reset individual counters - */ - if (status == SERVER_DEAD) { - ss->my_access_count = 0L; - ss->my_bytes_served = 0L; - } - ss->conn_count = (unsigned short) 0; - ss->conn_bytes = (unsigned long) 0; - } - if (r) { - conn_rec *c = r->connection; - apr_cpystrn(ss->client, ap_get_remote_host(c, r->per_dir_config, - REMOTE_NOLOOKUP), sizeof(ss->client)); - if (r->the_request == NULL) { - apr_cpystrn(ss->request, "NULL", sizeof(ss->request)); - } else if (r->parsed_uri.password == NULL) { - apr_cpystrn(ss->request, r->the_request, sizeof(ss->request)); - } else { - /* Don't reveal the password in the server-status view */ - apr_cpystrn(ss->request, apr_pstrcat(r->pool, r->method, " ", - ap_unparse_uri_components(r->pool, &r->parsed_uri, UNP_OMITPASSWORD), - r->assbackwards ? NULL : " ", r->protocol, NULL), - sizeof(ss->request)); - } - ss->vhostrec = r->server; - } - } - - put_scoreboard_info(child_num, thread_num, ss); - return old_status; -} - -void ap_time_process_request(int child_num, int thread_num, int status) -{ - short_score *ss; - - if (child_num < 0) - return; - - ss = &ap_scoreboard_image->servers[child_num][thread_num]; - - if (status == START_PREQUEST) { - ss->start_time = apr_now(); - } - else if (status == STOP_PREQUEST) { - ss->stop_time = apr_now(); - } - put_scoreboard_info(child_num, thread_num, ss); -} - diff --git a/server/util.c b/server/util.c deleted file mode 100644 index b358501c077961e5e3c299dac66c2a05cb360988..0000000000000000000000000000000000000000 --- a/server/util.c +++ /dev/null @@ -1,2145 +0,0 @@ -/* ==================================================================== - * Copyright (c) 1995-1999 The Apache Group. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in - * the documentation and/or other materials provided with the - * distribution. - * - * 3. All advertising materials mentioning features or use of this - * software must display the following acknowledgment: - * "This product includes software developed by the Apache Group - * for use in the Apache HTTP server project (http://www.apache.org/)." - * - * 4. The names "Apache Server" and "Apache Group" must not be used to - * endorse or promote products derived from this software without - * prior written permission. For written permission, please contact - * apache@apache.org. - * - * 5. Products derived from this software may not be called "Apache" - * nor may "Apache" appear in their names without prior written - * permission of the Apache Group. - * - * 6. Redistributions of any form whatsoever must retain the following - * acknowledgment: - * "This product includes software developed by the Apache Group - * for use in the Apache HTTP server project (http://www.apache.org/)." - * - * THIS SOFTWARE IS PROVIDED BY THE APACHE GROUP ``AS IS'' AND ANY - * EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR - * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE APACHE GROUP OR - * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT - * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, - * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED - * OF THE POSSIBILITY OF SUCH DAMAGE. - * ==================================================================== - * - * This software consists of voluntary contributions made by many - * individuals on behalf of the Apache Group and was originally based - * on public domain software written at the National Center for - * Supercomputing Applications, University of Illinois, Urbana-Champaign. - * For more information on the Apache Group and the Apache HTTP server - * project, please see . - * - */ - -/* - * util.c: string utility things - * - * 3/21/93 Rob McCool - * 1995-96 Many changes by the Apache Group - * - */ - -/* Debugging aid: - * #define DEBUG to trace all cfg_open*()/cfg_closefile() calls - * #define DEBUG_CFG_LINES to trace every line read from the config files - */ - -#include "httpd.h" -#include "http_conf_globals.h" /* for user_id & group_id */ -#include "http_log.h" -#if defined(SUNOS4) -/* stdio.h has been read in ap_config.h already. Add missing prototypes here: */ -extern int fgetc(FILE *); -extern char *fgets(char *s, int, FILE*); -extern int fclose(FILE *); -#endif - -/* A bunch of functions in util.c scan strings looking for certain characters. - * To make that more efficient we encode a lookup table. The test_char_table - * is generated automatically by gen_test_char.c. - */ -#include "test_char.h" - -/* we assume the folks using this ensure 0 <= c < 256... which means - * you need a cast to (unsigned char) first, you can't just plug a - * char in here and get it to work, because if char is signed then it - * will first be sign extended. - */ -#define TEST_CHAR(c, f) (test_char_table[(unsigned)(c)] & (f)) - -void ap_util_init(void) -{ - /* nothing to do... previously there was run-time initialization of - * test_char_table here - */ -} - - -API_VAR_EXPORT const char ap_month_snames[12][4] = -{ - "Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec" -}; -API_VAR_EXPORT const char ap_day_snames[7][4] = -{ - "Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat" -}; - -API_EXPORT(char *) ap_get_time() -{ - time_t t; - char *time_string; - - t = time(NULL); - time_string = ctime(&t); - time_string[strlen(time_string) - 1] = '\0'; - return (time_string); -} - -/* - * Examine a field value (such as a media-/content-type) string and return - * it sans any parameters; e.g., strip off any ';charset=foo' and the like. - */ -API_EXPORT(char *) ap_field_noparam(pool *p, const char *intype) -{ - const char *semi; - - semi = strchr(intype, ';'); - if (semi == NULL) { - return ap_pstrdup(p, intype); - } - else { - while ((semi > intype) && ap_isspace(semi[-1])) { - semi--; - } - return ap_pstrndup(p, intype, semi - intype); - } -} - -API_EXPORT(char *) ap_ht_time(pool *p, time_t t, const char *fmt, int gmt) -{ - char ts[MAX_STRING_LEN]; - char tf[MAX_STRING_LEN]; - struct tm *tms; - - tms = (gmt ? gmtime(&t) : localtime(&t)); - if(gmt) { - /* Convert %Z to "GMT" and %z to "+0000"; - * on hosts that do not have a time zone string in struct tm, - * strftime must assume its argument is local time. - */ - const char *f; - char *strp; - for(strp = tf, f = fmt; strp < tf + sizeof(tf) - 6 && (*strp = *f) - ; f++, strp++) { - if (*f != '%') continue; - switch (f[1]) { - case '%': - *++strp = *++f; - break; - case 'Z': - *strp++ = 'G'; - *strp++ = 'M'; - *strp = 'T'; - f++; - break; - case 'z': /* common extension */ - *strp++ = '+'; - *strp++ = '0'; - *strp++ = '0'; - *strp++ = '0'; - *strp = '0'; - f++; - break; - } - } - *strp = '\0'; - fmt = tf; - } - - /* check return code? */ - strftime(ts, MAX_STRING_LEN, fmt, tms); - ts[MAX_STRING_LEN - 1] = '\0'; - return ap_pstrdup(p, ts); -} - -API_EXPORT(char *) ap_gm_timestr_822(pool *p, time_t sec) -{ - struct tm *tms; - - tms = gmtime(&sec); - - /* RFC date format; as strftime '%a, %d %b %Y %T GMT' */ - return ap_psprintf(p, - "%s, %.2d %s %d %.2d:%.2d:%.2d GMT", ap_day_snames[tms->tm_wday], - tms->tm_mday, ap_month_snames[tms->tm_mon], tms->tm_year + 1900, - tms->tm_hour, tms->tm_min, tms->tm_sec); -} - -/* What a pain in the ass. */ -#if defined(HAVE_GMTOFF) -API_EXPORT(struct tm *) ap_get_gmtoff(int *tz) -{ - time_t tt = time(NULL); - struct tm *t; - - t = localtime(&tt); - *tz = (int) (t->tm_gmtoff / 60); - return t; -} -#else -API_EXPORT(struct tm *) ap_get_gmtoff(int *tz) -{ - time_t tt = time(NULL); - struct tm gmt; - struct tm *t; - int days, hours, minutes; - - /* Assume we are never more than 24 hours away. */ - gmt = *gmtime(&tt); /* remember gmtime/localtime return ptr to static */ - t = localtime(&tt); /* buffer... so be careful */ - days = t->tm_yday - gmt.tm_yday; - hours = ((days < -1 ? 24 : 1 < days ? -24 : days * 24) - + t->tm_hour - gmt.tm_hour); - minutes = hours * 60 + t->tm_min - gmt.tm_min; - *tz = minutes; - return t; -} -#endif - -/* Roy owes Rob beer. */ -/* Rob owes Roy dinner. */ - -/* These legacy comments would make a lot more sense if Roy hadn't - * replaced the old later_than() routine with util_date.c. - * - * Well, okay, they still wouldn't make any sense. - */ - -/* Match = 0, NoMatch = 1, Abort = -1 - * Based loosely on sections of wildmat.c by Rich Salz - * Hmmm... shouldn't this really go component by component? - */ -API_EXPORT(int) ap_strcmp_match(const char *str, const char *exp) -{ - int x, y; - - for (x = 0, y = 0; exp[y]; ++y, ++x) { - if ((!str[x]) && (exp[y] != '*')) - return -1; - if (exp[y] == '*') { - while (exp[++y] == '*'); - if (!exp[y]) - return 0; - while (str[x]) { - int ret; - if ((ret = ap_strcmp_match(&str[x++], &exp[y])) != 1) - return ret; - } - return -1; - } - else if ((exp[y] != '?') && (str[x] != exp[y])) - return 1; - } - return (str[x] != '\0'); -} - -API_EXPORT(int) ap_strcasecmp_match(const char *str, const char *exp) -{ - int x, y; - - for (x = 0, y = 0; exp[y]; ++y, ++x) { - if ((!str[x]) && (exp[y] != '*')) - return -1; - if (exp[y] == '*') { - while (exp[++y] == '*'); - if (!exp[y]) - return 0; - while (str[x]) { - int ret; - if ((ret = ap_strcasecmp_match(&str[x++], &exp[y])) != 1) - return ret; - } - return -1; - } - else if ((exp[y] != '?') && (ap_tolower(str[x]) != ap_tolower(exp[y]))) - return 1; - } - return (str[x] != '\0'); -} - -API_EXPORT(int) ap_is_matchexp(const char *str) -{ - register int x; - - for (x = 0; str[x]; x++) - if ((str[x] == '*') || (str[x] == '?')) - return 1; - return 0; -} - -/* - * Apache stub function for the regex libraries regexec() to make sure the - * whole regex(3) API is available through the Apache (exported) namespace. - * This is especially important for the DSO situations of modules. - * DO NOT MAKE A MACRO OUT OF THIS FUNCTION! - */ -API_EXPORT(int) ap_regexec(const regex_t *preg, const char *string, - size_t nmatch, regmatch_t pmatch[], int eflags) -{ - return regexec(preg, string, nmatch, pmatch, eflags); -} - -API_EXPORT(size_t) ap_regerror(int errcode, const regex_t *preg, char *errbuf, size_t errbuf_size) -{ - return regerror(errcode, preg, errbuf, errbuf_size); -} - - -/* This function substitutes for $0-$9, filling in regular expression - * submatches. Pass it the same nmatch and pmatch arguments that you - * passed ap_regexec(). pmatch should not be greater than the maximum number - * of subexpressions - i.e. one more than the re_nsub member of regex_t. - * - * input should be the string with the $-expressions, source should be the - * string that was matched against. - * - * It returns the substituted string, or NULL on error. - * - * Parts of this code are based on Henry Spencer's regsub(), from his - * AT&T V8 regexp package. - */ - -API_EXPORT(char *) ap_pregsub(pool *p, const char *input, const char *source, - size_t nmatch, regmatch_t pmatch[]) -{ - const char *src = input; - char *dest, *dst; - char c; - size_t no; - int len; - - if (!source) - return NULL; - if (!nmatch) - return ap_pstrdup(p, src); - - /* First pass, find the size */ - - len = 0; - - while ((c = *src++) != '\0') { - if (c == '&') - no = 0; - else if (c == '$' && ap_isdigit(*src)) - no = *src++ - '0'; - else - no = 10; - - if (no > 9) { /* Ordinary character. */ - if (c == '\\' && (*src == '$' || *src == '&')) - c = *src++; - len++; - } - else if (no < nmatch && pmatch[no].rm_so < pmatch[no].rm_eo) { - len += pmatch[no].rm_eo - pmatch[no].rm_so; - } - - } - - dest = dst = ap_pcalloc(p, len + 1); - - /* Now actually fill in the string */ - - src = input; - - while ((c = *src++) != '\0') { - if (c == '&') - no = 0; - else if (c == '$' && ap_isdigit(*src)) - no = *src++ - '0'; - else - no = 10; - - if (no > 9) { /* Ordinary character. */ - if (c == '\\' && (*src == '$' || *src == '&')) - c = *src++; - *dst++ = c; - } - else if (no < nmatch && pmatch[no].rm_so < pmatch[no].rm_eo) { - len = pmatch[no].rm_eo - pmatch[no].rm_so; - memcpy(dst, source + pmatch[no].rm_so, len); - dst += len; - } - - } - *dst = '\0'; - - return dest; -} - -/* - * Parse .. so we don't compromise security - */ -API_EXPORT(void) ap_getparents(char *name) -{ - int l, w; - - /* Four paseses, as per RFC 1808 */ - /* a) remove ./ path segments */ - - for (l = 0, w = 0; name[l] != '\0';) { - if (name[l] == '.' && name[l + 1] == '/' && (l == 0 || name[l - 1] == '/')) - l += 2; - else - name[w++] = name[l++]; - } - - /* b) remove trailing . path, segment */ - if (w == 1 && name[0] == '.') - w--; - else if (w > 1 && name[w - 1] == '.' && name[w - 2] == '/') - w--; - name[w] = '\0'; - - /* c) remove all xx/../ segments. (including leading ../ and /../) */ - l = 0; - - while (name[l] != '\0') { - if (name[l] == '.' && name[l + 1] == '.' && name[l + 2] == '/' && - (l == 0 || name[l - 1] == '/')) { - register int m = l + 3, n; - - l = l - 2; - if (l >= 0) { - while (l >= 0 && name[l] != '/') - l--; - l++; - } - else - l = 0; - n = l; - while ((name[n] = name[m])) - (++n, ++m); - } - else - ++l; - } - - /* d) remove trailing xx/.. segment. */ - if (l == 2 && name[0] == '.' && name[1] == '.') - name[0] = '\0'; - else if (l > 2 && name[l - 1] == '.' && name[l - 2] == '.' && name[l - 3] == '/') { - l = l - 4; - if (l >= 0) { - while (l >= 0 && name[l] != '/') - l--; - l++; - } - else - l = 0; - name[l] = '\0'; - } -} - -API_EXPORT(void) ap_no2slash(char *name) -{ - char *d, *s; - - s = d = name; - -#ifdef WIN32 - /* Check for UNC names. Leave leading two slashes. */ - if (s[0] == '/' && s[1] == '/') - *d++ = *s++; -#endif - - while (*s) { - if ((*d++ = *s) == '/') { - do { - ++s; - } while (*s == '/'); - } - else { - ++s; - } - } - *d = '\0'; -} - - -/* - * copy at most n leading directories of s into d - * d should be at least as large as s plus 1 extra byte - * assumes n > 0 - * the return value is the ever useful pointer to the trailing \0 of d - * - * examples: - * /a/b, 1 ==> / - * /a/b, 2 ==> /a/ - * /a/b, 3 ==> /a/b/ - * /a/b, 4 ==> /a/b/ - */ -API_EXPORT(char *) ap_make_dirstr_prefix(char *d, const char *s, int n) -{ - for (;;) { - *d = *s; - if (*d == '\0') { - *d = '/'; - break; - } - if (*d == '/' && (--n) == 0) - break; - ++d; - ++s; - } - *++d = 0; - return (d); -} - - -/* - * return the parent directory name including trailing / of the file s - */ -API_EXPORT(char *) ap_make_dirstr_parent(pool *p, const char *s) -{ - char *last_slash = strrchr(s, '/'); - char *d; - int l; - - if (last_slash == NULL) { - /* XXX: well this is really broken if this happens */ - return (ap_pstrdup(p, "/")); - } - l = (last_slash - s) + 1; - d = ap_palloc(p, l + 1); - memcpy(d, s, l); - d[l] = 0; - return (d); -} - - -/* - * This function is deprecated. Use one of the preceeding two functions - * which are faster. - */ -API_EXPORT(char *) ap_make_dirstr(pool *p, const char *s, int n) -{ - register int x, f; - char *res; - - for (x = 0, f = 0; s[x]; x++) { - if (s[x] == '/') - if ((++f) == n) { - res = ap_palloc(p, x + 2); - memcpy(res, s, x); - res[x] = '/'; - res[x + 1] = '\0'; - return res; - } - } - - if (s[strlen(s) - 1] == '/') - return ap_pstrdup(p, s); - else - return ap_pstrcat(p, s, "/", NULL); -} - -API_EXPORT(int) ap_count_dirs(const char *path) -{ - register int x, n; - - for (x = 0, n = 0; path[x]; x++) - if (path[x] == '/') - n++; - return n; -} - - -API_EXPORT(void) ap_chdir_file(const char *file) -{ - const char *x; - char buf[HUGE_STRING_LEN]; - - x = strrchr(file, '/'); - if (x == NULL) { - chdir(file); - } - else if (x - file < sizeof(buf) - 1) { - memcpy(buf, file, x - file); - buf[x - file] = '\0'; - chdir(buf); - } - /* XXX: well, this is a silly function, no method of reporting an - * error... ah well. */ -} - -API_EXPORT(char *) ap_getword_nc(pool *atrans, char **line, char stop) -{ - return ap_getword(atrans, (const char **) line, stop); -} - -API_EXPORT(char *) ap_getword(pool *atrans, const char **line, char stop) -{ - char *pos = strchr(*line, stop); - char *res; - - if (!pos) { - res = ap_pstrdup(atrans, *line); - *line += strlen(*line); - return res; - } - - res = ap_pstrndup(atrans, *line, pos - *line); - - while (*pos == stop) { - ++pos; - } - - *line = pos; - - return res; -} - -API_EXPORT(char *) ap_getword_white_nc(pool *atrans, char **line) -{ - return ap_getword_white(atrans, (const char **) line); -} - -API_EXPORT(char *) ap_getword_white(pool *atrans, const char **line) -{ - int pos = -1, x; - char *res; - - for (x = 0; (*line)[x]; x++) { - if (ap_isspace((*line)[x])) { - pos = x; - break; - } - } - - if (pos == -1) { - res = ap_pstrdup(atrans, *line); - *line += strlen(*line); - return res; - } - - res = ap_palloc(atrans, pos + 1); - ap_cpystrn(res, *line, pos + 1); - - while (ap_isspace((*line)[pos])) - ++pos; - - *line += pos; - - return res; -} - -API_EXPORT(char *) ap_getword_nulls_nc(pool *atrans, char **line, char stop) -{ - return ap_getword_nulls(atrans, (const char **) line, stop); -} - -API_EXPORT(char *) ap_getword_nulls(pool *atrans, const char **line, char stop) -{ - char *pos = strchr(*line, stop); - char *res; - - if (!pos) { - res = ap_pstrdup(atrans, *line); - *line += strlen(*line); - return res; - } - - res = ap_pstrndup(atrans, *line, pos - *line); - - ++pos; - - *line = pos; - - return res; -} - -/* Get a word, (new) config-file style --- quoted strings and backslashes - * all honored - */ - -static char *substring_conf(pool *p, const char *start, int len, char quote) -{ - char *result = ap_palloc(p, len + 2); - char *resp = result; - int i; - - for (i = 0; i < len; ++i) { - if (start[i] == '\\' && (start[i + 1] == '\\' - || (quote && start[i + 1] == quote))) - *resp++ = start[++i]; - else - *resp++ = start[i]; - } - - *resp++ = '\0'; - return result; -} - -API_EXPORT(char *) ap_getword_conf_nc(pool *p, char **line) -{ - return ap_getword_conf(p, (const char **) line); -} - -API_EXPORT(char *) ap_getword_conf(pool *p, const char **line) -{ - const char *str = *line, *strend; - char *res; - char quote; - - while (*str && ap_isspace(*str)) - ++str; - - if (!*str) { - *line = str; - return ""; - } - - if ((quote = *str) == '"' || quote == '\'') { - strend = str + 1; - while (*strend && *strend != quote) { - if (*strend == '\\' && strend[1] && strend[1] == quote) - strend += 2; - else - ++strend; - } - res = substring_conf(p, str + 1, strend - str - 1, quote); - - if (*strend == quote) - ++strend; - } - else { - strend = str; - while (*strend && !ap_isspace(*strend)) - ++strend; - - res = substring_conf(p, str, strend - str, 0); - } - - while (*strend && ap_isspace(*strend)) - ++strend; - *line = strend; - return res; -} - -API_EXPORT(int) ap_cfg_closefile(configfile_t *cfp) -{ -#ifdef DEBUG - ap_log_error(APLOG_MARK, APLOG_DEBUG|APLOG_NOERRNO, NULL, - "Done with config file %s", cfp->name); -#endif - return (cfp->close == NULL) ? 0 : cfp->close(cfp->param); -} - -/* Common structure that holds the file and pool for ap_pcfg_openfile */ -typedef struct { - struct pool *pool; - FILE *file; -} poolfile_t; - -static int cfg_close(void *param) -{ - poolfile_t *cfp = (poolfile_t *) param; - return (ap_pfclose(cfp->pool, cfp->file)); -} - -static int cfg_getch(void *param) -{ - poolfile_t *cfp = (poolfile_t *) param; - return (fgetc(cfp->file)); -} - -static void *cfg_getstr(void *buf, size_t bufsiz, void *param) -{ - poolfile_t *cfp = (poolfile_t *) param; - return (fgets(buf, bufsiz, cfp->file)); -} - -/* Open a configfile_t as FILE, return open configfile_t struct pointer */ -API_EXPORT(configfile_t *) ap_pcfg_openfile(pool *p, const char *name) -{ - configfile_t *new_cfg; - poolfile_t *new_pfile; - FILE *file; - struct stat stbuf; - int saved_errno; - - if (name == NULL) { - ap_log_error(APLOG_MARK, APLOG_ERR | APLOG_NOERRNO, NULL, - "Internal error: pcfg_openfile() called with NULL filename"); - return NULL; - } - - if (!ap_os_is_filename_valid(name)) { - ap_log_error(APLOG_MARK, APLOG_ERR | APLOG_NOERRNO, NULL, - "Access to config file %s denied: not a valid filename", - name); - errno = EACCES; - return NULL; - } - - file = ap_pfopen(p, name, "r"); -#ifdef DEBUG - saved_errno = errno; - ap_log_error(APLOG_MARK, APLOG_DEBUG | APLOG_NOERRNO, NULL, - "Opening config file %s (%s)", - name, (file == NULL) ? strerror(errno) : "successful"); - errno = saved_errno; -#endif - if (file == NULL) - return NULL; - - if (fstat(fileno(file), &stbuf) == 0 && - !S_ISREG(stbuf.st_mode) && -#if defined(WIN32) || defined(OS2) - !(strcasecmp(name, "nul") == 0 || - (strlen(name) >= 4 && - strcasecmp(name + strlen(name) - 4, "/nul") == 0))) { -#else - strcmp(name, "/dev/null") != 0) { -#endif /* WIN32 || OS2 */ - saved_errno = errno; - ap_log_error(APLOG_MARK, APLOG_ERR | APLOG_NOERRNO, NULL, - "Access to file %s denied by server: not a regular file", - name); - ap_pfclose(p, file); - errno = saved_errno; - return NULL; - } - - new_cfg = ap_palloc(p, sizeof(*new_cfg)); - new_pfile = ap_palloc(p, sizeof(*new_pfile)); - new_pfile->file = file; - new_pfile->pool = p; - new_cfg->param = new_pfile; - new_cfg->name = ap_pstrdup(p, name); - new_cfg->getch = (int (*)(void *)) cfg_getch; - new_cfg->getstr = (void *(*)(void *, size_t, void *)) cfg_getstr; - new_cfg->close = (int (*)(void *)) cfg_close; - new_cfg->line_number = 0; - return new_cfg; -} - - -/* Allocate a configfile_t handle with user defined functions and params */ -API_EXPORT(configfile_t *) ap_pcfg_open_custom(pool *p, const char *descr, - void *param, - int(*getch)(void *param), - void *(*getstr) (void *buf, size_t bufsiz, void *param), - int(*close_func)(void *param)) -{ - configfile_t *new_cfg = ap_palloc(p, sizeof(*new_cfg)); -#ifdef DEBUG - ap_log_error(APLOG_MARK, APLOG_DEBUG | APLOG_NOERRNO, NULL, "Opening config handler %s", descr); -#endif - new_cfg->param = param; - new_cfg->name = descr; - new_cfg->getch = getch; - new_cfg->getstr = getstr; - new_cfg->close = close_func; - new_cfg->line_number = 0; - return new_cfg; -} - - -/* Read one character from a configfile_t */ -API_EXPORT(int) ap_cfg_getc(configfile_t *cfp) -{ - register int ch = cfp->getch(cfp->param); - if (ch == LF) - ++cfp->line_number; - return ch; -} - - -/* Read one line from open configfile_t, strip LF, increase line number */ -/* If custom handler does not define a getstr() function, read char by char */ -API_EXPORT(int) ap_cfg_getline(char *buf, size_t bufsize, configfile_t *cfp) -{ - /* If a "get string" function is defined, use it */ - if (cfp->getstr != NULL) { - char *src, *dst; - char *cp; - char *cbuf = buf; - size_t cbufsize = bufsize; - - while (1) { - ++cfp->line_number; - if (cfp->getstr(cbuf, cbufsize, cfp->param) == NULL) - return 1; - - /* - * check for line continuation, - * i.e. match [^\\]\\[\r]\n only - */ - cp = cbuf; - while (cp < cbuf+cbufsize && *cp != '\0') - cp++; - if (cp > cbuf && cp[-1] == LF) { - cp--; - if (cp > cbuf && cp[-1] == CR) - cp--; - if (cp > cbuf && cp[-1] == '\\') { - cp--; - if (!(cp > cbuf && cp[-1] == '\\')) { - /* - * line continuation requested - - * then remove backslash and continue - */ - cbufsize -= (cp-cbuf); - cbuf = cp; - continue; - } - else { - /* - * no real continuation because escaped - - * then just remove escape character - */ - for ( ; cp < cbuf+cbufsize && *cp != '\0'; cp++) - cp[0] = cp[1]; - } - } - } - break; - } - - /* - * Leading and trailing white space is eliminated completely - */ - src = buf; - while (ap_isspace(*src)) - ++src; - /* blast trailing whitespace */ - dst = &src[strlen(src)]; - while (--dst >= src && ap_isspace(*dst)) - *dst = '\0'; - /* Zap leading whitespace by shifting */ - if (src != buf) - for (dst = buf; (*dst++ = *src++) != '\0'; ) - ; - -#ifdef DEBUG_CFG_LINES - ap_log_error(APLOG_MARK, APLOG_DEBUG|APLOG_NOERRNO, NULL, "Read config: %s", buf); -#endif - return 0; - } else { - /* No "get string" function defined; read character by character */ - register int c; - register size_t i = 0; - - buf[0] = '\0'; - /* skip leading whitespace */ - do { - c = cfp->getch(cfp->param); - } while (c == '\t' || c == ' '); - - if (c == EOF) - return 1; - - if(bufsize < 2) { - /* too small, assume caller is crazy */ - return 1; - } - - while (1) { - if ((c == '\t') || (c == ' ')) { - buf[i++] = ' '; - while ((c == '\t') || (c == ' ')) - c = cfp->getch(cfp->param); - } - if (c == CR) { - /* silently ignore CR (_assume_ that a LF follows) */ - c = cfp->getch(cfp->param); - } - if (c == LF) { - /* increase line number and return on LF */ - ++cfp->line_number; - } - if (c == EOF || c == 0x4 || c == LF || i >= (bufsize - 2)) { - /* - * check for line continuation - */ - if (i > 0 && buf[i-1] == '\\') { - i--; - if (!(i > 0 && buf[i-1] == '\\')) { - /* line is continued */ - c = cfp->getch(cfp->param); - continue; - } - /* else nothing needs be done because - * then the backslash is escaped and - * we just strip to a single one - */ - } - /* blast trailing whitespace */ - while (i > 0 && ap_isspace(buf[i - 1])) - --i; - buf[i] = '\0'; -#ifdef DEBUG_CFG_LINES - ap_log_error(APLOG_MARK, APLOG_DEBUG|APLOG_NOERRNO, NULL, "Read config: %s", buf); -#endif - return 0; - } - buf[i] = c; - ++i; - c = cfp->getch(cfp->param); - } - } -} - -/* Size an HTTP header field list item, as separated by a comma. - * The return value is a pointer to the beginning of the non-empty list item - * within the original string (or NULL if there is none) and the address - * of field is shifted to the next non-comma, non-whitespace character. - * len is the length of the item excluding any beginning whitespace. - */ -API_EXPORT(const char *) ap_size_list_item(const char **field, int *len) -{ - const unsigned char *ptr = (const unsigned char *)*field; - const unsigned char *token; - int in_qpair, in_qstr, in_com; - - /* Find first non-comma, non-whitespace byte */ - - while (*ptr == ',' || ap_isspace(*ptr)) - ++ptr; - - token = ptr; - - /* Find the end of this item, skipping over dead bits */ - - for (in_qpair = in_qstr = in_com = 0; - *ptr && (in_qpair || in_qstr || in_com || *ptr != ','); - ++ptr) { - - if (in_qpair) { - in_qpair = 0; - } - else { - switch (*ptr) { - case '\\': in_qpair = 1; /* quoted-pair */ - break; - case '"' : if (!in_com) /* quoted string delim */ - in_qstr = !in_qstr; - break; - case '(' : if (!in_qstr) /* comment (may nest) */ - ++in_com; - break; - case ')' : if (in_com) /* end comment */ - --in_com; - break; - default : break; - } - } - } - - if ((*len = (ptr - token)) == 0) { - *field = (const char *)ptr; - return NULL; - } - - /* Advance field pointer to the next non-comma, non-white byte */ - - while (*ptr == ',' || ap_isspace(*ptr)) - ++ptr; - - *field = (const char *)ptr; - return (const char *)token; -} - -/* Retrieve an HTTP header field list item, as separated by a comma, - * while stripping insignificant whitespace and lowercasing anything not in - * a quoted string or comment. The return value is a new string containing - * the converted list item (or NULL if none) and the address pointed to by - * field is shifted to the next non-comma, non-whitespace. - */ -API_EXPORT(char *) ap_get_list_item(pool *p, const char **field) -{ - const char *tok_start; - const unsigned char *ptr; - unsigned char *pos; - char *token; - int addspace = 0, in_qpair = 0, in_qstr = 0, in_com = 0, tok_len = 0; - - /* Find the beginning and maximum length of the list item so that - * we can allocate a buffer for the new string and reset the field. - */ - if ((tok_start = ap_size_list_item(field, &tok_len)) == NULL) { - return NULL; - } - token = ap_palloc(p, tok_len + 1); - - /* Scan the token again, but this time copy only the good bytes. - * We skip extra whitespace and any whitespace around a '=', '/', - * or ';' and lowercase normal characters not within a comment, - * quoted-string or quoted-pair. - */ - for (ptr = (const unsigned char *)tok_start, pos = (unsigned char *)token; - *ptr && (in_qpair || in_qstr || in_com || *ptr != ','); - ++ptr) { - - if (in_qpair) { - in_qpair = 0; - *pos++ = *ptr; - } - else { - switch (*ptr) { - case '\\': in_qpair = 1; - if (addspace == 1) - *pos++ = ' '; - *pos++ = *ptr; - addspace = 0; - break; - case '"' : if (!in_com) - in_qstr = !in_qstr; - if (addspace == 1) - *pos++ = ' '; - *pos++ = *ptr; - addspace = 0; - break; - case '(' : if (!in_qstr) - ++in_com; - if (addspace == 1) - *pos++ = ' '; - *pos++ = *ptr; - addspace = 0; - break; - case ')' : if (in_com) - --in_com; - *pos++ = *ptr; - addspace = 0; - break; - case ' ' : - case '\t': if (addspace) - break; - if (in_com || in_qstr) - *pos++ = *ptr; - else - addspace = 1; - break; - case '=' : - case '/' : - case ';' : if (!(in_com || in_qstr)) - addspace = -1; - *pos++ = *ptr; - break; - default : if (addspace == 1) - *pos++ = ' '; - *pos++ = (in_com || in_qstr) ? *ptr - : ap_tolower(*ptr); - addspace = 0; - break; - } - } - } - *pos = '\0'; - - return token; -} - -/* Find an item in canonical form (lowercase, no extra spaces) within - * an HTTP field value list. Returns 1 if found, 0 if not found. - * This would be much more efficient if we stored header fields as - * an array of list items as they are received instead of a plain string. - */ -API_EXPORT(int) ap_find_list_item(pool *p, const char *line, const char *tok) -{ - const unsigned char *pos; - const unsigned char *ptr = (const unsigned char *)line; - int good = 0, addspace = 0, in_qpair = 0, in_qstr = 0, in_com = 0; - - if (!line || !tok) - return 0; - - do { /* loop for each item in line's list */ - - /* Find first non-comma, non-whitespace byte */ - - while (*ptr == ',' || ap_isspace(*ptr)) - ++ptr; - - if (*ptr) - good = 1; /* until proven otherwise for this item */ - else - break; /* no items left and nothing good found */ - - /* We skip extra whitespace and any whitespace around a '=', '/', - * or ';' and lowercase normal characters not within a comment, - * quoted-string or quoted-pair. - */ - for (pos = (const unsigned char *)tok; - *ptr && (in_qpair || in_qstr || in_com || *ptr != ','); - ++ptr) { - - if (in_qpair) { - in_qpair = 0; - if (good) - good = (*pos++ == *ptr); - } - else { - switch (*ptr) { - case '\\': in_qpair = 1; - if (addspace == 1) - good = good && (*pos++ == ' '); - good = good && (*pos++ == *ptr); - addspace = 0; - break; - case '"' : if (!in_com) - in_qstr = !in_qstr; - if (addspace == 1) - good = good && (*pos++ == ' '); - good = good && (*pos++ == *ptr); - addspace = 0; - break; - case '(' : if (!in_qstr) - ++in_com; - if (addspace == 1) - good = good && (*pos++ == ' '); - good = good && (*pos++ == *ptr); - addspace = 0; - break; - case ')' : if (in_com) - --in_com; - good = good && (*pos++ == *ptr); - addspace = 0; - break; - case ' ' : - case '\t': if (addspace || !good) - break; - if (in_com || in_qstr) - good = (*pos++ == *ptr); - else - addspace = 1; - break; - case '=' : - case '/' : - case ';' : if (!(in_com || in_qstr)) - addspace = -1; - good = good && (*pos++ == *ptr); - break; - default : if (!good) - break; - if (addspace == 1) - good = (*pos++ == ' '); - if (in_com || in_qstr) - good = good && (*pos++ == *ptr); - else - good = good && (*pos++ == ap_tolower(*ptr)); - addspace = 0; - break; - } - } - } - if (good && *pos) - good = 0; /* not good if only a prefix was matched */ - - } while (*ptr && !good); - - return good; -} - - -/* Retrieve a token, spacing over it and returning a pointer to - * the first non-white byte afterwards. Note that these tokens - * are delimited by semis and commas; and can also be delimited - * by whitespace at the caller's option. - */ - -API_EXPORT(char *) ap_get_token(pool *p, const char **accept_line, int accept_white) -{ - const char *ptr = *accept_line; - const char *tok_start; - char *token; - int tok_len; - - /* Find first non-white byte */ - - while (*ptr && ap_isspace(*ptr)) - ++ptr; - - tok_start = ptr; - - /* find token end, skipping over quoted strings. - * (comments are already gone). - */ - - while (*ptr && (accept_white || !ap_isspace(*ptr)) - && *ptr != ';' && *ptr != ',') { - if (*ptr++ == '"') - while (*ptr) - if (*ptr++ == '"') - break; - } - - tok_len = ptr - tok_start; - token = ap_pstrndup(p, tok_start, tok_len); - - /* Advance accept_line pointer to the next non-white byte */ - - while (*ptr && ap_isspace(*ptr)) - ++ptr; - - *accept_line = ptr; - return token; -} - - -/* find http tokens, see the definition of token from RFC2068 */ -API_EXPORT(int) ap_find_token(pool *p, const char *line, const char *tok) -{ - const unsigned char *start_token; - const unsigned char *s; - - if (!line) - return 0; - - s = (const unsigned char *)line; - for (;;) { - /* find start of token, skip all stop characters, note NUL - * isn't a token stop, so we don't need to test for it - */ - while (TEST_CHAR(*s, T_HTTP_TOKEN_STOP)) { - ++s; - } - if (!*s) { - return 0; - } - start_token = s; - /* find end of the token */ - while (*s && !TEST_CHAR(*s, T_HTTP_TOKEN_STOP)) { - ++s; - } - if (!strncasecmp((const char *)start_token, (const char *)tok, s - start_token)) { - return 1; - } - if (!*s) { - return 0; - } - } -} - - -API_EXPORT(int) ap_find_last_token(pool *p, const char *line, const char *tok) -{ - int llen, tlen, lidx; - - if (!line) - return 0; - - llen = strlen(line); - tlen = strlen(tok); - lidx = llen - tlen; - - if ((lidx < 0) || - ((lidx > 0) && !(ap_isspace(line[lidx - 1]) || line[lidx - 1] == ','))) - return 0; - - return (strncasecmp(&line[lidx], tok, tlen) == 0); -} - -API_EXPORT(char *) ap_escape_shell_cmd(pool *p, const char *str) -{ - char *cmd; - unsigned char *d; - const unsigned char *s; - - cmd = ap_palloc(p, 2 * strlen(str) + 1); /* Be safe */ - d = (unsigned char *)cmd; - s = (const unsigned char *)str; - for (; *s; ++s) { - -#if defined(OS2) || defined(WIN32) - /* Don't allow '&' in parameters under OS/2. */ - /* This can be used to send commands to the shell. */ - if (*s == '&') { - *d++ = ' '; - continue; - } -#endif - - if (TEST_CHAR(*s, T_ESCAPE_SHELL_CMD)) { - *d++ = '\\'; - } - *d++ = *s; - } - *d = '\0'; - - return cmd; -} - -static char x2c(const char *what) -{ - register char digit; - -#ifndef CHARSET_EBCDIC - digit = ((what[0] >= 'A') ? ((what[0] & 0xdf) - 'A') + 10 : (what[0] - '0')); - digit *= 16; - digit += (what[1] >= 'A' ? ((what[1] & 0xdf) - 'A') + 10 : (what[1] - '0')); -#else /*CHARSET_EBCDIC*/ - char xstr[5]; - xstr[0]='0'; - xstr[1]='x'; - xstr[2]=what[0]; - xstr[3]=what[1]; - xstr[4]='\0'; - digit = os_toebcdic[0xFF & strtol(xstr, NULL, 16)]; -#endif /*CHARSET_EBCDIC*/ - return (digit); -} - -/* - * Unescapes a URL. - * Returns 0 on success, non-zero on error - * Failure is due to - * bad % escape returns BAD_REQUEST - * - * decoding %00 -> \0 - * decoding %2f -> / (a special character) - * returns NOT_FOUND - */ -API_EXPORT(int) ap_unescape_url(char *url) -{ - register int x, y, badesc, badpath; - - badesc = 0; - badpath = 0; - for (x = 0, y = 0; url[y]; ++x, ++y) { - if (url[y] != '%') - url[x] = url[y]; - else { - if (!ap_isxdigit(url[y + 1]) || !ap_isxdigit(url[y + 2])) { - badesc = 1; - url[x] = '%'; - } - else { - url[x] = x2c(&url[y + 1]); - y += 2; - if (url[x] == '/' || url[x] == '\0') - badpath = 1; - } - } - } - url[x] = '\0'; - if (badesc) - return BAD_REQUEST; - else if (badpath) - return NOT_FOUND; - else - return OK; -} - -API_EXPORT(char *) ap_construct_server(pool *p, const char *hostname, - unsigned port, const request_rec *r) -{ - if (ap_is_default_port(port, r)) - return ap_pstrdup(p, hostname); - else { - return ap_psprintf(p, "%s:%u", hostname, port); - } -} - -/* c2x takes an unsigned, and expects the caller has guaranteed that - * 0 <= what < 256... which usually means that you have to cast to - * unsigned char first, because (unsigned)(char)(x) fist goes through - * signed extension to an int before the unsigned cast. - * - * The reason for this assumption is to assist gcc code generation -- - * the unsigned char -> unsigned extension is already done earlier in - * both uses of this code, so there's no need to waste time doing it - * again. - */ -static const char c2x_table[] = "0123456789abcdef"; - -static ap_inline unsigned char *c2x(unsigned what, unsigned char *where) -{ - *where++ = '%'; - *where++ = c2x_table[what >> 4]; - *where++ = c2x_table[what & 0xf]; - return where; -} - -/* - * escape_path_segment() escapes a path segment, as defined in RFC 1808. This - * routine is (should be) OS independent. - * - * os_escape_path() converts an OS path to a URL, in an OS dependent way. In all - * cases if a ':' occurs before the first '/' in the URL, the URL should be - * prefixed with "./" (or the ':' escaped). In the case of Unix, this means - * leaving '/' alone, but otherwise doing what escape_path_segment() does. For - * efficiency reasons, we don't use escape_path_segment(), which is provided for - * reference. Again, RFC 1808 is where this stuff is defined. - * - * If partial is set, os_escape_path() assumes that the path will be appended to - * something with a '/' in it (and thus does not prefix "./"). - */ - -API_EXPORT(char *) ap_escape_path_segment(pool *p, const char *segment) -{ - char *copy = ap_palloc(p, 3 * strlen(segment) + 1); - const unsigned char *s = (const unsigned char *)segment; - unsigned char *d = (unsigned char *)copy; - unsigned c; - - while ((c = *s)) { - if (TEST_CHAR(c, T_ESCAPE_PATH_SEGMENT)) { - d = c2x(c, d); - } - else { - *d++ = c; - } - ++s; - } - *d = '\0'; - return copy; -} - -API_EXPORT(char *) ap_os_escape_path(pool *p, const char *path, int partial) -{ - char *copy = ap_palloc(p, 3 * strlen(path) + 3); - const unsigned char *s = (const unsigned char *)path; - unsigned char *d = (unsigned char *)copy; - unsigned c; - - if (!partial) { - char *colon = strchr(path, ':'); - char *slash = strchr(path, '/'); - - if (colon && (!slash || colon < slash)) { - *d++ = '.'; - *d++ = '/'; - } - } - while ((c = *s)) { - if (TEST_CHAR(c, T_OS_ESCAPE_PATH)) { - d = c2x(c, d); - } - else { - *d++ = c; - } - ++s; - } - *d = '\0'; - return copy; -} - -/* ap_escape_uri is now a macro for os_escape_path */ - -API_EXPORT(char *) ap_escape_html(pool *p, const char *s) -{ - int i, j; - char *x; - - /* first, count the number of extra characters */ - for (i = 0, j = 0; s[i] != '\0'; i++) - if (s[i] == '<' || s[i] == '>') - j += 3; - else if (s[i] == '&') - j += 4; - - if (j == 0) - return ap_pstrndup(p, s, i); - - x = ap_palloc(p, i + j + 1); - for (i = 0, j = 0; s[i] != '\0'; i++, j++) - if (s[i] == '<') { - memcpy(&x[j], "<", 4); - j += 3; - } - else if (s[i] == '>') { - memcpy(&x[j], ">", 4); - j += 3; - } - else if (s[i] == '&') { - memcpy(&x[j], "&", 5); - j += 4; - } - else - x[j] = s[i]; - - x[j] = '\0'; - return x; -} - -API_EXPORT(int) ap_is_directory(const char *path) -{ - struct stat finfo; - - if (stat(path, &finfo) == -1) - return 0; /* in error condition, just return no */ - - return (S_ISDIR(finfo.st_mode)); -} - -API_EXPORT(char *) ap_make_full_path(pool *a, const char *src1, - const char *src2) -{ - register int x; - - x = strlen(src1); - if (x == 0) - return ap_pstrcat(a, "/", src2, NULL); - - if (src1[x - 1] != '/') - return ap_pstrcat(a, src1, "/", src2, NULL); - else - return ap_pstrcat(a, src1, src2, NULL); -} - -/* - * Check for an absoluteURI syntax (see section 3.2 in RFC2068). - */ -API_EXPORT(int) ap_is_url(const char *u) -{ - register int x; - - for (x = 0; u[x] != ':'; x++) { - if ((!u[x]) || - ((!ap_isalpha(u[x])) && (!ap_isdigit(u[x])) && - (u[x] != '+') && (u[x] != '-') && (u[x] != '.'))) { - return 0; - } - } - - return (x ? 1 : 0); /* If the first character is ':', it's broken, too */ -} - -API_EXPORT(int) ap_can_exec(const struct stat *finfo) -{ -#ifdef MULTIPLE_GROUPS - int cnt; -#endif -#if defined(OS2) || defined(WIN32) - /* OS/2 dosen't have Users and Groups */ - return 1; -#else - if (ap_user_id == finfo->st_uid) - if (finfo->st_mode & S_IXUSR) - return 1; - if (ap_group_id == finfo->st_gid) - if (finfo->st_mode & S_IXGRP) - return 1; -#ifdef MULTIPLE_GROUPS - for (cnt = 0; cnt < NGROUPS_MAX; cnt++) { - if (group_id_list[cnt] == finfo->st_gid) - if (finfo->st_mode & S_IXGRP) - return 1; - } -#endif - return (finfo->st_mode & S_IXOTH); -#endif -} - -#ifdef NEED_STRDUP -char *strdup(const char *str) -{ - char *sdup; - - if (!(sdup = (char *) malloc(strlen(str) + 1))) { - fprintf(stderr, "Ouch! Out of memory in our strdup()!\n"); - return NULL; - } - sdup = strcpy(sdup, str); - - return sdup; -} -#endif - -/* The following two routines were donated for SVR4 by Andreas Vogel */ -#ifdef NEED_STRCASECMP -int strcasecmp(const char *a, const char *b) -{ - const char *p = a; - const char *q = b; - for (p = a, q = b; *p && *q; p++, q++) { - int diff = ap_tolower(*p) - ap_tolower(*q); - if (diff) - return diff; - } - if (*p) - return 1; /* p was longer than q */ - if (*q) - return -1; /* p was shorter than q */ - return 0; /* Exact match */ -} - -#endif - -#ifdef NEED_STRNCASECMP -int strncasecmp(const char *a, const char *b, int n) -{ - const char *p = a; - const char *q = b; - - for (p = a, q = b; /*NOTHING */ ; p++, q++) { - int diff; - if (p == a + n) - return 0; /* Match up to n characters */ - if (!(*p && *q)) - return *p - *q; - diff = ap_tolower(*p) - ap_tolower(*q); - if (diff) - return diff; - } - /*NOTREACHED */ -} -#endif - -/* The following routine was donated for UTS21 by dwd@bell-labs.com */ -#ifdef NEED_STRSTR -char *strstr(char *s1, char *s2) -{ - char *p1, *p2; - if (*s2 == '\0') { - /* an empty s2 */ - return(s1); - } - while((s1 = strchr(s1, *s2)) != NULL) { - /* found first character of s2, see if the rest matches */ - p1 = s1; - p2 = s2; - while (*++p1 == *++p2) { - if (*p1 == '\0') { - /* both strings ended together */ - return(s1); - } - } - if (*p2 == '\0') { - /* second string ended, a match */ - break; - } - /* didn't find a match here, try starting at next character in s1 */ - s1++; - } - return(s1); -} -#endif - -#ifdef NEED_INITGROUPS -int initgroups(const char *name, gid_t basegid) -{ -#if defined(QNX) || defined(MPE) || defined(BEOS) || defined(_OSD_POSIX) || defined(TPF) || defined(__TANDEM) -/* QNX, MPE and BeOS do not appear to support supplementary groups. */ - return 0; -#else /* ndef QNX */ - gid_t groups[NGROUPS_MAX]; - struct group *g; - int index = 0; - - setgrent(); - - groups[index++] = basegid; - - while (index < NGROUPS_MAX && ((g = getgrent()) != NULL)) - if (g->gr_gid != basegid) { - char **names; - - for (names = g->gr_mem; *names != NULL; ++names) - if (!strcmp(*names, name)) - groups[index++] = g->gr_gid; - } - - endgrent(); - - return setgroups(index, groups); -#endif /* def QNX */ -} -#endif /* def NEED_INITGROUPS */ - -#ifdef NEED_WAITPID -/* From ikluft@amdahl.com - * this is not ideal but it works for SVR3 variants - * Modified by dwd@bell-labs.com to call wait3 instead of wait because - * apache started to use the WNOHANG option. - */ -int waitpid(pid_t pid, int *statusp, int options) -{ - int tmp_pid; - if (kill(pid, 0) == -1) { - errno = ECHILD; - return -1; - } - while (((tmp_pid = wait3(statusp, options, 0)) != pid) && - (tmp_pid != -1) && (tmp_pid != 0) && (pid != -1)) - ; - return tmp_pid; -} -#endif - -API_EXPORT(int) ap_ind(const char *s, char c) -{ - register int x; - - for (x = 0; s[x]; x++) - if (s[x] == c) - return x; - - return -1; -} - -API_EXPORT(int) ap_rind(const char *s, char c) -{ - register int x; - - for (x = strlen(s) - 1; x != -1; x--) - if (s[x] == c) - return x; - - return -1; -} - -API_EXPORT(void) ap_str_tolower(char *str) -{ - while (*str) { - *str = ap_tolower(*str); - ++str; - } -} - -API_EXPORT(uid_t) ap_uname2id(const char *name) -{ -#ifdef WIN32 - return (1); -#else - struct passwd *ent; - - if (name[0] == '#') - return (atoi(&name[1])); - - if (!(ent = getpwnam(name))) { - fprintf(stderr, "%s: bad user name %s\n", ap_server_argv0, name); - exit(1); - } - return (ent->pw_uid); -#endif -} - -API_EXPORT(gid_t) ap_gname2id(const char *name) -{ -#ifdef WIN32 - return (1); -#else - struct group *ent; - - if (name[0] == '#') - return (atoi(&name[1])); - - if (!(ent = getgrnam(name))) { - fprintf(stderr, "%s: bad group name %s\n", ap_server_argv0, name); - exit(1); - } - return (ent->gr_gid); -#endif -} - - -/* - * Parses a host of the form
    [:port] - * :port is permitted if 'port' is not NULL - */ -unsigned long ap_get_virthost_addr(char *w, unsigned short *ports) -{ - struct hostent *hep; - unsigned long my_addr; - char *p; - - p = strchr(w, ':'); - if (ports != NULL) { - *ports = 0; - if (p != NULL && strcmp(p + 1, "*") != 0) - *ports = atoi(p + 1); - } - - if (p != NULL) - *p = '\0'; - if (strcmp(w, "*") == 0) { - if (p != NULL) - *p = ':'; - return htonl(INADDR_ANY); - } - - my_addr = ap_inet_addr((char *)w); - if (my_addr != INADDR_NONE) { - if (p != NULL) - *p = ':'; - return my_addr; - } - - hep = gethostbyname(w); - - if ((!hep) || (hep->h_addrtype != AF_INET || !hep->h_addr_list[0])) { - fprintf(stderr, "Cannot resolve host name %s --- exiting!\n", w); - exit(1); - } - - if (hep->h_addr_list[1]) { - fprintf(stderr, "Host %s has multiple addresses ---\n", w); - fprintf(stderr, "you must choose one explicitly for use as\n"); - fprintf(stderr, "a virtual host. Exiting!!!\n"); - exit(1); - } - - if (p != NULL) - *p = ':'; - - return ((struct in_addr *) (hep->h_addr))->s_addr; -} - - -static char *find_fqdn(pool *a, struct hostent *p) -{ - int x; - - if (!strchr(p->h_name, '.')) { - for (x = 0; p->h_aliases[x]; ++x) { - if (strchr(p->h_aliases[x], '.') && - (!strncasecmp(p->h_aliases[x], p->h_name, strlen(p->h_name)))) - return ap_pstrdup(a, p->h_aliases[x]); - } - return NULL; - } - return ap_pstrdup(a, (void *) p->h_name); -} - -char *ap_get_local_host(pool *a) -{ -#ifndef MAXHOSTNAMELEN -#define MAXHOSTNAMELEN 256 -#endif - char str[MAXHOSTNAMELEN + 1]; - char *server_hostname; - struct hostent *p; - -#ifdef BEOS /* BeOS returns zero as an error for gethostname */ - if (gethostname(str, sizeof(str) - 1) == 0) { -#else - if (gethostname(str, sizeof(str) - 1) != 0) { -#endif /* BeOS */ - perror("Unable to gethostname"); - exit(1); - } - str[MAXHOSTNAMELEN] = '\0'; - if ((!(p = gethostbyname(str))) || (!(server_hostname = find_fqdn(a, p)))) { - fprintf(stderr, "%s: cannot determine local host name.\n", - ap_server_argv0); - fprintf(stderr, "Use the ServerName directive to set it manually.\n"); - exit(1); - } - - return server_hostname; -} - -/* simple 'pool' alloc()ing glue to ap_base64.c - */ -API_EXPORT(char *) ap_pbase64decode(pool *p, const char *bufcoded) -{ - char *decoded; - int l; - - decoded = (char *) ap_palloc(p, 1 + ap_base64decode_len(bufcoded)); - l = ap_base64decode(decoded, bufcoded); - decoded[l] = '\0'; /* make binary sequence into string */ - - return decoded; -} - -API_EXPORT(char *) ap_pbase64encode(pool *p, char *string) -{ - char *encoded; - int l = strlen(string); - - encoded = (char *) ap_palloc(p, 1 + ap_base64encode_len(l)); - l = ap_base64encode(encoded, string, l); - encoded[l] = '\0'; /* make binary sequence into string */ - - return encoded; -} - -/* deprecated names for the above two functions, here for compatibility - */ -API_EXPORT(char *) ap_uudecode(pool *p, const char *bufcoded) -{ - return ap_pbase64decode(p, bufcoded); -} - -API_EXPORT(char *) ap_uuencode(pool *p, char *string) -{ - return ap_pbase64encode(p, string); -} - -#ifdef OS2 -void os2pathname(char *path) -{ - char newpath[MAX_STRING_LEN]; - int loop; - int offset; - - offset = 0; - for (loop = 0; loop < (strlen(path) + 1) && loop < sizeof(newpath) - 1; loop++) { - if (path[loop] == '/') { - newpath[offset] = '\\'; - /* - offset = offset + 1; - newpath[offset] = '\\'; - */ - } - else - newpath[offset] = path[loop]; - offset = offset + 1; - }; - /* Debugging code */ - /* fprintf(stderr, "%s \n", newpath); */ - - strcpy(path, newpath); -}; - -/* quotes in the string are doubled up. - * Used to escape quotes in args passed to OS/2's cmd.exe - */ -char *ap_double_quotes(pool *p, char *str) -{ - int num_quotes = 0; - int len = 0; - char *quote_doubled_str, *dest; - - while (str[len]) { - num_quotes += str[len++] == '\"'; - } - - quote_doubled_str = ap_palloc(p, len + num_quotes + 1); - dest = quote_doubled_str; - - while (*str) { - if (*str == '\"') - *(dest++) = '\"'; - *(dest++) = *(str++); - } - - *dest = 0; - return quote_doubled_str; -} -#endif - - -#ifdef NEED_STRERROR -char * - strerror(int err) -{ - - char *p; - extern char *const sys_errlist[]; - - p = sys_errlist[err]; - return (p); -} -#endif - -#if defined(NEED_DIFFTIME) -double difftime(time_t time1, time_t time0) -{ - return (time1 - time0); -} -#endif - -/* we want to downcase the type/subtype for comparison purposes - * but nothing else because ;parameter=foo values are case sensitive. - * XXX: in truth we want to downcase parameter names... but really, - * apache has never handled parameters and such correctly. You - * also need to compress spaces and such to be able to compare - * properly. -djg - */ -API_EXPORT(void) ap_content_type_tolower(char *str) -{ - char *semi; - - semi = strchr(str, ';'); - if (semi) { - *semi = '\0'; - } - while (*str) { - *str = ap_tolower(*str); - ++str; - } - if (semi) { - *semi = ';'; - } -} - -/* - * Given a string, replace any bare " with \" . - */ -API_EXPORT(char *) ap_escape_quotes (pool *p, const char *instring) -{ - int newlen = 0; - const char *inchr = instring; - char *outchr, *outstring; - - /* - * Look through the input string, jogging the length of the output - * string up by an extra byte each time we find an unescaped ". - */ - while (*inchr != '\0') { - newlen++; - if (*inchr == '"') { - newlen++; - } - /* - * If we find a slosh, and it's not the last byte in the string, - * it's escaping something - advance past both bytes. - */ - if ((*inchr == '\\') && (inchr[1] != '\0')) { - inchr++; - newlen++; - } - inchr++; - } - outstring = ap_palloc(p, newlen + 1); - inchr = instring; - outchr = outstring; - /* - * Now copy the input string to the output string, inserting a slosh - * in front of every " that doesn't already have one. - */ - while (*inchr != '\0') { - if ((*inchr == '\\') && (inchr[1] != '\0')) { - *outchr++ = *inchr++; - *outchr++ = *inchr++; - } - if (*inchr == '"') { - *outchr++ = '\\'; - } - if (*inchr != '\0') { - *outchr++ = *inchr++; - } - } - *outchr = '\0'; - return outstring; -} diff --git a/server/util_cfgtree.c b/server/util_cfgtree.c deleted file mode 100644 index cc82e1c1854230b4068763d88a1cff6c9363fb3e..0000000000000000000000000000000000000000 --- a/server/util_cfgtree.c +++ /dev/null @@ -1,89 +0,0 @@ -/* ==================================================================== - * The Apache Software License, Version 1.1 - * - * Copyright (c) 2000 The Apache Software Foundation. All rights - * reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in - * the documentation and/or other materials provided with the - * distribution. - * - * 3. The end-user documentation included with the redistribution, - * if any, must include the following acknowledgment: - * "This product includes software developed by the - * Apache Software Foundation (http://www.apache.org/)." - * Alternately, this acknowledgment may appear in the software itself, - * if and wherever such third-party acknowledgments normally appear. - * - * 4. The names "Apache" and "Apache Software Foundation" must - * not be used to endorse or promote products derived from this - * software without prior written permission. For written - * permission, please contact apache@apache.org. - * - * 5. Products derived from this software may not be called "Apache", - * nor may "Apache" appear in their name, without prior written - * permission of the Apache Software Foundation. - * - * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED - * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES - * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR - * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF - * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND - * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, - * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT - * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * ==================================================================== - * - * This software consists of voluntary contributions made by many - * individuals on behalf of the Apache Software Foundation. For more - * information on the Apache Software Foundation, please see - * . - * - * Portions of this software are based upon public domain software - * originally written at the National Center for Supercomputing Applications, - * University of Illinois, Urbana-Champaign. - */ - -#define CORE_PRIVATE -#include "util_cfgtree.h" -#include - -ap_directive_t *conf_tree; - -ap_directive_t *ap_add_node(ap_directive_t **parent, ap_directive_t *current, - ap_directive_t *toadd, int child) -{ - if (current == NULL) { - /* we just started a new parent */ - if (*parent == NULL) { - /* no parent, no current: root of tree */ - conf_tree = toadd; - } - else { - (*parent)->first_child = toadd; - } - return toadd; - } - current->next = toadd; - toadd->parent = *parent; - if (child) { - /* switch parents, navigate into child */ - *parent = toadd; - return NULL; - } - return conf_tree; -} - - diff --git a/server/util_charset.c b/server/util_charset.c deleted file mode 100644 index 8a613f90759d696f581398679541c16025a50aa0..0000000000000000000000000000000000000000 --- a/server/util_charset.c +++ /dev/null @@ -1,122 +0,0 @@ -/* ==================================================================== - * The Apache Software License, Version 1.1 - * - * Copyright (c) 2000 The Apache Software Foundation. All rights - * reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in - * the documentation and/or other materials provided with the - * distribution. - * - * 3. The end-user documentation included with the redistribution, - * if any, must include the following acknowledgment: - * "This product includes software developed by the - * Apache Software Foundation (http://www.apache.org/)." - * Alternately, this acknowledgment may appear in the software itself, - * if and wherever such third-party acknowledgments normally appear. - * - * 4. The names "Apache" and "Apache Software Foundation" must - * not be used to endorse or promote products derived from this - * software without prior written permission. For written - * permission, please contact apache@apache.org. - * - * 5. Products derived from this software may not be called "Apache", - * nor may "Apache" appear in their name, without prior written - * permission of the Apache Software Foundation. - * - * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED - * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES - * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR - * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF - * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND - * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, - * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT - * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * ==================================================================== - * - * This software consists of voluntary contributions made by many - * individuals on behalf of the Apache Software Foundation. For more - * information on the Apache Software Foundation, please see - * . - * - * Portions of this software are based upon public domain software - * originally written at the National Center for Supercomputing Applications, - * University of Illinois, Urbana-Champaign. - */ - -#include "ap_config.h" - -#ifdef APACHE_XLATE - -#include "httpd.h" -#include "http_log.h" -#include "http_core.h" -#include "util_charset.h" - -/* ap_hdrs_to_ascii, ap_hdrs_from_ascii - * - * These are the translation handles used to translate between the network - * format of protocol headers and the local machine format. - * - * For an EBCDIC machine, these are valid handles which are set up at - * initialization to translate between ISO-8859-1 and the code page of - * the source code. - * - * For an ASCII machine, these remain NULL so that when they are stored - * in the BUFF via ap_bsetop(BO_WXLATE or BO_RXLATE) it ensures that no - * translation is performed. - */ - -ap_xlate_t *ap_hdrs_to_ascii, *ap_hdrs_from_ascii; - -/* ap_locale_to_ascii, ap_locale_from_ascii - * - * These handles are used for the translation of content, unless a - * configuration module overrides them. - * - * For an EBCDIC machine, these are valid handles which are set up at - * initialization to translate between ISO-8859-1 and the code page of - * the httpd process's locale. - * - * For an ASCII machine, these remain NULL so that no translation is - * performed (unless a configuration module does something, of course). - */ - -ap_xlate_t *ap_locale_to_ascii, *ap_locale_from_ascii; - -API_EXPORT(ap_status_t) ap_set_content_xlate(request_rec *r, int output, - ap_xlate_t *xlate) -{ - ap_status_t rv; - - if (output) { - r->rrx->to_net = xlate; - rv = ap_bsetopt(r->connection->client, BO_WXLATE, &xlate); - } - else { - r->rrx->from_net = xlate; - rv = ap_bsetopt(r->connection->client, BO_RXLATE, &xlate); - } - - if (rv) { - ap_log_rerror(APLOG_MARK, APLOG_ERR, rv, r, - "BO_%sXLATE failed", - output ? "W" : "R"); - } - - return rv; -} - -#endif /*APACHE_XLATE*/ diff --git a/server/util_debug.c b/server/util_debug.c deleted file mode 100644 index 415fdcac8e98a03ec2276afcd94450399df8b6fa..0000000000000000000000000000000000000000 --- a/server/util_debug.c +++ /dev/null @@ -1,78 +0,0 @@ -/* ==================================================================== - * The Apache Software License, Version 1.1 - * - * Copyright (c) 2000 The Apache Software Foundation. All rights - * reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in - * the documentation and/or other materials provided with the - * distribution. - * - * 3. The end-user documentation included with the redistribution, - * if any, must include the following acknowledgment: - * "This product includes software developed by the - * Apache Software Foundation (http://www.apache.org/)." - * Alternately, this acknowledgment may appear in the software itself, - * if and wherever such third-party acknowledgments normally appear. - * - * 4. The names "Apache" and "Apache Software Foundation" must - * not be used to endorse or promote products derived from this - * software without prior written permission. For written - * permission, please contact apache@apache.org. - * - * 5. Products derived from this software may not be called "Apache", - * nor may "Apache" appear in their name, without prior written - * permission of the Apache Software Foundation. - * - * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED - * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES - * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR - * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF - * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND - * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, - * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT - * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * ==================================================================== - * - * This software consists of voluntary contributions made by many - * individuals on behalf of the Apache Software Foundation. For more - * information on the Apache Software Foundation, please see - * . - * - * Portions of this software are based upon public domain software - * originally written at the National Center for Supercomputing Applications, - * University of Illinois, Urbana-Champaign. - */ - -#include "httpd.h" - -#ifdef AP_DEBUG -# undef strchr - -char *ap_strchr(char *s, int c) -{ return strchr(s,c); } - -const char *ap_strchr_c(const char *s, int c) -{ return strchr(s,c); } - -# undef strrchr - -char *ap_strrchr(char *s, int c) -{ return strrchr(s,c); } - -const char *ap_strrchr_c(const char *s, int c) -{ return strrchr(s,c); } - -#endif diff --git a/server/util_ebcdic.c b/server/util_ebcdic.c deleted file mode 100644 index e1f5e4cebe87ef2da2f4604ee858e00ce767a935..0000000000000000000000000000000000000000 --- a/server/util_ebcdic.c +++ /dev/null @@ -1,103 +0,0 @@ -/* ==================================================================== - * The Apache Software License, Version 1.1 - * - * Copyright (c) 2000 The Apache Software Foundation. All rights - * reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in - * the documentation and/or other materials provided with the - * distribution. - * - * 3. The end-user documentation included with the redistribution, - * if any, must include the following acknowledgment: - * "This product includes software developed by the - * Apache Software Foundation (http://www.apache.org/)." - * Alternately, this acknowledgment may appear in the software itself, - * if and wherever such third-party acknowledgments normally appear. - * - * 4. The names "Apache" and "Apache Software Foundation" must - * not be used to endorse or promote products derived from this - * software without prior written permission. For written - * permission, please contact apache@apache.org. - * - * 5. Products derived from this software may not be called "Apache", - * nor may "Apache" appear in their name, without prior written - * permission of the Apache Software Foundation. - * - * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED - * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES - * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR - * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF - * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND - * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, - * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT - * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * ==================================================================== - * - * This software consists of voluntary contributions made by many - * individuals on behalf of the Apache Software Foundation. For more - * information on the Apache Software Foundation, please see - * . - * - * Portions of this software are based upon public domain software - * originally written at the National Center for Supercomputing Applications, - * University of Illinois, Urbana-Champaign. - */ - -#define CORE_PRIVATE -#include "ap_config.h" - -#ifdef CHARSET_EBCDIC - -#include "httpd.h" -#include "http_log.h" -#include "util_ebcdic.h" - -ap_xlate_t *hdrs_to_ascii, *hdrs_from_ascii; -ap_xlate_t *locale_to_ascii, *locale_from_ascii; - -ap_status_t ap_init_ebcdic(ap_pool_t *pool) -{ - ap_status_t rv; - char buf[80]; - - rv = ap_xlate_open(&hdrs_to_ascii, "ISO8859-1", APR_DEFAULT_CHARSET, pool); - if (rv) { - ap_log_error(APLOG_MARK, APLOG_ERR, rv, NULL, - "ap_xlate_open() failed"); - return rv; - } - - rv = ap_xlate_open(&hdrs_from_ascii, APR_DEFAULT_CHARSET, "ISO8859-1", pool); - if (rv) { - ap_log_error(APLOG_MARK, APLOG_ERR, rv, NULL, - "ap_xlate_open() failed"); - return rv; - } - - locale_to_ascii = hdrs_to_ascii; /* TODO: "ISO8859-1" to APR_LOCALE_CHARSET */ - locale_from_ascii = hdrs_from_ascii; /* TODO: APR_LOCALE_CHARSET to "ISO8859-1" */ - - rv = ap_MD5InitEBCDIC(hdrs_to_ascii); - if (rv) { - ap_log_error(APLOG_MARK, APLOG_ERR, rv, NULL, - "ap_MD5InitEBCDIC() failed"); - return rv; - } - - return APR_SUCCESS; -} - -#endif /* CHARSET_EBCDIC */ diff --git a/server/util_filter.c b/server/util_filter.c deleted file mode 100644 index 77bdc98728fb8bf33f38de29e09be86a747bccdf..0000000000000000000000000000000000000000 --- a/server/util_filter.c +++ /dev/null @@ -1,146 +0,0 @@ -/* ==================================================================== - * The Apache Software License, Version 1.1 - * - * Copyright (c) 2000 The Apache Software Foundation. All rights - * reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in - * the documentation and/or other materials provided with the - * distribution. - * - * 3. The end-user documentation included with the redistribution, - * if any, must include the following acknowledgment: - * "This product includes software developed by the - * Apache Software Foundation (http://www.apache.org/)." - * Alternately, this acknowledgment may appear in the software itself, - * if and wherever such third-party acknowledgments normally appear. - * - * 4. The names "Apache" and "Apache Software Foundation" must - * not be used to endorse or promote products derived from this - * software without prior written permission. For written - * permission, please contact apache@apache.org. - * - * 5. Products derived from this software may not be called "Apache", - * nor may "Apache" appear in their name, without prior written - * permission of the Apache Software Foundation. - * - * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED - * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES - * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR - * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF - * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND - * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, - * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT - * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * ==================================================================== - * - * This software consists of voluntary contributions made by many - * individuals on behalf of the Apache Software Foundation. For more - * information on the Apache Software Foundation, please see - * . - */ - -#include "util_filter.h" - -/* - * ap_filter_rec_t: - * - * This (internal) structure is used for recording information about the - * registered filters. It associates a name with the filter's callback - * and filter type. - * - * At the moment, these are simply linked in a chain, so a ->next pointer - * is available. - */ -typedef struct ap_filter_rec_t { - const char *name; - ap_filter_func filter_func; - ap_filter_type ftype; - - struct ap_filter_rec_t *next; -} ap_filter_rec_t; - -/* ### make this visible for direct manipulation? - ### use a hash table -*/ -static ap_filter_rec_t *registered_filters = NULL; - -/* NOTE: Apache's current design doesn't allow a pool to be passed thu, - so we depend on a global to hold the correct pool -*/ -#define FILTER_POOL ap_global_hook_pool -#include "ap_hooks.h" /* for ap_global_hook_pool */ - -/* -** This macro returns true/false if a given filter should be inserted BEFORE -** another filter. This will happen when one of: 1) there isn't another -** filter; 2) that filter has a higher filter type (class); 3) that filter -** corresponds to a different request. -*/ -#define INSERT_BEFORE(f, before_this) ((before_this) == NULL \ - || (before_this)->ftype > (f)->ftype) - - -static ap_status_t filter_cleanup(void *ctx) -{ - registered_filters = NULL; - return APR_SUCCESS; -} - -API_EXPORT(void) ap_register_filter(const char *name, - ap_filter_func filter_func, - ap_filter_type ftype) -{ - ap_filter_rec_t *frec = ap_palloc(FILTER_POOL, sizeof(*frec)); - - frec->name = name; - frec->filter_func = filter_func; - frec->ftype = ftype; - - frec->next = registered_filters; - registered_filters = frec; - - ap_register_cleanup(FILTER_POOL, NULL, filter_cleanup, NULL); -} - -API_EXPORT(void) ap_add_filter(const char *name, void *ctx, request_rec *r) -{ - ap_filter_rec_t *frec = registered_filters; - - for (; frec != NULL; frec = frec->next) { - if (!strcasecmp(name, frec->name)) { - ap_filter_t *f = ap_pcalloc(r->pool, sizeof(*f)); - - f->filter_func = frec->filter_func; - f->ctx = ctx; - f->ftype = frec->ftype; - - if (INSERT_BEFORE(f, r->filters)) { - f->next = r->filters; - r->filters = f; - } - else { - ap_filter_t *fscan = r->filters; - while (!INSERT_BEFORE(f, fscan->next)) - fscan = fscan->next; - f->next = fscan->next; - fscan->next = f; - } - - break; - } - } -} - diff --git a/server/util_md5.c b/server/util_md5.c deleted file mode 100644 index 368ddf63b230edf1febecf23907df8e777e4469d..0000000000000000000000000000000000000000 --- a/server/util_md5.c +++ /dev/null @@ -1,229 +0,0 @@ -/* ==================================================================== - * Copyright (c) 1995-1999 The Apache Group. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in - * the documentation and/or other materials provided with the - * distribution. - * - * 3. All advertising materials mentioning features or use of this - * software must display the following acknowledgment: - * "This product includes software developed by the Apache Group - * for use in the Apache HTTP server project (http://www.apache.org/)." - * - * 4. The names "Apache Server" and "Apache Group" must not be used to - * endorse or promote products derived from this software without - * prior written permission. For written permission, please contact - * apache@apache.org. - * - * 5. Products derived from this software may not be called "Apache" - * nor may "Apache" appear in their names without prior written - * permission of the Apache Group. - * - * 6. Redistributions of any form whatsoever must retain the following - * acknowledgment: - * "This product includes software developed by the Apache Group - * for use in the Apache HTTP server project (http://www.apache.org/)." - * - * THIS SOFTWARE IS PROVIDED BY THE APACHE GROUP ``AS IS'' AND ANY - * EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR - * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE APACHE GROUP OR - * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT - * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, - * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED - * OF THE POSSIBILITY OF SUCH DAMAGE. - * ==================================================================== - * - * This software consists of voluntary contributions made by many - * individuals on behalf of the Apache Group and was originally based - * on public domain software written at the National Center for - * Supercomputing Applications, University of Illinois, Urbana-Champaign. - * For more information on the Apache Group and the Apache HTTP server - * project, please see . - * - */ - -/************************************************************************ - * NCSA HTTPd Server - * Software Development Group - * National Center for Supercomputing Applications - * University of Illinois at Urbana-Champaign - * 605 E. Springfield, Champaign, IL 61820 - * httpd@ncsa.uiuc.edu - * - * Copyright (C) 1995, Board of Trustees of the University of Illinois - * - ************************************************************************ - * - * md5.c: NCSA HTTPd code which uses the md5c.c RSA Code - * - * Original Code Copyright (C) 1994, Jeff Hostetler, Spyglass, Inc. - * Portions of Content-MD5 code Copyright (C) 1993, 1994 by Carnegie Mellon - * University (see Copyright below). - * Portions of Content-MD5 code Copyright (C) 1991 Bell Communications - * Research, Inc. (Bellcore) (see Copyright below). - * Portions extracted from mpack, John G. Myers - jgm+@cmu.edu - * Content-MD5 Code contributed by Martin Hamilton (martin@net.lut.ac.uk) - * - */ - - - -/* md5.c --Module Interface to MD5. */ -/* Jeff Hostetler, Spyglass, Inc., 1994. */ - -#include "httpd.h" -#include "util_md5.h" - -API_EXPORT(char *) ap_md5_binary(pool *p, const unsigned char *buf, int length) -{ - const char *hex = "0123456789abcdef"; - AP_MD5_CTX my_md5; - unsigned char hash[16]; - char *r, result[33]; - int i; - - /* - * Take the MD5 hash of the string argument. - */ - - ap_MD5Init(&my_md5); - ap_MD5Update(&my_md5, buf, (unsigned int)length); - ap_MD5Final(hash, &my_md5); - - for (i = 0, r = result; i < 16; i++) { - *r++ = hex[hash[i] >> 4]; - *r++ = hex[hash[i] & 0xF]; - } - *r = '\0'; - - return ap_pstrdup(p, result); -} - -API_EXPORT(char *) ap_md5(pool *p, const unsigned char *string) -{ - return ap_md5_binary(p, string, (int) strlen((char *)string)); -} - -/* these portions extracted from mpack, John G. Myers - jgm+@cmu.edu */ - -/* (C) Copyright 1993,1994 by Carnegie Mellon University - * All Rights Reserved. - * - * Permission to use, copy, modify, distribute, and sell this software - * and its documentation for any purpose is hereby granted without - * fee, provided that the above copyright notice appear in all copies - * and that both that copyright notice and this permission notice - * appear in supporting documentation, and that the name of Carnegie - * Mellon University not be used in advertising or publicity - * pertaining to distribution of the software without specific, - * written prior permission. Carnegie Mellon University makes no - * representations about the suitability of this software for any - * purpose. It is provided "as is" without express or implied - * warranty. - * - * CARNEGIE MELLON UNIVERSITY DISCLAIMS ALL WARRANTIES WITH REGARD TO - * THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY - * AND FITNESS, IN NO EVENT SHALL CARNEGIE MELLON UNIVERSITY BE LIABLE - * FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES - * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN - * AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING - * OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS - * SOFTWARE. - */ - -/* - * Copyright (c) 1991 Bell Communications Research, Inc. (Bellcore) - * - * Permission to use, copy, modify, and distribute this material - * for any purpose and without fee is hereby granted, provided - * that the above copyright notice and this permission notice - * appear in all copies, and that the name of Bellcore not be - * used in advertising or publicity pertaining to this - * material without the specific, prior written permission - * of an authorized representative of Bellcore. BELLCORE - * MAKES NO REPRESENTATIONS ABOUT THE ACCURACY OR SUITABILITY - * OF THIS MATERIAL FOR ANY PURPOSE. IT IS PROVIDED "AS IS", - * WITHOUT ANY EXPRESS OR IMPLIED WARRANTIES. - */ - -static char basis_64[] = -"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/"; - -API_EXPORT(char *) ap_md5contextTo64(pool *a, AP_MD5_CTX * context) -{ - unsigned char digest[18]; - char *encodedDigest; - int i; - char *p; - - encodedDigest = (char *) ap_pcalloc(a, 25 * sizeof(char)); - - ap_MD5Final(digest, context); - digest[sizeof(digest) - 1] = digest[sizeof(digest) - 2] = 0; - - p = encodedDigest; - for (i = 0; i < sizeof(digest); i += 3) { - *p++ = basis_64[digest[i] >> 2]; - *p++ = basis_64[((digest[i] & 0x3) << 4) | ((int) (digest[i + 1] & 0xF0) >> 4)]; - *p++ = basis_64[((digest[i + 1] & 0xF) << 2) | ((int) (digest[i + 2] & 0xC0) >> 6)]; - *p++ = basis_64[digest[i + 2] & 0x3F]; - } - *p-- = '\0'; - *p-- = '='; - *p-- = '='; - return encodedDigest; -} - -#ifdef CHARSET_EBCDIC - -API_EXPORT(char *) ap_md5digest(pool *p, FILE *infile, int convert) -{ - AP_MD5_CTX context; - unsigned char buf[1000]; - long length = 0; - int nbytes; - - ap_MD5Init(&context); - while ((nbytes = fread(buf, 1, sizeof(buf), infile))) { - length += nbytes; - if (!convert) { - ascii2ebcdic(buf, buf, nbytes); - } - ap_MD5Update(&context, buf, nbytes); - } - rewind(infile); - return ap_md5contextTo64(p, &context); -} - -#else - -API_EXPORT(char *) ap_md5digest(pool *p, FILE *infile) -{ - AP_MD5_CTX context; - unsigned char buf[1000]; - long length = 0; - unsigned int nbytes; - - ap_MD5Init(&context); - while ((nbytes = fread(buf, 1, sizeof(buf), infile))) { - length += nbytes; - ap_MD5Update(&context, buf, nbytes); - } - rewind(infile); - return ap_md5contextTo64(p, &context); -} - -#endif /* CHARSET_EBCDIC */ diff --git a/server/util_script.c b/server/util_script.c deleted file mode 100644 index 467dd2964c1972e5cbcd2a0ebbb2ad951d13afea..0000000000000000000000000000000000000000 --- a/server/util_script.c +++ /dev/null @@ -1,1138 +0,0 @@ -/* ==================================================================== - * Copyright (c) 1995-1999 The Apache Group. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in - * the documentation and/or other materials provided with the - * distribution. - * - * 3. All advertising materials mentioning features or use of this - * software must display the following acknowledgment: - * "This product includes software developed by the Apache Group - * for use in the Apache HTTP server project (http://www.apache.org/)." - * - * 4. The names "Apache Server" and "Apache Group" must not be used to - * endorse or promote products derived from this software without - * prior written permission. For written permission, please contact - * apache@apache.org. - * - * 5. Products derived from this software may not be called "Apache" - * nor may "Apache" appear in their names without prior written - * permission of the Apache Group. - * - * 6. Redistributions of any form whatsoever must retain the following - * acknowledgment: - * "This product includes software developed by the Apache Group - * for use in the Apache HTTP server project (http://www.apache.org/)." - * - * THIS SOFTWARE IS PROVIDED BY THE APACHE GROUP ``AS IS'' AND ANY - * EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR - * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE APACHE GROUP OR - * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT - * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, - * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED - * OF THE POSSIBILITY OF SUCH DAMAGE. - * ==================================================================== - * - * This software consists of voluntary contributions made by many - * individuals on behalf of the Apache Group and was originally based - * on public domain software written at the National Center for - * Supercomputing Applications, University of Illinois, Urbana-Champaign. - * For more information on the Apache Group and the Apache HTTP server - * project, please see . - * - */ - -#define CORE_PRIVATE -#include "httpd.h" -#include "http_config.h" -#include "http_conf_globals.h" -#include "http_main.h" -#include "http_log.h" -#include "http_protocol.h" -#include "http_core.h" /* For document_root. Sigh... */ -#include "http_request.h" /* for sub_req_lookup_uri() */ -#include "util_script.h" -#include "util_date.h" /* For parseHTTPdate() */ - -#ifdef OS2 -#define INCL_DOS -#include -#endif - -/* - * Various utility functions which are common to a whole lot of - * script-type extensions mechanisms, and might as well be gathered - * in one place (if only to avoid creating inter-module dependancies - * where there don't have to be). - */ - -#define MALFORMED_MESSAGE "malformed header from script. Bad header=" -#define MALFORMED_HEADER_LENGTH_TO_SHOW 30 - -/* If a request includes query info in the URL (stuff after "?"), and - * the query info does not contain "=" (indicative of a FORM submission), - * then this routine is called to create the argument list to be passed - * to the CGI script. When suexec is enabled, the suexec path, user, and - * group are the first three arguments to be passed; if not, all three - * must be NULL. The query info is split into separate arguments, where - * "+" is the separator between keyword arguments. - * - * XXXX: note that the WIN32 code uses one of the suexec strings - * to pass an interpreter name. Remember this if changing the way they - * are handled in create_argv. - * - */ -static char **create_argv(pool *p, char *path, char *user, char *group, - char *av0, const char *args) -{ - int x, numwords; - char **av; - char *w; - int idx = 0; - - /* count the number of keywords */ - - for (x = 0, numwords = 1; args[x]; x++) { - if (args[x] == '+') { - ++numwords; - } - } - - if (numwords > APACHE_ARG_MAX - 5) { - numwords = APACHE_ARG_MAX - 5; /* Truncate args to prevent overrun */ - } - av = (char **) ap_palloc(p, (numwords + 5) * sizeof(char *)); - - if (path) { - av[idx++] = path; - } - if (user) { - av[idx++] = user; - } - if (group) { - av[idx++] = group; - } - - av[idx++] = av0; - - for (x = 1; x <= numwords; x++) { - w = ap_getword_nulls(p, &args, '+'); - ap_unescape_url(w); - av[idx++] = ap_escape_shell_cmd(p, w); - } - av[idx] = NULL; - return av; -} - - -static char *http2env(pool *a, char *w) -{ - char *res = ap_pstrcat(a, "HTTP_", w, NULL); - char *cp = res; - - while (*++cp) { - if (!ap_isalnum(*cp) && *cp != '_') { - *cp = '_'; - } - else { - *cp = ap_toupper(*cp); - } - } - - return res; -} - -API_EXPORT(char **) ap_create_environment(pool *p, table *t) -{ - array_header *env_arr = ap_table_elts(t); - table_entry *elts = (table_entry *) env_arr->elts; - char **env = (char **) ap_palloc(p, (env_arr->nelts + 2) * sizeof(char *)); - int i, j; - char *tz; - char *whack; - - j = 0; - if (!ap_table_get(t, "TZ")) { - tz = getenv("TZ"); - if (tz != NULL) { - env[j++] = ap_pstrcat(p, "TZ=", tz, NULL); - } - } - for (i = 0; i < env_arr->nelts; ++i) { - if (!elts[i].key) { - continue; - } - env[j] = ap_pstrcat(p, elts[i].key, "=", elts[i].val, NULL); - whack = env[j]; - if (ap_isdigit(*whack)) { - *whack++ = '_'; - } - while (*whack != '=') { - if (!ap_isalnum(*whack) && *whack != '_') { - *whack = '_'; - } - ++whack; - } - ++j; - } - - env[j] = NULL; - return env; -} - -API_EXPORT(void) ap_add_common_vars(request_rec *r) -{ - table *e; - server_rec *s = r->server; - conn_rec *c = r->connection; - const char *rem_logname; - char *env_path; -#ifdef WIN32 - char *env_temp; -#endif - const char *host; - array_header *hdrs_arr = ap_table_elts(r->headers_in); - table_entry *hdrs = (table_entry *) hdrs_arr->elts; - int i; - - /* use a temporary table which we'll overlap onto - * r->subprocess_env later - */ - e = ap_make_table(r->pool, 25 + hdrs_arr->nelts); - - /* First, add environment vars from headers... this is as per - * CGI specs, though other sorts of scripting interfaces see - * the same vars... - */ - - for (i = 0; i < hdrs_arr->nelts; ++i) { - if (!hdrs[i].key) { - continue; - } - - /* A few headers are special cased --- Authorization to prevent - * rogue scripts from capturing passwords; content-type and -length - * for no particular reason. - */ - - if (!strcasecmp(hdrs[i].key, "Content-type")) { - ap_table_addn(e, "CONTENT_TYPE", hdrs[i].val); - } - else if (!strcasecmp(hdrs[i].key, "Content-length")) { - ap_table_addn(e, "CONTENT_LENGTH", hdrs[i].val); - } - /* - * You really don't want to disable this check, since it leaves you - * wide open to CGIs stealing passwords and people viewing them - * in the environment with "ps -e". But, if you must... - */ -#ifndef SECURITY_HOLE_PASS_AUTHORIZATION - else if (!strcasecmp(hdrs[i].key, "Authorization") - || !strcasecmp(hdrs[i].key, "Proxy-Authorization")) { - continue; - } -#endif - else { - ap_table_addn(e, http2env(r->pool, hdrs[i].key), hdrs[i].val); - } - } - - if (!(env_path = getenv("PATH"))) { - env_path = DEFAULT_PATH; - } - -#ifdef WIN32 - if (env_temp = getenv("SystemRoot")) { - ap_table_addn(e, "SystemRoot", env_temp); - } - if (env_temp = getenv("COMSPEC")) { - ap_table_addn(e, "COMSPEC", env_temp); - } - if (env_temp = getenv("WINDIR")) { - ap_table_addn(e, "WINDIR", env_temp); - } -#endif - - ap_table_addn(e, "PATH", env_path); - ap_table_addn(e, "SERVER_SIGNATURE", ap_psignature("", r)); - ap_table_addn(e, "SERVER_SOFTWARE", ap_get_server_version()); - ap_table_addn(e, "SERVER_NAME", ap_get_server_name(r)); - ap_table_addn(e, "SERVER_ADDR", r->connection->local_ip); /* Apache */ - ap_table_addn(e, "SERVER_PORT", - ap_psprintf(r->pool, "%u", ap_get_server_port(r))); - host = ap_get_remote_host(c, r->per_dir_config, REMOTE_HOST); - if (host) { - ap_table_addn(e, "REMOTE_HOST", host); - } - ap_table_addn(e, "REMOTE_ADDR", c->remote_ip); - ap_table_addn(e, "DOCUMENT_ROOT", ap_document_root(r)); /* Apache */ - ap_table_addn(e, "SERVER_ADMIN", s->server_admin); /* Apache */ - ap_table_addn(e, "SCRIPT_FILENAME", r->filename); /* Apache */ - - ap_table_addn(e, "REMOTE_PORT", - ap_psprintf(r->pool, "%d", ntohs(c->remote_addr.sin_port))); - - if (c->user) { - ap_table_addn(e, "REMOTE_USER", c->user); - } - if (c->ap_auth_type) { - ap_table_addn(e, "AUTH_TYPE", c->ap_auth_type); - } - rem_logname = ap_get_remote_logname(r); - if (rem_logname) { - ap_table_addn(e, "REMOTE_IDENT", ap_pstrdup(r->pool, rem_logname)); - } - - /* Apache custom error responses. If we have redirected set two new vars */ - - if (r->prev) { - if (r->prev->args) { - ap_table_addn(e, "REDIRECT_QUERY_STRING", r->prev->args); - } - if (r->prev->uri) { - ap_table_addn(e, "REDIRECT_URL", r->prev->uri); - } - } - - ap_overlap_tables(r->subprocess_env, e, AP_OVERLAP_TABLES_SET); -} - -/* This "cute" little function comes about because the path info on - * filenames and URLs aren't always the same. So we take the two, - * and find as much of the two that match as possible. - */ - -API_EXPORT(int) ap_find_path_info(const char *uri, const char *path_info) -{ - int lu = strlen(uri); - int lp = strlen(path_info); - - while (lu-- && lp-- && uri[lu] == path_info[lp]); - - if (lu == -1) { - lu = 0; - } - - while (uri[lu] != '\0' && uri[lu] != '/') { - lu++; - } - return lu; -} - -/* Obtain the Request-URI from the original request-line, returning - * a new string from the request pool containing the URI or "". - */ -static char *original_uri(request_rec *r) -{ - char *first, *last; - - if (r->the_request == NULL) { - return (char *) ap_pcalloc(r->pool, 1); - } - - first = r->the_request; /* use the request-line */ - - while (*first && !ap_isspace(*first)) { - ++first; /* skip over the method */ - } - while (ap_isspace(*first)) { - ++first; /* and the space(s) */ - } - - last = first; - while (*last && !ap_isspace(*last)) { - ++last; /* end at next whitespace */ - } - - return ap_pstrndup(r->pool, first, last - first); -} - -API_EXPORT(void) ap_add_cgi_vars(request_rec *r) -{ - table *e = r->subprocess_env; - - ap_table_setn(e, "GATEWAY_INTERFACE", "CGI/1.1"); - ap_table_setn(e, "SERVER_PROTOCOL", r->protocol); - ap_table_setn(e, "REQUEST_METHOD", r->method); - ap_table_setn(e, "QUERY_STRING", r->args ? r->args : ""); - ap_table_setn(e, "REQUEST_URI", original_uri(r)); - - /* Note that the code below special-cases scripts run from includes, - * because it "knows" that the sub_request has been hacked to have the - * args and path_info of the original request, and not any that may have - * come with the script URI in the include command. Ugh. - */ - - if (!strcmp(r->protocol, "INCLUDED")) { - ap_table_setn(e, "SCRIPT_NAME", r->uri); - if (r->path_info && *r->path_info) { - ap_table_setn(e, "PATH_INFO", r->path_info); - } - } - else if (!r->path_info || !*r->path_info) { - ap_table_setn(e, "SCRIPT_NAME", r->uri); - } - else { - int path_info_start = ap_find_path_info(r->uri, r->path_info); - - ap_table_setn(e, "SCRIPT_NAME", - ap_pstrndup(r->pool, r->uri, path_info_start)); - - ap_table_setn(e, "PATH_INFO", r->path_info); - } - - if (r->path_info && r->path_info[0]) { - /* - * To get PATH_TRANSLATED, treat PATH_INFO as a URI path. - * Need to re-escape it for this, since the entire URI was - * un-escaped before we determined where the PATH_INFO began. - */ - request_rec *pa_req; - - pa_req = ap_sub_req_lookup_uri(ap_escape_uri(r->pool, r->path_info), r); - - if (pa_req->filename) { -#ifdef WIN32 - char buffer[HUGE_STRING_LEN]; -#endif - char *pt = ap_pstrcat(r->pool, pa_req->filename, pa_req->path_info, - NULL); -#ifdef WIN32 - /* We need to make this a real Windows path name */ - GetFullPathName(pt, HUGE_STRING_LEN, buffer, NULL); - ap_table_setn(e, "PATH_TRANSLATED", ap_pstrdup(r->pool, buffer)); -#else - ap_table_setn(e, "PATH_TRANSLATED", pt); -#endif - } - ap_destroy_sub_req(pa_req); - } -} - - -static int set_cookie_doo_doo(void *v, const char *key, const char *val) -{ - ap_table_addn(v, key, val); - return 1; -} - -API_EXPORT(int) ap_scan_script_header_err_core(request_rec *r, char *buffer, - int (*getsfunc) (char *, int, void *), - void *getsfunc_data) -{ - char x[MAX_STRING_LEN]; - char *w, *l; - int p; - int cgi_status = HTTP_OK; - table *merge; - table *cookie_table; - - if (buffer) { - *buffer = '\0'; - } - w = buffer ? buffer : x; - - ap_hard_timeout("read script header", r); - - /* temporary place to hold headers to merge in later */ - merge = ap_make_table(r->pool, 10); - - /* The HTTP specification says that it is legal to merge duplicate - * headers into one. Some browsers that support Cookies don't like - * merged headers and prefer that each Set-Cookie header is sent - * separately. Lets humour those browsers by not merging. - * Oh what a pain it is. - */ - cookie_table = ap_make_table(r->pool, 2); - ap_table_do(set_cookie_doo_doo, cookie_table, r->err_headers_out, "Set-Cookie", NULL); - - while (1) { - - if ((*getsfunc) (w, MAX_STRING_LEN - 1, getsfunc_data) == 0) { - ap_kill_timeout(r); - ap_log_rerror(APLOG_MARK, APLOG_NOERRNO|APLOG_ERR, r, - "Premature end of script headers: %s", r->filename); - return HTTP_INTERNAL_SERVER_ERROR; - } - - /* Delete terminal (CR?)LF */ - - p = strlen(w); - if (p > 0 && w[p - 1] == '\n') { - if (p > 1 && w[p - 2] == '\015') { - w[p - 2] = '\0'; - } - else { - w[p - 1] = '\0'; - } - } - - /* - * If we've finished reading the headers, check to make sure any - * HTTP/1.1 conditions are met. If so, we're done; normal processing - * will handle the script's output. If not, just return the error. - * The appropriate thing to do would be to send the script process a - * SIGPIPE to let it know we're ignoring it, close the channel to the - * script process, and *then* return the failed-to-meet-condition - * error. Otherwise we'd be waiting for the script to finish - * blithering before telling the client the output was no good. - * However, we don't have the information to do that, so we have to - * leave it to an upper layer. - */ - if (w[0] == '\0') { - int cond_status = OK; - - ap_kill_timeout(r); - if ((cgi_status == HTTP_OK) && (r->method_number == M_GET)) { - cond_status = ap_meets_conditions(r); - } - ap_overlap_tables(r->err_headers_out, merge, - AP_OVERLAP_TABLES_MERGE); - if (!ap_is_empty_table(cookie_table)) { - /* the cookies have already been copied to the cookie_table */ - ap_table_unset(r->err_headers_out, "Set-Cookie"); - r->err_headers_out = ap_overlay_tables(r->pool, - r->err_headers_out, cookie_table); - } - return cond_status; - } - - /* if we see a bogus header don't ignore it. Shout and scream */ - -#ifdef CHARSET_EBCDIC - /* Chances are that we received an ASCII header text instead of - * the expected EBCDIC header lines. Try to auto-detect: - */ - if (!(l = strchr(w, ':'))) { - int maybeASCII = 0, maybeEBCDIC = 0; - char *cp; - - for (cp = w; *cp != '\0'; ++cp) { - if (isprint(*cp) && !isprint(os_toebcdic[*cp])) - ++maybeEBCDIC; - if (!isprint(*cp) && isprint(os_toebcdic[*cp])) - ++maybeASCII; - } - if (maybeASCII > maybeEBCDIC) { - ap_log_error(APLOG_MARK, APLOG_NOERRNO|APLOG_ERR, r->server, - "CGI Interface Error: Script headers apparently ASCII: (CGI = %s)", r->filename); - ascii2ebcdic(w, w, cp - w); - } - } -#endif - if (!(l = strchr(w, ':'))) { - char malformed[(sizeof MALFORMED_MESSAGE) + 1 - + MALFORMED_HEADER_LENGTH_TO_SHOW]; - - strcpy(malformed, MALFORMED_MESSAGE); - strncat(malformed, w, MALFORMED_HEADER_LENGTH_TO_SHOW); - - if (!buffer) { - /* Soak up all the script output - may save an outright kill */ - while ((*getsfunc) (w, MAX_STRING_LEN - 1, getsfunc_data)) { - continue; - } - } - - ap_kill_timeout(r); - ap_log_rerror(APLOG_MARK, APLOG_NOERRNO|APLOG_ERR, r, - "%s: %s", malformed, r->filename); - return HTTP_INTERNAL_SERVER_ERROR; - } - - *l++ = '\0'; - while (*l && ap_isspace(*l)) { - ++l; - } - - if (!strcasecmp(w, "Content-type")) { - char *tmp; - - /* Nuke trailing whitespace */ - - char *endp = l + strlen(l) - 1; - while (endp > l && ap_isspace(*endp)) { - *endp-- = '\0'; - } - - tmp = ap_pstrdup(r->pool, l); - ap_content_type_tolower(tmp); - r->content_type = tmp; - } - /* - * If the script returned a specific status, that's what - * we'll use - otherwise we assume 200 OK. - */ - else if (!strcasecmp(w, "Status")) { - r->status = cgi_status = atoi(l); - r->status_line = ap_pstrdup(r->pool, l); - } - else if (!strcasecmp(w, "Location")) { - ap_table_set(r->headers_out, w, l); - } - else if (!strcasecmp(w, "Content-Length")) { - ap_table_set(r->headers_out, w, l); - } - else if (!strcasecmp(w, "Transfer-Encoding")) { - ap_table_set(r->headers_out, w, l); - } - /* - * If the script gave us a Last-Modified header, we can't just - * pass it on blindly because of restrictions on future values. - */ - else if (!strcasecmp(w, "Last-Modified")) { - time_t mtime = ap_parseHTTPdate(l); - - ap_update_mtime(r, mtime); - ap_set_last_modified(r); - } - else if (!strcasecmp(w, "Set-Cookie")) { - ap_table_add(cookie_table, w, l); - } - else { - ap_table_add(merge, w, l); - } - } -} - -static int getsfunc_FILE(char *buf, int len, void *f) -{ - return fgets(buf, len, (FILE *) f) != NULL; -} - -API_EXPORT(int) ap_scan_script_header_err(request_rec *r, FILE *f, - char *buffer) -{ - return ap_scan_script_header_err_core(r, buffer, getsfunc_FILE, f); -} - -static int getsfunc_BUFF(char *w, int len, void *fb) -{ - return ap_bgets(w, len, (BUFF *) fb) > 0; -} - -API_EXPORT(int) ap_scan_script_header_err_buff(request_rec *r, BUFF *fb, - char *buffer) -{ - return ap_scan_script_header_err_core(r, buffer, getsfunc_BUFF, fb); -} - - -API_EXPORT(void) ap_send_size(size_t size, request_rec *r) -{ - /* XXX: this -1 thing is a gross hack */ - if (size == (size_t)-1) { - ap_rputs(" -", r); - } - else if (!size) { - ap_rputs(" 0k", r); - } - else if (size < 1024) { - ap_rputs(" 1k", r); - } - else if (size < 1048576) { - ap_rprintf(r, "%4dk", (size + 512) / 1024); - } - else if (size < 103809024) { - ap_rprintf(r, "%4.1fM", size / 1048576.0); - } - else { - ap_rprintf(r, "%4dM", (size + 524288) / 1048576); - } -} - -#if defined(OS2) || defined(WIN32) -static char **create_argv_cmd(pool *p, char *av0, const char *args, char *path) -{ - register int x, n; - char **av; - char *w; - - for (x = 0, n = 2; args[x]; x++) { - if (args[x] == '+') { - ++n; - } - } - - /* Add extra strings to array. */ - n = n + 2; - - av = (char **) ap_palloc(p, (n + 1) * sizeof(char *)); - av[0] = av0; - - /* Now insert the extra strings we made room for above. */ - av[1] = strdup("/C"); - av[2] = strdup(path); - - for (x = (1 + 2); x < n; x++) { - w = ap_getword(p, &args, '+'); - ap_unescape_url(w); - av[x] = ap_escape_shell_cmd(p, w); - } - av[n] = NULL; - return av; -} -#endif - - -API_EXPORT(int) ap_call_exec(request_rec *r, child_info *pinfo, char *argv0, - char **env, int shellcmd) -{ - int pid = 0; -#if defined(RLIMIT_CPU) || defined(RLIMIT_NPROC) || \ - defined(RLIMIT_DATA) || defined(RLIMIT_VMEM) || defined (RLIMIT_AS) - - core_dir_config *conf; - conf = (core_dir_config *) ap_get_module_config(r->per_dir_config, - &core_module); - -#endif - -#if !defined(WIN32) && !defined(OS2) - /* the fd on r->server->error_log is closed, but we need somewhere to - * put the error messages from the log_* functions. So, we use stderr, - * since that is better than allowing errors to go unnoticed. Don't do - * this on Win32, though, since we haven't fork()'d. - */ - r->server->error_log = stderr; -#endif - -#ifdef RLIMIT_CPU - if (conf->limit_cpu != NULL) { - if ((setrlimit(RLIMIT_CPU, conf->limit_cpu)) != 0) { - ap_log_error(APLOG_MARK, APLOG_ERR, r->server, - "setrlimit: failed to set CPU usage limit"); - } - } -#endif -#ifdef RLIMIT_NPROC - if (conf->limit_nproc != NULL) { - if ((setrlimit(RLIMIT_NPROC, conf->limit_nproc)) != 0) { - ap_log_error(APLOG_MARK, APLOG_ERR, r->server, - "setrlimit: failed to set process limit"); - } - } -#endif -#if defined(RLIMIT_AS) - if (conf->limit_mem != NULL) { - if ((setrlimit(RLIMIT_AS, conf->limit_mem)) != 0) { - ap_log_error(APLOG_MARK, APLOG_ERR, r->server, - "setrlimit(RLIMIT_AS): failed to set memory " - "usage limit"); - } - } -#elif defined(RLIMIT_DATA) - if (conf->limit_mem != NULL) { - if ((setrlimit(RLIMIT_DATA, conf->limit_mem)) != 0) { - ap_log_error(APLOG_MARK, APLOG_ERR, r->server, - "setrlimit(RLIMIT_DATA): failed to set memory " - "usage limit"); - } - } -#elif defined(RLIMIT_VMEM) - if (conf->limit_mem != NULL) { - if ((setrlimit(RLIMIT_VMEM, conf->limit_mem)) != 0) { - ap_log_error(APLOG_MARK, APLOG_ERR, r->server, - "setrlimit(RLIMIT_VMEM): failed to set memory " - "usage limit"); - } - } -#endif - -#ifdef OS2 - { - /* Additions by Alec Kloss, to allow exec'ing of scripts under OS/2 */ - int is_script = 0; - char interpreter[2048]; /* hope it's enough for the interpreter path */ - char error_object[260]; - FILE *program; - char *cmdline = r->filename, *cmdline_pos; - int cmdlen; - char *args = "", *args_end; - ULONG rc; - RESULTCODES rescodes; - int env_len, e; - char *env_block, *env_block_pos; - - if (r->args && r->args[0] && !strchr(r->args, '=')) - args = r->args; - - program = fopen(r->filename, "rt"); - - if (!program) { - ap_log_rerror(APLOG_MARK, APLOG_ERR, r, "fopen(%s) failed", - r->filename); - return (pid); - } - - fgets(interpreter, sizeof(interpreter), program); - fclose(program); - - if (!strncmp(interpreter, "#!", 2)) { - is_script = 1; - interpreter[strlen(interpreter) - 1] = '\0'; - if (interpreter[2] != '/' && interpreter[2] != '\\' && interpreter[3] != ':') { - char buffer[300]; - if (DosSearchPath(SEARCH_ENVIRONMENT, "PATH", interpreter+2, buffer, sizeof(buffer)) == 0) { - strcpy(interpreter+2, buffer); - } else { - strcat(interpreter, ".exe"); - if (DosSearchPath(SEARCH_ENVIRONMENT, "PATH", interpreter+2, buffer, sizeof(buffer)) == 0) { - strcpy(interpreter+2, buffer); - } - } - } - } - - if (is_script) { - cmdline = ap_pstrcat(r->pool, interpreter+2, " ", r->filename, NULL); - } - else if (strstr(strupr(r->filename), ".CMD") > 0) { - /* Special case to allow use of REXX commands as scripts. */ - os2pathname(r->filename); - cmdline = ap_pstrcat(r->pool, SHELL_PATH, " /C ", r->filename, NULL); - } - else { - cmdline = r->filename; - } - - args = ap_pstrdup(r->pool, args); - ap_unescape_url(args); - args = ap_double_quotes(r->pool, args); - args_end = args + strlen(args); - - if (args_end - args > 4000) { /* cmd.exe won't handle lines longer than 4k */ - args_end = args + 4000; - *args_end = 0; - } - - /* +4 = 1 space between progname and args, 2 for double null at end, 2 for possible quote on first arg */ - cmdlen = strlen(cmdline) + strlen(args) + 4; - cmdline_pos = cmdline; - - while (*cmdline_pos) { - cmdlen += 2 * (*cmdline_pos == '+'); /* Allow space for each arg to be quoted */ - cmdline_pos++; - } - - cmdline = ap_pstrndup(r->pool, cmdline, cmdlen); - cmdline_pos = cmdline + strlen(cmdline); - - while (args < args_end) { - char *arg; - - arg = ap_getword_nc(r->pool, &args, '+'); - - if (strpbrk(arg, "&|<> ")) - arg = ap_pstrcat(r->pool, "\"", arg, "\"", NULL); - - *(cmdline_pos++) = ' '; - strcpy(cmdline_pos, arg); - cmdline_pos += strlen(cmdline_pos); - } - - *(++cmdline_pos) = 0; /* Add required second terminator */ - args = strchr(cmdline, ' '); - - if (args) { - *args = 0; - args++; - } - - /* Create environment block from list of envariables */ - for (env_len=1, e=0; env[e]; e++) - env_len += strlen(env[e]) + 1; - - env_block = ap_palloc(r->pool, env_len); - env_block_pos = env_block; - - for (e=0; env[e]; e++) { - strcpy(env_block_pos, env[e]); - env_block_pos += strlen(env_block_pos) + 1; - } - - *env_block_pos = 0; /* environment block is terminated by a double null */ - - rc = DosExecPgm(error_object, sizeof(error_object), EXEC_ASYNC, cmdline, env_block, &rescodes, cmdline); - - if (rc) { - ap_log_rerror(APLOG_MARK, APLOG_ERR, r, "DosExecPgm(%s %s) failed, %s - %s", - cmdline, args ? args : "", ap_os_error_message(rc), error_object ); - return -1; - } - - return rescodes.codeTerminate; - } -#elif defined(WIN32) - { - /* Adapted from Alec Kloss' work for OS/2 */ - char *interpreter = NULL; - char *arguments = NULL; - char *ext = NULL; - char *exename = NULL; - char *s = NULL; - char *quoted_filename; - char *pCommand; - char *pEnvBlock, *pNext; - - int i; - int iEnvBlockLen; - - file_type_e fileType; - - STARTUPINFO si; - PROCESS_INFORMATION pi; - - memset(&si, 0, sizeof(si)); - memset(&pi, 0, sizeof(pi)); - - pid = -1; - - if (!shellcmd) { - - fileType = ap_get_win32_interpreter(r, &interpreter); - - if (fileType == eFileTypeUNKNOWN) { - ap_log_rerror(APLOG_MARK, APLOG_ERR|APLOG_NOERRNO, r, - "%s is not executable; ensure interpreted scripts have " - "\"#!\" first line", - r->filename); - return (pid); - } - - /* - * Look at the arguments... - */ - arguments = ""; - if ((r->args) && (r->args[0]) && !strchr(r->args, '=')) { - /* If we are in this leg, there are some other arguments - * that we must include in the execution of the CGI. - * Because CreateProcess is the way it is, we have to - * create a command line like format for the execution - * of the CGI. This means we need to create on long - * string with the executable and arguments. - * - * The arguments string comes in the request structure, - * and each argument is separated by a '+'. We'll replace - * these pluses with spaces. - */ - - int iStringSize = 0; - int x; - - /* - * Duplicate the request structure string so we don't change it. - */ - arguments = ap_pstrdup(r->pool, r->args); - - /* - * Change the '+' to ' ' - */ - for (x=0; arguments[x]; x++) { - if ('+' == arguments[x]) { - arguments[x] = ' '; - } - } - - /* - * We need to unescape any characters that are - * in the arguments list. - */ - ap_unescape_url(arguments); - arguments = ap_escape_shell_cmd(r->pool, arguments); - } - - /* - * We have the interpreter (if there is one) and we have - * the arguments (if there are any). - * Build the command string to pass to CreateProcess. - */ - quoted_filename = ap_pstrcat(r->pool, "\"", r->filename, "\"", NULL); - if (interpreter && *interpreter) { - pCommand = ap_pstrcat(r->pool, interpreter, " ", - quoted_filename, " ", arguments, NULL); - } - else { - pCommand = ap_pstrcat(r->pool, quoted_filename, " ", arguments, NULL); - } - - } else { - - char *shell_cmd = "CMD.EXE /C "; - OSVERSIONINFO osver; - osver.dwOSVersionInfoSize = sizeof(OSVERSIONINFO); - - /* - * Use CMD.EXE for NT, COMMAND.COM for WIN95 - */ - if (GetVersionEx(&osver)) { - if (osver.dwPlatformId != VER_PLATFORM_WIN32_NT) { - shell_cmd = "COMMAND.COM /C "; - } - } - pCommand = ap_pstrcat(r->pool, shell_cmd, argv0, NULL); - } - - /* - * Make child process use hPipeOutputWrite as standard out, - * and make sure it does not show on screen. - */ - si.cb = sizeof(si); - si.dwFlags = STARTF_USESHOWWINDOW | STARTF_USESTDHANDLES; - si.wShowWindow = SW_HIDE; - si.hStdInput = pinfo->hPipeInputRead; - si.hStdOutput = pinfo->hPipeOutputWrite; - si.hStdError = pinfo->hPipeErrorWrite; - - /* - * Win32's CreateProcess call requires that the environment - * be passed in an environment block, a null terminated block of - * null terminated strings. - */ - i = 0; - iEnvBlockLen = 1; - while (env[i]) { - iEnvBlockLen += strlen(env[i]) + 1; - i++; - } - - pEnvBlock = (char *)ap_pcalloc(r->pool,iEnvBlockLen); - - i = 0; - pNext = pEnvBlock; - while (env[i]) { - strcpy(pNext, env[i]); - pNext = pNext + strlen(pNext) + 1; - i++; - } - - if (CreateProcess(NULL, pCommand, NULL, NULL, TRUE, DETACHED_PROCESS, pEnvBlock, - ap_make_dirstr_parent(r->pool, r->filename), - &si, &pi)) { - if (fileType == eFileTypeEXE16) { - /* Hack to get 16-bit CGI's working. It works for all the - * standard modules shipped with Apache. pi.dwProcessId is 0 - * for 16-bit CGIs and all the Unix specific code that calls - * ap_call_exec interprets this as a failure case. And we can't - * use -1 either because it is mapped to 0 by the caller. - */ - pid = -2; - } - else { - pid = pi.dwProcessId; - /* - * We must close the handles to the new process and its main thread - * to prevent handle and memory leaks. - */ - CloseHandle(pi.hProcess); - CloseHandle(pi.hThread); - } - } - return (pid); - } - -#else - if (ap_suexec_enabled - && ((r->server->server_uid != ap_user_id) - || (r->server->server_gid != ap_group_id) - || (!strncmp("/~", r->uri, 2)))) { - - char *execuser, *grpname; - struct passwd *pw; - struct group *gr; - - if (!strncmp("/~", r->uri, 2)) { - gid_t user_gid; - char *username = ap_pstrdup(r->pool, r->uri + 2); - char *pos = strchr(username, '/'); - - if (pos) { - *pos = '\0'; - } - - if ((pw = getpwnam(username)) == NULL) { - ap_log_rerror(APLOG_MARK, APLOG_ERR, r, - "getpwnam: invalid username %s", username); - return (pid); - } - execuser = ap_pstrcat(r->pool, "~", pw->pw_name, NULL); - user_gid = pw->pw_gid; - - if ((gr = getgrgid(user_gid)) == NULL) { - if ((grpname = ap_palloc(r->pool, 16)) == NULL) { - return (pid); - } - else { - ap_snprintf(grpname, 16, "%ld", (long) user_gid); - } - } - else { - grpname = gr->gr_name; - } - } - else { - if ((pw = getpwuid(r->server->server_uid)) == NULL) { - ap_log_rerror(APLOG_MARK, APLOG_ERR, r, - "getpwuid: invalid userid %ld", - (long) r->server->server_uid); - return (pid); - } - execuser = ap_pstrdup(r->pool, pw->pw_name); - - if ((gr = getgrgid(r->server->server_gid)) == NULL) { - ap_log_rerror(APLOG_MARK, APLOG_ERR, r, - "getgrgid: invalid groupid %ld", - (long) r->server->server_gid); - return (pid); - } - grpname = gr->gr_name; - } - - if (shellcmd) { - execle(SUEXEC_BIN, SUEXEC_BIN, execuser, grpname, argv0, - NULL, env); - } - - else if ((!r->args) || (!r->args[0]) || strchr(r->args, '=')) { - execle(SUEXEC_BIN, SUEXEC_BIN, execuser, grpname, argv0, - NULL, env); - } - - else { - execve(SUEXEC_BIN, - create_argv(r->pool, SUEXEC_BIN, execuser, grpname, - argv0, r->args), - env); - } - } - else { - if (shellcmd) { - execle(SHELL_PATH, SHELL_PATH, "-c", argv0, NULL, env); - } - - else if ((!r->args) || (!r->args[0]) || strchr(r->args, '=')) { - execle(r->filename, argv0, NULL, env); - } - - else { - execve(r->filename, - create_argv(r->pool, NULL, NULL, NULL, argv0, r->args), - env); - } - } - return (pid); -#endif -} diff --git a/server/util_time.c b/server/util_time.c deleted file mode 100644 index 3db076bceab311edd8746975e994bee5628ad9be..0000000000000000000000000000000000000000 --- a/server/util_time.c +++ /dev/null @@ -1,175 +0,0 @@ -/* ==================================================================== - * The Apache Software License, Version 1.1 - * - * Copyright (c) 2001 The Apache Software Foundation. All rights - * reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in - * the documentation and/or other materials provided with the - * distribution. - * - * 3. The end-user documentation included with the redistribution, - * if any, must include the following acknowledgment: - * "This product includes software developed by the - * Apache Software Foundation (http://www.apache.org/)." - * Alternately, this acknowledgment may appear in the software itself, - * if and wherever such third-party acknowledgments normally appear. - * - * 4. The names "Apache" and "Apache Software Foundation" must - * not be used to endorse or promote products derived from this - * software without prior written permission. For written - * permission, please contact apache@apache.org. - * - * 5. Products derived from this software may not be called "Apache", - * nor may "Apache" appear in their name, without prior written - * permission of the Apache Software Foundation. - * - * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED - * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES - * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR - * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF - * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND - * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, - * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT - * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * ==================================================================== - * - * This software consists of voluntary contributions made by many - * individuals on behalf of the Apache Software Foundation. For more - * information on the Apache Software Foundation, please see - * . - * - */ - -#include "util_time.h" - -/* Cache for exploded values of recent timestamps - */ - -struct exploded_time_cache_element { - apr_int64_t t; - apr_exploded_time_t xt; - apr_int64_t t_validate; /* please see comments in cached_explode() */ -}; - -/* the "+ 1" is for the current second: */ -#define TIME_CACHE_SIZE (AP_TIME_RECENT_THRESHOLD + 1) - -static struct exploded_time_cache_element exploded_cache_localtime[TIME_CACHE_SIZE]; -static struct exploded_time_cache_element exploded_cache_gmt[TIME_CACHE_SIZE]; - - -static apr_status_t cached_explode(apr_exploded_time_t *xt, apr_time_t t, - struct exploded_time_cache_element *cache, - int use_gmt) -{ - apr_int64_t seconds = t / APR_USEC_PER_SEC; - struct exploded_time_cache_element *cache_element = - &(cache[seconds % TIME_CACHE_SIZE]); - struct exploded_time_cache_element cache_element_snapshot; - - /* The cache is implemented as a ring buffer. Each second, - * it uses a different element in the buffer. The timestamp - * in the element indicates whether the element contains the - * exploded time for the current second (vs the time - * 'now - AP_TIME_RECENT_THRESHOLD' seconds ago). If the - * cached value is for the current time, we use it. Otherwise, - * we compute the apr_exploded_time_t and store it in this - * cache element. Note that the timestamp in the cache - * element is updated only after the exploded time. Thus - * if two threads hit this cache element simultaneously - * at the start of a new second, they'll both explode the - * time and store it. I.e., the writers will collide, but - * they'll be writing the same value. - */ - if (cache_element->t >= seconds) { - /* There is an intentional race condition in this design: - * in a multithreaded app, one thread might be reading - * from this cache_element to resolve a timestamp from - * TIME_CACHE_SIZE seconds ago at the same time that - * another thread is copying the exploded form of the - * current time into the same cache_element. (I.e., the - * first thread might hit this element of the ring buffer - * just as the element is being recycled.) This can - * also happen at the start of a new second, if a - * reader accesses the cache_element after a writer - * has updated cache_element.t but before the writer - * has finished updating the whole cache_element. - * - * Rather than trying to prevent this race condition - * with locks, we allow it to happen and then detect - * and correct it. The detection works like this: - * Step 1: Take a "snapshot" of the cache element by - * copying it into a temporary buffer. - * Step 2: Check whether the snapshot contains consistent - * data: the timestamps at the start and end of - * the cache_element should both match the 'seconds' - * value that we computed from the input time. - * If these three don't match, then the snapshot - * shows the cache_element in the middle of an - * update, and its contents are invalid. - * Step 3: If the snapshot is valid, use it. Otherwise, - * just give up on the cache and explode the - * input time. - */ - memcpy(&cache_element_snapshot, cache_element, - sizeof(struct exploded_time_cache_element)); - if ((seconds != cache_element_snapshot.t) || - (seconds != cache_element_snapshot.t_validate)) { - /* Invalid snapshot */ - if (use_gmt) { - return apr_explode_gmt(xt, t); - } - else { - return apr_explode_localtime(xt, t); - } - } - else { - /* Valid snapshot */ - memcpy(xt, &(cache_element_snapshot.xt), - sizeof(apr_exploded_time_t)); - } - } - else { - apr_status_t r; - if (use_gmt) { - r = apr_explode_gmt(xt, t); - } - else { - r = apr_explode_localtime(xt, t); - } - if (!APR_STATUS_IS_SUCCESS(r)) { - return r; - } - cache_element->t = seconds; - memcpy(&(cache_element->xt), xt, sizeof(apr_exploded_time_t)); - cache_element->t_validate = seconds; - } - xt->tm_usec = t % APR_USEC_PER_SEC; - return APR_SUCCESS; -} - - -AP_DECLARE(apr_status_t) ap_explode_recent_localtime(apr_exploded_time_t * tm, - apr_time_t t) -{ - return cached_explode(tm, t, exploded_cache_localtime, 0); -} - -AP_DECLARE(apr_status_t) ap_explode_recent_gmt(apr_exploded_time_t * tm, - apr_time_t t) -{ - return cached_explode(tm, t, exploded_cache_gmt, 1); -} diff --git a/server/util_xml.c b/server/util_xml.c deleted file mode 100644 index 26c8a0fc0c025686b733dbcd23daf89d03024316..0000000000000000000000000000000000000000 --- a/server/util_xml.c +++ /dev/null @@ -1,421 +0,0 @@ -/* -** Copyright (C) 1998-2000 Greg Stein. All Rights Reserved. -** -** By using this file, you agree to the terms and conditions set forth in -** the LICENSE.html file which can be found at the top level of the mod_dav -** distribution or at http://www.webdav.org/mod_dav/license-1.html. -** -** Contact information: -** Greg Stein, PO Box 760, Palo Alto, CA, 94302 -** gstein@lyra.org, http://www.webdav.org/mod_dav/ -*/ - -/* -** DAV extension module for Apache 1.3.* -** - XML parser for the body of a request -** -** Written by Greg Stein, gstein@lyra.org, http://www.lyra.org/ -*/ - -/* James Clark's Expat parser */ -#include - -#include "httpd.h" -#include "http_protocol.h" -#include "http_log.h" - -#include "mod_dav.h" - - -/* errors related to namespace processing */ -#define DAV_NS_ERROR_UNKNOWN_PREFIX (DAV_NS_ERROR_BASE) - -/* test for a namespace prefix that begins with [Xx][Mm][Ll] */ -#define DAV_NS_IS_RESERVED(name) \ - ( (name[0] == 'X' || name[0] == 'x') && \ - (name[1] == 'M' || name[1] == 'm') && \ - (name[2] == 'L' || name[2] == 'l') ) - -/* content for parsing */ -typedef struct dav_xml_ctx { - dav_xml_doc *doc; /* the doc we're parsing */ - ap_pool *p; /* the pool we allocate from */ - dav_xml_elem *cur_elem; /* current element */ - - int error; /* an error has occurred */ - /* errors may be DAV_NS_ERROR_* or other errors defined here (none yet) */ - -} dav_xml_ctx; - -/* struct for scoping namespace declarations */ -typedef struct dav_xml_ns_scope { - const char *prefix; /* prefix used for this ns */ - int ns; /* index into namespace table */ - int emptyURI; /* the namespace URI is the empty string */ - struct dav_xml_ns_scope *next; /* next scoped namespace */ -} dav_xml_ns_scope; - -/* ### need a similar mechanism for xml:lang values */ - - -/* return namespace table index for a given prefix */ -static int dav_find_prefix(dav_xml_ctx *ctx, const char *prefix) -{ - dav_xml_elem *elem = ctx->cur_elem; - - /* - ** Walk up the tree, looking for a namespace scope that defines this - ** prefix. - */ - for (; elem; elem = elem->parent) { - dav_xml_ns_scope *ns_scope = elem->ns_scope; - - for (ns_scope = elem->ns_scope; ns_scope; ns_scope = ns_scope->next) { - if (strcmp(prefix, ns_scope->prefix) == 0) { - if (ns_scope->emptyURI) { - /* - ** It is possible to set the default namespace to an - ** empty URI string; this resets the default namespace - ** to mean "no namespace." We just found the prefix - ** refers to an empty URI, so return "no namespace." - */ - return DAV_NS_NONE; - } - - return ns_scope->ns; - } - } - } - - /* - * If the prefix is empty (""), this means that a prefix was not - * specified in the element/attribute. The search that was performed - * just above did not locate a default namespace URI (which is stored - * into ns_scope with an empty prefix). This means the element/attribute - * has "no namespace". We have a reserved value for this. - */ - if (*prefix == '\0') { - return DAV_NS_NONE; - } - - /* not found */ - return DAV_NS_ERROR_UNKNOWN_PREFIX; -} - -static void dav_start_handler(void *userdata, const char *name, const char **attrs) -{ - dav_xml_ctx *ctx = userdata; - dav_xml_elem *elem; - dav_xml_attr *attr; - dav_xml_attr *prev; - char *colon; - const char *quoted; - - /* punt once we find an error */ - if (ctx->error) - return; - - elem = ap_pcalloc(ctx->p, sizeof(*elem)); - - /* prep the element */ - elem->name = ap_pstrdup(ctx->p, name); - - /* fill in the attributes (note: ends up in reverse order) */ - while (*attrs) { - attr = ap_palloc(ctx->p, sizeof(*attr)); - attr->name = ap_pstrdup(ctx->p, *attrs++); - attr->value = ap_pstrdup(ctx->p, *attrs++); - attr->next = elem->attr; - elem->attr = attr; - } - - /* hook the element into the tree */ - if (ctx->cur_elem == NULL) { - /* no current element; this also becomes the root */ - ctx->cur_elem = ctx->doc->root = elem; - } - else { - /* this element appeared within the current elem */ - elem->parent = ctx->cur_elem; - - /* set up the child/sibling links */ - if (elem->parent->last_child == NULL) { - /* no first child either */ - elem->parent->first_child = elem->parent->last_child = elem; - } - else { - /* hook onto the end of the parent's children */ - elem->parent->last_child->next = elem; - elem->parent->last_child = elem; - } - - /* this element is now the current element */ - ctx->cur_elem = elem; - } - - /* scan the attributes for namespace declarations */ - for (prev = NULL, attr = elem->attr; - attr; - attr = attr->next) { - if (strncmp(attr->name, "xmlns", 5) == 0) { - const char *prefix = &attr->name[5]; - dav_xml_ns_scope *ns_scope; - - /* test for xmlns:foo= form and xmlns= form */ - if (*prefix == ':') - ++prefix; - else if (*prefix != '\0') { - /* advance "prev" since "attr" is still present */ - prev = attr; - continue; - } - - /* quote the URI before we ever start working with it */ - quoted = dav_quote_string(ctx->p, attr->value, 1); - - /* build and insert the new scope */ - ns_scope = ap_pcalloc(ctx->p, sizeof(*ns_scope)); - ns_scope->prefix = prefix; - ns_scope->ns = dav_insert_uri(ctx->doc->namespaces, quoted); - ns_scope->emptyURI = *quoted == '\0'; - ns_scope->next = elem->ns_scope; - elem->ns_scope = ns_scope; - - /* remove this attribute from the element */ - if (prev == NULL) - elem->attr = attr->next; - else - prev->next = attr->next; - - /* Note: prev will not be advanced since we just removed "attr" */ - } - else if (strcmp(attr->name, "xml:lang") == 0) { - /* save away the language (in quoted form) */ - elem->lang = dav_quote_string(ctx->p, attr->value, 1); - - /* remove this attribute from the element */ - if (prev == NULL) - elem->attr = attr->next; - else - prev->next = attr->next; - - /* Note: prev will not be advanced since we just removed "attr" */ - } - else { - /* advance "prev" since "attr" is still present */ - prev = attr; - } - } - - /* - ** If an xml:lang attribute didn't exist (lang==NULL), then copy the - ** language from the parent element (if present). - ** - ** NOTE: dav_elem_size() *depends* upon this pointer equality. - */ - if (elem->lang == NULL && elem->parent != NULL) - elem->lang = elem->parent->lang; - - /* adjust the element's namespace */ - colon = strchr(elem->name, ':'); - if (colon == NULL) { - /* - * The element is using the default namespace, which will always - * be found. Either it will be "no namespace", or a default - * namespace URI has been specified at some point. - */ - elem->ns = dav_find_prefix(ctx, ""); - } - else if (DAV_NS_IS_RESERVED(elem->name)) { - elem->ns = DAV_NS_NONE; - } - else { - *colon = '\0'; - elem->ns = dav_find_prefix(ctx, elem->name); - elem->name = colon + 1; - - if (DAV_NS_IS_ERROR(elem->ns)) { - ctx->error = elem->ns; - return; - } - } - - /* adjust all remaining attributes' namespaces */ - for (attr = elem->attr; attr; attr = attr->next) { - colon = strchr(attr->name, ':'); - if (colon == NULL) { - /* - * Attributes do NOT use the default namespace. Therefore, - * we place them into the "no namespace" category. - */ - attr->ns = DAV_NS_NONE; - } - else if (DAV_NS_IS_RESERVED(attr->name)) { - attr->ns = DAV_NS_NONE; - } - else { - *colon = '\0'; - attr->ns = dav_find_prefix(ctx, attr->name); - attr->name = colon + 1; - - if (DAV_NS_IS_ERROR(attr->ns)) { - ctx->error = attr->ns; - return; - } - } - } -} - -static void dav_end_handler(void *userdata, const char *name) -{ - dav_xml_ctx *ctx = userdata; - - /* punt once we find an error */ - if (ctx->error) - return; - - /* pop up one level */ - ctx->cur_elem = ctx->cur_elem->parent; -} - -static void dav_cdata_handler(void *userdata, const char *data, int len) -{ - dav_xml_ctx *ctx = userdata; - dav_xml_elem *elem; - dav_text_header *hdr; - const char *s; - - /* punt once we find an error */ - if (ctx->error) - return; - - elem = ctx->cur_elem; - s = ap_pstrndup(ctx->p, data, len); - - if (elem->last_child == NULL) { - /* no children yet. this cdata follows the start tag */ - hdr = &elem->first_cdata; - } - else { - /* child elements exist. this cdata follows the last child. */ - hdr = &elem->last_child->following_cdata; - } - - dav_text_append(ctx->p, hdr, s); -} - -int dav_parse_input(request_rec * r, dav_xml_doc **pdoc) -{ - int result; - dav_xml_ctx ctx = - {0}; - XML_Parser parser; - - if ((result = ap_setup_client_block(r, REQUEST_CHUNKED_DECHUNK)) != OK) - return result; - - if (r->remaining == 0) { - *pdoc = NULL; - return OK; - } - - ctx.p = r->pool; - ctx.doc = ap_pcalloc(ctx.p, sizeof(*ctx.doc)); - - ctx.doc->namespaces = ap_make_array(ctx.p, 5, sizeof(const char *)); - dav_insert_uri(ctx.doc->namespaces, "DAV:"); - - /* ### we should get the encoding from Content-Encoding */ - parser = XML_ParserCreate(NULL); - if (parser == NULL) { - /* ### anything better to do? */ - fprintf(stderr, "Ouch! XML_ParserCreate() failed!\n"); - exit(1); - } - - XML_SetUserData(parser, (void *) &ctx); - XML_SetElementHandler(parser, dav_start_handler, dav_end_handler); - XML_SetCharacterDataHandler(parser, dav_cdata_handler); - - if (ap_should_client_block(r)) { - long len; - char *buffer; - char end; - int rv; - size_t total_read = 0; - size_t limit_xml_body = dav_get_limit_xml_body(r); - - /* allocate our working buffer */ - buffer = ap_palloc(r->pool, DAV_READ_BLOCKSIZE); - - /* read the body, stuffing it into the parser */ - while ((len = ap_get_client_block(r, buffer, DAV_READ_BLOCKSIZE)) > 0) { - total_read += len; - if (limit_xml_body && total_read > limit_xml_body) { - ap_log_rerror(APLOG_MARK, APLOG_NOERRNO | APLOG_ERR, r, - "XML request body is larger than the configured " - "limit of %lu", (unsigned long)limit_xml_body); - goto read_error; - } - - rv = XML_Parse(parser, buffer, len, 0); - if (rv == 0) - goto parser_error; - } - if (len == -1) { - /* ap_get_client_block() has logged an error */ - goto read_error; - } - - /* tell the parser that we're done */ - rv = XML_Parse(parser, &end, 0, 1); - if (rv == 0) - goto parser_error; - } - - XML_ParserFree(parser); - - if (ctx.error) { - switch (ctx.error) { - case DAV_NS_ERROR_UNKNOWN_PREFIX: - ap_log_rerror(APLOG_MARK, APLOG_ERR | APLOG_NOERRNO, r, - "An undefined namespace prefix was used."); - break; - - default: - ap_log_rerror(APLOG_MARK, APLOG_ERR | APLOG_NOERRNO, r, - "There was an error within the XML request body."); - break; - } - - /* Apache will supply a default error, plus the error log above. */ - return HTTP_BAD_REQUEST; - } - - /* ### assert: ctx.cur_elem == NULL */ - - *pdoc = ctx.doc; - - return OK; - - parser_error: - { - enum XML_Error err = XML_GetErrorCode(parser); - - /* ### fix this error message (default vs special) */ - ap_log_rerror(APLOG_MARK, APLOG_ERR | APLOG_NOERRNO, r, - "XML parser error code: %s (%d).", - XML_ErrorString(err), err); - - XML_ParserFree(parser); - - /* Apache will supply a default error, plus the error log above. */ - return HTTP_BAD_REQUEST; - } - - read_error: - XML_ParserFree(parser); - - /* Apache will supply a default error, plus whatever was logged. */ - return HTTP_BAD_REQUEST; -} diff --git a/server/vhost.c b/server/vhost.c deleted file mode 100644 index 793048f947104aa5f639d36d7fc810a465de68a8..0000000000000000000000000000000000000000 --- a/server/vhost.c +++ /dev/null @@ -1,917 +0,0 @@ -/* ==================================================================== - * Copyright (c) 1995-1999 The Apache Group. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in - * the documentation and/or other materials provided with the - * distribution. - * - * 3. All advertising materials mentioning features or use of this - * software must display the following acknowledgment: - * "This product includes software developed by the Apache Group - * for use in the Apache HTTP server project (http://www.apache.org/)." - * - * 4. The names "Apache Server" and "Apache Group" must not be used to - * endorse or promote products derived from this software without - * prior written permission. For written permission, please contact - * apache@apache.org. - * - * 5. Products derived from this software may not be called "Apache" - * nor may "Apache" appear in their names without prior written - * permission of the Apache Group. - * - * 6. Redistributions of any form whatsoever must retain the following - * acknowledgment: - * "This product includes software developed by the Apache Group - * for use in the Apache HTTP server project (http://www.apache.org/)." - * - * THIS SOFTWARE IS PROVIDED BY THE APACHE GROUP ``AS IS'' AND ANY - * EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR - * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE APACHE GROUP OR - * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT - * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, - * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED - * OF THE POSSIBILITY OF SUCH DAMAGE. - * ==================================================================== - * - * This software consists of voluntary contributions made by many - * individuals on behalf of the Apache Group and was originally based - * on public domain software written at the National Center for - * Supercomputing Applications, University of Illinois, Urbana-Champaign. - * For more information on the Apache Group and the Apache HTTP server - * project, please see . - * - */ - -/* - * http_vhost.c: functions pertaining to virtual host addresses - * (configuration and run-time) - */ - -#define CORE_PRIVATE -#include "httpd.h" -#include "http_config.h" -#include "http_conf_globals.h" -#include "http_log.h" -#include "http_vhost.h" -#include "http_protocol.h" - -/* - * After all the definitions there's an explanation of how it's all put - * together. - */ - -/* meta-list of name-vhosts. Each server_rec can be in possibly multiple - * lists of name-vhosts. - */ -typedef struct name_chain name_chain; -struct name_chain { - name_chain *next; - server_addr_rec *sar; /* the record causing it to be in - * this chain (needed for port comparisons) */ - server_rec *server; /* the server to use on a match */ -}; - -/* meta-list of ip addresses. Each server_rec can be in possibly multiple - * hash chains since it can have multiple ips. - */ -typedef struct ipaddr_chain ipaddr_chain; -struct ipaddr_chain { - ipaddr_chain *next; - server_addr_rec *sar; /* the record causing it to be in - * this chain (need for both ip addr and port - * comparisons) */ - server_rec *server; /* the server to use if this matches */ - name_chain *names; /* if non-NULL then a list of name-vhosts - * sharing this address */ -}; - -/* This defines the size of the hash table used for hashing ip addresses - * of virtual hosts. It must be a power of two. - */ -#ifndef IPHASH_TABLE_SIZE -#define IPHASH_TABLE_SIZE 256 -#endif - -/* A (n) bucket hash table, each entry has a pointer to a server rec and - * a pointer to the other entries in that bucket. Each individual address, - * even for virtualhosts with multiple addresses, has an entry in this hash - * table. There are extra buckets for _default_, and name-vhost entries. - * - * Note that after config time this is constant, so it is thread-safe. - */ -static ipaddr_chain *iphash_table[IPHASH_TABLE_SIZE]; - -/* dump out statistics about the hash function */ -/* #define IPHASH_STATISTICS */ - -/* list of the _default_ servers */ -static ipaddr_chain *default_list; - -/* list of the NameVirtualHost addresses */ -static server_addr_rec *name_vhost_list; -static server_addr_rec **name_vhost_list_tail; - -/* - * How it's used: - * - * The ip address determines which chain in iphash_table is interesting, then - * a comparison is done down that chain to find the first ipaddr_chain whose - * sar matches the address:port pair. - * - * If that ipaddr_chain has names == NULL then you're done, it's an ip-vhost. - * - * Otherwise it's a name-vhost list, and the default is the server in the - * ipaddr_chain record. We tuck away the ipaddr_chain record in the - * conn_rec field vhost_lookup_data. Later on after the headers we get a - * second chance, and we use the name_chain to figure out what name-vhost - * matches the headers. - * - * If there was no ip address match in the iphash_table then do a lookup - * in the default_list. - * - * How it's put together ... well you should be able to figure that out - * from how it's used. Or something like that. - */ - - -/* called at the beginning of the config */ -void ap_init_vhost_config(pool *p) -{ - memset(iphash_table, 0, sizeof(iphash_table)); - default_list = NULL; - name_vhost_list = NULL; - name_vhost_list_tail = &name_vhost_list; -} - - -/* - * Parses a host of the form
    [:port] - * paddr is used to create a list in the order of input - * **paddr is the ->next pointer of the last entry (or s->addrs) - * *paddr is the variable used to keep track of **paddr between calls - * port is the default port to assume - */ -static const char *get_addresses(pool *p, char *w, server_addr_rec ***paddr, - unsigned port) -{ - struct hostent *hep; - unsigned long my_addr; - server_addr_rec *sar; - char *t; - int i, is_an_ip_addr; - - if (*w == 0) - return NULL; - - t = strchr(w, ':'); - if (t) { - if (strcmp(t + 1, "*") == 0) { - port = 0; - } - else if ((i = atoi(t + 1))) { - port = i; - } - else { - return ":port must be numeric"; - } - *t = 0; - } - - is_an_ip_addr = 0; - if (strcmp(w, "*") == 0) { - my_addr = htonl(INADDR_ANY); - is_an_ip_addr = 1; - } - else if (strcasecmp(w, "_default_") == 0 - || strcmp(w, "255.255.255.255") == 0) { - my_addr = DEFAULT_VHOST_ADDR; - is_an_ip_addr = 1; - } - else if ((my_addr = ap_inet_addr(w)) != INADDR_NONE) { - is_an_ip_addr = 1; - } - if (is_an_ip_addr) { - sar = ap_pcalloc(p, sizeof(server_addr_rec)); - **paddr = sar; - *paddr = &sar->next; - sar->host_addr.s_addr = my_addr; - sar->host_port = port; - sar->virthost = ap_pstrdup(p, w); - if (t != NULL) - *t = ':'; - return NULL; - } - - hep = gethostbyname(w); - - if ((!hep) || (hep->h_addrtype != AF_INET || !hep->h_addr_list[0])) { - ap_log_error(APLOG_MARK, APLOG_NOERRNO|APLOG_ERR, NULL, - "Cannot resolve host name %s --- ignoring!", w); - if (t != NULL) - *t = ':'; - return NULL; - } - - for (i = 0; hep->h_addr_list[i]; ++i) { - sar = ap_pcalloc(p, sizeof(server_addr_rec)); - **paddr = sar; - *paddr = &sar->next; - sar->host_addr = *(struct in_addr *) hep->h_addr_list[i]; - sar->host_port = port; - sar->virthost = ap_pstrdup(p, w); - } - - if (t != NULL) - *t = ':'; - return NULL; -} - - -/* parse the addresses */ -const char *ap_parse_vhost_addrs(pool *p, const char *hostname, server_rec *s) -{ - server_addr_rec **addrs; - const char *err; - - /* start the list of addreses */ - addrs = &s->addrs; - while (hostname[0]) { - err = get_addresses(p, ap_getword_conf(p, &hostname), &addrs, s->port); - if (err) { - *addrs = NULL; - return err; - } - } - /* terminate the list */ - *addrs = NULL; - if (s->addrs) { - if (s->addrs->host_port) { - /* override the default port which is inherited from main_server */ - s->port = s->addrs->host_port; - } - } - return NULL; -} - - -const char *ap_set_name_virtual_host (cmd_parms *cmd, void *dummy, char *arg) -{ - /* use whatever port the main server has at this point */ - return get_addresses(cmd->pool, arg, &name_vhost_list_tail, - cmd->server->port); -} - - -/* hash table statistics, keep this in here for the beta period so - * we can find out if the hash function is ok - */ -#ifdef IPHASH_STATISTICS -static int iphash_compare(const void *a, const void *b) -{ - return (*(const int *) b - *(const int *) a); -} - - -static void dump_iphash_statistics(server_rec *main_s) -{ - unsigned count[IPHASH_TABLE_SIZE]; - int i; - ipaddr_chain *src; - unsigned total; - char buf[HUGE_STRING_LEN]; - char *p; - - total = 0; - for (i = 0; i < IPHASH_TABLE_SIZE; ++i) { - count[i] = 0; - for (src = iphash_table[i]; src; src = src->next) { - ++count[i]; - if (i < IPHASH_TABLE_SIZE) { - /* don't count the slop buckets in the total */ - ++total; - } - } - } - qsort(count, IPHASH_TABLE_SIZE, sizeof(count[0]), iphash_compare); - p = buf + ap_snprintf(buf, sizeof(buf), - "iphash: total hashed = %u, avg chain = %u, " - "chain lengths (count x len):", - total, total / IPHASH_TABLE_SIZE); - total = 1; - for (i = 1; i < IPHASH_TABLE_SIZE; ++i) { - if (count[i - 1] != count[i]) { - p += ap_snprintf(p, sizeof(buf) - (p - buf), " %ux%u", - total, count[i - 1]); - total = 1; - } - else { - ++total; - } - } - p += ap_snprintf(p, sizeof(buf) - (p - buf), " %ux%u", - total, count[IPHASH_TABLE_SIZE - 1]); - ap_log_error(APLOG_MARK, APLOG_NOERRNO|APLOG_DEBUG, main_s, buf); -} -#endif - - -/* This hashing function is designed to get good distribution in the cases - * where the server is handling entire "networks" of servers. i.e. a - * whack of /24s. This is probably the most common configuration for - * ISPs with large virtual servers. - * - * NOTE: This function is symmetric (i.e. collapses all 4 octets - * into one), so machine byte order (big/little endianness) does not matter. - * - * Hash function provided by David Hankins. - */ -static ap_inline unsigned hash_inaddr(unsigned key) -{ - key ^= (key >> 16); - return ((key >> 8) ^ key) % IPHASH_TABLE_SIZE; -} - - - -static ipaddr_chain *new_ipaddr_chain(pool *p, - server_rec *s, server_addr_rec *sar) -{ - ipaddr_chain *new; - - new = ap_palloc(p, sizeof(*new)); - new->names = NULL; - new->server = s; - new->sar = sar; - new->next = NULL; - return new; -} - - -static name_chain *new_name_chain(pool *p, server_rec *s, server_addr_rec *sar) -{ - name_chain *new; - - new = ap_palloc(p, sizeof(*new)); - new->server = s; - new->sar = sar; - new->next = NULL; - return new; -} - - -static ap_inline ipaddr_chain *find_ipaddr(struct in_addr *server_ip, - unsigned port) -{ - unsigned bucket; - ipaddr_chain *trav; - unsigned addr; - - /* scan the hash table for an exact match first */ - addr = server_ip->s_addr; - bucket = hash_inaddr(addr); - for (trav = iphash_table[bucket]; trav; trav = trav->next) { - server_addr_rec *sar = trav->sar; - if ((sar->host_addr.s_addr == addr) - && (sar->host_port == 0 || sar->host_port == port - || port == 0)) { - return trav; - } - } - return NULL; -} - - -static ipaddr_chain *find_default_server(unsigned port) -{ - server_addr_rec *sar; - ipaddr_chain *trav; - - for (trav = default_list; trav; trav = trav->next) { - sar = trav->sar; - if (sar->host_port == 0 || sar->host_port == port) { - /* match! */ - return trav; - } - } - return NULL; -} - - -static void dump_vhost_config(FILE *f) -{ - int i; - ipaddr_chain *ic; - name_chain *nc; - char buf[MAX_STRING_LEN]; - - fprintf(f, "VirtualHost configuration:\n"); - for (i = 0; i < IPHASH_TABLE_SIZE; ++i) { - for (ic = iphash_table[i]; ic; ic = ic->next) { - if (ic->sar->host_port == 0) { - ap_snprintf(buf, sizeof(buf), "%pA:*", &ic->sar->host_addr); - } - else { - ap_snprintf(buf, sizeof(buf), "%pA:%u", &ic->sar->host_addr, - ic->sar->host_port); - } - if (ic->names == NULL) { - fprintf(f, "%-22s %s (%s:%u)\n", buf, - ic->server->server_hostname, ic->server->defn_name, - ic->server->defn_line_number); - continue; - } - fprintf(f, "%-22s is a NameVirtualHost\n" - "%22s default server %s (%s:%u)\n", - buf, "", ic->server->server_hostname, - ic->server->defn_name, ic->server->defn_line_number); - for (nc = ic->names; nc; nc = nc->next) { - if (nc->sar->host_port) { - fprintf(f, "%22s port %u ", "", nc->sar->host_port); - } - else { - fprintf(f, "%22s port * ", ""); - } - fprintf(f, "namevhost %s (%s:%u)\n", - nc->server->server_hostname, - nc->server->defn_name, - nc->server->defn_line_number); - } - } - } - if (default_list) { - fprintf(f, "_default_ servers:\n"); - for (ic = default_list; ic; ic = ic->next) { - if (ic->sar->host_port == 0) { - fprintf(f, "port * "); - } - else { - fprintf(f, "port %u ", ic->sar->host_port); - } - fprintf(f, "server %s (%s:%u)\n", - ic->server->server_hostname, ic->server->defn_name, - ic->server->defn_line_number); - } - } -} - -/* compile the tables and such we need to do the run-time vhost lookups */ -void ap_fini_vhost_config(pool *p, server_rec *main_s) -{ - server_addr_rec *sar; - int has_default_vhost_addr; - server_rec *s; - int i; - ipaddr_chain **iphash_table_tail[IPHASH_TABLE_SIZE]; - - /* terminate the name_vhost list */ - *name_vhost_list_tail = NULL; - - /* Main host first */ - s = main_s; - - if (!s->server_hostname) { - s->server_hostname = ap_get_local_host(p); - } - - /* initialize the tails */ - for (i = 0; i < IPHASH_TABLE_SIZE; ++i) { - iphash_table_tail[i] = &iphash_table[i]; - } - - /* The first things to go into the hash table are the NameVirtualHosts - * Since name_vhost_list is in the same order that the directives - * occured in the config file, we'll copy it in that order. - */ - for (sar = name_vhost_list; sar; sar = sar->next) { - unsigned bucket = hash_inaddr(sar->host_addr.s_addr); - ipaddr_chain *new = new_ipaddr_chain(p, NULL, sar); - - *iphash_table_tail[bucket] = new; - iphash_table_tail[bucket] = &new->next; - - /* Notice that what we've done is insert an ipaddr_chain with - * both server and names NULL. Remember that. - */ - } - - /* The next things to go into the hash table are the virtual hosts - * themselves. They're listed off of main_s->next in the reverse - * order they occured in the config file, so we insert them at - * the iphash_table_tail but don't advance the tail. - */ - - for (s = main_s->next; s; s = s->next) { - has_default_vhost_addr = 0; - for (sar = s->addrs; sar; sar = sar->next) { - ipaddr_chain *ic; - - if (sar->host_addr.s_addr == DEFAULT_VHOST_ADDR - || sar->host_addr.s_addr == INADDR_ANY) { - /* add it to default bucket for each appropriate sar - * since we need to do a port test - */ - ipaddr_chain *other; - - other = find_default_server(sar->host_port); - if (other && other->sar->host_port != 0) { - ap_log_error(APLOG_MARK, APLOG_NOERRNO|APLOG_WARNING, main_s, - "_default_ VirtualHost overlap on port %u," - " the first has precedence", sar->host_port); - } - has_default_vhost_addr = 1; - ic = new_ipaddr_chain(p, s, sar); - ic->next = default_list; - default_list = ic; - } - else { - /* see if it matches something we've already got */ - ic = find_ipaddr(&sar->host_addr, sar->host_port); - - /* the first time we encounter a NameVirtualHost address - * ic->server will be NULL, on subsequent encounters - * ic->names will be non-NULL. - */ - if (ic && (ic->names || ic->server == NULL)) { - name_chain *nc = new_name_chain(p, s, sar); - nc->next = ic->names; - ic->names = nc; - ic->server = s; - if (sar->host_port != ic->sar->host_port) { - /* one of the two is a * port, the other isn't */ - ap_log_error(APLOG_MARK, APLOG_NOERRNO|APLOG_ERR, main_s, - "VirtualHost %s:%u -- mixing * " - "ports and non-* ports with " - "a NameVirtualHost address is not supported," - " proceeding with undefined results", - sar->virthost, sar->host_port); - } - } - else if (ic) { - ap_log_error(APLOG_MARK, APLOG_NOERRNO|APLOG_WARNING, main_s, - "VirtualHost %s:%u overlaps with " - "VirtualHost %s:%u, the first has precedence, " - "perhaps you need a NameVirtualHost directive", - sar->virthost, sar->host_port, - ic->sar->virthost, ic->sar->host_port); - ic->sar = sar; - ic->server = s; - } - else { - unsigned bucket = hash_inaddr(sar->host_addr.s_addr); - - ic = new_ipaddr_chain(p, s, sar); - ic->next = *iphash_table_tail[bucket]; - *iphash_table_tail[bucket] = ic; - } - } - } - - /* Ok now we want to set up a server_hostname if the user was - * silly enough to forget one. - * XXX: This is silly we should just crash and burn. - */ - if (!s->server_hostname) { - if (has_default_vhost_addr) { - s->server_hostname = main_s->server_hostname; - } - else if (!s->addrs) { - /* what else can we do? at this point this vhost has - no configured name, probably because they used - DNS in the VirtualHost statement. It's disabled - anyhow by the host matching code. -djg */ - s->server_hostname = - ap_pstrdup(p, "bogus_host_without_forward_dns"); - } - else { - struct hostent *h; - - if ((h = gethostbyaddr((char *) &(s->addrs->host_addr), - sizeof(struct in_addr), AF_INET))) { - s->server_hostname = ap_pstrdup(p, (char *) h->h_name); - } - else { - /* again, what can we do? They didn't specify a - ServerName, and their DNS isn't working. -djg */ - ap_log_error(APLOG_MARK, APLOG_NOERRNO|APLOG_ERR, main_s, - "Failed to resolve server name " - "for %s (check DNS) -- or specify an explicit " - "ServerName", - inet_ntoa(s->addrs->host_addr)); - s->server_hostname = - ap_pstrdup(p, "bogus_host_without_reverse_dns"); - } - } - } - } - - /* now go through and delete any NameVirtualHosts that didn't have any - * hosts associated with them. Lamers. - */ - for (i = 0; i < IPHASH_TABLE_SIZE; ++i) { - ipaddr_chain **pic = &iphash_table[i]; - - while (*pic) { - ipaddr_chain *ic = *pic; - - if (ic->server == NULL) { - ap_log_error(APLOG_MARK, APLOG_NOERRNO|APLOG_WARNING, main_s, - "NameVirtualHost %s:%u has no VirtualHosts", - ic->sar->virthost, ic->sar->host_port); - *pic = ic->next; - } - else if (ic->names == NULL) { - /* if server != NULL and names == NULL then we're done - * looking at NameVirtualHosts - */ - break; - } - else { - pic = &ic->next; - } - } - } - -#ifdef IPHASH_STATISTICS - dump_iphash_statistics(main_s); -#endif - if (ap_dump_settings) { - dump_vhost_config(stderr); - } -} - - -/***************************************************************************** - * run-time vhost matching functions - */ - -/* Remove :port and optionally a single trailing . from the hostname, this - * canonicalizes it somewhat. - */ -static void fix_hostname(request_rec *r) -{ - const char *hostname = r->hostname; - char *host = ap_getword(r->pool, &hostname, ':'); /* get rid of port */ - size_t l; - - /* trim a trailing . */ - l = strlen(host); - if (l > 0 && host[l-1] == '.') { - host[l-1] = '\0'; - } - - r->hostname = host; -} - - -/* return 1 if host matches ServerName or ServerAliases */ -static int matches_aliases(server_rec *s, const char *host) -{ - int i; - array_header *names; - - /* match ServerName */ - if (!strcasecmp(host, s->server_hostname)) { - return 1; - } - - /* search all the aliases from ServerAlias directive */ - names = s->names; - if (names) { - char **name = (char **) names->elts; - for (i = 0; i < names->nelts; ++i) { - if(!name[i]) continue; - if (!strcasecmp(host, name[i])) - return 1; - } - } - names = s->wild_names; - if (names) { - char **name = (char **) names->elts; - for (i = 0; i < names->nelts; ++i) { - if(!name[i]) continue; - if (!ap_strcasecmp_match(host, name[i])) - return 1; - } - } - return 0; -} - - -/* Suppose a request came in on the same socket as this r, and included - * a header "Host: host:port", would it map to r->server? It's more - * than just that though. When we do the normal matches for each request - * we don't even bother considering Host: etc on non-namevirtualhosts, - * we just call it a match. But here we require the host:port to match - * the ServerName and/or ServerAliases. - */ -API_EXPORT(int) ap_matches_request_vhost(request_rec *r, const char *host, - unsigned port) -{ - server_rec *s; - server_addr_rec *sar; - - s = r->server; - - /* search all the values */ - /* XXX: If this is a NameVirtualHost then we may not be doing the Right Thing - * consider: - * - * NameVirtualHost 10.1.1.1 - * - * ServerName v1 - * - * - * ServerName v2 - * - * - * Suppose r->server is v2, and we're asked to match "10.1.1.1". We'll say - * "yup it's v2", when really it isn't... if a request came in for 10.1.1.1 - * it would really go to v1. - */ - for (sar = s->addrs; sar; sar = sar->next) { - if ((sar->host_port == 0 || port == sar->host_port) - && !strcasecmp(host, sar->virthost)) { - return 1; - } - } - - /* the Port has to match now, because the rest don't have ports associated - * with them. */ - if (port != s->port) { - return 0; - } - - return matches_aliases(s, host); -} - - -static void check_hostalias(request_rec *r) -{ - /* - * Even if the request has a Host: header containing a port we ignore - * that port. We always use the physical port of the socket. There - * are a few reasons for this: - * - * - the default of 80 or 443 for SSL is easier to handle this way - * - there is less of a possibility of a security problem - * - it simplifies the data structure - * - the client may have no idea that a proxy somewhere along the way - * translated the request to another ip:port - * - except for the addresses from the VirtualHost line, none of the other - * names we'll match have ports associated with them - */ - const char *host = r->hostname; - unsigned port = ntohs(r->connection->local_addr.sin_port); - server_rec *s; - server_rec *last_s; - name_chain *src; - - last_s = NULL; - - /* Recall that the name_chain is a list of server_addr_recs, some of - * whose ports may not match. Also each server may appear more than - * once in the chain -- specifically, it will appear once for each - * address from its VirtualHost line which matched. We only want to - * do the full ServerName/ServerAlias comparisons once for each - * server, fortunately we know that all the VirtualHost addresses for - * a single server are adjacent to each other. - */ - - for (src = r->connection->vhost_lookup_data; src; src = src->next) { - server_addr_rec *sar; - - /* We only consider addresses on the name_chain which have a matching - * port - */ - sar = src->sar; - if (sar->host_port != 0 && port != sar->host_port) { - continue; - } - - s = src->server; - - /* does it match the virthost from the sar? */ - if (!strcasecmp(host, sar->virthost)) { - goto found; - } - - if (s == last_s) { - /* we've already done ServerName and ServerAlias checks for this - * vhost - */ - continue; - } - last_s = s; - - if (matches_aliases(s, host)) { - goto found; - } - } - return; - -found: - /* s is the first matching server, we're done */ - r->server = r->connection->server = s; -} - - -static void check_serverpath(request_rec *r) -{ - server_rec *s; - server_rec *last_s; - name_chain *src; - unsigned port = ntohs(r->connection->local_addr.sin_port); - - /* - * This is in conjunction with the ServerPath code in http_core, so we - * get the right host attached to a non- Host-sending request. - * - * See the comment in check_hostalias about how each vhost can be - * listed multiple times. - */ - - last_s = NULL; - for (src = r->connection->vhost_lookup_data; src; src = src->next) { - /* We only consider addresses on the name_chain which have a matching - * port - */ - if (src->sar->host_port != 0 && port != src->sar->host_port) { - continue; - } - - s = src->server; - if (s == last_s) { - continue; - } - last_s = s; - - if (s->path && !strncmp(r->uri, s->path, s->pathlen) && - (s->path[s->pathlen - 1] == '/' || - r->uri[s->pathlen] == '/' || - r->uri[s->pathlen] == '\0')) { - r->server = r->connection->server = s; - return; - } - } -} - - -void ap_update_vhost_from_headers(request_rec *r) -{ - /* must set this for HTTP/1.1 support */ - if (r->hostname || (r->hostname = ap_table_get(r->headers_in, "Host"))) { - fix_hostname(r); - } - /* check if we tucked away a name_chain */ - if (r->connection->vhost_lookup_data) { - if (r->hostname) - check_hostalias(r); - else - check_serverpath(r); - } -} - - -/* Called for a new connection which has a known local_addr. Note that the - * new connection is assumed to have conn->server == main server. - */ -void ap_update_vhost_given_ip(conn_rec *conn) -{ - ipaddr_chain *trav; - unsigned port = ntohs(conn->local_addr.sin_port); - - /* scan the hash table for an exact match first */ - trav = find_ipaddr(&conn->local_addr.sin_addr, port); - if (trav) { - /* save the name_chain for later in case this is a name-vhost */ - conn->vhost_lookup_data = trav->names; - conn->server = trav->server; - return; - } - - /* There's certainly no name-vhosts with this address, they would have - * been matched above. - */ - conn->vhost_lookup_data = NULL; - - /* maybe there's a default server matching this port */ - trav = find_default_server(port); - if (trav) { - conn->server = trav->server; - } - - /* otherwise we're stuck with just the main server */ -} diff --git a/srclib/.cvsignore b/srclib/.cvsignore deleted file mode 100644 index f3c7a7c5da68804a1bdf391127ba34aed33c3cca..0000000000000000000000000000000000000000 --- a/srclib/.cvsignore +++ /dev/null @@ -1 +0,0 @@ -Makefile diff --git a/srclib/Makefile.in b/srclib/Makefile.in deleted file mode 100644 index 5d725f2af1859031860eb53a9fb8ab2df23c4936..0000000000000000000000000000000000000000 --- a/srclib/Makefile.in +++ /dev/null @@ -1,9 +0,0 @@ - -DEPTH = .. -topsrcdir = @topsrcdir@ -srcdir = @srcdir@ -VPATH = @srcdir@ - -SUBDIRS = apr - -include $(topsrcdir)/build/rules.mk diff --git a/srclib/pcre/.cvsignore b/srclib/pcre/.cvsignore deleted file mode 100644 index ba115cc7494364565839f8075a46302e19844774..0000000000000000000000000000000000000000 --- a/srclib/pcre/.cvsignore +++ /dev/null @@ -1,14 +0,0 @@ -*.la -*.lo -.libs -Makefile -chartables.c -config.h -config.log -config.status -dftables -libtool -pcre-config -pcre.h -pcretest -pgrep diff --git a/srclib/pcre/RunTest b/srclib/pcre/RunTest deleted file mode 100755 index 85eeb6245e30ef28807fb6a5034bb375714a2a1a..0000000000000000000000000000000000000000 --- a/srclib/pcre/RunTest +++ /dev/null @@ -1,94 +0,0 @@ -#! /bin/sh - -# Run PCRE tests - -cf=diff - -# Select which tests to run; if no selection, run all - -do1=no -do2=no -do3=no -do4=no - -while [ $# -gt 0 ] ; do - case $1 in - 1) do1=yes;; - 2) do2=yes;; - 3) do3=yes;; - 4) do4=yes;; - *) echo "Unknown test number $1"; exit 1;; - esac - shift -done - -if [ $do1 = no -a $do2 = no -a $do3 = no -a $do4 = no ] ; then - do1=yes - do2=yes - do3=yes - do4=yes -fi - -# Primary test, Perl-compatible - -if [ $do1 = yes ] ; then - echo "Testing main functionality (Perl compatible)" - ./pcretest testdata/testinput1 testtry - if [ $? = 0 ] ; then - $cf testtry testdata/testoutput1 - if [ $? != 0 ] ; then exit 1; fi - else exit 1 - fi -fi - -# PCRE tests that are not Perl-compatible - API & error tests, mostly - -if [ $do2 = yes ] ; then - echo "Testing API and error handling (not Perl compatible)" - ./pcretest -i testdata/testinput2 testtry - if [ $? = 0 ] ; then - $cf testtry testdata/testoutput2 - if [ $? != 0 ] ; then exit 1; fi - else exit 1 - fi -fi - -# Additional Perl-compatible tests for Perl 5.005's new features - -if [ $do3 = yes ] ; then - echo "Testing Perl 5.005 features (Perl 5.005 compatible)" - ./pcretest testdata/testinput3 testtry - if [ $? = 0 ] ; then - $cf testtry testdata/testoutput3 - if [ $? != 0 ] ; then exit 1; fi - else exit 1 - fi -fi - -if [ $do1 = yes -a $do2 = yes -a $do3 = yes ] ; then - echo "The three main tests all ran OK" - echo " " -fi - -# Locale-specific tests, provided the "fr" locale is available - -if [ $do4 = yes ] ; then - locale -a | grep '^fr$' >/dev/null - if [ $? -eq 0 ] ; then - echo "Testing locale-specific features (using 'fr' locale)" - ./pcretest testdata/testinput4 testtry - if [ $? = 0 ] ; then - $cf testtry testdata/testoutput4 - if [ $? != 0 ] ; then exit 1; fi - echo "Locale test ran OK" - echo " " - else exit 1 - fi - else - echo "Cannot test locale-specific features - 'fr' locale not found," - echo "or the \"locale\" command is not available to check for it." - echo " " - fi -fi - -# End diff --git a/srclib/pcre/config.hw b/srclib/pcre/config.hw deleted file mode 100644 index 124f5de2ced2839c5671305708c8c84ab0b64ed6..0000000000000000000000000000000000000000 --- a/srclib/pcre/config.hw +++ /dev/null @@ -1,28 +0,0 @@ - -/* On Unix systems config.in is converted by configure into config.h. PCRE is -written in Standard C, but there are a few non-standard things it can cope -with, allowing it to run on SunOS4 and other "close to standard" systems. - -On a non-Unix system you should just copy this file into config.h and change -the definitions of HAVE_STRERROR and HAVE_MEMMOVE to 1. Unfortunately, because -of the way autoconf works, these cannot be made the defaults. */ - -/* Define to empty if the keyword does not work. */ - -#undef const - -/* Define to `unsigned' if doesn't define size_t. */ - -#undef size_t - -/* The following two definitions are mainly for the benefit of SunOS4, which -doesn't have the strerror() or memmove() functions that should be present in -all Standard C libraries. The macros should normally be defined with the value -1 for other systems, but unfortunately we can't make this the default because -"configure" files generated by autoconf will only change 0 to 1; they won't -change 1 to 0 if the functions are not found. */ - -#define HAVE_STRERROR 1 -#define HAVE_MEMMOVE 1 - -/* End */ diff --git a/srclib/pcre/configure b/srclib/pcre/configure new file mode 100755 index 0000000000000000000000000000000000000000..6fb9fdf07c811e78cbf9586d1aaa539f6b50a985 --- /dev/null +++ b/srclib/pcre/configure @@ -0,0 +1,7482 @@ +#! /bin/sh +# Guess values for system-dependent variables and create Makefiles. +# Generated by Autoconf 2.50. +# +# Copyright 1992, 1993, 1994, 1995, 1996, 1998, 1999, 2000, 2001 +# Free Software Foundation, Inc. +# This configure script is free software; the Free Software Foundation +# gives unlimited permission to copy, distribute and modify it. + +# Find the correct PATH separator. Usually this is `:', but +# DJGPP uses `;' like DOS. +if test "X${PATH_SEPARATOR+set}" != Xset; then + UNAME=${UNAME-`uname 2>/dev/null`} + case X$UNAME in + *-DOS) lt_cv_sys_path_separator=';' ;; + *) lt_cv_sys_path_separator=':' ;; + esac +fi + +# Check that we are running under the correct shell. +SHELL=${CONFIG_SHELL-/bin/sh} + +case X$ECHO in +X*--fallback-echo) + # Remove one level of quotation (which was required for Make). + ECHO=`echo "$ECHO" | sed 's,\\\\\$\\$0,'$0','` + ;; +esac + +echo=${ECHO-echo} +if test "X$1" = X--no-reexec; then + # Discard the --no-reexec flag, and continue. + shift +elif test "X$1" = X--fallback-echo; then + # Avoid inline document here, it may be left over + : +elif test "X`($echo '\t') 2>/dev/null`" = 'X\t'; then + # Yippee, $echo works! + : +else + # Restart under the correct shell. + exec $SHELL "$0" --no-reexec ${1+"$@"} +fi + +if test "X$1" = X--fallback-echo; then + # used as fallback echo + shift + cat </dev/null && + echo_test_string="`eval $cmd`" && + (test "X$echo_test_string" = "X$echo_test_string") 2>/dev/null + then + break + fi + done +fi + +if test "X`($echo '\t') 2>/dev/null`" = 'X\t' && + echo_testing_string=`($echo "$echo_test_string") 2>/dev/null` && + test "X$echo_testing_string" = "X$echo_test_string"; then + : +else + # The Solaris, AIX, and Digital Unix default echo programs unquote + # backslashes. This makes it impossible to quote backslashes using + # echo "$something" | sed 's/\\/\\\\/g' + # + # So, first we look for a working echo in the user's PATH. + + IFS="${IFS= }"; save_ifs="$IFS"; IFS="${IFS}${PATH_SEPARATOR}" + for dir in $PATH /usr/ucb; do + if (test -f $dir/echo || test -f $dir/echo$ac_exeext) && + test "X`($dir/echo '\t') 2>/dev/null`" = 'X\t' && + echo_testing_string=`($dir/echo "$echo_test_string") 2>/dev/null` && + test "X$echo_testing_string" = "X$echo_test_string"; then + echo="$dir/echo" + break + fi + done + IFS="$save_ifs" + + if test "X$echo" = Xecho; then + # We didn't find a better echo, so look for alternatives. + if test "X`(print -r '\t') 2>/dev/null`" = 'X\t' && + echo_testing_string=`(print -r "$echo_test_string") 2>/dev/null` && + test "X$echo_testing_string" = "X$echo_test_string"; then + # This shell has a builtin print -r that does the trick. + echo='print -r' + elif (test -f /bin/ksh || test -f /bin/ksh$ac_exeext) && + test "X$CONFIG_SHELL" != X/bin/ksh; then + # If we have ksh, try running configure again with it. + ORIGINAL_CONFIG_SHELL=${CONFIG_SHELL-/bin/sh} + export ORIGINAL_CONFIG_SHELL + CONFIG_SHELL=/bin/ksh + export CONFIG_SHELL + exec $CONFIG_SHELL "$0" --no-reexec ${1+"$@"} + else + # Try using printf. + echo='printf %s\n' + if test "X`($echo '\t') 2>/dev/null`" = 'X\t' && + echo_testing_string=`($echo "$echo_test_string") 2>/dev/null` && + test "X$echo_testing_string" = "X$echo_test_string"; then + # Cool, printf works + : + elif echo_testing_string=`($ORIGINAL_CONFIG_SHELL "$0" --fallback-echo '\t') 2>/dev/null` && + test "X$echo_testing_string" = 'X\t' && + echo_testing_string=`($ORIGINAL_CONFIG_SHELL "$0" --fallback-echo "$echo_test_string") 2>/dev/null` && + test "X$echo_testing_string" = "X$echo_test_string"; then + CONFIG_SHELL=$ORIGINAL_CONFIG_SHELL + export CONFIG_SHELL + SHELL="$CONFIG_SHELL" + export SHELL + echo="$CONFIG_SHELL $0 --fallback-echo" + elif echo_testing_string=`($CONFIG_SHELL "$0" --fallback-echo '\t') 2>/dev/null` && + test "X$echo_testing_string" = 'X\t' && + echo_testing_string=`($CONFIG_SHELL "$0" --fallback-echo "$echo_test_string") 2>/dev/null` && + test "X$echo_testing_string" = "X$echo_test_string"; then + echo="$CONFIG_SHELL $0 --fallback-echo" + else + # maybe with a smaller string... + prev=: + + for cmd in 'echo test' 'sed 2q "$0"' 'sed 10q "$0"' 'sed 20q "$0"' 'sed 50q "$0"'; do + if (test "X$echo_test_string" = "X`eval $cmd`") 2>/dev/null + then + break + fi + prev="$cmd" + done + + if test "$prev" != 'sed 50q "$0"'; then + echo_test_string=`eval $prev` + export echo_test_string + exec ${ORIGINAL_CONFIG_SHELL-${CONFIG_SHELL-/bin/sh}} "$0" ${1+"$@"} + else + # Oops. We lost completely, so just stick with echo. + echo=echo + fi + fi + fi + fi +fi +fi + +# Copy echo and quote the copy suitably for passing to libtool from +# the Makefile, instead of quoting the original, which is used later. +ECHO=$echo +if test "X$ECHO" = "X$CONFIG_SHELL $0 --fallback-echo"; then + ECHO="$CONFIG_SHELL \\\$\$0 --fallback-echo" +fi + +# Be Bourne compatible +if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then + emulate sh + NULLCMD=: +elif test -n "${BASH_VERSION+set}" && (set -o posix) >/dev/null 2>&1; then + set -o posix +fi + +# Name of the executable. +as_me=`echo "$0" |sed 's,.*[\\/],,'` + +if expr a : '\(a\)' >/dev/null 2>&1; then + as_expr=expr +else + as_expr=false +fi + +rm -f conf$$ conf$$.exe conf$$.file +echo >conf$$.file +if ln -s conf$$.file conf$$ 2>/dev/null; then + # We could just check for DJGPP; but this test a) works b) is more generic + # and c) will remain valid once DJGPP supports symlinks (DJGPP 2.04). + if test -f conf$$.exe; then + # Don't use ln at all; we don't have any links + as_ln_s='cp -p' + else + as_ln_s='ln -s' + fi +elif ln conf$$.file conf$$ 2>/dev/null; then + as_ln_s=ln +else + as_ln_s='cp -p' +fi +rm -f conf$$ conf$$.exe conf$$.file + +as_executable_p="test -f" + +# Support unset when possible. +if (FOO=FOO; unset FOO) >/dev/null 2>&1; then + as_unset=unset +else + as_unset=false +fi + +# NLS nuisances. +$as_unset LANG || test "${LANG+set}" != set || { LANG=C; export LANG; } +$as_unset LC_ALL || test "${LC_ALL+set}" != set || { LC_ALL=C; export LC_ALL; } +$as_unset LC_TIME || test "${LC_TIME+set}" != set || { LC_TIME=C; export LC_TIME; } +$as_unset LC_CTYPE || test "${LC_CTYPE+set}" != set || { LC_CTYPE=C; export LC_CTYPE; } +$as_unset LANGUAGE || test "${LANGUAGE+set}" != set || { LANGUAGE=C; export LANGUAGE; } +$as_unset LC_COLLATE || test "${LC_COLLATE+set}" != set || { LC_COLLATE=C; export LC_COLLATE; } +$as_unset LC_NUMERIC || test "${LC_NUMERIC+set}" != set || { LC_NUMERIC=C; export LC_NUMERIC; } +$as_unset LC_MESSAGES || test "${LC_MESSAGES+set}" != set || { LC_MESSAGES=C; export LC_MESSAGES; } + +# IFS +# We need space, tab and new line, in precisely that order. +as_nl=' +' +IFS=" $as_nl" + +# CDPATH. +$as_unset CDPATH || test "${CDPATH+set}" != set || { CDPATH=:; export CDPATH; } + +# Name of the host. +# hostname on some systems (SVR3.2, Linux) returns a bogus exit status, +# so uname gets run too. +ac_hostname=`(hostname || uname -n) 2>/dev/null | sed 1q` + +exec 6>&1 + +# +# Initializations. +# +ac_default_prefix=/usr/local +cross_compiling=no +subdirs= +MFLAGS= MAKEFLAGS= +SHELL=${CONFIG_SHELL-/bin/sh} + +# Maximum number of lines to put in a shell here document. +# This variable seems obsolete. It should probably be removed, and +# only ac_max_sed_lines should be used. +: ${ac_max_here_lines=38} + +# Avoid depending upon Character Ranges. +ac_cr_az='abcdefghijklmnopqrstuvwxyz' +ac_cr_AZ='ABCDEFGHIJKLMNOPQRSTUVWXYZ' +ac_cr_09='0123456789' +ac_cr_alnum=$ac_cr_az$ac_cr_AZ$ac_cr_09 + +# Sed expression to map a string onto a valid sh and CPP variable names. +ac_tr_sh="sed y%*+%pp%;s%[^_$ac_cr_alnum]%_%g" +ac_tr_cpp="sed y%*$ac_cr_az%P$ac_cr_AZ%;s%[^_$ac_cr_alnum]%_%g" + +ac_unique_file="dftables.c" +# Factoring default headers for most tests. +ac_includes_default="\ +#include +#include +#include +#if STDC_HEADERS +# include +# include +#else +# if HAVE_STDLIB_H +# include +# endif +#endif +#if HAVE_STRING_H +# if !STDC_HEADERS && HAVE_MEMORY_H +# include +# endif +# include +#else +# if HAVE_STRINGS_H +# include +# endif +#endif +#if HAVE_INTTYPES_H +# include +#endif +#if HAVE_UNISTD_H +# include +#endif" + +# Initialize some variables set by options. +ac_init_help= +ac_init_version=false +# The variables have the same names as the options, with +# dashes changed to underlines. +cache_file=/dev/null +exec_prefix=NONE +no_create= +no_recursion= +prefix=NONE +program_prefix=NONE +program_suffix=NONE +program_transform_name=s,x,x, +silent= +site= +srcdir= +verbose= +x_includes=NONE +x_libraries=NONE + +# Installation directory options. +# These are left unexpanded so users can "make install exec_prefix=/foo" +# and all the variables that are supposed to be based on exec_prefix +# by default will actually change. +# Use braces instead of parens because sh, perl, etc. also accept them. +bindir='${exec_prefix}/bin' +sbindir='${exec_prefix}/sbin' +libexecdir='${exec_prefix}/libexec' +datadir='${prefix}/share' +sysconfdir='${prefix}/etc' +sharedstatedir='${prefix}/com' +localstatedir='${prefix}/var' +libdir='${exec_prefix}/lib' +includedir='${prefix}/include' +oldincludedir='/usr/include' +infodir='${prefix}/info' +mandir='${prefix}/man' + +# Identity of this package. +PACKAGE_NAME= +PACKAGE_TARNAME= +PACKAGE_VERSION= +PACKAGE_STRING= +PACKAGE_BUGREPORT= + +ac_prev= +for ac_option +do + # If the previous option needs an argument, assign it. + if test -n "$ac_prev"; then + eval "$ac_prev=\$ac_option" + ac_prev= + continue + fi + + ac_optarg=`expr "x$ac_option" : 'x[^=]*=\(.*\)'` + + # Accept the important Cygnus configure options, so we can diagnose typos. + + case $ac_option in + + -bindir | --bindir | --bindi | --bind | --bin | --bi) + ac_prev=bindir ;; + -bindir=* | --bindir=* | --bindi=* | --bind=* | --bin=* | --bi=*) + bindir=$ac_optarg ;; + + -build | --build | --buil | --bui | --bu) + ac_prev=build_alias ;; + -build=* | --build=* | --buil=* | --bui=* | --bu=*) + build_alias=$ac_optarg ;; + + -cache-file | --cache-file | --cache-fil | --cache-fi \ + | --cache-f | --cache- | --cache | --cach | --cac | --ca | --c) + ac_prev=cache_file ;; + -cache-file=* | --cache-file=* | --cache-fil=* | --cache-fi=* \ + | --cache-f=* | --cache-=* | --cache=* | --cach=* | --cac=* | --ca=* | --c=*) + cache_file=$ac_optarg ;; + + --config-cache | -C) + cache_file=config.cache ;; + + -datadir | --datadir | --datadi | --datad | --data | --dat | --da) + ac_prev=datadir ;; + -datadir=* | --datadir=* | --datadi=* | --datad=* | --data=* | --dat=* \ + | --da=*) + datadir=$ac_optarg ;; + + -disable-* | --disable-*) + ac_feature=`expr "x$ac_option" : 'x-*disable-\(.*\)'` + # Reject names that are not valid shell variable names. + expr "x$ac_feature" : ".*[^-_$ac_cr_alnum]" >/dev/null && + { echo "$as_me: error: invalid feature name: $ac_feature" >&2 + { (exit 1); exit 1; }; } + ac_feature=`echo $ac_feature | sed 's/-/_/g'` + eval "enable_$ac_feature=no" ;; + + -enable-* | --enable-*) + ac_feature=`expr "x$ac_option" : 'x-*enable-\([^=]*\)'` + # Reject names that are not valid shell variable names. + expr "x$ac_feature" : ".*[^-_$ac_cr_alnum]" >/dev/null && + { echo "$as_me: error: invalid feature name: $ac_feature" >&2 + { (exit 1); exit 1; }; } + ac_feature=`echo $ac_feature | sed 's/-/_/g'` + case $ac_option in + *=*) ac_optarg=`echo "$ac_optarg" | sed "s/'/'\\\\\\\\''/g"`;; + *) ac_optarg=yes ;; + esac + eval "enable_$ac_feature='$ac_optarg'" ;; + + -exec-prefix | --exec_prefix | --exec-prefix | --exec-prefi \ + | --exec-pref | --exec-pre | --exec-pr | --exec-p | --exec- \ + | --exec | --exe | --ex) + ac_prev=exec_prefix ;; + -exec-prefix=* | --exec_prefix=* | --exec-prefix=* | --exec-prefi=* \ + | --exec-pref=* | --exec-pre=* | --exec-pr=* | --exec-p=* | --exec-=* \ + | --exec=* | --exe=* | --ex=*) + exec_prefix=$ac_optarg ;; + + -gas | --gas | --ga | --g) + # Obsolete; use --with-gas. + with_gas=yes ;; + + -help | --help | --hel | --he | -h) + ac_init_help=long ;; + -help=r* | --help=r* | --hel=r* | --he=r* | -hr*) + ac_init_help=recursive ;; + -help=s* | --help=s* | --hel=s* | --he=s* | -hs*) + ac_init_help=short ;; + + -host | --host | --hos | --ho) + ac_prev=host_alias ;; + -host=* | --host=* | --hos=* | --ho=*) + host_alias=$ac_optarg ;; + + -includedir | --includedir | --includedi | --included | --include \ + | --includ | --inclu | --incl | --inc) + ac_prev=includedir ;; + -includedir=* | --includedir=* | --includedi=* | --included=* | --include=* \ + | --includ=* | --inclu=* | --incl=* | --inc=*) + includedir=$ac_optarg ;; + + -infodir | --infodir | --infodi | --infod | --info | --inf) + ac_prev=infodir ;; + -infodir=* | --infodir=* | --infodi=* | --infod=* | --info=* | --inf=*) + infodir=$ac_optarg ;; + + -libdir | --libdir | --libdi | --libd) + ac_prev=libdir ;; + -libdir=* | --libdir=* | --libdi=* | --libd=*) + libdir=$ac_optarg ;; + + -libexecdir | --libexecdir | --libexecdi | --libexecd | --libexec \ + | --libexe | --libex | --libe) + ac_prev=libexecdir ;; + -libexecdir=* | --libexecdir=* | --libexecdi=* | --libexecd=* | --libexec=* \ + | --libexe=* | --libex=* | --libe=*) + libexecdir=$ac_optarg ;; + + -localstatedir | --localstatedir | --localstatedi | --localstated \ + | --localstate | --localstat | --localsta | --localst \ + | --locals | --local | --loca | --loc | --lo) + ac_prev=localstatedir ;; + -localstatedir=* | --localstatedir=* | --localstatedi=* | --localstated=* \ + | --localstate=* | --localstat=* | --localsta=* | --localst=* \ + | --locals=* | --local=* | --loca=* | --loc=* | --lo=*) + localstatedir=$ac_optarg ;; + + -mandir | --mandir | --mandi | --mand | --man | --ma | --m) + ac_prev=mandir ;; + -mandir=* | --mandir=* | --mandi=* | --mand=* | --man=* | --ma=* | --m=*) + mandir=$ac_optarg ;; + + -nfp | --nfp | --nf) + # Obsolete; use --without-fp. + with_fp=no ;; + + -no-create | --no-create | --no-creat | --no-crea | --no-cre \ + | --no-cr | --no-c) + no_create=yes ;; + + -no-recursion | --no-recursion | --no-recursio | --no-recursi \ + | --no-recurs | --no-recur | --no-recu | --no-rec | --no-re | --no-r) + no_recursion=yes ;; + + -oldincludedir | --oldincludedir | --oldincludedi | --oldincluded \ + | --oldinclude | --oldinclud | --oldinclu | --oldincl | --oldinc \ + | --oldin | --oldi | --old | --ol | --o) + ac_prev=oldincludedir ;; + -oldincludedir=* | --oldincludedir=* | --oldincludedi=* | --oldincluded=* \ + | --oldinclude=* | --oldinclud=* | --oldinclu=* | --oldincl=* | --oldinc=* \ + | --oldin=* | --oldi=* | --old=* | --ol=* | --o=*) + oldincludedir=$ac_optarg ;; + + -prefix | --prefix | --prefi | --pref | --pre | --pr | --p) + ac_prev=prefix ;; + -prefix=* | --prefix=* | --prefi=* | --pref=* | --pre=* | --pr=* | --p=*) + prefix=$ac_optarg ;; + + -program-prefix | --program-prefix | --program-prefi | --program-pref \ + | --program-pre | --program-pr | --program-p) + ac_prev=program_prefix ;; + -program-prefix=* | --program-prefix=* | --program-prefi=* \ + | --program-pref=* | --program-pre=* | --program-pr=* | --program-p=*) + program_prefix=$ac_optarg ;; + + -program-suffix | --program-suffix | --program-suffi | --program-suff \ + | --program-suf | --program-su | --program-s) + ac_prev=program_suffix ;; + -program-suffix=* | --program-suffix=* | --program-suffi=* \ + | --program-suff=* | --program-suf=* | --program-su=* | --program-s=*) + program_suffix=$ac_optarg ;; + + -program-transform-name | --program-transform-name \ + | --program-transform-nam | --program-transform-na \ + | --program-transform-n | --program-transform- \ + | --program-transform | --program-transfor \ + | --program-transfo | --program-transf \ + | --program-trans | --program-tran \ + | --progr-tra | --program-tr | --program-t) + ac_prev=program_transform_name ;; + -program-transform-name=* | --program-transform-name=* \ + | --program-transform-nam=* | --program-transform-na=* \ + | --program-transform-n=* | --program-transform-=* \ + | --program-transform=* | --program-transfor=* \ + | --program-transfo=* | --program-transf=* \ + | --program-trans=* | --program-tran=* \ + | --progr-tra=* | --program-tr=* | --program-t=*) + program_transform_name=$ac_optarg ;; + + -q | -quiet | --quiet | --quie | --qui | --qu | --q \ + | -silent | --silent | --silen | --sile | --sil) + silent=yes ;; + + -sbindir | --sbindir | --sbindi | --sbind | --sbin | --sbi | --sb) + ac_prev=sbindir ;; + -sbindir=* | --sbindir=* | --sbindi=* | --sbind=* | --sbin=* \ + | --sbi=* | --sb=*) + sbindir=$ac_optarg ;; + + -sharedstatedir | --sharedstatedir | --sharedstatedi \ + | --sharedstated | --sharedstate | --sharedstat | --sharedsta \ + | --sharedst | --shareds | --shared | --share | --shar \ + | --sha | --sh) + ac_prev=sharedstatedir ;; + -sharedstatedir=* | --sharedstatedir=* | --sharedstatedi=* \ + | --sharedstated=* | --sharedstate=* | --sharedstat=* | --sharedsta=* \ + | --sharedst=* | --shareds=* | --shared=* | --share=* | --shar=* \ + | --sha=* | --sh=*) + sharedstatedir=$ac_optarg ;; + + -site | --site | --sit) + ac_prev=site ;; + -site=* | --site=* | --sit=*) + site=$ac_optarg ;; + + -srcdir | --srcdir | --srcdi | --srcd | --src | --sr) + ac_prev=srcdir ;; + -srcdir=* | --srcdir=* | --srcdi=* | --srcd=* | --src=* | --sr=*) + srcdir=$ac_optarg ;; + + -sysconfdir | --sysconfdir | --sysconfdi | --sysconfd | --sysconf \ + | --syscon | --sysco | --sysc | --sys | --sy) + ac_prev=sysconfdir ;; + -sysconfdir=* | --sysconfdir=* | --sysconfdi=* | --sysconfd=* | --sysconf=* \ + | --syscon=* | --sysco=* | --sysc=* | --sys=* | --sy=*) + sysconfdir=$ac_optarg ;; + + -target | --target | --targe | --targ | --tar | --ta | --t) + ac_prev=target_alias ;; + -target=* | --target=* | --targe=* | --targ=* | --tar=* | --ta=* | --t=*) + target_alias=$ac_optarg ;; + + -v | -verbose | --verbose | --verbos | --verbo | --verb) + verbose=yes ;; + + -version | --version | --versio | --versi | --vers | -V) + ac_init_version=: ;; + + -with-* | --with-*) + ac_package=`expr "x$ac_option" : 'x-*with-\([^=]*\)'` + # Reject names that are not valid shell variable names. + expr "x$ac_package" : ".*[^-_$ac_cr_alnum]" >/dev/null && + { echo "$as_me: error: invalid package name: $ac_package" >&2 + { (exit 1); exit 1; }; } + ac_package=`echo $ac_package| sed 's/-/_/g'` + case $ac_option in + *=*) ac_optarg=`echo "$ac_optarg" | sed "s/'/'\\\\\\\\''/g"`;; + *) ac_optarg=yes ;; + esac + eval "with_$ac_package='$ac_optarg'" ;; + + -without-* | --without-*) + ac_package=`expr "x$ac_option" : 'x-*without-\(.*\)'` + # Reject names that are not valid shell variable names. + expr "x$ac_package" : ".*[^-_$ac_cr_alnum]" >/dev/null && + { echo "$as_me: error: invalid package name: $ac_package" >&2 + { (exit 1); exit 1; }; } + ac_package=`echo $ac_package | sed 's/-/_/g'` + eval "with_$ac_package=no" ;; + + --x) + # Obsolete; use --with-x. + with_x=yes ;; + + -x-includes | --x-includes | --x-include | --x-includ | --x-inclu \ + | --x-incl | --x-inc | --x-in | --x-i) + ac_prev=x_includes ;; + -x-includes=* | --x-includes=* | --x-include=* | --x-includ=* | --x-inclu=* \ + | --x-incl=* | --x-inc=* | --x-in=* | --x-i=*) + x_includes=$ac_optarg ;; + + -x-libraries | --x-libraries | --x-librarie | --x-librari \ + | --x-librar | --x-libra | --x-libr | --x-lib | --x-li | --x-l) + ac_prev=x_libraries ;; + -x-libraries=* | --x-libraries=* | --x-librarie=* | --x-librari=* \ + | --x-librar=* | --x-libra=* | --x-libr=* | --x-lib=* | --x-li=* | --x-l=*) + x_libraries=$ac_optarg ;; + + -*) { echo "$as_me: error: unrecognized option: $ac_option +Try \`$0 --help' for more information." >&2 + { (exit 1); exit 1; }; } + ;; + + *=*) + ac_envvar=`expr "x$ac_option" : 'x\([^=]*\)='` + # Reject names that are not valid shell variable names. + expr "x$ac_envvar" : ".*[^_$ac_cr_alnum]" >/dev/null && + { echo "$as_me: error: invalid variable name: $ac_envvar" >&2 + { (exit 1); exit 1; }; } + ac_optarg=`echo "$ac_optarg" | sed "s/'/'\\\\\\\\''/g"` + eval "$ac_envvar='$ac_optarg'" + export $ac_envvar ;; + + *) + # FIXME: should be removed in autoconf 3.0. + echo "$as_me: WARNING: you should use --build, --host, --target" >&2 + expr "x$ac_option" : ".*[^-._$ac_cr_alnum]" >/dev/null && + echo "$as_me: WARNING: invalid host type: $ac_option" >&2 + : ${build_alias=$ac_option} ${host_alias=$ac_option} ${target_alias=$ac_option} + ;; + + esac +done + +if test -n "$ac_prev"; then + ac_option=--`echo $ac_prev | sed 's/_/-/g'` + { echo "$as_me: error: missing argument to $ac_option" >&2 + { (exit 1); exit 1; }; } +fi + +# Be sure to have absolute paths. +for ac_var in bindir sbindir libexecdir datadir sysconfdir sharedstatedir \ + localstatedir libdir includedir oldincludedir infodir mandir \ + exec_prefix prefix +do + eval ac_val=$`echo $ac_var` + case $ac_val in + [\\/$]* | ?:[\\/]* ) ;; + NONE ) ;; + *) { echo "$as_me: error: expected an absolute path for --$ac_var: $ac_val" >&2 + { (exit 1); exit 1; }; };; + esac +done + +# There might be people who depend on the old broken behavior: `$host' +# used to hold the argument of --host etc. +build=$build_alias +host=$host_alias +target=$target_alias + +# FIXME: should be removed in autoconf 3.0. +if test "x$host_alias" != x; then + if test "x$build_alias" = x; then + cross_compiling=maybe + echo "$as_me: WARNING: If you wanted to set the --build type, don't use --host. + If a cross compiler is detected then cross compile mode will be used." >&2 + elif test "x$build_alias" != "x$host_alias"; then + cross_compiling=yes + fi +fi + +ac_tool_prefix= +test -n "$host_alias" && ac_tool_prefix=$host_alias- + +test "$silent" = yes && exec 6>/dev/null + +# Find the source files, if location was not specified. +if test -z "$srcdir"; then + ac_srcdir_defaulted=yes + # Try the directory containing this script, then its parent. + ac_prog=$0 + ac_confdir=`echo "$ac_prog" | sed 's%[\\/][^\\/][^\\/]*$%%'` + test "x$ac_confdir" = "x$ac_prog" && ac_confdir=. + srcdir=$ac_confdir + if test ! -r $srcdir/$ac_unique_file; then + srcdir=.. + fi +else + ac_srcdir_defaulted=no +fi +if test ! -r $srcdir/$ac_unique_file; then + if test "$ac_srcdir_defaulted" = yes; then + { echo "$as_me: error: cannot find sources in $ac_confdir or .." >&2 + { (exit 1); exit 1; }; } + else + { echo "$as_me: error: cannot find sources in $srcdir" >&2 + { (exit 1); exit 1; }; } + fi +fi +srcdir=`echo "$srcdir" | sed 's%\([^\\/]\)[\\/]*$%\1%'` +ac_env_build_alias_set=${build_alias+set} +ac_env_build_alias_value=$build_alias +ac_cv_env_build_alias_set=${build_alias+set} +ac_cv_env_build_alias_value=$build_alias +ac_env_host_alias_set=${host_alias+set} +ac_env_host_alias_value=$host_alias +ac_cv_env_host_alias_set=${host_alias+set} +ac_cv_env_host_alias_value=$host_alias +ac_env_target_alias_set=${target_alias+set} +ac_env_target_alias_value=$target_alias +ac_cv_env_target_alias_set=${target_alias+set} +ac_cv_env_target_alias_value=$target_alias +ac_env_CC_set=${CC+set} +ac_env_CC_value=$CC +ac_cv_env_CC_set=${CC+set} +ac_cv_env_CC_value=$CC +ac_env_CFLAGS_set=${CFLAGS+set} +ac_env_CFLAGS_value=$CFLAGS +ac_cv_env_CFLAGS_set=${CFLAGS+set} +ac_cv_env_CFLAGS_value=$CFLAGS +ac_env_LDFLAGS_set=${LDFLAGS+set} +ac_env_LDFLAGS_value=$LDFLAGS +ac_cv_env_LDFLAGS_set=${LDFLAGS+set} +ac_cv_env_LDFLAGS_value=$LDFLAGS +ac_env_CPPFLAGS_set=${CPPFLAGS+set} +ac_env_CPPFLAGS_value=$CPPFLAGS +ac_cv_env_CPPFLAGS_set=${CPPFLAGS+set} +ac_cv_env_CPPFLAGS_value=$CPPFLAGS +ac_env_CPP_set=${CPP+set} +ac_env_CPP_value=$CPP +ac_cv_env_CPP_set=${CPP+set} +ac_cv_env_CPP_value=$CPP + +# +# Report the --help message. +# +if test "$ac_init_help" = "long"; then + # Omit some internal or obsolete options to make the list less imposing. + # The list generated by autoconf has been trimmed to remove many + # options that are totally irrelevant to PCRE (e.g. relating to X), + # or are not supported by its Makefile. + # This message is too long to be a string in the A/UX 3.1 sh. + cat < if you have libraries in a + nonstandard directory + CPPFLAGS C/C++ preprocessor flags, e.g. -I if you have + headers in a nonstandard directory + CPP C preprocessor + +Use these variables to override the choices made by `configure' or to help +it to find libraries and programs with nonstandard names/locations. + +EOF +fi + +if test "$ac_init_help" = "recursive"; then + # If there are subdirs, report their specific --help. + ac_popdir=`pwd` + for ac_subdir in : $ac_subdirs_all; do test "x$ac_subdir" = x: && continue + cd $ac_subdir + # A "../" for each directory in /$ac_subdir. + ac_dots=`echo $ac_subdir | + sed 's,^\./,,;s,[^/]$,&/,;s,[^/]*/,../,g'` + + case $srcdir in + .) # No --srcdir option. We are building in place. + ac_sub_srcdir=$srcdir ;; + [\\/]* | ?:[\\/]* ) # Absolute path. + ac_sub_srcdir=$srcdir/$ac_subdir ;; + *) # Relative path. + ac_sub_srcdir=$ac_dots$srcdir/$ac_subdir ;; + esac + + # Check for guested configure; otherwise get Cygnus style configure. + if test -f $ac_sub_srcdir/configure.gnu; then + echo + $SHELL $ac_sub_srcdir/configure.gnu --help=recursive + elif test -f $ac_sub_srcdir/configure; then + echo + $SHELL $ac_sub_srcdir/configure --help=recursive + elif test -f $ac_sub_srcdir/configure.ac || + test -f $ac_sub_srcdir/configure.in; then + echo + $ac_configure --help + else + echo "$as_me: WARNING: no configuration information is in $ac_subdir" >&2 + fi + cd $ac_popdir + done +fi + +test -n "$ac_init_help" && exit 0 +if $ac_init_version; then + cat <<\EOF + +Copyright 1992, 1993, 1994, 1995, 1996, 1998, 1999, 2000, 2001 +Free Software Foundation, Inc. +This configure script is free software; the Free Software Foundation +gives unlimited permission to copy, distribute and modify it. +EOF + exit 0 +fi +exec 5>config.log +cat >&5 </dev/null | sed 1q` +uname -m = `(uname -m) 2>/dev/null || echo unknown` +uname -r = `(uname -r) 2>/dev/null || echo unknown` +uname -s = `(uname -s) 2>/dev/null || echo unknown` +uname -v = `(uname -v) 2>/dev/null || echo unknown` + +/usr/bin/uname -p = `(/usr/bin/uname -p) 2>/dev/null || echo unknown` +/bin/uname -X = `(/bin/uname -X) 2>/dev/null || echo unknown` + +/bin/arch = `(/bin/arch) 2>/dev/null || echo unknown` +/usr/bin/arch -k = `(/usr/bin/arch -k) 2>/dev/null || echo unknown` +/usr/convex/getsysinfo = `(/usr/convex/getsysinfo) 2>/dev/null || echo unknown` +hostinfo = `(hostinfo) 2>/dev/null || echo unknown` +/bin/machine = `(/bin/machine) 2>/dev/null || echo unknown` +/usr/bin/oslevel = `(/usr/bin/oslevel) 2>/dev/null || echo unknown` +/bin/universe = `(/bin/universe) 2>/dev/null || echo unknown` + +PATH = $PATH + +_ASUNAME +} >&5 + +cat >&5 <\?\"\']*) + ac_arg=`echo "$ac_arg" | sed "s/'/'\\\\\\\\''/g"` + ac_configure_args="$ac_configure_args$ac_sep'$ac_arg'" + ac_sep=" " ;; + *) ac_configure_args="$ac_configure_args$ac_sep$ac_arg" + ac_sep=" " ;; + esac + # Get rid of the leading space. +done + +# When interrupted or exit'd, cleanup temporary files, and complete +# config.log. We remove comments because anyway the quotes in there +# would cause problems or look ugly. +trap 'exit_status=$? + # Save into config.log some information that might help in debugging. + echo >&5 + echo "## ----------------- ##" >&5 + echo "## Cache variables. ##" >&5 + echo "## ----------------- ##" >&5 + echo >&5 + # The following way of writing the cache mishandles newlines in values, +{ + (set) 2>&1 | + case `(ac_space='"'"' '"'"'; set | grep ac_space) 2>&1` in + *ac_space=\ *) + sed -n \ + "s/'"'"'/'"'"'\\\\'"'"''"'"'/g; + s/^\\([_$ac_cr_alnum]*_cv_[_$ac_cr_alnum]*\\)=\\(.*\\)/\\1='"'"'\\2'"'"'/p" + ;; + *) + sed -n \ + "s/^\\([_$ac_cr_alnum]*_cv_[_$ac_cr_alnum]*\\)=\\(.*\\)/\\1=\\2/p" + ;; + esac; +} >&5 + sed "/^$/d" confdefs.h >conftest.log + if test -s conftest.log; then + echo >&5 + echo "## ------------ ##" >&5 + echo "## confdefs.h. ##" >&5 + echo "## ------------ ##" >&5 + echo >&5 + cat conftest.log >&5 + fi + (echo; echo) >&5 + test "$ac_signal" != 0 && + echo "$as_me: caught signal $ac_signal" >&5 + echo "$as_me: exit $exit_status" >&5 + rm -rf conftest* confdefs* core core.* *.core conf$$* $ac_clean_files && + exit $exit_status + ' 0 +for ac_signal in 1 2 13 15; do + trap 'ac_status=$?; ac_signal='$ac_signal'; { (exit $ac_status); exit $ac_status; }' $ac_signal +done +ac_signal=0 + +# confdefs.h avoids OS command line length limits that DEFS can exceed. +rm -rf conftest* confdefs.h +# AIX cpp loses on an empty file, so make sure it contains at least a newline. +echo >confdefs.h + +# Let the site file select an alternate cache file if it wants to. +# Prefer explicitly selected file to automatically selected ones. +if test -z "$CONFIG_SITE"; then + if test "x$prefix" != xNONE; then + CONFIG_SITE="$prefix/share/config.site $prefix/etc/config.site" + else + CONFIG_SITE="$ac_default_prefix/share/config.site $ac_default_prefix/etc/config.site" + fi +fi +for ac_site_file in $CONFIG_SITE; do + if test -r "$ac_site_file"; then + { echo "$as_me:1012: loading site script $ac_site_file" >&5 +echo "$as_me: loading site script $ac_site_file" >&6;} + cat "$ac_site_file" >&5 + . "$ac_site_file" + fi +done + +if test -r "$cache_file"; then + # Some versions of bash will fail to source /dev/null (special + # files actually), so we avoid doing that. + if test -f "$cache_file"; then + { echo "$as_me:1023: loading cache $cache_file" >&5 +echo "$as_me: loading cache $cache_file" >&6;} + case $cache_file in + [\\/]* | ?:[\\/]* ) . $cache_file;; + *) . ./$cache_file;; + esac + fi +else + { echo "$as_me:1031: creating cache $cache_file" >&5 +echo "$as_me: creating cache $cache_file" >&6;} + >$cache_file +fi + +# Check that the precious variables saved in the cache have kept the same +# value. +ac_suggest_removing_cache=false +for ac_var in `(set) 2>&1 | + sed -n 's/^ac_env_\([a-zA-Z_0-9]*\)_set=.*/\1/p'`; do + eval ac_old_set=\$ac_cv_env_${ac_var}_set + eval ac_new_set=\$ac_env_${ac_var}_set + eval ac_old_val="\$ac_cv_env_${ac_var}_value" + eval ac_new_val="\$ac_env_${ac_var}_value" + case $ac_old_set,$ac_new_set in + set,) + { echo "$as_me:1047: WARNING: \`$ac_var' was set to \`$ac_old_val' in the previous run" >&5 +echo "$as_me: WARNING: \`$ac_var' was set to \`$ac_old_val' in the previous run" >&2;} + ac_suggest_removing_cache=: ;; + ,set) + { echo "$as_me:1051: WARNING: \`$ac_var' was not set in the previous run" >&5 +echo "$as_me: WARNING: \`$ac_var' was not set in the previous run" >&2;} + ac_suggest_removing_cache=: ;; + ,);; + *) + if test "x$ac_old_val" != "x$ac_new_val"; then + { echo "$as_me:1057: WARNING: \`$ac_var' has changed since the previous run:" >&5 +echo "$as_me: WARNING: \`$ac_var' has changed since the previous run:" >&2;} + { echo "$as_me:1059: WARNING: former value: $ac_old_val" >&5 +echo "$as_me: WARNING: former value: $ac_old_val" >&2;} + { echo "$as_me:1061: WARNING: current value: $ac_new_val" >&5 +echo "$as_me: WARNING: current value: $ac_new_val" >&2;} + ac_suggest_removing_cache=: + fi;; + esac +done +if $ac_suggest_removing_cache; then + { echo "$as_me:1068: WARNING: changes in the environment can compromise the build" >&5 +echo "$as_me: WARNING: changes in the environment can compromise the build" >&2;} + { echo "$as_me:1070: WARNING: consider removing $cache_file and starting over" >&5 +echo "$as_me: WARNING: consider removing $cache_file and starting over" >&2;} +fi + +ac_ext=c +ac_cpp='$CPP $CPPFLAGS' +ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' +ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' +ac_compiler_gnu=$ac_cv_c_compiler_gnu + +case `echo "testing\c"; echo 1,2,3`,`echo -n testing; echo 1,2,3` in + *c*,-n*) ECHO_N= ECHO_C=' +' ECHO_T=' ' ;; + *c*,* ) ECHO_N=-n ECHO_C= ECHO_T= ;; + *) ECHO_N= ECHO_C='\c' ECHO_T= ;; +esac +echo "#! $SHELL" >conftest.sh +echo "exit 0" >>conftest.sh +chmod +x conftest.sh +if { (echo "$as_me:1089: PATH=\".;.\"; conftest.sh") >&5 + (PATH=".;."; conftest.sh) 2>&5 + ac_status=$? + echo "$as_me:1092: \$? = $ac_status" >&5 + (exit $ac_status); }; then + ac_path_separator=';' +else + ac_path_separator=: +fi +PATH_SEPARATOR="$ac_path_separator" +rm -f conftest.sh + +ac_config_headers="$ac_config_headers config.h:config.in" + +PCRE_MAJOR=3 +PCRE_MINOR=9 +PCRE_DATE=02-Jan-2002 +PCRE_VERSION=${PCRE_MAJOR}.${PCRE_MINOR} + +PCRE_LIB_VERSION=0:1:0 +PCRE_POSIXLIB_VERSION=0:0:0 + +ac_ext=c +ac_cpp='$CPP $CPPFLAGS' +ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' +ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' +ac_compiler_gnu=$ac_cv_c_compiler_gnu +if test -n "$ac_tool_prefix"; then + # Extract the first word of "${ac_tool_prefix}gcc", so it can be a program name with args. +set dummy ${ac_tool_prefix}gcc; ac_word=$2 +echo "$as_me:1119: checking for $ac_word" >&5 +echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 +if test "${ac_cv_prog_CC+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + if test -n "$CC"; then + ac_cv_prog_CC="$CC" # Let the user override the test. +else + ac_save_IFS=$IFS; IFS=$ac_path_separator +ac_dummy="$PATH" +for ac_dir in $ac_dummy; do + IFS=$ac_save_IFS + test -z "$ac_dir" && ac_dir=. + $as_executable_p "$ac_dir/$ac_word" || continue +ac_cv_prog_CC="${ac_tool_prefix}gcc" +echo "$as_me:1134: found $ac_dir/$ac_word" >&5 +break +done + +fi +fi +CC=$ac_cv_prog_CC +if test -n "$CC"; then + echo "$as_me:1142: result: $CC" >&5 +echo "${ECHO_T}$CC" >&6 +else + echo "$as_me:1145: result: no" >&5 +echo "${ECHO_T}no" >&6 +fi + +fi +if test -z "$ac_cv_prog_CC"; then + ac_ct_CC=$CC + # Extract the first word of "gcc", so it can be a program name with args. +set dummy gcc; ac_word=$2 +echo "$as_me:1154: checking for $ac_word" >&5 +echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 +if test "${ac_cv_prog_ac_ct_CC+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + if test -n "$ac_ct_CC"; then + ac_cv_prog_ac_ct_CC="$ac_ct_CC" # Let the user override the test. +else + ac_save_IFS=$IFS; IFS=$ac_path_separator +ac_dummy="$PATH" +for ac_dir in $ac_dummy; do + IFS=$ac_save_IFS + test -z "$ac_dir" && ac_dir=. + $as_executable_p "$ac_dir/$ac_word" || continue +ac_cv_prog_ac_ct_CC="gcc" +echo "$as_me:1169: found $ac_dir/$ac_word" >&5 +break +done + +fi +fi +ac_ct_CC=$ac_cv_prog_ac_ct_CC +if test -n "$ac_ct_CC"; then + echo "$as_me:1177: result: $ac_ct_CC" >&5 +echo "${ECHO_T}$ac_ct_CC" >&6 +else + echo "$as_me:1180: result: no" >&5 +echo "${ECHO_T}no" >&6 +fi + + CC=$ac_ct_CC +else + CC="$ac_cv_prog_CC" +fi + +if test -z "$CC"; then + if test -n "$ac_tool_prefix"; then + # Extract the first word of "${ac_tool_prefix}cc", so it can be a program name with args. +set dummy ${ac_tool_prefix}cc; ac_word=$2 +echo "$as_me:1193: checking for $ac_word" >&5 +echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 +if test "${ac_cv_prog_CC+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + if test -n "$CC"; then + ac_cv_prog_CC="$CC" # Let the user override the test. +else + ac_save_IFS=$IFS; IFS=$ac_path_separator +ac_dummy="$PATH" +for ac_dir in $ac_dummy; do + IFS=$ac_save_IFS + test -z "$ac_dir" && ac_dir=. + $as_executable_p "$ac_dir/$ac_word" || continue +ac_cv_prog_CC="${ac_tool_prefix}cc" +echo "$as_me:1208: found $ac_dir/$ac_word" >&5 +break +done + +fi +fi +CC=$ac_cv_prog_CC +if test -n "$CC"; then + echo "$as_me:1216: result: $CC" >&5 +echo "${ECHO_T}$CC" >&6 +else + echo "$as_me:1219: result: no" >&5 +echo "${ECHO_T}no" >&6 +fi + +fi +if test -z "$ac_cv_prog_CC"; then + ac_ct_CC=$CC + # Extract the first word of "cc", so it can be a program name with args. +set dummy cc; ac_word=$2 +echo "$as_me:1228: checking for $ac_word" >&5 +echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 +if test "${ac_cv_prog_ac_ct_CC+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + if test -n "$ac_ct_CC"; then + ac_cv_prog_ac_ct_CC="$ac_ct_CC" # Let the user override the test. +else + ac_save_IFS=$IFS; IFS=$ac_path_separator +ac_dummy="$PATH" +for ac_dir in $ac_dummy; do + IFS=$ac_save_IFS + test -z "$ac_dir" && ac_dir=. + $as_executable_p "$ac_dir/$ac_word" || continue +ac_cv_prog_ac_ct_CC="cc" +echo "$as_me:1243: found $ac_dir/$ac_word" >&5 +break +done + +fi +fi +ac_ct_CC=$ac_cv_prog_ac_ct_CC +if test -n "$ac_ct_CC"; then + echo "$as_me:1251: result: $ac_ct_CC" >&5 +echo "${ECHO_T}$ac_ct_CC" >&6 +else + echo "$as_me:1254: result: no" >&5 +echo "${ECHO_T}no" >&6 +fi + + CC=$ac_ct_CC +else + CC="$ac_cv_prog_CC" +fi + +fi +if test -z "$CC"; then + # Extract the first word of "cc", so it can be a program name with args. +set dummy cc; ac_word=$2 +echo "$as_me:1267: checking for $ac_word" >&5 +echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 +if test "${ac_cv_prog_CC+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + if test -n "$CC"; then + ac_cv_prog_CC="$CC" # Let the user override the test. +else + ac_prog_rejected=no + ac_save_IFS=$IFS; IFS=$ac_path_separator +ac_dummy="$PATH" +for ac_dir in $ac_dummy; do + IFS=$ac_save_IFS + test -z "$ac_dir" && ac_dir=. + $as_executable_p "$ac_dir/$ac_word" || continue +if test "$ac_dir/$ac_word" = "/usr/ucb/cc"; then + ac_prog_rejected=yes + continue +fi +ac_cv_prog_CC="cc" +echo "$as_me:1287: found $ac_dir/$ac_word" >&5 +break +done + +if test $ac_prog_rejected = yes; then + # We found a bogon in the path, so make sure we never use it. + set dummy $ac_cv_prog_CC + shift + if test $# != 0; then + # We chose a different compiler from the bogus one. + # However, it has the same basename, so the bogon will be chosen + # first if we set CC to just the basename; use the full file name. + shift + set dummy "$ac_dir/$ac_word" ${1+"$@"} + shift + ac_cv_prog_CC="$@" + fi +fi +fi +fi +CC=$ac_cv_prog_CC +if test -n "$CC"; then + echo "$as_me:1309: result: $CC" >&5 +echo "${ECHO_T}$CC" >&6 +else + echo "$as_me:1312: result: no" >&5 +echo "${ECHO_T}no" >&6 +fi + +fi +if test -z "$CC"; then + if test -n "$ac_tool_prefix"; then + for ac_prog in cl + do + # Extract the first word of "$ac_tool_prefix$ac_prog", so it can be a program name with args. +set dummy $ac_tool_prefix$ac_prog; ac_word=$2 +echo "$as_me:1323: checking for $ac_word" >&5 +echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 +if test "${ac_cv_prog_CC+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + if test -n "$CC"; then + ac_cv_prog_CC="$CC" # Let the user override the test. +else + ac_save_IFS=$IFS; IFS=$ac_path_separator +ac_dummy="$PATH" +for ac_dir in $ac_dummy; do + IFS=$ac_save_IFS + test -z "$ac_dir" && ac_dir=. + $as_executable_p "$ac_dir/$ac_word" || continue +ac_cv_prog_CC="$ac_tool_prefix$ac_prog" +echo "$as_me:1338: found $ac_dir/$ac_word" >&5 +break +done + +fi +fi +CC=$ac_cv_prog_CC +if test -n "$CC"; then + echo "$as_me:1346: result: $CC" >&5 +echo "${ECHO_T}$CC" >&6 +else + echo "$as_me:1349: result: no" >&5 +echo "${ECHO_T}no" >&6 +fi + + test -n "$CC" && break + done +fi +if test -z "$CC"; then + ac_ct_CC=$CC + for ac_prog in cl +do + # Extract the first word of "$ac_prog", so it can be a program name with args. +set dummy $ac_prog; ac_word=$2 +echo "$as_me:1362: checking for $ac_word" >&5 +echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 +if test "${ac_cv_prog_ac_ct_CC+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + if test -n "$ac_ct_CC"; then + ac_cv_prog_ac_ct_CC="$ac_ct_CC" # Let the user override the test. +else + ac_save_IFS=$IFS; IFS=$ac_path_separator +ac_dummy="$PATH" +for ac_dir in $ac_dummy; do + IFS=$ac_save_IFS + test -z "$ac_dir" && ac_dir=. + $as_executable_p "$ac_dir/$ac_word" || continue +ac_cv_prog_ac_ct_CC="$ac_prog" +echo "$as_me:1377: found $ac_dir/$ac_word" >&5 +break +done + +fi +fi +ac_ct_CC=$ac_cv_prog_ac_ct_CC +if test -n "$ac_ct_CC"; then + echo "$as_me:1385: result: $ac_ct_CC" >&5 +echo "${ECHO_T}$ac_ct_CC" >&6 +else + echo "$as_me:1388: result: no" >&5 +echo "${ECHO_T}no" >&6 +fi + + test -n "$ac_ct_CC" && break +done + + CC=$ac_ct_CC +fi + +fi + +test -z "$CC" && { { echo "$as_me:1400: error: no acceptable cc found in \$PATH" >&5 +echo "$as_me: error: no acceptable cc found in \$PATH" >&2;} + { (exit 1); exit 1; }; } + +cat >conftest.$ac_ext <<_ACEOF +#line 1405 "configure" +#include "confdefs.h" + +int +main () +{ + + ; + return 0; +} +_ACEOF +ac_clean_files_save=$ac_clean_files +ac_clean_files="$ac_clean_files a.out a.exe" +# Try to create an executable without -o first, disregard a.out. +# It will help us diagnose broken compiler, and finding out an intuition +# of exeext. +echo "$as_me:1421: checking for C compiler default output" >&5 +echo $ECHO_N "checking for C compiler default output... $ECHO_C" >&6 +ac_link_default=`echo "$ac_link" | sed 's/ -o *conftest[^ ]*//'` +if { (eval echo "$as_me:1424: \"$ac_link_default\"") >&5 + (eval $ac_link_default) 2>&5 + ac_status=$? + echo "$as_me:1427: \$? = $ac_status" >&5 + (exit $ac_status); }; then + for ac_file in `ls a.exe conftest.exe a.* conftest conftest.* 2>/dev/null`; do + case $ac_file in + *.$ac_ext | *.o | *.obj | *.xcoff | *.tds | *.d | *.pdb ) ;; + a.out ) # We found the default executable, but exeext='' is most + # certainly right. + break;; + *.* ) ac_cv_exeext=`expr "$ac_file" : '[^.]*\(\..*\)'` + export ac_cv_exeext + break;; + * ) break;; + esac +done +else + echo "$as_me: failed program was:" >&5 +cat conftest.$ac_ext >&5 +{ { echo "$as_me:1444: error: C compiler cannot create executables" >&5 +echo "$as_me: error: C compiler cannot create executables" >&2;} + { (exit 77); exit 77; }; } +fi + +ac_exeext=$ac_cv_exeext +echo "$as_me:1450: result: $ac_file" >&5 +echo "${ECHO_T}$ac_file" >&6 + +# Check the compiler produces executables we can run. If not, either +# the compiler is broken, or we cross compile. +echo "$as_me:1455: checking whether the C compiler works" >&5 +echo $ECHO_N "checking whether the C compiler works... $ECHO_C" >&6 +# FIXME: These cross compiler hacks should be removed for Autoconf 3.0 +# If not cross compiling, check that we can run a simple program. +if test "$cross_compiling" != yes; then + if { ac_try='./$ac_file' + { (eval echo "$as_me:1461: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:1464: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + cross_compiling=no + else + if test "$cross_compiling" = maybe; then + cross_compiling=yes + else + { { echo "$as_me:1471: error: cannot run C compiled programs. +If you meant to cross compile, use \`--host'." >&5 +echo "$as_me: error: cannot run C compiled programs. +If you meant to cross compile, use \`--host'." >&2;} + { (exit 1); exit 1; }; } + fi + fi +fi +echo "$as_me:1479: result: yes" >&5 +echo "${ECHO_T}yes" >&6 + +rm -f a.out a.exe conftest$ac_cv_exeext +ac_clean_files=$ac_clean_files_save +# Check the compiler produces executables we can run. If not, either +# the compiler is broken, or we cross compile. +echo "$as_me:1486: checking whether we are cross compiling" >&5 +echo $ECHO_N "checking whether we are cross compiling... $ECHO_C" >&6 +echo "$as_me:1488: result: $cross_compiling" >&5 +echo "${ECHO_T}$cross_compiling" >&6 + +echo "$as_me:1491: checking for executable suffix" >&5 +echo $ECHO_N "checking for executable suffix... $ECHO_C" >&6 +if { (eval echo "$as_me:1493: \"$ac_link\"") >&5 + (eval $ac_link) 2>&5 + ac_status=$? + echo "$as_me:1496: \$? = $ac_status" >&5 + (exit $ac_status); }; then + # If both `conftest.exe' and `conftest' are `present' (well, observable) +# catch `conftest.exe'. For instance with Cygwin, `ls conftest' will +# work properly (i.e., refer to `conftest.exe'), while it won't with +# `rm'. +for ac_file in `(ls conftest.exe; ls conftest; ls conftest.*) 2>/dev/null`; do + case $ac_file in + *.$ac_ext | *.o | *.obj | *.xcoff | *.tds | *.d | *.pdb ) ;; + *.* ) ac_cv_exeext=`expr "$ac_file" : '[^.]*\(\..*\)'` + export ac_cv_exeext + break;; + * ) break;; + esac +done +else + { { echo "$as_me:1512: error: cannot compute EXEEXT: cannot compile and link" >&5 +echo "$as_me: error: cannot compute EXEEXT: cannot compile and link" >&2;} + { (exit 1); exit 1; }; } +fi + +rm -f conftest$ac_cv_exeext +echo "$as_me:1518: result: $ac_cv_exeext" >&5 +echo "${ECHO_T}$ac_cv_exeext" >&6 + +rm -f conftest.$ac_ext +EXEEXT=$ac_cv_exeext +ac_exeext=$EXEEXT +echo "$as_me:1524: checking for object suffix" >&5 +echo $ECHO_N "checking for object suffix... $ECHO_C" >&6 +if test "${ac_cv_objext+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + cat >conftest.$ac_ext <<_ACEOF +#line 1530 "configure" +#include "confdefs.h" + +int +main () +{ + + ; + return 0; +} +_ACEOF +rm -f conftest.o conftest.obj +if { (eval echo "$as_me:1542: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>&5 + ac_status=$? + echo "$as_me:1545: \$? = $ac_status" >&5 + (exit $ac_status); }; then + for ac_file in `(ls conftest.o conftest.obj; ls conftest.*) 2>/dev/null`; do + case $ac_file in + *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb ) ;; + *) ac_cv_objext=`expr "$ac_file" : '.*\.\(.*\)'` + break;; + esac +done +else + echo "$as_me: failed program was:" >&5 +cat conftest.$ac_ext >&5 +{ { echo "$as_me:1557: error: cannot compute OBJEXT: cannot compile" >&5 +echo "$as_me: error: cannot compute OBJEXT: cannot compile" >&2;} + { (exit 1); exit 1; }; } +fi + +rm -f conftest.$ac_cv_objext conftest.$ac_ext +fi +echo "$as_me:1564: result: $ac_cv_objext" >&5 +echo "${ECHO_T}$ac_cv_objext" >&6 +OBJEXT=$ac_cv_objext +ac_objext=$OBJEXT +echo "$as_me:1568: checking whether we are using the GNU C compiler" >&5 +echo $ECHO_N "checking whether we are using the GNU C compiler... $ECHO_C" >&6 +if test "${ac_cv_c_compiler_gnu+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + cat >conftest.$ac_ext <<_ACEOF +#line 1574 "configure" +#include "confdefs.h" + +int +main () +{ +#ifndef __GNUC__ + choke me +#endif + + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:1589: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>&5 + ac_status=$? + echo "$as_me:1592: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:1595: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:1598: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_compiler_gnu=yes +else + echo "$as_me: failed program was:" >&5 +cat conftest.$ac_ext >&5 +ac_compiler_gnu=no +fi +rm -f conftest.$ac_objext conftest.$ac_ext +ac_cv_c_compiler_gnu=$ac_compiler_gnu + +fi +echo "$as_me:1610: result: $ac_cv_c_compiler_gnu" >&5 +echo "${ECHO_T}$ac_cv_c_compiler_gnu" >&6 +GCC=`test $ac_compiler_gnu = yes && echo yes` +ac_test_CFLAGS=${CFLAGS+set} +ac_save_CFLAGS=$CFLAGS +CFLAGS="-g" +echo "$as_me:1616: checking whether $CC accepts -g" >&5 +echo $ECHO_N "checking whether $CC accepts -g... $ECHO_C" >&6 +if test "${ac_cv_prog_cc_g+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + cat >conftest.$ac_ext <<_ACEOF +#line 1622 "configure" +#include "confdefs.h" + +int +main () +{ + + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:1634: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>&5 + ac_status=$? + echo "$as_me:1637: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:1640: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:1643: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_cv_prog_cc_g=yes +else + echo "$as_me: failed program was:" >&5 +cat conftest.$ac_ext >&5 +ac_cv_prog_cc_g=no +fi +rm -f conftest.$ac_objext conftest.$ac_ext +fi +echo "$as_me:1653: result: $ac_cv_prog_cc_g" >&5 +echo "${ECHO_T}$ac_cv_prog_cc_g" >&6 +if test "$ac_test_CFLAGS" = set; then + CFLAGS=$ac_save_CFLAGS +elif test $ac_cv_prog_cc_g = yes; then + if test "$GCC" = yes; then + CFLAGS="-g -O2" + else + CFLAGS="-g" + fi +else + if test "$GCC" = yes; then + CFLAGS="-O2" + else + CFLAGS= + fi +fi +# Some people use a C++ compiler to compile C. Since we use `exit', +# in C++ we need to declare it. In case someone uses the same compiler +# for both compiling C and C++ we need to have the C++ compiler decide +# the declaration of exit, since it's the most demanding environment. +cat >conftest.$ac_ext <<_ACEOF +#ifndef __cplusplus + choke me +#endif +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:1680: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>&5 + ac_status=$? + echo "$as_me:1683: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:1686: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:1689: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + for ac_declaration in \ + ''\ + '#include ' \ + 'extern "C" void std::exit (int) throw (); using std::exit;' \ + 'extern "C" void std::exit (int); using std::exit;' \ + 'extern "C" void exit (int) throw ();' \ + 'extern "C" void exit (int);' \ + 'void exit (int);' +do + cat >conftest.$ac_ext <<_ACEOF +#line 1701 "configure" +#include "confdefs.h" +#include +$ac_declaration +int +main () +{ +exit (42); + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:1714: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>&5 + ac_status=$? + echo "$as_me:1717: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:1720: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:1723: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + : +else + echo "$as_me: failed program was:" >&5 +cat conftest.$ac_ext >&5 +continue +fi +rm -f conftest.$ac_objext conftest.$ac_ext + cat >conftest.$ac_ext <<_ACEOF +#line 1733 "configure" +#include "confdefs.h" +$ac_declaration +int +main () +{ +exit (42); + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:1745: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>&5 + ac_status=$? + echo "$as_me:1748: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:1751: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:1754: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + break +else + echo "$as_me: failed program was:" >&5 +cat conftest.$ac_ext >&5 +fi +rm -f conftest.$ac_objext conftest.$ac_ext +done +echo '#ifdef __cplusplus' >>confdefs.h +echo $ac_declaration >>confdefs.h +echo '#endif' >>confdefs.h + +else + echo "$as_me: failed program was:" >&5 +cat conftest.$ac_ext >&5 +fi +rm -f conftest.$ac_objext conftest.$ac_ext +ac_ext=c +ac_cpp='$CPP $CPPFLAGS' +ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' +ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' +ac_compiler_gnu=$ac_cv_c_compiler_gnu + +ac_aux_dir= +for ac_dir in $srcdir $srcdir/.. $srcdir/../..; do + if test -f $ac_dir/install-sh; then + ac_aux_dir=$ac_dir + ac_install_sh="$ac_aux_dir/install-sh -c" + break + elif test -f $ac_dir/install.sh; then + ac_aux_dir=$ac_dir + ac_install_sh="$ac_aux_dir/install.sh -c" + break + elif test -f $ac_dir/shtool; then + ac_aux_dir=$ac_dir + ac_install_sh="$ac_aux_dir/shtool install -c" + break + fi +done +if test -z "$ac_aux_dir"; then + { { echo "$as_me:1795: error: cannot find install-sh or install.sh in $srcdir $srcdir/.. $srcdir/../.." >&5 +echo "$as_me: error: cannot find install-sh or install.sh in $srcdir $srcdir/.. $srcdir/../.." >&2;} + { (exit 1); exit 1; }; } +fi +ac_config_guess="$SHELL $ac_aux_dir/config.guess" +ac_config_sub="$SHELL $ac_aux_dir/config.sub" +ac_configure="$SHELL $ac_aux_dir/configure" # This should be Cygnus configure. + +# Find a good install program. We prefer a C program (faster), +# so one script is as good as another. But avoid the broken or +# incompatible versions: +# SysV /etc/install, /usr/sbin/install +# SunOS /usr/etc/install +# IRIX /sbin/install +# AIX /bin/install +# AmigaOS /C/install, which installs bootblocks on floppy discs +# AIX 4 /usr/bin/installbsd, which doesn't work without a -g flag +# AFS /usr/afsws/bin/install, which mishandles nonexistent args +# SVR4 /usr/ucb/install, which tries to use the nonexistent group "staff" +# ./install, which can be erroneously created by make from ./install.sh. +echo "$as_me:1815: checking for a BSD compatible install" >&5 +echo $ECHO_N "checking for a BSD compatible install... $ECHO_C" >&6 +if test -z "$INSTALL"; then +if test "${ac_cv_path_install+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + ac_save_IFS=$IFS; IFS=$ac_path_separator + for ac_dir in $PATH; do + IFS=$ac_save_IFS + # Account for people who put trailing slashes in PATH elements. + case $ac_dir/ in + / | ./ | .// | /cC/* \ + | /etc/* | /usr/sbin/* | /usr/etc/* | /sbin/* | /usr/afsws/bin/* \ + | /usr/ucb/* ) ;; + *) + # OSF1 and SCO ODT 3.0 have their own names for install. + # Don't use installbsd from OSF since it installs stuff as root + # by default. + for ac_prog in ginstall scoinst install; do + if $as_executable_p "$ac_dir/$ac_prog"; then + if test $ac_prog = install && + grep dspmsg "$ac_dir/$ac_prog" >/dev/null 2>&1; then + # AIX install. It has an incompatible calling convention. + : + elif test $ac_prog = install && + grep pwplus "$ac_dir/$ac_prog" >/dev/null 2>&1; then + # program-specific install script used by HP pwplus--don't use. + : + else + ac_cv_path_install="$ac_dir/$ac_prog -c" + break 2 + fi + fi + done + ;; + esac + done + +fi + if test "${ac_cv_path_install+set}" = set; then + INSTALL=$ac_cv_path_install + else + # As a last resort, use the slow shell script. We don't cache a + # path for INSTALL within a source directory, because that will + # break other packages using the cache if that directory is + # removed, or if the path is relative. + INSTALL=$ac_install_sh + fi +fi +echo "$as_me:1864: result: $INSTALL" >&5 +echo "${ECHO_T}$INSTALL" >&6 + +# Use test -z because SunOS4 sh mishandles braces in ${var-val}. +# It thinks the first close brace ends the variable substitution. +test -z "$INSTALL_PROGRAM" && INSTALL_PROGRAM='${INSTALL}' + +test -z "$INSTALL_SCRIPT" && INSTALL_SCRIPT='${INSTALL}' + +test -z "$INSTALL_DATA" && INSTALL_DATA='${INSTALL} -m 644' + +if test -n "$ac_tool_prefix"; then + # Extract the first word of "${ac_tool_prefix}ranlib", so it can be a program name with args. +set dummy ${ac_tool_prefix}ranlib; ac_word=$2 +echo "$as_me:1878: checking for $ac_word" >&5 +echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 +if test "${ac_cv_prog_RANLIB+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + if test -n "$RANLIB"; then + ac_cv_prog_RANLIB="$RANLIB" # Let the user override the test. +else + ac_save_IFS=$IFS; IFS=$ac_path_separator +ac_dummy="$PATH" +for ac_dir in $ac_dummy; do + IFS=$ac_save_IFS + test -z "$ac_dir" && ac_dir=. + $as_executable_p "$ac_dir/$ac_word" || continue +ac_cv_prog_RANLIB="${ac_tool_prefix}ranlib" +echo "$as_me:1893: found $ac_dir/$ac_word" >&5 +break +done + +fi +fi +RANLIB=$ac_cv_prog_RANLIB +if test -n "$RANLIB"; then + echo "$as_me:1901: result: $RANLIB" >&5 +echo "${ECHO_T}$RANLIB" >&6 +else + echo "$as_me:1904: result: no" >&5 +echo "${ECHO_T}no" >&6 +fi + +fi +if test -z "$ac_cv_prog_RANLIB"; then + ac_ct_RANLIB=$RANLIB + # Extract the first word of "ranlib", so it can be a program name with args. +set dummy ranlib; ac_word=$2 +echo "$as_me:1913: checking for $ac_word" >&5 +echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 +if test "${ac_cv_prog_ac_ct_RANLIB+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + if test -n "$ac_ct_RANLIB"; then + ac_cv_prog_ac_ct_RANLIB="$ac_ct_RANLIB" # Let the user override the test. +else + ac_save_IFS=$IFS; IFS=$ac_path_separator +ac_dummy="$PATH" +for ac_dir in $ac_dummy; do + IFS=$ac_save_IFS + test -z "$ac_dir" && ac_dir=. + $as_executable_p "$ac_dir/$ac_word" || continue +ac_cv_prog_ac_ct_RANLIB="ranlib" +echo "$as_me:1928: found $ac_dir/$ac_word" >&5 +break +done + + test -z "$ac_cv_prog_ac_ct_RANLIB" && ac_cv_prog_ac_ct_RANLIB=":" +fi +fi +ac_ct_RANLIB=$ac_cv_prog_ac_ct_RANLIB +if test -n "$ac_ct_RANLIB"; then + echo "$as_me:1937: result: $ac_ct_RANLIB" >&5 +echo "${ECHO_T}$ac_ct_RANLIB" >&6 +else + echo "$as_me:1940: result: no" >&5 +echo "${ECHO_T}no" >&6 +fi + + RANLIB=$ac_ct_RANLIB +else + RANLIB="$ac_cv_prog_RANLIB" +fi + +ac_ext=c +ac_cpp='$CPP $CPPFLAGS' +ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' +ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' +ac_compiler_gnu=$ac_cv_c_compiler_gnu +echo "$as_me:1954: checking how to run the C preprocessor" >&5 +echo $ECHO_N "checking how to run the C preprocessor... $ECHO_C" >&6 +# On Suns, sometimes $CPP names a directory. +if test -n "$CPP" && test -d "$CPP"; then + CPP= +fi +if test -z "$CPP"; then + if test "${ac_cv_prog_CPP+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + # Double quotes because CPP needs to be expanded + for CPP in "$CC -E" "$CC -E -traditional-cpp" "/lib/cpp" + do + # break 2 since there is a loop in there. + ac_preproc_ok=false +for ac_c_preproc_warn_flag in '' yes +do + # Use a header file that comes with gcc, so configuring glibc + # with a fresh cross-compiler works. + # On the NeXT, cc -E runs the code through the compiler's parser, + # not just through cpp. "Syntax error" is here to catch this case. + cat >conftest.$ac_ext <<_ACEOF +#line 1976 "configure" +#include "confdefs.h" +#include + Syntax error +_ACEOF +if { (eval echo "$as_me:1981: \"$ac_cpp conftest.$ac_ext\"") >&5 + (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1 + ac_status=$? + egrep -v '^ *\+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:1987: \$? = $ac_status" >&5 + (exit $ac_status); } >/dev/null; then + if test -s conftest.err; then + ac_cpp_err=$ac_c_preproc_warn_flag + else + ac_cpp_err= + fi +else + ac_cpp_err=yes +fi +if test -z "$ac_cpp_err"; then + : +else + echo "$as_me: failed program was:" >&5 + cat conftest.$ac_ext >&5 + # Broken: fails on valid input. +continue +fi +rm -f conftest.err conftest.$ac_ext + + # OK, works on sane cases. Now check whether non-existent headers + # can be detected and how. + cat >conftest.$ac_ext <<_ACEOF +#line 2010 "configure" +#include "confdefs.h" +#include +_ACEOF +if { (eval echo "$as_me:2014: \"$ac_cpp conftest.$ac_ext\"") >&5 + (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1 + ac_status=$? + egrep -v '^ *\+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:2020: \$? = $ac_status" >&5 + (exit $ac_status); } >/dev/null; then + if test -s conftest.err; then + ac_cpp_err=$ac_c_preproc_warn_flag + else + ac_cpp_err= + fi +else + ac_cpp_err=yes +fi +if test -z "$ac_cpp_err"; then + # Broken: success on invalid input. +continue +else + echo "$as_me: failed program was:" >&5 + cat conftest.$ac_ext >&5 + # Passes both tests. +ac_preproc_ok=: +break +fi +rm -f conftest.err conftest.$ac_ext + +done +# Because of `break', _AC_PREPROC_IFELSE's cleaning code was skipped. +rm -f conftest.err conftest.$ac_ext +if $ac_preproc_ok; then + break 2 +fi + + done + ac_cv_prog_CPP=$CPP + +fi + CPP=$ac_cv_prog_CPP +else + ac_cv_prog_CPP=$CPP +fi +echo "$as_me:2057: result: $CPP" >&5 +echo "${ECHO_T}$CPP" >&6 +ac_preproc_ok=false +for ac_c_preproc_warn_flag in '' yes +do + # Use a header file that comes with gcc, so configuring glibc + # with a fresh cross-compiler works. + # On the NeXT, cc -E runs the code through the compiler's parser, + # not just through cpp. "Syntax error" is here to catch this case. + cat >conftest.$ac_ext <<_ACEOF +#line 2067 "configure" +#include "confdefs.h" +#include + Syntax error +_ACEOF +if { (eval echo "$as_me:2072: \"$ac_cpp conftest.$ac_ext\"") >&5 + (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1 + ac_status=$? + egrep -v '^ *\+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:2078: \$? = $ac_status" >&5 + (exit $ac_status); } >/dev/null; then + if test -s conftest.err; then + ac_cpp_err=$ac_c_preproc_warn_flag + else + ac_cpp_err= + fi +else + ac_cpp_err=yes +fi +if test -z "$ac_cpp_err"; then + : +else + echo "$as_me: failed program was:" >&5 + cat conftest.$ac_ext >&5 + # Broken: fails on valid input. +continue +fi +rm -f conftest.err conftest.$ac_ext + + # OK, works on sane cases. Now check whether non-existent headers + # can be detected and how. + cat >conftest.$ac_ext <<_ACEOF +#line 2101 "configure" +#include "confdefs.h" +#include +_ACEOF +if { (eval echo "$as_me:2105: \"$ac_cpp conftest.$ac_ext\"") >&5 + (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1 + ac_status=$? + egrep -v '^ *\+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:2111: \$? = $ac_status" >&5 + (exit $ac_status); } >/dev/null; then + if test -s conftest.err; then + ac_cpp_err=$ac_c_preproc_warn_flag + else + ac_cpp_err= + fi +else + ac_cpp_err=yes +fi +if test -z "$ac_cpp_err"; then + # Broken: success on invalid input. +continue +else + echo "$as_me: failed program was:" >&5 + cat conftest.$ac_ext >&5 + # Passes both tests. +ac_preproc_ok=: +break +fi +rm -f conftest.err conftest.$ac_ext + +done +# Because of `break', _AC_PREPROC_IFELSE's cleaning code was skipped. +rm -f conftest.err conftest.$ac_ext +if $ac_preproc_ok; then + : +else + { { echo "$as_me:2139: error: C preprocessor \"$CPP\" fails sanity check" >&5 +echo "$as_me: error: C preprocessor \"$CPP\" fails sanity check" >&2;} + { (exit 1); exit 1; }; } +fi + +ac_ext=c +ac_cpp='$CPP $CPPFLAGS' +ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' +ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' +ac_compiler_gnu=$ac_cv_c_compiler_gnu + +echo "$as_me:2150: checking for ANSI C header files" >&5 +echo $ECHO_N "checking for ANSI C header files... $ECHO_C" >&6 +if test "${ac_cv_header_stdc+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + cat >conftest.$ac_ext <<_ACEOF +#line 2156 "configure" +#include "confdefs.h" +#include +#include +#include +#include + +_ACEOF +if { (eval echo "$as_me:2164: \"$ac_cpp conftest.$ac_ext\"") >&5 + (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1 + ac_status=$? + egrep -v '^ *\+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:2170: \$? = $ac_status" >&5 + (exit $ac_status); } >/dev/null; then + if test -s conftest.err; then + ac_cpp_err=$ac_c_preproc_warn_flag + else + ac_cpp_err= + fi +else + ac_cpp_err=yes +fi +if test -z "$ac_cpp_err"; then + ac_cv_header_stdc=yes +else + echo "$as_me: failed program was:" >&5 + cat conftest.$ac_ext >&5 + ac_cv_header_stdc=no +fi +rm -f conftest.err conftest.$ac_ext + +if test $ac_cv_header_stdc = yes; then + # SunOS 4.x string.h does not declare mem*, contrary to ANSI. + cat >conftest.$ac_ext <<_ACEOF +#line 2192 "configure" +#include "confdefs.h" +#include + +_ACEOF +if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | + egrep "memchr" >/dev/null 2>&1; then + : +else + ac_cv_header_stdc=no +fi +rm -f conftest* + +fi + +if test $ac_cv_header_stdc = yes; then + # ISC 2.0.2 stdlib.h does not declare free, contrary to ANSI. + cat >conftest.$ac_ext <<_ACEOF +#line 2210 "configure" +#include "confdefs.h" +#include + +_ACEOF +if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | + egrep "free" >/dev/null 2>&1; then + : +else + ac_cv_header_stdc=no +fi +rm -f conftest* + +fi + +if test $ac_cv_header_stdc = yes; then + # /bin/cc in Irix-4.0.5 gets non-ANSI ctype macros unless using -ansi. + if test "$cross_compiling" = yes; then + : +else + cat >conftest.$ac_ext <<_ACEOF +#line 2231 "configure" +#include "confdefs.h" +#include +#if ((' ' & 0x0FF) == 0x020) +# define ISLOWER(c) ('a' <= (c) && (c) <= 'z') +# define TOUPPER(c) (ISLOWER(c) ? 'A' + ((c) - 'a') : (c)) +#else +# define ISLOWER(c) (('a' <= (c) && (c) <= 'i') \ + || ('j' <= (c) && (c) <= 'r') \ + || ('s' <= (c) && (c) <= 'z')) +# define TOUPPER(c) (ISLOWER(c) ? ((c) | 0x40) : (c)) +#endif + +#define XOR(e, f) (((e) && !(f)) || (!(e) && (f))) +int +main () +{ + int i; + for (i = 0; i < 256; i++) + if (XOR (islower (i), ISLOWER (i)) + || toupper (i) != TOUPPER (i)) + exit(2); + exit (0); +} +_ACEOF +rm -f conftest$ac_exeext +if { (eval echo "$as_me:2257: \"$ac_link\"") >&5 + (eval $ac_link) 2>&5 + ac_status=$? + echo "$as_me:2260: \$? = $ac_status" >&5 + (exit $ac_status); } && { ac_try='./conftest$ac_exeext' + { (eval echo "$as_me:2262: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:2265: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + : +else + echo "$as_me: program exited with status $ac_status" >&5 +echo "$as_me: failed program was:" >&5 +cat conftest.$ac_ext >&5 +ac_cv_header_stdc=no +fi +rm -f core core.* *.core conftest$ac_exeext conftest.$ac_ext +fi +fi +fi +echo "$as_me:2278: result: $ac_cv_header_stdc" >&5 +echo "${ECHO_T}$ac_cv_header_stdc" >&6 +if test $ac_cv_header_stdc = yes; then + +cat >>confdefs.h <<\EOF +#define STDC_HEADERS 1 +EOF + +fi + +for ac_header in limits.h +do +ac_ac_Header=`echo "ac_cv_header_$ac_header" | $ac_tr_sh` +echo "$as_me:2291: checking for $ac_header" >&5 +echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6 +if eval "test \"\${$ac_ac_Header+set}\" = set"; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + cat >conftest.$ac_ext <<_ACEOF +#line 2297 "configure" +#include "confdefs.h" +#include <$ac_header> +_ACEOF +if { (eval echo "$as_me:2301: \"$ac_cpp conftest.$ac_ext\"") >&5 + (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1 + ac_status=$? + egrep -v '^ *\+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:2307: \$? = $ac_status" >&5 + (exit $ac_status); } >/dev/null; then + if test -s conftest.err; then + ac_cpp_err=$ac_c_preproc_warn_flag + else + ac_cpp_err= + fi +else + ac_cpp_err=yes +fi +if test -z "$ac_cpp_err"; then + eval "$ac_ac_Header=yes" +else + echo "$as_me: failed program was:" >&5 + cat conftest.$ac_ext >&5 + eval "$ac_ac_Header=no" +fi +rm -f conftest.err conftest.$ac_ext +fi +echo "$as_me:2326: result: `eval echo '${'$ac_ac_Header'}'`" >&5 +echo "${ECHO_T}`eval echo '${'$ac_ac_Header'}'`" >&6 +if test `eval echo '${'$ac_ac_Header'}'` = yes; then + cat >>confdefs.h <&5 +echo $ECHO_N "checking for $CC option to accept ANSI C... $ECHO_C" >&6 +if test "${ac_cv_prog_cc_stdc+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + ac_cv_prog_cc_stdc=no +ac_save_CC=$CC +cat >conftest.$ac_ext <<_ACEOF +#line 2344 "configure" +#include "confdefs.h" +#include +#include +#include +#include +/* Most of the following tests are stolen from RCS 5.7's src/conf.sh. */ +struct buf { int x; }; +FILE * (*rcsopen) (struct buf *, struct stat *, int); +static char *e (p, i) + char **p; + int i; +{ + return p[i]; +} +static char *f (char * (*g) (char **, int), char **p, ...) +{ + char *s; + va_list v; + va_start (v,p); + s = g (p, va_arg (v,int)); + va_end (v); + return s; +} +int test (int i, double x); +struct s1 {int (*f) (int a);}; +struct s2 {int (*f) (double a);}; +int pairnames (int, char **, FILE *(*)(struct buf *, struct stat *, int), int, int); +int argc; +char **argv; +int +main () +{ +return f (e, argv, 0) != argv[0] || f (e, argv, 1) != argv[1]; + ; + return 0; +} +_ACEOF +# Don't try gcc -ansi; that turns off useful extensions and +# breaks some systems' header files. +# AIX -qlanglvl=ansi +# Ultrix and OSF/1 -std1 +# HP-UX 10.20 and later -Ae +# HP-UX older versions -Aa -D_HPUX_SOURCE +# SVR4 -Xc -D__EXTENSIONS__ +for ac_arg in "" -qlanglvl=ansi -std1 -Ae "-Aa -D_HPUX_SOURCE" "-Xc -D__EXTENSIONS__" +do + CC="$ac_save_CC $ac_arg" + rm -f conftest.$ac_objext +if { (eval echo "$as_me:2393: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>&5 + ac_status=$? + echo "$as_me:2396: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:2399: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:2402: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_cv_prog_cc_stdc=$ac_arg +break +else + echo "$as_me: failed program was:" >&5 +cat conftest.$ac_ext >&5 +fi +rm -f conftest.$ac_objext +done +rm -f conftest.$ac_ext conftest.$ac_objext +CC=$ac_save_CC + +fi + +case "x$ac_cv_prog_cc_stdc" in + x|xno) + echo "$as_me:2419: result: none needed" >&5 +echo "${ECHO_T}none needed" >&6 ;; + *) + echo "$as_me:2422: result: $ac_cv_prog_cc_stdc" >&5 +echo "${ECHO_T}$ac_cv_prog_cc_stdc" >&6 + CC="$CC $ac_cv_prog_cc_stdc" ;; +esac + +echo "$as_me:2427: checking for an ANSI C-conforming const" >&5 +echo $ECHO_N "checking for an ANSI C-conforming const... $ECHO_C" >&6 +if test "${ac_cv_c_const+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + cat >conftest.$ac_ext <<_ACEOF +#line 2433 "configure" +#include "confdefs.h" + +int +main () +{ +/* FIXME: Include the comments suggested by Paul. */ +#ifndef __cplusplus + /* Ultrix mips cc rejects this. */ + typedef int charset[2]; + const charset x; + /* SunOS 4.1.1 cc rejects this. */ + char const *const *ccp; + char **p; + /* NEC SVR4.0.2 mips cc rejects this. */ + struct point {int x, y;}; + static struct point const zero = {0,0}; + /* AIX XL C 1.02.0.0 rejects this. + It does not let you subtract one const X* pointer from another in + an arm of an if-expression whose if-part is not a constant + expression */ + const char *g = "string"; + ccp = &g + (g ? g-g : 0); + /* HPUX 7.0 cc rejects these. */ + ++ccp; + p = (char**) ccp; + ccp = (char const *const *) p; + { /* SCO 3.2v4 cc rejects this. */ + char *t; + char const *s = 0 ? (char *) 0 : (char const *) 0; + + *t++ = 0; + } + { /* Someone thinks the Sun supposedly-ANSI compiler will reject this. */ + int x[] = {25, 17}; + const int *foo = &x[0]; + ++foo; + } + { /* Sun SC1.0 ANSI compiler rejects this -- but not the above. */ + typedef const int *iptr; + iptr p = 0; + ++p; + } + { /* AIX XL C 1.02.0.0 rejects this saying + "k.c", line 2.27: 1506-025 (S) Operand must be a modifiable lvalue. */ + struct s { int j; const int *ap[3]; }; + struct s *b; b->j = 5; + } + { /* ULTRIX-32 V3.1 (Rev 9) vcc rejects this */ + const int foo = 10; + } +#endif + + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:2491: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>&5 + ac_status=$? + echo "$as_me:2494: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:2497: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:2500: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_cv_c_const=yes +else + echo "$as_me: failed program was:" >&5 +cat conftest.$ac_ext >&5 +ac_cv_c_const=no +fi +rm -f conftest.$ac_objext conftest.$ac_ext +fi +echo "$as_me:2510: result: $ac_cv_c_const" >&5 +echo "${ECHO_T}$ac_cv_c_const" >&6 +if test $ac_cv_c_const = no; then + +cat >>confdefs.h <<\EOF +#define const +EOF + +fi + +for ac_header in stdlib.h string.h memory.h strings.h inttypes.h unistd.h +do +ac_ac_Header=`echo "ac_cv_header_$ac_header" | $ac_tr_sh` +echo "$as_me:2523: checking for $ac_header" >&5 +echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6 +if eval "test \"\${$ac_ac_Header+set}\" = set"; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + cat >conftest.$ac_ext <<_ACEOF +#line 2529 "configure" +#include "confdefs.h" +#include <$ac_header> +_ACEOF +if { (eval echo "$as_me:2533: \"$ac_cpp conftest.$ac_ext\"") >&5 + (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1 + ac_status=$? + egrep -v '^ *\+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:2539: \$? = $ac_status" >&5 + (exit $ac_status); } >/dev/null; then + if test -s conftest.err; then + ac_cpp_err=$ac_c_preproc_warn_flag + else + ac_cpp_err= + fi +else + ac_cpp_err=yes +fi +if test -z "$ac_cpp_err"; then + eval "$ac_ac_Header=yes" +else + echo "$as_me: failed program was:" >&5 + cat conftest.$ac_ext >&5 + eval "$ac_ac_Header=no" +fi +rm -f conftest.err conftest.$ac_ext +fi +echo "$as_me:2558: result: `eval echo '${'$ac_ac_Header'}'`" >&5 +echo "${ECHO_T}`eval echo '${'$ac_ac_Header'}'`" >&6 +if test `eval echo '${'$ac_ac_Header'}'` = yes; then + cat >>confdefs.h <&5 +echo $ECHO_N "checking for size_t... $ECHO_C" >&6 +if test "${ac_cv_type_size_t+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + cat >conftest.$ac_ext <<_ACEOF +#line 2574 "configure" +#include "confdefs.h" +$ac_includes_default +int +main () +{ +if ((size_t *) 0) + return 0; +if (sizeof (size_t)) + return 0; + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:2589: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>&5 + ac_status=$? + echo "$as_me:2592: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:2595: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:2598: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_cv_type_size_t=yes +else + echo "$as_me: failed program was:" >&5 +cat conftest.$ac_ext >&5 +ac_cv_type_size_t=no +fi +rm -f conftest.$ac_objext conftest.$ac_ext +fi +echo "$as_me:2608: result: $ac_cv_type_size_t" >&5 +echo "${ECHO_T}$ac_cv_type_size_t" >&6 +if test $ac_cv_type_size_t = yes; then + : +else + +cat >>confdefs.h <&5 +echo $ECHO_N "checking for $ac_func... $ECHO_C" >&6 +if eval "test \"\${$ac_ac_var+set}\" = set"; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + cat >conftest.$ac_ext <<_ACEOF +#line 2629 "configure" +#include "confdefs.h" +/* System header to define __stub macros and hopefully few prototypes, + which can conflict with char $ac_func (); below. */ +#include +/* Override any gcc2 internal prototype to avoid an error. */ +#ifdef __cplusplus +extern "C" +#endif +/* We use char because int might match the return type of a gcc2 + builtin and then its argument prototype would still apply. */ +char $ac_func (); +char (*f) (); + +int +main () +{ +/* The GNU C library defines this for functions which it implements + to always fail with ENOSYS. Some functions are actually named + something starting with __ and the normal name is an alias. */ +#if defined (__stub_$ac_func) || defined (__stub___$ac_func) +choke me +#else +f = $ac_func; +#endif + + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext conftest$ac_exeext +if { (eval echo "$as_me:2660: \"$ac_link\"") >&5 + (eval $ac_link) 2>&5 + ac_status=$? + echo "$as_me:2663: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -s conftest$ac_exeext' + { (eval echo "$as_me:2666: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:2669: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + eval "$ac_ac_var=yes" +else + echo "$as_me: failed program was:" >&5 +cat conftest.$ac_ext >&5 +eval "$ac_ac_var=no" +fi +rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext +fi +echo "$as_me:2679: result: `eval echo '${'$ac_ac_var'}'`" >&5 +echo "${ECHO_T}`eval echo '${'$ac_ac_var'}'`" >&6 +if test `eval echo '${'$ac_ac_var'}'` = yes; then + cat >>confdefs.h </dev/null 2>&1 || + { { echo "$as_me:2784: error: cannot run $ac_config_sub" >&5 +echo "$as_me: error: cannot run $ac_config_sub" >&2;} + { (exit 1); exit 1; }; } + +echo "$as_me:2788: checking build system type" >&5 +echo $ECHO_N "checking build system type... $ECHO_C" >&6 +if test "${ac_cv_build+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + ac_cv_build_alias=$build_alias +test -z "$ac_cv_build_alias" && + ac_cv_build_alias=`$ac_config_guess` +test -z "$ac_cv_build_alias" && + { { echo "$as_me:2797: error: cannot guess build type; you must specify one" >&5 +echo "$as_me: error: cannot guess build type; you must specify one" >&2;} + { (exit 1); exit 1; }; } +ac_cv_build=`$ac_config_sub $ac_cv_build_alias` || + { { echo "$as_me:2801: error: $ac_config_sub $ac_cv_build_alias failed." >&5 +echo "$as_me: error: $ac_config_sub $ac_cv_build_alias failed." >&2;} + { (exit 1); exit 1; }; } + +fi +echo "$as_me:2806: result: $ac_cv_build" >&5 +echo "${ECHO_T}$ac_cv_build" >&6 +build=$ac_cv_build +build_cpu=`echo $ac_cv_build | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\1/'` +build_vendor=`echo $ac_cv_build | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\2/'` +build_os=`echo $ac_cv_build | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\3/'` + +echo "$as_me:2813: checking host system type" >&5 +echo $ECHO_N "checking host system type... $ECHO_C" >&6 +if test "${ac_cv_host+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + ac_cv_host_alias=$host_alias +test -z "$ac_cv_host_alias" && + ac_cv_host_alias=$ac_cv_build_alias +ac_cv_host=`$ac_config_sub $ac_cv_host_alias` || + { { echo "$as_me:2822: error: $ac_config_sub $ac_cv_host_alias failed" >&5 +echo "$as_me: error: $ac_config_sub $ac_cv_host_alias failed" >&2;} + { (exit 1); exit 1; }; } + +fi +echo "$as_me:2827: result: $ac_cv_host" >&5 +echo "${ECHO_T}$ac_cv_host" >&6 +host=$ac_cv_host +host_cpu=`echo $ac_cv_host | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\1/'` +host_vendor=`echo $ac_cv_host | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\2/'` +host_os=`echo $ac_cv_host | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\3/'` + +# Check whether --with-gnu-ld or --without-gnu-ld was given. +if test "${with_gnu_ld+set}" = set; then + withval="$with_gnu_ld" + test "$withval" = no || with_gnu_ld=yes +else + with_gnu_ld=no +fi; +ac_prog=ld +if test "$GCC" = yes; then + # Check if gcc -print-prog-name=ld gives a path. + echo "$as_me:2844: checking for ld used by GCC" >&5 +echo $ECHO_N "checking for ld used by GCC... $ECHO_C" >&6 + case $host in + *-*-mingw*) + # gcc leaves a trailing carriage return which upsets mingw + ac_prog=`($CC -print-prog-name=ld) 2>&5 | tr -d '\015'` ;; + *) + ac_prog=`($CC -print-prog-name=ld) 2>&5` ;; + esac + case $ac_prog in + # Accept absolute paths. + [\\/]* | [A-Za-z]:[\\/]*) + re_direlt='/[^/][^/]*/\.\./' + # Canonicalize the path of ld + ac_prog=`echo $ac_prog| sed 's%\\\\%/%g'` + while echo $ac_prog | grep "$re_direlt" > /dev/null 2>&1; do + ac_prog=`echo $ac_prog| sed "s%$re_direlt%/%"` + done + test -z "$LD" && LD="$ac_prog" + ;; + "") + # If it fails, then pretend we aren't using GCC. + ac_prog=ld + ;; + *) + # If it is relative, then search for the first ld in PATH. + with_gnu_ld=unknown + ;; + esac +elif test "$with_gnu_ld" = yes; then + echo "$as_me:2874: checking for GNU ld" >&5 +echo $ECHO_N "checking for GNU ld... $ECHO_C" >&6 +else + echo "$as_me:2877: checking for non-GNU ld" >&5 +echo $ECHO_N "checking for non-GNU ld... $ECHO_C" >&6 +fi +if test "${lt_cv_path_LD+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + if test -z "$LD"; then + IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS="${IFS}${PATH_SEPARATOR-:}" + for ac_dir in $PATH; do + test -z "$ac_dir" && ac_dir=. + if test -f "$ac_dir/$ac_prog" || test -f "$ac_dir/$ac_prog$ac_exeext"; then + lt_cv_path_LD="$ac_dir/$ac_prog" + # Check to see if the program is GNU ld. I'd rather use --version, + # but apparently some GNU ld's only accept -v. + # Break only if it was the GNU/non-GNU ld that we prefer. + if "$lt_cv_path_LD" -v 2>&1 < /dev/null | egrep '(GNU|with BFD)' > /dev/null; then + test "$with_gnu_ld" != no && break + else + test "$with_gnu_ld" != yes && break + fi + fi + done + IFS="$ac_save_ifs" +else + lt_cv_path_LD="$LD" # Let the user override the test with a path. +fi +fi + +LD="$lt_cv_path_LD" +if test -n "$LD"; then + echo "$as_me:2907: result: $LD" >&5 +echo "${ECHO_T}$LD" >&6 +else + echo "$as_me:2910: result: no" >&5 +echo "${ECHO_T}no" >&6 +fi +test -z "$LD" && { { echo "$as_me:2913: error: no acceptable ld found in \$PATH" >&5 +echo "$as_me: error: no acceptable ld found in \$PATH" >&2;} + { (exit 1); exit 1; }; } +echo "$as_me:2916: checking if the linker ($LD) is GNU ld" >&5 +echo $ECHO_N "checking if the linker ($LD) is GNU ld... $ECHO_C" >&6 +if test "${lt_cv_prog_gnu_ld+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + # I'd rather use --version here, but apparently some GNU ld's only accept -v. +if $LD -v 2>&1 &5; then + lt_cv_prog_gnu_ld=yes +else + lt_cv_prog_gnu_ld=no +fi +fi +echo "$as_me:2928: result: $lt_cv_prog_gnu_ld" >&5 +echo "${ECHO_T}$lt_cv_prog_gnu_ld" >&6 +with_gnu_ld=$lt_cv_prog_gnu_ld + +echo "$as_me:2932: checking for $LD option to reload object files" >&5 +echo $ECHO_N "checking for $LD option to reload object files... $ECHO_C" >&6 +if test "${lt_cv_ld_reload_flag+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + lt_cv_ld_reload_flag='-r' +fi +echo "$as_me:2939: result: $lt_cv_ld_reload_flag" >&5 +echo "${ECHO_T}$lt_cv_ld_reload_flag" >&6 +reload_flag=$lt_cv_ld_reload_flag +test -n "$reload_flag" && reload_flag=" $reload_flag" + +echo "$as_me:2944: checking for BSD-compatible nm" >&5 +echo $ECHO_N "checking for BSD-compatible nm... $ECHO_C" >&6 +if test "${lt_cv_path_NM+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + if test -n "$NM"; then + # Let the user override the test. + lt_cv_path_NM="$NM" +else + IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS="${IFS}${PATH_SEPARATOR-:}" + for ac_dir in $PATH /usr/ccs/bin /usr/ucb /bin; do + test -z "$ac_dir" && ac_dir=. + tmp_nm=$ac_dir/${ac_tool_prefix}nm + if test -f $tmp_nm || test -f $tmp_nm$ac_exeext ; then + # Check to see if the nm accepts a BSD-compat flag. + # Adding the `sed 1q' prevents false positives on HP-UX, which says: + # nm: unknown option "B" ignored + # Tru64's nm complains that /dev/null is an invalid object file + if ($tmp_nm -B /dev/null 2>&1 | sed '1q'; exit 0) | egrep '(/dev/null|Invalid file or object type)' >/dev/null; then + lt_cv_path_NM="$tmp_nm -B" + break + elif ($tmp_nm -p /dev/null 2>&1 | sed '1q'; exit 0) | egrep /dev/null >/dev/null; then + lt_cv_path_NM="$tmp_nm -p" + break + else + lt_cv_path_NM=${lt_cv_path_NM="$tmp_nm"} # keep the first match, but + continue # so that we can try to find one that supports BSD flags + fi + fi + done + IFS="$ac_save_ifs" + test -z "$lt_cv_path_NM" && lt_cv_path_NM=nm +fi +fi + +NM="$lt_cv_path_NM" +echo "$as_me:2980: result: $NM" >&5 +echo "${ECHO_T}$NM" >&6 + +echo "$as_me:2983: checking whether ln -s works" >&5 +echo $ECHO_N "checking whether ln -s works... $ECHO_C" >&6 +LN_S=$as_ln_s +if test "$LN_S" = "ln -s"; then + echo "$as_me:2987: result: yes" >&5 +echo "${ECHO_T}yes" >&6 +else + echo "$as_me:2990: result: no, using $LN_S" >&5 +echo "${ECHO_T}no, using $LN_S" >&6 +fi + +echo "$as_me:2994: checking how to recognise dependant libraries" >&5 +echo $ECHO_N "checking how to recognise dependant libraries... $ECHO_C" >&6 +if test "${lt_cv_deplibs_check_method+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + lt_cv_file_magic_cmd='$MAGIC_CMD' +lt_cv_file_magic_test_file= +lt_cv_deplibs_check_method='unknown' +# Need to set the preceding variable on all platforms that support +# interlibrary dependencies. +# 'none' -- dependencies not supported. +# `unknown' -- same as none, but documents that we really don't know. +# 'pass_all' -- all dependencies passed with no checks. +# 'test_compile' -- check by making test program. +# ['file_magic [regex]'] -- check by looking for files in library path +# which responds to the $file_magic_cmd with a given egrep regex. +# If you have `file' or equivalent on your system and you're not sure +# whether `pass_all' will *always* work, you probably want this one. + +case $host_os in +aix4* | aix5*) + lt_cv_deplibs_check_method=pass_all + ;; + +beos*) + lt_cv_deplibs_check_method=pass_all + ;; + +bsdi4*) + lt_cv_deplibs_check_method='file_magic ELF [0-9][0-9]*-bit [ML]SB (shared object|dynamic lib)' + lt_cv_file_magic_cmd='/usr/bin/file -L' + lt_cv_file_magic_test_file=/shlib/libc.so + ;; + +cygwin* | mingw* | pw32*) + lt_cv_deplibs_check_method='file_magic file format pei*-i386(.*architecture: i386)?' + lt_cv_file_magic_cmd='$OBJDUMP -f' + ;; + +darwin* | rhapsody*) + lt_cv_deplibs_check_method='file_magic Mach-O dynamically linked shared library' + lt_cv_file_magic_cmd='/usr/bin/file -L' + case "$host_os" in + rhapsody* | darwin1.012) + lt_cv_file_magic_test_file=`echo /System/Library/Frameworks/System.framework/Versions/*/System | head -1` + ;; + *) # Darwin 1.3 on + lt_cv_file_magic_test_file='/usr/lib/libSystem.dylib' + ;; + esac + ;; + +freebsd*) + if echo __ELF__ | $CC -E - | grep __ELF__ > /dev/null; then + case $host_cpu in + i*86 ) + # Not sure whether the presence of OpenBSD here was a mistake. + # Let's accept both of them until this is cleared up. + lt_cv_deplibs_check_method='file_magic (FreeBSD|OpenBSD)/i[3-9]86 (compact )?demand paged shared library' + lt_cv_file_magic_cmd=/usr/bin/file + lt_cv_file_magic_test_file=`echo /usr/lib/libc.so.*` + ;; + esac + else + lt_cv_deplibs_check_method=pass_all + fi + ;; + +gnu*) + lt_cv_deplibs_check_method=pass_all + ;; + +hpux10.20*|hpux11*) + lt_cv_deplibs_check_method='file_magic (s[0-9][0-9][0-9]|PA-RISC[0-9].[0-9]) shared library' + lt_cv_file_magic_cmd=/usr/bin/file + lt_cv_file_magic_test_file=/usr/lib/libc.sl + ;; + +irix5* | irix6*) + case $host_os in + irix5*) + # this will be overridden with pass_all, but let us keep it just in case + lt_cv_deplibs_check_method="file_magic ELF 32-bit MSB dynamic lib MIPS - version 1" + ;; + *) + case $LD in + *-32|*"-32 ") libmagic=32-bit;; + *-n32|*"-n32 ") libmagic=N32;; + *-64|*"-64 ") libmagic=64-bit;; + *) libmagic=never-match;; + esac + # this will be overridden with pass_all, but let us keep it just in case + lt_cv_deplibs_check_method="file_magic ELF ${libmagic} MSB mips-[1234] dynamic lib MIPS - version 1" + ;; + esac + lt_cv_file_magic_test_file=`echo /lib${libsuff}/libc.so*` + lt_cv_deplibs_check_method=pass_all + ;; + +# This must be Linux ELF. +linux-gnu*) + case $host_cpu in + alpha* | i*86 | powerpc* | sparc* | ia64* ) + lt_cv_deplibs_check_method=pass_all ;; + *) + # glibc up to 2.1.1 does not perform some relocations on ARM + lt_cv_deplibs_check_method='file_magic ELF [0-9][0-9]*-bit [LM]SB (shared object|dynamic lib )' ;; + esac + lt_cv_file_magic_test_file=`echo /lib/libc.so* /lib/libc-*.so` + ;; + +netbsd*) + if echo __ELF__ | $CC -E - | grep __ELF__ > /dev/null; then + lt_cv_deplibs_check_method='match_pattern /lib[^/\.]+\.so\.[0-9]+\.[0-9]+$' + else + lt_cv_deplibs_check_method='match_pattern /lib[^/\.]+\.so$' + fi + ;; + +newos6*) + lt_cv_deplibs_check_method='file_magic ELF [0-9][0-9]*-bit [ML]SB (executable|dynamic lib)' + lt_cv_file_magic_cmd=/usr/bin/file + lt_cv_file_magic_test_file=/usr/lib/libnls.so + ;; + +osf3* | osf4* | osf5*) + # this will be overridden with pass_all, but let us keep it just in case + lt_cv_deplibs_check_method='file_magic COFF format alpha shared library' + lt_cv_file_magic_test_file=/shlib/libc.so + lt_cv_deplibs_check_method=pass_all + ;; + +sco3.2v5*) + lt_cv_deplibs_check_method=pass_all + ;; + +solaris*) + lt_cv_deplibs_check_method=pass_all + lt_cv_file_magic_test_file=/lib/libc.so + ;; + +sysv5uw[78]* | sysv4*uw2*) + lt_cv_deplibs_check_method=pass_all + ;; + +sysv4 | sysv4.2uw2* | sysv4.3* | sysv5*) + case $host_vendor in + motorola) + lt_cv_deplibs_check_method='file_magic ELF [0-9][0-9]*-bit [ML]SB (shared object|dynamic lib) M[0-9][0-9]* Version [0-9]' + lt_cv_file_magic_test_file=`echo /usr/lib/libc.so*` + ;; + ncr) + lt_cv_deplibs_check_method=pass_all + ;; + sequent) + lt_cv_file_magic_cmd='/bin/file' + lt_cv_deplibs_check_method='file_magic ELF [0-9][0-9]*-bit [LM]SB (shared object|dynamic lib )' + ;; + sni) + lt_cv_file_magic_cmd='/bin/file' + lt_cv_deplibs_check_method="file_magic ELF [0-9][0-9]*-bit [LM]SB dynamic lib" + lt_cv_file_magic_test_file=/lib/libc.so + ;; + esac + ;; +esac + +fi +echo "$as_me:3162: result: $lt_cv_deplibs_check_method" >&5 +echo "${ECHO_T}$lt_cv_deplibs_check_method" >&6 +file_magic_cmd=$lt_cv_file_magic_cmd +deplibs_check_method=$lt_cv_deplibs_check_method + +# Check for command to grab the raw symbol name followed by C symbol from nm. +echo "$as_me:3168: checking command to parse $NM output" >&5 +echo $ECHO_N "checking command to parse $NM output... $ECHO_C" >&6 +if test "${lt_cv_sys_global_symbol_pipe+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + +# These are sane defaults that work on at least a few old systems. +# [They come from Ultrix. What could be older than Ultrix?!! ;)] + +# Character class describing NM global symbol codes. +symcode='[BCDEGRST]' + +# Regexp to match symbols that can be accessed directly from C. +sympat='\([_A-Za-z][_A-Za-z0-9]*\)' + +# Transform the above into a raw symbol and a C symbol. +symxfrm='\1 \2\3 \3' + +# Transform an extracted symbol line into a proper C declaration +lt_cv_global_symbol_to_cdecl="sed -n -e 's/^. .* \(.*\)$/extern char \1;/p'" + +# Define system-specific variables. +case $host_os in +aix*) + symcode='[BCDT]' + ;; +cygwin* | mingw* | pw32*) + symcode='[ABCDGISTW]' + ;; +hpux*) # Its linker distinguishes data from code symbols + lt_cv_global_symbol_to_cdecl="sed -n -e 's/^T .* \(.*\)$/extern char \1();/p' -e 's/^$symcode* .* \(.*\)$/extern char \1;/p'" + ;; +irix*) + symcode='[BCDEGRST]' + ;; +solaris* | sysv5*) + symcode='[BDT]' + ;; +sysv4) + symcode='[DFNSTU]' + ;; +esac + +# Handle CRLF in mingw tool chain +opt_cr= +case $host_os in +mingw*) + opt_cr=`echo 'x\{0,1\}' | tr x '\015'` # option cr in regexp + ;; +esac + +# If we're using GNU nm, then use its standard symbol codes. +if $NM -V 2>&1 | egrep '(GNU|with BFD)' > /dev/null; then + symcode='[ABCDGISTW]' +fi + +# Try without a prefix undercore, then with it. +for ac_symprfx in "" "_"; do + + # Write the raw and C identifiers. +lt_cv_sys_global_symbol_pipe="sed -n -e 's/^.*[ ]\($symcode$symcode*\)[ ][ ]*\($ac_symprfx\)$sympat$opt_cr$/$symxfrm/p'" + + # Check to see that the pipe works correctly. + pipe_works=no + rm -f conftest* + cat > conftest.$ac_ext <&5 + (eval $ac_compile) 2>&5 + ac_status=$? + echo "$as_me:3248: \$? = $ac_status" >&5 + (exit $ac_status); }; then + # Now try to grab the symbols. + nlist=conftest.nm + if { (eval echo "$as_me:3252: \"$NM conftest.$ac_objext \| $lt_cv_sys_global_symbol_pipe \> $nlist\"") >&5 + (eval $NM conftest.$ac_objext \| $lt_cv_sys_global_symbol_pipe \> $nlist) 2>&5 + ac_status=$? + echo "$as_me:3255: \$? = $ac_status" >&5 + (exit $ac_status); } && test -s "$nlist"; then + # Try sorting and uniquifying the output. + if sort "$nlist" | uniq > "$nlist"T; then + mv -f "$nlist"T "$nlist" + else + rm -f "$nlist"T + fi + + # Make sure that we snagged all the symbols we need. + if egrep ' nm_test_var$' "$nlist" >/dev/null; then + if egrep ' nm_test_func$' "$nlist" >/dev/null; then + cat < conftest.$ac_ext +#ifdef __cplusplus +extern "C" { +#endif + +EOF + # Now generate the symbol file. + eval "$lt_cv_global_symbol_to_cdecl"' < "$nlist" >> conftest.$ac_ext' + + cat <> conftest.$ac_ext +#if defined (__STDC__) && __STDC__ +# define lt_ptr_t void * +#else +# define lt_ptr_t char * +# define const +#endif + +/* The mapping between symbol names and symbols. */ +const struct { + const char *name; + lt_ptr_t address; +} +lt_preloaded_symbols[] = +{ +EOF + sed "s/^$symcode$symcode* \(.*\) \(.*\)$/ {\"\2\", (lt_ptr_t) \&\2},/" < "$nlist" >> conftest.$ac_ext + cat <<\EOF >> conftest.$ac_ext + {0, (lt_ptr_t) 0} +}; + +#ifdef __cplusplus +} +#endif +EOF + # Now try linking the two files. + mv conftest.$ac_objext conftstm.$ac_objext + save_LIBS="$LIBS" + save_CFLAGS="$CFLAGS" + LIBS="conftstm.$ac_objext" + CFLAGS="$CFLAGS$no_builtin_flag" + if { (eval echo "$as_me:3307: \"$ac_link\"") >&5 + (eval $ac_link) 2>&5 + ac_status=$? + echo "$as_me:3310: \$? = $ac_status" >&5 + (exit $ac_status); } && test -s conftest; then + pipe_works=yes + fi + LIBS="$save_LIBS" + CFLAGS="$save_CFLAGS" + else + echo "cannot find nm_test_func in $nlist" >&5 + fi + else + echo "cannot find nm_test_var in $nlist" >&5 + fi + else + echo "cannot run $lt_cv_sys_global_symbol_pipe" >&5 + fi + else + echo "$progname: failed program was:" >&5 + cat conftest.$ac_ext >&5 + fi + rm -f conftest* conftst* + + # Do not use the global_symbol_pipe unless it works. + if test "$pipe_works" = yes; then + break + else + lt_cv_sys_global_symbol_pipe= + fi +done + +fi + +global_symbol_pipe="$lt_cv_sys_global_symbol_pipe" +if test -z "$lt_cv_sys_global_symbol_pipe"; then + global_symbol_to_cdecl= +else + global_symbol_to_cdecl="$lt_cv_global_symbol_to_cdecl" +fi +if test -z "$global_symbol_pipe$global_symbol_to_cdecl"; then + echo "$as_me:3348: result: failed" >&5 +echo "${ECHO_T}failed" >&6 +else + echo "$as_me:3351: result: ok" >&5 +echo "${ECHO_T}ok" >&6 +fi + +for ac_header in dlfcn.h +do +ac_ac_Header=`echo "ac_cv_header_$ac_header" | $ac_tr_sh` +echo "$as_me:3358: checking for $ac_header" >&5 +echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6 +if eval "test \"\${$ac_ac_Header+set}\" = set"; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + cat >conftest.$ac_ext <<_ACEOF +#line 3364 "configure" +#include "confdefs.h" +#include <$ac_header> +_ACEOF +if { (eval echo "$as_me:3368: \"$ac_cpp conftest.$ac_ext\"") >&5 + (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1 + ac_status=$? + egrep -v '^ *\+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:3374: \$? = $ac_status" >&5 + (exit $ac_status); } >/dev/null; then + if test -s conftest.err; then + ac_cpp_err=$ac_c_preproc_warn_flag + else + ac_cpp_err= + fi +else + ac_cpp_err=yes +fi +if test -z "$ac_cpp_err"; then + eval "$ac_ac_Header=yes" +else + echo "$as_me: failed program was:" >&5 + cat conftest.$ac_ext >&5 + eval "$ac_ac_Header=no" +fi +rm -f conftest.err conftest.$ac_ext +fi +echo "$as_me:3393: result: `eval echo '${'$ac_ac_Header'}'`" >&5 +echo "${ECHO_T}`eval echo '${'$ac_ac_Header'}'`" >&6 +if test `eval echo '${'$ac_ac_Header'}'` = yes; then + cat >>confdefs.h <&5 +echo $ECHO_N "checking for ${ac_tool_prefix}file... $ECHO_C" >&6 +if test "${lt_cv_path_MAGIC_CMD+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + case $MAGIC_CMD in + /*) + lt_cv_path_MAGIC_CMD="$MAGIC_CMD" # Let the user override the test with a path. + ;; + ?:/*) + lt_cv_path_MAGIC_CMD="$MAGIC_CMD" # Let the user override the test with a dos path. + ;; + *) + ac_save_MAGIC_CMD="$MAGIC_CMD" + IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS=":" + ac_dummy="/usr/bin:$PATH" + for ac_dir in $ac_dummy; do + test -z "$ac_dir" && ac_dir=. + if test -f $ac_dir/${ac_tool_prefix}file; then + lt_cv_path_MAGIC_CMD="$ac_dir/${ac_tool_prefix}file" + if test -n "$file_magic_test_file"; then + case $deplibs_check_method in + "file_magic "*) + file_magic_regex="`expr \"$deplibs_check_method\" : \"file_magic \(.*\)\"`" + MAGIC_CMD="$lt_cv_path_MAGIC_CMD" + if eval $file_magic_cmd \$file_magic_test_file 2> /dev/null | + egrep "$file_magic_regex" > /dev/null; then + : + else + cat <&2 + +*** Warning: the command libtool uses to detect shared libraries, +*** $file_magic_cmd, produces output that libtool cannot recognize. +*** The result is that libtool may fail to recognize shared libraries +*** as such. This will affect the creation of libtool libraries that +*** depend on shared libraries, but programs linked with such libtool +*** libraries will work regardless of this problem. Nevertheless, you +*** may want to report the problem to your system manager and/or to +*** bug-libtool@gnu.org + +EOF + fi ;; + esac + fi + break + fi + done + IFS="$ac_save_ifs" + MAGIC_CMD="$ac_save_MAGIC_CMD" + ;; +esac +fi + +MAGIC_CMD="$lt_cv_path_MAGIC_CMD" +if test -n "$MAGIC_CMD"; then + echo "$as_me:3462: result: $MAGIC_CMD" >&5 +echo "${ECHO_T}$MAGIC_CMD" >&6 +else + echo "$as_me:3465: result: no" >&5 +echo "${ECHO_T}no" >&6 +fi + +if test -z "$lt_cv_path_MAGIC_CMD"; then + if test -n "$ac_tool_prefix"; then + echo "$as_me:3471: checking for file" >&5 +echo $ECHO_N "checking for file... $ECHO_C" >&6 +if test "${lt_cv_path_MAGIC_CMD+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + case $MAGIC_CMD in + /*) + lt_cv_path_MAGIC_CMD="$MAGIC_CMD" # Let the user override the test with a path. + ;; + ?:/*) + lt_cv_path_MAGIC_CMD="$MAGIC_CMD" # Let the user override the test with a dos path. + ;; + *) + ac_save_MAGIC_CMD="$MAGIC_CMD" + IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS=":" + ac_dummy="/usr/bin:$PATH" + for ac_dir in $ac_dummy; do + test -z "$ac_dir" && ac_dir=. + if test -f $ac_dir/file; then + lt_cv_path_MAGIC_CMD="$ac_dir/file" + if test -n "$file_magic_test_file"; then + case $deplibs_check_method in + "file_magic "*) + file_magic_regex="`expr \"$deplibs_check_method\" : \"file_magic \(.*\)\"`" + MAGIC_CMD="$lt_cv_path_MAGIC_CMD" + if eval $file_magic_cmd \$file_magic_test_file 2> /dev/null | + egrep "$file_magic_regex" > /dev/null; then + : + else + cat <&2 + +*** Warning: the command libtool uses to detect shared libraries, +*** $file_magic_cmd, produces output that libtool cannot recognize. +*** The result is that libtool may fail to recognize shared libraries +*** as such. This will affect the creation of libtool libraries that +*** depend on shared libraries, but programs linked with such libtool +*** libraries will work regardless of this problem. Nevertheless, you +*** may want to report the problem to your system manager and/or to +*** bug-libtool@gnu.org + +EOF + fi ;; + esac + fi + break + fi + done + IFS="$ac_save_ifs" + MAGIC_CMD="$ac_save_MAGIC_CMD" + ;; +esac +fi + +MAGIC_CMD="$lt_cv_path_MAGIC_CMD" +if test -n "$MAGIC_CMD"; then + echo "$as_me:3526: result: $MAGIC_CMD" >&5 +echo "${ECHO_T}$MAGIC_CMD" >&6 +else + echo "$as_me:3529: result: no" >&5 +echo "${ECHO_T}no" >&6 +fi + + else + MAGIC_CMD=: + fi +fi + + fi + ;; +esac + +if test -n "$ac_tool_prefix"; then + # Extract the first word of "${ac_tool_prefix}ranlib", so it can be a program name with args. +set dummy ${ac_tool_prefix}ranlib; ac_word=$2 +echo "$as_me:3545: checking for $ac_word" >&5 +echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 +if test "${ac_cv_prog_RANLIB+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + if test -n "$RANLIB"; then + ac_cv_prog_RANLIB="$RANLIB" # Let the user override the test. +else + ac_save_IFS=$IFS; IFS=$ac_path_separator +ac_dummy="$PATH" +for ac_dir in $ac_dummy; do + IFS=$ac_save_IFS + test -z "$ac_dir" && ac_dir=. + $as_executable_p "$ac_dir/$ac_word" || continue +ac_cv_prog_RANLIB="${ac_tool_prefix}ranlib" +echo "$as_me:3560: found $ac_dir/$ac_word" >&5 +break +done + +fi +fi +RANLIB=$ac_cv_prog_RANLIB +if test -n "$RANLIB"; then + echo "$as_me:3568: result: $RANLIB" >&5 +echo "${ECHO_T}$RANLIB" >&6 +else + echo "$as_me:3571: result: no" >&5 +echo "${ECHO_T}no" >&6 +fi + +fi +if test -z "$ac_cv_prog_RANLIB"; then + ac_ct_RANLIB=$RANLIB + # Extract the first word of "ranlib", so it can be a program name with args. +set dummy ranlib; ac_word=$2 +echo "$as_me:3580: checking for $ac_word" >&5 +echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 +if test "${ac_cv_prog_ac_ct_RANLIB+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + if test -n "$ac_ct_RANLIB"; then + ac_cv_prog_ac_ct_RANLIB="$ac_ct_RANLIB" # Let the user override the test. +else + ac_save_IFS=$IFS; IFS=$ac_path_separator +ac_dummy="$PATH" +for ac_dir in $ac_dummy; do + IFS=$ac_save_IFS + test -z "$ac_dir" && ac_dir=. + $as_executable_p "$ac_dir/$ac_word" || continue +ac_cv_prog_ac_ct_RANLIB="ranlib" +echo "$as_me:3595: found $ac_dir/$ac_word" >&5 +break +done + + test -z "$ac_cv_prog_ac_ct_RANLIB" && ac_cv_prog_ac_ct_RANLIB=":" +fi +fi +ac_ct_RANLIB=$ac_cv_prog_ac_ct_RANLIB +if test -n "$ac_ct_RANLIB"; then + echo "$as_me:3604: result: $ac_ct_RANLIB" >&5 +echo "${ECHO_T}$ac_ct_RANLIB" >&6 +else + echo "$as_me:3607: result: no" >&5 +echo "${ECHO_T}no" >&6 +fi + + RANLIB=$ac_ct_RANLIB +else + RANLIB="$ac_cv_prog_RANLIB" +fi + +if test -n "$ac_tool_prefix"; then + # Extract the first word of "${ac_tool_prefix}strip", so it can be a program name with args. +set dummy ${ac_tool_prefix}strip; ac_word=$2 +echo "$as_me:3619: checking for $ac_word" >&5 +echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 +if test "${ac_cv_prog_STRIP+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + if test -n "$STRIP"; then + ac_cv_prog_STRIP="$STRIP" # Let the user override the test. +else + ac_save_IFS=$IFS; IFS=$ac_path_separator +ac_dummy="$PATH" +for ac_dir in $ac_dummy; do + IFS=$ac_save_IFS + test -z "$ac_dir" && ac_dir=. + $as_executable_p "$ac_dir/$ac_word" || continue +ac_cv_prog_STRIP="${ac_tool_prefix}strip" +echo "$as_me:3634: found $ac_dir/$ac_word" >&5 +break +done + +fi +fi +STRIP=$ac_cv_prog_STRIP +if test -n "$STRIP"; then + echo "$as_me:3642: result: $STRIP" >&5 +echo "${ECHO_T}$STRIP" >&6 +else + echo "$as_me:3645: result: no" >&5 +echo "${ECHO_T}no" >&6 +fi + +fi +if test -z "$ac_cv_prog_STRIP"; then + ac_ct_STRIP=$STRIP + # Extract the first word of "strip", so it can be a program name with args. +set dummy strip; ac_word=$2 +echo "$as_me:3654: checking for $ac_word" >&5 +echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 +if test "${ac_cv_prog_ac_ct_STRIP+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + if test -n "$ac_ct_STRIP"; then + ac_cv_prog_ac_ct_STRIP="$ac_ct_STRIP" # Let the user override the test. +else + ac_save_IFS=$IFS; IFS=$ac_path_separator +ac_dummy="$PATH" +for ac_dir in $ac_dummy; do + IFS=$ac_save_IFS + test -z "$ac_dir" && ac_dir=. + $as_executable_p "$ac_dir/$ac_word" || continue +ac_cv_prog_ac_ct_STRIP="strip" +echo "$as_me:3669: found $ac_dir/$ac_word" >&5 +break +done + + test -z "$ac_cv_prog_ac_ct_STRIP" && ac_cv_prog_ac_ct_STRIP=":" +fi +fi +ac_ct_STRIP=$ac_cv_prog_ac_ct_STRIP +if test -n "$ac_ct_STRIP"; then + echo "$as_me:3678: result: $ac_ct_STRIP" >&5 +echo "${ECHO_T}$ac_ct_STRIP" >&6 +else + echo "$as_me:3681: result: no" >&5 +echo "${ECHO_T}no" >&6 +fi + + STRIP=$ac_ct_STRIP +else + STRIP="$ac_cv_prog_STRIP" +fi + +enable_dlopen=no +enable_win32_dll=no + +# Check whether --enable-libtool-lock or --disable-libtool-lock was given. +if test "${enable_libtool_lock+set}" = set; then + enableval="$enable_libtool_lock" + +fi; +test "x$enable_libtool_lock" != xno && enable_libtool_lock=yes + +# Some flags need to be propagated to the compiler or linker for good +# libtool support. +case $host in +*-*-irix6*) + # Find out which ABI we are using. + echo '#line 3705 "configure"' > conftest.$ac_ext + if { (eval echo "$as_me:3706: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>&5 + ac_status=$? + echo "$as_me:3709: \$? = $ac_status" >&5 + (exit $ac_status); }; then + case `/usr/bin/file conftest.$ac_objext` in + *32-bit*) + LD="${LD-ld} -32" + ;; + *N32*) + LD="${LD-ld} -n32" + ;; + *64-bit*) + LD="${LD-ld} -64" + ;; + esac + fi + rm -rf conftest* + ;; + +*-*-sco3.2v5*) + # On SCO OpenServer 5, we need -belf to get full-featured binaries. + SAVE_CFLAGS="$CFLAGS" + CFLAGS="$CFLAGS -belf" + echo "$as_me:3730: checking whether the C compiler needs -belf" >&5 +echo $ECHO_N "checking whether the C compiler needs -belf... $ECHO_C" >&6 +if test "${lt_cv_cc_needs_belf+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + + ac_ext=c +ac_cpp='$CPP $CPPFLAGS' +ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' +ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' +ac_compiler_gnu=$ac_cv_c_compiler_gnu + + cat >conftest.$ac_ext <<_ACEOF +#line 3743 "configure" +#include "confdefs.h" + +int +main () +{ + + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext conftest$ac_exeext +if { (eval echo "$as_me:3755: \"$ac_link\"") >&5 + (eval $ac_link) 2>&5 + ac_status=$? + echo "$as_me:3758: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -s conftest$ac_exeext' + { (eval echo "$as_me:3761: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:3764: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + lt_cv_cc_needs_belf=yes +else + echo "$as_me: failed program was:" >&5 +cat conftest.$ac_ext >&5 +lt_cv_cc_needs_belf=no +fi +rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext + ac_ext=c +ac_cpp='$CPP $CPPFLAGS' +ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' +ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' +ac_compiler_gnu=$ac_cv_c_compiler_gnu + +fi +echo "$as_me:3780: result: $lt_cv_cc_needs_belf" >&5 +echo "${ECHO_T}$lt_cv_cc_needs_belf" >&6 + if test x"$lt_cv_cc_needs_belf" != x"yes"; then + # this is probably gcc 2.8.0, egcs 1.0 or newer; no need for -belf + CFLAGS="$SAVE_CFLAGS" + fi + ;; + +esac + +# Sed substitution that helps us do robust quoting. It backslashifies +# metacharacters that are still active within double-quoted strings. +Xsed='sed -e s/^X//' +sed_quote_subst='s/\([\\"\\`$\\\\]\)/\\\1/g' + +# Same as above, but do not quote variable references. +double_quote_subst='s/\([\\"\\`\\\\]\)/\\\1/g' + +# Sed substitution to delay expansion of an escaped shell variable in a +# double_quote_subst'ed string. +delay_variable_subst='s/\\\\\\\\\\\$/\\\\\\$/g' + +# Constants: +rm="rm -f" + +# Global variables: +default_ofile=libtool +can_build_shared=yes + +# All known linkers require a `.a' archive for static linking (except M$VC, +# which needs '.lib'). +libext=a +ltmain="$ac_aux_dir/ltmain.sh" +ofile="$default_ofile" +with_gnu_ld="$lt_cv_prog_gnu_ld" +need_locks="$enable_libtool_lock" + +old_CC="$CC" +old_CFLAGS="$CFLAGS" + +# Set sane defaults for various variables +test -z "$AR" && AR=ar +test -z "$AR_FLAGS" && AR_FLAGS=cru +test -z "$AS" && AS=as +test -z "$CC" && CC=cc +test -z "$DLLTOOL" && DLLTOOL=dlltool +test -z "$LD" && LD=ld +test -z "$LN_S" && LN_S="ln -s" +test -z "$MAGIC_CMD" && MAGIC_CMD=file +test -z "$NM" && NM=nm +test -z "$OBJDUMP" && OBJDUMP=objdump +test -z "$RANLIB" && RANLIB=: +test -z "$STRIP" && STRIP=: +test -z "$ac_objext" && ac_objext=o + +if test x"$host" != x"$build"; then + ac_tool_prefix=${host_alias}- +else + ac_tool_prefix= +fi + +# Transform linux* to *-*-linux-gnu*, to support old configure scripts. +case $host_os in +linux-gnu*) ;; +linux*) host=`echo $host | sed 's/^\(.*-.*-linux\)\(.*\)$/\1-gnu\2/'` +esac + +case $host_os in +aix3*) + # AIX sometimes has problems with the GCC collect2 program. For some + # reason, if we set the COLLECT_NAMES environment variable, the problems + # vanish in a puff of smoke. + if test "X${COLLECT_NAMES+set}" != Xset; then + COLLECT_NAMES= + export COLLECT_NAMES + fi + ;; +esac + +# Determine commands to create old-style static archives. +old_archive_cmds='$AR $AR_FLAGS $oldlib$oldobjs$old_deplibs' +old_postinstall_cmds='chmod 644 $oldlib' +old_postuninstall_cmds= + +if test -n "$RANLIB"; then + old_archive_cmds="$old_archive_cmds~\$RANLIB \$oldlib" + old_postinstall_cmds="\$RANLIB \$oldlib~$old_postinstall_cmds" +fi + +# Allow CC to be a program name with arguments. +set dummy $CC +compiler="$2" + +## FIXME: this should be a separate macro +## +echo "$as_me:3875: checking for objdir" >&5 +echo $ECHO_N "checking for objdir... $ECHO_C" >&6 +rm -f .libs 2>/dev/null +mkdir .libs 2>/dev/null +if test -d .libs; then + objdir=.libs +else + # MS-DOS does not allow filenames that begin with a dot. + objdir=_libs +fi +rmdir .libs 2>/dev/null +echo "$as_me:3886: result: $objdir" >&5 +echo "${ECHO_T}$objdir" >&6 +## +## END FIXME + +## FIXME: this should be a separate macro +## + +# Check whether --with-pic or --without-pic was given. +if test "${with_pic+set}" = set; then + withval="$with_pic" + pic_mode="$withval" +else + pic_mode=default +fi; +test -z "$pic_mode" && pic_mode=default + +# We assume here that the value for lt_cv_prog_cc_pic will not be cached +# in isolation, and that seeing it set (from the cache) indicates that +# the associated values are set (in the cache) correctly too. +echo "$as_me:3906: checking for $compiler option to produce PIC" >&5 +echo $ECHO_N "checking for $compiler option to produce PIC... $ECHO_C" >&6 +if test "${lt_cv_prog_cc_pic+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + lt_cv_prog_cc_pic= + lt_cv_prog_cc_shlib= + lt_cv_prog_cc_wl= + lt_cv_prog_cc_static= + lt_cv_prog_cc_no_builtin= + lt_cv_prog_cc_can_build_shared=$can_build_shared + + if test "$GCC" = yes; then + lt_cv_prog_cc_wl='-Wl,' + lt_cv_prog_cc_static='-static' + + case $host_os in + aix*) + # Below there is a dirty hack to force normal static linking with -ldl + # The problem is because libdl dynamically linked with both libc and + # libC (AIX C++ library), which obviously doesn't included in libraries + # list by gcc. This cause undefined symbols with -static flags. + # This hack allows C programs to be linked with "-static -ldl", but + # we not sure about C++ programs. + lt_cv_prog_cc_static="$lt_cv_prog_cc_static ${lt_cv_prog_cc_wl}-lC" + ;; + amigaos*) + # FIXME: we need at least 68020 code to build shared libraries, but + # adding the `-m68020' flag to GCC prevents building anything better, + # like `-m68040'. + lt_cv_prog_cc_pic='-m68020 -resident32 -malways-restore-a4' + ;; + beos* | irix5* | irix6* | osf3* | osf4* | osf5*) + # PIC is the default for these OSes. + ;; + darwin* | rhapsody*) + # PIC is the default on this platform + # Common symbols not allowed in MH_DYLIB files + lt_cv_prog_cc_pic='-fno-common' + ;; + cygwin* | mingw* | pw32* | os2*) + # This hack is so that the source file can tell whether it is being + # built for inclusion in a dll (and should export symbols for example). + lt_cv_prog_cc_pic='-DDLL_EXPORT' + ;; + sysv4*MP*) + if test -d /usr/nec; then + lt_cv_prog_cc_pic=-Kconform_pic + fi + ;; + *) + lt_cv_prog_cc_pic='-fPIC' + ;; + esac + else + # PORTME Check for PIC flags for the system compiler. + case $host_os in + aix3* | aix4* | aix5*) + # All AIX code is PIC. + if test "$host_cpu" = ia64; then + # AIX 5 now supports IA64 processor + lt_cv_prog_cc_static='-Bstatic' + lt_cv_prog_cc_wl='-Wl,' + else + lt_cv_prog_cc_static='-bnso -bI:/lib/syscalls.exp' + fi + ;; + + hpux9* | hpux10* | hpux11*) + # Is there a better lt_cv_prog_cc_static that works with the bundled CC? + lt_cv_prog_cc_wl='-Wl,' + lt_cv_prog_cc_static="${lt_cv_prog_cc_wl}-a ${lt_cv_prog_cc_wl}archive" + lt_cv_prog_cc_pic='+Z' + ;; + + irix5* | irix6*) + lt_cv_prog_cc_wl='-Wl,' + lt_cv_prog_cc_static='-non_shared' + # PIC (with -KPIC) is the default. + ;; + + cygwin* | mingw* | pw32* | os2*) + # This hack is so that the source file can tell whether it is being + # built for inclusion in a dll (and should export symbols for example). + lt_cv_prog_cc_pic='-DDLL_EXPORT' + ;; + + newsos6) + lt_cv_prog_cc_pic='-KPIC' + lt_cv_prog_cc_static='-Bstatic' + ;; + + osf3* | osf4* | osf5*) + # All OSF/1 code is PIC. + lt_cv_prog_cc_wl='-Wl,' + lt_cv_prog_cc_static='-non_shared' + ;; + + sco3.2v5*) + lt_cv_prog_cc_pic='-Kpic' + lt_cv_prog_cc_static='-dn' + lt_cv_prog_cc_shlib='-belf' + ;; + + solaris*) + lt_cv_prog_cc_pic='-KPIC' + lt_cv_prog_cc_static='-Bstatic' + lt_cv_prog_cc_wl='-Wl,' + ;; + + sunos4*) + lt_cv_prog_cc_pic='-PIC' + lt_cv_prog_cc_static='-Bstatic' + lt_cv_prog_cc_wl='-Qoption ld ' + ;; + + sysv4 | sysv4.2uw2* | sysv4.3* | sysv5*) + lt_cv_prog_cc_pic='-KPIC' + lt_cv_prog_cc_static='-Bstatic' + if test "x$host_vendor" = xsni; then + lt_cv_prog_cc_wl='-LD' + else + lt_cv_prog_cc_wl='-Wl,' + fi + ;; + + uts4*) + lt_cv_prog_cc_pic='-pic' + lt_cv_prog_cc_static='-Bstatic' + ;; + + sysv4*MP*) + if test -d /usr/nec ;then + lt_cv_prog_cc_pic='-Kconform_pic' + lt_cv_prog_cc_static='-Bstatic' + fi + ;; + + *) + lt_cv_prog_cc_can_build_shared=no + ;; + esac + fi + +fi + +if test -z "$lt_cv_prog_cc_pic"; then + echo "$as_me:4053: result: none" >&5 +echo "${ECHO_T}none" >&6 +else + echo "$as_me:4056: result: $lt_cv_prog_cc_pic" >&5 +echo "${ECHO_T}$lt_cv_prog_cc_pic" >&6 + + # Check to make sure the pic_flag actually works. + echo "$as_me:4060: checking if $compiler PIC flag $lt_cv_prog_cc_pic works" >&5 +echo $ECHO_N "checking if $compiler PIC flag $lt_cv_prog_cc_pic works... $ECHO_C" >&6 + if test "${lt_cv_prog_cc_pic_works+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + save_CFLAGS="$CFLAGS" + CFLAGS="$CFLAGS $lt_cv_prog_cc_pic -DPIC" + cat >conftest.$ac_ext <<_ACEOF +#line 4068 "configure" +#include "confdefs.h" + +int +main () +{ + + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:4080: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>&5 + ac_status=$? + echo "$as_me:4083: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:4086: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:4089: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + case $host_os in + hpux9* | hpux10* | hpux11*) + # On HP-UX, both CC and GCC only warn that PIC is supported... then + # they create non-PIC objects. So, if there were any warnings, we + # assume that PIC is not supported. + if test -s conftest.err; then + lt_cv_prog_cc_pic_works=no + else + lt_cv_prog_cc_pic_works=yes + fi + ;; + *) + lt_cv_prog_cc_pic_works=yes + ;; + esac + +else + echo "$as_me: failed program was:" >&5 +cat conftest.$ac_ext >&5 + lt_cv_prog_cc_pic_works=no + +fi +rm -f conftest.$ac_objext conftest.$ac_ext + CFLAGS="$save_CFLAGS" + +fi + + if test "X$lt_cv_prog_cc_pic_works" = Xno; then + lt_cv_prog_cc_pic= + lt_cv_prog_cc_can_build_shared=no + else + lt_cv_prog_cc_pic=" $lt_cv_prog_cc_pic" + fi + + echo "$as_me:4125: result: $lt_cv_prog_cc_pic_works" >&5 +echo "${ECHO_T}$lt_cv_prog_cc_pic_works" >&6 +fi +## +## END FIXME + +# Check for any special shared library compilation flags. +if test -n "$lt_cv_prog_cc_shlib"; then + { echo "$as_me:4133: WARNING: \`$CC' requires \`$lt_cv_prog_cc_shlib' to build shared libraries" >&5 +echo "$as_me: WARNING: \`$CC' requires \`$lt_cv_prog_cc_shlib' to build shared libraries" >&2;} + if echo "$old_CC $old_CFLAGS " | egrep -e "[ ]$lt_cv_prog_cc_shlib[ ]" >/dev/null; then : + else + { echo "$as_me:4137: WARNING: add \`$lt_cv_prog_cc_shlib' to the CC or CFLAGS env variable and reconfigure" >&5 +echo "$as_me: WARNING: add \`$lt_cv_prog_cc_shlib' to the CC or CFLAGS env variable and reconfigure" >&2;} + lt_cv_prog_cc_can_build_shared=no + fi +fi + +## FIXME: this should be a separate macro +## +echo "$as_me:4145: checking if $compiler static flag $lt_cv_prog_cc_static works" >&5 +echo $ECHO_N "checking if $compiler static flag $lt_cv_prog_cc_static works... $ECHO_C" >&6 +if test "${lt_cv_prog_cc_static_works+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + lt_cv_prog_cc_static_works=no + save_LDFLAGS="$LDFLAGS" + LDFLAGS="$LDFLAGS $lt_cv_prog_cc_static" + cat >conftest.$ac_ext <<_ACEOF +#line 4154 "configure" +#include "confdefs.h" + +int +main () +{ + + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext conftest$ac_exeext +if { (eval echo "$as_me:4166: \"$ac_link\"") >&5 + (eval $ac_link) 2>&5 + ac_status=$? + echo "$as_me:4169: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -s conftest$ac_exeext' + { (eval echo "$as_me:4172: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:4175: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + lt_cv_prog_cc_static_works=yes +else + echo "$as_me: failed program was:" >&5 +cat conftest.$ac_ext >&5 +fi +rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext + LDFLAGS="$save_LDFLAGS" + +fi + +# Belt *and* braces to stop my trousers falling down: +test "X$lt_cv_prog_cc_static_works" = Xno && lt_cv_prog_cc_static= +echo "$as_me:4189: result: $lt_cv_prog_cc_static_works" >&5 +echo "${ECHO_T}$lt_cv_prog_cc_static_works" >&6 + +pic_flag="$lt_cv_prog_cc_pic" +special_shlib_compile_flags="$lt_cv_prog_cc_shlib" +wl="$lt_cv_prog_cc_wl" +link_static_flag="$lt_cv_prog_cc_static" +no_builtin_flag="$lt_cv_prog_cc_no_builtin" +can_build_shared="$lt_cv_prog_cc_can_build_shared" +## +## END FIXME + +## FIXME: this should be a separate macro +## +# Check to see if options -o and -c are simultaneously supported by compiler +echo "$as_me:4204: checking if $compiler supports -c -o file.$ac_objext" >&5 +echo $ECHO_N "checking if $compiler supports -c -o file.$ac_objext... $ECHO_C" >&6 +if test "${lt_cv_compiler_c_o+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + +$rm -r conftest 2>/dev/null +mkdir conftest +cd conftest +echo "int some_variable = 0;" > conftest.$ac_ext +mkdir out +# According to Tom Tromey, Ian Lance Taylor reported there are C compilers +# that will create temporary files in the current directory regardless of +# the output directory. Thus, making CWD read-only will cause this test +# to fail, enabling locking or at least warning the user not to do parallel +# builds. +chmod -w . +save_CFLAGS="$CFLAGS" +CFLAGS="$CFLAGS -o out/conftest2.$ac_objext" +compiler_c_o=no +if { (eval echo configure:4224: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>out/conftest.err; } && test -s out/conftest2.$ac_objext; then + # The compiler can only warn and ignore the option if not recognized + # So say no if there are warnings + if test -s out/conftest.err; then + lt_cv_compiler_c_o=no + else + lt_cv_compiler_c_o=yes + fi +else + # Append any errors to the config.log. + cat out/conftest.err 1>&5 + lt_cv_compiler_c_o=no +fi +CFLAGS="$save_CFLAGS" +chmod u+w . +$rm conftest* out/* +rmdir out +cd .. +rmdir conftest +$rm -r conftest 2>/dev/null + +fi + +compiler_c_o=$lt_cv_compiler_c_o +echo "$as_me:4248: result: $compiler_c_o" >&5 +echo "${ECHO_T}$compiler_c_o" >&6 + +if test x"$compiler_c_o" = x"yes"; then + # Check to see if we can write to a .lo + echo "$as_me:4253: checking if $compiler supports -c -o file.lo" >&5 +echo $ECHO_N "checking if $compiler supports -c -o file.lo... $ECHO_C" >&6 + if test "${lt_cv_compiler_o_lo+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + + lt_cv_compiler_o_lo=no + save_CFLAGS="$CFLAGS" + CFLAGS="$CFLAGS -c -o conftest.lo" + cat >conftest.$ac_ext <<_ACEOF +#line 4263 "configure" +#include "confdefs.h" + +int +main () +{ +int some_variable = 0; + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:4275: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>&5 + ac_status=$? + echo "$as_me:4278: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:4281: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:4284: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + # The compiler can only warn and ignore the option if not recognized + # So say no if there are warnings + if test -s conftest.err; then + lt_cv_compiler_o_lo=no + else + lt_cv_compiler_o_lo=yes + fi + +else + echo "$as_me: failed program was:" >&5 +cat conftest.$ac_ext >&5 +fi +rm -f conftest.$ac_objext conftest.$ac_ext + CFLAGS="$save_CFLAGS" + +fi + + compiler_o_lo=$lt_cv_compiler_o_lo + echo "$as_me:4304: result: $compiler_c_lo" >&5 +echo "${ECHO_T}$compiler_c_lo" >&6 +else + compiler_o_lo=no +fi +## +## END FIXME + +## FIXME: this should be a separate macro +## +# Check to see if we can do hard links to lock some files if needed +hard_links="nottested" +if test "$compiler_c_o" = no && test "$need_locks" != no; then + # do not overwrite the value of need_locks provided by the user + echo "$as_me:4318: checking if we can lock with hard links" >&5 +echo $ECHO_N "checking if we can lock with hard links... $ECHO_C" >&6 + hard_links=yes + $rm conftest* + ln conftest.a conftest.b 2>/dev/null && hard_links=no + touch conftest.a + ln conftest.a conftest.b 2>&5 || hard_links=no + ln conftest.a conftest.b 2>/dev/null && hard_links=no + echo "$as_me:4326: result: $hard_links" >&5 +echo "${ECHO_T}$hard_links" >&6 + if test "$hard_links" = no; then + { echo "$as_me:4329: WARNING: \`$CC' does not support \`-c -o', so \`make -j' may be unsafe" >&5 +echo "$as_me: WARNING: \`$CC' does not support \`-c -o', so \`make -j' may be unsafe" >&2;} + need_locks=warn + fi +else + need_locks=no +fi +## +## END FIXME + +## FIXME: this should be a separate macro +## +if test "$GCC" = yes; then + # Check to see if options -fno-rtti -fno-exceptions are supported by compiler + echo "$as_me:4343: checking if $compiler supports -fno-rtti -fno-exceptions" >&5 +echo $ECHO_N "checking if $compiler supports -fno-rtti -fno-exceptions... $ECHO_C" >&6 + echo "int some_variable = 0;" > conftest.$ac_ext + save_CFLAGS="$CFLAGS" + CFLAGS="$CFLAGS -fno-rtti -fno-exceptions -c conftest.$ac_ext" + compiler_rtti_exceptions=no + cat >conftest.$ac_ext <<_ACEOF +#line 4350 "configure" +#include "confdefs.h" + +int +main () +{ +int some_variable = 0; + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:4362: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>&5 + ac_status=$? + echo "$as_me:4365: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:4368: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:4371: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + # The compiler can only warn and ignore the option if not recognized + # So say no if there are warnings + if test -s conftest.err; then + compiler_rtti_exceptions=no + else + compiler_rtti_exceptions=yes + fi + +else + echo "$as_me: failed program was:" >&5 +cat conftest.$ac_ext >&5 +fi +rm -f conftest.$ac_objext conftest.$ac_ext + CFLAGS="$save_CFLAGS" + echo "$as_me:4387: result: $compiler_rtti_exceptions" >&5 +echo "${ECHO_T}$compiler_rtti_exceptions" >&6 + + if test "$compiler_rtti_exceptions" = "yes"; then + no_builtin_flag=' -fno-builtin -fno-rtti -fno-exceptions' + else + no_builtin_flag=' -fno-builtin' + fi +fi +## +## END FIXME + +## FIXME: this should be a separate macro +## +# See if the linker supports building shared libraries. +echo "$as_me:4402: checking whether the linker ($LD) supports shared libraries" >&5 +echo $ECHO_N "checking whether the linker ($LD) supports shared libraries... $ECHO_C" >&6 + +allow_undefined_flag= +no_undefined_flag= +need_lib_prefix=unknown +need_version=unknown +# when you set need_version to no, make sure it does not cause -set_version +# flags to be left without arguments +archive_cmds= +archive_expsym_cmds= +old_archive_from_new_cmds= +old_archive_from_expsyms_cmds= +export_dynamic_flag_spec= +whole_archive_flag_spec= +thread_safe_flag_spec= +hardcode_into_libs=no +hardcode_libdir_flag_spec= +hardcode_libdir_separator= +hardcode_direct=no +hardcode_minus_L=no +hardcode_shlibpath_var=unsupported +runpath_var= +link_all_deplibs=unknown +always_export_symbols=no +export_symbols_cmds='$NM $libobjs $convenience | $global_symbol_pipe | sed '\''s/.* //'\'' | sort | uniq > $export_symbols' +# include_expsyms should be a list of space-separated symbols to be *always* +# included in the symbol list +include_expsyms= +# exclude_expsyms can be an egrep regular expression of symbols to exclude +# it will be wrapped by ` (' and `)$', so one must not match beginning or +# end of line. Example: `a|bc|.*d.*' will exclude the symbols `a' and `bc', +# as well as any symbol that contains `d'. +exclude_expsyms="_GLOBAL_OFFSET_TABLE_" +# Although _GLOBAL_OFFSET_TABLE_ is a valid symbol C name, most a.out +# platforms (ab)use it in PIC code, but their linkers get confused if +# the symbol is explicitly referenced. Since portable code cannot +# rely on this symbol name, it's probably fine to never include it in +# preloaded symbol tables. +extract_expsyms_cmds= + +case $host_os in +cygwin* | mingw* | pw32* ) + # FIXME: the MSVC++ port hasn't been tested in a loooong time + # When not using gcc, we currently assume that we are using + # Microsoft Visual C++. + if test "$GCC" != yes; then + with_gnu_ld=no + fi + ;; + +esac + +ld_shlibs=yes +if test "$with_gnu_ld" = yes; then + # If archive_cmds runs LD, not CC, wlarc should be empty + wlarc='${wl}' + + # See if GNU ld supports shared libraries. + case $host_os in + aix3* | aix4* | aix5*) + # On AIX, the GNU linker is very broken + # Note:Check GNU linker on AIX 5-IA64 when/if it becomes available. + ld_shlibs=no + cat <&2 + +*** Warning: the GNU linker, at least up to release 2.9.1, is reported +*** to be unable to reliably create shared libraries on AIX. +*** Therefore, libtool is disabling shared libraries support. If you +*** really care for shared libraries, you may want to modify your PATH +*** so that a non-GNU linker is found, and then restart. + +EOF + ;; + + amigaos*) + archive_cmds='$rm $output_objdir/a2ixlibrary.data~$echo "#define NAME $libname" > $output_objdir/a2ixlibrary.data~$echo "#define LIBRARY_ID 1" >> $output_objdir/a2ixlibrary.data~$echo "#define VERSION $major" >> $output_objdir/a2ixlibrary.data~$echo "#define REVISION $revision" >> $output_objdir/a2ixlibrary.data~$AR $AR_FLAGS $lib $libobjs~$RANLIB $lib~(cd $output_objdir && a2ixlibrary -32)' + hardcode_libdir_flag_spec='-L$libdir' + hardcode_minus_L=yes + + # Samuel A. Falvo II reports + # that the semantics of dynamic libraries on AmigaOS, at least up + # to version 4, is to share data among multiple programs linked + # with the same dynamic library. Since this doesn't match the + # behavior of shared libraries on other platforms, we can use + # them. + ld_shlibs=no + ;; + + beos*) + if $LD --help 2>&1 | egrep ': supported targets:.* elf' > /dev/null; then + allow_undefined_flag=unsupported + # Joseph Beckenbach says some releases of gcc + # support --undefined. This deserves some investigation. FIXME + archive_cmds='$CC -nostart $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' + else + ld_shlibs=no + fi + ;; + + cygwin* | mingw* | pw32*) + # hardcode_libdir_flag_spec is actually meaningless, as there is + # no search path for DLLs. + hardcode_libdir_flag_spec='-L$libdir' + allow_undefined_flag=unsupported + always_export_symbols=yes + + extract_expsyms_cmds='test -f $output_objdir/impgen.c || \ + sed -e "/^# \/\* impgen\.c starts here \*\//,/^# \/\* impgen.c ends here \*\// { s/^# //;s/^# *$//; p; }" -e d < $''0 > $output_objdir/impgen.c~ + test -f $output_objdir/impgen.exe || (cd $output_objdir && \ + if test "x$HOST_CC" != "x" ; then $HOST_CC -o impgen impgen.c ; \ + else $CC -o impgen impgen.c ; fi)~ + $output_objdir/impgen $dir/$soroot > $output_objdir/$soname-def' + + old_archive_from_expsyms_cmds='$DLLTOOL --as=$AS --dllname $soname --def $output_objdir/$soname-def --output-lib $output_objdir/$newlib' + + # cygwin and mingw dlls have different entry points and sets of symbols + # to exclude. + # FIXME: what about values for MSVC? + dll_entry=__cygwin_dll_entry@12 + dll_exclude_symbols=DllMain@12,_cygwin_dll_entry@12,_cygwin_noncygwin_dll_entry@12~ + case $host_os in + mingw*) + # mingw values + dll_entry=_DllMainCRTStartup@12 + dll_exclude_symbols=DllMain@12,DllMainCRTStartup@12,DllEntryPoint@12~ + ;; + esac + + # mingw and cygwin differ, and it's simplest to just exclude the union + # of the two symbol sets. + dll_exclude_symbols=DllMain@12,_cygwin_dll_entry@12,_cygwin_noncygwin_dll_entry@12,DllMainCRTStartup@12,DllEntryPoint@12 + + # recent cygwin and mingw systems supply a stub DllMain which the user + # can override, but on older systems we have to supply one (in ltdll.c) + if test "x$lt_cv_need_dllmain" = "xyes"; then + ltdll_obj='$output_objdir/$soname-ltdll.'"$ac_objext " + ltdll_cmds='test -f $output_objdir/$soname-ltdll.c || sed -e "/^# \/\* ltdll\.c starts here \*\//,/^# \/\* ltdll.c ends here \*\// { s/^# //; p; }" -e d < [$]0 > $output_objdir/$soname-ltdll.c~ + test -f $output_objdir/$soname-ltdll.$ac_objext || (cd $output_objdir && $CC -c $soname-ltdll.c)~' + else + ltdll_obj= + ltdll_cmds= + fi + + # Extract the symbol export list from an `--export-all' def file, + # then regenerate the def file from the symbol export list, so that + # the compiled dll only exports the symbol export list. + # Be careful not to strip the DATA tag left be newer dlltools. + export_symbols_cmds="$ltdll_cmds"' + $DLLTOOL --export-all --exclude-symbols '$dll_exclude_symbols' --output-def $output_objdir/$soname-def '$ltdll_obj'$libobjs $convenience~ + sed -e "1,/EXPORTS/d" -e "s/ @ [0-9]*//" -e "s/ *;.*$//" < $output_objdir/$soname-def > $export_symbols' + + # If the export-symbols file already is a .def file (1st line + # is EXPORTS), use it as is. + # If DATA tags from a recent dlltool are present, honour them! + archive_expsym_cmds='if test "x`head -1 $export_symbols`" = xEXPORTS; then + cp $export_symbols $output_objdir/$soname-def; + else + echo EXPORTS > $output_objdir/$soname-def; + _lt_hint=1; + cat $export_symbols | while read symbol; do + set dummy \$symbol; + case \$# in + 2) echo " \$2 @ \$_lt_hint ; " >> $output_objdir/$soname-def;; + *) echo " \$2 @ \$_lt_hint \$3 ; " >> $output_objdir/$soname-def;; + esac; + _lt_hint=`expr 1 + \$_lt_hint`; + done; + fi~ + '"$ltdll_cmds"' + $CC -Wl,--base-file,$output_objdir/$soname-base '$lt_cv_cc_dll_switch' -Wl,-e,'$dll_entry' -o $output_objdir/$soname '$ltdll_obj'$libobjs $deplibs $compiler_flags~ + $DLLTOOL --as=$AS --dllname $soname --exclude-symbols '$dll_exclude_symbols' --def $output_objdir/$soname-def --base-file $output_objdir/$soname-base --output-exp $output_objdir/$soname-exp~ + $CC -Wl,--base-file,$output_objdir/$soname-base $output_objdir/$soname-exp '$lt_cv_cc_dll_switch' -Wl,-e,'$dll_entry' -o $output_objdir/$soname '$ltdll_obj'$libobjs $deplibs $compiler_flags~ + $DLLTOOL --as=$AS --dllname $soname --exclude-symbols '$dll_exclude_symbols' --def $output_objdir/$soname-def --base-file $output_objdir/$soname-base --output-exp $output_objdir/$soname-exp --output-lib $output_objdir/$libname.dll.a~ + $CC $output_objdir/$soname-exp '$lt_cv_cc_dll_switch' -Wl,-e,'$dll_entry' -o $output_objdir/$soname '$ltdll_obj'$libobjs $deplibs $compiler_flags' + ;; + + netbsd*) + if echo __ELF__ | $CC -E - | grep __ELF__ >/dev/null; then + archive_cmds='$LD -Bshareable $libobjs $deplibs $linker_flags -o $lib' + wlarc= + else + archive_cmds='$CC -shared -nodefaultlibs $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' + archive_expsym_cmds='$CC -shared -nodefaultlibs $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib' + fi + ;; + + solaris* | sysv5*) + if $LD -v 2>&1 | egrep 'BFD 2\.8' > /dev/null; then + ld_shlibs=no + cat <&2 + +*** Warning: The releases 2.8.* of the GNU linker cannot reliably +*** create shared libraries on Solaris systems. Therefore, libtool +*** is disabling shared libraries support. We urge you to upgrade GNU +*** binutils to release 2.9.1 or newer. Another option is to modify +*** your PATH or compiler configuration so that the native linker is +*** used, and then restart. + +EOF + elif $LD --help 2>&1 | egrep ': supported targets:.* elf' > /dev/null; then + archive_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' + archive_expsym_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib' + else + ld_shlibs=no + fi + ;; + + sunos4*) + archive_cmds='$LD -assert pure-text -Bshareable -o $lib $libobjs $deplibs $linker_flags' + wlarc= + hardcode_direct=yes + hardcode_shlibpath_var=no + ;; + + *) + if $LD --help 2>&1 | egrep ': supported targets:.* elf' > /dev/null; then + archive_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' + archive_expsym_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib' + else + ld_shlibs=no + fi + ;; + esac + + if test "$ld_shlibs" = yes; then + runpath_var=LD_RUN_PATH + hardcode_libdir_flag_spec='${wl}--rpath ${wl}$libdir' + export_dynamic_flag_spec='${wl}--export-dynamic' + case $host_os in + cygwin* | mingw* | pw32*) + # dlltool doesn't understand --whole-archive et. al. + whole_archive_flag_spec= + ;; + *) + # ancient GNU ld didn't support --whole-archive et. al. + if $LD --help 2>&1 | egrep 'no-whole-archive' > /dev/null; then + whole_archive_flag_spec="$wlarc"'--whole-archive$convenience '"$wlarc"'--no-whole-archive' + else + whole_archive_flag_spec= + fi + ;; + esac + fi +else + # PORTME fill in a description of your system's linker (not GNU ld) + case $host_os in + aix3*) + allow_undefined_flag=unsupported + always_export_symbols=yes + archive_expsym_cmds='$LD -o $output_objdir/$soname $libobjs $deplibs $linker_flags -bE:$export_symbols -T512 -H512 -bM:SRE~$AR $AR_FLAGS $lib $output_objdir/$soname' + # Note: this linker hardcodes the directories in LIBPATH if there + # are no directories specified by -L. + hardcode_minus_L=yes + if test "$GCC" = yes && test -z "$link_static_flag"; then + # Neither direct hardcoding nor static linking is supported with a + # broken collect2. + hardcode_direct=unsupported + fi + ;; + + aix4* | aix5*) + # When large executables or shared objects are built, AIX ld can + # have problems creating the table of contents. If linking a library + # or program results in "error TOC overflow" add -mminimal-toc to + # CXXFLAGS/CFLAGS for g++/gcc. In the cases where that is not + # enough to fix the problem, add -Wl,-bbigtoc to LDFLAGS. + + archive_cmds='' + hardcode_libdir_separator=':' + if test "$GCC" = yes; then + collect2name=`${CC} -print-prog-name=collect2` + if test -f "$collect2name" && \ + strings "$collect2name" | grep resolve_lib_name >/dev/null + then + # We have reworked collect2 + hardcode_direct=yes + else + # We have old collect2 + hardcode_direct=unsupported + # It fails to find uninstalled libraries when the uninstalled + # path is not listed in the libpath. Setting hardcode_minus_L + # to unsupported forces relinking + hardcode_minus_L=yes + hardcode_libdir_flag_spec='-L$libdir' + hardcode_libdir_separator= + fi + shared_flag='-shared' + else + if test "$host_cpu" = ia64; then + shared_flag='-G' + else + shared_flag='${wl}-bM:SRE' + fi + hardcode_direct=yes + fi + + if test "$host_cpu" = ia64; then + # On IA64, the linker does run time linking by default, so we don't + # have to do anything special. + aix_use_runtimelinking=no + exp_sym_flag='-Bexport' + no_entry_flag="" + else + # Test if we are trying to use run time linking, or normal AIX style linking. + # If -brtl is somewhere in LDFLAGS, we need to do run time linking. + aix_use_runtimelinking=no + for ld_flag in $LDFLAGS; do + if (test $ld_flag = "-brtl" || test $ld_flag = "-Wl,-brtl" ); then + aix_use_runtimelinking=yes + break + fi + done + exp_sym_flag='-bexport' + no_entry_flag='-bnoentry' + fi + # It seems that -bexpall can do strange things, so it is better to + # generate a list of symbols to export. + always_export_symbols=yes + if test "$aix_use_runtimelinking" = yes; then + hardcode_libdir_flag_spec='${wl}-blibpath:$libdir:/usr/lib:/lib' + allow_undefined_flag=' -Wl,-G' + archive_expsym_cmds="\$CC $shared_flag"' -o $output_objdir/$soname $libobjs $deplibs $compiler_flags ${allow_undefined_flag} '"\${wl}$no_entry_flag \${wl}$exp_sym_flag:\$export_symbols" + else + if test "$host_cpu" = ia64; then + hardcode_libdir_flag_spec='${wl}-R $libdir:/usr/lib:/lib' + allow_undefined_flag="-znodefs" + archive_expsym_cmds="\$CC $shared_flag"' -o $output_objdir/$soname ${wl}-h$soname $libobjs $deplibs $compiler_flags ${wl}${allow_undefined_flag} '"\${wl}$no_entry_flag \${wl}$exp_sym_flag:\$export_symbols" + else + hardcode_libdir_flag_spec='${wl}-bnolibpath ${wl}-blibpath:$libdir:/usr/lib:/lib' + # Warning - without using the other run time loading flags, -berok will + # link without error, but may produce a broken library. + allow_undefined_flag='${wl}-berok" + # This is a bit strange, but is similar to how AIX traditionally builds + # it's shared libraries. + archive_expsym_cmds="\$CC $shared_flag"' -o $output_objdir/$soname $libobjs $deplibs $compiler_flags ${allow_undefined_flag} '"\${wl}$no_entry_flag \${wl}$exp_sym_flag:\$export_symbols"' ~$AR -crlo $objdir/$libname$release.a $objdir/$soname' + fi + fi + ;; + + amigaos*) + archive_cmds='$rm $output_objdir/a2ixlibrary.data~$echo "#define NAME $libname" > $output_objdir/a2ixlibrary.data~$echo "#define LIBRARY_ID 1" >> $output_objdir/a2ixlibrary.data~$echo "#define VERSION $major" >> $output_objdir/a2ixlibrary.data~$echo "#define REVISION $revision" >> $output_objdir/a2ixlibrary.data~$AR $AR_FLAGS $lib $libobjs~$RANLIB $lib~(cd $output_objdir && a2ixlibrary -32)' + hardcode_libdir_flag_spec='-L$libdir' + hardcode_minus_L=yes + # see comment about different semantics on the GNU ld section + ld_shlibs=no + ;; + + cygwin* | mingw* | pw32*) + # When not using gcc, we currently assume that we are using + # Microsoft Visual C++. + # hardcode_libdir_flag_spec is actually meaningless, as there is + # no search path for DLLs. + hardcode_libdir_flag_spec=' ' + allow_undefined_flag=unsupported + # Tell ltmain to make .lib files, not .a files. + libext=lib + # FIXME: Setting linknames here is a bad hack. + archive_cmds='$CC -o $lib $libobjs $compiler_flags `echo "$deplibs" | sed -e '\''s/ -lc$//'\''` -link -dll~linknames=' + # The linker will automatically build a .lib file if we build a DLL. + old_archive_from_new_cmds='true' + # FIXME: Should let the user specify the lib program. + old_archive_cmds='lib /OUT:$oldlib$oldobjs$old_deplibs' + fix_srcfile_path='`cygpath -w "$srcfile"`' + ;; + + darwin* | rhapsody*) + allow_undefined_flag='-undefined suppress' + # FIXME: Relying on posixy $() will cause problems for + # cross-compilation, but unfortunately the echo tests do not + # yet detect zsh echo's removal of \ escapes. + archive_cmds='$CC $(test .$module = .yes && echo -bundle || echo -dynamiclib) $allow_undefined_flag -o $lib $libobjs $deplibs$linkopts -install_name $rpath/$soname $(test -n "$verstring" -a x$verstring != x0.0 && echo $verstring)' + # We need to add '_' to the symbols in $export_symbols first + #archive_expsym_cmds="$archive_cmds"' && strip -s $export_symbols' + hardcode_direct=yes + hardcode_shlibpath_var=no + whole_archive_flag_spec='-all_load $convenience' + ;; + + freebsd1*) + ld_shlibs=no + ;; + + # FreeBSD 2.2.[012] allows us to include c++rt0.o to get C++ constructor + # support. Future versions do this automatically, but an explicit c++rt0.o + # does not break anything, and helps significantly (at the cost of a little + # extra space). + freebsd2.2*) + archive_cmds='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags /usr/lib/c++rt0.o' + hardcode_libdir_flag_spec='-R$libdir' + hardcode_direct=yes + hardcode_shlibpath_var=no + ;; + + # Unfortunately, older versions of FreeBSD 2 do not have this feature. + freebsd2*) + archive_cmds='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags' + hardcode_direct=yes + hardcode_minus_L=yes + hardcode_shlibpath_var=no + ;; + + # FreeBSD 3 and greater uses gcc -shared to do shared libraries. + freebsd*) + archive_cmds='$CC -shared -o $lib $libobjs $deplibs $compiler_flags' + hardcode_libdir_flag_spec='-R$libdir' + hardcode_direct=yes + hardcode_shlibpath_var=no + ;; + + hpux9* | hpux10* | hpux11*) + case $host_os in + hpux9*) archive_cmds='$rm $output_objdir/$soname~$LD -b +b $install_libdir -o $output_objdir/$soname $libobjs $deplibs $linker_flags~test $output_objdir/$soname = $lib || mv $output_objdir/$soname $lib' ;; + *) archive_cmds='$LD -b +h $soname +b $install_libdir -o $lib $libobjs $deplibs $linker_flags' ;; + esac + hardcode_libdir_flag_spec='${wl}+b ${wl}$libdir' + hardcode_libdir_separator=: + hardcode_direct=yes + hardcode_minus_L=yes # Not in the search PATH, but as the default + # location of the library. + export_dynamic_flag_spec='${wl}-E' + ;; + + irix5* | irix6*) + if test "$GCC" = yes; then + archive_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && echo ${wl}-set_version ${wl}$verstring` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib' + else + archive_cmds='$LD -shared $libobjs $deplibs $linker_flags -soname $soname `test -n "$verstring" && echo -set_version $verstring` -update_registry ${output_objdir}/so_locations -o $lib' + fi + hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir' + hardcode_libdir_separator=: + link_all_deplibs=yes + ;; + + netbsd*) + if echo __ELF__ | $CC -E - | grep __ELF__ >/dev/null; then + archive_cmds='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags' # a.out + else + archive_cmds='$LD -shared -o $lib $libobjs $deplibs $linker_flags' # ELF + fi + hardcode_libdir_flag_spec='-R$libdir' + hardcode_direct=yes + hardcode_shlibpath_var=no + ;; + + newsos6) + archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linkopts' + hardcode_direct=yes + hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir' + hardcode_libdir_separator=: + hardcode_shlibpath_var=no + ;; + + openbsd*) + archive_cmds='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags' + hardcode_libdir_flag_spec='-R$libdir' + hardcode_direct=yes + hardcode_shlibpath_var=no + ;; + + os2*) + hardcode_libdir_flag_spec='-L$libdir' + hardcode_minus_L=yes + allow_undefined_flag=unsupported + archive_cmds='$echo "LIBRARY $libname INITINSTANCE" > $output_objdir/$libname.def~$echo "DESCRIPTION \"$libname\"" >> $output_objdir/$libname.def~$echo DATA >> $output_objdir/$libname.def~$echo " SINGLE NONSHARED" >> $output_objdir/$libname.def~$echo EXPORTS >> $output_objdir/$libname.def~emxexp $libobjs >> $output_objdir/$libname.def~$CC -Zdll -Zcrtdll -o $lib $libobjs $deplibs $compiler_flags $output_objdir/$libname.def' + old_archive_from_new_cmds='emximp -o $output_objdir/$libname.a $output_objdir/$libname.def' + ;; + + osf3*) + if test "$GCC" = yes; then + allow_undefined_flag=' ${wl}-expect_unresolved ${wl}\*' + archive_cmds='$CC -shared${allow_undefined_flag} $libobjs $deplibs $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && echo ${wl}-set_version ${wl}$verstring` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib' + else + allow_undefined_flag=' -expect_unresolved \*' + archive_cmds='$LD -shared${allow_undefined_flag} $libobjs $deplibs $linker_flags -soname $soname `test -n "$verstring" && echo -set_version $verstring` -update_registry ${output_objdir}/so_locations -o $lib' + fi + hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir' + hardcode_libdir_separator=: + ;; + + osf4* | osf5*) # as osf3* with the addition of -msym flag + if test "$GCC" = yes; then + allow_undefined_flag=' ${wl}-expect_unresolved ${wl}\*' + archive_cmds='$CC -shared${allow_undefined_flag} $libobjs $deplibs $compiler_flags ${wl}-msym ${wl}-soname ${wl}$soname `test -n "$verstring" && echo ${wl}-set_version ${wl}$verstring` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib' + hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir' + else + allow_undefined_flag=' -expect_unresolved \*' + archive_cmds='$LD -shared${allow_undefined_flag} $libobjs $deplibs $linker_flags -msym -soname $soname `test -n "$verstring" && echo -set_version $verstring` -update_registry ${output_objdir}/so_locations -o $lib' + archive_expsym_cmds='for i in `cat $export_symbols`; do printf "-exported_symbol " >> $lib.exp; echo "\$i" >> $lib.exp; done; echo "-hidden">> $lib.exp~ + $LD -shared${allow_undefined_flag} -input $lib.exp $linker_flags $libobjs $deplibs -soname $soname `test -n "$verstring" && echo -set_version $verstring` -update_registry ${objdir}/so_locations -o $lib~$rm $lib.exp' + + #Both c and cxx compiler support -rpath directly + hardcode_libdir_flag_spec='-rpath $libdir' + fi + hardcode_libdir_separator=: + ;; + + sco3.2v5*) + archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' + hardcode_shlibpath_var=no + runpath_var=LD_RUN_PATH + hardcode_runpath_var=yes + ;; + + solaris*) + no_undefined_flag=' -z defs' + # $CC -shared without GNU ld will not create a library from C++ + # object files and a static libstdc++, better avoid it by now + archive_cmds='$LD -G${allow_undefined_flag} -h $soname -o $lib $libobjs $deplibs $linker_flags' + archive_expsym_cmds='$echo "{ global:" > $lib.exp~cat $export_symbols | sed -e "s/\(.*\)/\1;/" >> $lib.exp~$echo "local: *; };" >> $lib.exp~ + $LD -G${allow_undefined_flag} -M $lib.exp -h $soname -o $lib $libobjs $deplibs $linker_flags~$rm $lib.exp' + hardcode_libdir_flag_spec='-R$libdir' + hardcode_shlibpath_var=no + case $host_os in + solaris2.[0-5] | solaris2.[0-5].*) ;; + *) # Supported since Solaris 2.6 (maybe 2.5.1?) + whole_archive_flag_spec='-z allextract$convenience -z defaultextract' ;; + esac + link_all_deplibs=yes + ;; + + sunos4*) + if test "x$host_vendor" = xsequent; then + # Use $CC to link under sequent, because it throws in some extra .o + # files that make .init and .fini sections work. + archive_cmds='$CC -G ${wl}-h $soname -o $lib $libobjs $deplibs $compiler_flags' + else + archive_cmds='$LD -assert pure-text -Bstatic -o $lib $libobjs $deplibs $linker_flags' + fi + hardcode_libdir_flag_spec='-L$libdir' + hardcode_direct=yes + hardcode_minus_L=yes + hardcode_shlibpath_var=no + ;; + + sysv4) + if test "x$host_vendor" = xsno; then + archive_cmds='$LD -G -Bsymbolic -h $soname -o $lib $libobjs $deplibs $linkopts' + hardcode_direct=yes # is this really true??? + else + archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' + hardcode_direct=no #Motorola manual says yes, but my tests say they lie + fi + runpath_var='LD_RUN_PATH' + hardcode_shlibpath_var=no + ;; + + sysv4.3*) + archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' + hardcode_shlibpath_var=no + export_dynamic_flag_spec='-Bexport' + ;; + + sysv5*) + no_undefined_flag=' -z text' + # $CC -shared without GNU ld will not create a library from C++ + # object files and a static libstdc++, better avoid it by now + archive_cmds='$LD -G${allow_undefined_flag} -h $soname -o $lib $libobjs $deplibs $linker_flags' + archive_expsym_cmds='$echo "{ global:" > $lib.exp~cat $export_symbols | sed -e "s/\(.*\)/\1;/" >> $lib.exp~$echo "local: *; };" >> $lib.exp~ + $LD -G${allow_undefined_flag} -M $lib.exp -h $soname -o $lib $libobjs $deplibs $linker_flags~$rm $lib.exp' + hardcode_libdir_flag_spec= + hardcode_shlibpath_var=no + runpath_var='LD_RUN_PATH' + ;; + + uts4*) + archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' + hardcode_libdir_flag_spec='-L$libdir' + hardcode_shlibpath_var=no + ;; + + dgux*) + archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' + hardcode_libdir_flag_spec='-L$libdir' + hardcode_shlibpath_var=no + ;; + + sysv4*MP*) + if test -d /usr/nec; then + archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' + hardcode_shlibpath_var=no + runpath_var=LD_RUN_PATH + hardcode_runpath_var=yes + ld_shlibs=yes + fi + ;; + + sysv4.2uw2*) + archive_cmds='$LD -G -o $lib $libobjs $deplibs $linker_flags' + hardcode_direct=yes + hardcode_minus_L=no + hardcode_shlibpath_var=no + hardcode_runpath_var=yes + runpath_var=LD_RUN_PATH + ;; + + sysv5uw7* | unixware7*) + no_undefined_flag='${wl}-z ${wl}text' + if test "$GCC" = yes; then + archive_cmds='$CC -shared ${wl}-h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags' + else + archive_cmds='$CC -G ${wl}-h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags' + fi + runpath_var='LD_RUN_PATH' + hardcode_shlibpath_var=no + ;; + + *) + ld_shlibs=no + ;; + esac +fi +echo "$as_me:5014: result: $ld_shlibs" >&5 +echo "${ECHO_T}$ld_shlibs" >&6 +test "$ld_shlibs" = no && can_build_shared=no +## +## END FIXME + +## FIXME: this should be a separate macro +## +# Check hardcoding attributes. +echo "$as_me:5023: checking how to hardcode library paths into programs" >&5 +echo $ECHO_N "checking how to hardcode library paths into programs... $ECHO_C" >&6 +hardcode_action= +if test -n "$hardcode_libdir_flag_spec" || \ + test -n "$runpath_var"; then + + # We can hardcode non-existant directories. + if test "$hardcode_direct" != no && + # If the only mechanism to avoid hardcoding is shlibpath_var, we + # have to relink, otherwise we might link with an installed library + # when we should be linking with a yet-to-be-installed one + ## test "$hardcode_shlibpath_var" != no && + test "$hardcode_minus_L" != no; then + # Linking always hardcodes the temporary library directory. + hardcode_action=relink + else + # We can link without hardcoding, and we can hardcode nonexisting dirs. + hardcode_action=immediate + fi +else + # We cannot hardcode anything, or else we can only hardcode existing + # directories. + hardcode_action=unsupported +fi +echo "$as_me:5047: result: $hardcode_action" >&5 +echo "${ECHO_T}$hardcode_action" >&6 +## +## END FIXME + +## FIXME: this should be a separate macro +## +striplib= +old_striplib= +echo "$as_me:5056: checking whether stripping libraries is possible" >&5 +echo $ECHO_N "checking whether stripping libraries is possible... $ECHO_C" >&6 +if test -n "$STRIP" && $STRIP -V 2>&1 | grep "GNU strip" >/dev/null; then + test -z "$old_striplib" && old_striplib="$STRIP --strip-debug" + test -z "$striplib" && striplib="$STRIP --strip-unneeded" + echo "$as_me:5061: result: yes" >&5 +echo "${ECHO_T}yes" >&6 +else + echo "$as_me:5064: result: no" >&5 +echo "${ECHO_T}no" >&6 +fi +## +## END FIXME + +reload_cmds='$LD$reload_flag -o $output$reload_objs' +test -z "$deplibs_check_method" && deplibs_check_method=unknown + +## FIXME: this should be a separate macro +## +# PORTME Fill in your ld.so characteristics +echo "$as_me:5076: checking dynamic linker characteristics" >&5 +echo $ECHO_N "checking dynamic linker characteristics... $ECHO_C" >&6 +library_names_spec= +libname_spec='lib$name' +soname_spec= +postinstall_cmds= +postuninstall_cmds= +finish_cmds= +finish_eval= +shlibpath_var= +shlibpath_overrides_runpath=unknown +version_type=none +dynamic_linker="$host_os ld.so" +sys_lib_dlsearch_path_spec="/lib /usr/lib" +sys_lib_search_path_spec="/lib /usr/lib /usr/local/lib" + +case $host_os in +aix3*) + version_type=linux + library_names_spec='${libname}${release}.so$versuffix $libname.a' + shlibpath_var=LIBPATH + + # AIX has no versioning support, so we append a major version to the name. + soname_spec='${libname}${release}.so$major' + ;; + +aix4* | aix5*) + version_type=linux + if test "$host_cpu" = ia64; then + # AIX 5 supports IA64 + library_names_spec='${libname}${release}.so$major ${libname}${release}.so$versuffix $libname.so' + shlibpath_var=LD_LIBRARY_PATH + else + # With GCC up to 2.95.x, collect2 would create an import file + # for dependence libraries. The import file would start with + # the line `#! .'. This would cause the generated library to + # depend on `.', always an invalid library. This was fixed in + # development snapshots of GCC prior to 3.0. + case $host_os in + aix4 | aix4.[01] | aix4.[01].*) + if { echo '#if __GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 97)' + echo ' yes ' + echo '#endif'; } | ${CC} -E - | grep yes > /dev/null; then + : + else + can_build_shared=no + fi + ;; + esac + # AIX (on Power*) has no versioning support, so currently we can not hardcode correct + # soname into executable. Probably we can add versioning support to + # collect2, so additional links can be useful in future. + if test "$aix_use_runtimelinking" = yes; then + # If using run time linking (on AIX 4.2 or later) use lib.so instead of + # lib.a to let people know that these are not typical AIX shared libraries. + library_names_spec='${libname}${release}.so$versuffix ${libname}${release}.so$major $libname.so' + else + # We preserve .a as extension for shared libraries through AIX4.2 + # and later when we are not doing run time linking. + library_names_spec='${libname}${release}.a $libname.a' + soname_spec='${libname}${release}.so$major' + fi + shlibpath_var=LIBPATH + deplibs_check_method=pass_all + fi + ;; + +amigaos*) + library_names_spec='$libname.ixlibrary $libname.a' + # Create ${libname}_ixlibrary.a entries in /sys/libs. + finish_eval='for lib in `ls $libdir/*.ixlibrary 2>/dev/null`; do libname=`$echo "X$lib" | $Xsed -e '\''s%^.*/\([^/]*\)\.ixlibrary$%\1%'\''`; test $rm /sys/libs/${libname}_ixlibrary.a; $show "(cd /sys/libs && $LN_S $lib ${libname}_ixlibrary.a)"; (cd /sys/libs && $LN_S $lib ${libname}_ixlibrary.a) || exit 1; done' + ;; + +beos*) + library_names_spec='${libname}.so' + dynamic_linker="$host_os ld.so" + shlibpath_var=LIBRARY_PATH + ;; + +bsdi4*) + version_type=linux + need_version=no + library_names_spec='${libname}${release}.so$versuffix ${libname}${release}.so$major $libname.so' + soname_spec='${libname}${release}.so$major' + finish_cmds='PATH="\$PATH:/sbin" ldconfig $libdir' + shlibpath_var=LD_LIBRARY_PATH + sys_lib_search_path_spec="/shlib /usr/lib /usr/X11/lib /usr/contrib/lib /lib /usr/local/lib" + sys_lib_dlsearch_path_spec="/shlib /usr/lib /usr/local/lib" + export_dynamic_flag_spec=-rdynamic + # the default ld.so.conf also contains /usr/contrib/lib and + # /usr/X11R6/lib (/usr/X11 is a link to /usr/X11R6), but let us allow + # libtool to hard-code these into programs + ;; + +cygwin* | mingw* | pw32*) + version_type=windows + need_version=no + need_lib_prefix=no + case $GCC,$host_os in + yes,cygwin*) + library_names_spec='$libname.dll.a' + soname_spec='`echo ${libname} | sed -e 's/^lib/cyg/'``echo ${release} | sed -e 's/[.]/-/g'`${versuffix}.dll' + postinstall_cmds='dlpath=`bash 2>&1 -c '\''. $dir/${file}i;echo \$dlname'\''`~ + dldir=$destdir/`dirname \$dlpath`~ + test -d \$dldir || mkdir -p \$dldir~ + $install_prog .libs/$dlname \$dldir/$dlname' + postuninstall_cmds='dldll=`bash 2>&1 -c '\''. $file; echo \$dlname'\''`~ + dlpath=$dir/\$dldll~ + $rm \$dlpath' + ;; + yes,mingw*) + library_names_spec='${libname}`echo ${release} | sed -e 's/[.]/-/g'`${versuffix}.dll' + sys_lib_search_path_spec=`$CC -print-search-dirs | grep "^libraries:" | sed -e "s/^libraries://" -e "s/;/ /g"` + ;; + yes,pw32*) + library_names_spec='`echo ${libname} | sed -e 's/^lib/pw/'``echo ${release} | sed -e 's/./-/g'`${versuffix}.dll' + ;; + *) + library_names_spec='${libname}`echo ${release} | sed -e 's/[.]/-/g'`${versuffix}.dll $libname.lib' + ;; + esac + dynamic_linker='Win32 ld.exe' + # FIXME: first we should search . and the directory the executable is in + shlibpath_var=PATH + ;; + +darwin* | rhapsody*) + dynamic_linker="$host_os dyld" + version_type=darwin + need_lib_prefix=no + need_version=no + # FIXME: Relying on posixy $() will cause problems for + # cross-compilation, but unfortunately the echo tests do not + # yet detect zsh echo's removal of \ escapes. + library_names_spec='${libname}${release}${versuffix}.$(test .$module = .yes && echo so || echo dylib) ${libname}${release}${major}.$(test .$module = .yes && echo so || echo dylib) ${libname}.$(test .$module = .yes && echo so || echo dylib)' + soname_spec='${libname}${release}${major}.$(test .$module = .yes && echo so || echo dylib)' + shlibpath_overrides_runpath=yes + shlibpath_var=DYLD_LIBRARY_PATH + ;; + +freebsd1*) + dynamic_linker=no + ;; + +freebsd*) + objformat=`test -x /usr/bin/objformat && /usr/bin/objformat || echo aout` + version_type=freebsd-$objformat + case $version_type in + freebsd-elf*) + library_names_spec='${libname}${release}.so$versuffix ${libname}${release}.so $libname.so' + need_version=no + need_lib_prefix=no + ;; + freebsd-*) + library_names_spec='${libname}${release}.so$versuffix $libname.so$versuffix' + need_version=yes + ;; + esac + shlibpath_var=LD_LIBRARY_PATH + case $host_os in + freebsd2*) + shlibpath_overrides_runpath=yes + ;; + *) + shlibpath_overrides_runpath=no + hardcode_into_libs=yes + ;; + esac + ;; + +gnu*) + version_type=linux + need_lib_prefix=no + need_version=no + library_names_spec='${libname}${release}.so$versuffix ${libname}${release}.so${major} ${libname}.so' + soname_spec='${libname}${release}.so$major' + shlibpath_var=LD_LIBRARY_PATH + hardcode_into_libs=yes + ;; + +hpux9* | hpux10* | hpux11*) + # Give a soname corresponding to the major version so that dld.sl refuses to + # link against other versions. + dynamic_linker="$host_os dld.sl" + version_type=sunos + need_lib_prefix=no + need_version=no + shlibpath_var=SHLIB_PATH + shlibpath_overrides_runpath=no # +s is required to enable SHLIB_PATH + library_names_spec='${libname}${release}.sl$versuffix ${libname}${release}.sl$major $libname.sl' + soname_spec='${libname}${release}.sl$major' + # HP-UX runs *really* slowly unless shared libraries are mode 555. + postinstall_cmds='chmod 555 $lib' + ;; + +irix5* | irix6*) + version_type=irix + need_lib_prefix=no + need_version=no + soname_spec='${libname}${release}.so$major' + library_names_spec='${libname}${release}.so$versuffix ${libname}${release}.so$major ${libname}${release}.so $libname.so' + case $host_os in + irix5*) + libsuff= shlibsuff= + ;; + *) + case $LD in # libtool.m4 will add one of these switches to LD + *-32|*"-32 ") libsuff= shlibsuff= libmagic=32-bit;; + *-n32|*"-n32 ") libsuff=32 shlibsuff=N32 libmagic=N32;; + *-64|*"-64 ") libsuff=64 shlibsuff=64 libmagic=64-bit;; + *) libsuff= shlibsuff= libmagic=never-match;; + esac + ;; + esac + shlibpath_var=LD_LIBRARY${shlibsuff}_PATH + shlibpath_overrides_runpath=no + sys_lib_search_path_spec="/usr/lib${libsuff} /lib${libsuff} /usr/local/lib${libsuff}" + sys_lib_dlsearch_path_spec="/usr/lib${libsuff} /lib${libsuff}" + ;; + +# No shared lib support for Linux oldld, aout, or coff. +linux-gnuoldld* | linux-gnuaout* | linux-gnucoff*) + dynamic_linker=no + ;; + +# This must be Linux ELF. +linux-gnu*) + version_type=linux + need_lib_prefix=no + need_version=no + library_names_spec='${libname}${release}.so$versuffix ${libname}${release}.so$major $libname.so' + soname_spec='${libname}${release}.so$major' + finish_cmds='PATH="\$PATH:/sbin" ldconfig -n $libdir' + shlibpath_var=LD_LIBRARY_PATH + shlibpath_overrides_runpath=no + # This implies no fast_install, which is unacceptable. + # Some rework will be needed to allow for fast_install + # before this can be enabled. + hardcode_into_libs=yes + + # We used to test for /lib/ld.so.1 and disable shared libraries on + # powerpc, because MkLinux only supported shared libraries with the + # GNU dynamic linker. Since this was broken with cross compilers, + # most powerpc-linux boxes support dynamic linking these days and + # people can always --disable-shared, the test was removed, and we + # assume the GNU/Linux dynamic linker is in use. + dynamic_linker='GNU/Linux ld.so' + ;; + +netbsd*) + version_type=sunos + need_lib_prefix=no + need_version=no + if echo __ELF__ | $CC -E - | grep __ELF__ >/dev/null; then + library_names_spec='${libname}${release}.so$versuffix ${libname}.so$versuffix' + finish_cmds='PATH="\$PATH:/sbin" ldconfig -m $libdir' + dynamic_linker='NetBSD (a.out) ld.so' + else + library_names_spec='${libname}${release}.so$versuffix ${libname}${release}.so$major ${libname}${release}.so ${libname}.so' + soname_spec='${libname}${release}.so$major' + dynamic_linker='NetBSD ld.elf_so' + fi + shlibpath_var=LD_LIBRARY_PATH + shlibpath_overrides_runpath=yes + hardcode_into_libs=yes + ;; + +newsos6) + version_type=linux + library_names_spec='${libname}${release}.so$versuffix ${libname}${release}.so$major $libname.so' + shlibpath_var=LD_LIBRARY_PATH + shlibpath_overrides_runpath=yes + ;; + +openbsd*) + version_type=sunos + if test "$with_gnu_ld" = yes; then + need_lib_prefix=no + need_version=no + fi + library_names_spec='${libname}${release}.so$versuffix ${libname}.so$versuffix' + finish_cmds='PATH="\$PATH:/sbin" ldconfig -m $libdir' + shlibpath_var=LD_LIBRARY_PATH + ;; + +os2*) + libname_spec='$name' + need_lib_prefix=no + library_names_spec='$libname.dll $libname.a' + dynamic_linker='OS/2 ld.exe' + shlibpath_var=LIBPATH + ;; + +osf3* | osf4* | osf5*) + version_type=osf + need_version=no + soname_spec='${libname}${release}.so' + library_names_spec='${libname}${release}.so$versuffix ${libname}${release}.so $libname.so' + shlibpath_var=LD_LIBRARY_PATH + sys_lib_search_path_spec="/usr/shlib /usr/ccs/lib /usr/lib/cmplrs/cc /usr/lib /usr/local/lib /var/shlib" + sys_lib_dlsearch_path_spec="$sys_lib_search_path_spec" + ;; + +sco3.2v5*) + version_type=osf + soname_spec='${libname}${release}.so$major' + library_names_spec='${libname}${release}.so$versuffix ${libname}${release}.so$major $libname.so' + shlibpath_var=LD_LIBRARY_PATH + ;; + +solaris*) + version_type=linux + need_lib_prefix=no + need_version=no + library_names_spec='${libname}${release}.so$versuffix ${libname}${release}.so$major $libname.so' + soname_spec='${libname}${release}.so$major' + shlibpath_var=LD_LIBRARY_PATH + shlibpath_overrides_runpath=yes + hardcode_into_libs=yes + # ldd complains unless libraries are executable + postinstall_cmds='chmod +x $lib' + ;; + +sunos4*) + version_type=sunos + library_names_spec='${libname}${release}.so$versuffix ${libname}.so$versuffix' + finish_cmds='PATH="\$PATH:/usr/etc" ldconfig $libdir' + shlibpath_var=LD_LIBRARY_PATH + shlibpath_overrides_runpath=yes + if test "$with_gnu_ld" = yes; then + need_lib_prefix=no + fi + need_version=yes + ;; + +sysv4 | sysv4.2uw2* | sysv4.3* | sysv5*) + version_type=linux + library_names_spec='${libname}${release}.so$versuffix ${libname}${release}.so$major $libname.so' + soname_spec='${libname}${release}.so$major' + shlibpath_var=LD_LIBRARY_PATH + case $host_vendor in + sni) + shlibpath_overrides_runpath=no + ;; + motorola) + need_lib_prefix=no + need_version=no + shlibpath_overrides_runpath=no + sys_lib_search_path_spec='/lib /usr/lib /usr/ccs/lib' + ;; + esac + ;; + +uts4*) + version_type=linux + library_names_spec='${libname}${release}.so$versuffix ${libname}${release}.so$major $libname.so' + soname_spec='${libname}${release}.so$major' + shlibpath_var=LD_LIBRARY_PATH + ;; + +dgux*) + version_type=linux + need_lib_prefix=no + need_version=no + library_names_spec='${libname}${release}.so$versuffix ${libname}${release}.so$major $libname.so' + soname_spec='${libname}${release}.so$major' + shlibpath_var=LD_LIBRARY_PATH + ;; + +sysv4*MP*) + if test -d /usr/nec ;then + version_type=linux + library_names_spec='$libname.so.$versuffix $libname.so.$major $libname.so' + soname_spec='$libname.so.$major' + shlibpath_var=LD_LIBRARY_PATH + fi + ;; + +*) + dynamic_linker=no + ;; +esac +echo "$as_me:5458: result: $dynamic_linker" >&5 +echo "${ECHO_T}$dynamic_linker" >&6 +test "$dynamic_linker" = no && can_build_shared=no +## +## END FIXME + +## FIXME: this should be a separate macro +## +# Report the final consequences. +echo "$as_me:5467: checking if libtool supports shared libraries" >&5 +echo $ECHO_N "checking if libtool supports shared libraries... $ECHO_C" >&6 +echo "$as_me:5469: result: $can_build_shared" >&5 +echo "${ECHO_T}$can_build_shared" >&6 +## +## END FIXME + +if test "$hardcode_action" = relink; then + # Fast installation is not supported + enable_fast_install=no +elif test "$shlibpath_overrides_runpath" = yes || + test "$enable_shared" = no; then + # Fast installation is not necessary + enable_fast_install=needless +fi + +variables_saved_for_relink="PATH $shlibpath_var $runpath_var" +if test "$GCC" = yes; then + variables_saved_for_relink="$variables_saved_for_relink GCC_EXEC_PREFIX COMPILER_PATH LIBRARY_PATH" +fi + +if test "x$enable_dlopen" != xyes; then + enable_dlopen=unknown + enable_dlopen_self=unknown + enable_dlopen_self_static=unknown +else + lt_cv_dlopen=no + lt_cv_dlopen_libs= + + case $host_os in + beos*) + lt_cv_dlopen="load_add_on" + lt_cv_dlopen_libs= + lt_cv_dlopen_self=yes + ;; + + cygwin* | mingw* | pw32*) + lt_cv_dlopen="LoadLibrary" + lt_cv_dlopen_libs= + ;; + + *) + echo "$as_me:5509: checking for dlopen in -ldl" >&5 +echo $ECHO_N "checking for dlopen in -ldl... $ECHO_C" >&6 +if test "${ac_cv_lib_dl_dlopen+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + ac_check_lib_save_LIBS=$LIBS +LIBS="-ldl $LIBS" +cat >conftest.$ac_ext <<_ACEOF +#line 5517 "configure" +#include "confdefs.h" + +/* Override any gcc2 internal prototype to avoid an error. */ +#ifdef __cplusplus +extern "C" +#endif +/* We use char because int might match the return type of a gcc2 + builtin and then its argument prototype would still apply. */ +char dlopen (); +int +main () +{ +dlopen (); + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext conftest$ac_exeext +if { (eval echo "$as_me:5536: \"$ac_link\"") >&5 + (eval $ac_link) 2>&5 + ac_status=$? + echo "$as_me:5539: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -s conftest$ac_exeext' + { (eval echo "$as_me:5542: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:5545: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_cv_lib_dl_dlopen=yes +else + echo "$as_me: failed program was:" >&5 +cat conftest.$ac_ext >&5 +ac_cv_lib_dl_dlopen=no +fi +rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext +LIBS=$ac_check_lib_save_LIBS +fi +echo "$as_me:5556: result: $ac_cv_lib_dl_dlopen" >&5 +echo "${ECHO_T}$ac_cv_lib_dl_dlopen" >&6 +if test $ac_cv_lib_dl_dlopen = yes; then + lt_cv_dlopen="dlopen" lt_cv_dlopen_libs="-ldl" +else + echo "$as_me:5561: checking for dlopen" >&5 +echo $ECHO_N "checking for dlopen... $ECHO_C" >&6 +if test "${ac_cv_func_dlopen+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + cat >conftest.$ac_ext <<_ACEOF +#line 5567 "configure" +#include "confdefs.h" +/* System header to define __stub macros and hopefully few prototypes, + which can conflict with char dlopen (); below. */ +#include +/* Override any gcc2 internal prototype to avoid an error. */ +#ifdef __cplusplus +extern "C" +#endif +/* We use char because int might match the return type of a gcc2 + builtin and then its argument prototype would still apply. */ +char dlopen (); +char (*f) (); + +int +main () +{ +/* The GNU C library defines this for functions which it implements + to always fail with ENOSYS. Some functions are actually named + something starting with __ and the normal name is an alias. */ +#if defined (__stub_dlopen) || defined (__stub___dlopen) +choke me +#else +f = dlopen; +#endif + + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext conftest$ac_exeext +if { (eval echo "$as_me:5598: \"$ac_link\"") >&5 + (eval $ac_link) 2>&5 + ac_status=$? + echo "$as_me:5601: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -s conftest$ac_exeext' + { (eval echo "$as_me:5604: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:5607: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_cv_func_dlopen=yes +else + echo "$as_me: failed program was:" >&5 +cat conftest.$ac_ext >&5 +ac_cv_func_dlopen=no +fi +rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext +fi +echo "$as_me:5617: result: $ac_cv_func_dlopen" >&5 +echo "${ECHO_T}$ac_cv_func_dlopen" >&6 +if test $ac_cv_func_dlopen = yes; then + lt_cv_dlopen="dlopen" +else + echo "$as_me:5622: checking for shl_load" >&5 +echo $ECHO_N "checking for shl_load... $ECHO_C" >&6 +if test "${ac_cv_func_shl_load+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + cat >conftest.$ac_ext <<_ACEOF +#line 5628 "configure" +#include "confdefs.h" +/* System header to define __stub macros and hopefully few prototypes, + which can conflict with char shl_load (); below. */ +#include +/* Override any gcc2 internal prototype to avoid an error. */ +#ifdef __cplusplus +extern "C" +#endif +/* We use char because int might match the return type of a gcc2 + builtin and then its argument prototype would still apply. */ +char shl_load (); +char (*f) (); + +int +main () +{ +/* The GNU C library defines this for functions which it implements + to always fail with ENOSYS. Some functions are actually named + something starting with __ and the normal name is an alias. */ +#if defined (__stub_shl_load) || defined (__stub___shl_load) +choke me +#else +f = shl_load; +#endif + + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext conftest$ac_exeext +if { (eval echo "$as_me:5659: \"$ac_link\"") >&5 + (eval $ac_link) 2>&5 + ac_status=$? + echo "$as_me:5662: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -s conftest$ac_exeext' + { (eval echo "$as_me:5665: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:5668: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_cv_func_shl_load=yes +else + echo "$as_me: failed program was:" >&5 +cat conftest.$ac_ext >&5 +ac_cv_func_shl_load=no +fi +rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext +fi +echo "$as_me:5678: result: $ac_cv_func_shl_load" >&5 +echo "${ECHO_T}$ac_cv_func_shl_load" >&6 +if test $ac_cv_func_shl_load = yes; then + lt_cv_dlopen="shl_load" +else + echo "$as_me:5683: checking for dlopen in -lsvld" >&5 +echo $ECHO_N "checking for dlopen in -lsvld... $ECHO_C" >&6 +if test "${ac_cv_lib_svld_dlopen+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + ac_check_lib_save_LIBS=$LIBS +LIBS="-lsvld $LIBS" +cat >conftest.$ac_ext <<_ACEOF +#line 5691 "configure" +#include "confdefs.h" + +/* Override any gcc2 internal prototype to avoid an error. */ +#ifdef __cplusplus +extern "C" +#endif +/* We use char because int might match the return type of a gcc2 + builtin and then its argument prototype would still apply. */ +char dlopen (); +int +main () +{ +dlopen (); + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext conftest$ac_exeext +if { (eval echo "$as_me:5710: \"$ac_link\"") >&5 + (eval $ac_link) 2>&5 + ac_status=$? + echo "$as_me:5713: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -s conftest$ac_exeext' + { (eval echo "$as_me:5716: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:5719: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_cv_lib_svld_dlopen=yes +else + echo "$as_me: failed program was:" >&5 +cat conftest.$ac_ext >&5 +ac_cv_lib_svld_dlopen=no +fi +rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext +LIBS=$ac_check_lib_save_LIBS +fi +echo "$as_me:5730: result: $ac_cv_lib_svld_dlopen" >&5 +echo "${ECHO_T}$ac_cv_lib_svld_dlopen" >&6 +if test $ac_cv_lib_svld_dlopen = yes; then + lt_cv_dlopen="dlopen" lt_cv_dlopen_libs="-lsvld" +else + echo "$as_me:5735: checking for shl_load in -ldld" >&5 +echo $ECHO_N "checking for shl_load in -ldld... $ECHO_C" >&6 +if test "${ac_cv_lib_dld_shl_load+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + ac_check_lib_save_LIBS=$LIBS +LIBS="-ldld $LIBS" +cat >conftest.$ac_ext <<_ACEOF +#line 5743 "configure" +#include "confdefs.h" + +/* Override any gcc2 internal prototype to avoid an error. */ +#ifdef __cplusplus +extern "C" +#endif +/* We use char because int might match the return type of a gcc2 + builtin and then its argument prototype would still apply. */ +char shl_load (); +int +main () +{ +shl_load (); + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext conftest$ac_exeext +if { (eval echo "$as_me:5762: \"$ac_link\"") >&5 + (eval $ac_link) 2>&5 + ac_status=$? + echo "$as_me:5765: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -s conftest$ac_exeext' + { (eval echo "$as_me:5768: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:5771: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_cv_lib_dld_shl_load=yes +else + echo "$as_me: failed program was:" >&5 +cat conftest.$ac_ext >&5 +ac_cv_lib_dld_shl_load=no +fi +rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext +LIBS=$ac_check_lib_save_LIBS +fi +echo "$as_me:5782: result: $ac_cv_lib_dld_shl_load" >&5 +echo "${ECHO_T}$ac_cv_lib_dld_shl_load" >&6 +if test $ac_cv_lib_dld_shl_load = yes; then + lt_cv_dlopen="dld_link" lt_cv_dlopen_libs="-dld" +fi + +fi + +fi + +fi + +fi + + ;; + esac + + if test "x$lt_cv_dlopen" != xno; then + enable_dlopen=yes + else + enable_dlopen=no + fi + + case $lt_cv_dlopen in + dlopen) + save_CPPFLAGS="$CPPFLAGS" + test "x$ac_cv_header_dlfcn_h" = xyes && CPPFLAGS="$CPPFLAGS -DHAVE_DLFCN_H" + + save_LDFLAGS="$LDFLAGS" + eval LDFLAGS=\"\$LDFLAGS $export_dynamic_flag_spec\" + + save_LIBS="$LIBS" + LIBS="$lt_cv_dlopen_libs $LIBS" + + echo "$as_me:5816: checking whether a program can dlopen itself" >&5 +echo $ECHO_N "checking whether a program can dlopen itself... $ECHO_C" >&6 +if test "${lt_cv_dlopen_self+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + if test "$cross_compiling" = yes; then : + lt_cv_dlopen_self=cross +else + lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2 + lt_status=$lt_dlunknown + cat > conftest.$ac_ext < +#endif + +#include + +#ifdef RTLD_GLOBAL +# define LT_DLGLOBAL RTLD_GLOBAL +#else +# ifdef DL_GLOBAL +# define LT_DLGLOBAL DL_GLOBAL +# else +# define LT_DLGLOBAL 0 +# endif +#endif + +/* We may have to define LT_DLLAZY_OR_NOW in the command line if we + find out it does not work in some platform. */ +#ifndef LT_DLLAZY_OR_NOW +# ifdef RTLD_LAZY +# define LT_DLLAZY_OR_NOW RTLD_LAZY +# else +# ifdef DL_LAZY +# define LT_DLLAZY_OR_NOW DL_LAZY +# else +# ifdef RTLD_NOW +# define LT_DLLAZY_OR_NOW RTLD_NOW +# else +# ifdef DL_NOW +# define LT_DLLAZY_OR_NOW DL_NOW +# else +# define LT_DLLAZY_OR_NOW 0 +# endif +# endif +# endif +# endif +#endif + +#ifdef __cplusplus +extern "C" void exit (int); +#endif + +void fnord() { int i=42;} +int main () +{ + void *self = dlopen (0, LT_DLGLOBAL|LT_DLLAZY_OR_NOW); + int status = $lt_dlunknown; + + if (self) + { + if (dlsym (self,"fnord")) status = $lt_dlno_uscore; + else if (dlsym( self,"_fnord")) status = $lt_dlneed_uscore; + /* dlclose (self); */ + } + + exit (status); +} +EOF + if { (eval echo "$as_me:5888: \"$ac_link\"") >&5 + (eval $ac_link) 2>&5 + ac_status=$? + echo "$as_me:5891: \$? = $ac_status" >&5 + (exit $ac_status); } && test -s conftest${ac_exeext} 2>/dev/null; then + (./conftest; exit; ) 2>/dev/null + lt_status=$? + case x$lt_status in + x$lt_dlno_uscore) lt_cv_dlopen_self=yes ;; + x$lt_dlneed_uscore) lt_cv_dlopen_self=yes ;; + x$lt_unknown|x*) lt_cv_dlopen_self=no ;; + esac + else : + # compilation failed + lt_cv_dlopen_self=no + fi +fi +rm -fr conftest* + +fi +echo "$as_me:5908: result: $lt_cv_dlopen_self" >&5 +echo "${ECHO_T}$lt_cv_dlopen_self" >&6 + + if test "x$lt_cv_dlopen_self" = xyes; then + LDFLAGS="$LDFLAGS $link_static_flag" + echo "$as_me:5913: checking whether a statically linked program can dlopen itself" >&5 +echo $ECHO_N "checking whether a statically linked program can dlopen itself... $ECHO_C" >&6 +if test "${lt_cv_dlopen_self_static+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + if test "$cross_compiling" = yes; then : + lt_cv_dlopen_self_static=cross +else + lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2 + lt_status=$lt_dlunknown + cat > conftest.$ac_ext < +#endif + +#include + +#ifdef RTLD_GLOBAL +# define LT_DLGLOBAL RTLD_GLOBAL +#else +# ifdef DL_GLOBAL +# define LT_DLGLOBAL DL_GLOBAL +# else +# define LT_DLGLOBAL 0 +# endif +#endif + +/* We may have to define LT_DLLAZY_OR_NOW in the command line if we + find out it does not work in some platform. */ +#ifndef LT_DLLAZY_OR_NOW +# ifdef RTLD_LAZY +# define LT_DLLAZY_OR_NOW RTLD_LAZY +# else +# ifdef DL_LAZY +# define LT_DLLAZY_OR_NOW DL_LAZY +# else +# ifdef RTLD_NOW +# define LT_DLLAZY_OR_NOW RTLD_NOW +# else +# ifdef DL_NOW +# define LT_DLLAZY_OR_NOW DL_NOW +# else +# define LT_DLLAZY_OR_NOW 0 +# endif +# endif +# endif +# endif +#endif + +#ifdef __cplusplus +extern "C" void exit (int); +#endif + +void fnord() { int i=42;} +int main () +{ + void *self = dlopen (0, LT_DLGLOBAL|LT_DLLAZY_OR_NOW); + int status = $lt_dlunknown; + + if (self) + { + if (dlsym (self,"fnord")) status = $lt_dlno_uscore; + else if (dlsym( self,"_fnord")) status = $lt_dlneed_uscore; + /* dlclose (self); */ + } + + exit (status); +} +EOF + if { (eval echo "$as_me:5985: \"$ac_link\"") >&5 + (eval $ac_link) 2>&5 + ac_status=$? + echo "$as_me:5988: \$? = $ac_status" >&5 + (exit $ac_status); } && test -s conftest${ac_exeext} 2>/dev/null; then + (./conftest; exit; ) 2>/dev/null + lt_status=$? + case x$lt_status in + x$lt_dlno_uscore) lt_cv_dlopen_self_static=yes ;; + x$lt_dlneed_uscore) lt_cv_dlopen_self_static=yes ;; + x$lt_unknown|x*) lt_cv_dlopen_self_static=no ;; + esac + else : + # compilation failed + lt_cv_dlopen_self_static=no + fi +fi +rm -fr conftest* + +fi +echo "$as_me:6005: result: $lt_cv_dlopen_self_static" >&5 +echo "${ECHO_T}$lt_cv_dlopen_self_static" >&6 + fi + + CPPFLAGS="$save_CPPFLAGS" + LDFLAGS="$save_LDFLAGS" + LIBS="$save_LIBS" + ;; + esac + + case $lt_cv_dlopen_self in + yes|no) enable_dlopen_self=$lt_cv_dlopen_self ;; + *) enable_dlopen_self=unknown ;; + esac + + case $lt_cv_dlopen_self_static in + yes|no) enable_dlopen_self_static=$lt_cv_dlopen_self_static ;; + *) enable_dlopen_self_static=unknown ;; + esac +fi + +## FIXME: this should be a separate macro +## +if test "$enable_shared" = yes && test "$GCC" = yes; then + case $archive_cmds in + *'~'*) + # FIXME: we may have to deal with multi-command sequences. + ;; + '$CC '*) + # Test whether the compiler implicitly links with -lc since on some + # systems, -lgcc has to come before -lc. If gcc already passes -lc + # to ld, don't add -lc before -lgcc. + echo "$as_me:6037: checking whether -lc should be explicitly linked in" >&5 +echo $ECHO_N "checking whether -lc should be explicitly linked in... $ECHO_C" >&6 + if test "${lt_cv_archive_cmds_need_lc+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + $rm conftest* + echo 'static int dummy;' > conftest.$ac_ext + + if { (eval echo "$as_me:6045: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>&5 + ac_status=$? + echo "$as_me:6048: \$? = $ac_status" >&5 + (exit $ac_status); }; then + soname=conftest + lib=conftest + libobjs=conftest.$ac_objext + deplibs= + wl=$lt_cv_prog_cc_wl + compiler_flags=-v + linker_flags=-v + verstring= + output_objdir=. + libname=conftest + save_allow_undefined_flag=$allow_undefined_flag + allow_undefined_flag= + if { (eval echo "$as_me:6062: \"$archive_cmds 2\>\&1 \| grep \" -lc \" \>/dev/null 2\>\&1\"") >&5 + (eval $archive_cmds 2\>\&1 \| grep \" -lc \" \>/dev/null 2\>\&1) 2>&5 + ac_status=$? + echo "$as_me:6065: \$? = $ac_status" >&5 + (exit $ac_status); } + then + lt_cv_archive_cmds_need_lc=no + else + lt_cv_archive_cmds_need_lc=yes + fi + allow_undefined_flag=$save_allow_undefined_flag + else + cat conftest.err 1>&5 + fi +fi + + echo "$as_me:6078: result: $lt_cv_archive_cmds_need_lc" >&5 +echo "${ECHO_T}$lt_cv_archive_cmds_need_lc" >&6 + ;; + esac +fi +need_lc=${lt_cv_archive_cmds_need_lc-yes} +## +## END FIXME + +## FIXME: this should be a separate macro +## +# The second clause should only fire when bootstrapping the +# libtool distribution, otherwise you forgot to ship ltmain.sh +# with your package, and you will get complaints that there are +# no rules to generate ltmain.sh. +if test -f "$ltmain"; then + : +else + # If there is no Makefile yet, we rely on a make rule to execute + # `config.status --recheck' to rerun these tests and create the + # libtool script then. + test -f Makefile && make "$ltmain" +fi + +if test -f "$ltmain"; then + trap "$rm \"${ofile}T\"; exit 1" 1 2 15 + $rm -f "${ofile}T" + + echo creating $ofile + + # Now quote all the things that may contain metacharacters while being + # careful not to overquote the AC_SUBSTed values. We take copies of the + # variables and quote the copies for generation of the libtool script. + for var in echo old_CC old_CFLAGS \ + AR AR_FLAGS CC LD LN_S NM SHELL \ + reload_flag reload_cmds wl \ + pic_flag link_static_flag no_builtin_flag export_dynamic_flag_spec \ + thread_safe_flag_spec whole_archive_flag_spec libname_spec \ + library_names_spec soname_spec \ + RANLIB old_archive_cmds old_archive_from_new_cmds old_postinstall_cmds \ + old_postuninstall_cmds archive_cmds archive_expsym_cmds postinstall_cmds \ + postuninstall_cmds extract_expsyms_cmds old_archive_from_expsyms_cmds \ + old_striplib striplib file_magic_cmd export_symbols_cmds \ + deplibs_check_method allow_undefined_flag no_undefined_flag \ + finish_cmds finish_eval global_symbol_pipe global_symbol_to_cdecl \ + hardcode_libdir_flag_spec hardcode_libdir_separator \ + sys_lib_search_path_spec sys_lib_dlsearch_path_spec \ + compiler_c_o compiler_o_lo need_locks exclude_expsyms include_expsyms; do + + case $var in + reload_cmds | old_archive_cmds | old_archive_from_new_cmds | \ + old_postinstall_cmds | old_postuninstall_cmds | \ + export_symbols_cmds | archive_cmds | archive_expsym_cmds | \ + extract_expsyms_cmds | old_archive_from_expsyms_cmds | \ + postinstall_cmds | postuninstall_cmds | \ + finish_cmds | sys_lib_search_path_spec | sys_lib_dlsearch_path_spec) + # Double-quote double-evaled strings. + eval "lt_$var=\\\"\`\$echo \"X\$$var\" | \$Xsed -e \"\$double_quote_subst\" -e \"\$sed_quote_subst\" -e \"\$delay_variable_subst\"\`\\\"" + ;; + *) + eval "lt_$var=\\\"\`\$echo \"X\$$var\" | \$Xsed -e \"\$sed_quote_subst\"\`\\\"" + ;; + esac + done + + cat <<__EOF__ > "${ofile}T" +#! $SHELL + +# `$echo "$ofile" | sed 's%^.*/%%'` - Provide generalized library-building support services. +# Generated automatically by $PROGRAM (GNU $PACKAGE $VERSION$TIMESTAMP) +# NOTE: Changes made to this file will be lost: look at ltmain.sh. +# +# Copyright (C) 1996-2000 Free Software Foundation, Inc. +# Originally by Gordon Matzigkeit , 1996 +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, but +# WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. +# +# As a special exception to the GNU General Public License, if you +# distribute this file as part of a program that contains a +# configuration script generated by Autoconf, you may include it under +# the same distribution terms that you use for the rest of that program. + +# Sed that helps us avoid accidentally triggering echo(1) options like -n. +Xsed="sed -e s/^X//" + +# The HP-UX ksh and POSIX shell print the target directory to stdout +# if CDPATH is set. +if test "X\${CDPATH+set}" = Xset; then CDPATH=:; export CDPATH; fi + +# ### BEGIN LIBTOOL CONFIG + +# Libtool was configured on host `(hostname || uname -n) 2>/dev/null | sed 1q`: + +# Shell to use when invoking shell scripts. +SHELL=$lt_SHELL + +# Whether or not to build shared libraries. +build_libtool_libs=$enable_shared + +# Whether or not to add -lc for building shared libraries. +build_libtool_need_lc=$need_lc + +# Whether or not to build static libraries. +build_old_libs=$enable_static + +# Whether or not to optimize for fast installation. +fast_install=$enable_fast_install + +# The host system. +host_alias=$host_alias +host=$host + +# An echo program that does not interpret backslashes. +echo=$lt_echo + +# The archiver. +AR=$lt_AR +AR_FLAGS=$lt_AR_FLAGS + +# The default C compiler. +CC=$lt_CC + +# Is the compiler the GNU C compiler? +with_gcc=$GCC + +# The linker used to build libraries. +LD=$lt_LD + +# Whether we need hard or soft links. +LN_S=$lt_LN_S + +# A BSD-compatible nm program. +NM=$lt_NM + +# A symbol stripping program +STRIP=$STRIP + +# Used to examine libraries when file_magic_cmd begins "file" +MAGIC_CMD=$MAGIC_CMD + +# Used on cygwin: DLL creation program. +DLLTOOL="$DLLTOOL" + +# Used on cygwin: object dumper. +OBJDUMP="$OBJDUMP" + +# Used on cygwin: assembler. +AS="$AS" + +# The name of the directory that contains temporary libtool files. +objdir=$objdir + +# How to create reloadable object files. +reload_flag=$lt_reload_flag +reload_cmds=$lt_reload_cmds + +# How to pass a linker flag through the compiler. +wl=$lt_wl + +# Object file suffix (normally "o"). +objext="$ac_objext" + +# Old archive suffix (normally "a"). +libext="$libext" + +# Executable file suffix (normally ""). +exeext="$exeext" + +# Additional compiler flags for building library objects. +pic_flag=$lt_pic_flag +pic_mode=$pic_mode + +# Does compiler simultaneously support -c and -o options? +compiler_c_o=$lt_compiler_c_o + +# Can we write directly to a .lo ? +compiler_o_lo=$lt_compiler_o_lo + +# Must we lock files when doing compilation ? +need_locks=$lt_need_locks + +# Do we need the lib prefix for modules? +need_lib_prefix=$need_lib_prefix + +# Do we need a version for libraries? +need_version=$need_version + +# Whether dlopen is supported. +dlopen_support=$enable_dlopen + +# Whether dlopen of programs is supported. +dlopen_self=$enable_dlopen_self + +# Whether dlopen of statically linked programs is supported. +dlopen_self_static=$enable_dlopen_self_static + +# Compiler flag to prevent dynamic linking. +link_static_flag=$lt_link_static_flag + +# Compiler flag to turn off builtin functions. +no_builtin_flag=$lt_no_builtin_flag + +# Compiler flag to allow reflexive dlopens. +export_dynamic_flag_spec=$lt_export_dynamic_flag_spec + +# Compiler flag to generate shared objects directly from archives. +whole_archive_flag_spec=$lt_whole_archive_flag_spec + +# Compiler flag to generate thread-safe objects. +thread_safe_flag_spec=$lt_thread_safe_flag_spec + +# Library versioning type. +version_type=$version_type + +# Format of library name prefix. +libname_spec=$lt_libname_spec + +# List of archive names. First name is the real one, the rest are links. +# The last name is the one that the linker finds with -lNAME. +library_names_spec=$lt_library_names_spec + +# The coded name of the library, if different from the real name. +soname_spec=$lt_soname_spec + +# Commands used to build and install an old-style archive. +RANLIB=$lt_RANLIB +old_archive_cmds=$lt_old_archive_cmds +old_postinstall_cmds=$lt_old_postinstall_cmds +old_postuninstall_cmds=$lt_old_postuninstall_cmds + +# Create an old-style archive from a shared archive. +old_archive_from_new_cmds=$lt_old_archive_from_new_cmds + +# Create a temporary old-style archive to link instead of a shared archive. +old_archive_from_expsyms_cmds=$lt_old_archive_from_expsyms_cmds + +# Commands used to build and install a shared archive. +archive_cmds=$lt_archive_cmds +archive_expsym_cmds=$lt_archive_expsym_cmds +postinstall_cmds=$lt_postinstall_cmds +postuninstall_cmds=$lt_postuninstall_cmds + +# Commands to strip libraries. +old_striplib=$lt_old_striplib +striplib=$lt_striplib + +# Method to check whether dependent libraries are shared objects. +deplibs_check_method=$lt_deplibs_check_method + +# Command to use when deplibs_check_method == file_magic. +file_magic_cmd=$lt_file_magic_cmd + +# Flag that allows shared libraries with undefined symbols to be built. +allow_undefined_flag=$lt_allow_undefined_flag + +# Flag that forces no undefined symbols. +no_undefined_flag=$lt_no_undefined_flag + +# Commands used to finish a libtool library installation in a directory. +finish_cmds=$lt_finish_cmds + +# Same as above, but a single script fragment to be evaled but not shown. +finish_eval=$lt_finish_eval + +# Take the output of nm and produce a listing of raw symbols and C names. +global_symbol_pipe=$lt_global_symbol_pipe + +# Transform the output of nm in a proper C declaration +global_symbol_to_cdecl=$lt_global_symbol_to_cdecl + +# This is the shared library runtime path variable. +runpath_var=$runpath_var + +# This is the shared library path variable. +shlibpath_var=$shlibpath_var + +# Is shlibpath searched before the hard-coded library search path? +shlibpath_overrides_runpath=$shlibpath_overrides_runpath + +# How to hardcode a shared library path into an executable. +hardcode_action=$hardcode_action + +# Whether we should hardcode library paths into libraries. +hardcode_into_libs=$hardcode_into_libs + +# Flag to hardcode \$libdir into a binary during linking. +# This must work even if \$libdir does not exist. +hardcode_libdir_flag_spec=$lt_hardcode_libdir_flag_spec + +# Whether we need a single -rpath flag with a separated argument. +hardcode_libdir_separator=$lt_hardcode_libdir_separator + +# Set to yes if using DIR/libNAME.so during linking hardcodes DIR into the +# resulting binary. +hardcode_direct=$hardcode_direct + +# Set to yes if using the -LDIR flag during linking hardcodes DIR into the +# resulting binary. +hardcode_minus_L=$hardcode_minus_L + +# Set to yes if using SHLIBPATH_VAR=DIR during linking hardcodes DIR into +# the resulting binary. +hardcode_shlibpath_var=$hardcode_shlibpath_var + +# Variables whose values should be saved in libtool wrapper scripts and +# restored at relink time. +variables_saved_for_relink="$variables_saved_for_relink" + +# Whether libtool must link a program against all its dependency libraries. +link_all_deplibs=$link_all_deplibs + +# Compile-time system search path for libraries +sys_lib_search_path_spec=$lt_sys_lib_search_path_spec + +# Run-time system search path for libraries +sys_lib_dlsearch_path_spec=$lt_sys_lib_dlsearch_path_spec + +# Fix the shell variable \$srcfile for the compiler. +fix_srcfile_path="$fix_srcfile_path" + +# Set to yes if exported symbols are required. +always_export_symbols=$always_export_symbols + +# The commands to list exported symbols. +export_symbols_cmds=$lt_export_symbols_cmds + +# The commands to extract the exported symbol list from a shared archive. +extract_expsyms_cmds=$lt_extract_expsyms_cmds + +# Symbols that should not be listed in the preloaded symbols. +exclude_expsyms=$lt_exclude_expsyms + +# Symbols that must always be exported. +include_expsyms=$lt_include_expsyms + +# ### END LIBTOOL CONFIG + +__EOF__ + + case $host_os in + aix3*) + cat <<\EOF >> "${ofile}T" + +# AIX sometimes has problems with the GCC collect2 program. For some +# reason, if we set the COLLECT_NAMES environment variable, the problems +# vanish in a puff of smoke. +if test "X${COLLECT_NAMES+set}" != Xset; then + COLLECT_NAMES= + export COLLECT_NAMES +fi +EOF + ;; + esac + + case $host_os in + cygwin* | mingw* | pw32* | os2*) + cat <<'EOF' >> "${ofile}T" + # This is a source program that is used to create dlls on Windows + # Don't remove nor modify the starting and closing comments +# /* ltdll.c starts here */ +# #define WIN32_LEAN_AND_MEAN +# #include +# #undef WIN32_LEAN_AND_MEAN +# #include +# +# #ifndef __CYGWIN__ +# # ifdef __CYGWIN32__ +# # define __CYGWIN__ __CYGWIN32__ +# # endif +# #endif +# +# #ifdef __cplusplus +# extern "C" { +# #endif +# BOOL APIENTRY DllMain (HINSTANCE hInst, DWORD reason, LPVOID reserved); +# #ifdef __cplusplus +# } +# #endif +# +# #ifdef __CYGWIN__ +# #include +# DECLARE_CYGWIN_DLL( DllMain ); +# #endif +# HINSTANCE __hDllInstance_base; +# +# BOOL APIENTRY +# DllMain (HINSTANCE hInst, DWORD reason, LPVOID reserved) +# { +# __hDllInstance_base = hInst; +# return TRUE; +# } +# /* ltdll.c ends here */ + # This is a source program that is used to create import libraries + # on Windows for dlls which lack them. Don't remove nor modify the + # starting and closing comments +# /* impgen.c starts here */ +# /* Copyright (C) 1999-2000 Free Software Foundation, Inc. +# +# This file is part of GNU libtool. +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. +# */ +# +# #include /* for printf() */ +# #include /* for open(), lseek(), read() */ +# #include /* for O_RDONLY, O_BINARY */ +# #include /* for strdup() */ +# +# /* O_BINARY isn't required (or even defined sometimes) under Unix */ +# #ifndef O_BINARY +# #define O_BINARY 0 +# #endif +# +# static unsigned int +# pe_get16 (fd, offset) +# int fd; +# int offset; +# { +# unsigned char b[2]; +# lseek (fd, offset, SEEK_SET); +# read (fd, b, 2); +# return b[0] + (b[1]<<8); +# } +# +# static unsigned int +# pe_get32 (fd, offset) +# int fd; +# int offset; +# { +# unsigned char b[4]; +# lseek (fd, offset, SEEK_SET); +# read (fd, b, 4); +# return b[0] + (b[1]<<8) + (b[2]<<16) + (b[3]<<24); +# } +# +# static unsigned int +# pe_as32 (ptr) +# void *ptr; +# { +# unsigned char *b = ptr; +# return b[0] + (b[1]<<8) + (b[2]<<16) + (b[3]<<24); +# } +# +# int +# main (argc, argv) +# int argc; +# char *argv[]; +# { +# int dll; +# unsigned long pe_header_offset, opthdr_ofs, num_entries, i; +# unsigned long export_rva, export_size, nsections, secptr, expptr; +# unsigned long name_rvas, nexp; +# unsigned char *expdata, *erva; +# char *filename, *dll_name; +# +# filename = argv[1]; +# +# dll = open(filename, O_RDONLY|O_BINARY); +# if (dll < 1) +# return 1; +# +# dll_name = filename; +# +# for (i=0; filename[i]; i++) +# if (filename[i] == '/' || filename[i] == '\\' || filename[i] == ':') +# dll_name = filename + i +1; +# +# pe_header_offset = pe_get32 (dll, 0x3c); +# opthdr_ofs = pe_header_offset + 4 + 20; +# num_entries = pe_get32 (dll, opthdr_ofs + 92); +# +# if (num_entries < 1) /* no exports */ +# return 1; +# +# export_rva = pe_get32 (dll, opthdr_ofs + 96); +# export_size = pe_get32 (dll, opthdr_ofs + 100); +# nsections = pe_get16 (dll, pe_header_offset + 4 +2); +# secptr = (pe_header_offset + 4 + 20 + +# pe_get16 (dll, pe_header_offset + 4 + 16)); +# +# expptr = 0; +# for (i = 0; i < nsections; i++) +# { +# char sname[8]; +# unsigned long secptr1 = secptr + 40 * i; +# unsigned long vaddr = pe_get32 (dll, secptr1 + 12); +# unsigned long vsize = pe_get32 (dll, secptr1 + 16); +# unsigned long fptr = pe_get32 (dll, secptr1 + 20); +# lseek(dll, secptr1, SEEK_SET); +# read(dll, sname, 8); +# if (vaddr <= export_rva && vaddr+vsize > export_rva) +# { +# expptr = fptr + (export_rva - vaddr); +# if (export_rva + export_size > vaddr + vsize) +# export_size = vsize - (export_rva - vaddr); +# break; +# } +# } +# +# expdata = (unsigned char*)malloc(export_size); +# lseek (dll, expptr, SEEK_SET); +# read (dll, expdata, export_size); +# erva = expdata - export_rva; +# +# nexp = pe_as32 (expdata+24); +# name_rvas = pe_as32 (expdata+32); +# +# printf ("EXPORTS\n"); +# for (i = 0; i> "${ofile}T" || (rm -f "${ofile}T"; exit 1) + + mv -f "${ofile}T" "$ofile" || \ + (rm -f "$ofile" && cp "${ofile}T" "$ofile" && rm -f "${ofile}T") + chmod +x "$ofile" +fi +## +## END FIXME + +# This can be used to rebuild libtool when needed +LIBTOOL_DEPS="$ac_aux_dir/ltmain.sh" + +# Always use our own libtool. +LIBTOOL='$(SHELL) $(top_builddir)/libtool' + +# Prevent multiple expansion + +ac_config_files="$ac_config_files Makefile pcre.h:pcre.in pcre-config:pcre-config.in RunTest:RunTest.in" +ac_config_commands="$ac_config_commands default" +cat >confcache <<\_ACEOF +# This file is a shell script that caches the results of configure +# tests run on this system so they can be shared between configure +# scripts and configure runs, see configure's option --config-cache. +# It is not useful on other systems. If it contains results you don't +# want to keep, you may remove or edit it. +# +# config.status only pays attention to the cache file if you give it +# the --recheck option to rerun configure. +# +# `ac_cv_env_foo' variables (set or unset) will be overriden when +# loading this file, other *unset* `ac_cv_foo' will be assigned the +# following values. + +_ACEOF + +# The following way of writing the cache mishandles newlines in values, +# but we know of no workaround that is simple, portable, and efficient. +# So, don't put newlines in cache variables' values. +# Ultrix sh set writes to stderr and can't be redirected directly, +# and sets the high bit in the cache file unless we assign to the vars. +{ + (set) 2>&1 | + case `(ac_space=' '; set | grep ac_space) 2>&1` in + *ac_space=\ *) + # `set' does not quote correctly, so add quotes (double-quote + # substitution turns \\\\ into \\, and sed turns \\ into \). + sed -n \ + "s/'/'\\\\''/g; + s/^\\([_$ac_cr_alnum]*_cv_[_$ac_cr_alnum]*\\)=\\(.*\\)/\\1='\\2'/p" + ;; + *) + # `set' quotes correctly as required by POSIX, so do not add quotes. + sed -n \ + "s/^\\([_$ac_cr_alnum]*_cv_[_$ac_cr_alnum]*\\)=\\(.*\\)/\\1=\\2/p" + ;; + esac; +} | + sed ' + t clear + : clear + s/^\([^=]*\)=\(.*[{}].*\)$/test "${\1+set}" = set || &/ + t end + /^ac_cv_env/!s/^\([^=]*\)=\(.*\)$/\1=${\1=\2}/ + : end' >>confcache +if cmp -s $cache_file confcache; then :; else + if test -w $cache_file; then + test "x$cache_file" != "x/dev/null" && echo "updating cache $cache_file" + cat confcache >$cache_file + else + echo "not updating unwritable cache $cache_file" + fi +fi +rm -f confcache + +test "x$prefix" = xNONE && prefix=$ac_default_prefix +# Let make expand exec_prefix. +test "x$exec_prefix" = xNONE && exec_prefix='${prefix}' + +# VPATH may cause trouble with some makes, so we remove $(srcdir), +# ${srcdir} and @srcdir@ from VPATH if srcdir is ".", strip leading and +# trailing colons and then remove the whole line if VPATH becomes empty +# (actually we leave an empty line to preserve line numbers). +if test "x$srcdir" = x.; then + ac_vpsub='/^[ ]*VPATH[ ]*=/{ +s/:*\$(srcdir):*/:/; +s/:*\${srcdir}:*/:/; +s/:*@srcdir@:*/:/; +s/^\([^=]*=[ ]*\):*/\1/; +s/:*$//; +s/^[^=]*=[ ]*$//; +}' +fi + +DEFS=-DHAVE_CONFIG_H + +: ${CONFIG_STATUS=./config.status} +ac_clean_files_save=$ac_clean_files +ac_clean_files="$ac_clean_files $CONFIG_STATUS" +{ echo "$as_me:6726: creating $CONFIG_STATUS" >&5 +echo "$as_me: creating $CONFIG_STATUS" >&6;} +cat >$CONFIG_STATUS <<_ACEOF +#! $SHELL +# Generated automatically by configure. +# Run this file to recreate the current configuration. +# Compiler output produced by configure, useful for debugging +# configure, is in config.log if it exists. + +debug=false +SHELL=\${CONFIG_SHELL-$SHELL} +ac_cs_invocation="\$0 \$@" + +_ACEOF + +cat >>$CONFIG_STATUS <<\_ACEOF +# Be Bourne compatible +if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then + emulate sh + NULLCMD=: +elif test -n "${BASH_VERSION+set}" && (set -o posix) >/dev/null 2>&1; then + set -o posix +fi + +# Name of the executable. +as_me=`echo "$0" |sed 's,.*[\\/],,'` + +if expr a : '\(a\)' >/dev/null 2>&1; then + as_expr=expr +else + as_expr=false +fi + +rm -f conf$$ conf$$.exe conf$$.file +echo >conf$$.file +if ln -s conf$$.file conf$$ 2>/dev/null; then + # We could just check for DJGPP; but this test a) works b) is more generic + # and c) will remain valid once DJGPP supports symlinks (DJGPP 2.04). + if test -f conf$$.exe; then + # Don't use ln at all; we don't have any links + as_ln_s='cp -p' + else + as_ln_s='ln -s' + fi +elif ln conf$$.file conf$$ 2>/dev/null; then + as_ln_s=ln +else + as_ln_s='cp -p' +fi +rm -f conf$$ conf$$.exe conf$$.file + +as_executable_p="test -f" + +# Support unset when possible. +if (FOO=FOO; unset FOO) >/dev/null 2>&1; then + as_unset=unset +else + as_unset=false +fi + +# NLS nuisances. +$as_unset LANG || test "${LANG+set}" != set || { LANG=C; export LANG; } +$as_unset LC_ALL || test "${LC_ALL+set}" != set || { LC_ALL=C; export LC_ALL; } +$as_unset LC_TIME || test "${LC_TIME+set}" != set || { LC_TIME=C; export LC_TIME; } +$as_unset LC_CTYPE || test "${LC_CTYPE+set}" != set || { LC_CTYPE=C; export LC_CTYPE; } +$as_unset LANGUAGE || test "${LANGUAGE+set}" != set || { LANGUAGE=C; export LANGUAGE; } +$as_unset LC_COLLATE || test "${LC_COLLATE+set}" != set || { LC_COLLATE=C; export LC_COLLATE; } +$as_unset LC_NUMERIC || test "${LC_NUMERIC+set}" != set || { LC_NUMERIC=C; export LC_NUMERIC; } +$as_unset LC_MESSAGES || test "${LC_MESSAGES+set}" != set || { LC_MESSAGES=C; export LC_MESSAGES; } + +# IFS +# We need space, tab and new line, in precisely that order. +as_nl=' +' +IFS=" $as_nl" + +# CDPATH. +$as_unset CDPATH || test "${CDPATH+set}" != set || { CDPATH=:; export CDPATH; } + +exec 6>&1 + +_ACEOF + +# Files that config.status was made for. +if test -n "$ac_config_files"; then + echo "config_files=\"$ac_config_files\"" >>$CONFIG_STATUS +fi + +if test -n "$ac_config_headers"; then + echo "config_headers=\"$ac_config_headers\"" >>$CONFIG_STATUS +fi + +if test -n "$ac_config_links"; then + echo "config_links=\"$ac_config_links\"" >>$CONFIG_STATUS +fi + +if test -n "$ac_config_commands"; then + echo "config_commands=\"$ac_config_commands\"" >>$CONFIG_STATUS +fi + +cat >>$CONFIG_STATUS <<\EOF + +ac_cs_usage="\ +\`$as_me' instantiates files from templates according to the +current configuration. + +Usage: $0 [OPTIONS] [FILE]... + + -h, --help print this help, then exit + -V, --version print version number, then exit + -d, --debug don't remove temporary files + --recheck update $as_me by reconfiguring in the same conditions + --file=FILE[:TEMPLATE] + instantiate the configuration file FILE + --header=FILE[:TEMPLATE] + instantiate the configuration header FILE + +Configuration files: +$config_files + +Configuration headers: +$config_headers + +Configuration commands: +$config_commands + +Report bugs to ." +EOF + +cat >>$CONFIG_STATUS <>$CONFIG_STATUS <<\EOF +# If no file are specified by the user, then we need to provide default +# value. By we need to know if files were specified by the user. +ac_need_defaults=: +while test $# != 0 +do + case $1 in + --*=*) + ac_option=`expr "x$1" : 'x\([^=]*\)='` + ac_optarg=`expr "x$1" : 'x[^=]*=\(.*\)'` + shift + set dummy "$ac_option" "$ac_optarg" ${1+"$@"} + shift + ;; + -*);; + *) # This is not an option, so the user has probably given explicit + # arguments. + ac_need_defaults=false;; + esac + + case $1 in + # Handling of the options. +EOF +cat >>$CONFIG_STATUS <>$CONFIG_STATUS <<\EOF + --version | --vers* | -V ) + echo "$ac_cs_version"; exit 0 ;; + --he | --h) + # Conflict between --help and --header + { { echo "$as_me:6902: error: ambiguous option: $1 +Try \`$0 --help' for more information." >&5 +echo "$as_me: error: ambiguous option: $1 +Try \`$0 --help' for more information." >&2;} + { (exit 1); exit 1; }; };; + --help | --hel | -h ) + echo "$ac_cs_usage"; exit 0 ;; + --debug | --d* | -d ) + debug=: ;; + --file | --fil | --fi | --f ) + shift + CONFIG_FILES="$CONFIG_FILES $1" + ac_need_defaults=false;; + --header | --heade | --head | --hea ) + shift + CONFIG_HEADERS="$CONFIG_HEADERS $1" + ac_need_defaults=false;; + + # Handling of arguments. + 'Makefile' ) CONFIG_FILES="$CONFIG_FILES Makefile" ;; + 'pcre.h' ) CONFIG_FILES="$CONFIG_FILES pcre.h:pcre.in" ;; + 'pcre-config' ) CONFIG_FILES="$CONFIG_FILES pcre-config:pcre-config.in" ;; + 'RunTest' ) CONFIG_FILES="$CONFIG_FILES RunTest:RunTest.in" ;; + 'default' ) CONFIG_COMMANDS="$CONFIG_COMMANDS default" ;; + 'config.h' ) CONFIG_HEADERS="$CONFIG_HEADERS config.h:config.in" ;; + + # This is an error. + -*) { { echo "$as_me:6929: error: unrecognized option: $1 +Try \`$0 --help' for more information." >&5 +echo "$as_me: error: unrecognized option: $1 +Try \`$0 --help' for more information." >&2;} + { (exit 1); exit 1; }; } ;; + *) { { echo "$as_me:6934: error: invalid argument: $1" >&5 +echo "$as_me: error: invalid argument: $1" >&2;} + { (exit 1); exit 1; }; };; + esac + shift +done + +exec 5>>config.log +cat >&5 << _ACEOF + +## ----------------------- ## +## Running config.status. ## +## ----------------------- ## + +This file was extended by $as_me 2.50, executed with + > $ac_cs_invocation +on `(hostname || uname -n) 2>/dev/null | sed 1q` + +_ACEOF +EOF + +cat >>$CONFIG_STATUS <<\EOF +# If the user did not use the arguments to specify the items to instantiate, +# then the envvar interface is used. Set only those that are not. +# We use the long form for the default assignment because of an extremely +# bizarre bug on SunOS 4.1.3. +if $ac_need_defaults; then + test "${CONFIG_FILES+set}" = set || CONFIG_FILES=$config_files + test "${CONFIG_HEADERS+set}" = set || CONFIG_HEADERS=$config_headers + test "${CONFIG_COMMANDS+set}" = set || CONFIG_COMMANDS=$config_commands +fi + +# Create a temporary directory, and hook for its removal unless debugging. +$debug || +{ + trap 'exit_status=$?; rm -rf $tmp && exit $exit_status' 0 + trap '{ (exit $?); exit $?; }' 1 2 13 15 +} + +# Create a (secure) tmp directory for tmp files. +: ${TMPDIR=/tmp} +{ + tmp=`(umask 077 && mktemp -d -q "$TMPDIR/csXXXXXX") 2>/dev/null` && + test -n "$tmp" && test -d "$tmp" +} || +{ + tmp=$TMPDIR/cs$$-$RANDOM + (umask 077 && mkdir $tmp) +} || +{ + echo "$me: cannot create a temporary directory in $TMPDIR" >&2 + { (exit 1); exit 1; } +} + +EOF + +cat >>$CONFIG_STATUS <\$tmp/subs.sed <<\\CEOF +s,@SHELL@,$SHELL,;t t +s,@exec_prefix@,$exec_prefix,;t t +s,@prefix@,$prefix,;t t +s,@program_transform_name@,$program_transform_name,;t t +s,@bindir@,$bindir,;t t +s,@sbindir@,$sbindir,;t t +s,@libexecdir@,$libexecdir,;t t +s,@datadir@,$datadir,;t t +s,@sysconfdir@,$sysconfdir,;t t +s,@sharedstatedir@,$sharedstatedir,;t t +s,@localstatedir@,$localstatedir,;t t +s,@libdir@,$libdir,;t t +s,@includedir@,$includedir,;t t +s,@oldincludedir@,$oldincludedir,;t t +s,@infodir@,$infodir,;t t +s,@mandir@,$mandir,;t t +s,@PACKAGE_NAME@,$PACKAGE_NAME,;t t +s,@PACKAGE_TARNAME@,$PACKAGE_TARNAME,;t t +s,@PACKAGE_VERSION@,$PACKAGE_VERSION,;t t +s,@PACKAGE_STRING@,$PACKAGE_STRING,;t t +s,@PACKAGE_BUGREPORT@,$PACKAGE_BUGREPORT,;t t +s,@ECHO_C@,$ECHO_C,;t t +s,@ECHO_N@,$ECHO_N,;t t +s,@ECHO_T@,$ECHO_T,;t t +s,@PATH_SEPARATOR@,$PATH_SEPARATOR,;t t +s,@DEFS@,$DEFS,;t t +s,@LIBS@,$LIBS,;t t +s,@CC@,$CC,;t t +s,@CFLAGS@,$CFLAGS,;t t +s,@LDFLAGS@,$LDFLAGS,;t t +s,@CPPFLAGS@,$CPPFLAGS,;t t +s,@ac_ct_CC@,$ac_ct_CC,;t t +s,@EXEEXT@,$EXEEXT,;t t +s,@OBJEXT@,$OBJEXT,;t t +s,@INSTALL_PROGRAM@,$INSTALL_PROGRAM,;t t +s,@INSTALL_SCRIPT@,$INSTALL_SCRIPT,;t t +s,@INSTALL_DATA@,$INSTALL_DATA,;t t +s,@RANLIB@,$RANLIB,;t t +s,@ac_ct_RANLIB@,$ac_ct_RANLIB,;t t +s,@CPP@,$CPP,;t t +s,@build@,$build,;t t +s,@build_cpu@,$build_cpu,;t t +s,@build_vendor@,$build_vendor,;t t +s,@build_os@,$build_os,;t t +s,@host@,$host,;t t +s,@host_cpu@,$host_cpu,;t t +s,@host_vendor@,$host_vendor,;t t +s,@host_os@,$host_os,;t t +s,@LN_S@,$LN_S,;t t +s,@ECHO@,$ECHO,;t t +s,@STRIP@,$STRIP,;t t +s,@ac_ct_STRIP@,$ac_ct_STRIP,;t t +s,@LIBTOOL@,$LIBTOOL,;t t +s,@HAVE_MEMMOVE@,$HAVE_MEMMOVE,;t t +s,@HAVE_STRERROR@,$HAVE_STRERROR,;t t +s,@NEWLINE@,$NEWLINE,;t t +s,@UTF8@,$UTF8,;t t +s,@PCRE_MAJOR@,$PCRE_MAJOR,;t t +s,@PCRE_MINOR@,$PCRE_MINOR,;t t +s,@PCRE_DATE@,$PCRE_DATE,;t t +s,@PCRE_VERSION@,$PCRE_VERSION,;t t +s,@PCRE_LIB_VERSION@,$PCRE_LIB_VERSION,;t t +s,@PCRE_POSIXLIB_VERSION@,$PCRE_POSIXLIB_VERSION,;t t +CEOF + +EOF + + cat >>$CONFIG_STATUS <<\EOF + # Split the substitutions into bite-sized pieces for seds with + # small command number limits, like on Digital OSF/1 and HP-UX. + ac_max_sed_lines=48 + ac_sed_frag=1 # Number of current file. + ac_beg=1 # First line for current file. + ac_end=$ac_max_sed_lines # Line after last line for current file. + ac_more_lines=: + ac_sed_cmds= + while $ac_more_lines; do + if test $ac_beg -gt 1; then + sed "1,${ac_beg}d; ${ac_end}q" $tmp/subs.sed >$tmp/subs.frag + else + sed "${ac_end}q" $tmp/subs.sed >$tmp/subs.frag + fi + if test ! -s $tmp/subs.frag; then + ac_more_lines=false + else + # The purpose of the label and of the branching condition is to + # speed up the sed processing (if there are no `@' at all, there + # is no need to browse any of the substitutions). + # These are the two extra sed commands mentioned above. + (echo ':t + /@[a-zA-Z_][a-zA-Z_0-9]*@/!b' && cat $tmp/subs.frag) >$tmp/subs-$ac_sed_frag.sed + if test -z "$ac_sed_cmds"; then + ac_sed_cmds="sed -f $tmp/subs-$ac_sed_frag.sed" + else + ac_sed_cmds="$ac_sed_cmds | sed -f $tmp/subs-$ac_sed_frag.sed" + fi + ac_sed_frag=`expr $ac_sed_frag + 1` + ac_beg=$ac_end + ac_end=`expr $ac_end + $ac_max_sed_lines` + fi + done + if test -z "$ac_sed_cmds"; then + ac_sed_cmds=cat + fi +fi # test -n "$CONFIG_FILES" + +EOF +cat >>$CONFIG_STATUS <<\EOF +for ac_file in : $CONFIG_FILES; do test "x$ac_file" = x: && continue + # Support "outfile[:infile[:infile...]]", defaulting infile="outfile.in". + case $ac_file in + - | *:- | *:-:* ) # input from stdin + cat >$tmp/stdin + ac_file_in=`echo "$ac_file" | sed 's,[^:]*:,,'` + ac_file=`echo "$ac_file" | sed 's,:.*,,'` ;; + *:* ) ac_file_in=`echo "$ac_file" | sed 's,[^:]*:,,'` + ac_file=`echo "$ac_file" | sed 's,:.*,,'` ;; + * ) ac_file_in=$ac_file.in ;; + esac + + # Compute @srcdir@, @top_srcdir@, and @INSTALL@ for subdirectories. + ac_dir=`$as_expr X"$ac_file" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ + X"$ac_file" : 'X\(//\)[^/]' \| \ + X"$ac_file" : 'X\(//\)$' \| \ + X"$ac_file" : 'X\(/\)' \| \ + . : '\(.\)' 2>/dev/null || +echo X"$ac_file" | + sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/; q; } + /^X\(\/\/\)[^/].*/{ s//\1/; q; } + /^X\(\/\/\)$/{ s//\1/; q; } + /^X\(\/\).*/{ s//\1/; q; } + s/.*/./; q'` + if test "$ac_dir" != "$ac_file" && test "$ac_dir" != .; then + { case "$ac_dir" in + [\\/]* | ?:[\\/]* ) as_incr_dir=;; + *) as_incr_dir=.;; +esac +as_dummy="$ac_dir" +for as_mkdir_dir in `IFS='/\\'; set X $as_dummy; shift; echo "$@"`; do + case $as_mkdir_dir in + # Skip DOS drivespec + ?:) as_incr_dir=$as_mkdir_dir ;; + *) + as_incr_dir=$as_incr_dir/$as_mkdir_dir + test -d "$as_incr_dir" || mkdir "$as_incr_dir" + ;; + esac +done; } + + ac_dir_suffix="/`echo $ac_dir|sed 's,^\./,,'`" + # A "../" for each directory in $ac_dir_suffix. + ac_dots=`echo "$ac_dir_suffix" | sed 's,/[^/]*,../,g'` + else + ac_dir_suffix= ac_dots= + fi + + case $srcdir in + .) ac_srcdir=. + if test -z "$ac_dots"; then + ac_top_srcdir=. + else + ac_top_srcdir=`echo $ac_dots | sed 's,/$,,'` + fi ;; + [\\/]* | ?:[\\/]* ) + ac_srcdir=$srcdir$ac_dir_suffix; + ac_top_srcdir=$srcdir ;; + *) # Relative path. + ac_srcdir=$ac_dots$srcdir$ac_dir_suffix + ac_top_srcdir=$ac_dots$srcdir ;; + esac + + case $INSTALL in + [\\/$]* | ?:[\\/]* ) ac_INSTALL=$INSTALL ;; + *) ac_INSTALL=$ac_dots$INSTALL ;; + esac + + if test x"$ac_file" != x-; then + { echo "$as_me:7179: creating $ac_file" >&5 +echo "$as_me: creating $ac_file" >&6;} + rm -f "$ac_file" + fi + # Let's still pretend it is `configure' which instantiates (i.e., don't + # use $as_me), people would be surprised to read: + # /* config.h. Generated automatically by config.status. */ + configure_input="Generated automatically from `echo $ac_file_in | + sed 's,.*/,,'` by configure." + + # First look for the input files in the build tree, otherwise in the + # src tree. + ac_file_inputs=`IFS=: + for f in $ac_file_in; do + case $f in + -) echo $tmp/stdin ;; + [\\/$]*) + # Absolute (can't be DOS-style, as IFS=:) + test -f "$f" || { { echo "$as_me:7197: error: cannot find input file: $f" >&5 +echo "$as_me: error: cannot find input file: $f" >&2;} + { (exit 1); exit 1; }; } + echo $f;; + *) # Relative + if test -f "$f"; then + # Build tree + echo $f + elif test -f "$srcdir/$f"; then + # Source tree + echo $srcdir/$f + else + # /dev/null tree + { { echo "$as_me:7210: error: cannot find input file: $f" >&5 +echo "$as_me: error: cannot find input file: $f" >&2;} + { (exit 1); exit 1; }; } + fi;; + esac + done` || { (exit 1); exit 1; } +EOF +cat >>$CONFIG_STATUS <>$CONFIG_STATUS <<\EOF +:t +/@[a-zA-Z_][a-zA-Z_0-9]*@/!b +s,@configure_input@,$configure_input,;t t +s,@srcdir@,$ac_srcdir,;t t +s,@top_srcdir@,$ac_top_srcdir,;t t +s,@INSTALL@,$ac_INSTALL,;t t +" $ac_file_inputs | (eval "$ac_sed_cmds") >$tmp/out + rm -f $tmp/stdin + if test x"$ac_file" != x-; then + mv $tmp/out $ac_file + else + cat $tmp/out + rm -f $tmp/out + fi + +done +EOF +cat >>$CONFIG_STATUS <<\EOF + +# +# CONFIG_HEADER section. +# + +# These sed commands are passed to sed as "A NAME B NAME C VALUE D", where +# NAME is the cpp macro being defined and VALUE is the value it is being given. +# +# ac_d sets the value in "#define NAME VALUE" lines. +ac_dA='s,^\([ ]*\)#\([ ]*define[ ][ ]*\)' +ac_dB='[ ].*$,\1#\2' +ac_dC=' ' +ac_dD=',;t' +# ac_u turns "#undef NAME" without trailing blanks into "#define NAME VALUE". +ac_uA='s,^\([ ]*\)#\([ ]*\)undef\([ ][ ]*\)' +ac_uB='$,\1#\2define\3' +ac_uC=' ' +ac_uD=',;t' + +for ac_file in : $CONFIG_HEADERS; do test "x$ac_file" = x: && continue + # Support "outfile[:infile[:infile...]]", defaulting infile="outfile.in". + case $ac_file in + - | *:- | *:-:* ) # input from stdin + cat >$tmp/stdin + ac_file_in=`echo "$ac_file" | sed 's,[^:]*:,,'` + ac_file=`echo "$ac_file" | sed 's,:.*,,'` ;; + *:* ) ac_file_in=`echo "$ac_file" | sed 's,[^:]*:,,'` + ac_file=`echo "$ac_file" | sed 's,:.*,,'` ;; + * ) ac_file_in=$ac_file.in ;; + esac + + test x"$ac_file" != x- && { echo "$as_me:7271: creating $ac_file" >&5 +echo "$as_me: creating $ac_file" >&6;} + + # First look for the input files in the build tree, otherwise in the + # src tree. + ac_file_inputs=`IFS=: + for f in $ac_file_in; do + case $f in + -) echo $tmp/stdin ;; + [\\/$]*) + # Absolute (can't be DOS-style, as IFS=:) + test -f "$f" || { { echo "$as_me:7282: error: cannot find input file: $f" >&5 +echo "$as_me: error: cannot find input file: $f" >&2;} + { (exit 1); exit 1; }; } + echo $f;; + *) # Relative + if test -f "$f"; then + # Build tree + echo $f + elif test -f "$srcdir/$f"; then + # Source tree + echo $srcdir/$f + else + # /dev/null tree + { { echo "$as_me:7295: error: cannot find input file: $f" >&5 +echo "$as_me: error: cannot find input file: $f" >&2;} + { (exit 1); exit 1; }; } + fi;; + esac + done` || { (exit 1); exit 1; } + # Remove the trailing spaces. + sed 's/[ ]*$//' $ac_file_inputs >$tmp/in + +EOF + +# Transform confdefs.h into two sed scripts, `conftest.defines' and +# `conftest.undefs', that substitutes the proper values into +# config.h.in to produce config.h. The first handles `#define' +# templates, and the second `#undef' templates. +# And first: Protect against being on the right side of a sed subst in +# config.status. Protect against being in an unquoted here document +# in config.status. +rm -f conftest.defines conftest.undefs +# Using a here document instead of a string reduces the quoting nightmare. +# Putting comments in sed scripts is not portable. +# +# `end' is used to avoid that the second main sed command (meant for +# 0-ary CPP macros) applies to n-ary macro definitions. +# See the Autoconf documentation for `clear'. +cat >confdef2sed.sed <<\EOF +s/[\\&,]/\\&/g +s,[\\$`],\\&,g +t clear +: clear +s,^[ ]*#[ ]*define[ ][ ]*\(\([^ (][^ (]*\)([^)]*)\)[ ]*\(.*\)$,${ac_dA}\2${ac_dB}\1${ac_dC}\3${ac_dD},gp +t end +s,^[ ]*#[ ]*define[ ][ ]*\([^ ][^ ]*\)[ ]*\(.*\)$,${ac_dA}\1${ac_dB}\1${ac_dC}\2${ac_dD},gp +: end +EOF +# If some macros were called several times there might be several times +# the same #defines, which is useless. Nevertheless, we may not want to +# sort them, since we want the *last* AC-DEFINE to be honored. +uniq confdefs.h | sed -n -f confdef2sed.sed >conftest.defines +sed 's/ac_d/ac_u/g' conftest.defines >conftest.undefs +rm -f confdef2sed.sed + +# This sed command replaces #undef with comments. This is necessary, for +# example, in the case of _POSIX_SOURCE, which is predefined and required +# on some systems where configure will not decide to define it. +cat >>conftest.undefs <<\EOF +s,^[ ]*#[ ]*undef[ ][ ]*[a-zA-Z_][a-zA-Z_0-9]*,/* & */, +EOF + +# Break up conftest.defines because some shells have a limit on the size +# of here documents, and old seds have small limits too (100 cmds). +echo ' # Handle all the #define templates only if necessary.' >>$CONFIG_STATUS +echo ' if egrep "^[ ]*#[ ]*define" $tmp/in >/dev/null; then' >>$CONFIG_STATUS +echo ' # If there are no defines, we may have an empty if/fi' >>$CONFIG_STATUS +echo ' :' >>$CONFIG_STATUS +rm -f conftest.tail +while grep . conftest.defines >/dev/null +do + # Write a limited-size here document to $tmp/defines.sed. + echo ' cat >$tmp/defines.sed <>$CONFIG_STATUS + # Speed up: don't consider the non `#define' lines. + echo '/^[ ]*#[ ]*define/!b' >>$CONFIG_STATUS + # Work around the forget-to-reset-the-flag bug. + echo 't clr' >>$CONFIG_STATUS + echo ': clr' >>$CONFIG_STATUS + sed ${ac_max_here_lines}q conftest.defines >>$CONFIG_STATUS + echo 'CEOF + sed -f $tmp/defines.sed $tmp/in >$tmp/out + rm -f $tmp/in + mv $tmp/out $tmp/in +' >>$CONFIG_STATUS + sed 1,${ac_max_here_lines}d conftest.defines >conftest.tail + rm -f conftest.defines + mv conftest.tail conftest.defines +done +rm -f conftest.defines +echo ' fi # egrep' >>$CONFIG_STATUS +echo >>$CONFIG_STATUS + +# Break up conftest.undefs because some shells have a limit on the size +# of here documents, and old seds have small limits too (100 cmds). +echo ' # Handle all the #undef templates' >>$CONFIG_STATUS +rm -f conftest.tail +while grep . conftest.undefs >/dev/null +do + # Write a limited-size here document to $tmp/undefs.sed. + echo ' cat >$tmp/undefs.sed <>$CONFIG_STATUS + # Speed up: don't consider the non `#undef' + echo '/^[ ]*#[ ]*undef/!b' >>$CONFIG_STATUS + # Work around the forget-to-reset-the-flag bug. + echo 't clr' >>$CONFIG_STATUS + echo ': clr' >>$CONFIG_STATUS + sed ${ac_max_here_lines}q conftest.undefs >>$CONFIG_STATUS + echo 'CEOF + sed -f $tmp/undefs.sed $tmp/in >$tmp/out + rm -f $tmp/in + mv $tmp/out $tmp/in +' >>$CONFIG_STATUS + sed 1,${ac_max_here_lines}d conftest.undefs >conftest.tail + rm -f conftest.undefs + mv conftest.tail conftest.undefs +done +rm -f conftest.undefs + +cat >>$CONFIG_STATUS <<\EOF + # Let's still pretend it is `configure' which instantiates (i.e., don't + # use $as_me), people would be surprised to read: + # /* config.h. Generated automatically by config.status. */ + if test x"$ac_file" = x-; then + echo "/* Generated automatically by configure. */" >$tmp/config.h + else + echo "/* $ac_file. Generated automatically by configure. */" >$tmp/config.h + fi + cat $tmp/in >>$tmp/config.h + rm -f $tmp/in + if test x"$ac_file" != x-; then + if cmp -s $ac_file $tmp/config.h 2>/dev/null; then + { echo "$as_me:7412: $ac_file is unchanged" >&5 +echo "$as_me: $ac_file is unchanged" >&6;} + else + ac_dir=`$as_expr X"$ac_file" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ + X"$ac_file" : 'X\(//\)[^/]' \| \ + X"$ac_file" : 'X\(//\)$' \| \ + X"$ac_file" : 'X\(/\)' \| \ + . : '\(.\)' 2>/dev/null || +echo X"$ac_file" | + sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/; q; } + /^X\(\/\/\)[^/].*/{ s//\1/; q; } + /^X\(\/\/\)$/{ s//\1/; q; } + /^X\(\/\).*/{ s//\1/; q; } + s/.*/./; q'` + if test "$ac_dir" != "$ac_file" && test "$ac_dir" != .; then + { case "$ac_dir" in + [\\/]* | ?:[\\/]* ) as_incr_dir=;; + *) as_incr_dir=.;; +esac +as_dummy="$ac_dir" +for as_mkdir_dir in `IFS='/\\'; set X $as_dummy; shift; echo "$@"`; do + case $as_mkdir_dir in + # Skip DOS drivespec + ?:) as_incr_dir=$as_mkdir_dir ;; + *) + as_incr_dir=$as_incr_dir/$as_mkdir_dir + test -d "$as_incr_dir" || mkdir "$as_incr_dir" + ;; + esac +done; } + + fi + rm -f $ac_file + mv $tmp/config.h $ac_file + fi + else + cat $tmp/config.h + rm -f $tmp/config.h + fi +done +EOF +cat >>$CONFIG_STATUS <<\EOF + +# +# CONFIG_COMMANDS section. +# +for ac_file in : $CONFIG_COMMANDS; do test "x$ac_file" = x: && continue + ac_dest=`echo "$ac_file" | sed 's,:.*,,'` + ac_source=`echo "$ac_file" | sed 's,[^:]*:,,'` + + case $ac_dest in + default ) chmod a+x RunTest pcre-config ;; + esac +done +EOF + +cat >>$CONFIG_STATUS <<\EOF + +{ (exit 0); exit 0; } +EOF +chmod +x $CONFIG_STATUS +ac_clean_files=$ac_clean_files_save + +# configure is writing to config.log, and then calls config.status. +# config.status does its own redirection, appending to config.log. +# Unfortunately, on DOS this fails, as config.log is still kept open +# by configure, so config.status won't be able to write to it; its +# output is simply discarded. So we exec the FD to /dev/null, +# effectively closing config.log, so it can be properly (re)opened and +# appended to by config.status. When coming back to configure, we +# need to make the FD available again. +if test "$no_create" != yes; then + ac_cs_success=: + exec 5>/dev/null + $SHELL $CONFIG_STATUS || ac_cs_success=false + exec 5>>config.log + # Use ||, not &&, to avoid exiting from the if with $? = 1, which + # would make configure fail if this is the last instruction. + $ac_cs_success || { (exit 1); exit 1; } +fi + diff --git a/srclib/pcre/dftables.dsp b/srclib/pcre/dftables.dsp deleted file mode 100644 index c2955cbf08e7879a3c653415d17e49438f193b97..0000000000000000000000000000000000000000 --- a/srclib/pcre/dftables.dsp +++ /dev/null @@ -1,160 +0,0 @@ -# Microsoft Developer Studio Project File - Name="dftables" - Package Owner=<4> -# Microsoft Developer Studio Generated Build File, Format Version 5.00 -# ** DO NOT EDIT ** - -# TARGTYPE "Win32 (x86) Console Application" 0x0103 - -CFG=dftables - Win32 Debug -!MESSAGE This is not a valid makefile. To build this project using NMAKE, -!MESSAGE use the Export Makefile command and run -!MESSAGE -!MESSAGE NMAKE /f "dftables.mak". -!MESSAGE -!MESSAGE You can specify a configuration when running NMAKE -!MESSAGE by defining the macro CFG on the command line. For example: -!MESSAGE -!MESSAGE NMAKE /f "dftables.mak" CFG="dftables - Win32 Debug" -!MESSAGE -!MESSAGE Possible choices for configuration are: -!MESSAGE -!MESSAGE "dftables - Win32 Release" (based on\ - "Win32 (x86) Console Application") -!MESSAGE "dftables - Win32 Debug" (based on "Win32 (x86) Console Application") -!MESSAGE - -# Begin Project -# PROP Scc_ProjName "" -# PROP Scc_LocalPath "" -CPP=cl.exe -RSC=rc.exe - -!IF "$(CFG)" == "dftables - Win32 Release" - -# PROP BASE Use_MFC 0 -# PROP BASE Use_Debug_Libraries 0 -# PROP BASE Output_Dir "Release" -# PROP BASE Intermediate_Dir "Release" -# PROP BASE Target_Dir "" -# PROP Use_MFC 0 -# PROP Use_Debug_Libraries 0 -# PROP Output_Dir "" -# PROP Intermediate_Dir "dftables_R" -# PROP Ignore_Export_Lib 0 -# PROP Target_Dir "" -# ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /FD /c -# ADD CPP /nologo /MD /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /FD /c -# ADD BASE RSC /l 0x809 /d "NDEBUG" -# ADD RSC /l 0x809 /d "NDEBUG" -BSC32=bscmake.exe -# ADD BASE BSC32 /nologo -# ADD BSC32 /nologo -LINK32=link.exe -# ADD BASE LINK32 kernel32.lib /nologo /subsystem:console /machine:I386 -# ADD LINK32 kernel32.lib /nologo /subsystem:console /pdb:none /machine:I386 - -!ELSEIF "$(CFG)" == "dftables - Win32 Debug" - -# PROP BASE Use_MFC 0 -# PROP BASE Use_Debug_Libraries 1 -# PROP BASE Output_Dir "Debug" -# PROP BASE Intermediate_Dir "Debug" -# PROP BASE Target_Dir "" -# PROP Use_MFC 0 -# PROP Use_Debug_Libraries 1 -# PROP Output_Dir "" -# PROP Intermediate_Dir "dftables_D" -# PROP Ignore_Export_Lib 0 -# PROP Target_Dir "" -# ADD BASE CPP /nologo /W3 /Gm /GX /Zi /Od /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /FD /c -# ADD CPP /nologo /MDd /W3 /Gm /GX- /Zi /Od /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /FD /c -# ADD BASE RSC /l 0x809 /d "_DEBUG" -# ADD RSC /l 0x809 /d "_DEBUG" -BSC32=bscmake.exe -# ADD BASE BSC32 /nologo -# ADD BSC32 /nologo -LINK32=link.exe -# ADD BASE LINK32 kernel32.lib /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept -# ADD LINK32 kernel32.lib /nologo /subsystem:console /pdb:none /debug /machine:I386 - -!ENDIF - -# Begin Target - -# Name "dftables - Win32 Release" -# Name "dftables - Win32 Debug" -# Begin Group "Source Files" - -# PROP Default_Filter "" -# Begin Source File - -SOURCE=.\dftables.c -# End Source File -# End Group -# Begin Group "Header Files" - -# PROP Default_Filter "h;hw" -# Begin Source File - -SOURCE=.\config.hw - -!IF "$(CFG)" == "dftables - Win32 Release" - -# Begin Custom Build -InputPath=.\config.hw - -".\config.h" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)" - echo Creating pcre config.h from config.hw - copy .\config.hw .\config.h - -# End Custom Build - -!ELSEIF "$(CFG)" == "dftables - Win32 Debug" - -# Begin Custom Build -InputPath=.\config.hw - -".\config.h" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)" - echo Creating pcre config.h from config.hw - copy .\config.hw .\config.h - -# End Custom Build - -!ENDIF - -# End Source File -# Begin Source File - -SOURCE=.\internal.h -# End Source File -# Begin Source File - -SOURCE=.\pcre.hw - -!IF "$(CFG)" == "dftables - Win32 Release" - -# Begin Custom Build -InputPath=.\pcre.hw - -".\pcre.h" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)" - echo Creating pcre.h from pcre.hw - copy .\pcre.hw .\pcre.h - -# End Custom Build - -!ELSEIF "$(CFG)" == "dftables - Win32 Debug" - -# Begin Custom Build -InputPath=.\pcre.hw - -".\pcre.h" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)" - echo Creating pcre.h from pcre.hw - copy .\pcre.hw .\pcre.h - -# End Custom Build - -!ENDIF - -# End Source File -# End Group -# End Target -# End Project diff --git a/srclib/pcre/doc/pgrep.1 b/srclib/pcre/doc/pgrep.1 deleted file mode 100644 index d9e9b575e01ff81251b5609f195a1821f0a0d5b8..0000000000000000000000000000000000000000 --- a/srclib/pcre/doc/pgrep.1 +++ /dev/null @@ -1,76 +0,0 @@ -.TH PGREP 1 -.SH NAME -pgrep - a grep with Perl-compatible regular expressions. -.SH SYNOPSIS -.B pgrep [-Vchilnsvx] pattern [file] ... - - -.SH DESCRIPTION -\fBpgrep\fR searches files for character patterns, in the same way as other -grep commands do, but it uses the PCRE regular expression library to support -patterns that are compatible with the regular expressions of Perl 5. See -\fBpcre(3)\fR for a full description of syntax and semantics. - -If no files are specified, \fBpgrep\fR reads the standard input. By default, -each line that matches the pattern is copied to the standard output, and if -there is more than one file, the file name is printed before each line of -output. However, there are options that can change how \fBpgrep\fR behaves. - -Lines are limited to BUFSIZ characters. BUFSIZ is defined in \fB\fR. -The newline character is removed from the end of each line before it is matched -against the pattern. - - -.SH OPTIONS -.TP 10 -\fB-V\fR -Write the version number of the PCRE library being used to the standard error -stream. -.TP -\fB-c\fR -Do not print individual lines; instead just print a count of the number of -lines that would otherwise have been printed. If several files are given, a -count is printed for each of them. -.TP -\fB-h\fR -Suppress printing of filenames when searching multiple files. -.TP -\fB-i\fR -Ignore upper/lower case distinctions during comparisons. -.TP -\fB-l\fR -Instead of printing lines from the files, just print the names of the files -containing lines that would have been printed. Each file name is printed -once, on a separate line. -.TP -\fB-n\fR -Precede each line by its line number in the file. -.TP -\fB-s\fR -Work silently, that is, display nothing except error messages. -The exit status indicates whether any matches were found. -.TP -\fB-v\fR -Invert the sense of the match, so that lines which do \fInot\fR match the -pattern are now the ones that are found. -.TP -\fB-x\fR -Force the pattern to be anchored (it must start matching at the beginning of -the line) and in addition, require it to match the entire line. This is -equivalent to having ^ and $ characters at the start and end of each -alternative branch in the regular expression. - - -.SH SEE ALSO -\fBpcre(3)\fR, Perl 5 documentation - - -.SH DIAGNOSTICS -Exit status is 0 if any matches were found, 1 if no matches were found, and 2 -for syntax errors or inacessible files (even if matches were found). - - -.SH AUTHOR -Philip Hazel -.br -Copyright (c) 1997-1999 University of Cambridge. diff --git a/srclib/pcre/doc/pgrep.html b/srclib/pcre/doc/pgrep.html deleted file mode 100644 index 54efed6785fc3a67d63650a9ca45c246c2b84c2d..0000000000000000000000000000000000000000 --- a/srclib/pcre/doc/pgrep.html +++ /dev/null @@ -1,105 +0,0 @@ - - -pgrep specification - - -

    pgrep specification

    -This HTML document has been generated automatically from the original man page. -If there is any nonsense in it, please consult the man page in case the -conversion went wrong. - -
  • NAME -

    -pgrep - a grep with Perl-compatible regular expressions. -

    -
  • SYNOPSIS -

    -pgrep [-Vchilnsvx] pattern [file] ... -

    -
  • DESCRIPTION -

    -pgrep searches files for character patterns, in the same way as other -grep commands do, but it uses the PCRE regular expression library to support -patterns that are compatible with the regular expressions of Perl 5. See -pcre(3) for a full description of syntax and semantics. -

    -

    -If no files are specified, pgrep reads the standard input. By default, -each line that matches the pattern is copied to the standard output, and if -there is more than one file, the file name is printed before each line of -output. However, there are options that can change how pgrep behaves. -

    -

    -Lines are limited to BUFSIZ characters. BUFSIZ is defined in <stdio.h>. -The newline character is removed from the end of each line before it is matched -against the pattern. -

    -
  • OPTIONS -

    --V -Write the version number of the PCRE library being used to the standard error -stream. -

    -

    --c -Do not print individual lines; instead just print a count of the number of -lines that would otherwise have been printed. If several files are given, a -count is printed for each of them. -

    -

    --h -Suppress printing of filenames when searching multiple files. -

    -

    --i -Ignore upper/lower case distinctions during comparisons. -

    -

    --l -Instead of printing lines from the files, just print the names of the files -containing lines that would have been printed. Each file name is printed -once, on a separate line. -

    -

    --n -Precede each line by its line number in the file. -

    -

    --s -Work silently, that is, display nothing except error messages. -The exit status indicates whether any matches were found. -

    -

    --v -Invert the sense of the match, so that lines which do not match the -pattern are now the ones that are found. -

    -

    --x -Force the pattern to be anchored (it must start matching at the beginning of -the line) and in addition, require it to match the entire line. This is -equivalent to having ^ and $ characters at the start and end of each -alternative branch in the regular expression. -

    -
  • SEE ALSO -

    -pcre(3), Perl 5 documentation -

    -
  • DIAGNOSTICS -

    -Exit status is 0 if any matches were found, 1 if no matches were found, and 2 -for syntax errors or inacessible files (even if matches were found). -

    -
  • AUTHOR -

    -Philip Hazel <ph10@cam.ac.uk> -
    -Copyright (c) 1997-1999 University of Cambridge. diff --git a/srclib/pcre/doc/pgrep.txt b/srclib/pcre/doc/pgrep.txt deleted file mode 100644 index bcd08c0aabab128e31cac1faff192f4b9af820ed..0000000000000000000000000000000000000000 --- a/srclib/pcre/doc/pgrep.txt +++ /dev/null @@ -1,86 +0,0 @@ -NAME - pgrep - a grep with Perl-compatible regular expressions. - - - -SYNOPSIS - pgrep [-Vchilnsvx] pattern [file] ... - - - -DESCRIPTION - pgrep searches files for character patterns, in the same way - as other grep commands do, but it uses the PCRE regular - expression library to support patterns that are compatible - with the regular expressions of Perl 5. See pcre(3) for a - full description of syntax and semantics. - - If no files are specified, pgrep reads the standard input. - By default, each line that matches the pattern is copied to - the standard output, and if there is more than one file, the - file name is printed before each line of output. However, - there are options that can change how pgrep behaves. - - Lines are limited to BUFSIZ characters. BUFSIZ is defined in - . The newline character is removed from the end of - each line before it is matched against the pattern. - - - -OPTIONS - -V Write the version number of the PCRE library being - used to the standard error stream. - - -c Do not print individual lines; instead just print - a count of the number of lines that would other- - wise have been printed. If several files are - given, a count is printed for each of them. - - -h Suppress printing of filenames when searching mul- - tiple files. - - -i Ignore upper/lower case distinctions during com- - parisons. - - -l Instead of printing lines from the files, just - print the names of the files containing lines that - would have been printed. Each file name is printed - once, on a separate line. - - -n Precede each line by its line number in the file. - - -s Work silently, that is, display nothing except - error messages. The exit status indicates whether - any matches were found. - - -v Invert the sense of the match, so that lines which - do not match the pattern are now the ones that are - found. - - -x Force the pattern to be anchored (it must start - matching at the beginning of the line) and in - addition, require it to match the entire line. - This is equivalent to having ^ and $ characters at - the start and end of each alternative branch in - the regular expression. - - - -SEE ALSO - pcre(3), Perl 5 documentation - - - - - -DIAGNOSTICS - Exit status is 0 if any matches were found, 1 if no matches - were found, and 2 for syntax errors or inacessible files - (even if matches were found). - - - -AUTHOR - Philip Hazel - Copyright (c) 1997-1999 University of Cambridge. - diff --git a/srclib/pcre/install-sh b/srclib/pcre/install-sh new file mode 100755 index 0000000000000000000000000000000000000000..e9de23842dcd44d2953129c866b1ad25f7e1f1d9 --- /dev/null +++ b/srclib/pcre/install-sh @@ -0,0 +1,251 @@ +#!/bin/sh +# +# install - install a program, script, or datafile +# This comes from X11R5 (mit/util/scripts/install.sh). +# +# Copyright 1991 by the Massachusetts Institute of Technology +# +# Permission to use, copy, modify, distribute, and sell this software and its +# documentation for any purpose is hereby granted without fee, provided that +# the above copyright notice appear in all copies and that both that +# copyright notice and this permission notice appear in supporting +# documentation, and that the name of M.I.T. not be used in advertising or +# publicity pertaining to distribution of the software without specific, +# written prior permission. M.I.T. makes no representations about the +# suitability of this software for any purpose. It is provided "as is" +# without express or implied warranty. +# +# Calling this script install-sh is preferred over install.sh, to prevent +# `make' implicit rules from creating a file called install from it +# when there is no Makefile. +# +# This script is compatible with the BSD install script, but was written +# from scratch. It can only install one file at a time, a restriction +# shared with many OS's install programs. + + +# set DOITPROG to echo to test this script + +# Don't use :- since 4.3BSD and earlier shells don't like it. +doit="${DOITPROG-}" + + +# put in absolute paths if you don't have them in your path; or use env. vars. + +mvprog="${MVPROG-mv}" +cpprog="${CPPROG-cp}" +chmodprog="${CHMODPROG-chmod}" +chownprog="${CHOWNPROG-chown}" +chgrpprog="${CHGRPPROG-chgrp}" +stripprog="${STRIPPROG-strip}" +rmprog="${RMPROG-rm}" +mkdirprog="${MKDIRPROG-mkdir}" + +transformbasename="" +transform_arg="" +instcmd="$mvprog" +chmodcmd="$chmodprog 0755" +chowncmd="" +chgrpcmd="" +stripcmd="" +rmcmd="$rmprog -f" +mvcmd="$mvprog" +src="" +dst="" +dir_arg="" + +while [ x"$1" != x ]; do + case $1 in + -c) instcmd="$cpprog" + shift + continue;; + + -d) dir_arg=true + shift + continue;; + + -m) chmodcmd="$chmodprog $2" + shift + shift + continue;; + + -o) chowncmd="$chownprog $2" + shift + shift + continue;; + + -g) chgrpcmd="$chgrpprog $2" + shift + shift + continue;; + + -s) stripcmd="$stripprog" + shift + continue;; + + -t=*) transformarg=`echo $1 | sed 's/-t=//'` + shift + continue;; + + -b=*) transformbasename=`echo $1 | sed 's/-b=//'` + shift + continue;; + + *) if [ x"$src" = x ] + then + src=$1 + else + # this colon is to work around a 386BSD /bin/sh bug + : + dst=$1 + fi + shift + continue;; + esac +done + +if [ x"$src" = x ] +then + echo "install: no input file specified" + exit 1 +else + true +fi + +if [ x"$dir_arg" != x ]; then + dst=$src + src="" + + if [ -d $dst ]; then + instcmd=: + chmodcmd="" + else + instcmd=mkdir + fi +else + +# Waiting for this to be detected by the "$instcmd $src $dsttmp" command +# might cause directories to be created, which would be especially bad +# if $src (and thus $dsttmp) contains '*'. + + if [ -f $src -o -d $src ] + then + true + else + echo "install: $src does not exist" + exit 1 + fi + + if [ x"$dst" = x ] + then + echo "install: no destination specified" + exit 1 + else + true + fi + +# If destination is a directory, append the input filename; if your system +# does not like double slashes in filenames, you may need to add some logic + + if [ -d $dst ] + then + dst="$dst"/`basename $src` + else + true + fi +fi + +## this sed command emulates the dirname command +dstdir=`echo $dst | sed -e 's,[^/]*$,,;s,/$,,;s,^$,.,'` + +# Make sure that the destination directory exists. +# this part is taken from Noah Friedman's mkinstalldirs script + +# Skip lots of stat calls in the usual case. +if [ ! -d "$dstdir" ]; then +defaultIFS=' +' +IFS="${IFS-${defaultIFS}}" + +oIFS="${IFS}" +# Some sh's can't handle IFS=/ for some reason. +IFS='%' +set - `echo ${dstdir} | sed -e 's@/@%@g' -e 's@^%@/@'` +IFS="${oIFS}" + +pathcomp='' + +while [ $# -ne 0 ] ; do + pathcomp="${pathcomp}${1}" + shift + + if [ ! -d "${pathcomp}" ] ; + then + $mkdirprog "${pathcomp}" + else + true + fi + + pathcomp="${pathcomp}/" +done +fi + +if [ x"$dir_arg" != x ] +then + $doit $instcmd $dst && + + if [ x"$chowncmd" != x ]; then $doit $chowncmd $dst; else true ; fi && + if [ x"$chgrpcmd" != x ]; then $doit $chgrpcmd $dst; else true ; fi && + if [ x"$stripcmd" != x ]; then $doit $stripcmd $dst; else true ; fi && + if [ x"$chmodcmd" != x ]; then $doit $chmodcmd $dst; else true ; fi +else + +# If we're going to rename the final executable, determine the name now. + + if [ x"$transformarg" = x ] + then + dstfile=`basename $dst` + else + dstfile=`basename $dst $transformbasename | + sed $transformarg`$transformbasename + fi + +# don't allow the sed command to completely eliminate the filename + + if [ x"$dstfile" = x ] + then + dstfile=`basename $dst` + else + true + fi + +# Make a temp file name in the proper directory. + + dsttmp=$dstdir/#inst.$$# + +# Move or copy the file name to the temp name + + $doit $instcmd $src $dsttmp && + + trap "rm -f ${dsttmp}" 0 && + +# and set any options; do chmod last to preserve setuid bits + +# If any of these fail, we abort the whole thing. If we want to +# ignore errors from any of these, just make sure not to ignore +# errors from the above "$doit $instcmd $src $dsttmp" command. + + if [ x"$chowncmd" != x ]; then $doit $chowncmd $dsttmp; else true;fi && + if [ x"$chgrpcmd" != x ]; then $doit $chgrpcmd $dsttmp; else true;fi && + if [ x"$stripcmd" != x ]; then $doit $stripcmd $dsttmp; else true;fi && + if [ x"$chmodcmd" != x ]; then $doit $chmodcmd $dsttmp; else true;fi && + +# Now rename the file to the real destination. + + $doit $rmcmd -f $dstdir/$dstfile && + $doit $mvcmd $dsttmp $dstdir/$dstfile + +fi && + + +exit 0 diff --git a/srclib/pcre/ltconfig b/srclib/pcre/ltconfig deleted file mode 100755 index a01334f9212c3a8e6a99db2b4d21f3380ccbfe80..0000000000000000000000000000000000000000 --- a/srclib/pcre/ltconfig +++ /dev/null @@ -1,3078 +0,0 @@ -#! /bin/sh - -# ltconfig - Create a system-specific libtool. -# Copyright (C) 1996-1999 Free Software Foundation, Inc. -# Originally by Gordon Matzigkeit , 1996 -# -# This file is free software; you can redistribute it and/or modify it -# under the terms of the GNU General Public License as published by -# the Free Software Foundation; either version 2 of the License, or -# (at your option) any later version. -# -# This program is distributed in the hope that it will be useful, but -# WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -# General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with this program; if not, write to the Free Software -# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. -# -# As a special exception to the GNU General Public License, if you -# distribute this file as part of a program that contains a -# configuration script generated by Autoconf, you may include it under -# the same distribution terms that you use for the rest of that program. - -# A lot of this script is taken from autoconf-2.10. - -# Check that we are running under the correct shell. -SHELL=${CONFIG_SHELL-/bin/sh} -echo=echo -if test "X$1" = X--no-reexec; then - # Discard the --no-reexec flag, and continue. - shift -elif test "X$1" = X--fallback-echo; then - # Avoid inline document here, it may be left over - : -elif test "X`($echo '\t') 2>/dev/null`" = 'X\t'; then - # Yippee, $echo works! - : -else - # Restart under the correct shell. - exec "$SHELL" "$0" --no-reexec ${1+"$@"} -fi - -if test "X$1" = X--fallback-echo; then - # used as fallback echo - shift - cat </dev/null`} - case X$UNAME in - *-DOS) PATH_SEPARATOR=';' ;; - *) PATH_SEPARATOR=':' ;; - esac -fi - -# The HP-UX ksh and POSIX shell print the target directory to stdout -# if CDPATH is set. -if test "X${CDPATH+set}" = Xset; then CDPATH=:; export CDPATH; fi - -if test "X${echo_test_string+set}" != Xset; then - # find a string as large as possible, as long as the shell can cope with it - for cmd in 'sed 50q "$0"' 'sed 20q "$0"' 'sed 10q "$0"' 'sed 2q "$0"' 'echo test'; do - # expected sizes: less than 2Kb, 1Kb, 512 bytes, 16 bytes, ... - if (echo_test_string="`eval $cmd`") 2>/dev/null && - echo_test_string="`eval $cmd`" && - (test "X$echo_test_string" = "X$echo_test_string") 2>/dev/null; then - break - fi - done -fi - -if test "X`($echo '\t') 2>/dev/null`" != 'X\t' || - test "X`($echo "$echo_test_string") 2>/dev/null`" != X"$echo_test_string"; then - # The Solaris, AIX, and Digital Unix default echo programs unquote - # backslashes. This makes it impossible to quote backslashes using - # echo "$something" | sed 's/\\/\\\\/g' - # - # So, first we look for a working echo in the user's PATH. - - IFS="${IFS= }"; save_ifs="$IFS"; IFS="${IFS}${PATH_SEPARATOR}" - for dir in $PATH /usr/ucb; do - if (test -f $dir/echo || test -f $dir/echo$ac_exeext) && - test "X`($dir/echo '\t') 2>/dev/null`" = 'X\t' && - test "X`($dir/echo "$echo_test_string") 2>/dev/null`" = X"$echo_test_string"; then - echo="$dir/echo" - break - fi - done - IFS="$save_ifs" - - if test "X$echo" = Xecho; then - # We didn't find a better echo, so look for alternatives. - if test "X`(print -r '\t') 2>/dev/null`" = 'X\t' && - test "X`(print -r "$echo_test_string") 2>/dev/null`" = X"$echo_test_string"; then - # This shell has a builtin print -r that does the trick. - echo='print -r' - elif (test -f /bin/ksh || test -f /bin/ksh$ac_exeext) && - test "X$CONFIG_SHELL" != X/bin/ksh; then - # If we have ksh, try running ltconfig again with it. - ORIGINAL_CONFIG_SHELL="${CONFIG_SHELL-/bin/sh}" - export ORIGINAL_CONFIG_SHELL - CONFIG_SHELL=/bin/ksh - export CONFIG_SHELL - exec "$CONFIG_SHELL" "$0" --no-reexec ${1+"$@"} - else - # Try using printf. - echo='printf "%s\n"' - if test "X`($echo '\t') 2>/dev/null`" = 'X\t' && - test "X`($echo "$echo_test_string") 2>/dev/null`" = X"$echo_test_string"; then - # Cool, printf works - : - elif test "X`("$ORIGINAL_CONFIG_SHELL" "$0" --fallback-echo '\t') 2>/dev/null`" = 'X\t' && - test "X`("$ORIGINAL_CONFIG_SHELL" "$0" --fallback-echo "$echo_test_string") 2>/dev/null`" = X"$echo_test_string"; then - CONFIG_SHELL="$ORIGINAL_CONFIG_SHELL" - export CONFIG_SHELL - SHELL="$CONFIG_SHELL" - export SHELL - echo="$CONFIG_SHELL $0 --fallback-echo" - elif test "X`("$CONFIG_SHELL" "$0" --fallback-echo '\t') 2>/dev/null`" = 'X\t' && - test "X`("$CONFIG_SHELL" "$0" --fallback-echo "$echo_test_string") 2>/dev/null`" = X"$echo_test_string"; then - echo="$CONFIG_SHELL $0 --fallback-echo" - else - # maybe with a smaller string... - prev=: - - for cmd in 'echo test' 'sed 2q "$0"' 'sed 10q "$0"' 'sed 20q "$0"' 'sed 50q "$0"'; do - if (test "X$echo_test_string" = "X`eval $cmd`") 2>/dev/null; then - break - fi - prev="$cmd" - done - - if test "$prev" != 'sed 50q "$0"'; then - echo_test_string=`eval $prev` - export echo_test_string - exec "${ORIGINAL_CONFIG_SHELL}" "$0" ${1+"$@"} - else - # Oops. We lost completely, so just stick with echo. - echo=echo - fi - fi - fi - fi -fi - -# Sed substitution that helps us do robust quoting. It backslashifies -# metacharacters that are still active within double-quoted strings. -Xsed='sed -e s/^X//' -sed_quote_subst='s/\([\\"\\`$\\\\]\)/\\\1/g' - -# Same as above, but do not quote variable references. -double_quote_subst='s/\([\\"\\`\\\\]\)/\\\1/g' - -# Sed substitution to delay expansion of an escaped shell variable in a -# double_quote_subst'ed string. -delay_variable_subst='s/\\\\\\\\\\\$/\\\\\\$/g' - -# The name of this program. -progname=`$echo "X$0" | $Xsed -e 's%^.*/%%'` - -# Constants: -PROGRAM=ltconfig -PACKAGE=libtool -VERSION=1.3.4 -TIMESTAMP=" (1.385.2.196 1999/12/07 21:47:57)" -ac_compile='${CC-cc} -c $CFLAGS $CPPFLAGS conftest.$ac_ext 1>&5' -ac_link='${CC-cc} -o conftest $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS 1>&5' -rm="rm -f" - -help="Try \`$progname --help' for more information." - -# Global variables: -default_ofile=libtool -can_build_shared=yes -enable_shared=yes -# All known linkers require a `.a' archive for static linking (except M$VC, -# which needs '.lib'). -enable_static=yes -enable_fast_install=yes -enable_dlopen=unknown -enable_win32_dll=no -ltmain= -silent= -srcdir= -ac_config_guess= -ac_config_sub= -host= -nonopt= -ofile="$default_ofile" -verify_host=yes -with_gcc=no -with_gnu_ld=no -need_locks=yes -ac_ext=c -objext=o -libext=a -exeext= -cache_file= - -old_AR="$AR" -old_CC="$CC" -old_CFLAGS="$CFLAGS" -old_CPPFLAGS="$CPPFLAGS" -old_LDFLAGS="$LDFLAGS" -old_LD="$LD" -old_LN_S="$LN_S" -old_LIBS="$LIBS" -old_NM="$NM" -old_RANLIB="$RANLIB" -old_DLLTOOL="$DLLTOOL" -old_OBJDUMP="$OBJDUMP" -old_AS="$AS" - -# Parse the command line options. -args= -prev= -for option -do - case "$option" in - -*=*) optarg=`echo "$option" | sed 's/[-_a-zA-Z0-9]*=//'` ;; - *) optarg= ;; - esac - - # If the previous option needs an argument, assign it. - if test -n "$prev"; then - eval "$prev=\$option" - prev= - continue - fi - - case "$option" in - --help) cat <&2 - echo "$help" 1>&2 - exit 1 - ;; - - *) - if test -z "$ltmain"; then - ltmain="$option" - elif test -z "$host"; then -# This generates an unnecessary warning for sparc-sun-solaris4.1.3_U1 -# if test -n "`echo $option| sed 's/[-a-z0-9.]//g'`"; then -# echo "$progname: warning \`$option' is not a valid host type" 1>&2 -# fi - host="$option" - else - echo "$progname: too many arguments" 1>&2 - echo "$help" 1>&2 - exit 1 - fi ;; - esac -done - -if test -z "$ltmain"; then - echo "$progname: you must specify a LTMAIN file" 1>&2 - echo "$help" 1>&2 - exit 1 -fi - -if test ! -f "$ltmain"; then - echo "$progname: \`$ltmain' does not exist" 1>&2 - echo "$help" 1>&2 - exit 1 -fi - -# Quote any args containing shell metacharacters. -ltconfig_args= -for arg -do - case "$arg" in - *" "*|*" "*|*[\[\]\~\#\$\^\&\*\(\)\{\}\\\|\;\<\>\?]*) - ltconfig_args="$ltconfig_args '$arg'" ;; - *) ltconfig_args="$ltconfig_args $arg" ;; - esac -done - -# A relevant subset of AC_INIT. - -# File descriptor usage: -# 0 standard input -# 1 file creation -# 2 errors and warnings -# 3 some systems may open it to /dev/tty -# 4 used on the Kubota Titan -# 5 compiler messages saved in config.log -# 6 checking for... messages and results -if test "$silent" = yes; then - exec 6>/dev/null -else - exec 6>&1 -fi -exec 5>>./config.log - -# NLS nuisances. -# Only set LANG and LC_ALL to C if already set. -# These must not be set unconditionally because not all systems understand -# e.g. LANG=C (notably SCO). -if test "X${LC_ALL+set}" = Xset; then LC_ALL=C; export LC_ALL; fi -if test "X${LANG+set}" = Xset; then LANG=C; export LANG; fi - -if test -n "$cache_file" && test -r "$cache_file"; then - echo "loading cache $cache_file within ltconfig" - . $cache_file -fi - -if (echo "testing\c"; echo 1,2,3) | grep c >/dev/null; then - # Stardent Vistra SVR4 grep lacks -e, says ghazi@caip.rutgers.edu. - if (echo -n testing; echo 1,2,3) | sed s/-n/xn/ | grep xn >/dev/null; then - ac_n= ac_c=' -' ac_t=' ' - else - ac_n=-n ac_c= ac_t= - fi -else - ac_n= ac_c='\c' ac_t= -fi - -if test -z "$srcdir"; then - # Assume the source directory is the same one as the path to LTMAIN. - srcdir=`$echo "X$ltmain" | $Xsed -e 's%/[^/]*$%%'` - test "$srcdir" = "$ltmain" && srcdir=. -fi - -trap "$rm conftest*; exit 1" 1 2 15 -if test "$verify_host" = yes; then - # Check for config.guess and config.sub. - ac_aux_dir= - for ac_dir in $srcdir $srcdir/.. $srcdir/../..; do - if test -f $ac_dir/config.guess; then - ac_aux_dir=$ac_dir - break - fi - done - if test -z "$ac_aux_dir"; then - echo "$progname: cannot find config.guess in $srcdir $srcdir/.. $srcdir/../.." 1>&2 - echo "$help" 1>&2 - exit 1 - fi - ac_config_guess=$ac_aux_dir/config.guess - ac_config_sub=$ac_aux_dir/config.sub - - # Make sure we can run config.sub. - if $SHELL $ac_config_sub sun4 >/dev/null 2>&1; then : - else - echo "$progname: cannot run $ac_config_sub" 1>&2 - echo "$help" 1>&2 - exit 1 - fi - - echo $ac_n "checking host system type""... $ac_c" 1>&6 - - host_alias=$host - case "$host_alias" in - "") - if host_alias=`$SHELL $ac_config_guess`; then : - else - echo "$progname: cannot guess host type; you must specify one" 1>&2 - echo "$help" 1>&2 - exit 1 - fi ;; - esac - host=`$SHELL $ac_config_sub $host_alias` - echo "$ac_t$host" 1>&6 - - # Make sure the host verified. - test -z "$host" && exit 1 - -elif test -z "$host"; then - echo "$progname: you must specify a host type if you use \`--no-verify'" 1>&2 - echo "$help" 1>&2 - exit 1 -else - host_alias=$host -fi - -# Transform linux* to *-*-linux-gnu*, to support old configure scripts. -case "$host_os" in -linux-gnu*) ;; -linux*) host=`echo $host | sed 's/^\(.*-.*-linux\)\(.*\)$/\1-gnu\2/'` -esac - -host_cpu=`echo $host | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\1/'` -host_vendor=`echo $host | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\2/'` -host_os=`echo $host | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\3/'` - -case "$host_os" in -aix3*) - # AIX sometimes has problems with the GCC collect2 program. For some - # reason, if we set the COLLECT_NAMES environment variable, the problems - # vanish in a puff of smoke. - if test "X${COLLECT_NAMES+set}" != Xset; then - COLLECT_NAMES= - export COLLECT_NAMES - fi - ;; -esac - -# Determine commands to create old-style static archives. -old_archive_cmds='$AR cru $oldlib$oldobjs' -old_postinstall_cmds='chmod 644 $oldlib' -old_postuninstall_cmds= - -# Set a sane default for `AR'. -test -z "$AR" && AR=ar - -# Set a sane default for `OBJDUMP'. -test -z "$OBJDUMP" && OBJDUMP=objdump - -# If RANLIB is not set, then run the test. -if test "${RANLIB+set}" != "set"; then - result=no - - echo $ac_n "checking for ranlib... $ac_c" 1>&6 - IFS="${IFS= }"; save_ifs="$IFS"; IFS="${IFS}${PATH_SEPARATOR}" - for dir in $PATH; do - test -z "$dir" && dir=. - if test -f $dir/ranlib || test -f $dir/ranlib$ac_exeext; then - RANLIB="ranlib" - result="ranlib" - break - fi - done - IFS="$save_ifs" - - echo "$ac_t$result" 1>&6 -fi - -if test -n "$RANLIB"; then - old_archive_cmds="$old_archive_cmds~\$RANLIB \$oldlib" - old_postinstall_cmds="\$RANLIB \$oldlib~$old_postinstall_cmds" -fi - -# Set sane defaults for `DLLTOOL', `OBJDUMP', and `AS', used on cygwin. -test -z "$DLLTOOL" && DLLTOOL=dlltool -test -z "$OBJDUMP" && OBJDUMP=objdump -test -z "$AS" && AS=as - -# Check to see if we are using GCC. -if test "$with_gcc" != yes || test -z "$CC"; then - # If CC is not set, then try to find GCC or a usable CC. - if test -z "$CC"; then - echo $ac_n "checking for gcc... $ac_c" 1>&6 - IFS="${IFS= }"; save_ifs="$IFS"; IFS="${IFS}${PATH_SEPARATOR}" - for dir in $PATH; do - test -z "$dir" && dir=. - if test -f $dir/gcc || test -f $dir/gcc$ac_exeext; then - CC="gcc" - break - fi - done - IFS="$save_ifs" - - if test -n "$CC"; then - echo "$ac_t$CC" 1>&6 - else - echo "$ac_t"no 1>&6 - fi - fi - - # Not "gcc", so try "cc", rejecting "/usr/ucb/cc". - if test -z "$CC"; then - echo $ac_n "checking for cc... $ac_c" 1>&6 - IFS="${IFS= }"; save_ifs="$IFS"; IFS="${IFS}${PATH_SEPARATOR}" - cc_rejected=no - for dir in $PATH; do - test -z "$dir" && dir=. - if test -f $dir/cc || test -f $dir/cc$ac_exeext; then - if test "$dir/cc" = "/usr/ucb/cc"; then - cc_rejected=yes - continue - fi - CC="cc" - break - fi - done - IFS="$save_ifs" - if test $cc_rejected = yes; then - # We found a bogon in the path, so make sure we never use it. - set dummy $CC - shift - if test $# -gt 0; then - # We chose a different compiler from the bogus one. - # However, it has the same name, so the bogon will be chosen - # first if we set CC to just the name; use the full file name. - shift - set dummy "$dir/cc" "$@" - shift - CC="$@" - fi - fi - - if test -n "$CC"; then - echo "$ac_t$CC" 1>&6 - else - echo "$ac_t"no 1>&6 - fi - - if test -z "$CC"; then - echo "$progname: error: no acceptable cc found in \$PATH" 1>&2 - exit 1 - fi - fi - - # Now see if the compiler is really GCC. - with_gcc=no - echo $ac_n "checking whether we are using GNU C... $ac_c" 1>&6 - echo "$progname:581: checking whether we are using GNU C" >&5 - - $rm conftest.c - cat > conftest.c <&5; (eval $ac_try) 2>&5; }; } | egrep yes >/dev/null 2>&1; then - with_gcc=yes - fi - $rm conftest.c - echo "$ac_t$with_gcc" 1>&6 -fi - -# Allow CC to be a program name with arguments. -set dummy $CC -compiler="$2" - -echo $ac_n "checking for object suffix... $ac_c" 1>&6 -$rm conftest* -echo 'int i = 1;' > conftest.c -echo "$progname:603: checking for object suffix" >& 5 -if { (eval echo $progname:604: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>conftest.err; }; then - # Append any warnings to the config.log. - cat conftest.err 1>&5 - - for ac_file in conftest.*; do - case $ac_file in - *.c) ;; - *) objext=`echo $ac_file | sed -e s/conftest.//` ;; - esac - done -else - cat conftest.err 1>&5 - echo "$progname: failed program was:" >&5 - cat conftest.c >&5 -fi -$rm conftest* -echo "$ac_t$objext" 1>&6 - -echo $ac_n "checking for executable suffix... $ac_c" 1>&6 -if eval "test \"`echo '$''{'ac_cv_exeext'+set}'`\" = set"; then - echo $ac_n "(cached) $ac_c" 1>&6 -else - ac_cv_exeext="no" - $rm conftest* - echo 'main () { return 0; }' > conftest.c - echo "$progname:629: checking for executable suffix" >& 5 - if { (eval echo $progname:630: \"$ac_link\") 1>&5; (eval $ac_link) 2>conftest.err; }; then - # Append any warnings to the config.log. - cat conftest.err 1>&5 - - for ac_file in conftest.*; do - case $ac_file in - *.c | *.err | *.$objext ) ;; - *) ac_cv_exeext=.`echo $ac_file | sed -e s/conftest.//` ;; - esac - done - else - cat conftest.err 1>&5 - echo "$progname: failed program was:" >&5 - cat conftest.c >&5 - fi - $rm conftest* -fi -if test "X$ac_cv_exeext" = Xno; then - exeext="" -else - exeext="$ac_cv_exeext" -fi -echo "$ac_t$ac_cv_exeext" 1>&6 - -echo $ac_n "checking for $compiler option to produce PIC... $ac_c" 1>&6 -pic_flag= -special_shlib_compile_flags= -wl= -link_static_flag= -no_builtin_flag= - -if test "$with_gcc" = yes; then - wl='-Wl,' - link_static_flag='-static' - - case "$host_os" in - beos* | irix5* | irix6* | osf3* | osf4* | osf5*) - # PIC is the default for these OSes. - ;; - aix*) - # Below there is a dirty hack to force normal static linking with -ldl - # The problem is because libdl dynamically linked with both libc and - # libC (AIX C++ library), which obviously doesn't included in libraries - # list by gcc. This cause undefined symbols with -static flags. - # This hack allows C programs to be linked with "-static -ldl", but - # we not sure about C++ programs. - link_static_flag="$link_static_flag ${wl}-lC" - ;; - cygwin* | mingw* | os2*) - # We can build DLLs from non-PIC. - ;; - amigaos*) - # FIXME: we need at least 68020 code to build shared libraries, but - # adding the `-m68020' flag to GCC prevents building anything better, - # like `-m68040'. - pic_flag='-m68020 -resident32 -malways-restore-a4' - ;; - sysv4*MP*) - if test -d /usr/nec; then - pic_flag=-Kconform_pic - fi - ;; - *) - pic_flag='-fPIC' - ;; - esac -else - # PORTME Check for PIC flags for the system compiler. - case "$host_os" in - aix3* | aix4*) - # All AIX code is PIC. - link_static_flag='-bnso -bI:/lib/syscalls.exp' - ;; - - hpux9* | hpux10* | hpux11*) - # Is there a better link_static_flag that works with the bundled CC? - wl='-Wl,' - link_static_flag="${wl}-a ${wl}archive" - pic_flag='+Z' - ;; - - irix5* | irix6*) - wl='-Wl,' - link_static_flag='-non_shared' - # PIC (with -KPIC) is the default. - ;; - - cygwin* | mingw* | os2*) - # We can build DLLs from non-PIC. - ;; - - osf3* | osf4* | osf5*) - # All OSF/1 code is PIC. - wl='-Wl,' - link_static_flag='-non_shared' - ;; - - sco3.2v5*) - pic_flag='-Kpic' - link_static_flag='-dn' - special_shlib_compile_flags='-belf' - ;; - - solaris*) - pic_flag='-KPIC' - link_static_flag='-Bstatic' - wl='-Wl,' - ;; - - sunos4*) - pic_flag='-PIC' - link_static_flag='-Bstatic' - wl='-Qoption ld ' - ;; - - sysv4 | sysv4.2uw2* | sysv4.3* | sysv5*) - pic_flag='-KPIC' - link_static_flag='-Bstatic' - wl='-Wl,' - ;; - - uts4*) - pic_flag='-pic' - link_static_flag='-Bstatic' - ;; - sysv4*MP*) - if test -d /usr/nec ;then - pic_flag='-Kconform_pic' - link_static_flag='-Bstatic' - fi - ;; - *) - can_build_shared=no - ;; - esac -fi - -if test -n "$pic_flag"; then - echo "$ac_t$pic_flag" 1>&6 - - # Check to make sure the pic_flag actually works. - echo $ac_n "checking if $compiler PIC flag $pic_flag works... $ac_c" 1>&6 - $rm conftest* - echo "int some_variable = 0;" > conftest.c - save_CFLAGS="$CFLAGS" - CFLAGS="$CFLAGS $pic_flag -DPIC" - echo "$progname:776: checking if $compiler PIC flag $pic_flag works" >&5 - if { (eval echo $progname:777: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>conftest.err; } && test -s conftest.$objext; then - # Append any warnings to the config.log. - cat conftest.err 1>&5 - - case "$host_os" in - hpux9* | hpux10* | hpux11*) - # On HP-UX, both CC and GCC only warn that PIC is supported... then they - # create non-PIC objects. So, if there were any warnings, we assume that - # PIC is not supported. - if test -s conftest.err; then - echo "$ac_t"no 1>&6 - can_build_shared=no - pic_flag= - else - echo "$ac_t"yes 1>&6 - pic_flag=" $pic_flag" - fi - ;; - *) - echo "$ac_t"yes 1>&6 - pic_flag=" $pic_flag" - ;; - esac - else - # Append any errors to the config.log. - cat conftest.err 1>&5 - can_build_shared=no - pic_flag= - echo "$ac_t"no 1>&6 - fi - CFLAGS="$save_CFLAGS" - $rm conftest* -else - echo "$ac_t"none 1>&6 -fi - -# Check to see if options -o and -c are simultaneously supported by compiler -echo $ac_n "checking if $compiler supports -c -o file.o... $ac_c" 1>&6 -$rm -r conftest 2>/dev/null -mkdir conftest -cd conftest -$rm conftest* -echo "int some_variable = 0;" > conftest.c -mkdir out -# According to Tom Tromey, Ian Lance Taylor reported there are C compilers -# that will create temporary files in the current directory regardless of -# the output directory. Thus, making CWD read-only will cause this test -# to fail, enabling locking or at least warning the user not to do parallel -# builds. -chmod -w . -save_CFLAGS="$CFLAGS" -CFLAGS="$CFLAGS -o out/conftest2.o" -echo "$progname:829: checking if $compiler supports -c -o file.o" >&5 -if { (eval echo $progname:830: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>out/conftest.err; } && test -s out/conftest2.o; then - - # The compiler can only warn and ignore the option if not recognized - # So say no if there are warnings - if test -s out/conftest.err; then - echo "$ac_t"no 1>&6 - compiler_c_o=no - else - echo "$ac_t"yes 1>&6 - compiler_c_o=yes - fi -else - # Append any errors to the config.log. - cat out/conftest.err 1>&5 - compiler_c_o=no - echo "$ac_t"no 1>&6 -fi -CFLAGS="$save_CFLAGS" -chmod u+w . -$rm conftest* out/* -rmdir out -cd .. -rmdir conftest -$rm -r conftest 2>/dev/null - -if test x"$compiler_c_o" = x"yes"; then - # Check to see if we can write to a .lo - echo $ac_n "checking if $compiler supports -c -o file.lo... $ac_c" 1>&6 - $rm conftest* - echo "int some_variable = 0;" > conftest.c - save_CFLAGS="$CFLAGS" - CFLAGS="$CFLAGS -c -o conftest.lo" - echo "$progname:862: checking if $compiler supports -c -o file.lo" >&5 -if { (eval echo $progname:863: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>conftest.err; } && test -s conftest.lo; then - - # The compiler can only warn and ignore the option if not recognized - # So say no if there are warnings - if test -s conftest.err; then - echo "$ac_t"no 1>&6 - compiler_o_lo=no - else - echo "$ac_t"yes 1>&6 - compiler_o_lo=yes - fi - else - # Append any errors to the config.log. - cat conftest.err 1>&5 - compiler_o_lo=no - echo "$ac_t"no 1>&6 - fi - CFLAGS="$save_CFLAGS" - $rm conftest* -else - compiler_o_lo=no -fi - -# Check to see if we can do hard links to lock some files if needed -hard_links="nottested" -if test "$compiler_c_o" = no && test "$need_locks" != no; then - # do not overwrite the value of need_locks provided by the user - echo $ac_n "checking if we can lock with hard links... $ac_c" 1>&6 - hard_links=yes - $rm conftest* - ln conftest.a conftest.b 2>/dev/null && hard_links=no - touch conftest.a - ln conftest.a conftest.b 2>&5 || hard_links=no - ln conftest.a conftest.b 2>/dev/null && hard_links=no - echo "$ac_t$hard_links" 1>&6 - $rm conftest* - if test "$hard_links" = no; then - echo "*** WARNING: \`$CC' does not support \`-c -o', so \`make -j' may be unsafe" >&2 - need_locks=warn - fi -else - need_locks=no -fi - -if test "$with_gcc" = yes; then - # Check to see if options -fno-rtti -fno-exceptions are supported by compiler - echo $ac_n "checking if $compiler supports -fno-rtti -fno-exceptions ... $ac_c" 1>&6 - $rm conftest* - echo "int some_variable = 0;" > conftest.c - save_CFLAGS="$CFLAGS" - CFLAGS="$CFLAGS -fno-rtti -fno-exceptions -c conftest.c" - echo "$progname:914: checking if $compiler supports -fno-rtti -fno-exceptions" >&5 - if { (eval echo $progname:915: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>conftest.err; } && test -s conftest.o; then - - # The compiler can only warn and ignore the option if not recognized - # So say no if there are warnings - if test -s conftest.err; then - echo "$ac_t"no 1>&6 - compiler_rtti_exceptions=no - else - echo "$ac_t"yes 1>&6 - compiler_rtti_exceptions=yes - fi - else - # Append any errors to the config.log. - cat conftest.err 1>&5 - compiler_rtti_exceptions=no - echo "$ac_t"no 1>&6 - fi - CFLAGS="$save_CFLAGS" - $rm conftest* - - if test "$compiler_rtti_exceptions" = "yes"; then - no_builtin_flag=' -fno-builtin -fno-rtti -fno-exceptions' - else - no_builtin_flag=' -fno-builtin' - fi - -fi - -# Check for any special shared library compilation flags. -if test -n "$special_shlib_compile_flags"; then - echo "$progname: warning: \`$CC' requires \`$special_shlib_compile_flags' to build shared libraries" 1>&2 - if echo "$old_CC $old_CFLAGS " | egrep -e "[ ]$special_shlib_compile_flags[ ]" >/dev/null; then : - else - echo "$progname: add \`$special_shlib_compile_flags' to the CC or CFLAGS env variable and reconfigure" 1>&2 - can_build_shared=no - fi -fi - -echo $ac_n "checking if $compiler static flag $link_static_flag works... $ac_c" 1>&6 -$rm conftest* -echo 'main(){return(0);}' > conftest.c -save_LDFLAGS="$LDFLAGS" -LDFLAGS="$LDFLAGS $link_static_flag" -echo "$progname:958: checking if $compiler static flag $link_static_flag works" >&5 -if { (eval echo $progname:959: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then - echo "$ac_t$link_static_flag" 1>&6 -else - echo "$ac_t"none 1>&6 - link_static_flag= -fi -LDFLAGS="$save_LDFLAGS" -$rm conftest* - -if test -z "$LN_S"; then - # Check to see if we can use ln -s, or we need hard links. - echo $ac_n "checking whether ln -s works... $ac_c" 1>&6 - $rm conftest.dat - if ln -s X conftest.dat 2>/dev/null; then - $rm conftest.dat - LN_S="ln -s" - else - LN_S=ln - fi - if test "$LN_S" = "ln -s"; then - echo "$ac_t"yes 1>&6 - else - echo "$ac_t"no 1>&6 - fi -fi - -# Make sure LD is an absolute path. -if test -z "$LD"; then - ac_prog=ld - if test "$with_gcc" = yes; then - # Check if gcc -print-prog-name=ld gives a path. - echo $ac_n "checking for ld used by GCC... $ac_c" 1>&6 - echo "$progname:991: checking for ld used by GCC" >&5 - ac_prog=`($CC -print-prog-name=ld) 2>&5` - case "$ac_prog" in - # Accept absolute paths. - [\\/]* | [A-Za-z]:[\\/]*) - re_direlt='/[^/][^/]*/\.\./' - # Canonicalize the path of ld - ac_prog=`echo $ac_prog| sed 's%\\\\%/%g'` - while echo $ac_prog | grep "$re_direlt" > /dev/null 2>&1; do - ac_prog=`echo $ac_prog| sed "s%$re_direlt%/%"` - done - test -z "$LD" && LD="$ac_prog" - ;; - "") - # If it fails, then pretend we are not using GCC. - ac_prog=ld - ;; - *) - # If it is relative, then search for the first ld in PATH. - with_gnu_ld=unknown - ;; - esac - elif test "$with_gnu_ld" = yes; then - echo $ac_n "checking for GNU ld... $ac_c" 1>&6 - echo "$progname:1015: checking for GNU ld" >&5 - else - echo $ac_n "checking for non-GNU ld""... $ac_c" 1>&6 - echo "$progname:1018: checking for non-GNU ld" >&5 - fi - - if test -z "$LD"; then - IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS="${IFS}${PATH_SEPARATOR}" - for ac_dir in $PATH; do - test -z "$ac_dir" && ac_dir=. - if test -f "$ac_dir/$ac_prog" || test -f "$ac_dir/$ac_prog$ac_exeext"; then - LD="$ac_dir/$ac_prog" - # Check to see if the program is GNU ld. I'd rather use --version, - # but apparently some GNU ld's only accept -v. - # Break only if it was the GNU/non-GNU ld that we prefer. - if "$LD" -v 2>&1 < /dev/null | egrep '(GNU|with BFD)' > /dev/null; then - test "$with_gnu_ld" != no && break - else - test "$with_gnu_ld" != yes && break - fi - fi - done - IFS="$ac_save_ifs" - fi - - if test -n "$LD"; then - echo "$ac_t$LD" 1>&6 - else - echo "$ac_t"no 1>&6 - fi - - if test -z "$LD"; then - echo "$progname: error: no acceptable ld found in \$PATH" 1>&2 - exit 1 - fi -fi - -# Check to see if it really is or is not GNU ld. -echo $ac_n "checking if the linker ($LD) is GNU ld... $ac_c" 1>&6 -# I'd rather use --version here, but apparently some GNU ld's only accept -v. -if $LD -v 2>&1 &5; then - with_gnu_ld=yes -else - with_gnu_ld=no -fi -echo "$ac_t$with_gnu_ld" 1>&6 - -# See if the linker supports building shared libraries. -echo $ac_n "checking whether the linker ($LD) supports shared libraries... $ac_c" 1>&6 - -allow_undefined_flag= -no_undefined_flag= -need_lib_prefix=unknown -need_version=unknown -# when you set need_version to no, make sure it does not cause -set_version -# flags to be left without arguments -archive_cmds= -archive_expsym_cmds= -old_archive_from_new_cmds= -export_dynamic_flag_spec= -whole_archive_flag_spec= -thread_safe_flag_spec= -hardcode_libdir_flag_spec= -hardcode_libdir_separator= -hardcode_direct=no -hardcode_minus_L=no -hardcode_shlibpath_var=unsupported -runpath_var= -always_export_symbols=no -export_symbols_cmds='$NM $libobjs $convenience | $global_symbol_pipe | sed '\''s/.* //'\'' | sort | uniq > $export_symbols' -# include_expsyms should be a list of space-separated symbols to be *always* -# included in the symbol list -include_expsyms= -# exclude_expsyms can be an egrep regular expression of symbols to exclude -# it will be wrapped by ` (' and `)$', so one must not match beginning or -# end of line. Example: `a|bc|.*d.*' will exclude the symbols `a' and `bc', -# as well as any symbol that contains `d'. -exclude_expsyms="_GLOBAL_OFFSET_TABLE_" -# Although _GLOBAL_OFFSET_TABLE_ is a valid symbol C name, most a.out -# platforms (ab)use it in PIC code, but their linkers get confused if -# the symbol is explicitly referenced. Since portable code cannot -# rely on this symbol name, it's probably fine to never include it in -# preloaded symbol tables. - -case "$host_os" in -cygwin* | mingw*) - # FIXME: the MSVC++ port hasn't been tested in a loooong time - # When not using gcc, we currently assume that we are using - # Microsoft Visual C++. - if test "$with_gcc" != yes; then - with_gnu_ld=no - fi - ;; - -esac - -ld_shlibs=yes -if test "$with_gnu_ld" = yes; then - # If archive_cmds runs LD, not CC, wlarc should be empty - wlarc='${wl}' - - # See if GNU ld supports shared libraries. - case "$host_os" in - aix3* | aix4*) - # On AIX, the GNU linker is very broken - ld_shlibs=no - cat <&2 - -*** Warning: the GNU linker, at least up to release 2.9.1, is reported -*** to be unable to reliably create shared libraries on AIX. -*** Therefore, libtool is disabling shared libraries support. If you -*** really care for shared libraries, you may want to modify your PATH -*** so that a non-GNU linker is found, and then restart. - -EOF - ;; - - amigaos*) - archive_cmds='$rm $objdir/a2ixlibrary.data~$echo "#define NAME $libname" > $objdir/a2ixlibrary.data~$echo "#define LIBRARY_ID 1" >> $objdir/a2ixlibrary.data~$echo "#define VERSION $major" >> $objdir/a2ixlibrary.data~$echo "#define REVISION $revision" >> $objdir/a2ixlibrary.data~$AR cru $lib $libobjs~$RANLIB $lib~(cd $objdir && a2ixlibrary -32)' - hardcode_libdir_flag_spec='-L$libdir' - hardcode_minus_L=yes - - # Samuel A. Falvo II reports - # that the semantics of dynamic libraries on AmigaOS, at least up - # to version 4, is to share data among multiple programs linked - # with the same dynamic library. Since this doesn't match the - # behavior of shared libraries on other platforms, we can use - # them. - ld_shlibs=no - ;; - - beos*) - if $LD --help 2>&1 | egrep ': supported targets:.* elf' > /dev/null; then - allow_undefined_flag=unsupported - # Joseph Beckenbach says some releases of gcc - # support --undefined. This deserves some investigation. FIXME - archive_cmds='$CC -nostart $libobjs $deplibs $linkopts ${wl}-soname $wl$soname -o $lib' - else - ld_shlibs=no - fi - ;; - - cygwin* | mingw*) - # hardcode_libdir_flag_spec is actually meaningless, as there is - # no search path for DLLs. - hardcode_libdir_flag_spec='-L$libdir' - allow_undefined_flag=unsupported - always_export_symbols=yes - - # Extract the symbol export list from an `--export-all' def file, - # then regenerate the def file from the symbol export list, so that - # the compiled dll only exports the symbol export list. - export_symbols_cmds='test -f $objdir/$soname-ltdll.c || sed -e "/^# \/\* ltdll\.c starts here \*\//,/^# \/\* ltdll.c ends here \*\// { s/^# //; p; }" -e d < $0 > $objdir/$soname-ltdll.c~ - test -f $objdir/$soname-ltdll.$objext || (cd $objdir && $CC -c $soname-ltdll.c)~ - $DLLTOOL --export-all --exclude-symbols DllMain@12,_cygwin_dll_entry@12,_cygwin_noncygwin_dll_entry@12 --output-def $objdir/$soname-def $objdir/$soname-ltdll.$objext $libobjs $convenience~ - sed -e "1,/EXPORTS/d" -e "s/ @ [0-9]* ; *//" < $objdir/$soname-def > $export_symbols' - - archive_expsym_cmds='echo EXPORTS > $objdir/$soname-def~ - _lt_hint=1; - for symbol in `cat $export_symbols`; do - echo " \$symbol @ \$_lt_hint ; " >> $objdir/$soname-def; - _lt_hint=`expr 1 + \$_lt_hint`; - done~ - test -f $objdir/$soname-ltdll.c || sed -e "/^# \/\* ltdll\.c starts here \*\//,/^# \/\* ltdll.c ends here \*\// { s/^# //; p; }" -e d < $0 > $objdir/$soname-ltdll.c~ - test -f $objdir/$soname-ltdll.$objext || (cd $objdir && $CC -c $soname-ltdll.c)~ - $CC -Wl,--base-file,$objdir/$soname-base -Wl,--dll -nostartfiles -Wl,-e,__cygwin_dll_entry@12 -o $lib $objdir/$soname-ltdll.$objext $libobjs $deplibs $linkopts~ - $DLLTOOL --as=$AS --dllname $soname --exclude-symbols DllMain@12,_cygwin_dll_entry@12,_cygwin_noncygwin_dll_entry@12 --def $objdir/$soname-def --base-file $objdir/$soname-base --output-exp $objdir/$soname-exp~ - $CC -Wl,--base-file,$objdir/$soname-base $objdir/$soname-exp -Wl,--dll -nostartfiles -Wl,-e,__cygwin_dll_entry@12 -o $lib $objdir/$soname-ltdll.$objext $libobjs $deplibs $linkopts~ - $DLLTOOL --as=$AS --dllname $soname --exclude-symbols DllMain@12,_cygwin_dll_entry@12,_cygwin_noncygwin_dll_entry@12 --def $objdir/$soname-def --base-file $objdir/$soname-base --output-exp $objdir/$soname-exp~ - $CC $objdir/$soname-exp -Wl,--dll -nostartfiles -Wl,-e,__cygwin_dll_entry@12 -o $lib $objdir/$soname-ltdll.$objext $libobjs $deplibs $linkopts' - - old_archive_from_new_cmds='$DLLTOOL --as=$AS --dllname $soname --def $objdir/$soname-def --output-lib $objdir/$libname.a' - ;; - - netbsd*) - if echo __ELF__ | $CC -E - | grep __ELF__ >/dev/null; then - archive_cmds='$CC -shared $libobjs $deplibs $linkopts ${wl}-soname $wl$soname -o $lib' - archive_expsym_cmds='$CC -shared $libobjs $deplibs $linkopts ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib' - else - archive_cmds='$LD -Bshareable $libobjs $deplibs $linkopts -o $lib' - # can we support soname and/or expsyms with a.out? -oliva - fi - ;; - - solaris* | sysv5*) - if $LD -v 2>&1 | egrep 'BFD 2\.8' > /dev/null; then - ld_shlibs=no - cat <&2 - -*** Warning: The releases 2.8.* of the GNU linker cannot reliably -*** create shared libraries on Solaris systems. Therefore, libtool -*** is disabling shared libraries support. We urge you to upgrade GNU -*** binutils to release 2.9.1 or newer. Another option is to modify -*** your PATH or compiler configuration so that the native linker is -*** used, and then restart. - -EOF - elif $LD --help 2>&1 | egrep ': supported targets:.* elf' > /dev/null; then - archive_cmds='$CC -shared $libobjs $deplibs $linkopts ${wl}-soname $wl$soname -o $lib' - archive_expsym_cmds='$CC -shared $libobjs $deplibs $linkopts ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib' - else - ld_shlibs=no - fi - ;; - - sunos4*) - archive_cmds='$LD -assert pure-text -Bshareable -o $lib $libobjs $deplibs $linkopts' - wlarc= - hardcode_direct=yes - hardcode_shlibpath_var=no - ;; - - *) - if $LD --help 2>&1 | egrep ': supported targets:.* elf' > /dev/null; then - archive_cmds='$CC -shared $libobjs $deplibs $linkopts ${wl}-soname $wl$soname -o $lib' - archive_expsym_cmds='$CC -shared $libobjs $deplibs $linkopts ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib' - else - ld_shlibs=no - fi - ;; - esac - - if test "$ld_shlibs" = yes; then - runpath_var=LD_RUN_PATH - hardcode_libdir_flag_spec='${wl}--rpath ${wl}$libdir' - export_dynamic_flag_spec='${wl}--export-dynamic' - case $host_os in - cygwin* | mingw*) - # dlltool doesn't understand --whole-archive et. al. - whole_archive_flag_spec= - ;; - *) - # ancient GNU ld didn't support --whole-archive et. al. - if $LD --help 2>&1 | egrep 'no-whole-archive' > /dev/null; then - whole_archive_flag_spec="$wlarc"'--whole-archive$convenience '"$wlarc"'--no-whole-archive' - else - whole_archive_flag_spec= - fi - ;; - esac - fi -else - # PORTME fill in a description of your system's linker (not GNU ld) - case "$host_os" in - aix3*) - allow_undefined_flag=unsupported - always_export_symbols=yes - archive_expsym_cmds='$LD -o $objdir/$soname $libobjs $deplibs $linkopts -bE:$export_symbols -T512 -H512 -bM:SRE~$AR cru $lib $objdir/$soname' - # Note: this linker hardcodes the directories in LIBPATH if there - # are no directories specified by -L. - hardcode_minus_L=yes - if test "$with_gcc" = yes && test -z "$link_static_flag"; then - # Neither direct hardcoding nor static linking is supported with a - # broken collect2. - hardcode_direct=unsupported - fi - ;; - - aix4*) - hardcode_libdir_flag_spec='${wl}-b ${wl}nolibpath ${wl}-b ${wl}libpath:$libdir:/usr/lib:/lib' - hardcode_libdir_separator=':' - if test "$with_gcc" = yes; then - collect2name=`${CC} -print-prog-name=collect2` - if test -f "$collect2name" && \ - strings "$collect2name" | grep resolve_lib_name >/dev/null - then - # We have reworked collect2 - hardcode_direct=yes - else - # We have old collect2 - hardcode_direct=unsupported - # It fails to find uninstalled libraries when the uninstalled - # path is not listed in the libpath. Setting hardcode_minus_L - # to unsupported forces relinking - hardcode_minus_L=yes - hardcode_libdir_flag_spec='-L$libdir' - hardcode_libdir_separator= - fi - shared_flag='-shared' - else - shared_flag='${wl}-bM:SRE' - hardcode_direct=yes - fi - allow_undefined_flag=' ${wl}-berok' - archive_cmds="\$CC $shared_flag"' -o $objdir/$soname $libobjs $deplibs $linkopts ${wl}-bexpall ${wl}-bnoentry${allow_undefined_flag}' - archive_expsym_cmds="\$CC $shared_flag"' -o $objdir/$soname $libobjs $deplibs $linkopts ${wl}-bE:$export_symbols ${wl}-bnoentry${allow_undefined_flag}' - case "$host_os" in aix4.[01]|aix4.[01].*) - # According to Greg Wooledge, -bexpall is only supported from AIX 4.2 on - always_export_symbols=yes ;; - esac - ;; - - amigaos*) - archive_cmds='$rm $objdir/a2ixlibrary.data~$echo "#define NAME $libname" > $objdir/a2ixlibrary.data~$echo "#define LIBRARY_ID 1" >> $objdir/a2ixlibrary.data~$echo "#define VERSION $major" >> $objdir/a2ixlibrary.data~$echo "#define REVISION $revision" >> $objdir/a2ixlibrary.data~$AR cru $lib $libobjs~$RANLIB $lib~(cd $objdir && a2ixlibrary -32)' - hardcode_libdir_flag_spec='-L$libdir' - hardcode_minus_L=yes - # see comment about different semantics on the GNU ld section - ld_shlibs=no - ;; - - cygwin* | mingw*) - # When not using gcc, we currently assume that we are using - # Microsoft Visual C++. - # hardcode_libdir_flag_spec is actually meaningless, as there is - # no search path for DLLs. - hardcode_libdir_flag_spec=' ' - allow_undefined_flag=unsupported - # Tell ltmain to make .lib files, not .a files. - libext=lib - # FIXME: Setting linknames here is a bad hack. - archive_cmds='$CC -o $lib $libobjs $linkopts `echo "$deplibs" | sed -e '\''s/ -lc$//'\''` -link -dll~linknames=' - # The linker will automatically build a .lib file if we build a DLL. - old_archive_from_new_cmds='true' - # FIXME: Should let the user specify the lib program. - old_archive_cmds='lib /OUT:$oldlib$oldobjs' - fix_srcfile_path='`cygpath -w $srcfile`' - ;; - - freebsd1*) - ld_shlibs=no - ;; - - # FreeBSD 2.2.[012] allows us to include c++rt0.o to get C++ constructor - # support. Future versions do this automatically, but an explicit c++rt0.o - # does not break anything, and helps significantly (at the cost of a little - # extra space). - freebsd2.2*) - archive_cmds='$LD -Bshareable -o $lib $libobjs $deplibs $linkopts /usr/lib/c++rt0.o' - hardcode_libdir_flag_spec='-R$libdir' - hardcode_direct=yes - hardcode_shlibpath_var=no - ;; - - # Unfortunately, older versions of FreeBSD 2 do not have this feature. - freebsd2*) - archive_cmds='$LD -Bshareable -o $lib $libobjs $deplibs $linkopts' - hardcode_direct=yes - hardcode_minus_L=yes - hardcode_shlibpath_var=no - ;; - - # FreeBSD 3 and greater uses gcc -shared to do shared libraries. - freebsd*) - archive_cmds='$CC -shared -o $lib $libobjs $deplibs $linkopts' - hardcode_libdir_flag_spec='-R$libdir' - hardcode_direct=yes - hardcode_shlibpath_var=no - ;; - - hpux9* | hpux10* | hpux11*) - case "$host_os" in - hpux9*) archive_cmds='$rm $objdir/$soname~$LD -b +b $install_libdir -o $objdir/$soname $libobjs $deplibs $linkopts~test $objdir/$soname = $lib || mv $objdir/$soname $lib' ;; - *) archive_cmds='$LD -b +h $soname +b $install_libdir -o $lib $libobjs $deplibs $linkopts' ;; - esac - hardcode_libdir_flag_spec='${wl}+b ${wl}$libdir' - hardcode_libdir_separator=: - hardcode_direct=yes - hardcode_minus_L=yes # Not in the search PATH, but as the default - # location of the library. - export_dynamic_flag_spec='${wl}-E' - ;; - - irix5* | irix6*) - if test "$with_gcc" = yes; then - archive_cmds='$CC -shared $libobjs $deplibs $linkopts ${wl}-soname ${wl}$soname `test -n "$verstring" && echo ${wl}-set_version ${wl}$verstring` ${wl}-update_registry ${wl}${objdir}/so_locations -o $lib' - else - archive_cmds='$LD -shared $libobjs $deplibs $linkopts -soname $soname `test -n "$verstring" && echo -set_version $verstring` -update_registry ${objdir}/so_locations -o $lib' - fi - hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir' - hardcode_libdir_separator=: - ;; - - netbsd*) - if echo __ELF__ | $CC -E - | grep __ELF__ >/dev/null; then - archive_cmds='$LD -Bshareable -o $lib $libobjs $deplibs $linkopts' # a.out - else - archive_cmds='$LD -shared -o $lib $libobjs $deplibs $linkopts' # ELF - fi - hardcode_libdir_flag_spec='${wl}-R$libdir' - hardcode_direct=yes - hardcode_shlibpath_var=no - ;; - - openbsd*) - archive_cmds='$LD -Bshareable -o $lib $libobjs $deplibs $linkopts' - hardcode_libdir_flag_spec='-R$libdir' - hardcode_direct=yes - hardcode_shlibpath_var=no - ;; - - os2*) - hardcode_libdir_flag_spec='-L$libdir' - hardcode_minus_L=yes - allow_undefined_flag=unsupported - archive_cmds='$echo "LIBRARY $libname INITINSTANCE" > $objdir/$libname.def~$echo "DESCRIPTION \"$libname\"" >> $objdir/$libname.def~$echo DATA >> $objdir/$libname.def~$echo " SINGLE NONSHARED" >> $objdir/$libname.def~$echo EXPORTS >> $objdir/$libname.def~emxexp $libobjs >> $objdir/$libname.def~$CC -Zdll -Zcrtdll -o $lib $libobjs $deplibs $linkopts $objdir/$libname.def' - old_archive_from_new_cmds='emximp -o $objdir/$libname.a $objdir/$libname.def' - ;; - - osf3*) - if test "$with_gcc" = yes; then - allow_undefined_flag=' ${wl}-expect_unresolved ${wl}\*' - archive_cmds='$CC -shared${allow_undefined_flag} $libobjs $deplibs $linkopts ${wl}-soname ${wl}$soname `test -n "$verstring" && echo ${wl}-set_version ${wl}$verstring` ${wl}-update_registry ${wl}${objdir}/so_locations -o $lib' - else - allow_undefined_flag=' -expect_unresolved \*' - archive_cmds='$LD -shared${allow_undefined_flag} $libobjs $deplibs $linkopts -soname $soname `test -n "$verstring" && echo -set_version $verstring` -update_registry ${objdir}/so_locations -o $lib' - fi - hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir' - hardcode_libdir_separator=: - ;; - - osf4* | osf5*) # As osf3* with the addition of the -msym flag - if test "$with_gcc" = yes; then - allow_undefined_flag=' ${wl}-expect_unresolved ${wl}\*' - archive_cmds='$CC -shared${allow_undefined_flag} $libobjs $deplibs $linkopts ${wl}-msym ${wl}-soname ${wl}$soname `test -n "$verstring" && echo ${wl}-set_version ${wl}$verstring` ${wl}-update_registry ${wl}${objdir}/so_locations -o $lib' - else - allow_undefined_flag=' -expect_unresolved \*' - archive_cmds='$LD -shared${allow_undefined_flag} $libobjs $deplibs $linkopts -msym -soname $soname `test -n "$verstring" && echo -set_version $verstring` -update_registry ${objdir}/so_locations -o $lib' - fi - hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir' - hardcode_libdir_separator=: - ;; - - sco3.2v5*) - archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linkopts' - hardcode_shlibpath_var=no - runpath_var=LD_RUN_PATH - hardcode_runpath_var=yes - ;; - - solaris*) - no_undefined_flag=' -z text' - # $CC -shared without GNU ld will not create a library from C++ - # object files and a static libstdc++, better avoid it by now - archive_cmds='$LD -G${allow_undefined_flag} -h $soname -o $lib $libobjs $deplibs $linkopts' - archive_expsym_cmds='$echo "{ global:" > $lib.exp~cat $export_symbols | sed -e "s/\(.*\)/\1;/" >> $lib.exp~$echo "local: *; };" >> $lib.exp~ - $LD -G${allow_undefined_flag} -M $lib.exp -h $soname -o $lib $libobjs $deplibs $linkopts~$rm $lib.exp' - hardcode_libdir_flag_spec='-R$libdir' - hardcode_shlibpath_var=no - case "$host_os" in - solaris2.[0-5] | solaris2.[0-5].*) ;; - *) # Supported since Solaris 2.6 (maybe 2.5.1?) - whole_archive_flag_spec='-z allextract$convenience -z defaultextract' ;; - esac - ;; - - sunos4*) - archive_cmds='$LD -assert pure-text -Bstatic -o $lib $libobjs $deplibs $linkopts' - hardcode_libdir_flag_spec='-L$libdir' - hardcode_direct=yes - hardcode_minus_L=yes - hardcode_shlibpath_var=no - ;; - - sysv4) - archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linkopts' - runpath_var='LD_RUN_PATH' - hardcode_shlibpath_var=no - hardcode_direct=no #Motorola manual says yes, but my tests say they lie - ;; - - sysv4.3*) - archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linkopts' - hardcode_shlibpath_var=no - export_dynamic_flag_spec='-Bexport' - ;; - - sysv5*) - no_undefined_flag=' -z text' - # $CC -shared without GNU ld will not create a library from C++ - # object files and a static libstdc++, better avoid it by now - archive_cmds='$LD -G${allow_undefined_flag} -h $soname -o $lib $libobjs $deplibs $linkopts' - archive_expsym_cmds='$echo "{ global:" > $lib.exp~cat $export_symbols | sed -e "s/\(.*\)/\1;/" >> $lib.exp~$echo "local: *; };" >> $lib.exp~ - $LD -G${allow_undefined_flag} -M $lib.exp -h $soname -o $lib $libobjs $deplibs $linkopts~$rm $lib.exp' - hardcode_libdir_flag_spec= - hardcode_shlibpath_var=no - runpath_var='LD_RUN_PATH' - ;; - - uts4*) - archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linkopts' - hardcode_libdir_flag_spec='-L$libdir' - hardcode_shlibpath_var=no - ;; - - dgux*) - archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linkopts' - hardcode_libdir_flag_spec='-L$libdir' - hardcode_shlibpath_var=no - ;; - - sysv4*MP*) - if test -d /usr/nec; then - archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linkopts' - hardcode_shlibpath_var=no - runpath_var=LD_RUN_PATH - hardcode_runpath_var=yes - ld_shlibs=yes - fi - ;; - - sysv4.2uw2*) - archive_cmds='$LD -G -o $lib $libobjs $deplibs $linkopts' - hardcode_direct=yes - hardcode_minus_L=no - hardcode_shlibpath_var=no - hardcode_runpath_var=yes - runpath_var=LD_RUN_PATH - ;; - - unixware7*) - archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linkopts' - runpath_var='LD_RUN_PATH' - hardcode_shlibpath_var=no - ;; - - *) - ld_shlibs=no - ;; - esac -fi -echo "$ac_t$ld_shlibs" 1>&6 -test "$ld_shlibs" = no && can_build_shared=no - -if test -z "$NM"; then - echo $ac_n "checking for BSD-compatible nm... $ac_c" 1>&6 - case "$NM" in - [\\/]* | [A-Za-z]:[\\/]*) ;; # Let the user override the test with a path. - *) - IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS="${IFS}${PATH_SEPARATOR}" - for ac_dir in $PATH /usr/ucb /usr/ccs/bin /bin; do - test -z "$ac_dir" && ac_dir=. - if test -f $ac_dir/nm || test -f $ac_dir/nm$ac_exeext; then - # Check to see if the nm accepts a BSD-compat flag. - # Adding the `sed 1q' prevents false positives on HP-UX, which says: - # nm: unknown option "B" ignored - if ($ac_dir/nm -B /dev/null 2>&1 | sed '1q'; exit 0) | egrep /dev/null >/dev/null; then - NM="$ac_dir/nm -B" - break - elif ($ac_dir/nm -p /dev/null 2>&1 | sed '1q'; exit 0) | egrep /dev/null >/dev/null; then - NM="$ac_dir/nm -p" - break - else - NM=${NM="$ac_dir/nm"} # keep the first match, but - continue # so that we can try to find one that supports BSD flags - fi - fi - done - IFS="$ac_save_ifs" - test -z "$NM" && NM=nm - ;; - esac - echo "$ac_t$NM" 1>&6 -fi - -# Check for command to grab the raw symbol name followed by C symbol from nm. -echo $ac_n "checking command to parse $NM output... $ac_c" 1>&6 - -# These are sane defaults that work on at least a few old systems. -# [They come from Ultrix. What could be older than Ultrix?!! ;)] - -# Character class describing NM global symbol codes. -symcode='[BCDEGRST]' - -# Regexp to match symbols that can be accessed directly from C. -sympat='\([_A-Za-z][_A-Za-z0-9]*\)' - -# Transform the above into a raw symbol and a C symbol. -symxfrm='\1 \2\3 \3' - -# Transform an extracted symbol line into a proper C declaration -global_symbol_to_cdecl="sed -n -e 's/^. .* \(.*\)$/extern char \1;/p'" - -# Define system-specific variables. -case "$host_os" in -aix*) - symcode='[BCDT]' - ;; -cygwin* | mingw*) - symcode='[ABCDGISTW]' - ;; -hpux*) # Its linker distinguishes data from code symbols - global_symbol_to_cdecl="sed -n -e 's/^T .* \(.*\)$/extern char \1();/p' -e 's/^. .* \(.*\)$/extern char \1;/p'" - ;; -irix*) - symcode='[BCDEGRST]' - ;; -solaris*) - symcode='[BDT]' - ;; -sysv4) - symcode='[DFNSTU]' - ;; -esac - -# If we're using GNU nm, then use its standard symbol codes. -if $NM -V 2>&1 | egrep '(GNU|with BFD)' > /dev/null; then - symcode='[ABCDGISTW]' -fi - -# Try without a prefix undercore, then with it. -for ac_symprfx in "" "_"; do - - # Write the raw and C identifiers. - global_symbol_pipe="sed -n -e 's/^.*[ ]\($symcode\)[ ][ ]*\($ac_symprfx\)$sympat$/$symxfrm/p'" - - # Check to see that the pipe works correctly. - pipe_works=no - $rm conftest* - cat > conftest.c <&5 - if { (eval echo $progname:1636: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; } && test -s conftest.$objext; then - # Now try to grab the symbols. - nlist=conftest.nm - if { echo "$progname:1639: eval \"$NM conftest.$objext | $global_symbol_pipe > $nlist\"" >&5; eval "$NM conftest.$objext | $global_symbol_pipe > $nlist 2>&5"; } && test -s "$nlist"; then - - # Try sorting and uniquifying the output. - if sort "$nlist" | uniq > "$nlist"T; then - mv -f "$nlist"T "$nlist" - else - rm -f "$nlist"T - fi - - # Make sure that we snagged all the symbols we need. - if egrep ' nm_test_var$' "$nlist" >/dev/null; then - if egrep ' nm_test_func$' "$nlist" >/dev/null; then - cat < conftest.c -#ifdef __cplusplus -extern "C" { -#endif - -EOF - # Now generate the symbol file. - eval "$global_symbol_to_cdecl"' < "$nlist" >> conftest.c' - - cat <> conftest.c -#if defined (__STDC__) && __STDC__ -# define lt_ptr_t void * -#else -# define lt_ptr_t char * -# define const -#endif - -/* The mapping between symbol names and symbols. */ -const struct { - const char *name; - lt_ptr_t address; -} -lt_preloaded_symbols[] = -{ -EOF - sed 's/^. \(.*\) \(.*\)$/ {"\2", (lt_ptr_t) \&\2},/' < "$nlist" >> conftest.c - cat <<\EOF >> conftest.c - {0, (lt_ptr_t) 0} -}; - -#ifdef __cplusplus -} -#endif -EOF - # Now try linking the two files. - mv conftest.$objext conftstm.$objext - save_LIBS="$LIBS" - save_CFLAGS="$CFLAGS" - LIBS="conftstm.$objext" - CFLAGS="$CFLAGS$no_builtin_flag" - if { (eval echo $progname:1691: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then - pipe_works=yes - else - echo "$progname: failed program was:" >&5 - cat conftest.c >&5 - fi - LIBS="$save_LIBS" - else - echo "cannot find nm_test_func in $nlist" >&5 - fi - else - echo "cannot find nm_test_var in $nlist" >&5 - fi - else - echo "cannot run $global_symbol_pipe" >&5 - fi - else - echo "$progname: failed program was:" >&5 - cat conftest.c >&5 - fi - $rm conftest* conftst* - - # Do not use the global_symbol_pipe unless it works. - if test "$pipe_works" = yes; then - break - else - global_symbol_pipe= - fi -done -if test "$pipe_works" = yes; then - echo "${ac_t}ok" 1>&6 -else - echo "${ac_t}failed" 1>&6 -fi - -if test -z "$global_symbol_pipe"; then - global_symbol_to_cdecl= -fi - -# Check hardcoding attributes. -echo $ac_n "checking how to hardcode library paths into programs... $ac_c" 1>&6 -hardcode_action= -if test -n "$hardcode_libdir_flag_spec" || \ - test -n "$runpath_var"; then - - # We can hardcode non-existant directories. - if test "$hardcode_direct" != no && - # If the only mechanism to avoid hardcoding is shlibpath_var, we - # have to relink, otherwise we might link with an installed library - # when we should be linking with a yet-to-be-installed one - ## test "$hardcode_shlibpath_var" != no && - test "$hardcode_minus_L" != no; then - # Linking always hardcodes the temporary library directory. - hardcode_action=relink - else - # We can link without hardcoding, and we can hardcode nonexisting dirs. - hardcode_action=immediate - fi -else - # We cannot hardcode anything, or else we can only hardcode existing - # directories. - hardcode_action=unsupported -fi -echo "$ac_t$hardcode_action" 1>&6 - - -reload_flag= -reload_cmds='$LD$reload_flag -o $output$reload_objs' -echo $ac_n "checking for $LD option to reload object files... $ac_c" 1>&6 -# PORTME Some linkers may need a different reload flag. -reload_flag='-r' -echo "$ac_t$reload_flag" 1>&6 -test -n "$reload_flag" && reload_flag=" $reload_flag" - -# PORTME Fill in your ld.so characteristics -library_names_spec= -libname_spec='lib$name' -soname_spec= -postinstall_cmds= -postuninstall_cmds= -finish_cmds= -finish_eval= -shlibpath_var= -shlibpath_overrides_runpath=unknown -version_type=none -dynamic_linker="$host_os ld.so" -sys_lib_dlsearch_path_spec="/lib /usr/lib" -sys_lib_search_path_spec="/lib /usr/lib /usr/local/lib" -file_magic_cmd= -file_magic_test_file= -deplibs_check_method='unknown' -# Need to set the preceding variable on all platforms that support -# interlibrary dependencies. -# 'none' -- dependencies not supported. -# `unknown' -- same as none, but documents that we really don't know. -# 'pass_all' -- all dependencies passed with no checks. -# 'test_compile' -- check by making test program. -# 'file_magic [regex]' -- check by looking for files in library path -# which responds to the $file_magic_cmd with a given egrep regex. -# If you have `file' or equivalent on your system and you're not sure -# whether `pass_all' will *always* work, you probably want this one. -echo $ac_n "checking dynamic linker characteristics... $ac_c" 1>&6 -case "$host_os" in -aix3*) - version_type=linux - library_names_spec='${libname}${release}.so$versuffix $libname.a' - shlibpath_var=LIBPATH - - # AIX has no versioning support, so we append a major version to the name. - soname_spec='${libname}${release}.so$major' - ;; - -aix4*) - version_type=linux - # AIX has no versioning support, so currently we can not hardcode correct - # soname into executable. Probably we can add versioning support to - # collect2, so additional links can be useful in future. - # We preserve .a as extension for shared libraries though AIX4.2 - # and later linker supports .so - library_names_spec='${libname}${release}.so$versuffix ${libname}${release}.so$major $libname.a' - shlibpath_var=LIBPATH - deplibs_check_method=pass_all - ;; - -amigaos*) - library_names_spec='$libname.ixlibrary $libname.a' - # Create ${libname}_ixlibrary.a entries in /sys/libs. - finish_eval='for lib in `ls $libdir/*.ixlibrary 2>/dev/null`; do libname=`$echo "X$lib" | $Xsed -e '\''s%^.*/\([^/]*\)\.ixlibrary$%\1%'\''`; test $rm /sys/libs/${libname}_ixlibrary.a; $show "(cd /sys/libs && $LN_S $lib ${libname}_ixlibrary.a)"; (cd /sys/libs && $LN_S $lib ${libname}_ixlibrary.a) || exit 1; done' - ;; - -beos*) - library_names_spec='${libname}.so' - dynamic_linker="$host_os ld.so" - shlibpath_var=LIBRARY_PATH - deplibs_check_method=pass_all - lt_cv_dlopen="load_add_on" - lt_cv_dlopen_libs= - lt_cv_dlopen_self=yes - ;; - -bsdi4*) - version_type=linux - need_version=no - library_names_spec='${libname}${release}.so$versuffix ${libname}${release}.so$major $libname.so' - soname_spec='${libname}${release}.so$major' - finish_cmds='PATH="\$PATH:/sbin" ldconfig $libdir' - shlibpath_var=LD_LIBRARY_PATH - deplibs_check_method='file_magic ELF [0-9][0-9]*-bit [ML]SB (shared object|dynamic lib)' - file_magic_cmd=/usr/bin/file - file_magic_test_file=/shlib/libc.so - sys_lib_search_path_spec="/shlib /usr/lib /usr/X11/lib /usr/contrib/lib /lib /usr/local/lib" - sys_lib_dlsearch_path_spec="/shlib /usr/lib /usr/local/lib" - export_dynamic_flag_spec=-rdynamic - # the default ld.so.conf also contains /usr/contrib/lib and - # /usr/X11R6/lib (/usr/X11 is a link to /usr/X11R6), but let us allow - # libtool to hard-code these into programs - ;; - -cygwin* | mingw*) - version_type=windows - need_version=no - need_lib_prefix=no - if test "$with_gcc" = yes; then - library_names_spec='${libname}`echo ${release} | sed -e 's/[.]/-/g'`${versuffix}.dll $libname.a' - else - library_names_spec='${libname}`echo ${release} | sed -e 's/[.]/-/g'`${versuffix}.dll $libname.lib' - fi - dynamic_linker='Win32 ld.exe' - deplibs_check_method='file_magic file format pei*-i386(.*architecture: i386)?' - file_magic_cmd='${OBJDUMP} -f' - # FIXME: first we should search . and the directory the executable is in - shlibpath_var=PATH - lt_cv_dlopen="LoadLibrary" - lt_cv_dlopen_libs= - ;; - -freebsd1*) - dynamic_linker=no - ;; - -freebsd*) - objformat=`test -x /usr/bin/objformat && /usr/bin/objformat || echo aout` - version_type=freebsd-$objformat - case "$version_type" in - freebsd-elf*) - deplibs_check_method='file_magic ELF [0-9][0-9]*-bit [LM]SB shared object' - file_magic_cmd=/usr/bin/file - file_magic_test_file=`echo /usr/lib/libc.so*` - library_names_spec='${libname}${release}.so$versuffix ${libname}${release}.so $libname.so' - need_version=no - need_lib_prefix=no - ;; - freebsd-*) - deplibs_check_method=unknown - library_names_spec='${libname}${release}.so$versuffix $libname.so$versuffix' - need_version=yes - ;; - esac - shlibpath_var=LD_LIBRARY_PATH - case "$host_os" in - freebsd2* | freebsd3.[01]* | freebsdelf3.[01]*) - shlibpath_overrides_runpath=yes - ;; - *) # from 3.2 on - shlibpath_overrides_runpath=no - ;; - esac - ;; - -gnu*) - version_type=linux - need_lib_prefix=no - need_version=no - library_names_spec='${libname}${release}.so$versuffix ${libname}${release}.so${major} ${libname}.so' - soname_spec='${libname}${release}.so$major' - shlibpath_var=LD_LIBRARY_PATH - ;; - -hpux9* | hpux10* | hpux11*) - # Give a soname corresponding to the major version so that dld.sl refuses to - # link against other versions. - dynamic_linker="$host_os dld.sl" - version_type=sunos - need_lib_prefix=no - need_version=no - shlibpath_var=SHLIB_PATH - shlibpath_overrides_runpath=no # +s is required to enable SHLIB_PATH - library_names_spec='${libname}${release}.sl$versuffix ${libname}${release}.sl$major $libname.sl' - soname_spec='${libname}${release}.sl$major' - # HP-UX runs *really* slowly unless shared libraries are mode 555. - postinstall_cmds='chmod 555 $lib' - ;; - -irix5* | irix6*) - version_type=irix - need_lib_prefix=no - need_version=no - soname_spec='${libname}${release}.so.$major' - library_names_spec='${libname}${release}.so.$versuffix ${libname}${release}.so.$major ${libname}${release}.so $libname.so' - case "$host_os" in - irix5*) - libsuff= shlibsuff= - # this will be overridden with pass_all, but let us keep it just in case - deplibs_check_method="file_magic ELF 32-bit MSB dynamic lib MIPS - version 1" - ;; - *) - case "$LD" in # libtool.m4 will add one of these switches to LD - *-32|*"-32 ") libsuff= shlibsuff= libmagic=32-bit;; - *-n32|*"-n32 ") libsuff=32 shlibsuff=N32 libmagic=N32;; - *-64|*"-64 ") libsuff=64 shlibsuff=64 libmagic=64-bit;; - *) libsuff= shlibsuff= libmagic=never-match;; - esac - ;; - esac - shlibpath_var=LD_LIBRARY${shlibsuff}_PATH - shlibpath_overrides_runpath=no - sys_lib_search_path_spec="/usr/lib${libsuff} /lib${libsuff} /usr/local/lib${libsuff}" - sys_lib_dlsearch_path_spec="/usr/lib${libsuff} /lib${libsuff}" - file_magic_cmd=/usr/bin/file - file_magic_test_file=`echo /lib${libsuff}/libc.so*` - deplibs_check_method='pass_all' - ;; - -# No shared lib support for Linux oldld, aout, or coff. -linux-gnuoldld* | linux-gnuaout* | linux-gnucoff*) - dynamic_linker=no - ;; - -# This must be Linux ELF. -linux-gnu*) - version_type=linux - need_lib_prefix=no - need_version=no - library_names_spec='${libname}${release}.so$versuffix ${libname}${release}.so$major $libname.so' - soname_spec='${libname}${release}.so$major' - finish_cmds='PATH="\$PATH:/sbin" ldconfig -n $libdir' - shlibpath_var=LD_LIBRARY_PATH - shlibpath_overrides_runpath=no - deplibs_check_method='file_magic ELF [0-9][0-9]*-bit [LM]SB (shared object|dynamic lib )' - file_magic_cmd=/usr/bin/file - file_magic_test_file=`echo /lib/libc.so* /lib/libc-*.so` - - if test -f /lib/ld.so.1; then - dynamic_linker='GNU ld.so' - else - # Only the GNU ld.so supports shared libraries on MkLinux. - case "$host_cpu" in - powerpc*) dynamic_linker=no ;; - *) dynamic_linker='Linux ld.so' ;; - esac - fi - ;; - -netbsd*) - version_type=sunos - if echo __ELF__ | $CC -E - | grep __ELF__ >/dev/null; then - library_names_spec='${libname}${release}.so$versuffix ${libname}.so$versuffix' - finish_cmds='PATH="\$PATH:/sbin" ldconfig -m $libdir' - dynamic_linker='NetBSD (a.out) ld.so' - else - library_names_spec='${libname}${release}.so$versuffix ${libname}${release}.so$major ${libname}${release}.so ${libname}.so' - soname_spec='${libname}${release}.so$major' - dynamic_linker='NetBSD ld.elf_so' - fi - shlibpath_var=LD_LIBRARY_PATH - ;; - -openbsd*) - version_type=sunos - if test "$with_gnu_ld" = yes; then - need_lib_prefix=no - need_version=no - fi - library_names_spec='${libname}${release}.so$versuffix ${libname}.so$versuffix' - finish_cmds='PATH="\$PATH:/sbin" ldconfig -m $libdir' - shlibpath_var=LD_LIBRARY_PATH - ;; - -os2*) - libname_spec='$name' - need_lib_prefix=no - library_names_spec='$libname.dll $libname.a' - dynamic_linker='OS/2 ld.exe' - shlibpath_var=LIBPATH - ;; - -osf3* | osf4* | osf5*) - version_type=osf - need_version=no - soname_spec='${libname}${release}.so' - library_names_spec='${libname}${release}.so$versuffix ${libname}${release}.so $libname.so' - shlibpath_var=LD_LIBRARY_PATH - # this will be overridden with pass_all, but let us keep it just in case - deplibs_check_method='file_magic COFF format alpha shared library' - file_magic_cmd=/usr/bin/file - file_magic_test_file=/shlib/libc.so - deplibs_check_method='pass_all' - sys_lib_search_path_spec="/usr/shlib /usr/ccs/lib /usr/lib/cmplrs/cc /usr/lib /usr/local/lib /var/shlib" - sys_lib_dlsearch_path_spec="$sys_lib_search_path_spec" - ;; - -sco3.2v5*) - version_type=osf - soname_spec='${libname}${release}.so$major' - library_names_spec='${libname}${release}.so$versuffix ${libname}${release}.so$major $libname.so' - shlibpath_var=LD_LIBRARY_PATH - ;; - -solaris*) - version_type=linux - need_lib_prefix=no - need_version=no - library_names_spec='${libname}${release}.so$versuffix ${libname}${release}.so$major $libname.so' - soname_spec='${libname}${release}.so$major' - shlibpath_var=LD_LIBRARY_PATH - shlibpath_overrides_runpath=yes - # ldd complains unless libraries are executable - postinstall_cmds='chmod +x $lib' - deplibs_check_method="file_magic ELF [0-9][0-9]-bit [LM]SB dynamic lib" - file_magic_cmd=/usr/bin/file - file_magic_test_file=/lib/libc.so - ;; - -sunos4*) - version_type=sunos - library_names_spec='${libname}${release}.so$versuffix ${libname}.so$versuffix' - finish_cmds='PATH="\$PATH:/usr/etc" ldconfig $libdir' - shlibpath_var=LD_LIBRARY_PATH - shlibpath_overrides_runpath=yes - if test "$with_gnu_ld" = yes; then - need_lib_prefix=no - fi - need_version=yes - ;; - -sysv4 | sysv4.2uw2* | sysv4.3* | sysv5*) - version_type=linux - library_names_spec='${libname}${release}.so$versuffix ${libname}${release}.so$major $libname.so' - soname_spec='${libname}${release}.so$major' - shlibpath_var=LD_LIBRARY_PATH - case "$host_vendor" in - ncr) - deplibs_check_method='pass_all' - ;; - motorola) - need_lib_prefix=no - need_version=no - shlibpath_overrides_runpath=no - sys_lib_search_path_spec='/lib /usr/lib /usr/ccs/lib' - deplibs_check_method='file_magic ELF [0-9][0-9]*-bit [ML]SB (shared object|dynamic lib) M[0-9][0-9]* Version [0-9]' - file_magic_cmd=/usr/bin/file - file_magic_test_file=`echo /usr/lib/libc.so*` - ;; - esac - ;; - -uts4*) - version_type=linux - library_names_spec='${libname}${release}.so$versuffix ${libname}${release}.so$major $libname.so' - soname_spec='${libname}${release}.so$major' - shlibpath_var=LD_LIBRARY_PATH - ;; - -dgux*) - version_type=linux - need_lib_prefix=no - need_version=no - library_names_spec='${libname}${release}.so$versuffix ${libname}${release}.so$major $libname.so' - soname_spec='${libname}${release}.so$major' - shlibpath_var=LD_LIBRARY_PATH - ;; - -sysv4*MP*) - if test -d /usr/nec ;then - version_type=linux - library_names_spec='$libname.so.$versuffix $libname.so.$major $libname.so' - soname_spec='$libname.so.$major' - shlibpath_var=LD_LIBRARY_PATH - fi - ;; - -*) - dynamic_linker=no - ;; -esac -echo "$ac_t$dynamic_linker" 1>&6 -test "$dynamic_linker" = no && can_build_shared=no - -# Report the final consequences. -echo "checking if libtool supports shared libraries... $can_build_shared" 1>&6 - -# Only try to build win32 dlls if AC_LIBTOOL_WIN32_DLL was used in -# configure.in, otherwise build static only libraries. -case "$host_os" in -cygwin* | mingw* | os2*) - if test x$can_build_shared = xyes; then - test x$enable_win32_dll = xno && can_build_shared=no - echo "checking if package supports dlls... $can_build_shared" 1>&6 - fi -;; -esac - -if test -n "$file_magic_test_file" && test -n "$file_magic_cmd"; then - case "$deplibs_check_method" in - "file_magic "*) - file_magic_regex="`expr \"$deplibs_check_method\" : \"file_magic \(.*\)\"`" - if eval $file_magic_cmd \$file_magic_test_file 2> /dev/null | - egrep "$file_magic_regex" > /dev/null; then - : - else - cat <&2 - -*** Warning: the command libtool uses to detect shared libraries, -*** $file_magic_cmd, produces output that libtool cannot recognize. -*** The result is that libtool may fail to recognize shared libraries -*** as such. This will affect the creation of libtool libraries that -*** depend on shared libraries, but programs linked with such libtool -*** libraries will work regardless of this problem. Nevertheless, you -*** may want to report the problem to your system manager and/or to -*** bug-libtool@gnu.org - -EOF - fi ;; - esac -fi - -echo $ac_n "checking whether to build shared libraries... $ac_c" 1>&6 -test "$can_build_shared" = "no" && enable_shared=no - -# On AIX, shared libraries and static libraries use the same namespace, and -# are all built from PIC. -case "$host_os" in -aix3*) - test "$enable_shared" = yes && enable_static=no - if test -n "$RANLIB"; then - archive_cmds="$archive_cmds~\$RANLIB \$lib" - postinstall_cmds='$RANLIB $lib' - fi - ;; - -aix4*) - test "$enable_shared" = yes && enable_static=no - ;; -esac - -echo "$ac_t$enable_shared" 1>&6 - -# Make sure either enable_shared or enable_static is yes. -test "$enable_shared" = yes || enable_static=yes - -echo "checking whether to build static libraries... $enable_static" 1>&6 - -if test "$hardcode_action" = relink; then - # Fast installation is not supported - enable_fast_install=no -elif test "$shlibpath_overrides_runpath" = yes || - test "$enable_shared" = no; then - # Fast installation is not necessary - enable_fast_install=needless -fi - -echo $ac_n "checking for objdir... $ac_c" 1>&6 -rm -f .libs 2>/dev/null -mkdir .libs 2>/dev/null -if test -d .libs; then - objdir=.libs -else - # MS-DOS does not allow filenames that begin with a dot. - objdir=_libs -fi -rmdir .libs 2>/dev/null -echo "$ac_t$objdir" 1>&6 - -if test "x$enable_dlopen" != xyes; then - enable_dlopen=unknown - enable_dlopen_self=unknown - enable_dlopen_self_static=unknown -else -if eval "test \"`echo '$''{'lt_cv_dlopen'+set}'`\" != set"; then - lt_cv_dlopen=no lt_cv_dlopen_libs= -echo $ac_n "checking for dlopen in -ldl""... $ac_c" 1>&6 -echo "$progname:2212: checking for dlopen in -ldl" >&5 -ac_lib_var=`echo dl'_'dlopen | sed 'y%./+-%__p_%'` -if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then - echo $ac_n "(cached) $ac_c" 1>&6 -else - ac_save_LIBS="$LIBS" -LIBS="-ldl $LIBS" -cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then - rm -rf conftest* - eval "ac_cv_lib_$ac_lib_var=yes" -else - echo "$progname: failed program was:" >&5 - cat conftest.$ac_ext >&5 - rm -rf conftest* - eval "ac_cv_lib_$ac_lib_var=no" -fi -rm -f conftest* -LIBS="$ac_save_LIBS" - -fi -if eval "test \"`echo '$ac_cv_lib_'$ac_lib_var`\" = yes"; then - echo "$ac_t""yes" 1>&6 - lt_cv_dlopen="dlopen" lt_cv_dlopen_libs="-ldl" -else - echo "$ac_t""no" 1>&6 -echo $ac_n "checking for dlopen""... $ac_c" 1>&6 -echo "$progname:2252: checking for dlopen" >&5 -if eval "test \"`echo '$''{'ac_cv_func_dlopen'+set}'`\" = set"; then - echo $ac_n "(cached) $ac_c" 1>&6 -else - cat > conftest.$ac_ext < -/* Override any gcc2 internal prototype to avoid an error. */ -/* We use char because int might match the return type of a gcc2 - builtin and then its argument prototype would still apply. */ -#ifdef __cplusplus -extern "C" -#endif -char dlopen(); - -int main() { - -/* The GNU C library defines this for functions which it implements - to always fail with ENOSYS. Some functions are actually named - something starting with __ and the normal name is an alias. */ -#if defined (__stub_dlopen) || defined (__stub___dlopen) -choke me -#else -dlopen(); -#endif - -; return 0; } -EOF -if { (eval echo $progname:2282: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then - rm -rf conftest* - eval "ac_cv_func_dlopen=yes" -else - echo "$progname: failed program was:" >&5 - cat conftest.$ac_ext >&5 - rm -rf conftest* - eval "ac_cv_func_dlopen=no" -fi -rm -f conftest* -fi -if eval "test \"`echo '$ac_cv_func_'dlopen`\" = yes"; then - echo "$ac_t""yes" 1>&6 - lt_cv_dlopen="dlopen" -else - echo "$ac_t""no" 1>&6 -echo $ac_n "checking for dld_link in -ldld""... $ac_c" 1>&6 -echo "$progname:2299: checking for dld_link in -ldld" >&5 -ac_lib_var=`echo dld'_'dld_link | sed 'y%./+-%__p_%'` -if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then - echo $ac_n "(cached) $ac_c" 1>&6 -else - ac_save_LIBS="$LIBS" -LIBS="-ldld $LIBS" -cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then - rm -rf conftest* - eval "ac_cv_lib_$ac_lib_var=yes" -else - echo "$progname: failed program was:" >&5 - cat conftest.$ac_ext >&5 - rm -rf conftest* - eval "ac_cv_lib_$ac_lib_var=no" -fi -rm -f conftest* -LIBS="$ac_save_LIBS" - -fi -if eval "test \"`echo '$ac_cv_lib_'$ac_lib_var`\" = yes"; then - echo "$ac_t""yes" 1>&6 - lt_cv_dlopen="dld_link" lt_cv_dlopen_libs="-ldld" -else - echo "$ac_t""no" 1>&6 -echo $ac_n "checking for shl_load""... $ac_c" 1>&6 -echo "$progname:2339: checking for shl_load" >&5 -if eval "test \"`echo '$''{'ac_cv_func_shl_load'+set}'`\" = set"; then - echo $ac_n "(cached) $ac_c" 1>&6 -else - cat > conftest.$ac_ext < -/* Override any gcc2 internal prototype to avoid an error. */ -/* We use char because int might match the return type of a gcc2 - builtin and then its argument prototype would still apply. */ -#ifdef __cplusplus -extern "C" -#endif -char shl_load(); - -int main() { - -/* The GNU C library defines this for functions which it implements - to always fail with ENOSYS. Some functions are actually named - something starting with __ and the normal name is an alias. */ -#if defined (__stub_shl_load) || defined (__stub___shl_load) -choke me -#else -shl_load(); -#endif - -; return 0; } -EOF -if { (eval echo $progname:2369: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then - rm -rf conftest* - eval "ac_cv_func_shl_load=yes" -else - echo "$progname: failed program was:" >&5 - cat conftest.$ac_ext >&5 - rm -rf conftest* - eval "ac_cv_func_shl_load=no" -fi -rm -f conftest* -fi - -if eval "test \"`echo '$ac_cv_func_'shl_load`\" = yes"; then - echo "$ac_t""yes" 1>&6 - lt_cv_dlopen="shl_load" -else - echo "$ac_t""no" 1>&6 -echo $ac_n "checking for shl_load in -ldld""... $ac_c" 1>&6 -echo "$progname:2387: checking for shl_load in -ldld" >&5 -ac_lib_var=`echo dld'_'shl_load | sed 'y%./+-%__p_%'` -if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then - echo $ac_n "(cached) $ac_c" 1>&6 -else - ac_save_LIBS="$LIBS" -LIBS="-ldld $LIBS" -cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then - rm -rf conftest* - eval "ac_cv_lib_$ac_lib_var=yes" -else - echo "$progname: failed program was:" >&5 - cat conftest.$ac_ext >&5 - rm -rf conftest* - eval "ac_cv_lib_$ac_lib_var=no" -fi -rm -f conftest* -LIBS="$ac_save_LIBS" - -fi -if eval "test \"`echo '$ac_cv_lib_'$ac_lib_var`\" = yes"; then - echo "$ac_t""yes" 1>&6 - lt_cv_dlopen="shl_load" lt_cv_dlopen_libs="-ldld" -else - echo "$ac_t""no" 1>&6 -fi - - -fi - - -fi - - -fi - - -fi - -fi - - if test "x$lt_cv_dlopen" != xno; then - enable_dlopen=yes - fi - - case "$lt_cv_dlopen" in - dlopen) -for ac_hdr in dlfcn.h; do -ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'` -echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6 -echo "$progname:2452: checking for $ac_hdr" >&5 -if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then - echo $ac_n "(cached) $ac_c" 1>&6 -else - cat > conftest.$ac_ext < -int fnord = 0; -EOF -ac_try="$ac_compile >/dev/null 2>conftest.out" -{ (eval echo $progname:2462: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } -ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` -if test -z "$ac_err"; then - rm -rf conftest* - eval "ac_cv_header_$ac_safe=yes" -else - echo "$ac_err" >&5 - echo "$progname: failed program was:" >&5 - cat conftest.$ac_ext >&5 - rm -rf conftest* - eval "ac_cv_header_$ac_safe=no" -fi -rm -f conftest* -fi -if eval "test \"`echo '$ac_cv_header_'$ac_safe`\" = yes"; then - echo "$ac_t""yes" 1>&6 -else - echo "$ac_t""no" 1>&6 -fi -done - - if test "x$ac_cv_header_dlfcn_h" = xyes; then - CPPFLAGS="$CPPFLAGS -DHAVE_DLFCN_H" - fi - eval LDFLAGS=\"\$LDFLAGS $export_dynamic_flag_spec\" - LIBS="$lt_cv_dlopen_libs $LIBS" - - echo $ac_n "checking whether a program can dlopen itself""... $ac_c" 1>&6 -echo "$progname:2490: checking whether a program can dlopen itself" >&5 -if test "${lt_cv_dlopen_self+set}" = set; then - echo $ac_n "(cached) $ac_c" 1>&6 -else - if test "$cross_compiling" = yes; then - lt_cv_dlopen_self=cross - else - cat > conftest.c < -#endif - -#include - -#ifdef RTLD_GLOBAL -# define LTDL_GLOBAL RTLD_GLOBAL -#else -# ifdef DL_GLOBAL -# define LTDL_GLOBAL DL_GLOBAL -# else -# define LTDL_GLOBAL 0 -# endif -#endif - -/* We may have to define LTDL_LAZY_OR_NOW in the command line if we - find out it does not work in some platform. */ -#ifndef LTDL_LAZY_OR_NOW -# ifdef RTLD_LAZY -# define LTDL_LAZY_OR_NOW RTLD_LAZY -# else -# ifdef DL_LAZY -# define LTDL_LAZY_OR_NOW DL_LAZY -# else -# ifdef RTLD_NOW -# define LTDL_LAZY_OR_NOW RTLD_NOW -# else -# ifdef DL_NOW -# define LTDL_LAZY_OR_NOW DL_NOW -# else -# define LTDL_LAZY_OR_NOW 0 -# endif -# endif -# endif -# endif -#endif - -fnord() { int i=42;} -main() { void *self, *ptr1, *ptr2; self=dlopen(0,LTDL_GLOBAL|LTDL_LAZY_OR_NOW); - if(self) { ptr1=dlsym(self,"fnord"); ptr2=dlsym(self,"_fnord"); - if(ptr1 || ptr2) { dlclose(self); exit(0); } } exit(1); } - -EOF -if { (eval echo $progname:2544: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest && (./conftest; exit) 2>/dev/null -then - lt_cv_dlopen_self=yes -else - echo "$progname: failed program was:" >&5 - cat conftest.$ac_ext >&5 - rm -fr conftest* - lt_cv_dlopen_self=no -fi -rm -fr conftest* -fi - -fi - -echo "$ac_t""$lt_cv_dlopen_self" 1>&6 - - if test "$lt_cv_dlopen_self" = yes; then - LDFLAGS="$LDFLAGS $link_static_flag" - echo $ac_n "checking whether a statically linked program can dlopen itself""... $ac_c" 1>&6 -echo "$progname:2563: checking whether a statically linked program can dlopen itself" >&5 -if test "${lt_cv_dlopen_self_static+set}" = set; then - echo $ac_n "(cached) $ac_c" 1>&6 -else - if test "$cross_compiling" = yes; then - lt_cv_dlopen_self_static=cross - else - cat > conftest.c < -#endif - -#include - -#ifdef RTLD_GLOBAL -# define LTDL_GLOBAL RTLD_GLOBAL -#else -# ifdef DL_GLOBAL -# define LTDL_GLOBAL DL_GLOBAL -# else -# define LTDL_GLOBAL 0 -# endif -#endif - -/* We may have to define LTDL_LAZY_OR_NOW in the command line if we - find out it does not work in some platform. */ -#ifndef LTDL_LAZY_OR_NOW -# ifdef RTLD_LAZY -# define LTDL_LAZY_OR_NOW RTLD_LAZY -# else -# ifdef DL_LAZY -# define LTDL_LAZY_OR_NOW DL_LAZY -# else -# ifdef RTLD_NOW -# define LTDL_LAZY_OR_NOW RTLD_NOW -# else -# ifdef DL_NOW -# define LTDL_LAZY_OR_NOW DL_NOW -# else -# define LTDL_LAZY_OR_NOW 0 -# endif -# endif -# endif -# endif -#endif - -fnord() { int i=42;} -main() { void *self, *ptr1, *ptr2; self=dlopen(0,LTDL_GLOBAL|LTDL_LAZY_OR_NOW); - if(self) { ptr1=dlsym(self,"fnord"); ptr2=dlsym(self,"_fnord"); - if(ptr1 || ptr2) { dlclose(self); exit(0); } } exit(1); } - -EOF -if { (eval echo $progname:2617: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest && (./conftest; exit) 2>/dev/null -then - lt_cv_dlopen_self_static=yes -else - echo "$progname: failed program was:" >&5 - cat conftest.$ac_ext >&5 - rm -fr conftest* - lt_cv_dlopen_self_static=no -fi -rm -fr conftest* -fi - -fi - -echo "$ac_t""$lt_cv_dlopen_self_static" 1>&6 -fi - ;; - esac - - case "$lt_cv_dlopen_self" in - yes|no) enable_dlopen_self=$lt_cv_dlopen_self ;; - *) enable_dlopen_self=unknown ;; - esac - - case "$lt_cv_dlopen_self_static" in - yes|no) enable_dlopen_self_static=$lt_cv_dlopen_self_static ;; - *) enable_dlopen_self_static=unknown ;; - esac -fi - -# Copy echo and quote the copy, instead of the original, because it is -# used later. -ltecho="$echo" -if test "X$ltecho" = "X$CONFIG_SHELL $0 --fallback-echo"; then - ltecho="$CONFIG_SHELL \$0 --fallback-echo" -fi -LTSHELL="$SHELL" - -LTCONFIG_VERSION="$VERSION" - -# Only quote variables if we're using ltmain.sh. -case "$ltmain" in -*.sh) - # Now quote all the things that may contain metacharacters. - for var in ltecho old_CC old_CFLAGS old_CPPFLAGS \ - old_LD old_LDFLAGS old_LIBS \ - old_NM old_RANLIB old_LN_S old_DLLTOOL old_OBJDUMP old_AS \ - AR CC LD LN_S NM LTSHELL LTCONFIG_VERSION \ - reload_flag reload_cmds wl \ - pic_flag link_static_flag no_builtin_flag export_dynamic_flag_spec \ - thread_safe_flag_spec whole_archive_flag_spec libname_spec \ - library_names_spec soname_spec \ - RANLIB old_archive_cmds old_archive_from_new_cmds old_postinstall_cmds \ - old_postuninstall_cmds archive_cmds archive_expsym_cmds postinstall_cmds postuninstall_cmds \ - file_magic_cmd export_symbols_cmds deplibs_check_method allow_undefined_flag no_undefined_flag \ - finish_cmds finish_eval global_symbol_pipe global_symbol_to_cdecl \ - hardcode_libdir_flag_spec hardcode_libdir_separator \ - sys_lib_search_path_spec sys_lib_dlsearch_path_spec \ - compiler_c_o compiler_o_lo need_locks exclude_expsyms include_expsyms; do - - case "$var" in - reload_cmds | old_archive_cmds | old_archive_from_new_cmds | \ - old_postinstall_cmds | old_postuninstall_cmds | \ - export_symbols_cmds | archive_cmds | archive_expsym_cmds | \ - postinstall_cmds | postuninstall_cmds | \ - finish_cmds | sys_lib_search_path_spec | sys_lib_dlsearch_path_spec) - # Double-quote double-evaled strings. - eval "$var=\\\"\`\$echo \"X\$$var\" | \$Xsed -e \"\$double_quote_subst\" -e \"\$sed_quote_subst\" -e \"\$delay_variable_subst\"\`\\\"" - ;; - *) - eval "$var=\\\"\`\$echo \"X\$$var\" | \$Xsed -e \"\$sed_quote_subst\"\`\\\"" - ;; - esac - done - - case "$ltecho" in - *'\$0 --fallback-echo"') - ltecho=`$echo "X$ltecho" | $Xsed -e 's/\\\\\\\$0 --fallback-echo"$/$0 --fallback-echo"/'` - ;; - esac - - trap "$rm \"$ofile\"; exit 1" 1 2 15 - echo "creating $ofile" - $rm "$ofile" - cat < "$ofile" -#! $SHELL - -# `$echo "$ofile" | sed 's%^.*/%%'` - Provide generalized library-building support services. -# Generated automatically by $PROGRAM (GNU $PACKAGE $VERSION$TIMESTAMP) -# NOTE: Changes made to this file will be lost: look at ltconfig or ltmain.sh. -# -# Copyright (C) 1996-1999 Free Software Foundation, Inc. -# Originally by Gordon Matzigkeit , 1996 -# -# This program is free software; you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation; either version 2 of the License, or -# (at your option) any later version. -# -# This program is distributed in the hope that it will be useful, but -# WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -# General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with this program; if not, write to the Free Software -# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. -# -# As a special exception to the GNU General Public License, if you -# distribute this file as part of a program that contains a -# configuration script generated by Autoconf, you may include it under -# the same distribution terms that you use for the rest of that program. - -# Sed that helps us avoid accidentally triggering echo(1) options like -n. -Xsed="sed -e s/^X//" - -# The HP-UX ksh and POSIX shell print the target directory to stdout -# if CDPATH is set. -if test "X\${CDPATH+set}" = Xset; then CDPATH=:; export CDPATH; fi - -### BEGIN LIBTOOL CONFIG -EOF - cfgfile="$ofile" - ;; - -*) - # Double-quote the variables that need it (for aesthetics). - for var in old_CC old_CFLAGS old_CPPFLAGS \ - old_LD old_LDFLAGS old_LIBS \ - old_NM old_RANLIB old_LN_S old_DLLTOOL old_OBJDUMP old_AS; do - eval "$var=\\\"\$var\\\"" - done - - # Just create a config file. - cfgfile="$ofile.cfg" - trap "$rm \"$cfgfile\"; exit 1" 1 2 15 - echo "creating $cfgfile" - $rm "$cfgfile" - cat < "$cfgfile" -# `$echo "$cfgfile" | sed 's%^.*/%%'` - Libtool configuration file. -# Generated automatically by $PROGRAM (GNU $PACKAGE $VERSION$TIMESTAMP) -EOF - ;; -esac - -cat <> "$cfgfile" -# Libtool was configured as follows, on host `(hostname || uname -n) 2>/dev/null | sed 1q`: -# -# CC=$old_CC CFLAGS=$old_CFLAGS CPPFLAGS=$old_CPPFLAGS \\ -# LD=$old_LD LDFLAGS=$old_LDFLAGS LIBS=$old_LIBS \\ -# NM=$old_NM RANLIB=$old_RANLIB LN_S=$old_LN_S \\ -# DLLTOOL=$old_DLLTOOL OBJDUMP=$old_OBJDUMP AS=$old_AS \\ -# $0$ltconfig_args -# -# Compiler and other test output produced by $progname, useful for -# debugging $progname, is in ./config.log if it exists. - -# The version of $progname that generated this script. -LTCONFIG_VERSION=$LTCONFIG_VERSION - -# Shell to use when invoking shell scripts. -SHELL=$LTSHELL - -# Whether or not to build shared libraries. -build_libtool_libs=$enable_shared - -# Whether or not to build static libraries. -build_old_libs=$enable_static - -# Whether or not to optimize for fast installation. -fast_install=$enable_fast_install - -# The host system. -host_alias=$host_alias -host=$host - -# An echo program that does not interpret backslashes. -echo=$ltecho - -# The archiver. -AR=$AR - -# The default C compiler. -CC=$CC - -# The linker used to build libraries. -LD=$LD - -# Whether we need hard or soft links. -LN_S=$LN_S - -# A BSD-compatible nm program. -NM=$NM - -# Used on cygwin: DLL creation program. -DLLTOOL="$DLLTOOL" - -# Used on cygwin: object dumper. -OBJDUMP="$OBJDUMP" - -# Used on cygwin: assembler. -AS="$AS" - -# The name of the directory that contains temporary libtool files. -objdir=$objdir - -# How to create reloadable object files. -reload_flag=$reload_flag -reload_cmds=$reload_cmds - -# How to pass a linker flag through the compiler. -wl=$wl - -# Object file suffix (normally "o"). -objext="$objext" - -# Old archive suffix (normally "a"). -libext="$libext" - -# Executable file suffix (normally ""). -exeext="$exeext" - -# Additional compiler flags for building library objects. -pic_flag=$pic_flag - -# Does compiler simultaneously support -c and -o options? -compiler_c_o=$compiler_c_o - -# Can we write directly to a .lo ? -compiler_o_lo=$compiler_o_lo - -# Must we lock files when doing compilation ? -need_locks=$need_locks - -# Do we need the lib prefix for modules? -need_lib_prefix=$need_lib_prefix - -# Do we need a version for libraries? -need_version=$need_version - -# Whether dlopen is supported. -dlopen=$enable_dlopen - -# Whether dlopen of programs is supported. -dlopen_self=$enable_dlopen_self - -# Whether dlopen of statically linked programs is supported. -dlopen_self_static=$enable_dlopen_self_static - -# Compiler flag to prevent dynamic linking. -link_static_flag=$link_static_flag - -# Compiler flag to turn off builtin functions. -no_builtin_flag=$no_builtin_flag - -# Compiler flag to allow reflexive dlopens. -export_dynamic_flag_spec=$export_dynamic_flag_spec - -# Compiler flag to generate shared objects directly from archives. -whole_archive_flag_spec=$whole_archive_flag_spec - -# Compiler flag to generate thread-safe objects. -thread_safe_flag_spec=$thread_safe_flag_spec - -# Library versioning type. -version_type=$version_type - -# Format of library name prefix. -libname_spec=$libname_spec - -# List of archive names. First name is the real one, the rest are links. -# The last name is the one that the linker finds with -lNAME. -library_names_spec=$library_names_spec - -# The coded name of the library, if different from the real name. -soname_spec=$soname_spec - -# Commands used to build and install an old-style archive. -RANLIB=$RANLIB -old_archive_cmds=$old_archive_cmds -old_postinstall_cmds=$old_postinstall_cmds -old_postuninstall_cmds=$old_postuninstall_cmds - -# Create an old-style archive from a shared archive. -old_archive_from_new_cmds=$old_archive_from_new_cmds - -# Commands used to build and install a shared archive. -archive_cmds=$archive_cmds -archive_expsym_cmds=$archive_expsym_cmds -postinstall_cmds=$postinstall_cmds -postuninstall_cmds=$postuninstall_cmds - -# Method to check whether dependent libraries are shared objects. -deplibs_check_method=$deplibs_check_method - -# Command to use when deplibs_check_method == file_magic. -file_magic_cmd=$file_magic_cmd - -# Flag that allows shared libraries with undefined symbols to be built. -allow_undefined_flag=$allow_undefined_flag - -# Flag that forces no undefined symbols. -no_undefined_flag=$no_undefined_flag - -# Commands used to finish a libtool library installation in a directory. -finish_cmds=$finish_cmds - -# Same as above, but a single script fragment to be evaled but not shown. -finish_eval=$finish_eval - -# Take the output of nm and produce a listing of raw symbols and C names. -global_symbol_pipe=$global_symbol_pipe - -# Transform the output of nm in a proper C declaration -global_symbol_to_cdecl=$global_symbol_to_cdecl - -# This is the shared library runtime path variable. -runpath_var=$runpath_var - -# This is the shared library path variable. -shlibpath_var=$shlibpath_var - -# Is shlibpath searched before the hard-coded library search path? -shlibpath_overrides_runpath=$shlibpath_overrides_runpath - -# How to hardcode a shared library path into an executable. -hardcode_action=$hardcode_action - -# Flag to hardcode \$libdir into a binary during linking. -# This must work even if \$libdir does not exist. -hardcode_libdir_flag_spec=$hardcode_libdir_flag_spec - -# Whether we need a single -rpath flag with a separated argument. -hardcode_libdir_separator=$hardcode_libdir_separator - -# Set to yes if using DIR/libNAME.so during linking hardcodes DIR into the -# resulting binary. -hardcode_direct=$hardcode_direct - -# Set to yes if using the -LDIR flag during linking hardcodes DIR into the -# resulting binary. -hardcode_minus_L=$hardcode_minus_L - -# Set to yes if using SHLIBPATH_VAR=DIR during linking hardcodes DIR into -# the resulting binary. -hardcode_shlibpath_var=$hardcode_shlibpath_var - -# Compile-time system search path for libraries -sys_lib_search_path_spec=$sys_lib_search_path_spec - -# Run-time system search path for libraries -sys_lib_dlsearch_path_spec=$sys_lib_dlsearch_path_spec - -# Fix the shell variable \$srcfile for the compiler. -fix_srcfile_path="$fix_srcfile_path" - -# Set to yes if exported symbols are required. -always_export_symbols=$always_export_symbols - -# The commands to list exported symbols. -export_symbols_cmds=$export_symbols_cmds - -# Symbols that should not be listed in the preloaded symbols. -exclude_expsyms=$exclude_expsyms - -# Symbols that must always be exported. -include_expsyms=$include_expsyms - -EOF - -case "$ltmain" in -*.sh) - echo '### END LIBTOOL CONFIG' >> "$ofile" - echo >> "$ofile" - case "$host_os" in - aix3*) - cat <<\EOF >> "$ofile" - -# AIX sometimes has problems with the GCC collect2 program. For some -# reason, if we set the COLLECT_NAMES environment variable, the problems -# vanish in a puff of smoke. -if test "X${COLLECT_NAMES+set}" != Xset; then - COLLECT_NAMES= - export COLLECT_NAMES -fi -EOF - ;; - esac - - # Append the ltmain.sh script. - sed '$q' "$ltmain" >> "$ofile" || (rm -f "$ofile"; exit 1) - # We use sed instead of cat because bash on DJGPP gets confused if - # if finds mixed CR/LF and LF-only lines. Since sed operates in - # text mode, it properly converts lines to CR/LF. This bash problem - # is reportedly fixed, but why not run on old versions too? - - chmod +x "$ofile" - ;; - -*) - # Compile the libtool program. - echo "FIXME: would compile $ltmain" - ;; -esac - -test -n "$cache_file" || exit 0 - -# AC_CACHE_SAVE -trap '' 1 2 15 -cat > confcache <<\EOF -# This file is a shell script that caches the results of configure -# tests run on this system so they can be shared between configure -# scripts and configure runs. It is not useful on other systems. -# If it contains results you don't want to keep, you may remove or edit it. -# -# By default, configure uses ./config.cache as the cache file, -# creating it if it does not exist already. You can give configure -# the --cache-file=FILE option to use a different cache file; that is -# what configure does when it calls configure scripts in -# subdirectories, so they share the cache. -# Giving --cache-file=/dev/null disables caching, for debugging configure. -# config.status only pays attention to the cache file if you give it the -# --recheck option to rerun configure. -# -EOF -# The following way of writing the cache mishandles newlines in values, -# but we know of no workaround that is simple, portable, and efficient. -# So, don't put newlines in cache variables' values. -# Ultrix sh set writes to stderr and can't be redirected directly, -# and sets the high bit in the cache file unless we assign to the vars. -(set) 2>&1 | - case `(ac_space=' '; set | grep ac_space) 2>&1` in - *ac_space=\ *) - # `set' does not quote correctly, so add quotes (double-quote substitution - # turns \\\\ into \\, and sed turns \\ into \). - sed -n \ - -e "s/'/'\\\\''/g" \ - -e "s/^\\([a-zA-Z0-9_]*_cv_[a-zA-Z0-9_]*\\)=\\(.*\\)/\\1=\${\\1='\\2'}/p" - ;; - *) - # `set' quotes correctly as required by POSIX, so do not add quotes. - sed -n -e 's/^\([a-zA-Z0-9_]*_cv_[a-zA-Z0-9_]*\)=\(.*\)/\1=${\1=\2}/p' - ;; - esac >> confcache -if cmp -s $cache_file confcache; then - : -else - if test -w $cache_file; then - echo "updating cache $cache_file" - cat confcache > $cache_file - else - echo "not updating unwritable cache $cache_file" - fi -fi -rm -f confcache - -exit 0 - -# Local Variables: -# mode:shell-script -# sh-indentation:2 -# End: diff --git a/srclib/pcre/mkinstalldirs b/srclib/pcre/mkinstalldirs new file mode 100755 index 0000000000000000000000000000000000000000..f4f054dc4f8e2ceb1cd917426d6e6eab15890355 --- /dev/null +++ b/srclib/pcre/mkinstalldirs @@ -0,0 +1,40 @@ +#! /bin/sh +# mkinstalldirs --- make directory hierarchy +# Author: Noah Friedman +# Created: 1993-05-16 +# Public domain + +# $Id: mkinstalldirs,v 1.1 2002/03/20 05:54:10 brianp Exp $ + +errstatus=0 + +for file +do + set fnord `echo ":$file" | sed -ne 's/^:\//#/;s/^://;s/\// /g;s/^#/\//;p'` + shift + + pathcomp= + for d + do + pathcomp="$pathcomp$d" + case "$pathcomp" in + -* ) pathcomp=./$pathcomp ;; + esac + + if test ! -d "$pathcomp"; then + echo "mkdir $pathcomp" + + mkdir "$pathcomp" || lasterr=$? + + if test ! -d "$pathcomp"; then + errstatus=$lasterr + fi + fi + + pathcomp="$pathcomp/" + done +done + +exit $errstatus + +# mkinstalldirs ends here diff --git a/srclib/pcre/pcre.dsp b/srclib/pcre/pcre.dsp deleted file mode 100644 index bb6781503a0bf8b3cce73808df24992f9e850dd9..0000000000000000000000000000000000000000 --- a/srclib/pcre/pcre.dsp +++ /dev/null @@ -1,193 +0,0 @@ -# Microsoft Developer Studio Project File - Name="pcre" - Package Owner=<4> -# Microsoft Developer Studio Generated Build File, Format Version 5.00 -# ** DO NOT EDIT ** - -# TARGTYPE "Win32 (x86) Static Library" 0x0104 - -CFG=pcre - Win32 Debug -!MESSAGE This is not a valid makefile. To build this project using NMAKE, -!MESSAGE use the Export Makefile command and run -!MESSAGE -!MESSAGE NMAKE /f "pcre.mak". -!MESSAGE -!MESSAGE You can specify a configuration when running NMAKE -!MESSAGE by defining the macro CFG on the command line. For example: -!MESSAGE -!MESSAGE NMAKE /f "pcre.mak" CFG="pcre - Win32 Debug" -!MESSAGE -!MESSAGE Possible choices for configuration are: -!MESSAGE -!MESSAGE "pcre - Win32 Release" (based on "Win32 (x86) Static Library") -!MESSAGE "pcre - Win32 Debug" (based on "Win32 (x86) Static Library") -!MESSAGE - -# Begin Project -# PROP Scc_ProjName "" -# PROP Scc_LocalPath "" -CPP=cl.exe - -!IF "$(CFG)" == "pcre - Win32 Release" - -# PROP BASE Use_MFC 0 -# PROP BASE Use_Debug_Libraries 0 -# PROP BASE Output_Dir "Release" -# PROP BASE Intermediate_Dir "Release" -# PROP BASE Target_Dir "" -# PROP Use_MFC 0 -# PROP Use_Debug_Libraries 0 -# PROP Output_Dir "LibR" -# PROP Intermediate_Dir "LibR" -# PROP Target_Dir "" -# ADD BASE CPP /nologo /MD /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /FD /c -# ADD CPP /nologo /MD /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /FD /c -BSC32=bscmake.exe -# ADD BASE BSC32 /nologo -# ADD BSC32 /nologo -LIB32=link.exe -lib -# ADD BASE LIB32 /nologo -# ADD LIB32 /nologo - -!ELSEIF "$(CFG)" == "pcre - Win32 Debug" - -# PROP BASE Use_MFC 0 -# PROP BASE Use_Debug_Libraries 1 -# PROP BASE Output_Dir "Debug" -# PROP BASE Intermediate_Dir "Debug" -# PROP BASE Target_Dir "" -# PROP Use_MFC 0 -# PROP Use_Debug_Libraries 1 -# PROP Output_Dir "LibD" -# PROP Intermediate_Dir "LibD" -# PROP Target_Dir "" -# ADD BASE CPP /nologo /MDd /W3 /GX /Z7 /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /FD /c -# ADD CPP /nologo /MDd /W3 /GX /Z7 /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /FD /c -BSC32=bscmake.exe -# ADD BASE BSC32 /nologo -# ADD BSC32 /nologo -LIB32=link.exe -lib -# ADD BASE LIB32 /nologo -# ADD LIB32 /nologo - -!ENDIF - -# Begin Target - -# Name "pcre - Win32 Release" -# Name "pcre - Win32 Debug" -# Begin Group "Source Files" - -# PROP Default_Filter "*.c" -# Begin Source File - -SOURCE=.\dftables.exe - -!IF "$(CFG)" == "pcre - Win32 Release" - -# Begin Custom Build -InputPath=.\dftables.exe - -".\chartables.c" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)" - .\dftables.exe >.\chartables.c - Echo Creating pcre chartables.c from dftables - -# End Custom Build - -!ELSEIF "$(CFG)" == "pcre - Win32 Debug" - -# Begin Custom Build -InputPath=.\dftables.exe - -".\chartables.c" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)" - .\dftables.exe >.\chartables.c - Echo Creating pcre chartables.c from dftables - -# End Custom Build - -!ENDIF - -# End Source File -# Begin Source File - -SOURCE=.\get.c -# End Source File -# Begin Source File - -SOURCE=.\maketables.c -# End Source File -# Begin Source File - -SOURCE=.\pcre.c -# End Source File -# Begin Source File - -SOURCE=.\study.c -# End Source File -# End Group -# Begin Group "Header Files" - -# PROP Default_Filter "*.h" -# Begin Source File - -SOURCE=.\config.hw - -!IF "$(CFG)" == "pcre - Win32 Release" - -# Begin Custom Build -InputPath=.\config.hw - -".\config.h" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)" - echo Creating pcre config.h from config.hw - copy .\config.hw .\config.h - -# End Custom Build - -!ELSEIF "$(CFG)" == "pcre - Win32 Debug" - -# Begin Custom Build -InputPath=.\config.hw - -".\config.h" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)" - echo Creating pcre config.h from config.hw - copy .\config.hw .\config.h - -# End Custom Build - -!ENDIF - -# End Source File -# Begin Source File - -SOURCE=.\pcre.hw - -!IF "$(CFG)" == "pcre - Win32 Release" - -# Begin Custom Build -InputPath=.\pcre.hw - -".\pcre.h" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)" - echo Creating pcre.h from pcre.hw - copy .\pcre.hw .\pcre.h - -# End Custom Build - -!ELSEIF "$(CFG)" == "pcre - Win32 Debug" - -# Begin Custom Build -InputPath=.\pcre.hw - -".\pcre.h" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)" - echo Creating pcre.h from pcre.hw - copy .\pcre.hw .\pcre.h - -# End Custom Build - -!ENDIF - -# End Source File -# Begin Source File - -SOURCE=..\..\include\pcreposix.h -# End Source File -# End Group -# End Target -# End Project diff --git a/srclib/pcre/pcre.hw b/srclib/pcre/pcre.hw deleted file mode 100644 index b66e2de9536872e6451b43d1e3199d0c0b4fd58f..0000000000000000000000000000000000000000 --- a/srclib/pcre/pcre.hw +++ /dev/null @@ -1,105 +0,0 @@ -/************************************************* -* Perl-Compatible Regular Expressions * -*************************************************/ - -/* Copyright (c) 1997-2000 University of Cambridge */ - -#ifndef _PCRE_H -#define _PCRE_H - -#define PCRE_MAJOR 3 -#define PCRE_MINOR 1 -#define PCRE_DATE 09-Feb-2000 - -/* Win32 uses DLL by default */ - -#ifdef _WIN32 -# ifdef STATIC -# define PCRE_DL_IMPORT -# else -# define PCRE_DL_IMPORT __declspec(dllimport) -# endif -#else -# define PCRE_DL_IMPORT -#endif - -/* Have to include stdlib.h in order to ensure that size_t is defined; -it is needed here for malloc. */ - -#include -#include - -/* Allow for C++ users */ - -#ifdef __cplusplus -extern "C" { -#endif - -/* Options */ - -#define PCRE_CASELESS 0x0001 -#define PCRE_MULTILINE 0x0002 -#define PCRE_DOTALL 0x0004 -#define PCRE_EXTENDED 0x0008 -#define PCRE_ANCHORED 0x0010 -#define PCRE_DOLLAR_ENDONLY 0x0020 -#define PCRE_EXTRA 0x0040 -#define PCRE_NOTBOL 0x0080 -#define PCRE_NOTEOL 0x0100 -#define PCRE_UNGREEDY 0x0200 -#define PCRE_NOTEMPTY 0x0400 - -/* Exec-time and get-time error codes */ - -#define PCRE_ERROR_NOMATCH (-1) -#define PCRE_ERROR_NULL (-2) -#define PCRE_ERROR_BADOPTION (-3) -#define PCRE_ERROR_BADMAGIC (-4) -#define PCRE_ERROR_UNKNOWN_NODE (-5) -#define PCRE_ERROR_NOMEMORY (-6) -#define PCRE_ERROR_NOSUBSTRING (-7) - -/* Request types for pcre_fullinfo() */ - -#define PCRE_INFO_OPTIONS 0 -#define PCRE_INFO_SIZE 1 -#define PCRE_INFO_CAPTURECOUNT 2 -#define PCRE_INFO_BACKREFMAX 3 -#define PCRE_INFO_FIRSTCHAR 4 -#define PCRE_INFO_FIRSTTABLE 5 -#define PCRE_INFO_LASTLITERAL 6 - -/* Types */ - -typedef void pcre; -typedef void pcre_extra; - -/* Store get and free functions. These can be set to alternative malloc/free -functions if required. Some magic is required for Win32 DLL; it is null on -other OS. */ - -PCRE_DL_IMPORT extern void *(*pcre_malloc)(size_t); -PCRE_DL_IMPORT extern void (*pcre_free)(void *); - -#undef PCRE_DL_IMPORT - -/* Functions */ - -extern pcre *pcre_compile(const char *, int, const char **, int *, - const unsigned char *); -extern int pcre_copy_substring(const char *, int *, int, int, char *, int); -extern int pcre_exec(const pcre *, const pcre_extra *, const char *, - int, int, int, int *, int); -extern int pcre_get_substring(const char *, int *, int, int, const char **); -extern int pcre_get_substring_list(const char *, int *, int, const char ***); -extern int pcre_info(const pcre *, int *, int *); -extern int pcre_fullinfo(const pcre *, const pcre_extra *, int, void *); -extern unsigned const char *pcre_maketables(void); -extern pcre_extra *pcre_study(const pcre *, int, const char **); -extern const char *pcre_version(void); - -#ifdef __cplusplus -} /* extern "C" */ -#endif - -#endif /* End of pcre.h */ diff --git a/srclib/pcre/pcreposix.dsp b/srclib/pcre/pcreposix.dsp deleted file mode 100644 index 651e4a19d708323a74099753c8eda91653498378..0000000000000000000000000000000000000000 --- a/srclib/pcre/pcreposix.dsp +++ /dev/null @@ -1,152 +0,0 @@ -# Microsoft Developer Studio Project File - Name="pcreposix" - Package Owner=<4> -# Microsoft Developer Studio Generated Build File, Format Version 5.00 -# ** DO NOT EDIT ** - -# TARGTYPE "Win32 (x86) Static Library" 0x0104 - -CFG=pcreposix - Win32 Debug -!MESSAGE This is not a valid makefile. To build this project using NMAKE, -!MESSAGE use the Export Makefile command and run -!MESSAGE -!MESSAGE NMAKE /f "pcreposix.mak". -!MESSAGE -!MESSAGE You can specify a configuration when running NMAKE -!MESSAGE by defining the macro CFG on the command line. For example: -!MESSAGE -!MESSAGE NMAKE /f "pcreposix.mak" CFG="pcreposix - Win32 Debug" -!MESSAGE -!MESSAGE Possible choices for configuration are: -!MESSAGE -!MESSAGE "pcreposix - Win32 Release" (based on "Win32 (x86) Static Library") -!MESSAGE "pcreposix - Win32 Debug" (based on "Win32 (x86) Static Library") -!MESSAGE - -# Begin Project -# PROP Scc_ProjName "" -# PROP Scc_LocalPath "" -CPP=cl.exe - -!IF "$(CFG)" == "pcreposix - Win32 Release" - -# PROP BASE Use_MFC 0 -# PROP BASE Use_Debug_Libraries 0 -# PROP BASE Output_Dir "Release" -# PROP BASE Intermediate_Dir "Release" -# PROP BASE Target_Dir "" -# PROP Use_MFC 0 -# PROP Use_Debug_Libraries 0 -# PROP Output_Dir "LibR" -# PROP Intermediate_Dir "LibR/posix" -# PROP Target_Dir "" -# ADD BASE CPP /nologo /MD /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /FD /c -# ADD CPP /nologo /MD /W3 /GX /O2 /I "..\include" /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /FD /c -BSC32=bscmake.exe -# ADD BASE BSC32 /nologo -# ADD BSC32 /nologo -LIB32=link.exe -lib -# ADD BASE LIB32 /nologo -# ADD LIB32 /nologo - -!ELSEIF "$(CFG)" == "pcreposix - Win32 Debug" - -# PROP BASE Use_MFC 0 -# PROP BASE Use_Debug_Libraries 1 -# PROP BASE Output_Dir "Debug" -# PROP BASE Intermediate_Dir "Debug" -# PROP BASE Target_Dir "" -# PROP Use_MFC 0 -# PROP Use_Debug_Libraries 1 -# PROP Output_Dir "LibD" -# PROP Intermediate_Dir "LibD/posix" -# PROP Target_Dir "" -# ADD BASE CPP /nologo /MDd /W3 /GX /Z7 /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /FD /c -# ADD CPP /nologo /MDd /W3 /GX /Z7 /Od /I "..\include" /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /FD /c -BSC32=bscmake.exe -# ADD BASE BSC32 /nologo -# ADD BSC32 /nologo -LIB32=link.exe -lib -# ADD BASE LIB32 /nologo -# ADD LIB32 /nologo - -!ENDIF - -# Begin Target - -# Name "pcreposix - Win32 Release" -# Name "pcreposix - Win32 Debug" -# Begin Group "Source Files" - -# PROP Default_Filter "*.c" -# Begin Source File - -SOURCE=.\pcreposix.c -# End Source File -# End Group -# Begin Group "Header Files" - -# PROP Default_Filter "*.h" -# Begin Source File - -SOURCE=.\config.hw - -!IF "$(CFG)" == "pcreposix - Win32 Release" - -# Begin Custom Build -InputPath=.\config.hw - -".\config.h" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)" - echo Creating pcre config.h from config.hw - copy .\config.hw .\config.h - -# End Custom Build - -!ELSEIF "$(CFG)" == "pcreposix - Win32 Debug" - -# Begin Custom Build -InputPath=.\config.hw - -".\config.h" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)" - echo Creating pcre config.h from config.hw - copy .\config.hw .\config.h - -# End Custom Build - -!ENDIF - -# End Source File -# Begin Source File - -SOURCE=..\..\include\pcre.h -# End Source File -# Begin Source File - -SOURCE=.\pcre.hw - -!IF "$(CFG)" == "pcreposix - Win32 Release" - -# Begin Custom Build -InputPath=.\pcre.hw - -".\pcre.h" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)" - echo Creating pcre.h from pcre.hw - copy .\pcre.hw .\pcre.h - -# End Custom Build - -!ELSEIF "$(CFG)" == "pcreposix - Win32 Debug" - -# Begin Custom Build -InputPath=.\pcre.hw - -".\pcre.h" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)" - echo Creating pcre.h from pcre.hw - copy .\pcre.hw .\pcre.h - -# End Custom Build - -!ENDIF - -# End Source File -# End Group -# End Target -# End Project diff --git a/srclib/pcre/pgrep.c b/srclib/pcre/pgrep.c deleted file mode 100644 index ad1b87eae97ab05185a103a5888fe5cb4b1a2e90..0000000000000000000000000000000000000000 --- a/srclib/pcre/pgrep.c +++ /dev/null @@ -1,225 +0,0 @@ -/************************************************* -* PCRE grep program * -*************************************************/ - -#include -#include -#include -#include -#include "config.h" -#include "pcre.h" - -#define FALSE 0 -#define TRUE 1 - -typedef int BOOL; - - - -/************************************************* -* Global variables * -*************************************************/ - -static pcre *pattern; -static pcre_extra *hints; - -static BOOL count_only = FALSE; -static BOOL filenames_only = FALSE; -static BOOL invert = FALSE; -static BOOL number = FALSE; -static BOOL silent = FALSE; -static BOOL whole_lines = FALSE; - - - -#if ! HAVE_STRERROR -/************************************************* -* Provide strerror() for non-ANSI libraries * -*************************************************/ - -/* Some old-fashioned systems still around (e.g. SunOS4) don't have strerror() -in their libraries, but can provide the same facility by this simple -alternative function. */ - -extern int sys_nerr; -extern char *sys_errlist[]; - -char * -strerror(int n) -{ -if (n < 0 || n >= sys_nerr) return "unknown error number"; -return sys_errlist[n]; -} -#endif /* HAVE_STRERROR */ - - - -/************************************************* -* Grep an individual file * -*************************************************/ - -static int -pgrep(FILE *in, char *name) -{ -int rc = 1; -int linenumber = 0; -int count = 0; -int offsets[99]; -char buffer[BUFSIZ]; - -while (fgets(buffer, sizeof(buffer), in) != NULL) - { - BOOL match; - int length = (int)strlen(buffer); - if (length > 0 && buffer[length-1] == '\n') buffer[--length] = 0; - linenumber++; - - match = pcre_exec(pattern, hints, buffer, length, 0, 0, offsets, 99) >= 0; - if (match && whole_lines && offsets[1] != length) match = FALSE; - - if (match != invert) - { - if (count_only) count++; - - else if (filenames_only) - { - fprintf(stdout, "%s\n", (name == NULL)? "" : name); - return 0; - } - - else if (silent) return 0; - - else - { - if (name != NULL) fprintf(stdout, "%s:", name); - if (number) fprintf(stdout, "%d:", linenumber); - fprintf(stdout, "%s\n", buffer); - } - - rc = 0; - } - } - -if (count_only) - { - if (name != NULL) fprintf(stdout, "%s:", name); - fprintf(stdout, "%d\n", count); - } - -return rc; -} - - - - -/************************************************* -* Usage function * -*************************************************/ - -static int -usage(int rc) -{ -fprintf(stderr, "Usage: pgrep [-Vchilnsvx] pattern [file] ...\n"); -return rc; -} - - - - -/************************************************* -* Main program * -*************************************************/ - -int -main(int argc, char **argv) -{ -int i; -int rc = 1; -int options = 0; -int errptr; -const char *error; -BOOL filenames = TRUE; - -/* Process the options */ - -for (i = 1; i < argc; i++) - { - char *s; - if (argv[i][0] != '-') break; - s = argv[i] + 1; - while (*s != 0) - { - switch (*s++) - { - case 'c': count_only = TRUE; break; - case 'h': filenames = FALSE; break; - case 'i': options |= PCRE_CASELESS; break; - case 'l': filenames_only = TRUE; - case 'n': number = TRUE; break; - case 's': silent = TRUE; break; - case 'v': invert = TRUE; break; - case 'x': whole_lines = TRUE; options |= PCRE_ANCHORED; break; - - case 'V': - fprintf(stderr, "PCRE version %s\n", pcre_version()); - break; - - default: - fprintf(stderr, "pgrep: unknown option %c\n", s[-1]); - return usage(2); - } - } - } - -/* There must be at least a regexp argument */ - -if (i >= argc) return usage(0); - -/* Compile the regular expression. */ - -pattern = pcre_compile(argv[i++], options, &error, &errptr, NULL); -if (pattern == NULL) - { - fprintf(stderr, "pgrep: error in regex at offset %d: %s\n", errptr, error); - return 2; - } - -/* Study the regular expression, as we will be running it may times */ - -hints = pcre_study(pattern, 0, &error); -if (error != NULL) - { - fprintf(stderr, "pgrep: error while studing regex: %s\n", error); - return 2; - } - -/* If there are no further arguments, do the business on stdin and exit */ - -if (i >= argc) return pgrep(stdin, NULL); - -/* Otherwise, work through the remaining arguments as files. If there is only -one, don't give its name on the output. */ - -if (i == argc - 1) filenames = FALSE; -if (filenames_only) filenames = TRUE; - -for (; i < argc; i++) - { - FILE *in = fopen(argv[i], "r"); - if (in == NULL) - { - fprintf(stderr, "%s: failed to open: %s\n", argv[i], strerror(errno)); - rc = 2; - } - else - { - int frc = pgrep(in, filenames? argv[i] : NULL); - if (frc == 0 && rc == 1) rc = 0; - fclose(in); - } - } - -return rc; -} - -/* End */ diff --git a/support/.cvsignore b/support/.cvsignore deleted file mode 100644 index 399f114e93415f33bec3e43aa9d07620b8fd0f06..0000000000000000000000000000000000000000 --- a/support/.cvsignore +++ /dev/null @@ -1,11 +0,0 @@ -Makefile -rotatelogs -htpasswd -htdigest -unescape -inc2shtml -httpd_monitor -suexec -logresolve -ab -apxs diff --git a/support/.indent.pro b/support/.indent.pro deleted file mode 100644 index a9fbe9f9a1f2e6e7bcc54171c215bdacd44171ba..0000000000000000000000000000000000000000 --- a/support/.indent.pro +++ /dev/null @@ -1,54 +0,0 @@ --i4 -npsl -di0 -br -nce -d0 -cli0 -npcs -nfc1 --TBUFF --TFILE --TTRANS --TUINT4 --T_trans --Tallow_options_t --Tapache_sfio --Tarray_header --Tbool_int --Tbuf_area --Tbuff_struct --Tbuffy --Tcmd_how --Tcmd_parms --Tcommand_rec --Tcommand_struct --Tconn_rec --Tcore_dir_config --Tcore_server_config --Tdir_maker_func --Tevent --Tglobals_s --Thandler_func --Thandler_rec --Tjoblist_s --Tlisten_rec --Tmerger_func --Tmode_t --Tmodule --Tmodule_struct --Tmutex --Tn_long --Tother_child_rec --Toverrides_t --Tparent_score --Tpid_t --Tpiped_log --Tpool --Trequest_rec --Trequire_line --Trlim_t --Tscoreboard --Tsemaphore --Tserver_addr_rec --Tserver_rec --Tserver_rec_chain --Tshort_score --Ttable --Ttable_entry --Tthread --Tu_wide_int --Tvtime_t --Twide_int diff --git a/support/Makefile.in b/support/Makefile.in deleted file mode 100644 index 8460b563ce714bbc3c469bb0d7352deb9b19a94c..0000000000000000000000000000000000000000 --- a/support/Makefile.in +++ /dev/null @@ -1,36 +0,0 @@ - -DEPTH = .. -top_srcdir = @top_srcdir@ -srcdir = @srcdir@ -VPATH = @srcdir@ - -PROGRAMS = htpasswd htdigest rotatelogs logresolve ab -targets = $(PROGRAMS) - -PROGRAM_LDADD = $(EXTRA_LDFLAGS) $(PROGRAM_DEPENDENCIES) $(EXTRA_LIBS) -PROGRAM_DEPENDENCIES = ../lib/apr/$(LIBPRE)apr.a \ - ../ap/libap.la - -include $(top_srcdir)/build/rules.mk -include $(top_srcdir)/build/program.mk - -htpasswd_OBJECTS = htpasswd.lo -htpasswd: $(htpasswd_OBJECTS) - $(LINK) $(htpasswd_OBJECTS) $(PROGRAM_LDADD) - -htdigest_OBJECTS = htdigest.lo -htdigest: $(htdigest_OBJECTS) - $(LINK) $(htdigest_OBJECTS) $(PROGRAM_LDADD) - -rotatelogs_OBJECTS = rotatelogs.lo -rotatelogs: $(rotatelogs_OBJECTS) - $(LINK) $(rotatelogs_OBJECTS) $(PROGRAM_LDADD) - -logresolve_OBJECTS = logresolve.lo -logresolve: $(logresolve_OBJECTS) - $(LINK) $(logresolve_OBJECTS) $(PROGRAM_LDADD) - -ab_OBJECTS = ab.lo -ab: $(ab_OBJECTS) - $(LINK) $(ab_OBJECTS) $(PROGRAM_LDADD) - diff --git a/support/NWGNUhtdigest b/support/NWGNUhtdigest deleted file mode 100644 index 1cc1c962955025f8fa7d8b41cd35f492869985f3..0000000000000000000000000000000000000000 --- a/support/NWGNUhtdigest +++ /dev/null @@ -1,246 +0,0 @@ -# -# Make sure all needed macro's are defined -# - -# -# Get the 'head' of the build environment if necessary. This includes default -# targets and paths to tools -# - -ifndef EnvironmentDefined -include $(AP_WORK)\build\NWGNUhead.inc -endif - -# -# These directories will be at the beginning of the include list, followed by -# INCDIRS -# -XINCDIRS += \ - $(NWOS) \ - $(AP_WORK)/srclib/apr/include \ - $(AP_WORK)/srclib/apr-util/include \ - $(AP_WORK)/srclib/apr/misc/netware \ - $(AP_WORK)/srclib/apr \ - $(EOLIST) - -# -# These flags will come after CFLAGS -# -XCFLAGS += \ - $(EOLIST) - -# -# These defines will come after DEFINES -# -XDEFINES += \ - $(EOLIST) - -# -# These flags will be added to the link.opt file -# -XLFLAGS += \ - $(EOLIST) - -# -# These values will be appended to the correct variables based on the value of -# RELEASE -# -ifeq "$(RELEASE)" "debug" -XINCDIRS += \ - $(EOLIST) - -XCFLAGS += \ - $(EOLIST) - -XDEFINES += \ - $(EOLIST) - -XLFLAGS += \ - $(EOLIST) -endif - -ifeq "$(RELEASE)" "noopt" -XINCDIRS += \ - $(EOLIST) - -XCFLAGS += \ - $(EOLIST) - -XDEFINES += \ - $(EOLIST) - -XLFLAGS += \ - $(EOLIST) -endif - -ifeq "$(RELEASE)" "release" -XINCDIRS += \ - $(EOLIST) - -XCFLAGS += \ - $(EOLIST) - -XDEFINES += \ - $(EOLIST) - -XLFLAGS += \ - $(EOLIST) -endif - -# -# These are used by the link target if an NLM is being generated -# This is used by the link 'name' directive to name the nlm. If left blank -# TARGET_nlm (see below) will be used. -# -NLM_NAME = htdigest - -# -# This is used by the link '-desc ' directive. -# If left blank, NLM_NAME will be used. -# -NLM_DESCRIPTION = HT Digest Utility for NetWare - -# -# This is used by the '-threadname' directive. If left blank, -# NLM_NAME Thread will be used. -# -NLM_THREAD_NAME = htdigest - -# -# If this is specified, it will override VERSION value in -# $(AP_WORK)\build\NWGNUenvironment.inc -# -NLM_VERSION = - -# -# If this is specified, it will override the default of 64K -# -NLM_STACK_SIZE = 8192 - - -# -# If this is specified it will be used by the link '-entry' directive -# -NLM_ENTRY_SYM = _LibCPrelude - -# -# If this is specified it will be used by the link '-exit' directive -# -NLM_EXIT_SYM = _LibCPostlude - -# -# If this is specified it will be used by the link '-check' directive -# -NLM_CHECK_SYM = - -# -# If these are specified it will be used by the link '-flags' directive -# -NLM_FLAGS = AUTOUNLOAD, PSEUDOPREEMPTION - -# -# If this is specified it will be linked in with the XDCData option in the def -# file instead of the default of $(NWOS)/apache.xdc. XDCData can be disabled -# by setting APACHE_UNIPROC in the environment -# -XDCDATA = - -# -# If there is an NLM target, put it here -# -TARGET_nlm = \ - $(OBJDIR)/htdigest.nlm \ - $(EOLIST) - -# -# If there is an LIB target, put it here -# -TARGET_lib = \ - $(EOLIST) - -# -# These are the OBJ files needed to create the NLM target above. -# Paths must all use the '/' character -# -FILES_nlm_objs = \ - $(OBJDIR)/htdigest.o \ - $(EOLIST) - -# -# These are the LIB files needed to create the NLM target above. -# These will be added as a library command in the link.opt file. -# -FILES_nlm_libs = \ - libcpre.o \ - $(EOLIST) - -# -# These are the modules that the above NLM target depends on to load. -# These will be added as a module command in the link.opt file. -# -FILES_nlm_modules = \ - aprlib \ - libc \ - $(EOLIST) - -# -# If the nlm has a msg file, put it's path here -# -FILE_nlm_msg = - -# -# If the nlm has a hlp file put it's path here -# -FILE_nlm_hlp = - -# -# If this is specified, it will override $(NWOS)\copyright.txt. -# -FILE_nlm_copyright = - -# -# Any additional imports go here -# -FILES_nlm_Ximports = \ - @$(APR)/aprlib.imp \ - @libc.imp \ - $(EOLIST) - -# -# Any symbols exported to here -# -FILES_nlm_exports = \ - $(EOLIST) - -# -# These are the OBJ files needed to create the LIB target above. -# Paths must all use the '/' character -# -FILES_lib_objs = \ - $(EOLIST) - -# -# implement targets and dependancies (leave this section alone) -# - -libs :: $(OBJDIR) $(TARGET_lib) - -nlms :: libs $(TARGET_nlm) - -# -# Updated this target to create necessary directories and copy files to the -# correct place. (See $(AP_WORK)\build\NWGNUhead.inc for examples) -# -install :: nlms FORCE - -# -# Any specialized rules here -# - -# -# Include the 'tail' makefile that has targets that depend on variables defined -# in this makefile -# - -include $(AP_WORK)\build\NWGNUtail.inc - diff --git a/support/NWGNUhtpasswd b/support/NWGNUhtpasswd deleted file mode 100644 index 7000529caa71233b9b1544b4961cbded43fd5e38..0000000000000000000000000000000000000000 --- a/support/NWGNUhtpasswd +++ /dev/null @@ -1,246 +0,0 @@ -# -# Make sure all needed macro's are defined -# - -# -# Get the 'head' of the build environment if necessary. This includes default -# targets and paths to tools -# - -ifndef EnvironmentDefined -include $(AP_WORK)\build\NWGNUhead.inc -endif - -# -# These directories will be at the beginning of the include list, followed by -# INCDIRS -# -XINCDIRS += \ - $(NWOS) \ - $(AP_WORK)/srclib/apr/include \ - $(AP_WORK)/srclib/apr-util/include \ - $(AP_WORK)/srclib/apr/misc/netware \ - $(AP_WORK)/srclib/apr \ - $(EOLIST) - -# -# These flags will come after CFLAGS -# -XCFLAGS += \ - $(EOLIST) - -# -# These defines will come after DEFINES -# -XDEFINES += \ - $(EOLIST) - -# -# These flags will be added to the link.opt file -# -XLFLAGS += \ - $(EOLIST) - -# -# These values will be appended to the correct variables based on the value of -# RELEASE -# -ifeq "$(RELEASE)" "debug" -XINCDIRS += \ - $(EOLIST) - -XCFLAGS += \ - $(EOLIST) - -XDEFINES += \ - $(EOLIST) - -XLFLAGS += \ - $(EOLIST) -endif - -ifeq "$(RELEASE)" "noopt" -XINCDIRS += \ - $(EOLIST) - -XCFLAGS += \ - $(EOLIST) - -XDEFINES += \ - $(EOLIST) - -XLFLAGS += \ - $(EOLIST) -endif - -ifeq "$(RELEASE)" "release" -XINCDIRS += \ - $(EOLIST) - -XCFLAGS += \ - $(EOLIST) - -XDEFINES += \ - $(EOLIST) - -XLFLAGS += \ - $(EOLIST) -endif - -# -# These are used by the link target if an NLM is being generated -# This is used by the link 'name' directive to name the nlm. If left blank -# TARGET_nlm (see below) will be used. -# -NLM_NAME = htpasswd - -# -# This is used by the link '-desc ' directive. -# If left blank, NLM_NAME will be used. -# -NLM_DESCRIPTION = HT Password Utility for NetWare - -# -# This is used by the '-threadname' directive. If left blank, -# NLM_NAME Thread will be used. -# -NLM_THREAD_NAME = htpasswd - -# -# If this is specified, it will override VERSION value in -# $(AP_WORK)\build\NWGNUenvironment.inc -# -NLM_VERSION = - -# -# If this is specified, it will override the default of 64K -# -NLM_STACK_SIZE = 8192 - - -# -# If this is specified it will be used by the link '-entry' directive -# -NLM_ENTRY_SYM = _LibCPrelude - -# -# If this is specified it will be used by the link '-exit' directive -# -NLM_EXIT_SYM = _LibCPostlude - -# -# If this is specified it will be used by the link '-check' directive -# -NLM_CHECK_SYM = - -# -# If these are specified it will be used by the link '-flags' directive -# -NLM_FLAGS = AUTOUNLOAD, PSEUDOPREEMPTION - -# -# If this is specified it will be linked in with the XDCData option in the def -# file instead of the default of $(NWOS)/apache.xdc. XDCData can be disabled -# by setting APACHE_UNIPROC in the environment -# -XDCDATA = - -# -# If there is an NLM target, put it here -# -TARGET_nlm = \ - $(OBJDIR)/htpasswd.nlm \ - $(EOLIST) - -# -# If there is an LIB target, put it here -# -TARGET_lib = \ - $(EOLIST) - -# -# These are the OBJ files needed to create the NLM target above. -# Paths must all use the '/' character -# -FILES_nlm_objs = \ - $(OBJDIR)/htpasswd.o \ - $(EOLIST) - -# -# These are the LIB files needed to create the NLM target above. -# These will be added as a library command in the link.opt file. -# -FILES_nlm_libs = \ - libcpre.o \ - $(EOLIST) - -# -# These are the modules that the above NLM target depends on to load. -# These will be added as a module command in the link.opt file. -# -FILES_nlm_modules = \ - aprlib \ - libc \ - $(EOLIST) - -# -# If the nlm has a msg file, put it's path here -# -FILE_nlm_msg = - -# -# If the nlm has a hlp file put it's path here -# -FILE_nlm_hlp = - -# -# If this is specified, it will override $(NWOS)\copyright.txt. -# -FILE_nlm_copyright = - -# -# Any additional imports go here -# -FILES_nlm_Ximports = \ - @$(APR)/aprlib.imp \ - @libc.imp \ - $(EOLIST) - -# -# Any symbols exported to here -# -FILES_nlm_exports = \ - $(EOLIST) - -# -# These are the OBJ files needed to create the LIB target above. -# Paths must all use the '/' character -# -FILES_lib_objs = \ - $(EOLIST) - -# -# implement targets and dependancies (leave this section alone) -# - -libs :: $(OBJDIR) $(TARGET_lib) - -nlms :: libs $(TARGET_nlm) - -# -# Updated this target to create necessary directories and copy files to the -# correct place. (See $(AP_WORK)\build\NWGNUhead.inc for examples) -# -install :: nlms FORCE - -# -# Any specialized rules here -# - -# -# Include the 'tail' makefile that has targets that depend on variables defined -# in this makefile -# - -include $(AP_WORK)\build\NWGNUtail.inc - diff --git a/support/NWGNUmakefile b/support/NWGNUmakefile deleted file mode 100644 index 8a1aef5f419f649899d9d76d2456113086dc1cdb..0000000000000000000000000000000000000000 --- a/support/NWGNUmakefile +++ /dev/null @@ -1,245 +0,0 @@ -# -# Declare the sub-directories to be built here -# - -SUBDIRS = \ - $(EOLIST) - -# -# Get the 'head' of the build environment. This includes default targets and -# paths to tools -# - -include $(AP_WORK)\build\NWGNUhead.inc - -# -# build this level's files - -# -# Make sure all needed macro's are defined -# - -# These directories will be at the beginning of the include list, followed by -# INCDIRS -# -XINCDIRS += \ - $(EOLIST) - -# -# These flags will come after CFLAGS -# -XCFLAGS += \ - $(EOLIST) - -# -# These defines will come after DEFINES -# -XDEFINES += \ - $(EOLIST) - -# -# These flags will be added to the link.opt file -# -XLFLAGS += \ - $(EOLIST) - -# -# These values will be appended to the correct variables based on the value of -# RELEASE -# -ifeq "$(RELEASE)" "debug" -XINCDIRS += \ - $(EOLIST) - -XCFLAGS += \ - $(EOLIST) - -XDEFINES += \ - $(EOLIST) - -XLFLAGS += \ - $(EOLIST) -endif - -ifeq "$(RELEASE)" "noopt" -XINCDIRS += \ - $(EOLIST) - -XCFLAGS += \ - $(EOLIST) - -XDEFINES += \ - $(EOLIST) - -XLFLAGS += \ - $(EOLIST) -endif - -ifeq "$(RELEASE)" "release" -XINCDIRS += \ - $(EOLIST) - -XCFLAGS += \ - $(EOLIST) - -XDEFINES += \ - $(EOLIST) - -XLFLAGS += \ - $(EOLIST) -endif - -# -# These are used by the link target if an NLM is being generated -# This is used by the link 'name' directive to name the nlm. If left blank -# TARGET_nlm (see below) will be used. -# -NLM_NAME = - -# -# This is used by the link '-desc ' directive. -# If left blank, NLM_NAME will be used. -# -NLM_DESCRIPTION = - -# -# This is used by the '-threadname' directive. If left blank, -# NLM_NAME Thread will be used. -# -NLM_THREAD_NAME = - -# -# If this is specified, it will override VERSION value in -# $(AP_WORK)\build\NWGNUenvironment.inc -# -NLM_VERSION = - -# -# If this is specified, it will override the default of 64K -# -NLM_STACK_SIZE = - - -# -# If this is specified it will be used by the link '-entry' directive -# -NLM_ENTRY_SYM = - -# -# If this is specified it will be used by the link '-exit' directive -# -NLM_EXIT_SYM = - -# -# If this is specified it will be used by the link '-check' directive -# -NLM_CHECK_SYM = - -# -# If these are specified it will be used by the link '-flags' directive -# -NLM_FLAGS = - -# -# If this is specified it will be linked in with the XDCData option in the def -# file instead of the default of $(NWOS)/apache.xdc. XDCData can be disabled -# by setting APACHE_UNIPROC in the environment -# -XDCDATA = - -# -# If there is an NLM target, put it here -# -TARGET_nlm = \ - $(OBJDIR)/htpasswd.nlm \ - $(OBJDIR)/htdigest.nlm \ - $(EOLIST) - -# -# If there is an LIB target, put it here -# -TARGET_lib = \ - $(EOLIST) - -# -# These are the OBJ files needed to create the NLM target above. -# Paths must all use the '/' character -# -FILES_nlm_objs = \ - $(EOLIST) - -# -# These are the LIB files needed to create the NLM target above. -# These will be added as a library command in the link.opt file. -# -FILES_nlm_libs = \ - $(EOLIST) - -# -# These are the modules that the above NLM target depends on to load. -# These will be added as a module command in the link.opt file. -# -FILES_nlm_modules = \ - $(EOLIST) - -# -# If the nlm has a msg file, put it's path here -# -FILE_nlm_msg = - -# -# If the nlm has a hlp file put it's path here -# -FILE_nlm_hlp = - -# -# If this is specified, it will override $(NWOS)\copyright.txt. -# -FILE_nlm_copyright = - -# -# Any additional imports go here -# -FILES_nlm_Ximports = \ - $(EOLIST) - -# -# Any symbols exported to here -# -FILES_nlm_exports = \ - $(EOLIST) - -# -# These are the OBJ files needed to create the LIB target above. -# Paths must all use the '/' character -# -FILES_lib_objs = \ - $(EOLIST) - -# -# implement targets and dependancies (leave this section alone) -# - -libs :: $(OBJDIR) $(TARGET_lib) - -nlms :: libs $(TARGET_nlm) - -# -# Updated this target to create necessary directories and copy files to the -# correct place. (See $(AP_WORK)\build\NWGNUhead.inc for examples) -# -install :: nlms FORCE - copy $(OBJDIR)\*.nlm $(INSTALL)\Apache2\*.* - -# -# Any specialized rules here -# - -# -# Include the 'tail' makefile that has targets that depend on variables defined -# in this makefile -# - -include $(AP_WORK)\build\NWGNUtail.inc - - diff --git a/support/README b/support/README deleted file mode 100644 index 80e9cafde0a20d4ce61257b34c76bc476ccdf53b..0000000000000000000000000000000000000000 --- a/support/README +++ /dev/null @@ -1,62 +0,0 @@ -Support files: - -ab - ABuse your server with this benchmarker. Rudimentary - command line testing tool. - -apachectl - Apache run-time Control script. To facilitate the - administrator and/or your rc.d scripts to control the - functioning of the Apache httpd daemon. - -apxs - APache eXtenSion tool. Eases building and installing - DSO style modules. - -dbmmanage - Create and update user authentication files in the faster - DBM format used by mod_auth_db. - -htdigest - Create and update user authentication files used in - DIGEST authentification. See mod_auth_digest. - -htpasswd - Create and update user authentication files used in - BASIC authentification. I.e. the htpasswd files. - See mod_auth. - -httpd.8 - General apache man page. - -log_server_status - This script is designed to be run at a frequent interval by something - like cron. It connects to the server and downloads the status - information. It reformats the information to a single line and logs - it to a file. - -logresolve - resolve hostnames for IP-adresses in Apache logfiles - -phf_abuse_log.cgi - This script can be used to detect people trying to abuse an ancient - and long plugged security hole which existed in a CGI script distributed - with Apache 1.0.3 and earlier versions. - -rotatelogs - rotate Apache logs without having to kill the server. - -split-logfile - This script will take a combined virtual hosts access - log file and break its contents into separate files. - -suexec - Switch User For Exec. Used internally by apache, - see the document `Apache suEXEC Support' - under http://www.apache.org/docs/suexec.html . - -SHA1 - This directory includes some utilities to allow Apache 1.3.6 to - recognize passwords in SHA1 format, as used by Netscape web - servers. It is not installed by default. - diff --git a/support/SHA1/README.sha1 b/support/SHA1/README.sha1 deleted file mode 100644 index 3998e1fdd91ef2a6fb42d015e8a4b51454c0e302..0000000000000000000000000000000000000000 --- a/support/SHA1/README.sha1 +++ /dev/null @@ -1,34 +0,0 @@ -This directory includes some utilities to allow Apache 1.3.6 to -recognize passwords in SHA1 format, as used by Netscape web servers. - -From Netscape's admin interface, export the password database to an -ldif file and then use convert.pl in this distribution to generate -apache style password files. - -Note: SHA1 support is useful for migration purposes, but is less - secure than Apache's password format, since Apache's (MD5) - password format uses a random eight character salt to generate - one of many possible hashes for the same password. Netscape - uses plain SHA1 without a salt, so the same password - will always generate the same hash, making it easier - to break since the search space is smaller. - -This code was contributed by Clinton Wong . - -README.sha1 - this file - -convert-sha1.pl - takes an ldif dump from Netscape's web server on - standard in, outputs apache htpasswd format on standard out. - - Usage: convert.pl < ldif > passwords - -htpasswd-sha1.pl - perl script to generate entries in apache htpasswd format. - - Usage: htpasswd-sha1.pl some_user some_password - -ldif-sha1.example - sample ldif dump with one sha1 password and one crypt password. - diff --git a/support/SHA1/convert-sha1.pl b/support/SHA1/convert-sha1.pl deleted file mode 100644 index 35228022a0890c47f697bdf650c22ff06cf38ff0..0000000000000000000000000000000000000000 --- a/support/SHA1/convert-sha1.pl +++ /dev/null @@ -1,36 +0,0 @@ -#!/usr/bin/perl -w -use strict; - -# This is public domain code. Do whatever you want with it. -# It was originally included in Clinton Wong's Apache 1.3.6 SHA1/ldif -# patch distribution as sample code for converting accounts from -# ldif format (as used by Netscape web servers) to Apache password format. - -my $uid=''; -my $passwd=''; - -while (my $line = <>) { - chomp $line; - if ( $line =~ /uid:\s*(.+)/) { $uid = $1 } - if ( $line =~ /userpassword:\s*(\{\w+\}.+)/) { - $passwd = $1; - $passwd =~ s/^\{crypt\}//i; # Apache stores crypt without a magic string - } - - if (length($line)==0) { - - if (length $uid and length $passwd) { - print $uid, ':', $passwd, "\n"; - } # output if we have something to print - - $uid = ''; - $passwd = ''; - - } # if newline -} # while something to read - -# handle last entry if there isn't a newline before EOF - if (length $uid and length $passwd) { - print $uid, ':', $passwd, "\n"; -} - diff --git a/support/SHA1/htpasswd-sha1.pl b/support/SHA1/htpasswd-sha1.pl deleted file mode 100644 index ad624d1101ff0e1171033d1e9ca7b4e4ca9c5115..0000000000000000000000000000000000000000 --- a/support/SHA1/htpasswd-sha1.pl +++ /dev/null @@ -1,22 +0,0 @@ -#!/usr/bin/perl -w -use strict; -# -# Utility which takes a username and password -# on the command line and generates a username -# sha1-encrytped password on the stdout. -# -# Typical useage: -# ./htpasswd-sha1.pl dirkx MySecret >> sha1-passwd -# -# This is public domain code. Do whatever you want with it. -# It was originally included in Clinton Wong's Apache 1.3.6 SHA1/ldif -# patch distribution as sample code for generating entries for -# Apache password files using SHA1. - -use MIME::Base64; # http://www.cpan.org/modules/by-module/MIME/ -use Digest::SHA1; # http://www.cpan.org/modules/by-module/MD5/ - -if ($#ARGV!=1) { die "Usage $0: user password\n" } - -print $ARGV[0], ':{SHA}', encode_base64( Digest::SHA1::sha1($ARGV[1]) ); - diff --git a/support/SHA1/ldif-sha1.example b/support/SHA1/ldif-sha1.example deleted file mode 100644 index b8fe917eaf3379ca5b3adb85f7b6e792a2b69f34..0000000000000000000000000000000000000000 --- a/support/SHA1/ldif-sha1.example +++ /dev/null @@ -1,19 +0,0 @@ -dn: cn=someuser -cn: someuser -sn: someuser -objectclass: top -objectclass: person -objectclass: organizationalPerson -objectclass: inetOrgPerson -uid: someuser -userpassword: {SHA}GvF+c3IdvgxAARuC7Uuxp9vjzik= - -dn: cn=anotheruser -cn: anotheruser -sn: anotheruser -objectclass: top -objectclass: person -objectclass: organizationalPerson -objectclass: inetOrgPerson -uid: anotheruser -userpassword: {crypt}eFnp.4sz5XnH6 diff --git a/support/ab.c b/support/ab.c deleted file mode 100644 index 0d968b247a277655533437675f493b59c464dca8..0000000000000000000000000000000000000000 --- a/support/ab.c +++ /dev/null @@ -1,1100 +0,0 @@ -/* ==================================================================== - * Copyright (c) 1998-1999 The Apache Group. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in - * the documentation and/or other materials provided with the - * distribution. - * - * 3. All advertising materials mentioning features or use of this - * software must display the following acknowledgment: - * "This product includes software developed by the Apache Group - * for use in the Apache HTTP server project (http://www.apache.org/)." - * - * 4. The names "Apache Server" and "Apache Group" must not be used to - * endorse or promote products derived from this software without - * prior written permission. For written permission, please contact - * apache@apache.org. - * - * 5. Products derived from this software may not be called "Apache" - * nor may "Apache" appear in their names without prior written - * permission of the Apache Group. - * - * 6. Redistributions of any form whatsoever must retain the following - * acknowledgment: - * "This product includes software developed by the Apache Group - * for use in the Apache HTTP server project (http://www.apache.org/)." - * - * THIS SOFTWARE IS PROVIDED BY THE APACHE GROUP ``AS IS'' AND ANY - * EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR - * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE APACHE GROUP OR - * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT - * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, - * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED - * OF THE POSSIBILITY OF SUCH DAMAGE. - * ==================================================================== - * - * This software consists of voluntary contributions made by many - * individuals on behalf of the Apache Group and was originally based - * on public domain software written at the National Center for - * Supercomputing Applications, University of Illinois, Urbana-Champaign. - * For more information on the Apache Group and the Apache HTTP server - * project, please see . - * - */ - -/* - ** This program is based on ZeusBench V1.0 written by Adam Twiss - ** which is Copyright (c) 1996 by Zeus Technology Ltd. http://www.zeustech.net/ - ** - ** This software is provided "as is" and any express or implied waranties, - ** including but not limited to, the implied warranties of merchantability and - ** fitness for a particular purpose are disclaimed. In no event shall - ** Zeus Technology Ltd. be liable for any direct, indirect, incidental, special, - ** exemplary, or consequential damaged (including, but not limited to, - ** procurement of substitute good or services; loss of use, data, or profits; - ** or business interruption) however caused and on theory of liability. Whether - ** in contract, strict liability or tort (including negligence or otherwise) - ** arising in any way out of the use of this software, even if advised of the - ** possibility of such damage. - ** - */ - -/* - ** HISTORY: - ** - Originally written by Adam Twiss , March 1996 - ** with input from Mike Belshe and - ** Michael Campanella - ** - Enhanced by Dean Gaudet , November 1997 - ** - Cleaned up by Ralf S. Engelschall , March 1998 - ** - POST and verbosity by Kurt Sussman , August 1998 - ** - HTML table output added by David N. Welton , January 1999 - ** - Added Cookie, Arbitrary header and auth support. , April 199 - ** - */ - -/* - * BUGS: - * - * - uses strcpy/etc. - * - has various other poor buffer attacks related to the lazy parsing of - * response headers from the server - * - doesn't implement much of HTTP/1.x, only accepts certain forms of - * responses - * - (performance problem) heavy use of strstr shows up top in profile - * only an issue for loopback usage - */ - -#define VERSION "1.3a" - -/* -------------------------------------------------------------------- */ - -/* affects include files on Solaris */ -#define BSD_COMP - -/* allow compilation outside an Apache build tree */ -#ifdef NO_APACHE_INCLUDES -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#define ap_select select -#else /* (!)NO_APACHE_INCLUDES */ -#include "ap_config.h" -#include "ap.h" -#ifdef CHARSET_EBCDIC -#include "ebcdic.h" -#endif -#include -#include - -#ifndef NO_WRITEV -#include -#include -#endif - -#endif /* NO_APACHE_INCLUDES */ -/* ------------------- DEFINITIONS -------------------------- */ - -/* maximum number of requests on a time limited test */ -#define MAX_REQUESTS 50000 - -/* good old state hostname */ -#define STATE_UNCONNECTED 0 -#define STATE_CONNECTING 1 -#define STATE_READ 2 - -#define CBUFFSIZE 512 - -struct connection { - int fd; - int state; - int read; /* amount of bytes read */ - int bread; /* amount of body read */ - int length; /* Content-Length value used for keep-alive */ - char cbuff[CBUFFSIZE]; /* a buffer to store server response header */ - int cbx; /* offset in cbuffer */ - int keepalive; /* non-zero if a keep-alive request */ - int gotheader; /* non-zero if we have the entire header in - * cbuff */ - struct timeval start, connect, done; -}; - -struct data { - int read; /* number of bytes read */ - int ctime; /* time in ms to connect */ - int time; /* time in ms for connection */ -}; - -#define ap_min(a,b) ((a)<(b))?(a):(b) -#define ap_max(a,b) ((a)>(b))?(a):(b) - -/* --------------------- GLOBALS ---------------------------- */ - -int verbosity = 0; /* no verbosity by default */ -int posting = 0; /* GET by default */ -int requests = 1; /* Number of requests to make */ -int concurrency = 1; /* Number of multiple requests to make */ -int tlimit = 0; /* time limit in cs */ -int keepalive = 0; /* try and do keepalive connections */ -char servername[1024]; /* name that server reports */ -char hostname[1024]; /* host name */ -char path[1024]; /* path name */ -char postfile[1024]; /* name of file containing post data */ -char *postdata; /* *buffer containing data from postfile */ -int postlen = 0; /* length of data to be POSTed */ -char content_type[1024]; /* content type to put in POST header */ -char cookie[1024], /* optional cookie line */ - auth[1024], /* optional (basic/uuencoded) - * authentification */ - hdrs[4096]; /* optional arbitrary headers */ -int port = 80; /* port number */ - -int use_html = 0; /* use html in the report */ -char *tablestring; -char *trstring; -char *tdstring; - -int doclen = 0; /* the length the document should be */ -int totalread = 0; /* total number of bytes read */ -int totalbread = 0; /* totoal amount of entity body read */ -int totalposted = 0; /* total number of bytes posted, inc. headers */ -int done = 0; /* number of requests we have done */ -int doneka = 0; /* number of keep alive connections done */ -int good = 0, bad = 0; /* number of good and bad requests */ - -/* store error cases */ -int err_length = 0, err_conn = 0, err_except = 0; -int err_response = 0; - -struct timeval start, endtime; - -/* global request (and its length) */ -char request[512]; -int reqlen; - -/* one global throw-away buffer to read stuff into */ -char buffer[8192]; - -struct connection *con; /* connection array */ -struct data *stats; /* date for each request */ - -fd_set readbits, writebits; /* bits for select */ -struct sockaddr_in server; /* server addr structure */ - -/* --------------------------------------------------------- */ - -/* simple little function to perror and exit */ - -static void err(char *s) -{ - if (errno) { - perror(s); - } - else { - printf("%s", s); - } - exit(errno); -} - -/* --------------------------------------------------------- */ - -/* write out request to a connection - assumes we can write - (small) request out in one go into our new socket buffer */ - -static void write_request(struct connection * c) -{ -#ifndef NO_WRITEV - struct iovec out[2]; int outcnt = 1; -#endif - gettimeofday(&c->connect, 0); -#ifndef NO_WRITEV - out[0].iov_base = request; - out[0].iov_len = reqlen; - - if (posting) { - out[1].iov_base = postdata; - out[1].iov_len = postlen; - outcnt = 2; - totalposted += (reqlen + postlen); - } - writev(c->fd,out, outcnt); -#else - write(c->fd,request,reqlen); - if (posting) { - write(c->fd,postdata,postlen); - totalposted += (reqlen + postlen); - } -#endif - - c->state = STATE_READ; - FD_SET(c->fd, &readbits); - FD_CLR(c->fd, &writebits); -} - -/* --------------------------------------------------------- */ - -/* make an fd non blocking */ - -static void nonblock(int fd) -{ - int i = 1; - ioctl(fd, FIONBIO, &i); -} - -/* --------------------------------------------------------- */ - -/* returns the time in ms between two timevals */ - -static int timedif(struct timeval a, struct timeval b) -{ - register int us, s; - - us = a.tv_usec - b.tv_usec; - us /= 1000; - s = a.tv_sec - b.tv_sec; - s *= 1000; - return s + us; -} - -/* --------------------------------------------------------- */ - -/* calculate and output results */ - -static void output_results(void) -{ - int timetaken; - - gettimeofday(&endtime, 0); - timetaken = timedif(endtime, start); - - printf("\r \r"); - printf("Server Software: %s\n", servername); - printf("Server Hostname: %s\n", hostname); - printf("Server Port: %d\n", port); - printf("\n"); - printf("Document Path: %s\n", path); - printf("Document Length: %d bytes\n", doclen); - printf("\n"); - printf("Concurrency Level: %d\n", concurrency); - printf("Time taken for tests: %d.%03d seconds\n", - timetaken / 1000, timetaken % 1000); - printf("Complete requests: %d\n", done); - printf("Failed requests: %d\n", bad); - if (bad) - printf(" (Connect: %d, Length: %d, Exceptions: %d)\n", - err_conn, err_length, err_except); - if (err_response) - printf("Non-2xx responses: %d\n", err_response); - if (keepalive) - printf("Keep-Alive requests: %d\n", doneka); - printf("Total transferred: %d bytes\n", totalread); - if (posting) - printf("Total POSTed: %d\n", totalposted); - printf("HTML transferred: %d bytes\n", totalbread); - - /* avoid divide by zero */ - if (timetaken) { - printf("Requests per second: %.2f\n", 1000 * (float) (done) / timetaken); - printf("Transfer rate: %.2f kb/s received\n", - (float) (totalread) / timetaken); - if (posting) { - printf(" %.2f kb/s sent\n", - (float) (totalposted) / timetaken); - printf(" %.2f kb/s total\n", - (float) (totalread + totalposted) / timetaken); - } - } - - { - /* work out connection times */ - int i; - int totalcon = 0, total = 0; - int mincon = 9999999, mintot = 999999; - int maxcon = 0, maxtot = 0; - - for (i = 0; i < requests; i++) { - struct data s = stats[i]; - mincon = ap_min(mincon, s.ctime); - mintot = ap_min(mintot, s.time); - maxcon = ap_max(maxcon, s.ctime); - maxtot = ap_max(maxtot, s.time); - totalcon += s.ctime; - total += s.time; - } - if (requests > 0) { /* avoid division by zero (if 0 requests) */ - printf("\nConnnection Times (ms)\n"); - printf(" min avg max\n"); - printf("Connect: %5d %5d %5d\n", mincon, totalcon / requests, maxcon); - printf("Processing: %5d %5d %5d\n", - mintot - mincon, (total / requests) - (totalcon / requests), - maxtot - maxcon); - printf("Total: %5d %5d %5d\n", mintot, total / requests, maxtot); - } - } -} - -/* --------------------------------------------------------- */ - -/* calculate and output results in HTML */ - -static void output_html_results(void) -{ - int timetaken; - - gettimeofday(&endtime, 0); - timetaken = timedif(endtime, start); - - printf("\n\n\n", tablestring); - printf("" - "\n", - trstring, tdstring, tdstring, servername); - printf("" - "\n", - trstring, tdstring, tdstring, hostname); - printf("" - "\n", - trstring, tdstring, tdstring, port); - printf("" - "\n", - trstring, tdstring, tdstring, path); - printf("" - "\n", - trstring, tdstring, tdstring, doclen); - printf("" - "\n", - trstring, tdstring, tdstring, concurrency); - printf("" - "\n", - trstring, tdstring, tdstring, timetaken / 1000, timetaken % 1000); - printf("" - "\n", - trstring, tdstring, tdstring, done); - printf("" - "\n", - trstring, tdstring, tdstring, bad); - if (bad) - printf("\n", - trstring, tdstring, err_conn, err_length, err_except); - if (err_response) - printf("" - "\n", - trstring, tdstring, tdstring, err_response); - if (keepalive) - printf("" - "\n", - trstring, tdstring, tdstring, doneka); - printf("" - "\n", - trstring, tdstring, tdstring, totalread); - if (posting) - printf("" - "\n", - trstring, tdstring, tdstring, totalposted); - printf("" - "\n", - trstring, tdstring, tdstring, totalbread); - - /* avoid divide by zero */ - if (timetaken) { - printf("" - "\n", - trstring, tdstring, tdstring, 1000 * (float) (done) / timetaken); - printf("" - "\n", - trstring, tdstring, tdstring, (float) (totalread) / timetaken); - if (posting) { - printf("" - "\n", - trstring, tdstring, tdstring, - (float) (totalposted) / timetaken); - printf("" - "\n", - trstring, tdstring, tdstring, - (float) (totalread + totalposted) / timetaken); - } - } - - { - /* work out connection times */ - int i; - int totalcon = 0, total = 0; - int mincon = 9999999, mintot = 999999; - int maxcon = 0, maxtot = 0; - - for (i = 0; i < requests; i++) { - struct data s = stats[i]; - mincon = ap_min(mincon, s.ctime); - mintot = ap_min(mintot, s.time); - maxcon = ap_max(maxcon, s.ctime); - maxtot = ap_max(maxtot, s.time); - totalcon += s.ctime; - total += s.time; - } - - if (requests > 0) { /* avoid division by zero (if 0 requests) */ - printf("\n", - trstring, tdstring); - printf("\n", - trstring, tdstring, tdstring, tdstring, tdstring); - printf("" - "" - "" - "\n", - trstring, tdstring, tdstring, mincon, tdstring, totalcon / requests, tdstring, maxcon); - printf("" - "" - "" - "\n", - trstring, tdstring, tdstring, mintot - mincon, tdstring, - (total / requests) - (totalcon / requests), tdstring, maxtot - maxcon); - printf("" - "" - "" - "\n", - trstring, tdstring, tdstring, mintot, tdstring, total / requests, tdstring, maxtot); - } - printf("
    Server Software:%s
    Server Hostname:%s
    Server Port:%d
    Document Path:%s
    Document Length:%d bytes
    Concurrency Level:%d
    Time taken for tests:%d.%03d seconds
    Complete requests:%d
    Failed requests:%d
    (Connect: %d, Length: %d, Exceptions: %d)
    Non-2xx responses:%d
    Keep-Alive requests:%d
    Total transferred:%d bytes
    Total POSTed:%d
    HTML transferred:%d bytes
    Requests per second:%.2f
    Transfer rate:%.2f kb/s received
     %.2f kb/s sent
     %.2f kb/s total
    Connnection Times (ms)
      min avg max
    Connect:%5d%5d%5d
    Processing:%5d%5d%5d
    Total:%5d%5d%5d
    \n"); - } -} - -/* --------------------------------------------------------- */ - -/* start asnchronous non-blocking connection */ - -static void start_connect(struct connection * c) -{ - c->read = 0; - c->bread = 0; - c->keepalive = 0; - c->cbx = 0; - c->gotheader = 0; - - c->fd = socket(AF_INET, SOCK_STREAM, 0); - if (c->fd < 0) - err("socket"); - - nonblock(c->fd); - gettimeofday(&c->start, 0); - - if (connect(c->fd, (struct sockaddr *) & server, sizeof(server)) < 0) { - if (errno == EINPROGRESS) { - c->state = STATE_CONNECTING; - FD_SET(c->fd, &writebits); - return; - } - else { - close(c->fd); - err_conn++; - if (bad++ > 10) { - err("\nTest aborted after 10 failures\n\n"); - } - start_connect(c); - } - } - - /* connected first time */ - write_request(c); -} - -/* --------------------------------------------------------- */ - -/* close down connection and save stats */ - -static void close_connection(struct connection * c) -{ - if (c->read == 0 && c->keepalive) { - /* server has legitimately shut down an idle keep alive request */ - good--; /* connection never happend */ - } - else { - if (good == 1) { - /* first time here */ - doclen = c->bread; - } - else if (c->bread != doclen) { - bad++; - err_length++; - } - - /* save out time */ - if (done < requests) { - struct data s; - gettimeofday(&c->done, 0); - s.read = c->read; - s.ctime = timedif(c->connect, c->start); - s.time = timedif(c->done, c->start); - stats[done++] = s; - } - } - - close(c->fd); - FD_CLR(c->fd, &readbits); - FD_CLR(c->fd, &writebits); - - /* connect again */ - start_connect(c); - return; -} - -/* --------------------------------------------------------- */ - -/* read data from connection */ - -static void read_connection(struct connection * c) -{ - int r; - char *part; - char respcode[4]; /* 3 digits and null */ - - r = read(c->fd, buffer, sizeof(buffer)); - if (r == 0 || (r < 0 && errno != EAGAIN)) { - good++; - close_connection(c); - return; - } - - if (r < 0 && errno == EAGAIN) - return; - - c->read += r; - totalread += r; - - if (!c->gotheader) { - char *s; - int l = 4; - int space = CBUFFSIZE - c->cbx - 1; /* -1 to allow for 0 - * terminator */ - int tocopy = (space < r) ? space : r; -#ifndef CHARSET_EBCDIC - memcpy(c->cbuff + c->cbx, buffer, tocopy); -#else /* CHARSET_EBCDIC */ - ascii2ebcdic(c->cbuff + c->cbx, buffer, tocopy); -#endif /* CHARSET_EBCDIC */ - c->cbx += tocopy; - space -= tocopy; - c->cbuff[c->cbx] = 0; /* terminate for benefit of strstr */ - if (verbosity >= 4) { - printf("LOG: header received:\n%s\n", c->cbuff); - } - s = strstr(c->cbuff, "\r\n\r\n"); - /* - * this next line is so that we talk to NCSA 1.5 which blatantly - * breaks the http specification - */ - if (!s) { - s = strstr(c->cbuff, "\n\n"); - l = 2; - } - - if (!s) { - /* read rest next time */ - if (space) - return; - else { - /* header is in invalid or too big - close connection */ - close(c->fd); - if (bad++ > 10) { - err("\nTest aborted after 10 failures\n\n"); - } - FD_CLR(c->fd, &writebits); - start_connect(c); - } - } - else { - /* have full header */ - if (!good) { - /* this is first time, extract some interesting info */ - char *p, *q; - p = strstr(c->cbuff, "Server:"); - q = servername; - if (p) { - p += 8; - while (*p > 32) - *q++ = *p++; - } - *q = 0; - } - - /* - * XXX: this parsing isn't even remotely HTTP compliant... but in - * the interest of speed it doesn't totally have to be, it just - * needs to be extended to handle whatever servers folks want to - * test against. -djg - */ - - /* check response code */ - part = strstr(c->cbuff, "HTTP"); /* really HTTP/1.x_ */ - strncpy(respcode, (part + strlen("HTTP/1.x_")), 3); - respcode[3] = '\0'; - if (respcode[0] != '2') { - err_response++; - if (verbosity >= 2) - printf("WARNING: Response code not 2xx (%s)\n", respcode); - } - else if (verbosity >= 3) { - printf("LOG: Response code = %s\n", respcode); - } - - c->gotheader = 1; - *s = 0; /* terminate at end of header */ - if (keepalive && - (strstr(c->cbuff, "Keep-Alive") - || strstr(c->cbuff, "keep-alive"))) { /* for benefit of MSIIS */ - char *cl; - cl = strstr(c->cbuff, "Content-Length:"); - /* handle NCSA, which sends Content-length: */ - if (!cl) - cl = strstr(c->cbuff, "Content-length:"); - if (cl) { - c->keepalive = 1; - c->length = atoi(cl + 16); - } - } - c->bread += c->cbx - (s + l - c->cbuff) + r - tocopy; - totalbread += c->bread; - } - } - else { - /* outside header, everything we have read is entity body */ - c->bread += r; - totalbread += r; - } - - if (c->keepalive && (c->bread >= c->length)) { - /* finished a keep-alive connection */ - good++; - doneka++; - /* save out time */ - if (good == 1) { - /* first time here */ - doclen = c->bread; - } - else if (c->bread != doclen) { - bad++; - err_length++; - } - if (done < requests) { - struct data s; - gettimeofday(&c->done, 0); - s.read = c->read; - s.ctime = timedif(c->connect, c->start); - s.time = timedif(c->done, c->start); - stats[done++] = s; - } - c->keepalive = 0; - c->length = 0; - c->gotheader = 0; - c->cbx = 0; - c->read = c->bread = 0; - write_request(c); - c->start = c->connect; /* zero connect time with keep-alive */ - } -} - -/* --------------------------------------------------------- */ - -/* run the tests */ - -static void test(void) -{ - struct timeval timeout, now; - fd_set sel_read, sel_except, sel_write; - int i; - - if (!use_html) { - printf("Benchmarking %s (be patient)...", hostname); - fflush(stdout); - } - - { - /* get server information */ - struct hostent *he; - he = gethostbyname(hostname); - if (!he) - err("bad hostname"); - server.sin_family = he->h_addrtype; - server.sin_port = htons(port); - server.sin_addr.s_addr = ((unsigned long *) (he->h_addr_list[0]))[0]; - } - - con = malloc(concurrency * sizeof(struct connection)); - memset(con, 0, concurrency * sizeof(struct connection)); - - stats = malloc(requests * sizeof(struct data)); - - FD_ZERO(&readbits); - FD_ZERO(&writebits); - - /* setup request */ - if (!posting) { - sprintf(request, "GET %s HTTP/1.0\r\n" - "User-Agent: ApacheBench/%s\r\n" - "%s" "%s" "%s" - "Host: %s\r\n" - "Accept: */*\r\n" - "\r\n" "%s", - path, - VERSION, - keepalive ? "Connection: Keep-Alive\r\n" : "", - cookie, auth, hostname, hdrs); - } - else { - sprintf(request, "POST %s HTTP/1.0\r\n" - "User-Agent: ApacheBench/%s\r\n" - "%s" "%s" "%s" - "Host: %s\r\n" - "Accept: */*\r\n" - "Content-length: %d\r\n" - "Content-type: %s\r\n" - "%s" - "\r\n", - path, - VERSION, - keepalive ? "Connection: Keep-Alive\r\n" : "", - cookie, auth, - hostname, postlen, - (content_type[0]) ? content_type : "text/plain", hdrs); - } - - if (verbosity >= 2) - printf("INFO: POST header == \n---\n%s\n---\n", request); - - reqlen = strlen(request); - -#ifdef CHARSET_EBCDIC - ebcdic2ascii(request, request, reqlen); -#endif /* CHARSET_EBCDIC */ - - /* ok - lets start */ - gettimeofday(&start, 0); - - /* initialise lots of requests */ - for (i = 0; i < concurrency; i++) - start_connect(&con[i]); - - while (done < requests) { - int n; - /* setup bit arrays */ - memcpy(&sel_except, &readbits, sizeof(readbits)); - memcpy(&sel_read, &readbits, sizeof(readbits)); - memcpy(&sel_write, &writebits, sizeof(readbits)); - - /* check for time limit expiry */ - gettimeofday(&now, 0); - if (tlimit && timedif(now, start) > (tlimit * 1000)) { - requests = done; /* so stats are correct */ - } - - /* Timeout of 30 seconds. */ - timeout.tv_sec = 30; - timeout.tv_usec = 0; - n = ap_select(FD_SETSIZE, &sel_read, &sel_write, &sel_except, &timeout); - if (!n) { - err("\nServer timed out\n\n"); - } - if (n < 1) - err("select"); - - for (i = 0; i < concurrency; i++) { - int s = con[i].fd; - if (FD_ISSET(s, &sel_except)) { - bad++; - err_except++; - start_connect(&con[i]); - continue; - } - if (FD_ISSET(s, &sel_read)) - read_connection(&con[i]); - if (FD_ISSET(s, &sel_write)) - write_request(&con[i]); - } - } - if (use_html) - output_html_results(); - else - output_results(); -} - -/* ------------------------------------------------------- */ - -/* display copyright information */ -static void copyright(void) -{ - if (!use_html) { - printf("This is ApacheBench, Version %s\n", VERSION); - printf("Copyright (c) 1996 Adam Twiss, Zeus Technology Ltd, http://www.zeustech.net/\n"); - printf("Copyright (c) 1998-1999 The Apache Group, http://www.apache.org/\n"); - printf("\n"); - } - else { - printf("

    \n"); - printf(" This is ApacheBench, Version %s
    \n", VERSION); - printf(" Copyright (c) 1996 Adam Twiss, Zeus Technology Ltd, http://www.zeustech.net/
    \n"); - printf(" Copyright (c) 1998-1999 The Apache Group, http://www.apache.org/
    \n"); - printf("

    \n

    \n"); - } -} - -/* display usage information */ -static void usage(char *progname) -{ - fprintf(stderr, "Usage: %s [options] [http://]hostname[:port]/path\n", progname); - fprintf(stderr, "Options are:\n"); - fprintf(stderr, " -n requests Number of requests to perform\n"); - fprintf(stderr, " -c concurrency Number of multiple requests to make\n"); - fprintf(stderr, " -t timelimit Seconds to max. wait for responses\n"); - fprintf(stderr, " -p postfile File containg data to POST\n"); - fprintf(stderr, " -T content-type Content-type header for POSTing\n"); - fprintf(stderr, " -v verbosity How much troubleshooting info to print\n"); - fprintf(stderr, " -w Print out results in HTML tables\n"); - fprintf(stderr, " -x attributes String to insert as table attributes\n"); - fprintf(stderr, " -y attributes String to insert as tr attributes\n"); - fprintf(stderr, " -z attributes String to insert as td or th attributes\n"); - fprintf(stderr, " -C attribute Add cookie, eg. 'Apache=1234. (repeatable)\n"); - fprintf(stderr, " -H attribute Add Arbitrary header line, eg. 'Accept-Encoding: zop'\n"); - fprintf(stderr, " Inserted after all normal header lines. (repeatable)\n"); - fprintf(stderr, " -A attribute Add Basic WWW Authentication, the attributes\n"); - fprintf(stderr, " are a colon separated username and password.\n"); - fprintf(stderr, " -p attribute Add Basic Proxy Authentication, the attributes\n"); - fprintf(stderr, " are a colon separated username and password.\n"); - fprintf(stderr, " -V Print version number and exit\n"); - fprintf(stderr, " -k Use HTTP KeepAlive feature\n"); - fprintf(stderr, " -h Display usage information (this message)\n"); - exit(EINVAL); -} - -/* ------------------------------------------------------- */ - -/* split URL into parts */ - -static int parse_url(char *url) -{ - char *cp; - char *h; - char *p = NULL; - - if (strlen(url) > 7 && strncmp(url, "http://", 7) == 0) - url += 7; - h = url; - if ((cp = strchr(url, ':')) != NULL) { - *cp++ = '\0'; - p = cp; - url = cp; - } - if ((cp = strchr(url, '/')) == NULL) - return 1; - strcpy(path, cp); - *cp = '\0'; - strcpy(hostname, h); - if (p != NULL) - port = atoi(p); - return 0; -} - -/* ------------------------------------------------------- */ - -/* read data to POST from file, save contents and length */ - -static int open_postfile(char *pfile) -{ - int postfd, status; - struct stat postfilestat; - - if ((postfd = open(pfile, O_RDONLY)) == -1) { - printf("Invalid postfile name (%s)\n", pfile); - return errno; - } - if ((status = fstat(postfd, &postfilestat)) == -1) { - perror("Can\'t stat postfile\n"); - return status; - } - postdata = malloc(postfilestat.st_size); - if (!postdata) { - printf("Can\'t alloc postfile buffer\n"); - return ENOMEM; - } - if (read(postfd, postdata, postfilestat.st_size) != postfilestat.st_size) { - printf("error reading postfilen"); - return EIO; - } - postlen = postfilestat.st_size; - return 0; -} - -/* ------------------------------------------------------- */ - -extern char *optarg; -extern int optind, opterr, optopt; - -/* sort out command-line args and call test */ -int main(int argc, char **argv) -{ - int c, r,l; - char tmp[1024]; - - /* table defaults */ - tablestring = ""; - trstring = ""; - tdstring = "bgcolor=white"; - cookie[0] = '\0'; - auth[0] = '\0'; - hdrs[0] = '\0'; - optind = 1; - while ((c = getopt(argc, argv, "n:c:t:T:p:v:kVhwx:y:z:C:H:P:A:")) > 0) { - switch (c) { - case 'n': - requests = atoi(optarg); - if (!requests) { - err("Invalid number of requests\n"); - } - break; - case 'k': - keepalive = 1; - break; - case 'c': - concurrency = atoi(optarg); - break; - case 'p': - if (0 == (r = open_postfile(optarg))) { - posting = 1; - } - else if (postdata) { - exit(r); - } - break; - case 'v': - verbosity = atoi(optarg); - break; - case 't': - tlimit = atoi(optarg); - requests = MAX_REQUESTS; /* need to size data array on - * something */ - break; - case 'T': - strcpy(content_type, optarg); - break; - case 'C': - strncat(cookie, "Cookie: ", sizeof(cookie)); - strncat(cookie, optarg, sizeof(cookie)); - strncat(cookie, "\r\n", sizeof(cookie)); - break; - case 'A': - /* assume username passwd already to be in colon separated form. Ready - * to be uu-encoded. - */ - while(isspace(*optarg)) - optarg++; - l=ap_base64encode(tmp,optarg,strlen(optarg)); - tmp[l]='\0'; - - strncat(auth, "Authorization: basic ", sizeof(auth)); - strncat(auth, tmp, sizeof(auth)); - strncat(auth, "\r\n", sizeof(auth)); - break; - case 'P': - /* - * assume username passwd already to be in colon separated form. - */ - while(isspace(*optarg)) - optarg++; - l=ap_base64encode(tmp,optarg,strlen(optarg)); - tmp[l]='\0'; - - strncat(auth, "Proxy-Authorization: basic ", sizeof(auth)); - strncat(auth, tmp, sizeof(auth)); - strncat(auth, "\r\n", sizeof(auth)); - break; - case 'H': - strncat(hdrs, optarg, sizeof(hdrs)); - strncat(hdrs, "\r\n", sizeof(hdrs)); - break; - case 'V': - copyright(); - exit(0); - break; - case 'w': - use_html = 1; - break; - /* - * if any of the following three are used, turn on html output - * automatically - */ - case 'x': - use_html = 1; - tablestring = optarg; - break; - case 'y': - use_html = 1; - trstring = optarg; - break; - case 'z': - use_html = 1; - tdstring = optarg; - break; - case 'h': - usage(argv[0]); - break; - default: - fprintf(stderr, "%s: invalid option `%c'\n", argv[0], c); - usage(argv[0]); - break; - } - } - if (optind != argc - 1) { - fprintf(stderr, "%s: wrong number of arguments\n", argv[0]); - usage(argv[0]); - } - - if (parse_url(argv[optind++])) { - fprintf(stderr, "%s: invalid URL\n", argv[0]); - usage(argv[0]); - } - - copyright(); - test(); - - exit(0); -} diff --git a/support/ab.dsp b/support/ab.dsp deleted file mode 100644 index d99141d5983f0d8e6589628ca0d70e70dbe10778..0000000000000000000000000000000000000000 --- a/support/ab.dsp +++ /dev/null @@ -1,93 +0,0 @@ -# Microsoft Developer Studio Project File - Name="ab" - Package Owner=<4> -# Microsoft Developer Studio Generated Build File, Format Version 5.00 -# ** DO NOT EDIT ** - -# TARGTYPE "Win32 (x86) Console Application" 0x0103 - -CFG=ab - Win32 Debug -!MESSAGE This is not a valid makefile. To build this project using NMAKE, -!MESSAGE use the Export Makefile command and run -!MESSAGE -!MESSAGE NMAKE /f "ab.mak". -!MESSAGE -!MESSAGE You can specify a configuration when running NMAKE -!MESSAGE by defining the macro CFG on the command line. For example: -!MESSAGE -!MESSAGE NMAKE /f "ab.mak" CFG="ab - Win32 Debug" -!MESSAGE -!MESSAGE Possible choices for configuration are: -!MESSAGE -!MESSAGE "ab - Win32 Release" (based on\ - "Win32 (x86) Console Application") -!MESSAGE "ab - Win32 Debug" (based on "Win32 (x86) Console Application") -!MESSAGE - -# Begin Project -# PROP Scc_ProjName "" -# PROP Scc_LocalPath "" -CPP=cl.exe -RSC=rc.exe - -!IF "$(CFG)" == "ab - Win32 Release" - -# PROP BASE Use_MFC 0 -# PROP BASE Use_Debug_Libraries 0 -# PROP BASE Output_Dir "ab" -# PROP BASE Intermediate_Dir "ab" -# PROP BASE Target_Dir "" -# PROP Use_MFC 0 -# PROP Use_Debug_Libraries 0 -# PROP Output_Dir "" -# PROP Intermediate_Dir "" -# PROP Ignore_Export_Lib 0 -# PROP Target_Dir "" -# ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c -# ADD CPP /nologo /MD /W3 /GX /O2 /I "..\include" /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /FD /c -# SUBTRACT CPP /YX -# ADD BASE RSC /l 0x409 /d "NDEBUG" -# ADD RSC /l 0x409 /d "NDEBUG" -BSC32=bscmake.exe -# ADD BASE BSC32 /nologo -# ADD BSC32 /nologo -LINK32=link.exe -# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /machine:I386 -# ADD LINK32 kernel32.lib advapi32.lib wsock32.lib ws2_32.lib /nologo /subsystem:console /machine:I386 /out:"release/ab.exe" -# SUBTRACT LINK32 /pdb:none - -!ELSEIF "$(CFG)" == "ab - Win32 Debug" - -# PROP BASE Use_MFC 0 -# PROP BASE Use_Debug_Libraries 1 -# PROP BASE Output_Dir "ab0" -# PROP BASE Intermediate_Dir "ab0" -# PROP BASE Target_Dir "" -# PROP Use_MFC 0 -# PROP Use_Debug_Libraries 1 -# PROP Output_Dir "" -# PROP Intermediate_Dir "" -# PROP Ignore_Export_Lib 0 -# PROP Target_Dir "" -# ADD BASE CPP /nologo /W3 /Gm /GX /Zi /Od /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c -# ADD CPP /nologo /MDd /W3 /Gm /GX /Zi /Od /I "..\lib\apr\include" /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /FD /c -# SUBTRACT CPP /YX -# ADD BASE RSC /l 0x409 /d "_DEBUG" -# ADD RSC /l 0x409 /d "_DEBUG" -BSC32=bscmake.exe -# ADD BASE BSC32 /nologo -# ADD BSC32 /nologo -LINK32=link.exe -# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept -# ADD LINK32 kernel32.lib advapi32.lib wsock32.lib ws2_32.lib /nologo /subsystem:console /incremental:no /debug /machine:I386 /out:"debug/ab.exe" /pdbtype:sept - -!ENDIF - -# Begin Target - -# Name "ab - Win32 Release" -# Name "ab - Win32 Debug" -# Begin Source File - -SOURCE=.\ab.c -# End Source File -# End Target -# End Project diff --git a/support/abs.dsp b/support/abs.dsp deleted file mode 100644 index cd8467a594765dbf877dd13ebee75870c445a145..0000000000000000000000000000000000000000 --- a/support/abs.dsp +++ /dev/null @@ -1,131 +0,0 @@ -# Microsoft Developer Studio Project File - Name="abs" - Package Owner=<4> -# Microsoft Developer Studio Generated Build File, Format Version 6.00 -# ** DO NOT EDIT ** - -# TARGTYPE "Win32 (x86) Console Application" 0x0103 - -CFG=abs - Win32 Debug -!MESSAGE This is not a valid makefile. To build this project using NMAKE, -!MESSAGE use the Export Makefile command and run -!MESSAGE -!MESSAGE NMAKE /f "abs.mak". -!MESSAGE -!MESSAGE You can specify a configuration when running NMAKE -!MESSAGE by defining the macro CFG on the command line. For example: -!MESSAGE -!MESSAGE NMAKE /f "abs.mak" CFG="abs - Win32 Debug" -!MESSAGE -!MESSAGE Possible choices for configuration are: -!MESSAGE -!MESSAGE "abs - Win32 Release" (based on "Win32 (x86) Console Application") -!MESSAGE "abs - Win32 Debug" (based on "Win32 (x86) Console Application") -!MESSAGE - -# Begin Project -# PROP AllowPerConfigDependencies 0 -# PROP Scc_ProjName "" -# PROP Scc_LocalPath "" -CPP=cl.exe -RSC=rc.exe - -!IF "$(CFG)" == "abs - Win32 Release" - -# PROP BASE Use_MFC 0 -# PROP BASE Use_Debug_Libraries 0 -# PROP BASE Output_Dir "Release" -# PROP BASE Intermediate_Dir "Release" -# PROP BASE Target_Dir "" -# PROP Use_MFC 0 -# PROP Use_Debug_Libraries 0 -# PROP Output_Dir "Release" -# PROP Intermediate_Dir "Release" -# PROP Ignore_Export_Lib 0 -# PROP Target_Dir "" -# ADD BASE CPP /nologo /MD /W3 /O2 /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /D "APR_DECLARE_STATIC" /D "APU_DECLARE_STATIC" /D "SSL" /FD /c -# ADD CPP /nologo /MD /W3 /O2 /I "../srclib/apr/include" /I "../srclib/apr-util/include" /I "../include" /I "../srclib/openssl/inc32" /D "NDEBUG" /D "WIN32" /D "_CONSOLE" /D "APR_DECLARE_STATIC" /D "APU_DECLARE_STATIC" /D "USE_SSL" /Fd"Release/abs" /FD /c -# ADD BASE RSC /l 0x409 /d "NDEBUG" -# ADD RSC /l 0x409 /d "NDEBUG" -BSC32=bscmake.exe -# ADD BASE BSC32 /nologo -# ADD BSC32 /nologo -LINK32=link.exe -# ADD BASE LINK32 kernel32.lib user32.lib wsock32.lib ws2_32.lib ssleay32.lib libeay32.lib /nologo /subsystem:console /map /machine:I386 /libpath:"../srclib/openssl/out32dll" -# ADD LINK32 kernel32.lib advapi32.lib wsock32.lib ws2_32.lib ssleay32.lib libeay32.lib /nologo /subsystem:console /map /machine:I386 /libpath:"../srclib/openssl/out32dll" - -!ELSEIF "$(CFG)" == "abs - Win32 Debug" - -# PROP BASE Use_MFC 0 -# PROP BASE Use_Debug_Libraries 1 -# PROP BASE Output_Dir "Debug" -# PROP BASE Intermediate_Dir "Debug" -# PROP BASE Target_Dir "" -# PROP Use_MFC 0 -# PROP Use_Debug_Libraries 1 -# PROP Output_Dir "Debug" -# PROP Intermediate_Dir "Debug" -# PROP Ignore_Export_Lib 0 -# PROP Target_Dir "" -# ADD BASE CPP /nologo /MDd /W3 /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /D "APR_DECLARE_STATIC" /D "APU_DECLARE_STATIC" /D "SSL" /FD /c -# ADD CPP /nologo /MDd /W3 /GX /Zi /Od /I "../srclib/apr/include" /I "../srclib/apr-util/include" /I "../include" /I "../srclib/openssl/inc32" /D "_DEBUG" /D "WIN32" /D "_CONSOLE" /D "APR_DECLARE_STATIC" /D "APU_DECLARE_STATIC" /D "USE_SSL" /Fd"Debug/abs" /FD /c -# ADD BASE RSC /l 0x409 /d "_DEBUG" -# ADD RSC /l 0x409 /d "_DEBUG" -BSC32=bscmake.exe -# ADD BASE BSC32 /nologo -# ADD BSC32 /nologo -LINK32=link.exe -# ADD BASE LINK32 kernel32.lib advapi32.lib wsock32.lib ws2_32.lib ssleay32.lib libeay32.lib /nologo /subsystem:console /incremental:no /map /debug /machine:I386 /libpath:"../srclib/openssl/out32dll" -# ADD LINK32 kernel32.lib advapi32.lib wsock32.lib ws2_32.lib ssleay32.lib libeay32.lib /nologo /subsystem:console /incremental:no /map /debug /machine:I386 /libpath:"../srclib/openssl/out32dll" - -!ENDIF - -# Begin Target - -# Name "abs - Win32 Release" -# Name "abs - Win32 Debug" -# Begin Source File - -SOURCE=.\ab.c - -!IF "$(CFG)" == "abs - Win32 Release" -# ADD CPP /Fo"Release/abs.obj" - -!ELSEIF "$(CFG)" == "abs - Win32 Debug" -# ADD CPP /Fo"Debug/abs.obj" - -!ENDIF -# End Source File -# Begin Source File - -SOURCE=.\abs.rc -# End Source File -# Begin Source File - -SOURCE=..\build\win32\win32ver.awk - -!IF "$(CFG)" == "abs - Win32 Release" - -# PROP Ignore_Default_Tool 1 -# Begin Custom Build - Creating Version Resource -InputPath=..\build\win32\win32ver.awk - -".\abs.rc" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)" - awk -f ../build/win32/win32ver.awk ab "ApacheBench/SSL Utility" ../include/ap_release.h > .\abs.rc - -# End Custom Build - -!ELSEIF "$(CFG)" == "abs - Win32 Debug" - -# PROP Ignore_Default_Tool 1 -# Begin Custom Build - Creating Version Resource -InputPath=..\build\win32\win32ver.awk - -".\abs.rc" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)" - awk -f ../build/win32/win32ver.awk ab "ApacheBench/SSL Utility" ../include/ap_release.h > .\abs.rc - -# End Custom Build - -!ENDIF - -# End Source File -# End Target -# End Project diff --git a/support/apachectl.in b/support/apachectl.in deleted file mode 100644 index 6f9bc6f7b50180fb3df69a8f43281750873a0ded..0000000000000000000000000000000000000000 --- a/support/apachectl.in +++ /dev/null @@ -1,234 +0,0 @@ -#!/bin/sh -# -# Copyright (c) 2000 The Apache Software Foundation. -# See license at the end of this file. -# -# Apache control script designed to allow an easy command line interface -# to controlling Apache. Written by Marc Slemko, 1997/08/23 -# -# The exit codes returned are: -# 0 - operation completed successfully -# 1 - -# 2 - usage error -# 3 - httpd could not be started -# 4 - httpd could not be stopped -# 5 - httpd could not be started during a restart -# 6 - httpd could not be restarted during a restart -# 7 - httpd could not be restarted during a graceful restart -# 8 - configuration syntax error -# -# When multiple arguments are given, only the error from the _last_ -# one is reported. Run "apachectl help" for usage info -# -# -# |||||||||||||||||||| START CONFIGURATION SECTION |||||||||||||||||||| -# -------------------- -------------------- -# -# the path to your PID file -PIDFILE=@prefix@/logs/httpd.pid -# -# the path to your httpd binary, including options if necessary -HTTPD='@prefix@/bin/httpd' -# -# a command that outputs a formatted text version of the HTML at the -# url given on the command line. Designed for lynx, however other -# programs may work. -LYNX="lynx -dump" -# -# the URL to your server's mod_status status page. If you do not -# have one, then status and fullstatus will not work. -STATUSURL="http://localhost:@PORT@/server-status" -# -# -------------------- -------------------- -# |||||||||||||||||||| END CONFIGURATION SECTION |||||||||||||||||||| - -ERROR=0 -ARGV="$@" -if [ "x$ARGV" = "x" ] ; then - ARGS="help" -fi - -for ARG in $@ $ARGS -do - # check for pidfile - if [ -f $PIDFILE ] ; then - PID=`cat $PIDFILE` - if [ "x$PID" != "x" ] && kill -0 $PID 2>/dev/null ; then - STATUS="httpd (pid $PID) running" - RUNNING=1 - else - STATUS="httpd (pid $PID?) not running" - RUNNING=0 - fi - else - STATUS="httpd (no pid file) not running" - RUNNING=0 - fi - - case $ARG in - start) - if [ $RUNNING -eq 1 ]; then - echo "$0 $ARG: httpd (pid $PID) already running" - continue - fi - if $HTTPD ; then - echo "$0 $ARG: httpd started" - else - echo "$0 $ARG: httpd could not be started" - ERROR=3 - fi - ;; - stop) - if [ $RUNNING -eq 0 ]; then - echo "$0 $ARG: $STATUS" - continue - fi - if kill $PID ; then - echo "$0 $ARG: httpd stopped" - else - echo "$0 $ARG: httpd could not be stopped" - ERROR=4 - fi - ;; - restart) - if [ $RUNNING -eq 0 ]; then - echo "$0 $ARG: httpd not running, trying to start" - if $HTTPD ; then - echo "$0 $ARG: httpd started" - else - echo "$0 $ARG: httpd could not be started" - ERROR=5 - fi - else - if $HTTPD -t >/dev/null 2>&1; then - if kill -HUP $PID ; then - echo "$0 $ARG: httpd restarted" - else - echo "$0 $ARG: httpd could not be restarted" - ERROR=6 - fi - else - echo "$0 $ARG: configuration broken, ignoring restart" - echo "$0 $ARG: (run 'apachectl configtest' for details)" - ERROR=6 - fi - fi - ;; - graceful) - if [ $RUNNING -eq 0 ]; then - echo "$0 $ARG: httpd not running, trying to start" - if $HTTPD ; then - echo "$0 $ARG: httpd started" - else - echo "$0 $ARG: httpd could not be started" - ERROR=5 - fi - else - if $HTTPD -t >/dev/null 2>&1; then - if kill -WINCH $PID ; then - echo "$0 $ARG: httpd gracefully restarted" - else - echo "$0 $ARG: httpd could not be restarted" - ERROR=7 - fi - else - echo "$0 $ARG: configuration broken, ignoring restart" - echo "$0 $ARG: (run 'apachectl configtest' for details)" - ERROR=7 - fi - fi - ;; - status) - $LYNX $STATUSURL | awk ' /process$/ { print; exit } { print } ' - ;; - fullstatus) - $LYNX $STATUSURL - ;; - configtest) - if $HTTPD -t; then - : - else - ERROR=8 - fi - ;; - *) - echo "usage: $0 (start|stop|restart|fullstatus|status|graceful|configtest|help)" - cat <. -# -# Portions of this software are based upon public domain software -# originally written at the National Center for Supercomputing Applications, -# University of Illinois, Urbana-Champaign. -# diff --git a/support/apxs.in b/support/apxs.in deleted file mode 100644 index 3bdd35d2b917b46255eccbf0f46cb446c590d972..0000000000000000000000000000000000000000 --- a/support/apxs.in +++ /dev/null @@ -1,655 +0,0 @@ -#!/usr/local/bin/perl -## ==================================================================== -## Copyright (c) 1998-1999 The Apache Group. All rights reserved. -## -## Redistribution and use in source and binary forms, with or without -## modification, are permitted provided that the following conditions -## are met: -## -## 1. Redistributions of source code must retain the above copyright -## notice, this list of conditions and the following disclaimer. -## -## 2. Redistributions in binary form must reproduce the above copyright -## notice, this list of conditions and the following disclaimer in -## the documentation and/or other materials provided with the -## distribution. -## -## 3. All advertising materials mentioning features or use of this -## software must display the following acknowledgment: -## "This product includes software developed by the Apache Group -## for use in the Apache HTTP server project (http://www.apache.org/)." -## -## 4. The names "Apache Server" and "Apache Group" must not be used to -## endorse or promote products derived from this software without -## prior written permission. For written permission, please contact -## apache@apache.org. -## -## 5. Products derived from this software may not be called "Apache" -## nor may "Apache" appear in their names without prior written -## permission of the Apache Group. -## -## 6. Redistributions of any form whatsoever must retain the following -## acknowledgment: -## "This product includes software developed by the Apache Group -## for use in the Apache HTTP server project (http://www.apache.org/)." -## -## THIS SOFTWARE IS PROVIDED BY THE APACHE GROUP ``AS IS'' AND ANY -## EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -## IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR -## PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE APACHE GROUP OR -## ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -## SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT -## NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; -## LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) -## HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, -## STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) -## ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED -## OF THE POSSIBILITY OF SUCH DAMAGE. -## ==================================================================== -## -## This software consists of voluntary contributions made by many -## individuals on behalf of the Apache Group and was originally based -## on public domain software written at the National Center for -## Supercomputing Applications, University of Illinois, Urbana-Champaign. -## For more information on the Apache Group and the Apache HTTP server -## project, please see . -## - -## -## apxs -- APache eXtenSion tool -## Written by Ralf S. Engelschall -## - -require 5.003; -use strict; -package apxs; - -## -## Configuration -## - -my $CFG_TARGET = '@TARGET@'; # substituted via Makefile.tmpl -my $CFG_CC = '@CC@'; # substituted via Makefile.tmpl -my $CFG_CFLAGS = '@CFLAGS@'; # substituted via Makefile.tmpl -my $CFG_CFLAGS_SHLIB = '@CFLAGS_SHLIB@'; # substituted via Makefile.tmpl -my $CFG_LD_SHLIB = '@LD_SHLIB@'; # substituted via Makefile.tmpl -my $CFG_LDFLAGS_SHLIB = '@LDFLAGS_MOD_SHLIB@'; # substituted via Makefile.tmpl -my $CFG_LIBS_SHLIB = '@LIBS_SHLIB@'; # substituted via Makefile.tmpl -my $CFG_PREFIX = '@prefix@'; # substituted via APACI install -my $CFG_SBINDIR = '@sbindir@'; # substituted via APACI install -my $CFG_INCLUDEDIR = '@includedir@'; # substituted via APACI install -my $CFG_LIBEXECDIR = '@libexecdir@'; # substituted via APACI install -my $CFG_SYSCONFDIR = '@sysconfdir@'; # substituted via APACI install - -## -## Cleanup the above stuff -## -$CFG_CFLAGS =~ s|^\s+||; -$CFG_CFLAGS =~ s|\s+$||; -$CFG_CFLAGS =~ s|\s+`.+apaci`||; - -## -## Initial shared object support check -## -if (not -x "$CFG_SBINDIR/$CFG_TARGET") { - print STDERR "apxs:Error: $CFG_SBINDIR/$CFG_TARGET not found or not executable\n"; - exit(1); -} -if (not grep(/mod_so/, `$CFG_SBINDIR/$CFG_TARGET -l`)) { - print STDERR "apxs:Error: Sorry, no shared object support for Apache\n"; - print STDERR "apxs:Error: available under your platform. Make sure\n"; - print STDERR "apxs:Error: the Apache module mod_so is compiled into\n"; - print STDERR "apxs:Error: your server binary `$CFG_SBINDIR/$CFG_TARGET'.\n"; - exit(1); -} - -## -## parse argument line -## - -# defaults for parameters -my $opt_n = ''; -my $opt_g = ''; -my $opt_c = 0; -my $opt_o = ''; -my @opt_D = (); -my @opt_I = (); -my @opt_L = (); -my @opt_l = (); -my @opt_W = (); -my @opt_S = (); -my $opt_e = 0; -my $opt_i = 0; -my $opt_a = 0; -my $opt_A = 0; -my $opt_q = 0; - -# this subroutine is derived from Perl's getopts.pl with the enhancement of -# the "+" metacharater at the format string to allow a list to be build by -# subsequent occurance of the same option. -sub Getopts { - my ($argumentative, @ARGV) = @_; - my (@args, $first, $rest, $pos); - my ($errs) = 0; - local ($_); - local ($[) = 0; - - @args = split( / */, $argumentative); - while(@ARGV && ($_ = $ARGV[0]) =~ /^-(.)(.*)/) { - ($first, $rest) = ($1,$2); - if ($_ =~ m|^--$|) { - shift(@ARGV); - last; - } - $pos = index($argumentative,$first); - if($pos >= $[) { - if($args[$pos+1] eq ':') { - shift(@ARGV); - if($rest eq '') { - unless (@ARGV) { - print STDERR "apxs:Error: Incomplete option: $first (needs an argument)\n"; - ++$errs; - } - $rest = shift(@ARGV); - } - eval "\$opt_$first = \$rest;"; - } - elsif ($args[$pos+1] eq '+') { - shift(@ARGV); - if($rest eq '') { - unless (@ARGV) { - print STDERR "apxs:Error: Incomplete option: $first (needs an argument)\n"; - ++$errs; - } - $rest = shift(@ARGV); - } - eval "push(\@opt_$first, \$rest);"; - } - else { - eval "\$opt_$first = 1"; - if($rest eq '') { - shift(@ARGV); - } - else { - $ARGV[0] = "-$rest"; - } - } - } - else { - print STDERR "apxs:Error: Unknown option: $first\n"; - ++$errs; - if($rest ne '') { - $ARGV[0] = "-$rest"; - } - else { - shift(@ARGV); - } - } - } - return ($errs == 0, @ARGV); -} - -sub usage { - print STDERR "Usage: apxs -g [-S =] -n \n"; - print STDERR " apxs -q [-S =] ...\n"; - print STDERR " apxs -c [-S =] [-o ] [-D [=]]\n"; - print STDERR " [-I ] [-L ] [-l ] [-Wc,]\n"; - print STDERR " [-Wl,] ...\n"; - print STDERR " apxs -i [-S =] [-a] [-A] [-n ] ...\n"; - print STDERR " apxs -e [-S =] [-a] [-A] [-n ] ...\n"; - exit(1); -} - -# option handling -my $rc; -($rc, @ARGV) = &Getopts("qn:gco:I+D+L+l+W+S+eiaA", @ARGV); -&usage if ($rc == 0); -&usage if ($#ARGV == -1 and not $opt_g); -&usage if (not $opt_q and not ($opt_g and $opt_n) and not $opt_i and not $opt_c and not $opt_e); - -# argument handling -my @args = @ARGV; -my $name = 'unknown'; -$name = $opt_n if ($opt_n ne ''); - -if (@opt_S) { - my ($opt_S); - foreach $opt_S (@opt_S) { - if ($opt_S =~ m/^([^=]+)=(.*)$/) { - my ($var) = $1; - my ($val) = $2; - my $oldval = eval "\$CFG_$var"; - - unless ($var and $oldval) { - print STDERR "apxs:Error: no config variable $var\n"; - &usage; - } - - eval "\$CFG_${var}=\"${val}\""; - } else { - print STDERR "apxs:Error: malformatted -S option\n"; - &usage; - } - } -} - -## -## Operation -## - -# helper function for executing a list of -# system command with return code checks -sub execute_cmds { - my (@cmds) = @_; - my ($cmd, $rc); - - foreach $cmd (@cmds) { - print STDERR "$cmd\n"; - $rc = system("$cmd"); - if ($rc != 0) { - printf(STDERR "apxs:Break: Command failed with rc=%d\n", $rc << 8); - exit(1); - } - } -} - -if ($opt_g) { - ## - ## SAMPLE MODULE SOURCE GENERATION - ## - - if (-d $name) { - print STDERR "apxs:Error: Directory `$name' already exists. Remove first\n"; - exit(1); - } - - my $data = join('', ); - $data =~ s|%NAME%|$name|sg; - $data =~ s|%TARGET%|$CFG_TARGET|sg; - - my ($mkf, $src) = ($data =~ m|^(.+)-=#=-\n(.+)|s); - - print STDERR "Creating [DIR] $name\n"; - system("mkdir $name"); - print STDERR "Creating [FILE] $name/Makefile\n"; - open(FP, ">${name}/Makefile") || die; - print FP $mkf; - close(FP); - print STDERR "Creating [FILE] $name/mod_$name.c\n"; - open(FP, ">${name}/mod_${name}.c") || die; - print FP $src; - close(FP); - - exit(0); -} - - -if ($opt_q) { - ## - ## QUERY INFORMATION - ## - - my $result = ''; - my $arg; - foreach $arg (@args) { - my $ok = 0; - my $name; - foreach $name (qw( - TARGET CC CFLAGS CFLAGS_SHLIB LD_SHLIB LDFLAGS_SHLIB LIBS_SHLIB - PREFIX SBINDIR INCLUDEDIR LIBEXECDIR SYSCONFDIR - )) { - if ($arg eq $name or $arg eq lc($name)) { - my $val = eval "\$CFG_$name"; - $result .= "${val}::"; - $ok = 1; - } - } - if (not $ok) { - printf(STDERR "apxs:Error: Invalid query string `%s'\n", $arg); - exit(1); - } - } - $result =~ s|::$||; - $result =~ s|::| |; - print $result; -} - -if ($opt_c) { - ## - ## SHARED OBJECT COMPILATION - ## - - # split files into sources and objects - my @srcs = (); - my @objs = (); - my $f; - foreach $f (@args) { - if ($f =~ m|\.c$|) { - push(@srcs, $f); - } - else { - push(@objs, $f); - } - } - - # determine output file - my $dso_file; - if ($opt_o eq '') { - if ($#srcs > -1) { - $dso_file = $srcs[0]; - $dso_file =~ s|\.[^.]+$|.so|; - } - elsif ($#objs > -1) { - $dso_file = $objs[0]; - $dso_file =~ s|\.[^.]+$|.so|; - } - else { - $dso_file = "mod_unknown.so"; - } - } - else { - $dso_file = $opt_o; - } - - # create compilation commands - my @cmds = (); - my $opt = ''; - my ($opt_Wc, $opt_I, $opt_D); - foreach $opt_Wc (@opt_W) { - $opt .= "$1 " if ($opt_Wc =~ m|^\s*c,(.*)$|); - } - foreach $opt_I (@opt_I) { - $opt .= "-I$opt_I "; - } - foreach $opt_D (@opt_D) { - $opt .= "-D$opt_D "; - } - my $cflags = "$CFG_CFLAGS $CFG_CFLAGS_SHLIB"; - my $s; - foreach $s (@srcs) { - my $o = $s; - $o =~ s|\.c$|.o|; - push(@cmds, "$CFG_CC $cflags -I$CFG_INCLUDEDIR $opt -c $s"); - unshift(@objs, $o); - } - - # create link command - my $cmd = "$CFG_LD_SHLIB $CFG_LDFLAGS_SHLIB -o $dso_file"; - my $o; - foreach $o (@objs) { - $cmd .= " $o"; - } - $opt = ''; - my ($opt_Wl, $opt_L, $opt_l); - foreach $opt_Wl (@opt_W) { - if($CFG_LD_SHLIB ne "gcc") { - $opt .= " $1" if ($opt_Wl =~ m|^\s*l,(.*)$|); - } else { - $opt .= " -W$opt_Wl"; - } - } - foreach $opt_L (@opt_L) { - $opt .= " -L$opt_L"; - } - foreach $opt_l (@opt_l) { - $opt .= " -l$opt_l"; - } - $cmd .= $opt; - $cmd .= " $CFG_LIBS_SHLIB"; - push(@cmds, $cmd); - - # execute the commands - &execute_cmds(@cmds); - - # allow one-step compilation and installation - if ($opt_i or $opt_e) { - @args = ( $dso_file ); - } -} - -if ($opt_i or $opt_e) { - ## - ## SHARED OBJECT INSTALLATION - ## - - # determine installation commands - # and corresponding LoadModule/AddModule directives - my @lmd = (); - my @amd = (); - my @cmds = (); - my $f; - foreach $f (@args) { - if ($f !~ m|\.so$|) { - print STDERR "apxs:Error: file $f is not a shared object\n"; - exit(1); - } - my $t = $f; - $t =~ s|^.+/([^/]+)$|$1|; - if ($opt_i) { - push(@cmds, "cp $f $CFG_LIBEXECDIR/$t"); - push(@cmds, "chmod 755 $CFG_LIBEXECDIR/$t"); - } - - # determine module symbolname and filename - my $filename = ''; - if ($name eq 'unknown') { - $name = ''; - my $base = $f; - $base =~ s|\.[^.]+$||; - if (-f "$base.c") { - open(FP, "<$base.c"); - my $content = join('', ); - close(FP); - if ($content =~ m|.*module\s+(?:MODULE_VAR_EXPORT\s+)?([a-zA-Z0-9_]+)_module\s*=\s*.*|s) { - $name = "$1"; - $filename = "$base.c"; - $filename =~ s|^[^/]+/||; - } - } - if ($name eq '') { - if ($base =~ m|.*mod_([a-zA-Z0-9_]+)\..+|) { - $name = "$1"; - $filename = $base; - $filename =~ s|^[^/]+/||; - } - } - if ($name eq '') { - print "apxs:Error: Sorry, cannot determine bootstrap symbol name\n"; - print "apxs:Error: Please specify one with option `-n'\n"; - exit(1); - } - } - if ($filename eq '') { - $filename = "mod_${name}.c"; - } - my $dir = $CFG_LIBEXECDIR; - $dir =~ s|^$CFG_PREFIX/?||; - $dir =~ s|(.)$|$1/|; - push(@lmd, sprintf("LoadModule %-18s %s", "${name}_module", "$dir$t")); - push(@amd, sprintf("AddModule %s", $filename)); - } - - # execute the commands - &execute_cmds(@cmds); - - # activate module via LoadModule/AddModule directive - if ($opt_a or $opt_A) { - if (not -f "$CFG_SYSCONFDIR/$CFG_TARGET.conf") { - print "apxs:Error: Config file $CFG_SYSCONFDIR/$CFG_TARGET.conf not found\n"; - exit(1); - } - - open(FP, "<$CFG_SYSCONFDIR/$CFG_TARGET.conf") || die; - my $content = join('', ); - close(FP); - - if ($content !~ m|\n#?\s*LoadModule\s+|) { - print STDERR "apxs:Error: Activation failed for custom $CFG_SYSCONFDIR/$CFG_TARGET.conf file.\n"; - print STDERR "apxs:Error: At least one `LoadModule' directive already has to exist.\n"; - exit(1); - } - - my $lmd; - my $c = ''; - $c = '#' if ($opt_A); - foreach $lmd (@lmd) { - my $what = $opt_A ? "preparing" : "activating"; - if ($content !~ m|\n#?\s*$lmd|) { - $content =~ s|^(.*\n#?\s*LoadModule\s+[^\n]+\n)|$1$c$lmd\n|sg; - } else { - $content =~ s|^(.*\n)#?\s*$lmd[^\n]*\n|$1$c$lmd\n|sg; - } - $lmd =~ m|LoadModule\s+(.+?)_module.*|; - print STDERR "[$what module `$1' in $CFG_SYSCONFDIR/$CFG_TARGET.conf]\n"; - } - my $amd; - foreach $amd (@amd) { - if ($content !~ m|\n#?\s*$amd|) { - $content =~ s|^(.*\n#?\s*AddModule\s+[^\n]+\n)|$1$c$amd\n|sg; - } else { - $content =~ s|^(.*\n)#?\s*$amd[^\n]*\n|$1$c$amd\n|sg; - } - } - if (@lmd or @amd) { - open(FP, ">$CFG_SYSCONFDIR/$CFG_TARGET.conf.new") || die; - print FP $content; - close(FP); - system("cp $CFG_SYSCONFDIR/$CFG_TARGET.conf $CFG_SYSCONFDIR/$CFG_TARGET.conf.bak && " . - "cp $CFG_SYSCONFDIR/$CFG_TARGET.conf.new $CFG_SYSCONFDIR/$CFG_TARGET.conf && " . - "rm $CFG_SYSCONFDIR/$CFG_TARGET.conf.new"); - } - } -} - -##EOF## -__DATA__ -## -## Makefile -- Build procedure for sample %NAME% Apache module -## Autogenerated via ``apxs -n %NAME% -g''. -## - -# the used tools -APXS=apxs -APACHECTL=apachectl - -# additional defines, includes and libraries -#DEF=-Dmy_define=my_value -#INC=-Imy/include/dir -#LIB=-Lmy/lib/dir -lmylib - -# the default target -all: mod_%NAME%.so - -# compile the shared object file -mod_%NAME%.so: mod_%NAME%.c - $(APXS) -c $(DEF) $(INC) $(LIB) mod_%NAME%.c - -# install the shared object file into Apache -install: all - $(APXS) -i -a -n '%NAME%' mod_%NAME%.so - -# cleanup -clean: - -rm -f mod_%NAME%.o mod_%NAME%.so - -# simple test -test: reload - lynx -mime_header http://localhost/%NAME% - -# install and activate shared object by reloading Apache to -# force a reload of the shared object file -reload: install restart - -# the general Apache start/restart/stop -# procedures -start: - $(APACHECTL) start -restart: - $(APACHECTL) restart -stop: - $(APACHECTL) stop - --=#=- -/* -** mod_%NAME%.c -- Apache sample %NAME% module -** [Autogenerated via ``apxs -n %NAME% -g''] -** -** To play with this sample module first compile it into a -** DSO file and install it into Apache's libexec directory -** by running: -** -** $ apxs -c -i mod_%NAME%.c -** -** Then activate it in Apache's %TARGET%.conf file for instance -** for the URL /%NAME% in as follows: -** -** # %TARGET%.conf -** LoadModule %NAME%_module libexec/mod_%NAME%.so -** -** SetHandler %NAME% -** -** -** Then after restarting Apache via -** -** $ apachectl restart -** -** you immediately can request the URL /%NAME and watch for the -** output of this module. This can be achieved for instance via: -** -** $ lynx -mime_header http://localhost/%NAME% -** -** The output should be similar to the following one: -** -** HTTP/1.1 200 OK -** Date: Tue, 31 Mar 1998 14:42:22 GMT -** Server: Apache/1.3.4 (Unix) -** Connection: close -** Content-Type: text/html -** -** The sample page from mod_%NAME%.c -*/ - -#include "httpd.h" -#include "http_config.h" -#include "http_protocol.h" -#include "ap_config.h" - -/* The sample content handler */ -static int %NAME%_handler(request_rec *r) -{ - r->content_type = "text/html"; - ap_send_http_header(r); - if (!r->header_only) - ap_rputs("The sample page from mod_%NAME%.c\n", r); - return OK; -} - -/* Dispatch list of content handlers */ -static const handler_rec %NAME%_handlers[] = { - { "%NAME%", %NAME%_handler }, - { NULL, NULL } -}; - -/* Dispatch list for API hooks */ -module MODULE_VAR_EXPORT %NAME%_module = { - STANDARD_MODULE_STUFF, - NULL, /* module initializer */ - NULL, /* create per-dir config structures */ - NULL, /* merge per-dir config structures */ - NULL, /* create per-server config structures */ - NULL, /* merge per-server config structures */ - NULL, /* table of config file commands */ - %NAME%_handlers, /* [#8] MIME-typed-dispatched handlers */ - NULL, /* [#1] URI to filename translation */ - NULL, /* [#4] validate user id from request */ - NULL, /* [#5] check if the user is ok _here_ */ - NULL, /* [#3] check access by host address */ - NULL, /* [#6] determine MIME type */ - NULL, /* [#7] pre-run fixups */ - NULL, /* [#9] log a transaction */ - NULL, /* [#2] header parser */ - NULL, /* child_init */ - NULL, /* child_exit */ - NULL /* [#0] post read-request */ -}; - diff --git a/support/checkgid.c b/support/checkgid.c deleted file mode 100644 index dacec205cc3315f1e6d43903d1147d8443ebd4bb..0000000000000000000000000000000000000000 --- a/support/checkgid.c +++ /dev/null @@ -1,145 +0,0 @@ -/* ==================================================================== - * The Apache Software License, Version 1.1 - * - * Copyright (c) 2001 The Apache Software Foundation. All rights - * reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in - * the documentation and/or other materials provided with the - * distribution. - * - * 3. The end-user documentation included with the redistribution, - * if any, must include the following acknowledgment: - * "This product includes software developed by the - * Apache Software Foundation (http://www.apache.org/)." - * Alternately, this acknowledgment may appear in the software itself, - * if and wherever such third-party acknowledgments normally appear. - * - * 4. The names "Apache" and "Apache Software Foundation" must - * not be used to endorse or promote products derived from this - * software without prior written permission. For written - * permission, please contact apache@apache.org. - * - * 5. Products derived from this software may not be called "Apache", - * nor may "Apache" appear in their name, without prior written - * permission of the Apache Software Foundation. - * - * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED - * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES - * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR - * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF - * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND - * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, - * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT - * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * ==================================================================== - * - * This software consists of voluntary contributions made by many - * individuals on behalf of the Apache Software Foundation. For more - * information on the Apache Software Foundation, please see - * . - */ - -/* - * Given one or more group identifers on the command line (e.g., - * "httpd" or "#-1"), figure out whether they'll be valid for - * the server to use at run-time. - * - * If a groupname isn't found, or we can't setgid() to it, return - * -1. If all groups are valid, return 0. - * - * This may need to be run as the superuser for the setgid() to - * succeed; running it as any other user may result in a false - * negative. - */ - -#include "ap_config.h" -#if APR_HAVE_STDIO_H -#include -#endif -#if APR_HAVE_SYS_TYPES_H -#include -#endif -#if HAVE_GRP_H -#include -#endif -#if APR_HAVE_UNISTD_H -#include -#endif - -int main(int argc, char *argv[]) -{ - int i; - int result; - gid_t gid; - struct group *grent; - struct group fake_grent; - - /* - * Assume success. :-) - */ - result = 0; - for (i = 1; i < argc; ++i) { - char *arg; - arg = argv[i]; - - /* - * If it's from a 'Group #-1' statement, get the numeric value - * and skip the group lookup stuff. - */ - if (*arg == '#') { - gid = atoi(&arg[1]); - fake_grent.gr_gid = gid; - grent = &fake_grent; - } - else { - grent = getgrnam(arg); - } - - /* - * A NULL return means no such group was found, so we're done - * with this one. - */ - if (grent == NULL) { - fprintf(stderr, "%s: group '%s' not found\n", argv[0], arg); - result = -1; - } - else { - int check; - - /* - * See if we can switch to the numeric GID we have. If so, - * all well and good; if not, well.. - */ - gid = grent->gr_gid; - check = setgid(gid); - if (check != 0) { - fprintf(stderr, "%s: invalid group '%s'\n", argv[0], arg); - perror(argv[0]); - result = -1; - } - } - } - /* - * Worst-case return value. - */ - return result; -} -/* - * Local Variables: - * mode: C - * c-file-style: "bsd" - * End: - */ diff --git a/support/config.m4 b/support/config.m4 deleted file mode 100644 index ce377479b6962a301439d5a96e2737746fc74468..0000000000000000000000000000000000000000 --- a/support/config.m4 +++ /dev/null @@ -1,45 +0,0 @@ - - -htpasswd_LTFLAGS="" -htdigest_LTFLAGS="" -rotatelogs_LTFLAGS="" -logresolve_LTFLAGS="" -ab_LTFLAGS="" - -dnl XXX Should we change the foo_LTFLAGS="-static" settings below -dnl to something like APR_ADDTO? -aaron - -AC_ARG_ENABLE(static-htpasswd,[ --enable-static-htpasswd Build a statically linked version of htpasswd],[ -if test "$enableval" = "yes" ; then - htpasswd_LTFLAGS="-static" -fi -]) -APACHE_SUBST(htpasswd_LTFLAGS) - -AC_ARG_ENABLE(static-htdigest,[ --enable-static-htdigest Build a statically linked version of htdigest],[ -if test "$enableval" = "yes" ; then - htdigest_LTFLAGS="-static" -fi -]) -APACHE_SUBST(htdigest_LTFLAGS) - -AC_ARG_ENABLE(static-rotatelogs,[ --enable-static-rotatelogs Build a statically linked version of rotatelogs],[ -if test "$enableval" = "yes" ; then - rotatelogs_LTFLAGS="-static" -fi -]) -APACHE_SUBST(rotatelogs_LTFLAGS) - -AC_ARG_ENABLE(static-logresolve,[ --enable-static-logresolve Build a statically linked version of logresolve],[ -if test "$enableval" = "yes" ; then - logresolve_LTFLAGS="-static" -fi -]) -APACHE_SUBST(logresolve_LTFLAGS) - -AC_ARG_ENABLE(static-ab,[ --enable-static-ab Build a statically linked version of ab],[ -if test "$enableval" = "yes" ; then - ab_LTFLAGS="-static" -fi -]) -APACHE_SUBST(ab_LTFLAGS) diff --git a/support/dbmmanage.in b/support/dbmmanage.in deleted file mode 100644 index 8c75637e1dd4c264b94f80164ecab2faa1d5928a..0000000000000000000000000000000000000000 --- a/support/dbmmanage.in +++ /dev/null @@ -1,350 +0,0 @@ -#!@perlbin@ -# ==================================================================== -# The Apache Software License, Version 1.1 -# -# Copyright (c) 2000-2001 The Apache Software Foundation. All rights -# reserved. -# -# Redistribution and use in source and binary forms, with or without -# modification, are permitted provided that the following conditions -# are met: -# -# 1. Redistributions of source code must retain the above copyright -# notice, this list of conditions and the following disclaimer. -# -# 2. Redistributions in binary form must reproduce the above copyright -# notice, this list of conditions and the following disclaimer in -# the documentation and/or other materials provided with the -# distribution. -# -# 3. The end-user documentation included with the redistribution, -# if any, must include the following acknowledgment: -# "This product includes software developed by the -# Apache Software Foundation (http://www.apache.org/)." -# Alternately, this acknowledgment may appear in the software itself, -# if and wherever such third-party acknowledgments normally appear. -# -# 4. The names "Apache" and "Apache Software Foundation" must -# not be used to endorse or promote products derived from this -# software without prior written permission. For written -# permission, please contact apache@apache.org. -# -# 5. Products derived from this software may not be called "Apache", -# nor may "Apache" appear in their name, without prior written -# permission of the Apache Software Foundation. -# -# THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED -# WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES -# OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE -# DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR -# ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF -# USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND -# ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, -# OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT -# OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF -# SUCH DAMAGE. -# ==================================================================== -# -# This software consists of voluntary contributions made by many -# individuals on behalf of the Apache Software Foundation. For more -# information on the Apache Software Foundation, please see -# . -# - -#for more functionality see the HTTPD::UserAdmin module: -# http://www.perl.com/CPAN/modules/by-module/HTTPD/HTTPD-Tools-x.xx.tar.gz -# -# usage: dbmmanage - -package dbmmanage; -# -ldb -lndbm -lgdbm -lsdbm -BEGIN { @AnyDBM_File::ISA = qw(DB_File NDBM_File GDBM_File SDBM_File) } -use strict; -use Fcntl; -use AnyDBM_File (); - -sub usage { - my $cmds = join "|", sort keys %dbmc::; - die <$command(); -untie %DB; - - -my $x; -sub genseed { - my $psf; - if ($not_unix) { - srand (time ^ $$ or time ^ ($$ + ($$ << 15))); - } - else { - for (qw(-xlwwa -le)) { - `ps $_ 2>/dev/null`; - $psf = $_, last unless $?; - } - srand (time ^ $$ ^ unpack("%L*", `ps $psf | gzip -f`)); - } - @range = (qw(. /), '0'..'9','a'..'z','A'..'Z'); - $x = int scalar @range; -} - -sub randchar { - join '', map $range[rand $x], 1..shift||1; -} - -sub saltpw_crypt { - genseed() unless @range; - return $newstyle_salt ? - join '', "_", randchar, "a..", randchar(4) : - randchar(2); -} - -sub cryptpw_crypt { - my ($pw, $salt) = @_; - $salt = saltpw_crypt unless $salt; - crypt $pw, $salt; -} - -sub saltpw_md5 { - genseed() unless @range; - randchar(8); -} - -sub cryptpw_md5 { - my($pw, $salt) = @_; - $salt = saltpw_md5 unless $salt; - Crypt::PasswdMD5::apache_md5_crypt($pw, $salt); -} - -sub cryptpw_sha1 { - my($pw, $salt) = @_; - '{SHA}' . Digest::SHA1::sha1_base64($pw) . "="; -} - -sub cryptpw { - if ($crypt_method eq "md5") { - return cryptpw_md5(@_); - } elsif ($crypt_method eq "sha1") { - return cryptpw_sha1(@_); - } elsif ($crypt_method eq "crypt") { - return cryptpw_crypt(@_); - } - @_[0]; # otherwise return plaintext -} - -sub getpass { - my $prompt = shift || "Enter password:"; - - unless($not_unix) { - open STDIN, "/dev/tty" or warn "couldn't open /dev/tty $!\n"; - system "stty -echo;"; - } - - my($c,$pwd); - print STDERR $prompt; - while (($c = getc(STDIN)) ne '' and $c ne "\n" and $c ne "\r") { - $pwd .= $c; - } - - system "stty echo" unless $not_unix; - print STDERR "\n"; - die "Can't use empty password!\n" unless length $pwd; - return $pwd; -} - -sub dbmc::update { - die "Sorry, user `$key' doesn't exist!\n" unless $DB{$key}; - $crypted_pwd = (split /:/, $DB{$key}, 3)[0] if $crypted_pwd eq '.'; - $groups = (split /:/, $DB{$key}, 3)[1] if !$groups || $groups eq '.'; - $comment = (split /:/, $DB{$key}, 3)[2] if !$comment || $comment eq '.'; - if (!$crypted_pwd || $crypted_pwd eq '-') { - dbmc->adduser; - } - else { - dbmc->add; - } -} - -sub dbmc::add { - die "Can't use empty password!\n" unless $crypted_pwd; - unless($is_update) { - die "Sorry, user `$key' already exists!\n" if $DB{$key}; - } - $groups = '' if $groups eq '-'; - $comment = '' if $comment eq '-'; - $groups .= ":" . $comment if $comment; - $crypted_pwd .= ":" . $groups if $groups; - $DB{$key} = $crypted_pwd; - my $action = $is_update ? "updated" : "added"; - print "User $key $action with password encrypted to $DB{$key} using $crypt_method\n"; -} - -sub dbmc::adduser { - my $value = getpass "New password:"; - die "They don't match, sorry.\n" unless getpass("Re-type new password:") eq $value; - $crypted_pwd = cryptpw $value; - dbmc->add; -} - -sub dbmc::delete { - die "Sorry, user `$key' doesn't exist!\n" unless $DB{$key}; - delete $DB{$key}, print "`$key' deleted\n"; -} - -sub dbmc::view { - print $key ? "$key:$DB{$key}\n" : map { "$_:$DB{$_}\n" if $DB{$_} } keys %DB; -} - -sub dbmc::check { - die "Sorry, user `$key' doesn't exist!\n" unless $DB{$key}; - my $chkpass = (split /:/, $DB{$key}, 3)[0]; - my $testpass = getpass(); - if (substr($chkpass, 0, 6) eq '$apr1$') { - need_md5_crypt; - $crypt_method = "md5"; - } elsif (substr($chkpass, 0, 5) eq '{SHA}') { - need_sha1_crypt; - $crypt_method = "sha1"; - } elsif (length($chkpass) == 13 && $chkpass ne $testpass) { - $crypt_method = "crypt"; - } else { - $crypt_method = "plain"; - } - print $crypt_method . (cryptpw($testpass, $chkpass) eq $chkpass - ? " password ok\n" : " password mismatch\n"); -} - -sub dbmc::import { - while(defined($_ = ) and chomp) { - ($key,$crypted_pwd,$groups,$comment) = split /:/, $_, 4; - dbmc->add; - } -} - diff --git a/support/envvars-std.in b/support/envvars-std.in deleted file mode 100644 index 37a860627830cf16054094d53f84d96dc7266430..0000000000000000000000000000000000000000 --- a/support/envvars-std.in +++ /dev/null @@ -1,10 +0,0 @@ -# envvars-std - default environment variables for apachectl -# -# This file is generated from envvars-std.in -# -# the following lines are automatically uncommented for -# binary builds -#binbuild @SHLIBPATH_VAR@='@prefix@/lib/:$@SHLIBPATH_VAR@' -#binbuild export @SHLIBPATH_VAR@ -# -@OS_SPECIFIC_VARS@ diff --git a/support/htdbm.c b/support/htdbm.c deleted file mode 100644 index b9a2f47eb7e813a8d11dfc285e9b4041e64fbf3b..0000000000000000000000000000000000000000 --- a/support/htdbm.c +++ /dev/null @@ -1,627 +0,0 @@ -/* ==================================================================== - * The Apache Software License, Version 1.1 - * - * Copyright (c) 2000-2001 The Apache Software Foundation. All rights - * reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in - * the documentation and/or other materials provided with the - * distribution. - * - * 3. The end-user documentation included with the redistribution, - * if any, must include the following acknowledgment: - * "This product includes software developed by the - * Apache Software Foundation (http://www.apache.org/)." - * Alternately, this acknowledgment may appear in the software itself, - * if and wherever such third-party acknowledgments normally appear. - * - * 4. The names "Apache" and "Apache Software Foundation" must - * not be used to endorse or promote products derived from this - * software without prior written permission. For written - * permission, please contact apache@apache.org. - * - * 5. Products derived from this software may not be called "Apache", - * nor may "Apache" appear in their name, without prior written - * permission of the Apache Software Foundation. - * - * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED - * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES - * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR - * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF - * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND - * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, - * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT - * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * ==================================================================== - * - * This software consists of voluntary contributions made by many - * individuals on behalf of the Apache Software Foundation. For more - * information on the Apache Software Foundation, please see - * . - * - * Portions of this software are based upon public domain software - * originally written at the National Center for Supercomputing Applications, - * University of Illinois, Urbana-Champaign. - */ - -/* - * htdbm.c: simple program for manipulating DBM - * password databases for the Apache HTTP server - * - * Contributed by Mladen Turk - * 12 Oct 2001 - */ - -#include "apr.h" -#include "apr_lib.h" -#include "apr_strings.h" -#include "apr_file_io.h" -#include "apr_file_info.h" -#include "apr_pools.h" -#include "apr_signal.h" -#include "apr_md5.h" -#include "apr_sha1.h" -#include "apr_dbm.h" - -#if APR_HAVE_STDLIB_H -#include -#endif -#if APR_HAVE_STRING_H -#include -#endif -#if APR_HAVE_STRINGS_H -#include -#endif - -#if APR_CHARSET_EBCDIC -#include "apr_xlate.h" -#endif /*APR_CHARSET_EBCDIC*/ - -#if APR_HAVE_CRYPT_H -#include -#endif - - -#if !APR_CHARSET_EBCDIC -#define LF 10 -#define CR 13 -#else /*APR_CHARSET_EBCDIC*/ -#define LF '\n' -#define CR '\r' -#endif /*APR_CHARSET_EBCDIC*/ - -#define MAX_STRING_LEN 256 -#define ALG_PLAIN 0 -#define ALG_APMD5 1 -#define ALG_APSHA 2 - -#if APR_HAVE_CRYPT_H -#define ALG_CRYPT 3 -#endif - - -#define ERR_FILEPERM 1 -#define ERR_SYNTAX 2 -#define ERR_PWMISMATCH 3 -#define ERR_INTERRUPTED 4 -#define ERR_OVERFLOW 5 -#define ERR_BADUSER 6 -#define ERR_EMPTY 7 - - -typedef struct apu_htdbm_t apu_htdbm_t; - -struct apu_htdbm_t { - apr_dbm_t *dbm; - apr_pool_t *pool; -#if APR_CHARSET_EBCDIC - apr_xlate_t *to_ascii; -#endif - char *filename; - char *username; - char *userpass; - char *comment; - int create; - int rdonly; - int alg; -}; - - -#define APU_HTDBM_DECLARE(x) static x -#define APU_HTDBM_STANDALONE 1 - -#define APU_HTDBM_MAKE 0 -#define APU_HTDBM_DELETE 1 -#define APU_HTDBM_VERIFY 2 -#define APU_HTDBM_LIST 3 -#define APU_HTDBM_NOFILE 4 -#define APU_HTDBM_STDIN 5 - -APU_HTDBM_DECLARE(void) apu_htdbm_terminate(apu_htdbm_t *htdbm) -{ - - if (htdbm->dbm) - apr_dbm_close(htdbm->dbm); - htdbm->dbm = NULL; -} - -#if APU_HTDBM_STANDALONE - -static apu_htdbm_t *h; - -APU_HTDBM_DECLARE(void) apu_htdbm_interrupted(void) -{ - apu_htdbm_terminate(h); - fprintf(stderr, "htdbm Interrupted !\n"); - exit(ERR_INTERRUPTED); -} -#endif - -APU_HTDBM_DECLARE(apr_status_t) apu_htdbm_init(apr_pool_t **pool, apu_htdbm_t **hdbm) -{ - -#if APR_CHARSET_EBCDIC - apr_status_t rv; -#endif - -#if APU_HTDBM_STANDALONE - apr_initialize(); - atexit(apr_terminate); - apr_pool_create( pool, NULL); - apr_signal(SIGINT, (void (*)(int)) apu_htdbm_interrupted); - -#endif - - (*hdbm) = (apu_htdbm_t *)apr_pcalloc(*pool, sizeof(apu_htdbm_t)); - (*hdbm)->pool = *pool; - -#if APR_CHARSET_EBCDIC - rv = apr_xlate_open(to_ascii, "ISO8859-1", APR_DEFAULT_CHARSET, (*hdbm)->pool); - if (rv) { - fprintf(stderr, "apr_xlate_open(to ASCII)->%d\n", rv); - return APR_EGENERAL; - } - rv = apr_SHA1InitEBCDIC((*hdbm)->to_ascii); - if (rv) { - fprintf(stderr, "apr_SHA1InitEBCDIC()->%d\n", rv); - return APR_EGENERAL; - } - rv = apr_MD5InitEBCDIC((*hdbm)->to_ascii); - if (rv) { - fprintf(stderr, "apr_MD5InitEBCDIC()->%d\n", rv); - return APR_EGENERAL; - } -#endif /*APR_CHARSET_EBCDIC*/ - - /* Set MD5 as default */ - (*hdbm)->alg = ALG_APMD5; - return APR_SUCCESS; -} - -APU_HTDBM_DECLARE(apr_status_t) apu_htdbm_open(apu_htdbm_t *htdbm) -{ - if (htdbm->create) - return apr_dbm_open(&htdbm->dbm, htdbm->filename, APR_DBM_RWCREATE, - APR_OS_DEFAULT, htdbm->pool); - else - return apr_dbm_open(&htdbm->dbm, htdbm->filename, - htdbm->rdonly ? APR_DBM_READONLY : APR_DBM_READWRITE, - APR_OS_DEFAULT, htdbm->pool); -} - -APU_HTDBM_DECLARE(char *) ap_getword(apr_pool_t *atrans, char **line, char stop) -{ - char *pos = strrchr(*line, stop); - char *res; - - if (!pos) { - res = apr_pstrdup(atrans, *line); - *line += strlen(*line); - return res; - } - - res = apr_pstrndup(atrans, *line, pos - *line); - - while (*pos == stop) - ++pos; - *line = pos; - return res; -} - -APU_HTDBM_DECLARE(apr_status_t) apu_htdbm_save(apu_htdbm_t *htdbm, int *changed) -{ - apr_datum_t key, val; - - if (!htdbm->username) - return APR_SUCCESS; - - key.dptr = htdbm->username; - key.dsize = strlen(htdbm->username); - if (apr_dbm_exists(htdbm->dbm, key)) - *changed = 1; - - val.dsize = strlen(htdbm->userpass); - if (!htdbm->comment) - val.dptr = htdbm->userpass; - else { - val.dptr = apr_pstrcat(htdbm->pool, htdbm->userpass, ";", - htdbm->comment, NULL); - val.dsize += (strlen(htdbm->comment) + 1); - } - return apr_dbm_store(htdbm->dbm, key, val); -} - -APU_HTDBM_DECLARE(apr_status_t) apu_htdbm_del(apu_htdbm_t *htdbm) -{ - apr_datum_t key; - - key.dptr = htdbm->username; - key.dsize = strlen(htdbm->username); - if (!apr_dbm_exists(htdbm->dbm, key)) - return APR_ENOENT; - - return apr_dbm_delete(htdbm->dbm, key); -} - -APU_HTDBM_DECLARE(apr_status_t) apu_htdbm_verify(apu_htdbm_t *htdbm) -{ - apr_datum_t key, val; - char pwd[MAX_STRING_LEN] = {0}; - char *rec, *cmnt; - - key.dptr = htdbm->username; - key.dsize = strlen(htdbm->username); - if (!apr_dbm_exists(htdbm->dbm, key)) - return APR_ENOENT; - if (apr_dbm_fetch(htdbm->dbm, key, &val) != APR_SUCCESS) - return APR_ENOENT; - rec = apr_pstrndup(htdbm->pool, val.dptr, val.dsize); - cmnt = strchr(rec, ';'); - if (cmnt) - strncpy(pwd, rec, cmnt - rec); - else - strcpy(pwd, rec); - return apr_password_validate(htdbm->userpass, pwd); -} - -APU_HTDBM_DECLARE(apr_status_t) apu_htdbm_list(apu_htdbm_t *htdbm) -{ - apr_status_t rv; - apr_datum_t key, val; - char *rec, *cmnt; - char kb[MAX_STRING_LEN]; - int i = 0; - - rv = apr_dbm_firstkey(htdbm->dbm, &key); - if (rv != APR_SUCCESS) { - fprintf(stderr, "Empty database -- %s\n", htdbm->filename); - return APR_ENOENT; - } - rec = apr_pcalloc(htdbm->pool, HUGE_STRING_LEN); - - fprintf(stderr, "Dumping records from database -- %s\n", htdbm->filename); - fprintf(stderr, " %-32sComment\n", "Username"); - while (key.dptr != NULL) { - rv = apr_dbm_fetch(htdbm->dbm, key, &val); - if (rv != APR_SUCCESS) { - fprintf(stderr, "Failed getting data from %s\n", htdbm->filename); - return APR_EGENERAL; - } - strncpy(kb, key.dptr, key.dsize); - kb[key.dsize] = '\0'; - fprintf(stderr, " %-32s", kb); - strncpy(rec, val.dptr, val.dsize); - rec[val.dsize] = '\0'; - cmnt = strchr(rec, ';'); - if (cmnt) - fprintf(stderr, cmnt + 1); - fprintf(stderr, "\n"); - rv = apr_dbm_nextkey(htdbm->dbm, &key); - if (rv != APR_SUCCESS) - fprintf(stderr, "Failed getting NextKey\n"); - ++i; - } - - fprintf(stderr, "Total #records : %d\n", i); - return APR_SUCCESS; -} - -static void to64(char *s, unsigned long v, int n) -{ - static unsigned char itoa64[] = /* 0 ... 63 => ASCII - 64 */ - "./0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz"; - - while (--n >= 0) { - *s++ = itoa64[v&0x3f]; - v >>= 6; - } -} - -APU_HTDBM_DECLARE(apr_status_t) apu_htdbm_make(apu_htdbm_t *htdbm) -{ - char cpw[MAX_STRING_LEN]; - char salt[9]; - - switch (htdbm->alg) { - case ALG_APSHA: - /* XXX cpw >= 28 + strlen(sha1) chars - fixed len SHA */ - apr_sha1_base64(htdbm->userpass,strlen(htdbm->userpass),cpw); - break; - - case ALG_APMD5: - (void) srand((int) time((time_t *) NULL)); - to64(&salt[0], rand(), 8); - salt[8] = '\0'; - apr_md5_encode((const char *)htdbm->userpass, (const char *)salt, - cpw, sizeof(cpw)); - break; - case ALG_PLAIN: - /* XXX this len limitation is not in sync with any HTTPd len. */ - apr_cpystrn(cpw,htdbm->userpass,sizeof(cpw)); - break; -#if APR_HAVE_CRYPT_H - case ALG_CRYPT: - (void) srand((int) time((time_t *) NULL)); - to64(&salt[0], rand(), 8); - salt[8] = '\0'; - apr_cpystrn(cpw, (char *)crypt(htdbm->userpass, salt), sizeof(cpw) - 1); - fprintf(stderr, "CRYPT is now depriciated, use MD5 instead !\n"); -#endif - default: - break; - } - htdbm->userpass = apr_pstrdup(htdbm->pool, cpw); - return APR_SUCCESS; -} - -APU_HTDBM_DECLARE(apr_status_t) apu_htdbm_valid_username(apu_htdbm_t *htdbm) -{ - if (!htdbm->username || (strlen(htdbm->username) > 64) || (strlen(htdbm->username) < 1)) { - fprintf(stderr, "Invalid username length\n"); - return APR_EINVAL; - } - if (strchr(htdbm->username, ':')) { - fprintf(stderr, "Username contains invalid characters\n"); - return APR_EINVAL; - } - return APR_SUCCESS; -} - -static void htdbm_usage(void) -{ - -#if APR_HAVE_CRYPT_H -#define CRYPT_OPTION "d" -#else -#define CRYPT_OPTION "" -#endif - fprintf(stderr, "htdbm -- program for manipulating DBM password databases.\n\n"); - fprintf(stderr, "Usage: htdbm [-cm"CRYPT_OPTION"pstvx] database username\n"); - fprintf(stderr, " -b[cm"CRYPT_OPTION"ptsv] database username password\n"); - fprintf(stderr, " -n[m"CRYPT_OPTION"pst] username\n"); - fprintf(stderr, " -nb[m"CRYPT_OPTION"pst] username password\n"); - fprintf(stderr, " -v[m"CRYPT_OPTION"ps] database username\n"); - fprintf(stderr, " -vb[m"CRYPT_OPTION"ps] database username password\n"); - fprintf(stderr, " -x[m"CRYPT_OPTION"ps] database username\n"); - fprintf(stderr, " -l database\n"); - fprintf(stderr, "Options:\n"); - fprintf(stderr, " -b Use the password from the command line rather" - "than prompting for it.\n"); - fprintf(stderr, " -c Create a new database.\n"); - fprintf(stderr, " -n Don't update database; display results on stdout.\n"); - fprintf(stderr, " -m Force MD5 encryption of the password (default).\n"); -#if APR_HAVE_CRYPT_H - fprintf(stderr, " -d Force CRYPT encryption of the password (now depriciated).\n"); -#endif - fprintf(stderr, " -p Do not encrypt the password (plaintext).\n"); - fprintf(stderr, " -s Force SHA encryption of the password.\n"); - fprintf(stderr, " -l Display usernames from database on stdout.\n"); - fprintf(stderr, " -t The last param is username comment.\n"); - fprintf(stderr, " -v Verify the username/password.\n"); - fprintf(stderr, " -x Remove the username record from database.\n"); - exit(ERR_SYNTAX); - -} - - -int main(int argc, const char *argv[]) -{ - apr_pool_t *pool; - apr_status_t rv; - apr_size_t l; - char pwi[MAX_STRING_LEN]; - char pwc[MAX_STRING_LEN]; - char errbuf[MAX_STRING_LEN]; - const char *arg; - int need_file = 1; - int need_user = 1; - int need_pwd = 1; - int need_cmnt = 0; - int pwd_supplied = 0; - int changed; - int cmd = APU_HTDBM_MAKE; - int i; - int args_left = 2; - - if ((rv = apu_htdbm_init(&pool, &h)) != APR_SUCCESS) { - fprintf(stderr, "Unable to initialize htdbm terminating!\n"); - apr_strerror(rv, errbuf, sizeof(errbuf)); - exit(1); - } - /* - * Preliminary check to make sure they provided at least - * three arguments, we'll do better argument checking as - * we parse the command line. - */ - if (argc < 3) - htdbm_usage(); - /* - * Go through the argument list and pick out any options. They - * have to precede any other arguments. - */ - for (i = 1; i < argc; i++) { - arg = argv[i]; - if (*arg != '-') - break; - - while (*++arg != '\0') { - switch (*arg) { - case 'b': - pwd_supplied = 1; - need_pwd = 0; - args_left++; - break; - case 'c': - h->create = 1; - break; - case 'n': - need_file = 0; - cmd = APU_HTDBM_NOFILE; - args_left--; - break; - case 'l': - need_pwd = 0; - need_user = 0; - cmd = APU_HTDBM_LIST; - h->rdonly = 1; - args_left--; - break; - case 't': - need_cmnt = 1; - args_left++; - break; - case 'v': - h->rdonly = 1; - cmd = APU_HTDBM_VERIFY; - break; - case 'x': - need_pwd = 0; - cmd = APU_HTDBM_DELETE; - break; - case 'm': - h->alg = ALG_APMD5; - break; - case 'p': - h->alg = ALG_PLAIN; - break; - case 's': - h->alg = ALG_APSHA; - break; -#if APR_HAVE_CRYPT_H - case 'd': - h->alg = ALG_CRYPT; - break; -#endif - default: - htdbm_usage(); - break; - } - } - } - /* - * Make sure we still have exactly the right number of arguments left - * (the filename, the username, and possibly the password if -b was - * specified). - */ - if ((argc - i) != args_left) - htdbm_usage(); - - if (!need_file) - i--; - else { - h->filename = apr_pstrdup(h->pool, argv[i]); - if ((rv = apu_htdbm_open(h)) != APR_SUCCESS) { - fprintf(stderr, "Error oppening database %s\n", argv[i]); - apr_strerror(rv, errbuf, sizeof(errbuf)); - exit(ERR_FILEPERM); - } - } - if (need_user) { - h->username = apr_pstrdup(pool, argv[i+1]); - if (apu_htdbm_valid_username(h) != APR_SUCCESS) - exit(ERR_BADUSER); - } - if (pwd_supplied) - h->userpass = apr_pstrdup(pool, argv[i+2]); - - if (need_pwd) { - l = sizeof(pwc); - if (apr_password_get("Enter password : ", pwi, &l) != APR_SUCCESS) { - fprintf(stderr, "Password too long\n"); - exit(ERR_OVERFLOW); - } - l = sizeof(pwc); - if (apr_password_get("Re-type password : ", pwc, &l) != APR_SUCCESS) { - fprintf(stderr, "Password too long\n"); - exit(ERR_OVERFLOW); - } - if (strcmp(pwi, pwc) != 0) { - fprintf(stderr, "Password verification error\n"); - exit(ERR_PWMISMATCH); - } - - h->userpass = apr_pstrdup(pool, pwi); - } - if (need_cmnt && pwd_supplied) - h->comment = apr_pstrdup(pool, argv[i+3]); - else if (need_cmnt) - h->comment = apr_pstrdup(pool, argv[i+2]); - - switch (cmd) { - case APU_HTDBM_VERIFY: - if ((rv = apu_htdbm_verify(h)) != APR_SUCCESS) { - if(rv == APR_ENOENT) { - fprintf(stderr, "The user '%s' cold not be found in database\n", h->username); - exit(ERR_BADUSER); - } - else { - fprintf(stderr, "Password mismatch for user '%s'\n", h->username); - exit(ERR_PWMISMATCH); - } - } - else - fprintf(stderr, "Password validated for user '%s'\n", h->username); - break; - case APU_HTDBM_DELETE: - if (apu_htdbm_del(h) != APR_SUCCESS) { - fprintf(stderr, "Cannot find user '%s' in database\n", h->username); - exit(ERR_BADUSER); - } - h->username = NULL; - changed = 1; - break; - case APU_HTDBM_LIST: - apu_htdbm_list(h); - break; - default: - apu_htdbm_make(h); - break; - - } - if (need_file && !h->rdonly) { - if ((rv = apu_htdbm_save(h, &changed)) != APR_SUCCESS) { - apr_strerror(rv, errbuf, sizeof(errbuf)); - exit(ERR_FILEPERM); - } - fprintf(stdout, "Database %s %s.\n", h->filename, - h->create ? "created" : (changed ? "modified" : "updated")); - } - if (cmd == APU_HTDBM_NOFILE) - fprintf(stderr, "%s:%s\n", h->username, h->userpass); - apu_htdbm_terminate(h); - apr_terminate(); - - return 0; /* Supress compiler warning. */ -} diff --git a/support/htdbm.dsp b/support/htdbm.dsp deleted file mode 100644 index 613c52fd02a0720c8e21f3ec87a5b7a6144fc86c..0000000000000000000000000000000000000000 --- a/support/htdbm.dsp +++ /dev/null @@ -1,123 +0,0 @@ -# Microsoft Developer Studio Project File - Name="htdbm" - Package Owner=<4> -# Microsoft Developer Studio Generated Build File, Format Version 6.00 -# ** DO NOT EDIT ** - -# TARGTYPE "Win32 (x86) Console Application" 0x0103 - -CFG=htdbm - Win32 Debug -!MESSAGE This is not a valid makefile. To build this project using NMAKE, -!MESSAGE use the Export Makefile command and run -!MESSAGE -!MESSAGE NMAKE /f "htdbm.mak". -!MESSAGE -!MESSAGE You can specify a configuration when running NMAKE -!MESSAGE by defining the macro CFG on the command line. For example: -!MESSAGE -!MESSAGE NMAKE /f "htdbm.mak" CFG="htdbm - Win32 Debug" -!MESSAGE -!MESSAGE Possible choices for configuration are: -!MESSAGE -!MESSAGE "htdbm - Win32 Release" (based on "Win32 (x86) Console Application") -!MESSAGE "htdbm - Win32 Debug" (based on "Win32 (x86) Console Application") -!MESSAGE - -# Begin Project -# PROP AllowPerConfigDependencies 0 -# PROP Scc_ProjName "" -# PROP Scc_LocalPath "" -CPP=cl.exe -RSC=rc.exe - -!IF "$(CFG)" == "htdbm - Win32 Release" - -# PROP BASE Use_MFC 0 -# PROP BASE Use_Debug_Libraries 0 -# PROP BASE Output_Dir "Release" -# PROP BASE Intermediate_Dir "Release" -# PROP BASE Target_Dir "" -# PROP Use_MFC 0 -# PROP Use_Debug_Libraries 0 -# PROP Output_Dir "Release" -# PROP Intermediate_Dir "Release" -# PROP Ignore_Export_Lib 0 -# PROP Target_Dir "" -# ADD BASE CPP /nologo /MD /W3 /O2 /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /D "APR_DECLARE_STATIC" /D "APU_DECLARE_STATIC" /FD /c -# ADD CPP /nologo /MD /W3 /O2 /I "../srclib/apr/include" /I "../srclib/apr-util/include" /D "NDEBUG" /D "WIN32" /D "_CONSOLE" /D "APR_DECLARE_STATIC" /D "APU_DECLARE_STATIC" /Fd"Release/htdbm" /FD /c -# ADD BASE RSC /l 0x409 /d "NDEBUG" -# ADD RSC /l 0x409 /d "NDEBUG" -BSC32=bscmake.exe -# ADD BASE BSC32 /nologo -# ADD BSC32 /nologo -LINK32=link.exe -# ADD BASE LINK32 kernel32.lib advapi32.lib wsock32.lib ws2_32.lib /nologo /subsystem:console /map /machine:I386 -# ADD LINK32 kernel32.lib advapi32.lib wsock32.lib ws2_32.lib /nologo /subsystem:console /map /machine:I386 - -!ELSEIF "$(CFG)" == "htdbm - Win32 Debug" - -# PROP BASE Use_MFC 0 -# PROP BASE Use_Debug_Libraries 1 -# PROP BASE Output_Dir "Debug" -# PROP BASE Intermediate_Dir "Debug" -# PROP BASE Target_Dir "" -# PROP Use_MFC 0 -# PROP Use_Debug_Libraries 1 -# PROP Output_Dir "Debug" -# PROP Intermediate_Dir "Debug" -# PROP Ignore_Export_Lib 0 -# PROP Target_Dir "" -# ADD BASE CPP /nologo /MDd /W3 /GX /Zi /Od /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /D "APR_DECLARE_STATIC" /D "APU_DECLARE_STATIC" /FD /c -# ADD CPP /nologo /MDd /W3 /GX /Zi /Od /I "../srclib/apr/include" /I "../srclib/apr-util/include" /D "_DEBUG" /D "WIN32" /D "_CONSOLE" /D "APR_DECLARE_STATIC" /D "APU_DECLARE_STATIC" /Fd"Debug/htdbm" /FD /c -# ADD BASE RSC /l 0x409 /d "_DEBUG" -# ADD RSC /l 0x409 /d "_DEBUG" -BSC32=bscmake.exe -# ADD BASE BSC32 /nologo -# ADD BSC32 /nologo -LINK32=link.exe -# ADD BASE LINK32 kernel32.lib advapi32.lib wsock32.lib ws2_32.lib /nologo /subsystem:console /incremental:no /map /debug /machine:I386 -# ADD LINK32 kernel32.lib advapi32.lib wsock32.lib ws2_32.lib /nologo /subsystem:console /incremental:no /map /debug /machine:I386 - -!ENDIF - -# Begin Target - -# Name "htdbm - Win32 Release" -# Name "htdbm - Win32 Debug" -# Begin Source File - -SOURCE=.\htdbm.c -# End Source File -# Begin Source File - -SOURCE=.\htdbm.rc -# End Source File -# Begin Source File - -SOURCE=..\build\win32\win32ver.awk - -!IF "$(CFG)" == "htdbm - Win32 Release" - -# PROP Ignore_Default_Tool 1 -# Begin Custom Build - Creating Version Resource -InputPath=..\build\win32\win32ver.awk - -".\htdbm.rc" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)" - awk -f ../build/win32/win32ver.awk htdbm "htdbm Utility" ../include/ap_release.h > .\htdbm.rc - -# End Custom Build - -!ELSEIF "$(CFG)" == "htdbm - Win32 Debug" - -# PROP Ignore_Default_Tool 1 -# Begin Custom Build - Creating Version Resource -InputPath=..\build\win32\win32ver.awk - -".\htdbm.rc" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)" - awk -f ../build/win32/win32ver.awk htdbm "htdbm Utility" ../include/ap_release.h > .\htdbm.rc - -# End Custom Build - -!ENDIF - -# End Source File -# End Target -# End Project diff --git a/support/htdigest.c b/support/htdigest.c deleted file mode 100644 index d1fc41800fd35810ed06568de301477f1b4b5e6b..0000000000000000000000000000000000000000 --- a/support/htdigest.c +++ /dev/null @@ -1,271 +0,0 @@ -/* ==================================================================== - * Copyright (c) 1995-1999 The Apache Group. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in - * the documentation and/or other materials provided with the - * distribution. - * - * 3. All advertising materials mentioning features or use of this - * software must display the following acknowledgment: - * "This product includes software developed by the Apache Group - * for use in the Apache HTTP server project (http://www.apache.org/)." - * - * 4. The names "Apache Server" and "Apache Group" must not be used to - * endorse or promote products derived from this software without - * prior written permission. For written permission, please contact - * apache@apache.org. - * - * 5. Products derived from this software may not be called "Apache" - * nor may "Apache" appear in their names without prior written - * permission of the Apache Group. - * - * 6. Redistributions of any form whatsoever must retain the following - * acknowledgment: - * "This product includes software developed by the Apache Group - * for use in the Apache HTTP server project (http://www.apache.org/)." - * - * THIS SOFTWARE IS PROVIDED BY THE APACHE GROUP ``AS IS'' AND ANY - * EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR - * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE APACHE GROUP OR - * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT - * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, - * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED - * OF THE POSSIBILITY OF SUCH DAMAGE. - * ==================================================================== - * - * This software consists of voluntary contributions made by many - * individuals on behalf of the Apache Group and was originally based - * on public domain software written at the National Center for - * Supercomputing Applications, University of Illinois, Urbana-Champaign. - * For more information on the Apache Group and the Apache HTTP server - * project, please see . - * - */ -/****************************************************************************** - ****************************************************************************** - * NOTE! This program is not safe as a setuid executable! Do not make it - * setuid! - ****************************************************************************** - *****************************************************************************/ -/* - * htdigest.c: simple program for manipulating digest passwd file for Apache - * - * by Alexei Kosut, based on htpasswd.c, by Rob McCool - */ - -#include "ap_config.h" -#include -#include "ap.h" -#include "ap_md5.h" -#if defined(MPE) || defined(QNX) || defined(WIN32) || defined(__TANDEM) -#include -#else -#include -#endif - -#ifdef WIN32 -#include -#define unlink _unlink -#endif - -#ifdef CHARSET_EBCDIC -#define LF '\n' -#define CR '\r' -#else -#define LF 10 -#define CR 13 -#endif /* CHARSET_EBCDIC */ - -#define MAX_STRING_LEN 256 - -char *tn; - -static void getword(char *word, char *line, char stop) -{ - int x = 0, y; - - for (x = 0; ((line[x]) && (line[x] != stop)); x++) - word[x] = line[x]; - - word[x] = '\0'; - if (line[x]) - ++x; - y = 0; - - while ((line[y++] = line[x++])); -} - -static int getline(char *s, int n, FILE *f) -{ - register int i = 0; - - while (1) { - s[i] = (char) fgetc(f); - - if (s[i] == CR) - s[i] = fgetc(f); - - if ((s[i] == 0x4) || (s[i] == LF) || (i == (n - 1))) { - s[i] = '\0'; - return (feof(f) ? 1 : 0); - } - ++i; - } -} - -static void putline(FILE *f, char *l) -{ - int x; - - for (x = 0; l[x]; x++) - fputc(l[x], f); - fputc('\n', f); -} - - -static void add_password(char *user, char *realm, FILE *f) -{ - char *pw; - AP_MD5_CTX context; - unsigned char digest[16]; - char string[MAX_STRING_LEN]; - char pwin[MAX_STRING_LEN]; - char pwv[MAX_STRING_LEN]; - unsigned int i; - - if (ap_getpass("New password: ", pwin, sizeof(pwin)) != 0) { - fprintf(stderr, "password too long"); - exit(5); - } - ap_getpass("Re-type new password: ", pwv, sizeof(pwv)); - if (strcmp(pwin, pwv) != 0) { - fprintf(stderr, "They don't match, sorry.\n"); - if (tn) { - unlink(tn); - } - exit(1); - } - pw = pwin; - fprintf(f, "%s:%s:", user, realm); - - /* Do MD5 stuff */ - sprintf(string, "%s:%s:%s", user, realm, pw); - - ap_MD5Init(&context); - ap_MD5Update(&context, (unsigned char *) string, strlen(string)); - ap_MD5Final(digest, &context); - - for (i = 0; i < 16; i++) - fprintf(f, "%02x", digest[i]); - - fprintf(f, "\n"); -} - -static void usage(void) -{ - fprintf(stderr, "Usage: htdigest [-c] passwordfile realm username\n"); - fprintf(stderr, "The -c flag creates a new file.\n"); - exit(1); -} - -static void interrupted(void) -{ - fprintf(stderr, "Interrupted.\n"); - if (tn) - unlink(tn); - exit(1); -} - -int main(int argc, char *argv[]) -{ - FILE *tfp, *f; - char user[MAX_STRING_LEN]; - char realm[MAX_STRING_LEN]; - char line[MAX_STRING_LEN]; - char l[MAX_STRING_LEN]; - char w[MAX_STRING_LEN]; - char x[MAX_STRING_LEN]; - char command[MAX_STRING_LEN]; - int found; - - tn = NULL; - signal(SIGINT, (void (*)(int)) interrupted); - if (argc == 5) { - if (strcmp(argv[1], "-c")) - usage(); - if (!(tfp = fopen(argv[2], "w"))) { - fprintf(stderr, "Could not open passwd file %s for writing.\n", - argv[2]); - perror("fopen"); - exit(1); - } - printf("Adding password for %s in realm %s.\n", argv[4], argv[3]); - add_password(argv[4], argv[3], tfp); - fclose(tfp); - exit(0); - } - else if (argc != 4) - usage(); - - tn = tmpnam(NULL); - if (!(tfp = fopen(tn, "w"))) { - fprintf(stderr, "Could not open temp file.\n"); - exit(1); - } - - if (!(f = fopen(argv[1], "r"))) { - fprintf(stderr, - "Could not open passwd file %s for reading.\n", argv[1]); - fprintf(stderr, "Use -c option to create new one.\n"); - exit(1); - } - strcpy(user, argv[3]); - strcpy(realm, argv[2]); - - found = 0; - while (!(getline(line, MAX_STRING_LEN, f))) { - if (found || (line[0] == '#') || (!line[0])) { - putline(tfp, line); - continue; - } - strcpy(l, line); - getword(w, l, ':'); - getword(x, l, ':'); - if (strcmp(user, w) || strcmp(realm, x)) { - putline(tfp, line); - continue; - } - else { - printf("Changing password for user %s in realm %s\n", user, realm); - add_password(user, realm, tfp); - found = 1; - } - } - if (!found) { - printf("Adding user %s in realm %s\n", user, realm); - add_password(user, realm, tfp); - } - fclose(f); - fclose(tfp); -#if defined(OS2) || defined(WIN32) - sprintf(command, "copy \"%s\" \"%s\"", tn, argv[1]); -#else - sprintf(command, "cp %s %s", tn, argv[1]); -#endif - system(command); - unlink(tn); - return 0; -} diff --git a/support/htdigest.dsp b/support/htdigest.dsp deleted file mode 100644 index f00f87e7e74ac2c25b186221a3ccdbad9f6a386a..0000000000000000000000000000000000000000 --- a/support/htdigest.dsp +++ /dev/null @@ -1,103 +0,0 @@ -# Microsoft Developer Studio Project File - Name="htdigest" - Package Owner=<4> -# Microsoft Developer Studio Generated Build File, Format Version 5.00 -# ** DO NOT EDIT ** - -# TARGTYPE "Win32 (x86) Console Application" 0x0103 - -CFG=htdigest - Win32 Debug -!MESSAGE This is not a valid makefile. To build this project using NMAKE, -!MESSAGE use the Export Makefile command and run -!MESSAGE -!MESSAGE NMAKE /f "htdigest.mak". -!MESSAGE -!MESSAGE You can specify a configuration when running NMAKE -!MESSAGE by defining the macro CFG on the command line. For example: -!MESSAGE -!MESSAGE NMAKE /f "htdigest.mak" CFG="htdigest - Win32 Debug" -!MESSAGE -!MESSAGE Possible choices for configuration are: -!MESSAGE -!MESSAGE "htdigest - Win32 Release" (based on\ - "Win32 (x86) Console Application") -!MESSAGE "htdigest - Win32 Debug" (based on "Win32 (x86) Console Application") -!MESSAGE - -# Begin Project -# PROP Scc_ProjName "" -# PROP Scc_LocalPath "" -CPP=cl.exe -RSC=rc.exe - -!IF "$(CFG)" == "htdigest - Win32 Release" - -# PROP BASE Use_MFC 0 -# PROP BASE Use_Debug_Libraries 0 -# PROP BASE Output_Dir "htdigest" -# PROP BASE Intermediate_Dir "htdigest" -# PROP BASE Target_Dir "" -# PROP Use_MFC 0 -# PROP Use_Debug_Libraries 0 -# PROP Output_Dir "" -# PROP Intermediate_Dir "" -# PROP Ignore_Export_Lib 0 -# PROP Target_Dir "" -# ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c -# ADD CPP /nologo /W3 /GX /O2 /I "..\include" /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c -# ADD BASE RSC /l 0x409 /d "NDEBUG" -# ADD RSC /l 0x409 /d "NDEBUG" -BSC32=bscmake.exe -# ADD BASE BSC32 /nologo -# ADD BSC32 /nologo -LINK32=link.exe -# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /machine:I386 -# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /machine:I386 /out:"release/htdigest.exe" -# SUBTRACT LINK32 /pdb:none - -!ELSEIF "$(CFG)" == "htdigest - Win32 Debug" - -# PROP BASE Use_MFC 0 -# PROP BASE Use_Debug_Libraries 1 -# PROP BASE Output_Dir "htdiges0" -# PROP BASE Intermediate_Dir "htdiges0" -# PROP BASE Target_Dir "" -# PROP Use_MFC 0 -# PROP Use_Debug_Libraries 1 -# PROP Output_Dir "" -# PROP Intermediate_Dir "" -# PROP Ignore_Export_Lib 0 -# PROP Target_Dir "" -# ADD BASE CPP /nologo /W3 /Gm /GX /Zi /Od /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c -# ADD CPP /nologo /W3 /Gm /GX /Zi /Od /I "..\include" /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c -# ADD BASE RSC /l 0x409 /d "_DEBUG" -# ADD RSC /l 0x409 /d "_DEBUG" -BSC32=bscmake.exe -# ADD BASE BSC32 /nologo -# ADD BSC32 /nologo -LINK32=link.exe -# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept -# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /debug /machine:I386 /out:"debug/htdigest.exe" /pdbtype:sept - -!ENDIF - -# Begin Target - -# Name "htdigest - Win32 Release" -# Name "htdigest - Win32 Debug" -# Begin Source File - -SOURCE=..\ap\ap_cpystrn.c -# End Source File -# Begin Source File - -SOURCE=..\ap\ap_getpass.c -# End Source File -# Begin Source File - -SOURCE=..\ap\ap_md5c.c -# End Source File -# Begin Source File - -SOURCE=.\htdigest.c -# End Source File -# End Target -# End Project diff --git a/support/htpasswd.c b/support/htpasswd.c deleted file mode 100644 index 21a24e0c0a39089f6f93c8b9353a418f5a8fbb36..0000000000000000000000000000000000000000 --- a/support/htpasswd.c +++ /dev/null @@ -1,577 +0,0 @@ -/* ==================================================================== - * Copyright (c) 1995-1999 The Apache Group. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in - * the documentation and/or other materials provided with the - * distribution. - * - * 3. All advertising materials mentioning features or use of this - * software must display the following acknowledgment: - * "This product includes software developed by the Apache Group - * for use in the Apache HTTP server project (http://www.apache.org/)." - * - * 4. The names "Apache Server" and "Apache Group" must not be used to - * endorse or promote products derived from this software without - * prior written permission. For written permission, please contact - * apache@apache.org. - * - * 5. Products derived from this software may not be called "Apache" - * nor may "Apache" appear in their names without prior written - * permission of the Apache Group. - * - * 6. Redistributions of any form whatsoever must retain the following - * acknowledgment: - * "This product includes software developed by the Apache Group - * for use in the Apache HTTP server project (http://www.apache.org/)." - * - * THIS SOFTWARE IS PROVIDED BY THE APACHE GROUP ``AS IS'' AND ANY - * EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR - * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE APACHE GROUP OR - * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT - * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, - * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED - * OF THE POSSIBILITY OF SUCH DAMAGE. - * ==================================================================== - * - * This software consists of voluntary contributions made by many - * individuals on behalf of the Apache Group and was originally based - * on public domain software written at the National Center for - * Supercomputing Applications, University of Illinois, Urbana-Champaign. - * For more information on the Apache Group and the Apache HTTP server - * project, please see . - * - */ - -/****************************************************************************** - ****************************************************************************** - * NOTE! This program is not safe as a setuid executable! Do not make it - * setuid! - ****************************************************************************** - *****************************************************************************/ -/* - * htpasswd.c: simple program for manipulating password file for - * the Apache HTTP server - * - * Originally by Rob McCool - * - * Exit values: - * 0: Success - * 1: Failure; file access/permission problem - * 2: Failure; command line syntax problem (usage message issued) - * 3: Failure; password verification failure - * 4: Failure; operation interrupted (such as with CTRL/C) - * 5: Failure; buffer would overflow (username, filename, or computed - * record too long) - * 6: Failure; username contains illegal or reserved characters - */ - -#include "ap_config.h" -#include -#include -#include -#include "ap.h" -#include "ap_md5.h" -#include "ap_sha1.h" - -#ifdef WIN32 -#include -#include "../os/win32/getopt.h" -#define unlink _unlink -#endif - -#ifndef CHARSET_EBCDIC -#define LF 10 -#define CR 13 -#else /*CHARSET_EBCDIC*/ -#define LF '\n' -#define CR '\r' -#endif /*CHARSET_EBCDIC*/ - -#define MAX_STRING_LEN 256 -#define ALG_PLAIN 0 -#define ALG_CRYPT 1 -#define ALG_APMD5 2 -#define ALG_APSHA 3 - -#define ERR_FILEPERM 1 -#define ERR_SYNTAX 2 -#define ERR_PWMISMATCH 3 -#define ERR_INTERRUPTED 4 -#define ERR_OVERFLOW 5 -#define ERR_BADUSER 6 - -/* - * This needs to be declared statically so the signal handler can - * access it. - */ -static char *tempfilename; - -/* - * Get a line of input from the user, not including any terminating - * newline. - */ -static int getline(char *s, int n, FILE *f) -{ - register int i = 0; - - while (1) { - s[i] = (char) fgetc(f); - - if (s[i] == CR) { - s[i] = fgetc(f); - } - - if ((s[i] == 0x4) || (s[i] == LF) || (i == (n - 1))) { - s[i] = '\0'; - return (feof(f) ? 1 : 0); - } - ++i; - } -} - -static void putline(FILE *f, char *l) -{ - int x; - - for (x = 0; l[x]; x++) { - fputc(l[x], f); - } - fputc('\n', f); -} - -/* - * Make a password record from the given information. A zero return - * indicates success; failure means that the output buffer contains an - * error message instead. - */ -static int mkrecord(char *user, char *record, size_t rlen, char *passwd, - int alg) -{ - char *pw; - char cpw[120]; - char pwin[MAX_STRING_LEN]; - char pwv[MAX_STRING_LEN]; - char salt[9]; - - if (passwd != NULL) { - pw = passwd; - } - else { - if (ap_getpass("New password: ", pwin, sizeof(pwin)) != 0) { - ap_snprintf(record, (rlen - 1), "password too long (>%d)", - sizeof(pwin) - 1); - return ERR_OVERFLOW; - } - ap_getpass("Re-type new password: ", pwv, sizeof(pwv)); - if (strcmp(pwin, pwv) != 0) { - ap_cpystrn(record, "password verification error", (rlen - 1)); - return ERR_PWMISMATCH; - } - pw = pwin; - memset(pwv, '\0', sizeof(pwin)); - } - switch (alg) { - - case ALG_APSHA: - /* XXX cpw >= 28 + strlen(sha1) chars - fixed len SHA */ - ap_sha1_base64(pw,strlen(pw),cpw); - break; - - case ALG_APMD5: - (void) srand((int) time((time_t *) NULL)); - ap_to64(&salt[0], rand(), 8); - salt[8] = '\0'; - - ap_MD5Encode((const unsigned char *)pw, (const unsigned char *)salt, - cpw, sizeof(cpw)); - break; - - case ALG_PLAIN: - /* XXX this len limitation is not in sync with any HTTPd len. */ - ap_cpystrn(cpw,pw,sizeof(cpw)); - break; - - case ALG_CRYPT: - default: - (void) srand((int) time((time_t *) NULL)); - ap_to64(&salt[0], rand(), 8); - salt[8] = '\0'; - - ap_cpystrn(cpw, (char *)crypt(pw, salt), sizeof(cpw) - 1); - break; - } - memset(pw, '\0', strlen(pw)); - - /* - * Check to see if the buffer is large enough to hold the username, - * hash, and delimiters. - */ - if ((strlen(user) + 1 + strlen(cpw)) > (rlen - 1)) { - ap_cpystrn(record, "resultant record too long", (rlen - 1)); - return ERR_OVERFLOW; - } - strcpy(record, user); - strcat(record, ":"); - strcat(record, cpw); - return 0; -} - -static int usage(void) -{ - fprintf(stderr, "Usage:\n"); - fprintf(stderr, "\thtpasswd [-cmdps] passwordfile username\n"); - fprintf(stderr, "\thtpasswd -b[cmdps] passwordfile username password\n\n"); - fprintf(stderr, " -c Create a new file.\n"); - fprintf(stderr, " -m Force MD5 encryption of the password" -#if defined(WIN32) || defined(TPF) - " (default)" -#endif - ".\n"); - fprintf(stderr, " -d Force CRYPT encryption of the password" -#if (!(defined(WIN32) || defined(TPF))) - " (default)" -#endif - ".\n"); - fprintf(stderr, " -p Do not encrypt the password (plaintext).\n"); - fprintf(stderr, " -s Force SHA encryption of the password.\n"); - fprintf(stderr, " -b Use the password from the command line rather " - "than prompting for it.\n"); - fprintf(stderr, - "On Windows and TPF systems the '-m' flag is used by default.\n"); - fprintf(stderr, - "On all other systems, the '-p' flag will probably not work.\n"); - return ERR_SYNTAX; -} - -static void interrupted(void) -{ - fprintf(stderr, "Interrupted.\n"); - if (tempfilename != NULL) { - unlink(tempfilename); - } - exit(ERR_INTERRUPTED); -} - -/* - * Check to see if the specified file can be opened for the given - * access. - */ -static int accessible(char *fname, char *mode) -{ - FILE *s; - - s = fopen(fname, mode); - if (s == NULL) { - return 0; - } - fclose(s); - return 1; -} - -/* - * Return true if a file is readable. - */ -static int readable(char *fname) -{ - return accessible(fname, "r"); -} - -/* - * Return true if the specified file can be opened for write access. - */ -static int writable(char *fname) -{ - return accessible(fname, "a"); -} - -/* - * Return true if the named file exists, regardless of permissions. - */ -static int exists(char *fname) -{ -#ifdef WIN32 - struct _stat sbuf; -#else - struct stat sbuf; -#endif - int check; - -#ifdef WIN32 - check = _stat(fname, &sbuf); -#else - check = stat(fname, &sbuf); -#endif - return ((check == -1) && (errno == ENOENT)) ? 0 : 1; -} - -/* - * Copy from the current position of one file to the current position - * of another. - */ -static void copy_file(FILE *target, FILE *source) -{ - static char line[MAX_STRING_LEN]; - - while (fgets(line, sizeof(line), source) != NULL) { - fputs(line, target); - } -} - -/* - * Let's do it. We end up doing a lot of file opening and closing, - * but what do we care? This application isn't run constantly. - */ -int main(int argc, char *argv[]) -{ - FILE *ftemp = NULL; - FILE *fpw = NULL; - char user[MAX_STRING_LEN]; - char password[MAX_STRING_LEN]; - char record[MAX_STRING_LEN]; - char line[MAX_STRING_LEN]; - char pwfilename[MAX_STRING_LEN]; - char *arg; - int found = 0; - int alg = ALG_CRYPT; - int newfile = 0; - int noninteractive = 0; - int i; - int args_left = 2; - - tempfilename = NULL; - signal(SIGINT, (void (*)(int)) interrupted); - - /* - * Preliminary check to make sure they provided at least - * three arguments, we'll do better argument checking as - * we parse the command line. - */ - if (argc < 3) { - return usage(); - } - - /* - * Go through the argument list and pick out any options. They - * have to precede any other arguments. - */ - for (i = 1; i < argc; i++) { - arg = argv[i]; - if (*arg != '-') { - break; - } - while (*++arg != '\0') { - if (*arg == 'c') { - newfile++; - } - else if (*arg == 'm') { - alg = ALG_APMD5; - } - else if (*arg == 's') { - alg = ALG_APSHA; - } - else if (*arg == 'p') { - alg = ALG_PLAIN; - } - else if (*arg == 'd') { - alg = ALG_CRYPT; - } - else if (*arg == 'b') { - noninteractive++; - args_left++; - } - else { - return usage(); - } - } - } - - /* - * Make sure we still have exactly the right number of arguments left - * (the filename, the username, and possibly the password if -b was - * specified). - */ - if ((argc - i) != args_left) { - return usage(); - } - if (strlen(argv[i]) > (sizeof(pwfilename) - 1)) { - fprintf(stderr, "%s: filename too long\n", argv[0]); - return ERR_OVERFLOW; - } - strcpy(pwfilename, argv[i]); - if (strlen(argv[i + 1]) > (sizeof(user) - 1)) { - fprintf(stderr, "%s: username too long (>%d)\n", argv[0], - sizeof(user) - 1); - return ERR_OVERFLOW; - } - strcpy(user, argv[i + 1]); - if ((arg = strchr(user, ':')) != NULL) { - fprintf(stderr, "%s: username contains illegal character '%c'\n", - argv[0], *arg); - return ERR_BADUSER; - } - if (noninteractive) { - if (strlen(argv[i + 2]) > (sizeof(password) - 1)) { - fprintf(stderr, "%s: password too long (>%d)\n", argv[0], - sizeof(password) - 1); - return ERR_OVERFLOW; - } - strcpy(password, argv[i + 2]); - } - -#ifdef WIN32 - if (alg == ALG_CRYPT) { - alg = ALG_APMD5; - fprintf(stderr, "Automatically using MD5 format on Windows.\n"); - } -#endif - -#if (!(defined(WIN32) || defined(TPF))) - if (alg == ALG_PLAIN) { - fprintf(stderr,"Warning: storing passwords as plain text might " - "just not work on this platform.\n"); - } -#endif - /* - * Verify that the file exists if -c was omitted. We give a special - * message if it doesn't. - */ - if ((! newfile) && (! exists(pwfilename))) { - fprintf(stderr, "%s: cannot modify file %s; use '-c' to create it\n", - argv[0], pwfilename); - perror("fopen"); - exit(ERR_FILEPERM); - } - /* - * Verify that we can read the existing file in the case of an update - * to it (rather than creation of a new one). - */ - if ((! newfile) && (! readable(pwfilename))) { - fprintf(stderr, "%s: cannot open file %s for read access\n", - argv[0], pwfilename); - perror("fopen"); - exit(ERR_FILEPERM); - } - /* - * Now check to see if we can preserve an existing file in case - * of password verification errors on a -c operation. - */ - if (newfile && exists(pwfilename) && (! readable(pwfilename))) { - fprintf(stderr, "%s: cannot open file %s for read access\n" - "%s: existing auth data would be lost on password mismatch", - argv[0], pwfilename, argv[0]); - perror("fopen"); - exit(ERR_FILEPERM); - } - /* - * Now verify that the file is writable! - */ - if (! writable(pwfilename)) { - fprintf(stderr, "%s: cannot open file %s for write access\n", - argv[0], pwfilename); - perror("fopen"); - exit(ERR_FILEPERM); - } - - /* - * All the file access checks have been made. Time to go to work; - * try to create the record for the username in question. If that - * fails, there's no need to waste any time on file manipulations. - * Any error message text is returned in the record buffer, since - * the mkrecord() routine doesn't have access to argv[]. - */ - i = mkrecord(user, record, sizeof(record) - 1, - noninteractive ? password : NULL, - alg); - if (i != 0) { - fprintf(stderr, "%s: %s\n", argv[0], record); - exit(i); - } - - /* - * We can access the files the right way, and we have a record - * to add or update. Let's do it.. - */ - tempfilename = tmpnam(NULL); - ftemp = fopen(tempfilename, "w+"); - if (ftemp == NULL) { - fprintf(stderr, "%s: unable to create temporary file\n", argv[0]); - perror("fopen"); - exit(ERR_FILEPERM); - } - /* - * If we're not creating a new file, copy records from the existing - * one to the temporary file until we find the specified user. - */ - if (! newfile) { - char scratch[MAX_STRING_LEN]; - - fpw = fopen(pwfilename, "r"); - while (! (getline(line, sizeof(line), fpw))) { - char *colon; - - if ((line[0] == '#') || (line[0] == '\0')) { - putline(ftemp, line); - continue; - } - strcpy(scratch, line); - /* - * See if this is our user. - */ - colon = strchr(scratch, ':'); - if (colon != NULL) { - *colon = '\0'; - } - if (strcmp(user, scratch) != 0) { - putline(ftemp, line); - continue; - } - found++; - break; - } - } - if (found) { - fprintf(stderr, "Updating "); - } - else { - fprintf(stderr, "Adding "); - } - fprintf(stderr, "password for user %s\n", user); - /* - * Now add the user record we created. - */ - putline(ftemp, record); - /* - * If we're updating an existing file, there may be additional - * records beyond the one we're updating, so copy them. - */ - if (! newfile) { - copy_file(ftemp, fpw); - fclose(fpw); - } - /* - * The temporary file now contains the information that should be - * in the actual password file. Close the open files, re-open them - * in the appropriate mode, and copy them file to the real one. - */ - fclose(ftemp); - fpw = fopen(pwfilename, "w+"); - ftemp = fopen(tempfilename, "r"); - copy_file(fpw, ftemp); - fclose(fpw); - fclose(ftemp); - unlink(tempfilename); - return 0; -} diff --git a/support/htpasswd.dsp b/support/htpasswd.dsp deleted file mode 100644 index 7949d7f7e8290c1c9a7ed18eb3f0ecd8ac4a171d..0000000000000000000000000000000000000000 --- a/support/htpasswd.dsp +++ /dev/null @@ -1,119 +0,0 @@ -# Microsoft Developer Studio Project File - Name="htpasswd" - Package Owner=<4> -# Microsoft Developer Studio Generated Build File, Format Version 5.00 -# ** DO NOT EDIT ** - -# TARGTYPE "Win32 (x86) Console Application" 0x0103 - -CFG=htpasswd - Win32 Debug -!MESSAGE This is not a valid makefile. To build this project using NMAKE, -!MESSAGE use the Export Makefile command and run -!MESSAGE -!MESSAGE NMAKE /f "htpasswd.mak". -!MESSAGE -!MESSAGE You can specify a configuration when running NMAKE -!MESSAGE by defining the macro CFG on the command line. For example: -!MESSAGE -!MESSAGE NMAKE /f "htpasswd.mak" CFG="htpasswd - Win32 Debug" -!MESSAGE -!MESSAGE Possible choices for configuration are: -!MESSAGE -!MESSAGE "htpasswd - Win32 Release" (based on\ - "Win32 (x86) Console Application") -!MESSAGE "htpasswd - Win32 Debug" (based on "Win32 (x86) Console Application") -!MESSAGE - -# Begin Project -# PROP Scc_ProjName "" -# PROP Scc_LocalPath "" -CPP=cl.exe -RSC=rc.exe - -!IF "$(CFG)" == "htpasswd - Win32 Release" - -# PROP BASE Use_MFC 0 -# PROP BASE Use_Debug_Libraries 0 -# PROP BASE Output_Dir "Release" -# PROP BASE Intermediate_Dir "Release" -# PROP BASE Target_Dir "" -# PROP Use_MFC 0 -# PROP Use_Debug_Libraries 0 -# PROP Output_Dir "Release" -# PROP Intermediate_Dir "Release" -# PROP Ignore_Export_Lib 0 -# PROP Target_Dir "" -# ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c -# ADD CPP /nologo /W3 /GX /O2 /I "..\include" /D "NDEBUG" /D "WIN32" /D "_CONSOLE" /D "_MBCS" /D "WIN32_LEAN_AND_MEAN" /YX /FD /c -# ADD BASE RSC /l 0x409 /d "NDEBUG" -# ADD RSC /l 0x409 /d "NDEBUG" -BSC32=bscmake.exe -# ADD BASE BSC32 /nologo -# ADD BSC32 /nologo -LINK32=link.exe -# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /machine:I386 -# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ws2_32.lib /nologo /subsystem:console /machine:I386 - -!ELSEIF "$(CFG)" == "htpasswd - Win32 Debug" - -# PROP BASE Use_MFC 0 -# PROP BASE Use_Debug_Libraries 1 -# PROP BASE Output_Dir "Debug" -# PROP BASE Intermediate_Dir "Debug" -# PROP BASE Target_Dir "" -# PROP Use_MFC 0 -# PROP Use_Debug_Libraries 1 -# PROP Output_Dir "Debug" -# PROP Intermediate_Dir "Debug" -# PROP Ignore_Export_Lib 0 -# PROP Target_Dir "" -# ADD BASE CPP /nologo /W3 /Gm /GX /Zi /Od /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c -# ADD CPP /nologo /W3 /Gm /GX /Zi /Od /I "..\include" /D "_DEBUG" /D "WIN32" /D "_CONSOLE" /D "_MBCS" /D "WIN32_LEAN_AND_MEAN" /YX /FD /c -# ADD BASE RSC /l 0x409 /d "_DEBUG" -# ADD RSC /l 0x409 /d "_DEBUG" -BSC32=bscmake.exe -# ADD BASE BSC32 /nologo -# ADD BSC32 /nologo -LINK32=link.exe -# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept -# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ws2_32.lib /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept -# SUBTRACT LINK32 /pdb:none - -!ENDIF - -# Begin Target - -# Name "htpasswd - Win32 Release" -# Name "htpasswd - Win32 Debug" -# Begin Source File - -SOURCE=..\ap\ap_cpystrn.c -# End Source File -# Begin Source File - -SOURCE=..\ap\ap_getpass.c -# End Source File -# Begin Source File - -SOURCE=..\ap\ap_md5c.c -# End Source File -# Begin Source File - -SOURCE=..\ap\ap_snprintf.c -# End Source File -# Begin Source File - -SOURCE=..\ap\ap_sha1.c -# End Source File -# Begin Source File - -SOURCE=..\ap\ap_checkpass.c -# End Source File -# Begin Source File - -SOURCE=..\ap\ap_base64.c -# End Source File -# Begin Source File - -SOURCE=.\htpasswd.c -# End Source File -# End Target -# End Project diff --git a/support/list_hooks.pl b/support/list_hooks.pl deleted file mode 100755 index c52c567142435ced0487d51cdac581f217b51b87..0000000000000000000000000000000000000000 --- a/support/list_hooks.pl +++ /dev/null @@ -1,77 +0,0 @@ -#!/usr/bin/perl -w - -use strict; - -use Carp; - -my $path=shift; - -findInDir($path); - -foreach my $hook (sort keys %::Hooks) { - my $h=$::Hooks{$hook}; - for my $x (qw(declared implemented type args)) { - croak "$hook datum '$x' missing" if !exists $h->{$x}; - } - print "$hook\n"; - print " declared in $h->{declared}\n"; - print " implemented in $h->{implemented}\n"; - print " type is $h->{type}\n"; - print " $h->{ret} $hook($h->{args})\n"; - print "\n"; -} - -sub findInDir { - my $path=shift; - - local(*D); - opendir(D,$path) || croak "Can't open $path: $!"; - while(my $f=readdir D) { - next if $f=~/^\./; - my $file="$path/$f"; - - if(-d $file) { - findInDir($file); - next; - } - next if $file !~ /\.[ch]$/; - - scanFile($file); - } - closedir D; -} - -sub scanFile { - my $file=shift; - -# print "scanning $file\n"; - - open(F,$file) || croak "Can't open $file: $!"; - while() { - next if /\#define/; - next if /\@deffunc/; - if(/AP_DECLARE_HOOK\((.*)\)/) { - my $def=$1; - my($ret,$name,$args)=$def=~/([^,\s]+)\s*,\s*([^,\s]+)\s*,\s*\((.*)\)/; - croak "Don't understand $def in $file" if !defined $args; -# print "found $ret $name($args) in $file\n"; - - croak "$name declared twice! ($_)" - if exists $::Hooks{$name}->{declared}; - $::Hooks{$name}->{declared}=$file; - $::Hooks{$name}->{ret}=$ret; - $::Hooks{$name}->{args}=$args; - } - if(/AP_IMPLEMENT_HOOK_()(VOID)\(([^,\s]+)/ - || /AP_IMPLEMENT(_OPTIONAL|)_HOOK_(.*?)\([^,]+?\s*,\s*([^,\s]+)/) { - my($type,$name)=($1 ? "OPTIONAL $2" : $2,$3); - -# print "found $name $type in $file\n"; - - croak "$name implemented twice ($::Hooks{$name}->{implemented} and $file) ($_)" - if exists $::Hooks{$name}->{implemented}; - $::Hooks{$name}->{implemented}=$file; - $::Hooks{$name}->{type}=$type; - } - } -} diff --git a/support/log_server_status.in b/support/log_server_status.in deleted file mode 100644 index f301604b766054fcdde5d3574918d96009bea23f..0000000000000000000000000000000000000000 --- a/support/log_server_status.in +++ /dev/null @@ -1,114 +0,0 @@ -#!@perlbin@ -# ==================================================================== -# The Apache Software License, Version 1.1 -# -# Copyright (c) 2000-2001 The Apache Software Foundation. All rights -# reserved. -# -# Redistribution and use in source and binary forms, with or without -# modification, are permitted provided that the following conditions -# are met: -# -# 1. Redistributions of source code must retain the above copyright -# notice, this list of conditions and the following disclaimer. -# -# 2. Redistributions in binary form must reproduce the above copyright -# notice, this list of conditions and the following disclaimer in -# the documentation and/or other materials provided with the -# distribution. -# -# 3. The end-user documentation included with the redistribution, -# if any, must include the following acknowledgment: -# "This product includes software developed by the -# Apache Software Foundation (http://www.apache.org/)." -# Alternately, this acknowledgment may appear in the software itself, -# if and wherever such third-party acknowledgments normally appear. -# -# 4. The names "Apache" and "Apache Software Foundation" must -# not be used to endorse or promote products derived from this -# software without prior written permission. For written -# permission, please contact apache@apache.org. -# -# 5. Products derived from this software may not be called "Apache", -# nor may "Apache" appear in their name, without prior written -# permission of the Apache Software Foundation. -# -# THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED -# WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES -# OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE -# DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR -# ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF -# USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND -# ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, -# OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT -# OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF -# SUCH DAMAGE. -# ==================================================================== -# -# This software consists of voluntary contributions made by many -# individuals on behalf of the Apache Software Foundation. For more -# information on the Apache Software Foundation, please see -# . -# -# Log Server Status -# Mark J Cox, UK Web Ltd 1996, mark@ukweb.com -# -# This script is designed to be run at a frequent interval by something -# like cron. It connects to the server and downloads the status -# information. It reformats the information to a single line and logs -# it to a file. Make sure the directory $wherelog is writable by the -# user who runs this script. -# -require 'sys/socket.ph'; - -$wherelog = "/var/log/graph/"; # Logs will be like "/var/log/graph/19960312" -$server = "localhost"; # Name of server, could be "www.foo.com" -$port = "80"; # Port on server -$request = "/status/?auto"; # Request to send - -sub tcp_connect -{ - local($host,$port) =@_; - $sockaddr='S n a4 x8'; - chop($hostname=`hostname`); - $port=(getservbyname($port, 'tcp'))[2] unless $port =~ /^\d+$/; - $me=pack($sockaddr,&AF_INET,0,(gethostbyname($hostname))[4]); - $them=pack($sockaddr,&AF_INET,$port,(gethostbyname($host))[4]); - socket(S,&PF_INET,&SOCK_STREAM,(getprotobyname('tcp'))[2]) || - die "socket: $!"; - bind(S,$me) || return "bind: $!"; - connect(S,$them) || return "connect: $!"; - select(S); - $| = 1; - select(stdout); - return ""; -} - -### Main - -{ - $year=`date +%y`; - chomp($year); - $year += ($year < 70) ? 2000 : 1900; - $date = $year . `date +%m%d:%H%M%S`; - chomp($date); - ($day,$time)=split(/:/,$date); - $res=&tcp_connect($server,$port); - open(OUT,">>$wherelog$day"); - if ($res) { - print OUT "$time:-1:-1:-1:-1:$res\n"; - exit 1; - } - print S "GET $request\n"; - while () { - $requests=$1 if ( m|^BusyServers:\ (\S+)|); - $idle=$1 if ( m|^IdleServers:\ (\S+)|); - $number=$1 if ( m|sses:\ (\S+)|); - $cpu=$1 if (m|^CPULoad:\ (\S+)|); - } - print OUT "$time:$requests:$idle:$number:$cpu\n"; -} - - diff --git a/support/logresolve.c b/support/logresolve.c deleted file mode 100644 index bcdc6e51b56c5f20e354ca5358a4ae0e76a52243..0000000000000000000000000000000000000000 --- a/support/logresolve.c +++ /dev/null @@ -1,345 +0,0 @@ -/* - * logresolve 1.1 - * - * Tom Rathborne - tomr@uunet.ca - http://www.uunet.ca/~tomr/ - * UUNET Canada, April 16, 1995 - * - * Rewritten by David Robinson. (drtr@ast.cam.ac.uk) - * - * Usage: logresolve [-s filename] [-c] < access_log > new_log - * - * Arguments: - * -s filename name of a file to record statistics - * -c check the DNS for a matching A record for the host. - * - * Notes: - * - * To generate meaningful statistics from an HTTPD log file, it's good - * to have the domain name of each machine that accessed your site, but - * doing this on the fly can slow HTTPD down. - * - * Compiling NCSA HTTPD with the -DMINIMAL_DNS flag turns IP#->hostname - * resolution off. Before running your stats program, just run your log - * file through this program (logresolve) and all of your IP numbers will - * be resolved into hostnames (where possible). - * - * logresolve takes an HTTPD access log (in the COMMON log file format, - * or any other format that has the IP number/domain name as the first - * field for that matter), and outputs the same file with all of the - * domain names looked up. Where no domain name can be found, the IP - * number is left in. - * - * To minimize impact on your nameserver, logresolve has its very own - * internal hash-table cache. This means that each IP number will only - * be looked up the first time it is found in the log file. - * - * The -c option causes logresolve to apply the same check as httpd - * compiled with -DMAXIMUM_DNS; after finding the hostname from the IP - * address, it looks up the IP addresses for the hostname and checks - * that one of these matches the original address. - */ - -#include "ap_config.h" -#include - -#include - -#ifndef MPE -#include -#endif - -static void cgethost(struct in_addr ipnum, char *string, int check); -static int getline(char *s, int n); -static void stats(FILE *output); - - -/* maximum line length */ -#define MAXLINE 1024 - -/* maximum length of a domain name */ -#ifndef MAXDNAME -#define MAXDNAME 256 -#endif - -/* number of buckets in cache hash table */ -#define BUCKETS 256 - -#if defined(NEED_STRDUP) -char *strdup (const char *str) -{ - char *dup; - - if (!(dup = (char *) malloc(strlen(str) + 1))) - return NULL; - dup = strcpy(dup, str); - - return dup; -} -#endif - -/* - * struct nsrec - record of nameservice for cache linked list - * - * ipnum - IP number hostname - hostname noname - nonzero if IP number has no - * hostname, i.e. hostname=IP number - */ - -struct nsrec { - struct in_addr ipnum; - char *hostname; - int noname; - struct nsrec *next; -} *nscache[BUCKETS]; - -/* - * statistics - obvious - */ - -#ifndef h_errno -extern int h_errno; /* some machines don't have this in their headers */ -#endif - -/* largeste value for h_errno */ -#define MAX_ERR (NO_ADDRESS) -#define UNKNOWN_ERR (MAX_ERR+1) -#define NO_REVERSE (MAX_ERR+2) - -static int cachehits = 0; -static int cachesize = 0; -static int entries = 0; -static int resolves = 0; -static int withname = 0; -static int errors[MAX_ERR + 3]; - -/* - * cgethost - gets hostname by IP address, caching, and adding unresolvable - * IP numbers with their IP number as hostname, setting noname flag - */ - -static void cgethost (struct in_addr ipnum, char *string, int check) -{ - struct nsrec **current, *new; - struct hostent *hostdata; - char *name; - - current = &nscache[((ipnum.s_addr + (ipnum.s_addr >> 8) + - (ipnum.s_addr >> 16) + (ipnum.s_addr >> 24)) % BUCKETS)]; - - while (*current != NULL && ipnum.s_addr != (*current)->ipnum.s_addr) - current = &(*current)->next; - - if (*current == NULL) { - cachesize++; - new = (struct nsrec *) malloc(sizeof(struct nsrec)); - if (new == NULL) { - perror("malloc"); - fprintf(stderr, "Insufficient memory\n"); - exit(1); - } - *current = new; - new->next = NULL; - - new->ipnum = ipnum; - - hostdata = gethostbyaddr((const char *) &ipnum, sizeof(struct in_addr), - AF_INET); - if (hostdata == NULL) { - if (h_errno > MAX_ERR) - errors[UNKNOWN_ERR]++; - else - errors[h_errno]++; - new->noname = h_errno; - name = strdup(inet_ntoa(ipnum)); - } - else { - new->noname = 0; - name = strdup(hostdata->h_name); - if (check) { - if (name == NULL) { - perror("strdup"); - fprintf(stderr, "Insufficient memory\n"); - exit(1); - } - hostdata = gethostbyname(name); - if (hostdata != NULL) { - char **hptr; - - for (hptr = hostdata->h_addr_list; *hptr != NULL; hptr++) - if (((struct in_addr *) (*hptr))->s_addr == ipnum.s_addr) - break; - if (*hptr == NULL) - hostdata = NULL; - } - if (hostdata == NULL) { - fprintf(stderr, "Bad host: %s != %s\n", name, - inet_ntoa(ipnum)); - new->noname = NO_REVERSE; - free(name); - name = strdup(inet_ntoa(ipnum)); - errors[NO_REVERSE]++; - } - } - } - new->hostname = name; - if (new->hostname == NULL) { - perror("strdup"); - fprintf(stderr, "Insufficient memory\n"); - exit(1); - } - } - else - cachehits++; - - /* size of string == MAXDNAME +1 */ - strncpy(string, (*current)->hostname, MAXDNAME); - string[MAXDNAME] = '\0'; -} - -/* - * prints various statistics to output - */ - -static void stats (FILE *output) -{ - int i; - char *ipstring; - struct nsrec *current; - char *errstring[MAX_ERR + 3]; - - for (i = 0; i < MAX_ERR + 3; i++) - errstring[i] = "Unknown error"; - errstring[HOST_NOT_FOUND] = "Host not found"; - errstring[TRY_AGAIN] = "Try again"; - errstring[NO_RECOVERY] = "Non recoverable error"; - errstring[NO_DATA] = "No data record"; - errstring[NO_ADDRESS] = "No address"; - errstring[NO_REVERSE] = "No reverse entry"; - - fprintf(output, "logresolve Statistics:\n"); - - fprintf(output, "Entries: %d\n", entries); - fprintf(output, " With name : %d\n", withname); - fprintf(output, " Resolves : %d\n", resolves); - if (errors[HOST_NOT_FOUND]) - fprintf(output, " - Not found : %d\n", errors[HOST_NOT_FOUND]); - if (errors[TRY_AGAIN]) - fprintf(output, " - Try again : %d\n", errors[TRY_AGAIN]); - if (errors[NO_DATA]) - fprintf(output, " - No data : %d\n", errors[NO_DATA]); - if (errors[NO_ADDRESS]) - fprintf(output, " - No address: %d\n", errors[NO_ADDRESS]); - if (errors[NO_REVERSE]) - fprintf(output, " - No reverse: %d\n", errors[NO_REVERSE]); - fprintf(output, "Cache hits : %d\n", cachehits); - fprintf(output, "Cache size : %d\n", cachesize); - fprintf(output, "Cache buckets : IP number * hostname\n"); - - for (i = 0; i < BUCKETS; i++) - for (current = nscache[i]; current != NULL; current = current->next) { - ipstring = inet_ntoa(current->ipnum); - if (current->noname == 0) - fprintf(output, " %3d %15s - %s\n", i, ipstring, - current->hostname); - else { - if (current->noname > MAX_ERR + 2) - fprintf(output, " %3d %15s : Unknown error\n", i, - ipstring); - else - fprintf(output, " %3d %15s : %s\n", i, ipstring, - errstring[current->noname]); - } - } -} - - -/* - * gets a line from stdin - */ - -static int getline (char *s, int n) -{ - char *cp; - - if (!fgets(s, n, stdin)) - return (0); - cp = strchr(s, '\n'); - if (cp) - *cp = '\0'; - return (1); -} - -int main (int argc, char *argv[]) -{ - struct in_addr ipnum; - char *bar, hoststring[MAXDNAME + 1], line[MAXLINE], *statfile; - int i, check; - - check = 0; - statfile = NULL; - for (i = 1; i < argc; i++) { - if (strcmp(argv[i], "-c") == 0) - check = 1; - else if (strcmp(argv[i], "-s") == 0) { - if (i == argc - 1) { - fprintf(stderr, "logresolve: missing filename to -s\n"); - exit(1); - } - i++; - statfile = argv[i]; - } - else { - fprintf(stderr, "Usage: logresolve [-s statfile] [-c] < input > output\n"); - exit(0); - } - } - - - for (i = 0; i < BUCKETS; i++) - nscache[i] = NULL; - for (i = 0; i < MAX_ERR + 2; i++) - errors[i] = 0; - - while (getline(line, MAXLINE)) { - if (line[0] == '\0') - continue; - entries++; - if (!isdigit(line[0])) { /* short cut */ - puts(line); - withname++; - continue; - } - bar = strchr(line, ' '); - if (bar != NULL) - *bar = '\0'; - ipnum.s_addr = inet_addr(line); - if (ipnum.s_addr == 0xffffffffu) { - if (bar != NULL) - *bar = ' '; - puts(line); - withname++; - continue; - } - - resolves++; - - cgethost(ipnum, hoststring, check); - if (bar != NULL) - printf("%s %s\n", hoststring, bar + 1); - else - puts(hoststring); - } - - if (statfile != NULL) { - FILE *fp; - fp = fopen(statfile, "w"); - if (fp == NULL) { - fprintf(stderr, "logresolve: could not open statistics file '%s'\n" - ,statfile); - exit(1); - } - stats(fp); - fclose(fp); - } - - return (0); -} diff --git a/support/logresolve.dsp b/support/logresolve.dsp deleted file mode 100644 index 2f5d87ed8beaff19d18b117e640c03333e72efb1..0000000000000000000000000000000000000000 --- a/support/logresolve.dsp +++ /dev/null @@ -1,94 +0,0 @@ -# Microsoft Developer Studio Project File - Name="logresolve" - Package Owner=<4> -# Microsoft Developer Studio Generated Build File, Format Version 5.00 -# ** DO NOT EDIT ** - -# TARGTYPE "Win32 (x86) Console Application" 0x0103 - -CFG=logresolve - Win32 Debug -!MESSAGE This is not a valid makefile. To build this project using NMAKE, -!MESSAGE use the Export Makefile command and run -!MESSAGE -!MESSAGE NMAKE /f "logresolve.mak". -!MESSAGE -!MESSAGE You can specify a configuration when running NMAKE -!MESSAGE by defining the macro CFG on the command line. For example: -!MESSAGE -!MESSAGE NMAKE /f "logresolve.mak" CFG="logresolve - Win32 Debug" -!MESSAGE -!MESSAGE Possible choices for configuration are: -!MESSAGE -!MESSAGE "logresolve - Win32 Release" (based on\ - "Win32 (x86) Console Application") -!MESSAGE "logresolve - Win32 Debug" (based on\ - "Win32 (x86) Console Application") -!MESSAGE - -# Begin Project -# PROP Scc_ProjName "" -# PROP Scc_LocalPath "" -CPP=cl.exe -RSC=rc.exe - -!IF "$(CFG)" == "logresolve - Win32 Release" - -# PROP BASE Use_MFC 0 -# PROP BASE Use_Debug_Libraries 0 -# PROP BASE Output_Dir "Release" -# PROP BASE Intermediate_Dir "Release" -# PROP BASE Target_Dir "" -# PROP Use_MFC 0 -# PROP Use_Debug_Libraries 0 -# PROP Output_Dir "Release" -# PROP Intermediate_Dir "Release" -# PROP Ignore_Export_Lib 0 -# PROP Target_Dir "" -# ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /FD /c -# ADD CPP /nologo /MT /W3 /GX /O2 /I "../include" /I "../lib/apr/include" /D "NDEBUG" /D "WIN32" /D "_CONSOLE" /D "WIN32_LEAN_AND_MEAN" /FD /c -# ADD BASE RSC /l 0x409 /d "NDEBUG" -# ADD RSC /l 0x409 /d "NDEBUG" -BSC32=bscmake.exe -# ADD BASE BSC32 /nologo -# ADD BSC32 /nologo -LINK32=link.exe -# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /machine:I386 -# ADD LINK32 kernel32.lib wsock32.lib ws2_32.lib /nologo /subsystem:console /map /machine:I386 -# SUBTRACT LINK32 /pdb:none /nodefaultlib - -!ELSEIF "$(CFG)" == "logresolve - Win32 Debug" - -# PROP BASE Use_MFC 0 -# PROP BASE Use_Debug_Libraries 1 -# PROP BASE Output_Dir "Debug" -# PROP BASE Intermediate_Dir "Debug" -# PROP BASE Target_Dir "" -# PROP Use_MFC 0 -# PROP Use_Debug_Libraries 1 -# PROP Output_Dir "Debug" -# PROP Intermediate_Dir "Debug" -# PROP Ignore_Export_Lib 0 -# PROP Target_Dir "" -# ADD BASE CPP /nologo /W3 /Gm /GX /Zi /Od /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /FD /c -# ADD CPP /nologo /MTd /W3 /Gm /GX /Zi /Od /I "../include" /I "../lib/apr/include" /D "_DEBUG" /D "WIN32" /D "_CONSOLE" /D "WIN32_LEAN_AND_MEAN" /FD /c -# SUBTRACT CPP /Fr -# ADD BASE RSC /l 0x409 /d "_DEBUG" -# ADD RSC /l 0x409 /d "_DEBUG" -BSC32=bscmake.exe -# ADD BASE BSC32 /nologo -# ADD BSC32 /nologo -LINK32=link.exe -# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept -# ADD LINK32 kernel32.lib wsock32.lib ws2_32.lib /nologo /subsystem:console /map /debug /machine:I386 /nodefaultlib -# SUBTRACT LINK32 /pdb:none - -!ENDIF - -# Begin Target - -# Name "logresolve - Win32 Release" -# Name "logresolve - Win32 Debug" -# Begin Source File - -SOURCE=.\logresolve.c -# End Source File -# End Target -# End Project diff --git a/support/logresolve.pl.in b/support/logresolve.pl.in deleted file mode 100644 index c2142f161d12a86ea00041047fdc72167bcea8ff..0000000000000000000000000000000000000000 --- a/support/logresolve.pl.in +++ /dev/null @@ -1,261 +0,0 @@ -#!@perlbin@ -# ==================================================================== -# The Apache Software License, Version 1.1 -# -# Copyright (c) 2000-2001 The Apache Software Foundation. All rights -# reserved. -# -# Redistribution and use in source and binary forms, with or without -# modification, are permitted provided that the following conditions -# are met: -# -# 1. Redistributions of source code must retain the above copyright -# notice, this list of conditions and the following disclaimer. -# -# 2. Redistributions in binary form must reproduce the above copyright -# notice, this list of conditions and the following disclaimer in -# the documentation and/or other materials provided with the -# distribution. -# -# 3. The end-user documentation included with the redistribution, -# if any, must include the following acknowledgment: -# "This product includes software developed by the -# Apache Software Foundation (http://www.apache.org/)." -# Alternately, this acknowledgment may appear in the software itself, -# if and wherever such third-party acknowledgments normally appear. -# -# 4. The names "Apache" and "Apache Software Foundation" must -# not be used to endorse or promote products derived from this -# software without prior written permission. For written -# permission, please contact apache@apache.org. -# -# 5. Products derived from this software may not be called "Apache", -# nor may "Apache" appear in their name, without prior written -# permission of the Apache Software Foundation. -# -# THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED -# WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES -# OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE -# DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR -# ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF -# USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND -# ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, -# OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT -# OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF -# SUCH DAMAGE. -# ==================================================================== -# -# This software consists of voluntary contributions made by many -# individuals on behalf of the Apache Software Foundation. For more -# information on the Apache Software Foundation, please see -# . -# -# logresolve.pl -# -# v 1.2 by robh @ imdb.com -# -# usage: logresolve.pl outfile -# -# input = Apache/NCSA/.. logfile with IP numbers at start of lines -# output = same logfile with IP addresses resolved to hostnames where -# name lookups succeeded. -# -# this differs from the C based 'logresolve' in that this script -# spawns a number ($CHILDREN) of subprocesses to resolve addresses -# concurrently and sets a short timeout ($TIMEOUT) for each lookup in -# order to keep things moving quickly. -# -# the parent process handles caching of IP->hostnames using a Perl hash -# it also avoids sending the same IP to multiple child processes to be -# resolved multiple times concurrently. -# -# Depending on the settings of $CHILDREN and $TIMEOUT you should see -# significant reductions in the overall time taken to resolve your -# logfiles. With $CHILDREN=40 and $TIMEOUT=5 I've seen 200,000 - 300,000 -# logfile lines processed per hour compared to ~45,000 per hour -# with 'logresolve'. -# -# I haven't yet seen any noticable reduction in the percentage of IPs -# that fail to get resolved. Your mileage will no doubt vary. 5s is long -# enough to wait IMO. -# -# Known to work with FreeBSD 2.2 -# Known to have problems with Solaris -# -# 980417 - use 'sockaddr_un' for bind/connect to make the script work -# with linux. Fix from Luuk de Boer - -require 5.004; - -$|=1; - -use FileHandle; -use Socket; - -use strict; -no strict 'refs'; - -use vars qw($PROTOCOL); -$PROTOCOL = 0; - -my $CHILDREN = 40; -my $TIMEOUT = 5; - -my $filename; -my %hash = (); -my $parent = $$; - -my @children = (); -for (my $child = 1; $child <=$CHILDREN; $child++) { - my $f = fork(); - if (!$f) { - $filename = "./.socket.$parent.$child"; - if (-e $filename) { unlink($filename) || warn "$filename .. $!\n";} - &child($child); - exit(0); - } - push(@children, $f); -} - -&parent; -&cleanup; - -## remove all temporary files before shutting down -sub cleanup { - # die kiddies, die - kill(15, @children); - for (my $child = 1; $child <=$CHILDREN; $child++) { - if (-e "./.socket.$parent.$child") { - unlink("./.socket.$parent.$child") - || warn ".socket.$parent.$child $!"; - } - } -} - -sub parent { - # Trap some possible signals to trigger temp file cleanup - $SIG{'KILL'} = $SIG{'INT'} = $SIG{'PIPE'} = \&cleanup; - - my %CHILDSOCK; - my $filename; - - ## fork child processes. Each child will create a socket connection - ## to this parent and use an unique temp filename to do so. - for (my $child = 1; $child <=$CHILDREN; $child++) { - $CHILDSOCK{$child}= FileHandle->new; - - if (!socket($CHILDSOCK{$child}, AF_UNIX, SOCK_STREAM, $PROTOCOL)) { - warn "parent socket to child failed $!"; - } - $filename = "./.socket.$parent.$child"; - my $response; - do { - $response = connect($CHILDSOCK{$child}, sockaddr_un($filename)); - if ($response != 1) { - sleep(1); - } - } while ($response != 1); - $CHILDSOCK{$child}->autoflush; - } - ## All child processes should now be ready or at worst warming up - - my (@buffer, $child, $ip, $rest, $hostname, $response); - ## read the logfile lines from STDIN - while() { - @buffer = (); # empty the logfile line buffer array. - $child = 1; # children are numbered 1..N, start with #1 - - # while we have a child to talk to and data to give it.. - do { - push(@buffer, $_); # buffer the line - ($ip, $rest) = split(/ /, $_, 2); # separate IP form rest - - unless ($hash{$ip}) { # resolve if unseen IP - $CHILDSOCK{$child}->print("$ip\n"); # pass IP to next child - $hash{$ip} = $ip; # don't look it up again. - $child++; - } - } while (($child < ($CHILDREN-1)) and ($_ = )); - - ## now poll each child for a response - while (--$child > 0) { - $response = $CHILDSOCK{$child}->getline; - chomp($response); - # child sends us back both the IP and HOSTNAME, no need for us - # to remember what child received any given IP, and no worries - # what order we talk to the children - ($ip, $hostname) = split(/\|/, $response, 2); - $hash{$ip} = $hostname; - } - - # resolve all the logfiles lines held in the log buffer array.. - for (my $line = 0; $line <=$#buffer; $line++) { - # get next buffered line - ($ip, $rest) = split(/ /, $buffer[$line], 2); - # separate IP from rest and replace with cached hostname - printf STDOUT ("%s %s", $hash{$ip}, $rest); - } - } -} - -######################################## - -sub child { - # arg = numeric ID - how the parent refers to me - my $me = shift; - - # add trap for alarm signals. - $SIG{'ALRM'} = sub { die "alarmed"; }; - - # create a socket to communicate with parent - socket(INBOUND, AF_UNIX, SOCK_STREAM, $PROTOCOL) - || die "Error with Socket: !$\n"; - $filename = "./.socket.$parent.$me"; - bind(INBOUND, sockaddr_un($filename)) - || die "Error Binding $filename: $!\n"; - listen(INBOUND, 5) || die "Error Listening: $!\n"; - - my ($ip, $send_back); - my $talk = FileHandle->new; - - # accept a connection from the parent process. We only ever have - # have one connection where we exchange 1 line of info with the - # parent.. 1 line in (IP address), 1 line out (IP + hostname). - accept($talk, INBOUND) || die "Error Accepting: $!\n"; - # disable I/O buffering just in case - $talk->autoflush; - # while the parent keeps sending data, we keep responding.. - while(($ip = $talk->getline)) { - chomp($ip); - # resolve the IP if time permits and send back what we found.. - $send_back = sprintf("%s|%s", $ip, &nslookup($ip)); - $talk->print($send_back."\n"); - } -} - -# perform a time restricted hostname lookup. -sub nslookup { - # get the IP as an arg - my $ip = shift; - my $hostname = undef; - - # do the hostname lookup inside an eval. The eval will use the - # already configured SIGnal handler and drop out of the {} block - # regardless of whether the alarm occured or not. - eval { - alarm($TIMEOUT); - $hostname = gethostbyaddr(gethostbyname($ip), AF_INET); - alarm(0); - }; - if ($@ =~ /alarm/) { - # useful for debugging perhaps.. - # print "alarming, isn't it? ($ip)"; - } - - # return the hostname or the IP address itself if there is no hostname - $hostname ne "" ? $hostname : $ip; -} - - diff --git a/support/phf_abuse_log.cgi.in b/support/phf_abuse_log.cgi.in deleted file mode 100644 index 723f553bac1886793b5076782fa150920859c30b..0000000000000000000000000000000000000000 --- a/support/phf_abuse_log.cgi.in +++ /dev/null @@ -1,22 +0,0 @@ -#!@perlbin@ - -# This script is used to detect people trying to abuse the security hole which -# existed in A CGI script direstributed with Apache 1.0.3 and earlier versions. -# You can redirect them to here using the "" suggestion -# in httpd.conf. -# -# The format logged to is -# "[date] remote_addr remote_host [date] referrer user_agent". - -$LOG = "/var/log/phf_log"; - -require "ctime.pl"; -$when = &ctime(time); -$when =~ s/\n//go; -$ENV{HTTP_USER_AGENT} .= " via $ENV{HTTP_VIA}" if($ENV{HTTP_VIA}); - -open(LOG, ">>$LOG") || die "boo hoo, phf_log $!"; -print LOG "[$when] $ENV{REMOTE_ADDR} $ENV{REMOTE_HOST} $ENV{$HTTP_REFERER} $ENV{HTTP_USER_AGENT}\n"; -close(LOG); - -print "Content-type: text/html\r\n\r\nSmile, you're on Candid Camera.\n"; diff --git a/support/rotatelogs.c b/support/rotatelogs.c deleted file mode 100644 index dc6bd9772961fedb2bca79dfbc43f7e0a24a15fe..0000000000000000000000000000000000000000 --- a/support/rotatelogs.c +++ /dev/null @@ -1,82 +0,0 @@ -/* - * Simple program to rotate Apache logs without having to kill the server. - * - * Contributed by Ben Laurie - * - * 12 Mar 1996 - */ - - -#define BUFSIZE 65536 -#define MAX_PATH 1024 - -#include "ap_config.h" -#include -#include -#include - -int main (int argc, char **argv) -{ - char buf[BUFSIZE], buf2[MAX_PATH]; - time_t tLogEnd = 0; - time_t tRotation; - int nLogFD = -1; - int nRead; - char *szLogRoot; - - if (argc != 3) { - fprintf(stderr, - "%s \n\n", - argv[0]); -#ifdef OS2 - fprintf(stderr, - "Add this:\n\nTransferLog \"|%s.exe /some/where 86400\"\n\n", - argv[0]); -#else - fprintf(stderr, - "Add this:\n\nTransferLog \"|%s /some/where 86400\"\n\n", - argv[0]); -#endif - fprintf(stderr, - "to httpd.conf. The generated name will be /some/where.nnnn " - "where nnnn is the\nsystem time at which the log nominally " - "starts (N.B. this time will always be a\nmultiple of the " - "rotation time, so you can synchronize cron scripts with it).\n" - "At the end of each rotation time a new log is started.\n"); - exit(1); - } - - szLogRoot = argv[1]; - tRotation = atoi(argv[2]); - if (tRotation <= 0) { - fprintf(stderr, "Rotation time must be > 0\n"); - exit(6); - } - - for (;;) { - nRead = read(0, buf, sizeof buf); - if (nRead == 0) - exit(3); - if (nRead < 0) - if (errno != EINTR) - exit(4); - if (nLogFD >= 0 && (time(NULL) >= tLogEnd || nRead < 0)) { - close(nLogFD); - nLogFD = -1; - } - if (nLogFD < 0) { - time_t tLogStart = (time(NULL) / tRotation) * tRotation; - sprintf(buf2, "%s.%010d", szLogRoot, (int) tLogStart); - tLogEnd = tLogStart + tRotation; - nLogFD = open(buf2, O_WRONLY | O_CREAT | O_APPEND, 0666); - if (nLogFD < 0) { - perror(buf2); - exit(2); - } - } - if (write(nLogFD, buf, nRead) != nRead) { - perror(buf2); - exit(5); - } - } -} diff --git a/support/rotatelogs.dsp b/support/rotatelogs.dsp deleted file mode 100644 index 3e0209d5ccbac2379a68de570ea7c63373444845..0000000000000000000000000000000000000000 --- a/support/rotatelogs.dsp +++ /dev/null @@ -1,89 +0,0 @@ -# Microsoft Developer Studio Project File - Name="rotatelogs" - Package Owner=<4> -# Microsoft Developer Studio Generated Build File, Format Version 5.00 -# ** DO NOT EDIT ** - -# TARGTYPE "Win32 (x86) Console Application" 0x0103 - -CFG=rotatelogs - Win32 Debug -!MESSAGE This is not a valid makefile. To build this project using NMAKE, -!MESSAGE use the Export Makefile command and run -!MESSAGE -!MESSAGE NMAKE /f "rotatelogs.mak". -!MESSAGE -!MESSAGE You can specify a configuration when running NMAKE -!MESSAGE by defining the macro CFG on the command line. For example: -!MESSAGE -!MESSAGE NMAKE /f "rotatelogs.mak" CFG="rotatelogs - Win32 Debug" -!MESSAGE -!MESSAGE Possible choices for configuration are: -!MESSAGE -!MESSAGE "rotatelogs - Win32 Release" (based on\ - "Win32 (x86) Console Application") -!MESSAGE "rotatelogs - Win32 Debug" (based on\ - "Win32 (x86) Console Application") -!MESSAGE - -# Begin Project -# PROP Scc_ProjName "" -# PROP Scc_LocalPath "" -CPP=cl.exe -RSC=rc.exe - -!IF "$(CFG)" == "rotatelogs - Win32 Release" - -# PROP BASE Use_MFC 0 -# PROP BASE Use_Debug_Libraries 0 -# PROP BASE Output_Dir "Release" -# PROP BASE Intermediate_Dir "Release" -# PROP BASE Target_Dir "" -# PROP Use_MFC 0 -# PROP Use_Debug_Libraries 0 -# PROP Output_Dir "Release" -# PROP Intermediate_Dir "Release" -# PROP Target_Dir "" -# ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c -# ADD CPP /nologo /W3 /GX /O2 /I "../include" /I "../lib/apr/include" /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c -# ADD BASE RSC /l 0x409 /d "NDEBUG" -# ADD RSC /l 0x409 /d "NDEBUG" -BSC32=bscmake.exe -# ADD BASE BSC32 /nologo -# ADD BSC32 /nologo -LINK32=link.exe -# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /machine:I386 -# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /machine:I386 - -!ELSEIF "$(CFG)" == "rotatelogs - Win32 Debug" - -# PROP BASE Use_MFC 0 -# PROP BASE Use_Debug_Libraries 1 -# PROP BASE Output_Dir "Debug" -# PROP BASE Intermediate_Dir "Debug" -# PROP BASE Target_Dir "" -# PROP Use_MFC 0 -# PROP Use_Debug_Libraries 1 -# PROP Output_Dir "Debug" -# PROP Intermediate_Dir "Debug" -# PROP Target_Dir "" -# ADD BASE CPP /nologo /W3 /Gm /GX /Zi /Od /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c -# ADD CPP /nologo /W3 /Gm /GX /Zi /Od /I "../include" /I "../lib/apr/include" /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c -# ADD BASE RSC /l 0x409 /d "_DEBUG" -# ADD RSC /l 0x409 /d "_DEBUG" -BSC32=bscmake.exe -# ADD BASE BSC32 /nologo -# ADD BSC32 /nologo -LINK32=link.exe -# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept -# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept - -!ENDIF - -# Begin Target - -# Name "rotatelogs - Win32 Release" -# Name "rotatelogs - Win32 Debug" -# Begin Source File - -SOURCE=.\rotatelogs.c -# End Source File -# End Target -# End Project diff --git a/support/split-logfile.in b/support/split-logfile.in deleted file mode 100644 index 66de2ebfdd3a00e34c50d6aeed97f78247537fb8..0000000000000000000000000000000000000000 --- a/support/split-logfile.in +++ /dev/null @@ -1,98 +0,0 @@ -#!@perlbin@ -# ==================================================================== -# The Apache Software License, Version 1.1 -# -# Copyright (c) 2000-2001 The Apache Software Foundation. All rights -# reserved. -# -# Redistribution and use in source and binary forms, with or without -# modification, are permitted provided that the following conditions -# are met: -# -# 1. Redistributions of source code must retain the above copyright -# notice, this list of conditions and the following disclaimer. -# -# 2. Redistributions in binary form must reproduce the above copyright -# notice, this list of conditions and the following disclaimer in -# the documentation and/or other materials provided with the -# distribution. -# -# 3. The end-user documentation included with the redistribution, -# if any, must include the following acknowledgment: -# "This product includes software developed by the -# Apache Software Foundation (http://www.apache.org/)." -# Alternately, this acknowledgment may appear in the software itself, -# if and wherever such third-party acknowledgments normally appear. -# -# 4. The names "Apache" and "Apache Software Foundation" must -# not be used to endorse or promote products derived from this -# software without prior written permission. For written -# permission, please contact apache@apache.org. -# -# 5. Products derived from this software may not be called "Apache", -# nor may "Apache" appear in their name, without prior written -# permission of the Apache Software Foundation. -# -# THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED -# WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES -# OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE -# DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR -# ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF -# USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND -# ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, -# OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT -# OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF -# SUCH DAMAGE. -# ==================================================================== -# -# This software consists of voluntary contributions made by many -# individuals on behalf of the Apache Software Foundation. For more -# information on the Apache Software Foundation, please see -# . - -# This script will take a combined Web server access -# log file and break its contents into separate files. -# It assumes that the first field of each line is the -# virtual host identity (put there by "%v"), and that -# the logfiles should be named that+".log" in the current -# directory. -# -# The combined log file is read from stdin. Records read -# will be appended to any existing log files. -# -%is_open = (); - -while ($log_line = ) { - # - # Get the first token from the log record; it's the - # identity of the virtual host to which the record - # applies. - # - ($vhost) = split (/\s/, $log_line); - # - # Normalize the virtual host name to all lowercase. - # If it's blank, the request was handled by the default - # server, so supply a default name. This shouldn't - # happen, but caution rocks. - # - $vhost = lc ($vhost) or "access"; - # - # If the log file for this virtual host isn't opened - # yet, do it now. - # - if (! $is_open{$vhost}) { - open $vhost, ">>${vhost}.log" - or die ("Can't open ${vhost}.log"); - $is_open{$vhost} = 1; - } - # - # Strip off the first token (which may be null in the - # case of the default server), and write the edited - # record to the current log file. - # - $log_line =~ s/^\S*\s+//; - printf $vhost "%s", $log_line; -} -exit 0; diff --git a/support/suexec.c b/support/suexec.c deleted file mode 100644 index 13f3fcc134df1e08d32a5bc4bf0601ad8cea7ab2..0000000000000000000000000000000000000000 --- a/support/suexec.c +++ /dev/null @@ -1,566 +0,0 @@ -/* ==================================================================== - * Copyright (c) 1995-1999 The Apache Group. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in - * the documentation and/or other materials provided with the - * distribution. - * - * 3. All advertising materials mentioning features or use of this - * software must display the following acknowledgment: - * "This product includes software developed by the Apache Group - * for use in the Apache HTTP server project (http://www.apache.org/)." - * - * 4. The names "Apache Server" and "Apache Group" must not be used to - * endorse or promote products derived from this software without - * prior written permission. For written permission, please contact - * apache@apache.org. - * - * 5. Products derived from this software may not be called "Apache" - * nor may "Apache" appear in their names without prior written - * permission of the Apache Group. - * - * 6. Redistributions of any form whatsoever must retain the following - * acknowledgment: - * "This product includes software developed by the Apache Group - * for use in the Apache HTTP server project (http://www.apache.org/)." - * - * THIS SOFTWARE IS PROVIDED BY THE APACHE GROUP ``AS IS'' AND ANY - * EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR - * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE APACHE GROUP OR - * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT - * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, - * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED - * OF THE POSSIBILITY OF SUCH DAMAGE. - * ==================================================================== - * - * This software consists of voluntary contributions made by many - * individuals on behalf of the Apache Group and was originally based - * on public domain software written at the National Center for - * Supercomputing Applications, University of Illinois, Urbana-Champaign. - * For more information on the Apache Group and the Apache HTTP server - * project, please see . - * - */ - -/* - * suexec.c -- "Wrapper" support program for suEXEC behaviour for Apache - * - *********************************************************************** - * - * NOTE! : DO NOT edit this code!!! Unless you know what you are doing, - * editing this code might open up your system in unexpected - * ways to would-be crackers. Every precaution has been taken - * to make this code as safe as possible; alter it at your own - * risk. - * - *********************************************************************** - * - * - */ - -#include "ap_config.h" -#include -#include -#include - -#include - -#include "suexec.h" - -/* - *********************************************************************** - * There is no initgroups() in QNX, so I believe this is safe :-) - * Use cc -osuexec -3 -O -mf -DQNX suexec.c to compile. - * - * May 17, 1997. - * Igor N. Kovalenko -- infoh@mail.wplus.net - *********************************************************************** - */ - -#if defined(NEED_INITGROUPS) -int initgroups(const char *name, gid_t basegid) -{ -/* QNX and MPE do not appear to support supplementary groups. */ - return 0; -} -#endif - -#if defined(PATH_MAX) -#define AP_MAXPATH PATH_MAX -#elif defined(MAXPATHLEN) -#define AP_MAXPATH MAXPATHLEN -#else -#define AP_MAXPATH 8192 -#endif - -#define AP_ENVBUF 256 - -extern char **environ; -static FILE *log = NULL; - -char *safe_env_lst[] = -{ - "AUTH_TYPE", - "CONTENT_LENGTH", - "CONTENT_TYPE", - "DATE_GMT", - "DATE_LOCAL", - "DOCUMENT_NAME", - "DOCUMENT_PATH_INFO", - "DOCUMENT_ROOT", - "DOCUMENT_URI", - "FILEPATH_INFO", - "GATEWAY_INTERFACE", - "LAST_MODIFIED", - "PATH_INFO", - "PATH_TRANSLATED", - "QUERY_STRING", - "QUERY_STRING_UNESCAPED", - "REMOTE_ADDR", - "REMOTE_HOST", - "REMOTE_IDENT", - "REMOTE_PORT", - "REMOTE_USER", - "REDIRECT_QUERY_STRING", - "REDIRECT_STATUS", - "REDIRECT_URL", - "REQUEST_METHOD", - "REQUEST_URI", - "SCRIPT_FILENAME", - "SCRIPT_NAME", - "SCRIPT_URI", - "SCRIPT_URL", - "SERVER_ADMIN", - "SERVER_NAME", - "SERVER_ADDR", - "SERVER_PORT", - "SERVER_PROTOCOL", - "SERVER_SOFTWARE", - "UNIQUE_ID", - "USER_NAME", - "TZ", - NULL -}; - - -static void err_output(const char *fmt, va_list ap) -{ -#ifdef LOG_EXEC - time_t timevar; - struct tm *lt; - - if (!log) { - if ((log = fopen(LOG_EXEC, "a")) == NULL) { - fprintf(stderr, "failed to open log file\n"); - perror("fopen"); - exit(1); - } - } - - time(&timevar); - lt = localtime(&timevar); - - fprintf(log, "[%d-%.2d-%.2d %.2d:%.2d:%.2d]: ", - lt->tm_year + 1900, lt->tm_mon + 1, lt->tm_mday, - lt->tm_hour, lt->tm_min, lt->tm_sec); - - vfprintf(log, fmt, ap); - - fflush(log); -#endif /* LOG_EXEC */ - return; -} - -static void log_err(const char *fmt,...) -{ -#ifdef LOG_EXEC - va_list ap; - - va_start(ap, fmt); - err_output(fmt, ap); - va_end(ap); -#endif /* LOG_EXEC */ - return; -} - -static void clean_env(void) -{ - char pathbuf[512]; - char **cleanenv; - char **ep; - int cidx = 0; - int idx; - - - if ((cleanenv = (char **) calloc(AP_ENVBUF, sizeof(char *))) == NULL) { - log_err("failed to malloc memory for environment\n"); - exit(120); - } - - sprintf(pathbuf, "PATH=%s", SAFE_PATH); - cleanenv[cidx] = strdup(pathbuf); - cidx++; - - for (ep = environ; *ep && cidx < AP_ENVBUF-1; ep++) { - if (!strncmp(*ep, "HTTP_", 5)) { - cleanenv[cidx] = *ep; - cidx++; - } - else { - for (idx = 0; safe_env_lst[idx]; idx++) { - if (!strncmp(*ep, safe_env_lst[idx], - strlen(safe_env_lst[idx]))) { - cleanenv[cidx] = *ep; - cidx++; - break; - } - } - } - } - - cleanenv[cidx] = NULL; - - environ = cleanenv; -} - -int main(int argc, char *argv[]) -{ - int userdir = 0; /* ~userdir flag */ - uid_t uid; /* user information */ - gid_t gid; /* target group placeholder */ - char *target_uname; /* target user name */ - char *target_gname; /* target group name */ - char *target_homedir; /* target home directory */ - char *actual_uname; /* actual user name */ - char *actual_gname; /* actual group name */ - char *prog; /* name of this program */ - char *cmd; /* command to be executed */ - char cwd[AP_MAXPATH]; /* current working directory */ - char dwd[AP_MAXPATH]; /* docroot working directory */ - struct passwd *pw; /* password entry holder */ - struct group *gr; /* group entry holder */ - struct stat dir_info; /* directory info holder */ - struct stat prg_info; /* program info holder */ - - /* - * If there are a proper number of arguments, set - * all of them to variables. Otherwise, error out. - */ - prog = argv[0]; - if (argc < 4) { - log_err("too few arguments\n"); - exit(101); - } - target_uname = argv[1]; - target_gname = argv[2]; - cmd = argv[3]; - - /* - * Check existence/validity of the UID of the user - * running this program. Error out if invalid. - */ - uid = getuid(); - if ((pw = getpwuid(uid)) == NULL) { - log_err("invalid uid: (%ld)\n", uid); - exit(102); - } - - /* - * Check to see if the user running this program - * is the user allowed to do so as defined in - * suexec.h. If not the allowed user, error out. - */ -#ifdef _OSD_POSIX - /* User name comparisons are case insensitive on BS2000/OSD */ - if (strcasecmp(HTTPD_USER, pw->pw_name)) { - log_err("user mismatch (%s instead of %s)\n", pw->pw_name, HTTPD_USER); - exit(103); - } -#else /*_OSD_POSIX*/ - if (strcmp(HTTPD_USER, pw->pw_name)) { - log_err("user mismatch (%s instead of %s)\n", pw->pw_name, HTTPD_USER); - exit(103); - } -#endif /*_OSD_POSIX*/ - - /* - * Check for a leading '/' (absolute path) in the command to be executed, - * or attempts to back up out of the current directory, - * to protect against attacks. If any are - * found, error out. Naughty naughty crackers. - */ - if ((cmd[0] == '/') || (!strncmp(cmd, "../", 3)) - || (strstr(cmd, "/../") != NULL)) { - log_err("invalid command (%s)\n", cmd); - exit(104); - } - - /* - * Check to see if this is a ~userdir request. If - * so, set the flag, and remove the '~' from the - * target username. - */ - if (!strncmp("~", target_uname, 1)) { - target_uname++; - userdir = 1; - } - - /* - * Error out if the target username is invalid. - */ - if ((pw = getpwnam(target_uname)) == NULL) { - log_err("invalid target user name: (%s)\n", target_uname); - exit(105); - } - - /* - * Error out if the target group name is invalid. - */ - if (strspn(target_gname, "1234567890") != strlen(target_gname)) { - if ((gr = getgrnam(target_gname)) == NULL) { - log_err("invalid target group name: (%s)\n", target_gname); - exit(106); - } - gid = gr->gr_gid; - actual_gname = strdup(gr->gr_name); - } - else { - gid = atoi(target_gname); - actual_gname = strdup(target_gname); - } - -#ifdef _OSD_POSIX - /* - * Initialize BS2000 user environment - */ - { - pid_t pid; - int status; - - switch (pid = ufork(target_uname)) - { - case -1: /* Error */ - log_err("failed to setup bs2000 environment for user %s: %s\n", - target_uname, strerror(errno)); - exit(150); - case 0: /* Child */ - break; - default: /* Father */ - while (pid != waitpid(pid, &status, 0)) - ; - /* @@@ FIXME: should we deal with STOP signals as well? */ - if (WIFSIGNALED(status)) - kill (getpid(), WTERMSIG(status)); - exit(WEXITSTATUS(status)); - } - } -#endif /*_OSD_POSIX*/ - - /* - * Save these for later since initgroups will hose the struct - */ - uid = pw->pw_uid; - actual_uname = strdup(pw->pw_name); - target_homedir = strdup(pw->pw_dir); - - /* - * Log the transaction here to be sure we have an open log - * before we setuid(). - */ - log_err("uid: (%s/%s) gid: (%s/%s) cmd: %s\n", - target_uname, actual_uname, - target_gname, actual_gname, - cmd); - - /* - * Error out if attempt is made to execute as root or as - * a UID less than UID_MIN. Tsk tsk. - */ - if ((uid == 0) || (uid < UID_MIN)) { - log_err("cannot run as forbidden uid (%d/%s)\n", uid, cmd); - exit(107); - } - - /* - * Error out if attempt is made to execute as root group - * or as a GID less than GID_MIN. Tsk tsk. - */ - if ((gid == 0) || (gid < GID_MIN)) { - log_err("cannot run as forbidden gid (%d/%s)\n", gid, cmd); - exit(108); - } - - /* - * Change UID/GID here so that the following tests work over NFS. - * - * Initialize the group access list for the target user, - * and setgid() to the target group. If unsuccessful, error out. - */ - if (((setgid(gid)) != 0) || (initgroups(actual_uname, gid) != 0)) { - log_err("failed to setgid (%ld: %s)\n", gid, cmd); - exit(109); - } - - /* - * setuid() to the target user. Error out on fail. - */ - if ((setuid(uid)) != 0) { - log_err("failed to setuid (%ld: %s)\n", uid, cmd); - exit(110); - } - - /* - * Get the current working directory, as well as the proper - * document root (dependant upon whether or not it is a - * ~userdir request). Error out if we cannot get either one, - * or if the current working directory is not in the docroot. - * Use chdir()s and getcwd()s to avoid problems with symlinked - * directories. Yuck. - */ - if (getcwd(cwd, AP_MAXPATH) == NULL) { - log_err("cannot get current working directory\n"); - exit(111); - } - - if (userdir) { - if (((chdir(target_homedir)) != 0) || - ((chdir(USERDIR_SUFFIX)) != 0) || - ((getcwd(dwd, AP_MAXPATH)) == NULL) || - ((chdir(cwd)) != 0)) { - log_err("cannot get docroot information (%s)\n", target_homedir); - exit(112); - } - } - else { - if (((chdir(DOC_ROOT)) != 0) || - ((getcwd(dwd, AP_MAXPATH)) == NULL) || - ((chdir(cwd)) != 0)) { - log_err("cannot get docroot information (%s)\n", DOC_ROOT); - exit(113); - } - } - - if ((strncmp(cwd, dwd, strlen(dwd))) != 0) { - log_err("command not in docroot (%s/%s)\n", cwd, cmd); - exit(114); - } - - /* - * Stat the cwd and verify it is a directory, or error out. - */ - if (((lstat(cwd, &dir_info)) != 0) || !(S_ISDIR(dir_info.st_mode))) { - log_err("cannot stat directory: (%s)\n", cwd); - exit(115); - } - - /* - * Error out if cwd is writable by others. - */ - if ((dir_info.st_mode & S_IWOTH) || (dir_info.st_mode & S_IWGRP)) { - log_err("directory is writable by others: (%s)\n", cwd); - exit(116); - } - - /* - * Error out if we cannot stat the program. - */ - if (((lstat(cmd, &prg_info)) != 0) || (S_ISLNK(prg_info.st_mode))) { - log_err("cannot stat program: (%s)\n", cmd); - exit(117); - } - - /* - * Error out if the program is writable by others. - */ - if ((prg_info.st_mode & S_IWOTH) || (prg_info.st_mode & S_IWGRP)) { - log_err("file is writable by others: (%s/%s)\n", cwd, cmd); - exit(118); - } - - /* - * Error out if the file is setuid or setgid. - */ - if ((prg_info.st_mode & S_ISUID) || (prg_info.st_mode & S_ISGID)) { - log_err("file is either setuid or setgid: (%s/%s)\n", cwd, cmd); - exit(119); - } - - /* - * Error out if the target name/group is different from - * the name/group of the cwd or the program. - */ - if ((uid != dir_info.st_uid) || - (gid != dir_info.st_gid) || - (uid != prg_info.st_uid) || - (gid != prg_info.st_gid)) { - log_err("target uid/gid (%ld/%ld) mismatch " - "with directory (%ld/%ld) or program (%ld/%ld)\n", - uid, gid, - dir_info.st_uid, dir_info.st_gid, - prg_info.st_uid, prg_info.st_gid); - exit(120); - } - /* - * Error out if the program is not executable for the user. - * Otherwise, she won't find any error in the logs except for - * "[error] Premature end of script headers: ..." - */ - if (!(prg_info.st_mode & S_IXUSR)) { - log_err("file has no execute permission: (%s/%s)\n", cwd, cmd); - exit(121); - } - - clean_env(); - - /* - * Be sure to close the log file so the CGI can't - * mess with it. If the exec fails, it will be reopened - * automatically when log_err is called. Note that the log - * might not actually be open if LOG_EXEC isn't defined. - * However, the "log" cell isn't ifdef'd so let's be defensive - * and assume someone might have done something with it - * outside an ifdef'd LOG_EXEC block. - */ - if (log != NULL) { - fclose(log); - log = NULL; - } - - /* - * Execute the command, replacing our image with its own. - */ -#ifdef NEED_HASHBANG_EMUL - /* We need the #! emulation when we want to execute scripts */ - { - extern char **environ; - - ap_execve(cmd, &argv[3], environ); - } -#else /*NEED_HASHBANG_EMUL*/ - execv(cmd, &argv[3]); -#endif /*NEED_HASHBANG_EMUL*/ - - /* - * (I can't help myself...sorry.) - * - * Uh oh. Still here. Where's the kaboom? There was supposed to be an - * EARTH-shattering kaboom! - * - * Oh well, log the failure and error out. - */ - log_err("(%d)%s: exec failed (%s)\n", errno, strerror(errno), cmd); - exit(255); -} diff --git a/support/suexec.h b/support/suexec.h deleted file mode 100644 index 892badd1e0bd5de0d5c988f693d918cb32e3632a..0000000000000000000000000000000000000000 --- a/support/suexec.h +++ /dev/null @@ -1,143 +0,0 @@ -/* ==================================================================== - * Copyright (c) 1995-1999 The Apache Group. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in - * the documentation and/or other materials provided with the - * distribution. - * - * 3. All advertising materials mentioning features or use of this - * software must display the following acknowledgment: - * "This product includes software developed by the Apache Group - * for use in the Apache HTTP server project (http://www.apache.org/)." - * - * 4. The names "Apache Server" and "Apache Group" must not be used to - * endorse or promote products derived from this software without - * prior written permission. For written permission, please contact - * apache@apache.org. - * - * 5. Products derived from this software may not be called "Apache" - * nor may "Apache" appear in their names without prior written - * permission of the Apache Group. - * - * 6. Redistributions of any form whatsoever must retain the following - * acknowledgment: - * "This product includes software developed by the Apache Group - * for use in the Apache HTTP server project (http://www.apache.org/)." - * - * THIS SOFTWARE IS PROVIDED BY THE APACHE GROUP ``AS IS'' AND ANY - * EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR - * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE APACHE GROUP OR - * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT - * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, - * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED - * OF THE POSSIBILITY OF SUCH DAMAGE. - * ==================================================================== - * - * This software consists of voluntary contributions made by many - * individuals on behalf of the Apache Group and was originally based - * on public domain software written at the National Center for - * Supercomputing Applications, University of Illinois, Urbana-Champaign. - * For more information on the Apache Group and the Apache HTTP server - * project, please see . - * - */ - -/* - * suexec.h -- user-definable variables for the suexec wrapper code. - * (See README.configure on how to customize these variables.) - */ - - -#ifndef _SUEXEC_H -#define _SUEXEC_H - -/* - * HTTPD_USER -- Define as the username under which Apache normally - * runs. This is the only user allowed to execute - * this program. - */ -#ifndef HTTPD_USER -#define HTTPD_USER "www" -#endif - -/* - * UID_MIN -- Define this as the lowest UID allowed to be a target user - * for suEXEC. For most systems, 500 or 100 is common. - */ -#ifndef UID_MIN -#define UID_MIN 100 -#endif - -/* - * GID_MIN -- Define this as the lowest GID allowed to be a target group - * for suEXEC. For most systems, 100 is common. - */ -#ifndef GID_MIN -#define GID_MIN 100 -#endif - -/* - * USERDIR_SUFFIX -- Define to be the subdirectory under users' - * home directories where suEXEC access should - * be allowed. All executables under this directory - * will be executable by suEXEC as the user so - * they should be "safe" programs. If you are - * using a "simple" UserDir directive (ie. one - * without a "*" in it) this should be set to - * the same value. suEXEC will not work properly - * in cases where the UserDir directive points to - * a location that is not the same as the user's - * home directory as referenced in the passwd file. - * - * If you have VirtualHosts with a different - * UserDir for each, you will need to define them to - * all reside in one parent directory; then name that - * parent directory here. IF THIS IS NOT DEFINED - * PROPERLY, ~USERDIR CGI REQUESTS WILL NOT WORK! - * See the suEXEC documentation for more detailed - * information. - */ -#ifndef USERDIR_SUFFIX -#define USERDIR_SUFFIX "public_html" -#endif - -/* - * LOG_EXEC -- Define this as a filename if you want all suEXEC - * transactions and errors logged for auditing and - * debugging purposes. - */ -#ifndef LOG_EXEC -#define LOG_EXEC "/usr/local/apache/logs/cgi.log" /* Need me? */ -#endif - -/* - * DOC_ROOT -- Define as the DocumentRoot set for Apache. This - * will be the only hierarchy (aside from UserDirs) - * that can be used for suEXEC behavior. - */ -#ifndef DOC_ROOT -#define DOC_ROOT "/usr/local/apache/htdocs" -#endif - -/* - * SAFE_PATH -- Define a safe PATH environment to pass to CGI executables. - * - */ -#ifndef SAFE_PATH -#define SAFE_PATH "/usr/local/bin:/usr/bin:/bin" -#endif - -#endif /* _SUEXEC_H */ diff --git a/support/utilitiesnw.def b/support/utilitiesnw.def deleted file mode 100644 index 426b8c96be7ab6c664084af96a9b5874d1e9a315..0000000000000000000000000000000000000000 --- a/support/utilitiesnw.def +++ /dev/null @@ -1,3 +0,0 @@ -MODULE APRLIB.NLM -MODULE LIBC.NLM - diff --git a/support/win32/.cvsignore b/support/win32/.cvsignore deleted file mode 100644 index 7658ff552566d242c1e4b09b3ca2fea0551282a8..0000000000000000000000000000000000000000 --- a/support/win32/.cvsignore +++ /dev/null @@ -1,3 +0,0 @@ -Release -Debug -*.plg diff --git a/support/win32/ApacheMonitor.c b/support/win32/ApacheMonitor.c deleted file mode 100644 index 156f896abc410b2322c7e1ed5810d3f3089b2d4d..0000000000000000000000000000000000000000 --- a/support/win32/ApacheMonitor.c +++ /dev/null @@ -1,1367 +0,0 @@ -/* ==================================================================== - * The Apache Software License, Version 1.1 - * - * Copyright (c) 2000 The Apache Software Foundation. All rights - * reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in - * the documentation and/or other materials provided with the - * distribution. - * - * 3. The end-user documentation included with the redistribution, - * if any, must include the following acknowledgment: - * "This product includes software developed by the - * Apache Software Foundation (http://www.apache.org/)." - * Alternately, this acknowledgment may appear in the software itself, - * if and wherever such third-party acknowledgments normally appear. - * - * 4. The names "Apache" and "Apache Software Foundation" must - * not be used to endorse or promote products derived from this - * software without prior written permission. For written - * permission, please contact apache@apache.org. - * - * 5. Products derived from this software may not be called "Apache", - * nor may "Apache" appear in their name, without prior written - * permission of the Apache Software Foundation. - * - * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED - * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES - * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR - * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF - * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND - * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, - * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT - * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * ==================================================================== - * - * This software consists of voluntary contributions made by many - * individuals on behalf of the Apache Software Foundation. For more - * information on the Apache Software Foundation, please see - * . - * - * Portions of this software are based upon public domain software - * originally written at the National Center for Supercomputing Applications, - * University of Illinois, Urbana-Champaign. - */ - -/* ==================================================================== - * ApacheService.c Simple program to manage and monitor Apache services. - * - * Contributed by Mladen Turk - * - * 05 Aug 2001 - * ==================================================================== - */ - -#define _WIN32_WINNT 0x0400 -#ifndef STRICT -#define STRICT -#endif - -#include -#include -#include -#include -#include -#include "ApacheMonitor.h" - - -#define OS_VERSION_WINNT 1 -#define OS_VERSION_WIN9X 2 -#define OS_VERSION_WIN2K 3 -/* Should be enough */ -#define MAX_APACHE_SERVICES 128 - -#define WM_TRAYMESSAGE (WM_APP+1) -#define WM_UPDATEMESSAGE (WM_USER+1) -#define SERVICE_APACHE_RESTART 128 -#define XBITMAP 16 -#define YBITMAP 16 -#define MAX_LOADSTRING 100 - -#ifndef SERVICE_RUNS_IN_SYSTEM_PROCESS -#define SERVICE_RUNS_IN_SYSTEM_PROCESS 0x00000001 - -typedef struct _SERVICE_STATUS_PROCESS { - DWORD dwServiceType; - DWORD dwCurrentState; - DWORD dwControlsAccepted; - DWORD dwWin32ExitCode; - DWORD dwServiceSpecificExitCode; - DWORD dwCheckPoint; - DWORD dwWaitHint; - DWORD dwProcessId; - DWORD dwServiceFlags; -} SERVICE_STATUS_PROCESS, *LPSERVICE_STATUS_PROCESS; - -typedef enum _SC_STATUS_TYPE { - SC_STATUS_PROCESS_INFO = 0 -} SC_STATUS_TYPE; - -#endif - -typedef BOOL (WINAPI *QUERYSERVICESTATUSEX)(SC_HANDLE, SC_STATUS_TYPE, - LPBYTE, DWORD, LPDWORD); - -typedef struct _st_APACHE_SERVICE -{ - LPSTR szServiceName; - LPSTR szDisplayName; - LPSTR szDescription; - LPSTR szImagePath; - DWORD dwPid; -} ST_APACHE_SERVICE; - -/* Global variables */ -HINSTANCE ap_hInstance = NULL; -HWND ap_hwndAboutDlg = NULL; -TCHAR szTitle[MAX_LOADSTRING]; /* The title bar text */ -TCHAR szWindowClass[MAX_LOADSTRING]; /* Window Class Name */ -HICON ap_icoStop; -HICON ap_icoRun; -UINT ap_uiTaskbarCreated; -DWORD ap_OSVersion; -BOOL dlgAboutOn = FALSE; -BOOL dlgServiceOn = FALSE; -ST_APACHE_SERVICE ap_stServices[MAX_APACHE_SERVICES]; - -HBITMAP hbmpStart, hbmpStop; -HBITMAP hbmpPicture, hbmpOld; -HWND ap_hServiceDlg; -BOOL ap_rescanServices; -HWND ap_hServiceDlg; - - -void ap_ClearServicesSt() -{ - int i; - for (i = 0; i < MAX_APACHE_SERVICES; i++) - { - if (ap_stServices[i].szServiceName) - free(ap_stServices[i].szServiceName); - if (ap_stServices[i].szDisplayName) - free(ap_stServices[i].szDisplayName); - if (ap_stServices[i].szDescription) - free(ap_stServices[i].szDescription); - if (ap_stServices[i].szImagePath) - free(ap_stServices[i].szImagePath); - - } - ZeroMemory(ap_stServices, sizeof(ST_APACHE_SERVICE) * MAX_APACHE_SERVICES); - -} - -void ErrorMessage(DWORD dwError) -{ - LPVOID lpMsgBuf; - FormatMessage(FORMAT_MESSAGE_ALLOCATE_BUFFER | - FORMAT_MESSAGE_FROM_SYSTEM | - FORMAT_MESSAGE_IGNORE_INSERTS, - NULL, - dwError == ERROR_SUCCESS ? GetLastError() : dwError, - MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT), - (LPTSTR) &lpMsgBuf, 0, NULL); - MessageBox(NULL, (LPCTSTR)lpMsgBuf, "Error", MB_OK | MB_ICONERROR); - LocalFree(lpMsgBuf); - -} - -LPTSTR GetStringRes(int id) -{ - static TCHAR buffer[MAX_PATH]; - - buffer[0] = 0; - LoadString(GetModuleHandle (NULL), id, buffer, MAX_PATH); - return buffer; -} - -BOOL GetSystemOSVersion(LPSTR szVersion, LPDWORD dwVersion) -{ - OSVERSIONINFOEX osvi; - BOOL bOsVersionInfoEx; - char szBuff[256]; - HKEY hKey; - char szProductType[80]; - DWORD dwBufLen; - - /* - Try calling GetVersionEx using the OSVERSIONINFOEX structure. - If that fails, try using the OSVERSIONINFO structure. - */ - ZeroMemory(&osvi, sizeof(OSVERSIONINFOEX)); - osvi.dwOSVersionInfoSize = sizeof(OSVERSIONINFOEX); - - if (!(bOsVersionInfoEx = GetVersionEx((OSVERSIONINFO *) &osvi))) - { - /* If OSVERSIONINFOEX doesn't work, try OSVERSIONINFO. */ - osvi.dwOSVersionInfoSize = sizeof(OSVERSIONINFO); - if (!GetVersionEx((OSVERSIONINFO *) &osvi)) - return FALSE; - } - - switch (osvi.dwPlatformId) - { - case VER_PLATFORM_WIN32_NT: - /* Test for the product. */ - if (szVersion!= NULL) - { - if (osvi.dwMajorVersion <= 4) - strcpy(szVersion, "MS Windows NT "); - else if (osvi.dwMajorVersion == 5 && osvi.dwMinorVersion == 0) - strcpy(szVersion, "MS Windows 2000 "); - else if (osvi.dwMajorVersion == 5 && osvi.dwMinorVersion == 1) - strcpy(szVersion, "Whistler "); - /* Test for product type.*/ -#ifdef VER_VORKSTATION_NT - if (bOsVersionInfoEx) - { - if (osvi.wProductType == VER_NT_WORKSTATION) - { -#ifdef VER_SUITE_PERSONAL - if (osvi.wSuiteMask & VER_SUITE_PERSONAL) - strcat(szVersion, "Personal "); - else -#endif - strcat(szVersion, "Professional "); - } - else if (osvi.wProductType == VER_NT_SERVER) - { - if (osvi.wSuiteMask & VER_SUITE_DATACENTER) - strcat(szVersion, "DataCenter Server "); - else if (osvi.wSuiteMask & VER_SUITE_ENTERPRISE) - strcat(szVersion, "Advanced Server "); - else - strcat(szVersion, "Server "); - } - } - else - { -#endif - RegOpenKeyEx(HKEY_LOCAL_MACHINE, - "SYSTEM\\CurrentControlSet\\Control\\ProductOptions", - 0, KEY_QUERY_VALUE, &hKey); - RegQueryValueEx(hKey, "ProductType", NULL, NULL, - (LPBYTE) szProductType, &dwBufLen); - RegCloseKey(hKey); - if (lstrcmpi("WINNT", szProductType) == 0) - strcat(szVersion, "Workstation "); - if (lstrcmpi("SERVERNT", szProductType) == 0) - strcat(szVersion, "Server "); -#ifdef VER_VORKSTATION_NT - } -#endif - /* Get version, service pack (if any), and build number. */ - if (osvi.dwMajorVersion <= 4) - { - sprintf(szBuff, "version %d.%d %s (Build-%d)\n", - osvi.dwMajorVersion, - osvi.dwMinorVersion, - osvi.szCSDVersion, - osvi.dwBuildNumber & 0xFFFF); - } - else - { - sprintf(szBuff, "%s (Build-%d)\n", - osvi.szCSDVersion, - osvi.dwBuildNumber & 0xFFFF); - } - strcat(szVersion, szBuff); - } - else if (dwVersion != NULL) - { - if (osvi.dwMajorVersion <= 4) - *dwVersion = OS_VERSION_WINNT; - else if (osvi.dwMajorVersion == 5) - *dwVersion = OS_VERSION_WIN2K; - else - return FALSE; - - } - break; - - case VER_PLATFORM_WIN32_WINDOWS: - if (szVersion != NULL) - { - if (osvi.dwMajorVersion == 4 && osvi.dwMinorVersion == 0) - { - strcpy(szVersion, "MS Windows 95 "); - if (osvi.szCSDVersion[1] == 'C') - strcat(szVersion, "OSR2 "); - } - - if(osvi.dwMajorVersion == 4 && osvi.dwMinorVersion == 10) - { - strcpy(szVersion, "MS Windows 98 "); - if (osvi.szCSDVersion[1] == 'A') - strcat(szVersion, "SE "); - } - - if(osvi.dwMajorVersion == 4 && osvi.dwMinorVersion == 90) - { - strcpy(szVersion, "MS Windows Me "); - } - } - if (dwVersion != NULL) - *dwVersion = OS_VERSION_WIN9X; - - break; - - case VER_PLATFORM_WIN32s: - if (szVersion != NULL) - strcpy(szVersion, "Microsoft Win32s "); - if (dwVersion != NULL) - *dwVersion = OS_VERSION_WIN9X; - break; - default: - return FALSE; - break; - } - return TRUE; -} - -static VOID ShowNotifyIcon(HWND hWnd, DWORD dwMessage) -{ - - NOTIFYICONDATA nid; - int i = 0, n = 0; - - ZeroMemory(&nid,sizeof(nid)); - nid.cbSize = sizeof(NOTIFYICONDATA); - nid.hWnd = hWnd; - nid.uID = 0xFF; - nid.uFlags = NIF_ICON | NIF_MESSAGE | NIF_TIP; - nid.uCallbackMessage = WM_TRAYMESSAGE; - - while (ap_stServices[i].szServiceName != NULL) - { - if (ap_stServices[i].dwPid != 0) - ++n; - ++i; - } - if (dwMessage != NIM_DELETE) - { - if (n) - nid.hIcon = ap_icoRun; - else - nid.hIcon = ap_icoStop; - } - else - nid.hIcon = NULL; - - sprintf(nid.szTip, "Running: %d Services", n); - Shell_NotifyIcon(dwMessage, &nid); - -} - -void ShowTryPopupMenu(HWND hWnd) -{ - /* create popup menu */ - HMENU hMenu = CreatePopupMenu(); - POINT pt; - - if (hMenu) - { - AppendMenu(hMenu, MF_STRING, IDM_ABOUT, "&About..."); - AppendMenu(hMenu, MF_STRING, IDM_RESTORE, "&Show Services..."); - AppendMenu(hMenu, MF_SEPARATOR, 0, ""); - AppendMenu(hMenu, MF_STRING, IDM_EXIT, "&Exit..."); - - GetCursorPos(&pt); - SetForegroundWindow(NULL); - TrackPopupMenu(hMenu, TPM_LEFTALIGN|TPM_RIGHTBUTTON, pt.x, pt.y, 0, hWnd, NULL); - } -} - -BOOL CenterWindow(HWND hwndChild) -{ - RECT rChild, rWorkArea; - int wChild, hChild; - int xNew, yNew; - BOOL bResult; - - /* Get the Height and Width of the child window */ - GetWindowRect(hwndChild, &rChild); - wChild = rChild.right - rChild.left; - hChild = rChild.bottom - rChild.top; - - /* Get the limits of the 'workarea' */ - bResult = SystemParametersInfo( - SPI_GETWORKAREA, /* system parameter to query or set */ - sizeof(RECT), - &rWorkArea, - 0); - if (!bResult) { - rWorkArea.left = rWorkArea.top = 0; - rWorkArea.right = GetSystemMetrics(SM_CXSCREEN); - rWorkArea.bottom = GetSystemMetrics(SM_CYSCREEN); - } - - /* Calculate new X position, then adjust for workarea */ - xNew = (rWorkArea.right - wChild)/2; - yNew = (rWorkArea.bottom - hChild)/2; - return SetWindowPos (hwndChild, HWND_TOP, xNew, yNew, 0, 0, SWP_NOSIZE | SWP_SHOWWINDOW); -} - -static void addItem(HWND hDlg, LPSTR lpStr, HBITMAP hBmp) -{ - int nItem; - - nItem = SendMessage(hDlg, LB_ADDSTRING, 0, (LPARAM)lpStr); - SendMessage(hDlg, LB_SETITEMDATA, nItem, (LPARAM)hBmp); -} - - -BOOL RunAndForgetConsole(LPTSTR szCmdLine, - LPDWORD nRetValue, - BOOL showConsole) -{ - - - STARTUPINFO stInfo; - PROCESS_INFORMATION prInfo; - BOOL bResult; - ZeroMemory(&stInfo, sizeof(stInfo)); - stInfo.cb = sizeof(stInfo); - stInfo.dwFlags = STARTF_USESHOWWINDOW; - stInfo.wShowWindow = showConsole ? SW_SHOWNORMAL : SW_HIDE; - - bResult = CreateProcess(NULL, - szCmdLine, - NULL, - NULL, - TRUE, - CREATE_NEW_CONSOLE , - NULL, - NULL , - &stInfo, - &prInfo); - if (nRetValue) - *nRetValue = GetLastError(); - - CloseHandle(prInfo.hThread); - CloseHandle(prInfo.hProcess); - if (!bResult) - return FALSE; - else - return TRUE; -} - - -BOOL ApacheManageService(LPCSTR szServiceName, LPCSTR szImagePath, DWORD dwCommand) -{ - - CHAR szBuf[MAX_PATH]; - LPSTR sPos; - DWORD retCode; - BOOL retValue; - BOOL ntService = TRUE; - SC_HANDLE schService; - SC_HANDLE schSCManager; - SERVICE_STATUS schSStatus; - LPSTR *args; - int ticks; - - if (ap_OSVersion == OS_VERSION_WIN9X) - { - sPos = strstr(szImagePath, "-k start"); - if (sPos) - { - lstrcpyn(szBuf, szImagePath, sPos - szImagePath); - switch (dwCommand) - { - case SERVICE_CONTROL_STOP: - lstrcat(szBuf, " -k stop -n "); - break; - case SERVICE_CONTROL_CONTINUE: - lstrcat(szBuf, " -k start -n "); - break; - case SERVICE_APACHE_RESTART: - lstrcat(szBuf, " -k restart -n "); - break; - case SERVICE_CONTROL_SHUTDOWN: - lstrcat(szBuf, " -k uninstall -n "); - break; - default: - return FALSE; - } - lstrcat(szBuf, szServiceName); - } - else - return FALSE; - if (!RunAndForgetConsole(szBuf, &retCode, FALSE)) - { - ErrorMessage(retCode); - return FALSE; - } - } - else - { - sPos = strstr(szImagePath, "--ntservice"); - if (!sPos) - { - sPos = strstr(szImagePath, "-k runservice"); - ntService = FALSE; - } - if (sPos) - { - lstrcpyn(szBuf, szImagePath, sPos - szImagePath); - if (dwCommand == SERVICE_CONTROL_SHUTDOWN) - { - lstrcat(szBuf, " -k uninstall -n "); - lstrcat(szBuf, szServiceName); - if (!RunAndForgetConsole(szBuf, &retCode, FALSE)) - { - ErrorMessage(retCode); - return FALSE; - } - else - return TRUE; - } - } - else - return FALSE; - schSCManager = OpenSCManager( - NULL, - NULL, - SC_MANAGER_ALL_ACCESS - ); - if (!schSCManager) - return FALSE; - - schService = OpenService(schSCManager, szServiceName, SERVICE_ALL_ACCESS); - if (schService != NULL) - { - retValue = FALSE; - switch (dwCommand) - { - case SERVICE_CONTROL_STOP: - if(ControlService(schService, SERVICE_CONTROL_STOP, &schSStatus)) - { - Sleep(1000); - while (QueryServiceStatus(schService, &schSStatus)) - { - if (schSStatus.dwCurrentState == SERVICE_STOP_PENDING) - Sleep(1000); - else - break; - } - } - if (QueryServiceStatus(schService, &schSStatus)) - { - if(schSStatus.dwCurrentState == SERVICE_STOPPED) - retValue = TRUE; - } - break; - case SERVICE_CONTROL_CONTINUE: - args = (char **)malloc(3 * sizeof(char*)); - args[0] = szBuf; - if (ntService) - args[1] = "--ntservice"; - else - { - args[1] = "-k"; - args[2] = "runservice"; - } - if(StartService(schService, ntService ? 2 : 3, args)) - { - Sleep(1000); - while (QueryServiceStatus(schService, &schSStatus)) - { - if (schSStatus.dwCurrentState == SERVICE_START_PENDING) - Sleep(1000); - else - break; - } - } - if (QueryServiceStatus(schService, &schSStatus)) - { - if(schSStatus.dwCurrentState == SERVICE_RUNNING) - retValue = TRUE; - } - /* is this OK to do? */ - free(args); - break; - case SERVICE_APACHE_RESTART: - if(ControlService(schService, SERVICE_APACHE_RESTART, &schSStatus)) - { - ticks = 60; - while(schSStatus.dwCurrentState == SERVICE_START_PENDING) - { - Sleep(1000); - if(!QueryServiceStatus(schService, &schSStatus)) - { - CloseServiceHandle(schService); - CloseServiceHandle(schSCManager); - return FALSE; - } - if (!--ticks) - break; - } - } - if(schSStatus.dwCurrentState == SERVICE_RUNNING) - retValue = TRUE; - break; - } - CloseServiceHandle(schService); - CloseServiceHandle(schSCManager); - return retValue; - - } - else - ap_rescanServices = TRUE; - - CloseServiceHandle(schSCManager); - return FALSE; - } - - return FALSE; -} - -BOOL IsServiceRunning(LPCSTR szServiceName, LPDWORD lpdwPid) -{ - - DWORD dwPid, dwBytes; - HWND hWnd; - SC_HANDLE schService; - SC_HANDLE schSCManager; - SERVICE_STATUS schSStatus; - SERVICE_STATUS_PROCESS schSProcess; - HANDLE hAdvapi; - QUERYSERVICESTATUSEX pQueryServiceStatusEx = NULL; - - if (ap_OSVersion == OS_VERSION_WIN9X) - { - hWnd = FindWindow("ApacheWin95ServiceMonitor", szServiceName); - if (hWnd && GetWindowThreadProcessId(hWnd, &dwPid)) - { - *lpdwPid = dwPid; - return TRUE; - } - else - return FALSE; - } - else - { - - dwPid = 0; - schSCManager = OpenSCManager( - NULL, - NULL, - SC_MANAGER_ALL_ACCESS - ); - if (!schSCManager) - return FALSE; - - schService = OpenService(schSCManager, szServiceName, SERVICE_QUERY_STATUS); - if (schService != NULL) - { - if (QueryServiceStatus(schService, &schSStatus)) - { - - dwPid = schSStatus.dwCurrentState; - if (lpdwPid) - *lpdwPid = 1; - } - if (ap_OSVersion == OS_VERSION_WIN2K) - { - hAdvapi = LoadLibrary("ADVAPI32.DLL"); - if (hAdvapi != NULL) - pQueryServiceStatusEx = (QUERYSERVICESTATUSEX)GetProcAddress(hAdvapi, - "QueryServiceStatusEx"); - if (hAdvapi != NULL && pQueryServiceStatusEx != NULL) - { - if (pQueryServiceStatusEx(schService, SC_STATUS_PROCESS_INFO, - (LPBYTE)&schSProcess, sizeof(SERVICE_STATUS_PROCESS), &dwBytes)) - { - dwPid = schSProcess.dwCurrentState; - if (lpdwPid) - *lpdwPid = schSProcess.dwProcessId; - } - } - if (hAdvapi != NULL) - FreeLibrary(hAdvapi); - } - CloseServiceHandle(schService); - CloseServiceHandle(schSCManager); - return dwPid == SERVICE_RUNNING ? TRUE : FALSE; - } - else - ap_rescanServices = TRUE; - - CloseServiceHandle(schSCManager); - return FALSE; - - } - - return FALSE; -} - -BOOL FindRunningServices() -{ - int i = 0; - DWORD dwPid; - BOOL rv = FALSE; - while (ap_stServices[i].szServiceName != NULL) - { - if (!IsServiceRunning(ap_stServices[i].szServiceName, &dwPid)) - dwPid = 0; - if (ap_stServices[i].dwPid != dwPid) - rv = TRUE; - ap_stServices[i].dwPid = dwPid; - ++i; - } - return rv; -} - -BOOL GetApacheServicesStatus() -{ - - CHAR szKey[MAX_PATH]; - CHAR achKey[MAX_PATH]; - CHAR szImagePath[MAX_PATH]; - CHAR szBuf[MAX_PATH]; - - HKEY hKey, hSubKey; - DWORD retCode, rv, dwKeyType; - DWORD dwBufLen = MAX_PATH; - - int i, stPos = 0; - ap_rescanServices = FALSE; - - retCode = RegOpenKeyEx(HKEY_LOCAL_MACHINE, - "System\\CurrentControlSet\\Services\\", - 0, KEY_READ, &hKey); - if (retCode != ERROR_SUCCESS) - { - ErrorMessage(retCode); - return FALSE; - } - ap_ClearServicesSt(); - for (i = 0, retCode = ERROR_SUCCESS; retCode == ERROR_SUCCESS; i++) - { - - retCode = RegEnumKey(hKey, i, achKey, MAX_PATH); - if (retCode == ERROR_SUCCESS) - { - lstrcpy(szKey, "System\\CurrentControlSet\\Services\\"); - lstrcat(szKey, achKey); - - if (RegOpenKeyEx(HKEY_LOCAL_MACHINE, szKey, 0, - KEY_QUERY_VALUE, &hSubKey) == ERROR_SUCCESS) - { - dwBufLen = MAX_PATH; - rv = RegQueryValueEx(hSubKey, "ImagePath", NULL, - &dwKeyType, szImagePath, &dwBufLen); - - if (rv == ERROR_SUCCESS && (dwKeyType == REG_SZ || dwKeyType == REG_EXPAND_SZ) && dwBufLen) - { - lstrcpy(szBuf, szImagePath); - CharLower(szBuf); - if (strstr(szBuf, "\\apache.exe") != NULL) - { - ap_stServices[stPos].szServiceName = strdup(achKey); - ap_stServices[stPos].szImagePath = strdup(szImagePath); - dwBufLen = MAX_PATH; - if (RegQueryValueEx(hSubKey, "Description", NULL, - &dwKeyType, szBuf, &dwBufLen) == ERROR_SUCCESS) - ap_stServices[stPos].szDescription = strdup(szBuf); - - dwBufLen = MAX_PATH; - if (RegQueryValueEx(hSubKey, "DisplayName", NULL, - &dwKeyType, szBuf, &dwBufLen) == ERROR_SUCCESS) - ap_stServices[stPos].szDisplayName= strdup(szBuf); - ++stPos; - if (stPos >= MAX_APACHE_SERVICES) - retCode = !ERROR_SUCCESS; - } - } - RegCloseKey(hSubKey); - } - } - } - RegCloseKey(hKey); - FindRunningServices(); - return TRUE; -} - -LRESULT CALLBACK ServiceDlgProc(HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam) -{ - - CHAR tchBuffer[MAX_PATH]; - CHAR tsbBuffer[MAX_PATH]; - CHAR szBuf[64]; - HWND hListBox; - static HWND hStatusBar; - TEXTMETRIC tm; - int i, y; - HDC hdcMem; - LPMEASUREITEMSTRUCT lpmis; - LPDRAWITEMSTRUCT lpdis; - RECT rcBitmap; - UINT nItem; - - switch (message) - { - - case WM_INITDIALOG: - ShowWindow(hDlg, SW_HIDE); - ap_hServiceDlg = hDlg; - hbmpStart = LoadBitmap(ap_hInstance, MAKEINTRESOURCE(IDB_BMPRUN)); - hbmpStop = LoadBitmap(ap_hInstance, MAKEINTRESOURCE(IDB_BMPSTOP)); - - Button_Enable(GetDlgItem(hDlg, IDC_SSTART), FALSE); - Button_Enable(GetDlgItem(hDlg, IDC_SSTOP), FALSE); - Button_Enable(GetDlgItem(hDlg, IDC_SRESTART), FALSE); - Button_Enable(GetDlgItem(hDlg, IDC_SUNINSTALL), FALSE); - hListBox = GetDlgItem(hDlg, IDL_SERVICES); - hStatusBar = CreateStatusWindow(SBT_TOOLTIPS | WS_CHILD | WS_VISIBLE, - "", hDlg, IDC_STATBAR); - if (GetApacheServicesStatus()) - { - i = 0; - while (ap_stServices[i].szServiceName != NULL) - { - addItem(hListBox, ap_stServices[i].szDisplayName, - ap_stServices[i].dwPid == 0 ? hbmpStop : hbmpStart); - ++i; - } - } - CenterWindow(hDlg); - ShowWindow(hDlg, SW_SHOW); - SetFocus(hListBox); - SendMessage(hListBox, LB_SETCURSEL, 0, 0); - return TRUE; - break; - case WM_UPDATEMESSAGE: - hListBox = GetDlgItem(hDlg, IDL_SERVICES); - SendMessage(hListBox, LB_RESETCONTENT, 0, 0); - Button_Enable(GetDlgItem(hDlg, IDC_SSTART), FALSE); - Button_Enable(GetDlgItem(hDlg, IDC_SSTOP), FALSE); - Button_Enable(GetDlgItem(hDlg, IDC_SRESTART), FALSE); - Button_Enable(GetDlgItem(hDlg, IDC_SUNINSTALL), FALSE); - i = 0; - while (ap_stServices[i].szServiceName != NULL) - { - addItem(hListBox, ap_stServices[i].szDisplayName, - ap_stServices[i].dwPid == 0 ? hbmpStop : hbmpStart); - ++i; - } - SendMessage(hListBox, LB_SETCURSEL, 0, 0); - /* Dirty hack to bring the window to the foreground */ - SetWindowPos(hDlg, HWND_TOPMOST, 0, 0, 0, 0, - SWP_NOSIZE | SWP_NOMOVE | SWP_SHOWWINDOW); - SetWindowPos(hDlg, HWND_NOTOPMOST, 0, 0, 0, 0, - SWP_NOSIZE | SWP_NOMOVE | SWP_SHOWWINDOW); - SetFocus(hListBox); - return TRUE; - break; - case WM_MEASUREITEM: - - lpmis = (LPMEASUREITEMSTRUCT) lParam; - lpmis->itemHeight = 16; - return TRUE; - - case WM_DRAWITEM: - - lpdis = (LPDRAWITEMSTRUCT) lParam; - if (lpdis->itemID == -1) - { - break; - } - switch (lpdis->itemAction) - { - case ODA_SELECT: - case ODA_DRAWENTIRE: - hbmpPicture = (HBITMAP)SendMessage(lpdis->hwndItem, - LB_GETITEMDATA, lpdis->itemID, (LPARAM) 0); - - hdcMem = CreateCompatibleDC(lpdis->hDC); - hbmpOld = SelectObject(hdcMem, hbmpPicture); - - BitBlt(lpdis->hDC, - lpdis->rcItem.left, lpdis->rcItem.top, - lpdis->rcItem.right - lpdis->rcItem.left, - lpdis->rcItem.bottom - lpdis->rcItem.top, - hdcMem, 0, 0, SRCCOPY); - SendMessage(lpdis->hwndItem, LB_GETTEXT, - lpdis->itemID, (LPARAM) tchBuffer); - - GetTextMetrics(lpdis->hDC, &tm); - y = (lpdis->rcItem.bottom + lpdis->rcItem.top - - tm.tmHeight) / 2; - - SelectObject(hdcMem, hbmpOld); - DeleteDC(hdcMem); - - rcBitmap.left = lpdis->rcItem.left + XBITMAP; - rcBitmap.top = lpdis->rcItem.top; - rcBitmap.right = lpdis->rcItem.right; - rcBitmap.bottom = lpdis->rcItem.top + YBITMAP; - - if (lpdis->itemState & ODS_SELECTED) - { - if (hbmpPicture == hbmpStop) - { - Button_Enable(GetDlgItem(hDlg, IDC_SSTART), TRUE); - Button_Enable(GetDlgItem(hDlg, IDC_SSTOP), FALSE); - Button_Enable(GetDlgItem(hDlg, IDC_SRESTART), FALSE); - Button_Enable(GetDlgItem(hDlg, IDC_SUNINSTALL), TRUE); - - } - else if (hbmpPicture == hbmpStart) - { - Button_Enable(GetDlgItem(hDlg, IDC_SSTART), FALSE); - Button_Enable(GetDlgItem(hDlg, IDC_SSTOP), TRUE); - Button_Enable(GetDlgItem(hDlg, IDC_SRESTART), TRUE); - Button_Enable(GetDlgItem(hDlg, IDC_SUNINSTALL), FALSE); - - } - i = 0; - while (ap_stServices[i].szServiceName != NULL) - { - if (lstrcmp(ap_stServices[i].szDisplayName, tchBuffer) == 0) - { - if (ap_stServices[i].szDescription) - lstrcpy(tsbBuffer, ap_stServices[i].szDescription); - else - lstrcpy(tsbBuffer, ap_stServices[i].szImagePath); - if (ap_stServices[i].dwPid != 0) - { - if (ap_stServices[i].dwPid & 0xFF000000) - sprintf(szBuf, " PID : 0x%08X", ap_stServices[i].dwPid); - else - sprintf(szBuf, " PID : %d", ap_stServices[i].dwPid); - lstrcat(tsbBuffer, szBuf); - } - SendMessage(hStatusBar, SB_SETTEXT, 0, (LPARAM)tsbBuffer); - break; - } - ++i; - } - - SetTextColor(lpdis->hDC, GetSysColor(COLOR_HIGHLIGHTTEXT)); - SetBkColor(lpdis->hDC, GetSysColor(COLOR_HIGHLIGHT)); - FillRect(lpdis->hDC, &rcBitmap, (HBRUSH)(COLOR_HIGHLIGHTTEXT)); - } - else - { - SetTextColor(lpdis->hDC, GetSysColor(COLOR_MENUTEXT)); - SetBkColor(lpdis->hDC, GetSysColor(COLOR_WINDOW)); - FillRect(lpdis->hDC, &rcBitmap, (HBRUSH)(COLOR_WINDOW+1)); - } - TextOut(lpdis->hDC, - XBITMAP + 6, - y, - tchBuffer, - strlen(tchBuffer)); - break; - - case ODA_FOCUS: - break; - } - return TRUE; - case WM_COMMAND: - switch (LOWORD(wParam)) - { - case IDL_SERVICES: - switch (HIWORD(wParam)) - { - case LBN_DBLCLK: - GetApacheServicesStatus(); - SendMessage(hDlg, WM_UPDATEMESSAGE, 0, 0); - return TRUE; - } - break; - case IDOK: - EndDialog(hDlg, TRUE); - return TRUE; - break; - case IDC_SSTART: - Button_Enable(GetDlgItem(hDlg, IDC_SSTART), FALSE); - hListBox = GetDlgItem(hDlg, IDL_SERVICES); - nItem = SendMessage(hListBox, LB_GETCURSEL, 0, 0); - if (nItem != LB_ERR) - { - ApacheManageService(ap_stServices[nItem].szServiceName, - ap_stServices[nItem].szImagePath, - SERVICE_CONTROL_CONTINUE); - } - Button_Enable(GetDlgItem(hDlg, IDC_SSTART), TRUE); - return TRUE; - break; - case IDC_SSTOP: - Button_Enable(GetDlgItem(hDlg, IDC_SSTOP), FALSE); - hListBox = GetDlgItem(hDlg, IDL_SERVICES); - nItem = SendMessage(hListBox, LB_GETCURSEL, 0, 0); - if (nItem != LB_ERR) - { - ApacheManageService(ap_stServices[nItem].szServiceName, - ap_stServices[nItem].szImagePath, - SERVICE_CONTROL_STOP); - } - Button_Enable(GetDlgItem(hDlg, IDC_SSTOP), TRUE); - return TRUE; - break; - case IDC_SRESTART: - Button_Enable(GetDlgItem(hDlg, IDC_SRESTART), FALSE); - hListBox = GetDlgItem(hDlg, IDL_SERVICES); - nItem = SendMessage(hListBox, LB_GETCURSEL, 0, 0); - if (nItem != LB_ERR) - { - ApacheManageService(ap_stServices[nItem].szServiceName, - ap_stServices[nItem].szImagePath, - SERVICE_APACHE_RESTART); - } - Button_Enable(GetDlgItem(hDlg, IDC_SRESTART), TRUE); - return TRUE; - break; - case IDC_SUNINSTALL: - Button_Enable(GetDlgItem(hDlg, IDC_SUNINSTALL), FALSE); - hListBox = GetDlgItem(hDlg, IDL_SERVICES); - nItem = SendMessage(hListBox, LB_GETCURSEL, 0, 0); - if (nItem != LB_ERR) - { - ApacheManageService(ap_stServices[nItem].szServiceName, - ap_stServices[nItem].szImagePath, - SERVICE_CONTROL_SHUTDOWN); - } - ap_rescanServices = TRUE; - Button_Enable(GetDlgItem(hDlg, IDC_SUNINSTALL), TRUE); - return TRUE; - break; - } - break; - case WM_SIZE: - switch (LOWORD(wParam)) - { - case SIZE_MINIMIZED: - EndDialog(hDlg, TRUE); - return TRUE; - break; - } - break; - case WM_ERASEBKGND: - - break; - case WM_CLOSE: - EndDialog(hDlg, TRUE); - return TRUE; - case WM_DESTROY: - DeleteObject(hbmpStart); - DeleteObject(hbmpStop); - return TRUE; - - default: - return FALSE; - } - return FALSE; -} - -/* About Box from MS Generic Sample */ -LRESULT CALLBACK AboutDlgProc(HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam) -{ - static HFONT hfontDlg; /* Font for dialog text */ - static HFONT hFinePrint; /* Font for 'fine print' in dialog */ - DWORD dwVerInfoSize; /* Size of version information block */ - LPSTR lpVersion; /* String pointer to 'version' text */ - DWORD dwVerHnd=0; /* An 'ignored' parameter, always '0' */ - UINT uVersionLen; - WORD wRootLen; - BOOL bRetCode; - int i; - char szFullPath[256]; - char szResult[256]; - char szGetName[256]; - char szVersion[256]; - DWORD dwResult; - - switch (message) { - case WM_INITDIALOG: - ShowWindow(hDlg, SW_HIDE); - ap_hwndAboutDlg = hDlg; - - hfontDlg = CreateFont(14, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - VARIABLE_PITCH | FF_SWISS, ""); - hFinePrint = CreateFont(11, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - VARIABLE_PITCH | FF_SWISS, ""); - - CenterWindow(hDlg); - GetModuleFileName(ap_hInstance, szFullPath, sizeof(szFullPath)); - - /* Now lets dive in and pull out the version information: */ - dwVerInfoSize = GetFileVersionInfoSize(szFullPath, &dwVerHnd); - if (dwVerInfoSize) { - LPSTR lpstrVffInfo; - HANDLE hMem; - hMem = GlobalAlloc(GMEM_MOVEABLE, dwVerInfoSize); - lpstrVffInfo = GlobalLock(hMem); - GetFileVersionInfo(szFullPath, dwVerHnd, dwVerInfoSize, lpstrVffInfo); - lstrcpy(szGetName, GetStringRes(IDS_VER_INFO_LANG)); - - wRootLen = lstrlen(szGetName); /* Save this position */ - - /* Set the title of the dialog: */ - lstrcat(szGetName, "ProductName"); - bRetCode = VerQueryValue((LPVOID)lpstrVffInfo, - (LPSTR)szGetName, - (LPVOID)&lpVersion, - (UINT *)&uVersionLen); - - /* Notice order of version and string... */ - lstrcpy(szResult, "About "); - lstrcat(szResult, lpVersion); - - SetWindowText(hDlg, szResult); - - /* Walk through the dialog items that we want to replace: */ - for (i = DLG_VERFIRST; i <= DLG_VERLAST; i++) { - GetDlgItemText(hDlg, i, szResult, sizeof(szResult)); - szGetName[wRootLen] = (char)0; - lstrcat(szGetName, szResult); - uVersionLen = 0; - lpVersion = NULL; - bRetCode = VerQueryValue((LPVOID)lpstrVffInfo, - (LPSTR)szGetName, - (LPVOID)&lpVersion, - (UINT *)&uVersionLen); - - if (bRetCode && uVersionLen && lpVersion) { - /* Replace dialog item text with version info */ - lstrcpy(szResult, lpVersion); - SetDlgItemText(hDlg, i, szResult); - } - else - { - dwResult = GetLastError(); - - wsprintf(szResult, GetStringRes(IDS_VERSION_ERROR), dwResult); - SetDlgItemText(hDlg, i, szResult); - } - SendMessage(GetDlgItem(hDlg, i), WM_SETFONT, - (UINT)((i==DLG_VERLAST)?hFinePrint:hfontDlg), - TRUE); - } - - - GlobalUnlock(hMem); - GlobalFree(hMem); - - } - - SendMessage(GetDlgItem(hDlg, IDC_LABEL), WM_SETFONT, - (WPARAM)hfontDlg,(LPARAM)TRUE); - if (!GetSystemOSVersion(szVersion, NULL)) - strcpy(szVersion, "Unknown Version"); - SetWindowText(GetDlgItem(hDlg, IDC_OSVERSION), szVersion); - ShowWindow(hDlg, SW_SHOW); - return (TRUE); - - case WM_COMMAND: - if (LOWORD(wParam) == IDOK || LOWORD(wParam) == IDCANCEL) { - EndDialog(hDlg, TRUE); - DeleteObject(hfontDlg); - DeleteObject(hFinePrint); - return (TRUE); - } - break; - } - - return FALSE; -} - -VOID CALLBACK MainTimerProc(HWND hWnd, UINT uMsg, UINT idEvent, DWORD dwTime) -{ - if (ap_rescanServices) - { - GetApacheServicesStatus(); - ShowNotifyIcon(hWnd, NIM_MODIFY); - if (ap_hServiceDlg) - { - SendMessage(ap_hServiceDlg, WM_UPDATEMESSAGE, 0, 0); - - } - } - else if (FindRunningServices()) - { - ShowNotifyIcon(hWnd, NIM_MODIFY); - if (ap_hServiceDlg) - { - SendMessage(ap_hServiceDlg, WM_UPDATEMESSAGE, 0, 0); - - } - } -} - - -LRESULT CALLBACK WndProc(HWND hWnd, UINT message, - WPARAM wParam, LPARAM lParam) -{ - if (message == ap_uiTaskbarCreated) - { - /* reinstall tray icon */ - ShowNotifyIcon(hWnd, NIM_ADD); - return DefWindowProc(hWnd, message, wParam, lParam); - } - switch (message) - { - case WM_CREATE: - GetSystemOSVersion(NULL, &ap_OSVersion); - GetApacheServicesStatus(); - ShowNotifyIcon(hWnd, NIM_ADD); - SetTimer(hWnd, 10, 1000, (TIMERPROC)MainTimerProc); - ap_hServiceDlg = NULL; - break; - case WM_QUIT: - ShowNotifyIcon(hWnd, NIM_DELETE); - break; - case WM_TRAYMESSAGE: - switch(lParam) - { - case WM_LBUTTONDBLCLK: - if (!dlgServiceOn) - { - dlgServiceOn = TRUE; - DialogBox(ap_hInstance, MAKEINTRESOURCE(IDD_APSRVMON_DIALOG), - hWnd, (DLGPROC)ServiceDlgProc); - dlgServiceOn = FALSE; - ap_hServiceDlg = NULL; - } - else if (ap_hServiceDlg) - { - /* Dirty hack to bring the window to the foreground */ - SetWindowPos(ap_hServiceDlg, HWND_TOPMOST, 0, 0, 0, 0, - SWP_NOSIZE | SWP_NOMOVE | SWP_SHOWWINDOW); - SetWindowPos(ap_hServiceDlg, HWND_NOTOPMOST, 0, 0, 0, 0, - SWP_NOSIZE | SWP_NOMOVE | SWP_SHOWWINDOW); - SetFocus(ap_hServiceDlg); - } - break; - case WM_RBUTTONUP: - ShowTryPopupMenu(hWnd); - break; - } - break; - case WM_COMMAND: - switch (LOWORD(wParam)) - { - case IDM_RESTORE: - if (!dlgServiceOn) - { - dlgServiceOn = TRUE; - DialogBox(ap_hInstance, MAKEINTRESOURCE(IDD_APSRVMON_DIALOG), - hWnd, (DLGPROC)ServiceDlgProc); - dlgServiceOn = FALSE; - ap_hServiceDlg = NULL; - } - else if (ap_hServiceDlg) - SetFocus(ap_hServiceDlg); - break; - case IDM_ABOUT: - if (!dlgAboutOn) - { - dlgAboutOn = TRUE; - DialogBox(ap_hInstance, MAKEINTRESOURCE(IDD_ABOUTBOX), - hWnd, (DLGPROC)AboutDlgProc); - dlgAboutOn = FALSE; - ap_hwndAboutDlg = NULL; - } - else if (ap_hwndAboutDlg) - SetFocus(ap_hwndAboutDlg); - - break; - case IDM_EXIT: - PostQuitMessage(0); - return TRUE; - break; - } - default: - return DefWindowProc(hWnd, message, wParam, lParam); - } - - return FALSE; -} - -/* Create main invisible window */ -HWND CreateMainWindow(HINSTANCE hInstance) -{ - HWND hWnd = NULL; - WNDCLASSEX wcex; - - wcex.cbSize = sizeof(WNDCLASSEX); - - wcex.style = CS_HREDRAW | CS_VREDRAW; - wcex.lpfnWndProc = (WNDPROC)WndProc; - wcex.cbClsExtra = 0; - wcex.cbWndExtra = 0; - wcex.hInstance = hInstance; - wcex.hIcon = LoadIcon(hInstance, (LPCTSTR)IDI_APSRVMON); - wcex.hCursor = LoadCursor(NULL, IDC_ARROW); - wcex.hbrBackground = (HBRUSH)(COLOR_WINDOW+1); - wcex.lpszMenuName = (LPCSTR)IDC_APSRVMON; - wcex.lpszClassName = szWindowClass; - wcex.hIconSm = LoadIcon(wcex.hInstance, (LPCTSTR)IDI_APSMALL); - - if (RegisterClassEx(&wcex)) - { - hWnd = CreateWindow(szWindowClass, szTitle, - 0, 0, 0, 0, 0, - NULL, NULL, hInstance, NULL); - } - - return hWnd; - -} - - -int WINAPI WinMain(HINSTANCE hInstance, - HINSTANCE hPrevInstance, - LPTSTR lpCmdLine, - int nCmdShow) -{ - HWND hwnd; - MSG msg; - /* single instance mutex */ - HANDLE hMutex = CreateMutex(NULL, FALSE, "APSRVMON_MUTEX"); - if((hMutex == NULL) || (GetLastError() == ERROR_ALREADY_EXISTS)) - { - if (hMutex) - CloseHandle(hMutex); - - return 0; - } - - InitCommonControls(); - ap_hInstance = hInstance; - - LoadString(hInstance, IDS_APP_TITLE, szTitle, MAX_LOADSTRING); - LoadString(hInstance, IDC_APSRVMON, szWindowClass, MAX_LOADSTRING); - ap_icoStop = LoadIcon(hInstance, MAKEINTRESOURCE(IDI_ICOSTOP)); - ap_icoRun = LoadIcon(hInstance, MAKEINTRESOURCE(IDI_ICORUN)); - ap_uiTaskbarCreated = RegisterWindowMessage("TaskbarCreated"); - - ZeroMemory(ap_stServices, sizeof(ST_APACHE_SERVICE) * MAX_APACHE_SERVICES); - hwnd = CreateMainWindow(hInstance); - if (hwnd != NULL) - { - while (GetMessage(&msg, NULL, 0, 0) == TRUE) - { - TranslateMessage(&msg); - DispatchMessage(&msg); - } - ap_ClearServicesSt(); - } - CloseHandle(hMutex); - return 0; -} diff --git a/support/win32/ApacheMonitor.dsp b/support/win32/ApacheMonitor.dsp deleted file mode 100644 index 8699a75baaa1f34d41578822ea20ab6b14304bf7..0000000000000000000000000000000000000000 --- a/support/win32/ApacheMonitor.dsp +++ /dev/null @@ -1,143 +0,0 @@ -# Microsoft Developer Studio Project File - Name="ApacheMonitor" - Package Owner=<4> -# Microsoft Developer Studio Generated Build File, Format Version 6.00 -# ** DO NOT EDIT ** - -# TARGTYPE "Win32 (x86) Application" 0x0101 - -CFG=ApacheMonitor - Win32 Debug -!MESSAGE This is not a valid makefile. To build this project using NMAKE, -!MESSAGE use the Export Makefile command and run -!MESSAGE -!MESSAGE NMAKE /f "ApacheMonitor.mak". -!MESSAGE -!MESSAGE You can specify a configuration when running NMAKE -!MESSAGE by defining the macro CFG on the command line. For example: -!MESSAGE -!MESSAGE NMAKE /f "ApacheMonitor.mak" CFG="ApacheMonitor - Win32 Debug" -!MESSAGE -!MESSAGE Possible choices for configuration are: -!MESSAGE -!MESSAGE "ApacheMonitor - Win32 Release" (based on "Win32 (x86) Application") -!MESSAGE "ApacheMonitor - Win32 Debug" (based on "Win32 (x86) Application") -!MESSAGE - -# Begin Project -# PROP AllowPerConfigDependencies 0 -# PROP Scc_ProjName "" -# PROP Scc_LocalPath "" -CPP=cl.exe -MTL=midl.exe -RSC=rc.exe - -!IF "$(CFG)" == "ApacheMonitor - Win32 Release" - -# PROP BASE Use_MFC 0 -# PROP BASE Use_Debug_Libraries 0 -# PROP BASE Output_Dir "Release" -# PROP BASE Intermediate_Dir "Release" -# PROP BASE Target_Dir "" -# PROP Use_MFC 0 -# PROP Use_Debug_Libraries 0 -# PROP Output_Dir "Release" -# PROP Intermediate_Dir "Release" -# PROP Ignore_Export_Lib 0 -# PROP Target_Dir "" -# ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /FD /c -# ADD CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /Fd"Release/ApacheMonitor" /FD /c -# ADD BASE MTL /nologo /D "NDEBUG" /mktyplib203 /o NUL /win32 -# ADD MTL /nologo /D "NDEBUG" /mktyplib203 /o NUL /win32 -# ADD BASE RSC /l 0x409 /d "NDEBUG" -# ADD RSC /l 0x409 /d "NDEBUG" -BSC32=bscmake.exe -# ADD BASE BSC32 /nologo -# ADD BSC32 /nologo -LINK32=link.exe -# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:windows /machine:I386 -# ADD LINK32 kernel32.lib user32.lib gdi32.lib advapi32.lib comctl32.lib shell32.lib version.lib /nologo /subsystem:windows /map /machine:I386 - -!ELSEIF "$(CFG)" == "ApacheMonitor - Win32 Debug" - -# PROP BASE Use_MFC 0 -# PROP BASE Use_Debug_Libraries 1 -# PROP BASE Output_Dir "Debug" -# PROP BASE Intermediate_Dir "Debug" -# PROP BASE Target_Dir "" -# PROP Use_MFC 0 -# PROP Use_Debug_Libraries 1 -# PROP Output_Dir "Debug" -# PROP Intermediate_Dir "Debug" -# PROP Ignore_Export_Lib 0 -# PROP Target_Dir "" -# ADD BASE CPP /nologo /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /FD /c -# ADD CPP /nologo /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /Fd"Debug/ApacheMonitor" /FD /c -# ADD BASE MTL /nologo /D "_DEBUG" /mktyplib203 /o NUL /win32 -# ADD MTL /nologo /D "_DEBUG" /mktyplib203 /o NUL /win32 -# ADD BASE RSC /l 0x409 /d "_DEBUG" -# ADD RSC /l 0x409 /d "_DEBUG" -BSC32=bscmake.exe -# ADD BASE BSC32 /nologo -# ADD BSC32 /nologo -LINK32=link.exe -# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:windows /debug /machine:I386 -# ADD LINK32 kernel32.lib user32.lib gdi32.lib advapi32.lib comctl32.lib shell32.lib version.lib /nologo /subsystem:windows /incremental:no /debug /machine:I386 -# SUBTRACT LINK32 /pdb:none - -!ENDIF - -# Begin Target - -# Name "ApacheMonitor - Win32 Release" -# Name "ApacheMonitor - Win32 Debug" -# Begin Group "Resource Files" - -# PROP Default_Filter "*.rc,*.ico,*.bmp" -# Begin Source File - -SOURCE=.\apache_header.bmp -# End Source File -# Begin Source File - -SOURCE=.\ApacheMonitor.ico -# End Source File -# Begin Source File - -SOURCE=.\ApacheMonitor.rc - -!IF "$(CFG)" == "ApacheMonitor - Win32 Release" - -!ELSEIF "$(CFG)" == "ApacheMonitor - Win32 Debug" - -!ENDIF - -# End Source File -# Begin Source File - -SOURCE=.\aprun.ico -# End Source File -# Begin Source File - -SOURCE=.\apsmall.ico -# End Source File -# Begin Source File - -SOURCE=.\apsrvmon.ico -# End Source File -# Begin Source File - -SOURCE=.\apstop.ico -# End Source File -# Begin Source File - -SOURCE=.\srun.bmp -# End Source File -# Begin Source File - -SOURCE=.\sstop.bmp -# End Source File -# End Group -# Begin Source File - -SOURCE=.\ApacheMonitor.c -# End Source File -# End Target -# End Project diff --git a/support/win32/ApacheMonitor.h b/support/win32/ApacheMonitor.h deleted file mode 100644 index 4bdfc15914d6f08e3ded8bffe8ece841f9b04639..0000000000000000000000000000000000000000 --- a/support/win32/ApacheMonitor.h +++ /dev/null @@ -1,49 +0,0 @@ -//{{NO_DEPENDENCIES}} -// Microsoft Developer Studio generated include file. -// Used by ApSrvmon.rc -// -#define IDD_APSRVMON_DIALOG 101 -#define IDD_ABOUTBOX 102 -#define IDS_APP_TITLE 103 -#define IDM_RESTORE 104 -#define IDM_ABOUT 105 -#define IDM_EXIT 106 -#define IDI_APSRVMONM 107 -#define IDI_APSRVMON 108 -#define IDI_APSMALL 109 -#define IDC_APSRVMON 110 -#define IDS_VERSION_ERROR 111 -#define IDS_VER_INFO_LANG 112 -#define IDR_MAINFRAME 128 -#define IDI_ICOSTOP 129 -#define IDI_ICORUN 130 -#define IDC_STATBAR 134 -#define DLG_VERFIRST 140 -#define IDC_COMPANY 140 -#define IDC_FILEDESC 141 -#define IDC_PRODVER 142 -#define IDC_COPYRIGHT 143 -#define IDC_OSVERSION 144 -#define IDC_TRADEMARK 145 -#define DLG_VERLAST 145 -#define IDC_LABEL 146 -#define IDB_BMPSTOP 155 -#define IDB_BMPRUN 156 -#define IDB_BMPHEADER 158 -#define IDL_SERVICES 1003 -#define IDC_SSTART 1004 -#define IDC_SSTOP 1005 -#define IDC_SRESTART 1006 -#define IDC_SUNINSTALL 1008 -#define IDC_STATIC -1 - -// Next default values for new objects -// -#ifdef APSTUDIO_INVOKED -#ifndef APSTUDIO_READONLY_SYMBOLS -#define _APS_NEXT_RESOURCE_VALUE 159 -#define _APS_NEXT_COMMAND_VALUE 32771 -#define _APS_NEXT_CONTROL_VALUE 1009 -#define _APS_NEXT_SYMED_VALUE 110 -#endif -#endif diff --git a/support/win32/ApacheMonitor.ico b/support/win32/ApacheMonitor.ico deleted file mode 100644 index cd28dc520c46b6b6bae3d12fd47d6084b98702e9..0000000000000000000000000000000000000000 Binary files a/support/win32/ApacheMonitor.ico and /dev/null differ diff --git a/support/win32/apache_header.bmp b/support/win32/apache_header.bmp deleted file mode 100644 index 7b116fc3da78e14ad8201a54dfde24f841c8e04b..0000000000000000000000000000000000000000 Binary files a/support/win32/apache_header.bmp and /dev/null differ diff --git a/support/win32/aprun.ico b/support/win32/aprun.ico deleted file mode 100644 index dbd5832602c12e8f93302e77f88703cb42a060d6..0000000000000000000000000000000000000000 Binary files a/support/win32/aprun.ico and /dev/null differ diff --git a/support/win32/apstop.ico b/support/win32/apstop.ico deleted file mode 100644 index fba49ad2926b971d17f3454d2b8d70a365b4083f..0000000000000000000000000000000000000000 Binary files a/support/win32/apstop.ico and /dev/null differ diff --git a/support/win32/srun.bmp b/support/win32/srun.bmp deleted file mode 100644 index 90ecd46f178a3444a81a1ef511b643d5b1400a3e..0000000000000000000000000000000000000000 Binary files a/support/win32/srun.bmp and /dev/null differ diff --git a/support/win32/sstop.bmp b/support/win32/sstop.bmp deleted file mode 100644 index ba73d87aecb8d15cf2270fa70d185c05e980234d..0000000000000000000000000000000000000000 Binary files a/support/win32/sstop.bmp and /dev/null differ diff --git a/support/win32/wintty.c b/support/win32/wintty.c deleted file mode 100644 index 28c5979cce081a3ea5657373f3ea3b96f9590daa..0000000000000000000000000000000000000000 --- a/support/win32/wintty.c +++ /dev/null @@ -1,328 +0,0 @@ -/* ==================================================================== - * The Apache Software License, Version 1.1 - * - * Copyright (c) 2000-2001 The Apache Software Foundation. All rights - * reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in - * the documentation and/or other materials provided with the - * distribution. - * - * 3. The end-user documentation included with the redistribution, - * if any, must include the following acknowledgment: - * "This product includes software developed by the - * Apache Software Foundation (http://www.apache.org/)." - * Alternately, this acknowledgment may appear in the software itself, - * if and wherever such third-party acknowledgments normally appear. - * - * 4. The names "Apache" and "Apache Software Foundation" must - * not be used to endorse or promote products derived from this - * software without prior written permission. For written - * permission, please contact apache@apache.org. - * - * 5. Products derived from this software may not be called "Apache", - * nor may "Apache" appear in their name, without prior written - * permission of the Apache Software Foundation. - * - * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED - * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES - * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR - * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF - * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND - * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, - * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT - * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * ==================================================================== - */ - -/* -------------------------------------------------------------------- - * - * wintty : a Apache/WinNT support utility for monitoring and - * reflecting user feedback from the Apache process via - * stdin/stdout, even as running within the service context. - * - * Originally contributed by William Rowe - * - * Note: this implementation is _very_ experimental, and error handling - * is far from complete. Using it as a cgi or pipe process allows the - * programmer to discover if facilities such as reliable piped logs - * are working as expected, or answer operator prompts that would - * otherwise be discarded by the service process. - * - * Also note the isservice detection semantics, which far exceed any - * mechanism we have discovered thus far. - * - * -------------------------------------------------------------------- - */ - -#define WIN32_LEAN_AND_MEAN -#include - -const char *options = -"Syntax: wintty [opts] [-?]\n\n" -" opts: -c{haracter} or -l{ine} input\n" -"\t-q{uiet} or -e{cho} input\n" -"\topts: -u{nprocessed} or -p{rocessed} input\n" -"\topts: -n{owrap} or -w{rap} output lines\n" -"\topts: -f{ormatted} or -r{aw} output lines\n" -"\topts: -v{erbose} error checking\n" -"\topts: -? for this message\n\n"; - -HANDLE herrout; -BOOL verbose = FALSE; - -void printerr(char *fmt, ...) -{ - char str[1024]; - va_list args; - DWORD len; - if (!verbose) - return; - va_start(args, fmt); - wvsprintf(str, fmt, args); - WriteFile(herrout, str, len = strlen(str), &len, NULL); -} - -DWORD WINAPI feedback(LPVOID pipeout); - -int main(int argc, char** argv) -{ - char str[1024], *contitle; - HANDLE hproc, thread; - HANDLE hwinsta, hsavewinsta; - HANDLE hdesk, hsavedesk; - HANDLE conin, conout; - HANDLE pipein, pipeout; - HANDLE hstdin, hstdout, hstderr; - DWORD conmode; - DWORD newinmode = 0, notinmode = 0; - DWORD newoutmode = 0, notoutmode = 0; - DWORD tid; - DWORD len; - BOOL isservice = FALSE; - - while (--argc) { - ++argv; - if (**argv == '/' || **argv == '-') { - switch (tolower((*argv)[1])) { - case 'c': - notinmode |= ENABLE_LINE_INPUT; break; - case 'l': - newinmode |= ENABLE_LINE_INPUT; break; - case 'q': - notinmode |= ENABLE_ECHO_INPUT; break; - case 'e': - newinmode |= ENABLE_ECHO_INPUT; break; - case 'u': - notinmode |= ENABLE_PROCESSED_INPUT; break; - case 'p': - newinmode |= ENABLE_PROCESSED_INPUT; break; - case 'n': - notoutmode |= ENABLE_WRAP_AT_EOL_OUTPUT; break; - case 'w': - newoutmode |= ENABLE_WRAP_AT_EOL_OUTPUT; break; - case 'r': - notoutmode |= ENABLE_PROCESSED_OUTPUT; break; - case 'f': - newoutmode |= ENABLE_PROCESSED_OUTPUT; break; - case 'v': - verbose = TRUE; - break; - case 't': - contitle = *(++argv); - --argc; - break; - case '?': - printf(options); - exit(1); - default: - printf("wintty option %s not recognized, use -? for help.\n\n", *argv); - exit(1); - } - } - else { - printf("wintty argument %s not understood, use -? for help.\n\n", *argv); - exit(1); - } - } - - hproc = GetCurrentProcess(); - herrout = hstderr = GetStdHandle(STD_ERROR_HANDLE); - if (!hstderr || hstderr == INVALID_HANDLE_VALUE) { - printerr("GetStdHandle(STD_ERROR_HANDLE) failed (%d)\n", GetLastError()); - } - else if (!DuplicateHandle(hproc, hstderr, - hproc, &herrout, 0, FALSE, - DUPLICATE_CLOSE_SOURCE | DUPLICATE_SAME_ACCESS)) { - printerr("DupHandle(stderr) failed (%d)\n", GetLastError()); - } - - hstdin = GetStdHandle(STD_INPUT_HANDLE); - if (!hstdin || hstdin == INVALID_HANDLE_VALUE) { - printerr("GetStdHandle(STD_INPUT_HANDLE) failed (%d)\n", GetLastError()); - } - else if (!DuplicateHandle(hproc, hstdin, - hproc, &pipein, 0, FALSE, - DUPLICATE_CLOSE_SOURCE | DUPLICATE_SAME_ACCESS)) { - printerr("DupHandle(stdin) failed (%d)\n", GetLastError()); - } - - hstdout = GetStdHandle(STD_OUTPUT_HANDLE); - if (!hstdout || hstdout == INVALID_HANDLE_VALUE) { - printerr("GetStdHandle(STD_OUTPUT_HANDLE) failed (%d)\n", GetLastError()); - } - else if (!DuplicateHandle(hproc, hstdout, - hproc, &pipeout, 0, FALSE, - DUPLICATE_CLOSE_SOURCE | DUPLICATE_SAME_ACCESS)) { - printerr("DupHandle(stdout) failed (%d)\n", GetLastError()); - } - - hsavewinsta = GetProcessWindowStation(); - if (!hsavewinsta || hsavewinsta == INVALID_HANDLE_VALUE) { - printerr("GetProcWinSta() failed (%d)\n", GetLastError()); - } - else if (!GetUserObjectInformation(hsavewinsta, UOI_NAME, str, sizeof(str), &len)) { - printerr("GetUserObjectInfo(GetProcWinSta) failed (%d)\n", GetLastError()); - CloseHandle(hsavewinsta); - } - else if (strnicmp(str, "Service-", 8) == 0) { - isservice = TRUE; - } - else - CloseHandle(hsavewinsta); - SetLastError(0); - - if (!FreeConsole()) - printerr("DupHandle(stdout) failed (%d)\n", GetLastError()); - - if (isservice) { - hwinsta = OpenWindowStation("WinSta0", TRUE, - WINSTA_ACCESSCLIPBOARD - | WINSTA_ACCESSGLOBALATOMS - | WINSTA_ENUMDESKTOPS - | WINSTA_ENUMERATE - | WINSTA_READATTRIBUTES - | WINSTA_READSCREEN - | WINSTA_WRITEATTRIBUTES); - if (!hwinsta || hwinsta == INVALID_HANDLE_VALUE) { - printerr("OpenWinSta(WinSta0) failed (%d)\n", GetLastError()); - } - else if (!SetProcessWindowStation(hwinsta)) { - printerr("SetProcWinSta(WinSta0) failed (%d)\n", GetLastError()); - } - hsavedesk = GetThreadDesktop(GetCurrentThreadId()); - hdesk = OpenDesktop("Default", 0, TRUE, - DESKTOP_READOBJECTS - | DESKTOP_CREATEWINDOW - | DESKTOP_CREATEMENU - | DESKTOP_HOOKCONTROL - | DESKTOP_JOURNALRECORD - | DESKTOP_JOURNALPLAYBACK - | DESKTOP_ENUMERATE - | DESKTOP_WRITEOBJECTS); - if (!hdesk || hdesk == INVALID_HANDLE_VALUE) { - printerr("OpenDesktop(Default) failed (%d)\n", GetLastError()); - } - else if (!SetThreadDesktop(hdesk)) { - printerr("SetThreadDesktop(Default) failed (%d)\n", GetLastError()); - } - } - - if (!AllocConsole()) { - printerr("AllocConsole(Default) failed (%d)\n", GetLastError()); - } - - if (contitle && !SetConsoleTitle(contitle)) { - printerr("SetConsoleTitle() failed (%d)\n", GetLastError()); - } - - conout = GetStdHandle(STD_OUTPUT_HANDLE); - if (!conout || conout == INVALID_HANDLE_VALUE) { - printerr("GetStdHandle(STD_OUTPUT_HANDLE) failed (%d)\n", GetLastError()); - } - else if (!GetConsoleMode(conout, &conmode)) { - printerr("GetConsoleMode(CONOUT) failed (%d)\n", GetLastError()); - } - else if (!SetConsoleMode(conout, conmode = ((conmode | newoutmode) & ~notoutmode))) { - printerr("SetConsoleMode(CONOUT, 0x%x) failed (%d)\n", conmode, GetLastError()); - } - - conin = GetStdHandle(STD_INPUT_HANDLE); - if (!conin || conin == INVALID_HANDLE_VALUE) { - printerr("GetStdHandle(STD_INPUT_HANDLE) failed (%d)\n", GetLastError()); - } - else if (!GetConsoleMode(conin, &conmode)) { - printerr("GetConsoleMode(CONOUT) failed (%d)\n", GetLastError()); - } - else if (!SetConsoleMode(conin, conmode = ((conmode | newinmode) & ~notinmode))) { - printerr("SetConsoleMode(CONIN, 0x%x) failed (%d)\n", conmode, GetLastError()); - } - - thread = CreateThread(NULL, 0, feedback, (LPVOID)pipeout, 0, &tid); - - while (ReadFile(pipein, str, sizeof(str), &len, NULL)) - if (!len || !WriteFile(conout, str, len, &len, NULL)) - break; - - printerr("[EOF] from stdin (%d)\n", GetLastError()); - - CloseHandle(pipeout); - if (!GetConsoleTitle(str, sizeof(str))) { - printerr("SetConsoleTitle() failed (%d)\n", GetLastError()); - } - else { - strcat(str, " - [Finished]"); - if (!SetConsoleTitle(str)) { - printerr("SetConsoleTitle() failed (%d)\n", GetLastError()); - } - } - - WaitForSingleObject(thread, INFINITE); - FreeConsole(); - CloseHandle(herrout); - if (isservice) { - if (!SetProcessWindowStation(hsavewinsta)) { - len = GetLastError(); - } - if (!SetThreadDesktop(hsavedesk)) { - len = GetLastError(); - } - CloseDesktop(hdesk); - CloseWindowStation(hwinsta); - } - return 0; -} - - -DWORD WINAPI feedback(LPVOID arg) -{ - HANDLE conin; - HANDLE pipeout = (HANDLE)arg; - char *str[1024]; - DWORD len; - - conin = GetStdHandle(STD_INPUT_HANDLE); - if (!conin) { - len = GetLastError(); - } - - while (ReadFile(conin, str, sizeof(str), &len, NULL)) - if (!len || !WriteFile(pipeout, str, len, &len, NULL)) - break; - - printerr("[EOF] from Console (%d)\n", GetLastError()); - - return 0; -} diff --git a/support/win32/wintty.dsp b/support/win32/wintty.dsp deleted file mode 100644 index bf62b5e80c1aaf9ce6c83f5908039762aa28d787..0000000000000000000000000000000000000000 --- a/support/win32/wintty.dsp +++ /dev/null @@ -1,90 +0,0 @@ -# Microsoft Developer Studio Project File - Name="wintty" - Package Owner=<4> -# Microsoft Developer Studio Generated Build File, Format Version 6.00 -# ** DO NOT EDIT ** - -# TARGTYPE "Win32 (x86) Console Application" 0x0103 - -CFG=wintty - Win32 Debug -!MESSAGE This is not a valid makefile. To build this project using NMAKE, -!MESSAGE use the Export Makefile command and run -!MESSAGE -!MESSAGE NMAKE /f "wintty.mak". -!MESSAGE -!MESSAGE You can specify a configuration when running NMAKE -!MESSAGE by defining the macro CFG on the command line. For example: -!MESSAGE -!MESSAGE NMAKE /f "wintty.mak" CFG="wintty - Win32 Debug" -!MESSAGE -!MESSAGE Possible choices for configuration are: -!MESSAGE -!MESSAGE "wintty - Win32 Release" (based on "Win32 (x86) Console Application") -!MESSAGE "wintty - Win32 Debug" (based on "Win32 (x86) Console Application") -!MESSAGE - -# Begin Project -# PROP AllowPerConfigDependencies 0 -# PROP Scc_ProjName "" -# PROP Scc_LocalPath "" -CPP=cl.exe -RSC=rc.exe - -!IF "$(CFG)" == "wintty - Win32 Release" - -# PROP BASE Use_MFC 0 -# PROP BASE Use_Debug_Libraries 0 -# PROP BASE Output_Dir "Release" -# PROP BASE Intermediate_Dir "Release" -# PROP BASE Target_Dir "" -# PROP Use_MFC 0 -# PROP Use_Debug_Libraries 0 -# PROP Output_Dir "Release" -# PROP Intermediate_Dir "Release" -# PROP Ignore_Export_Lib 0 -# PROP Target_Dir "" -# ADD BASE CPP /nologo /MD /W3 /O2 /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /D "APR_DECLARE_STATIC" /D "APU_DECLARE_STATIC" /FD /c -# ADD CPP /nologo /MD /W3 /O2 /I "../srclib/apr/include" /I "../srclib/apr-util/include" /D "NDEBUG" /D "WIN32" /D "_CONSOLE" /D "APR_DECLARE_STATIC" /D "APU_DECLARE_STATIC" /Fd"Release/wintty" /FD /c -# ADD BASE RSC /l 0x409 /d "NDEBUG" -# ADD RSC /l 0x409 /d "NDEBUG" -BSC32=bscmake.exe -# ADD BASE BSC32 /nologo -# ADD BSC32 /nologo -LINK32=link.exe -# ADD BASE LINK32 kernel32.lib user32.lib advapi32.lib /nologo /subsystem:console /incremental:no /map /machine:I386 -# ADD LINK32 kernel32.lib user32.lib advapi32.lib /nologo /subsystem:console /incremental:no /map /machine:I386 - -!ELSEIF "$(CFG)" == "wintty - Win32 Debug" - -# PROP BASE Use_MFC 0 -# PROP BASE Use_Debug_Libraries 1 -# PROP BASE Output_Dir "Debug" -# PROP BASE Intermediate_Dir "Debug" -# PROP BASE Target_Dir "" -# PROP Use_MFC 0 -# PROP Use_Debug_Libraries 1 -# PROP Output_Dir "Debug" -# PROP Intermediate_Dir "Debug" -# PROP Ignore_Export_Lib 0 -# PROP Target_Dir "" -# ADD BASE CPP /nologo /MDd /W3 /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /D "APR_DECLARE_STATIC" /D "APU_DECLARE_STATIC" /FD /c -# ADD CPP /nologo /MDd /W3 /GX /ZI /Od /I "../srclib/apr/include" /I "../srclib/apr-util/include" /D "_DEBUG" /D "WIN32" /D "_CONSOLE" /D "APR_DECLARE_STATIC" /D "APU_DECLARE_STATIC" /Fd"Debug/wintty" /FD /c -# ADD BASE RSC /l 0x409 /d "_DEBUG" -# ADD RSC /l 0x409 /d "_DEBUG" -BSC32=bscmake.exe -# ADD BASE BSC32 /nologo -# ADD BSC32 /nologo -LINK32=link.exe -# ADD BASE LINK32 kernel32.lib user32.lib advapi32.lib /nologo /subsystem:console /incremental:no /map /debug /machine:I386 -# ADD LINK32 kernel32.lib user32.lib advapi32.lib /nologo /subsystem:console /incremental:no /map /debug /machine:I386 - -!ENDIF - -# Begin Target - -# Name "wintty - Win32 Release" -# Name "wintty - Win32 Debug" -# Begin Source File - -SOURCE=.\wintty.c -# End Source File -# End Target -# End Project diff --git a/test/.cvsignore b/test/.cvsignore deleted file mode 100644 index e2244a438e60537239c6465d7d954e9ecfe0aa28..0000000000000000000000000000000000000000 --- a/test/.cvsignore +++ /dev/null @@ -1,11 +0,0 @@ -a.out -time-FCNTL -time-FLOCK -time-SYSVSEM -time-SYSVSEM2 -time-PTHREAD -time-USLOCK -zb -test-writev -test_date -test_select diff --git a/test/.indent.pro b/test/.indent.pro deleted file mode 100644 index a9fbe9f9a1f2e6e7bcc54171c215bdacd44171ba..0000000000000000000000000000000000000000 --- a/test/.indent.pro +++ /dev/null @@ -1,54 +0,0 @@ --i4 -npsl -di0 -br -nce -d0 -cli0 -npcs -nfc1 --TBUFF --TFILE --TTRANS --TUINT4 --T_trans --Tallow_options_t --Tapache_sfio --Tarray_header --Tbool_int --Tbuf_area --Tbuff_struct --Tbuffy --Tcmd_how --Tcmd_parms --Tcommand_rec --Tcommand_struct --Tconn_rec --Tcore_dir_config --Tcore_server_config --Tdir_maker_func --Tevent --Tglobals_s --Thandler_func --Thandler_rec --Tjoblist_s --Tlisten_rec --Tmerger_func --Tmode_t --Tmodule --Tmodule_struct --Tmutex --Tn_long --Tother_child_rec --Toverrides_t --Tparent_score --Tpid_t --Tpiped_log --Tpool --Trequest_rec --Trequire_line --Trlim_t --Tscoreboard --Tsemaphore --Tserver_addr_rec --Tserver_rec --Tserver_rec_chain --Tshort_score --Ttable --Ttable_entry --Tthread --Tu_wide_int --Tvtime_t --Twide_int diff --git a/test/Makefile.in b/test/Makefile.in deleted file mode 100644 index e7770f7fbb9278f6b5ad688c8dcbf5c8b3c4083f..0000000000000000000000000000000000000000 --- a/test/Makefile.in +++ /dev/null @@ -1,15 +0,0 @@ - -PROGRAMS = dbu -targets = $(PROGRAMS) - -PROGRAM_LDADD = $(EXTRA_LDFLAGS) $(PROGRAM_DEPENDENCIES) $(EXTRA_LIBS) -PROGRAM_DEPENDENCIES = ../ap/libap.la \ - ../lib/aputil/libaputil.la \ - ../lib/sdbm/libsdbm.la \ - ../lib/apr/$(LIBPRE)apr.a - -include $(top_srcdir)/build/rules.mk - -dbu_OBJECTS = dbu.lo -dbu: $(dbu_OBJECTS) - $(LINK) $(dbu_OBJECTS) $(PROGRAM_LDADD) diff --git a/test/README b/test/README deleted file mode 100644 index 9f8be502b88fc0747e899de5757b8fe986908203..0000000000000000000000000000000000000000 --- a/test/README +++ /dev/null @@ -1,3 +0,0 @@ -This directory contains useful test code for testing various bits -of Apache functionality. This stuff is for the developers only, -so we might remove it on public releases. diff --git a/test/check_chunked b/test/check_chunked deleted file mode 100644 index 6a121672113ee584444fd31848d87e8b115ce539..0000000000000000000000000000000000000000 --- a/test/check_chunked +++ /dev/null @@ -1,42 +0,0 @@ -#!/usr/bin/perl -w - -# This is meant to be used on the raw output of an HTTP/1.1 connection -# to check that the chunks are all correctly laid out. It's easiest -# to use a tool like netcat to generate the output. This script -# *insists* that \r exist in the output. -# -# You can find netcat at avian.org:/src/hacks/nc110.tgz. - -use strict; - -my $is_chunked = 0; - -# must toss headers -while(<>) { - if (/^Transfer-Encoding:\s+chunked/i) { - $is_chunked = 1; - } - last if ($_ eq "\r\n"); -} - -$is_chunked || die "wasn't chunked\n"; - -for(;;) { - $_ = <> || die "unexpected end of file!\n"; - - m#^([0-9a-f]+) *\r$#i || die "bogus chunklen: $_"; - - my $chunklen = hex($1); - - exit 0 if ($chunklen == 0); - - chop; chop; - print "$_ "; - - my $data = ''; - read(ARGV, $data, $chunklen) == $chunklen || die "short read!\n"; - - $_ = <> || die "unexpected end of file!\n"; - - $_ eq "\r\n" || die "missing chunk trailer!\n"; -} diff --git a/test/cls.c b/test/cls.c deleted file mode 100644 index 91114a784ca4aadcc5c8b0ffdf7ad90c210c012d..0000000000000000000000000000000000000000 --- a/test/cls.c +++ /dev/null @@ -1,166 +0,0 @@ -#include -#include -#include -#include -#include - -/* - * Compare a string to a mask - * Mask characters: - * @ - uppercase letter - * # - lowercase letter - * & - hex digit - * # - digit - * * - swallow remaining characters - * - exact match for any other character - */ -static int checkmask(const char *data, const char *mask) -{ - int i, ch, d; - - for (i = 0; mask[i] != '\0' && mask[i] != '*'; i++) { - ch = mask[i]; - d = data[i]; - if (ch == '@') { - if (!isupper(d)) - return 0; - } - else if (ch == '$') { - if (!islower(d)) - return 0; - } - else if (ch == '#') { - if (!isdigit(d)) - return 0; - } - else if (ch == '&') { - if (!isxdigit(d)) - return 0; - } - else if (ch != d) - return 0; - } - - if (mask[i] == '*') - return 1; - else - return (data[i] == '\0'); -} - -/* - * Converts 8 hex digits to a time integer - */ -static int hex2sec(const char *x) -{ - int i, ch; - unsigned int j; - - for (i = 0, j = 0; i < 8; i++) { - ch = x[i]; - j <<= 4; - if (isdigit(ch)) - j |= ch - '0'; - else if (isupper(ch)) - j |= ch - ('A' - 10); - else - j |= ch - ('a' - 10); - } - if (j == 0xffffffff) - return -1; /* so that it works with 8-byte ints */ - else - return j; -} - -int main(int argc, char **argv) -{ - int i, ver; - DIR *d; - struct dirent *e; - const char *s; - FILE *fp; - char path[FILENAME_MAX + 1]; - char line[1035]; - time_t date, lmod, expire; - unsigned int len; - struct tm ts; - char sdate[30], slmod[30], sexpire[30]; - const char time_format[] = "%e %b %Y %R"; - - if (argc != 2) { - printf("Usage: cls directory\n"); - exit(0); - } - - d = opendir(argv[1]); - if (d == NULL) { - perror("opendir"); - exit(1); - } - - for (;;) { - e = readdir(d); - if (e == NULL) - break; - s = e->d_name; - if (s[0] == '.' || s[0] == '#') - continue; - sprintf(path, "%s/%s", argv[1], s); - fp = fopen(path, "r"); - if (fp == NULL) { - perror("fopen"); - continue; - } - if (fgets(line, 1034, fp) == NULL) { - perror("fgets"); - fclose(fp); - continue; - } - if (!checkmask(line, "&&&&&&&& &&&&&&&& &&&&&&&& &&&&&&&& &&&&&&&&\n")) { - fprintf(stderr, "Bad cache file\n"); - fclose(fp); - continue; - } - date = hex2sec(line); - lmod = hex2sec(line + 9); - expire = hex2sec(line + 18); - ver = hex2sec(line + 27); - len = hex2sec(line + 35); - if (fgets(line, 1034, fp) == NULL) { - perror("fgets"); - fclose(fp); - continue; - } - fclose(fp); - i = strlen(line); - if (strncmp(line, "X-URL: ", 7) != 0 || line[i - 1] != '\n') { - fprintf(stderr, "Bad cache file\n"); - continue; - } - line[i - 1] = '\0'; - if (date != -1) { - ts = *gmtime(&date); - strftime(sdate, 30, time_format, &ts); - } - else - strcpy(sdate, "-"); - - if (lmod != -1) { - ts = *gmtime(&lmod); - strftime(slmod, 30, time_format, &ts); - } - else - strcpy(slmod, "-"); - - if (expire != -1) { - ts = *gmtime(&expire); - strftime(sexpire, 30, time_format, &ts); - } - else - strcpy(sexpire, "-"); - - printf("%s: %d; %s %s %s\n", line + 7, ver, sdate, slmod, sexpire); - } - - closedir(d); - return 0; -} diff --git a/test/tcpdumpscii.txt b/test/tcpdumpscii.txt deleted file mode 100644 index 9c1060edab2dad07fc140b8b5ab3aced81925618..0000000000000000000000000000000000000000 --- a/test/tcpdumpscii.txt +++ /dev/null @@ -1,50 +0,0 @@ - -From marcs@znep.com Fri Apr 17 15:16:16 1998 -Date: Sat, 22 Nov 1997 20:44:10 -0700 (MST) -From: Marc Slemko -To: TLOSAP -Subject: Re: Getting ethernet packets content under FreeBSD? (fwd) -Reply-To: new-httpd@apache.org - -Anyone too lazy to hack tcpdump (eg. my tcpdump has a -X option to display -the data in ASCII) can use something like the below to grab HTTP headers -when debugging broken clients. - -Nothing complicated, but handy. - ----------- Forwarded message ---------- -Date: Sat, 22 Nov 1997 14:35:23 PST -From: Bill Fenner -To: Nate Williams -Cc: bmah@ca.sandia.gov, hackers@FreeBSD.ORG -Subject: Re: Getting ethernet packets content under FreeBSD? - -I usually just use this perl script, which I call "tcpdumpscii". -Then run "tcpdumpscii -s 1500 -x [other tcpdump args]". - - Bill - -#!/import/misc/bin/perl -# -# -open(TCPDUMP,"tcpdump -l @ARGV|"); -while () { - if (/^\s+(\S\S)+/) { - $sav = $_; - $asc = ""; - while (s/\s*(\S\S)\s*//) { - $i = hex($1); - if ($i < 32 || $i > 126) { - $asc .= "."; - } else { - $asc .= pack(C,hex($1)); - } - } - $foo = "." x length($asc); - $_ = $sav; - s/\t/ /g; - s/^$foo/$asc/; - } - print; -} - diff --git a/test/test-writev.c b/test/test-writev.c deleted file mode 100644 index 852c7017662a6b80b635f721316f8c3883f7abd2..0000000000000000000000000000000000000000 --- a/test/test-writev.c +++ /dev/null @@ -1,85 +0,0 @@ -/* - test-writev: use this to figure out if your writev() does intelligent - things on the network. Some writev()s when given multiple buffers - will break them up into multiple packets, which is a waste. - - Linux prior to 2.0.31 has this problem. - - Solaris 2.5, 2.5.1 doesn't appear to, 2.6 hasn't been tested. - - IRIX 5.3 doesn't have this problem. - - To use this you want to snoop the wire with tcpdump, and then run - "test-writev a.b.c.d port#" ... against some TCP service on another - box. For example you can run it against port 80 on another server. - You want to look to see how many data packets are sent, you're hoping - only one of size 300 is sent. -*/ - -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#ifndef INADDR_NONE -#define INADDR_NONE (-1ul) -#endif - -void main( int argc, char **argv ) -{ - struct sockaddr_in server_addr; - int s; - struct iovec vector[3]; - char buf[100]; - int i; - const int just_say_no = 1; - - if( argc != 3 ) { -usage: - fprintf( stderr, "usage: test-writev a.b.c.d port#\n" ); - exit( 1 ); - } - server_addr.sin_family = AF_INET; - server_addr.sin_addr.s_addr = inet_addr( argv[1] ); - if( server_addr.sin_addr.s_addr == INADDR_NONE ) { - fprintf( stderr, "bogus address\n" ); - goto usage; - } - server_addr.sin_port = htons( atoi( argv[2] ) ); - - s = socket( AF_INET, SOCK_STREAM, 0 ); - if( s < 0 ) { - perror("socket"); - exit(1); - } - if( connect( s, (struct sockaddr *)&server_addr, sizeof( server_addr ) ) - != 0 ) { - perror("connect"); - exit(1); - } - - if( setsockopt(s, IPPROTO_TCP, TCP_NODELAY, (char*)&just_say_no, - sizeof(just_say_no)) != 0 ) { - perror( "TCP_NODELAY" ); - exit(1); - } - /* now build up a two part writev and write it out */ - for( i = 0; i < sizeof( buf ); ++i ) { - buf[i] = 'x'; - } - vector[0].iov_base = buf; - vector[0].iov_len = sizeof(buf); - vector[1].iov_base = buf; - vector[1].iov_len = sizeof(buf); - vector[2].iov_base = buf; - vector[2].iov_len = sizeof(buf); - - i = writev( s, &vector[0], 3 ); - fprintf( stdout, "i=%d, errno=%d\n", i, errno ); - exit(0); -} diff --git a/test/test_find.c b/test/test_find.c deleted file mode 100644 index 6f887f50078e557534345d6b479c0f4c7c8449cc..0000000000000000000000000000000000000000 --- a/test/test_find.c +++ /dev/null @@ -1,62 +0,0 @@ -/* This program tests the ap_find_list_item routine in ../main/util.c. - * - * The defines in this sample compile line are specific to Roy's system. - * They should match whatever was used to compile Apache first. - * - gcc -g -O2 -I../os/unix -I../include -o test_find \ - -DSOLARIS2=250 -Wall -DALLOC_DEBUG -DPOOL_DEBUG \ - ../main/alloc.o ../main/buff.o ../main/util.o \ - ../ap/libap.a -lsocket -lnsl test_find.c - * - * Roy Fielding, 1999 - */ -#include -#include -#include "httpd.h" -#include "alloc.h" - -/* - * Dummy a bunch of stuff just to get a compile - */ -uid_t ap_user_id; -gid_t ap_group_id; -void *ap_dummy_mutex = &ap_dummy_mutex; -char *ap_server_argv0; - -API_EXPORT(void) ap_block_alarms(void) -{ - ; -} - -API_EXPORT(void) ap_unblock_alarms(void) -{ - ; -} - -API_EXPORT(void) ap_log_error(const char *file, int line, int level, - const request_rec *r, const char *fmt, ...) -{ - ; -} - -int main (void) -{ - ap_pool *p; - char line[512]; - char tok[512]; - - p = ap_init_alloc(); - - printf("Enter field value to find items within:\n"); - if (!gets(line)) - exit(0); - - printf("Enter search item:\n"); - while (gets(tok)) { - printf(" [%s] == %s\n", tok, ap_find_list_item(p, line, tok) - ? "Yes" : "No"); - printf("Enter search item:\n"); - } - - exit(0); -} diff --git a/test/test_limits.c b/test/test_limits.c deleted file mode 100644 index 8d76ce2e083bca965c3d7a368f0c701a6cb7c963..0000000000000000000000000000000000000000 --- a/test/test_limits.c +++ /dev/null @@ -1,200 +0,0 @@ -/************************************************************** - * test_limits.c - * - * A simple program for sending abusive requests to a server, based - * on the sioux.c exploit code that this nimrod posted (see below). - * Roy added options for testing long header fieldsize (-t h), long - * request-lines (-t r), and a long request body (-t b). - * - * FreeBSD 2.2.x, FreeBSD 3.0, IRIX 5.3, IRIX 6.2: - * gcc -o test_limits test_limits.c - * - * Solaris 2.5.1: - * gcc -o test_limits test_limits.c -lsocket -lnsl - * - * - * Message-ID: <861zqspvtw.fsf@niobe.ewox.org> - * Date: Fri, 7 Aug 1998 19:04:27 +0200 - * Sender: Bugtraq List - * From: Dag-Erling Coidan =?ISO-8859-1?Q?Sm=F8rgrav?= - * Subject: YA Apache DoS attack - * - * Copyright (c) 1998 Dag-Erling Codan Smrgrav - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer - * in this position and unchanged. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. The name of the author may not be used to endorse or promote products - * derived from this software withough specific prior written permission - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR - * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES - * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. - * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, - * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT - * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF - * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * - */ - -/* - * Kudos to Mark Huizer who originally suggested this on freebsd-current - */ - -#include -#include - -#include -#include - -#include -#include -#include -#include -#include - -#define TEST_LONG_REQUEST_LINE 1 -#define TEST_LONG_REQUEST_FIELDS 2 -#define TEST_LONG_REQUEST_FIELDSIZE 3 -#define TEST_LONG_REQUEST_BODY 4 - -void -usage(void) -{ - fprintf(stderr, - "usage: test_limits [-t (r|n|h|b)] [-a address] [-p port] [-n num]\n"); - exit(1); -} - -int -main(int argc, char *argv[]) -{ - struct sockaddr_in sin; - struct hostent *he; - FILE *f; - int o, sd; - - /* default parameters */ - char *addr = "localhost"; - int port = 80; - int num = 1000; - int testtype = TEST_LONG_REQUEST_FIELDS; - - /* get options */ - while ((o = getopt(argc, argv, "t:a:p:n:")) != EOF) - switch (o) { - case 't': - if (*optarg == 'r') - testtype = TEST_LONG_REQUEST_LINE; - else if (*optarg == 'n') - testtype = TEST_LONG_REQUEST_FIELDS; - else if (*optarg == 'h') - testtype = TEST_LONG_REQUEST_FIELDSIZE; - else if (*optarg == 'b') - testtype = TEST_LONG_REQUEST_BODY; - break; - case 'a': - addr = optarg; - break; - case 'p': - port = atoi(optarg); - break; - case 'n': - num = atoi(optarg); - break; - default: - usage(); - } - - if (argc != optind) - usage(); - - /* connect */ - if ((he = gethostbyname(addr)) == NULL) { - perror("gethostbyname"); - exit(1); - } - bzero(&sin, sizeof(sin)); - bcopy(he->h_addr, (char *)&sin.sin_addr, he->h_length); - sin.sin_family = he->h_addrtype; - sin.sin_port = htons(port); - - if ((sd = socket(sin.sin_family, SOCK_STREAM, IPPROTO_TCP)) == -1) { - perror("socket"); - exit(1); - } - - if (connect(sd, (struct sockaddr *)&sin, sizeof(sin)) == -1) { - perror("connect"); - exit(1); - } - - if ((f = fdopen(sd, "r+")) == NULL) { - perror("fdopen"); - exit(1); - } - - /* attack! */ - fprintf(stderr, "Testing like a plague of locusts on %s\n", addr); - - if (testtype == TEST_LONG_REQUEST_LINE) { - fprintf(f, "GET "); - while (num-- && !ferror(f)) { - fprintf(f, "/123456789"); - fflush(f); - } - fprintf(f, " HTTP/1.0\r\n\r\n"); - } - else { - fprintf(f, "GET /fred/foo HTTP/1.0\r\n"); - - if (testtype == TEST_LONG_REQUEST_FIELDSIZE) { - while (num-- && !ferror(f)) { - fprintf(f, "User-Agent: sioux"); - fflush(f); - } - fprintf(f, "\r\n"); - } - else if (testtype == TEST_LONG_REQUEST_FIELDS) { - while (num-- && !ferror(f)) - fprintf(f, "User-Agent: sioux\r\n"); - fprintf(f, "\r\n"); - } - else if (testtype == TEST_LONG_REQUEST_BODY) { - fprintf(f, "User-Agent: sioux\r\n"); - fprintf(f, "Content-Length: 33554433\r\n"); - fprintf(f, "\r\n"); - while (num-- && !ferror(f)) - fprintf(f, "User-Agent: sioux\r\n"); - } - else { - fprintf(f, "\r\n"); - } - } - fflush(f); - - { - ssize_t len; - char buff[512]; - - while ((len = read(sd, buff, 512)) > 0) - len = write(1, buff, len); - } - if (ferror(f)) { - perror("fprintf"); - exit(1); - } - - fclose(f); - exit(0); -} diff --git a/test/test_parser.c b/test/test_parser.c deleted file mode 100644 index 23e2c21c5066c07841cb83323bf2048e93400f33..0000000000000000000000000000000000000000 --- a/test/test_parser.c +++ /dev/null @@ -1,59 +0,0 @@ -/* This program tests the ap_get_list_item routine in ../main/util.c. - * - * The defines in this sample compile line are specific to Roy's system. - * They should match whatever was used to compile Apache first. - * - gcc -g -O2 -I../os/unix -I../include -o test_parser \ - -DSOLARIS2=250 -Wall -DALLOC_DEBUG -DPOOL_DEBUG \ - ../main/alloc.o ../main/buff.o ../main/util.o \ - ../ap/libap.a -lsocket -lnsl test_parser.c - * - * Roy Fielding, 1999 - */ -#include -#include -#include "httpd.h" -#include "alloc.h" - -/* - * Dummy a bunch of stuff just to get a compile - */ -uid_t ap_user_id; -gid_t ap_group_id; -void *ap_dummy_mutex = &ap_dummy_mutex; -char *ap_server_argv0; - -API_EXPORT(void) ap_block_alarms(void) -{ - ; -} - -API_EXPORT(void) ap_unblock_alarms(void) -{ - ; -} - -API_EXPORT(void) ap_log_error(const char *file, int line, int level, - const request_rec *r, const char *fmt, ...) -{ - ; -} - -int main (void) -{ - ap_pool *p; - const char *field; - char *newstr; - char instr[512]; - - p = ap_init_alloc(); - - while (gets(instr)) { - printf(" [%s] ==\n", instr); - field = instr; - while ((newstr = ap_get_list_item(p, &field)) != NULL) - printf(" <%s> ..\n", newstr); - } - - exit(0); -} diff --git a/test/test_select.c b/test/test_select.c deleted file mode 100644 index 8c0a6a43634f78b39a957b2842e58536118a6647..0000000000000000000000000000000000000000 --- a/test/test_select.c +++ /dev/null @@ -1,30 +0,0 @@ -/* This is just a quick test program to see how long a wait is - * produced by a select loop with an exponential backoff. - * - * gcc -g -O2 -o test_select test_select.c - * test_select - * - * Roy Fielding, 1996 - */ - -#include -#include -#include - -int main (void) -{ - int srv; - long waittime = 4096; - struct timeval tv; - - printf("Start\n"); - while ((waittime > 0) && (waittime < 3000000)) { - printf("%d\n", waittime); - tv.tv_sec = waittime/1000000; - tv.tv_usec = waittime%1000000; - waittime <<= 1; - srv = select(0, NULL, NULL, NULL, &tv); - } - printf("End\n"); - exit(0); -} diff --git a/test/time-sem.c b/test/time-sem.c deleted file mode 100644 index 8bf67c72546fefafa42998b15bdcc96dc47b5cda..0000000000000000000000000000000000000000 --- a/test/time-sem.c +++ /dev/null @@ -1,572 +0,0 @@ -/* -time-sem.c has the basics of the semaphores we use in http_main.c. It's -intended for timing differences between various methods on an -architecture. In practice we've found many things affect which semaphore -to be used: - - - NFS filesystems absolutely suck for fcntl() and flock() - - - uslock absolutely sucks on single-processor IRIX boxes, but - absolutely rocks on multi-processor boxes. The converse - is true for fcntl. sysvsem seems a moderate balance. - - - Under Solaris you can't have too many processes use SEM_UNDO, there - might be a tuneable somewhere that increases the limit from 29. - We're not sure what the tunable is, so there's a define - NO_SEM_UNDO which can be used to simulate us trapping/blocking - signals to be able to properly release the semaphore on a clean - child death. You'll also need to define NEED_UNION_SEMUN - under solaris. - -You'll need to define USE_SHMGET_SCOREBOARD if anonymous shared mmap() -doesn't work on your system (i.e. linux). - -argv[1] is the #children, argv[2] is the #iterations per child - -You should run each over many different #children inputs, and choose -#iter such that the program runs for at least a second or so... or even -longer depending on your patience. - -compile with: - -gcc -o time-FCNTL -Wall -O time-sem.c -DUSE_FCNTL_SERIALIZED_ACCEPT -gcc -o time-FLOCK -Wall -O time-sem.c -DUSE_FLOCK_SERIALIZED_ACCEPT -gcc -o time-SYSVSEM -Wall -O time-sem.c -DUSE_SYSVSEM_SERIALIZED_ACCEPT -gcc -o time-SYSVSEM2 -Wall -O time-sem.c -DUSE_SYSVSEM_SERIALIZED_ACCEPT -DNO_SEM_UNDO -gcc -o time-PTHREAD -Wall -O time-sem.c -DUSE_PTHREAD_SERIALIZED_ACCEPT -lpthread -gcc -o time-USLOCK -Wall -O time-sem.c -DUSE_USLOCK_SERIALIZED_ACCEPT - -not all versions work on all systems. -*/ - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#if defined(USE_FCNTL_SERIALIZED_ACCEPT) - -static struct flock lock_it; -static struct flock unlock_it; - -static int fcntl_fd=-1; - -#define accept_mutex_child_init() -#define accept_mutex_cleanup() - -/* - * Initialize mutex lock. - * Must be safe to call this on a restart. - */ -void -accept_mutex_init(void) -{ - - lock_it.l_whence = SEEK_SET; /* from current point */ - lock_it.l_start = 0; /* -"- */ - lock_it.l_len = 0; /* until end of file */ - lock_it.l_type = F_WRLCK; /* set exclusive/write lock */ - lock_it.l_pid = 0; /* pid not actually interesting */ - unlock_it.l_whence = SEEK_SET; /* from current point */ - unlock_it.l_start = 0; /* -"- */ - unlock_it.l_len = 0; /* until end of file */ - unlock_it.l_type = F_UNLCK; /* set exclusive/write lock */ - unlock_it.l_pid = 0; /* pid not actually interesting */ - - printf("opening test-lock-thing in current directory\n"); - fcntl_fd = open("test-lock-thing", O_CREAT | O_WRONLY | O_EXCL, 0644); - if (fcntl_fd == -1) - { - perror ("open"); - fprintf (stderr, "Cannot open lock file: %s\n", "test-lock-thing"); - exit (1); - } - unlink("test-lock-thing"); -} - -void accept_mutex_on(void) -{ - int ret; - - while ((ret = fcntl(fcntl_fd, F_SETLKW, &lock_it)) < 0 && errno == EINTR) - continue; - - if (ret < 0) { - perror ("fcntl lock_it"); - exit(1); - } -} - -void accept_mutex_off(void) -{ - if (fcntl (fcntl_fd, F_SETLKW, &unlock_it) < 0) - { - perror ("fcntl unlock_it"); - exit(1); - } -} - -#elif defined(USE_FLOCK_SERIALIZED_ACCEPT) - -#include - -static int flock_fd=-1; - -#define FNAME "test-lock-thing" - -/* - * Initialize mutex lock. - * Must be safe to call this on a restart. - */ -void accept_mutex_init(void) -{ - - printf("opening " FNAME " in current directory\n"); - flock_fd = open(FNAME, O_CREAT | O_WRONLY | O_EXCL, 0644); - if (flock_fd == -1) - { - perror ("open"); - fprintf (stderr, "Cannot open lock file: %s\n", "test-lock-thing"); - exit (1); - } -} - -void accept_mutex_child_init(void) -{ - flock_fd = open(FNAME, O_WRONLY, 0600); - if (flock_fd == -1) { - perror("open"); - exit(1); - } -} - -void accept_mutex_cleanup(void) -{ - unlink(FNAME); -} - -void accept_mutex_on(void) -{ - int ret; - - while ((ret = flock(flock_fd, LOCK_EX)) < 0 && errno == EINTR) - continue; - - if (ret < 0) { - perror ("flock(LOCK_EX)"); - exit(1); - } -} - -void accept_mutex_off(void) -{ - if (flock (flock_fd, LOCK_UN) < 0) - { - perror ("flock(LOCK_UN)"); - exit(1); - } -} - -#elif defined (USE_SYSVSEM_SERIALIZED_ACCEPT) - -#include -#include -#include - -static int sem_id = -1; -#ifdef NO_SEM_UNDO -static sigset_t accept_block_mask; -static sigset_t accept_previous_mask; -#endif - -#define accept_mutex_child_init() -#define accept_mutex_cleanup() - -void accept_mutex_init(void) -{ -#ifdef NEED_UNION_SEMUN - /* believe it or not, you need to define this under solaris */ - union semun { - int val; - struct semid_ds *buf; - ushort *array; - }; -#endif - - union semun ick; - - sem_id = semget(999, 1, IPC_CREAT | 0666); - if (sem_id < 0) { - perror ("semget"); - exit (1); - } - ick.val = 1; - if (semctl(sem_id, 0, SETVAL, ick) < 0) { - perror ("semctl"); - exit(1); - } -#ifdef NO_SEM_UNDO - sigfillset(&accept_block_mask); - sigdelset(&accept_block_mask, SIGHUP); - sigdelset(&accept_block_mask, SIGTERM); - sigdelset(&accept_block_mask, SIGUSR1); -#endif -} - -void accept_mutex_on() -{ - struct sembuf op; - -#ifdef NO_SEM_UNDO - if (sigprocmask(SIG_BLOCK, &accept_block_mask, &accept_previous_mask)) { - perror("sigprocmask(SIG_BLOCK)"); - exit (1); - } - op.sem_flg = 0; -#else - op.sem_flg = SEM_UNDO; -#endif - op.sem_num = 0; - op.sem_op = -1; - if (semop(sem_id, &op, 1) < 0) { - perror ("accept_mutex_on"); - exit (1); - } -} - -void accept_mutex_off() -{ - struct sembuf op; - - op.sem_num = 0; - op.sem_op = 1; -#ifdef NO_SEM_UNDO - op.sem_flg = 0; -#else - op.sem_flg = SEM_UNDO; -#endif - if (semop(sem_id, &op, 1) < 0) { - perror ("accept_mutex_off"); - exit (1); - } -#ifdef NO_SEM_UNDO - if (sigprocmask(SIG_SETMASK, &accept_previous_mask, NULL)) { - perror("sigprocmask(SIG_SETMASK)"); - exit (1); - } -#endif -} - -#elif defined (USE_PTHREAD_SERIALIZED_ACCEPT) - -/* note: pthread mutexes aren't released on child death, hence the - * signal goop ... in a real implementation we'd do special things - * during hup, term, usr1. - */ - -#include - -static pthread_mutex_t *mutex; -static sigset_t accept_block_mask; -static sigset_t accept_previous_mask; - -#define accept_mutex_child_init() -#define accept_mutex_cleanup() - -void accept_mutex_init(void) -{ - pthread_mutexattr_t mattr; - int fd; - - fd = open ("/dev/zero", O_RDWR); - if (fd == -1) { - perror ("open(/dev/zero)"); - exit (1); - } - mutex = (pthread_mutex_t *)mmap ((caddr_t)0, sizeof (*mutex), - PROT_READ|PROT_WRITE, MAP_SHARED, fd, 0); - if (mutex == (void *)(caddr_t)-1) { - perror ("mmap"); - exit (1); - } - close (fd); - if (pthread_mutexattr_init(&mattr)) { - perror ("pthread_mutexattr_init"); - exit (1); - } - if (pthread_mutexattr_setpshared(&mattr, PTHREAD_PROCESS_SHARED)) { - perror ("pthread_mutexattr_setpshared"); - exit (1); - } - if (pthread_mutex_init(mutex, &mattr)) { - perror ("pthread_mutex_init"); - exit (1); - } - sigfillset(&accept_block_mask); - sigdelset(&accept_block_mask, SIGHUP); - sigdelset(&accept_block_mask, SIGTERM); - sigdelset(&accept_block_mask, SIGUSR1); -} - -void accept_mutex_on() -{ - if (sigprocmask(SIG_BLOCK, &accept_block_mask, &accept_previous_mask)) { - perror("sigprocmask(SIG_BLOCK)"); - exit (1); - } - if (pthread_mutex_lock (mutex)) { - perror ("pthread_mutex_lock"); - exit (1); - } -} - -void accept_mutex_off() -{ - if (pthread_mutex_unlock (mutex)) { - perror ("pthread_mutex_unlock"); - exit (1); - } - if (sigprocmask(SIG_SETMASK, &accept_previous_mask, NULL)) { - perror("sigprocmask(SIG_SETMASK)"); - exit (1); - } -} - -#elif defined (USE_USLOCK_SERIALIZED_ACCEPT) - -#include - -static usptr_t *us = NULL; -static ulock_t uslock = NULL; - -#define accept_mutex_child_init() -#define accept_mutex_cleanup() - -void accept_mutex_init(void) -{ - ptrdiff_t old; - /* default is 8 */ -#define CONF_INITUSERS_MAX 15 - if ((old = usconfig(CONF_INITUSERS, CONF_INITUSERS_MAX)) == -1) { - perror("usconfig"); - exit(-1); - } - if ((old = usconfig(CONF_LOCKTYPE, US_NODEBUG)) == -1) { - perror("usconfig"); - exit(-1); - } - if ((old = usconfig(CONF_ARENATYPE, US_SHAREDONLY)) == -1) { - perror("usconfig"); - exit(-1); - } - if ((us = usinit("/dev/zero")) == NULL) { - perror("usinit"); - exit(-1); - } - if ((uslock = usnewlock(us)) == NULL) { - perror("usnewlock"); - exit(-1); - } -} -void accept_mutex_on() -{ - switch(ussetlock(uslock)) { - case 1: - /* got lock */ - break; - case 0: - fprintf(stderr, "didn't get lock\n"); - exit(-1); - case -1: - perror("ussetlock"); - exit(-1); - } -} -void accept_mutex_off() -{ - if (usunsetlock(uslock) == -1) { - perror("usunsetlock"); - exit(-1); - } -} -#endif - - -#ifndef USE_SHMGET_SCOREBOARD -static void *get_shared_mem(size_t size) -{ - void *result; - - /* allocate shared memory for the shared_counter */ - result = (unsigned long *)mmap ((caddr_t)0, size, - PROT_READ|PROT_WRITE, MAP_ANON|MAP_SHARED, -1, 0); - if (result == (void *)(caddr_t)-1) { - perror ("mmap"); - exit (1); - } - return result; -} -#else -#include -#include -#include - -static void *get_shared_mem(size_t size) -{ - key_t shmkey = IPC_PRIVATE; - int shmid = -1; - void *result; -#ifdef MOVEBREAK - char *obrk; -#endif - - if ((shmid = shmget(shmkey, size, IPC_CREAT | SHM_R | SHM_W)) == -1) { - perror("shmget"); - exit(1); - } - -#ifdef MOVEBREAK - /* - * Some SysV systems place the shared segment WAY too close - * to the dynamic memory break point (sbrk(0)). This severely - * limits the use of malloc/sbrk in the program since sbrk will - * refuse to move past that point. - * - * To get around this, we move the break point "way up there", - * attach the segment and then move break back down. Ugly - */ - if ((obrk = sbrk(MOVEBREAK)) == (char *) -1) { - perror("sbrk"); - } -#endif - -#define BADSHMAT ((void *)(-1)) - if ((result = shmat(shmid, 0, 0)) == BADSHMAT) { - perror("shmat"); - } - /* - * We must avoid leaving segments in the kernel's - * (small) tables. - */ - if (shmctl(shmid, IPC_RMID, NULL) != 0) { - perror("shmctl(IPC_RMID)"); - } - if (result == BADSHMAT) /* now bailout */ - exit(1); - -#ifdef MOVEBREAK - if (obrk == (char *) -1) - return; /* nothing else to do */ - if (sbrk(-(MOVEBREAK)) == (char *) -1) { - perror("sbrk 2"); - } -#endif - return result; -} -#endif - -#ifdef _POSIX_PRIORITY_SCHEDULING -/* don't ask */ -#define _P __P -#include -#define YIELD sched_yield() -#else -#define YIELD do { struct timeval zero; zero.tv_sec = zero.tv_usec = 0; select(0,0,0,0,&zero); } while(0) -#endif - -void main (int argc, char **argv) -{ - int num_iter; - int num_child; - int i; - struct timeval first; - struct timeval last; - long ms; - int pid; - unsigned long *shared_counter; - - if (argc != 3) { - fprintf (stderr, "Usage: time-sem num-child num-iter\n"); - exit (1); - } - - num_child = atoi (argv[1]); - num_iter = atoi (argv[2]); - - /* allocate shared memory for the shared_counter */ - shared_counter = get_shared_mem(sizeof(*shared_counter)); - - /* initialize counter to 0 */ - *shared_counter = 0; - - accept_mutex_init (); - - /* parent grabs mutex until done spawning children */ - accept_mutex_on (); - - for (i = 0; i < num_child; ++i) { - pid = fork(); - if (pid == 0) { - /* child, do our thing */ - accept_mutex_child_init(); - for (i = 0; i < num_iter; ++i) { - unsigned long tmp; - - accept_mutex_on (); - tmp = *shared_counter; - YIELD; - *shared_counter = tmp + 1; - accept_mutex_off (); - } - exit (0); - } else if (pid == -1) { - perror ("fork"); - exit (1); - } - } - - /* a quick test to see that nothing is screwed up */ - if (*shared_counter != 0) { - puts ("WTF! shared_counter != 0 before the children have been started!"); - exit (1); - } - - gettimeofday (&first, NULL); - /* launch children into action */ - accept_mutex_off (); - for (i = 0; i < num_child; ++i) { - if (wait(NULL) == -1) { - perror ("wait"); - } - } - gettimeofday (&last, NULL); - - if (*shared_counter != num_child * num_iter) { - printf ("WTF! shared_counter != num_child * num_iter!\n" - "shared_counter = %lu\nnum_child = %d\nnum_iter=%d\n", - *shared_counter, - num_child, num_iter); - } - - last.tv_sec -= first.tv_sec; - ms = last.tv_usec - first.tv_usec; - if (ms < 0) { - --last.tv_sec; - ms += 1000000; - } - last.tv_usec = ms; - printf ("%8lu.%06lu\n", last.tv_sec, last.tv_usec); - - accept_mutex_cleanup(); - - exit(0); -} - diff --git a/test/zb.c b/test/zb.c deleted file mode 100644 index 0a6666eb25d59c7007c9c513e8d751db71713dd2..0000000000000000000000000000000000000000 --- a/test/zb.c +++ /dev/null @@ -1,567 +0,0 @@ - -/* ZeusBench V1.01 - =============== - -This program is Copyright (C) Zeus Technology Limited 1996. - -This program may be used and copied freely providing this copyright notice -is not removed. - -This software is provided "as is" and any express or implied waranties, -including but not limited to, the implied warranties of merchantability and -fitness for a particular purpose are disclaimed. In no event shall -Zeus Technology Ltd. be liable for any direct, indirect, incidental, special, -exemplary, or consequential damaged (including, but not limited to, -procurement of substitute good or services; loss of use, data, or profits; -or business interruption) however caused and on theory of liability. Whether -in contract, strict liability or tort (including negligence or otherwise) -arising in any way out of the use of this software, even if advised of the -possibility of such damage. - - Written by Adam Twiss (adam@zeus.co.uk). March 1996 - -Thanks to the following people for their input: - Mike Belshe (mbelshe@netscape.com) - Michael Campanella (campanella@stevms.enet.dec.com) - -*/ - -/* -------------------- Notes on compiling ------------------------------ - -This should compile unmodified using gcc on HP-UX, FreeBSD, Linux, -IRIX, Solaris, AIX and Digital Unix (OSF). On Solaris 2.x you will -need to compile with "-lnsl -lsocket" options. If you have any -difficulties compiling then let me know. - -On SunOS 4.x.x you may need to compile with -DSUNOS4 to add the following -two lines of code which appear not to exist in my SunOS headers */ - -#ifdef SUNOS4 -extern char *optarg; -extern int optind, opterr, optopt; -#endif - -/* -------------------------------------------------------------------- */ - -/* affects include files on Solaris */ -#define BSD_COMP - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -/* ------------------- DEFINITIONS -------------------------- */ - -/* maximum number of requests on a time limited test */ -#define MAX_REQUESTS 50000 - -/* good old state machine */ -#define STATE_UNCONNECTED 0 -#define STATE_CONNECTING 1 -#define STATE_READ 2 - -#define CBUFFSIZE 512 - -struct connection -{ - int fd; - int state; - int read; /* amount of bytes read */ - int bread; /* amount of body read */ - int length; /* Content-Length value used for keep-alive */ - char cbuff[CBUFFSIZE]; /* a buffer to store server response header */ - int cbx; /* offset in cbuffer */ - int keepalive; /* non-zero if a keep-alive request */ - int gotheader; /* non-zero if we have the entire header in cbuff */ - struct timeval start, connect, done; -}; - -struct data -{ - int read; /* number of bytes read */ - int ctime; /* time in ms to connect */ - int time; /* time in ms for connection */ -}; - -#define min(a,b) ((a)<(b))?(a):(b) -#define max(a,b) ((a)>(b))?(a):(b) - -/* --------------------- GLOBALS ---------------------------- */ - -int requests = 1; /* Number of requests to make */ -int concurrency = 1; /* Number of multiple requests to make */ -int tlimit = 0; /* time limit in cs */ -int keepalive = 0; /* try and do keepalive connections */ -char *machine; /* Machine name */ -char *file; /* file name to use */ -char server_name[80]; /* name that server reports */ -int port = 80; /* port to use */ - -int doclen = 0; /* the length the document should be */ -int totalread = 0; /* total number of bytes read */ -int totalbread = 0; /* totoal amount of entity body read */ -int done=0; /* number of requests we have done */ -int doneka=0; /* number of keep alive connections done */ -int good=0, bad=0; /* number of good and bad requests */ - -/* store error cases */ -int err_length = 0, err_conn = 0, err_except = 0; - -struct timeval start, endtime; - -/* global request (and its length) */ -char request[512]; -int reqlen; - -/* one global throw-away buffer to read stuff into */ -char buffer[4096]; - -struct connection *con; /* connection array */ -struct data *stats; /* date for each request */ - -fd_set readbits, writebits; /* bits for select */ -struct sockaddr_in server; /* server addr structure */ - -/* --------------------------------------------------------- */ - -/* simple little function to perror and exit */ - -static void err(char *s) -{ - perror(s); - exit(errno); -} - -/* --------------------------------------------------------- */ - -/* write out request to a connection - assumes we can write - (small) request out in one go into our new socket buffer */ - -void write_request(struct connection *c) -{ - gettimeofday(&c->connect,0); - write(c->fd,request, reqlen); - c->state = STATE_READ; - FD_SET(c->fd, &readbits); - FD_CLR(c->fd, &writebits); -} - -/* --------------------------------------------------------- */ - -/* make an fd non blocking */ - -void nonblock(int fd) -{ - int i=1; - ioctl(fd, FIONBIO, &i); -} - -/* --------------------------------------------------------- */ - -/* returns the time in ms between two timevals */ - -int timedif(struct timeval a, struct timeval b) -{ - register int us,s; - - us = a.tv_usec - b.tv_usec; - us /= 1000; - s = a.tv_sec - b.tv_sec; - s *= 1000; - return s+us; -} - -/* --------------------------------------------------------- */ - -/* calculate and output results and exit */ - -void output_results() -{ - int timetaken; - - gettimeofday(&endtime,0); - timetaken = timedif(endtime, start); - - printf("\n---\n"); - printf("Server: %s\n", server_name); - printf("Document Length: %d\n", doclen); - printf("Concurency Level: %d\n", concurrency); - printf("Time taken for tests: %d.%03d seconds\n", - timetaken/1000, timetaken%1000); - printf("Complete requests: %d\n", done); - printf("Failed requests: %d\n", bad); - if(bad) printf(" (Connect: %d, Length: %d, Exceptions: %d)\n", - err_conn, err_length, err_except); - if(keepalive) printf("Keep-Alive requests: %d\n", doneka); - printf("Bytes transfered: %d\n", totalread); - printf("HTML transfered: %d\n", totalbread); - - /* avoid divide by zero */ - if(timetaken) { - printf("Requests per seconds: %.2f\n", 1000*(float)(done)/timetaken); - printf("Transfer rate: %.2f kb/s\n", - (float)(totalread)/timetaken); - } - - { - /* work out connection times */ - int i; - int totalcon=0, total=0; - int mincon=9999999, mintot=999999; - int maxcon=0, maxtot=0; - - for(i=0; iread = 0; - c->bread = 0; - c->keepalive = 0; - c->cbx = 0; - c->gotheader = 0; - - c->fd = socket(AF_INET, SOCK_STREAM, 0); - if(c->fd<0) err("socket"); - - nonblock(c->fd); - gettimeofday(&c->start,0); - - if(connect(c->fd, (struct sockaddr *) &server, sizeof(server))<0) { - if(errno==EINPROGRESS) { - c->state = STATE_CONNECTING; - FD_SET(c->fd, &writebits); - return; - } - else { - close(c->fd); - err_conn++; - if(bad++>10) { - printf("\nTest aborted after 10 failures\n\n"); - exit(1); - } - start_connect(c); - } - } - - /* connected first time */ - write_request(c); -} - -/* --------------------------------------------------------- */ - -/* close down connection and save stats */ - -void close_connection(struct connection *c) -{ - if(c->read == 0 && c->keepalive) { - /* server has legitiamately shut down an idle keep alive request */ - good--; /* connection never happend */ - } - else { - if(good==1) { - /* first time here */ - doclen = c->bread; - } else if (c->bread!=doclen) { - bad++; - err_length++; - } - - /* save out time */ - if(done < requests) { - struct data s; - gettimeofday(&c->done,0); - s.read = c->read; - s.ctime = timedif(c->connect, c->start); - s.time = timedif(c->done, c->start); - stats[done++] = s; - } - } - - close(c->fd); - FD_CLR(c->fd, &readbits); - FD_CLR(c->fd, &writebits); - - /* connect again */ - start_connect(c); - return; -} - -/* --------------------------------------------------------- */ - -/* read data from connection */ - -void read_connection(struct connection *c) -{ - int r; - - r=read(c->fd,buffer,sizeof(buffer)); - if(r==0 || (r<0 && errno!=EAGAIN)) { - good++; - close_connection(c); - return; - } - - if(r<0 && errno==EAGAIN) return; - - c->read += r; - totalread += r; - - if(!c->gotheader) { - char *s; - int l=4; - int space = CBUFFSIZE - c->cbx - 1; /* -1 to allow for 0 terminator */ - int tocopy = (spacecbuff+c->cbx, buffer, space); - c->cbx += tocopy; space -= tocopy; - c->cbuff[c->cbx] = 0; /* terminate for benefit of strstr */ - s = strstr(c->cbuff, "\r\n\r\n"); - /* this next line is so that we talk to NCSA 1.5 which blatantly breaks - the http specifaction */ - if(!s) { s = strstr(c->cbuff,"\n\n"); l=2; } - - if(!s) { - /* read rest next time */ - if(space) - return; - else { - /* header is in invalid or too big - close connection */ - close(c->fd); - if(bad++>10) { - printf("\nTest aborted after 10 failures\n\n"); - exit(1); - } - FD_CLR(c->fd, &writebits); - start_connect(c); - } - } - else { - /* have full header */ - if(!good) { - /* this is first time, extract some interesting info */ - char *p, *q; - p = strstr(c->cbuff, "Server:"); - q = server_name; - if(p) { p+=8; while(*p>32) *q++ = *p++; } - *q = 0; - } - - c->gotheader = 1; - *s = 0; /* terminate at end of header */ - if(keepalive && - (strstr(c->cbuff, "Keep-Alive") - || strstr(c->cbuff, "keep-alive"))) /* for benefit of MSIIS */ - { - char *cl; - cl = strstr(c->cbuff, "Content-Length:"); - /* for cacky servers like NCSA which break the spec and send a - lower case 'l' */ - if(!cl) cl = strstr(c->cbuff, "Content-length:"); - if(cl) { - c->keepalive=1; - c->length = atoi(cl+16); - } - } - c->bread += c->cbx - (s+l-c->cbuff) + r-tocopy; - totalbread += c->bread; - } - } - else { - /* outside header, everything we have read is entity body */ - c->bread += r; - totalbread += r; - } - - if(c->keepalive && (c->bread >= c->length)) { - /* finished a keep-alive connection */ - good++; doneka++; - /* save out time */ - if(good==1) { - /* first time here */ - doclen = c->bread; - } else if(c->bread!=doclen) { bad++; err_length++; } - if(done < requests) { - struct data s; - gettimeofday(&c->done,0); - s.read = c->read; - s.ctime = timedif(c->connect, c->start); - s.time = timedif(c->done, c->start); - stats[done++] = s; - } - c->keepalive = 0; c->length = 0; c->gotheader=0; c->cbx = 0; - c->read = c->bread = 0; - write_request(c); - c->start = c->connect; /* zero connect time with keep-alive */ - } -} - -/* --------------------------------------------------------- */ - -/* run the tests */ - -int test() -{ - struct timeval timeout, now; - fd_set sel_read, sel_except, sel_write; - int i; - - { - /* get server information */ - struct hostent *he; - he = gethostbyname(machine); - if (!he) err("gethostbyname"); - server.sin_family = he->h_addrtype; - server.sin_port = htons(port); - server.sin_addr.s_addr = ((unsigned long *)(he->h_addr_list[0]))[0]; - } - - con = malloc(concurrency*sizeof(struct connection)); - memset(con,0,concurrency*sizeof(struct connection)); - - stats = malloc(requests * sizeof(struct data)); - - FD_ZERO(&readbits); - FD_ZERO(&writebits); - - /* setup request */ - sprintf(request,"GET %s HTTP/1.0\r\nUser-Agent: ZeusBench/1.0\r\n" - "%sHost: %s\r\nAccept: */*\r\n\r\n", file, - keepalive?"Connection: Keep-Alive\r\n":"", machine ); - - reqlen = strlen(request); - - /* ok - lets start */ - gettimeofday(&start,0); - - /* initialise lots of requests */ - for(i=0; i (tlimit*1000)) { - requests=done; /* so stats are correct */ - output_results(); - } - - /* Timeout of 30 seconds. */ - timeout.tv_sec=30; timeout.tv_usec=0; - n=select(256, &sel_read, &sel_write, &sel_except, &timeout); - if(!n) { - printf("\nServer timed out\n\n"); - exit(1); - } - if(n<1) err("select"); - - for(i=0; i=requests) output_results(); - } - return 0; -} - -/* ------------------------------------------------------- */ - -/* display usage information */ - -void usage(char *progname) { - printf("\nZeusBench v1.0\n\n"); - printf("Usage: %s [-k] [-n requests | -t timelimit (sec)]" - "\n\t\t[-c concurrency] [-p port] \n",progname); - printf("Filename should start with a '/' e.g. /index.html\n\n"); - exit(EINVAL); -} - -/* ------------------------------------------------------- */ - -/* sort out command-line args and call test */ - -int main(int argc, char **argv) { - int c; - if (argc < 3) usage(argv[0]); - - machine = argv[1]; - file = argv[2]; - optind = 3; - while ((c = getopt(argc,argv,"p:n:c:d:t:d:k"))>0) { - switch(c) { - case 'd': - break; - case 'n': - requests = atoi(optarg); - if(!requests) { - printf("Invalid number of requests\n"); - exit(1); - } - break; - case 'k': - keepalive=1; - break; - case 'c': - concurrency = atoi(optarg); - break; - case 'p': - port = atoi(optarg); - break; - case 't': - tlimit = atoi(optarg); - requests = MAX_REQUESTS; /* need to size data array on something */ - break; - default: - usage(argv[0]); - break; - } - } - test(); - return 0; -} - - - - - -